See ChangeLog 19990519-02:45
This commit is contained in:
@@ -1,3 +1,26 @@
|
||||
19990519-02:45 Ryszard Glab <rglab@imid.med.pl>
|
||||
|
||||
* source/compiler/harbour.y
|
||||
- added support for INCLUDE environment variable
|
||||
- corrected looking for unmatched ENDIF/ELSE//ELSEIF
|
||||
- added '-t' option = alternative initialization of symbol table
|
||||
When this option is used then the Harbour generates C code for a function
|
||||
<modulename>__InitSymbols that have to be called in order to properly
|
||||
initialize the global symbol table. You should use this option if you
|
||||
want to generate the C code output and your C compiler doesn't allow
|
||||
to call any function before the 'main'.
|
||||
|
||||
* surce/vm/initsymb.c
|
||||
- added new file that registers a symbols table with runtime support
|
||||
functions. This file can be edited to add calls for application specific
|
||||
functions that registers local symbols tables used in application modules.
|
||||
The Harbour compiler can create <modulename>__InitSymbols functions
|
||||
when you use '-t' option.
|
||||
|
||||
* source/vm/hvm.c
|
||||
- added call for InitSymbolTable function that registers symbol table
|
||||
with runtime support Harbour functions.
|
||||
|
||||
19990518-19:30 David G. Holm <dholm@jsd-llc.com>
|
||||
* source/rtl/environ.c
|
||||
- Enhanced Harbour OS function to return both OS and Version
|
||||
@@ -311,10 +334,43 @@
|
||||
NB! Not needed for 32-bit compilers.
|
||||
|
||||
Tue May 11 18:53:43 1999 Gonzalo A. Diethelm <Gonzalo.Diethelm@jda.cl>
|
||||
<<<<<<< ChangeLog
|
||||
=======
|
||||
|
||||
* Makefile:
|
||||
Added obj to the list of directories.
|
||||
>>>>>>> 1.78
|
||||
|
||||
<<<<<<< ChangeLog
|
||||
* Makefile:
|
||||
Added obj to the list of directories.
|
||||
|
||||
* source/Makefile:
|
||||
Added rdd to the list of directories.
|
||||
|
||||
* source/rtl/Makefile:
|
||||
Added gtapi.c to the list of C sources.
|
||||
|
||||
* source/rtl/gtapi.c:
|
||||
Got rid of two warnings with gcc.
|
||||
|
||||
* source/rtl/environ.c:
|
||||
Made sure it compiles with gcc.
|
||||
There was a missing #endif.
|
||||
|
||||
* source/tools/stringp.prg:
|
||||
* tests/working/debugtst.prg:
|
||||
Replaced Debug() with HBDebug(), otherwise the generated C source
|
||||
collides with the macro DEBUG.
|
||||
|
||||
* source/vm/hvm.c:
|
||||
Corrected a comment.
|
||||
|
||||
* source/rdd/Makefile:
|
||||
* obj/Makefile:
|
||||
Added these two Makefiles.
|
||||
|
||||
=======
|
||||
* source/Makefile:
|
||||
Added rdd to the list of directories.
|
||||
|
||||
@@ -340,6 +396,7 @@ Tue May 11 18:53:43 1999 Gonzalo A. Diethelm <Gonzalo.Diethelm@jda.cl>
|
||||
* obj/Makefile:
|
||||
Added these two Makefiles.
|
||||
|
||||
>>>>>>> 1.78
|
||||
19990511-19:20 Eddie Runia
|
||||
* source/rtl/classes.c
|
||||
(Default) parameter self added to INLINE methods
|
||||
|
||||
@@ -395,7 +395,7 @@ Separator {SpaceTab}|{Comment}|{LineCont}
|
||||
%}
|
||||
"endif"|"endi" { /* ENDIF can be used in one context only */
|
||||
if( _wIfCounter == 0 )
|
||||
GenError( ERR_ENDIF, NULL, NULL );
|
||||
GenError( ERR_ENDIF, NULL, NULL );
|
||||
return ENDIF;
|
||||
}
|
||||
"endc"("ase"|"as"|"a")? { /* ENDCASE can be used in one context only */
|
||||
|
||||
@@ -131,6 +131,7 @@ static void __yy_memcpy( char * from, char * to, int count ); /* Bison prototype
|
||||
/* production related functions */
|
||||
PFUNCTION AddFunCall( char * szFuntionName );
|
||||
void AddExtern( char * szExternName ); /* defines a new extern name */
|
||||
void AddSearchPath( char *, PATHNAMES * * ); /* add pathname to a search list */
|
||||
void AddVar( char * szVarName ); /* add a new param, local, static variable to a function definition or a public or private */
|
||||
PCOMSYMBOL AddSymbol( char * szSymbolName );
|
||||
void CheckDuplVars( PVAR pVars, char * szVarName, int iVarScope ); /*checks for duplicate variables definitions */
|
||||
@@ -352,6 +353,7 @@ int _iSyntaxCheckOnly = 0; /* syntax check only */
|
||||
int _iLanguage = LANG_C; /* default Harbour generated output language */
|
||||
int _iRestrictSymbolLength = 0; /* generate 10 chars max symbols length */
|
||||
int _iShortCuts = 1; /* .and. & .or. expressions shortcuts */
|
||||
short int _iAltSymbolTableInit = 0; /* alternative method of symbol table initialization */
|
||||
WORD _wSeqCounter = 0;
|
||||
WORD _wForCounter = 0;
|
||||
WORD _wIfCounter = 0;
|
||||
@@ -791,8 +793,9 @@ IfEndif : IfBegin EndIf { JumpHere( $1 ); }
|
||||
| IfBegin IfElseIf IfElse EndIf { JumpHere( $1 ); FixElseIfs( $2 ); }
|
||||
;
|
||||
|
||||
IfBegin : IF Expression Crlf { $$ = JumpFalse( 0 ); ++_wIfCounter; } IfStats
|
||||
{ $$ = Jump( 0 ); JumpHere( $<iNumber>4 ); }
|
||||
IfBegin : IF Expression { ++_wIfCounter; } Crlf { $$ = JumpFalse( 0 ); }
|
||||
IfStats
|
||||
{ $$ = Jump( 0 ); JumpHere( $<iNumber>5 ); }
|
||||
;
|
||||
|
||||
IfElse : ELSE Crlf IfStats
|
||||
@@ -1054,23 +1057,7 @@ int harbour_main( int argc, char * argv[] )
|
||||
|
||||
case 'i':
|
||||
case 'I':
|
||||
{
|
||||
PATHNAMES *pPath = _pIncludePath;
|
||||
|
||||
if( pPath )
|
||||
{
|
||||
while( pPath->pNext )
|
||||
pPath =pPath->pNext;
|
||||
pPath->pNext =(PATHNAMES *)OurMalloc( sizeof(PATHNAMES) );
|
||||
pPath =pPath->pNext;
|
||||
}
|
||||
else
|
||||
{
|
||||
_pIncludePath = pPath =(PATHNAMES *)OurMalloc( sizeof(PATHNAMES) );
|
||||
}
|
||||
pPath->pNext = NULL;
|
||||
pPath->szPath = argv[ iArg ]+2;
|
||||
}
|
||||
AddSearchPath( argv[ iArg ]+2, &_pIncludePath );
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
@@ -1098,6 +1085,11 @@ int harbour_main( int argc, char * argv[] )
|
||||
_iSyntaxCheckOnly = 1;
|
||||
break;
|
||||
|
||||
case 't':
|
||||
case 'T':
|
||||
_iAltSymbolTableInit = 1;
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
case 'Y':
|
||||
yydebug = TRUE;
|
||||
@@ -1152,6 +1144,22 @@ int harbour_main( int argc, char * argv[] )
|
||||
|
||||
if( Include( szFileName, NULL ) )
|
||||
{
|
||||
char * szInclude = getenv( "INCLUDE" );
|
||||
|
||||
if( szInclude )
|
||||
{
|
||||
char * pPath;
|
||||
char * pDelim;
|
||||
|
||||
pPath = szInclude = strdup( szInclude );
|
||||
while( (pDelim = strchr( pPath, ';' )) != NULL )
|
||||
{
|
||||
*pDelim ='\0';
|
||||
AddSearchPath( pPath, &_pIncludePath );
|
||||
pPath =pDelim + 1;
|
||||
}
|
||||
}
|
||||
|
||||
FunDef( strupr( strdup( pFileName->name ) ), FS_PUBLIC, FUN_PROCEDURE );
|
||||
yyparse();
|
||||
FixReturns(); /* fix all previous function returns offsets */
|
||||
@@ -1260,6 +1268,7 @@ void PrintUsage( char * szSelf )
|
||||
"\t/o<path>\tobject file drive and/or path\n"
|
||||
"\t/q\t\tquiet\n"
|
||||
"\t/s\t\tsyntax check only\n"
|
||||
"\t/t\t\talternative method of symbol table initialization\n"
|
||||
"\t/y\t\ttrace lex & yacc activity\n"
|
||||
"\t/z\t\tsupress .and. & .or. shortcutting\n"
|
||||
"\t/10\t\trestrict symbol length to 10 characters\n"
|
||||
@@ -1384,6 +1393,29 @@ char *MakeFilename( char *szFileName, FILENAME *pFileName )
|
||||
return szFileName;
|
||||
}
|
||||
|
||||
/*
|
||||
* Function that adds specified path to the list of pathnames to search
|
||||
*/
|
||||
void AddSearchPath( char *szPath, PATHNAMES * *pSearchList )
|
||||
{
|
||||
PATHNAMES *pPath = *pSearchList;
|
||||
|
||||
if( pPath )
|
||||
{
|
||||
while( pPath->pNext )
|
||||
pPath =pPath->pNext;
|
||||
pPath->pNext =(PATHNAMES *)OurMalloc( sizeof(PATHNAMES) );
|
||||
pPath =pPath->pNext;
|
||||
}
|
||||
else
|
||||
{
|
||||
*pSearchList =pPath =(PATHNAMES *)OurMalloc( sizeof(PATHNAMES) );
|
||||
}
|
||||
pPath->pNext = NULL;
|
||||
pPath->szPath = szPath;
|
||||
}
|
||||
|
||||
|
||||
PFUNCTION AddFunCall( char * szFunctionName )
|
||||
{
|
||||
PFUNCTION pFunc = ( PFUNCTION ) OurMalloc( sizeof( _FUNC ) );
|
||||
@@ -1797,9 +1829,11 @@ void GenCCode( char *szFileName, char *szName ) /* generates the C languag
|
||||
if( ! _iStartProc )
|
||||
pSym = pSym->pNext; /* starting procedure is always the first symbol */
|
||||
|
||||
wSym = 0; /* syymbols counter */
|
||||
while( pSym )
|
||||
{
|
||||
fprintf( yyc, "{ \"%s\", ", pSym->szName );
|
||||
++wSym;
|
||||
|
||||
if( pSym->cScope & FS_STATIC )
|
||||
fprintf( yyc, "FS_STATIC" );
|
||||
@@ -1835,7 +1869,15 @@ void GenCCode( char *szFileName, char *szName ) /* generates the C languag
|
||||
}
|
||||
fprintf( yyc, " };\n\n" );
|
||||
|
||||
fprintf( yyc, "#include <init.h>\n\n" );
|
||||
if( _iAltSymbolTableInit )
|
||||
{
|
||||
fprintf( yyc, "void ProcessSymbols( SYMBOL *, WORD );\n" );
|
||||
fprintf( yyc, "/* Add a local symbol table to the global one\n*/\n" );
|
||||
fprintf( yyc, "void %s__InitSymbols( void )\n{\n"
|
||||
" ProcessSymbols( symbols, %i );\n}\n\n", symbols.pFirst->szName, wSym );
|
||||
}
|
||||
else
|
||||
fprintf( yyc, "#include <init.h>\n\n" );
|
||||
|
||||
/* Generate functions data
|
||||
*/
|
||||
|
||||
@@ -7,6 +7,7 @@ ROOT = ../../
|
||||
C_SOURCES=\
|
||||
dynsym.c \
|
||||
hvm.c \
|
||||
initsymb.c \
|
||||
|
||||
LIB=vm
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
/* The Harbour virtual machine */
|
||||
/* $Id$
|
||||
*
|
||||
* The Harbour virtual machine
|
||||
*/
|
||||
|
||||
/* Please note the following comments we may use everywhere
|
||||
TODO: something should be added here
|
||||
@@ -117,6 +120,8 @@ void CodeblockEvaluate( PCODEBLOCK );
|
||||
void CodeblockCopy( PITEM, PITEM );
|
||||
void CodeblockDetach( PCODEBLOCK );
|
||||
|
||||
void InitSymbolTable( void ); /* initialization of runtime support symbols */
|
||||
|
||||
static void ForceLink( void );
|
||||
|
||||
ULONG hb_isMessage( PITEM, char * );
|
||||
@@ -185,6 +190,10 @@ BYTE bErrorLevel = 0; /* application exit errorlevel */
|
||||
#ifdef OBJ_GENERATION
|
||||
ProcessObjSymbols(); /* initialize Harbour generated OBJs symbols */
|
||||
#endif
|
||||
|
||||
/* Initialize symbol table with runtime support functions */
|
||||
InitSymbolTable();
|
||||
|
||||
DoInitFunctions( argc, argv ); /* process defined INIT functions */
|
||||
|
||||
#ifdef HARBOUR_MAIN
|
||||
|
||||
128
harbour/source/vm/initsymb.c
Normal file
128
harbour/source/vm/initsymb.c
Normal file
@@ -0,0 +1,128 @@
|
||||
/* $Id$
|
||||
*
|
||||
* Initiialization of runtime support symbols
|
||||
*/
|
||||
#include "hbsetup.h"
|
||||
#include "extend.h"
|
||||
#include "types.h"
|
||||
|
||||
void ProcessSymbols( SYMBOL *, WORD );
|
||||
|
||||
HARBOUR AADD( void );
|
||||
HARBOUR ABS( void );
|
||||
HARBOUR ASC( void );
|
||||
HARBOUR AT( void );
|
||||
HARBOUR CHR( void );
|
||||
HARBOUR CTOD( void );
|
||||
HARBOUR DAY( void );
|
||||
HARBOUR DTOC( void );
|
||||
HARBOUR DTOS( void );
|
||||
HARBOUR EMPTY( void );
|
||||
HARBOUR EXP( void );
|
||||
HARBOUR INT( void );
|
||||
HARBOUR LEFT( void );
|
||||
HARBOUR LEN( void );
|
||||
HARBOUR LOG( void );
|
||||
HARBOUR LOWER( void );
|
||||
HARBOUR LTRIM( void );
|
||||
HARBOUR MAX( void );
|
||||
HARBOUR MIN( void );
|
||||
HARBOUR MONTH( void );
|
||||
HARBOUR PCOUNT( void );
|
||||
HARBOUR REPLICATE( void );
|
||||
HARBOUR RTRIM( void );
|
||||
HARBOUR SPACE( void );
|
||||
HARBOUR SQRT( void );
|
||||
HARBOUR STR( void );
|
||||
HARBOUR STR( void );
|
||||
HARBOUR SUBSTR( void );
|
||||
HARBOUR TIME( void );
|
||||
HARBOUR TRANSFORM( void );
|
||||
HARBOUR TRIM( void );
|
||||
HARBOUR UPPER( void );
|
||||
HARBOUR VAL( void );
|
||||
HARBOUR YEAR( void );
|
||||
|
||||
|
||||
static SYMBOL symbols[] = {
|
||||
{ "AADD" , FS_PUBLIC, AADD , 0 },
|
||||
{ "ABS" , FS_PUBLIC, ABS , 0 },
|
||||
{ "ASC" , FS_PUBLIC, ASC , 0 },
|
||||
{ "AT" , FS_PUBLIC, AT , 0 },
|
||||
{ "BOF" , FS_PUBLIC, NULL , 0 },
|
||||
{ "BREAK" , FS_PUBLIC, NULL , 0 },
|
||||
{ "CDOW" , FS_PUBLIC, NULL , 0 },
|
||||
{ "CHR" , FS_PUBLIC, CHR , 0 },
|
||||
{ "CMONTH" , FS_PUBLIC, NULL , 0 },
|
||||
{ "COL" , FS_PUBLIC, NULL , 0 },
|
||||
{ "CTOD" , FS_PUBLIC, CTOD , 0 },
|
||||
{ "DATE" , FS_PUBLIC, NULL , 0 },
|
||||
{ "DAY" , FS_PUBLIC, DAY , 0 },
|
||||
{ "DELETED" , FS_PUBLIC, NULL , 0 },
|
||||
{ "DEVPOS" , FS_PUBLIC, NULL , 0 },
|
||||
{ "DO" , FS_PUBLIC, NULL , 0 },
|
||||
{ "DOW" , FS_PUBLIC, NULL , 0 },
|
||||
{ "DTOC" , FS_PUBLIC, DTOC , 0 },
|
||||
{ "DTOS" , FS_PUBLIC, DTOS , 0 },
|
||||
{ "EMPTY" , FS_PUBLIC, EMPTY , 0 },
|
||||
{ "EOF" , FS_PUBLIC, NULL , 0 },
|
||||
{ "EXP" , FS_PUBLIC, EXP , 0 },
|
||||
{ "FCOUNT" , FS_PUBLIC, NULL , 0 },
|
||||
{ "FIELDNAME" , FS_PUBLIC, NULL , 0 },
|
||||
{ "FLOCK" , FS_PUBLIC, NULL , 0 },
|
||||
{ "FOUND" , FS_PUBLIC, NULL , 0 },
|
||||
{ "INKEY" , FS_PUBLIC, NULL , 0 },
|
||||
{ "INT" , FS_PUBLIC, INT , 0 },
|
||||
{ "LASTREC" , FS_PUBLIC, NULL , 0 },
|
||||
{ "LEFT" , FS_PUBLIC, LEFT , 0 },
|
||||
{ "LEN" , FS_PUBLIC, LEN , 0 },
|
||||
{ "LOCK" , FS_PUBLIC, NULL , 0 },
|
||||
{ "LOG" , FS_PUBLIC, LOG , 0 },
|
||||
{ "LOWER" , FS_PUBLIC, LOWER , 0 },
|
||||
{ "LTRIM" , FS_PUBLIC, LTRIM , 0 },
|
||||
{ "MAX" , FS_PUBLIC, MAX , 0 },
|
||||
{ "MIN" , FS_PUBLIC, MIN , 0 },
|
||||
{ "MONTH" , FS_PUBLIC, MONTH , 0 },
|
||||
{ "PCOL" , FS_PUBLIC, NULL , 0 },
|
||||
{ "PCOUNT" , FS_PUBLIC, PCOUNT , 0 },
|
||||
{ "PROW" , FS_PUBLIC, NULL , 0 },
|
||||
{ "QSELF" , FS_PUBLIC, NULL , 0 },
|
||||
{ "RECCOUNT" , FS_PUBLIC, NULL , 0 },
|
||||
{ "RECNO" , FS_PUBLIC, NULL , 0 },
|
||||
{ "REPLICATE" , FS_PUBLIC, REPLICATE , 0 },
|
||||
{ "RLOCK" , FS_PUBLIC, NULL , 0 },
|
||||
{ "ROUND" , FS_PUBLIC, NULL , 0 },
|
||||
{ "ROW" , FS_PUBLIC, NULL , 0 },
|
||||
{ "RTRIM" , FS_PUBLIC, RTRIM , 0 },
|
||||
{ "SECONDS" , FS_PUBLIC, NULL , 0 },
|
||||
{ "SELECT" , FS_PUBLIC, NULL , 0 },
|
||||
{ "SETPOS" , FS_PUBLIC, NULL , 0 },
|
||||
{ "SPACE" , FS_PUBLIC, SPACE , 0 },
|
||||
{ "SQRT" , FS_PUBLIC, SQRT , 0 },
|
||||
{ "STR" , FS_PUBLIC, STR , 0 },
|
||||
{ "SUBSTR" , FS_PUBLIC, SUBSTR , 0 },
|
||||
{ "TIME" , FS_PUBLIC, TIME , 0 },
|
||||
{ "TRANSFORM" , FS_PUBLIC, TRANSFORM , 0 },
|
||||
{ "TRIM" , FS_PUBLIC, TRIM , 0 },
|
||||
{ "TYPE" , FS_PUBLIC, NULL , 0 },
|
||||
{ "UPPER" , FS_PUBLIC, UPPER , 0 },
|
||||
{ "VAL" , FS_PUBLIC, VAL , 0 },
|
||||
{ "WORD" , FS_PUBLIC, NULL , 0 },
|
||||
{ "YEAR" , FS_PUBLIC, YEAR , 0 }
|
||||
};
|
||||
|
||||
/*
|
||||
* Registers runtime support functions symbols
|
||||
*/
|
||||
void InitSymbolTable( void )
|
||||
{
|
||||
/*
|
||||
* Place here your <modulename>__InitSymbols functions
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* The system symbol table with runtime functions HAVE TO be called last
|
||||
*/
|
||||
ProcessSymbols( symbols, sizeof(symbols)/sizeof( SYMBOL ) );
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
#
|
||||
include ..\..\makedos.env
|
||||
|
||||
OBJECTS=hvm.o dynsym.o
|
||||
OBJECTS=hvm.o dynsym.o initsymb.o
|
||||
|
||||
all: $(HARBOURLIB)
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
TARGET=$(HARBOURLIB)
|
||||
|
||||
OBJECTS=hvm.obj dynsym.obj
|
||||
OBJECTS=hvm.obj dynsym.obj initsymb.obj
|
||||
|
||||
all : $(TARGET)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user