Commit | Line | Data |
---|---|---|
d7794a9d | 1 | /* Copyright (C) 2001, 2009, 2010, 2013 Free Software Foundation, Inc. |
17e90c5e | 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. | |
17e90c5e | 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. | |
17e90c5e | 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 | */ |
17e90c5e | 18 | |
8f5cfc81 KN |
19 | #ifndef _SCM_PROGRAMS_H_ |
20 | #define _SCM_PROGRAMS_H_ | |
17e90c5e KN |
21 | |
22 | #include <libguile.h> | |
53e28ed9 | 23 | #include <libguile/objcodes.h> |
17e90c5e KN |
24 | |
25 | /* | |
26 | * Programs | |
27 | */ | |
28 | ||
ba20f78a | 29 | #define SCM_F_PROGRAM_IS_BOOT 0x100 |
1d1cae0e AW |
30 | #define SCM_F_PROGRAM_IS_PRIMITIVE 0x200 |
31 | #define SCM_F_PROGRAM_IS_PRIMITIVE_GENERIC 0x400 | |
32 | #define SCM_F_PROGRAM_IS_CONTINUATION 0x800 | |
2150e9a8 | 33 | #define SCM_F_PROGRAM_IS_PARTIAL_CONTINUATION 0x1000 |
17e90c5e | 34 | |
2fb924f6 AW |
35 | #define SCM_PROGRAM_P(x) (!SCM_IMP (x) && SCM_TYP7(x) == scm_tc7_program) |
36 | #define SCM_PROGRAM_OBJCODE(x) (SCM_CELL_OBJECT_1 (x)) | |
37 | #define SCM_PROGRAM_OBJTABLE(x) (SCM_CELL_OBJECT_2 (x)) | |
6f16379e AW |
38 | #define SCM_PROGRAM_FREE_VARIABLES(x) (SCM_CELL_OBJECT_LOC (x, 3)) |
39 | #define SCM_PROGRAM_FREE_VARIABLE_REF(x,i) (SCM_PROGRAM_FREE_VARIABLES (x)[i]) | |
40 | #define SCM_PROGRAM_FREE_VARIABLE_SET(x,i,v) (SCM_PROGRAM_FREE_VARIABLES (x)[i]=(v)) | |
41 | #define SCM_PROGRAM_NUM_FREE_VARIABLES(x) (SCM_CELL_WORD_0 (x) >> 16) | |
53e28ed9 | 42 | #define SCM_PROGRAM_DATA(x) (SCM_OBJCODE_DATA (SCM_PROGRAM_OBJCODE (x))) |
17e90c5e | 43 | #define SCM_VALIDATE_PROGRAM(p,x) SCM_MAKE_VALIDATE (p, x, PROGRAM_P) |
2fb924f6 | 44 | #define SCM_PROGRAM_IS_BOOT(x) (SCM_CELL_WORD_0 (x) & SCM_F_PROGRAM_IS_BOOT) |
cc7005bc | 45 | #define SCM_PROGRAM_IS_PRIMITIVE(x) (SCM_CELL_WORD_0 (x) & SCM_F_PROGRAM_IS_PRIMITIVE) |
f318aa1e | 46 | #define SCM_PROGRAM_IS_PRIMITIVE_GENERIC(x) (SCM_CELL_WORD_0 (x) & SCM_F_PROGRAM_IS_PRIMITIVE_GENERIC) |
1d1cae0e | 47 | #define SCM_PROGRAM_IS_CONTINUATION(x) (SCM_CELL_WORD_0 (x) & SCM_F_PROGRAM_IS_CONTINUATION) |
2150e9a8 | 48 | #define SCM_PROGRAM_IS_PARTIAL_CONTINUATION(x) (SCM_CELL_WORD_0 (x) & SCM_F_PROGRAM_IS_PARTIAL_CONTINUATION) |
17e90c5e | 49 | |
57ab0671 | 50 | SCM_API SCM scm_make_program (SCM objcode, SCM objtable, SCM free_variables); |
17e90c5e | 51 | |
560b9c25 AW |
52 | SCM_API SCM scm_program_p (SCM obj); |
53 | SCM_API SCM scm_program_base (SCM program); | |
560b9c25 AW |
54 | SCM_API SCM scm_program_meta (SCM program); |
55 | SCM_API SCM scm_program_bindings (SCM program); | |
56 | SCM_API SCM scm_program_sources (SCM program); | |
b262b74b | 57 | SCM_API SCM scm_program_source (SCM program, SCM ip, SCM sources); |
6c6a4439 | 58 | SCM_API SCM scm_program_arities (SCM program); |
560b9c25 AW |
59 | SCM_API SCM scm_program_objects (SCM program); |
60 | SCM_API SCM scm_program_module (SCM program); | |
6f16379e AW |
61 | SCM_API SCM scm_program_num_free_variables (SCM program); |
62 | SCM_API SCM scm_program_free_variable_ref (SCM program, SCM i); | |
63 | SCM_API SCM scm_program_free_variable_set_x (SCM program, SCM i, SCM x); | |
560b9c25 | 64 | SCM_API SCM scm_program_objcode (SCM program); |
fcd4901b | 65 | |
07e424b7 | 66 | SCM_INTERNAL SCM scm_i_program_properties (SCM program); |
56164a5a | 67 | SCM_INTERNAL int scm_i_program_arity (SCM program, int *req, int *opt, int *rest); |
2fb924f6 AW |
68 | SCM_INTERNAL void scm_i_program_print (SCM program, SCM port, |
69 | scm_print_state *pstate); | |
560b9c25 AW |
70 | SCM_INTERNAL void scm_bootstrap_programs (void); |
71 | SCM_INTERNAL void scm_init_programs (void); | |
17e90c5e | 72 | |
8f5cfc81 | 73 | #endif /* _SCM_PROGRAMS_H_ */ |
17e90c5e KN |
74 | |
75 | /* | |
76 | Local Variables: | |
77 | c-file-style: "gnu" | |
78 | End: | |
79 | */ |