Commit | Line | Data |
---|---|---|
a98cef7e KN |
1 | /* Copyright (C) 2000 Free Software Foundation, Inc. |
2 | * | |
3 | * This program is free software; you can redistribute it and/or modify | |
4 | * it under the terms of the GNU General Public License as published by | |
5 | * the Free Software Foundation; either version 2, or (at your option) | |
6 | * any later version. | |
7 | * | |
8 | * This program is distributed in the hope that it will be useful, | |
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 | * GNU General Public License for more details. | |
12 | * | |
13 | * You should have received a copy of the GNU General Public License | |
14 | * along with this software; see the file COPYING. If not, write to | |
15 | * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, | |
16 | * Boston, MA 02111-1307 USA | |
17 | * | |
18 | * As a special exception, the Free Software Foundation gives permission | |
19 | * for additional uses of the text contained in its release of GUILE. | |
20 | * | |
21 | * The exception is that, if you link the GUILE library with other files | |
22 | * to produce an executable, this does not by itself cause the | |
23 | * resulting executable to be covered by the GNU General Public License. | |
24 | * Your use of that executable is in no way restricted on account of | |
25 | * linking the GUILE library code into it. | |
26 | * | |
27 | * This exception does not however invalidate any other reasons why | |
28 | * the executable file might be covered by the GNU General Public License. | |
29 | * | |
30 | * This exception applies only to the code released by the | |
31 | * Free Software Foundation under the name GUILE. If you copy | |
32 | * code from other Free Software Foundation releases into a copy of | |
33 | * GUILE, as the General Public License permits, the exception does | |
34 | * not apply to the code that you add in this way. To avoid misleading | |
35 | * anyone as to the status of such modified files, you must delete | |
36 | * this exception notice from them. | |
37 | * | |
38 | * If you write modifications of your own for GUILE, it is your choice | |
39 | * whether to permit this exception to apply to your modifications. | |
40 | * If you do not wish that, delete this exception notice. */ | |
41 | ||
42 | #ifndef VM_SNARF_H | |
43 | #define VM_SNARF_H | |
44 | ||
45 | #include "config.h" | |
46 | ||
47 | #define VM_LABEL(TAG) l_##TAG## | |
48 | #define VM_OPCODE(TAG) op_##TAG## | |
49 | ||
50 | #ifdef HAVE_LABELS_AS_VALUES | |
51 | #define VM_TAG(TAG) VM_LABEL(TAG): | |
52 | #define VM_ADDR(TAG) &&VM_LABEL(TAG) | |
53 | #else /* not HAVE_LABELS_AS_VALUES */ | |
54 | #define VM_TAG(TAG) case VM_OPCODE(TAG): | |
55 | #define VM_ADDR(TAG) NULL | |
56 | #endif /* not HAVE_LABELS_AS_VALUES */ | |
57 | ||
58 | #ifndef SCM_MAGIC_SNARFER | |
59 | ||
60 | /* | |
61 | * These are directly included in vm_engine.c | |
62 | */ | |
63 | #define SCM_DEFINE_INSTRUCTION(TAG,NAME,TYPE) VM_TAG(TAG) | |
64 | #define SCM_DEFINE_VM_FUNCTION(TAG,SNAME,NAME,NARGS,RESTP) VM_TAG(TAG) | |
65 | ||
66 | #else /* SCM_MAGIC_SNARFER */ | |
67 | #ifndef SCM_SNARF_OPCODE | |
4b482259 | 68 | #ifndef SCM_SNARF_LABEL |
a98cef7e KN |
69 | |
70 | /* | |
4b482259 | 71 | * These will go to *.inst |
a98cef7e KN |
72 | */ |
73 | #define SCM_DEFINE_INSTRUCTION(TAG,NAME,TYPE) \ | |
4b482259 | 74 | SCM_SNARF_INIT_START {VM_OPCODE(TAG), TYPE, NAME, SCM_BOOL_F, NULL, 0, 0}, |
a98cef7e | 75 | #define SCM_DEFINE_VM_FUNCTION(TAG,SNAME,NAME,NARGS,RESTP) \ |
4b482259 | 76 | SCM_SNARF_INIT_START {VM_OPCODE(TAG), INST_NONE, NAME, SCM_BOOL_F, SNAME, NARGS, RESTP}, |
a98cef7e | 77 | |
4b482259 KN |
78 | #else /* SCM_SNARF_LABEL */ |
79 | ||
80 | /* | |
81 | * These will go to *.label | |
82 | */ | |
83 | #define SCM_DEFINE_INSTRUCTION(TAG,NAME,TYPE) \ | |
84 | SCM_SNARF_INIT_START VM_ADDR(TAG), | |
85 | #define SCM_DEFINE_VM_FUNCTION(TAG,SNAME,NAME,NARGS,RESTP) \ | |
86 | SCM_SNARF_INIT_START VM_ADDR(TAG), | |
87 | ||
88 | #endif /* SCM_SNARF_LABEL */ | |
a98cef7e KN |
89 | #else /* SCM_SNARF_OPCODE */ |
90 | ||
91 | /* | |
4b482259 | 92 | * These will go to *.opcode |
a98cef7e | 93 | */ |
4b482259 KN |
94 | #define SCM_DEFINE_INSTRUCTION(TAG,NAME,TYPE) \ |
95 | SCM_SNARF_INIT_START VM_OPCODE(TAG), | |
96 | #define SCM_DEFINE_VM_FUNCTION(TAG,SNAME,NAME,NARGS,RESTP) \ | |
97 | SCM_SNARF_INIT_START VM_OPCODE(TAG), | |
a98cef7e KN |
98 | |
99 | #endif /* SCM_SNARF_OPCODE */ | |
100 | #endif /* SCM_MAGIC_SNARFER */ | |
101 | ||
102 | #endif /* not VM_SNARF_H */ |