G:/ScriptBasic/source/builder.c File Reference

#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "filesys.h"
#include "report.h"
#include "lexer.h"
#include "sym.h"
#include "expression.h"
#include "myalloc.h"
#include "builder.h"
#include "errcodes.h"
#include "buildnum.h"

Go to the source code of this file.

Defines

#define REPORT(x1, x2, x3, x4)   if( pBuild->report )pBuild->report(pBuild->reportptr,x1,x2,x3,REPORT_ERROR,&(pBuild->iErrorCounter),x4,(&pBuild->fErrorFlags))
#define CALL_PREPROCESSOR(X, Y)   if( pBuild->pPREP && pBuild->pPREP->n )ipreproc_Process(pBuild->pPREP,X,Y)
#define NEXT_ARGUMENT
#define MYFWRITE(buffer, pieces, size, fp)
#define CORRUPTFILE   {REPORT(szFileName,0L,BU_ERROR_FILE_CORRUPT,NULL);return;}
#define CHECKEOF()   feof(fp) || (lEOFfset && lEOFfset < ftell(fp))
#define ASSERTEOF   if( CHECKEOF() )CORRUPTFILE

Functions

void build_AllocateStringTable (pBuildObject pBuild, int *piFailure)
unsigned long build_StringIndex (pBuildObject pBuild, char *s, long sLen)
int build_Build_l (pBuildObject pBuild, peNODE_l Result)
int build_Build_r (pBuildObject pBuild, peNODE Result)
int build_Build (pBuildObject pBuild)
unsigned long build_MagicCode (pVersionInfo p)
void build_SaveCCode (pBuildObject pBuild, char *szFileName)
int build_SaveCorePart (pBuildObject pBuild, FILE *fp, unsigned long fFlag)
int build_SaveCore (pBuildObject pBuild, FILE *fp)
int build_SaveCode (pBuildObject pBuild, char *szFileName)
void build_SaveECode (pBuildObject pBuild, char *pszInterpreter, char *szFileName)
int build_GetExeCodeOffset (char *pszInterpreter, long *plOffset, long *plEOFfset)
void build_LoadCore (pBuildObject pBuild, char *szFileName, FILE *fp, long lEOFfset)
void build_LoadCodeWithOffset (pBuildObject pBuild, char *szFileName, long lOffset, long lEOFfset)
void build_LoadCode (pBuildObject pBuild, char *szFileName)
int build_IsFileBinaryFormat (char *szFileName)
void build_pprint (pBuildObject pBuild, FILE *f)
static long build_TableItemBytes (char *SymbolName)
static void build_CountSymbolBytes (char *SymbolName, void *SymbolValue, void *f)
static void build_PutFTableItem (char *SymbolName, void *SymbolValue, void *f)
static void build_PutVTableItem (char *SymbolName, void *SymbolValue, void *f)
int build_CreateFTable (pBuildObject pBuild)
int build_CreateVTable (pBuildObject pBuild)
static long build_LookupFunctionOrVariable (pSymbolLongTable Table, unsigned long cbTable, char *s)
long build_LookupFunctionByName (pBuildObject pBuild, char *s)
long build_LookupVariableByName (pBuildObject pBuild, char *s)

Variables

static VersionInfo sVersionInfo


Define Documentation

#define ASSERTEOF   if( CHECKEOF() )CORRUPTFILE
 

Referenced by build_LoadCore().

#define CALL_PREPROCESSOR X,
 )     if( pBuild->pPREP && pBuild->pPREP->n )ipreproc_Process(pBuild->pPREP,X,Y)
 

Definition at line 187 of file builder.c.

Referenced by ex_Command_l(), ex_IsCommandThis(), and lex_InitStructure().

 
#define CHECKEOF  )     feof(fp) || (lEOFfset && lEOFfset < ftell(fp))
 

Referenced by build_LoadCore().

#define CORRUPTFILE   {REPORT(szFileName,0L,BU_ERROR_FILE_CORRUPT,NULL);return;}
 

Referenced by build_LoadCodeWithOffset(), and build_LoadCore().

#define MYFWRITE buffer,
pieces,
size,
fp   ) 
 

Value:

if( fwrite(buffer,size,pieces,fp) != pieces ){\
                                        return BU_ERROR_FAIL;\
                                        }

Referenced by build_SaveCorePart().

#define NEXT_ARGUMENT
 

Value:

if( Result->Parameter.CommandArgument.next ){\
            if( pThis->Parameter.CommandArgument.next = Result->Parameter.CommandArgument.next->NodeId ){\
              pThis = pBuild->CommandArray+Result->Parameter.CommandArgument.next->NodeId-1;\
              pThis->OpCode = eNTYPE_CRG;\
              Result = Result->Parameter.CommandArgument.next;\
              }\
            break;\
            }\
          else{\
            pThis->Parameter.CommandArgument.next = 0;\
            return BU_ERROR_SUCCESS;\
            }

Referenced by build_Build_r().

#define REPORT x1,
x2,
x3,
x4   )     if( pBuild->report )pBuild->report(pBuild->reportptr,x1,x2,x3,REPORT_ERROR,&(pBuild->iErrorCounter),x4,(&pBuild->fErrorFlags))
 

Definition at line 185 of file builder.c.

Referenced by _ex_CleanLabelStack(), _ex_PopLabel(), build_AllocateStringTable(), build_Build(), build_Build_r(), build_LoadCodeWithOffset(), build_LoadCore(), build_SaveECode(), CUL_callback(), ex_CleanNameSpaceStack(), ex_Command_l(), ex_Global(), ex_IsCommandCALL(), ex_LeftValue(), ex_Local(), ex_Pragma(), ex_Tag(), execute_Execute(), lex_ReadInput(), reader_LoadPreprocessors(), reader_ProcessIncludeFiles(), reader_ReadLines_r(), and reader_RelateFile().


Function Documentation

void build_AllocateStringTable pBuildObject  pBuild,
int *  piFailure
 

Definition at line 227 of file builder.c.

References alloc_Alloc(), NULL, and REPORT.

Referenced by build_Build().

int build_Build pBuildObject  pBuild  ) 
 

Definition at line 526 of file builder.c.

References alloc_Alloc(), alloc_InitSegment(), build_AllocateStringTable(), build_Build_l(), build_CreateFTable(), build_CreateVTable(), NULL, and REPORT.

Referenced by HttpExtensionProc(), main(), and scriba_BuildCode().

int build_Build_l pBuildObject  pBuild,
peNODE_l  Result
 

Definition at line 314 of file builder.c.

References build_Build_r().

Referenced by build_Build(), and build_Build_r().

int build_Build_r pBuildObject  pBuild,
peNODE  Result
 

Definition at line 344 of file builder.c.

References build_Build_l(), build_StringIndex(), j, NEXT_ARGUMENT, NULL, q, and REPORT.

Referenced by build_Build_l().

static void build_CountSymbolBytes char *  SymbolName,
void *  SymbolValue,
void *  f
[static]
 

Definition at line 1305 of file builder.c.

References build_TableItemBytes(), and pL.

Referenced by build_CreateFTable(), and build_CreateVTable().

int build_CreateFTable pBuildObject  pBuild  ) 
 

Definition at line 1378 of file builder.c.

References alloc_Alloc(), build_CountSymbolBytes(), build_PutFTableItem(), NULL, p, and sym_TraverseSymbolTable().

Referenced by build_Build().

int build_CreateVTable pBuildObject  pBuild  ) 
 

Definition at line 1436 of file builder.c.

References alloc_Alloc(), build_CountSymbolBytes(), build_PutVTableItem(), NULL, p, and sym_TraverseSymbolTable().

Referenced by build_Build().

int build_GetExeCodeOffset char *  pszInterpreter,
long *  plOffset,
long *  plEOFfset
 

Definition at line 925 of file builder.c.

References file_fclose(), file_fopen(), file_fread(), fp, fseek(), memcpy(), NULL, and SEEK_END.

Referenced by main().

int build_IsFileBinaryFormat char *  szFileName  ) 
 

Definition at line 1148 of file builder.c.

References build_MagicCode(), ch, file_fclose(), file_fopen(), fp, NULL, ret, and sVersionInfo.

Referenced by HttpExtensionProc(), main(), scriba_IsFileBinaryFormat(), and scriba_UseCacheFile().

void build_LoadCode pBuildObject  pBuild,
char *  szFileName
 

Definition at line 1133 of file builder.c.

References build_LoadCodeWithOffset().

Referenced by HttpExtensionProc(), and main().

void build_LoadCodeWithOffset pBuildObject  pBuild,
char *  szFileName,
long  lOffset,
long  lEOFfset
 

Definition at line 1094 of file builder.c.

References alloc_InitSegment(), build_LoadCore(), CORRUPTFILE, file_fclose(), file_fopen(), fp, fseek(), NULL, REPORT, and SEEK_SET.

Referenced by build_LoadCode(), and scriba_LoadBinaryProgramWithOffset().

void build_LoadCore pBuildObject  pBuild,
char *  szFileName,
FILE *  fp,
long  lEOFfset
 

Definition at line 981 of file builder.c.

References alloc_Alloc(), ASSERTEOF, build_MagicCode(), ch, CHECKEOF, CORRUPTFILE, NULL, REPORT, and sVersionInfo.

Referenced by build_LoadCodeWithOffset().

long build_LookupFunctionByName pBuildObject  pBuild,
char *  s
 

Definition at line 1492 of file builder.c.

References build_LookupFunctionOrVariable().

Referenced by scriba_LookupFunctionByName().

static long build_LookupFunctionOrVariable pSymbolLongTable  Table,
unsigned long  cbTable,
char *  s
[static]
 

Definition at line 1470 of file builder.c.

References build_TableItemBytes(), and p.

Referenced by build_LookupFunctionByName(), and build_LookupVariableByName().

long build_LookupVariableByName pBuildObject  pBuild,
char *  s
 

Definition at line 1503 of file builder.c.

References build_LookupFunctionOrVariable().

Referenced by scriba_LookupVariableByName().

unsigned long build_MagicCode pVersionInfo  p  ) 
 

Definition at line 583 of file builder.c.

References memcpy(), s, and sVersionInfo.

Referenced by build_IsFileBinaryFormat(), build_LoadCore(), build_SaveCorePart(), execute_InitStructure(), HttpExtensionProc(), main(), and scriba_PreRun().

void build_pprint pBuildObject  pBuild,
FILE *  f
 

Definition at line 1197 of file builder.c.

References i.

static void build_PutFTableItem char *  SymbolName,
void *  SymbolValue,
void *  f
[static]
 

Definition at line 1316 of file builder.c.

References build_TableItemBytes(), and strcpy().

Referenced by build_CreateFTable().

static void build_PutVTableItem char *  SymbolName,
void *  SymbolValue,
void *  f
[static]
 

Definition at line 1334 of file builder.c.

References build_TableItemBytes(), pV, and strcpy().

Referenced by build_CreateVTable().

void build_SaveCCode pBuildObject  pBuild,
char *  szFileName
 

Definition at line 640 of file builder.c.

References file_fopen(), fp, i, j, NULL, and s.

Referenced by main(), and scriba_SaveCCode().

int build_SaveCode pBuildObject  pBuild,
char *  szFileName
 

Definition at line 818 of file builder.c.

References build_SaveCore(), file_fclose(), file_fopen(), fp, and NULL.

Referenced by HttpExtensionProc(), main(), and scriba_SaveCode().

int build_SaveCore pBuildObject  pBuild,
FILE *  fp
 

Definition at line 763 of file builder.c.

References build_SaveCorePart().

Referenced by build_SaveCode(), and build_SaveECode().

int build_SaveCorePart pBuildObject  pBuild,
FILE *  fp,
unsigned long  fFlag
 

Definition at line 707 of file builder.c.

References build_MagicCode(), MYFWRITE, NULL, and sVersionInfo.

Referenced by build_SaveCore().

void build_SaveECode pBuildObject  pBuild,
char *  pszInterpreter,
char *  szFileName
 

Definition at line 852 of file builder.c.

References build_SaveCore(), ch, fi, file_fclose(), file_fopen(), file_fwrite(), fp, memcpy(), NULL, REPORT, and strcpy().

Referenced by scriba_SaveECode().

unsigned long build_StringIndex pBuildObject  pBuild,
char *  s,
long  sLen
 

Definition at line 274 of file builder.c.

References lLen, memcpy(), and r.

Referenced by build_Build_r().

static long build_TableItemBytes char *  SymbolName  )  [static]
 

Definition at line 1288 of file builder.c.

References len.

Referenced by build_CountSymbolBytes(), build_LookupFunctionOrVariable(), build_PutFTableItem(), and build_PutVTableItem().


Variable Documentation

VersionInfo sVersionInfo [static]
 

Definition at line 572 of file builder.c.

Referenced by build_IsFileBinaryFormat(), build_LoadCore(), build_MagicCode(), and build_SaveCorePart().


Generated on Sun Mar 12 23:56:32 2006 for ScriptBasic by  doxygen 1.4.6-NO