comparison src/eval.c @ 5581:56144c8593a8

Mechanically change INT to FIXNUM in our sources. src/ChangeLog addition: 2011-10-09 Aidan Kehoe <kehoea@parhasard.net> [...] Mechanically change INT (where it refers to non-bignum Lisp integers) to FIXNUM in our sources. Done for the following functions, enums, and macros: Lisp_Type_Int_Even, Lisp_Type_Int_Odd, INT_GCBITS, INT_VALBITS, make_int(), INTP(), XINT(), CHECK_INT(), XREALINT(), INT_PLUS(), INT_MINUS(), EMACS_INT_MAX (to MOST_POSITIVE_FIXNUM), EMACS_INT_MIN (to MOST_NEGATIVE_FIXNUM), NUMBER_FITS_IN_AN_EMACS_INT() to NUMBER_FITS_IN_A_FIXNUM(), XFLOATINT, XCHAR_OR_INT, INT_OR_FLOAT. The EMACS_INT typedef was not changed, it does not describe non-bignum Lisp integers. Script that did the change available in http://mid.gmane.org/20067.17650.181273.12014@parhasard.net . modules/ChangeLog addition: 2011-10-09 Aidan Kehoe <kehoea@parhasard.net> [...] Mechanically change INT to FIXNUM, where the usage describes non-bignum Lisp integers. See the src/ChangeLog entry for more details. man/ChangeLog addition: 2011-10-09 Aidan Kehoe <kehoea@parhasard.net> * internals/internals.texi (How Lisp Objects Are Represented in C): * internals/internals.texi (Integers and Characters): Mechanically change INT to FIXNUM, where the usage describes non-bignum Lisp integers.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 09 Oct 2011 09:51:57 +0100
parents b0d87f92e60b
children 5f4f92a31875
comparison
equal deleted inserted replaced
5580:a0e81357194e 5581:56144c8593a8
1240 Lisp_Object retval = Qnil; 1240 Lisp_Object retval = Qnil;
1241 1241
1242 GET_LIST_LENGTH (args, nargs); 1242 GET_LIST_LENGTH (args, nargs);
1243 1243
1244 if (nargs & 1) /* Odd number of arguments? */ 1244 if (nargs & 1) /* Odd number of arguments? */
1245 Fsignal (Qwrong_number_of_arguments, list2 (Qsetq, make_int (nargs))); 1245 Fsignal (Qwrong_number_of_arguments, list2 (Qsetq, make_fixnum (nargs)));
1246 1246
1247 GC_PROPERTY_LIST_LOOP_3 (symbol, val, args) 1247 GC_PROPERTY_LIST_LOOP_3 (symbol, val, args)
1248 { 1248 {
1249 val = Feval (val); 1249 val = Feval (val);
1250 val = IGNORE_MULTIPLE_VALUES (val); 1250 val = IGNORE_MULTIPLE_VALUES (val);
1279 1279
1280 GET_LIST_LENGTH (args, nargs); 1280 GET_LIST_LENGTH (args, nargs);
1281 if (nargs != 1) 1281 if (nargs != 1)
1282 { 1282 {
1283 Fsignal (Qwrong_number_of_arguments, 1283 Fsignal (Qwrong_number_of_arguments,
1284 list2 (Qquote, make_int (nargs))); 1284 list2 (Qquote, make_fixnum (nargs)));
1285 } 1285 }
1286 1286
1287 return XCAR (args); 1287 return XCAR (args);
1288 } 1288 }
1289 1289
1361 1361
1362 GET_LIST_LENGTH (args, nargs); 1362 GET_LIST_LENGTH (args, nargs);
1363 if (nargs != 1) 1363 if (nargs != 1)
1364 { 1364 {
1365 Fsignal (Qwrong_number_of_arguments, 1365 Fsignal (Qwrong_number_of_arguments,
1366 list2 (Qfunction, make_int (nargs))); 1366 list2 (Qfunction, make_fixnum (nargs)));
1367 } 1367 }
1368 1368
1369 return XCAR (args); 1369 return XCAR (args);
1370 } 1370 }
1371 1371
1408 (args)) 1408 (args))
1409 { 1409 {
1410 /* This function can GC */ 1410 /* This function can GC */
1411 if (!NILP (Vmacro_declaration_function)) 1411 if (!NILP (Vmacro_declaration_function))
1412 { 1412 {
1413 Lisp_Object declare = Fnth (make_int (2), args); 1413 Lisp_Object declare = Fnth (make_fixnum (2), args);
1414 1414
1415 /* Sigh. This GNU interface is incompatible with the CL declare macro, 1415 /* Sigh. This GNU interface is incompatible with the CL declare macro,
1416 and the latter is much older. 1416 and the latter is much older.
1417 1417
1418 GNU describe this syntax in their docstrings. It's sufficiently 1418 GNU describe this syntax in their docstrings. It's sufficiently
1424 compiler (will) warn(s) if it encounters code that attempts to use 1424 compiler (will) warn(s) if it encounters code that attempts to use
1425 it. */ 1425 it. */
1426 1426
1427 if (STRINGP (declare)) 1427 if (STRINGP (declare))
1428 { 1428 {
1429 declare = Fnth (make_int (3), args); 1429 declare = Fnth (make_fixnum (3), args);
1430 } 1430 }
1431 1431
1432 if (CONSP (declare) && EQ (Qdeclare, XCAR (declare))) 1432 if (CONSP (declare) && EQ (Qdeclare, XCAR (declare)))
1433 { 1433 {
1434 call2 (Vmacro_declaration_function, XCAR (args), declare); 1434 call2 (Vmacro_declaration_function, XCAR (args), declare);
1599 /* Not defined or definition not suitable */ 1599 /* Not defined or definition not suitable */
1600 break; 1600 break;
1601 if (EQ (XCAR (def), Qautoload)) 1601 if (EQ (XCAR (def), Qautoload))
1602 { 1602 {
1603 /* Autoloading function: will it be a macro when loaded? */ 1603 /* Autoloading function: will it be a macro when loaded? */
1604 tem = Felt (def, make_int (4)); 1604 tem = Felt (def, make_fixnum (4));
1605 if (EQ (tem, Qt) || EQ (tem, Qmacro)) 1605 if (EQ (tem, Qt) || EQ (tem, Qmacro))
1606 { 1606 {
1607 /* Yes, load it and try again. */ 1607 /* Yes, load it and try again. */
1608 /* do_autoload GCPROs both arguments */ 1608 /* do_autoload GCPROs both arguments */
1609 do_autoload (def, sym); 1609 do_autoload (def, sym);
1927 Lisp_Object tag, value; 1927 Lisp_Object tag, value;
1928 1928
1929 GET_LIST_LENGTH (args, nargs); 1929 GET_LIST_LENGTH (args, nargs);
1930 if (nargs != 2) 1930 if (nargs != 2)
1931 { 1931 {
1932 Fsignal (Qwrong_number_of_arguments, list2 (Qthrow, make_int (nargs))); 1932 Fsignal (Qwrong_number_of_arguments, list2 (Qthrow, make_fixnum (nargs)));
1933 } 1933 }
1934 1934
1935 tag = IGNORE_MULTIPLE_VALUES (Feval (XCAR(args))); 1935 tag = IGNORE_MULTIPLE_VALUES (Feval (XCAR(args)));
1936 1936
1937 value = Feval (XCAR (XCDR (args))); 1937 value = Feval (XCAR (XCDR (args)));
2307 /* This function can GC */ 2307 /* This function can GC */
2308 int speccount = specpdl_depth(); 2308 int speccount = specpdl_depth();
2309 Lisp_Object tem; 2309 Lisp_Object tem;
2310 2310
2311 tem = Ffunction_max_args (args[0]); 2311 tem = Ffunction_max_args (args[0]);
2312 if (! (XINT (Ffunction_min_args (args[0])) <= 1 2312 if (! (XFIXNUM (Ffunction_min_args (args[0])) <= 1
2313 && (NILP (tem) || 1 <= XINT (tem)))) 2313 && (NILP (tem) || 1 <= XFIXNUM (tem))))
2314 invalid_argument ("Must be function of one argument", args[0]); 2314 invalid_argument ("Must be function of one argument", args[0]);
2315 2315
2316 /* (handler-fun . handler-args) but currently there are no handler-args */ 2316 /* (handler-fun . handler-args) but currently there are no handler-args */
2317 tem = noseeum_cons (list1 (args[0]), Vcondition_handlers); 2317 tem = noseeum_cons (list1 (args[0]), Vcondition_handlers);
2318 record_unwind_protect (condition_bind_unwind, tem); 2318 record_unwind_protect (condition_bind_unwind, tem);
3040 3040
3041 Lisp_Object 3041 Lisp_Object
3042 signal_wrong_number_of_arguments_error (Lisp_Object function, int nargs) 3042 signal_wrong_number_of_arguments_error (Lisp_Object function, int nargs)
3043 { 3043 {
3044 return Fsignal (Qwrong_number_of_arguments, 3044 return Fsignal (Qwrong_number_of_arguments,
3045 list2 (function, make_int (nargs))); 3045 list2 (function, make_fixnum (nargs)));
3046 } 3046 }
3047 3047
3048 /* Used in list traversal macros for efficiency. */ 3048 /* Used in list traversal macros for efficiency. */
3049 DOESNT_RETURN 3049 DOESNT_RETURN
3050 signal_malformed_list_error (Lisp_Object list) 3050 signal_malformed_list_error (Lisp_Object list)
3703 /* The actual printed compiled_function object is incomprehensible. 3703 /* The actual printed compiled_function object is incomprehensible.
3704 Check the backtrace to see if we can get a more meaningful symbol. */ 3704 Check the backtrace to see if we can get a more meaningful symbol. */
3705 if (EQ (fun, indirect_function (*backtrace_list->function, 0))) 3705 if (EQ (fun, indirect_function (*backtrace_list->function, 0)))
3706 fun = *backtrace_list->function; 3706 fun = *backtrace_list->function;
3707 return Fsignal (Qwrong_number_of_arguments, 3707 return Fsignal (Qwrong_number_of_arguments,
3708 list2 (fun, make_int (nargs))); 3708 list2 (fun, make_fixnum (nargs)));
3709 } 3709 }
3710 3710
3711 { 3711 {
3712 Lisp_Object value = 3712 Lisp_Object value =
3713 execute_optimized_program ((Opbyte *) XOPAQUE_DATA (f->instructions), 3713 execute_optimized_program ((Opbyte *) XOPAQUE_DATA (f->instructions),
4273 /* Lazily munge the instructions into a more efficient form */ 4273 /* Lazily munge the instructions into a more efficient form */
4274 /* Needed to set max_args */ 4274 /* Needed to set max_args */
4275 optimize_compiled_function (function); 4275 optimize_compiled_function (function);
4276 4276
4277 if (function_min_args_p) 4277 if (function_min_args_p)
4278 return make_int (f->min_args); 4278 return make_fixnum (f->min_args);
4279 else if (f->max_args == MANY) 4279 else if (f->max_args == MANY)
4280 return Qnil; 4280 return Qnil;
4281 else 4281 else
4282 return make_int (f->max_args); 4282 return make_fixnum (f->max_args);
4283 } 4283 }
4284 else if (CONSP (function)) 4284 else if (CONSP (function))
4285 { 4285 {
4286 Lisp_Object funcar = XCAR (function); 4286 Lisp_Object funcar = XCAR (function);
4287 4287
4333 { 4333 {
4334 argcount++; 4334 argcount++;
4335 } 4335 }
4336 } 4336 }
4337 4337
4338 return make_int (argcount); 4338 return make_fixnum (argcount);
4339 } 4339 }
4340 } 4340 }
4341 4341
4342 DEFUN ("function-min-args", Ffunction_min_args, 1, 1, 0, /* 4342 DEFUN ("function-min-args", Ffunction_min_args, 1, 1, 0, /*
4343 Return the minimum number of arguments a function may be called with. 4343 Return the minimum number of arguments a function may be called with.
4631 Elemcount allocated_count = mv->allocated_count; 4631 Elemcount allocated_count = mv->allocated_count;
4632 4632
4633 if (index != 0 && 4633 if (index != 0 &&
4634 (index < first_desired || index >= (first_desired + allocated_count))) 4634 (index < first_desired || index >= (first_desired + allocated_count)))
4635 { 4635 {
4636 args_out_of_range (make_int (first_desired), 4636 args_out_of_range (make_fixnum (first_desired),
4637 make_int (first_desired + allocated_count)); 4637 make_fixnum (first_desired + allocated_count));
4638 } 4638 }
4639 4639
4640 mv->contents[index == 0 ? 0 : 1 + (index - first_desired)] = value; 4640 mv->contents[index == 0 ? 0 : 1 + (index - first_desired)] = value;
4641 } 4641 }
4642 4642
4648 Elemcount allocated_count = mv->allocated_count; 4648 Elemcount allocated_count = mv->allocated_count;
4649 4649
4650 if (index != 0 && 4650 if (index != 0 &&
4651 (index < first_desired || index >= (first_desired + allocated_count))) 4651 (index < first_desired || index >= (first_desired + allocated_count)))
4652 { 4652 {
4653 args_out_of_range (make_int (first_desired), 4653 args_out_of_range (make_fixnum (first_desired),
4654 make_int (first_desired + allocated_count)); 4654 make_fixnum (first_desired + allocated_count));
4655 } 4655 }
4656 4656
4657 return mv->contents[index == 0 ? 0 : 1 + (index - first_desired)]; 4657 return mv->contents[index == 0 ? 0 : 1 + (index - first_desired)];
4658 } 4658 }
4659 4659
4756 " FIRST-DESIRED-MULTIPLE-VALUE", Qunbound); 4756 " FIRST-DESIRED-MULTIPLE-VALUE", Qunbound);
4757 } 4757 }
4758 4758
4759 if (upper > Vmultiple_values_limit) 4759 if (upper > Vmultiple_values_limit)
4760 { 4760 {
4761 args_out_of_range (make_int (upper), make_int (Vmultiple_values_limit)); 4761 args_out_of_range (make_fixnum (upper), make_fixnum (Vmultiple_values_limit));
4762 } 4762 }
4763 4763
4764 /* In the event that something back up the stack wants more multiple 4764 /* In the event that something back up the stack wants more multiple
4765 values than we do, we need to keep its figures for 4765 values than we do, we need to keep its figures for
4766 first_desired_multiple_value or multiple_value_current_limit both. It 4766 first_desired_multiple_value or multiple_value_current_limit both. It
4791 4791
4792 Lisp_Object 4792 Lisp_Object
4793 multiple_value_call (int nargs, Lisp_Object *args) 4793 multiple_value_call (int nargs, Lisp_Object *args)
4794 { 4794 {
4795 /* The argument order here is horrible: */ 4795 /* The argument order here is horrible: */
4796 int i, speccount = XINT (args[3]); 4796 int i, speccount = XFIXNUM (args[3]);
4797 Lisp_Object result = Qnil, head = Fcons (args[0], Qnil), list_offset; 4797 Lisp_Object result = Qnil, head = Fcons (args[0], Qnil), list_offset;
4798 struct gcpro gcpro1, gcpro2; 4798 struct gcpro gcpro1, gcpro2;
4799 Lisp_Object apply_args[2]; 4799 Lisp_Object apply_args[2];
4800 4800
4801 GCPRO2 (head, result); 4801 GCPRO2 (head, result);
4864 4864
4865 GCPRO1 (*constructed_args); 4865 GCPRO1 (*constructed_args);
4866 gcpro1.nvars = ++i; 4866 gcpro1.nvars = ++i;
4867 4867
4868 /* The argument order is horrible here. */ 4868 /* The argument order is horrible here. */
4869 constructed_args[i] = make_int (0); 4869 constructed_args[i] = make_fixnum (0);
4870 gcpro1.nvars = ++i; 4870 gcpro1.nvars = ++i;
4871 constructed_args[i] = make_int (Vmultiple_values_limit); 4871 constructed_args[i] = make_fixnum (Vmultiple_values_limit);
4872 gcpro1.nvars = ++i; 4872 gcpro1.nvars = ++i;
4873 4873
4874 speccount = bind_multiple_value_limits (0, Vmultiple_values_limit); 4874 speccount = bind_multiple_value_limits (0, Vmultiple_values_limit);
4875 constructed_args[i] = make_int (speccount); 4875 constructed_args[i] = make_fixnum (speccount);
4876 gcpro1.nvars = ++i; 4876 gcpro1.nvars = ++i;
4877 4877
4878 { 4878 {
4879 LIST_LOOP_2 (elt, XCDR (args)) 4879 LIST_LOOP_2 (elt, XCDR (args))
4880 { 4880 {
4887 } 4887 }
4888 4888
4889 Lisp_Object 4889 Lisp_Object
4890 multiple_value_list_internal (int nargs, Lisp_Object *args) 4890 multiple_value_list_internal (int nargs, Lisp_Object *args)
4891 { 4891 {
4892 int first = XINT (args[0]), upper = XINT (args[1]), 4892 int first = XFIXNUM (args[0]), upper = XFIXNUM (args[1]),
4893 speccount = XINT(args[2]); 4893 speccount = XFIXNUM(args[2]);
4894 Lisp_Object result = Qnil; 4894 Lisp_Object result = Qnil;
4895 4895
4896 assert (nargs == 4); 4896 assert (nargs == 4);
4897 4897
4898 result = args[3]; 4898 result = args[3];
4953 4953
4954 GET_LIST_LENGTH (args, nargs); 4954 GET_LIST_LENGTH (args, nargs);
4955 if (nargs != 3) 4955 if (nargs != 3)
4956 { 4956 {
4957 Fsignal (Qwrong_number_of_arguments, 4957 Fsignal (Qwrong_number_of_arguments,
4958 list2 (Qmultiple_value_list_internal, make_int (nargs))); 4958 list2 (Qmultiple_value_list_internal, make_fixnum (nargs)));
4959 } 4959 }
4960 4960
4961 argv[0] = IGNORE_MULTIPLE_VALUES (Feval (XCAR (args))); 4961 argv[0] = IGNORE_MULTIPLE_VALUES (Feval (XCAR (args)));
4962 4962
4963 GCPRO1 (argv[0]); 4963 GCPRO1 (argv[0]);
4964 gcpro1.nvars = 1; 4964 gcpro1.nvars = 1;
4965 4965
4966 args = XCDR (args); 4966 args = XCDR (args);
4967 argv[1] = IGNORE_MULTIPLE_VALUES (Feval (XCAR (args))); 4967 argv[1] = IGNORE_MULTIPLE_VALUES (Feval (XCAR (args)));
4968 4968
4969 check_integer_range (argv[1], Qzero, make_int (EMACS_INT_MAX)); 4969 check_integer_range (argv[1], Qzero, make_fixnum (MOST_POSITIVE_FIXNUM));
4970 check_integer_range (argv[0], Qzero, argv[1]); 4970 check_integer_range (argv[0], Qzero, argv[1]);
4971 4971
4972 upper = XINT (argv[1]); 4972 upper = XFIXNUM (argv[1]);
4973 first = XINT (argv[0]); 4973 first = XFIXNUM (argv[0]);
4974 4974
4975 gcpro1.nvars = 2; 4975 gcpro1.nvars = 2;
4976 4976
4977 /* The unintuitive order of things here is for the sake of the bytecode; 4977 /* The unintuitive order of things here is for the sake of the bytecode;
4978 the alternative would be to encode the number of arguments in the 4978 the alternative would be to encode the number of arguments in the
4979 bytecode stream, which complicates things if we have more than 255 4979 bytecode stream, which complicates things if we have more than 255
4980 arguments. */ 4980 arguments. */
4981 argv[2] = make_int (bind_multiple_value_limits (first, upper)); 4981 argv[2] = make_fixnum (bind_multiple_value_limits (first, upper));
4982 gcpro1.nvars = 3; 4982 gcpro1.nvars = 3;
4983 args = XCDR (args); 4983 args = XCDR (args);
4984 4984
4985 /* GCPROing in this function is not strictly necessary, this Feval is the 4985 /* GCPROing in this function is not strictly necessary, this Feval is the
4986 only point that may cons up data that is not immediately discarded, and 4986 only point that may cons up data that is not immediately discarded, and
7044 (level, flag)) 7044 (level, flag))
7045 { 7045 {
7046 REGISTER struct backtrace *backlist = backtrace_list; 7046 REGISTER struct backtrace *backlist = backtrace_list;
7047 REGISTER int i; 7047 REGISTER int i;
7048 7048
7049 CHECK_INT (level); 7049 CHECK_FIXNUM (level);
7050 7050
7051 for (i = 0; backlist && i < XINT (level); i++) 7051 for (i = 0; backlist && i < XFIXNUM (level); i++)
7052 { 7052 {
7053 backlist = backlist->next; 7053 backlist = backlist->next;
7054 } 7054 }
7055 7055
7056 if (backlist) 7056 if (backlist)
7121 Vinhibit_quit = Qt; 7121 Vinhibit_quit = Qt;
7122 7122
7123 entering_debugger = 0; 7123 entering_debugger = 0;
7124 7124
7125 if (!NILP (detailed)) 7125 if (!NILP (detailed))
7126 Vprint_level = make_int (50); 7126 Vprint_level = make_fixnum (50);
7127 else 7127 else
7128 Vprint_level = make_int (3); 7128 Vprint_level = make_fixnum (3);
7129 print_readably = 0; 7129 print_readably = 0;
7130 print_escape_newlines = 1; 7130 print_escape_newlines = 1;
7131 7131
7132 GCPRO2 (stream, old_level); 7132 GCPRO2 (stream, old_level);
7133 7133
7241 { 7241 {
7242 REGISTER struct backtrace *backlist = backtrace_list; 7242 REGISTER struct backtrace *backlist = backtrace_list;
7243 REGISTER int i; 7243 REGISTER int i;
7244 Lisp_Object tem; 7244 Lisp_Object tem;
7245 7245
7246 check_integer_range (nframes, Qzero, make_integer (EMACS_INT_MAX)); 7246 check_integer_range (nframes, Qzero, make_integer (MOST_POSITIVE_FIXNUM));
7247 7247
7248 /* Find the frame requested. */ 7248 /* Find the frame requested. */
7249 for (i = XINT (nframes); backlist && (i-- > 0);) 7249 for (i = XFIXNUM (nframes); backlist && (i-- > 0);)
7250 backlist = backlist->next; 7250 backlist = backlist->next;
7251 7251
7252 if (!backlist) 7252 if (!backlist)
7253 return Qnil; 7253 return Qnil;
7254 if (backlist->nargs == UNEVALLED) 7254 if (backlist->nargs == UNEVALLED)
7598 The exclusive upper bound on the number of multiple values. 7598 The exclusive upper bound on the number of multiple values.
7599 7599
7600 This applies to `values', `values-list', `multiple-value-bind' and related 7600 This applies to `values', `values-list', `multiple-value-bind' and related
7601 macros and special operators. 7601 macros and special operators.
7602 */); 7602 */);
7603 Vmultiple_values_limit = EMACS_INT_MAX > INT_MAX ? INT_MAX : EMACS_INT_MAX; 7603 Vmultiple_values_limit = MOST_POSITIVE_FIXNUM > INT_MAX ? INT_MAX : MOST_POSITIVE_FIXNUM;
7604 7604
7605 DEFVAR_LISP ("macro-declaration-function", &Vmacro_declaration_function /* 7605 DEFVAR_LISP ("macro-declaration-function", &Vmacro_declaration_function /*
7606 Function to process declarations in a macro definition. 7606 Function to process declarations in a macro definition.
7607 The function will be called with two args MACRO and DECL. 7607 The function will be called with two args MACRO and DECL.
7608 MACRO is the name of the macro being defined. 7608 MACRO is the name of the macro being defined.