comparison src/lread.c @ 9274:5c66d8b65a7c

(Fget_file_char, Fload, read1, oblookup, map_obarray, defsubr, defalias, defvar_int, defvar_bool, defvar_lisp, defvar_lisp_nopro, defvar_per_buffer): Use new accessor macros instead of calling XSET directly.
author Karl Heuer <kwzh@gnu.org>
date Tue, 04 Oct 1994 12:17:56 +0000
parents fe6b30db719d
children ed68c3822e4b
comparison
equal deleted inserted replaced
9273:129621997564 9274:5c66d8b65a7c
322 DEFUN ("get-file-char", Fget_file_char, Sget_file_char, 0, 0, 0, 322 DEFUN ("get-file-char", Fget_file_char, Sget_file_char, 0, 0, 0,
323 "Don't use this yourself.") 323 "Don't use this yourself.")
324 () 324 ()
325 { 325 {
326 register Lisp_Object val; 326 register Lisp_Object val;
327 XSET (val, Lisp_Int, getc (instream)); 327 XSETINT (val, getc (instream));
328 return val; 328 return val;
329 } 329 }
330 330
331 static void readevalloop (); 331 static void readevalloop ();
332 static Lisp_Object load_unwind (); 332 static Lisp_Object load_unwind ();
432 /* We may not be able to store STREAM itself as a Lisp_Object pointer 432 /* We may not be able to store STREAM itself as a Lisp_Object pointer
433 since that is guaranteed to work only for data that has been malloc'd. 433 since that is guaranteed to work only for data that has been malloc'd.
434 So malloc a full-size pointer, and record the address of that pointer. */ 434 So malloc a full-size pointer, and record the address of that pointer. */
435 ptr = (FILE **) xmalloc (sizeof (FILE *)); 435 ptr = (FILE **) xmalloc (sizeof (FILE *));
436 *ptr = stream; 436 *ptr = stream;
437 XSET (lispstream, Lisp_Internal_Stream, (EMACS_INT) ptr); 437 XSETINTERNAL_STREAM (lispstream, (EMACS_INT) ptr);
438 record_unwind_protect (load_unwind, lispstream); 438 record_unwind_protect (load_unwind, lispstream);
439 record_unwind_protect (load_descriptor_unwind, load_descriptor_list); 439 record_unwind_protect (load_descriptor_unwind, load_descriptor_list);
440 load_descriptor_list 440 load_descriptor_list
441 = Fcons (make_number (fileno (stream)), load_descriptor_list); 441 = Fcons (make_number (fileno (stream)), load_descriptor_list);
442 load_in_progress++; 442 load_in_progress++;
1127 1127
1128 case ')': 1128 case ')':
1129 case ']': 1129 case ']':
1130 { 1130 {
1131 register Lisp_Object val; 1131 register Lisp_Object val;
1132 XSET (val, Lisp_Internal, c); 1132 XSETINTERNAL (val, c);
1133 return val; 1133 return val;
1134 } 1134 }
1135 1135
1136 case '#': 1136 case '#':
1137 c = READCHAR; 1137 c = READCHAR;
1200 1200
1201 c = READCHAR; 1201 c = READCHAR;
1202 if (c < 0) return Fsignal (Qend_of_file, Qnil); 1202 if (c < 0) return Fsignal (Qend_of_file, Qnil);
1203 1203
1204 if (c == '\\') 1204 if (c == '\\')
1205 XSET (val, Lisp_Int, read_escape (readcharfun)); 1205 XSETINT (val, read_escape (readcharfun));
1206 else 1206 else
1207 XSET (val, Lisp_Int, c); 1207 XSETINT (val, c);
1208 1208
1209 return val; 1209 return val;
1210 } 1210 }
1211 1211
1212 case '\"': 1212 case '\"':
1275 1275
1276 if (! isdigit (next_char)) 1276 if (! isdigit (next_char))
1277 #endif 1277 #endif
1278 { 1278 {
1279 register Lisp_Object val; 1279 register Lisp_Object val;
1280 XSET (val, Lisp_Internal, c); 1280 XSETINTERNAL (val, c);
1281 return val; 1281 return val;
1282 } 1282 }
1283 1283
1284 /* Otherwise, we fall through! Note that the atom-reading loop 1284 /* Otherwise, we fall through! Note that the atom-reading loop
1285 below will now loop at least once, assuring that we will not 1285 below will now loop at least once, assuring that we will not
1352 { 1352 {
1353 #ifdef LISP_FLOAT_TYPE 1353 #ifdef LISP_FLOAT_TYPE
1354 if (p1[-1] == '.') 1354 if (p1[-1] == '.')
1355 p1[-1] = '\0'; 1355 p1[-1] = '\0';
1356 #endif 1356 #endif
1357 XSET (val, Lisp_Int, atoi (read_buffer)); 1357 XSETINT (val, atoi (read_buffer));
1358 return val; 1358 return val;
1359 } 1359 }
1360 } 1360 }
1361 #ifdef LISP_FLOAT_TYPE 1361 #ifdef LISP_FLOAT_TYPE
1362 if (isfloat_string (read_buffer)) 1362 if (isfloat_string (read_buffer))
1635 bucket = XVECTOR (obarray)->contents[hash]; 1635 bucket = XVECTOR (obarray)->contents[hash];
1636 if (XFASTINT (bucket) == 0) 1636 if (XFASTINT (bucket) == 0)
1637 ; 1637 ;
1638 else if (!SYMBOLP (bucket)) 1638 else if (!SYMBOLP (bucket))
1639 error ("Bad data in guts of obarray"); /* Like CADR error message */ 1639 error ("Bad data in guts of obarray"); /* Like CADR error message */
1640 else for (tail = bucket; ; XSET (tail, Lisp_Symbol, XSYMBOL (tail)->next)) 1640 else for (tail = bucket; ; XSETSYMBOL (tail, XSYMBOL (tail)->next))
1641 { 1641 {
1642 if (XSYMBOL (tail)->name->size == size && 1642 if (XSYMBOL (tail)->name->size == size &&
1643 !bcmp (XSYMBOL (tail)->name->data, ptr, size)) 1643 !bcmp (XSYMBOL (tail)->name->data, ptr, size))
1644 return tail; 1644 return tail;
1645 else if (XSYMBOL (tail)->next == 0) 1645 else if (XSYMBOL (tail)->next == 0)
1646 break; 1646 break;
1647 } 1647 }
1648 XSET (tem, Lisp_Int, hash); 1648 XSETINT (tem, hash);
1649 return tem; 1649 return tem;
1650 } 1650 }
1651 1651
1652 static int 1652 static int
1653 hash_string (ptr, len) 1653 hash_string (ptr, len)
1684 while (1) 1684 while (1)
1685 { 1685 {
1686 (*fn) (tail, arg); 1686 (*fn) (tail, arg);
1687 if (XSYMBOL (tail)->next == 0) 1687 if (XSYMBOL (tail)->next == 0)
1688 break; 1688 break;
1689 XSET (tail, Lisp_Symbol, XSYMBOL (tail)->next); 1689 XSETSYMBOL (tail, XSYMBOL (tail)->next);
1690 } 1690 }
1691 } 1691 }
1692 } 1692 }
1693 1693
1694 mapatoms_1 (sym, function) 1694 mapatoms_1 (sym, function)
1758 defsubr (sname) 1758 defsubr (sname)
1759 struct Lisp_Subr *sname; 1759 struct Lisp_Subr *sname;
1760 { 1760 {
1761 Lisp_Object sym; 1761 Lisp_Object sym;
1762 sym = intern (sname->symbol_name); 1762 sym = intern (sname->symbol_name);
1763 XSET (XSYMBOL (sym)->function, Lisp_Subr, sname); 1763 XSETSUBR (XSYMBOL (sym)->function, sname);
1764 } 1764 }
1765 1765
1766 #ifdef NOTDEF /* use fset in subr.el now */ 1766 #ifdef NOTDEF /* use fset in subr.el now */
1767 void 1767 void
1768 defalias (sname, string) 1768 defalias (sname, string)
1769 struct Lisp_Subr *sname; 1769 struct Lisp_Subr *sname;
1770 char *string; 1770 char *string;
1771 { 1771 {
1772 Lisp_Object sym; 1772 Lisp_Object sym;
1773 sym = intern (string); 1773 sym = intern (string);
1774 XSET (XSYMBOL (sym)->function, Lisp_Subr, sname); 1774 XSETSUBR (XSYMBOL (sym)->function, sname);
1775 } 1775 }
1776 #endif /* NOTDEF */ 1776 #endif /* NOTDEF */
1777 1777
1778 /* Define an "integer variable"; a symbol whose value is forwarded 1778 /* Define an "integer variable"; a symbol whose value is forwarded
1779 to a C variable of type int. Sample call: */ 1779 to a C variable of type int. Sample call: */
1784 char *namestring; 1784 char *namestring;
1785 int *address; 1785 int *address;
1786 { 1786 {
1787 Lisp_Object sym; 1787 Lisp_Object sym;
1788 sym = intern (namestring); 1788 sym = intern (namestring);
1789 XSET (XSYMBOL (sym)->value, Lisp_Intfwd, address); 1789 XSETINTFWD (XSYMBOL (sym)->value, address);
1790 } 1790 }
1791 1791
1792 /* Similar but define a variable whose value is T if address contains 1, 1792 /* Similar but define a variable whose value is T if address contains 1,
1793 NIL if address contains 0 */ 1793 NIL if address contains 0 */
1794 1794
1797 char *namestring; 1797 char *namestring;
1798 int *address; 1798 int *address;
1799 { 1799 {
1800 Lisp_Object sym; 1800 Lisp_Object sym;
1801 sym = intern (namestring); 1801 sym = intern (namestring);
1802 XSET (XSYMBOL (sym)->value, Lisp_Boolfwd, address); 1802 XSETBOOLFWD (XSYMBOL (sym)->value, address);
1803 } 1803 }
1804 1804
1805 /* Similar but define a variable whose value is the Lisp Object stored at address. */ 1805 /* Similar but define a variable whose value is the Lisp Object stored at address. */
1806 1806
1807 void 1807 void
1809 char *namestring; 1809 char *namestring;
1810 Lisp_Object *address; 1810 Lisp_Object *address;
1811 { 1811 {
1812 Lisp_Object sym; 1812 Lisp_Object sym;
1813 sym = intern (namestring); 1813 sym = intern (namestring);
1814 XSET (XSYMBOL (sym)->value, Lisp_Objfwd, address); 1814 XSETOBJFWD (XSYMBOL (sym)->value, address);
1815 staticpro (address); 1815 staticpro (address);
1816 } 1816 }
1817 1817
1818 /* Similar but don't request gc-marking of the C variable. 1818 /* Similar but don't request gc-marking of the C variable.
1819 Used when that variable will be gc-marked for some other reason, 1819 Used when that variable will be gc-marked for some other reason,
1824 char *namestring; 1824 char *namestring;
1825 Lisp_Object *address; 1825 Lisp_Object *address;
1826 { 1826 {
1827 Lisp_Object sym; 1827 Lisp_Object sym;
1828 sym = intern (namestring); 1828 sym = intern (namestring);
1829 XSET (XSYMBOL (sym)->value, Lisp_Objfwd, address); 1829 XSETOBJFWD (XSYMBOL (sym)->value, address);
1830 } 1830 }
1831 1831
1832 #ifndef standalone 1832 #ifndef standalone
1833 1833
1834 /* Similar but define a variable whose value is the Lisp Object stored in 1834 /* Similar but define a variable whose value is the Lisp Object stored in
1846 extern struct buffer buffer_local_symbols; 1846 extern struct buffer buffer_local_symbols;
1847 1847
1848 sym = intern (namestring); 1848 sym = intern (namestring);
1849 offset = (char *)address - (char *)current_buffer; 1849 offset = (char *)address - (char *)current_buffer;
1850 1850
1851 XSET (XSYMBOL (sym)->value, Lisp_Buffer_Objfwd, 1851 XSETBUFFER_OBJFWD (XSYMBOL (sym)->value,
1852 (Lisp_Object *) offset); 1852 (Lisp_Object *) offset);
1853 *(Lisp_Object *)(offset + (char *)&buffer_local_symbols) = sym; 1853 *(Lisp_Object *)(offset + (char *)&buffer_local_symbols) = sym;
1854 *(Lisp_Object *)(offset + (char *)&buffer_local_types) = type; 1854 *(Lisp_Object *)(offset + (char *)&buffer_local_types) = type;
1855 if (*(int *)(offset + (char *)&buffer_local_flags) == 0) 1855 if (*(int *)(offset + (char *)&buffer_local_flags) == 0)
1856 /* Did a DEFVAR_PER_BUFFER without initializing the corresponding 1856 /* Did a DEFVAR_PER_BUFFER without initializing the corresponding
1857 slot of buffer_local_flags */ 1857 slot of buffer_local_flags */