#ifndef XS_npcode_XS_H
#define XS_npcode_XS_H
#ifdef __cplusplus
extern "C"
{
#endif
#ifndef bool
#define bool int
#endif
#define istypedefed 
#include <stdio.h>
#include <stdlib.h>
#define FGLC_XDR_VERSION 100
#define FGLC_XDR_MAGIC 0xa4fc2345
struct vstring {
char * s;
int rcnt;
};
#ifndef OMIT_TYPEDEFS
typedef struct vstring vstring; /* XX */

#endif
enum npcode_cmd_type {
 CMD_NULL = 0 ,
 CMD_BLOCK = 1 ,
 CMD_END_BLOCK = 2 ,
 CMD_CALL = 3 ,
 CMD_IF = 4 ,
 CMD_SET_VAR = 5 ,
 CMD_SET_VAR_ONCE = 6 ,
 CMD_GOTO_LABEL = 7 ,
 CMD_GOTO_PC = 8 ,
 CMD_RETURN = 9 ,
 CMD_NOP = 10 ,
 CMD_PUSH_LONG = 11 ,
 CMD_PUSH_INT = 12 ,
 CMD_PUSH_CHAR = 13 ,
 CMD_PUSH_CHARV = 14 ,
 CMD_CHK_ERR = 15 ,
 CMD_PUSH_VARIABLE = 16 ,
 CMD_END_4GL_0 = 17 ,
 CMD_END_4GL_1 = 18 ,
 CMD_DISPLAY_AT = 19 ,
 CMD_PUSH_OP = 20 ,
 CMD_CLR_ERR = 21 ,
 CMD_ERRCHK = 22 ,
 CMD_ECALL = 23 ,
 CMD_SET_STAT = 24 ,
 CMD_SET_LINE = 25 ,
 CMD_PUSH_OP_AND = 26 ,
 CMD_PUSH_OP_OR = 27 ,
 CMD_PUSH_OP_EQUAL = 28 ,
 CMD_PUSH_OP_CONCAT = 29 ,
 CMD_PUSH_OP_ISNULL = 30 ,
 CMD_ERRCHK_40110 = 31 ,
 CMD_ERRCHK_40010 = 32 ,
 CMD_ERRCHK_40000 = 33 ,
 CMD_PUSH_FUNCTION = 34 ,
 CMD_POP_FUNCTION = 35 ,
 CMD_POP_ARGS = 36 ,
 CMD_POP_PARAM = 37 ,
 CMD_POP_VAR2 = 38 
};
typedef enum npcode_cmd_type npcode_cmd_type;

enum param_type {
 PARAM_TYPE_NULL = 0 ,
 PARAM_TYPE_LITERAL_INT = 1 ,
 PARAM_TYPE_LITERAL_CHAR = 2 ,
 PARAM_TYPE_LITERAL_STRING = 3 ,
 PARAM_TYPE_LITERAL_DOUBLE = 4 ,
 PARAM_TYPE_VAR = 5 ,
 PARAM_TYPE_VAR_ID = 6 ,
 PARAM_TYPE_CALL = 7 ,
 PARAM_TYPE_LIST = 8 ,
 PARAM_TYPE_OP = 9 ,
 PARAM_TYPE_USE_VAR = 10 ,
 PARAM_TYPE_EMPTY = 11 ,
 PARAM_TYPE_CACHED = 12 ,
 PARAM_TYPE_NOP = 13 ,
 PARAM_TYPE_SPECIAL = 14 ,
 PARAM_TYPE_ONKEY = 15 
};
typedef enum param_type param_type;

enum var_category {
 CAT_NULL = 0 ,
 CAT_NORMAL = 1 ,
 CAT_STATIC = 2 ,
 CAT_EXTERN = 3 ,
 CAT_ALLOC = 4 ,
 CAT_ALLOC_STATIC = 5 ,
 CAT_ALLOC_EXTERN = 6 ,
 CAT_SUBSTRUCT = 7 ,
 CAT_PARAMETER = 8 ,
 CAT_PARAMETER_SET = 9 
};
typedef enum var_category var_category;

struct variable_element {
short name_id;
long dtype;
long i_arr_size[3];
short unit_size;
long total_size;
long offset;
struct {
 unsigned int next_len;
 struct variable_element * next_val;
} next;
};
#ifndef OMIT_TYPEDEFS
typedef struct variable_element variable_element; /* XX */

#endif
struct npvariable {
long variable_id;
long def_block;
enum var_category category;
struct variable_element * var;
};
#ifndef OMIT_TYPEDEFS
typedef struct npvariable npvariable; /* XX */

#endif
struct param_list {
struct {
 unsigned int list_param_id_len;
 long * list_param_id_val;
} list_param_id;
};
#ifndef OMIT_TYPEDEFS
typedef struct param_list param_list; /* XX */

#endif
enum enumop {
 EOP_EQUAL = 0 ,
 EOP_GT = 1 ,
 EOP_GTE = 2 ,
 EOP_LT = 3 ,
 EOP_LTE = 4 ,
 EOP_PLUS = 5 ,
 EOP_MINUS = 6 ,
 EOP_MULTIPLY = 7 ,
 EOP_DIVIDE = 8 ,
 EOP_AND = 9 ,
 EOP_OR = 10 ,
 EOP_LOGAND = 11 ,
 EOP_LOGOR = 12 ,
 EOP_NE = 13 ,
 EOP_NOT = 14 ,
 EOP_MOD = 15 
};
typedef enum enumop enumop;

struct param_op {
long left_param_id;
enum enumop op_i;
long right_param_id;
};
#ifndef OMIT_TYPEDEFS
typedef struct param_op param_op; /* XX */

#endif
struct cmd_block {
struct {
 unsigned int c_vars_len;
 struct npvariable * c_vars_val;
} c_vars;
long mem_for_vars;
long mem_to_alloc;
};
#ifndef OMIT_TYPEDEFS
typedef struct cmd_block cmd_block; /* XX */

#endif
struct cmd_end_block {
long pc_start_block;
};
#ifndef OMIT_TYPEDEFS
typedef struct cmd_end_block cmd_end_block; /* XX */

#endif
struct param {
int param_type;
union {
long n;
istypedefed char c;
long str_entry;
double * d;
char * v;
int vid;
struct npcmd_call * c_call;
struct param_list * p_list;
struct param_op * op;
struct use_variable * uv;
long param_cache_id;
char * special;
char * keys;
} param_u;
};
typedef struct param param;
struct npcmd_if {
long condition_param_id;
long goto_true;
long goto_false;
};
#ifndef OMIT_TYPEDEFS
typedef struct npcmd_if npcmd_if; /* XX */

#endif
struct npcmd_call {
long func_id;
long func_params_param_id;
};
#ifndef OMIT_TYPEDEFS
typedef struct npcmd_call npcmd_call; /* XX */

#endif
struct use_variable_sub {
long x1subscript_param_id[3];
long x1element;
long subscript_all;
};
#ifndef OMIT_TYPEDEFS
typedef struct use_variable_sub use_variable_sub; /* XX */

#endif
struct use_variable {
short variable_id;
short defined_in_block_pc;
istypedefed char indirection;
struct {
 unsigned int sub_len;
 struct use_variable_sub * sub_val;
} sub;
};
#ifndef OMIT_TYPEDEFS
typedef struct use_variable use_variable; /* XX */

#endif
struct cmd_set_var {
struct use_variable variable;
long value_param_id;
};
#ifndef OMIT_TYPEDEFS
typedef struct cmd_set_var cmd_set_var; /* XX */

#endif
struct cmd_set_var1 {
struct use_variable variable;
long value_param_id;
int set;
};
#ifndef OMIT_TYPEDEFS
typedef struct cmd_set_var1 cmd_set_var1; /* XX */

#endif
struct cmd_display_at {
short x;
short y;
};
#ifndef OMIT_TYPEDEFS
typedef struct cmd_display_at cmd_display_at; /* XX */

#endif
struct cmd_errchk {
long line;
long module_name;
istypedefed char modes[5];
long actions[5];
};
#ifndef OMIT_TYPEDEFS
typedef struct cmd_errchk cmd_errchk; /* XX */

#endif
struct cmd_errchk_40110 {
long line;
long module_name;
};
#ifndef OMIT_TYPEDEFS
typedef struct cmd_errchk_40110 cmd_errchk_40110; /* XX */

#endif
struct cmd_errchk_40010 {
long line;
long module_name;
};
#ifndef OMIT_TYPEDEFS
typedef struct cmd_errchk_40010 cmd_errchk_40010; /* XX */

#endif
struct cmd_errchk_40000 {
long line;
long module_name;
};
#ifndef OMIT_TYPEDEFS
typedef struct cmd_errchk_40000 cmd_errchk_40000; /* XX */

#endif
struct ecall {
int func_id;
int ln;
int nparam;
};
#ifndef OMIT_TYPEDEFS
typedef struct ecall ecall; /* XX */

#endif
struct cmd_push_function {
long funcname;
long paramnames;
long nargs;
};
#ifndef OMIT_TYPEDEFS
typedef struct cmd_push_function cmd_push_function; /* XX */

#endif
struct cmd_pop_param {
long x;
};
#ifndef OMIT_TYPEDEFS
typedef struct cmd_pop_param cmd_pop_param; /* XX */

#endif
struct cmd_pop_var2 {
long x;
};
#ifndef OMIT_TYPEDEFS
typedef struct cmd_pop_var2 cmd_pop_var2; /* XX */

#endif
struct cmd {
int npcode_cmd_type;
union {
struct cmd_block * c_block;
struct cmd_end_block * c_endblock;
struct npcmd_call * c_call;
struct npcmd_if * c_if;
struct cmd_set_var * c_setvar;
struct cmd_set_var1 * c_setvar1;
long c_goto_str;
long c_goto_pc;
long c_return_param_id;
long c_push_long;
short c_push_int;
long c_chk_err_lineno;
struct cmd_errchk * c_errchk;
struct cmd_errchk_40110 * c_errchk_40110;
struct cmd_errchk_40010 * c_errchk_40010;
struct cmd_errchk_40000 * c_errchk_40000;
long c_push_char;
long c_var_param_id;
struct cmd_display_at c_disp_at;
long c_push_op;
struct ecall * c_ecall;
long c_setval;
long c_cline;
long c_pop_args;
struct cmd_push_function * c_push_function;
struct cmd_pop_param * c_pop_param;
struct cmd_pop_var2 * c_pop_var2;
} cmd_u;
};
typedef struct cmd cmd;
struct call_stack {
struct cmd_block * block;
int pc;
};
#ifndef OMIT_TYPEDEFS
typedef struct call_stack call_stack; /* XX */

#endif
struct npfunction {
long func_name_id;
long module_name_id;
struct {
 unsigned int param_vars_len;
 struct use_variable * param_vars_val;
} param_vars;
long function_class;
struct {
 unsigned int cmds_len;
 struct cmd * cmds_val;
} cmds;
};
#ifndef OMIT_TYPEDEFS
typedef struct npfunction npfunction; /* XX */

#endif
struct module {
long fglc_magic;
long fglc_version;
long file_size;
char * module_name;
long compiled_time;
struct {
 unsigned int string_table_len;
 struct vstring * string_table_val;
} string_table;
struct {
 unsigned int id_table_len;
 struct vstring * id_table_val;
} id_table;
struct {
 unsigned int external_function_table_len;
 long * external_function_table_val;
} external_function_table;
struct {
 unsigned int functions_len;
 struct npfunction * functions_val;
} functions;
struct {
 unsigned int params_len;
 struct param * params_val;
} params;
int max_variable_id;
};
#ifndef OMIT_TYPEDEFS
typedef struct module module; /* XX */

#endif
struct module_list {
long fglc_magic;
long fglc_version;
long file_size;
struct {
 unsigned int modules_len;
 struct module * modules_val;
} modules;
};
#ifndef OMIT_TYPEDEFS
typedef struct module_list module_list; /* XX */

#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */


#endif /*XS_npcode_XS_H*/
