xref: /titanic_50/usr/src/lib/efcode/include/fcode/proto.h (revision 989f28072d20c73ae0955d6a1e3e2fc74831cb39)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2000-2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_FCODE_PROTO_H
28 #define	_FCODE_PROTO_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #define	FNPROTO(x)	void x(fcode_env_t *)
37 
38 FNPROTO(bdo);
39 FNPROTO(bqdo);
40 
41 FNPROTO(literal);
42 void branch_common(fcode_env_t *, short, fstack_t, int);
43 FNPROTO(zero);
44 FNPROTO(bloop);
45 FNPROTO(bplusloop);
46 FNPROTO(loop_i);
47 FNPROTO(loop_j);
48 FNPROTO(bleave);
49 FNPROTO(execute);
50 FNPROTO(add);
51 FNPROTO(subtract);
52 FNPROTO(multiply);
53 FNPROTO(slash_mod);
54 FNPROTO(uslash_mod);
55 FNPROTO(divide);
56 FNPROTO(mod);
57 FNPROTO(and);
58 FNPROTO(or);
59 FNPROTO(xor);
60 FNPROTO(invert);
61 FNPROTO(lshift);
62 FNPROTO(rshift);
63 FNPROTO(rshifta);
64 FNPROTO(negate);
65 FNPROTO(f_abs);
66 FNPROTO(f_min);
67 FNPROTO(f_max);
68 FNPROTO(to_r);
69 FNPROTO(from_r);
70 FNPROTO(rfetch);
71 FNPROTO(f_exit);
72 FNPROTO(zero_equals);
73 FNPROTO(zero_not_equals);
74 FNPROTO(zero_less);
75 FNPROTO(zero_less_equals);
76 FNPROTO(zero_greater);
77 FNPROTO(zero_greater_equals);
78 FNPROTO(less);
79 FNPROTO(greater);
80 FNPROTO(equals);
81 FNPROTO(not_equals);
82 FNPROTO(unsign_greater);
83 FNPROTO(unsign_less_equals);
84 FNPROTO(unsign_less);
85 FNPROTO(unsign_greater_equals);
86 FNPROTO(greater_equals);
87 FNPROTO(less_equals);
88 FNPROTO(between);
89 FNPROTO(within);
90 FNPROTO(drop);
91 FNPROTO(f_dup);
92 FNPROTO(over);
93 FNPROTO(swap);
94 FNPROTO(rot);
95 FNPROTO(minus_rot);
96 FNPROTO(tuck);
97 FNPROTO(nip);
98 FNPROTO(pick);
99 FNPROTO(roll);
100 FNPROTO(qdup);
101 FNPROTO(depth);
102 FNPROTO(two_drop);
103 FNPROTO(two_dup);
104 FNPROTO(two_over);
105 FNPROTO(two_swap);
106 FNPROTO(two_rot);
107 FNPROTO(two_slash);
108 FNPROTO(utwo_slash);
109 FNPROTO(two_times);
110 FNPROTO(slash_c);
111 FNPROTO(slash_w);
112 FNPROTO(slash_l);
113 FNPROTO(slash_n);
114 FNPROTO(ca_plus);
115 FNPROTO(wa_plus);
116 FNPROTO(la_plus);
117 FNPROTO(na_plus);
118 FNPROTO(c1_plus);
119 FNPROTO(w1_plus);
120 FNPROTO(l1_plus);
121 FNPROTO(cell_plus);
122 FNPROTO(do_chars);
123 FNPROTO(slash_w_times);
124 FNPROTO(slash_l_times);
125 FNPROTO(cells);
126 FNPROTO(do_off);
127 FNPROTO(do_on);
128 FNPROTO(fetch);
129 FNPROTO(lfetch);
130 FNPROTO(wfetch);
131 FNPROTO(swfetch);
132 FNPROTO(cfetch);
133 FNPROTO(store);
134 FNPROTO(lstore);
135 FNPROTO(wstore);
136 FNPROTO(cstore);
137 
138 FNPROTO(noop);
139 FNPROTO(lwsplit);
140 FNPROTO(wljoin);
141 FNPROTO(lbsplit);
142 FNPROTO(bljoin);
143 FNPROTO(wbflip);
144 FNPROTO(upper_case);
145 FNPROTO(lower_case);
146 FNPROTO(pack_str);
147 FNPROTO(count_str);
148 FNPROTO(to_body);
149 FNPROTO(to_acf);
150 FNPROTO(bcase);
151 FNPROTO(bendcase);
152 
153 FNPROTO(span);
154 
155 FNPROTO(expect);
156 
157 FNPROTO(emit);
158 FNPROTO(type);
159 
160 FNPROTO(fc_crlf);
161 
162 FNPROTO(base);
163 FNPROTO(dollar_number);
164 FNPROTO(digit);
165 
166 FNPROTO(do_constant);
167 FNPROTO(do_defer);
168 FNPROTO(do_crash);
169 FNPROTO(do_field);
170 FNPROTO(idefer_exec);
171 
172 FNPROTO(set_args);
173 
174 void make_common_access(fcode_env_t *, char *, int, int, int,
175     void (*acf_i)(fcode_env_t *), void (*acf_s)(fcode_env_t *),
176     void (*set_a)(fcode_env_t *, int));
177 
178 FNPROTO(do_create);
179 
180 FNPROTO(instance);
181 FNPROTO(semi);
182 
183 FNPROTO(dollar_find);
184 acf_t voc_find(fcode_env_t *env);
185 
186 FNPROTO(evaluate);
187 
188 FNPROTO(ccomma);
189 FNPROTO(wcomma);
190 FNPROTO(lcomma);
191 FNPROTO(comma);
192 FNPROTO(state);
193 FNPROTO(compile_comma);
194 
195 FNPROTO(here);
196 FNPROTO(aligned);
197 FNPROTO(wbsplit);
198 FNPROTO(bwjoin);
199 FNPROTO(bmark);
200 FNPROTO(bresolve);
201 
202 FNPROTO(f_error);
203 FNPROTO(fc_unimplemented);
204 FNPROTO(fc_obsolete);
205 FNPROTO(fc_historical);
206 
207 FNPROTO(myspace);
208 FNPROTO(property);
209 FNPROTO(encode_int);
210 FNPROTO(encode_plus);
211 FNPROTO(encode_phys);
212 FNPROTO(encode_string);
213 FNPROTO(encode_bytes);
214 FNPROTO(model_prop);
215 FNPROTO(device_type);
216 FNPROTO(new_device);
217 
218 FNPROTO(finish_device);
219 
220 FNPROTO(device_name);
221 
222 FNPROTO(lwflip);
223 FNPROTO(lbflip);
224 
225 FNPROTO(child_node);
226 FNPROTO(peer_node);
227 
228 FNPROTO(byte_load);
229 
230 uchar_t  next_bytecode(fcode_env_t *);
231 ushort_t get_short(fcode_env_t *);
232 uint_t   get_int(fcode_env_t *);
233 
234 char *get_name(long *);
235 FNPROTO(words);
236 void header(fcode_env_t *, char *, int, flag_t);
237 void do_code(fcode_env_t *, int, char *, FNPROTO((*)));
238 void push_string(fcode_env_t *, char *, int);
239 
240 FNPROTO(verify_usage);
241 FNPROTO(dump_dictionary);
242 void print_stack_element(fcode_env_t *, fstack_t);
243 void dump_data_stack(fcode_env_t *, int);
244 void dump_return_stack(fcode_env_t *, int);
245 char *acf_lookup(fcode_env_t *, acf_t);
246 char *acf_to_name(fcode_env_t *, acf_t);
247 int within_dictionary(fcode_env_t *, void *);
248 char *acf_backup_search(fcode_env_t *, acf_t);
249 void dump_forth_environment(fcode_env_t *);
250 void forth_abort(fcode_env_t *, char *, ...);
251 void forth_perror(fcode_env_t *, char *, ...);
252 void return_to_interact(fcode_env_t *);
253 char *get_path(fcode_env_t *, device_t *);
254 char *search_for_fcode_file(fcode_env_t *, char *);
255 int current_debug_state(fcode_env_t *);
256 int debug_flags_to_mask(char *);
257 int do_exec_debug(fcode_env_t *, void *);
258 int name_is_debugged(fcode_env_t *, char *);
259 prop_t *find_property(device_t *, char *);
260 void buffer_init(fcode_env_t *env);
261 void check_for_debug_entry(fcode_env_t *);
262 void check_for_debug_exit(fcode_env_t *);
263 void check_semi_debug_exit(fcode_env_t *);
264 void check_vitals(fcode_env_t *);
265 void clear_debug_state(fcode_env_t *, int);
266 void debug_set_level(fcode_env_t *, int);
267 void define_actions(fcode_env_t *env, int n, token_t *array);
268 void do_alias(fcode_env_t *);
269 void do_bbranch(fcode_env_t *env);
270 void do_bdo(fcode_env_t *);
271 void do_bleave(fcode_env_t *env);
272 void do_bloop(fcode_env_t *env);
273 void do_bofbranch(fcode_env_t *env);
274 void do_bploop(fcode_env_t *env);
275 void do_bqbranch(fcode_env_t *env);
276 void do_bqdo(fcode_env_t *env);
277 void do_creator(fcode_env_t *env);
278 void do_default_action(fcode_env_t *env);
279 void do_emit(fcode_env_t *, uchar_t);
280 void do_literal(fcode_env_t *);
281 void dump_comma(fcode_env_t *, char *);
282 void dump_words(fcode_env_t *);
283 void fevaluate(fcode_env_t *);
284 void ibuffer_init(fcode_env_t *env);
285 void install_builtin_nodes(fcode_env_t *);
286 void install_does(fcode_env_t *);
287 void install_openprom_nodes(fcode_env_t *);
288 void install_package_nodes(fcode_env_t *);
289 void internal_env_addr(fcode_env_t *env);
290 void internal_env_fetch(fcode_env_t *env);
291 void internal_env_store(fcode_env_t *env);
292 void key(fcode_env_t *);
293 void keyquestion(fcode_env_t *);
294 void make_a_node(fcode_env_t *, char *, int);
295 void output_data_stack(fcode_env_t *, int);
296 void output_return_stack(fcode_env_t *, int, int);
297 void output_step_message(fcode_env_t *);
298 void output_vitals(fcode_env_t *);
299 void print_property(fcode_env_t *, prop_t *, char *);
300 void read_line(fcode_env_t *);
301 void run_daemon(fcode_env_t *);
302 void run_fcode_from_file(fcode_env_t *, char *, int);
303 void tick_literal(fcode_env_t *);
304 void unbug(fcode_env_t *);
305 void xbflip(fcode_env_t *);
306 void xfetch(fcode_env_t *);
307 void xlflip(fcode_env_t *);
308 void xstore(fcode_env_t *);
309 void expose_acf(fcode_env_t *, char *);
310 
311 FNPROTO(do_semi);
312 FNPROTO(do_colon);
313 FNPROTO(do_next);
314 void do_run(fcode_env_t *, int);
315 
316 void *safe_malloc(size_t, char *, int);
317 void *safe_realloc(void *, size_t, char *, int);
318 char *safe_strdup(char *, char *, int);
319 void safe_free(void *, char *, int);
320 
321 FNPROTO(do_forth);
322 FNPROTO(do_current);
323 FNPROTO(do_context);
324 FNPROTO(do_definitions);
325 FNPROTO(do_interact);
326 FNPROTO(do_resume);
327 FNPROTO(do_vocab);
328 FNPROTO(create);
329 FNPROTO(colon);
330 FNPROTO(does);
331 FNPROTO(recursive);
332 FNPROTO(do_if);
333 FNPROTO(do_else);
334 FNPROTO(do_then);
335 FNPROTO(parse_word);
336 FNPROTO(do_quote);
337 FNPROTO(run_quote);
338 
339 FNPROTO(do_order);
340 FNPROTO(do_also);
341 FNPROTO(do_previous);
342 
343 FNPROTO(find_package);
344 FNPROTO(open_package);
345 FNPROTO(close_package);
346 FNPROTO(find_method);
347 FNPROTO(dollar_call_parent);
348 FNPROTO(my_parent);
349 FNPROTO(my_unit);
350 FNPROTO(ihandle_to_phandle);
351 FNPROTO(dollar_call_method);
352 FNPROTO(dollar_open_package);
353 
354 FNPROTO(call_environment_method);
355 
356 FNPROTO(f_abort);
357 FNPROTO(catch);
358 FNPROTO(throw);
359 
360 FNPROTO(get_my_property);
361 FNPROTO(decode_int);
362 FNPROTO(decode_string);
363 FNPROTO(get_inherited_prop);
364 FNPROTO(delete_property);
365 FNPROTO(get_package_property);
366 void get_environment_property(fcode_env_t *env, int);
367 
368 FNPROTO(root_node);
369 FNPROTO(current_device);
370 FNPROTO(dot_properties);
371 FNPROTO(pwd);
372 FNPROTO(do_ls);
373 FNPROTO(do_cd);
374 FNPROTO(do_select_dev);
375 FNPROTO(do_unselect_dev);
376 FNPROTO(device_end);
377 FNPROTO(value);
378 FNPROTO(buffer_colon);
379 FNPROTO(variable);
380 FNPROTO(constant);
381 FNPROTO(actions);
382 FNPROTO(use_actions);
383 FNPROTO(action_colon);
384 FNPROTO(perform_action);
385 FNPROTO(do_tick);
386 FNPROTO(bracket_tick);
387 FNPROTO(defer);
388 FNPROTO(bye);
389 FNPROTO(dump_device);
390 FNPROTO(dump_instance);
391 FNPROTO(compile_string);
392 FNPROTO(parse_two_int);
393 
394 token_t *alloc_instance_data(fcode_env_t *, int, int, int *);
395 FNPROTO(fetch_instance_data);
396 FNPROTO(set_instance_data);
397 FNPROTO(address_instance_data);
398 FNPROTO(instance_variable);
399 FNPROTO(decode_phys);
400 
401 void install_actions(fcode_env_t *env, token_t *table);
402 void set_value_actions(fcode_env_t *env, int);
403 void set_internal_value_actions(fcode_env_t *env);
404 void set_buffer_actions(fcode_env_t *env, int);
405 
406 void system_message(fcode_env_t *env, char *msg);
407 
408 void check_interrupt(void);
409 void complete_interrupt(void);
410 
411 FNPROTO(do_set_action);
412 void push_a_string(fcode_env_t *, char *);
413 char *pop_a_string(fcode_env_t *, int *);
414 char *pop_a_duped_string(fcode_env_t *, int *);
415 char *parse_a_string(fcode_env_t *, int *);
416 void push_double(fcode_env_t *, dforth_t);
417 dforth_t pop_double(fcode_env_t *);
418 dforth_t peek_double(fcode_env_t *);
419 void push_xforth(fcode_env_t *, xforth_t);
420 xforth_t pop_xforth(fcode_env_t *);
421 xforth_t peek_xforth(fcode_env_t *);
422 void create_prop(fcode_env_t *, char *);
423 void create_int_prop(fcode_env_t *, char *, int);
424 void create_string_prop(fcode_env_t *, char *, char *);
425 void make_builtin_hooks(fcode_env_t *, char *);
426 fstack_t mapping_to_mcookie(uint64_t, size_t, uint64_t, size_t);
427 void delete_mapping(fstack_t);
428 int is_mcookie(fstack_t);
429 uint64_t mcookie_to_addr(fstack_t);
430 fstack_t mcookie_to_rlen(fstack_t);
431 fstack_t mcookie_to_rvirt(fstack_t);
432 void set_here(fcode_env_t *, uchar_t *, char *);
433 int call_my_parent(fcode_env_t *, char *);
434 FILE *get_dump_fd(fcode_env_t *);
435 
436 void load_file(fcode_env_t *);
437 void token_roundup(fcode_env_t *, char *);
438 
439 #ifdef DEBUG
440 void do_fclib_trace(fcode_env_t *, void *);
441 int do_fclib_step(fcode_env_t *);
442 #endif
443 
444 #ifdef	__cplusplus
445 }
446 #endif
447 
448 #endif /* _FCODE_PROTO_H */
449