diff options
| author | Kenichi Handa | 2010-07-08 17:09:35 +0900 |
|---|---|---|
| committer | Kenichi Handa | 2010-07-08 17:09:35 +0900 |
| commit | 80d4189187791916590b6c2b20b54588d432bb75 (patch) | |
| tree | e59e52ee4a456f3235bff0e7fba4362681dba7dd /src/data.c | |
| parent | a7840ffb291e13c2a2386ccbd58089e1d7461c16 (diff) | |
| parent | 0216627eb39f77958e30f4750f581714fdfd7faf (diff) | |
| download | emacs-80d4189187791916590b6c2b20b54588d432bb75.tar.gz emacs-80d4189187791916590b6c2b20b54588d432bb75.zip | |
merge trunk
Diffstat (limited to 'src/data.c')
| -rw-r--r-- | src/data.c | 102 |
1 files changed, 34 insertions, 68 deletions
diff --git a/src/data.c b/src/data.c index 93cc57e9f2c..cde6e9538b9 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -50,7 +50,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 50 | #include <math.h> | 50 | #include <math.h> |
| 51 | 51 | ||
| 52 | #if !defined (atof) | 52 | #if !defined (atof) |
| 53 | extern double atof (); | 53 | extern double atof (const char *); |
| 54 | #endif /* !atof */ | 54 | #endif /* !atof */ |
| 55 | 55 | ||
| 56 | Lisp_Object Qnil, Qt, Qquote, Qlambda, Qsubr, Qunbound; | 56 | Lisp_Object Qnil, Qt, Qquote, Qlambda, Qsubr, Qunbound; |
| @@ -97,16 +97,14 @@ Lisp_Object Vmost_positive_fixnum, Vmost_negative_fixnum; | |||
| 97 | 97 | ||
| 98 | 98 | ||
| 99 | void | 99 | void |
| 100 | circular_list_error (list) | 100 | circular_list_error (Lisp_Object list) |
| 101 | Lisp_Object list; | ||
| 102 | { | 101 | { |
| 103 | xsignal (Qcircular_list, list); | 102 | xsignal (Qcircular_list, list); |
| 104 | } | 103 | } |
| 105 | 104 | ||
| 106 | 105 | ||
| 107 | Lisp_Object | 106 | Lisp_Object |
| 108 | wrong_type_argument (predicate, value) | 107 | wrong_type_argument (register Lisp_Object predicate, register Lisp_Object value) |
| 109 | register Lisp_Object predicate, value; | ||
| 110 | { | 108 | { |
| 111 | /* If VALUE is not even a valid Lisp object, we'd want to abort here | 109 | /* If VALUE is not even a valid Lisp object, we'd want to abort here |
| 112 | where we can get a backtrace showing where it came from. We used | 110 | where we can get a backtrace showing where it came from. We used |
| @@ -119,21 +117,19 @@ wrong_type_argument (predicate, value) | |||
| 119 | } | 117 | } |
| 120 | 118 | ||
| 121 | void | 119 | void |
| 122 | pure_write_error () | 120 | pure_write_error (void) |
| 123 | { | 121 | { |
| 124 | error ("Attempt to modify read-only object"); | 122 | error ("Attempt to modify read-only object"); |
| 125 | } | 123 | } |
| 126 | 124 | ||
| 127 | void | 125 | void |
| 128 | args_out_of_range (a1, a2) | 126 | args_out_of_range (Lisp_Object a1, Lisp_Object a2) |
| 129 | Lisp_Object a1, a2; | ||
| 130 | { | 127 | { |
| 131 | xsignal2 (Qargs_out_of_range, a1, a2); | 128 | xsignal2 (Qargs_out_of_range, a1, a2); |
| 132 | } | 129 | } |
| 133 | 130 | ||
| 134 | void | 131 | void |
| 135 | args_out_of_range_3 (a1, a2, a3) | 132 | args_out_of_range_3 (Lisp_Object a1, Lisp_Object a2, Lisp_Object a3) |
| 136 | Lisp_Object a1, a2, a3; | ||
| 137 | { | 133 | { |
| 138 | xsignal3 (Qargs_out_of_range, a1, a2, a3); | 134 | xsignal3 (Qargs_out_of_range, a1, a2, a3); |
| 139 | } | 135 | } |
| @@ -146,8 +142,7 @@ int sign_extend_temp; | |||
| 146 | /* On a few machines, XINT can only be done by calling this. */ | 142 | /* On a few machines, XINT can only be done by calling this. */ |
| 147 | 143 | ||
| 148 | int | 144 | int |
| 149 | sign_extend_lisp_int (num) | 145 | sign_extend_lisp_int (EMACS_INT num) |
| 150 | EMACS_INT num; | ||
| 151 | { | 146 | { |
| 152 | if (num & (((EMACS_INT) 1) << (VALBITS - 1))) | 147 | if (num & (((EMACS_INT) 1) << (VALBITS - 1))) |
| 153 | return num | (((EMACS_INT) (-1)) << VALBITS); | 148 | return num | (((EMACS_INT) (-1)) << VALBITS); |
| @@ -840,8 +835,7 @@ Value, if non-nil, is a list \(interactive SPEC). */) | |||
| 840 | indirections contains a loop. */ | 835 | indirections contains a loop. */ |
| 841 | 836 | ||
| 842 | struct Lisp_Symbol * | 837 | struct Lisp_Symbol * |
| 843 | indirect_variable (symbol) | 838 | indirect_variable (struct Lisp_Symbol *symbol) |
| 844 | struct Lisp_Symbol *symbol; | ||
| 845 | { | 839 | { |
| 846 | struct Lisp_Symbol *tortoise, *hare; | 840 | struct Lisp_Symbol *tortoise, *hare; |
| 847 | 841 | ||
| @@ -892,8 +886,7 @@ variable chain of symbols. */) | |||
| 892 | ((blv)->forwarded ? do_symval_forwarding (BLV_FWD (blv)) : BLV_VALUE (blv)) | 886 | ((blv)->forwarded ? do_symval_forwarding (BLV_FWD (blv)) : BLV_VALUE (blv)) |
| 893 | 887 | ||
| 894 | Lisp_Object | 888 | Lisp_Object |
| 895 | do_symval_forwarding (valcontents) | 889 | do_symval_forwarding (register union Lisp_Fwd *valcontents) |
| 896 | register union Lisp_Fwd *valcontents; | ||
| 897 | { | 890 | { |
| 898 | register Lisp_Object val; | 891 | register Lisp_Object val; |
| 899 | switch (XFWDTYPE (valcontents)) | 892 | switch (XFWDTYPE (valcontents)) |
| @@ -947,11 +940,7 @@ do_symval_forwarding (valcontents) | |||
| 947 | } while (0) | 940 | } while (0) |
| 948 | 941 | ||
| 949 | static void | 942 | static void |
| 950 | store_symval_forwarding (/* symbol, */ valcontents, newval, buf) | 943 | store_symval_forwarding (union Lisp_Fwd *valcontents, register Lisp_Object newval, struct buffer *buf) |
| 951 | /* struct Lisp_Symbol *symbol; */ | ||
| 952 | union Lisp_Fwd *valcontents; | ||
| 953 | register Lisp_Object newval; | ||
| 954 | struct buffer *buf; | ||
| 955 | { | 944 | { |
| 956 | switch (XFWDTYPE (valcontents)) | 945 | switch (XFWDTYPE (valcontents)) |
| 957 | { | 946 | { |
| @@ -1032,8 +1021,7 @@ store_symval_forwarding (/* symbol, */ valcontents, newval, buf) | |||
| 1032 | This makes it safe to alter the status of other bindings. */ | 1021 | This makes it safe to alter the status of other bindings. */ |
| 1033 | 1022 | ||
| 1034 | void | 1023 | void |
| 1035 | swap_in_global_binding (symbol) | 1024 | swap_in_global_binding (struct Lisp_Symbol *symbol) |
| 1036 | struct Lisp_Symbol *symbol; | ||
| 1037 | { | 1025 | { |
| 1038 | struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (symbol); | 1026 | struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (symbol); |
| 1039 | 1027 | ||
| @@ -1059,9 +1047,7 @@ swap_in_global_binding (symbol) | |||
| 1059 | This could be another forwarding pointer. */ | 1047 | This could be another forwarding pointer. */ |
| 1060 | 1048 | ||
| 1061 | static void | 1049 | static void |
| 1062 | swap_in_symval_forwarding (symbol, blv) | 1050 | swap_in_symval_forwarding (struct Lisp_Symbol *symbol, struct Lisp_Buffer_Local_Value *blv) |
| 1063 | struct Lisp_Symbol *symbol; | ||
| 1064 | struct Lisp_Buffer_Local_Value *blv; | ||
| 1065 | { | 1051 | { |
| 1066 | register Lisp_Object tem1; | 1052 | register Lisp_Object tem1; |
| 1067 | 1053 | ||
| @@ -1111,8 +1097,7 @@ swap_in_symval_forwarding (symbol, blv) | |||
| 1111 | within this function. Great care is required for this. */ | 1097 | within this function. Great care is required for this. */ |
| 1112 | 1098 | ||
| 1113 | Lisp_Object | 1099 | Lisp_Object |
| 1114 | find_symbol_value (symbol) | 1100 | find_symbol_value (Lisp_Object symbol) |
| 1115 | Lisp_Object symbol; | ||
| 1116 | { | 1101 | { |
| 1117 | struct Lisp_Symbol *sym; | 1102 | struct Lisp_Symbol *sym; |
| 1118 | 1103 | ||
| @@ -1183,8 +1168,7 @@ let_shadows_buffer_binding_p (struct Lisp_Symbol *symbol) | |||
| 1183 | } | 1168 | } |
| 1184 | 1169 | ||
| 1185 | static int | 1170 | static int |
| 1186 | let_shadows_global_binding_p (symbol) | 1171 | let_shadows_global_binding_p (Lisp_Object symbol) |
| 1187 | Lisp_Object symbol; | ||
| 1188 | { | 1172 | { |
| 1189 | struct specbinding *p; | 1173 | struct specbinding *p; |
| 1190 | 1174 | ||
| @@ -1204,9 +1188,7 @@ let_shadows_global_binding_p (symbol) | |||
| 1204 | If BINDFLAG is nonzero, we don't do that. */ | 1188 | If BINDFLAG is nonzero, we don't do that. */ |
| 1205 | 1189 | ||
| 1206 | void | 1190 | void |
| 1207 | set_internal (symbol, newval, where, bindflag) | 1191 | set_internal (register Lisp_Object symbol, register Lisp_Object newval, register Lisp_Object where, int bindflag) |
| 1208 | register Lisp_Object symbol, newval, where; | ||
| 1209 | int bindflag; | ||
| 1210 | { | 1192 | { |
| 1211 | int voide = EQ (newval, Qunbound); | 1193 | int voide = EQ (newval, Qunbound); |
| 1212 | struct Lisp_Symbol *sym; | 1194 | struct Lisp_Symbol *sym; |
| @@ -1357,8 +1339,7 @@ set_internal (symbol, newval, where, bindflag) | |||
| 1357 | Return Qunbound if it is void. */ | 1339 | Return Qunbound if it is void. */ |
| 1358 | 1340 | ||
| 1359 | Lisp_Object | 1341 | Lisp_Object |
| 1360 | default_value (symbol) | 1342 | default_value (Lisp_Object symbol) |
| 1361 | Lisp_Object symbol; | ||
| 1362 | { | 1343 | { |
| 1363 | struct Lisp_Symbol *sym; | 1344 | struct Lisp_Symbol *sym; |
| 1364 | 1345 | ||
| @@ -2057,7 +2038,7 @@ If the current binding is global (the default), the value is nil. */) | |||
| 2057 | /* This code is disabled now that we use the selected frame to return | 2038 | /* This code is disabled now that we use the selected frame to return |
| 2058 | keyboard-local-values. */ | 2039 | keyboard-local-values. */ |
| 2059 | #if 0 | 2040 | #if 0 |
| 2060 | extern struct terminal *get_terminal P_ ((Lisp_Object display, int)); | 2041 | extern struct terminal *get_terminal (Lisp_Object display, int); |
| 2061 | 2042 | ||
| 2062 | DEFUN ("terminal-local-value", Fterminal_local_value, Sterminal_local_value, 2, 2, 0, | 2043 | DEFUN ("terminal-local-value", Fterminal_local_value, Sterminal_local_value, 2, 2, 0, |
| 2063 | doc: /* Return the terminal-local value of SYMBOL on TERMINAL. | 2044 | doc: /* Return the terminal-local value of SYMBOL on TERMINAL. |
| @@ -2109,8 +2090,7 @@ selected frame's terminal device). */) | |||
| 2109 | This is like Findirect_function, except that it doesn't signal an | 2090 | This is like Findirect_function, except that it doesn't signal an |
| 2110 | error if the chain ends up unbound. */ | 2091 | error if the chain ends up unbound. */ |
| 2111 | Lisp_Object | 2092 | Lisp_Object |
| 2112 | indirect_function (object) | 2093 | indirect_function (register Lisp_Object object) |
| 2113 | register Lisp_Object object; | ||
| 2114 | { | 2094 | { |
| 2115 | Lisp_Object tortoise, hare; | 2095 | Lisp_Object tortoise, hare; |
| 2116 | 2096 | ||
| @@ -2284,13 +2264,13 @@ bool-vector. IDX starts at 0. */) | |||
| 2284 | USE_SAFE_ALLOCA; | 2264 | USE_SAFE_ALLOCA; |
| 2285 | 2265 | ||
| 2286 | SAFE_ALLOCA (str, unsigned char *, nbytes); | 2266 | SAFE_ALLOCA (str, unsigned char *, nbytes); |
| 2287 | bcopy (SDATA (array), str, nbytes); | 2267 | memcpy (str, SDATA (array), nbytes); |
| 2288 | allocate_string_data (XSTRING (array), nchars, | 2268 | allocate_string_data (XSTRING (array), nchars, |
| 2289 | nbytes + new_bytes - prev_bytes); | 2269 | nbytes + new_bytes - prev_bytes); |
| 2290 | bcopy (str, SDATA (array), idxval_byte); | 2270 | memcpy (SDATA (array), str, idxval_byte); |
| 2291 | p1 = SDATA (array) + idxval_byte; | 2271 | p1 = SDATA (array) + idxval_byte; |
| 2292 | bcopy (str + idxval_byte + prev_bytes, p1 + new_bytes, | 2272 | memcpy (p1 + new_bytes, str + idxval_byte + prev_bytes, |
| 2293 | nbytes - (idxval_byte + prev_bytes)); | 2273 | nbytes - (idxval_byte + prev_bytes)); |
| 2294 | SAFE_FREE (); | 2274 | SAFE_FREE (); |
| 2295 | clear_string_char_byte_cache (); | 2275 | clear_string_char_byte_cache (); |
| 2296 | } | 2276 | } |
| @@ -2326,9 +2306,7 @@ bool-vector. IDX starts at 0. */) | |||
| 2326 | enum comparison { equal, notequal, less, grtr, less_or_equal, grtr_or_equal }; | 2306 | enum comparison { equal, notequal, less, grtr, less_or_equal, grtr_or_equal }; |
| 2327 | 2307 | ||
| 2328 | Lisp_Object | 2308 | Lisp_Object |
| 2329 | arithcompare (num1, num2, comparison) | 2309 | arithcompare (Lisp_Object num1, Lisp_Object num2, enum comparison comparison) |
| 2330 | Lisp_Object num1, num2; | ||
| 2331 | enum comparison comparison; | ||
| 2332 | { | 2310 | { |
| 2333 | double f1 = 0, f2 = 0; | 2311 | double f1 = 0, f2 = 0; |
| 2334 | int floatp = 0; | 2312 | int floatp = 0; |
| @@ -2454,8 +2432,7 @@ DEFUN ("zerop", Fzerop, Szerop, 1, 1, 0, | |||
| 2454 | when the value fits in one. */ | 2432 | when the value fits in one. */ |
| 2455 | 2433 | ||
| 2456 | Lisp_Object | 2434 | Lisp_Object |
| 2457 | long_to_cons (i) | 2435 | long_to_cons (long unsigned int i) |
| 2458 | unsigned long i; | ||
| 2459 | { | 2436 | { |
| 2460 | unsigned long top = i >> 16; | 2437 | unsigned long top = i >> 16; |
| 2461 | unsigned int bot = i & 0xFFFF; | 2438 | unsigned int bot = i & 0xFFFF; |
| @@ -2467,8 +2444,7 @@ long_to_cons (i) | |||
| 2467 | } | 2444 | } |
| 2468 | 2445 | ||
| 2469 | unsigned long | 2446 | unsigned long |
| 2470 | cons_to_long (c) | 2447 | cons_to_long (Lisp_Object c) |
| 2471 | Lisp_Object c; | ||
| 2472 | { | 2448 | { |
| 2473 | Lisp_Object top, bot; | 2449 | Lisp_Object top, bot; |
| 2474 | if (INTEGERP (c)) | 2450 | if (INTEGERP (c)) |
| @@ -2509,8 +2485,7 @@ NUMBER may be an integer or a floating point number. */) | |||
| 2509 | } | 2485 | } |
| 2510 | 2486 | ||
| 2511 | INLINE static int | 2487 | INLINE static int |
| 2512 | digit_to_number (character, base) | 2488 | digit_to_number (int character, int base) |
| 2513 | int character, base; | ||
| 2514 | { | 2489 | { |
| 2515 | int digit; | 2490 | int digit; |
| 2516 | 2491 | ||
| @@ -2605,15 +2580,12 @@ enum arithop | |||
| 2605 | Amin | 2580 | Amin |
| 2606 | }; | 2581 | }; |
| 2607 | 2582 | ||
| 2608 | static Lisp_Object float_arith_driver P_ ((double, int, enum arithop, | 2583 | static Lisp_Object float_arith_driver (double, int, enum arithop, |
| 2609 | int, Lisp_Object *)); | 2584 | int, Lisp_Object *); |
| 2610 | extern Lisp_Object fmod_float (); | 2585 | extern Lisp_Object fmod_float (Lisp_Object, Lisp_Object); |
| 2611 | 2586 | ||
| 2612 | Lisp_Object | 2587 | Lisp_Object |
| 2613 | arith_driver (code, nargs, args) | 2588 | arith_driver (enum arithop code, int nargs, register Lisp_Object *args) |
| 2614 | enum arithop code; | ||
| 2615 | int nargs; | ||
| 2616 | register Lisp_Object *args; | ||
| 2617 | { | 2589 | { |
| 2618 | register Lisp_Object val; | 2590 | register Lisp_Object val; |
| 2619 | register int argnum; | 2591 | register int argnum; |
| @@ -2698,12 +2670,7 @@ arith_driver (code, nargs, args) | |||
| 2698 | #define isnan(x) ((x) != (x)) | 2670 | #define isnan(x) ((x) != (x)) |
| 2699 | 2671 | ||
| 2700 | static Lisp_Object | 2672 | static Lisp_Object |
| 2701 | float_arith_driver (accum, argnum, code, nargs, args) | 2673 | float_arith_driver (double accum, register int argnum, enum arithop code, int nargs, register Lisp_Object *args) |
| 2702 | double accum; | ||
| 2703 | register int argnum; | ||
| 2704 | enum arithop code; | ||
| 2705 | int nargs; | ||
| 2706 | register Lisp_Object *args; | ||
| 2707 | { | 2674 | { |
| 2708 | register Lisp_Object val; | 2675 | register Lisp_Object val; |
| 2709 | double next; | 2676 | double next; |
| @@ -3038,7 +3005,7 @@ lowercase l) for small endian machines. */) | |||
| 3038 | 3005 | ||
| 3039 | 3006 | ||
| 3040 | void | 3007 | void |
| 3041 | syms_of_data () | 3008 | syms_of_data (void) |
| 3042 | { | 3009 | { |
| 3043 | Lisp_Object error_tail, arith_tail; | 3010 | Lisp_Object error_tail, arith_tail; |
| 3044 | 3011 | ||
| @@ -3467,8 +3434,7 @@ syms_of_data () | |||
| 3467 | } | 3434 | } |
| 3468 | 3435 | ||
| 3469 | SIGTYPE | 3436 | SIGTYPE |
| 3470 | arith_error (signo) | 3437 | arith_error (int signo) |
| 3471 | int signo; | ||
| 3472 | { | 3438 | { |
| 3473 | sigsetmask (SIGEMPTYMASK); | 3439 | sigsetmask (SIGEMPTYMASK); |
| 3474 | 3440 | ||
| @@ -3477,7 +3443,7 @@ arith_error (signo) | |||
| 3477 | } | 3443 | } |
| 3478 | 3444 | ||
| 3479 | void | 3445 | void |
| 3480 | init_data () | 3446 | init_data (void) |
| 3481 | { | 3447 | { |
| 3482 | /* Don't do this if just dumping out. | 3448 | /* Don't do this if just dumping out. |
| 3483 | We don't want to call `signal' in this case | 3449 | We don't want to call `signal' in this case |