2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License, Version 1.0 only
2N/A * (the "License"). You may not use this file except in compliance
2N/A * with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright (c) 2000 by Sun Microsystems, Inc.
2N/A * All rights reserved.
2N/A */
2N/A
2N/A#ifndef _FCODE_PRIVATE_H
2N/A#define _FCODE_PRIVATE_H
2N/A
2N/A#pragma ident "%Z%%M% %I% %E% SMI"
2N/A
2N/A#ifdef DEBUG
2N/A#include <fcode/debug.h>
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/Along get_interpreter_debug_level(void);
2N/Avoid set_interpreter_debug_level(long lvl);
2N/A
2N/A#define DPRINTF(x, y) if (get_interpreter_debug_level() & (DEBUG_##x))\
2N/A printf y
2N/A#define DEBUGF(x, y) if (get_interpreter_debug_level() & (DEBUG_##x))\
2N/A { y; }
2N/A#else
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A#define DPRINTF(x, y)
2N/A#define DEBUGF(x, y)
2N/A#endif
2N/A
2N/A#define PUSH(sp, n) *(++sp) = (n)
2N/A#define POP(sp) *(sp--)
2N/A
2N/A#define ERROR(x) printf x
2N/A
2N/A#define MALLOC(x) safe_malloc((x), __FILE__, __LINE__)
2N/A#define REALLOC(x, n) safe_realloc((x), (n), __FILE__, __LINE__)
2N/A#define STRDUP(x) safe_strdup((x), __FILE__, __LINE__)
2N/A#define FREE(x) safe_free((x), __FILE__, __LINE__)
2N/A
2N/A#include <fcode/engine.h>
2N/A
2N/Aextern fcode_env_t *initial_env;
2N/Aextern int fcode_impl_count;
2N/A
2N/A#define SET_TOKEN(t, f, n, a) \
2N/A env->table[t].flags = f; \
2N/A env->table[t].name = n; \
2N/A env->table[t].apf = a;
2N/A
2N/A#define FCODE(token, fl, nm, fnc) \
2N/A fcode_impl_count++; \
2N/A env->table[token].flags = fl; \
2N/A do_code(env, token, nm, fnc);
2N/A
2N/A#define ANSI(tk, t, nm, fnc) FCODE(tk, (ANSI_WORD|P1275_WORD|t), nm, fnc)
2N/A#define P1275(tk, t, nm, fnc) FCODE(tk, (P1275_WORD|t), nm, fnc)
2N/A
2N/A#ifdef DEBUG
2N/A#define ASSERT(x) if (!(x)) printf("%s:%d: ASSERT FAILED!!\n",\
2N/A __FILE__, __LINE__);
2N/A#ifdef NOTICE
2N/A#undef NOTICE
2N/A#define NOTICE printf("%s:%d: _init called\n", __FILE__, __LINE__)
2N/A#else
2N/A#define NOTICE
2N/A#endif
2N/A#else
2N/A#define ASSERT(x)
2N/A#define NOTICE
2N/A#endif
2N/A
2N/Avoid fc_abort(fcode_env_t *, char *type);
2N/A
2N/A#define TODO fc_abort(env, "TODO")
2N/A#define FATAL ERROR(("%s:%d: MANGLED FCODE!! Fatal Error\n",\
2N/A __FILE__, __LINE__)))
2N/A
2N/A#ifndef USE_INTERRUPTS
2N/A#define CHECK_INTERRUPT
2N/A#define COMPLETE_INTERRUPT
2N/A#else
2N/A#define CHECK_INTERRUPT check_interrupt()
2N/A#define COMPLETE_INTERRUPT complete_interrupt()
2N/A#endif
2N/A
2N/A/* dforth_t manimpulations */
2N/A#define MAKE_DFORTH(hi, lo) ((((u_dforth_t)(hi) << 32)) | \
2N/A (((u_dforth_t)(lo)) & 0xffffffff))
2N/A#define DFORTH_LO(df) (((u_dforth_t)(df)) & 0xffffffff)
2N/A#define DFORTH_HI(df) ((((u_dforth_t)(df)) >> 32) & 0xffffffff)
2N/A
2N/A#define TRUE (-1)
2N/A#define FALSE (0)
2N/A
2N/A
2N/Ainstance_t *open_instance_chain(fcode_env_t *, device_t *, int);
2N/Avoid close_instance_chain(fcode_env_t *, instance_t *, int);
2N/Avoid activate_device(fcode_env_t *, device_t *);
2N/Avoid deactivate_device(fcode_env_t *, device_t *);
2N/A
2N/Avoid install_handlers(fcode_env_t *);
2N/Avoid set_defer_actions(fcode_env_t *, int);
2N/Avoid throw_from_fclib(fcode_env_t *, fstack_t, char *, ...);
2N/Aint get_default_intprop(fcode_env_t *, char *, device_t *, int);
2N/Auint_t get_number_of_parent_address_cells(fcode_env_t *);
2N/Achar *get_package_name(fcode_env_t *, device_t *);
2N/A
2N/Atoken_t *get_instance_address(fcode_env_t *);
2N/Afc_resource_t *find_resource(fc_resource_t **, void *,
2N/A int (c)(void *, void *));
2N/Avoid *add_resource(fc_resource_t **, void *, int (c)(void *, void *));
2N/Avoid free_resource(fc_resource_t **, void *, int (c)(void *, void *));
2N/Avoid set_temporary_compile(fcode_env_t *);
2N/Avoid temporary_execute(fcode_env_t *);
2N/Aprop_t *lookup_package_property(fcode_env_t *, char *, device_t *);
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _FCODE_PRIVATE_H */