Added fix for __DATE__, added __TIME__
Added tag table crap for new autoloading feature Version bump
This commit is contained in:
parent
a29f8d0651
commit
58209dfb37
@ -61,6 +61,8 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
#include "sc.h"
|
#include "sc.h"
|
||||||
#define VERSION_STR "3.0.3367-amxx"
|
#define VERSION_STR "3.0.3367-amxx"
|
||||||
#define VERSION_INT 0x300
|
#define VERSION_INT 0x300
|
||||||
@ -125,6 +127,7 @@ static void dostate(void);
|
|||||||
static void addwhile(int *ptr);
|
static void addwhile(int *ptr);
|
||||||
static void delwhile(void);
|
static void delwhile(void);
|
||||||
static int *readwhile(void);
|
static int *readwhile(void);
|
||||||
|
static void inst_datetime_defines(void);
|
||||||
|
|
||||||
static int lastst = 0; /* last executed statement type */
|
static int lastst = 0; /* last executed statement type */
|
||||||
static int nestlevel = 0; /* number of active (open) compound statements */
|
static int nestlevel = 0; /* number of active (open) compound statements */
|
||||||
@ -382,6 +385,23 @@ long pc_lengthbin(void *handle)
|
|||||||
|
|
||||||
#endif /* !defined NO_MAIN */
|
#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
|
/* "main" of the compiler
|
||||||
*/
|
*/
|
||||||
@ -531,7 +551,7 @@ int pc_compile(int argc, char *argv[])
|
|||||||
delete_symbols(&glbtab,0,TRUE,FALSE);
|
delete_symbols(&glbtab,0,TRUE,FALSE);
|
||||||
#if !defined NO_DEFINE
|
#if !defined NO_DEFINE
|
||||||
delete_substtable();
|
delete_substtable();
|
||||||
insert_subst("__DATE__", "\"" __DATE__ "\"", 8);
|
inst_datetime_defines();
|
||||||
#endif
|
#endif
|
||||||
resetglobals();
|
resetglobals();
|
||||||
sc_ctrlchar=sc_ctrlchar_org;
|
sc_ctrlchar=sc_ctrlchar_org;
|
||||||
@ -595,7 +615,7 @@ int pc_compile(int argc, char *argv[])
|
|||||||
delete_symbols(&glbtab,0,TRUE,FALSE);
|
delete_symbols(&glbtab,0,TRUE,FALSE);
|
||||||
#if !defined NO_DEFINE
|
#if !defined NO_DEFINE
|
||||||
delete_substtable();
|
delete_substtable();
|
||||||
insert_subst("__DATE__", "\"" __DATE__ "\"", 8);
|
inst_datetime_defines();
|
||||||
#endif
|
#endif
|
||||||
resetglobals();
|
resetglobals();
|
||||||
sc_ctrlchar=sc_ctrlchar_org;
|
sc_ctrlchar=sc_ctrlchar_org;
|
||||||
|
@ -1016,8 +1016,28 @@ static int command(void)
|
|||||||
} /* if */
|
} /* if */
|
||||||
} else if (strcmp(str,"dynamic")==0) {
|
} else if (strcmp(str,"dynamic")==0) {
|
||||||
preproc_expr(&sc_stksize,NULL);
|
preproc_expr(&sc_stksize,NULL);
|
||||||
} else if (strcmp(str,"library")==0) {
|
} else if ( !strcmp(str,"library") ||
|
||||||
char name[sNAMEMAX+1];
|
!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')
|
while (*lptr<=' ' && *lptr!='\0')
|
||||||
lptr++;
|
lptr++;
|
||||||
if (*lptr=='"') {
|
if (*lptr=='"') {
|
||||||
@ -1027,6 +1047,20 @@ static int command(void)
|
|||||||
for (i=0; i<sizeof name && (alphanum(*lptr) || *lptr=='-'); i++,lptr++)
|
for (i=0; i<sizeof name && (alphanum(*lptr) || *lptr=='-'); i++,lptr++)
|
||||||
name[i]=*lptr;
|
name[i]=*lptr;
|
||||||
name[i]='\0';
|
name[i]='\0';
|
||||||
|
if (!strncmp(str, "exp", 3) || !strncmp(str, "def", 3))
|
||||||
|
{
|
||||||
|
while (*lptr && isalpha(*lptr))
|
||||||
|
lptr++;
|
||||||
|
for (i=1; i<sizeof sname && alphanum(*lptr); i++,lptr++)
|
||||||
|
sname[i]=*lptr;
|
||||||
|
sname[i] = '\0';
|
||||||
|
if (!sname[1])
|
||||||
|
{
|
||||||
|
error(28);
|
||||||
|
} else {
|
||||||
|
sname[0] = '_';
|
||||||
|
}
|
||||||
|
}
|
||||||
} /* if */
|
} /* if */
|
||||||
if (strlen(name)==0) {
|
if (strlen(name)==0) {
|
||||||
curlibrary=NULL;
|
curlibrary=NULL;
|
||||||
@ -1034,8 +1068,22 @@ static int command(void)
|
|||||||
pc_addlibtable=FALSE;
|
pc_addlibtable=FALSE;
|
||||||
} else {
|
} else {
|
||||||
/* add the name if it does not yet exist in the table */
|
/* add the name if it does not yet exist in the table */
|
||||||
if (find_constval(&libname_tab,name,0)==NULL)
|
char newname[sNAMEMAX+1];
|
||||||
curlibrary=append_constval(&libname_tab,name,0,0);
|
if (strlen(name) + strlen(prefix) + strlen(sname) <= sNAMEMAX)
|
||||||
|
{
|
||||||
|
strcpy(newname, prefix);
|
||||||
|
strcat(newname, name);
|
||||||
|
strcat(newname, sname);
|
||||||
|
if (newname[0] != '?')
|
||||||
|
{
|
||||||
|
if (find_constval(&libname_tab,newname,0)==NULL)
|
||||||
|
{
|
||||||
|
curlibrary=append_constval(&libname_tab,newname,0,0);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
exporttag(pc_addtag(newname));
|
||||||
|
}
|
||||||
|
}
|
||||||
} /* if */
|
} /* if */
|
||||||
} else if (strcmp(str,"pack")==0) {
|
} else if (strcmp(str,"pack")==0) {
|
||||||
cell val;
|
cell val;
|
||||||
|
Loading…
Reference in New Issue
Block a user