X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Ffns.c;h=266783ba50d1d461bd12f818199b0f17a3dc72a8;hb=bf61348b2123526bd2d00dda09deb06c7b4410b6;hp=29ef8fa98f332fa9bec196c79a17271313330f0c;hpb=170dcc3172bcd984e972e7be768959ea0f884f1e;p=chise%2Fxemacs-chise.git diff --git a/src/fns.c b/src/fns.c index 29ef8fa..266783b 100644 --- a/src/fns.c +++ b/src/fns.c @@ -144,7 +144,7 @@ extern void seed_random (long arg); DEFUN ("random", Frandom, 0, 1, 0, /* Return a pseudo-random number. All integers representable in Lisp are equally likely. - On most systems, this is 28 bits' worth. + On most systems, this is 31 bits' worth. With positive integer argument N, return random number in interval [0,N). With argument t, set the random number seed from the current time and pid. */ @@ -164,7 +164,7 @@ With argument t, set the random number seed from the current time and pid. it's possible to get a quotient larger than limit; discarding these values eliminates the bias that would otherwise appear when using a large limit. */ - denominator = ((unsigned long)1 << VALBITS) / XINT (limit); + denominator = ((unsigned long)1 << INT_VALBITS) / XINT (limit); do val = get_random () / denominator; while (val >= XINT (limit)); @@ -713,7 +713,7 @@ concat (int nargs, Lisp_Object *args, break; default: val = Qnil; - abort (); + ABORT (); } } @@ -1002,7 +1002,7 @@ are copied to the new string. } else { - abort (); /* unreachable, since Flength (sequence) did not get + ABORT (); /* unreachable, since Flength (sequence) did not get an error */ return Qnil; } @@ -3021,7 +3021,7 @@ mapcar1 (size_t leni, Lisp_Object *vals, } } else - abort (); /* unreachable, since Flength (sequence) did not get an error */ + ABORT (); /* unreachable, since Flength (sequence) did not get an error */ if (vals) UNGCPRO; @@ -3638,7 +3638,7 @@ into shorter lines. encoded_length = base64_encode_1 (XLSTREAM (input), encoded, NILP (no_line_break)); if (encoded_length > allength) - abort (); + ABORT (); Lstream_delete (XLSTREAM (input)); /* Now we have encoded the region, so we insert the new contents @@ -3680,7 +3680,7 @@ into shorter lines. encoded_length = base64_encode_1 (XLSTREAM (input), encoded, NILP (no_line_break)); if (encoded_length > allength) - abort (); + ABORT (); Lstream_delete (XLSTREAM (input)); result = make_string (encoded, encoded_length); XMALLOC_UNBIND (encoded, allength, speccount); @@ -3713,7 +3713,7 @@ Characters out of the base64 alphabet are ignored. XMALLOC_OR_ALLOCA (decoded, length * MAX_EMCHAR_LEN, Bufbyte); decoded_length = base64_decode_1 (XLSTREAM (input), decoded, &cc_decoded_length); if (decoded_length > length * MAX_EMCHAR_LEN) - abort (); + ABORT (); Lstream_delete (XLSTREAM (input)); /* Now we have decoded the region, so we insert the new contents @@ -3754,7 +3754,7 @@ Characters out of the base64 alphabet are ignored. decoded_length = base64_decode_1 (XLSTREAM (input), decoded, &cc_decoded_length); if (decoded_length > length * MAX_EMCHAR_LEN) - abort (); + ABORT (); Lstream_delete (XLSTREAM (input)); result = make_string (decoded, decoded_length); @@ -3837,7 +3837,36 @@ simplify_char_spec (Lisp_Object char_spec) #if 0 Lisp_Object ret = Ffind_char (char_spec); #else - Lisp_Object ret = Fdefine_char (char_spec); + Lisp_Object ret; + Lisp_Object rest = char_spec; + int have_ccs = 0; + + while (CONSP (rest)) + { + Lisp_Object cell = Fcar (rest); + Lisp_Object ccs; + +#if 0 + if (!LISTP (cell)) + signal_simple_error ("Invalid argument", char_spec); +#endif + if (!NILP (ccs = Ffind_charset (Fcar (cell)))) + { + cell = Fcdr (cell); + if (CONSP (cell)) + ret = Fmake_char (ccs, Fcar (cell), Fcar (Fcdr (cell))); + else + ret = Fdecode_char (ccs, cell, Qt, Qt); + have_ccs = 1; + if (CHARP (ret)) + return ret; + } + rest = Fcdr (rest); + } + if (have_ccs) + ret = Fdefine_char (char_spec); + else + ret = Qnil; #endif if (CHARP (ret))