aboutsummaryrefslogtreecommitdiffstats
path: root/src/data.c
diff options
context:
space:
mode:
authorKenichi Handa2010-07-08 17:09:35 +0900
committerKenichi Handa2010-07-08 17:09:35 +0900
commit80d4189187791916590b6c2b20b54588d432bb75 (patch)
treee59e52ee4a456f3235bff0e7fba4362681dba7dd /src/data.c
parenta7840ffb291e13c2a2386ccbd58089e1d7461c16 (diff)
parent0216627eb39f77958e30f4750f581714fdfd7faf (diff)
downloademacs-80d4189187791916590b6c2b20b54588d432bb75.tar.gz
emacs-80d4189187791916590b6c2b20b54588d432bb75.zip
merge trunk
Diffstat (limited to 'src/data.c')
-rw-r--r--src/data.c102
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)
53extern double atof (); 53extern double atof (const char *);
54#endif /* !atof */ 54#endif /* !atof */
55 55
56Lisp_Object Qnil, Qt, Qquote, Qlambda, Qsubr, Qunbound; 56Lisp_Object Qnil, Qt, Qquote, Qlambda, Qsubr, Qunbound;
@@ -97,16 +97,14 @@ Lisp_Object Vmost_positive_fixnum, Vmost_negative_fixnum;
97 97
98 98
99void 99void
100circular_list_error (list) 100circular_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
107Lisp_Object 106Lisp_Object
108wrong_type_argument (predicate, value) 107wrong_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
121void 119void
122pure_write_error () 120pure_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
127void 125void
128args_out_of_range (a1, a2) 126args_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
134void 131void
135args_out_of_range_3 (a1, a2, a3) 132args_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
148int 144int
149sign_extend_lisp_int (num) 145sign_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
842struct Lisp_Symbol * 837struct Lisp_Symbol *
843indirect_variable (symbol) 838indirect_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
894Lisp_Object 888Lisp_Object
895do_symval_forwarding (valcontents) 889do_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
949static void 942static void
950store_symval_forwarding (/* symbol, */ valcontents, newval, buf) 943store_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
1034void 1023void
1035swap_in_global_binding (symbol) 1024swap_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
1061static void 1049static void
1062swap_in_symval_forwarding (symbol, blv) 1050swap_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
1113Lisp_Object 1099Lisp_Object
1114find_symbol_value (symbol) 1100find_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
1185static int 1170static int
1186let_shadows_global_binding_p (symbol) 1171let_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
1206void 1190void
1207set_internal (symbol, newval, where, bindflag) 1191set_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
1359Lisp_Object 1341Lisp_Object
1360default_value (symbol) 1342default_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
2060extern struct terminal *get_terminal P_ ((Lisp_Object display, int)); 2041extern struct terminal *get_terminal (Lisp_Object display, int);
2061 2042
2062DEFUN ("terminal-local-value", Fterminal_local_value, Sterminal_local_value, 2, 2, 0, 2043DEFUN ("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. */
2111Lisp_Object 2092Lisp_Object
2112indirect_function (object) 2093indirect_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. */)
2326enum comparison { equal, notequal, less, grtr, less_or_equal, grtr_or_equal }; 2306enum comparison { equal, notequal, less, grtr, less_or_equal, grtr_or_equal };
2327 2307
2328Lisp_Object 2308Lisp_Object
2329arithcompare (num1, num2, comparison) 2309arithcompare (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
2456Lisp_Object 2434Lisp_Object
2457long_to_cons (i) 2435long_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
2469unsigned long 2446unsigned long
2470cons_to_long (c) 2447cons_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
2511INLINE static int 2487INLINE static int
2512digit_to_number (character, base) 2488digit_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
2608static Lisp_Object float_arith_driver P_ ((double, int, enum arithop, 2583static Lisp_Object float_arith_driver (double, int, enum arithop,
2609 int, Lisp_Object *)); 2584 int, Lisp_Object *);
2610extern Lisp_Object fmod_float (); 2585extern Lisp_Object fmod_float (Lisp_Object, Lisp_Object);
2611 2586
2612Lisp_Object 2587Lisp_Object
2613arith_driver (code, nargs, args) 2588arith_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
2700static Lisp_Object 2672static Lisp_Object
2701float_arith_driver (accum, argnum, code, nargs, args) 2673float_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
3040void 3007void
3041syms_of_data () 3008syms_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
3469SIGTYPE 3436SIGTYPE
3470arith_error (signo) 3437arith_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
3479void 3445void
3480init_data () 3446init_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