comparison src/symbols.c @ 272:c5d627a313b1 r21-0b34

Import from CVS: tag r21-0b34
author cvs
date Mon, 13 Aug 2007 10:28:48 +0200
parents 966663fcf606
children 7df0dd720c89
comparison
equal deleted inserted replaced
271:c7b7086b0a39 272:c5d627a313b1
87 Lisp_Object 87 Lisp_Object
88 follow_past_lisp_magic); 88 follow_past_lisp_magic);
89 89
90 90
91 #ifdef LRECORD_SYMBOL 91 #ifdef LRECORD_SYMBOL
92
93 static Lisp_Object mark_symbol (Lisp_Object, void (*) (Lisp_Object));
94 extern void print_symbol (Lisp_Object, Lisp_Object, int);
95 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("symbol", symbol,
96 mark_symbol, print_symbol, 0, 0, 0,
97 struct Lisp_Symbol);
98 92
99 static Lisp_Object 93 static Lisp_Object
100 mark_symbol (Lisp_Object obj, void (*markobj) (Lisp_Object)) 94 mark_symbol (Lisp_Object obj, void (*markobj) (Lisp_Object))
101 { 95 {
102 struct Lisp_Symbol *sym = XSYMBOL (obj); 96 struct Lisp_Symbol *sym = XSYMBOL (obj);
118 XSETSYMBOL (obj, sym); 112 XSETSYMBOL (obj, sym);
119 return obj; 113 return obj;
120 } 114 }
121 } 115 }
122 116
117 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("symbol", symbol,
118 mark_symbol, print_symbol, 0, 0, 0,
119 struct Lisp_Symbol);
123 #endif /* LRECORD_SYMBOL */ 120 #endif /* LRECORD_SYMBOL */
124 121
125 122
126 /**********************************************************************/ 123 /**********************************************************************/
127 /* Intern */ 124 /* Intern */
364 361
365 /* derived from hashpjw, Dragon Book P436. */ 362 /* derived from hashpjw, Dragon Book P436. */
366 int 363 int
367 hash_string (CONST Bufbyte *ptr, Bytecount len) 364 hash_string (CONST Bufbyte *ptr, Bytecount len)
368 { 365 {
369 CONST Bufbyte *p = ptr; 366 int hash = 0;
370 int hash = 0, g; 367
371 Bytecount count = len; 368 while (len-- > 0)
372 369 {
373 while (count-- > 0) 370 int g;
374 { 371 hash = (hash << 4) + *ptr++;
375 hash = (hash << 4) + *p++; 372 g = hash & 0xf0000000;
376 if ((g = (hash & 0xf0000000))) { 373 if (g)
377 hash = hash ^ (g >> 24); 374 hash = (hash ^ (g >> 24)) ^ g;
378 hash = hash ^ g;
379 }
380 } 375 }
381 return hash & 07777777777; 376 return hash & 07777777777;
382 } 377 }
383 378
384 /* Map FN over OBARRAY. The mapping is stopped when FN returns a 379 /* Map FN over OBARRAY. The mapping is stopped when FN returns a
386 void 381 void
387 map_obarray (Lisp_Object obarray, 382 map_obarray (Lisp_Object obarray,
388 int (*fn) (Lisp_Object, void *), void *arg) 383 int (*fn) (Lisp_Object, void *), void *arg)
389 { 384 {
390 REGISTER int i; 385 REGISTER int i;
391 Lisp_Object tail;
392 386
393 CHECK_VECTOR (obarray); 387 CHECK_VECTOR (obarray);
394 for (i = XVECTOR_LENGTH (obarray) - 1; i >= 0; i--) 388 for (i = XVECTOR_LENGTH (obarray) - 1; i >= 0; i--)
395 { 389 {
396 tail = XVECTOR_DATA (obarray)[i]; 390 Lisp_Object tail = XVECTOR_DATA (obarray)[i];
397 if (SYMBOLP (tail)) 391 if (SYMBOLP (tail))
398 while (1) 392 while (1)
399 { 393 {
400 struct Lisp_Symbol *next; 394 struct Lisp_Symbol *next;
401 if ((*fn) (tail, arg)) 395 if ((*fn) (tail, arg))
432 426
433 /**********************************************************************/ 427 /**********************************************************************/
434 /* Apropos */ 428 /* Apropos */
435 /**********************************************************************/ 429 /**********************************************************************/
436 430
437 struct appropos_mapper_closure { 431 struct appropos_mapper_closure
432 {
438 Lisp_Object regexp; 433 Lisp_Object regexp;
439 Lisp_Object predicate; 434 Lisp_Object predicate;
440 Lisp_Object accumulation; 435 Lisp_Object accumulation;
441 }; 436 };
442 437
443 static int 438 static int
444 apropos_mapper (Lisp_Object symbol, void *arg) 439 apropos_mapper (Lisp_Object symbol, void *arg)
445 { 440 {
446 struct appropos_mapper_closure *closure = 441 struct appropos_mapper_closure *closure =
447 (struct appropos_mapper_closure *)arg; 442 (struct appropos_mapper_closure *) arg;
448 Lisp_Object acceptp = Qt;
449 Bytecount match = fast_lisp_string_match (closure->regexp, 443 Bytecount match = fast_lisp_string_match (closure->regexp,
450 Fsymbol_name (symbol)); 444 Fsymbol_name (symbol));
451 if (match < 0) 445
452 acceptp = Qnil; 446 if (match >= 0 &&
453 else if (!NILP (closure->predicate)) 447 (NILP (closure->predicate) ||
454 acceptp = call1 (closure->predicate, symbol); 448 !NILP (call1 (closure->predicate, symbol))))
455
456 if (!NILP (acceptp))
457 closure->accumulation = Fcons (symbol, closure->accumulation); 449 closure->accumulation = Fcons (symbol, closure->accumulation);
450
458 return 0; 451 return 0;
459 } 452 }
460 453
461 DEFUN ("apropos-internal", Fapropos_internal, 1, 2, 0, /* 454 DEFUN ("apropos-internal", Fapropos_internal, 1, 2, 0, /*
462 Show all symbols whose names contain match for REGEXP. 455 Show all symbols whose names contain match for REGEXP.
487 struct buffer *buf, 480 struct buffer *buf,
488 Lisp_Object new_alist_el, 481 Lisp_Object new_alist_el,
489 int set_it_p); 482 int set_it_p);
490 483
491 DEFUN ("boundp", Fboundp, 1, 1, 0, /* 484 DEFUN ("boundp", Fboundp, 1, 1, 0, /*
492 T if SYMBOL's value is not void. 485 Return t if SYMBOL's value is not void.
493 */ 486 */
494 (sym)) 487 (sym))
495 { 488 {
496 CHECK_SYMBOL (sym); 489 CHECK_SYMBOL (sym);
497 return UNBOUNDP (find_symbol_value (sym)) ? Qnil : Qt; 490 return UNBOUNDP (find_symbol_value (sym)) ? Qnil : Qt;
498 } 491 }
499 492
500 DEFUN ("globally-boundp", Fglobally_boundp, 1, 1, 0, /* 493 DEFUN ("globally-boundp", Fglobally_boundp, 1, 1, 0, /*
501 T if SYMBOL has a global (non-bound) value. 494 Return t if SYMBOL has a global (non-bound) value.
502 This is for the byte-compiler; you really shouldn't be using this. 495 This is for the byte-compiler; you really shouldn't be using this.
503 */ 496 */
504 (sym)) 497 (sym))
505 { 498 {
506 CHECK_SYMBOL (sym); 499 CHECK_SYMBOL (sym);
507 return UNBOUNDP (top_level_value (sym)) ? Qnil : Qt; 500 return UNBOUNDP (top_level_value (sym)) ? Qnil : Qt;
508 } 501 }
509 502
510 DEFUN ("fboundp", Ffboundp, 1, 1, 0, /* 503 DEFUN ("fboundp", Ffboundp, 1, 1, 0, /*
511 T if SYMBOL's function definition is not void. 504 Return t if SYMBOL's function definition is not void.
512 */ 505 */
513 (sym)) 506 (sym))
514 { 507 {
515 CHECK_SYMBOL (sym); 508 CHECK_SYMBOL (sym);
516 return (UNBOUNDP (XSYMBOL (sym)->function)) ? Qnil : Qt; 509 return UNBOUNDP (XSYMBOL (sym)->function) ? Qnil : Qt;
517 } 510 }
518 511
519 /* Return non-zero if SYM's value or function (the current contents of 512 /* Return non-zero if SYM's value or function (the current contents of
520 which should be passed in as VAL) is constant, i.e. unsettable. */ 513 which should be passed in as VAL) is constant, i.e. unsettable. */
521 514
524 { 517 {
525 /* #### - I wonder if it would be better to just have a new magic value 518 /* #### - I wonder if it would be better to just have a new magic value
526 type and make nil, t, and all keywords have that same magic 519 type and make nil, t, and all keywords have that same magic
527 constant_symbol value. This test is awfully specific about what is 520 constant_symbol value. This test is awfully specific about what is
528 constant and what isn't. --Stig */ 521 constant and what isn't. --Stig */
529 return 522 if (EQ (sym, Qnil) ||
530 NILP (sym) || 523 EQ (sym, Qt))
531 EQ (sym, Qt) || 524 return 1;
532 (SYMBOL_VALUE_MAGIC_P (val) && 525
533 (XSYMBOL_VALUE_MAGIC_TYPE (val) == SYMVAL_CONST_OBJECT_FORWARD || 526 if (SYMBOL_VALUE_MAGIC_P (val))
534 XSYMBOL_VALUE_MAGIC_TYPE (val) == SYMVAL_CONST_SPECIFIER_FORWARD || 527 switch (XSYMBOL_VALUE_MAGIC_TYPE (val))
535 XSYMBOL_VALUE_MAGIC_TYPE (val) == SYMVAL_CONST_FIXNUM_FORWARD || 528 {
536 XSYMBOL_VALUE_MAGIC_TYPE (val) == SYMVAL_CONST_BOOLEAN_FORWARD || 529 case SYMVAL_CONST_OBJECT_FORWARD:
537 XSYMBOL_VALUE_MAGIC_TYPE (val) == SYMVAL_CONST_CURRENT_BUFFER_FORWARD || 530 case SYMVAL_CONST_SPECIFIER_FORWARD:
538 XSYMBOL_VALUE_MAGIC_TYPE (val) == SYMVAL_CONST_SELECTED_CONSOLE_FORWARD)) 531 case SYMVAL_CONST_FIXNUM_FORWARD:
539 /* We don't return true for keywords here because they are handled 532 case SYMVAL_CONST_BOOLEAN_FORWARD:
533 case SYMVAL_CONST_CURRENT_BUFFER_FORWARD:
534 case SYMVAL_CONST_SELECTED_CONSOLE_FORWARD:
535 return 1;
536 }
537
538 /* We don't return true for keywords here because they are handled
540 specially by reject_constant_symbols(). */ 539 specially by reject_constant_symbols(). */
541 ; 540 return 0;
542 } 541 }
543 542
544 /* We are setting SYM's value slot (or function slot, if FUNCTION_P is 543 /* We are setting SYM's value slot (or function slot, if FUNCTION_P is
545 non-zero) to NEWVAL. Make sure this is allowed. 544 non-zero) to NEWVAL. Make sure this is allowed.
546 FOLLOW_PAST_LISP_MAGIC specifies whether we delve past 545 FOLLOW_PAST_LISP_MAGIC specifies whether we delve past
576 verify_ok_for_buffer_local (Lisp_Object sym, 575 verify_ok_for_buffer_local (Lisp_Object sym,
577 Lisp_Object follow_past_lisp_magic) 576 Lisp_Object follow_past_lisp_magic)
578 { 577 {
579 Lisp_Object val = fetch_value_maybe_past_magic (sym, follow_past_lisp_magic); 578 Lisp_Object val = fetch_value_maybe_past_magic (sym, follow_past_lisp_magic);
580 579
581 if (symbol_is_constant (sym, val) || 580 if (symbol_is_constant (sym, val))
582 (SYMBOL_VALUE_MAGIC_P (val) && 581 goto not_ok;
583 XSYMBOL_VALUE_MAGIC_TYPE (val) == 582 if (SYMBOL_VALUE_MAGIC_P (val))
584 SYMVAL_DEFAULT_BUFFER_FORWARD) || 583 switch (XSYMBOL_VALUE_MAGIC_TYPE (val))
585 (SYMBOL_VALUE_MAGIC_P (val) && 584 {
586 XSYMBOL_VALUE_MAGIC_TYPE (val) == 585 case SYMVAL_DEFAULT_BUFFER_FORWARD:
587 SYMVAL_DEFAULT_CONSOLE_FORWARD) || 586 case SYMVAL_DEFAULT_CONSOLE_FORWARD:
588 /* #### It's theoretically possible for it to be reasonable 587 /* #### It's theoretically possible for it to be reasonable
589 to have both console-local and buffer-local variables, 588 to have both console-local and buffer-local variables,
590 but I don't want to consider that right now. */ 589 but I don't want to consider that right now. */
591 (SYMBOL_VALUE_MAGIC_P (val) && 590 case SYMVAL_SELECTED_CONSOLE_FORWARD:
592 XSYMBOL_VALUE_MAGIC_TYPE (val) == 591 goto not_ok;
593 SYMVAL_SELECTED_CONSOLE_FORWARD) 592 }
594 ) 593
595 signal_error (Qerror, 594 return;
596 list2 (build_string ("Symbol may not be buffer-local"), 595
597 sym)); 596 not_ok:
597 signal_error (Qerror,
598 list2 (build_string ("Symbol may not be buffer-local"), sym));
598 } 599 }
599 600
600 DEFUN ("makunbound", Fmakunbound, 1, 1, 0, /* 601 DEFUN ("makunbound", Fmakunbound, 1, 1, 0, /*
601 Make SYMBOL's value be void. 602 Make SYMBOL's value be void.
602 */ 603 */
616 XSYMBOL (sym)->function = Qunbound; 617 XSYMBOL (sym)->function = Qunbound;
617 return sym; 618 return sym;
618 } 619 }
619 620
620 DEFUN ("symbol-function", Fsymbol_function, 1, 1, 0, /* 621 DEFUN ("symbol-function", Fsymbol_function, 1, 1, 0, /*
621 Return SYMBOL's function definition. Error if that is void. 622 Return SYMBOL's function definition. Error if that is void.
622 */ 623 */
623 (symbol)) 624 (symbol))
624 { 625 {
625 CHECK_SYMBOL (symbol); 626 CHECK_SYMBOL (symbol);
626 if (UNBOUNDP (XSYMBOL (symbol)->function)) 627 if (UNBOUNDP (XSYMBOL (symbol)->function))
889 low-level functions below do not accept them; you need 890 low-level functions below do not accept them; you need
890 to call follow_varalias_pointers to get the actual 891 to call follow_varalias_pointers to get the actual
891 symbol to operate on. 892 symbol to operate on.
892 */ 893 */
893 894
894 static Lisp_Object mark_symbol_value_buffer_local (Lisp_Object, 895 static Lisp_Object
895 void (*) (Lisp_Object)); 896 mark_symbol_value_buffer_local (Lisp_Object obj,
896 static Lisp_Object mark_symbol_value_lisp_magic (Lisp_Object, 897 void (*markobj) (Lisp_Object))
897 void (*) (Lisp_Object)); 898 {
898 static Lisp_Object mark_symbol_value_varalias (Lisp_Object, 899 struct symbol_value_buffer_local *bfwd;
899 void (*) (Lisp_Object)); 900
901 assert (XSYMBOL_VALUE_MAGIC_TYPE (obj) == SYMVAL_BUFFER_LOCAL ||
902 XSYMBOL_VALUE_MAGIC_TYPE (obj) == SYMVAL_SOME_BUFFER_LOCAL);
903
904 bfwd = XSYMBOL_VALUE_BUFFER_LOCAL (obj);
905 ((markobj) (bfwd->default_value));
906 ((markobj) (bfwd->current_value));
907 ((markobj) (bfwd->current_buffer));
908 return bfwd->current_alist_element;
909 }
910
911 static Lisp_Object
912 mark_symbol_value_lisp_magic (Lisp_Object obj,
913 void (*markobj) (Lisp_Object))
914 {
915 struct symbol_value_lisp_magic *bfwd;
916 int i;
917
918 assert (XSYMBOL_VALUE_MAGIC_TYPE (obj) == SYMVAL_LISP_MAGIC);
919
920 bfwd = XSYMBOL_VALUE_LISP_MAGIC (obj);
921 for (i = 0; i < MAGIC_HANDLER_MAX; i++)
922 {
923 ((markobj) (bfwd->handler[i]));
924 ((markobj) (bfwd->harg[i]));
925 }
926 return bfwd->shadowed;
927 }
928
929 static Lisp_Object
930 mark_symbol_value_varalias (Lisp_Object obj,
931 void (*markobj) (Lisp_Object))
932 {
933 struct symbol_value_varalias *bfwd;
934
935 assert (XSYMBOL_VALUE_MAGIC_TYPE (obj) == SYMVAL_VARALIAS);
936
937 bfwd = XSYMBOL_VALUE_VARALIAS (obj);
938 ((markobj) (bfwd->shadowed));
939 return bfwd->aliasee;
940 }
941
942 /* Should never, ever be called. (except by an external debugger) */
943 void
944 print_symbol_value_magic (Lisp_Object obj,
945 Lisp_Object printcharfun, int escapeflag)
946 {
947 char buf[200];
948 sprintf (buf, "#<INTERNAL EMACS BUG (%s type %d) 0x%p>",
949 XRECORD_LHEADER_IMPLEMENTATION (obj)->name,
950 XSYMBOL_VALUE_MAGIC_TYPE (obj),
951 (void *) XPNTR (obj));
952 write_c_string (buf, printcharfun);
953 }
900 954
901 DEFINE_LRECORD_IMPLEMENTATION ("symbol-value-forward", 955 DEFINE_LRECORD_IMPLEMENTATION ("symbol-value-forward",
902 symbol_value_forward, 956 symbol_value_forward,
903 this_one_is_unmarkable, 957 this_one_is_unmarkable,
904 print_symbol_value_magic, 0, 0, 0, 958 print_symbol_value_magic, 0, 0, 0,
905 struct symbol_value_forward); 959 struct symbol_value_forward);
906 960
907 DEFINE_LRECORD_IMPLEMENTATION ("symbol-value-buffer-local", 961 DEFINE_LRECORD_IMPLEMENTATION ("symbol-value-buffer-local",
908 symbol_value_buffer_local, 962 symbol_value_buffer_local,
909 mark_symbol_value_buffer_local, 963 mark_symbol_value_buffer_local,
910 print_symbol_value_magic, 964 print_symbol_value_magic, 0, 0, 0,
911 0, 0, 0,
912 struct symbol_value_buffer_local); 965 struct symbol_value_buffer_local);
913 966
914 DEFINE_LRECORD_IMPLEMENTATION ("symbol-value-lisp-magic", 967 DEFINE_LRECORD_IMPLEMENTATION ("symbol-value-lisp-magic",
915 symbol_value_lisp_magic, 968 symbol_value_lisp_magic,
916 mark_symbol_value_lisp_magic, 969 mark_symbol_value_lisp_magic,
917 print_symbol_value_magic, 970 print_symbol_value_magic, 0, 0, 0,
918 0, 0, 0,
919 struct symbol_value_lisp_magic); 971 struct symbol_value_lisp_magic);
920 972
921 DEFINE_LRECORD_IMPLEMENTATION ("symbol-value-varalias", 973 DEFINE_LRECORD_IMPLEMENTATION ("symbol-value-varalias",
922 symbol_value_varalias, 974 symbol_value_varalias,
923 mark_symbol_value_varalias, 975 mark_symbol_value_varalias,
924 print_symbol_value_magic, 976 print_symbol_value_magic, 0, 0, 0,
925 0, 0, 0,
926 struct symbol_value_varalias); 977 struct symbol_value_varalias);
927
928 static Lisp_Object
929 mark_symbol_value_buffer_local (Lisp_Object obj,
930 void (*markobj) (Lisp_Object))
931 {
932 struct symbol_value_buffer_local *bfwd;
933
934 assert (XSYMBOL_VALUE_MAGIC_TYPE (obj) == SYMVAL_BUFFER_LOCAL ||
935 XSYMBOL_VALUE_MAGIC_TYPE (obj) == SYMVAL_SOME_BUFFER_LOCAL);
936
937 bfwd = XSYMBOL_VALUE_BUFFER_LOCAL (obj);
938 ((markobj) (bfwd->default_value));
939 ((markobj) (bfwd->current_value));
940 ((markobj) (bfwd->current_buffer));
941 return bfwd->current_alist_element;
942 }
943
944 static Lisp_Object
945 mark_symbol_value_lisp_magic (Lisp_Object obj,
946 void (*markobj) (Lisp_Object))
947 {
948 struct symbol_value_lisp_magic *bfwd;
949 int i;
950
951 assert (XSYMBOL_VALUE_MAGIC_TYPE (obj) == SYMVAL_LISP_MAGIC);
952
953 bfwd = XSYMBOL_VALUE_LISP_MAGIC (obj);
954 for (i = 0; i < MAGIC_HANDLER_MAX; i++)
955 {
956 ((markobj) (bfwd->handler[i]));
957 ((markobj) (bfwd->harg[i]));
958 }
959 return bfwd->shadowed;
960 }
961
962 static Lisp_Object
963 mark_symbol_value_varalias (Lisp_Object obj,
964 void (*markobj) (Lisp_Object))
965 {
966 struct symbol_value_varalias *bfwd;
967
968 assert (XSYMBOL_VALUE_MAGIC_TYPE (obj) == SYMVAL_VARALIAS);
969
970 bfwd = XSYMBOL_VALUE_VARALIAS (obj);
971 ((markobj) (bfwd->shadowed));
972 return bfwd->aliasee;
973 }
974
975 /* Should never, ever be called. (except by an external debugger) */
976 void
977 print_symbol_value_magic (Lisp_Object obj,
978 Lisp_Object printcharfun, int escapeflag)
979 {
980 char buf[200];
981 sprintf (buf, "#<INTERNAL EMACS BUG (symfwd %d) 0x%p>",
982 XSYMBOL_VALUE_MAGIC_TYPE (obj), (void *) XPNTR (obj));
983 write_c_string (buf, printcharfun);
984 }
985 978
986 979
987 /* Getting and setting values of symbols */ 980 /* Getting and setting values of symbols */
988 981
989 /* Given the raw contents of a symbol value cell, return the Lisp value of 982 /* Given the raw contents of a symbol value cell, return the Lisp value of
1865 1858
1866 RETURN_NOT_REACHED(Qnil) /* suppress compiler warning */ 1859 RETURN_NOT_REACHED(Qnil) /* suppress compiler warning */
1867 } 1860 }
1868 1861
1869 DEFUN ("default-boundp", Fdefault_boundp, 1, 1, 0, /* 1862 DEFUN ("default-boundp", Fdefault_boundp, 1, 1, 0, /*
1870 Return T if SYMBOL has a non-void default value. 1863 Return t if SYMBOL has a non-void default value.
1871 This is the value that is seen in buffers that do not have their own values 1864 This is the value that is seen in buffers that do not have their own values
1872 for this variable. 1865 for this variable.
1873 */ 1866 */
1874 (sym)) 1867 (sym))
1875 { 1868 {
2056 2049
2057 { 2050 {
2058 struct symbol_value_buffer_local *bfwd 2051 struct symbol_value_buffer_local *bfwd
2059 = alloc_lcrecord_type (struct symbol_value_buffer_local, 2052 = alloc_lcrecord_type (struct symbol_value_buffer_local,
2060 lrecord_symbol_value_buffer_local); 2053 lrecord_symbol_value_buffer_local);
2061 Lisp_Object foo = Qnil; 2054 Lisp_Object foo;
2062 bfwd->magic.type = SYMVAL_BUFFER_LOCAL; 2055 bfwd->magic.type = SYMVAL_BUFFER_LOCAL;
2063 2056
2064 bfwd->default_value = find_symbol_value (variable); 2057 bfwd->default_value = find_symbol_value (variable);
2065 bfwd->current_value = valcontents; 2058 bfwd->current_value = valcontents;
2066 bfwd->current_alist_element = Qnil; 2059 bfwd->current_alist_element = Qnil;
2081 as it is to do so to the default-value, but it's 2074 as it is to do so to the default-value, but it's
2082 still really dubious. */ 2075 still really dubious. */
2083 if (UNBOUNDP (valcontents)) 2076 if (UNBOUNDP (valcontents))
2084 Fset (variable, Qnil); 2077 Fset (variable, Qnil);
2085 #endif 2078 #endif
2086 return (variable); 2079 return variable;
2087 } 2080 }
2088 } 2081 }
2089 2082
2090 DEFUN ("make-local-variable", Fmake_local_variable, 1, 1, "vMake Local Variable: ", /* 2083 DEFUN ("make-local-variable", Fmake_local_variable, 1, 1,
2084 "vMake Local Variable: ", /*
2091 Make VARIABLE have a separate value in the current buffer. 2085 Make VARIABLE have a separate value in the current buffer.
2092 Other buffers will continue to share a common default value. 2086 Other buffers will continue to share a common default value.
2093 \(The buffer-local value of VARIABLE starts out as the same value 2087 \(The buffer-local value of VARIABLE starts out as the same value
2094 VARIABLE previously had. If VARIABLE was void, it remains void.) 2088 VARIABLE previously had. If VARIABLE was void, it remains void.)
2095 See also `make-variable-buffer-local'. 2089 See also `make-variable-buffer-local'.
2237 } 2231 }
2238 2232
2239 return variable; 2233 return variable;
2240 } 2234 }
2241 2235
2242 DEFUN ("kill-local-variable", Fkill_local_variable, 1, 1, "vKill Local Variable: ", /* 2236 DEFUN ("kill-local-variable", Fkill_local_variable, 1, 1,
2237 "vKill Local Variable: ", /*
2243 Make VARIABLE no longer have a separate value in the current buffer. 2238 Make VARIABLE no longer have a separate value in the current buffer.
2244 From now on the default value will apply in this buffer. 2239 From now on the default value will apply in this buffer.
2245 */ 2240 */
2246 (variable)) 2241 (variable))
2247 { 2242 {
2329 } 2324 }
2330 RETURN_NOT_REACHED(Qnil) /* suppress compiler warning */ 2325 RETURN_NOT_REACHED(Qnil) /* suppress compiler warning */
2331 } 2326 }
2332 2327
2333 2328
2334 DEFUN ("kill-console-local-variable", Fkill_console_local_variable, 1, 1, "vKill Console Local Variable: ", /* 2329 DEFUN ("kill-console-local-variable", Fkill_console_local_variable, 1, 1,
2330 "vKill Console Local Variable: ", /*
2335 Make VARIABLE no longer have a separate value in the selected console. 2331 Make VARIABLE no longer have a separate value in the selected console.
2336 From now on the default value will apply in this console. 2332 From now on the default value will apply in this console.
2337 */ 2333 */
2338 (variable)) 2334 (variable))
2339 { 2335 {
3019 will be followed appropriately. 3015 will be followed appropriately.
3020 If VARIABLE already has a value, this value will be shadowed 3016 If VARIABLE already has a value, this value will be shadowed
3021 until the alias is removed, at which point it will be restored. 3017 until the alias is removed, at which point it will be restored.
3022 Currently VARIABLE cannot be a built-in variable, a variable that 3018 Currently VARIABLE cannot be a built-in variable, a variable that
3023 has a buffer-local value in any buffer, or the symbols nil or t. 3019 has a buffer-local value in any buffer, or the symbols nil or t.
3024 (ALIAS, however, can be any type of variable.) 3020 \(ALIAS, however, can be any type of variable.)
3025 */ 3021 */
3026 (variable, alias)) 3022 (variable, alias))
3027 { 3023 {
3028 struct symbol_value_varalias *bfwd; 3024 struct symbol_value_varalias *bfwd;
3029 Lisp_Object valcontents; 3025 Lisp_Object valcontents;
3141 Lisp_Object Vpure_uninterned_symbol_table; 3137 Lisp_Object Vpure_uninterned_symbol_table;
3142 3138
3143 void 3139 void
3144 init_symbols_once_early (void) 3140 init_symbols_once_early (void)
3145 { 3141 {
3142 #ifndef Qzero
3143 Qzero = make_int (0); /* Only used if Lisp_Object is a union type */
3144 #endif
3145
3146 #ifndef Qnull_pointer
3147 /* C guarantees that Qnull_pointer will be initialized to all 0 bits,
3148 so the following is a actually a no-op. */
3149 XSETOBJ (Qnull_pointer, (enum Lisp_Type) 0, 0);
3150 #endif
3151
3146 /* see comment in Fpurecopy() */ 3152 /* see comment in Fpurecopy() */
3147 Vpure_uninterned_symbol_table = 3153 Vpure_uninterned_symbol_table =
3148 make_lisp_hashtable (50, HASHTABLE_NONWEAK, HASHTABLE_EQ); 3154 make_lisp_hashtable (50, HASHTABLE_NONWEAK, HASHTABLE_EQ);
3149 staticpro(&Vpure_uninterned_symbol_table); 3155 staticpro (&Vpure_uninterned_symbol_table);
3150 3156
3151 Qnil = Fmake_symbol (make_pure_pname ((CONST Bufbyte *) "nil", 3, 1)); 3157 Qnil = Fmake_symbol (make_pure_pname ((CONST Bufbyte *) "nil", 3, 1));
3152 /* Bootstrapping problem: Qnil isn't set when make_pure_pname is 3158 /* Bootstrapping problem: Qnil isn't set when make_pure_pname is
3153 called the first time. */ 3159 called the first time. */
3154 XSYMBOL (Qnil)->name->plist = Qnil; 3160 XSYMBOL (Qnil)->name->plist = Qnil;
3155 XSYMBOL (Qnil)->value = Qnil; /* Nihil ex nihil */ 3161 XSYMBOL (Qnil)->value = Qnil; /* Nihil ex nihil */
3156 XSYMBOL (Qnil)->plist = Qnil; 3162 XSYMBOL (Qnil)->plist = Qnil;
3157 3163
3158 #ifndef Qzero
3159 Qzero = make_int (0); /* Only used if Lisp_Object is a union type */
3160 #endif
3161
3162 #ifndef Qnull_pointer
3163 Qnull_pointer.ui = 0;
3164 #endif
3165
3166 Vobarray = make_vector (OBARRAY_SIZE, Qzero); 3164 Vobarray = make_vector (OBARRAY_SIZE, Qzero);
3167 initial_obarray = Vobarray; 3165 initial_obarray = Vobarray;
3168 staticpro (&initial_obarray); 3166 staticpro (&initial_obarray);
3169 /* Intern nil in the obarray */ 3167 /* Intern nil in the obarray */
3170 { 3168 {
3171 /* These locals are to kludge around a pyramid compiler bug. */ 3169 int hash = hash_string (string_data (XSYMBOL (Qnil)->name), 3);
3172 int hash; 3170 XVECTOR_DATA (Vobarray)[hash % OBARRAY_SIZE] = Qnil;
3173 Lisp_Object *tem;
3174
3175 hash = hash_string (string_data (XSYMBOL (Qnil)->name), 3);
3176 /* Separate statement here to avoid VAXC bug. */
3177 hash %= OBARRAY_SIZE;
3178 tem = &XVECTOR_DATA (Vobarray)[hash];
3179 *tem = Qnil;
3180 XSYMBOL (Qnil)->obarray = Qt; 3171 XSYMBOL (Qnil)->obarray = Qt;
3181 } 3172 }
3182 3173
3183 { 3174 {
3184 /* Required to get around a GCC syntax error on certain 3175 /* Required to get around a GCC syntax error on certain
3341 DEFSUBR (Fdontusethis_set_symbol_value_handler); 3332 DEFSUBR (Fdontusethis_set_symbol_value_handler);
3342 } 3333 }
3343 3334
3344 /* Create and initialize a variable whose value is forwarded to C data */ 3335 /* Create and initialize a variable whose value is forwarded to C data */
3345 void 3336 void
3346 defvar_mumble (CONST char *namestring, 3337 defvar_mumble (CONST char *namestring, CONST void *magic, size_t sizeof_magic)
3347 CONST void *magic, int sizeof_magic)
3348 { 3338 {
3349 Lisp_Object kludge; 3339 Lisp_Object kludge;
3350 Lisp_Object sym = Fintern (make_pure_pname ((CONST Bufbyte *) namestring, 3340 Lisp_Object sym = Fintern (make_pure_pname ((CONST Bufbyte *) namestring,
3351 strlen (namestring), 3341 strlen (namestring),
3352 1), 3342 1),