Commit 3c656201 authored by Armando I. Rivera's avatar Armando I. Rivera

Source tree cleanup

parent a2ca344d
This diff is collapsed.
/*
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
/*
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);}
#define RETURN_DOUBLE_VALUE_OR_LONG(x) \
dResult = (x);\
if( dResult == floor(dResult) && fabs(dResult) < LONG_MAX ){\
RESULT= NEWMORTALLONG;\
ASSERTNULL(RESULT);\
LONGVALUE(RESULT) = ((long)dResult);\
RETURN;\
}\
RESULT = NEWMORTALDOUBLE;\
ASSERTNULL(RESULT);\
DOUBLEVALUE(RESULT) = dResult;\
RETURN;
#define RETURN_DOUBLE_VALUE(x) \
RESULT = NEWMORTALDOUBLE;\
ASSERTNULL(RESULT);\
DOUBLEVALUE(RESULT) = (x);\
RETURN;
#define RETURN_LONG_VALUE(x) \
RESULT= NEWMORTALLONG;\
ASSERTNULL(RESULT);\
LONGVALUE(RESULT) = (x);\
RETURN;
#define RETURN_UNDEF RESULT = NULL; RETURN
#define RETURN_TRUE \
RESULT= NEWMORTALLONG;\
ASSERTNULL(RESULT);\
LONGVALUE(RESULT) = -1L;\
RETURN;
#define RETURN_FALSE \
RESULT= NEWMORTALLONG;\
ASSERTNULL(RESULT);\
LONGVALUE(RESULT) = 0L;\
RETURN;
#define PROGRAMCOUNTER (pEo->CommandArray[pEo->ProgramCounter-1].Parameter.NodeList.actualm)
#define SETPROGRAMCOUNTER(x) ( pEo->fNextPC=1 , pEo->NextProgramCounter = (x) )
#define NEXTPARAMETER (_ActualNode = pEo->CommandArray[_ActualNode-1].Parameter.CommandArgument.next)
#define PARAMETERNODE (pEo->CommandArray[_ActualNode-1].Parameter.CommandArgument.Argument.pNode)
#define PARAMETERLONG (pEo->CommandArray[_ActualNode-1].Parameter.CommandArgument.Argument.lLongValue)
#define PARAMETERDOUBLE (pEo->CommandArray[_ActualNode-1].Parameter.CommandArgument.Argument.dDoubleValue)
#define PARAMETERSTRING (pEo->StringTable+pEo->CommandArray[_ActualNode-1].Parameter.CommandArgument.Argument.szStringValue)
#define PARAMETERSTRLEN (*((long *)(pEo->StringTable+pEo->CommandArray[_ActualNode-1].Parameter.CommandArgument.Argument.szStringValue-sizeof(long))))
#define PARAMETEREXEC (pEo->InstructionParameter[_ActualNode-1])
#define OPCODE(x) (pEo->CommandArray[x-1].OpCode)
#define THISPARAMPTR (pEo->CommandParameter[pEo->CommandArray[_ActualNode-1].OpCode - START_CMD])
#define PARAMPTR(x) (pEo->CommandParameter[(x) - START_CMD])
#define FINALPTR(x) (pEo->Finaliser[(x) - START_CMD])
#define ALLOC(x) alloc_Alloc((x),pEo->pMemorySegment)
#define FREE(x) alloc_Free((x),pEo->pMemorySegment)
#define PARAMETERLIST (pEo->CommandArray[pEo->OperatorNode-1].Parameter.Arguments.Argument)
#define NEWLONG memory_NewLong(pEo->pMo)
#define NEWDOUBLE memory_NewDouble(pEo->pMo)
#define NEWSTRING(length) memory_NewString(pEo->pMo,length)
#define NEWARRAY(low,high) memory_NewArray(pEo->pMo,low,high)
#define NEWMORTALLONG memory_NewMortalLong(pEo->pMo,_pThisCommandMortals)
#define NEWMORTALDOUBLE memory_NewMortalDouble(pEo->pMo,_pThisCommandMortals)
#define NEWMORTALSTRING(length) memory_NewMortalString(pEo->pMo,length,_pThisCommandMortals)
#define NEWMORTALARRAY(low,high) memory_NewArray(pEo->pMo,_pThisCommandMortals,low,high)
#define CONVERT2DOUBLE(x) execute_Convert2Double(pEo,x,_pThisCommandMortals)
#define CONVERT2LONG(x) execute_Convert2Long(pEo,x,_pThisCommandMortals)
#define CONVERT2STRING(x) execute_Convert2String(pEo,x,_pThisCommandMortals)
#define CONVERT2NUMERIC(x) execute_Convert2Numeric(pEo,x,_pThisCommandMortals)
#define CONVERT2ZCHAR(x,y) (y) = ALLOC(STRLEN( (x) )+1);\
if( (y) == NULL )ERROR(COMMAND_ERROR_MEMORY_LOW);\
memcpy((y),STRINGVALUE( (x) ),STRLEN( (x) ));\
(y)[STRLEN( (x) )] = (char)0;
#define ISSTRINGINTEGER(x) execute_IsStringInteger(x)
#define ISINTEGER(x) execute_IsInteger(x)
#define RESULT pEo->pOpResult
#define CAR(x) (((x)>0) ? pEo->CommandArray[(x)-1].Parameter.NodeList.actualm : 0)
#define CDR(x) (((x)>0) ? pEo->CommandArray[(x)-1].Parameter.NodeList.rest : 0)
#define EVALUATEEXPRESSION(x) memory_DupMortalize(pEo->pMo,\
execute_Dereference(pEo,\
execute_Evaluate(pEo,x,_pThisCommandMortals,&iErrorCode,0),&iErrorCode),\
_pThisCommandMortals,\
&iErrorCode)
#define _EVALUATEEXPRESSION(x) execute_Dereference(pEo,execute_Evaluate(pEo,x,_pThisCommandMortals,&iErrorCode,0),&iErrorCode)
#define _EVALUATEEXPRESSION_A(x) execute_Dereference(pEo,execute_Evaluate(pEo,x,_pThisCommandMortals,&iErrorCode,1),&iErrorCode)
#define EVALUATELEFTVALUE(x) execute_LeftValue(pEo,x,_pThisCommandMortals,&iErrorCode,0)
#define EVALUATELEFTVALUE_A(x) execute_LeftValue(pEo,x,_pThisCommandMortals,&iErrorCode,1)
#define ASSERTOKE if( iErrorCode )ERROR(iErrorCode);
#define ASSERTNULL(X) if( (X) == NULL )ERROR(COMMAND_ERROR_MEMORY_LOW);
#define IMMORTALIZE(x) memory_Immortalize(x,_pThisCommandMortals)
typedef unsigned long NODE;
typedef pFixSizeMemoryObject VARIABLE, *LEFTVALUE;
#define TYPE(x) ((x)->vType)
#define OPTION(x) options_Get(pEo,(x))
#define OPTIONR(x) options_GetR(pEo,(x))
#ifdef __cplusplus
}
#endif
#endif
Bstring.c/1.11/
Bfile.c/1.22/
Benviron.c/1.3/
/extops.c/1.1.1.1/Fri Nov 23 22:41:34 2001//
/goto.c/1.4/Fri Sep 20 06:28:18 2002//
/if.c/1.2/Tue Aug 13 19:13:41 2002//
/while.c/1.2/Fri Aug 9 15:24:48 2002//
/function.c/1.3/Thu Mar 27 08:59:37 2003//
/string.c/1.12/Fri Mar 28 14:30:38 2003//
/let.c/1.6/Tue Apr 29 14:03:14 2003//
/mathfunc.c/1.9/Fri Jun 6 12:02:11 2003//
/mathops.c/1.5/Wed Jul 9 21:57:59 2003//
/print.c/1.2/Wed Jul 16 19:09:46 2003//
/time.c/1.3/Tue Apr 13 13:02:59 2004//
/environ.c/1.4/Fri Feb 11 12:52:46 2005//
/external.c/1.4/Fri Feb 11 13:22:12 2005//
/file.c/1.25/Fri Feb 11 15:55:43 2005//
D