Mercurial > hg > xemacs-beta
comparison src/lisp.h @ 14:9ee227acff29 r19-15b90
Import from CVS: tag r19-15b90
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:48:42 +0200 |
parents | ac2d302a0011 |
children | 0293115a14e9 |
comparison
equal
deleted
inserted
replaced
13:13c6d0aaafe5 | 14:9ee227acff29 |
---|---|
167 to a malloced array of TYPE objects (or possibly a NULL pointer, | 167 to a malloced array of TYPE objects (or possibly a NULL pointer, |
168 if SIZEVAR is 0), with the total size stored in SIZEVAR. This | 168 if SIZEVAR is 0), with the total size stored in SIZEVAR. This |
169 macro will realloc BASEVAR as necessary so that it can hold at | 169 macro will realloc BASEVAR as necessary so that it can hold at |
170 least NEEDED_SIZE objects. The reallocing is done by doubling, | 170 least NEEDED_SIZE objects. The reallocing is done by doubling, |
171 which ensures constant amortized time per element. */ | 171 which ensures constant amortized time per element. */ |
172 #define DO_REALLOC(basevar, sizevar, needed_size, type) do \ | 172 #define DO_REALLOC(basevar, sizevar, needed_size, type) do \ |
173 { \ | 173 { \ |
174 /* Avoid side-effectualness. */ \ | 174 /* Avoid side-effectualness. */ \ |
175 /* Dammit! Macros suffer from dynamic scope! */ \ | 175 /* Dammit! Macros suffer from dynamic scope! */ \ |
176 /* We demand inline functions! */ \ | 176 /* We demand inline functions! */ \ |
177 int do_realloc_needed_size = (needed_size); \ | 177 int do_realloc_needed_size = (needed_size); \ |
181 if (newsize < 32) \ | 181 if (newsize < 32) \ |
182 newsize = 32; \ | 182 newsize = 32; \ |
183 (sizevar) = newsize; \ | 183 (sizevar) = newsize; \ |
184 } \ | 184 } \ |
185 if (newsize) \ | 185 if (newsize) \ |
186 (basevar) = (type *) xrealloc (basevar, (newsize)*sizeof(type)); \ | 186 (basevar) = (type *) xrealloc (basevar, \ |
187 (newsize)*sizeof(type)); \ | |
187 } while (0) | 188 } while (0) |
188 | 189 |
189 #ifdef ERROR_CHECK_MALLOC | 190 #ifdef ERROR_CHECK_MALLOC |
190 #define xfree(lvalue) do \ | 191 #define xfree(lvalue) do \ |
191 { \ | 192 { \ |
253 #define ALIGN_PTR(ptr, unit) \ | 254 #define ALIGN_PTR(ptr, unit) \ |
254 ((void *) ALIGN_SIZE ((long) (ptr), unit)) | 255 ((void *) ALIGN_SIZE ((long) (ptr), unit)) |
255 | 256 |
256 #ifdef QUANTIFY | 257 #ifdef QUANTIFY |
257 #include "quantify.h" | 258 #include "quantify.h" |
258 #define QUANTIFY_START_RECORDING \ | 259 #define QUANTIFY_START_RECORDING \ |
259 do { quantify_start_recording_data (); } while (0) | 260 do { quantify_start_recording_data (); } while (0) |
260 #define QUANTIFY_STOP_RECORDING \ | 261 #define QUANTIFY_STOP_RECORDING \ |
261 do { quantify_stop_recording_data (); } while (0) | 262 do { quantify_stop_recording_data (); } while (0) |
262 #else /* !QUANTIFY */ | 263 #else /* !QUANTIFY */ |
263 #define QUANTIFY_START_RECORDING | 264 #define QUANTIFY_START_RECORDING |
264 #define QUANTIFY_STOP_RECORDING | 265 #define QUANTIFY_STOP_RECORDING |
265 #endif /* !QUANTIFY */ | 266 #endif /* !QUANTIFY */ |
266 | |
267 | 267 |
268 #ifndef DO_NOTHING | 268 #ifndef DO_NOTHING |
269 #define DO_NOTHING do {} while (0) | 269 #define DO_NOTHING do {} while (0) |
270 #endif | 270 #endif |
271 | 271 |
396 | 396 |
397 typedef unsigned char Extbyte; | 397 typedef unsigned char Extbyte; |
398 | 398 |
399 /* To the user, a buffer is made up of characters, declared as follows. | 399 /* To the user, a buffer is made up of characters, declared as follows. |
400 In the non-Mule world, characters and Bufbytes are equivalent. | 400 In the non-Mule world, characters and Bufbytes are equivalent. |
401 In the Mule world, a characters requires (typically) 1 to 4 | 401 In the Mule world, a character requires (typically) 1 to 4 |
402 Bufbytes for its representation in a buffer. */ | 402 Bufbytes for its representation in a buffer. */ |
403 | 403 |
404 typedef int Emchar; | 404 typedef int Emchar; |
405 | 405 |
406 /* Different ways of referring to a position in a buffer. We use | 406 /* Different ways of referring to a position in a buffer. We use |
850 | 850 |
851 # define bytecount_to_charcount(ptr, len) (len) | 851 # define bytecount_to_charcount(ptr, len) (len) |
852 # define charcount_to_bytecount(ptr, len) (len) | 852 # define charcount_to_bytecount(ptr, len) (len) |
853 | 853 |
854 #define string_length(s) ((s)->_size) | 854 #define string_length(s) ((s)->_size) |
855 #define XSTRING_length(s) string_length (XSTRING (s)) | 855 #define XSTRING_LENGTH(s) string_length (XSTRING (s)) |
856 #define string_data(s) ((s)->_data + 0) | 856 #define string_data(s) ((s)->_data + 0) |
857 #define XSTRING_data(s) string_data (XSTRING (s)) | 857 #define XSTRING_DATA(s) string_data (XSTRING (s)) |
858 #define string_byte(s, i) ((s)->_data[i] + 0) | 858 #define string_byte(s, i) ((s)->_data[i] + 0) |
859 #define XSTRING_byte(s, i) string_byte (XSTRING (s), i) | 859 #define XSTRING_BYTE(s, i) string_byte (XSTRING (s), i) |
860 #define string_byte_addr(s, i) (&((s)->_data[i])) | 860 #define string_byte_addr(s, i) (&((s)->_data[i])) |
861 #define set_string_length(s, len) do { (s)->_size = (len); } while (0) | 861 #define set_string_length(s, len) do { (s)->_size = (len); } while (0) |
862 #define set_string_data(s, ptr) do { (s)->_data = (ptr); } while (0) | 862 #define set_string_data(s, ptr) do { (s)->_data = (ptr); } while (0) |
863 #define set_string_byte(s, i, c) do { (s)->_data[i] = (c); } while (0) | 863 #define set_string_byte(s, i, c) do { (s)->_data[i] = (c); } while (0) |
864 | 864 |
911 #define vector_next(v) ((v)->contents[(v)->size]) | 911 #define vector_next(v) ((v)->contents[(v)->size]) |
912 | 912 |
913 /*********** bit vector ***********/ | 913 /*********** bit vector ***********/ |
914 | 914 |
915 #if (LONGBITS < 16) | 915 #if (LONGBITS < 16) |
916 What the hell?! | 916 #error What the hell?! |
917 #elif (LONGBITS < 32) | 917 #elif (LONGBITS < 32) |
918 # define LONGBITS_LOG2 4 | 918 # define LONGBITS_LOG2 4 |
919 # define LONGBITS_POWER_OF_2 16 | 919 # define LONGBITS_POWER_OF_2 16 |
920 #elif (LONGBITS < 64) | 920 #elif (LONGBITS < 64) |
921 # define LONGBITS_LOG2 5 | 921 # define LONGBITS_LOG2 5 |
1636 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ | 1636 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ |
1637 gcprolist = &gcpro2; } | 1637 gcprolist = &gcpro2; } |
1638 | 1638 |
1639 #define GCPRO3(varname1, varname2, varname3) \ | 1639 #define GCPRO3(varname1, varname2, varname3) \ |
1640 {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \ | 1640 {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \ |
1641 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ | 1641 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ |
1642 gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \ | 1642 gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \ |
1643 gcprolist = &gcpro3; } | 1643 gcprolist = &gcpro3; } |
1644 | 1644 |
1645 #define GCPRO4(varname1, varname2, varname3, varname4) \ | 1645 #define GCPRO4(varname1, varname2, varname3, varname4) \ |
1646 {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \ | 1646 {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \ |
1647 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ | 1647 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ |
1648 gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \ | 1648 gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \ |
1649 gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \ | 1649 gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \ |
1650 gcprolist = &gcpro4; } | 1650 gcprolist = &gcpro4; } |
1651 | 1651 |
1652 #define GCPRO5(varname1, varname2, varname3, varname4, varname5) \ | 1652 #define GCPRO5(varname1, varname2, varname3, varname4, varname5) \ |
1653 {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \ | 1653 {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \ |
1654 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ | 1654 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ |
1655 gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \ | 1655 gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \ |
1656 gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \ | 1656 gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \ |
1657 gcpro5.next = &gcpro4; gcpro5.var = &varname5; gcpro5.nvars = 1; \ | 1657 gcpro5.next = &gcpro4; gcpro5.var = &varname5; gcpro5.nvars = 1; \ |
1658 gcprolist = &gcpro5; } | 1658 gcprolist = &gcpro5; } |
1659 | 1659 |
1660 #define UNGCPRO (gcprolist = gcpro1.next) | 1660 #define UNGCPRO (gcprolist = gcpro1.next) |
1661 | 1661 |
1662 #define NGCPRO1(varname) \ | 1662 #define NGCPRO1(varname) \ |
1663 {ngcpro1.next = gcprolist; ngcpro1.var = &varname; ngcpro1.nvars = 1; \ | 1663 {ngcpro1.next = gcprolist; ngcpro1.var = &varname; ngcpro1.nvars = 1; \ |
1664 gcprolist = &ngcpro1; } | 1664 gcprolist = &ngcpro1; } |
1665 | 1665 |
1666 #define NGCPRO2(varname1, varname2) \ | 1666 #define NGCPRO2(varname1, varname2) \ |
1667 {ngcpro1.next = gcprolist; ngcpro1.var = &varname1; ngcpro1.nvars = 1; \ | 1667 {ngcpro1.next = gcprolist; ngcpro1.var = &varname1; ngcpro1.nvars = 1; \ |
1668 ngcpro2.next = &ngcpro1; ngcpro2.var = &varname2; ngcpro2.nvars = 1; \ | 1668 ngcpro2.next = &ngcpro1; ngcpro2.var = &varname2; ngcpro2.nvars = 1; \ |
1669 gcprolist = &ngcpro2; } | 1669 gcprolist = &ngcpro2; } |
1670 | 1670 |
1671 #define NGCPRO3(varname1, varname2, varname3) \ | 1671 #define NGCPRO3(varname1, varname2, varname3) \ |
1672 {ngcpro1.next = gcprolist; ngcpro1.var = &varname1; ngcpro1.nvars = 1; \ | 1672 {ngcpro1.next = gcprolist; ngcpro1.var = &varname1; ngcpro1.nvars = 1; \ |
1673 ngcpro2.next = &ngcpro1; ngcpro2.var = &varname2; ngcpro2.nvars = 1; \ | 1673 ngcpro2.next = &ngcpro1; ngcpro2.var = &varname2; ngcpro2.nvars = 1; \ |
1674 ngcpro3.next = &ngcpro2; ngcpro3.var = &varname3; ngcpro3.nvars = 1; \ | 1674 ngcpro3.next = &ngcpro2; ngcpro3.var = &varname3; ngcpro3.nvars = 1; \ |
1675 gcprolist = &ngcpro3; } | 1675 gcprolist = &ngcpro3; } |
1676 | 1676 |
1677 #define NGCPRO4(varname1, varname2, varname3, varname4) \ | 1677 #define NGCPRO4(varname1, varname2, varname3, varname4) \ |
1678 {ngcpro1.next = gcprolist; ngcpro1.var = &varname1; ngcpro1.nvars = 1; \ | 1678 {ngcpro1.next = gcprolist; ngcpro1.var = &varname1; ngcpro1.nvars = 1; \ |
1679 ngcpro2.next = &ngcpro1; ngcpro2.var = &varname2; ngcpro2.nvars = 1; \ | 1679 ngcpro2.next = &ngcpro1; ngcpro2.var = &varname2; ngcpro2.nvars = 1; \ |
1680 ngcpro3.next = &ngcpro2; ngcpro3.var = &varname3; ngcpro3.nvars = 1; \ | 1680 ngcpro3.next = &ngcpro2; ngcpro3.var = &varname3; ngcpro3.nvars = 1; \ |
1681 ngcpro4.next = &ngcpro3; ngcpro4.var = &varname4; ngcpro4.nvars = 1; \ | 1681 ngcpro4.next = &ngcpro3; ngcpro4.var = &varname4; ngcpro4.nvars = 1; \ |
1682 gcprolist = &ngcpro4; } | 1682 gcprolist = &ngcpro4; } |
1683 | 1683 |
1684 #define NGCPRO5(varname1, varname2, varname3, varname4, varname5) \ | 1684 #define NGCPRO5(varname1, varname2, varname3, varname4, varname5) \ |
1685 {ngcpro1.next = gcprolist; ngcpro1.var = &varname1; ngcpro1.nvars = 1; \ | 1685 {ngcpro1.next = gcprolist; ngcpro1.var = &varname1; ngcpro1.nvars = 1; \ |
1686 ngcpro2.next = &ngcpro1; ngcpro2.var = &varname2; ngcpro2.nvars = 1; \ | 1686 ngcpro2.next = &ngcpro1; ngcpro2.var = &varname2; ngcpro2.nvars = 1; \ |
1687 ngcpro3.next = &ngcpro2; ngcpro3.var = &varname3; ngcpro3.nvars = 1; \ | 1687 ngcpro3.next = &ngcpro2; ngcpro3.var = &varname3; ngcpro3.nvars = 1; \ |
1688 ngcpro4.next = &ngcpro3; ngcpro4.var = &varname4; ngcpro4.nvars = 1; \ | 1688 ngcpro4.next = &ngcpro3; ngcpro4.var = &varname4; ngcpro4.nvars = 1; \ |
1689 ngcpro5.next = &ngcpro4; ngcpro5.var = &varname5; ngcpro5.nvars = 1; \ | 1689 ngcpro5.next = &ngcpro4; ngcpro5.var = &varname5; ngcpro5.nvars = 1; \ |
1690 gcprolist = &ngcpro5; } | 1690 gcprolist = &ngcpro5; } |
1691 | 1691 |
1692 #define NUNGCPRO (gcprolist = ngcpro1.next) | 1692 #define NUNGCPRO (gcprolist = ngcpro1.next) |
1693 | 1693 |
1694 #define NNGCPRO1(varname) \ | 1694 #define NNGCPRO1(varname) \ |