Mercurial > hg > xemacs-beta
comparison src/lread.c @ 173:8eaf7971accc r20-3b13
Import from CVS: tag r20-3b13
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:49:09 +0200 |
parents | 3bb7ccffb0c0 |
children | bfd6434d15b3 |
comparison
equal
deleted
inserted
replaced
172:a38aed19690b | 173:8eaf7971accc |
---|---|
61 But this is fucking typical Stallman bogosity. Nested | 61 But this is fucking typical Stallman bogosity. Nested |
62 backquotes are perfectly legal and fail utterly with | 62 backquotes are perfectly legal and fail utterly with |
63 this silliness. */ | 63 this silliness. */ |
64 static int new_backquote_flag, old_backquote_flag; | 64 static int new_backquote_flag, old_backquote_flag; |
65 Lisp_Object Qbackquote, Qbacktick, Qcomma, Qcomma_at, Qcomma_dot; | 65 Lisp_Object Qbackquote, Qbacktick, Qcomma, Qcomma_at, Qcomma_dot; |
66 #endif | 66 #endif |
67 Lisp_Object Qvariable_domain; /* I18N3 */ | 67 Lisp_Object Qvariable_domain; /* I18N3 */ |
68 Lisp_Object Vvalues, Vstandard_input, Vafter_load_alist; | 68 Lisp_Object Vvalues, Vstandard_input, Vafter_load_alist; |
69 Lisp_Object Qcurrent_load_list; | 69 Lisp_Object Qcurrent_load_list; |
70 Lisp_Object Qload, Qload_file_name; | 70 Lisp_Object Qload, Qload_file_name; |
71 Lisp_Object Qlocate_file_hash_table; | 71 Lisp_Object Qlocate_file_hash_table; |
227 | 227 |
228 if (BUFFERP (readcharfun)) | 228 if (BUFFERP (readcharfun)) |
229 { | 229 { |
230 Emchar c; | 230 Emchar c; |
231 struct buffer *b = XBUFFER (readcharfun); | 231 struct buffer *b = XBUFFER (readcharfun); |
232 | 232 |
233 if (!BUFFER_LIVE_P (b)) | 233 if (!BUFFER_LIVE_P (b)) |
234 error ("Reading from killed buffer"); | 234 error ("Reading from killed buffer"); |
235 | 235 |
236 if (BUF_PT (b) >= BUF_ZV (b)) | 236 if (BUF_PT (b) >= BUF_ZV (b)) |
237 return -1; | 237 return -1; |
340 #undef kludge | 340 #undef kludge |
341 #endif /* standalone */ | 341 #endif /* standalone */ |
342 | 342 |
343 | 343 |
344 | 344 |
345 static void readevalloop (Lisp_Object readcharfun, | 345 static void readevalloop (Lisp_Object readcharfun, |
346 Lisp_Object sourcefile, | 346 Lisp_Object sourcefile, |
347 Lisp_Object (*evalfun) (Lisp_Object), | 347 Lisp_Object (*evalfun) (Lisp_Object), |
348 int printflag); | 348 int printflag); |
349 | 349 |
350 static Lisp_Object | 350 static Lisp_Object |
390 Ashes ashes, they all fall down. | 390 Ashes ashes, they all fall down. |
391 */ | 391 */ |
392 void | 392 void |
393 ebolify_bytecode_constants (Lisp_Object vector) | 393 ebolify_bytecode_constants (Lisp_Object vector) |
394 { | 394 { |
395 int len = vector_length (XVECTOR (vector)); | 395 int len = XVECTOR_LENGTH (vector); |
396 int i; | 396 int i; |
397 | 397 |
398 for (i = 0; i < len; i++) | 398 for (i = 0; i < len; i++) |
399 { | 399 { |
400 Lisp_Object el = vector_data (XVECTOR (vector))[i]; | 400 Lisp_Object el = XVECTOR_DATA (vector)[i]; |
401 | 401 |
402 /* We don't check for `eq', `equal', and the others that have | 402 /* We don't check for `eq', `equal', and the others that have |
403 bytecode opcodes. This might lose if someone passes #'eq or | 403 bytecode opcodes. This might lose if someone passes #'eq or |
404 something to `funcall', but who would really do that? As | 404 something to `funcall', but who would really do that? As |
405 they say in law, we've made a "good-faith effort" to | 405 they say in law, we've made a "good-faith effort" to |
418 #endif | 418 #endif |
419 if (EQ (el, Qrassq)) | 419 if (EQ (el, Qrassq)) |
420 el = Qold_rassq; | 420 el = Qold_rassq; |
421 if (EQ (el, Qrassoc)) | 421 if (EQ (el, Qrassoc)) |
422 el = Qold_rassoc; | 422 el = Qold_rassoc; |
423 vector_data (XVECTOR (vector))[i] = el; | 423 XVECTOR_DATA (vector)[i] = el; |
424 } | 424 } |
425 } | 425 } |
426 | 426 |
427 static Lisp_Object | 427 static Lisp_Object |
428 pas_de_lache_ici (int fd, Lisp_Object victim) | 428 pas_de_lache_ici (int fd, Lisp_Object victim) |
603 if (XSTRING_LENGTH (file) > 0) | 603 if (XSTRING_LENGTH (file) > 0) |
604 { | 604 { |
605 char *foundstr; | 605 char *foundstr; |
606 int foundlen; | 606 int foundlen; |
607 | 607 |
608 fd = locate_file (Vload_path, file, | 608 fd = locate_file (Vload_path, file, |
609 ((!NILP (nosuffix)) ? "" : | 609 ((!NILP (nosuffix)) ? "" : |
610 load_ignore_elc_files ? ".el:" : | 610 load_ignore_elc_files ? ".el:" : |
611 ".elc:.el:"), | 611 ".elc:.el:"), |
612 &found, | 612 &found, |
613 -1); | 613 -1); |
758 else | 758 else |
759 load_byte_code_version = elc_header[4]; | 759 load_byte_code_version = elc_header[4]; |
760 } | 760 } |
761 else | 761 else |
762 load_byte_code_version = 100; /* no Ebolification needed */ | 762 load_byte_code_version = 100; /* no Ebolification needed */ |
763 | 763 |
764 readevalloop (lispstream, file, Feval, 0); | 764 readevalloop (lispstream, file, Feval, 0); |
765 #ifdef MULE | 765 #ifdef MULE |
766 if (!NILP (used_codesys)) | 766 if (!NILP (used_codesys)) |
767 Fset (used_codesys, | 767 Fset (used_codesys, |
768 XCODING_SYSTEM_NAME | 768 XCODING_SYSTEM_NAME |
801 } | 801 } |
802 #endif /* DEBUG_XEMACS */ | 802 #endif /* DEBUG_XEMACS */ |
803 | 803 |
804 if (!noninteractive) | 804 if (!noninteractive) |
805 PRINT_LOADING_MESSAGE ("done"); | 805 PRINT_LOADING_MESSAGE ("done"); |
806 | 806 |
807 UNGCPRO; | 807 UNGCPRO; |
808 return Qt; | 808 return Qt; |
809 } | 809 } |
810 | 810 |
811 | 811 |
850 { | 850 { |
851 CHECK_STRING (suffixes); | 851 CHECK_STRING (suffixes); |
852 } | 852 } |
853 if (!(NILP (mode) || (INTP (mode) && XINT (mode) >= 0))) | 853 if (!(NILP (mode) || (INTP (mode) && XINT (mode) >= 0))) |
854 mode = wrong_type_argument (Qnatnump, mode); | 854 mode = wrong_type_argument (Qnatnump, mode); |
855 locate_file (path_list, filename, | 855 locate_file (path_list, filename, |
856 ((NILP (suffixes)) ? "" : | 856 ((NILP (suffixes)) ? "" : |
857 (char *) (XSTRING_DATA (suffixes))), | 857 (char *) (XSTRING_DATA (suffixes))), |
858 &tp, (NILP (mode) ? R_OK : XINT (mode))); | 858 &tp, (NILP (mode) ? R_OK : XINT (mode))); |
859 return tp; | 859 return tp; |
860 } | 860 } |
923 /* Calculate maximum size of any filename made from | 923 /* Calculate maximum size of any filename made from |
924 this path element/specified file name and any possible suffix. */ | 924 this path element/specified file name and any possible suffix. */ |
925 want_size = strlen (suffix) + XSTRING_LENGTH (filename) + 1; | 925 want_size = strlen (suffix) + XSTRING_LENGTH (filename) + 1; |
926 if (fn_size < want_size) | 926 if (fn_size < want_size) |
927 fn = (char *) alloca (fn_size = 100 + want_size); | 927 fn = (char *) alloca (fn_size = 100 + want_size); |
928 | 928 |
929 nsuffix = suffix; | 929 nsuffix = suffix; |
930 | 930 |
931 /* Loop over suffixes. */ | 931 /* Loop over suffixes. */ |
932 while (1) | 932 while (1) |
933 { | 933 { |
934 char *esuffix = (char *) strchr (nsuffix, ':'); | 934 char *esuffix = (char *) strchr (nsuffix, ':'); |
935 int lsuffix = ((esuffix) ? (esuffix - nsuffix) : strlen (nsuffix)); | 935 int lsuffix = ((esuffix) ? (esuffix - nsuffix) : strlen (nsuffix)); |
936 | 936 |
937 /* Concatenate path element/specified name with the suffix. */ | 937 /* Concatenate path element/specified name with the suffix. */ |
938 strncpy (fn, (char *) XSTRING_DATA (filename), | 938 strncpy (fn, (char *) XSTRING_DATA (filename), |
939 XSTRING_LENGTH (filename)); | 939 XSTRING_LENGTH (filename)); |
940 fn[XSTRING_LENGTH (filename)] = 0; | 940 fn[XSTRING_LENGTH (filename)] = 0; |
941 if (lsuffix != 0) /* Bug happens on CCI if lsuffix is 0. */ | 941 if (lsuffix != 0) /* Bug happens on CCI if lsuffix is 0. */ |
942 strncat (fn, nsuffix, lsuffix); | 942 strncat (fn, nsuffix, lsuffix); |
943 | 943 |
944 /* Ignore file if it's a directory. */ | 944 /* Ignore file if it's a directory. */ |
945 if (stat (fn, &st) >= 0 | 945 if (stat (fn, &st) >= 0 |
946 && (st.st_mode & S_IFMT) != S_IFDIR) | 946 && (st.st_mode & S_IFMT) != S_IFDIR) |
947 { | 947 { |
948 /* Check that we can access or open it. */ | 948 /* Check that we can access or open it. */ |
952 #ifdef DOS_NT | 952 #ifdef DOS_NT |
953 fd = open (fn, O_RDONLY | O_BINARY, 0); | 953 fd = open (fn, O_RDONLY | O_BINARY, 0); |
954 #else | 954 #else |
955 fd = open (fn, O_RDONLY, 0); | 955 fd = open (fn, O_RDONLY, 0); |
956 #endif | 956 #endif |
957 | 957 |
958 if (fd >= 0) | 958 if (fd >= 0) |
959 { | 959 { |
960 /* We succeeded; return this descriptor and filename. */ | 960 /* We succeeded; return this descriptor and filename. */ |
961 if (storeptr) | 961 if (storeptr) |
962 *storeptr = build_string (fn); | 962 *storeptr = build_string (fn); |
963 UNGCPRO; | 963 UNGCPRO; |
964 | 964 |
965 /* XXX FIX ME | 965 /* XXX FIX ME |
966 Not sure about this on NT yet. Do nothing for now. | 966 Not sure about this on NT yet. Do nothing for now. |
967 --marcpa */ | 967 --marcpa */ |
968 #ifndef DOS_NT | 968 #ifndef DOS_NT |
969 /* If we actually opened the file, set close-on-exec flag | 969 /* If we actually opened the file, set close-on-exec flag |
970 on the new descriptor so that subprocesses can't whack | 970 on the new descriptor so that subprocesses can't whack |
971 at it. */ | 971 at it. */ |
972 if (mode < 0) | 972 if (mode < 0) |
973 (void) fcntl (fd, F_SETFD, FD_CLOEXEC); | 973 (void) fcntl (fd, F_SETFD, FD_CLOEXEC); |
974 #endif | 974 #endif |
975 | 975 |
976 return fd; | 976 return fd; |
977 } | 977 } |
978 } | 978 } |
979 | 979 |
980 /* Advance to next suffix. */ | 980 /* Advance to next suffix. */ |
981 if (esuffix == 0) | 981 if (esuffix == 0) |
982 break; | 982 break; |
983 nsuffix += lsuffix + 1; | 983 nsuffix += lsuffix + 1; |
984 } | 984 } |
985 | 985 |
986 UNGCPRO; | 986 UNGCPRO; |
987 return -1; | 987 return -1; |
988 } | 988 } |
989 | 989 |
990 /* do the same as locate_file() but don't use any hash tables. */ | 990 /* do the same as locate_file() but don't use any hash tables. */ |
1013 return val; | 1013 return val; |
1014 } | 1014 } |
1015 if (absolute) | 1015 if (absolute) |
1016 break; | 1016 break; |
1017 } | 1017 } |
1018 | 1018 |
1019 UNGCPRO; | 1019 UNGCPRO; |
1020 return -1; | 1020 return -1; |
1021 } | 1021 } |
1022 | 1022 |
1023 /* Construct a list of all files to search for. */ | 1023 /* Construct a list of all files to search for. */ |
1029 int fn_size = 100; | 1029 int fn_size = 100; |
1030 char buf[100]; | 1030 char buf[100]; |
1031 char *fn = buf; | 1031 char *fn = buf; |
1032 CONST char *nsuffix; | 1032 CONST char *nsuffix; |
1033 Lisp_Object suffixtab = Qnil; | 1033 Lisp_Object suffixtab = Qnil; |
1034 | 1034 |
1035 /* Calculate maximum size of any filename made from | 1035 /* Calculate maximum size of any filename made from |
1036 this path element/specified file name and any possible suffix. */ | 1036 this path element/specified file name and any possible suffix. */ |
1037 want_size = strlen (suffix) + XSTRING_LENGTH (str) + 1; | 1037 want_size = strlen (suffix) + XSTRING_LENGTH (str) + 1; |
1038 if (fn_size < want_size) | 1038 if (fn_size < want_size) |
1039 fn = (char *) alloca (fn_size = 100 + want_size); | 1039 fn = (char *) alloca (fn_size = 100 + want_size); |
1040 | 1040 |
1041 nsuffix = suffix; | 1041 nsuffix = suffix; |
1042 | 1042 |
1043 while (1) | 1043 while (1) |
1044 { | 1044 { |
1045 char *esuffix = (char *) strchr (nsuffix, ':'); | 1045 char *esuffix = (char *) strchr (nsuffix, ':'); |
1046 int lsuffix = ((esuffix) ? (esuffix - nsuffix) : strlen (nsuffix)); | 1046 int lsuffix = ((esuffix) ? (esuffix - nsuffix) : strlen (nsuffix)); |
1047 | 1047 |
1048 /* Concatenate path element/specified name with the suffix. */ | 1048 /* Concatenate path element/specified name with the suffix. */ |
1049 strncpy (fn, (char *) XSTRING_DATA (str), XSTRING_LENGTH (str)); | 1049 strncpy (fn, (char *) XSTRING_DATA (str), XSTRING_LENGTH (str)); |
1050 fn[XSTRING_LENGTH (str)] = 0; | 1050 fn[XSTRING_LENGTH (str)] = 0; |
1051 if (lsuffix != 0) /* Bug happens on CCI if lsuffix is 0. */ | 1051 if (lsuffix != 0) /* Bug happens on CCI if lsuffix is 0. */ |
1052 strncat (fn, nsuffix, lsuffix); | 1052 strncat (fn, nsuffix, lsuffix); |
1053 | 1053 |
1054 suffixtab = Fcons (build_string (fn), suffixtab); | 1054 suffixtab = Fcons (build_string (fn), suffixtab); |
1055 /* Advance to next suffix. */ | 1055 /* Advance to next suffix. */ |
1056 if (esuffix == 0) | 1056 if (esuffix == 0) |
1057 break; | 1057 break; |
1058 nsuffix += lsuffix + 1; | 1058 nsuffix += lsuffix + 1; |
1219 { | 1219 { |
1220 foundit = 1; | 1220 foundit = 1; |
1221 | 1221 |
1222 /* If we're loading, remove it. */ | 1222 /* If we're loading, remove it. */ |
1223 if (loading) | 1223 if (loading) |
1224 { | 1224 { |
1225 if (NILP (prev)) | 1225 if (NILP (prev)) |
1226 Vload_history = Fcdr (tail); | 1226 Vload_history = Fcdr (tail); |
1227 else | 1227 else |
1228 Fsetcdr (prev, Fcdr (tail)); | 1228 Fsetcdr (prev, Fcdr (tail)); |
1229 } | 1229 } |
1273 return Qnil; | 1273 return Qnil; |
1274 } | 1274 } |
1275 #endif /* 0 */ | 1275 #endif /* 0 */ |
1276 | 1276 |
1277 static void | 1277 static void |
1278 readevalloop (Lisp_Object readcharfun, | 1278 readevalloop (Lisp_Object readcharfun, |
1279 Lisp_Object sourcename, | 1279 Lisp_Object sourcename, |
1280 Lisp_Object (*evalfun) (Lisp_Object), | 1280 Lisp_Object (*evalfun) (Lisp_Object), |
1281 int printflag) | 1281 int printflag) |
1282 { | 1282 { |
1283 /* This function can GC */ | 1283 /* This function can GC */ |
1481 Vcurrent_compiled_function_annotation = Qnil; | 1481 Vcurrent_compiled_function_annotation = Qnil; |
1482 #endif | 1482 #endif |
1483 #ifndef standalone | 1483 #ifndef standalone |
1484 if (EQ (stream, Qread_char)) | 1484 if (EQ (stream, Qread_char)) |
1485 { | 1485 { |
1486 Lisp_Object val = call1 (Qread_from_minibuffer, | 1486 Lisp_Object val = call1 (Qread_from_minibuffer, |
1487 build_translated_string ("Lisp expression: ")); | 1487 build_translated_string ("Lisp expression: ")); |
1488 return (Fcar (Fread_from_string (val, Qnil, Qnil))); | 1488 return Fcar (Fread_from_string (val, Qnil, Qnil)); |
1489 } | 1489 } |
1490 #endif | 1490 #endif |
1491 | 1491 |
1492 if (STRINGP (stream)) | 1492 if (STRINGP (stream)) |
1493 return Fcar (Fread_from_string (stream, Qnil, Qnil)); | 1493 return Fcar (Fread_from_string (stream, Qnil, Qnil)); |
1537 static Lisp_Object | 1537 static Lisp_Object |
1538 backquote_unwind (Lisp_Object ptr) | 1538 backquote_unwind (Lisp_Object ptr) |
1539 { /* used as unwind-protect function in read0() */ | 1539 { /* used as unwind-protect function in read0() */ |
1540 int *counter = (int *) get_opaque_ptr (ptr); | 1540 int *counter = (int *) get_opaque_ptr (ptr); |
1541 if (--*counter < 0) | 1541 if (--*counter < 0) |
1542 *counter = 0; | 1542 *counter = 0; |
1543 free_opaque_ptr (ptr); | 1543 free_opaque_ptr (ptr); |
1544 return Qnil; | 1544 return Qnil; |
1545 } | 1545 } |
1546 | 1546 |
1547 #endif | 1547 #endif |
1548 | 1548 |
1549 /* Use this for recursive reads, in contexts where internal tokens | 1549 /* Use this for recursive reads, in contexts where internal tokens |
1550 are not allowed. See also read1(). */ | 1550 are not allowed. See also read1(). */ |
1551 static Lisp_Object | 1551 static Lisp_Object |
1552 read0 (Lisp_Object readcharfun) | 1552 read0 (Lisp_Object readcharfun) |
1598 #define alt_modifier (0x040000) | 1598 #define alt_modifier (0x040000) |
1599 #define super_modifier (0x080000) | 1599 #define super_modifier (0x080000) |
1600 #define hyper_modifier (0x100000) | 1600 #define hyper_modifier (0x100000) |
1601 #define shift_modifier (0x200000) | 1601 #define shift_modifier (0x200000) |
1602 /* fsf uses a different modifiers for meta and control. Possibly | 1602 /* fsf uses a different modifiers for meta and control. Possibly |
1603 byte_compiled code will still work fsfmacs, though... --Stig | 1603 byte_compiled code will still work fsfmacs, though... --Stig |
1604 | 1604 |
1605 #define ctl_modifier (0x400000) | 1605 #define ctl_modifier (0x400000) |
1606 #define meta_modifier (0x800000) | 1606 #define meta_modifier (0x800000) |
1607 */ | 1607 */ |
1608 #define FSF_LOSSAGE(mask) \ | 1608 #define FSF_LOSSAGE(mask) \ |
1609 if (puke_on_fsf_keys || ((c = readchar (readcharfun)) != '-')) \ | 1609 if (puke_on_fsf_keys || ((c = readchar (readcharfun)) != '-')) \ |
1610 error ("Invalid escape character syntax"); \ | 1610 error ("Invalid escape character syntax"); \ |
1611 if ((c = readchar (readcharfun)) == '\\') \ | 1611 if ((c = readchar (readcharfun)) == '\\') \ |
1635 /* FSFmacs junk for non-ASCII controls. | 1635 /* FSFmacs junk for non-ASCII controls. |
1636 Not used here. */ | 1636 Not used here. */ |
1637 if (c == '?') | 1637 if (c == '?') |
1638 return 0177; | 1638 return 0177; |
1639 else | 1639 else |
1640 return (c & (0200 | 037)); | 1640 return c & (0200 | 037); |
1641 | 1641 |
1642 case '0': | 1642 case '0': |
1643 case '1': | 1643 case '1': |
1644 case '2': | 1644 case '2': |
1645 case '3': | 1645 case '3': |
1646 case '4': | 1646 case '4': |
1731 unreadchar (readcharfun, c); | 1731 unreadchar (readcharfun, c); |
1732 /* blasted terminating 0 */ | 1732 /* blasted terminating 0 */ |
1733 Lstream_put_emchar (XLSTREAM (Vread_buffer_stream), 0); | 1733 Lstream_put_emchar (XLSTREAM (Vread_buffer_stream), 0); |
1734 Lstream_flush (XLSTREAM (Vread_buffer_stream)); | 1734 Lstream_flush (XLSTREAM (Vread_buffer_stream)); |
1735 | 1735 |
1736 return (Lstream_byte_count (XLSTREAM (Vread_buffer_stream)) - 1); | 1736 return Lstream_byte_count (XLSTREAM (Vread_buffer_stream)) - 1; |
1737 } | 1737 } |
1738 | 1738 |
1739 static Lisp_Object parse_integer (CONST Bufbyte *buf, Bytecount len, int base); | 1739 static Lisp_Object parse_integer (CONST Bufbyte *buf, Bytecount len, int base); |
1740 | 1740 |
1741 static Lisp_Object | 1741 static Lisp_Object |
1786 number = atoi (read_buffer); | 1786 number = atoi (read_buffer); |
1787 else if (sizeof (long) == sizeof (EMACS_INT)) | 1787 else if (sizeof (long) == sizeof (EMACS_INT)) |
1788 number = atol (read_buffer); | 1788 number = atol (read_buffer); |
1789 else | 1789 else |
1790 abort (); | 1790 abort (); |
1791 return (make_int (number)); | 1791 return make_int (number); |
1792 } | 1792 } |
1793 #else | 1793 #else |
1794 return (parse_integer ((Bufbyte *) read_ptr, len, 10)); | 1794 return parse_integer ((Bufbyte *) read_ptr, len, 10); |
1795 #endif | 1795 #endif |
1796 } | 1796 } |
1797 } | 1797 } |
1798 #ifdef LISP_FLOAT_TYPE | 1798 #ifdef LISP_FLOAT_TYPE |
1799 if (isfloat_string (read_ptr)) | 1799 if (isfloat_string (read_ptr)) |
1802 } | 1802 } |
1803 | 1803 |
1804 { | 1804 { |
1805 Lisp_Object sym; | 1805 Lisp_Object sym; |
1806 if (uninterned_symbol) | 1806 if (uninterned_symbol) |
1807 sym = (Fmake_symbol ((purify_flag) | 1807 sym = (Fmake_symbol ((purify_flag) |
1808 ? make_pure_pname ((Bufbyte *) read_ptr, len, 0) | 1808 ? make_pure_pname ((Bufbyte *) read_ptr, len, 0) |
1809 : make_string ((Bufbyte *) read_ptr, len))); | 1809 : make_string ((Bufbyte *) read_ptr, len))); |
1810 else | 1810 else |
1811 { | 1811 { |
1812 /* intern will purecopy pname if necessary */ | 1812 /* intern will purecopy pname if necessary */ |
1818 /* the LISP way is to put keywords in their own package, but we don't | 1818 /* the LISP way is to put keywords in their own package, but we don't |
1819 have packages, so we do something simpler. Someday, maybe we'll | 1819 have packages, so we do something simpler. Someday, maybe we'll |
1820 have packages and then this will be reworked. --Stig. */ | 1820 have packages and then this will be reworked. --Stig. */ |
1821 XSYMBOL (sym)->value = sym; | 1821 XSYMBOL (sym)->value = sym; |
1822 } | 1822 } |
1823 return (sym); | 1823 return sym; |
1824 } | 1824 } |
1825 } | 1825 } |
1826 | 1826 |
1827 | 1827 |
1828 static Lisp_Object | 1828 static Lisp_Object |
1857 c = c - 'A' + 10; | 1857 c = c - 'A' + 10; |
1858 else if (islower (c)) | 1858 else if (islower (c)) |
1859 c = c - 'a' + 10; | 1859 c = c - 'a' + 10; |
1860 else | 1860 else |
1861 goto loser; | 1861 goto loser; |
1862 | 1862 |
1863 if (c < 0 || c >= base) | 1863 if (c < 0 || c >= base) |
1864 goto loser; | 1864 goto loser; |
1865 | 1865 |
1866 onum = num; | 1866 onum = num; |
1867 num = num * base + c; | 1867 num = num * base + c; |
1873 Lisp_Object result = make_int ((negativland) ? -num : num); | 1873 Lisp_Object result = make_int ((negativland) ? -num : num); |
1874 if (num && ((XINT (result) < 0) != negativland)) | 1874 if (num && ((XINT (result) < 0) != negativland)) |
1875 goto overflow; | 1875 goto overflow; |
1876 if (XINT (result) != ((negativland) ? -num : num)) | 1876 if (XINT (result) != ((negativland) ? -num : num)) |
1877 goto overflow; | 1877 goto overflow; |
1878 return (result); | 1878 return result; |
1879 } | 1879 } |
1880 overflow: | 1880 overflow: |
1881 return Fsignal (Qinvalid_read_syntax, | 1881 return Fsignal (Qinvalid_read_syntax, |
1882 list3 (build_translated_string | 1882 list3 (build_translated_string |
1883 ("Integer constant overflow in reader"), | 1883 ("Integer constant overflow in reader"), |
1884 make_string (buf, len), | 1884 make_string (buf, len), |
1885 make_int (base))); | 1885 make_int (base))); |
1886 loser: | 1886 loser: |
1887 return Fsignal (Qinvalid_read_syntax, | 1887 return Fsignal (Qinvalid_read_syntax, |
1888 list3 (build_translated_string | 1888 list3 (build_translated_string |
1889 ("Invalid integer constant in reader"), | 1889 ("Invalid integer constant in reader"), |
1890 make_string (buf, len), | 1890 make_string (buf, len), |
1891 make_int (base))); | 1891 make_int (base))); |
1892 } | 1892 } |
1982 { | 1982 { |
1983 Emchar c = readchar (readcharfun); | 1983 Emchar c = readchar (readcharfun); |
1984 Lisp_Object list = Qnil; | 1984 Lisp_Object list = Qnil; |
1985 Lisp_Object orig_list = Qnil; | 1985 Lisp_Object orig_list = Qnil; |
1986 Lisp_Object already_seen = Qnil; | 1986 Lisp_Object already_seen = Qnil; |
1987 int keyword_count; | |
1987 struct structure_type *st; | 1988 struct structure_type *st; |
1988 struct gcpro gcpro1, gcpro2; | 1989 struct gcpro gcpro1, gcpro2; |
1989 | 1990 |
1990 GCPRO2 (orig_list, already_seen); | 1991 GCPRO2 (orig_list, already_seen); |
1991 if (c != '(') | 1992 if (c != '(') |
2000 if (!(len & 1)) | 2001 if (!(len & 1)) |
2001 RETURN_UNGCPRO | 2002 RETURN_UNGCPRO |
2002 (continuable_syntax_error | 2003 (continuable_syntax_error |
2003 ("structures must have alternating keyword/value pairs")); | 2004 ("structures must have alternating keyword/value pairs")); |
2004 } | 2005 } |
2005 | 2006 |
2006 st = recognized_structure_type (XCAR (list)); | 2007 st = recognized_structure_type (XCAR (list)); |
2007 if (!st) | 2008 if (!st) |
2008 { | 2009 RETURN_UNGCPRO (Fsignal (Qinvalid_read_syntax, |
2009 RETURN_UNGCPRO (Fsignal (Qinvalid_read_syntax, | 2010 list2 (build_translated_string |
2010 list2 (build_translated_string | 2011 ("unrecognized structure type"), |
2011 ("unrecognized structure type"), | 2012 XCAR (list)))); |
2012 XCAR (list)))); | |
2013 } | |
2014 | 2013 |
2015 list = Fcdr (list); | 2014 list = Fcdr (list); |
2015 keyword_count = Dynarr_length (st->keywords); | |
2016 while (!NILP (list)) | 2016 while (!NILP (list)) |
2017 { | 2017 { |
2018 Lisp_Object keyword, value; | 2018 Lisp_Object keyword, value; |
2019 int i; | 2019 int i; |
2020 struct structure_keyword_entry *en; | 2020 struct structure_keyword_entry *en = NULL; |
2021 | 2021 |
2022 keyword = Fcar (list); | 2022 keyword = Fcar (list); |
2023 list = Fcdr (list); | 2023 list = Fcdr (list); |
2024 value = Fcar (list); | 2024 value = Fcar (list); |
2025 list = Fcdr (list); | 2025 list = Fcdr (list); |
2026 | 2026 |
2027 if (!NILP (memq_no_quit (keyword, already_seen))) | 2027 if (!NILP (memq_no_quit (keyword, already_seen))) |
2028 { | 2028 RETURN_UNGCPRO (Fsignal (Qinvalid_read_syntax, |
2029 RETURN_UNGCPRO (Fsignal (Qinvalid_read_syntax, | 2029 list2 (build_translated_string |
2030 list2 (build_translated_string | 2030 ("structure keyword already seen"), |
2031 ("structure keyword already seen"), | 2031 keyword))); |
2032 keyword))); | 2032 |
2033 } | 2033 for (i = 0; i < keyword_count; i++) |
2034 | |
2035 for (i = 0; i < Dynarr_length (st->keywords); i++) | |
2036 { | 2034 { |
2037 en = Dynarr_atp (st->keywords, i); | 2035 en = Dynarr_atp (st->keywords, i); |
2038 if (EQ (keyword, en->keyword)) | 2036 if (EQ (keyword, en->keyword)) |
2039 break; | 2037 break; |
2040 } | 2038 } |
2041 | 2039 |
2042 if (i == Dynarr_length (st->keywords)) | 2040 if (i == keyword_count) |
2043 RETURN_UNGCPRO (Fsignal (Qinvalid_read_syntax, | 2041 RETURN_UNGCPRO (Fsignal (Qinvalid_read_syntax, |
2044 list2 (build_translated_string | 2042 list2 (build_translated_string |
2045 ("unrecognized structure keyword"), | 2043 ("unrecognized structure keyword"), |
2046 keyword))); | 2044 keyword))); |
2047 | 2045 |
2054 | 2052 |
2055 already_seen = Fcons (keyword, already_seen); | 2053 already_seen = Fcons (keyword, already_seen); |
2056 } | 2054 } |
2057 | 2055 |
2058 if (st->validate && ! (st->validate) (orig_list, ERROR_ME)) | 2056 if (st->validate && ! (st->validate) (orig_list, ERROR_ME)) |
2059 RETURN_UNGCPRO | 2057 RETURN_UNGCPRO (Fsignal (Qinvalid_read_syntax, |
2060 (Fsignal (Qinvalid_read_syntax, | 2058 list2 (build_translated_string |
2061 list2 (build_translated_string | 2059 ("invalid structure initializer"), |
2062 ("invalid structure initializer"), | 2060 orig_list))); |
2063 orig_list))); | |
2064 | 2061 |
2065 RETURN_UNGCPRO ((st->instantiate) (XCDR (orig_list))); | 2062 RETURN_UNGCPRO ((st->instantiate) (XCDR (orig_list))); |
2066 } | 2063 } |
2067 | 2064 |
2068 | 2065 |
2069 static Lisp_Object read_compiled_function (Lisp_Object readcharfun, | 2066 static Lisp_Object read_compiled_function (Lisp_Object readcharfun, |
2070 int terminator); | 2067 int terminator); |
2071 static Lisp_Object read_vector (Lisp_Object readcharfun, int terminator); | 2068 static Lisp_Object read_vector (Lisp_Object readcharfun, int terminator); |
2095 default: | 2092 default: |
2096 { | 2093 { |
2097 /* Ignore whitespace and control characters */ | 2094 /* Ignore whitespace and control characters */ |
2098 if (c <= 040) | 2095 if (c <= 040) |
2099 goto retry; | 2096 goto retry; |
2100 return (c); | 2097 return c; |
2101 } | 2098 } |
2102 | 2099 |
2103 case ';': | 2100 case ';': |
2104 { | 2101 { |
2105 /* Comment */ | 2102 /* Comment */ |
2112 | 2109 |
2113 #if 0 | 2110 #if 0 |
2114 static Lisp_Object | 2111 static Lisp_Object |
2115 list2_pure (int pure, Lisp_Object a, Lisp_Object b) | 2112 list2_pure (int pure, Lisp_Object a, Lisp_Object b) |
2116 { | 2113 { |
2117 if (pure) | 2114 return pure ? pure_cons (a, pure_cons (b, Qnil)) : list2 (a, b); |
2118 return (pure_cons (a, pure_cons (b, Qnil))); | |
2119 else | |
2120 return (list2 (a, b)); | |
2121 } | 2115 } |
2122 #endif | 2116 #endif |
2123 | 2117 |
2124 /* Read the next Lisp object from the stream READCHARFUN and return it. | 2118 /* Read the next Lisp object from the stream READCHARFUN and return it. |
2125 If the return value is a cons whose car is Qunbound, then read1() | 2119 If the return value is a cons whose car is Qunbound, then read1() |
2126 encountered a misplaced token (e.g. a right bracket, right paren, | 2120 encountered a misplaced token (e.g. a right bracket, right paren, |
2127 or dot followed by a non-number). To filter this stuff out, | 2121 or dot followed by a non-number). To filter this stuff out, |
2128 use read0(). */ | 2122 use read0(). */ |
2129 | 2123 |
2130 static Lisp_Object | 2124 static Lisp_Object |
2131 read1 (Lisp_Object readcharfun) | 2125 read1 (Lisp_Object readcharfun) |
2132 { | 2126 { |
2133 Emchar c; | 2127 Emchar c; |
2134 | 2128 |
2211 } /* switch(ch) */ | 2205 } /* switch(ch) */ |
2212 #endif /* old backquote crap... */ | 2206 #endif /* old backquote crap... */ |
2213 return read_list (readcharfun, ')', 1, 1); | 2207 return read_list (readcharfun, ')', 1, 1); |
2214 } | 2208 } |
2215 case '[': | 2209 case '[': |
2216 return (read_vector (readcharfun, ']')); | 2210 return read_vector (readcharfun, ']'); |
2217 | 2211 |
2218 case ')': | 2212 case ')': |
2219 case ']': | 2213 case ']': |
2220 /* #### - huh? these don't do what they seem... */ | 2214 /* #### - huh? these don't do what they seem... */ |
2221 return (noseeum_cons (Qunbound, make_char (c))); | 2215 return noseeum_cons (Qunbound, make_char (c)); |
2222 case '.': | 2216 case '.': |
2223 { | 2217 { |
2224 #ifdef LISP_FLOAT_TYPE | 2218 #ifdef LISP_FLOAT_TYPE |
2225 /* If a period is followed by a number, then we should read it | 2219 /* If a period is followed by a number, then we should read it |
2226 as a floating point number. Otherwise, it denotes a dotted | 2220 as a floating point number. Otherwise, it denotes a dotted |
2229 c = readchar (readcharfun); | 2223 c = readchar (readcharfun); |
2230 unreadchar (readcharfun, c); | 2224 unreadchar (readcharfun, c); |
2231 | 2225 |
2232 /* Can't use isdigit on Emchars */ | 2226 /* Can't use isdigit on Emchars */ |
2233 if (c < '0' || c > '9') | 2227 if (c < '0' || c > '9') |
2234 return (noseeum_cons (Qunbound, make_char ('.'))); | 2228 return noseeum_cons (Qunbound, make_char ('.')); |
2235 | 2229 |
2236 /* Note that read_atom will loop | 2230 /* Note that read_atom will loop |
2237 at least once, assuring that we will not try to UNREAD | 2231 at least once, assuring that we will not try to UNREAD |
2238 two characters in a row. | 2232 two characters in a row. |
2239 (I think this doesn't matter anymore because there should | 2233 (I think this doesn't matter anymore because there should |
2240 be no more danger in unreading multiple characters) */ | 2234 be no more danger in unreading multiple characters) */ |
2241 return (read_atom (readcharfun, '.', 0)); | 2235 return read_atom (readcharfun, '.', 0); |
2242 | 2236 |
2243 #else /* ! LISP_FLOAT_TYPE */ | 2237 #else /* ! LISP_FLOAT_TYPE */ |
2244 return (noseeum_cons (Qunbound, make_char ('.'))); | 2238 return noseeum_cons (Qunbound, make_char ('.')); |
2245 #endif /* ! LISP_FLOAT_TYPE */ | 2239 #endif /* ! LISP_FLOAT_TYPE */ |
2246 } | 2240 } |
2247 | 2241 |
2248 case '#': | 2242 case '#': |
2249 { | 2243 { |
2256 #if 0 /* FSFmacs silly bool-vector syntax */ | 2250 #if 0 /* FSFmacs silly bool-vector syntax */ |
2257 case '&': | 2251 case '&': |
2258 #endif | 2252 #endif |
2259 /* "#["-- byte-code constant syntax */ | 2253 /* "#["-- byte-code constant syntax */ |
2260 /* purecons #[...] syntax */ | 2254 /* purecons #[...] syntax */ |
2261 case '[': return (read_compiled_function (readcharfun, ']' | 2255 case '[': return read_compiled_function (readcharfun, ']' |
2262 /*, purify_flag */ )); | 2256 /*, purify_flag */ ); |
2263 /* "#:"-- quasi-implemented gensym syntax */ | 2257 /* "#:"-- quasi-implemented gensym syntax */ |
2264 case ':': return (read_atom (readcharfun, -1, 1)); | 2258 case ':': return read_atom (readcharfun, -1, 1); |
2265 /* #'x => (function x) */ | 2259 /* #'x => (function x) */ |
2266 case '\'': return (list2 (Qfunction, read0 (readcharfun))); | 2260 case '\'': return list2 (Qfunction, read0 (readcharfun)); |
2267 #if 0 | 2261 #if 0 |
2268 /* RMS uses this syntax for fat-strings. | 2262 /* RMS uses this syntax for fat-strings. |
2269 If we use it for vectors, then obscure bugs happen. | 2263 If we use it for vectors, then obscure bugs happen. |
2270 */ | 2264 */ |
2271 /* "#(" -- Scheme/CL vector syntax */ | 2265 /* "#(" -- Scheme/CL vector syntax */ |
2272 case '(': return (read_vector (readcharfun, ')')); | 2266 case '(': return read_vector (readcharfun, ')'); |
2273 #endif | 2267 #endif |
2274 #if 0 /* FSFmacs */ | 2268 #if 0 /* FSFmacs */ |
2275 case '(': | 2269 case '(': |
2276 { | 2270 { |
2277 Lisp_Object tmp; | 2271 Lisp_Object tmp; |
2281 tmp = read1 (readcharfun); | 2275 tmp = read1 (readcharfun); |
2282 if (!STRINGP (tmp)) | 2276 if (!STRINGP (tmp)) |
2283 { | 2277 { |
2284 if (CONSP (tmp) && UNBOUNDP (XCAR (tmp))) | 2278 if (CONSP (tmp) && UNBOUNDP (XCAR (tmp))) |
2285 free_cons (XCONS (tmp)); | 2279 free_cons (XCONS (tmp)); |
2286 return (Fsignal (Qinvalid_read_syntax, | 2280 return Fsignal (Qinvalid_read_syntax, |
2287 list1 (build_string ("#")))); | 2281 list1 (build_string ("#"))); |
2288 } | 2282 } |
2289 GCPRO1 (tmp); | 2283 GCPRO1 (tmp); |
2290 /* Read the intervals and their properties. */ | 2284 /* Read the intervals and their properties. */ |
2291 while (1) | 2285 while (1) |
2292 { | 2286 { |
2293 Lisp_Object beg, end, plist; | 2287 Lisp_Object beg, end, plist; |
2294 Emchar ch; | 2288 Emchar ch; |
2295 int invalid = 0; | 2289 int invalid = 0; |
2296 | 2290 |
2297 beg = read1 (readcharfun); | 2291 beg = read1 (readcharfun); |
2298 if (CONSP (beg) && UNBOUNDP (XCAR (beg))) | 2292 if (CONSP (beg) && UNBOUNDP (XCAR (beg))) |
2299 { | 2293 { |
2300 ch = XCHAR (XCDR (beg)); | 2294 ch = XCHAR (XCDR (beg)); |
2301 free_cons (XCONS (beg)); | 2295 free_cons (XCONS (beg)); |
2358 | 2352 |
2359 goto retry; | 2353 goto retry; |
2360 } | 2354 } |
2361 case '$': return Vload_file_name_internal; | 2355 case '$': return Vload_file_name_internal; |
2362 /* bit vectors */ | 2356 /* bit vectors */ |
2363 case '*': return (read_bit_vector (readcharfun)); | 2357 case '*': return read_bit_vector (readcharfun); |
2364 /* #o10 => 8 -- octal constant syntax */ | 2358 /* #o10 => 8 -- octal constant syntax */ |
2365 case 'o': return (read_integer (readcharfun, 8)); | 2359 case 'o': return read_integer (readcharfun, 8); |
2366 /* #xdead => 57005 -- hex constant syntax */ | 2360 /* #xdead => 57005 -- hex constant syntax */ |
2367 case 'x': return (read_integer (readcharfun, 16)); | 2361 case 'x': return read_integer (readcharfun, 16); |
2368 /* #b010 => 2 -- binary constant syntax */ | 2362 /* #b010 => 2 -- binary constant syntax */ |
2369 case 'b': return (read_integer (readcharfun, 2)); | 2363 case 'b': return read_integer (readcharfun, 2); |
2370 /* #s(foobar key1 val1 key2 val2) -- structure syntax */ | 2364 /* #s(foobar key1 val1 key2 val2) -- structure syntax */ |
2371 case 's': return (read_structure (readcharfun)); | 2365 case 's': return read_structure (readcharfun); |
2372 case '<': | 2366 case '<': |
2373 { | 2367 { |
2374 unreadchar (readcharfun, c); | 2368 unreadchar (readcharfun, c); |
2375 return Fsignal (Qinvalid_read_syntax, | 2369 return Fsignal (Qinvalid_read_syntax, |
2376 list1 (build_string ("Cannot read unreadable object"))); | 2370 list1 (build_string ("Cannot read unreadable object"))); |
2447 commas to begin symbols (unless they're inside | 2441 commas to begin symbols (unless they're inside |
2448 backquotes). If an error is signalled here in the | 2442 backquotes). If an error is signalled here in the |
2449 future, then commas should be invalid read syntax | 2443 future, then commas should be invalid read syntax |
2450 outside of backquotes anywhere they're found (i.e. | 2444 outside of backquotes anywhere they're found (i.e. |
2451 they must be quoted in symbols) -- Stig */ | 2445 they must be quoted in symbols) -- Stig */ |
2452 return (read_atom (readcharfun, c, 0)); | 2446 return read_atom (readcharfun, c, 0); |
2453 } | 2447 } |
2454 } | 2448 } |
2455 #endif | 2449 #endif |
2456 | 2450 |
2457 case '?': | 2451 case '?': |
2461 if (c < 0) | 2455 if (c < 0) |
2462 return Fsignal (Qend_of_file, list1 (readcharfun)); | 2456 return Fsignal (Qend_of_file, list1 (readcharfun)); |
2463 | 2457 |
2464 if (c == '\\') | 2458 if (c == '\\') |
2465 c = read_escape (readcharfun); | 2459 c = read_escape (readcharfun); |
2466 return (make_char (c)); | 2460 return make_char (c); |
2467 } | 2461 } |
2468 | 2462 |
2469 case '\"': | 2463 case '\"': |
2470 { | 2464 { |
2471 /* String */ | 2465 /* String */ |
2499 | 2493 |
2500 /* If purifying, and string starts with \ newline, | 2494 /* If purifying, and string starts with \ newline, |
2501 return zero instead. This is for doc strings | 2495 return zero instead. This is for doc strings |
2502 that we are really going to find in lib-src/DOC.nn.nn */ | 2496 that we are really going to find in lib-src/DOC.nn.nn */ |
2503 if (purify_flag && NILP (Vdoc_file_name) && cancel) | 2497 if (purify_flag && NILP (Vdoc_file_name) && cancel) |
2504 return (Qzero); | 2498 return Qzero; |
2505 | 2499 |
2506 Lstream_flush (XLSTREAM (Vread_buffer_stream)); | 2500 Lstream_flush (XLSTREAM (Vread_buffer_stream)); |
2507 #if 0 /* FSFmacs defun hack */ | 2501 #if 0 /* FSFmacs defun hack */ |
2508 if (read_pure) | 2502 if (read_pure) |
2509 return | 2503 return |
2521 default: | 2515 default: |
2522 { | 2516 { |
2523 /* Ignore whitespace and control characters */ | 2517 /* Ignore whitespace and control characters */ |
2524 if (c <= 040) | 2518 if (c <= 040) |
2525 goto retry; | 2519 goto retry; |
2526 return (read_atom (readcharfun, c, 0)); | 2520 return read_atom (readcharfun, c, 0); |
2527 } | 2521 } |
2528 } | 2522 } |
2529 } | 2523 } |
2530 | 2524 |
2531 | 2525 |
2541 int | 2535 int |
2542 isfloat_string (CONST char *cp) | 2536 isfloat_string (CONST char *cp) |
2543 { | 2537 { |
2544 int state = 0; | 2538 int state = 0; |
2545 CONST Bufbyte *ucp = (CONST Bufbyte *) cp; | 2539 CONST Bufbyte *ucp = (CONST Bufbyte *) cp; |
2546 | 2540 |
2547 if (*ucp == '+' || *ucp == '-') | 2541 if (*ucp == '+' || *ucp == '-') |
2548 ucp++; | 2542 ucp++; |
2549 | 2543 |
2550 if (*ucp >= '0' && *ucp <= '9') | 2544 if (*ucp >= '0' && *ucp <= '9') |
2551 { | 2545 { |
2603 | 2597 |
2604 QUIT; | 2598 QUIT; |
2605 ch = reader_nextchar (readcharfun); | 2599 ch = reader_nextchar (readcharfun); |
2606 | 2600 |
2607 if (ch == terminator) | 2601 if (ch == terminator) |
2608 return (state); | 2602 return state; |
2609 else | 2603 else |
2610 unreadchar (readcharfun, ch); | 2604 unreadchar (readcharfun, ch); |
2611 #ifdef FEATUREP_SYNTAX | 2605 #ifdef FEATUREP_SYNTAX |
2612 if (ch == ']') | 2606 if (ch == ']') |
2613 syntax_error ("\"]\" in a list"); | 2607 syntax_error ("\"]\" in a list"); |
2617 state = ((conser) (readcharfun, state, len)); | 2611 state = ((conser) (readcharfun, state, len)); |
2618 } | 2612 } |
2619 } | 2613 } |
2620 | 2614 |
2621 | 2615 |
2622 struct read_list_state | 2616 struct read_list_state |
2623 { | 2617 { |
2624 Lisp_Object head; | 2618 Lisp_Object head; |
2625 Lisp_Object tail; | 2619 Lisp_Object tail; |
2626 int length; | 2620 int length; |
2627 int allow_dotted_lists; | 2621 int allow_dotted_lists; |
2638 | 2632 |
2639 if (CONSP (elt) && UNBOUNDP (XCAR (elt))) | 2633 if (CONSP (elt) && UNBOUNDP (XCAR (elt))) |
2640 { | 2634 { |
2641 Lisp_Object tem = elt; | 2635 Lisp_Object tem = elt; |
2642 Emchar ch; | 2636 Emchar ch; |
2643 | 2637 |
2644 elt = XCDR (elt); | 2638 elt = XCDR (elt); |
2645 free_cons (XCONS (tem)); | 2639 free_cons (XCONS (tem)); |
2646 tem = Qnil; | 2640 tem = Qnil; |
2647 ch = XCHAR (elt); | 2641 ch = XCHAR (elt); |
2648 #ifdef FEATUREP_SYNTAX | 2642 #ifdef FEATUREP_SYNTAX |
2706 else | 2700 else |
2707 s->head = elt; | 2701 s->head = elt; |
2708 s->tail = elt; | 2702 s->tail = elt; |
2709 done: | 2703 done: |
2710 s->length++; | 2704 s->length++; |
2711 return (s); | 2705 return s; |
2712 } | 2706 } |
2713 | 2707 |
2714 | 2708 |
2715 #if 0 /* FSFmacs defun hack */ | 2709 #if 0 /* FSFmacs defun hack */ |
2716 /* -1 for allow_dotted_lists means allow_dotted_lists and check | 2710 /* -1 for allow_dotted_lists means allow_dotted_lists and check |
2807 can modify it in-place. */ | 2801 can modify it in-place. */ |
2808 Fcons (holding_cons, Vload_force_doc_string_list); | 2802 Fcons (holding_cons, Vload_force_doc_string_list); |
2809 } | 2803 } |
2810 } | 2804 } |
2811 } | 2805 } |
2812 | 2806 |
2813 UNGCPRO; | 2807 UNGCPRO; |
2814 return (s.head); | 2808 return s.head; |
2815 } | 2809 } |
2816 | 2810 |
2817 static Lisp_Object | 2811 static Lisp_Object |
2818 read_vector (Lisp_Object readcharfun, | 2812 read_vector (Lisp_Object readcharfun, |
2819 Emchar terminator) | 2813 Emchar terminator) |
2829 s.head = Qnil; | 2823 s.head = Qnil; |
2830 s.tail = Qnil; | 2824 s.tail = Qnil; |
2831 s.length = 0; | 2825 s.length = 0; |
2832 s.allow_dotted_lists = 0; | 2826 s.allow_dotted_lists = 0; |
2833 GCPRO2 (s.head, s.tail); | 2827 GCPRO2 (s.head, s.tail); |
2834 | 2828 |
2835 (void) sequence_reader (readcharfun, | 2829 (void) sequence_reader (readcharfun, |
2836 terminator, | 2830 terminator, |
2837 &s, | 2831 &s, |
2838 read_list_conser); | 2832 read_list_conser); |
2839 UNGCPRO; | 2833 UNGCPRO; |
2845 s.head = make_pure_vector (len, Qnil); | 2839 s.head = make_pure_vector (len, Qnil); |
2846 else | 2840 else |
2847 #endif | 2841 #endif |
2848 s.head = make_vector (len, Qnil); | 2842 s.head = make_vector (len, Qnil); |
2849 | 2843 |
2850 for (i = 0, p = &(vector_data (XVECTOR (s.head))[0]); | 2844 for (i = 0, p = &(XVECTOR_DATA (s.head)[0]); |
2851 i < len; | 2845 i < len; |
2852 i++, p++) | 2846 i++, p++) |
2853 { | 2847 { |
2854 struct Lisp_Cons *otem = XCONS (tem); | 2848 struct Lisp_Cons *otem = XCONS (tem); |
2855 #if 0 /* FSFmacs defun hack */ | 2849 #if 0 /* FSFmacs defun hack */ |
2860 tem = Fcar (tem); | 2854 tem = Fcar (tem); |
2861 *p = tem; | 2855 *p = tem; |
2862 tem = otem->cdr; | 2856 tem = otem->cdr; |
2863 free_cons (otem); | 2857 free_cons (otem); |
2864 } | 2858 } |
2865 return (s.head); | 2859 return s.head; |
2866 } | 2860 } |
2867 | 2861 |
2868 static Lisp_Object | 2862 static Lisp_Object |
2869 read_compiled_function (Lisp_Object readcharfun, Emchar terminator) | 2863 read_compiled_function (Lisp_Object readcharfun, Emchar terminator) |
2870 { | 2864 { |
2871 /* Accept compiled functions at read-time so that we don't | 2865 /* Accept compiled functions at read-time so that we don't |
2872 have to build them at load-time. */ | 2866 have to build them at load-time. */ |
2873 Lisp_Object stuff; | 2867 Lisp_Object stuff; |
2874 Lisp_Object make_byte_code_args[COMPILED_DOMAIN + 1]; | 2868 Lisp_Object make_byte_code_args[COMPILED_DOMAIN + 1]; |
2875 struct gcpro gcpro1; | 2869 struct gcpro gcpro1; |
2876 int len; | 2870 int len; |
2939 /* Don't print this warning. If the hardcoded paths don't exist, then | 2933 /* Don't print this warning. If the hardcoded paths don't exist, then |
2940 startup.el will try and deduce one. If it fails, it knows how to | 2934 startup.el will try and deduce one. If it fails, it knows how to |
2941 handle things. */ | 2935 handle things. */ |
2942 #if 0 | 2936 #if 0 |
2943 #ifndef WINDOWSNT | 2937 #ifndef WINDOWSNT |
2944 /* When Emacs is invoked over network shares on NT, PATH_LOADSEARCH is | 2938 /* When Emacs is invoked over network shares on NT, PATH_LOADSEARCH is |
2945 almost never correct, thereby causing a warning to be printed out that | 2939 almost never correct, thereby causing a warning to be printed out that |
2946 confuses users. Since PATH_LOADSEARCH is always overriden by the | 2940 confuses users. Since PATH_LOADSEARCH is always overriden by the |
2947 EMACSLOADPATH environment variable below, disable the warning on NT. */ | 2941 EMACSLOADPATH environment variable below, disable the warning on NT. */ |
2948 | 2942 |
2949 /* Warn if dirs in the *standard* path don't exist. */ | 2943 /* Warn if dirs in the *standard* path don't exist. */ |