/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2000 by Sun Microsystems, Inc.
* All rights reserved.
*/
#ifndef _FCODE_ENGINE_H
#define _FCODE_ENGINE_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#define CONVERT_HANDLES
#ifdef BIGSTACK
typedef long long fstack_t;
typedef unsigned long long ufstack_t;
#else
typedef long fstack_t;
typedef unsigned long ufstack_t;
#endif
/* x@, x! type */
/* l@, l! type */
/* w@, w! type */
/* Double type */
typedef struct PROPERTY {
char *name;
int size;
} prop_t;
typedef struct RESOURCE {
void *data;
#define INIT_DATA 0
typedef struct DEVICE_VECTOR {
/*
* If there is private data associated with a node this vector
* table contains the routines that will be called to augment the
* device.
* These two routines allow the interpreter to use a different
*
* Interface Note:
* Any routine installed here is assumed to have the standard forth
* call state. It must be a void function call taking a forth execution
* environment, returning any data on the stack. In general the
* vector call should have the same semantics as the original routine
* it is replacing. (see get_prop as an example).
*
* The caller has the responsibility of converting the resulting data
* back to a form it requires.
*
*/
struct DEVICE {
void *private; /* app private data */
};
typedef struct INSTANCE {
/*
* These are copies of the same structures from the device definition
* however changes here will be thrown away when the instance is
* destroyed.
*/
char *my_args;
int my_args_len;
} instance_t;
typedef struct FCODE_TOKEN {
char *name;
#ifdef DEBUG
int usage;
#endif
} fcode_token;
typedef struct {
char *buffer;
char *scanptr;
int maxlen;
int separator;
} input_typ;
typedef struct ERROR_FRAME {
} error_frame;
struct FCODE_ENV {
long order_depth;
int interpretting;
int fcode_debug;
int diagnostic_mode;
int num_actions;
int action_count;
int strict_fcode;
#ifdef CONVERT_HANDLES
#endif
void *private; /* private data ptr for app use. */
};
typedef unsigned char flag_t;
#ifdef FCODE_INTERNAL
#endif
/*
* Note that sizeof (token_t) MUST equal sizeof (token_t *). If it doesn't,
* many things will break.
*/
#define min(x, y) ((x) < (y) ? (x) : (y))
#define max(x, y) ((x) > (y) ? (x) : (y))
/* values for flag_t */
#ifdef CONVERT_HANDLES
#else
#define ALLOCATE_PHANDLE(e)
#endif
extern fcode_env_t *env;
extern int dict_size;
extern int in_forth_abort;
extern int stack_size;
extern void (*blit_ptr)(fcode_env_t *);
extern void (*create_ptr)(fcode_env_t *);
extern void (*do_bdo_ptr)(fcode_env_t *);
extern void (*do_bqdo_ptr)(fcode_env_t *);
extern void (*do_leave_ptr)(fcode_env_t *);
extern void (*do_loop_ptr)(fcode_env_t *);
extern void (*do_ploop_ptr)(fcode_env_t *);
extern void (*does_ptr)(fcode_env_t *);
extern void (*quote_ptr)(fcode_env_t *);
extern void (*quote_ptr)(fcode_env_t *);
extern void (*semi_ptr)(fcode_env_t *);
extern void (*tlit_ptr)(fcode_env_t *);
extern void (*to_ptr)(fcode_env_t *);
extern void (*to_ptr)(fcode_env_t *);
#ifdef __cplusplus
}
#endif
#endif /* _FCODE_ENGINE_H */