X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Flread.c;h=eebde6693b2a5ba5a136a18bef1d0c237bcf831e;hb=975655e6b5b1526ee82b159b3eadf69888c42090;hp=a92fc184ef1cb3a956fa0a37086f7a5a9a1c9274;hpb=afa9772e3fcbb4e80e3e4cfd1a40b4fccc6d08b8;p=chise%2Fxemacs-chise.git- diff --git a/src/lread.c b/src/lread.c index a92fc18..eebde66 100644 --- a/src/lread.c +++ b/src/lread.c @@ -218,14 +218,14 @@ EXFUN (Fread_from_string, 3); static DOESNT_RETURN -syntax_error (CONST char *string) +syntax_error (const char *string) { signal_error (Qinvalid_read_syntax, list1 (build_translated_string (string))); } static Lisp_Object -continuable_syntax_error (CONST char *string) +continuable_syntax_error (const char *string) { return Fsignal (Qinvalid_read_syntax, list1 (build_translated_string (string))); @@ -259,9 +259,9 @@ readchar (Lisp_Object readcharfun) #ifdef DEBUG_XEMACS /* testing Mule */ static int testing_mule = 0; /* Change via debugger */ if (testing_mule) { - if (c >= 0x20 && c <= 0x7E) fprintf (stderr, "%c", c); - else if (c == '\n') fprintf (stderr, "\\n\n"); - else fprintf (stderr, "\\%o ", c); + if (c >= 0x20 && c <= 0x7E) stderr_out ("%c", c); + else if (c == '\n') stderr_out ("\\n\n"); + else stderr_out ("\\%o ", c); } #endif return c; @@ -676,7 +676,7 @@ encoding detection or end-of-line detection. { /* Lisp_Object's must be malloc'ed, not stack-allocated */ Lisp_Object lispstream = Qnil; - CONST int block_size = 8192; + const int block_size = 8192; struct gcpro ngcpro1; NGCPRO1 (lispstream); @@ -978,12 +978,12 @@ locate_file_map_suffixes (Lisp_Object filename, Lisp_Object suffixes, else { /* Case c) */ - CONST char *nsuffix = (CONST char *) XSTRING_DATA (suffixes); + const char *nsuffix = (const char *) XSTRING_DATA (suffixes); while (1) { char *esuffix = (char *) strchr (nsuffix, ':'); - int lsuffix = ((esuffix) ? (esuffix - nsuffix) : strlen (nsuffix)); + int lsuffix = esuffix ? esuffix - nsuffix : strlen (nsuffix); /* Concatenate path element/specified name with the suffix. */ strncpy (fn + fn_len, nsuffix, lsuffix); @@ -1815,6 +1815,25 @@ read_escape (Lisp_Object readcharfun) } return i; } + case 'u': + { + REGISTER Emchar i = 0; + REGISTER int count = 0; + while (++count <= 6) + { + c = readchar (readcharfun); + /* Remember, can't use isdigit(), isalpha() etc. on Emchars */ + if (c >= '0' && c <= '9') i = (i << 4) + (c - '0'); + else if (c >= 'a' && c <= 'f') i = (i << 4) + (c - 'a') + 10; + else if (c >= 'A' && c <= 'F') i = (i << 4) + (c - 'A') + 10; + else + { + unreadchar (readcharfun, c); + break; + } + } + return i; + } #ifdef MULE /* #### need some way of reading an extended character with @@ -1870,7 +1889,7 @@ read_atom_0 (Lisp_Object readcharfun, Emchar firstchar, int *saw_a_backslash) return Lstream_byte_count (XLSTREAM (Vread_buffer_stream)) - 1; } -static Lisp_Object parse_integer (CONST Bufbyte *buf, Bytecount len, int base); +static Lisp_Object parse_integer (const Bufbyte *buf, Bytecount len, int base); static Lisp_Object read_atom (Lisp_Object readcharfun, @@ -1950,10 +1969,10 @@ read_atom (Lisp_Object readcharfun, static Lisp_Object -parse_integer (CONST Bufbyte *buf, Bytecount len, int base) +parse_integer (const Bufbyte *buf, Bytecount len, int base) { - CONST Bufbyte *lim = buf + len; - CONST Bufbyte *p = buf; + const Bufbyte *lim = buf + len; + const Bufbyte *p = buf; EMACS_UINT num = 0; int negativland = 0; @@ -2036,6 +2055,7 @@ read_bit_vector (Lisp_Object readcharfun) { unsigned_char_dynarr *dyn = Dynarr_new (unsigned_char); Emchar c; + Lisp_Object val; while (1) { @@ -2048,8 +2068,12 @@ read_bit_vector (Lisp_Object readcharfun) if (c >= 0) unreadchar (readcharfun, c); - return make_bit_vector_from_byte_vector (Dynarr_atp (dyn, 0), - Dynarr_length (dyn)); + val = make_bit_vector_from_byte_vector (Dynarr_atp (dyn, 0), + Dynarr_length (dyn)); + + Dynarr_free (dyn); + + return val; } @@ -2691,10 +2715,10 @@ retry: #define EXP_INT 16 int -isfloat_string (CONST char *cp) +isfloat_string (const char *cp) { int state = 0; - CONST Bufbyte *ucp = (CONST Bufbyte *) cp; + const Bufbyte *ucp = (const Bufbyte *) cp; if (*ucp == '+' || *ucp == '-') ucp++; @@ -2997,7 +3021,7 @@ read_vector (Lisp_Object readcharfun, i < len; i++, p++) { - struct Lisp_Cons *otem = XCONS (tem); + Lisp_Cons *otem = XCONS (tem); tem = Fcar (tem); *p = tem; tem = otem->cdr; @@ -3029,7 +3053,7 @@ read_compiled_function (Lisp_Object readcharfun, Emchar terminator) for (iii = 0; CONSP (stuff); iii++) { - struct Lisp_Cons *victim = XCONS (stuff); + Lisp_Cons *victim = XCONS (stuff); make_byte_code_args[iii] = Fcar (stuff); if ((purify_flag || load_force_doc_strings) && CONSP (make_byte_code_args[iii])