comparison lib-src/mule/fakelisp.h @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents
children
comparison
equal deleted inserted replaced
69:804d1389bcd6 70:131b0175ea99
1 #ifndef _FAKELISP_H
2 #define _FAKELISP_H
3
4 #include <config.h>
5
6 /* Cancel substitutions made by config.h for Emacs. */
7 #undef open
8 #undef read
9 #undef write
10 #undef close
11
12 /* We used to test for `BSTRING' here, but only GCC and Emacs define
13 `BSTRING', as far as I know, and neither of them use this code. */
14 #if HAVE_STRING_H || STDC_HEADERS
15 #include <string.h>
16 #ifndef bcmp
17 #define bcmp(s1, s2, n) memcmp ((s1), (s2), (n))
18 #endif
19 #ifndef bcopy
20 #define bcopy(s, d, n) memcpy ((d), (s), (n))
21 #endif
22 #ifndef bzero
23 #define bzero(s, n) memset ((s), 0, (n))
24 #endif
25 #else
26 #include <strings.h>
27 #endif
28
29 typedef unsigned int Lisp_Object;
30
31 enum Lisp_Type {
32 Lisp_Int,
33 Lisp_Symbol,
34 Lisp_String,
35 Lisp_Vector
36 };
37
38 #ifndef VALBITS /* hir, 1994.12.19 */
39 #define VALBITS 24
40 #endif
41 #define VALMASK ((1 << VALBITS) - 1)
42
43 #define XTYPE(x) ((enum Lisp_Type)((x)>>VALBITS))
44
45 struct Lisp_Vector {
46 int size;
47 Lisp_Object *contents;
48 };
49
50 struct Lisp_String {
51 int size;
52 unsigned char *data;
53 };
54
55 struct Lisp_Symbol {
56 unsigned char *name;
57 Lisp_Object value;
58 };
59
60 #define Qnil (Lisp_Object)(Lisp_Symbol << VALBITS)
61 #define Qt (Lisp_Object)((Lisp_Symbol << VALBITS) | 1)
62
63 #define XFASTINT(x) (x)
64 #define XVECTOR(x) ((struct Lisp_Vector *)Lisp_Object_Table[(x)&VALMASK])
65 #define XSTRING(x) ((struct Lisp_String *)Lisp_Object_Table[(x)&VALMASK])
66 #define XSYMBOL(x) ((struct Lisp_Symbol *)Lisp_Object_Table[(x)&VALMASK])
67
68 extern void *Lisp_Object_Table[4096];
69
70 extern Lisp_Object make_vector(), make_string(), make_symbol();
71 extern Lisp_Object Fsymbol_value();
72
73 #define GLYPH unsigned int
74
75 #endif /* _FAKELISP_H */