Commit | Line | Data |
---|---|---|
a6ffc6a2 JB |
1 | # Set up something to print out s-expressions. |
2 | define pr | |
3 | set Fprin1 ($, Qexternal_debugging_output) | |
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 | ||
11 | define xtype | |
12 | print (enum Lisp_Type) (($ >> 24) & 0x7f) | |
13 | p $$ | |
14 | end | |
e065a56e JB |
15 | document xtype |
16 | Print the type of $, assuming it is an Elisp value. | |
17 | end | |
a6ffc6a2 JB |
18 | |
19 | define xint | |
20 | print (($ & 0x00ffffff) << 8) >> 8 | |
21 | end | |
e065a56e JB |
22 | document xint |
23 | Print $, assuming it is an Elisp integer. This gets the sign right. | |
24 | end | |
a6ffc6a2 JB |
25 | |
26 | define xptr | |
27 | print (void *) ($ & 0x00ffffff) | |
28 | end | |
e065a56e JB |
29 | document xptr |
30 | Print the pointer portion of $, assuming it is an Elisp value. | |
31 | end | |
a6ffc6a2 JB |
32 | |
33 | define xwindow | |
34 | print (struct window *) ($ & 0x00ffffff) | |
35 | end | |
e065a56e JB |
36 | document xwindow |
37 | Print $ as a window pointer, assuming it is an Elisp window value. | |
38 | end | |
a6ffc6a2 JB |
39 | |
40 | define xmarker | |
41 | print (struct Lisp_Marker *) ($ & 0x00ffffff) | |
42 | end | |
e065a56e JB |
43 | document xmarker |
44 | Print $ as a marker pointer, assuming it is an Elisp marker value. | |
45 | end | |
a6ffc6a2 JB |
46 | |
47 | define xbuffer | |
48 | print (struct buffer *) ($ & 0x00ffffff) | |
49 | end | |
e065a56e JB |
50 | document xbuffer |
51 | Print $ as a buffer pointer, assuming it is an Elisp buffer value. | |
52 | end | |
a6ffc6a2 JB |
53 | |
54 | define xsymbol | |
55 | print (struct Lisp_Symbol *) ($ & 0x00ffffff) | |
56 | print &$->name->data | |
57 | print $$ | |
58 | end | |
e065a56e JB |
59 | document xsymbol |
60 | Print the name and address of the symbol $. | |
61 | This command assumes that $ is an Elisp symbol value. | |
62 | end | |
a6ffc6a2 JB |
63 | |
64 | define xstring | |
65 | print (struct Lisp_String *) ($ & 0x00ffffff) | |
e065a56e | 66 | print ($->size > 10000) ? "big string" : ($->data[0])@($->size) |
a6ffc6a2 JB |
67 | print $$ |
68 | end | |
a6ffc6a2 | 69 | document xstring |
e065a56e JB |
70 | Print the contents and address of the string $. |
71 | This command assumes that $ is an Elisp string value. | |
a6ffc6a2 JB |
72 | end |
73 | ||
74 | define xvector | |
75 | set $temp = (struct Lisp_Vector *) ($ & 0x00ffffff) | |
e065a56e | 76 | print ($temp->size > 10000) ? "big vector" : ($temp->contents[0])@($temp->size) |
a6ffc6a2 JB |
77 | print $temp |
78 | end | |
a6ffc6a2 | 79 | document xvector |
e065a56e JB |
80 | Print the contents and address of the vector $. |
81 | This command assumes that $ is an Elisp vector value. | |
a6ffc6a2 JB |
82 | end |
83 | ||
84 | define xscreen | |
85 | print (struct screen *) ($ & 0x00ffffff) | |
86 | end | |
e065a56e JB |
87 | document xwindow |
88 | Print $ as a screen pointer, assuming it is an Elisp screen value. | |
89 | end | |
a6ffc6a2 JB |
90 | |
91 | define xcons | |
92 | print (struct Lisp_Cons *) ($ & 0x00ffffff) | |
93 | print *$ | |
ffd56f97 | 94 | print $$ |
a6ffc6a2 | 95 | end |
e065a56e JB |
96 | document xcons |
97 | Print the contents of $, assuming it is an Elisp cons. | |
98 | end | |
a6ffc6a2 JB |
99 | |
100 | define xcar | |
101 | print ((($ >> 24) & 0x7f) == Lisp_Cons ? ((struct Lisp_Cons *) ($ & 0x00ffffff))->car : 0) | |
102 | end | |
e065a56e JB |
103 | document xcar |
104 | Print the car of $, assuming it is an Elisp pair. | |
105 | end | |
a6ffc6a2 JB |
106 | |
107 | define xcdr | |
108 | print ((($ >> 24) & 0x7f) == Lisp_Cons ? ((struct Lisp_Cons *) ($ & 0x00ffffff))->cdr : 0) | |
109 | end | |
e065a56e JB |
110 | document xcdr |
111 | Print the cdr of $, assuming it is an Elisp pair. | |
112 | end | |
a6ffc6a2 | 113 | |
e065a56e | 114 | set print pretty on |
a6ffc6a2 JB |
115 | |
116 | # Don't let abort actually run, as it will make | |
117 | # stdio stop working and therefore the `pr' command below as well. | |
118 | break abort | |
119 | ||
120 | # If we are running in synchronous mode, we want a chance to look around | |
121 | # before Emacs exits. Perhaps we should put the break somewhere else | |
122 | # instead... | |
123 | break _XPrintDefaultError | |
124 | ||
e065a56e JB |
125 | unset environment TERMCAP |
126 | unset environment TERM | |
127 | set environment DISPLAY :0.0 | |
128 | show environment DISPLAY | |
a6ffc6a2 | 129 | set args -q |