Export <slot> from GOOPS
[bpt/guile.git] / libguile / vm-expand.h
CommitLineData
8f5cfc81 1/* Copyright (C) 2001 Free Software Foundation, Inc.
a98cef7e 2 *
560b9c25 3 * This library is free software; you can redistribute it and/or
53befeb7
NJ
4 * modify it under the terms of the GNU Lesser General Public License
5 * as published by the Free Software Foundation; either version 3 of
6 * the License, or (at your option) any later version.
a98cef7e 7 *
53befeb7
NJ
8 * This library is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
560b9c25
AW
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
a98cef7e 12 *
560b9c25
AW
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
53befeb7
NJ
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16 * 02110-1301 USA
560b9c25 17 */
a98cef7e 18
77c04abe 19#ifndef VM_LABEL
17e90c5e
KN
20#define VM_LABEL(tag) l_##tag
21#define VM_OPCODE(tag) scm_op_##tag
a98cef7e
KN
22
23#ifdef HAVE_LABELS_AS_VALUES
17e90c5e
KN
24#define VM_TAG(tag) VM_LABEL(tag):
25#define VM_ADDR(tag) &&VM_LABEL(tag)
a98cef7e 26#else /* not HAVE_LABELS_AS_VALUES */
17e90c5e
KN
27#define VM_TAG(tag) case VM_OPCODE(tag):
28#define VM_ADDR(tag) NULL
a98cef7e 29#endif /* not HAVE_LABELS_AS_VALUES */
77c04abe 30#endif /* VM_LABEL */
a98cef7e 31
17e90c5e 32#undef VM_DEFINE_FUNCTION
3616e9e9 33#undef VM_DEFINE_LOADER
f775e51b
AW
34#define VM_DEFINE_FUNCTION(code,tag,name,nargs) \
35 VM_DEFINE_INSTRUCTION(code,tag,name,0,nargs,1)
36#define VM_DEFINE_LOADER(code,tag,name) \
37 VM_DEFINE_INSTRUCTION(code,tag,name,-1,0,1)
38
39#undef VM_DEFINE_INSTRUCTION
a98cef7e 40/*
53e28ed9 41 * These will go to scm_instruction_table in instructions.c
a98cef7e 42 */
f775e51b
AW
43#ifdef VM_INSTRUCTION_TO_TABLE
44#define VM_DEFINE_INSTRUCTION(code_,tag_,name_,len_,npop_,npush_) \
aeeff258 45 table[VM_OPCODE (tag_)].opcode = code_; \
f775e51b
AW
46 table[VM_OPCODE (tag_)].name = name_; \
47 table[VM_OPCODE (tag_)].len = len_; \
48 table[VM_OPCODE (tag_)].npop = npop_; \
49 table[VM_OPCODE (tag_)].npush = npush_;
4b482259 50
77c04abe
KN
51#else
52#ifdef VM_INSTRUCTION_TO_LABEL
4b482259 53/*
77c04abe 54 * These will go to jump_table in vm_engine.c
4b482259 55 */
aeeff258 56#define VM_DEFINE_INSTRUCTION(code,tag,name,len,npop,npush) jump_table[code] = VM_ADDR (tag);
a98cef7e 57
77c04abe
KN
58#else
59#ifdef VM_INSTRUCTION_TO_OPCODE
a98cef7e 60/*
53e28ed9 61 * These will go to scm_opcode in instructions.h
a98cef7e 62 */
53e28ed9 63#define VM_DEFINE_INSTRUCTION(code,tag,name,len,npop,npush) VM_OPCODE (tag) = code,
a98cef7e 64
77c04abe
KN
65#else /* Otherwise */
66/*
67 * These are directly included in vm_engine.c
68 */
53e28ed9 69#define VM_DEFINE_INSTRUCTION(code,tag,name,len,npop,npush) VM_TAG (tag)
a98cef7e 70
77c04abe
KN
71#endif /* VM_INSTRUCTION_TO_OPCODE */
72#endif /* VM_INSTRUCTION_TO_LABEL */
73#endif /* VM_INSTRUCTION_TO_TABLE */
17e90c5e
KN
74
75/*
76 Local Variables:
77 c-file-style: "gnu"
78 End:
79*/