Mercurial > emacs
comparison src/data.c @ 9263:cda13734e32c
(make_number, Fsymbol_name, do_symval_forwarding, swap_in_symval_forwarding,
find_symbol_value, Fset, arith_driver, Frem, Fmod, Fash, Flsh): Use new
accessor macros instead of calling XSET directly.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Tue, 04 Oct 1994 12:01:46 +0000 |
parents | 3db4151c3d00 |
children | e6daff3e246f |
comparison
equal
deleted
inserted
replaced
9262:582534b6e763 | 9263:cda13734e32c |
---|---|
132 Lisp_Object | 132 Lisp_Object |
133 make_number (num) | 133 make_number (num) |
134 int num; | 134 int num; |
135 { | 135 { |
136 register Lisp_Object val; | 136 register Lisp_Object val; |
137 XSET (val, Lisp_Int, num); | 137 XSETINT (val, num); |
138 return val; | 138 return val; |
139 } | 139 } |
140 | 140 |
141 /* On some machines, XINT needs a temporary location. | 141 /* On some machines, XINT needs a temporary location. |
142 Here it is, in case it is needed. */ | 142 Here it is, in case it is needed. */ |
535 register Lisp_Object sym; | 535 register Lisp_Object sym; |
536 { | 536 { |
537 register Lisp_Object name; | 537 register Lisp_Object name; |
538 | 538 |
539 CHECK_SYMBOL (sym, 0); | 539 CHECK_SYMBOL (sym, 0); |
540 XSET (name, Lisp_String, XSYMBOL (sym)->name); | 540 XSETSTRING (name, XSYMBOL (sym)->name); |
541 return name; | 541 return name; |
542 } | 542 } |
543 | 543 |
544 DEFUN ("fset", Ffset, Sfset, 2, 2, 0, | 544 DEFUN ("fset", Ffset, Sfset, 2, 2, 0, |
545 "Set SYMBOL's function definition to NEWVAL, and return NEWVAL.") | 545 "Set SYMBOL's function definition to NEWVAL, and return NEWVAL.") |
634 #else | 634 #else |
635 switch (XTYPE (valcontents)) | 635 switch (XTYPE (valcontents)) |
636 #endif | 636 #endif |
637 { | 637 { |
638 case Lisp_Intfwd: | 638 case Lisp_Intfwd: |
639 XSET (val, Lisp_Int, *XINTPTR (valcontents)); | 639 XSETINT (val, *XINTPTR (valcontents)); |
640 return val; | 640 return val; |
641 | 641 |
642 case Lisp_Boolfwd: | 642 case Lisp_Boolfwd: |
643 if (*XINTPTR (valcontents)) | 643 if (*XINTPTR (valcontents)) |
644 return Qt; | 644 return Qt; |
741 Fsetcdr (tem1, do_symval_forwarding (XCONS (valcontents)->car)); | 741 Fsetcdr (tem1, do_symval_forwarding (XCONS (valcontents)->car)); |
742 tem1 = assq_no_quit (sym, current_buffer->local_var_alist); | 742 tem1 = assq_no_quit (sym, current_buffer->local_var_alist); |
743 if (NILP (tem1)) | 743 if (NILP (tem1)) |
744 tem1 = XCONS (XCONS (valcontents)->cdr)->cdr; | 744 tem1 = XCONS (XCONS (valcontents)->cdr)->cdr; |
745 XCONS (XCONS (XCONS (valcontents)->cdr)->cdr)->car = tem1; | 745 XCONS (XCONS (XCONS (valcontents)->cdr)->cdr)->car = tem1; |
746 XSET (XCONS (XCONS (valcontents)->cdr)->car, Lisp_Buffer, current_buffer); | 746 XSETBUFFER (XCONS (XCONS (valcontents)->cdr)->car, current_buffer); |
747 store_symval_forwarding (sym, XCONS (valcontents)->car, Fcdr (tem1)); | 747 store_symval_forwarding (sym, XCONS (valcontents)->car, Fcdr (tem1)); |
748 } | 748 } |
749 return XCONS (valcontents)->car; | 749 return XCONS (valcontents)->car; |
750 } | 750 } |
751 | 751 |
775 case Lisp_Some_Buffer_Local_Value: | 775 case Lisp_Some_Buffer_Local_Value: |
776 valcontents = swap_in_symval_forwarding (sym, valcontents); | 776 valcontents = swap_in_symval_forwarding (sym, valcontents); |
777 goto retry; | 777 goto retry; |
778 | 778 |
779 case Lisp_Intfwd: | 779 case Lisp_Intfwd: |
780 XSET (val, Lisp_Int, *XINTPTR (valcontents)); | 780 XSETINT (val, *XINTPTR (valcontents)); |
781 return val; | 781 return val; |
782 | 782 |
783 case Lisp_Boolfwd: | 783 case Lisp_Boolfwd: |
784 if (*XINTPTR (valcontents)) | 784 if (*XINTPTR (valcontents)) |
785 return Qt; | 785 return Qt; |
908 } | 908 } |
909 /* Cache the new buffer's assoc in CURRENT-ALIST-ELEMENT. */ | 909 /* Cache the new buffer's assoc in CURRENT-ALIST-ELEMENT. */ |
910 XCONS (XCONS (XCONS (valcontents)->cdr)->cdr)->car = tem1; | 910 XCONS (XCONS (XCONS (valcontents)->cdr)->cdr)->car = tem1; |
911 | 911 |
912 /* Set BUFFER, now that CURRENT-ALIST-ELEMENT is accurate. */ | 912 /* Set BUFFER, now that CURRENT-ALIST-ELEMENT is accurate. */ |
913 XSET (XCONS (XCONS (valcontents)->cdr)->car, | 913 XSETBUFFER (XCONS (XCONS (valcontents)->cdr)->car, current_buffer); |
914 Lisp_Buffer, current_buffer); | |
915 } | 914 } |
916 valcontents = XCONS (valcontents)->car; | 915 valcontents = XCONS (valcontents)->car; |
917 } | 916 } |
918 | 917 |
919 /* If storing void (making the symbol void), forward only through | 918 /* If storing void (making the symbol void), forward only through |
1676 case Amax: if (!argnum || next > accum) accum = next; break; | 1675 case Amax: if (!argnum || next > accum) accum = next; break; |
1677 case Amin: if (!argnum || next < accum) accum = next; break; | 1676 case Amin: if (!argnum || next < accum) accum = next; break; |
1678 } | 1677 } |
1679 } | 1678 } |
1680 | 1679 |
1681 XSET (val, Lisp_Int, accum); | 1680 XSETINT (val, accum); |
1682 return val; | 1681 return val; |
1683 } | 1682 } |
1684 | 1683 |
1685 #ifdef LISP_FLOAT_TYPE | 1684 #ifdef LISP_FLOAT_TYPE |
1686 | 1685 |
1809 CHECK_NUMBER_COERCE_MARKER (num2, 1); | 1808 CHECK_NUMBER_COERCE_MARKER (num2, 1); |
1810 | 1809 |
1811 if (XFASTINT (num2) == 0) | 1810 if (XFASTINT (num2) == 0) |
1812 Fsignal (Qarith_error, Qnil); | 1811 Fsignal (Qarith_error, Qnil); |
1813 | 1812 |
1814 XSET (val, Lisp_Int, XINT (num1) % XINT (num2)); | 1813 XSETINT (val, XINT (num1) % XINT (num2)); |
1815 return val; | 1814 return val; |
1816 } | 1815 } |
1817 | 1816 |
1818 #ifndef HAVE_FMOD | 1817 #ifndef HAVE_FMOD |
1819 double | 1818 double |
1872 | 1871 |
1873 /* If the "remainder" comes out with the wrong sign, fix it. */ | 1872 /* If the "remainder" comes out with the wrong sign, fix it. */ |
1874 if ((i1 < 0) != (i2 < 0)) | 1873 if ((i1 < 0) != (i2 < 0)) |
1875 i1 += i2; | 1874 i1 += i2; |
1876 | 1875 |
1877 XSET (val, Lisp_Int, i1); | 1876 XSETINT (val, i1); |
1878 return val; | 1877 return val; |
1879 } | 1878 } |
1880 | 1879 |
1881 DEFUN ("max", Fmax, Smax, 1, MANY, 0, | 1880 DEFUN ("max", Fmax, Smax, 1, MANY, 0, |
1882 "Return largest of all the arguments (which must be numbers or markers).\n\ | 1881 "Return largest of all the arguments (which must be numbers or markers).\n\ |
1939 | 1938 |
1940 CHECK_NUMBER (num1, 0); | 1939 CHECK_NUMBER (num1, 0); |
1941 CHECK_NUMBER (num2, 1); | 1940 CHECK_NUMBER (num2, 1); |
1942 | 1941 |
1943 if (XINT (num2) > 0) | 1942 if (XINT (num2) > 0) |
1944 XSET (val, Lisp_Int, XINT (num1) << XFASTINT (num2)); | 1943 XSETINT (val, XINT (num1) << XFASTINT (num2)); |
1945 else | 1944 else |
1946 XSET (val, Lisp_Int, XINT (num1) >> -XINT (num2)); | 1945 XSETINT (val, XINT (num1) >> -XINT (num2)); |
1947 return val; | 1946 return val; |
1948 } | 1947 } |
1949 | 1948 |
1950 DEFUN ("lsh", Flsh, Slsh, 2, 2, 0, | 1949 DEFUN ("lsh", Flsh, Slsh, 2, 2, 0, |
1951 "Return VALUE with its bits shifted left by COUNT.\n\ | 1950 "Return VALUE with its bits shifted left by COUNT.\n\ |
1958 | 1957 |
1959 CHECK_NUMBER (num1, 0); | 1958 CHECK_NUMBER (num1, 0); |
1960 CHECK_NUMBER (num2, 1); | 1959 CHECK_NUMBER (num2, 1); |
1961 | 1960 |
1962 if (XINT (num2) > 0) | 1961 if (XINT (num2) > 0) |
1963 XSET (val, Lisp_Int, (unsigned) XFASTINT (num1) << XFASTINT (num2)); | 1962 XSETINT (val, (unsigned) XFASTINT (num1) << XFASTINT (num2)); |
1964 else | 1963 else |
1965 XSET (val, Lisp_Int, (unsigned) XFASTINT (num1) >> -XINT (num2)); | 1964 XSETINT (val, (unsigned) XFASTINT (num1) >> -XINT (num2)); |
1966 return val; | 1965 return val; |
1967 } | 1966 } |
1968 | 1967 |
1969 DEFUN ("1+", Fadd1, Sadd1, 1, 1, 0, | 1968 DEFUN ("1+", Fadd1, Sadd1, 1, 1, 0, |
1970 "Return NUMBER plus one. NUMBER may be a number or a marker.\n\ | 1969 "Return NUMBER plus one. NUMBER may be a number or a marker.\n\ |