aboutsummaryrefslogtreecommitdiffstats
path: root/src/data.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/data.c')
-rw-r--r--src/data.c59
1 files changed, 2 insertions, 57 deletions
diff --git a/src/data.c b/src/data.c
index 669efa5802e..ce9de8c5b23 100644
--- a/src/data.c
+++ b/src/data.c
@@ -25,17 +25,11 @@ Boston, MA 02111-1307, USA. */
25#include "lisp.h" 25#include "lisp.h"
26#include "puresize.h" 26#include "puresize.h"
27#include "charset.h" 27#include "charset.h"
28
29#ifndef standalone
30#include "buffer.h" 28#include "buffer.h"
31#include "keyboard.h" 29#include "keyboard.h"
32#include "frame.h" 30#include "frame.h"
33#endif
34
35#include "syssignal.h" 31#include "syssignal.h"
36 32
37#ifdef LISP_FLOAT_TYPE
38
39#ifdef STDC_HEADERS 33#ifdef STDC_HEADERS
40#include <float.h> 34#include <float.h>
41#endif 35#endif
@@ -61,7 +55,6 @@ Boston, MA 02111-1307, USA. */
61#endif 55#endif
62 56
63#include <math.h> 57#include <math.h>
64#endif /* LISP_FLOAT_TYPE */
65 58
66#if !defined (atof) 59#if !defined (atof)
67extern double atof (); 60extern double atof ();
@@ -93,10 +86,8 @@ Lisp_Object Qad_advice_info, Qad_activate_internal;
93Lisp_Object Qrange_error, Qdomain_error, Qsingularity_error; 86Lisp_Object Qrange_error, Qdomain_error, Qsingularity_error;
94Lisp_Object Qoverflow_error, Qunderflow_error; 87Lisp_Object Qoverflow_error, Qunderflow_error;
95 88
96#ifdef LISP_FLOAT_TYPE
97Lisp_Object Qfloatp; 89Lisp_Object Qfloatp;
98Lisp_Object Qnumberp, Qnumber_or_marker_p; 90Lisp_Object Qnumberp, Qnumber_or_marker_p;
99#endif
100 91
101static Lisp_Object Qinteger, Qsymbol, Qstring, Qcons, Qmarker, Qoverlay; 92static Lisp_Object Qinteger, Qsymbol, Qstring, Qcons, Qmarker, Qoverlay;
102static Lisp_Object Qfloat, Qwindow_configuration, Qwindow; 93static Lisp_Object Qfloat, Qwindow_configuration, Qwindow;
@@ -252,10 +243,8 @@ for example, (type-of 1) returns `integer'.")
252 return Qhash_table; 243 return Qhash_table;
253 return Qvector; 244 return Qvector;
254 245
255#ifdef LISP_FLOAT_TYPE
256 case Lisp_Float: 246 case Lisp_Float:
257 return Qfloat; 247 return Qfloat;
258#endif
259 248
260 default: 249 default:
261 abort (); 250 abort ();
@@ -506,7 +495,6 @@ DEFUN ("number-or-marker-p", Fnumber_or_marker_p,
506 return Qnil; 495 return Qnil;
507} 496}
508 497
509#ifdef LISP_FLOAT_TYPE
510DEFUN ("floatp", Ffloatp, Sfloatp, 1, 1, 0, 498DEFUN ("floatp", Ffloatp, Sfloatp, 1, 1, 0,
511 "Return t if OBJECT is a floating point number.") 499 "Return t if OBJECT is a floating point number.")
512 (object) 500 (object)
@@ -516,7 +504,7 @@ DEFUN ("floatp", Ffloatp, Sfloatp, 1, 1, 0,
516 return Qt; 504 return Qt;
517 return Qnil; 505 return Qnil;
518} 506}
519#endif /* LISP_FLOAT_TYPE */ 507
520 508
521/* Extract and set components of lists */ 509/* Extract and set components of lists */
522 510
@@ -1939,7 +1927,6 @@ arithcompare (num1, num2, comparison)
1939 double f1, f2; 1927 double f1, f2;
1940 int floatp = 0; 1928 int floatp = 0;
1941 1929
1942#ifdef LISP_FLOAT_TYPE
1943 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (num1, 0); 1930 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (num1, 0);
1944 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (num2, 0); 1931 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (num2, 0);
1945 1932
@@ -1949,10 +1936,6 @@ arithcompare (num1, num2, comparison)
1949 f1 = (FLOATP (num1)) ? XFLOAT_DATA (num1) : XINT (num1); 1936 f1 = (FLOATP (num1)) ? XFLOAT_DATA (num1) : XINT (num1);
1950 f2 = (FLOATP (num2)) ? XFLOAT_DATA (num2) : XINT (num2); 1937 f2 = (FLOATP (num2)) ? XFLOAT_DATA (num2) : XINT (num2);
1951 } 1938 }
1952#else
1953 CHECK_NUMBER_COERCE_MARKER (num1, 0);
1954 CHECK_NUMBER_COERCE_MARKER (num2, 0);
1955#endif /* LISP_FLOAT_TYPE */
1956 1939
1957 switch (comparison) 1940 switch (comparison)
1958 { 1941 {
@@ -2045,7 +2028,6 @@ DEFUN ("zerop", Fzerop, Szerop, 1, 1, 0, "Return t if NUMBER is zero.")
2045 (number) 2028 (number)
2046 register Lisp_Object number; 2029 register Lisp_Object number;
2047{ 2030{
2048#ifdef LISP_FLOAT_TYPE
2049 CHECK_NUMBER_OR_FLOAT (number, 0); 2031 CHECK_NUMBER_OR_FLOAT (number, 0);
2050 2032
2051 if (FLOATP (number)) 2033 if (FLOATP (number))
@@ -2054,9 +2036,6 @@ DEFUN ("zerop", Fzerop, Szerop, 1, 1, 0, "Return t if NUMBER is zero.")
2054 return Qt; 2036 return Qt;
2055 return Qnil; 2037 return Qnil;
2056 } 2038 }
2057#else
2058 CHECK_NUMBER (number, 0);
2059#endif /* LISP_FLOAT_TYPE */
2060 2039
2061 if (!XINT (number)) 2040 if (!XINT (number))
2062 return Qt; 2041 return Qt;
@@ -2101,9 +2080,6 @@ NUMBER may be an integer or a floating point number.")
2101{ 2080{
2102 char buffer[VALBITS]; 2081 char buffer[VALBITS];
2103 2082
2104#ifndef LISP_FLOAT_TYPE
2105 CHECK_NUMBER (number, 0);
2106#else
2107 CHECK_NUMBER_OR_FLOAT (number, 0); 2083 CHECK_NUMBER_OR_FLOAT (number, 0);
2108 2084
2109 if (FLOATP (number)) 2085 if (FLOATP (number))
@@ -2113,7 +2089,6 @@ NUMBER may be an integer or a floating point number.")
2113 float_to_string (pigbuf, XFLOAT_DATA (number)); 2089 float_to_string (pigbuf, XFLOAT_DATA (number));
2114 return build_string (pigbuf); 2090 return build_string (pigbuf);
2115 } 2091 }
2116#endif /* LISP_FLOAT_TYPE */
2117 2092
2118 if (sizeof (int) == sizeof (EMACS_INT)) 2093 if (sizeof (int) == sizeof (EMACS_INT))
2119 sprintf (buffer, "%d", XINT (number)); 2094 sprintf (buffer, "%d", XINT (number));
@@ -2187,10 +2162,8 @@ If the base used is not 10, floating point is not recognized.")
2187 else if (*p == '+') 2162 else if (*p == '+')
2188 p++; 2163 p++;
2189 2164
2190#ifdef LISP_FLOAT_TYPE
2191 if (isfloat_string (p) && b == 10) 2165 if (isfloat_string (p) && b == 10)
2192 return make_float (negative * atof (p)); 2166 return make_float (negative * atof (p));
2193#endif /* LISP_FLOAT_TYPE */
2194 2167
2195 while (1) 2168 while (1)
2196 { 2169 {
@@ -2237,15 +2210,11 @@ arith_driver (code, nargs, args)
2237 for (argnum = 0; argnum < nargs; argnum++) 2210 for (argnum = 0; argnum < nargs; argnum++)
2238 { 2211 {
2239 val = args[argnum]; /* using args[argnum] as argument to CHECK_NUMBER_... */ 2212 val = args[argnum]; /* using args[argnum] as argument to CHECK_NUMBER_... */
2240#ifdef LISP_FLOAT_TYPE
2241 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (val, argnum); 2213 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (val, argnum);
2242 2214
2243 if (FLOATP (val)) /* time to do serious math */ 2215 if (FLOATP (val)) /* time to do serious math */
2244 return (float_arith_driver ((double) accum, argnum, code, 2216 return (float_arith_driver ((double) accum, argnum, code,
2245 nargs, args)); 2217 nargs, args));
2246#else
2247 CHECK_NUMBER_COERCE_MARKER (val, argnum);
2248#endif /* LISP_FLOAT_TYPE */
2249 args[argnum] = val; /* runs into a compiler bug. */ 2218 args[argnum] = val; /* runs into a compiler bug. */
2250 next = XINT (args[argnum]); 2219 next = XINT (args[argnum]);
2251 switch (SWITCH_ENUM_CAST (code)) 2220 switch (SWITCH_ENUM_CAST (code))
@@ -2279,8 +2248,6 @@ arith_driver (code, nargs, args)
2279#undef isnan 2248#undef isnan
2280#define isnan(x) ((x) != (x)) 2249#define isnan(x) ((x) != (x))
2281 2250
2282#ifdef LISP_FLOAT_TYPE
2283
2284Lisp_Object 2251Lisp_Object
2285float_arith_driver (accum, argnum, code, nargs, args) 2252float_arith_driver (accum, argnum, code, nargs, args)
2286 double accum; 2253 double accum;
@@ -2344,7 +2311,7 @@ float_arith_driver (accum, argnum, code, nargs, args)
2344 2311
2345 return make_float (accum); 2312 return make_float (accum);
2346} 2313}
2347#endif /* LISP_FLOAT_TYPE */ 2314
2348 2315
2349DEFUN ("+", Fplus, Splus, 0, MANY, 0, 2316DEFUN ("+", Fplus, Splus, 0, MANY, 0,
2350 "Return sum of any number of arguments, which are numbers or markers.") 2317 "Return sum of any number of arguments, which are numbers or markers.")
@@ -2436,18 +2403,12 @@ Both X and Y must be numbers or markers.")
2436 Lisp_Object val; 2403 Lisp_Object val;
2437 EMACS_INT i1, i2; 2404 EMACS_INT i1, i2;
2438 2405
2439#ifdef LISP_FLOAT_TYPE
2440 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (x, 0); 2406 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (x, 0);
2441 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (y, 1); 2407 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (y, 1);
2442 2408
2443 if (FLOATP (x) || FLOATP (y)) 2409 if (FLOATP (x) || FLOATP (y))
2444 return fmod_float (x, y); 2410 return fmod_float (x, y);
2445 2411
2446#else /* not LISP_FLOAT_TYPE */
2447 CHECK_NUMBER_COERCE_MARKER (x, 0);
2448 CHECK_NUMBER_COERCE_MARKER (y, 1);
2449#endif /* not LISP_FLOAT_TYPE */
2450
2451 i1 = XINT (x); 2412 i1 = XINT (x);
2452 i2 = XINT (y); 2413 i2 = XINT (y);
2453 2414
@@ -2566,14 +2527,10 @@ Markers are converted to integers.")
2566 (number) 2527 (number)
2567 register Lisp_Object number; 2528 register Lisp_Object number;
2568{ 2529{
2569#ifdef LISP_FLOAT_TYPE
2570 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (number, 0); 2530 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (number, 0);
2571 2531
2572 if (FLOATP (number)) 2532 if (FLOATP (number))
2573 return (make_float (1.0 + XFLOAT_DATA (number))); 2533 return (make_float (1.0 + XFLOAT_DATA (number)));
2574#else
2575 CHECK_NUMBER_COERCE_MARKER (number, 0);
2576#endif /* LISP_FLOAT_TYPE */
2577 2534
2578 XSETINT (number, XINT (number) + 1); 2535 XSETINT (number, XINT (number) + 1);
2579 return number; 2536 return number;
@@ -2585,14 +2542,10 @@ Markers are converted to integers.")
2585 (number) 2542 (number)
2586 register Lisp_Object number; 2543 register Lisp_Object number;
2587{ 2544{
2588#ifdef LISP_FLOAT_TYPE
2589 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (number, 0); 2545 CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (number, 0);
2590 2546
2591 if (FLOATP (number)) 2547 if (FLOATP (number))
2592 return (make_float (-1.0 + XFLOAT_DATA (number))); 2548 return (make_float (-1.0 + XFLOAT_DATA (number)));
2593#else
2594 CHECK_NUMBER_COERCE_MARKER (number, 0);
2595#endif /* LISP_FLOAT_TYPE */
2596 2549
2597 XSETINT (number, XINT (number) - 1); 2550 XSETINT (number, XINT (number) - 1);
2598 return number; 2551 return number;
@@ -2660,11 +2613,9 @@ syms_of_data ()
2660 Qboundp = intern ("boundp"); 2613 Qboundp = intern ("boundp");
2661 Qfboundp = intern ("fboundp"); 2614 Qfboundp = intern ("fboundp");
2662 2615
2663#ifdef LISP_FLOAT_TYPE
2664 Qfloatp = intern ("floatp"); 2616 Qfloatp = intern ("floatp");
2665 Qnumberp = intern ("numberp"); 2617 Qnumberp = intern ("numberp");
2666 Qnumber_or_marker_p = intern ("number-or-marker-p"); 2618 Qnumber_or_marker_p = intern ("number-or-marker-p");
2667#endif /* LISP_FLOAT_TYPE */
2668 2619
2669 Qchar_table_p = intern ("char-table-p"); 2620 Qchar_table_p = intern ("char-table-p");
2670 Qvector_or_char_table_p = intern ("vector-or-char-table-p"); 2621 Qvector_or_char_table_p = intern ("vector-or-char-table-p");
@@ -2770,7 +2721,6 @@ syms_of_data ()
2770 Fput (Qtext_read_only, Qerror_message, 2721 Fput (Qtext_read_only, Qerror_message,
2771 build_string ("Text is read-only")); 2722 build_string ("Text is read-only"));
2772 2723
2773#ifdef LISP_FLOAT_TYPE
2774 Qrange_error = intern ("range-error"); 2724 Qrange_error = intern ("range-error");
2775 Qdomain_error = intern ("domain-error"); 2725 Qdomain_error = intern ("domain-error");
2776 Qsingularity_error = intern ("singularity-error"); 2726 Qsingularity_error = intern ("singularity-error");
@@ -2807,7 +2757,6 @@ syms_of_data ()
2807 staticpro (&Qsingularity_error); 2757 staticpro (&Qsingularity_error);
2808 staticpro (&Qoverflow_error); 2758 staticpro (&Qoverflow_error);
2809 staticpro (&Qunderflow_error); 2759 staticpro (&Qunderflow_error);
2810#endif /* LISP_FLOAT_TYPE */
2811 2760
2812 staticpro (&Qnil); 2761 staticpro (&Qnil);
2813 staticpro (&Qt); 2762 staticpro (&Qt);
@@ -2855,11 +2804,9 @@ syms_of_data ()
2855 staticpro (&Qmarkerp); 2804 staticpro (&Qmarkerp);
2856 staticpro (&Qbuffer_or_string_p); 2805 staticpro (&Qbuffer_or_string_p);
2857 staticpro (&Qinteger_or_marker_p); 2806 staticpro (&Qinteger_or_marker_p);
2858#ifdef LISP_FLOAT_TYPE
2859 staticpro (&Qfloatp); 2807 staticpro (&Qfloatp);
2860 staticpro (&Qnumberp); 2808 staticpro (&Qnumberp);
2861 staticpro (&Qnumber_or_marker_p); 2809 staticpro (&Qnumber_or_marker_p);
2862#endif /* LISP_FLOAT_TYPE */
2863 staticpro (&Qchar_table_p); 2810 staticpro (&Qchar_table_p);
2864 staticpro (&Qvector_or_char_table_p); 2811 staticpro (&Qvector_or_char_table_p);
2865 2812
@@ -2924,9 +2871,7 @@ A keyword symbol is a symbol whose name starts with a colon (`:').");
2924 defsubr (&Sinteger_or_marker_p); 2871 defsubr (&Sinteger_or_marker_p);
2925 defsubr (&Snumberp); 2872 defsubr (&Snumberp);
2926 defsubr (&Snumber_or_marker_p); 2873 defsubr (&Snumber_or_marker_p);
2927#ifdef LISP_FLOAT_TYPE
2928 defsubr (&Sfloatp); 2874 defsubr (&Sfloatp);
2929#endif /* LISP_FLOAT_TYPE */
2930 defsubr (&Snatnump); 2875 defsubr (&Snatnump);
2931 defsubr (&Ssymbolp); 2876 defsubr (&Ssymbolp);
2932 defsubr (&Skeywordp); 2877 defsubr (&Skeywordp);