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
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.
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]
23 * Copyright (c) 2000 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #ifndef _FCODE_PRIVATE_H
28 #define _FCODE_PRIVATE_H
30 #pragma ident "%Z%%M% %I% %E% SMI"
33 #include <fcode/debug.h>
39 long get_interpreter_debug_level(void);
40 void set_interpreter_debug_level(long lvl
);
42 #define DPRINTF(x, y) if (get_interpreter_debug_level() & (DEBUG_##x))\
44 #define DEBUGF(x, y) if (get_interpreter_debug_level() & (DEBUG_##x))\
56 #define PUSH(sp, n) *(++sp) = (n)
57 #define POP(sp) *(sp--)
59 #define ERROR(x) printf x
61 #define MALLOC(x) safe_malloc((x), __FILE__, __LINE__)
62 #define REALLOC(x, n) safe_realloc((x), (n), __FILE__, __LINE__)
63 #define STRDUP(x) safe_strdup((x), __FILE__, __LINE__)
64 #define FREE(x) safe_free((x), __FILE__, __LINE__)
66 #include <fcode/engine.h>
68 extern fcode_env_t
*initial_env
;
69 extern int fcode_impl_count
;
71 #define SET_TOKEN(t, f, n, a) \
72 env->table[t].flags = f; \
73 env->table[t].name = n; \
74 env->table[t].apf = a;
76 #define FCODE(token, fl, nm, fnc) \
78 env->table[token].flags = fl; \
79 do_code(env, token, nm, fnc);
81 #define ANSI(tk, t, nm, fnc) FCODE(tk, (ANSI_WORD|P1275_WORD|t), nm, fnc)
82 #define P1275(tk, t, nm, fnc) FCODE(tk, (P1275_WORD|t), nm, fnc)
85 #define ASSERT(x) if (!(x)) printf("%s:%d: ASSERT FAILED!!\n",\
89 #define NOTICE printf("%s:%d: _init called\n", __FILE__, __LINE__)
98 void fc_abort(fcode_env_t
*, char *type
);
100 #define TODO fc_abort(env, "TODO")
101 #define FATAL ERROR(("%s:%d: MANGLED FCODE!! Fatal Error\n",\
102 __FILE__, __LINE__)))
104 #ifndef USE_INTERRUPTS
105 #define CHECK_INTERRUPT
106 #define COMPLETE_INTERRUPT
108 #define CHECK_INTERRUPT check_interrupt()
109 #define COMPLETE_INTERRUPT complete_interrupt()
112 /* dforth_t manimpulations */
113 #define MAKE_DFORTH(hi, lo) ((((u_dforth_t)(hi) << 32)) | \
114 (((u_dforth_t)(lo)) & 0xffffffff))
115 #define DFORTH_LO(df) (((u_dforth_t)(df)) & 0xffffffff)
116 #define DFORTH_HI(df) ((((u_dforth_t)(df)) >> 32) & 0xffffffff)
122 instance_t
*open_instance_chain(fcode_env_t
*, device_t
*, int);
123 void close_instance_chain(fcode_env_t
*, instance_t
*, int);
124 void activate_device(fcode_env_t
*, device_t
*);
125 void deactivate_device(fcode_env_t
*, device_t
*);
127 void install_handlers(fcode_env_t
*);
128 void set_defer_actions(fcode_env_t
*, int);
129 void throw_from_fclib(fcode_env_t
*, fstack_t
, char *, ...);
130 int get_default_intprop(fcode_env_t
*, char *, device_t
*, int);
131 uint_t
get_number_of_parent_address_cells(fcode_env_t
*);
132 char *get_package_name(fcode_env_t
*, device_t
*);
134 token_t
*get_instance_address(fcode_env_t
*);
135 fc_resource_t
*find_resource(fc_resource_t
**, void *,
136 int (c
)(void *, void *));
137 void *add_resource(fc_resource_t
**, void *, int (c
)(void *, void *));
138 void free_resource(fc_resource_t
**, void *, int (c
)(void *, void *));
139 void set_temporary_compile(fcode_env_t
*);
140 void temporary_execute(fcode_env_t
*);
141 prop_t
*lookup_package_property(fcode_env_t
*, char *, device_t
*);
147 #endif /* _FCODE_PRIVATE_H */