Commit 631b8ce2 authored by Armando Rivera's avatar Armando Rivera

Massive Cleanup of code base

parent 2f0c2bb6
MIT License
Copyright (c) 2018 scriptbasic
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
for(@INC) {
next if /\./;
if( -e "$_/jamal/esd.pm" ) {
print "$_\n";
}
}
/*
builder.h
*/
#ifndef __BUILDER_H__
#define __BUILDER_H__ 1
#ifdef __cplusplus
extern "C" {
#endif
#ifdef WIN32
#pragma warning( disable : 4103 )
#pragma pack(push,4)
#endif
typedef struct _cNODE {
long OpCode;
union {
struct {
unsigned long next;
union {
unsigned long pNode;
long lLongValue;
double dDoubleValue;
unsigned long szStringValue;
}Argument;
}CommandArgument;
struct {
unsigned long Argument;
}Arguments;
union {
double dValue;
long lValue;
unsigned long sValue;
}Constant;
struct {
unsigned long Serial;
}Variable;
struct {
unsigned long NodeId;
unsigned long Argument;
}UserFunction;
struct {
unsigned long actualm;
unsigned long rest;
}NodeList;
}Parameter;
} cNODE,*pcNODE;
#ifdef WIN32
#pragma pack(pop)
#endif
typedef struct _SymbolLongTable {
long value;
char symbol[1];
} SymbolLongTable, *pSymbolLongTable;
typedef struct _BuildObject {
void *(*memory_allocating_function)(size_t);
void (*memory_releasing_function)(void *);
void *pMemorySegment;
char *StringTable;
unsigned long cbStringTable;
unsigned long cbCollectedStrings;
int iErrorCounter;
long cGlobalVariables;
pcNODE CommandArray;
unsigned long NodeCounter;
unsigned long StartNode;
unsigned long cbFTable;
unsigned long cbVTable;
pSymbolLongTable FTable;
pSymbolLongTable VTable;
peXobject pEx;
pReportFunction report;
void *reportptr;
unsigned long fErrorFlags;
char *FirstUNIXline;
struct _PreprocObject *pPREP;
} BuildObject, *pBuildObject;
#define MAGIC_CODE 0x1A534142
#define VERSION_HIGH 0x00000002
#define VERSION_LOW 0x00000001
#define MYVERSION_HIGH 0x00000000
#define MYVERSION_LOW 0x00000000
#define VARIATION "STANDARD"
typedef struct _VersionInfo {
unsigned long MagicCode;
unsigned long VersionHigh, VersionLow;
unsigned long MyVersionHigh,MyVersionLow;
unsigned long Build;
unsigned long Date;
unsigned char Variation[9];
} VersionInfo,*pVersionInfo;
#define BU_SAVE_FTABLE 0x00000001
#define BU_SAVE_VTABLE 0x00000002
/*FUNDEF*/
void build_AllocateStringTable(pBuildObject pBuild,
int *piFailure);
/*FEDNUF*/
/*FUNDEF*/
unsigned long build_StringIndex(pBuildObject pBuild,
char *s,
long sLen);
/*FEDNUF*/
/*FUNDEF*/
int build_Build_l(pBuildObject pBuild,
peNODE_l Result);
/*FEDNUF*/
/*FUNDEF*/
int build_Build_r(pBuildObject pBuild,
peNODE Result);
/*FEDNUF*/
/*FUNDEF*/
int build_Build(pBuildObject pBuild);
/*FEDNUF*/
/*FUNDEF*/
unsigned long build_MagicCode(pVersionInfo p);
/*FEDNUF*/
/*FUNDEF*/
void build_SaveCCode(pBuildObject pBuild,
char *szFileName);
/*FEDNUF*/
/*FUNDEF*/
int build_SaveCorePart(pBuildObject pBuild,
FILE *fp,
unsigned long fFlag);
/*FEDNUF*/
/*FUNDEF*/
int build_SaveCore(pBuildObject pBuild,
FILE *fp);
/*FEDNUF*/
/*FUNDEF*/
int build_SaveCode(pBuildObject pBuild,
char *szFileName);
/*FEDNUF*/
/*FUNDEF*/
void build_SaveECode(pBuildObject pBuild,
char *pszInterpreter,
char *szFileName);
/*FEDNUF*/
/*FUNDEF*/
int build_GetExeCodeOffset(char *pszInterpreter,
long *plOffset,
long *plEOFfset);
/*FEDNUF*/
/*FUNDEF*/
void build_LoadCore(pBuildObject pBuild,
char *szFileName,
FILE *fp,
long lEOFfset);
/*FEDNUF*/
/*FUNDEF*/
void build_LoadCodeWithOffset(pBuildObject pBuild,
char *szFileName,
long lOffset,
long lEOFfset);
/*FEDNUF*/
/*FUNDEF*/
void build_LoadCode(pBuildObject pBuild,
char *szFileName);
/*FEDNUF*/
/*FUNDEF*/
int build_IsFileBinaryFormat(char *szFileName);
/*FEDNUF*/
/*FUNDEF*/
void build_pprint(pBuildObject pBuild,
FILE *f);
/*FEDNUF*/
/*FUNDEF*/
int build_CreateFTable(pBuildObject pBuild);
/*FEDNUF*/
/*FUNDEF*/
int build_CreateVTable(pBuildObject pBuild);
/*FEDNUF*/
/*FUNDEF*/
long build_LookupFunctionByName(pBuildObject pBuild,
char *s);
/*FEDNUF*/
/*FUNDEF*/
long build_LookupVariableByName(pBuildObject pBuild,
char *s);
/*FEDNUF*/
#ifdef __cplusplus
}
#endif
#endif
/*
buildnum.h
*/
#ifndef __BUILDNUM_H__
#define __BUILDNUM_H__ 1
#ifdef __cplusplus
extern "C" {
#endif
#ifndef SCRIPTBASIC_BUILD
#define SCRIPTBASIC_BUILD 1
#endif
#ifdef __cplusplus
}
#endif
#endif
del /s /q bin\exe\*
del /s /q bin\include\*
del /s /q bin\lib\*
del /s /q bin\make\*
del /s /q bin\obj\*
del /s /q bin\var\*
\ No newline at end of file
/*
command.h
*/
#ifndef __COMMAND_H__
#define __COMMAND_H__ 1
#ifdef __cplusplus
extern "C" {
#endif
#include "errcodes.h"
#include "report.h"
#include "sym.h"
#include "lexer.h"
#include "expression.h"
#include "builder.h"
#include "memory.h"
#include "syntax.h"
#include "execute.h"
#include "syntax.h"
#include "myalloc.h"
#include "filesys.h"
#include "options.h"
#include "hookers.h"
#include "notimp.h"
#define COMMAND(x) void COMMAND_##x(pExecuteObject pEo){\
MortalList _ThisCommandMortals=NULL;\
pMortalList _pThisCommandMortals = &_ThisCommandMortals;\
unsigned long _ActualNode=PROGRAMCOUNTER;\
int iErrorCode;
#define IDENTICAL_COMMAND(x) COMMAND_##x(pEo);
#define USE_CALLER_MORTALS (_pThisCommandMortals = pEo->pGlobalMortalList)
#define END goto _FunctionFinishLabel;\
_FunctionFinishLabel: \
memory_ReleaseMortals(pEo->pMo,&_ThisCommandMortals);\
iErrorCode = 0;\
FINISH;\
}
#define FINISH
#define RETURN goto _FunctionFinishLabel
#ifdef ERROR
#undef ERROR
#endif
#define ERROR(x) do{ pEo->ErrorCode = x; RETURN; }while(0)
#define NOTIMPLEMENTED ERROR(COMMAND_ERROR_NOTIMP)
#define DEREFERENCE(X) refcount = pEo->pMo->maxderef;\
while( *(X) && TYPE( *(X) ) == VTYPE_REF ){\
(X) = (*(X))->Value.aValue;\
if( ! refcount -- )ERROR(COMMAND_ERROR_CIRCULAR);\
}
#define ERRORUNDEF if( (*RaiseError(pEo))&1 ){\
ERROR(COMMAND_ERROR_DIV);\
}\
RESULT = NULL; RETURN;
#define NONULOP(x) ASSERTOKE;if( memory_IsUndef(x) ){if((*RaiseError(pEo))&2 ){\
ERROR(COMMAND_ERROR_UNDEFOP);\
}\
RESULT = NULL; RETURN;}
#define NONULOPE(x) ASSERTOKE;if( memory_IsUndef(x) ){if( (*RaiseError(pEo))&4 )ERROR(COMMAND_ERROR_UNDEFOP);}