Changeset 3553
- Timestamp:
- 11/21/04 09:53:25 (4 years ago)
- Files:
-
- branches/2.2/src/ChangeLog.Meadow (modified) (1 diff)
- branches/2.2/src/abbrev.c (modified) (13 diffs)
- branches/2.2/src/acldef.h (modified) (1 diff)
- branches/2.2/src/alloca.c (modified) (17 diffs)
- branches/2.2/src/atimer.c (modified) (7 diffs)
- branches/2.2/src/atimer.h (modified) (4 diffs)
- branches/2.2/src/blockinput.h (modified) (3 diffs)
- branches/2.2/src/buffer.c (modified) (133 diffs)
- branches/2.2/src/buffer.h (modified) (26 diffs)
- branches/2.2/src/bytecode.c (modified) (26 diffs)
- branches/2.2/src/editfns.c (modified) (1 diff)
- branches/2.2/src/fileio.c (modified) (1 diff)
- branches/2.2/src/lisp.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/2.2/src/ChangeLog.Meadow
r3546 r3553 1 2004-11-21 MIYOSHI Masanori <miyoshi@meadowy.org> 2 3 * abbrev.c: Sync up with Emacs CVS HEAD. 4 5 * acldef.h: Ditto. 6 7 * alloca.c: Ditto. 8 9 * atimer.c: Ditto. 10 11 * atimer.h: Ditto. 12 13 * blockinput.h: Ditto. 14 15 * buffer.c: Ditto. 16 17 * buffer.h: Ditto. 18 19 * bytecode.c: Ditto. 20 21 * editfns.c: Ditto. 22 23 * fileio.c: Ditto. 24 25 * lisp.h: Update declarations. 26 1 27 2004-11-13 MIYOSHI Masanori <miyoshi@meadowy.org> 2 28 branches/2.2/src/abbrev.c
r3516 r3553 1 1 /* Primitives for word-abbrev mode. 2 Copyright (C) 1985, 1986, 1993, 1996, 1998 Free Software Foundation, Inc. 2 Copyright (C) 1985, 1986, 1993, 1996, 1998, 2001,02,03,04 3 Free Software Foundation, Inc. 3 4 4 5 This file is part of GNU Emacs. … … 89 90 () 90 91 { 92 /* The value 59 is arbitrary chosen prime number. */ 91 93 return Fmake_vector (make_number (59), make_number (0)); 92 94 } … … 94 96 DEFUN ("clear-abbrev-table", Fclear_abbrev_table, Sclear_abbrev_table, 1, 1, 0, 95 97 doc: /* Undefine all abbrevs in abbrev table TABLE, leaving it empty. */) 96 (table)98 (table) 97 99 Lisp_Object table; 98 100 { … … 203 205 if (!NILP (current_buffer->abbrev_table)) 204 206 sym = Fintern_soft (abbrev, current_buffer->abbrev_table); 205 if (NILP ( XSYMBOL (sym)->value))207 if (NILP (SYMBOL_VALUE (sym))) 206 208 sym = Qnil; 207 209 if (NILP (sym)) 208 210 sym = Fintern_soft (abbrev, Vglobal_abbrev_table); 209 211 } 210 if (NILP (XSYMBOL (sym)->value)) return Qnil; 212 if (NILP (SYMBOL_VALUE (sym))) 213 return Qnil; 211 214 return sym; 212 215 } … … 246 249 value = Qnil; 247 250 248 if (!NILP (Vrun_hooks)) 249 call1 (Vrun_hooks, Qpre_abbrev_expand_hook); 251 Frun_hooks (1, &Qpre_abbrev_expand_hook); 250 252 251 253 wordstart = 0; … … 318 320 else 319 321 XSETFASTINT (sym, 0); 320 if (INTEGERP (sym) || NILP (XSYMBOL (sym)->value)) 322 323 if (INTEGERP (sym) || NILP (SYMBOL_VALUE (sym))) 321 324 sym = oblookup (Vglobal_abbrev_table, buffer, 322 325 wordend - wordstart, p - buffer); 323 if (INTEGERP (sym) || NILP ( XSYMBOL (sym)->value))326 if (INTEGERP (sym) || NILP (SYMBOL_VALUE (sym))) 324 327 return value; 325 328 … … 343 346 if (INTEGERP (XSYMBOL (sym)->plist)) 344 347 XSETINT (XSYMBOL (sym)->plist, 345 XINT (XSYMBOL (sym)->plist) + 1); /* Increment use count */ 348 XINT (XSYMBOL (sym)->plist) + 1); 349 else if (INTEGERP (tem = Fget (sym, Qcount))) 350 Fput (sym, Qcount, make_number (XINT (tem) + 1)); 346 351 347 352 /* If this abbrev has an expansion, delete the abbrev 348 353 and insert the expansion. */ 349 expansion = XSYMBOL (sym)->value;354 expansion = SYMBOL_VALUE (sym); 350 355 if (STRINGP (expansion)) 351 356 { 352 357 SET_PT (wordstart); 353 358 354 del_range_both (wordstart, wordstart_byte, wordend, wordend_byte, 1); 355 356 insert_from_string (expansion, 0, 0, XSTRING (expansion)->size, 357 STRING_BYTES (XSTRING (expansion)), 1); 359 insert_from_string (expansion, 0, 0, SCHARS (expansion), 360 SBYTES (expansion), 1); 361 del_range_both (PT, PT_BYTE, 362 wordend + (PT - wordstart), 363 wordend_byte + (PT_BYTE - wordstart_byte), 364 1); 365 358 366 SET_PT (PT + whitecnt); 359 367 … … 433 441 int zv_before; 434 442 435 val = XSYMBOL (Vlast_abbrev)->value;443 val = SYMBOL_VALUE (Vlast_abbrev); 436 444 if (!STRINGP (val)) 437 445 error ("value of abbrev-symbol must be a string"); 438 446 zv_before = ZV; 439 del_range_byte (PT_BYTE, PT_BYTE + S TRING_BYTES (XSTRING (val)), 1);447 del_range_byte (PT_BYTE, PT_BYTE + SBYTES (val), 1); 440 448 /* Don't inherit properties here; just copy from old contents. */ 441 449 insert_from_string (Vlast_abbrev_text, 0, 0, 442 XSTRING (Vlast_abbrev_text)->size,443 S TRING_BYTES (XSTRING (Vlast_abbrev_text)), 0);450 SCHARS (Vlast_abbrev_text), 451 SBYTES (Vlast_abbrev_text), 0); 444 452 Vlast_abbrev_text = Qnil; 445 453 /* Total number of characters deleted. */ … … 454 462 Lisp_Object sym, stream; 455 463 { 456 Lisp_Object name; 457 if (NILP (XSYMBOL (sym)->value)) 464 Lisp_Object name, count, system_flag; 465 466 if (INTEGERP (XSYMBOL (sym)->plist)) 467 { 468 count = XSYMBOL (sym)->plist; 469 system_flag = Qnil; 470 } 471 else 472 { 473 count = Fget (sym, Qcount); 474 system_flag = Fget (sym, Qsystem_type); 475 } 476 477 if (NILP (SYMBOL_VALUE (sym)) || ! NILP (system_flag)) 458 478 return; 479 459 480 insert (" (", 5); 460 XSETSTRING (name, XSYMBOL (sym)->name);481 XSETSTRING (name, SYMBOL_NAME (sym)); 461 482 Fprin1 (name, stream); 462 483 insert (" ", 1); 463 Fprin1 ( XSYMBOL (sym)->value, stream);484 Fprin1 (SYMBOL_VALUE (sym), stream); 464 485 insert (" ", 1); 465 486 Fprin1 (XSYMBOL (sym)->function, stream); 466 487 insert (" ", 1); 467 Fprin1 ( XSYMBOL (sym)->plist, stream);488 Fprin1 (count, stream); 468 489 insert (")\n", 2); 469 490 } … … 473 494 Lisp_Object sym, stream; 474 495 { 475 Lisp_Object one; 476 477 if (NILP (XSYMBOL (sym)->value)) 496 Lisp_Object one, count, system_flag; 497 498 if (INTEGERP (XSYMBOL (sym)->plist)) 499 { 500 count = XSYMBOL (sym)->plist; 501 system_flag = Qnil; 502 } 503 else 504 { 505 count = Fget (sym, Qcount); 506 system_flag = Fget (sym, Qsystem_type); 507 } 508 509 if (NILP (SYMBOL_VALUE (sym))) 478 510 return; 511 479 512 one = make_number (1); 480 513 Fprin1 (Fsymbol_name (sym), stream); 481 Findent_to (make_number (15), one); 482 Fprin1 (XSYMBOL (sym)->plist, stream); 514 515 if (!NILP (system_flag)) 516 { 517 insert_string (" (sys)"); 518 Findent_to (make_number (20), one); 519 } 520 else 521 Findent_to (make_number (15), one); 522 523 Fprin1 (count, stream); 483 524 Findent_to (make_number (20), one); 484 Fprin1 ( XSYMBOL (sym)->value, stream);525 Fprin1 (SYMBOL_VALUE (sym), stream); 485 526 if (!NILP (XSYMBOL (sym)->function)) 486 527 { … … 498 539 is inserted. Otherwise the description is an expression, 499 540 a call to `define-abbrev-table', which would 500 define the abbrev table NAME exactly as it is currently defined. */) 501 (name, readable) 541 define the abbrev table NAME exactly as it is currently defined. 542 543 Abbrevs marked as "system abbrevs" are normally omitted. However, if 544 READABLE is non-nil, they are listed. */) 545 (name, readable) 502 546 Lisp_Object name, readable; 503 547 { … … 616 660 DEFVAR_LISP ("abbrev-start-location", &Vabbrev_start_location, 617 661 doc: /* Buffer position for `expand-abbrev' to use as the start of the abbrev. 618 nil meansuse the word before point as the abbrev.662 When nil, use the word before point as the abbrev. 619 663 Calling `expand-abbrev' sets this to nil. */); 620 664 Vabbrev_start_location = Qnil; … … 657 701 defsubr (&Sdefine_abbrev_table); 658 702 } 703 704 /* arch-tag: b721db69-f633-44a8-a361-c275acbdad7d 705 (do not change this comment) */ branches/2.2/src/acldef.h
r3104 r3553 39 39 #define ACL$B_TYPE 10 40 40 #define ACL$L_LIST 12 41 42 /* arch-tag: 7c11e99d-34df-41e8-98e2-20f152c4ad73 43 (do not change this comment) */ branches/2.2/src/alloca.c
r3104 r3553 1 1 /* alloca.c -- allocate automatically reclaimed memory 2 2 (Mostly) portable public-domain implementation -- D A Gwyn 3 4 NOTE: The canonical source of this file is maintained with gnulib. 5 Bugs can be reported to bug-gnulib@gnu.org. 3 6 4 7 This implementation of the PWB library alloca function, … … 23 26 24 27 #ifdef HAVE_CONFIG_H 25 # include <config.h>28 # include <config.h> 26 29 #endif 27 30 28 31 #ifdef HAVE_STRING_H 29 # include <string.h>32 # include <string.h> 30 33 #endif 31 34 #ifdef HAVE_STDLIB_H 32 # include <stdlib.h>35 # include <stdlib.h> 33 36 #endif 34 37 35 #ifdef emacs 36 #include "lisp.h" 37 #include "blockinput.h" 38 #ifdef DO_BLOCK_INPUT 39 # include "blockinput.h" 38 40 #endif 39 41 … … 43 45 /* If someone has defined alloca as a macro, 44 46 there must be some other way alloca is supposed to work. */ 45 # ifndef alloca46 47 # ifdef emacs48 # ifdef static47 # ifndef alloca 48 49 # ifdef emacs 50 # ifdef static 49 51 /* actually, only want this if static is defined as "" 50 52 -- this is for usg, in which emacs must undefine static 51 53 in order to make unexec workable 52 54 */ 53 #ifndef STACK_DIRECTION 54 #error "Must know STACK_DIRECTION at compile-time" 55 #endif /* STACK_DIRECTION undefined */ 56 #endif /* static */ 57 #endif /* emacs */ 55 # ifndef STACK_DIRECTION 56 you 57 lose 58 -- must know STACK_DIRECTION at compile-time 59 /* Using #error here is not wise since this file should work for 60 old and obscure compilers. 61 62 As far as I know, using it is OK if it's indented -- at least for 63 pcc-based processors. -- fx */ 64 # endif /* STACK_DIRECTION undefined */ 65 # endif /* static */ 66 # endif /* emacs */ 58 67 59 68 /* If your stack is a linked list of frames, you have to 60 69 provide an "address metric" ADDRESS_FUNCTION macro. */ 61 70 62 # if defined (CRAY) && defined (CRAY_STACKSEG_END)71 # if defined (CRAY) && defined (CRAY_STACKSEG_END) 63 72 long i00afunc (); 64 #define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg)) 65 #else 66 #define ADDRESS_FUNCTION(arg) &(arg) 67 #endif 68 69 #ifdef POINTER_TYPE 73 # define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg)) 74 # else 75 # define ADDRESS_FUNCTION(arg) &(arg) 76 # endif 77 78 # ifndef POINTER_TYPE 79 # ifdef __STDC__ 80 # define POINTER_TYPE void 81 # else 82 # define POINTER_TYPE char 83 # endif 84 # endif 70 85 typedef POINTER_TYPE *pointer; 71 #else 72 #if __STDC__ 73 typedef void *pointer; 74 #else 75 typedef char *pointer; 76 #endif /*__STDC__*/ 77 #endif /*POINTER_TYPE*/ 78 79 80 #ifndef NULL 81 #define NULL 0 82 #endif 83 84 /* Different portions of Emacs need to call different versions of 85 malloc. The Emacs executable needs alloca to call xmalloc, because 86 ordinary malloc isn't protected from input signals. On the other 87 hand, the utilities in lib-src need alloca to call malloc; some of 88 them are very simple, and don't have an xmalloc routine. 89 90 Non-Emacs programs expect this to call use xmalloc. 86 87 # ifndef NULL 88 # define NULL 0 89 # endif 90 91 /* The Emacs executable needs alloca to call xmalloc, because ordinary 92 malloc isn't protected from input signals. xmalloc also checks for 93 out-of-memory errors, so we should use it generally. 91 94 92 95 Callers below should use malloc. */ 93 96 94 # ifdef emacs95 # define malloc xmalloc96 # ifdef EMACS_FREE97 # define free EMACS_FREE98 #endif 99 #endif 100 extern pointer malloc ();97 # undef malloc 98 # define malloc xmalloc 99 # undef free 100 # define free xfree 101 102 void *xmalloc _P ((size_t)); 103 void xfree _P ((void *)); 101 104 102 105 /* Define STACK_DIRECTION if you know the direction of stack … … 108 111 STACK_DIRECTION = 0 => direction of growth unknown */ 109 112 110 # ifndef STACK_DIRECTION111 # defineSTACK_DIRECTION 0 /* Direction unknown. */112 # endif113 114 # if STACK_DIRECTION != 0115 116 # defineSTACK_DIR STACK_DIRECTION /* Known at compile-time. */117 118 # else /* STACK_DIRECTION == 0; need run-time code. */113 # ifndef STACK_DIRECTION 114 # define STACK_DIRECTION 0 /* Direction unknown. */ 115 # endif 116 117 # if STACK_DIRECTION != 0 118 119 # define STACK_DIR STACK_DIRECTION /* Known at compile-time. */ 120 121 # else /* STACK_DIRECTION == 0; need run-time code. */ 119 122 120 123 static int stack_dir; /* 1 or -1 once known. */ 121 # defineSTACK_DIR stack_dir124 # define STACK_DIR stack_dir 122 125 123 126 static void … … 143 146 } 144 147 145 # endif /* STACK_DIRECTION == 0 */148 # endif /* STACK_DIRECTION == 0 */ 146 149 147 150 /* An "alloca header" is used to: … … 152 155 alignment chunk size. The following default should work okay. */ 153 156 154 # ifndef ALIGN_SIZE155 # defineALIGN_SIZE sizeof(double)156 # endif157 # ifndef ALIGN_SIZE 158 # define ALIGN_SIZE sizeof(double) 159 # endif 157 160 158 161 typedef union hdr … … 177 180 pointer 178 181 alloca (size) 179 unsignedsize;182 size_t size; 180 183 { 181 184 auto char probe; /* Probes stack depth: */ 182 185 register char *depth = ADDRESS_FUNCTION (probe); 183 186 184 # if STACK_DIRECTION == 0187 # if STACK_DIRECTION == 0 185 188 if (STACK_DIR == 0) /* Unknown growth direction. */ 186 189 find_stack_direction (); 187 # endif190 # endif 188 191 189 192 /* Reclaim garbage, defined as all alloca'd storage that … … 193 196 register header *hp; /* Traverses linked list. */ 194 197 195 # ifdef emacs198 # ifdef DO_BLOCK_INPUT 196 199 BLOCK_INPUT; 197 # endif200 # endif 198 201 199 202 for (hp = last_alloca_header; hp != NULL;) … … 212 215 last_alloca_header = hp; /* -> last valid storage. */ 213 216 214 # ifdef emacs217 # ifdef DO_BLOCK_INPUT 215 218 UNBLOCK_INPUT; 216 # endif219 # endif 217 220 } 218 221 … … 223 226 224 227 { 228 /* Address of header. */ 225 229 register pointer new = malloc (sizeof (header) + size); 226 /* Address of header. */227 230 228 231 if (new == 0) … … 240 243 } 241 244 242 # if defined (CRAY) && defined (CRAY_STACKSEG_END)243 244 # ifdef DEBUG_I00AFUNC245 # include <stdio.h>246 # endif247 248 # ifndef CRAY_STACK249 # define CRAY_STACK250 # ifndef CRAY2245 # if defined (CRAY) && defined (CRAY_STACKSEG_END) 246 247 # ifdef DEBUG_I00AFUNC 248 # include <stdio.h> 249 # endif 250 251 # ifndef CRAY_STACK 252 # define CRAY_STACK 253 # ifndef CRAY2 251 254 /* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */ 252 255 struct stack_control_header … … 300 303 }; 301 304 302 # else /* CRAY2 */305 # else /* CRAY2 */ 303 306 /* The following structure defines the vector of words 304 307 returned by the STKSTAT library routine. */ … … 353 356 }; 354 357 355 # endif /* CRAY2 */356 # endif /* not CRAY_STACK */357 358 # ifdef CRAY2358 # endif /* CRAY2 */ 359 # endif /* not CRAY_STACK */ 360 361 # ifdef CRAY2 359 362 /* Determine a "stack measure" for an arbitrary ADDRESS. 360 363 I doubt that "lint" will like this much. */ … … 427 430 } 428 431 429 # else /* not CRAY2 */432 # else /* not CRAY2 */ 430 433 /* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP. 431 434 Determine the number of the cell within the stack, … … 472 475 while (!(this_segment <= address && address <= stkl)) 473 476 { 474 # ifdef DEBUG_I00AFUNC477 # ifdef DEBUG_I00AFUNC 475 478 fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl); 476 # endif479 # endif 477 480 if (pseg == 0) 478 481 break; … … 493 496 while (pseg != 0) 494 497 { 495 # ifdef DEBUG_I00AFUNC498 # ifdef DEBUG_I00AFUNC 496 499 fprintf (stderr, "%011o %011o\n", pseg, size); 497 # endif500 # endif 498 501 stkl = stkl - pseg; 499 502 ssptr = (struct stack_segment_linkage *) stkl; … … 505 508 } 506 509 507 # endif /* not CRAY2 */508 # endif /* CRAY */509 510 # endif /* no alloca */510 # endif /* not CRAY2 */ 511 # endif /* CRAY */ 512 513 # endif /* no alloca */ 511 514 #endif /* not GCC version 2 */ 515 516 /* arch-tag: 5c9901c8-3cd4-453e-bd66-d9035a175ee3 517 (do not change this comment) */ branches/2.2/src/atimer.c
r3421 r3553 1 1 /* Asynchronous timers. 2 Copyright (C) 2000 Free Software Foundation, Inc.2 Copyright (C) 2000, 2004 Free Software Foundation, Inc. 3 3 4 4 This file is part of GNU Emacs. … … 20 20 21 21 #include <config.h> 22 #include <signal.h> 23 #include <stdio.h> 22 24 #include <lisp.h> 23 #include <signal.h>24 25 #include <syssignal.h> 25 26 #include <systime.h> 26 27 #include <blockinput.h> 27 28 #include <atimer.h> 28 #include <stdio.h>29 29 30 30 #ifdef HAVE_UNISTD_H … … 35 35 #include <sys/time.h> 36 36 #endif 37 38 /* The ubiquitous min/max macros. */39 40 #define max(X, Y) ((X) > (Y) ? (X) : (Y))41 #define min(X, Y) ((X) < (Y) ? (X) : (Y))42 37 43 38 /* Free-list of atimer structures. */ … … 63 58 int pending_atimers; 64 59 65 /* Block/unblock SIGALRM. .*/60 /* Block/unblock SIGALRM. */ 66 61 67 62 #define BLOCK_ATIMERS sigblock (sigmask (SIGALRM)) … … 381 376 t = atimers; 382 377 atimers = atimers->next; 378 #ifndef MAC_OSX 383 379 t->fn (t); 380 #endif 384 381 385 382 if (t->type == ATIMER_CONTINUOUS) … … 393 390 free_atimers = t; 394 391 } 392 #ifdef MAC_OSX 393 /* Fix for Ctrl-G. Perhaps this should apply to all platforms. */ 394 t->fn (t); 395 #endif 395 396 396 397 EMACS_GET_TIME (now); 397 398 } 398 399 #if defined (USG) && !defined (POSIX_SIGNALS)400 /* USG systems forget handlers when they are used;401 must reestablish each time. */402 signal (SIGALRM, alarm_signal_handler);403 #endif /* USG */404 399 405 400 set_alarm (); … … 445 440 signal (SIGALRM, alarm_signal_handler); 446 441 } 442 /* arch-tag: e6308261-eec6-404b-89fb-6e5909518d70 443 (do not change this comment) */ branches/2.2/src/atimer.h
r3421 r3553 1 1 /* Asynchronous timers. 2 Copyright (C) 2000 Free Software Foundation, Inc.2 Copyright (C) 2000, 2003 Free Software Foundation, Inc. 3 3 4 4 This file is part of GNU Emacs. … … 21 21 #ifndef EMACS_ATIMER_H 22 22 #define EMACS_ATIMER_H 23 24 /* Declare the prototype for a general external function. */ 25 #if defined (PROTOTYPES) || defined (WINDOWSNT) 26 #define P_(proto) proto 27 #else 28 #define P_(proto) () 29 #endif 23 30 24 31 #include "systime.h" /* for EMACS_TIME */ … … 59 66 EMACS_TIME interval; 60 67 61 /* Function to call when timer is ripe. Inter upt input is62 g aranteed to not be blocked when this function is called. */68 /* Function to call when timer is ripe. Interrupt input is 69 guaranteed to not be blocked when this function is called. */ 63 70 atimer_callback fn; 64 71 … … 83 90 84 91 #endif /* EMACS_ATIMER_H */ 92 93 /* arch-tag: 02c7c1c8-45bd-4222-b874-4ca44662f60b 94 (do not change this comment) */ branches/2.2/src/blockinput.h
r3421 r3553 1 1 /* blockinput.h - interface to blocking complicated interrupt-driven input. 2 Copyright (C) 1989, 1993 Free Software Foundation, Inc.2 Copyright (C) 1989, 1993, 2004 Free Software Foundation, Inc. 3 3 4 4 This file is part of GNU Emacs. … … 98 98 #define UNBLOCK_INPUT_RESIGNAL UNBLOCK_INPUT 99 99 100 /* In critical section ? */ 101 #define INPUT_BLOCKED_P (interrupt_input_blocked > 0) 102 100 103 /* Defined in keyboard.c */ 101 104 /* Don't use a prototype here; it causes trouble in some files. */ … … 116 119 117 120 #endif /* EMACS_BLOCKINPUT_H */ 121 122 /* arch-tag: 51a9ec86-945a-4966-8f04-2d1341250e03 123 (do not change this comment) */ branches/2.2/src/buffer.c
r3497 r3553 33 33 34 34 #ifndef MAXPATHLEN 35 /* in 4.1 , param.h fails to define this. */35 /* in 4.1 [probably SunOS? -stef] , param.h fails to define this. */ 36 36 #define MAXPATHLEN 1024 37 37 #endif /* not MAXPATHLEN */ … … 40 40 #include <unistd.h> 41 41 #endif 42 42 43 #include "lisp.h" 43 44 #include "intervals.h" … … 50 51 #include "blockinput.h" 51 52 #include "keyboard.h" 53 #include "keymap.h" 52 54 #include "frame.h" 53 55 … … 87 89 If a slot is -2, then there is no DEFVAR_PER_BUFFER for it, 88 90 but there is a default value which is copied into each buffer. 89 90 If a slot in this structure is negative, then even though there may91 be a DEFVAR_PER_BUFFER for the slot, there is no default value for it;92 and the corresponding slot in buffer_defaults is not used.93 91 94 92 If a slot in this structure corresponding to a DEFVAR_PER_BUFFER is … … 149 147 If any of these functions returns nil, we don't kill it. */ 150 148 Lisp_Object Vkill_buffer_query_functions; 149 Lisp_Object Qkill_buffer_query_functions; 151 150 152 151 /* List of functions to call before changing an unmodified buffer. */ … … 156 155 Lisp_Object Qbefore_change_functions; 157 156 Lisp_Object Qafter_change_functions; 157 Lisp_Object Qucs_set_table_for_input; 158 158 159 159 /* If nonzero, all modification hooks are suppressed. */ … … 192 192 { 193 193 if (STRINGP (spec)) 194 error ("No buffer named %s", XSTRING (spec)->data);194 error ("No buffer named %s", SDATA (spec)); 195 195 error ("Invalid buffer argument"); 196 196 } … … 199 199 doc: /* Return non-nil if OBJECT is a buffer which has not been killed. 200 200 Value is nil if OBJECT is not a buffer or if it has been killed. */) 201 (object)201 (object) 202 202 Lisp_Object object; 203 203 { … … 208 208 DEFUN ("buffer-list", Fbuffer_list, Sbuffer_list, 0, 1, 0, 209 209 doc: /* Return a list of all existing live buffers. 210 If the optional arg FRAME is a frame, we return that frame's buffer list. */) 211 (frame) 210 If the optional arg FRAME is a frame, we return the buffer list 211 in the proper order for that frame: the buffers in FRAME's `buffer-list' 212 frame parameter come first, followed by the rest of the buffers. */) 213 (frame) 212 214 Lisp_Object frame; 213 215 { … … 246 248 { 247 249 register Lisp_Object tail; 248 for (tail = list; !NILP (tail); tail = Fcdr(tail))250 for (tail = list; CONSP (tail); tail = XCDR (tail)) 249 251 { 250 252 register Lisp_Object elt, tem; 251 elt = Fcar(tail);253 elt = XCAR (tail); 252 254 tem = Fstring_equal (Fcar (elt), key); 253 255 if (!NILP (tem)) … … 261 263 If there is no live buffer named NAME, return nil. 262 264 NAME may also be a buffer; if so, the value is that buffer. */) 263 (name)265 (name) 264 266 register Lisp_Object name; 265 267 { … … 276 278 If there is no such live buffer, return nil. 277 279 See also `find-buffer-visiting'. */) 278 (filename)280 (filename) 279 281 register Lisp_Object filename; 280 282 { … … 330 332 If NAME is a buffer instead of a string, then it is the value returned. 331 333 The value is never nil. */) 332 (name)334 (name) 333 335 register Lisp_Object name; 334 336 { … … 340 342 return buf; 341 343 342 if ( XSTRING (name)->size== 0)344 if (SCHARS (name) == 0) 343 345 error ("Empty string for buffer name is not allowed"); 344 346 … … 360 362 buffer_memory_full (); 361 363 362 BUF_PT (b) = 1;363 BUF_GPT (b) = 1;364 BUF_BEGV (b) = 1;365 BUF_ZV (b) = 1;366 BUF_Z (b) = 1;367 BUF_PT_BYTE (b) = 1;368 BUF_GPT_BYTE (b) = 1;369 BUF_BEGV_BYTE (b) = 1;370 BUF_ZV_BYTE (b) = 1;371 BUF_Z_BYTE (b) = 1;364 BUF_PT (b) = BEG; 365 BUF_GPT (b) = BEG; 366 BUF_BEGV (b) = BEG; 367 BUF_ZV (b) = BEG; 368 BUF_Z (b) = BEG; 369 BUF_PT_BYTE (b) = BEG_BYTE; 370 BUF_GPT_BYTE (b) = BEG_BYTE; 371 BUF_BEGV_BYTE (b) = BEG_BYTE; 372 BUF_ZV_BYTE (b) = BEG_BYTE; 373 BUF_Z_BYTE (b) = BEG_BYTE; 372 374 BUF_MODIFF (b) = 1; 373 375 BUF_OVERLAY_MODIFF (b) = 1; … … 396 398 397 399 name = Fcopy_sequence (name); 398 XSTRING (name)->intervals = NULL_INTERVAL;400 STRING_SET_INTERVALS (name, NULL_INTERVAL); 399 401 b->name = name; 400 402 401 if ( XSTRING (name)->data[0]!= ' ')403 if (SREF (name, 0) != ' ') 402 404 b->undo_list = Qnil; 403 405 else … … 407 409 reset_buffer_local_variables (b, 1); 408 410 411 b->mark = Fmake_marker (); 412 BUF_MARKERS (b) = Qnil; 413 b->name = name; 414 409 415 /* Put this in the alist of all live buffers. */ 410 416 XSETBUFFER (buf, b); 411 417 Vbuffer_alist = nconc2 (Vbuffer_alist, Fcons (Fcons (name, buf), Qnil)); 412 418 413 b->mark = Fmake_marker ();414 BUF_MARKERS (b) = Qnil;415 b->name = name;416 419 return buf; 417 420 } … … 433 436 { 434 437 Lisp_Object overlay, start, end, old_overlay; 435 intcharpos;438 EMACS_INT charpos; 436 439 437 440 old_overlay = XCAR (list); … … 472 475 struct buffer *from, *to; 473 476 { 474 Lisp_Object to_buffer ;477 Lisp_Object to_buffer, tem; 475 478 int offset; 476 479 … … 499 502 to->overlays_before = copy_overlays (to, from->overlays_before); 500 503 to->overlays_after = copy_overlays (to, from->overlays_after); 504 505 /* Copy the alist of local variables, 506 and all the alist elements too. */ 507 to->local_var_alist 508 = Fcopy_sequence (from->local_var_alist); 509 for (tem = to->local_var_alist; CONSP (tem); 510 tem = XCDR (tem)) 511 XSETCAR (tem, Fcons (XCAR (XCAR (tem)), XCDR (XCAR (tem)))); 501 512 } 502 513 … … 506 517 "bMake indirect buffer (to buffer): \nBName of indirect buffer: ", 507 518 doc: /* Create and return an indirect buffer for buffer BASE-BUFFER, named NAME. 508 BASE-BUFFER should be a n existing buffer (or buffer name).519 BASE-BUFFER should be a live buffer, or the name of an existing buffer. 509 520 NAME should be a string which is not the name of an existing buffer. 510 521 Optional argument CLONE non-nil means preserve BASE-BUFFER's state, 511 522 such as major and minor modes, in the indirect buffer. 512 523 CLONE nil means the indirect buffer's state is reset to default values. */) 513 (base_buffer, name, clone)524 (base_buffer, name, clone) 514 525 Lisp_Object base_buffer, name, clone; 515 526 { 516 Lisp_Object buf ;527 Lisp_Object buf, tem; 517 528 struct buffer *b; 518 529 530 CHECK_STRING (name); 519 531 buf = Fget_buffer (name); 520 532 if (!NILP (buf)) 521 error ("Buffer name `%s' is in use", XSTRING (name)->data); 522 533 error ("Buffer name `%s' is in use", SDATA (name)); 534 535 tem = base_buffer; 523 536 base_buffer = Fget_buffer (base_buffer); 524 537 if (NILP (base_buffer)) 525 error ("No such buffer: `%s'", XSTRING (name)->data); 526 527 if (XSTRING (name)->size == 0) 538 error ("No such buffer: `%s'", SDATA (tem)); 539 if (NILP (XBUFFER (base_buffer)->name)) 540 error ("Base buffer has been killed"); 541 542 if (SCHARS (name) == 0) 528 543 error ("Empty string for buffer name is not allowed"); 529 544 … … 555 570 556 571 name = Fcopy_sequence (name); 557 XSTRING (name)->intervals = NULL_INTERVAL;572 STRING_SET_INTERVALS (name, NULL_INTERVAL); 558 573 b->name = name; 559 574 … … 633 648 634 649 /* Reinitialize everything about a buffer except its name and contents 635 and local variables. */ 650 and local variables. 651 If called on an already-initialized buffer, the list of overlays 652 should be deleted before calling this function, otherwise we end up 653 with overlays that claim to belong to the buffer but the buffer 654 claims it doesn't belong to it. */ 636 655 637 656 void … … 712 731 #endif 713 732 714 #if 0715 b->sort_table = XSTRING (Vascii_sort_table);716 b->folding_sort_table = XSTRING (Vascii_folding_sort_table);717 #endif /* 0 */718 719 733 /* Reset all (or most) per-buffer variables to their defaults. */ 720 734 b->local_var_alist = Qnil; … … 749 763 If there is no live buffer named NAME, then return NAME. 750 764 Otherwise modify name by appending `<NUMBER>', incrementing NUMBER 751 until an unused name is found, and then return that name.765 \(starting at 2) until an unused name is found, and then return that name. 752 766 Optional second argument IGNORE specifies a name that is okay to use 753 767 \(if it is in the sequence to be tried) 754 768 even if a buffer with that name exists. */) 755 (name, ignore)769 (name, ignore) 756 770 register Lisp_Object name, ignore; 757 771 { … … 762 776 CHECK_STRING (name); 763 777 778 tem = Fstring_equal (name, ignore); 779 if (!NILP (tem)) 780 return name; 764 781 tem = Fget_buffer (name); 765 782 if (NILP (tem)) … … 784 801 doc: /* Return the name of BUFFER, as a string. 785 802 With no argument or nil as argument, return the name of the current buffer. */) 786 (buffer)803 (buffer) 787 804 register Lisp_Object buffer; 788 805 { … … 796 813 doc: /* Return name of file BUFFER is visiting, or nil if none. 797 814 No argument or nil as argument means use the current buffer. */) 798 (buffer)815 (buffer) 799 816 register Lisp_Object buffer; 800 817 { … … 808 825 0, 1, 0, 809 826 doc: /* Return the base buffer of indirect buffer BUFFER. 810 If BUFFER is not indirect, return nil. */) 811 (buffer) 827 If BUFFER is not indirect, return nil. 828 BUFFER defaults to the current buffer. */) 829 (buffer) 812 830 register Lisp_Object buffer; 813 831 { … … 878 896 879 897 /* What binding is loaded right now? */ 880 valcontents = XSYMBOL (symbol)->value;898 valcontents = SYMBOL_VALUE (symbol); 881 899 current_alist_element 882 900 = XCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr); … … 907 925 Note that storing new VALUEs in these elements doesn't change the variables. 908 926 No argument or nil as argument means use current buffer as BUFFER. */) 909 (buffer)927 (buffer) 910 928 register Lisp_Object buffer; 911 929 { … … 976 994 doc: /* Return t if BUFFER was modified since its file was last read or saved. 977 995 No argument or nil as argument means use current buffer as BUFFER. */) 978 (buffer)996 (buffer) 979 997 register Lisp_Object buffer; 980 998 { … … 995 1013 doc: /* Mark current buffer as modified or unmodified according to FLAG. 996 1014 A non-nil FLAG means mark the buffer modified. */) 997 (flag)1015 (flag) 998 1016 register Lisp_Object flag; 999 1017 { … … 1044 1062 DEFUN ("restore-buffer-modified-p", Frestore_buffer_modified_p, 1045 1063 Srestore_buffer_modified_p, 1, 1, 0, 1046 doc: /* Like `set-buffer-modified-p', with a difference sconcerning redisplay.1064 doc: /* Like `set-buffer-modified-p', with a difference concerning redisplay. 1047 1065 It is not ensured that mode lines will be updated to show the modified 1048 1066 state of the current buffer. Use with care. */) 1049 (flag)1067 (flag) 1050 1068 Lisp_Object flag; 1051 1069 { … … 1078 1096 that buffer is changed. It wraps around occasionally. 1079 1097 No argument or nil as argument means use current buffer as BUFFER. */) 1080 (buffer)1098 (buffer) 1081 1099 register Lisp_Object buffer; 1082 1100 { … … 1103 1121 We return the name we actually gave the buffer. 1104 1122 This does not change the name of the visited file (if any). */) 1105 (newname, unique)1123 (newname, unique) 1106 1124 &n
