19990916-03:17 GMT+1
This commit is contained in:
@@ -1,3 +1,17 @@
|
||||
19990916-03:17 GMT+1 Victor Szel <info@szelvesz.hu>
|
||||
|
||||
* source/debug/*.*
|
||||
source/hbpp/*.*
|
||||
source/hbpp/stdalone/hbpp.c
|
||||
+ Copyright text changed to the newer version.
|
||||
+ Missing copyright headers added.
|
||||
* source/runner/runlib.c
|
||||
+ TODO: added about default extension handling.
|
||||
* source/hbpp/stdalone/hbpp.c
|
||||
source/hbpp/hbppint.c
|
||||
source/hbpp/hbpplib.c
|
||||
! Formatting error corrected.
|
||||
|
||||
19990914-20:45 EDT David G. Holm <dholm@jsd-llc.com>
|
||||
+ config/win32/mingw32.cf
|
||||
* source/hbpp/hbpp.c
|
||||
|
||||
@@ -3,35 +3,35 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
Harbour Project source code
|
||||
|
||||
The Harbour debugger
|
||||
|
||||
Copyright 1999 Antonio Linares <alinares@fivetech.com>
|
||||
www - http://www.harbour-project.org
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version, with one exception:
|
||||
|
||||
The exception is that if you link the Harbour Runtime Library (HRL)
|
||||
and/or the Harbour Virtual Machine (HVM) with other files to produce
|
||||
an executable, this does not by itself cause the resulting executable
|
||||
to be covered by the GNU General Public License. Your use of that
|
||||
executable is in no way restricted on account of linking the HRL
|
||||
and/or HVM code into it.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
|
||||
their web site at http://www.gnu.org/).
|
||||
*/
|
||||
* Harbour Project source code:
|
||||
* The Debugger
|
||||
*
|
||||
* Copyright 1999 Antonio Linares <alinares@fivetech.com>
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version, with one exception:
|
||||
*
|
||||
* The exception is that if you link the Harbour Runtime Library (HRL)
|
||||
* and/or the Harbour Virtual Machine (HVM) with other files to produce
|
||||
* an executable, this does not by itself cause the resulting executable
|
||||
* to be covered by the GNU General Public License. Your use of that
|
||||
* executable is in no way restricted on account of linking the HRL
|
||||
* and/or HVM code into it.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
|
||||
* their web site at http://www.gnu.org/).
|
||||
*
|
||||
*/
|
||||
|
||||
#include "box.ch"
|
||||
#include "classes.ch"
|
||||
|
||||
@@ -2,7 +2,36 @@
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
// Browses a text file
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* Text file browser class
|
||||
*
|
||||
* Copyright 1999 {list of individual authors and e-mail addresses}
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version, with one exception:
|
||||
*
|
||||
* The exception is that if you link the Harbour Runtime Library (HRL)
|
||||
* and/or the Harbour Virtual Machine (HVM) with other files to produce
|
||||
* an executable, this does not by itself cause the resulting executable
|
||||
* to be covered by the GNU General Public License. Your use of that
|
||||
* executable is in no way restricted on account of linking the HRL
|
||||
* and/or HVM code into it.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
|
||||
* their web site at http://www.gnu.org/).
|
||||
*
|
||||
*/
|
||||
|
||||
#include "classes.ch"
|
||||
#include "common.ch"
|
||||
|
||||
@@ -3,34 +3,34 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
Harbour Project source code
|
||||
|
||||
This file contains the main part of preprocessor implementation.
|
||||
|
||||
Copyright 1999 Alexander S.Kresin <alex@belacy.belgorod.su>
|
||||
www - http://www.harbour-project.org
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version, with one exception:
|
||||
|
||||
The exception is that if you link the Harbour Runtime Library (HRL)
|
||||
and/or the Harbour Virtual Machine (HVM) with other files to produce
|
||||
an executable, this does not by itself cause the resulting executable
|
||||
to be covered by the GNU General Public License. Your use of that
|
||||
executable is in no way restricted on account of linking the HRL
|
||||
and/or HVM code into it.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
|
||||
their web site at http://www.gnu.org/).
|
||||
* Harbour Project source code:
|
||||
* Preprocessor core module
|
||||
*
|
||||
* Copyright 1999 Alexander S.Kresin <alex@belacy.belgorod.su>
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version, with one exception:
|
||||
*
|
||||
* The exception is that if you link the Harbour Runtime Library (HRL)
|
||||
* and/or the Harbour Virtual Machine (HVM) with other files to produce
|
||||
* an executable, this does not by itself cause the resulting executable
|
||||
* to be covered by the GNU General Public License. Your use of that
|
||||
* executable is in no way restricted on account of linking the HRL
|
||||
* and/or HVM code into it.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
|
||||
* their web site at http://www.gnu.org/).
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -3,167 +3,180 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
Harbour Project source code
|
||||
|
||||
This file contains some functions of preprocessor, which provides
|
||||
a link with compiler.
|
||||
|
||||
Copyright 1999 Alexander S.Kresin <alex@belacy.belgorod.su>
|
||||
www - http://www.harbour-project.org
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version, with one exception:
|
||||
|
||||
The exception is that if you link the Harbour Runtime Library (HRL)
|
||||
and/or the Harbour Virtual Machine (HVM) with other files to produce
|
||||
an executable, this does not by itself cause the resulting executable
|
||||
to be covered by the GNU General Public License. Your use of that
|
||||
executable is in no way restricted on account of linking the HRL
|
||||
and/or HVM code into it.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
|
||||
their web site at http://www.gnu.org/).
|
||||
* Harbour Project source code:
|
||||
* Preprocessor & Compiler integration module
|
||||
*
|
||||
* Copyright 1999 Alexander S.Kresin <alex@belacy.belgorod.su>
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version, with one exception:
|
||||
*
|
||||
* The exception is that if you link the Harbour Runtime Library (HRL)
|
||||
* and/or the Harbour Virtual Machine (HVM) with other files to produce
|
||||
* an executable, this does not by itself cause the resulting executable
|
||||
* to be covered by the GNU General Public License. Your use of that
|
||||
* executable is in no way restricted on account of linking the HRL
|
||||
* and/or HVM code into it.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
|
||||
* their web site at http://www.gnu.org/).
|
||||
*
|
||||
*/
|
||||
|
||||
#if ( defined(__GNUC__) || defined(__WATCOMC__) ) && ! defined(__MINGW32__)
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#elif ( defined(_MSC_VER) || defined(__IBMCPP__) )
|
||||
#include <memory.h>
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#include <alloc.h>
|
||||
#include <mem.h>
|
||||
#include <alloc.h>
|
||||
#include <mem.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include "hbpp.h"
|
||||
#include "hberrors.h"
|
||||
|
||||
void Hbpp_init ( void );
|
||||
int PreProcess( FILE*, FILE*, char *);
|
||||
int Hp_Parse( FILE*, FILE* );
|
||||
int PreProcess( FILE *, FILE *, char * );
|
||||
int Hp_Parse( FILE *, FILE * );
|
||||
|
||||
int iBuffer, lenBuffer;
|
||||
BOOL _bPPO = 0;
|
||||
char sLine[ STR_SIZE ], sOutLine[ STR_SIZE ];
|
||||
FILE *yyppo;
|
||||
FILE * yyppo;
|
||||
|
||||
void Hbpp_init ( void )
|
||||
void Hbpp_init( void )
|
||||
{
|
||||
lenBuffer = 10;
|
||||
iBuffer = 10;
|
||||
aCondCompile = (int*) hb_xgrab( sizeof(int) * 5 );
|
||||
lenBuffer = 10;
|
||||
iBuffer = 10;
|
||||
aCondCompile = ( int * ) hb_xgrab( sizeof( int ) * 5 );
|
||||
}
|
||||
|
||||
int PreProcess( FILE* handl_i, FILE* handl_o, char *sOut )
|
||||
int PreProcess( FILE * handl_i, FILE * handl_o, char * sOut )
|
||||
{
|
||||
static char sBuffer[BUFF_SIZE]; /* File read buffer */
|
||||
char *ptr, *ptrOut = sOut;
|
||||
int lContinue = 0;
|
||||
int lens=0, rdlen;
|
||||
int rezParse;
|
||||
while ( ( rdlen = pp_RdStr(handl_i,sLine+lens, STR_SIZE-lens,lContinue,
|
||||
sBuffer,&lenBuffer,&iBuffer ) ) >= 0 )
|
||||
{
|
||||
if ( !lInclude ) nline++;
|
||||
lens += rdlen;
|
||||
|
||||
if( sLine[lens-1] == ';' )
|
||||
{
|
||||
lContinue = 1;
|
||||
lens--; lens--;
|
||||
while ( sLine[lens] == ' ' || sLine[lens] == '\t' ) lens--;
|
||||
if ( sLine[lens+1] == ' ' || sLine[lens+1] == '\t' ) lens++;
|
||||
sLine[++lens] = '\0';
|
||||
|
||||
*ptrOut++ = '\n';
|
||||
}
|
||||
else { lContinue = 0; lens=0; }
|
||||
|
||||
if ( !lContinue )
|
||||
{
|
||||
if ( *sLine != '\0' )
|
||||
static char sBuffer[ BUFF_SIZE ]; /* File read buffer */
|
||||
char *ptr, *ptrOut = sOut;
|
||||
int lContinue = 0;
|
||||
int lens = 0, rdlen;
|
||||
int rezParse;
|
||||
while( ( rdlen = pp_RdStr( handl_i, sLine + lens, STR_SIZE - lens, lContinue,
|
||||
sBuffer, &lenBuffer, &iBuffer ) ) >= 0 )
|
||||
{
|
||||
ptr = sLine;
|
||||
SKIPTABSPACES( ptr );
|
||||
if ( *ptr == '#' )
|
||||
{
|
||||
if ( (rezParse=ParseDirective( ptr+1 )) == 0 )
|
||||
*sLine = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( nCondCompile==0 || aCondCompile[nCondCompile-1])
|
||||
if( ! lInclude )
|
||||
nline++;
|
||||
lens += rdlen;
|
||||
|
||||
if( sLine[ lens - 1 ] == ';' )
|
||||
{
|
||||
if ( (rezParse = ParseExpression( ptr, sOutLine)) > 0 )
|
||||
{
|
||||
printf ( "\nError number %u in line %u\n", rezParse, nline );
|
||||
}
|
||||
lContinue = 1;
|
||||
lens--;
|
||||
lens--;
|
||||
while( sLine[ lens ] == ' ' || sLine[ lens ] == '\t' ) lens--;
|
||||
if( sLine[ lens + 1 ] == ' ' || sLine[ lens + 1 ] == '\t' ) lens++;
|
||||
sLine[ ++lens ] = '\0';
|
||||
|
||||
*ptrOut++ = '\n';
|
||||
}
|
||||
else
|
||||
{
|
||||
lContinue = 0;
|
||||
lens = 0;
|
||||
}
|
||||
|
||||
if( !lContinue )
|
||||
{
|
||||
if( *sLine != '\0' )
|
||||
{
|
||||
ptr = sLine;
|
||||
SKIPTABSPACES( ptr );
|
||||
if( *ptr == '#' )
|
||||
{
|
||||
if( ( rezParse = ParseDirective( ptr + 1 ) ) == 0 )
|
||||
*sLine = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
if( nCondCompile == 0 || aCondCompile[ nCondCompile - 1 ] )
|
||||
{
|
||||
if( ( rezParse = ParseExpression( ptr, sOutLine ) ) > 0 )
|
||||
{
|
||||
printf( "\nError number %u in line %u\n", rezParse, nline );
|
||||
}
|
||||
}
|
||||
else
|
||||
*sLine = '\0';
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
else *sLine = '\0';
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( rdlen < 0 ) return 0;
|
||||
if( rdlen < 0 ) return 0;
|
||||
|
||||
lens = strocpy( ptrOut, sLine ) + ( ptrOut - sOut );
|
||||
*( sOut + lens++ ) = '\n';
|
||||
*( sOut + lens ) = '\0';
|
||||
lens = strocpy( ptrOut, sLine ) + ( ptrOut - sOut );
|
||||
*( sOut + lens++ ) = '\n';
|
||||
*( sOut + lens ) = '\0';
|
||||
|
||||
if ( _bPPO )
|
||||
pp_WrStr(handl_o,sOut);
|
||||
if( _bPPO )
|
||||
pp_WrStr( handl_o, sOut );
|
||||
|
||||
return lens;
|
||||
return lens;
|
||||
}
|
||||
|
||||
int Hp_Parse( FILE* handl_i, FILE* handl_o )
|
||||
int Hp_Parse( FILE * handl_i, FILE * handl_o )
|
||||
{
|
||||
char *sBuffer = (char *)hb_xgrab( BUFF_SIZE ); /* File read buffer */
|
||||
char *ptr;
|
||||
int lContinue = 0;
|
||||
int iBuffer = 10, lenBuffer = 10;
|
||||
int lens=0, rdlen;
|
||||
while ( ( rdlen = pp_RdStr(handl_i,sLine+lens, STR_SIZE-lens,lContinue,
|
||||
sBuffer,&lenBuffer,&iBuffer ) ) >= 0 )
|
||||
{
|
||||
lens += rdlen;
|
||||
|
||||
if( sLine[lens-1] == ';' )
|
||||
{
|
||||
lContinue = 1;
|
||||
lens--; lens--;
|
||||
while ( sLine[lens] == ' ' || sLine[lens] == '\t' ) lens--;
|
||||
sLine[++lens] = '\0';
|
||||
}
|
||||
else { lContinue = 0; lens=0; }
|
||||
|
||||
if ( !lContinue )
|
||||
{
|
||||
if ( *sLine != '\0' )
|
||||
char * sBuffer = ( char * ) hb_xgrab( BUFF_SIZE ); /* File read buffer */
|
||||
char * ptr;
|
||||
int lContinue = 0;
|
||||
int iBuffer = 10, lenBuffer = 10;
|
||||
int lens = 0, rdlen;
|
||||
while( ( rdlen = pp_RdStr( handl_i, sLine + lens, STR_SIZE - lens, lContinue,
|
||||
sBuffer, &lenBuffer, &iBuffer ) ) >= 0 )
|
||||
{
|
||||
ptr = sLine;
|
||||
SKIPTABSPACES( ptr );
|
||||
if ( *ptr == '#' )
|
||||
{
|
||||
ParseDirective( ptr+1 );
|
||||
*sLine = '\0';
|
||||
}
|
||||
else
|
||||
GenWarning( _szPWarnings, 'I', WARN_NONDIRECTIVE, NULL, NULL );
|
||||
lens += rdlen;
|
||||
|
||||
if( sLine[ lens - 1 ] == ';' )
|
||||
{
|
||||
lContinue = 1;
|
||||
lens--;
|
||||
lens--;
|
||||
while( sLine[ lens ] == ' ' || sLine[ lens ] == '\t' ) lens--;
|
||||
sLine[ ++lens ] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
lContinue = 0;
|
||||
lens = 0;
|
||||
}
|
||||
|
||||
if( !lContinue )
|
||||
{
|
||||
if( *sLine != '\0' )
|
||||
{
|
||||
ptr = sLine;
|
||||
SKIPTABSPACES( ptr );
|
||||
if( *ptr == '#' )
|
||||
{
|
||||
ParseDirective( ptr + 1 );
|
||||
*sLine = '\0';
|
||||
}
|
||||
else
|
||||
GenWarning( _szPWarnings, 'I', WARN_NONDIRECTIVE, NULL, NULL );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
hb_xfree( sBuffer );
|
||||
return 0;
|
||||
|
||||
hb_xfree( sBuffer );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3,36 +3,35 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
Harbour Project source code
|
||||
|
||||
This file contains source for a run-time preprocessing function
|
||||
|
||||
Copyright (C) 1999 Felipe G. Coury
|
||||
www - http://www.harbour-project.org
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version, with one exception:
|
||||
|
||||
The exception is that if you link the Harbour Runtime Library (HRL)
|
||||
and/or the Harbour Virtual Machine (HVM) with other files to produce
|
||||
an executable, this does not by itself cause the resulting executable
|
||||
to be covered by the GNU General Public License. Your use of that
|
||||
executable is in no way restricted on account of linking the HRL
|
||||
and/or HVM code into it.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
|
||||
their web site at http://www.gnu.org/).
|
||||
|
||||
*/
|
||||
* Harbour Project source code:
|
||||
* Preprocessor runtime library callable version
|
||||
*
|
||||
* Copyright 1999 Felipe G. Coury
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version, with one exception:
|
||||
*
|
||||
* The exception is that if you link the Harbour Runtime Library (HRL)
|
||||
* and/or the Harbour Virtual Machine (HVM) with other files to produce
|
||||
* an executable, this does not by itself cause the resulting executable
|
||||
* to be covered by the GNU General Public License. Your use of that
|
||||
* executable is in no way restricted on account of linking the HRL
|
||||
* and/or HVM code into it.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
|
||||
* their web site at http://www.gnu.org/).
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "hbpp.h"
|
||||
@@ -40,44 +39,44 @@
|
||||
#include "itemapi.h"
|
||||
#include "hberrors.h"
|
||||
|
||||
PATHNAMES *_pIncludePath = NULL;
|
||||
PATHNAMES * _pIncludePath = NULL;
|
||||
PHB_FNAME _pFileName = NULL;
|
||||
BOOL _bWarnings = FALSE;
|
||||
|
||||
/* TODO: Extend the function to allow directives
|
||||
and external include files */
|
||||
HARBOUR HB___PREPROCESS(void)
|
||||
HARBOUR HB___PREPROCESS( void )
|
||||
{
|
||||
if (ISCHAR(1))
|
||||
{
|
||||
char *pText = (char *)hb_xgrab(STR_SIZE);
|
||||
char *pOut = (char *)hb_xgrab(STR_SIZE);
|
||||
char *ptr = pText;
|
||||
if( ISCHAR( 1 ) )
|
||||
{
|
||||
char * pText = ( char * ) hb_xgrab( STR_SIZE );
|
||||
char * pOut = ( char * ) hb_xgrab( STR_SIZE );
|
||||
char * ptr = pText;
|
||||
|
||||
int slen, resParse;
|
||||
int slen, resParse;
|
||||
|
||||
slen = MIN(hb_parclen(1), STR_SIZE - 1);
|
||||
memcpy(pText, hb_parc(1), slen);
|
||||
pText[slen] = 0; /* Preprocessor expects null-terminated string */
|
||||
memset(pOut, 0, STR_SIZE);
|
||||
slen = MIN( hb_parclen( 1 ), STR_SIZE - 1 );
|
||||
memcpy( pText, hb_parc( 1 ), slen );
|
||||
pText[ slen ] = 0; /* Preprocessor expects null-terminated string */
|
||||
memset( pOut, 0, STR_SIZE );
|
||||
|
||||
SKIPTABSPACES( ptr );
|
||||
SKIPTABSPACES( ptr );
|
||||
|
||||
if ( (resParse = ParseExpression( ptr, pOut )) > 0 )
|
||||
{
|
||||
/* Some error here? */
|
||||
}
|
||||
if( ( resParse = ParseExpression( ptr, pOut ) ) > 0 )
|
||||
{
|
||||
/* Some error here? */
|
||||
}
|
||||
|
||||
hb_retc(pText); /* Preprocessor returns parsed line in input buffer */
|
||||
hb_retc( pText ); /* Preprocessor returns parsed line in input buffer */
|
||||
|
||||
hb_xfree(pText);
|
||||
hb_xfree(pOut);
|
||||
}
|
||||
else
|
||||
hb_retc("");
|
||||
hb_xfree( pText );
|
||||
hb_xfree( pOut );
|
||||
}
|
||||
else
|
||||
hb_retc( "" );
|
||||
}
|
||||
|
||||
void GenError( char* _szErrors[], char cPrefix, int iError, char * szError1, char * szError2 )
|
||||
void GenError( char * _szErrors[], char cPrefix, int iError, char * szError1, char * szError2 )
|
||||
{
|
||||
printf( "Error %c%i ", cPrefix, iError );
|
||||
printf( _szErrors[ iError - 1 ], szError1, szError2 );
|
||||
@@ -87,7 +86,7 @@ void GenError( char* _szErrors[], char cPrefix, int iError, char * szError1, cha
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
|
||||
void GenWarning( char* _szWarnings[], char cPrefix, int iWarning, char * szWarning1, char * szWarning2)
|
||||
void GenWarning( char * _szWarnings[], char cPrefix, int iWarning, char * szWarning1, char * szWarning2 )
|
||||
{
|
||||
if( _bWarnings && iWarning < WARN_ASSIGN_SUSPECT ) /* TODO: add switch to set level */
|
||||
{
|
||||
|
||||
@@ -1,42 +1,50 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
Harbour Project source code
|
||||
|
||||
This file contains some functions of preprocessor, which need for
|
||||
standalone version ( including main() function ).
|
||||
|
||||
Copyright 1999 Alexander S.Kresin <alex@belacy.belgorod.su>
|
||||
www - http://www.harbour-project.org
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version, with one exception:
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
|
||||
their web site at http://www.gnu.org/).
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* Preprocessor standalone main module
|
||||
*
|
||||
* Copyright 1999 Alexander S.Kresin <alex@belacy.belgorod.su>
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version, with one exception:
|
||||
*
|
||||
* The exception is that if you link the Harbour Runtime Library (HRL)
|
||||
* and/or the Harbour Virtual Machine (HVM) with other files to produce
|
||||
* an executable, this does not by itself cause the resulting executable
|
||||
* to be covered by the GNU General Public License. Your use of that
|
||||
* executable is in no way restricted on account of linking the HRL
|
||||
* and/or HVM code into it.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
|
||||
* their web site at http://www.gnu.org/).
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#if defined(__GNUC__)
|
||||
#include <unistd.h>
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#if ! defined(__MPW__)
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#if (defined(_MSC_VER) || defined(__IBMCPP__))
|
||||
#include <memory.h>
|
||||
#else
|
||||
#include <mem.h>
|
||||
#endif
|
||||
#if ! defined(__MPW__)
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#if (defined(_MSC_VER) || defined(__IBMCPP__))
|
||||
#include <memory.h>
|
||||
#else
|
||||
#include <mem.h>
|
||||
#endif
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
@@ -44,131 +52,143 @@
|
||||
#include "hbpp.h"
|
||||
#include "hberrors.h"
|
||||
|
||||
extern int pp_strAt(char *, int, char*, int);
|
||||
extern void pp_Stuff (char*, char*, int, int, int);
|
||||
extern int pp_strAt( char *, int, char *, int );
|
||||
extern void pp_Stuff( char *, char *, int, int, int );
|
||||
|
||||
int Hp_Parse( FILE*, FILE* );
|
||||
void OutTable( DEFINES*, COMMANDS* );
|
||||
int Hp_Parse( FILE *, FILE * );
|
||||
void OutTable( DEFINES *, COMMANDS * );
|
||||
void AddSearchPath( char *, PATHNAMES * * ); /* add pathname to a search list */
|
||||
|
||||
char sLine[STR_SIZE], sOutLine[STR_SIZE];
|
||||
char sLine[ STR_SIZE ], sOutLine[ STR_SIZE ];
|
||||
|
||||
PATHNAMES *_pIncludePath = NULL;
|
||||
PHB_FNAME _pFileName = NULL;
|
||||
BOOL _bWarnings = FALSE;
|
||||
|
||||
int main (int argc,char* argv[])
|
||||
int main( int argc, char * argv[] )
|
||||
{
|
||||
FILE *handl_i,*handl_o;
|
||||
FILE * handl_i;
|
||||
FILE * handl_o;
|
||||
char szFileName[ _POSIX_PATH_MAX ];
|
||||
char * szDefText;
|
||||
int iArg = 1, i;
|
||||
BOOL bOutTable = FALSE;
|
||||
BOOL bOutNew = FALSE;
|
||||
DEFINES *stdef = topDefine;
|
||||
COMMANDS *stcmd = topCommand;
|
||||
DEFINES * stdef = topDefine;
|
||||
COMMANDS * stcmd = topCommand;
|
||||
|
||||
printf( "Harbour preprocessor\n" );
|
||||
while( iArg < argc )
|
||||
{
|
||||
if( IS_OPT_SEP(argv[ iArg ][ 0 ]))
|
||||
{
|
||||
switch( argv[ iArg ][ 1 ] )
|
||||
{
|
||||
case 'd':
|
||||
case 'D': /* defines a #define from the command line */
|
||||
{
|
||||
i = 0;
|
||||
szDefText = strodup( argv[ iArg ] + 2 );
|
||||
while( i < strolen( szDefText ) && szDefText[ i ] != '=' )
|
||||
i++;
|
||||
if( szDefText[ i ] != '=' )
|
||||
AddDefine( szDefText, 0 );
|
||||
else
|
||||
{
|
||||
szDefText[ i ] = 0;
|
||||
AddDefine( szDefText, szDefText + i + 1 );
|
||||
}
|
||||
free( szDefText );
|
||||
}
|
||||
break;
|
||||
case 'i':
|
||||
case 'I':
|
||||
AddSearchPath( argv[ iArg ]+2, &_pIncludePath );
|
||||
break;
|
||||
case 'o':
|
||||
case 'O':
|
||||
bOutTable = TRUE;
|
||||
break;
|
||||
case 'n':
|
||||
case 'N':
|
||||
bOutNew = TRUE;
|
||||
break;
|
||||
case 'w':
|
||||
case 'W':
|
||||
_bWarnings = TRUE;
|
||||
break;
|
||||
default:
|
||||
printf( "\nInvalid command line option: %s\n", &argv[ iArg ][ 1 ] );
|
||||
break;
|
||||
}
|
||||
}
|
||||
else _pFileName =hb_fsFNameSplit( argv[ iArg ] );
|
||||
iArg++;
|
||||
if( IS_OPT_SEP(argv[ iArg ][ 0 ]))
|
||||
{
|
||||
switch( argv[ iArg ][ 1 ] )
|
||||
{
|
||||
case 'd':
|
||||
case 'D': /* defines a #define from the command line */
|
||||
{
|
||||
i = 0;
|
||||
szDefText = strodup( argv[ iArg ] + 2 );
|
||||
while( i < strolen( szDefText ) && szDefText[ i ] != '=' )
|
||||
i++;
|
||||
if( szDefText[ i ] != '=' )
|
||||
AddDefine( szDefText, 0 );
|
||||
else
|
||||
{
|
||||
szDefText[ i ] = 0;
|
||||
AddDefine( szDefText, szDefText + i + 1 );
|
||||
}
|
||||
free( szDefText );
|
||||
}
|
||||
break;
|
||||
case 'i':
|
||||
case 'I':
|
||||
AddSearchPath( argv[ iArg ]+2, &_pIncludePath );
|
||||
break;
|
||||
case 'o':
|
||||
case 'O':
|
||||
bOutTable = TRUE;
|
||||
break;
|
||||
case 'n':
|
||||
case 'N':
|
||||
bOutNew = TRUE;
|
||||
break;
|
||||
case 'w':
|
||||
case 'W':
|
||||
_bWarnings = TRUE;
|
||||
break;
|
||||
default:
|
||||
printf( "\nInvalid command line option: %s\n", &argv[ iArg ][ 1 ] );
|
||||
break;
|
||||
}
|
||||
}
|
||||
else _pFileName = hb_fsFNameSplit( argv[ iArg ] );
|
||||
iArg++;
|
||||
}
|
||||
if( _pFileName )
|
||||
{
|
||||
if( !_pFileName->szExtension ) _pFileName->szExtension =".prg";
|
||||
if( ! _pFileName->szExtension )
|
||||
_pFileName->szExtension =".prg";
|
||||
|
||||
hb_fsFNameMerge( szFileName, _pFileName );
|
||||
|
||||
if ((handl_i = fopen(szFileName, "r")) == NULL)
|
||||
{ printf("\nCan't open %s\n",szFileName); return 1; }
|
||||
printf( "\nParsing file %s\n", szFileName );
|
||||
if( ( handl_i = fopen( szFileName, "r" ) ) == NULL )
|
||||
{
|
||||
printf("\nCan't open %s\n", szFileName );
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf( "\nParsing file %s\n", szFileName );
|
||||
}
|
||||
else
|
||||
{
|
||||
printf( "Syntax: hbpp <file.prg> [options]\n"
|
||||
"\nOptions: \n"
|
||||
"\t/d<id>[=<val>]\t#define <id>\n"
|
||||
"\t/i<path>\tadd #include file search path\n"
|
||||
"\t/o\t\tcreates hbpp.out with all tables\n"
|
||||
"\t/n\t\twith those only, which defined in your file\n"
|
||||
"\t/w\t\tenable warnings\n");
|
||||
printf( "Syntax: hbpp <file.prg> [options]\n"
|
||||
"\nOptions: \n"
|
||||
"\t/d<id>[=<val>]\t#define <id>\n"
|
||||
"\t/i<path>\tadd #include file search path\n"
|
||||
"\t/o\t\tcreates hbpp.out with all tables\n"
|
||||
"\t/n\t\twith those only, which defined in your file\n"
|
||||
"\t/w\t\tenable warnings\n" );
|
||||
|
||||
if( bOutTable )
|
||||
OutTable( NULL, NULL );
|
||||
return 1;
|
||||
if( bOutTable )
|
||||
OutTable( NULL, NULL );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
_pFileName->szExtension =".ppo";
|
||||
_pFileName->szExtension = ".ppo";
|
||||
hb_fsFNameMerge( szFileName, _pFileName );
|
||||
|
||||
if ((handl_o = fopen(szFileName, "wt" )) == NULL)
|
||||
{ printf("\nCan't open %s\n",szFileName); return 1; }
|
||||
|
||||
if( ( handl_o = fopen( szFileName, "wt" ) ) == NULL )
|
||||
{
|
||||
char * szInclude = getenv( "INCLUDE" );
|
||||
|
||||
if( szInclude )
|
||||
{
|
||||
char * pPath;
|
||||
char * pDelim;
|
||||
|
||||
pPath = szInclude = strodup( szInclude );
|
||||
while( (pDelim = strchr( pPath, OS_PATH_LIST_SEPARATOR )) != NULL )
|
||||
{
|
||||
*pDelim = '\0';
|
||||
AddSearchPath( pPath, &_pIncludePath );
|
||||
pPath = pDelim + 1;
|
||||
}
|
||||
AddSearchPath( pPath, &_pIncludePath );
|
||||
}
|
||||
printf("\nCan't open %s\n", szFileName );
|
||||
return 1;
|
||||
}
|
||||
|
||||
aCondCompile = (int*) hb_xgrab( sizeof(int) * 5 );
|
||||
{
|
||||
char * szInclude = getenv( "INCLUDE" );
|
||||
|
||||
Hp_Parse(handl_i,handl_o );
|
||||
fclose(handl_i); fclose(handl_o);
|
||||
if( szInclude )
|
||||
{
|
||||
char * pPath;
|
||||
char * pDelim;
|
||||
|
||||
pPath = szInclude = strodup( szInclude );
|
||||
while( ( pDelim = strchr( pPath, OS_PATH_LIST_SEPARATOR ) ) != NULL )
|
||||
{
|
||||
*pDelim = '\0';
|
||||
AddSearchPath( pPath, &_pIncludePath );
|
||||
pPath = pDelim + 1;
|
||||
}
|
||||
AddSearchPath( pPath, &_pIncludePath );
|
||||
}
|
||||
}
|
||||
|
||||
aCondCompile = ( int * ) hb_xgrab( sizeof( int ) * 5 );
|
||||
|
||||
Hp_Parse( handl_i, handl_o );
|
||||
fclose( handl_i );
|
||||
fclose( handl_o );
|
||||
|
||||
if( bOutTable )
|
||||
OutTable( NULL, NULL );
|
||||
@@ -176,68 +196,75 @@ int main (int argc,char* argv[])
|
||||
OutTable( stdef, stcmd );
|
||||
|
||||
printf( "\nOk" );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Hp_Parse( FILE* handl_i, FILE* handl_o )
|
||||
int Hp_Parse( FILE * handl_i, FILE * handl_o )
|
||||
{
|
||||
char sBuffer[BUFF_SIZE]; /* File read buffer */
|
||||
char *ptr;
|
||||
char sBuffer[ BUFF_SIZE ]; /* File read buffer */
|
||||
char * ptr;
|
||||
int lContinue = 0;
|
||||
int iBuffer = 10, lenBuffer = 10;
|
||||
int lens=0, rdlen;
|
||||
int lens = 0, rdlen;
|
||||
|
||||
while ( ( rdlen = pp_RdStr(handl_i,sLine+lens, STR_SIZE-lens,lContinue,
|
||||
sBuffer,&lenBuffer,&iBuffer ) ) >= 0 )
|
||||
while( ( rdlen = pp_RdStr( handl_i, sLine + lens, STR_SIZE - lens, lContinue,
|
||||
sBuffer, &lenBuffer, &iBuffer ) ) >= 0 )
|
||||
{
|
||||
if ( !lInclude ) nline++;
|
||||
if( ! lInclude ) nline++;
|
||||
lens += rdlen;
|
||||
|
||||
if( sLine[lens-1] == ';' )
|
||||
if( sLine[ lens - 1 ] == ';' )
|
||||
{
|
||||
lContinue = 1;
|
||||
lens--; lens--;
|
||||
while ( sLine[lens] == ' ' || sLine[lens] == '\t' ) lens--;
|
||||
if ( sLine[lens+1] == ' ' || sLine[lens+1] == '\t' ) lens++;
|
||||
sLine[++lens] = '\0';
|
||||
lens--;
|
||||
lens--;
|
||||
while( sLine[ lens ] == ' ' || sLine[ lens ] == '\t' ) lens--;
|
||||
if( sLine[ lens + 1 ] == ' ' || sLine[ lens+ 1 ] == '\t' ) lens++;
|
||||
sLine[ ++lens ] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
lContinue = 0;
|
||||
lens = 0;
|
||||
}
|
||||
else { lContinue = 0; lens=0; }
|
||||
|
||||
if ( *sLine != '\0' && !lContinue )
|
||||
if( *sLine != '\0' && !lContinue )
|
||||
{
|
||||
printf( "\r line %i", nline );
|
||||
ptr = sLine;
|
||||
SKIPTABSPACES( ptr );
|
||||
if ( *ptr == '#' )
|
||||
if( *ptr == '#' )
|
||||
{
|
||||
if ( ParseDirective( ptr+1 ) == 0 )
|
||||
if( ParseDirective( ptr + 1 ) == 0 )
|
||||
*sLine = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( nCondCompile==0 || aCondCompile[nCondCompile-1])
|
||||
if( nCondCompile == 0 || aCondCompile[ nCondCompile - 1 ] )
|
||||
ParseExpression( ptr, sOutLine );
|
||||
else
|
||||
*sLine = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
if(!lInclude)
|
||||
if( ! lInclude )
|
||||
{
|
||||
if( lContinue ) pp_WrStr(handl_o,"\n");
|
||||
else pp_WrStr(handl_o,sLine);
|
||||
if( lContinue ) pp_WrStr( handl_o, "\n" );
|
||||
else pp_WrStr( handl_o, sLine );
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void OutTable( DEFINES* endDefine, COMMANDS* endCommand )
|
||||
void OutTable( DEFINES * endDefine, COMMANDS * endCommand )
|
||||
{
|
||||
FILE *handl_o;
|
||||
int ipos, len_mpatt, len_value;
|
||||
int num;
|
||||
DEFINES *stdef1 = topDefine, *stdef2 = NULL, *stdef3;
|
||||
COMMANDS *stcmd1 = topCommand, *stcmd2 = NULL, *stcmd3;
|
||||
DEFINES * stdef1 = topDefine, * stdef2 = NULL, * stdef3;
|
||||
COMMANDS * stcmd1 = topCommand, * stcmd2 = NULL, * stcmd3;
|
||||
|
||||
while( stdef1 != endDefine )
|
||||
{
|
||||
@@ -254,7 +281,7 @@ void OutTable( DEFINES* endDefine, COMMANDS* endCommand )
|
||||
stcmd1 = stcmd3;
|
||||
}
|
||||
|
||||
if ((handl_o = fopen("hbpp.out", "wt" )) == NULL)
|
||||
if( ( handl_o = fopen( "hbpp.out", "wt" ) ) == NULL )
|
||||
{
|
||||
printf( "\nCan't open hbpp.out\n" );
|
||||
return;
|
||||
@@ -263,74 +290,75 @@ void OutTable( DEFINES* endDefine, COMMANDS* endCommand )
|
||||
num = 1;
|
||||
while( stdef2 != NULL )
|
||||
{
|
||||
fprintf( handl_o,"\n static DEFINES sD___%i = ",num );
|
||||
fprintf( handl_o,"{\"%s\",", stdef2->name);
|
||||
fprintf( handl_o, "\n static DEFINES sD___%i = ", num );
|
||||
fprintf( handl_o, "{\"%s\",", stdef2->name );
|
||||
if( stdef2->pars )
|
||||
fprintf(handl_o, "\"%s\",", stdef2->pars);
|
||||
fprintf( handl_o, "\"%s\",", stdef2->pars );
|
||||
else
|
||||
fprintf(handl_o, "NULL,");
|
||||
fprintf(handl_o, "%d,", stdef2->npars);
|
||||
fprintf( handl_o, "NULL," );
|
||||
fprintf( handl_o, "%d,", stdef2->npars );
|
||||
if( stdef2->value )
|
||||
fprintf(handl_o, "\"%s\"", stdef2->value);
|
||||
fprintf( handl_o, "\"%s\"", stdef2->value );
|
||||
else
|
||||
fprintf(handl_o, "NULL");
|
||||
fprintf( handl_o, "NULL" );
|
||||
if( num == 1 )
|
||||
fprintf(handl_o, ", NULL };");
|
||||
fprintf( handl_o, ", NULL };" );
|
||||
else
|
||||
fprintf(handl_o, ", &sD___%i };", num-1);
|
||||
fprintf( handl_o, ", &sD___%i };", num - 1 );
|
||||
stdef2 = stdef2->last;
|
||||
num++;
|
||||
}
|
||||
fprintf( handl_o,"\n DEFINES *topDefine = " );
|
||||
fprintf( handl_o, "\n DEFINES *topDefine = " );
|
||||
if( num == 1 )
|
||||
fprintf( handl_o,"NULL;" );
|
||||
fprintf( handl_o, "NULL;" );
|
||||
else
|
||||
fprintf( handl_o," = &sD___%i;\n",num-1 );
|
||||
fprintf( handl_o, " = &sD___%i;\n", num - 1 );
|
||||
|
||||
num = 1;
|
||||
while( stcmd2 != NULL )
|
||||
{
|
||||
fprintf( handl_o,"\n static COMMANDS sC___%i = ",num );
|
||||
fprintf( handl_o,"{%d,\"%s\",",stcmd2->com_or_xcom, stcmd2->name);
|
||||
if (stcmd2->mpatt !=NULL)
|
||||
fprintf( handl_o, "\n static COMMANDS sC___%i = ", num );
|
||||
fprintf( handl_o, "{%d,\"%s\",", stcmd2->com_or_xcom, stcmd2->name );
|
||||
if( stcmd2->mpatt != NULL )
|
||||
{
|
||||
len_mpatt = strocpy( sLine, stcmd2->mpatt );
|
||||
while( (ipos = pp_strAt( "\1", 1, sLine, len_mpatt) ) > 0 )
|
||||
while( ( ipos = pp_strAt( "\1", 1, sLine, len_mpatt ) ) > 0 )
|
||||
{
|
||||
pp_Stuff ( "\\1", sLine+ipos-1, 2, 1, len_mpatt );
|
||||
pp_Stuff( "\\1", sLine + ipos - 1, 2, 1, len_mpatt );
|
||||
len_mpatt++;
|
||||
}
|
||||
fprintf(handl_o, "\"%s\",", sLine);
|
||||
fprintf( handl_o, "\"%s\",", sLine );
|
||||
}
|
||||
else
|
||||
fprintf(handl_o, "NULL,");
|
||||
if ( stcmd2->value !=NULL )
|
||||
fprintf( handl_o, "NULL," );
|
||||
if( stcmd2->value != NULL )
|
||||
{
|
||||
len_value = strocpy( sLine, stcmd2->value );
|
||||
while( (ipos = pp_strAt( "\1", 1, sLine, len_value) ) > 0 )
|
||||
while( ( ipos = pp_strAt( "\1", 1, sLine, len_value ) ) > 0 )
|
||||
{
|
||||
pp_Stuff ( "\\1", sLine+ipos-1, 2, 1, len_value );
|
||||
pp_Stuff( "\\1", sLine + ipos - 1, 2, 1, len_value );
|
||||
len_value++;
|
||||
}
|
||||
if( len_mpatt + len_value > 80 )
|
||||
fprintf( handl_o, "\n " );
|
||||
fprintf(handl_o, "\"%s\"",sLine);
|
||||
fprintf( handl_o, "\"%s\"", sLine );
|
||||
}
|
||||
else fprintf(handl_o, "NULL");
|
||||
else fprintf( handl_o, "NULL" );
|
||||
if( num == 1 )
|
||||
fprintf(handl_o, ",NULL };");
|
||||
fprintf( handl_o, ",NULL };" );
|
||||
else
|
||||
fprintf(handl_o, ",&sC___%i };", num-1);
|
||||
fprintf( handl_o, ",&sC___%i };", num - 1 );
|
||||
stcmd2 = stcmd2->last;
|
||||
num++;
|
||||
}
|
||||
fprintf( handl_o,"\n COMMANDS *topCommand = " );
|
||||
fprintf( handl_o, "\n COMMANDS *topCommand = " );
|
||||
if( num == 1 )
|
||||
fprintf( handl_o,"NULL;" );
|
||||
fprintf( handl_o, "NULL;" );
|
||||
else
|
||||
fprintf( handl_o," = &sC___%i;\n",num-1 );
|
||||
fprintf( handl_o, " = &sC___%i;\n", num - 1 );
|
||||
|
||||
stcmd1 = topTranslate, stcmd2 = NULL;
|
||||
stcmd1 = topTranslate;
|
||||
stcmd2 = NULL;
|
||||
while( stcmd1 != NULL )
|
||||
{
|
||||
stcmd3 = stcmd1->last;
|
||||
@@ -341,90 +369,90 @@ void OutTable( DEFINES* endDefine, COMMANDS* endCommand )
|
||||
num = 1;
|
||||
while( stcmd2 != NULL )
|
||||
{
|
||||
fprintf( handl_o,"\n static COMMANDS sC___%i = ",num );
|
||||
fprintf( handl_o,"{%d,\"%s\",",stcmd2->com_or_xcom, stcmd2->name);
|
||||
if (stcmd2->mpatt !=NULL)
|
||||
fprintf( handl_o, "\n static COMMANDS sC___%i = ", num );
|
||||
fprintf( handl_o, "{%d,\"%s\",", stcmd2->com_or_xcom, stcmd2->name );
|
||||
if( stcmd2->mpatt != NULL )
|
||||
{
|
||||
len_mpatt = strocpy( sLine, stcmd2->mpatt );
|
||||
while( (ipos = pp_strAt( "\1", 1, sLine, len_mpatt) ) > 0 )
|
||||
while( ( ipos = pp_strAt( "\1", 1, sLine, len_mpatt ) ) > 0 )
|
||||
{
|
||||
pp_Stuff ( "\\1", sLine+ipos-1, 2, 1, len_mpatt );
|
||||
pp_Stuff( "\\1", sLine + ipos - 1, 2, 1, len_mpatt );
|
||||
len_mpatt++;
|
||||
}
|
||||
fprintf(handl_o, "\"%s\",", sLine);
|
||||
fprintf( handl_o, "\"%s\",", sLine );
|
||||
}
|
||||
else
|
||||
fprintf(handl_o, "NULL,");
|
||||
if ( stcmd2->value !=NULL )
|
||||
fprintf( handl_o, "NULL," );
|
||||
if( stcmd2->value != NULL )
|
||||
{
|
||||
len_value = strocpy( sLine, stcmd2->value );
|
||||
while( (ipos = pp_strAt( "\1", 1, sLine, len_value) ) > 0 )
|
||||
while( ( ipos = pp_strAt( "\1", 1, sLine, len_value ) ) > 0 )
|
||||
{
|
||||
pp_Stuff ( "\\1", sLine+ipos-1, 2, 1, len_value );
|
||||
pp_Stuff( "\\1", sLine + ipos - 1, 2, 1, len_value );
|
||||
len_value++;
|
||||
}
|
||||
if( len_mpatt + len_value > 80 )
|
||||
fprintf( handl_o, "\n " );
|
||||
fprintf(handl_o, "\"%s\"",sLine);
|
||||
fprintf( handl_o, "\"%s\"", sLine );
|
||||
}
|
||||
else fprintf(handl_o, "NULL");
|
||||
else fprintf( handl_o, "NULL" );
|
||||
if( num == 1 )
|
||||
fprintf(handl_o, ",NULL };");
|
||||
fprintf( handl_o, ",NULL };" );
|
||||
else
|
||||
fprintf(handl_o, ",&sC___%i };", num-1);
|
||||
fprintf( handl_o, ",&sC___%i };", num - 1 );
|
||||
stcmd2 = stcmd2->last;
|
||||
num++;
|
||||
}
|
||||
fprintf( handl_o,"\n COMMANDS *topTranslate = " );
|
||||
fprintf( handl_o, "\n COMMANDS *topTranslate = " );
|
||||
if( num == 1 )
|
||||
fprintf( handl_o,"NULL;" );
|
||||
fprintf( handl_o, "NULL;" );
|
||||
else
|
||||
fprintf( handl_o," = &sT___%i;",num );
|
||||
fprintf( handl_o, " = &sT___%i;", num );
|
||||
|
||||
fclose(handl_o);
|
||||
fclose( handl_o );
|
||||
}
|
||||
|
||||
/*
|
||||
* Function that adds specified path to the list of pathnames to search
|
||||
*/
|
||||
void AddSearchPath( char *szPath, PATHNAMES * *pSearchList )
|
||||
void AddSearchPath( char * szPath, PATHNAMES * * pSearchList )
|
||||
{
|
||||
PATHNAMES *pPath = *pSearchList;
|
||||
PATHNAMES * pPath = *pSearchList;
|
||||
|
||||
if( pPath )
|
||||
{
|
||||
while( pPath->pNext )
|
||||
if( pPath )
|
||||
{
|
||||
while( pPath->pNext )
|
||||
pPath = pPath->pNext;
|
||||
pPath->pNext = ( PATHNAMES * ) hb_xgrab( sizeof( PATHNAMES ) );
|
||||
pPath = pPath->pNext;
|
||||
pPath->pNext = ( PATHNAMES * ) hb_xgrab( sizeof( PATHNAMES ) );
|
||||
pPath = pPath->pNext;
|
||||
}
|
||||
else
|
||||
{
|
||||
*pSearchList =pPath =(PATHNAMES *)hb_xgrab( sizeof(PATHNAMES) );
|
||||
}
|
||||
pPath->pNext = NULL;
|
||||
pPath->szPath = szPath;
|
||||
}
|
||||
else
|
||||
{
|
||||
*pSearchList = pPath = ( PATHNAMES * ) hb_xgrab( sizeof( PATHNAMES ) );
|
||||
}
|
||||
pPath->pNext = NULL;
|
||||
pPath->szPath = szPath;
|
||||
}
|
||||
|
||||
void GenError( char* _szErrors[], char cPrefix, int iError, char * szError1, char * szError2 )
|
||||
void GenError( char * _szErrors[], char cPrefix, int iError, char * szError1, char * szError2 )
|
||||
{
|
||||
printf( "\r(%i) ", nline );
|
||||
printf( "Error %c%04i ", cPrefix, iError );
|
||||
printf( _szErrors[ iError - 1 ], szError1, szError2 );
|
||||
printf( "\n\n" );
|
||||
printf( "\r(%i) ", nline );
|
||||
printf( "Error %c%04i ", cPrefix, iError );
|
||||
printf( _szErrors[ iError - 1 ], szError1, szError2 );
|
||||
printf( "\n\n" );
|
||||
|
||||
exit( EXIT_FAILURE );
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
|
||||
void GenWarning( char* _szWarnings[], char cPrefix, int iWarning, char * szWarning1, char * szWarning2)
|
||||
void GenWarning( char * _szWarnings[], char cPrefix, int iWarning, char * szWarning1, char * szWarning2)
|
||||
{
|
||||
if( _bWarnings && iWarning < WARN_ASSIGN_SUSPECT ) /* TODO: add switch to set level */
|
||||
{
|
||||
printf( "\r(%i) ", nline );
|
||||
printf( "Warning %c%04i ", cPrefix, iWarning );
|
||||
printf( _szWarnings[ iWarning - 1 ], szWarning1, szWarning2 );
|
||||
printf( "\n" );
|
||||
}
|
||||
if( _bWarnings && iWarning < WARN_ASSIGN_SUSPECT ) /* TODO: add switch to set level */
|
||||
{
|
||||
printf( "\r(%i) ", nline );
|
||||
printf( "Warning %c%04i ", cPrefix, iWarning );
|
||||
printf( _szWarnings[ iWarning - 1 ], szWarning1, szWarning2 );
|
||||
printf( "\n" );
|
||||
}
|
||||
}
|
||||
|
||||
#define IS_PATH_SEP( c ) ( strchr( OS_PATH_DELIMITER_LIST, ( c ) ) != NULL )
|
||||
|
||||
@@ -3,35 +3,34 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
Harbour Project source code
|
||||
|
||||
This file contains the tables of predefined #define and #command
|
||||
statements of preprocessor.
|
||||
|
||||
Copyright 1999 Alexander S.Kresin <alex@belacy.belgorod.su>
|
||||
www - http://www.harbour-project.org
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version, with one exception:
|
||||
|
||||
The exception is that if you link the Harbour Runtime Library (HRL)
|
||||
and/or the Harbour Virtual Machine (HVM) with other files to produce
|
||||
an executable, this does not by itself cause the resulting executable
|
||||
to be covered by the GNU General Public License. Your use of that
|
||||
executable is in no way restricted on account of linking the HRL
|
||||
and/or HVM code into it.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
|
||||
their web site at http://www.gnu.org/).
|
||||
* Harbour Project source code:
|
||||
* Preprocessor precompiled STD.CH and some additions ( mainly generated )
|
||||
*
|
||||
* Copyright 1999 Alexander S.Kresin <alex@belacy.belgorod.su>
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version, with one exception:
|
||||
*
|
||||
* The exception is that if you link the Harbour Runtime Library (HRL)
|
||||
* and/or the Harbour Virtual Machine (HVM) with other files to produce
|
||||
* an executable, this does not by itself cause the resulting executable
|
||||
* to be covered by the GNU General Public License. Your use of that
|
||||
* executable is in no way restricted on account of linking the HRL
|
||||
* and/or HVM code into it.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
|
||||
* their web site at http://www.gnu.org/).
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -3,25 +3,34 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* runlib.c contains the .HRB object runner system
|
||||
* Harbour Project source code:
|
||||
* Harbour Portable Object (.HRB) file runner
|
||||
*
|
||||
* Copyright(C) 1999 by Eddie Runia <eddie@runia.com>
|
||||
* Copyright 1999 Eddie Runia <eddie@runia.com>
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version, with one exception:
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
* The exception is that if you link the Harbour Runtime Library (HRL)
|
||||
* and/or the Harbour Virtual Machine (HVM) with other files to produce
|
||||
* an executable, this does not by itself cause the resulting executable
|
||||
* to be covered by the GNU General Public License. Your use of that
|
||||
* executable is in no way restricted on account of linking the HRL
|
||||
* and/or HVM code into it.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program; if not, write to:
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
|
||||
* their web site at http://www.gnu.org/).
|
||||
*
|
||||
* The Free Software Foundation, Inc.,
|
||||
* 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "extend.h"
|
||||
@@ -47,6 +56,7 @@
|
||||
/* TODO: Fill the error codes with valid ones (instead of 9999) */
|
||||
/* TOFIX: Change this assembler hack to something standard and portable */
|
||||
/* TODO: Change the fopen()/fread()/fclose() calls to hb_fs*() */
|
||||
/* TODO: Add default extension handling */
|
||||
|
||||
/* NOTE: This is the assembler output from : hb_vmExecute( pcode, symbols ). */
|
||||
|
||||
|
||||
@@ -3,35 +3,35 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
Harbour Project source code
|
||||
|
||||
The declarations for all harbour defined functions/procedures.
|
||||
|
||||
Copyright 1999 Ryszard Glab
|
||||
www - http://www.harbour-project.org
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version, with one exception:
|
||||
|
||||
The exception is that if you link the Harbour Runtime Library (HRL)
|
||||
and/or the Harbour Virtual Machine (HVM) with other files to produce
|
||||
an executable, this does not by itself cause the resulting executable
|
||||
to be covered by the GNU General Public License. Your use of that
|
||||
executable is in no way restricted on account of linking the HRL
|
||||
and/or HVM code into it.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
|
||||
their web site at http://www.gnu.org/).
|
||||
*/
|
||||
* Harbour Project source code:
|
||||
* The declarations for all harbour defined functions/procedures.
|
||||
*
|
||||
* Copyright 1999 Ryszard Glab <rglab@imid.med.pl>
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version, with one exception:
|
||||
*
|
||||
* The exception is that if you link the Harbour Runtime Library (HRL)
|
||||
* and/or the Harbour Virtual Machine (HVM) with other files to produce
|
||||
* an executable, this does not by itself cause the resulting executable
|
||||
* to be covered by the GNU General Public License. Your use of that
|
||||
* executable is in no way restricted on account of linking the HRL
|
||||
* and/or HVM code into it.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
|
||||
* their web site at http://www.gnu.org/).
|
||||
*
|
||||
*/
|
||||
|
||||
// Files from: vm
|
||||
//
|
||||
|
||||
@@ -2,6 +2,37 @@
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* Standalone Harbour Portable Object file runner
|
||||
*
|
||||
* Copyright 1999 Ryszard Glab <rglab@imid.med.pl>
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version, with one exception:
|
||||
*
|
||||
* The exception is that if you link the Harbour Runtime Library (HRL)
|
||||
* and/or the Harbour Virtual Machine (HVM) with other files to produce
|
||||
* an executable, this does not by itself cause the resulting executable
|
||||
* to be covered by the GNU General Public License. Your use of that
|
||||
* executable is in no way restricted on account of linking the HRL
|
||||
* and/or HVM code into it.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
|
||||
* their web site at http://www.gnu.org/).
|
||||
*
|
||||
*/
|
||||
|
||||
#include "external.ch"
|
||||
|
||||
FUNCTION Main( cHRBFile, cPar1, cPar2, cPar3, cPar4, cPar5, cPar6, cPar7, cPar8, cPar9 )
|
||||
|
||||
Reference in New Issue
Block a user