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