1 /*_. Klink 0.0: klink-private.h */
4 /* Private internal definitions */
5 /*_ . Credits and License */
7 Copyright (C) 2010,2011 Tom Breton (Tehom)
9 This program is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
25 #ifndef _KLINK_PRIVATE_H
26 #define _KLINK_PRIVATE_H
33 /*_ . C++ nonmangling */
40 /*_ . Ubiquitous objects */
52 typedef struct dump_stack_frame_cell
* _kt_spagstack
;
55 /*_ , The interpreter itself */
59 /** True internal variables **/
60 _kt_spagstack dump
; /* The dynamic stack (Really one leaf
61 of a spaghetti stack). The center
62 of the interpreter. */
63 int done
; /* Whether eval loop should stop. */
64 jmp_buf pseudocontinuation
; /* longjmping here goes directly to
65 next eval loop iteration. (Or
66 terminates, if we're not in eval
69 /* Caches of ground-environment variables, provided for built-ins. */
70 pko error_continuation
; /* What to do on error. */
71 /* Don't seem to can use a root_continuation cache. */
73 /** Caches and pseudo-caches of dynamic variables **/
74 int tracing
; /* Are we tracing? */
75 int new_tracing
; /* Are we tracing? */
76 pko fail_continuation
; /* Logical fail */
78 pko envir
; /* Current environment. No cache key; it's
79 always in use so we don't deep-store it.
80 But conceptually it's a dynamic variable. */
83 pko ca_inport
; /* Will become just a cache */
84 pko ca_outport
; /* Same */
85 pko ca_nesting
; /* Same */
88 /* global pointers to special symbols */
89 pko QUOTE
; /* pointer to syntax quote */
91 pko QQUOTE
; /* pointer to symbol quasiquote */
92 pko UNQUOTE
; /* pointer to symbol unquote */
93 pko UNQUOTESP
; /* pointer to symbol unquote-splicing */
94 pko COLON_HOOK
; /* *colon-hook* */
95 pko SHARP_HOOK
; /* *sharp-hook* */
97 /*** Scratch variables ***/
99 char linebuff
[LINESIZE
];
100 #define STRBUFFSIZE 256
101 char strbuff
[STRBUFFSIZE
];
103 /** Special-purpose pseudo-passing **/
104 int tok
; /* Token from tokenizer to read */
105 pko value
; /* Value from longjmp to eval
107 pko next_func
; /* Next functor, from frame pop to
108 eval loop iteration */
109 int retcode
; /* return code, from exit operation to
112 void *ext_data
; /* For the benefit of foreign functions */
113 struct klink_interface
*vptr
;
116 /*_ . Function signatures */
118 int is_string (pko p
);
119 char *string_value (pko p
);
120 int is_number (pko p
);
123 double rvalue (pko p
);
124 int is_integer (pko p
);
126 int is_character (pko p
);
127 long charvalue (pko p
);
128 int is_vector (pko p
);
133 pko
pair_car (klink
* sc
, pko p
);
134 pko
pair_cdr (klink
* sc
, pko p
);
135 pko
set_car (klink
* sc
, pko p
, pko q
);
136 pko
set_cdr (klink
* sc
, pko p
, pko q
);
138 int is_symbol (pko p
);
139 char *symname (klink
* sc
, pko p
);
143 int is_continuation (pko p
);
144 int is_promise (pko p
);
145 int is_environment (pko p
);
146 int is_immutable (pko p
);
147 void setimmutable (pko p
);
151 /*_ . End nonmangling */