From 142fbaafddf652f1c7f4012882a4eac110712e78 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 22 Aug 2014 00:04:48 -0700 Subject: [PATCH] Port sc7 to C++. --- sourcepawn/compiler/AMBuilder | 2 +- sourcepawn/compiler/sc7-in.scp | 7 ++++++- sourcepawn/compiler/{sc7.c => sc7.cpp} | 0 3 files changed, 7 insertions(+), 2 deletions(-) rename sourcepawn/compiler/{sc7.c => sc7.cpp} (100%) diff --git a/sourcepawn/compiler/AMBuilder b/sourcepawn/compiler/AMBuilder index 0b3d23e0..b4e7d40a 100644 --- a/sourcepawn/compiler/AMBuilder +++ b/sourcepawn/compiler/AMBuilder @@ -88,7 +88,7 @@ binary.sources += [ 'sc4.c', 'sc5.c', 'sc6.c', - 'sc7.c', + 'sc7.cpp', 'scexpand.cpp', 'sci18n.cpp', 'sclist.cpp', diff --git a/sourcepawn/compiler/sc7-in.scp b/sourcepawn/compiler/sc7-in.scp index 856994ca..0ab4da69 100644 --- a/sourcepawn/compiler/sc7-in.scp +++ b/sourcepawn/compiler/sc7-in.scp @@ -41,12 +41,17 @@ unsigned char sequences_table[][2] = { /*-*SCPACK end of pair table, do not change or remove this line */ #define seqsize(o,p) (opcodes(o)+opargs(p)) +typedef struct { + const char *find; + const char *replace; + int savesize; /* number of bytes saved (in bytecode) */ +} PRE_SEQUENCE; typedef struct { char *find; char *replace; int savesize; /* number of bytes saved (in bytecode) */ } SEQUENCE; -static SEQUENCE sequences_cmp[] = { +static PRE_SEQUENCE sequences_cmp[] = { /* A very common sequence in four varieties * load.s.pri n1 load.s.pri n2 * push.pri load.s.alt n1 diff --git a/sourcepawn/compiler/sc7.c b/sourcepawn/compiler/sc7.cpp similarity index 100% rename from sourcepawn/compiler/sc7.c rename to sourcepawn/compiler/sc7.cpp