Port sc6 to C++.

This commit is contained in:
David Anderson 2014-08-22 00:07:40 -07:00
parent 142fbaafdd
commit 3eb1faa470
4 changed files with 177 additions and 177 deletions

View File

@ -87,7 +87,7 @@ binary.sources += [
'sc3.c', 'sc3.c',
'sc4.c', 'sc4.c',
'sc5.c', 'sc5.c',
'sc6.c', 'sc6.cpp',
'sc7.cpp', 'sc7.cpp',
'scexpand.cpp', 'scexpand.cpp',
'sci18n.cpp', 'sci18n.cpp',

View File

@ -79,7 +79,7 @@ typedef struct tagAMX_DBG_HDR {
typedef struct tagAMX_DBG_FILE { typedef struct tagAMX_DBG_FILE {
ucell address PACKED; /* address in the code segment where generated code (for this file) starts */ ucell address PACKED; /* address in the code segment where generated code (for this file) starts */
const char name[1]; /* ASCII string, zero-terminated */ char name[1]; /* ASCII string, zero-terminated */
} PACKED AMX_DBG_FILE; } PACKED AMX_DBG_FILE;
typedef struct tagAMX_DBG_LINE { typedef struct tagAMX_DBG_LINE {
@ -95,7 +95,7 @@ typedef struct tagAMX_DBG_SYMBOL {
char ident; /* kind of symbol (function/variable) */ char ident; /* kind of symbol (function/variable) */
char vclass; /* class of symbol (global/local) */ char vclass; /* class of symbol (global/local) */
int16_t dim PACKED; /* number of dimensions */ int16_t dim PACKED; /* number of dimensions */
const char name[1]; /* ASCII string, zero-terminated */ char name[1]; /* ASCII string, zero-terminated */
} PACKED AMX_DBG_SYMBOL; } PACKED AMX_DBG_SYMBOL;
typedef struct tagAMX_DBG_SYMDIM { typedef struct tagAMX_DBG_SYMDIM {
@ -105,19 +105,19 @@ typedef struct tagAMX_DBG_SYMDIM {
typedef struct tagAMX_DBG_TAG { typedef struct tagAMX_DBG_TAG {
int16_t tag PACKED; /* tag id */ int16_t tag PACKED; /* tag id */
const char name[1]; /* ASCII string, zero-terminated */ char name[1]; /* ASCII string, zero-terminated */
} PACKED AMX_DBG_TAG; } PACKED AMX_DBG_TAG;
typedef struct tagAMX_DBG_MACHINE { typedef struct tagAMX_DBG_MACHINE {
int16_t automaton PACKED; /* automaton id */ int16_t automaton PACKED; /* automaton id */
ucell address PACKED; /* address of state variable */ ucell address PACKED; /* address of state variable */
const char name[1]; /* ASCII string, zero-terminated */ char name[1]; /* ASCII string, zero-terminated */
} PACKED AMX_DBG_MACHINE; } PACKED AMX_DBG_MACHINE;
typedef struct tagAMX_DBG_STATE { typedef struct tagAMX_DBG_STATE {
int16_t state PACKED; /* state id */ int16_t state PACKED; /* state id */
int16_t automaton PACKED; /* automaton id */ int16_t automaton PACKED; /* automaton id */
const char name[1]; /* ASCII string, zero-terminated */ char name[1]; /* ASCII string, zero-terminated */
} PACKED AMX_DBG_STATE; } PACKED AMX_DBG_STATE;
typedef struct tagAMX_DBG { typedef struct tagAMX_DBG {

View File

@ -44,7 +44,7 @@ typedef cell (*OPCODE_PROC)(FILE *fbin,char *params,cell opcode);
typedef struct { typedef struct {
cell opcode; cell opcode;
char *name; const char *name;
int segment; /* sIN_CSEG=parse in cseg, sIN_DSEG=parse in dseg */ int segment; /* sIN_CSEG=parse in cseg, sIN_DSEG=parse in dseg */
OPCODE_PROC func; OPCODE_PROC func;
} OPCODEC; } OPCODEC;

View File

@ -45,13 +45,13 @@ typedef struct {
const char *find; const char *find;
const char *replace; const char *replace;
int savesize; /* number of bytes saved (in bytecode) */ int savesize; /* number of bytes saved (in bytecode) */
} PRE_SEQUENCE; } SETUP_SEQUENCE;
typedef struct { typedef struct {
char *find; char *find;
char *replace; char *replace;
int savesize; /* number of bytes saved (in bytecode) */ int savesize; /* number of bytes saved (in bytecode) */
} SEQUENCE; } SEQUENCE;
static PRE_SEQUENCE sequences_cmp[] = { static SETUP_SEQUENCE sequences_cmp[] = {
/* A very common sequence in four varieties /* A very common sequence in four varieties
* load.s.pri n1 load.s.pri n2 * load.s.pri n1 load.s.pri n2
* push.pri load.s.alt n1 * push.pri load.s.alt n1