From 58209dfb371f867a2a028dc4ab0add1d8f24787b Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 10 May 2006 03:44:35 +0000 Subject: [PATCH] Added fix for __DATE__, added __TIME__ Added tag table crap for new autoloading feature Version bump --- compiler/libpc300/sc1.c | 24 ++++++++++++++++-- compiler/libpc300/sc2.c | 56 ++++++++++++++++++++++++++++++++++++++--- 2 files changed, 74 insertions(+), 6 deletions(-) diff --git a/compiler/libpc300/sc1.c b/compiler/libpc300/sc1.c index 9e4bdfb0..390a7450 100755 --- a/compiler/libpc300/sc1.c +++ b/compiler/libpc300/sc1.c @@ -61,6 +61,8 @@ #include #endif +#include + #include "sc.h" #define VERSION_STR "3.0.3367-amxx" #define VERSION_INT 0x300 @@ -125,6 +127,7 @@ static void dostate(void); static void addwhile(int *ptr); static void delwhile(void); static int *readwhile(void); +static void inst_datetime_defines(void); static int lastst = 0; /* last executed statement type */ static int nestlevel = 0; /* number of active (open) compound statements */ @@ -382,6 +385,23 @@ long pc_lengthbin(void *handle) #endif /* !defined NO_MAIN */ +void inst_datetime_defines() +{ + char date[64]; + char ltime[64]; + time_t td; + struct tm *curtime; + + time(&td); + curtime = localtime(&td); + + strftime(date, 31, "\"%m/%d/%Y\"", curtime); + strftime(ltime, 31, "\"%H:%M:%S\"", curtime); + + insert_subst("__DATE__", date, 8); + insert_subst("__TIME__", ltime, 8); +} + /* "main" of the compiler */ @@ -531,7 +551,7 @@ int pc_compile(int argc, char *argv[]) delete_symbols(&glbtab,0,TRUE,FALSE); #if !defined NO_DEFINE delete_substtable(); - insert_subst("__DATE__", "\"" __DATE__ "\"", 8); + inst_datetime_defines(); #endif resetglobals(); sc_ctrlchar=sc_ctrlchar_org; @@ -595,7 +615,7 @@ int pc_compile(int argc, char *argv[]) delete_symbols(&glbtab,0,TRUE,FALSE); #if !defined NO_DEFINE delete_substtable(); - insert_subst("__DATE__", "\"" __DATE__ "\"", 8); + inst_datetime_defines(); #endif resetglobals(); sc_ctrlchar=sc_ctrlchar_org; diff --git a/compiler/libpc300/sc2.c b/compiler/libpc300/sc2.c index f2f3a3ab..f18f6bb4 100755 --- a/compiler/libpc300/sc2.c +++ b/compiler/libpc300/sc2.c @@ -1016,8 +1016,28 @@ static int command(void) } /* if */ } else if (strcmp(str,"dynamic")==0) { preproc_expr(&sc_stksize,NULL); - } else if (strcmp(str,"library")==0) { - char name[sNAMEMAX+1]; + } else if ( !strcmp(str,"library") || + !strcmp(str, "reqlib") || + !strcmp(str, "reqclass") || + !strcmp(str, "loadlib") || + !strcmp(str, "explib") || + !strcmp(str, "expclass") || + !strcmp(str, "defclasslib") ) { + char name[sNAMEMAX+1],sname[sNAMEMAX+1]; + const char *prefix = ""; + sname[0] = '\0'; + if (!strcmp(str, "reqlib")) + prefix = "?rl_"; + else if (!strcmp(str, "reqclass")) + prefix = "?rc_"; + else if (!strcmp(str, "loadlib")) + prefix = "?f_"; + else if (!strcmp(str, "explib")) + prefix = "?el_"; + else if (!strcmp(str, "expclass")) + prefix = "?ec_"; + else if (!strcmp(str, "defclasslib")) + prefix = "?d_"; while (*lptr<=' ' && *lptr!='\0') lptr++; if (*lptr=='"') { @@ -1027,6 +1047,20 @@ static int command(void) for (i=0; i