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 |
3fe8bda5 RS |
24 | output (enum Lisp_Type) (($ >> 28) & 0x7) |
25 | echo \n | |
26 | output ((($ >> 28) & 0x7) == Lisp_Misc ? (enum Lisp_Misc_Type) (((struct Lisp_Free *) (($ & 0x0fffffff) | $data_seg_bits))->type) : (($ >> 28) & 0x7) == Lisp_Vectorlike ? ($size = ((struct Lisp_Vector *) (($ & 0x0fffffff) | $data_seg_bits))->size, (enum pvec_type) (($size & PVEC_FLAG) ? $size & PVEC_TYPE_MASK : 0)) : 0) | |
ef15f270 | 27 | echo \n |
a6ffc6a2 | 28 | end |
e065a56e | 29 | document xtype |
ba1e23bf | 30 | Print the type of $, assuming it is an Emacs Lisp value. |
3fe8bda5 RS |
31 | If the first type printed is Lisp_Vector or Lisp_Misc, |
32 | the second line gives the more precise type. | |
33 | Otherwise the second line doesn't mean anything. | |
34 | end | |
35 | ||
36 | define xvectype | |
37 | set $size = ((struct Lisp_Vector *) (($ & 0x0fffffff) | $data_seg_bits))->size | |
38 | output (enum pvec_type) (($size & PVEC_FLAG) ? $size & PVEC_TYPE_MASK : 0) | |
39 | echo \n | |
40 | end | |
41 | document xvectype | |
42 | Print the vector subtype of $, assuming it is a vector or pseudovector. | |
43 | end | |
44 | ||
45 | define xmisctype | |
46 | output (enum Lisp_Misc_Type) (((struct Lisp_Free *) (($ & 0x0fffffff) | $data_seg_bits))->type) | |
47 | echo \n | |
48 | end | |
49 | document xmisctype | |
50 | Print the specific type of $, assuming it is some misc type. | |
e065a56e | 51 | end |
a6ffc6a2 JB |
52 | |
53 | define xint | |
dcda44dd | 54 | print (($ & 0x0fffffff) << 4) >> 4 |
a6ffc6a2 | 55 | end |
e065a56e | 56 | document xint |
ba1e23bf | 57 | Print $, assuming it is an Emacs Lisp integer. This gets the sign right. |
e065a56e | 58 | end |
a6ffc6a2 JB |
59 | |
60 | define xptr | |
3fe8bda5 | 61 | print (void *) (($ & 0x0fffffff) | $data_seg_bits) |
a6ffc6a2 | 62 | end |
e065a56e | 63 | document xptr |
ba1e23bf | 64 | Print the pointer portion of $, assuming it is an Emacs Lisp value. |
e065a56e | 65 | end |
a6ffc6a2 JB |
66 | |
67 | define xwindow | |
3fe8bda5 | 68 | print (struct window *) (($ & 0x0fffffff) | $data_seg_bits) |
ef15f270 | 69 | printf "%dx%d+%d+%d\n", $->width, $->height, $->left, $->top |
a6ffc6a2 | 70 | end |
e065a56e | 71 | document xwindow |
ba1e23bf | 72 | Print $ as a window pointer, assuming it is an Emacs Lisp window value. |
ef15f270 | 73 | Print the window's position as "WIDTHxHEIGHT+LEFT+TOP". |
e065a56e | 74 | end |
a6ffc6a2 JB |
75 | |
76 | define xmarker | |
3fe8bda5 | 77 | print (struct Lisp_Marker *) (($ & 0x0fffffff) | $data_seg_bits) |
a6ffc6a2 | 78 | end |
e065a56e | 79 | document xmarker |
ba1e23bf | 80 | Print $ as a marker pointer, assuming it is an Emacs Lisp marker value. |
e065a56e | 81 | end |
a6ffc6a2 | 82 | |
a6a3acf0 KH |
83 | define xoverlay |
84 | print (struct Lisp_Overlay *) (($ & 0x0fffffff) | $data_seg_bits) | |
85 | end | |
86 | document xoverlay | |
87 | Print $ as a overlay pointer, assuming it is an Emacs Lisp overlay value. | |
88 | end | |
89 | ||
90 | define xmiscfree | |
91 | print (struct Lisp_Free *) (($ & 0x0fffffff) | $data_seg_bits) | |
92 | end | |
93 | document xmiscfree | |
94 | Print $ as a misc free-cell pointer, assuming it is an Emacs Lisp Misc value. | |
95 | end | |
96 | ||
97 | define xintfwd | |
98 | print (struct Lisp_Intfwd *) (($ & 0x0fffffff) | $data_seg_bits) | |
99 | end | |
100 | document xintfwd | |
101 | Print $ as an integer forwarding pointer, assuming it is an Emacs Lisp Misc value. | |
102 | end | |
103 | ||
104 | define xboolfwd | |
105 | print (struct Lisp_Boolfwd *) (($ & 0x0fffffff) | $data_seg_bits) | |
106 | end | |
107 | document xboolfwd | |
108 | Print $ as a boolean forwarding pointer, assuming it is an Emacs Lisp Misc value. | |
109 | end | |
110 | ||
111 | define xobjfwd | |
112 | print (struct Lisp_Objfwd *) (($ & 0x0fffffff) | $data_seg_bits) | |
113 | end | |
114 | document xobjfwd | |
115 | Print $ as an object forwarding pointer, assuming it is an Emacs Lisp Misc value. | |
116 | end | |
117 | ||
029c56f6 | 118 | define xbufobjfwd |
a6a3acf0 KH |
119 | print (struct Lisp_Buffer_Objfwd *) (($ & 0x0fffffff) | $data_seg_bits) |
120 | end | |
029c56f6 | 121 | document xbufobjfwd |
a6a3acf0 KH |
122 | Print $ as a buffer-local object forwarding pointer, assuming it is an Emacs Lisp Misc value. |
123 | end | |
124 | ||
cd39e946 KH |
125 | define xdispobjfwd |
126 | print (struct Lisp_Display_Objfwd *) (($ & 0x0fffffff) | $data_seg_bits) | |
127 | end | |
128 | document xdispobjfwd | |
129 | Print $ as a display-local object forwarding pointer, assuming it is an Emacs Lisp Misc value. | |
130 | end | |
131 | ||
029c56f6 | 132 | define xbuflocal |
a6a3acf0 KH |
133 | print (struct Lisp_Buffer_Local_Value *) (($ & 0x0fffffff) | $data_seg_bits) |
134 | end | |
029c56f6 | 135 | document xbuflocal |
a6a3acf0 KH |
136 | Print $ as a buffer-local-value pointer, assuming it is an Emacs Lisp Misc value. |
137 | end | |
138 | ||
a6ffc6a2 | 139 | define xbuffer |
3fe8bda5 RS |
140 | print (struct buffer *) (($ & 0x0fffffff) | $data_seg_bits) |
141 | output &((struct Lisp_String *) ((($->name) & 0x0fffffff) | $data_seg_bits))->data | |
ef15f270 | 142 | echo \n |
a6ffc6a2 | 143 | end |
e065a56e | 144 | document xbuffer |
ba1e23bf | 145 | Set $ as a buffer pointer, assuming it is an Emacs Lisp buffer value. |
daa37602 | 146 | Print the name of the buffer. |
e065a56e | 147 | end |
a6ffc6a2 JB |
148 | |
149 | define xsymbol | |
3fe8bda5 | 150 | print (struct Lisp_Symbol *) ((((int) $) & 0x0fffffff) | $data_seg_bits) |
ef15f270 JB |
151 | output &$->name->data |
152 | echo \n | |
a6ffc6a2 | 153 | end |
e065a56e JB |
154 | document xsymbol |
155 | Print the name and address of the symbol $. | |
ba1e23bf | 156 | This command assumes that $ is an Emacs Lisp symbol value. |
e065a56e | 157 | end |
a6ffc6a2 JB |
158 | |
159 | define xstring | |
3fe8bda5 | 160 | print (struct Lisp_String *) (($ & 0x0fffffff) | $data_seg_bits) |
4ea0847a | 161 | output ($->size > 1000) ? 0 : ($->data[0])@($->size) |
ef15f270 | 162 | echo \n |
a6ffc6a2 | 163 | end |
a6ffc6a2 | 164 | document xstring |
e065a56e | 165 | Print the contents and address of the string $. |
ba1e23bf | 166 | This command assumes that $ is an Emacs Lisp string value. |
a6ffc6a2 JB |
167 | end |
168 | ||
169 | define xvector | |
3fe8bda5 | 170 | print (struct Lisp_Vector *) (($ & 0x0fffffff) | $data_seg_bits) |
4ea0847a | 171 | output ($->size > 50) ? 0 : ($->contents[0])@($->size) |
ef15f270 | 172 | echo \n |
a6ffc6a2 | 173 | end |
a6ffc6a2 | 174 | document xvector |
e065a56e | 175 | Print the contents and address of the vector $. |
ba1e23bf | 176 | This command assumes that $ is an Emacs Lisp vector value. |
a6ffc6a2 JB |
177 | end |
178 | ||
ec558adc | 179 | define xframe |
3fe8bda5 | 180 | print (struct frame *) (($ & 0x0fffffff) | $data_seg_bits) |
a6ffc6a2 | 181 | end |
ec558adc | 182 | document xframe |
ba1e23bf | 183 | Print $ as a frame pointer, assuming it is an Emacs Lisp frame value. |
e065a56e | 184 | end |
a6ffc6a2 | 185 | |
029c56f6 | 186 | define xwinconfig |
a6a3acf0 KH |
187 | print (struct save_window_data *) (($ & 0x0fffffff) | $data_seg_bits) |
188 | end | |
029c56f6 | 189 | document xwinconfig |
a6a3acf0 KH |
190 | Print $ as a window configuration pointer, assuming it is an Emacs Lisp window configuration value. |
191 | end | |
192 | ||
193 | define xcompiled | |
194 | print (struct Lisp_Vector *) (($ & 0x0fffffff) | $data_seg_bits) | |
195 | output ($->contents[0])@($->size & 0xff) | |
196 | end | |
197 | document xcompiled | |
198 | Print $ as a compiled function pointer, assuming it is an Emacs Lisp compiled value. | |
199 | end | |
200 | ||
a6ffc6a2 | 201 | define xcons |
3fe8bda5 | 202 | print (struct Lisp_Cons *) (($ & 0x0fffffff) | $data_seg_bits) |
cac29370 | 203 | output *$ |
ef15f270 | 204 | echo \n |
a6ffc6a2 | 205 | end |
e065a56e | 206 | document xcons |
ba1e23bf | 207 | Print the contents of $, assuming it is an Emacs Lisp cons. |
e065a56e | 208 | end |
a6ffc6a2 JB |
209 | |
210 | define xcar | |
6a044d86 | 211 | print ((($ >> 28) & 0xf) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & 0x0fffffff) | $data_seg_bits))->car : 0) |
a6ffc6a2 | 212 | end |
e065a56e | 213 | document xcar |
ba1e23bf | 214 | Print the car of $, assuming it is an Emacs Lisp pair. |
e065a56e | 215 | end |
a6ffc6a2 JB |
216 | |
217 | define xcdr | |
6a044d86 | 218 | print ((($ >> 28) & 0xf) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & 0x0fffffff) | $data_seg_bits))->cdr : 0) |
a6ffc6a2 | 219 | end |
e065a56e | 220 | document xcdr |
ba1e23bf | 221 | Print the cdr of $, assuming it is an Emacs Lisp pair. |
e065a56e | 222 | end |
a6ffc6a2 | 223 | |
ec558adc | 224 | define xsubr |
3fe8bda5 | 225 | print (struct Lisp_Subr *) (($ & 0x0fffffff) | $data_seg_bits) |
ec558adc JB |
226 | output *$ |
227 | echo \n | |
228 | end | |
229 | document xsubr | |
230 | Print the address of the subr which the Lisp_Object $ points to. | |
231 | end | |
232 | ||
8dd926ca | 233 | define xprocess |
3fe8bda5 | 234 | print (struct Lisp_Process *) (($ & 0x0fffffff) | $data_seg_bits) |
8dd926ca JB |
235 | output *$ |
236 | echo \n | |
237 | end | |
238 | document xprocess | |
239 | Print the address of the struct Lisp_process which the Lisp_Object $ points to. | |
240 | end | |
241 | ||
df86e57e | 242 | define xfloat |
3fe8bda5 | 243 | print ((struct Lisp_Float *) (($ & 0x0fffffff) | $data_seg_bits))->data |
df86e57e JB |
244 | end |
245 | document xfloat | |
246 | Print $ assuming it is a lisp floating-point number. | |
247 | end | |
248 | ||
b2367490 | 249 | define xscrollbar |
3fe8bda5 | 250 | print (struct scrollbar *) (($ & 0x0fffffff) | $data_seg_bits) |
b2367490 JB |
251 | output *$ |
252 | echo \n | |
253 | end | |
dec5f4e3 | 254 | document xscrollbar |
b2367490 JB |
255 | Print $ as a scrollbar pointer. |
256 | end | |
257 | ||
e065a56e | 258 | set print pretty on |
df86e57e | 259 | set print sevenbit-strings |
a6ffc6a2 | 260 | |
e5d77022 | 261 | show environment DISPLAY |
6f5d1a4f | 262 | show environment TERM |
6f5d1a4f | 263 | set args -geometry 80x40+0+0 |
e5d77022 | 264 | |
a6ffc6a2 | 265 | # Don't let abort actually run, as it will make |
7f692070 | 266 | # stdio stop working and therefore the `pr' command above as well. |
a6ffc6a2 JB |
267 | break abort |
268 | ||
269 | # If we are running in synchronous mode, we want a chance to look around | |
270 | # before Emacs exits. Perhaps we should put the break somewhere else | |
271 | # instead... | |
998ee976 RS |
272 | break x_error_quitter |
273 | ||
a6ffc6a2 | 274 |