aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/.gdbinit208
-rw-r--r--src/.gdbinit-union402
-rw-r--r--src/ChangeLog45
-rw-r--r--src/callint.c22
-rw-r--r--src/data.c46
-rw-r--r--src/editfns.c2
-rw-r--r--src/emacs.c13
-rw-r--r--src/eval.c10
-rw-r--r--src/lisp.h1
-rw-r--r--src/xterm.c57
10 files changed, 282 insertions, 524 deletions
diff --git a/src/.gdbinit b/src/.gdbinit
index 145f4f4df87..1b141a42064 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -1,4 +1,4 @@
1# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001 1# Copyright (C) 1992, 93, 94, 95, 96, 97, 1998, 2000, 01, 2004
2# Free Software Foundation, Inc. 2# Free Software Foundation, Inc.
3# 3#
4# This file is part of GNU Emacs. 4# This file is part of GNU Emacs.
@@ -38,12 +38,22 @@ handle SIGALRM ignore
38# Set up a mask to use. 38# Set up a mask to use.
39# This should be EMACS_INT, but in some cases that is a macro. 39# This should be EMACS_INT, but in some cases that is a macro.
40# long ought to work in all cases right now. 40# long ought to work in all cases right now.
41set $valmask = ((long)1 << gdb_valbits) - 1 41
42set $nonvalbits = gdb_emacs_intbits - gdb_valbits 42define xgetptr
43 set $ptr = (gdb_use_union ? $arg0.u.val : $arg0 & $valmask) | gdb_data_seg_bits
44end
45
46define xgetint
47 set $int = gdb_use_union ? $arg0.s.val : (gdb_use_lsb ? $arg0 : $arg0 << gdb_gctypebits) >> gdb_gctypebits
48end
49
50define xgettype
51 set $type = gdb_use_union ? $arg0.s.type : (enum Lisp_Type) (gdb_use_lsb ? $arg0 & $tagmask : $arg0 >> gdb_valbits)
52end
43 53
44# Set up something to print out s-expressions. 54# Set up something to print out s-expressions.
45define pr 55define pr
46set debug_print ($) 56 set debug_print ($)
47end 57end
48document pr 58document pr
49Print the emacs s-expression which is $. 59Print the emacs s-expression which is $.
@@ -51,115 +61,135 @@ Works only when an inferior emacs is executing.
51end 61end
52 62
53define xtype 63define xtype
54output (enum Lisp_Type) (($ >> gdb_valbits) & 0x7) 64 xgettype $
55echo \n 65 output $type
56output ((($ >> gdb_valbits) & 0x7) == Lisp_Misc ? (enum Lisp_Misc_Type) (((struct Lisp_Free *) (($ & $valmask) | gdb_data_seg_bits))->type) : (($ >> gdb_valbits) & 0x7) == Lisp_Vectorlike ? ($size = ((struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits))->size, (enum pvec_type) (($size & PVEC_FLAG) ? $size & PVEC_TYPE_MASK : 0)) : 0) 66 echo \n
57echo \n 67 if $type == Lisp_Misc
68 xmisctype
69 else
70 if $type == Lisp_Vectorlike
71 xvectype
72 end
73 end
58end 74end
59document xtype 75document xtype
60Print the type of $, assuming it is an Emacs Lisp value. 76Print the type of $, assuming it is an Emacs Lisp value.
61If the first type printed is Lisp_Vector or Lisp_Misc, 77If the first type printed is Lisp_Vector or Lisp_Misc,
62the second line gives the more precise type. 78a second line gives the more precise type.
63Otherwise the second line doesn't mean anything.
64end 79end
65 80
66define xvectype 81define xvectype
67set $size = ((struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits))->size 82 xgetptr $
68output (enum pvec_type) (($size & PVEC_FLAG) ? $size & PVEC_TYPE_MASK : 0) 83 set $size = ((struct Lisp_Vector *) $ptr)->size
69echo \n 84 output ($size & PVEC_FLAG) ? (enum pvec_type) ($size & PVEC_TYPE_MASK) : $size
85 echo \n
70end 86end
71document xvectype 87document xvectype
72Print the vector subtype of $, assuming it is a vector or pseudovector. 88Print the size or vector subtype of $, assuming it is a vector or pseudovector.
73end 89end
74 90
75define xmisctype 91define xmisctype
76output (enum Lisp_Misc_Type) (((struct Lisp_Free *) (($ & $valmask) | gdb_data_seg_bits))->type) 92 xgetptr $
77echo \n 93 output (enum Lisp_Misc_Type) (((struct Lisp_Free *) $ptr)->type)
94 echo \n
78end 95end
79document xmisctype 96document xmisctype
80Print the specific type of $, assuming it is some misc type. 97Print the specific type of $, assuming it is some misc type.
81end 98end
82 99
83define xint 100define xint
84print (($ & $valmask) << $nonvalbits) >> $nonvalbits 101 xgetint $
102 print $int
85end 103end
86document xint 104document xint
87Print $, assuming it is an Emacs Lisp integer. This gets the sign right. 105Print $, assuming it is an Emacs Lisp integer. This gets the sign right.
88end 106end
89 107
90define xptr 108define xptr
91print (void *) (($ & $valmask) | gdb_data_seg_bits) 109 xgetptr $
110 print (void *) $ptr
92end 111end
93document xptr 112document xptr
94Print the pointer portion of $, assuming it is an Emacs Lisp value. 113Print the pointer portion of $, assuming it is an Emacs Lisp value.
95end 114end
96 115
97define xmarker 116define xmarker
98print (struct Lisp_Marker *) (($ & $valmask) | gdb_data_seg_bits) 117 xgetptr $
118 print (struct Lisp_Marker *) $ptr
99end 119end
100document xmarker 120document xmarker
101Print $ as a marker pointer, assuming it is an Emacs Lisp marker value. 121Print $ as a marker pointer, assuming it is an Emacs Lisp marker value.
102end 122end
103 123
104define xoverlay 124define xoverlay
105print (struct Lisp_Overlay *) (($ & $valmask) | gdb_data_seg_bits) 125 xgetptr $
126 print (struct Lisp_Overlay *) $ptr
106end 127end
107document xoverlay 128document xoverlay
108Print $ as a overlay pointer, assuming it is an Emacs Lisp overlay value. 129Print $ as a overlay pointer, assuming it is an Emacs Lisp overlay value.
109end 130end
110 131
111define xmiscfree 132define xmiscfree
112print (struct Lisp_Free *) (($ & $valmask) | gdb_data_seg_bits) 133 xgetptr $
134 print (struct Lisp_Free *) $ptr
113end 135end
114document xmiscfree 136document xmiscfree
115Print $ as a misc free-cell pointer, assuming it is an Emacs Lisp Misc value. 137Print $ as a misc free-cell pointer, assuming it is an Emacs Lisp Misc value.
116end 138end
117 139
118define xintfwd 140define xintfwd
119print (struct Lisp_Intfwd *) (($ & $valmask) | gdb_data_seg_bits) 141 xgetptr $
142 print (struct Lisp_Intfwd *) $ptr
120end 143end
121document xintfwd 144document xintfwd
122Print $ as an integer forwarding pointer, assuming it is an Emacs Lisp Misc value. 145Print $ as an integer forwarding pointer, assuming it is an Emacs Lisp Misc value.
123end 146end
124 147
125define xboolfwd 148define xboolfwd
126print (struct Lisp_Boolfwd *) (($ & $valmask) | gdb_data_seg_bits) 149 xgetptr $
150 print (struct Lisp_Boolfwd *) $ptr
127end 151end
128document xboolfwd 152document xboolfwd
129Print $ as a boolean forwarding pointer, assuming it is an Emacs Lisp Misc value. 153Print $ as a boolean forwarding pointer, assuming it is an Emacs Lisp Misc value.
130end 154end
131 155
132define xobjfwd 156define xobjfwd
133print (struct Lisp_Objfwd *) (($ & $valmask) | gdb_data_seg_bits) 157 xgetptr $
158 print (struct Lisp_Objfwd *) $ptr
134end 159end
135document xobjfwd 160document xobjfwd
136Print $ as an object forwarding pointer, assuming it is an Emacs Lisp Misc value. 161Print $ as an object forwarding pointer, assuming it is an Emacs Lisp Misc value.
137end 162end
138 163
139define xbufobjfwd 164define xbufobjfwd
140print (struct Lisp_Buffer_Objfwd *) (($ & $valmask) | gdb_data_seg_bits) 165 xgetptr $
166 print (struct Lisp_Buffer_Objfwd *) $ptr
141end 167end
142document xbufobjfwd 168document xbufobjfwd
143Print $ as a buffer-local object forwarding pointer, assuming it is an Emacs Lisp Misc value. 169Print $ as a buffer-local object forwarding pointer, assuming it is an Emacs Lisp Misc value.
144end 170end
145 171
146define xkbobjfwd 172define xkbobjfwd
147print (struct Lisp_Kboard_Objfwd *) (($ & $valmask) | gdb_data_seg_bits) 173 xgetptr $
174 print (struct Lisp_Kboard_Objfwd *) $ptr
148end 175end
149document xkbobjfwd 176document xkbobjfwd
150Print $ as a kboard-local object forwarding pointer, assuming it is an Emacs Lisp Misc value. 177Print $ as a kboard-local object forwarding pointer, assuming it is an Emacs Lisp Misc value.
151end 178end
152 179
153define xbuflocal 180define xbuflocal
154print (struct Lisp_Buffer_Local_Value *) (($ & $valmask) | gdb_data_seg_bits) 181 xgetptr $
182 print (struct Lisp_Buffer_Local_Value *) $ptr
155end 183end
156document xbuflocal 184document xbuflocal
157Print $ as a buffer-local-value pointer, assuming it is an Emacs Lisp Misc value. 185Print $ as a buffer-local-value pointer, assuming it is an Emacs Lisp Misc value.
158end 186end
159 187
160define xsymbol 188define xsymbol
161print (struct Lisp_Symbol *) ((((int) $) & $valmask) | gdb_data_seg_bits) 189 xgetptr $
162xprintsym $ 190 print (struct Lisp_Symbol *) $ptr
191 xprintsym $
192 echo \n
163end 193end
164document xsymbol 194document xsymbol
165Print the name and address of the symbol $. 195Print the name and address of the symbol $.
@@ -167,9 +197,10 @@ This command assumes that $ is an Emacs Lisp symbol value.
167end 197end
168 198
169define xstring 199define xstring
170print (struct Lisp_String *) (($ & $valmask) | gdb_data_seg_bits) 200 xgetptr $
171output ($->size > 1000) ? 0 : ($->data[0])@($->size_byte < 0 ? $->size : $->size_byte) 201 print (struct Lisp_String *) $ptr
172echo \n 202 output ($->size > 1000) ? 0 : ($->data[0])@($->size_byte < 0 ? $->size : $->size_byte)
203 echo \n
173end 204end
174document xstring 205document xstring
175Print the contents and address of the string $. 206Print the contents and address of the string $.
@@ -177,8 +208,9 @@ This command assumes that $ is an Emacs Lisp string value.
177end 208end
178 209
179define xvector 210define xvector
180print (struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits) 211 xgetptr $
181output ($->size > 50) ? 0 : ($->contents[0])@($->size) 212 print (struct Lisp_Vector *) $ptr
213 output ($->size > 50) ? 0 : ($->contents[0])@($->size)
182echo \n 214echo \n
183end 215end
184document xvector 216document xvector
@@ -187,32 +219,36 @@ This command assumes that $ is an Emacs Lisp vector value.
187end 219end
188 220
189define xprocess 221define xprocess
190print (struct Lisp_Process *) (($ & $valmask) | gdb_data_seg_bits) 222 xgetptr $
191output *$ 223 print (struct Lisp_Process *) $ptr
192echo \n 224 output *$
225 echo \n
193end 226end
194document xprocess 227document xprocess
195Print the address of the struct Lisp_process which the Lisp_Object $ points to. 228Print the address of the struct Lisp_process which the Lisp_Object $ points to.
196end 229end
197 230
198define xframe 231define xframe
199print (struct frame *) (($ & $valmask) | gdb_data_seg_bits) 232 xgetptr $
233 print (struct frame *) $ptr
200end 234end
201document xframe 235document xframe
202Print $ as a frame pointer, assuming it is an Emacs Lisp frame value. 236Print $ as a frame pointer, assuming it is an Emacs Lisp frame value.
203end 237end
204 238
205define xcompiled 239define xcompiled
206print (struct Lisp_Vector *) (($ & $valmask) | gdb_data_seg_bits) 240 xgetptr $
207output ($->contents[0])@($->size & 0xff) 241 print (struct Lisp_Vector *) $ptr
242 output ($->contents[0])@($->size & 0xff)
208end 243end
209document xcompiled 244document xcompiled
210Print $ as a compiled function pointer, assuming it is an Emacs Lisp compiled value. 245Print $ as a compiled function pointer, assuming it is an Emacs Lisp compiled value.
211end 246end
212 247
213define xwindow 248define xwindow
214print (struct window *) (($ & $valmask) | gdb_data_seg_bits) 249 xgetptr $
215printf "%dx%d+%d+%d\n", $->width, $->height, $->left, $->top 250 print (struct window *) $ptr
251 printf "%dx%d+%d+%d\n", $->width, $->height, $->left, $->top
216end 252end
217document xwindow 253document xwindow
218Print $ as a window pointer, assuming it is an Emacs Lisp window value. 254Print $ as a window pointer, assuming it is an Emacs Lisp window value.
@@ -220,27 +256,30 @@ Print the window's position as "WIDTHxHEIGHT+LEFT+TOP".
220end 256end
221 257
222define xwinconfig 258define xwinconfig
223print (struct save_window_data *) (($ & $valmask) | gdb_data_seg_bits) 259 xgetptr $
260 print (struct save_window_data *) $ptr
224end 261end
225document xwinconfig 262document xwinconfig
226Print $ as a window configuration pointer, assuming it is an Emacs Lisp window configuration value. 263Print $ as a window configuration pointer, assuming it is an Emacs Lisp window configuration value.
227end 264end
228 265
229define xsubr 266define xsubr
230print (struct Lisp_Subr *) (($ & $valmask) | gdb_data_seg_bits) 267 xgetptr $
231output *$ 268 print (struct Lisp_Subr *) $ptr
232echo \n 269 output *$
270 echo \n
233end 271end
234document xsubr 272document xsubr
235Print the address of the subr which the Lisp_Object $ points to. 273Print the address of the subr which the Lisp_Object $ points to.
236end 274end
237 275
238define xchartable 276define xchartable
239print (struct Lisp_Char_Table *) (($ & $valmask) | gdb_data_seg_bits) 277 xgetptr $
240printf "Purpose: " 278 print (struct Lisp_Char_Table *) $ptr
241output (char*)&((struct Lisp_Symbol *) ((((int) $->purpose) & $valmask) | gdb_data_seg_bits))->name->data 279 printf "Purpose: "
242printf " %d extra slots", ($->size & 0x1ff) - 388 280 xprintsym $->purpose
243echo \n 281 printf " %d extra slots", ($->size & 0x1ff) - 388
282 echo \n
244end 283end
245document xchartable 284document xchartable
246Print the address of the char-table $, and its purpose. 285Print the address of the char-table $, and its purpose.
@@ -248,9 +287,10 @@ This command assumes that $ is an Emacs Lisp char-table value.
248end 287end
249 288
250define xboolvector 289define xboolvector
251print (struct Lisp_Bool_Vector *) (($ & $valmask) | gdb_data_seg_bits) 290 xgetptr $
252output ($->size > 256) ? 0 : ($->data[0])@(($->size + 7)/ 8) 291 print (struct Lisp_Bool_Vector *) $ptr
253echo \n 292 output ($->size > 256) ? 0 : ($->data[0])@(($->size + 7)/ 8)
293 echo \n
254end 294end
255document xboolvector 295document xboolvector
256Print the contents and address of the bool-vector $. 296Print the contents and address of the bool-vector $.
@@ -258,9 +298,11 @@ This command assumes that $ is an Emacs Lisp bool-vector value.
258end 298end
259 299
260define xbuffer 300define xbuffer
261print (struct buffer *) (($ & $valmask) | gdb_data_seg_bits) 301 xgetptr $
262output ((struct Lisp_String *) ((($->name) & $valmask) | gdb_data_seg_bits))->data 302 print (struct buffer *) $ptr
263echo \n 303 xgetptr $->name
304 output ((struct Lisp_String *) $ptr)->data
305 echo \n
264end 306end
265document xbuffer 307document xbuffer
266Set $ as a buffer pointer, assuming it is an Emacs Lisp buffer value. 308Set $ as a buffer pointer, assuming it is an Emacs Lisp buffer value.
@@ -268,24 +310,26 @@ Print the name of the buffer.
268end 310end
269 311
270define xhashtable 312define xhashtable
271print (struct Lisp_Hash_Table *) (($ & $valmask) | gdb_data_seg_bits) 313 xgetptr $
314 print (struct Lisp_Hash_Table *) $ptr
272end 315end
273document xhashtable 316document xhashtable
274Set $ as a hash table pointer, assuming it is an Emacs Lisp hash table value. 317Set $ as a hash table pointer, assuming it is an Emacs Lisp hash table value.
275end 318end
276 319
277define xcons 320define xcons
278print (struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits) 321 xgetptr $
279output/x *$ 322 print (struct Lisp_Cons *) $ptr
280echo \n 323 output/x *$
324 echo \n
281end 325end
282document xcons 326document xcons
283Print the contents of $, assuming it is an Emacs Lisp cons. 327Print the contents of $, assuming it is an Emacs Lisp cons.
284end 328end
285 329
286define nextcons 330define nextcons
287p $.cdr 331 p $.cdr
288xcons 332 xcons
289end 333end
290document nextcons 334document nextcons
291Print the contents of the next cell in a list. 335Print the contents of the next cell in a list.
@@ -293,28 +337,34 @@ This assumes that the last thing you printed was a cons cell contents
293(type struct Lisp_Cons) or a pointer to one. 337(type struct Lisp_Cons) or a pointer to one.
294end 338end
295define xcar 339define xcar
296print/x ((($ >> gdb_valbits) & 0xf) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits))->car : 0) 340 xgetptr $
341 xgettype $
342 print/x ($type == Lisp_Cons ? ((struct Lisp_Cons *) $ptr)->car : 0)
297end 343end
298document xcar 344document xcar
299Print the car of $, assuming it is an Emacs Lisp pair. 345Print the car of $, assuming it is an Emacs Lisp pair.
300end 346end
301 347
302define xcdr 348define xcdr
303print/x ((($ >> gdb_valbits) & 0xf) == Lisp_Cons ? ((struct Lisp_Cons *) (($ & $valmask) | gdb_data_seg_bits))->cdr : 0) 349 xgetptr $
350 xgettype $
351 print/x ($type == Lisp_Cons ? ((struct Lisp_Cons *) $ptr)->cdr : 0)
304end 352end
305document xcdr 353document xcdr
306Print the cdr of $, assuming it is an Emacs Lisp pair. 354Print the cdr of $, assuming it is an Emacs Lisp pair.
307end 355end
308 356
309define xfloat 357define xfloat
310print ((struct Lisp_Float *) (($ & $valmask) | gdb_data_seg_bits))->data 358 xgetptr $
359 print ((struct Lisp_Float *) $ptr)->data
311end 360end
312document xfloat 361document xfloat
313Print $ assuming it is a lisp floating-point number. 362Print $ assuming it is a lisp floating-point number.
314end 363end
315 364
316define xscrollbar 365define xscrollbar
317print (struct scrollbar *) (($ & $valmask) | gdb_data_seg_bits) 366 xgetptr $
367 print (struct scrollbar *) $ptr
318output *$ 368output *$
319echo \n 369echo \n
320end 370end
@@ -323,10 +373,11 @@ Print $ as a scrollbar pointer.
323end 373end
324 374
325define xprintsym 375define xprintsym
326 set $sym = (struct Lisp_Symbol *) ((((int) $arg0) & $valmask) | gdb_data_seg_bits) 376 xgetptr $arg0
327 set $sym_name = ((struct Lisp_String *)(($sym->xname & $valmask) | gdb_data_seg_bits)) 377 set $sym = (struct Lisp_Symbol *) $ptr
378 xgetptr $sym->xname
379 set $sym_name = (struct Lisp_String *) $ptr
328 output ($sym_name->data[0])@($sym_name->size_byte < 0 ? $sym_name->size : $sym_name->size_byte) 380 output ($sym_name->data[0])@($sym_name->size_byte < 0 ? $sym_name->size : $sym_name->size_byte)
329 echo \n
330end 381end
331document xprintsym 382document xprintsym
332 Print argument as a symbol. 383 Print argument as a symbol.
@@ -335,14 +386,16 @@ end
335define xbacktrace 386define xbacktrace
336 set $bt = backtrace_list 387 set $bt = backtrace_list
337 while $bt 388 while $bt
338 set $type = (enum Lisp_Type) ((*$bt->function >> gdb_valbits) & 0x7) 389 xgettype (*$bt->function)
339 if $type == Lisp_Symbol 390 if $type == Lisp_Symbol
340 xprintsym *$bt->function 391 xprintsym (*$bt->function)
392 echo \n
341 else 393 else
342 printf "0x%x ", *$bt->function 394 printf "0x%x ", *$bt->function
343 if $type == Lisp_Vectorlike 395 if $type == Lisp_Vectorlike
344 set $size = ((struct Lisp_Vector *) ((*$bt->function & $valmask) | gdb_data_seg_bits))->size 396 xgetptr (*$bt->function)
345 output (enum pvec_type) (($size & PVEC_FLAG) ? $size & PVEC_TYPE_MASK : 0) 397 set $size = ((struct Lisp_Vector *) $ptr)->size
398 output ($size & PVEC_FLAG) ? (enum pvec_type) ($size & PVEC_TYPE_MASK) : $size
346 else 399 else
347 printf "Lisp type %d", $type 400 printf "Lisp type %d", $type
348 end 401 end
@@ -358,16 +411,17 @@ document xbacktrace
358end 411end
359 412
360define xreload 413define xreload
361 set $valmask = ((long)1 << gdb_valbits) - 1 414 set $tagmask = (((long)1 << gdb_gctypebits) - 1)
362 set $nonvalbits = gdb_emacs_intbits - gdb_valbits 415 set $valmask = gdb_use_lsb ? ~($tagmask) : ((long)1 << gdb_valbits) - 1
363end 416end
364document xreload 417document xreload
365 When starting Emacs a second time in the same gdb session under 418 When starting Emacs a second time in the same gdb session under
366 FreeBSD 2.2.5, gdb 4.13, $valmask and $nonvalbits have lost 419 FreeBSD 2.2.5, gdb 4.13, $valmask have lost
367 their values. (The same happens on current (2000) versions of GNU/Linux 420 their values. (The same happens on current (2000) versions of GNU/Linux
368 with gdb 5.0.) 421 with gdb 5.0.)
369 This function reloads them. 422 This function reloads them.
370end 423end
424xreload
371 425
372define hook-run 426define hook-run
373 xreload 427 xreload
diff --git a/src/.gdbinit-union b/src/.gdbinit-union
deleted file mode 100644
index 1af2c0976c4..00000000000
--- a/src/.gdbinit-union
+++ /dev/null
@@ -1,402 +0,0 @@
1# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001
2# Free Software Foundation, Inc.
3#
4# This file is part of GNU Emacs.
5#
6# GNU Emacs is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2, or (at your option)
9# any later version.
10#
11# GNU Emacs is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with GNU Emacs; see the file COPYING. If not, write to the
18# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19# Boston, MA 02111-1307, USA.
20
21# Force loading of symbols, enough to give us gdb_valbits etc.
22set main
23
24# Find lwlib source files too.
25dir ../lwlib
26#dir /gd/gnu/lesstif-0.89.9/lib/Xm
27
28# Don't enter GDB when user types C-g to quit.
29# This has one unfortunate effect: you can't type C-c
30# at the GDB to stop Emacs, when using X.
31# However, C-z works just as well in that case.
32handle 2 noprint pass
33
34# Don't pass SIGALRM to Emacs. This makes problems when
35# debugging.
36handle SIGALRM ignore
37
38# Set up a mask to use.
39# This should be EMACS_INT, but in some cases that is a macro.
40# long ought to work in all cases right now.
41set $valmask = ((long)1 << gdb_valbits) - 1
42set $nonvalbits = gdb_emacs_intbits - gdb_valbits
43
44# Set up something to print out s-expressions.
45define pr
46set debug_print ($)
47end
48document pr
49Print the emacs s-expression which is $.
50Works only when an inferior emacs is executing.
51end
52
53define xtype
54output (enum Lisp_Type) (($.i >> gdb_valbits) & 0x7)
55echo \n
56output ((($.i >> gdb_valbits) & 0x7) == Lisp_Misc ? (enum Lisp_Misc_Type) (((struct Lisp_Free *) (($.i & $valmask) | gdb_data_seg_bits))->type) : (($.i >> gdb_valbits) & 0x7) == Lisp_Vectorlike ? ($size = ((struct Lisp_Vector *) (($.i & $valmask) | gdb_data_seg_bits))->size, (enum pvec_type) (($size & PVEC_FLAG) ? $size & PVEC_TYPE_MASK : 0)) : 0)
57echo \n
58end
59document xtype
60Print the type of $, assuming it is an Emacs Lisp value.
61If the first type printed is Lisp_Vector or Lisp_Misc,
62the second line gives the more precise type.
63Otherwise the second line doesn't mean anything.
64end
65
66define xvectype
67 set $size = ((struct Lisp_Vector *) (($.i & $valmask) | gdb_data_seg_bits))->size
68 output (enum pvec_type) (($size & PVEC_FLAG) ? $size & PVEC_TYPE_MASK : 0)
69 echo \n
70end
71document xvectype
72 Print the vector subtype of $, assuming it is a vector or pseudovector.
73end
74
75define xmisctype
76 output (enum Lisp_Misc_Type) (((struct Lisp_Free *) (($.i & $valmask) | gdb_data_seg_bits))->type)
77 echo \n
78end
79document xmisctype
80 Print the specific type of $, assuming it is some misc type.
81end
82
83define xint
84 print (($.i & $valmask) << $nonvalbits) >> $nonvalbits
85end
86document xint
87 Print $, assuming it is an Emacs Lisp integer. This gets the sign right.
88end
89
90define xptr
91 print (void *) (($.i & $valmask) | gdb_data_seg_bits)
92end
93document xptr
94 Print the pointer portion of $, assuming it is an Emacs Lisp value.
95end
96
97define xmarker
98 print (struct Lisp_Marker *) (($.i & $valmask) | gdb_data_seg_bits)
99end
100document xmarker
101 Print $ as a marker pointer, assuming it is an Emacs Lisp marker value.
102end
103
104define xoverlay
105 print (struct Lisp_Overlay *) (($.i & $valmask) | gdb_data_seg_bits)
106end
107document xoverlay
108 Print $ as a overlay pointer, assuming it is an Emacs Lisp overlay value.
109end
110
111define xmiscfree
112 print (struct Lisp_Free *) (($.i & $valmask) | gdb_data_seg_bits)
113end
114document xmiscfree
115 Print $ as a misc free-cell pointer, assuming it is an Emacs Lisp Misc value.
116end
117
118define xintfwd
119 print (struct Lisp_Intfwd *) (($.i & $valmask) | gdb_data_seg_bits)
120end
121document xintfwd
122 Print $ as an integer forwarding pointer, assuming it is an Emacs Lisp Misc value.
123end
124
125define xboolfwd
126 print (struct Lisp_Boolfwd *) (($.i & $valmask) | gdb_data_seg_bits)
127end
128document xboolfwd
129 Print $ as a boolean forwarding pointer, assuming it is an Emacs Lisp Misc value.
130end
131
132define xobjfwd
133 print (struct Lisp_Objfwd *) (($.i & $valmask) | gdb_data_seg_bits)
134end
135document xobjfwd
136 Print $ as an object forwarding pointer, assuming it is an Emacs Lisp Misc value.
137end
138
139define xbufobjfwd
140 print (struct Lisp_Buffer_Objfwd *) (($.i & $valmask) | gdb_data_seg_bits)
141end
142document xbufobjfwd
143 Print $ as a buffer-local object forwarding pointer, assuming it is an Emacs Lisp Misc value.
144end
145
146define xkbobjfwd
147 print (struct Lisp_Kboard_Objfwd *) (($.i & $valmask) | gdb_data_seg_bits)
148end
149document xkbobjfwd
150 Print $ as a kboard-local object forwarding pointer, assuming it is an Emacs Lisp Misc value.
151end
152
153define xbuflocal
154 print (struct Lisp_Buffer_Local_Value *) (($.i & $valmask) | gdb_data_seg_bits)
155end
156document xbuflocal
157 Print $ as a buffer-local-value pointer, assuming it is an Emacs Lisp Misc value.
158end
159
160define xsymbol
161 print (struct Lisp_Symbol *) (($.i & $valmask) | gdb_data_seg_bits)
162 xprintsymptr $
163end
164document xsymbol
165 Print the name and address of the symbol $.
166 This command assumes that $ is an Emacs Lisp symbol value.
167end
168
169define xstring
170 print (struct Lisp_String *) (($.i & $valmask) | gdb_data_seg_bits)
171 output ($->size > 1000) ? 0 : ($->data[0])@($->size_byte < 0 ? $->size : $->size_byte)
172 echo \n
173end
174document xstring
175 Print the contents and address of the string $.
176 This command assumes that $ is an Emacs Lisp string value.
177end
178
179define xvector
180 print (struct Lisp_Vector *) (($.i & $valmask) | gdb_data_seg_bits)
181 output ($->size > 50) ? 0 : ($->contents[0])@($->size)
182 echo \n
183end
184document xvector
185 Print the contents and address of the vector $.
186 This command assumes that $ is an Emacs Lisp vector value.
187end
188
189define xprocess
190 print (struct Lisp_Process *) (($.i & $valmask) | gdb_data_seg_bits)
191 output *$
192 echo \n
193end
194document xprocess
195 Print the address of the struct Lisp_process which the Lisp_Object $ points to.
196end
197
198define xframe
199 print (struct frame *) (($.i & $valmask) | gdb_data_seg_bits)
200end
201document xframe
202 Print $ as a frame pointer, assuming it is an Emacs Lisp frame value.
203end
204
205define xcompiled
206 print (struct Lisp_Vector *) (($.i & $valmask) | gdb_data_seg_bits)
207 output ($->contents[0])@($->size & 0xff)
208end
209document xcompiled
210 Print $ as a compiled function pointer, assuming it is an Emacs Lisp compiled value.
211end
212
213define xwindow
214 print (struct window *) (($.i & $valmask) | gdb_data_seg_bits)
215 printf "%dx%d+%d+%d\n", $->width, $->height, $->left, $->top
216end
217document xwindow
218 Print $ as a window pointer, assuming it is an Emacs Lisp window value.
219 Print the window's position as "WIDTHxHEIGHT+LEFT+TOP".
220end
221
222define xwinconfig
223 print (struct save_window_data *) (($.i & $valmask) | gdb_data_seg_bits)
224end
225document xwinconfig
226 Print $ as a window configuration pointer, assuming it is an Emacs Lisp window configuration value.
227end
228
229define xsubr
230 print (struct Lisp_Subr *) (($.i & $valmask) | gdb_data_seg_bits)
231 output *$
232 echo \n
233end
234document xsubr
235 Print the address of the subr which the Lisp_Object $ points to.
236end
237
238define xchartable
239 print (struct Lisp_Char_Table *) (($.i & $valmask) | gdb_data_seg_bits)
240 printf "Purpose: "
241 output (char*)&((struct Lisp_Symbol *) (($->purpose.i & $valmask) | gdb_data_seg_bits))->name->data
242 printf " %d extra slots", ($->size & 0x1ff) - 388
243 echo \n
244end
245document xchartable
246 Print the address of the char-table $, and its purpose.
247 This command assumes that $ is an Emacs Lisp char-table value.
248end
249
250define xboolvector
251 print (struct Lisp_Bool_Vector *) (($.i & $valmask) | gdb_data_seg_bits)
252 output ($->size > 256) ? 0 : ($->data[0])@(($->size + 7)/ 8)
253 echo \n
254end
255document xboolvector
256 Print the contents and address of the bool-vector $.
257 This command assumes that $ is an Emacs Lisp bool-vector value.
258end
259
260define xbuffer
261 print (struct buffer *) (($.i & $valmask) | gdb_data_seg_bits)
262 output ((struct Lisp_String *) (($->name.i & $valmask) | gdb_data_seg_bits))->data
263 echo \n
264end
265document xbuffer
266 Set $ as a buffer pointer, assuming it is an Emacs Lisp buffer value.
267 Print the name of the buffer.
268end
269
270define xhashtable
271 print (struct Lisp_Hash_Table *) (($.i & $valmask) | gdb_data_seg_bits)
272end
273document xhashtable
274 Set $ as a hash table pointer, assuming it is an Emacs Lisp hash table value.
275end
276
277define xcons
278 print (struct Lisp_Cons *) (($.i & $valmask) | gdb_data_seg_bits)
279 output/x *$
280 echo \n
281end
282document xcons
283 Print the contents of $, assuming it is an Emacs Lisp cons.
284end
285
286define nextcons
287 p $.cdr
288 xcons
289end
290document nextcons
291 Print the contents of the next cell in a list.
292 This assumes that the last thing you printed was a cons cell contents
293 (type struct Lisp_Cons) or a pointer to one.
294end
295
296define xcar
297 print/x ((($.i >> gdb_valbits) & 0xf) == Lisp_Cons ? ((struct Lisp_Cons *) (($.i & $valmask) | gdb_data_seg_bits))->car : 0)
298end
299document xcar
300 Print the car of $, assuming it is an Emacs Lisp pair.
301end
302
303define xcdr
304 print/x ((($.i >> gdb_valbits) & 0xf) == Lisp_Cons ? ((struct Lisp_Cons *) (($.i & $valmask) | gdb_data_seg_bits))->cdr : 0)
305end
306document xcdr
307 Print the cdr of $, assuming it is an Emacs Lisp pair.
308end
309
310define xfloat
311 print ((struct Lisp_Float *) (($.i & $valmask) | gdb_data_seg_bits))->data
312end
313document xfloat
314 Print $ assuming it is a lisp floating-point number.
315end
316
317define xscrollbar
318 print (struct scrollbar *) (($.i & $valmask) | gdb_data_seg_bits)
319 output *$
320 echo \n
321end
322document xscrollbar
323 Print $ as a scrollbar pointer.
324end
325
326define xprintsym
327 set $sym = ((struct Lisp_Symbol *) (($arg0.i & $valmask) | gdb_data_seg_bits))
328 xprintsymptr $sym
329end
330document xprintsym
331 Print argument as a symbol.
332end
333define xprintsymptr
334 set $sym = $arg0
335 set $sym_name = ((struct Lisp_String *)(($sym->xname.i & $valmask) | gdb_data_seg_bits))
336 output ($sym_name->data[0])@($sym_name->size_byte < 0 ? $sym_name->size : $sym_name->size_byte)
337 echo \n
338end
339
340define xbacktrace
341 set $bt = backtrace_list
342 while $bt
343 set $type = (enum Lisp_Type) (((*$bt->function).i >> gdb_valbits) & 0x7)
344 if $type == Lisp_Symbol
345 xprintsym (*$bt->function)
346 else
347 printf "0x%x ", (*$bt->function).i
348 if $type == Lisp_Vectorlike
349 set $size = ((struct Lisp_Vector *) (((*$bt->function).i & $valmask) | gdb_data_seg_bits))->size
350 output (enum pvec_type) (($size & PVEC_FLAG) ? $size & PVEC_TYPE_MASK : 0)
351 else
352 printf "Lisp type %d", $type
353 end
354 echo \n
355 end
356 set $bt = $bt->next
357 end
358end
359document xbacktrace
360 Print a backtrace of Lisp function calls from backtrace_list.
361 Set a breakpoint at Fsignal and call this to see from where
362 an error was signaled.
363end
364
365define xreload
366 set $valmask = ((long)1 << gdb_valbits) - 1
367 set $nonvalbits = gdb_emacs_intbits - gdb_valbits
368end
369document xreload
370 When starting Emacs a second time in the same gdb session under
371 FreeBSD 2.2.5, gdb 4.13, $valmask and $nonvalbits have lost
372 their values. (The same happens on current (2000) versions of GNU/Linux
373 with gdb 5.0.)
374 This function reloads them.
375end
376
377define hook-run
378 xreload
379end
380
381# Call xreload if a new Emacs executable is loaded.
382define hookpost-run
383 xreload
384end
385
386set print pretty on
387set print sevenbit-strings
388
389# show environment DISPLAY
390# show environment TERM
391# set args -geometry 80x40+0+0
392
393# Don't let abort actually run, as it will make
394# stdio stop working and therefore the `pr' command above as well.
395# break abort
396
397# If we are running in synchronous mode, we want a chance to look around
398# before Emacs exits. Perhaps we should put the break somewhere else
399# instead...
400# break x_error_quitter
401
402# arch-tag: 08f4d20d-0254-4374-a80c-179d5a517915
diff --git a/src/ChangeLog b/src/ChangeLog
index 357060188a5..a1c384ce535 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,46 @@
12004-04-03 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * .gdbinit-union: Remove.
4
5 * .gdbinit: Make it work for USE_LSB_TAG and !NO_LISP_UNION.
6 (xgetptr, xgetint, xgettype): New funs. Use them everywhere.
7 ($nonvalbits): Remove.
8 ($valmask): Set it by calling xreload to avoid redundancy.
9
10 * emacs.c (gdb_use_union, gdb_use_lsb): New vars.
11 (gdb_emacs_intbits): Remove.
12
132004-03-31 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
14
15 * data.c (Fbyteorder): Make test work even if unsigned is not 4 bytes.
16
172004-03-30 Kenichi Handa <handa@m17n.org>
18
19 * editfns.c (Fformat): Fix initialization of the array info.
20
212004-03-30 Kim F. Storm <storm@cua.dk>
22
23 * xterm.c (x_mouse_click_focus_ignore_position): New var.
24 (syms_of_xterm): DEFVAR_BOOL it.
25 (ignore_next_mouse_click_timeout): New var.
26 (handle_one_xevent): Clear it on KeyPress, set it on EnterNotify.
27 Use it to filter mouse clicks following focus event.
28
292004-03-29 David Ponce <david@dponce.com>
30
31 * callint.c (Fcall_interactively): Fix last change.
32
332004-03-28 Stefan Monnier <monnier@iro.umontreal.ca>
34
35 * eval.c (Fcommandp): Simplify.
36
37 * data.c (Finteractive_form): Rename from Fsubr_interactive_form.
38 Extend to handle all kinds of functions.
39
40 * lisp.h (Finteractive_form): Declare.
41
42 * callint.c (Fcall_interactively): Use it.
43
12004-03-26 Kim F. Storm <storm@cua.dk> 442004-03-26 Kim F. Storm <storm@cua.dk>
2 45
3 * xdisp.c (syms_of_xdisp): Include `void-variable' in list_of_error 46 * xdisp.c (syms_of_xdisp): Include `void-variable' in list_of_error
@@ -39,7 +82,7 @@
39 * image.c (Qcenter): Move to xdisp.c. 82 * image.c (Qcenter): Move to xdisp.c.
40 83
41 * xdisp.c (Qcenter): Declare here. 84 * xdisp.c (Qcenter): Declare here.
42 (syms_of_xdisp): intern and staticpro it. 85 (syms_of_xdisp): Intern and staticpro it.
43 (handle_single_display_prop): Allow space display property on all 86 (handle_single_display_prop): Allow space display property on all
44 platforms. 87 platforms.
45 (display_mode_line): Set mode_line_p before displaying line. 88 (display_mode_line): Set mode_line_p before displaying line.
diff --git a/src/callint.c b/src/callint.c
index 21a6bd0b1ad..1d7d6f9f89f 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -1,5 +1,5 @@
1/* Call a Lisp function interactively. 1/* Call a Lisp function interactively.
2 Copyright (C) 1985, 86, 93, 94, 95, 1997, 2000, 02, 2003 2 Copyright (C) 1985, 86, 93, 94, 95, 1997, 2000, 02, 03, 2004
3 Free Software Foundation, Inc. 3 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
@@ -347,25 +347,17 @@ supply if the command inquires which events were used to invoke it. */)
347 goto lose; 347 goto lose;
348 specs = XVECTOR (fun)->contents[COMPILED_INTERACTIVE]; 348 specs = XVECTOR (fun)->contents[COMPILED_INTERACTIVE];
349 } 349 }
350 else if (!CONSP (fun)) 350 else
351 goto lose;
352 else if (funcar = XCAR (fun), EQ (funcar, Qautoload))
353 { 351 {
352 Lisp_Object form;
354 GCPRO2 (function, prefix_arg); 353 GCPRO2 (function, prefix_arg);
355 do_autoload (fun, function); 354 form = Finteractive_form (function);
356 UNGCPRO; 355 UNGCPRO;
357 goto retry; 356 if (CONSP (form))
358 } 357 specs = filter_specs = Fcar (XCDR (form));
359 else if (EQ (funcar, Qlambda)) 358 else
360 {
361 specs = Fassq (Qinteractive, Fcdr (XCDR (fun)));
362 if (NILP (specs))
363 goto lose; 359 goto lose;
364 filter_specs = Fnth (make_number (1), specs);
365 specs = Fcar (Fcdr (specs));
366 } 360 }
367 else
368 goto lose;
369 361
370 /* If either SPECS or STRING is set to a string, use it. */ 362 /* If either SPECS or STRING is set to a string, use it. */
371 if (STRINGP (specs)) 363 if (STRINGP (specs))
diff --git a/src/data.c b/src/data.c
index bff2baaed27..c3cf05e0f10 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1,5 +1,5 @@
1/* Primitive operations on Lisp data types for GNU Emacs Lisp interpreter. 1/* Primitive operations on Lisp data types for GNU Emacs Lisp interpreter.
2 Copyright (C) 1985,86,88,93,94,95,97,98,99, 2000, 2001, 2003 2 Copyright (C) 1985,86,88,93,94,95,97,98,99, 2000, 2001, 03, 2004
3 Free Software Foundation, Inc. 3 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
@@ -761,17 +761,39 @@ function with `&rest' args, or `unevalled' for a special form. */)
761 return Fcons (make_number (minargs), make_number (maxargs)); 761 return Fcons (make_number (minargs), make_number (maxargs));
762} 762}
763 763
764DEFUN ("subr-interactive-form", Fsubr_interactive_form, Ssubr_interactive_form, 1, 1, 0, 764DEFUN ("interactive-form", Finteractive_form, Sinteractive_form, 1, 1, 0,
765 doc: /* Return the interactive form of SUBR or nil if none. 765 doc: /* Return the interactive form of CMD or nil if none.
766SUBR must be a built-in function. Value, if non-nil, is a list 766CMD must be a command. Value, if non-nil, is a list
767\(interactive SPEC). */) 767\(interactive SPEC). */)
768 (subr) 768 (cmd)
769 Lisp_Object subr; 769 Lisp_Object cmd;
770{ 770{
771 if (!SUBRP (subr)) 771 Lisp_Object fun = indirect_function (cmd);
772 wrong_type_argument (Qsubrp, subr); 772
773 if (XSUBR (subr)->prompt) 773 if (SUBRP (fun))
774 return list2 (Qinteractive, build_string (XSUBR (subr)->prompt)); 774 {
775 if (XSUBR (fun)->prompt)
776 return list2 (Qinteractive, build_string (XSUBR (fun)->prompt));
777 }
778 else if (COMPILEDP (fun))
779 {
780 if ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) > COMPILED_INTERACTIVE)
781 return list2 (Qinteractive, AREF (fun, COMPILED_INTERACTIVE));
782 }
783 else if (CONSP (fun))
784 {
785 Lisp_Object funcar = XCAR (fun);
786 if (EQ (funcar, Qlambda))
787 return Fassq (Qinteractive, Fcdr (XCDR (fun)));
788 else if (EQ (funcar, Qautoload))
789 {
790 struct gcpro gcpro1;
791 GCPRO1 (cmd);
792 do_autoload (fun, cmd);
793 UNGCPRO;
794 return Finteractive_form (cmd);
795 }
796 }
775 return Qnil; 797 return Qnil;
776} 798}
777 799
@@ -2887,7 +2909,7 @@ lowercase l) for small endian machines. */)
2887 () 2909 ()
2888{ 2910{
2889 unsigned i = 0x04030201; 2911 unsigned i = 0x04030201;
2890 int order = *(char *)&i == 4 ? 66 : 108; 2912 int order = *(char *)&i == 1 ? 108 : 66;
2891 2913
2892 return make_number (order); 2914 return make_number (order);
2893} 2915}
@@ -3209,7 +3231,7 @@ syms_of_data ()
3209 staticpro (&Qhash_table); 3231 staticpro (&Qhash_table);
3210 3232
3211 defsubr (&Sindirect_variable); 3233 defsubr (&Sindirect_variable);
3212 defsubr (&Ssubr_interactive_form); 3234 defsubr (&Sinteractive_form);
3213 defsubr (&Seq); 3235 defsubr (&Seq);
3214 defsubr (&Snull); 3236 defsubr (&Snull);
3215 defsubr (&Stype_of); 3237 defsubr (&Stype_of);
diff --git a/src/editfns.c b/src/editfns.c
index df183155c4b..ce075f2696c 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -3280,7 +3280,7 @@ usage: (format STRING &rest OBJECTS) */)
3280 int i; 3280 int i;
3281 info = (struct info *) alloca (nbytes); 3281 info = (struct info *) alloca (nbytes);
3282 bzero (info, nbytes); 3282 bzero (info, nbytes);
3283 for (i = 0; i <= nargs; i++) 3283 for (i = 0; i < nargs; i++)
3284 info[i].start = -1; 3284 info[i].start = -1;
3285 discarded = (char *) alloca (SBYTES (args[0])); 3285 discarded = (char *) alloca (SBYTES (args[0]));
3286 bzero (discarded, SBYTES (args[0])); 3286 bzero (discarded, SBYTES (args[0]));
diff --git a/src/emacs.c b/src/emacs.c
index 1c7d595d3d3..011d66c5cab 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1,5 +1,5 @@
1/* Fully extensible Emacs, running on Unix, intended for GNU. 1/* Fully extensible Emacs, running on Unix, intended for GNU.
2 Copyright (C) 1985,86,87,93,94,95,97,98,1999,2001,02,2003 2 Copyright (C) 1985,86,87,93,94,95,97,98,1999,2001,02,03,2004
3 Free Software Foundation, Inc. 3 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
@@ -87,9 +87,18 @@ extern char *index P_ ((const char *, int));
87 87
88/* Make these values available in GDB, which doesn't see macros. */ 88/* Make these values available in GDB, which doesn't see macros. */
89 89
90#ifdef USE_LSB_TAG
91int gdb_use_lsb = 1;
92#else
93int gdb_use_lsb = 0;
94#endif
95#ifdef NO_UNION_TYPE
96int gdb_use_union = 0;
97#else
98int gdb_use_union = 1;
99#endif
90EMACS_INT gdb_valbits = VALBITS; 100EMACS_INT gdb_valbits = VALBITS;
91EMACS_INT gdb_gctypebits = GCTYPEBITS; 101EMACS_INT gdb_gctypebits = GCTYPEBITS;
92EMACS_INT gdb_emacs_intbits = sizeof (EMACS_INT) * BITS_PER_CHAR;
93#ifdef DATA_SEG_BITS 102#ifdef DATA_SEG_BITS
94EMACS_INT gdb_data_seg_bits = DATA_SEG_BITS; 103EMACS_INT gdb_data_seg_bits = DATA_SEG_BITS;
95#else 104#else
diff --git a/src/eval.c b/src/eval.c
index a5f66b295a6..0326a828a81 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1,5 +1,5 @@
1/* Evaluator for GNU Emacs Lisp interpreter. 1/* Evaluator for GNU Emacs Lisp interpreter.
2 Copyright (C) 1985, 86, 87, 93, 94, 95, 99, 2000, 2001, 2002 2 Copyright (C) 1985, 86, 87, 93, 94, 95, 99, 2000, 2001, 02, 2004
3 Free Software Foundation, Inc. 3 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
@@ -1812,13 +1812,11 @@ then strings and vectors are not accepted. */)
1812 /* Lists may represent commands. */ 1812 /* Lists may represent commands. */
1813 if (!CONSP (fun)) 1813 if (!CONSP (fun))
1814 return Qnil; 1814 return Qnil;
1815 funcar = Fcar (fun); 1815 funcar = XCAR (fun);
1816 if (!SYMBOLP (funcar))
1817 return Fsignal (Qinvalid_function, Fcons (fun, Qnil));
1818 if (EQ (funcar, Qlambda)) 1816 if (EQ (funcar, Qlambda))
1819 return Fassq (Qinteractive, Fcdr (Fcdr (fun))); 1817 return Fassq (Qinteractive, Fcdr (XCDR (fun)));
1820 if (EQ (funcar, Qautoload)) 1818 if (EQ (funcar, Qautoload))
1821 return Fcar (Fcdr (Fcdr (Fcdr (fun)))); 1819 return Fcar (Fcdr (Fcdr (XCDR (fun))));
1822 else 1820 else
1823 return Qnil; 1821 return Qnil;
1824} 1822}
diff --git a/src/lisp.h b/src/lisp.h
index 2135f80f5e8..48b9c0c7912 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2034,6 +2034,7 @@ extern Lisp_Object Qnumberp, Qnumber_or_marker_p;
2034extern Lisp_Object Qinteger; 2034extern Lisp_Object Qinteger;
2035 2035
2036extern void circular_list_error P_ ((Lisp_Object)); 2036extern void circular_list_error P_ ((Lisp_Object));
2037EXFUN (Finteractive_form, 1);
2037 2038
2038/* Defined in frame.c */ 2039/* Defined in frame.c */
2039extern Lisp_Object Qframep; 2040extern Lisp_Object Qframep;
diff --git a/src/xterm.c b/src/xterm.c
index a297faa2ac0..fe1dca7fd71 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -216,6 +216,17 @@ static String Xt_default_resources[] = {0};
216 216
217static int toolkit_scroll_bar_interaction; 217static int toolkit_scroll_bar_interaction;
218 218
219/* Non-zero means to not move point as a result of clicking on a
220 frame to focus it (when focus-follows-mouse is nil). */
221
222int x_mouse_click_focus_ignore_position;
223
224/* Non-zero timeout value means ignore next mouse click if it arrives
225 before that timeout elapses (i.e. as part of the same sequence of
226 events resulting from clicking on a frame to select it). */
227
228static unsigned long ignore_next_mouse_click_timeout;
229
219/* Mouse movement. 230/* Mouse movement.
220 231
221 Formerly, we used PointerMotionHintMask (in standard_event_mask) 232 Formerly, we used PointerMotionHintMask (in standard_event_mask)
@@ -748,13 +759,13 @@ x_draw_fringe_bitmap (w, row, p)
748 759
749 if (p->overlay_p) 760 if (p->overlay_p)
750 { 761 {
751 clipmask = XCreatePixmapFromBitmapData (display, 762 clipmask = XCreatePixmapFromBitmapData (display,
752 FRAME_X_DISPLAY_INFO (f)->root_window, 763 FRAME_X_DISPLAY_INFO (f)->root_window,
753 bits, p->wd, p->h, 764 bits, p->wd, p->h,
754 1, 0, 1); 765 1, 0, 1);
755 gcv.clip_mask = clipmask; 766 gcv.clip_mask = clipmask;
756 gcv.clip_x_origin = p->x; 767 gcv.clip_x_origin = p->x;
757 gcv.clip_y_origin = p->y; 768 gcv.clip_y_origin = p->y;
758 XChangeGC (display, gc, GCClipMask | GCClipXOrigin | GCClipYOrigin, &gcv); 769 XChangeGC (display, gc, GCClipMask | GCClipXOrigin | GCClipYOrigin, &gcv);
759 } 770 }
760 771
@@ -5733,7 +5744,7 @@ event_handler_gdk (gxev, ev, data)
5733 else 5744 else
5734 { 5745 {
5735 current_count += 5746 current_count +=
5736 handle_one_xevent (dpyinfo, xev, &current_finish, 5747 handle_one_xevent (dpyinfo, xev, &current_finish,
5737 current_hold_quit); 5748 current_hold_quit);
5738 } 5749 }
5739 } 5750 }
@@ -6175,6 +6186,8 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
6175 6186
6176 case KeyPress: 6187 case KeyPress:
6177 6188
6189 ignore_next_mouse_click_timeout = 0;
6190
6178#if defined (USE_X_TOOLKIT) || defined (USE_GTK) 6191#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
6179 /* Dispatch KeyPress events when in menu. */ 6192 /* Dispatch KeyPress events when in menu. */
6180 if (popup_activated ()) 6193 if (popup_activated ())
@@ -6534,6 +6547,9 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
6534 6547
6535 f = x_any_window_to_frame (dpyinfo, event.xcrossing.window); 6548 f = x_any_window_to_frame (dpyinfo, event.xcrossing.window);
6536 6549
6550 if (f && x_mouse_click_focus_ignore_position)
6551 ignore_next_mouse_click_timeout = event.xmotion.time + 200;
6552
6537#if 0 6553#if 0
6538 if (event.xcrossing.focus) 6554 if (event.xcrossing.focus)
6539 { 6555 {
@@ -6777,7 +6793,21 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
6777#if defined (USE_X_TOOLKIT) || defined (USE_GTK) 6793#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
6778 if (! popup_activated ()) 6794 if (! popup_activated ())
6779#endif 6795#endif
6780 construct_mouse_click (&inev, &event, f); 6796 {
6797 if (ignore_next_mouse_click_timeout)
6798 {
6799 if (event.type == ButtonPress
6800 && (int)(event.xbutton.time - ignore_next_mouse_click_timeout) > 0)
6801 {
6802 ignore_next_mouse_click_timeout = 0;
6803 construct_mouse_click (&inev, &event, f);
6804 }
6805 if (event.type == ButtonRelease)
6806 ignore_next_mouse_click_timeout = 0;
6807 }
6808 else
6809 construct_mouse_click (&inev, &event, f);
6810 }
6781 } 6811 }
6782 } 6812 }
6783 else 6813 else
@@ -6925,7 +6955,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
6925 any_help_event_p = 1; 6955 any_help_event_p = 1;
6926 gen_help_event (help_echo_string, frame, help_echo_window, 6956 gen_help_event (help_echo_string, frame, help_echo_window,
6927 help_echo_object, help_echo_pos); 6957 help_echo_object, help_echo_pos);
6928 } 6958 }
6929 else 6959 else
6930 { 6960 {
6931 help_echo_string = Qnil; 6961 help_echo_string = Qnil;
@@ -8241,7 +8271,7 @@ x_set_offset (f, xoff, yoff, change_gravity)
8241 f->win_gravity = NorthWestGravity; 8271 f->win_gravity = NorthWestGravity;
8242 } 8272 }
8243 x_calc_absolute_position (f); 8273 x_calc_absolute_position (f);
8244 8274
8245 BLOCK_INPUT; 8275 BLOCK_INPUT;
8246 x_wm_set_size_hint (f, (long) 0, 0); 8276 x_wm_set_size_hint (f, (long) 0, 0);
8247 8277
@@ -10365,7 +10395,7 @@ x_term_init (display_name, xrm_option, resource_name)
10365 get_bits_and_offset (dpyinfo->visual->green_mask, 10395 get_bits_and_offset (dpyinfo->visual->green_mask,
10366 &dpyinfo->green_bits, &dpyinfo->green_offset); 10396 &dpyinfo->green_bits, &dpyinfo->green_offset);
10367 } 10397 }
10368 10398
10369 /* See if a private colormap is requested. */ 10399 /* See if a private colormap is requested. */
10370 if (dpyinfo->visual == DefaultVisualOfScreen (dpyinfo->screen)) 10400 if (dpyinfo->visual == DefaultVisualOfScreen (dpyinfo->screen))
10371 { 10401 {
@@ -10790,6 +10820,7 @@ x_initialize ()
10790 x_noop_count = 0; 10820 x_noop_count = 0;
10791 last_tool_bar_item = -1; 10821 last_tool_bar_item = -1;
10792 any_help_event_p = 0; 10822 any_help_event_p = 0;
10823 ignore_next_mouse_click_timeout = 0;
10793 10824
10794#ifdef USE_GTK 10825#ifdef USE_GTK
10795 current_count = -1; 10826 current_count = -1;
@@ -10877,6 +10908,16 @@ UNDERLINE_POSITION font properties, for example 7x13 on XFree prior
10877to 4.1, set this to nil. */); 10908to 4.1, set this to nil. */);
10878 x_use_underline_position_properties = 1; 10909 x_use_underline_position_properties = 1;
10879 10910
10911 DEFVAR_BOOL ("x-mouse-click-focus-ignore-position",
10912 &x_mouse_click_focus_ignore_position,
10913 doc: /* Non-nil means that a mouse click to focus a frame does not move point.
10914This variable is only used when the window manager requires that you
10915click on a frame to select it (give it focus). In that case, a value
10916of nil, means that the selected window and cursor position changes to
10917reflect the mouse click position, while a non-nil value means that the
10918selected window or cursor position is preserved. */);
10919 x_mouse_click_focus_ignore_position = 0;
10920
10880 DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars, 10921 DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars,
10881 doc: /* What X toolkit scroll bars Emacs uses. 10922 doc: /* What X toolkit scroll bars Emacs uses.
10882A value of nil means Emacs doesn't use X toolkit scroll bars. 10923A value of nil means Emacs doesn't use X toolkit scroll bars.