8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / lib / efcode / include / fcode / private.h
blob1a5834483b6a76665dfbab7bc08079ced5cfbd58
1 /*
2 * CDDL HEADER START
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.
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]
20 * CDDL HEADER END
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"
32 #ifdef DEBUG
33 #include <fcode/debug.h>
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
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))\
43 printf y
44 #define DEBUGF(x, y) if (get_interpreter_debug_level() & (DEBUG_##x))\
45 { y; }
46 #else
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
52 #define DPRINTF(x, y)
53 #define DEBUGF(x, y)
54 #endif
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) \
77 fcode_impl_count++; \
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)
84 #ifdef DEBUG
85 #define ASSERT(x) if (!(x)) printf("%s:%d: ASSERT FAILED!!\n",\
86 __FILE__, __LINE__);
87 #ifdef NOTICE
88 #undef NOTICE
89 #define NOTICE printf("%s:%d: _init called\n", __FILE__, __LINE__)
90 #else
91 #define NOTICE
92 #endif
93 #else
94 #define ASSERT(x)
95 #define NOTICE
96 #endif
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
107 #else
108 #define CHECK_INTERRUPT check_interrupt()
109 #define COMPLETE_INTERRUPT complete_interrupt()
110 #endif
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)
118 #define TRUE (-1)
119 #define FALSE (0)
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 *);
143 #ifdef __cplusplus
145 #endif
147 #endif /* _FCODE_PRIVATE_H */