tldm-universe/Ardent/UV/gcidir/include/pi.optab.h

209 lines
9.3 KiB
C
Raw Permalink Normal View History

2024-09-09 21:51:08 +00:00
/******************************************************************************
*
* INFO/BASIC de-compiler include file defining the opcode tables
*
* Module %M% Version %I% Date %H%
*
* (c) Copyright 1998 Ardent Software Inc. - All Rights Reserved
* This is unpublished proprietary source code of Ardent Software Inc.
* The copyright notice above does not evidence any actual or intended
* publication of such source code.
*
*******************************************************************************
*
* Maintenence log - insert most recent change descriptions at top
*
* Date.... GTAR# WHO Description.........................................
* 10/14/98 23801 SAP Change copyrights.
* 07/14/94 14444 NDP Removed __MODULE__ and __SCCSID__ definitions.
* 06/23/94 14421 PGW Initial implementation
*
******************************************************************************/
/*
* This include file defines a set of data tables (initialized in
* pi.optab.c) used by the decompiler program to hold data about all
* the opcodes used in INFO/BASIC object code (.IRUN) files.
* It also contains the #define statements which assign symbolic names
* to the fields and used.
*/
/*
* Each table entry is a structure of the type defined here:
*/
typedef struct opcode_table_str OP_TABLE_TYPE, *OP_TABLE_PTR;
struct opcode_table_str {
int op_type;
int op_priority;
char * op_name;
int op_args;
char * op_template;
char * op_flags;
int (*op_function) proto((OP_TABLE_PTR));
};
/*
* op_type is the opcode type, containing one of the following values:
*/
#define OF_UNKNOWN 'U' /* Invalid/ illegal opcode */
#define OF_FUNCTION 'F' /* Function ) These opcodes do not */
/* /Operator ) have data bytes */
#define OF_STATEMENT 'S' /* Statement ) following them. */
#define OF_SPECIAL 'X' /* Special ) */
#define OF_1BYTE 'B' /* 1-Byte ) */
#define OF_INTEGER 'I' /* Integer ) These opcodes all */
#define OF_ALIST 'L' /* Addr List ) have data bytes */
#define OF_FLOAT 'R' /* Float ) following them in */
#define OF_STRING 'G' /* String ) the opcode stream. */
#define OF_LOCADDR 'V' /* Var (loc) ) */
#define OF_COMADDR 'C' /* Var (com) ) */
#define OF_COMMON 'D' /* COMMON ) */
#define OF_ADDR 'A' /* Address ) */
#define OF_MONITOR 'M' /* Monitor ) */
/*
* op_priority is the priority of this operator. The program uses a
* priority scheme to introduce parentheses where necessary to ensure
* that the order of evaluation is preserved. The idea is only to put in
* parentheses where necessary, rather than round every sub-expression,
* which would be the easy way out but would result in unreadable
* code. Priority only applies to opcodes of type F (Function).
* Priority values run from 0 (the highest) to 8 (the lowest).
*
* op_name is the opcode name.
* It is passed as the message ID when expanding the template.
*
* op_args is the number of stack items that this opcode uses.
*
* op_template is a CMH template which is expanded to obtain the
* INFO/BASIC text associated with this opcode. Arguments <1>, <2>,
* and so on are the values from the stack, in the order in which they
* were pushed onto the stack. If the opcode has flag U (UNIT.NO) set,
* then argument <1> will either contain "ON expression" or "",
* and arguments from the stack will be in <2> onwards. If the opcode
* has flag S (select list number) set, then the saved select list number
* will be added to the end as a final argument.
*
* op_flags contains flags indicating aspects of the resulting statement
* that might need special treatment. If a particular character is present
* in the value of this field, the associated flag is set. Characters are:
*
* A Assign This statement assigns to its first argument.
* E ERROR This statement can take an ON ERROR clause.
* L LOCKED This statement can take a LOCKED clause.
* T THEN This statement takes a THEN and/or ELSE clause.
* C Continue Suppress the normal end-of-line, to handle the
* case where THEN/ELSE must be on the same line.
* U UNIT.NO This statement can take an "ON unit.no" clause.
* u UNIT.NO Like 'U', but the saved print unit is not cleared.
* 1 First argument is a matrix and should not be resolved.
* 2 Second argument is a matrix and should not be resolved.
* S SELNUM This statement can take a saved select list number
*
* op_function is the function to be called to deal with an occurrence
* of this particular opcode.
*/
/*
* op_table contains data for all single-byte opcodes.
*/
extern OP_TABLE_TYPE op_table[];
/*
* op95_table contains data for all 95-nnn opcodes.
*/
extern OP_TABLE_TYPE op95_table[];
/*
* op45_table contains data for all 45-nnn opcodes.
*/
extern OP_TABLE_TYPE op45_table[];
/*
* selindx_table contains data for the variants on the SELINDX
* opcode.
*/
extern OP_TABLE_TYPE selindx_table[];
/*
* if_expr_table is a special table entry for conditional expressions.
*/
extern OP_TABLE_TYPE if_expr_table;
/*
* replace_stmt, ins_stmt, and del_stmt are special table entries
* for dynamic array assignment, the INS statement, and the DEL
* statement, respectively.
*/
extern OP_TABLE_TYPE replace_stmt;
extern OP_TABLE_TYPE ins_stmt;
extern OP_TABLE_TYPE del_stmt;
/*
* sma_locate_stmt is a special entry for the SMA form of LOCATE.
*/
extern OP_TABLE_TYPE sma_locate_stmt;
/***********************************************************************
* function declarations for all functions used (defined in decomp.c)
***********************************************************************/
/* General opcode functions */
int dc_function proto((OP_TABLE_PTR op_ptr));
int dc_invalid proto((OP_TABLE_PTR op_ptr));
int dc_statement proto((OP_TABLE_PTR op_ptr));
int dc_unsupported proto((OP_TABLE_PTR op_ptr));
/* Specific opcode functions */
int dc_bindcom proto((OP_TABLE_PTR op_ptr));
int dc_brl proto((OP_TABLE_PTR op_ptr));
int dc_brlfals proto((OP_TABLE_PTR op_ptr));
int dc_brlnerr proto((OP_TABLE_PTR op_ptr));
int dc_brltrue proto((OP_TABLE_PTR op_ptr));
int dc_brs proto((OP_TABLE_PTR op_ptr));
int dc_call proto((OP_TABLE_PTR op_ptr));
int dc_delete proto((OP_TABLE_PTR op_ptr));
int dc_dimlcl proto((OP_TABLE_PTR op_ptr));
int dc_dimcom proto((OP_TABLE_PTR op_ptr));
int dc_dimicom proto((OP_TABLE_PTR op_ptr));
int dc_dup proto((OP_TABLE_PTR op_ptr));
int dc_execute proto((OP_TABLE_PTR op_ptr));
int dc_filelock proto((OP_TABLE_PTR op_ptr));
int dc_forinit proto((OP_TABLE_PTR op_ptr));
int dc_fortst proto((OP_TABLE_PTR op_ptr));
int dc_gosub proto((OP_TABLE_PTR op_ptr));
int dc_indxary proto((OP_TABLE_PTR op_ptr));
int dc_inputat proto((OP_TABLE_PTR op_ptr));
int dc_inputop proto((OP_TABLE_PTR op_ptr));
int dc_insert proto((OP_TABLE_PTR op_ptr));
int dc_ldcom proto((OP_TABLE_PTR op_ptr));
int dc_ldfloat proto((OP_TABLE_PTR op_ptr));
int dc_ldioopt proto((OP_TABLE_PTR op_ptr));
int dc_ldlint proto((OP_TABLE_PTR op_ptr));
int dc_ldstr proto((OP_TABLE_PTR op_ptr));
int dc_ldvar proto((OP_TABLE_PTR op_ptr));
int dc_locate proto((OP_TABLE_PTR op_ptr));
int dc_mark proto((OP_TABLE_PTR op_ptr));
int dc_marki proto((OP_TABLE_PTR op_ptr));
int dc_monitor proto((OP_TABLE_PTR op_ptr));
int dc_nop proto((OP_TABLE_PTR op_ptr));
int dc_ongo proto((OP_TABLE_PTR op_ptr));
int dc_onerr proto((OP_TABLE_PTR op_ptr));
int dc_op45 proto((OP_TABLE_PTR op_ptr));
int dc_op95 proto((OP_TABLE_PTR op_ptr));
int dc_page proto((OP_TABLE_PTR op_ptr));
int dc_readl proto((OP_TABLE_PTR op_ptr));
int dc_readlist proto((OP_TABLE_PTR op_ptr));
int dc_readnx2 proto((OP_TABLE_PTR op_ptr));
int dc_recordlock proto((OP_TABLE_PTR op_ptr));
int dc_replace proto((OP_TABLE_PTR op_ptr));
int dc_return2 proto((OP_TABLE_PTR op_ptr));
int dc_selindx proto((OP_TABLE_PTR op_ptr));
int dc_setpnum proto((OP_TABLE_PTR op_ptr));
int dc_setprun proto((OP_TABLE_PTR op_ptr));
int dc_sma proto((OP_TABLE_PTR op_ptr));
int dc_sselnum proto((OP_TABLE_PTR op_ptr));
int dc_stop proto((OP_TABLE_PTR op_ptr));
int dc_store proto((OP_TABLE_PTR op_ptr));