Remove unreachable code in scm_setter
[bpt/guile.git] / libguile / programs.h
CommitLineData
de0233af 1/* Copyright (C) 2001, 2009, 2010, 2011, 2012, 2013, 2014 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>
17e90c5e 23
510ca126 24/*
a1eb8d11 25 * Programs
510ca126
AW
26 */
27
d798a895
AW
28#define SCM_PROGRAM_P(x) (SCM_HAS_TYP7 (x, scm_tc7_program))
29#define SCM_PROGRAM_CODE(x) ((scm_t_uint32 *) SCM_CELL_WORD_1 (x))
30#define SCM_PROGRAM_FREE_VARIABLES(x) (SCM_CELL_OBJECT_LOC (x, 2))
31#define SCM_PROGRAM_FREE_VARIABLE_REF(x,i) (SCM_PROGRAM_FREE_VARIABLES (x)[i])
32#define SCM_PROGRAM_FREE_VARIABLE_SET(x,i,v) (SCM_PROGRAM_FREE_VARIABLES (x)[i]=(v))
33#define SCM_PROGRAM_NUM_FREE_VARIABLES(x) (SCM_CELL_WORD_0 (x) >> 16)
34#define SCM_VALIDATE_PROGRAM(p,x) SCM_MAKE_VALIDATE (p, x, PROGRAM_P)
510ca126 35
a1eb8d11
AW
36#define SCM_F_PROGRAM_IS_BOOT 0x100
37#define SCM_F_PROGRAM_IS_PRIMITIVE 0x200
38#define SCM_F_PROGRAM_IS_PRIMITIVE_GENERIC 0x400
39#define SCM_F_PROGRAM_IS_CONTINUATION 0x800
40#define SCM_F_PROGRAM_IS_PARTIAL_CONTINUATION 0x1000
41#define SCM_F_PROGRAM_IS_FOREIGN 0x2000
42
43#define SCM_PROGRAM_IS_BOOT(x) (SCM_CELL_WORD_0 (x) & SCM_F_PROGRAM_IS_BOOT)
44#define SCM_PROGRAM_IS_PRIMITIVE(x) (SCM_CELL_WORD_0 (x) & SCM_F_PROGRAM_IS_PRIMITIVE)
45#define SCM_PROGRAM_IS_PRIMITIVE_GENERIC(x) (SCM_CELL_WORD_0 (x) & SCM_F_PROGRAM_IS_PRIMITIVE_GENERIC)
46#define SCM_PROGRAM_IS_CONTINUATION(x) (SCM_CELL_WORD_0 (x) & SCM_F_PROGRAM_IS_CONTINUATION)
47#define SCM_PROGRAM_IS_PARTIAL_CONTINUATION(x) (SCM_CELL_WORD_0 (x) & SCM_F_PROGRAM_IS_PARTIAL_CONTINUATION)
48#define SCM_PROGRAM_IS_FOREIGN(x) (SCM_CELL_WORD_0 (x) & SCM_F_PROGRAM_IS_FOREIGN)
49
e326baac 50#ifdef BUILDING_LIBGUILE
510ca126 51static inline SCM
80797145 52scm_i_make_program (const scm_t_uint32 *code)
510ca126 53{
e0755cd1 54 return scm_cell (scm_tc7_program, (scm_t_bits)code);
510ca126 55}
e326baac 56#endif
510ca126 57
0bd1e9c6 58SCM_INTERNAL SCM scm_program_p (SCM obj);
d1100525 59SCM_INTERNAL SCM scm_program_code (SCM program);
510ca126 60
27337b63
AW
61SCM_INTERNAL SCM scm_primitive_p (SCM obj);
62SCM_INTERNAL SCM scm_primitive_call_ip (SCM prim);
63
80797145
AW
64SCM_INTERNAL SCM scm_i_program_name (SCM program);
65SCM_INTERNAL SCM scm_i_program_documentation (SCM program);
66SCM_INTERNAL SCM scm_i_program_properties (SCM program);
510ca126 67
581a4eb8
AW
68SCM_INTERNAL SCM scm_find_source_for_addr (SCM ip);
69
de0233af
AW
70SCM_INTERNAL SCM scm_program_address_range (SCM program);
71
6f16379e
AW
72SCM_API SCM scm_program_num_free_variables (SCM program);
73SCM_API SCM scm_program_free_variable_ref (SCM program, SCM i);
74SCM_API SCM scm_program_free_variable_set_x (SCM program, SCM i, SCM x);
fcd4901b 75
56164a5a 76SCM_INTERNAL int scm_i_program_arity (SCM program, int *req, int *opt, int *rest);
2fb924f6
AW
77SCM_INTERNAL void scm_i_program_print (SCM program, SCM port,
78 scm_print_state *pstate);
560b9c25
AW
79SCM_INTERNAL void scm_bootstrap_programs (void);
80SCM_INTERNAL void scm_init_programs (void);
17e90c5e 81
8f5cfc81 82#endif /* _SCM_PROGRAMS_H_ */
17e90c5e
KN
83
84/*
85 Local Variables:
86 c-file-style: "gnu"
87 End:
88*/