Commit | Line | Data |
---|---|---|
a6ffc6a2 JB |
1 | # Set up something to print out s-expressions. |
2 | define pr | |
36fa5981 | 3 | set debug_print ($) |
a6ffc6a2 JB |
4 | echo \n |
5 | end | |
a6ffc6a2 JB |
6 | document pr |
7 | Print the emacs s-expression which is $. | |
8 | Works only when an inferior emacs is executing. | |
9 | end | |
10 | ||
ec558adc JB |
11 | # Set this to the same thing as the DATA_SEG_BITS macro in your |
12 | # machine-description files. | |
13 | set $data_seg_bits = 0 | |
14 | ||
45c18993 JB |
15 | define mips |
16 | set $data_seg_bits = 0x10000000 | |
17 | end | |
18 | document mips | |
19 | Set up the xfoo macros to deal with the MIPS processor. | |
20 | Specifically, this sets $data_seg_bits to the right thing. | |
21 | end | |
22 | ||
a6ffc6a2 | 23 | define xtype |
ef15f270 JB |
24 | output (enum Lisp_Type) (($ >> 24) & 0x7f) |
25 | echo \n | |
a6ffc6a2 | 26 | end |
e065a56e JB |
27 | document xtype |
28 | Print the type of $, assuming it is an Elisp value. | |
29 | end | |
a6ffc6a2 JB |
30 | |
31 | define xint | |
32 | print (($ & 0x00ffffff) << 8) >> 8 | |
33 | end | |
e065a56e JB |
34 | document xint |
35 | Print $, assuming it is an Elisp integer. This gets the sign right. | |
36 | end | |
a6ffc6a2 JB |
37 | |
38 | define xptr | |
ec558adc | 39 | print (void *) (($ & 0x00ffffff) | $data_seg_bits) |
a6ffc6a2 | 40 | end |
e065a56e JB |
41 | document xptr |
42 | Print the pointer portion of $, assuming it is an Elisp value. | |
43 | end | |
a6ffc6a2 JB |
44 | |
45 | define xwindow | |
ec558adc | 46 | print (struct window *) (($ & 0x00ffffff) | $data_seg_bits) |
ef15f270 | 47 | printf "%dx%d+%d+%d\n", $->width, $->height, $->left, $->top |
a6ffc6a2 | 48 | end |
e065a56e JB |
49 | document xwindow |
50 | Print $ as a window pointer, assuming it is an Elisp window value. | |
ef15f270 | 51 | Print the window's position as "WIDTHxHEIGHT+LEFT+TOP". |
e065a56e | 52 | end |
a6ffc6a2 JB |
53 | |
54 | define xmarker | |
ec558adc | 55 | print (struct Lisp_Marker *) (($ & 0x00ffffff) | $data_seg_bits) |
a6ffc6a2 | 56 | end |
e065a56e JB |
57 | document xmarker |
58 | Print $ as a marker pointer, assuming it is an Elisp marker value. | |
59 | end | |
a6ffc6a2 JB |
60 | |
61 | define xbuffer | |
ec558adc JB |
62 | print (struct buffer *) (($ & 0x00ffffff) | $data_seg_bits) |
63 | output &((struct Lisp_String *) ((($->name) & 0x00ffffff) | $data_seg_bits))->data | |
ef15f270 | 64 | echo \n |
a6ffc6a2 | 65 | end |
e065a56e | 66 | document xbuffer |
daa37602 JB |
67 | Set $ as a buffer pointer, assuming it is an Elisp buffer value. |
68 | Print the name of the buffer. | |
e065a56e | 69 | end |
a6ffc6a2 JB |
70 | |
71 | define xsymbol | |
ec558adc | 72 | print (struct Lisp_Symbol *) (($ & 0x00ffffff) | $data_seg_bits) |
ef15f270 JB |
73 | output &$->name->data |
74 | echo \n | |
a6ffc6a2 | 75 | end |
e065a56e JB |
76 | document xsymbol |
77 | Print the name and address of the symbol $. | |
78 | This command assumes that $ is an Elisp symbol value. | |
79 | end | |
a6ffc6a2 JB |
80 | |
81 | define xstring | |
ec558adc | 82 | print (struct Lisp_String *) (($ & 0x00ffffff) | $data_seg_bits) |
ef15f270 JB |
83 | output ($->size > 10000) ? "big string" : ($->data[0])@($->size) |
84 | echo \n | |
a6ffc6a2 | 85 | end |
a6ffc6a2 | 86 | document xstring |
e065a56e JB |
87 | Print the contents and address of the string $. |
88 | This command assumes that $ is an Elisp string value. | |
a6ffc6a2 JB |
89 | end |
90 | ||
91 | define xvector | |
ec558adc | 92 | print (struct Lisp_Vector *) (($ & 0x00ffffff) | $data_seg_bits) |
ef15f270 JB |
93 | output ($->size > 1000) ? "big vector" : ($->contents[0])@($->size) |
94 | echo \n | |
a6ffc6a2 | 95 | end |
a6ffc6a2 | 96 | document xvector |
e065a56e JB |
97 | Print the contents and address of the vector $. |
98 | This command assumes that $ is an Elisp vector value. | |
a6ffc6a2 JB |
99 | end |
100 | ||
ec558adc JB |
101 | define xframe |
102 | print (struct frame *) (($ & 0x00ffffff) | $data_seg_bits) | |
a6ffc6a2 | 103 | end |
ec558adc JB |
104 | document xframe |
105 | Print $ as a frame pointer, assuming it is an Elisp frame value. | |
e065a56e | 106 | end |
a6ffc6a2 JB |
107 | |
108 | define xcons | |
ec558adc | 109 | print (struct Lisp_Cons *) (($ & 0x00ffffff) | $data_seg_bits) |
cac29370 | 110 | output *$ |
ef15f270 | 111 | echo \n |
a6ffc6a2 | 112 | end |
e065a56e JB |
113 | document xcons |
114 | Print the contents of $, assuming it is an Elisp cons. | |
115 | end | |
a6ffc6a2 JB |
116 | |
117 | define xcar | |
ec558adc | 118 | print ((($ >> 24) & 0x7f) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & 0x00ffffff) | $data_seg_bits))->car : 0) |
a6ffc6a2 | 119 | end |
e065a56e JB |
120 | document xcar |
121 | Print the car of $, assuming it is an Elisp pair. | |
122 | end | |
a6ffc6a2 JB |
123 | |
124 | define xcdr | |
ec558adc | 125 | print ((($ >> 24) & 0x7f) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & 0x00ffffff) | $data_seg_bits))->cdr : 0) |
a6ffc6a2 | 126 | end |
e065a56e JB |
127 | document xcdr |
128 | Print the cdr of $, assuming it is an Elisp pair. | |
129 | end | |
a6ffc6a2 | 130 | |
ec558adc JB |
131 | define xsubr |
132 | print (struct Lisp_Subr *) (($ & 0x00ffffff) | $data_seg_bits) | |
133 | output *$ | |
134 | echo \n | |
135 | end | |
136 | document xsubr | |
137 | Print the address of the subr which the Lisp_Object $ points to. | |
138 | end | |
139 | ||
8dd926ca JB |
140 | define xprocess |
141 | print (struct Lisp_Process *) (($ & 0x00ffffff) | $data_seg_bits) | |
142 | output *$ | |
143 | echo \n | |
144 | end | |
145 | document xprocess | |
146 | Print the address of the struct Lisp_process which the Lisp_Object $ points to. | |
147 | end | |
148 | ||
df86e57e JB |
149 | define xfloat |
150 | print ((struct Lisp_Float *) (($ & 0x00ffffff) | $data_seg_bits))->data | |
151 | end | |
152 | document xfloat | |
153 | Print $ assuming it is a lisp floating-point number. | |
154 | end | |
155 | ||
b2367490 JB |
156 | define xscrollbar |
157 | print (struct scrollbar *) (($ & 0x00ffffff) | $data_seg_bits) | |
158 | output *$ | |
159 | echo \n | |
160 | end | |
dec5f4e3 | 161 | document xscrollbar |
b2367490 JB |
162 | Print $ as a scrollbar pointer. |
163 | end | |
164 | ||
e065a56e | 165 | set print pretty on |
df86e57e | 166 | set print sevenbit-strings |
a6ffc6a2 | 167 | |
e5d77022 | 168 | show environment DISPLAY |
6f5d1a4f | 169 | show environment TERM |
6f5d1a4f | 170 | set args -geometry 80x40+0+0 |
e5d77022 | 171 | |
a6ffc6a2 | 172 | # Don't let abort actually run, as it will make |
7f692070 | 173 | # stdio stop working and therefore the `pr' command above as well. |
a6ffc6a2 JB |
174 | break abort |
175 | ||
176 | # If we are running in synchronous mode, we want a chance to look around | |
177 | # before Emacs exits. Perhaps we should put the break somewhere else | |
178 | # instead... | |
179 | break _XPrintDefaultError | |
180 |