1
0
forked from GitHub/gf-core

An initial import of the teyjus source code in the C runtime for GF. The two runtime are still not connected but the source code compiles.

This commit is contained in:
kr.angelov
2012-07-31 15:16:04 +00:00
parent 8da1bbd17d
commit 2844742afd
76 changed files with 23808 additions and 3 deletions

View File

@@ -0,0 +1,27 @@
TABLES
======
The files in source/tables define the pervasive tables and instruction
format tables.
pervasives:
pervasives.h{c}
===============
Defines the pervasive tables for pervasive kinds, type skeletons
and constants. Note these files are automatically generated.
pervinit.h{c}
=============
Defines the initialization functions for pervasive tables: such functions
are necessary because the pervasive names in the system run-time have
special encoding in the simulator (source/simulator/mcstring.h{c}) for
garbage collection as opposed to simply C strings. These names have to
be laid out on the system memory upon system initialization.
instructions.h{c}
=================
Defines instruction formats and instruction opcodes.
Note these files are automatically generated.

View File

@@ -0,0 +1,292 @@
/****************************************************************************/
/* */
/* File instructions.c. This file defines the operand types table and */
/* the instruction information table. */
/* */
/****************************************************************************/
#include "instructions.h"
/****************************************************************************/
/* OPERAND TYPES TABLE */
/****************************************************************************/
/* Max number of operand that could be taken by instructions including the */
/* padding bytes and one to terminate the list. (machine dependent) */
#define INSTR_MAX_OPERAND 8
/* this array is indexed by instruction category. For each category,
INSTR_operandTypeTab contains a string of values indicating the type
of the operand at that position, terminated by INSTR_X. This
information is useful when parsing instruction streams. */
typedef INSTR_OperandType
INSTR_OperandTypeTab[INSTR_NUM_INSTR_CATS][INSTR_MAX_OPERAND];
INSTR_OperandTypeTab INSTR_operandTypeTable ={
//INSTR_CAT_X
{INSTR_P, INSTR_P, INSTR_P, INSTR_X, INSTR_X, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_RX
{INSTR_R, INSTR_P, INSTR_P, INSTR_X, INSTR_X, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_EX
{INSTR_E, INSTR_P, INSTR_P, INSTR_X, INSTR_X, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_I1X
{INSTR_I1, INSTR_P, INSTR_P, INSTR_X, INSTR_X, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_CX
{INSTR_P, INSTR_C, INSTR_X, INSTR_X, INSTR_X, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_KX
{INSTR_P, INSTR_K, INSTR_X, INSTR_X, INSTR_X, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_IX
{INSTR_P, INSTR_P, INSTR_P, INSTR_I, INSTR_X, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_FX
{INSTR_P, INSTR_P, INSTR_P, INSTR_F, INSTR_X, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_SX
{INSTR_P, INSTR_P, INSTR_P, INSTR_S, INSTR_X, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_MTX
{INSTR_P, INSTR_P, INSTR_P, INSTR_MT, INSTR_X, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_LX
{INSTR_P, INSTR_P, INSTR_P, INSTR_L, INSTR_X, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_RRX
{INSTR_R, INSTR_R, INSTR_P, INSTR_X, INSTR_X, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_ERX
{INSTR_E, INSTR_R, INSTR_P, INSTR_X, INSTR_X, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_RCX
{INSTR_R, INSTR_C, INSTR_X, INSTR_X, INSTR_X, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_RIX
{INSTR_R, INSTR_P, INSTR_P, INSTR_I, INSTR_X, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_RFX
{INSTR_R, INSTR_P, INSTR_P, INSTR_F, INSTR_X, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_RSX
{INSTR_R, INSTR_P, INSTR_P, INSTR_S, INSTR_X, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_RI1X
{INSTR_R, INSTR_I1, INSTR_P, INSTR_X, INSTR_X, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_RCEX
{INSTR_R, INSTR_CE, INSTR_P, INSTR_X, INSTR_X, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_ECEX
{INSTR_E, INSTR_CE, INSTR_P, INSTR_X, INSTR_X, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_CLX
{INSTR_P, INSTR_C, INSTR_L, INSTR_X, INSTR_X, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_RKX
{INSTR_R, INSTR_K, INSTR_X, INSTR_X, INSTR_X, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_ECX
{INSTR_E, INSTR_C, INSTR_X, INSTR_X, INSTR_X, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_I1ITX
{INSTR_I1, INSTR_P, INSTR_P, INSTR_IT, INSTR_X, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_I1LX
{INSTR_I1, INSTR_P, INSTR_P, INSTR_L, INSTR_X, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_SEGLX
{INSTR_SEG, INSTR_P, INSTR_P, INSTR_L, INSTR_X, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_I1LWPX
{INSTR_I1, INSTR_P, INSTR_P, INSTR_L, INSTR_WP, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_I1NX
{INSTR_I1, INSTR_N, INSTR_P, INSTR_X, INSTR_X, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_I1HTX
{INSTR_I1, INSTR_P, INSTR_P, INSTR_HT, INSTR_X, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_I1BVTX
{INSTR_I1, INSTR_P, INSTR_P, INSTR_BVT, INSTR_X, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_CWPX
{INSTR_P, INSTR_C, INSTR_WP, INSTR_X, INSTR_X, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_I1WPX
{INSTR_I1, INSTR_P, INSTR_P, INSTR_WP, INSTR_X, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_RRI1X
{INSTR_R, INSTR_R, INSTR_I1, INSTR_X, INSTR_X, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_RCLX
{INSTR_R, INSTR_C, INSTR_L, INSTR_X, INSTR_X, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_RCI1X
{INSTR_R, INSTR_C, INSTR_I1, INSTR_P, INSTR_P, INSTR_P, INSTR_X, INSTR_X},
//INSTR_CAT_SEGI1LX
{INSTR_SEG, INSTR_I1, INSTR_P, INSTR_L, INSTR_X, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_I1LLX
{INSTR_I1, INSTR_P, INSTR_P, INSTR_L, INSTR_L, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_NLLX
{INSTR_N, INSTR_P, INSTR_P, INSTR_L, INSTR_L, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_LLLLX
{INSTR_P, INSTR_P, INSTR_P, INSTR_L, INSTR_L, INSTR_L, INSTR_L, INSTR_X},
//INSTR_CAT_I1CWPX
{INSTR_I1, INSTR_C, INSTR_WP, INSTR_X, INSTR_X, INSTR_X, INSTR_X, INSTR_X},
//INSTR_CAT_I1I1WPX
{INSTR_I1, INSTR_I1, INSTR_P, INSTR_WP, INSTR_X, INSTR_X, INSTR_X, INSTR_X}
};
INSTR_OperandType* INSTR_operandTypes(INSTR_InstrCategory index)
{
return INSTR_operandTypeTable[index];
}
/****************************************************************************/
/* INSTRUCTION INFORMATION TABLE */
/****************************************************************************/
typedef struct //entry of the instruction info table
{
char* name;
INSTR_InstrCategory type;
int size;
} INSTR_InstrInfoTab_;
typedef INSTR_InstrInfoTab_ INSTR_InstrInfoTab[INSTR_NUM_INSTRS];
INSTR_InstrInfoTab INSTR_instrInfoTable ={
{"put_variable_t", INSTR_CAT_RRX, INSTR_RRX_LEN},
{"put_variable_p", INSTR_CAT_ERX, INSTR_ERX_LEN},
{"put_value_t", INSTR_CAT_RRX, INSTR_RRX_LEN},
{"put_value_p", INSTR_CAT_ERX, INSTR_ERX_LEN},
{"put_unsafe_value", INSTR_CAT_ERX, INSTR_ERX_LEN},
{"copy_value", INSTR_CAT_ERX, INSTR_ERX_LEN},
{"put_m_const", INSTR_CAT_RCX, INSTR_RCX_LEN},
{"put_p_const", INSTR_CAT_RCX, INSTR_RCX_LEN},
{"put_nil", INSTR_CAT_RX, INSTR_RX_LEN},
{"put_integer", INSTR_CAT_RIX, INSTR_RIX_LEN},
{"put_float", INSTR_CAT_RFX, INSTR_RFX_LEN},
{"put_string", INSTR_CAT_RSX, INSTR_RSX_LEN},
{"put_index", INSTR_CAT_RI1X, INSTR_RI1X_LEN},
{"put_app", INSTR_CAT_RRI1X, INSTR_RRI1X_LEN},
{"put_list", INSTR_CAT_RX, INSTR_RX_LEN},
{"put_lambda", INSTR_CAT_RRI1X, INSTR_RRI1X_LEN},
{"set_variable_t", INSTR_CAT_RX, INSTR_RX_LEN},
{"set_variable_te", INSTR_CAT_RX, INSTR_RX_LEN},
{"set_variable_p", INSTR_CAT_EX, INSTR_EX_LEN},
{"set_value_t", INSTR_CAT_RX, INSTR_RX_LEN},
{"set_value_p", INSTR_CAT_EX, INSTR_EX_LEN},
{"globalize_pt", INSTR_CAT_ERX, INSTR_ERX_LEN},
{"globalize_t", INSTR_CAT_RX, INSTR_RX_LEN},
{"set_m_const", INSTR_CAT_CX, INSTR_CX_LEN},
{"set_p_const", INSTR_CAT_CX, INSTR_CX_LEN},
{"set_nil", INSTR_CAT_X, INSTR_X_LEN},
{"set_integer", INSTR_CAT_IX, INSTR_IX_LEN},
{"set_float", INSTR_CAT_FX, INSTR_FX_LEN},
{"set_string", INSTR_CAT_SX, INSTR_SX_LEN},
{"set_index", INSTR_CAT_I1X, INSTR_I1X_LEN},
{"set_void", INSTR_CAT_I1X, INSTR_I1X_LEN},
{"deref", INSTR_CAT_RX, INSTR_RX_LEN},
{"set_lambda", INSTR_CAT_RI1X, INSTR_RI1X_LEN},
{"get_variable_t", INSTR_CAT_RRX, INSTR_RRX_LEN},
{"get_variable_p", INSTR_CAT_ERX, INSTR_ERX_LEN},
{"init_variable_t", INSTR_CAT_RCEX, INSTR_RCEX_LEN},
{"init_variable_p", INSTR_CAT_ECEX, INSTR_ECEX_LEN},
{"get_m_constant", INSTR_CAT_RCX, INSTR_RCX_LEN},
{"get_p_constant", INSTR_CAT_RCLX, INSTR_RCLX_LEN},
{"get_integer", INSTR_CAT_RIX, INSTR_RIX_LEN},
{"get_float", INSTR_CAT_RFX, INSTR_RFX_LEN},
{"get_string", INSTR_CAT_RSX, INSTR_RSX_LEN},
{"get_nil", INSTR_CAT_RX, INSTR_RX_LEN},
{"get_m_structure", INSTR_CAT_RCI1X, INSTR_RCI1X_LEN},
{"get_p_structure", INSTR_CAT_RCI1X, INSTR_RCI1X_LEN},
{"get_list", INSTR_CAT_RX, INSTR_RX_LEN},
{"unify_variable_t", INSTR_CAT_RX, INSTR_RX_LEN},
{"unify_variable_p", INSTR_CAT_EX, INSTR_EX_LEN},
{"unify_value_t", INSTR_CAT_RX, INSTR_RX_LEN},
{"unify_value_p", INSTR_CAT_EX, INSTR_EX_LEN},
{"unify_local_value_t", INSTR_CAT_RX, INSTR_RX_LEN},
{"unify_local_value_p", INSTR_CAT_EX, INSTR_EX_LEN},
{"unify_m_constant", INSTR_CAT_CX, INSTR_CX_LEN},
{"unify_p_constant", INSTR_CAT_CLX, INSTR_CLX_LEN},
{"unify_integer", INSTR_CAT_IX, INSTR_IX_LEN},
{"unify_float", INSTR_CAT_FX, INSTR_FX_LEN},
{"unify_string", INSTR_CAT_SX, INSTR_SX_LEN},
{"unify_nil", INSTR_CAT_X, INSTR_X_LEN},
{"unify_void", INSTR_CAT_I1X, INSTR_I1X_LEN},
{"put_type_variable_t", INSTR_CAT_RRX, INSTR_RRX_LEN},
{"put_type_variable_p", INSTR_CAT_ERX, INSTR_ERX_LEN},
{"put_type_value_t", INSTR_CAT_RRX, INSTR_RRX_LEN},
{"put_type_value_p", INSTR_CAT_ERX, INSTR_ERX_LEN},
{"put_type_unsafe_value", INSTR_CAT_ERX, INSTR_ERX_LEN},
{"put_type_const", INSTR_CAT_RKX, INSTR_RKX_LEN},
{"put_type_structure", INSTR_CAT_RKX, INSTR_RKX_LEN},
{"put_type_arrow", INSTR_CAT_RX, INSTR_RX_LEN},
{"set_type_variable_t", INSTR_CAT_RX, INSTR_RX_LEN},
{"set_type_variable_p", INSTR_CAT_EX, INSTR_EX_LEN},
{"set_type_value_t", INSTR_CAT_RX, INSTR_RX_LEN},
{"set_type_value_p", INSTR_CAT_EX, INSTR_EX_LEN},
{"set_type_local_value_t", INSTR_CAT_RX, INSTR_RX_LEN},
{"set_type_local_value_p", INSTR_CAT_EX, INSTR_EX_LEN},
{"set_type_constant", INSTR_CAT_KX, INSTR_KX_LEN},
{"get_type_variable_t", INSTR_CAT_RRX, INSTR_RRX_LEN},
{"get_type_variable_p", INSTR_CAT_ERX, INSTR_ERX_LEN},
{"init_type_variable_t", INSTR_CAT_RCEX, INSTR_RCEX_LEN},
{"init_type_variable_p", INSTR_CAT_ECEX, INSTR_ECEX_LEN},
{"get_type_value_t", INSTR_CAT_RRX, INSTR_RRX_LEN},
{"get_type_value_p", INSTR_CAT_ERX, INSTR_ERX_LEN},
{"get_type_constant", INSTR_CAT_RKX, INSTR_RKX_LEN},
{"get_type_structure", INSTR_CAT_RKX, INSTR_RKX_LEN},
{"get_type_arrow", INSTR_CAT_RX, INSTR_RX_LEN},
{"unify_type_variable_t", INSTR_CAT_RX, INSTR_RX_LEN},
{"unify_type_variable_p", INSTR_CAT_EX, INSTR_EX_LEN},
{"unify_type_value_t", INSTR_CAT_RX, INSTR_RX_LEN},
{"unify_type_value_p", INSTR_CAT_EX, INSTR_EX_LEN},
{"unify_envty_value_t", INSTR_CAT_RX, INSTR_RX_LEN},
{"unify_envty_value_p", INSTR_CAT_EX, INSTR_EX_LEN},
{"unify_type_local_value_t", INSTR_CAT_RX, INSTR_RX_LEN},
{"unify_type_local_value_p", INSTR_CAT_EX, INSTR_EX_LEN},
{"unify_envty_local_value_t", INSTR_CAT_RX, INSTR_RX_LEN},
{"unify_envty_local_value_p", INSTR_CAT_EX, INSTR_EX_LEN},
{"unify_type_constant", INSTR_CAT_KX, INSTR_KX_LEN},
{"pattern_unify_t", INSTR_CAT_RRX, INSTR_RRX_LEN},
{"pattern_unify_p", INSTR_CAT_ERX, INSTR_ERX_LEN},
{"finish_unify", INSTR_CAT_X, INSTR_X_LEN},
{"head_normalize_t", INSTR_CAT_RX, INSTR_RX_LEN},
{"head_normalize_p", INSTR_CAT_EX, INSTR_EX_LEN},
{"incr_universe", INSTR_CAT_X, INSTR_X_LEN},
{"decr_universe", INSTR_CAT_X, INSTR_X_LEN},
{"set_univ_tag", INSTR_CAT_ECX, INSTR_ECX_LEN},
{"tag_exists_t", INSTR_CAT_RX, INSTR_RX_LEN},
{"tag_exists_p", INSTR_CAT_EX, INSTR_EX_LEN},
{"tag_variable", INSTR_CAT_EX, INSTR_EX_LEN},
{"push_impl_point", INSTR_CAT_I1ITX, INSTR_I1ITX_LEN},
{"pop_impl_point", INSTR_CAT_X, INSTR_X_LEN},
{"add_imports", INSTR_CAT_SEGI1LX, INSTR_SEGI1LX_LEN},
{"remove_imports", INSTR_CAT_SEGLX, INSTR_SEGLX_LEN},
{"push_import", INSTR_CAT_MTX, INSTR_MTX_LEN},
{"pop_imports", INSTR_CAT_I1X, INSTR_I1X_LEN},
{"allocate", INSTR_CAT_I1X, INSTR_I1X_LEN},
{"deallocate", INSTR_CAT_X, INSTR_X_LEN},
{"call", INSTR_CAT_I1LX, INSTR_I1LX_LEN},
{"call_name", INSTR_CAT_I1CWPX, INSTR_I1CWPX_LEN},
{"execute", INSTR_CAT_LX, INSTR_LX_LEN},
{"execute_name", INSTR_CAT_CWPX, INSTR_CWPX_LEN},
{"proceed", INSTR_CAT_X, INSTR_X_LEN},
{"try_me_else", INSTR_CAT_I1LX, INSTR_I1LX_LEN},
{"retry_me_else", INSTR_CAT_I1LX, INSTR_I1LX_LEN},
{"trust_me", INSTR_CAT_I1WPX, INSTR_I1WPX_LEN},
{"try", INSTR_CAT_I1LX, INSTR_I1LX_LEN},
{"retry", INSTR_CAT_I1LX, INSTR_I1LX_LEN},
{"trust", INSTR_CAT_I1LWPX, INSTR_I1LWPX_LEN},
{"trust_ext", INSTR_CAT_I1NX, INSTR_I1NX_LEN},
{"try_else", INSTR_CAT_I1LLX, INSTR_I1LLX_LEN},
{"retry_else", INSTR_CAT_I1LLX, INSTR_I1LLX_LEN},
{"branch", INSTR_CAT_LX, INSTR_LX_LEN},
{"switch_on_term", INSTR_CAT_LLLLX, INSTR_LLLLX_LEN},
{"switch_on_constant", INSTR_CAT_I1HTX, INSTR_I1HTX_LEN},
{"switch_on_bvar", INSTR_CAT_I1BVTX, INSTR_I1BVTX_LEN},
{"switch_on_reg", INSTR_CAT_NLLX, INSTR_NLLX_LEN},
{"neck_cut", INSTR_CAT_X, INSTR_X_LEN},
{"get_level", INSTR_CAT_EX, INSTR_EX_LEN},
{"put_level", INSTR_CAT_EX, INSTR_EX_LEN},
{"cut", INSTR_CAT_EX, INSTR_EX_LEN},
{"call_builtin", INSTR_CAT_I1I1WPX, INSTR_I1I1WPX_LEN},
{"builtin", INSTR_CAT_I1X, INSTR_I1X_LEN},
{"stop", INSTR_CAT_X, INSTR_X_LEN},
{"halt", INSTR_CAT_X, INSTR_X_LEN},
{"fail", INSTR_CAT_X, INSTR_X_LEN},
{"create_type_variable", INSTR_CAT_EX, INSTR_EX_LEN},
{"execute_link_only", INSTR_CAT_CWPX, INSTR_CWPX_LEN},
{"call_link_only", INSTR_CAT_I1CWPX, INSTR_I1CWPX_LEN},
{"put_variable_te", INSTR_CAT_RRX, INSTR_RRX_LEN}
};
/* Accessing functions */
INSTR_InstrCategory INSTR_instrType(int index)
{
return (INSTR_instrInfoTable[index]).type;
}
char* INSTR_instrName(int index)
{
return (INSTR_instrInfoTable[index]).name;
}
int INSTR_instrSize(int index)
{
return (INSTR_instrInfoTable[index]).size;
}

View File

@@ -0,0 +1,480 @@
/****************************************************************************/
/* File instructions.h. */
/* This file defines instruction operand types, instruction categories and */
/* instruction opcode. */
/****************************************************************************/
#ifndef INSTRUCTIONS_H
#define INSTRUCTIONS_H
#include "../simulator/mctypes.h" //to be changed
#include "../simulator/dataformats.h" //to be changed
/****************************************************************************/
/* OPERAND TYPES */
/****************************************************************************/
/* possible types of instruction operands */
typedef enum INSTR_OperandType
{
// (1 byte) padding
INSTR_P,
// (1 word) padding
INSTR_WP,
// argument register number
INSTR_R,
// environment variable number
INSTR_E,
// next clause number in impt or impl pt
INSTR_N,
// 1 byte natural number
INSTR_I1,
// closure environment variable number
INSTR_CE,
// import segment index
INSTR_SEG,
// constant symbol table index
INSTR_C,
// kind symbol table index
INSTR_K,
// code location
INSTR_L,
// integer immediate value
INSTR_I,
// floating point immediate value
INSTR_F,
// string pointer
INSTR_S,
// module table address
INSTR_MT,
// impl table address
INSTR_IT,
// hash table address
INSTR_HT,
// branch table for bound var indexing
INSTR_BVT,
// operand list terminator
INSTR_X
} INSTR_OperandType;
/**************************************************************************/
/* Types for instruction operants */
/**************************************************************************/
typedef Byte INSTR_OpCode;
typedef Byte INSTR_RegInd;
typedef Byte INSTR_EnvInd;
typedef Byte INSTR_NextClauseInd;
typedef Byte INSTR_OneByteInt;
typedef Byte INSTR_ClEnvInd;
typedef Byte INSTR_ImpSegInd;
typedef TwoBytes INSTR_CstIndex;
typedef TwoBytes INSTR_KstIndex;
typedef CSpacePtr INSTR_CodeLabel;
typedef int INSTR_Int;
typedef float INSTR_Float;
typedef DF_StrDataPtr INSTR_Str;
typedef MemPtr INSTR_ModTab;
typedef MemPtr INSTR_ImplTab;
typedef MemPtr INSTR_HashTab;
typedef MemPtr INSTR_BranchTab;
/***************************************************************************/
/* INSTRUCTION CATEGORIES */
/***************************************************************************/
/* The names of instruction categories no longer include padding bytes. */
/* Thus we do not need to maintain two sets of names for different machine */
/* architectures. */
typedef enum INSTR_InstrCategory
{
INSTR_CAT_X = 0,
INSTR_CAT_RX = 1,
INSTR_CAT_EX = 2,
INSTR_CAT_I1X = 3,
INSTR_CAT_CX = 4,
INSTR_CAT_KX = 5,
INSTR_CAT_IX = 6,
INSTR_CAT_FX = 7,
INSTR_CAT_SX = 8,
INSTR_CAT_MTX = 9,
INSTR_CAT_LX = 10,
INSTR_CAT_RRX = 11,
INSTR_CAT_ERX = 12,
INSTR_CAT_RCX = 13,
INSTR_CAT_RIX = 14,
INSTR_CAT_RFX = 15,
INSTR_CAT_RSX = 16,
INSTR_CAT_RI1X = 17,
INSTR_CAT_RCEX = 18,
INSTR_CAT_ECEX = 19,
INSTR_CAT_CLX = 20,
INSTR_CAT_RKX = 21,
INSTR_CAT_ECX = 22,
INSTR_CAT_I1ITX = 23,
INSTR_CAT_I1LX = 24,
INSTR_CAT_SEGLX = 25,
INSTR_CAT_I1LWPX = 26,
INSTR_CAT_I1NX = 27,
INSTR_CAT_I1HTX = 28,
INSTR_CAT_I1BVTX = 29,
INSTR_CAT_CWPX = 30,
INSTR_CAT_I1WPX = 31,
INSTR_CAT_RRI1X = 32,
INSTR_CAT_RCLX = 33,
INSTR_CAT_RCI1X = 34,
INSTR_CAT_SEGI1LX = 35,
INSTR_CAT_I1LLX = 36,
INSTR_CAT_NLLX = 37,
INSTR_CAT_LLLLX = 38,
INSTR_CAT_I1CWPX = 39,
INSTR_CAT_I1I1WPX = 40
} INSTR_InstrCategory;
#define INSTR_NUM_INSTR_CATS 41
#define INSTR_CALL_I1_LEN 7
/**************************************************************************/
/* Macros defines instruction lengths and distances between op code and */
/* operands. */
/* The assumption is that the op code occupies 1 byte. */
/**************************************************************************/
//INSTR_CAT_X
#define INSTR_X_LEN 4
//INSTR_CAT_RX
#define INSTR_RX_LEN 4
#define INSTR_RX_R 1
//INSTR_CAT_EX
#define INSTR_EX_LEN 4
#define INSTR_EX_E 1
//INSTR_CAT_I1X
#define INSTR_I1X_LEN 4
#define INSTR_I1X_I1 1
//INSTR_CAT_CX
#define INSTR_CX_LEN 4
#define INSTR_CX_C 2
//INSTR_CAT_KX
#define INSTR_KX_LEN 4
#define INSTR_KX_K 2
//INSTR_CAT_IX
#define INSTR_IX_LEN 8
#define INSTR_IX_I 4
//INSTR_CAT_FX
#define INSTR_FX_LEN 8
#define INSTR_FX_F 4
//INSTR_CAT_SX
#define INSTR_SX_LEN 8
#define INSTR_SX_S 4
//INSTR_CAT_MTX
#define INSTR_MTX_LEN 8
#define INSTR_MTX_MT 4
//INSTR_CAT_LX
#define INSTR_LX_LEN 8
#define INSTR_LX_L 4
//INSTR_CAT_RRX
#define INSTR_RRX_LEN 4
#define INSTR_RRX_R1 1
#define INSTR_RRX_R2 2
//INSTR_CAT_ERX
#define INSTR_ERX_LEN 4
#define INSTR_ERX_E 1
#define INSTR_ERX_R 2
//INSTR_CAT_RCX
#define INSTR_RCX_LEN 4
#define INSTR_RCX_R 1
#define INSTR_RCX_C 2
//INSTR_CAT_RIX
#define INSTR_RIX_LEN 8
#define INSTR_RIX_R 1
#define INSTR_RIX_I 4
//INSTR_CAT_RFX
#define INSTR_RFX_LEN 8
#define INSTR_RFX_R 1
#define INSTR_RFX_F 4
//INSTR_CAT_RSX
#define INSTR_RSX_LEN 8
#define INSTR_RSX_R 1
#define INSTR_RSX_S 4
//INSTR_CAT_RI1X
#define INSTR_RI1X_LEN 4
#define INSTR_RI1X_R 1
#define INSTR_RI1X_I1 2
//INSTR_CAT_RCEX
#define INSTR_RCEX_LEN 4
#define INSTR_RCEX_R 1
#define INSTR_RCEX_CE 2
//INSTR_CAT_ECEX
#define INSTR_ECEX_LEN 4
#define INSTR_ECEX_E 1
#define INSTR_ECEX_CE 2
//INSTR_CAT_CLX
#define INSTR_CLX_LEN 8
#define INSTR_CLX_C 2
#define INSTR_CLX_L 4
//INSTR_CAT_RKX
#define INSTR_RKX_LEN 4
#define INSTR_RKX_R 1
#define INSTR_RKX_K 2
//INSTR_CAT_ECX
#define INSTR_ECX_LEN 4
#define INSTR_ECX_E 1
#define INSTR_ECX_C 2
//INSTR_CAT_I1ITX
#define INSTR_I1ITX_LEN 8
#define INSTR_I1ITX_I1 1
#define INSTR_I1ITX_IT 4
//INSTR_CAT_I1LX
#define INSTR_I1LX_LEN 8
#define INSTR_I1LX_I1 1
#define INSTR_I1LX_L 4
//INSTR_CAT_SEGLX
#define INSTR_SEGLX_LEN 8
#define INSTR_SEGLX_SEG 1
#define INSTR_SEGLX_L 4
//INSTR_CAT_I1LWPX
#define INSTR_I1LWPX_LEN 12
#define INSTR_I1LWPX_I1 1
#define INSTR_I1LWPX_L 4
//INSTR_CAT_I1NX
#define INSTR_I1NX_LEN 4
#define INSTR_I1NX_I1 1
#define INSTR_I1NX_N 2
//INSTR_CAT_I1HTX
#define INSTR_I1HTX_LEN 8
#define INSTR_I1HTX_I1 1
#define INSTR_I1HTX_HT 4
//INSTR_CAT_I1BVTX
#define INSTR_I1BVTX_LEN 8
#define INSTR_I1BVTX_I1 1
#define INSTR_I1BVTX_BVT 4
//INSTR_CAT_CWPX
#define INSTR_CWPX_LEN 8
#define INSTR_CWPX_C 2
//INSTR_CAT_I1WPX
#define INSTR_I1WPX_LEN 8
#define INSTR_I1WPX_I1 1
//INSTR_CAT_RRI1X
#define INSTR_RRI1X_LEN 4
#define INSTR_RRI1X_R1 1
#define INSTR_RRI1X_R2 2
#define INSTR_RRI1X_I1 3
//INSTR_CAT_RCLX
#define INSTR_RCLX_LEN 8
#define INSTR_RCLX_R 1
#define INSTR_RCLX_C 2
#define INSTR_RCLX_L 4
//INSTR_CAT_RCI1X
#define INSTR_RCI1X_LEN 8
#define INSTR_RCI1X_R 1
#define INSTR_RCI1X_C 2
#define INSTR_RCI1X_I1 4
//INSTR_CAT_SEGI1LX
#define INSTR_SEGI1LX_LEN 8
#define INSTR_SEGI1LX_SEG 1
#define INSTR_SEGI1LX_I1 2
#define INSTR_SEGI1LX_L 4
//INSTR_CAT_I1LLX
#define INSTR_I1LLX_LEN 12
#define INSTR_I1LLX_I1 1
#define INSTR_I1LLX_L1 4
#define INSTR_I1LLX_L2 8
//INSTR_CAT_NLLX
#define INSTR_NLLX_LEN 12
#define INSTR_NLLX_N 1
#define INSTR_NLLX_L1 4
#define INSTR_NLLX_L2 8
//INSTR_CAT_LLLLX
#define INSTR_LLLLX_LEN 20
#define INSTR_LLLLX_L1 4
#define INSTR_LLLLX_L2 8
#define INSTR_LLLLX_L3 12
#define INSTR_LLLLX_L4 16
//INSTR_CAT_I1CWPX
#define INSTR_I1CWPX_LEN 8
#define INSTR_I1CWPX_I1 1
#define INSTR_I1CWPX_C 2
//INSTR_CAT_I1I1WPX
#define INSTR_I1I1WPX_LEN 8
#define INSTR_I1I1WPX_I11 1
#define INSTR_I1I1WPX_I12 2
/****************************************************************************/
/* OPERAND TYPES TABLE */
/****************************************************************************/
//the operand types array in a given entry
INSTR_OperandType* INSTR_operandTypes(INSTR_InstrCategory index);
/***************************************************************************/
/* OPCODES OF INSTRUCTIONS */
/***************************************************************************/
// Instructions for term unification and creation
#define put_variable_t 0
#define put_variable_p 1
#define put_value_t 2
#define put_value_p 3
#define put_unsafe_value 4
#define copy_value 5
#define put_m_const 6
#define put_p_const 7
#define put_nil 8
#define put_integer 9
#define put_float 10
#define put_string 11
#define put_index 12
#define put_app 13
#define put_list 14
#define put_lambda 15
#define set_variable_t 16
#define set_variable_te 17
#define set_variable_p 18
#define set_value_t 19
#define set_value_p 20
#define globalize_pt 21
#define globalize_t 22
#define set_m_const 23
#define set_p_const 24
#define set_nil 25
#define set_integer 26
#define set_float 27
#define set_string 28
#define set_index 29
#define set_void 30
#define deref 31
#define set_lambda 32
#define get_variable_t 33
#define get_variable_p 34
#define init_variable_t 35
#define init_variable_p 36
#define get_m_constant 37
#define get_p_constant 38
#define get_integer 39
#define get_float 40
#define get_string 41
#define get_nil 42
#define get_m_structure 43
#define get_p_structure 44
#define get_list 45
#define unify_variable_t 46
#define unify_variable_p 47
#define unify_value_t 48
#define unify_value_p 49
#define unify_local_value_t 50
#define unify_local_value_p 51
#define unify_m_constant 52
#define unify_p_constant 53
#define unify_integer 54
#define unify_float 55
#define unify_string 56
#define unify_nil 57
#define unify_void 58
// Instructions for type unification and creation
#define put_type_variable_t 59
#define put_type_variable_p 60
#define put_type_value_t 61
#define put_type_value_p 62
#define put_type_unsafe_value 63
#define put_type_const 64
#define put_type_structure 65
#define put_type_arrow 66
#define set_type_variable_t 67
#define set_type_variable_p 68
#define set_type_value_t 69
#define set_type_value_p 70
#define set_type_local_value_t 71
#define set_type_local_value_p 72
#define set_type_constant 73
#define get_type_variable_t 74
#define get_type_variable_p 75
#define init_type_variable_t 76
#define init_type_variable_p 77
#define get_type_value_t 78
#define get_type_value_p 79
#define get_type_constant 80
#define get_type_structure 81
#define get_type_arrow 82
#define unify_type_variable_t 83
#define unify_type_variable_p 84
#define unify_type_value_t 85
#define unify_type_value_p 86
#define unify_envty_value_t 87
#define unify_envty_value_p 88
#define unify_type_local_value_t 89
#define unify_type_local_value_p 90
#define unify_envty_local_value_t 91
#define unify_envty_local_value_p 92
#define unify_type_constant 93
// Instructions for handling higher-order aspects
#define pattern_unify_t 94
#define pattern_unify_p 95
#define finish_unify 96
#define head_normalize_t 97
#define head_normalize_p 98
// Instructions for handling logical aspects
#define incr_universe 99
#define decr_universe 100
#define set_univ_tag 101
#define tag_exists_t 102
#define tag_exists_p 103
#define tag_variable 104
#define push_impl_point 105
#define pop_impl_point 106
#define add_imports 107
#define remove_imports 108
#define push_import 109
#define pop_imports 110
// Control Instructions
#define allocate 111
#define deallocate 112
#define call 113
#define call_name 114
#define execute 115
#define execute_name 116
#define proceed 117
// Choice Instructions
#define try_me_else 118
#define retry_me_else 119
#define trust_me 120
#define try 121
#define retry 122
#define trust 123
#define trust_ext 124
#define try_else 125
#define retry_else 126
#define branch 127
// Indexing Instructions
#define switch_on_term 128
#define switch_on_constant 129
#define switch_on_bvar 130
#define switch_on_reg 131
// Cut Instructions
#define neck_cut 132
#define get_level 133
#define put_level 134
#define cut 135
// Miscellaneous Instructions
#define call_builtin 136
#define builtin 137
#define stop 138
#define halt 139
#define fail 140
// new added
#define create_type_variable 141
// resolved by the linker
#define execute_link_only 142
#define call_link_only 143
#define put_variable_te 144
#define INSTR_NUM_INSTRS 145
/***************************************************************************/
/* INSTRUCTION INFORMATION TABLE */
/***************************************************************************/
INSTR_InstrCategory INSTR_instrType(int index); //instr type in a given entry
char* INSTR_instrName(int index); //instr name in a given entry
int INSTR_instrSize(int index); //instr size in a given entry
#endif //INSTRUCTIONS_H

View File

@@ -0,0 +1,810 @@
/***************************************************************************/
/* File pervasives.c. */
/***************************************************************************/
#ifndef PERVASIVES_C
#define PERVASIVES_C
#include <string.h>
#include "pervasives.h"
#include "../system/error.h" //to be changed
#include "../system/operators.h" //to be changed
/****************************************************************************/
/* PERVASIVE KIND */
/****************************************************************************/
//pervasive kind data table (array)
PERV_KindData PERV_kindDataTab[PERV_KIND_NUM] = {
//name, arity
// int
{"int", 0},
// real
{"real", 0},
// bool
{"o", 0},
// string
{"string", 0},
// list type constructor
{"list", 1},
// in_stream
{"in_stream", 0},
// out_stream
{"out_stream", 0}
};
PERV_KindData PERV_getKindData(int index)
{
return PERV_kindDataTab[index];
}
void PERV_copyKindDataTab(PERV_KindData* dst)
{
//this way of copy relies on the assumption that the pervasive kind data
//has the same structure as that of the run-time kind symbol table entries.
memcpy((void*)dst, (void*)PERV_kindDataTab,
sizeof(PERV_KindData) * PERV_KIND_NUM);
}
/***************************************************************************/
/* TYPE SKELETIONS FOR PERVASIVE CONSTANTS */
/****************************************************************************/
//pervasive type skeleton table (array)
PERV_TySkelData PERV_tySkelTab[PERV_TY_SKEL_NUM];
//pervasive type skeletons and type skeleton table initialization
//The type skeletons are created in the memory of the system through malloc,
//and addresses are entered into the pervasive type skeleton table.
void PERV_tySkelTabInit()
{
int tySkelInd = 0; //ts tab index
MemPtr tySkelBase = (MemPtr)EM_malloc(WORD_SIZE * 336 ); //ts area
// A
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkSkelVarType(tySkelBase, 0);
tySkelBase += DF_TY_ATOMIC_SIZE;
// (list A)
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkStrType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkStrFuncType(tySkelBase, PERV_LIST_INDEX, 1);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSkelVarType(tySkelBase, 0);
tySkelBase += DF_TY_ATOMIC_SIZE;
// A->(list A)->(list A)
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSkelVarType(tySkelBase, 0);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkStrType(tySkelBase, (DF_TypePtr)(tySkelBase + 2 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkStrType(tySkelBase, (DF_TypePtr)(tySkelBase + 3 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkStrFuncType(tySkelBase, PERV_LIST_INDEX, 1);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSkelVarType(tySkelBase, 0);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkStrFuncType(tySkelBase, PERV_LIST_INDEX, 1);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSkelVarType(tySkelBase, 0);
tySkelBase += DF_TY_ATOMIC_SIZE;
// int
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkSortType(tySkelBase, PERV_INT_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// real
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkSortType(tySkelBase, PERV_REAL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// string
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkSortType(tySkelBase, PERV_STRING_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// o (type of proposition)
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkSortType(tySkelBase, PERV_BOOL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// int -> int
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_INT_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_INT_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// int -> int -> int
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_INT_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_INT_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_INT_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// int -> int -> o
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_INT_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_INT_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_BOOL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// int -> real
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_INT_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_REAL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// real -> int
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_REAL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_INT_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// real -> real
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_REAL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_REAL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// real -> string
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_REAL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_STRING_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// real -> real -> real
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_REAL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_REAL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_REAL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// real -> real -> o
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_REAL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_REAL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_BOOL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// string -> int
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_STRING_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_INT_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// int -> string
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_INT_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_STRING_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// string -> string -> string
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_STRING_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_STRING_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_STRING_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// string -> string -> o
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_STRING_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_STRING_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_BOOL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// string -> int -> int -> string
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_STRING_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_INT_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_INT_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_STRING_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// o -> o -> o
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_BOOL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_BOOL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_BOOL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// (A -> o) -> o
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 2 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_BOOL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSkelVarType(tySkelBase, 0);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_BOOL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// A -> A -> o
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSkelVarType(tySkelBase, 0);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSkelVarType(tySkelBase, 0);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_BOOL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// in_stream
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkSortType(tySkelBase, PERV_INSTREAM_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// out_stream
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkSortType(tySkelBase, PERV_OUTSTREAM_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// string -> in_stream -> o
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_STRING_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_INSTREAM_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_BOOL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// string -> out_stream -> o
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_STRING_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_OUTSTREAM_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_BOOL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// in_stream -> o
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_INSTREAM_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_BOOL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// out_stream -> o
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_OUTSTREAM_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_BOOL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// A -> string -> o
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSkelVarType(tySkelBase, 0);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_STRING_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_BOOL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// string -> A -> o
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_STRING_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSkelVarType(tySkelBase, 0);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_BOOL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// out_stream -> string -> o
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_OUTSTREAM_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_STRING_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_BOOL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// in_stream -> int -> string -> o
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_INSTREAM_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_INT_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_STRING_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_BOOL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// in_stream -> string -> o
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_INSTREAM_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_STRING_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_BOOL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// string -> o
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_STRING_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_BOOL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// A -> o
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSkelVarType(tySkelBase, 0);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_BOOL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// out_stream -> A -> o
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_OUTSTREAM_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSkelVarType(tySkelBase, 0);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_BOOL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// in_stream -> A -> o
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_INSTREAM_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSkelVarType(tySkelBase, 0);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_BOOL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// o -> o
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_BOOL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_BOOL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// string -> int -> in_stream -> out_stream -> o
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_STRING_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_INT_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_INSTREAM_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_OUTSTREAM_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_BOOL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
// string -> int -> o
PERV_tySkelTab[tySkelInd] = (PERV_TySkelData)tySkelBase;
tySkelInd++;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_STRING_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkArrowType(tySkelBase, (DF_TypePtr)(tySkelBase + 1 * DF_TY_ATOMIC_SIZE));
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_INT_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
DF_mkSortType(tySkelBase, PERV_BOOL_INDEX);
tySkelBase += DF_TY_ATOMIC_SIZE;
}
void PERV_copyTySkelTab(PERV_TySkelData* dst)
{
memcpy((void*)dst, (void*)PERV_tySkelTab,
sizeof(PERV_TySkelData) * PERV_KIND_NUM);
}
/***************************************************************************/
/* PERVASIVE CONSTANTS */
/***************************************************************************/
//pervasive constant data table (array)
PERV_ConstData PERV_constDataTab[PERV_CONST_NUM] = {
//name, tesize, tst, neededness, UC, prec, fixity
// logical and
{",", 0, 21, 0, 0, 110, OP_INFIXL},
// logical or
{";", 0, 21, 0, 0, 100, OP_INFIXL},
// existential quantifier
{"sigma", 1, 22, 1, 0, 0, OP_NONE},
// universal quantifier
{"pi", 1, 22, 1, 0, 0, OP_NONE},
// true proposition
{"true", 0, 6, 0, 0, 0, OP_NONE},
// cut predicate
{"!", 0, 6, 0, 0, 0, OP_NONE},
// fail predicate
{"fail", 0, 6, 0, 0, 0, OP_NONE},
//nothing
{NULL, 0, 0, 0, 0, OP_NONE },
// another logical and
{"&", 0, 21, 0, 0, 120, OP_INFIXR},
// halt the system
{"halt", 0, 6, 0, 0, 0, OP_NONE},
// return to top level
{"stop", 0, 6, 0, 0, 0, OP_NONE},
// Prolog if; needed?
{":-", 0, 21, 0, 0, 0, OP_INFIXL},
// implication; needed?
{"=>", 0, 21, 0, 0, 130, OP_INFIXR},
//nothing
{NULL, 0, 0, 0, 0, OP_NONE },
//nothing
{NULL, 0, 0, 0, 0, OP_NONE },
// solve; used by code generator
{"solve", 0, 39, 0, 0, 0, OP_NONE},
// is
{"is", 1, 23, 1, 0, 130, OP_INFIX},
// not
{"not", 0, 39, 0, 0, 0, OP_NONE},
// equality (unify) predicate
{"=", 1, 23, 1, 0, 130, OP_INFIX},
// less than on integers
{"<", 0, 9, 0, 0, 130, OP_INFIX},
// greater than on integers
{">", 0, 9, 0, 0, 130, OP_INFIX},
// less than or eq on integers
{"<=", 0, 9, 0, 0, 130, OP_INFIX},
// greater than or eq on integers
{">=", 0, 9, 0, 0, 130, OP_INFIX},
// less than in reals
{"<", 0, 15, 0, 0, 130, OP_INFIX},
// greater than on reals
{">", 0, 15, 0, 0, 130, OP_INFIX},
// less than or eq on reals
{"<=", 0, 15, 0, 0, 130, OP_INFIX},
// greater than or eq on reals
{">=", 0, 15, 0, 0, 130, OP_INFIX},
// less than on strings
{"<", 0, 19, 0, 0, 130, OP_INFIX},
// greater than on strings
{">", 0, 19, 0, 0, 130, OP_INFIX},
// less than or eq on strings
{"<=", 0, 19, 0, 0, 130, OP_INFIX},
// greater than or eq on strings
{">=", 0, 19, 0, 0, 130, OP_INFIX},
// open_in
{"open_in", 0, 26, 0, 0, 0, OP_NONE},
// open_out
{"open_out", 0, 27, 0, 0, 0, OP_NONE},
// open_append
{"open_append", 0, 27, 0, 0, 0, OP_NONE},
// close_in
{"close_in", 0, 28, 0, 0, 0, OP_NONE},
// close_out
{"close_out", 0, 29, 0, 0, 0, OP_NONE},
// open_string
{"open_string", 0, 26, 0, 0, 0, OP_NONE},
// input
{"input", 0, 33, 0, 0, 0, OP_NONE},
// output
{"output", 0, 32, 0, 0, 0, OP_NONE},
// input_line
{"input_line", 0, 34, 0, 0, 0, OP_NONE},
// lookahead
{"lookahead", 0, 34, 0, 0, 0, OP_NONE},
// eof
{"eof", 0, 28, 0, 0, 0, OP_NONE},
// flush
{"flush", 0, 29, 0, 0, 0, OP_NONE},
// print
{"print", 0, 35, 0, 0, 0, OP_NONE},
// read
{"read", 1, 36, 1, 0, 0, OP_NONE},
// printterm
{"printterm", 1, 37, 0, 0, 0, OP_NONE},
// term_to_string
{"term_to_string", 1, 30, 0, 0, 0, OP_NONE},
// string_to_term
{"string_to_term", 1, 31, 1, 0, 0, OP_NONE},
// readterm
{"readterm", 1, 38, 1, 0, 0, OP_NONE},
// getenv predicate; needed?
{"getenv", 0, 19, 0, 0, 0, OP_NONE},
// open_socket predicate
{"open_socket", 0, 40, 0, 0, 0, OP_NONE},
// time predicate
{"time", 0, 9, 0, 0, 0, OP_NONE},
// system predicate
{"system", 0, 41, 0, 0, 0, OP_NONE},
//nothing
{NULL, 0, 0, 0, 0, OP_NONE },
//nothing
{NULL, 0, 0, 0, 0, OP_NONE },
//nothing
{NULL, 0, 0, 0, 0, OP_NONE },
// unary minus on integers
{"-", 0, 7, 0, 0, 256, OP_PREFIX},
// addition on integers
{"+", 0, 8, 0, 0, 150, OP_INFIXL},
// subtraction on integers
{"-", 0, 8, 0, 0, 150, OP_INFIXL},
// mutiplication on integers
{"*", 0, 8, 0, 0, 160, OP_INFIXL},
// integer division
{"div", 0, 8, 0, 0, 160, OP_INFIXL},
// modulus
{"mod", 0, 7, 0, 0, 160, OP_INFIXL},
// coercion to real
{"int_to_real", 0, 10, 0, 0, 0, OP_NONE},
// integer abs
{"abs", 0, 7, 0, 0, 0, OP_NONE},
// unary minus on real
{"-", 0, 12, 0, 0, 256, OP_PREFIX},
// addition on reals
{"+", 0, 14, 0, 0, 150, OP_INFIXL},
// subtraction on reals
{"-", 0, 14, 0, 0, 150, OP_INFIXL},
// multiplication on reals
{"*", 0, 14, 0, 0, 160, OP_INFIXL},
// division
{"/", 0, 14, 0, 0, 160, OP_INFIXL},
// square root
{"sqrt", 0, 12, 0, 0, 0, OP_NONE},
// sine
{"sin", 0, 12, 0, 0, 0, OP_NONE},
// cosine
{"cos", 0, 12, 0, 0, 0, OP_NONE},
// arc tan
{"arctan", 0, 12, 0, 0, 0, OP_NONE},
// natural log
{"ln", 0, 12, 0, 0, 0, OP_NONE},
// floor function
{"floor", 0, 11, 0, 0, 0, OP_NONE},
// ceiling function
{"ceil", 0, 11, 0, 0, 0, OP_NONE},
// truncation
{"truncate", 0, 11, 0, 0, 0, OP_NONE},
// real abs
{"rabs", 0, 12, 0, 0, 0, OP_NONE},
// string concatination
{"^", 0, 18, 0, 0, 150, OP_INFIXL},
// string length
{"size", 0, 16, 0, 0, 0, OP_NONE},
// chr function
{"chr", 0, 17, 0, 0, 0, OP_NONE},
// ord function
{"string_to_int", 0, 16, 0, 0, 0, OP_NONE},
// substring
{"substring", 0, 20, 0, 0, 0, OP_NONE},
// int to string
{"int_to_string", 0, 17, 0, 0, 0, OP_NONE},
// real to string
{"real_to_string", 0, 13, 0, 0, 0, OP_NONE},
// for unnamed universal constants (Note: tesize should be 0)
{"<constant>", 0, 0, 0, 0, 0, OP_NONE},
// std_in
{"std_in", 0, 24, 0, 0, 0, OP_NONE},
// std_out
{"std_out", 0, 25, 0, 0, 0, OP_NONE},
// std_err
{"std_err", 0, 25, 0, 0, 0, OP_NONE},
// nil
{"nil", 0, 1, 0, 0, 0, OP_NONE},
// integer constant
{"<int_constant>", 0, 3, 0, 0, 0, OP_NONE},
// real constant
{"<real_constant>", 0, 4, 0, 0, 0, OP_NONE},
// string constant
{"<str_constant>", 0, 5, 0, 0, 0, OP_NONE},
// cons
{"::", 0, 2, 0, 0, 140, OP_INFIXR}
};
PERV_ConstData PERV_getConstData(int index)
{
return PERV_constDataTab[index];
}
void PERV_copyConstDataTab(PERV_ConstData* dst)
{
//this way of copy relies on the assumption that the pervasive kind data
//has the same structure as that of the run-time kind symbol table entries.
memcpy((void*)dst, (void*)PERV_constDataTab,
sizeof(PERV_ConstData) * PERV_CONST_NUM);
}
Boolean PERV_isLogicSymb(int index)
{
return ((index >= PERV_LSSTART) && (index <= PERV_LSEND));
}
Boolean PERV_isPredSymb(int index)
{
return ((index >= PERV_PREDSTART) && (index <= PERV_PREDEND));
}
PERV_LogicSymbTypes PERV_logicSymb(int index)
{
return ((PERV_LogicSymbTypes)(index - PERV_LSSTART));
}
int PERV_predBuiltin(int index)
{
return (index - PERV_PREDSTART);
}
#endif //PERVASIVES_C

View File

@@ -0,0 +1,326 @@
/****************************************************************************/
/* File pervasives.h. */
/****************************************************************************/
#ifndef PERVASIVES_H
#define PERVASIVES_H
#include "../simulator/mctypes.h" //to be changed
#include "../simulator/dataformats.h" //to be changed
/****************************************************************************/
/* PERVASIVE KIND */
/****************************************************************************/
//indices for predefined sorts and type constructors
typedef enum PERV_KindIndexType
{
// int
PERV_INT_INDEX = 0,
// real
PERV_REAL_INDEX = 1,
// bool
PERV_BOOL_INDEX = 2,
// string
PERV_STRING_INDEX = 3,
// list type constructor
PERV_LIST_INDEX = 4,
// in_stream
PERV_INSTREAM_INDEX = 5,
// out_stream
PERV_OUTSTREAM_INDEX = 6
} PERV_KindIndexType;
//total number of pervasive kinds
#define PERV_KIND_NUM 7
//pervasive kind data type
typedef struct
{
char *name;
TwoBytes arity;
} PERV_KindData;
//pervasive kind data table (array)
extern PERV_KindData PERV_kindDataTab[PERV_KIND_NUM];
//pervasive kind data access function
PERV_KindData PERV_getKindData(int index);
//pervasive kind table copy function (used in module space initialization)
//this functiion relies on the assumption that the pervasive kind data
//has the same structure as that of the run-time kind symbol table entries.
void PERV_copyKindDataTab(PERV_KindData* dst);
/***************************************************************************/
/* TYPE SKELETIONS FOR PERVASIVE CONSTANTS */
/****************************************************************************/
//total number of type skeletons needed for pervasive constants
#define PERV_TY_SKEL_NUM 42
//pervasive type skel data type
typedef DF_TypePtr PERV_TySkelData;
//pervasive type skel table (array)
extern PERV_TySkelData PERV_tySkelTab[PERV_TY_SKEL_NUM];
//pervasive type skeletons and type skeleton table initialization
//Note that type skeltons have to be dynamically allocated, and so does the
//info recorded in each entry of the pervasive type skeleton table
void PERV_tySkelTabInit();
//pervasive tyskel table copy function
void PERV_copyTySkelTab(PERV_TySkelData* dst);
/***************************************************************************/
/* PERVASIVE CONSTANTS */
/***************************************************************************/
//indices for predefined constants
typedef enum PERV_ConstIndexType
{
// logical and
PERV_AND_INDEX = 0,
// logical or
PERV_OR_INDEX = 1,
// existential quantifier
PERV_SOME_INDEX = 2,
// universal quantifier
PERV_ALL_INDEX = 3,
// true proposition
PERV_TRUE_INDEX = 4,
// cut predicate
PERV_CUT_INDEX = 5,
// fail predicate
PERV_FAIL_INDEX = 6,
// empty
// another logical and
PERV_AMPAND_INDEX = 8,
// halt the system
PERV_HALT_INDEX = 9,
// return to top level
PERV_STOP_INDEX = 10,
// Prolog if; needed?
PERV_COLONDASH_INDEX = 11,
// implication; needed?
PERV_IMPL_INDEX = 12,
// empty
// empty
// solve; used by code generator
PERV_SOLVE_INDEX = 15,
// is
PERV_IS_INDEX = 16,
// not
PERV_NOT_INDEX = 17,
// equality (unify) predicate
PERV_EQ_INDEX = 18,
// less than on integers
PERV_INTLSS_INDEX = 19,
// greater than on integers
PERV_INTGRT_INDEX = 20,
// less than or eq on integers
PERV_INTLEQ_INDEX = 21,
// greater than or eq on integers
PERV_INTGEQ_INDEX = 22,
// less than in reals
PERV_REALLSS_INDEX = 23,
// greater than on reals
PERV_REALGRT_INDEX = 24,
// less than or eq on reals
PERV_REALLEQ_INDEX = 25,
// greater than or eq on reals
PERV_REALGEQ_INDEX = 26,
// less than on strings
PERV_STRLSS_INDEX = 27,
// greater than on strings
PERV_STRGRT_INDEX = 28,
// less than or eq on strings
PERV_STRLEQ_INDEX = 29,
// greater than or eq on strings
PERV_STRGEQ_INDEX = 30,
// open_in
PERV_OPENIN_INDEX = 31,
// open_out
PERV_OPENOUT_INDEX = 32,
// open_append
PERV_OPENAPP_INDEX = 33,
// close_in
PERV_CLOSEIN_INDEX = 34,
// close_out
PERV_CLOSEOUT_INDEX = 35,
// open_string
PERV_OPENSTR_INDEX = 36,
// input
PERV_INPUT_INDEX = 37,
// output
PERV_OUTPUT_INDEX = 38,
// input_line
PERV_INPUTLINE_INDEX = 39,
// lookahead
PERV_LOOKAHEAD_INDEX = 40,
// eof
PERV_EOF_INDEX = 41,
// flush
PERV_FLUSH_INDEX = 42,
// print
PERV_PRINT_INDEX = 43,
// read
PERV_READ_INDEX = 44,
// printterm
PERV_PRINTTERM_INDEX = 45,
// term_to_string
PERV_TERMTOSTR_INDEX = 46,
// string_to_term
PERV_STRTOTERM_INDEX = 47,
// readterm
PERV_READTERM_INDEX = 48,
// getenv predicate; needed?
PERV_GETENV_INDEX = 49,
// open_socket predicate
PERV_OPENSOCKET_INDEX = 50,
// time predicate
PERV_TIME_INDEX = 51,
// system predicate
PERV_SYSTEM_INDEX = 52,
// empty
// empty
// empty
// unary minus on integers
PERV_INTUMINUS_INDEX = 56,
// addition on integers
PERV_INTPLUS_INDEX = 57,
// subtraction on integers
PERV_INTMINUS_INDEX = 58,
// mutiplication on integers
PERV_INTMULT_INDEX = 59,
// integer division
PERV_INTDIV_INDEX = 60,
// modulus
PERV_MOD_INDEX = 61,
// coercion to real
PERV_ITOR_INDEX = 62,
// integer abs
PERV_IABS_INDEX = 63,
// unary minus on real
PERV_REALUMINUS_INDEX = 64,
// addition on reals
PERV_REALPLUS_INDEX = 65,
// subtraction on reals
PERV_REALMINUS_INDEX = 66,
// multiplication on reals
PERV_REALMULT_INDEX = 67,
// division
PERV_REALDIV_INDEX = 68,
// square root
PERV_SQRT_INDEX = 69,
// sine
PERV_SIN_INDEX = 70,
// cosine
PERV_COS_INDEX = 71,
// arc tan
PERV_ARCTAN_INDEX = 72,
// natural log
PERV_LOG_INDEX = 73,
// floor function
PERV_FLOOR_INDEX = 74,
// ceiling function
PERV_CEIL_INDEX = 75,
// truncation
PERV_TRUNC_INDEX = 76,
// real abs
PERV_RABS_INDEX = 77,
// string concatination
PERV_SCAT_INDEX = 78,
// string length
PERV_SLEN_INDEX = 79,
// chr function
PERV_ITOCHR_INDEX = 80,
// ord function
PERV_STOI_INDEX = 81,
// substring
PERV_SUBSTR_INDEX = 82,
// int to string
PERV_ITOSTR_INDEX = 83,
// real to string
PERV_RTOS_INDEX = 84,
// for unnamed universal constants (Note: tesize should be 0)
PERV_UNIV_INDEX = 85,
// std_in
PERV_STDIN_INDEX = 86,
// std_out
PERV_STDOUT_INDEX = 87,
// std_err
PERV_STDERR_INDEX = 88,
// nil
PERV_NIL_INDEX = 89,
// integer constant
PERV_INTC_INDEX = 90,
// real constant
PERV_REALC_INDEX = 91,
// string constant
PERV_STRC_INDEX = 92,
// cons
PERV_CONS_INDEX = 93
} PERV_ConstIndexType;
//total number pervasive constants
#define PERV_CONST_NUM 94
//pervasive const data type
typedef struct
{
char *name;
TwoBytes typeEnvSize;
TwoBytes tskTabIndex; //index to the type skeleton table
TwoBytes neededness; //neededness (predicate constant)
TwoBytes univCount;
int precedence;
int fixity;
} PERV_ConstData;
//pervasive const data table (array)
extern PERV_ConstData PERV_constDataTab[PERV_CONST_NUM];
//pervasive const data access function
PERV_ConstData PERV_getConstData(int index);
//pervasive const table copy function (used in module space initialization)
//this functiion relies on the assumption that the pervasive kind data
//has the same structure as that of the run-time kind symbol table entries.
void PERV_copyConstDataTab(PERV_ConstData* dst);
#define PERV_LSSTART PERV_AND_INDEX //begin of interpretable symbols
#define PERV_LSEND PERV_STOP_INDEX //end of interpretable symbols
#define PERV_PREDSTART PERV_SOLVE_INDEX //begin of predicate symbols
#define PERV_PREDEND PERV_SYSTEM_INDEX //end of predicate symbols
typedef enum PERV_LogicSymbTypes
{
PERV_AND = 0,
PERV_OR = 1,
PERV_SOME = 2,
PERV_ALL = 3,
PERV_L_TRUE = 4,
PERV_CUT = 5,
PERV_FAIL = 6,
PERV_EQ = 7,
PERV_AMPAND = 8,
PERV_HALT = 9,
PERV_STOP = 10,
} PERV_LogicSymbTypes;
//functions used by the simulator for interpreted goals
Boolean PERV_isLogicSymb(int index);
Boolean PERV_isPredSymb(int index);
PERV_LogicSymbTypes PERV_logicSymb(int index);
int PERV_predBuiltin(int index);
#endif //PERVASIVES_H

View File

@@ -0,0 +1,152 @@
//////////////////////////////////////////////////////////////////////////////
//Copyright 2008
// Andrew Gacek, Steven Holte, Gopalan Nadathur, Xiaochu Qi, Zach Snow
//////////////////////////////////////////////////////////////////////////////
// This file is part of Teyjus. //
// //
// Teyjus is free software: you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation, either version 3 of the License, or //
// (at your option) any later version. //
// //
// Teyjus is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with Teyjus. If not, see <http://www.gnu.org/licenses/>. //
//////////////////////////////////////////////////////////////////////////////
/***************************************************************************/
/* File pervinit.h{c}. */
/* Functions for setting up the symbol tables of pervasive constants and */
/* kinds are provided. */
/***************************************************************************/
#include <string.h>
#include <stdio.h>
#include "pervinit.h"
#include "pervasives.h"
#include "../system/memory.h"
#include "../simulator/dataformats.h"
#include "../simulator/mcstring.h"
#include "../simulator/mctypes.h"
DF_StrDataPtr PERVINIT_writeName(char* name)
{
int length = strlen(name);
MemPtr rtPtr, mcStr;
rtPtr = (MemPtr)MEM_memExtend(MCSTR_numWords(length) +
DF_STRDATA_HEAD_SIZE);
mcStr = rtPtr + DF_STRDATA_HEAD_SIZE;
//create data head
DF_mkStrDataHead((MemPtr)rtPtr);
//create the string data
MCSTR_toString((MCSTR_Str)mcStr, name, length);
return (DF_StrDataPtr)rtPtr;
}
/***************************************************************************/
/* PERVASIVE KINDS */
/***************************************************************************/
MEM_KstEnt PERVINIT_kindDataTab[PERV_KIND_NUM];
/* Set up pervasive kind symbol table. */
/* The kind names are supposed to be written in the current top of system */
/* memory. */
static void PERVINIT_kindTabInit()
{
int tabInd;
for (tabInd = 0; tabInd < PERV_KIND_NUM; tabInd++) {
if (PERV_kindDataTab[tabInd].name)
PERVINIT_kindDataTab[tabInd].name=
PERVINIT_writeName(PERV_kindDataTab[tabInd].name);
else PERVINIT_kindDataTab[tabInd].name = NULL;
PERVINIT_kindDataTab[tabInd].arity=PERV_kindDataTab[tabInd].arity;
}
}
/* copy the pervasive kind table into given address */
void PERVINIT_copyKindDataTab(MEM_KstPtr dst)
{
memcpy((void*)dst, (void*)PERVINIT_kindDataTab,
MEM_KST_ENTRY_SIZE * WORD_SIZE * PERV_KIND_NUM);
}
/***************************************************************************/
/* PERVASIVE TYPE SKELETONS */
/***************************************************************************/
MEM_TstPtr PERVINIT_tySkelTab;
/* Set up pervasive type skeleton table. */
static void PERVINIT_tySkelTabInit()
{
PERVINIT_tySkelTab = PERV_tySkelTab;
PERV_tySkelTabInit();
}
/* copy the pervasive type skeleton table into given address */
void PERVINIT_copyTySkelTab(PERV_TySkelData* dst)
{
memcpy((void*)dst, (void*)PERVINIT_tySkelTab,
MEM_TST_ENTRY_SIZE * WORD_SIZE * PERV_TY_SKEL_NUM);
}
/***************************************************************************/
/* PERVASIVE CONSTANTS */
/***************************************************************************/
MEM_CstEnt PERVINIT_constDataTab[PERV_CONST_NUM];
/* Set up pervasive constant symbol table. */
/* The constant names are supposed to be written in the current top of */
/* system memory. */
static void PERVINIT_constTabInit()
{
int tabInd;
for (tabInd = 0; tabInd < PERV_CONST_NUM; tabInd++) {
if (PERV_constDataTab[tabInd].name)
PERVINIT_constDataTab[tabInd].name =
PERVINIT_writeName(PERV_constDataTab[tabInd].name);
else PERVINIT_constDataTab[tabInd].name = NULL;
PERVINIT_constDataTab[tabInd].typeEnvSize =
PERV_constDataTab[tabInd].typeEnvSize;
PERVINIT_constDataTab[tabInd].tskTabIndex =
PERV_constDataTab[tabInd].tskTabIndex;
PERVINIT_constDataTab[tabInd].neededness =
PERV_constDataTab[tabInd].neededness;
PERVINIT_constDataTab[tabInd].univCount =
PERV_constDataTab[tabInd].univCount;
PERVINIT_constDataTab[tabInd].precedence =
PERV_constDataTab[tabInd].precedence;
PERVINIT_constDataTab[tabInd].fixity =
PERV_constDataTab[tabInd].fixity;
}
}
/* copy the pervsive constant table into given address */
void PERVINIT_copyConstDataTab(MEM_CstPtr dst)
{
memcpy((void*)dst, (void*)PERVINIT_constDataTab,
MEM_CST_ENTRY_SIZE * WORD_SIZE * PERV_CONST_NUM);
}
/***************************************************************************/
/* PERVASIVE TABLES INITIALIZATION */
/* Fill in the actual pervasive tables; create string data needed for names*/
/* onto the current top of the system memory; create the type skeletons in */
/* a malloced space. */
/***************************************************************************/
void PERVINIT_tableInit()
{
PERVINIT_kindTabInit();
PERVINIT_tySkelTabInit();
PERVINIT_constTabInit();
}

View File

@@ -0,0 +1,73 @@
//////////////////////////////////////////////////////////////////////////////
//Copyright 2008
// Andrew Gacek, Steven Holte, Gopalan Nadathur, Xiaochu Qi, Zach Snow
//////////////////////////////////////////////////////////////////////////////
// This file is part of Teyjus. //
// //
// Teyjus is free software: you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation, either version 3 of the License, or //
// (at your option) any later version. //
// //
// Teyjus is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with Teyjus. If not, see <http://www.gnu.org/licenses/>. //
//////////////////////////////////////////////////////////////////////////////
/***************************************************************************/
/* File pervinit.h{c}. */
/* Functions for setting up the symbol tables of pervasive constants and */
/* kinds are provided. */
/***************************************************************************/
#ifndef PERVINIT_H
#define PERVINIT_H
#include "../simulator/dataformats.h" //to be modified
#include "../system/memory.h" //to be modified
#include "pervasives.h"
#include "../simulator/mctypes.h"
/***************************************************************************/
/* PERVASIVE KINDS */
/***************************************************************************/
//the actual pervasive kind table get copied during loading
extern MEM_KstEnt PERVINIT_kindDataTab[PERV_KIND_NUM];
/* copy the pervasive kind table into given address */
void PERVINIT_copyKindDataTab(MEM_KstPtr dst);
/***************************************************************************/
/* PERVASIVE TYPE SKELETONS */
/***************************************************************************/
//pervasive type skeleton table
extern MEM_TstPtr PERVINIT_tySkelTab;
/* copy the pervasive type skeleton table into given address */
void PERVINIT_copyTySkelTab(MEM_TstPtr dst);
/***************************************************************************/
/* PERVASIVE CONSTANTS */
/***************************************************************************/
//the acutual pervasive constant table get copied during loading
extern MEM_CstEnt PERVINIT_constDataTab[PERV_CONST_NUM];
/* copy the pervasive constant table into given address */
void PERVINIT_copyConstDataTab(MEM_CstPtr dst);
/***************************************************************************/
/* PERVASIVE TABLES INITIALIZATION */
/* Fill in the actual pervasive tables; create string data needed for names*/
/* onto the current top of the system memory; create the type skeletons in */
/* a malloced space. */
/***************************************************************************/
void PERVINIT_tableInit();
#endif //PERVINIT_H