comparison src/buffer.h @ 28350:51fbfd80a45f

(MAX_PER_BUFFER_VARS): Renamed from MAX_BUFFER_LOCAL_VARS. (PER_BUFFER_VAR_OFFSET): Renamed from BUFFER_LOCAL_VAR_OFFSET. (PER_BUFFER_VAR_IDX): Renamed from BUFFER_LOCAL_VAR_IDX. (PER_BUFFER_VALUE_P): Renamed from BUFFER_HAS_LOCAL_VALUE_P. (SET_PER_BUFFER_VALUE_P): Renamed from SET_BUFFER_HAS_LOCAL_VALUE_P. (PER_BUFFER_IDX): Renamed from BUFFER_LOCAL_IDX. (PER_BUFFER_DEFAULT): Renamed from BUFFER_LOCAL_DEFAULT_VALUE. (PER_BUFFER_VALUE): Renamed from BUFFER_LOCAL_VALUE. (PER_BUFFER_SYMBOL): Renamed from BUFFER_LOCAL_SYMBOL. (PER_BUFFER_TYPE): Renamed from BUFFER_LOCAL_TYPE.
author Gerd Moellmann <gerd@gnu.org>
date Mon, 27 Mar 2000 12:49:02 +0000
parents 7d1e7bfa5ae1
children fd361114073d
comparison
equal deleted inserted replaced
28349:26f2a2e9a2b5 28350:51fbfd80a45f
480 /* A non-zero value in slot IDX means that per-buffer variable 480 /* A non-zero value in slot IDX means that per-buffer variable
481 with index IDX has a local value in this buffer. The index IDX 481 with index IDX has a local value in this buffer. The index IDX
482 for a buffer-local variable is stored in that variable's slot 482 for a buffer-local variable is stored in that variable's slot
483 in buffer_local_flags as a Lisp integer. If the index is -1, 483 in buffer_local_flags as a Lisp integer. If the index is -1,
484 this means the variable is always local in all buffers. */ 484 this means the variable is always local in all buffers. */
485 #define MAX_BUFFER_LOCAL_VARS 30 485 #define MAX_PER_BUFFER_VARS 50
486 char local_flags[MAX_BUFFER_LOCAL_VARS]; 486 char local_flags[MAX_PER_BUFFER_VARS];
487 487
488 /* Set to the modtime of the visited file when read or written. 488 /* Set to the modtime of the visited file when read or written.
489 -1 means visited file was nonexistent. 489 -1 means visited file was nonexistent.
490 0 means visited file modtime unknown; in no case complain 490 0 means visited file modtime unknown; in no case complain
491 about any mismatch on next save attempt. */ 491 about any mismatch on next save attempt. */
861 Buffer-local Variables 861 Buffer-local Variables
862 ***********************************************************************/ 862 ***********************************************************************/
863 863
864 /* Number of per-buffer variables used. */ 864 /* Number of per-buffer variables used. */
865 865
866 extern int max_buffer_local_idx; 866 extern int last_per_buffer_idx;
867 867
868 /* Return the offset in bytes of member VAR of struct buffer 868 /* Return the offset in bytes of member VAR of struct buffer
869 from the start of a buffer structure. */ 869 from the start of a buffer structure. */
870 870
871 #define BUFFER_LOCAL_VAR_OFFSET(VAR) \ 871 #define PER_BUFFER_VAR_OFFSET(VAR) \
872 ((char *) &buffer_local_flags.VAR - (char *) &buffer_local_flags) 872 ((char *) &buffer_local_flags.VAR - (char *) &buffer_local_flags)
873 873
874 /* Return the index of buffer-local variable VAR. Each per-buffer 874 /* Return the index of buffer-local variable VAR. Each per-buffer
875 variable has an index > 0 associated with it, except when it always 875 variable has an index > 0 associated with it, except when it always
876 has buffer-local values, in which case the index is -1. If this is 876 has buffer-local values, in which case the index is -1. If this is
877 0, this is a bug and means that the slot of VAR in 877 0, this is a bug and means that the slot of VAR in
878 buffer_local_flags wasn't intiialized. */ 878 buffer_local_flags wasn't intiialized. */
879 879
880 #define BUFFER_LOCAL_VAR_IDX(VAR) \ 880 #define PER_BUFFER_VAR_IDX(VAR) \
881 BUFFER_LOCAL_IDX (BUFFER_LOCAL_VAR_OFFSET (VAR)) 881 PER_BUFFER_IDX (PER_BUFFER_VAR_OFFSET (VAR))
882 882
883 /* Value is non-zero if the variable with index IDX has a local value 883 /* Value is non-zero if the variable with index IDX has a local value
884 in buffer B. */ 884 in buffer B. */
885 885
886 #define BUFFER_HAS_LOCAL_VALUE_P(B, IDX) \ 886 #define PER_BUFFER_VALUE_P(B, IDX) \
887 (((IDX) < 0 || IDX >= max_buffer_local_idx) \ 887 (((IDX) < 0 || IDX >= last_per_buffer_idx) \
888 ? (abort (), 0) \ 888 ? (abort (), 0) \
889 : ((B)->local_flags[IDX] != 0)) 889 : ((B)->local_flags[IDX] != 0))
890 890
891 /* Set whether per-buffer variable with index IDX has a buffer-local 891 /* Set whether per-buffer variable with index IDX has a buffer-local
892 value in buffer B. VAL zero means it hasn't. */ 892 value in buffer B. VAL zero means it hasn't. */
893 893
894 #define SET_BUFFER_HAS_LOCAL_VALUE_P(B, IDX, VAL) \ 894 #define SET_PER_BUFFER_VALUE_P(B, IDX, VAL) \
895 do { \ 895 do { \
896 if ((IDX) < 0 || (IDX) >= max_buffer_local_idx) \ 896 if ((IDX) < 0 || (IDX) >= last_per_buffer_idx) \
897 abort (); \ 897 abort (); \
898 (B)->local_flags[IDX] = (VAL); \ 898 (B)->local_flags[IDX] = (VAL); \
899 } while (0) 899 } while (0)
900 900
901 /* Return the index of the per-buffer variable at offset OFFSET in the 901 /* Return the index of the per-buffer variable at offset OFFSET in the
902 buffer structure. */ 902 buffer structure. */
903 903
904 #define BUFFER_LOCAL_IDX(OFFSET) \ 904 #define PER_BUFFER_IDX(OFFSET) \
905 XINT (*(Lisp_Object *)((OFFSET) + (char *) &buffer_local_flags)) 905 XINT (*(Lisp_Object *)((OFFSET) + (char *) &buffer_local_flags))
906 906
907 /* Return the default value of the per-buffer variable at offset 907 /* Return the default value of the per-buffer variable at offset
908 OFFSET in the buffer structure. */ 908 OFFSET in the buffer structure. */
909 909
910 #define BUFFER_LOCAL_DEFAULT_VALUE(OFFSET) \ 910 #define PER_BUFFER_DEFAULT(OFFSET) \
911 (*(Lisp_Object *)((OFFSET) + (char *) &buffer_defaults)) 911 (*(Lisp_Object *)((OFFSET) + (char *) &buffer_defaults))
912 912
913 /* Return the buffer-local value of the per-buffer variable at offset 913 /* Return the buffer-local value of the per-buffer variable at offset
914 OFFSET in the buffer structure. */ 914 OFFSET in the buffer structure. */
915 915
916 #define BUFFER_LOCAL_VALUE(BUFFER, OFFSET) \ 916 #define PER_BUFFER_VALUE(BUFFER, OFFSET) \
917 (*(Lisp_Object *)((OFFSET) + (char *) (BUFFER))) 917 (*(Lisp_Object *)((OFFSET) + (char *) (BUFFER)))
918 918
919 /* Return the symbol of the per-buffer variable at offset OFFSET in 919 /* Return the symbol of the per-buffer variable at offset OFFSET in
920 the buffer structure. */ 920 the buffer structure. */
921 921
922 #define BUFFER_LOCAL_SYMBOL(OFFSET) \ 922 #define PER_BUFFER_SYMBOL(OFFSET) \
923 (*(Lisp_Object *)((OFFSET) + (char *) &buffer_local_symbols)) 923 (*(Lisp_Object *)((OFFSET) + (char *) &buffer_local_symbols))
924 924
925 /* Return the type of the per-buffer variable at offset OFFSET in the 925 /* Return the type of the per-buffer variable at offset OFFSET in the
926 buffer structure. */ 926 buffer structure. */
927 927
928 #define BUFFER_LOCAL_TYPE(OFFSET) \ 928 #define PER_BUFFER_TYPE(OFFSET) \
929 (*(Lisp_Object *)((OFFSET) + (char *) &buffer_local_types)) 929 (*(Lisp_Object *)((OFFSET) + (char *) &buffer_local_types))