Updating preprocessor files

This commit is contained in:
Alexander S.Kresin
1999-07-31 11:14:04 +00:00
parent 8b99ddd9be
commit f66a2bfe27
3 changed files with 392 additions and 317 deletions

View File

@@ -1,3 +1,11 @@
19990731-14:50 Alexander Kresin
* source\hbpp\hbpp.c
* source\hbpp\table.c
* fixed some bugs, mentioned by Kwon,Oh-Chul ( ?"1234" ), Victor Szel
* added support of letters, prefixed by '\' in rezult patterns
* some other improvements that I don't remember already :)
+ added 'ANNOUNCE' keyword
19990731-11:40 CET Patrick Mast <harbour@PatrickMast.com>
* updated build40.bat and makefile.b40
@@ -56,11 +64,11 @@
+ doc/hdr_tpl.txt - Small modification RCS ID and licenc part
of the header separated.
* include/*.* - Standardized (again) RCS ID and licenc headers.
19990731-06:40 GMT+2 Ryszard Glaaab <rglab@imid.med.pl>
*source/compiler/harbour.y
* PUBLIC and PRIVATE variables referenced inside a codeblock
can be used to initialize a static variables
* PUBLIC and PRIVATE variables referenced inside a codeblock
can be used to initialize a static variables
19990731-06:00 CET Victor Szel <info@szelvesz.hu>
+ include/achoice.ch
@@ -148,37 +156,37 @@
Fri Jul 30 14:44:00 1999 Gonzalo A. Diethelm <Gonzalo.Diethelm@jda.cl>
* config/bin.cf:
* config/c.cf:
* config/prg.cf:
Added support for recursing into subdirectories in addition to
creating a target (library or executable).
Added support for executables whose main function is defined in a
PRG file.
* config/bin.cf:
* config/c.cf:
* config/prg.cf:
Added support for recursing into subdirectories in addition to
creating a target (library or executable).
Added support for executables whose main function is defined in a
PRG file.
* config/header.cf:
Temporarily got rid of two definitions that look buggy.
* include/run_exp.h:
Got rid of warning regarding pragma.
* source/hbpp/Makefile:
* source/hbpp/hbppmain.c:
* source/hbpp/stdalone/Makefile:
* source/hbpp/stdalone/hbpp.c:
Support for recursing into stdalone.
Moved hbpp/hbppmain.c tp hbpp/stdalone/hbpp.c.
* source/odbc/Makefile:
* source/runner/Makefile:
Added GNU-makefiles for these two directories (but they don'
compile ok under gcc/Win32).
* source/rtl/files.c:
Changed defined(__GNUC__) for defined(__CYGWIN__).
* config/header.cf:
Temporarily got rid of two definitions that look buggy.
* source/rtl/gt/gtwin.c:
Got rid of a warning.
* include/run_exp.h:
Got rid of warning regarding pragma.
* source/hbpp/Makefile:
* source/hbpp/hbppmain.c:
* source/hbpp/stdalone/Makefile:
* source/hbpp/stdalone/hbpp.c:
Support for recursing into stdalone.
Moved hbpp/hbppmain.c tp hbpp/stdalone/hbpp.c.
* source/odbc/Makefile:
* source/runner/Makefile:
Added GNU-makefiles for these two directories (but they don'
compile ok under gcc/Win32).
* source/rtl/files.c:
Changed defined(__GNUC__) for defined(__CYGWIN__).
* source/rtl/gt/gtwin.c:
Got rid of a warning.
19990730-20:24 CET Victor Szel <info@szelvesz.hu>
- buildicc.cmd - Removed.
@@ -375,65 +383,65 @@ Fri Jul 30 14:44:00 1999 Gonzalo A. Diethelm <Gonzalo.Diethelm@jda.cl>
Thu Jul 29 16:17:09 1999 Gonzalo A. Diethelm <Gonzalo.Diethelm@jda.cl>
* config/dos/djgpp.cf:
* config/linux/gcc.cf:
* config/os2/gcc.cf:
* config/win32/gcc.cf:
* config/win32/msvc.cf:
One more modification: the DB drivers must be linked against only
when the Makefile specifies linking against the rdd
library. Otherwise, other binaries such as the Harbour compiler
would try to link against the DB drivers.
* config/dos/djgpp.cf:
* config/linux/gcc.cf:
* config/os2/gcc.cf:
* config/win32/gcc.cf:
* config/win32/msvc.cf:
One more modification: the DB drivers must be linked against only
when the Makefile specifies linking against the rdd
library. Otherwise, other binaries such as the Harbour compiler
would try to link against the DB drivers.
Thu Jul 29 15:58:44 1999 Gonzalo A. Diethelm <Gonzalo.Diethelm@jda.cl>
* source/rdd/Makefile:
* source/rdd/nulsys/Makefile:
Bruno Cantero pointed out that a user may use all of the DB
drivers simultaneously, so I got rid of the environment variable
and made sure all of the valid DB drivers are linked against the
application. On of the valid drivers is nulsys.
* source/rdd/Makefile:
* source/rdd/nulsys/Makefile:
Bruno Cantero pointed out that a user may use all of the DB
drivers simultaneously, so I got rid of the environment variable
and made sure all of the valid DB drivers are linked against the
application. On of the valid drivers is nulsys.
* config/global.cf:
Now a list of all the valid DB drivers is stored in
HB_DB_DRIVERS.
* config/global.cf:
Now a list of all the valid DB drivers is stored in
HB_DB_DRIVERS.
* config/dos/djgpp.cf:
* config/linux/gcc.cf:
* config/os2/gcc.cf:
* config/win32/gcc.cf:
* config/win32/msvc.cf:
Deleted support for environment variable HB_DB_DRIVER.
Added support for make variable HB_DB_DRIVERS.
* config/dos/djgpp.cf:
* config/linux/gcc.cf:
* config/os2/gcc.cf:
* config/win32/gcc.cf:
* config/win32/msvc.cf:
Deleted support for environment variable HB_DB_DRIVER.
Added support for make variable HB_DB_DRIVERS.
Thu Jul 29 14:46:51 1999 Gonzalo A. Diethelm <Gonzalo.Diethelm@jda.cl>
* source/rdd/Makefile:
* source/rdd/dbfntx/Makefile:
Now there is a subdirectory for each database driver. For now,
only dbfntx/ is supported. The Makefile in rdd/ walks into each
subdirectory.
* source/rdd/Makefile:
* source/rdd/dbfntx/Makefile:
Now there is a subdirectory for each database driver. For now,
only dbfntx/ is supported. The Makefile in rdd/ walks into each
subdirectory.
* source/rdd/dbfntx0.prg:
* source/rdd/dbfntx1.c:
* source/rdd/dbfntx/dbfntx0.prg:
* source/rdd/dbfntx/dbfntx1.c:
Moved these files from rdd/ to rdd/dbfntx/.
* source/rdd/dbfntx0.prg:
* source/rdd/dbfntx1.c:
* source/rdd/dbfntx/dbfntx0.prg:
* source/rdd/dbfntx/dbfntx1.c:
Moved these files from rdd/ to rdd/dbfntx/.
* config/bin.cf:
* config/dir.cf:
* config/header.cf:
* config/lib.cf:
* config/test.cf:
* config/dos/djgpp.cf:
* config/linux/gcc.cf:
* config/os2/gcc.cf:
* config/win32/gcc.cf:
* config/win32/msvc.cf:
Added support for the new separate directories for the database
driver. The user must define an environment variable HB_DB_DRIVER
with the appropriate driver he wants to use. For example, defining
it to 'dbfntx' will pick up that driver.
* config/bin.cf:
* config/dir.cf:
* config/header.cf:
* config/lib.cf:
* config/test.cf:
* config/dos/djgpp.cf:
* config/linux/gcc.cf:
* config/os2/gcc.cf:
* config/win32/gcc.cf:
* config/win32/msvc.cf:
Added support for the new separate directories for the database
driver. The user must define an environment variable HB_DB_DRIVER
with the appropriate driver he wants to use. For example, defining
it to 'dbfntx' will pick up that driver.
19990729-18:39 CET Victor Szel <info@szelvesz.hu>
- source/rdd/dbcmd.c
@@ -608,15 +616,15 @@ Thu Jul 29 14:46:51 1999 Gonzalo A. Diethelm <Gonzalo.Diethelm@jda.cl>
Wed Jul 28 11:54:06 1999 Gonzalo A. Diethelm <Gonzalo.Diethelm@jda.cl>
* source/rtl/dir.c:
Fixed a typo: #if define(USE_NT) => #if defined(USE_NT).
* source/rtl/dir.c:
Fixed a typo: #if define(USE_NT) => #if defined(USE_NT).
* source/rtl/inkey.c:
Added an include of <mingw32/conio.h> when compiling with gcc.
* source/rtl/inkey.c:
Added an include of <mingw32/conio.h> when compiling with gcc.
* include/Makefile:
* tests/working/Makefile:
Updated list of files.
* include/Makefile:
* tests/working/Makefile:
Updated list of files.
19990728-14:30 CET Eddie Runia <eddie@runia.com>
* source/rtl/dir.c
@@ -752,8 +760,8 @@ Wed Jul 28 11:54:06 1999 Gonzalo A. Diethelm <Gonzalo.Diethelm@jda.cl>
*source/rtl/natmsg/msgspa.c
*source/rtl/natmsg/msguk.c
*source/rtl/natmsg/msgyu852.c
* corrected bug in hb_ErrorNetDescription
(was "<=" instead of "<" ;-)
* corrected bug in hb_ErrorNetDescription
(was "<=" instead of "<" ;-)
19990727-19:48 GMT+1 Bruno Cantero <bruno@issnet.net>
* source/rdd/dbcmd.c
@@ -917,10 +925,10 @@ Wed Jul 28 11:54:06 1999 Gonzalo A. Diethelm <Gonzalo.Diethelm@jda.cl>
Mon Jul 26 11:42:11 1999 Gonzalo A. Diethelm <Gonzalo.Diethelm@jda.cl>
* include/Makefile:
* source/rdd/Makefile:
* tests/working/Makefile:
Updated file lists.
* include/Makefile:
* source/rdd/Makefile:
* tests/working/Makefile:
Updated file lists.
19990726-13:20 CET Victor Szel <info@szelvesz.hu>
+ source/rtl/gtapi.c
@@ -1229,27 +1237,27 @@ Mon Jul 26 11:42:11 1999 Gonzalo A. Diethelm <Gonzalo.Diethelm@jda.cl>
19990722-16:30 GMT+2 Ryszard Glab <rglab@imid.med.pl>
*source/compiler/harbour.y
* symbol names are no longer released for the second time
(it caused that DJGPP hanged in 'free' function)
* symbol names are no longer released for the second time
(it caused that DJGPP hanged in 'free' function)
*source/hbpp/makefile
+ added preproc.c
+ added preproc.c
*source/hbpp/harb.h
- changed to definie LONG and ULONG typedefs if there is no
HB_DEFS_H_ defined (these typedefs are defined in hbdefs.h)
- changed to definie LONG and ULONG typedefs if there is no
HB_DEFS_H_ defined (these typedefs are defined in hbdefs.h)
*source/hbpp/preproc.c
- removed nested /* */
- removed nested /* */
*tests/working/Makefile
- removed statics1.prg and statics2.prg because these file have to
be linked together into an executable (we should change Makefile
architecture to support it)
- removed testpre.prg (it requires hbpp library however this library
cannot be linked because of duplicated symbol 'hb_strAt' defined
in rtl library also) -the changes in source/hbpp/*.c was an attempt
to get it working.
- removed statics1.prg and statics2.prg because these file have to
be linked together into an executable (we should change Makefile
architecture to support it)
- removed testpre.prg (it requires hbpp library however this library
cannot be linked because of duplicated symbol 'hb_strAt' defined
in rtl library also) -the changes in source/hbpp/*.c was an attempt
to get it working.
19990722-14:30 CET Matthew Hamilton
* tests/working/inifiles.prg
@@ -1273,17 +1281,17 @@ Mon Jul 26 11:42:11 1999 Gonzalo A. Diethelm <Gonzalo.Diethelm@jda.cl>
* changed GetDynSym to hb_GetDynSym
* changed NewDynSym to hb_NewDynSym
* changed FindDynSym to hb_FindDynSym
+ added initialization of hMemvar and hArea
+ added initialization of hMemvar and hArea
*source/vm/hvm.c
* changed GetDynSym to hb_GetDynSym
* changed NewDynSym to hb_NewDynSym
* changed FindDynSym to hb_FindDynSym
+ added support for PUBLIC and PRIVATE variables and PARAMETERS
(not finished yet)
(not finished yet)
*include/extend.h
* changed definition of DYNSYM
* changed definition of DYNSYM
+ added definition of VS_MEMVAR, VS_PUBLIC, VS_PRIVATE
*include/init.h
@@ -1291,7 +1299,7 @@ Mon Jul 26 11:42:11 1999 Gonzalo A. Diethelm <Gonzalo.Diethelm@jda.cl>
at this moment)
*config/dos/watcom.cf
* changed to not link and lib in no case exact mode
* changed to not link and lib in no case exact mode
*include/pcode.h
- removed unused opcode HB_P_DEFSTATIC
@@ -1305,31 +1313,31 @@ Mon Jul 26 11:42:11 1999 Gonzalo A. Diethelm <Gonzalo.Diethelm@jda.cl>
+ added support for PUBLIC and PRIVATE statements
+ new __PUBLIC and __PRIVATE functions that can be accessed
from PRG code to create memvar variables
+ support for PARAMETERS statement
+ support for PARAMETERS statement
NOTE: It is still in development! There is something wrong with
reference counting (see tests/working/memvar.prg)
NOTE: It is still in development! There is something wrong with
reference counting (see tests/working/memvar.prg)
*source/compiler/harbour.y
+ added support for PUBLIC and PRIVATE variables
+ added support for PARAMETERS statement
+ added support for PARAMETERS statement
*source/compiler/harbour.l
+ added full support for PUBLIC, PRIVATE and PARAMETERS
* LOCAL can now be used in abbreviated form
+ added full support for PUBLIC, PRIVATE and PARAMETERS
* LOCAL can now be used in abbreviated form
+tests/working/memvar.prg
+ tests memvar variables
(NOTE: it can show unreleased memory blocks)
(NOTE: it can show unreleased memory blocks)
*tests/working/Makefile
+ added memvar.prg
Wed Jul 21 17:39:35 1999 Gonzalo A. Diethelm <Gonzalo.Diethelm@jda.cl>
* include/hbsetup.h:
Added Win32 as a case when CR/LF must be output for a new line to
appear on the screen.
* include/hbsetup.h:
Added Win32 as a case when CR/LF must be output for a new line to
appear on the screen.
19990721-22:36 CET Patrick Mast <harbour@PatrickMast.com>
* Makefile.vc errorsys compiles with /iinclude now
@@ -1340,22 +1348,22 @@ Wed Jul 21 17:39:35 1999 Gonzalo A. Diethelm <Gonzalo.Diethelm@jda.cl>
Wed Jul 21 15:36:04 1999 Gonzalo A. Diethelm <Gonzalo.Diethelm@jda.cl>
* source/compiler/harbour.y:
Moved printing the "build..." message after the command line
arguments have been checked, so that if the user specifies -q, it
is not shown.
* source/compiler/harbour.y:
Moved printing the "build..." message after the command line
arguments have been checked, so that if the user specifies -q, it
is not shown.
* source/vm/hvm.c:
Got rid of a couple of warnings.
* source/vm/hvm.c:
Got rid of a couple of warnings.
* include/Makefile:
* tests/working/Makefile:
Updates list of files.
* include/Makefile:
* tests/working/Makefile:
Updates list of files.
* include/init.h:
* include/initsymb.h:
* source/hbpp/preproc.c:
Updated use of RCS Id keyword.
* include/init.h:
* include/initsymb.h:
* source/hbpp/preproc.c:
Updated use of RCS Id keyword.
19990721-18:39 GMT+1 Paul Tucker / Bruno Cantero <bruno@issnet.net>
* source/compiler/harbour.y
@@ -1740,15 +1748,15 @@ Wed Jul 21 15:36:04 1999 Gonzalo A. Diethelm <Gonzalo.Diethelm@jda.cl>
Fri Jul 16 17:53:35 1999 Gonzalo A. Diethelm <Gonzalo.Diethelm@jda.cl>
* source/rtl/gt/gtwin.c:
Added the possibility to log everything to a file; this made it
possible for me to find out what was wrong with GTwin (which is,
noone was calling gtInit()).
* source/rtl/console.c:
Call gtInit() as the first console initialization. This finally
made it possible to have a working GT on Win32 with gcc (it should
work with other compilers too).
* source/rtl/gt/gtwin.c:
Added the possibility to log everything to a file; this made it
possible for me to find out what was wrong with GTwin (which is,
noone was calling gtInit()).
* source/rtl/console.c:
Call gtInit() as the first console initialization. This finally
made it possible to have a working GT on Win32 with gcc (it should
work with other compilers too).
19990716-20:43 Alexander Kresin
* source\hbpp\hbpp.c

View File

@@ -49,19 +49,19 @@
#include "hberrors.h"
int Hp_Parse( FILE*, FILE* );
int ParseDirective( char* );
int ParseDefine( char* );
DEFINES* AddDefine ( char*, char* );
int ParseUndef( char* );
int ParseIfdef( char*, int);
int ParseCommand( char*, int, int );
int ConvertPatterns ( char*, int, char*, int );
void AddCommand ( char * );
void AddTranslate ( char * );
int ParseDirective( char* ); /* Parsing preprocessor directives ( #... ) */
int ParseDefine( char* ); /* Process #define directive */
DEFINES* AddDefine ( char*, char* ); /* Add new #define to a linked list */
int ParseUndef( char* ); /* Process #undef directive */
int ParseIfdef( char*, int); /* Process #ifdef directive */
int ParseCommand( char*, int, int ); /* Process #command or #translate directive */
int ConvertPatterns ( char*, int, char*, int ); /* Converting result pattern in #command and #translate */
void AddCommand ( char * ); /* Add new #command to an array */
void AddTranslate ( char * ); /* Add new #translate to an array */
COMMANDS* getCommand ( int );
int ParseExpression( char*, char* );
int WorkDefine ( char**, char**, DEFINES *, int );
void WorkPseudoF ( char**, char**, DEFINES*);
int ParseExpression( char*, char* ); /* Parsing a line ( without preprocessor directive ) */
int WorkDefine ( char**, char**, DEFINES *, int ); /* Replace fragment of code with a #defined result text */
void WorkPseudoF ( char**, char**, DEFINES*); /* Replace pseudofunction with a #defined result text */
int WorkCommand ( char*, char*, char*, int);
int CommandStuff ( char *, char *, char *, int*, int );
int WorkTranslate ( char*, char*, char*, int, int* );
@@ -149,10 +149,12 @@ int ParseDirective( char* sLine )
int i;
FILE* handl_i;
i = NextWord( &sLine, sDirective, TRUE );
i = NextName( &sLine, sDirective, NULL );
stroupper( sDirective );
SKIPTABSPACES(sLine);
if ( i == 4 && memcmp ( sDirective, "else", 4 ) == 0 )
if ( i == 4 && memcmp ( sDirective, "ELSE", 4 ) == 0 )
{ /* --- #else --- */
if ( nCondCompile == 0 )
GenError( _szPErrors, 'P', ERR_DIRECTIVE_ELSE, NULL, NULL );
@@ -160,22 +162,22 @@ int ParseDirective( char* sLine )
aCondCompile[nCondCompile-1] = 1 - aCondCompile[nCondCompile-1];
}
else if ( i == 5 && memcmp ( sDirective, "endif", 5 ) == 0 )
else if ( i == 5 && memcmp ( sDirective, "ENDIF", 5 ) == 0 )
{ /* --- #endif --- */
if ( nCondCompile == 0 )
GenError( _szPErrors, 'P', ERR_DIRECTIVE_ENDIF, NULL, NULL );
else nCondCompile--;
}
else if ( i == 5 && memcmp ( sDirective, "ifdef", 5 ) == 0 )
else if ( i == 5 && memcmp ( sDirective, "IFDEF", 5 ) == 0 )
ParseIfdef ( sLine, TRUE ); /* --- #ifdef --- */
else if ( i == 6 && memcmp ( sDirective, "ifndef", 6 ) == 0 )
else if ( i == 6 && memcmp ( sDirective, "IFNDEF", 6 ) == 0 )
ParseIfdef ( sLine, FALSE ); /* --- #ifndef --- */
else if ( nCondCompile==0 || aCondCompile[nCondCompile-1])
{
if ( i == 7 && memcmp ( sDirective, "include", 7 ) == 0 )
if ( i == 7 && memcmp ( sDirective, "INCLUDE", 7 ) == 0 )
{ /* --- #include --- */
char cDelimChar;
@@ -201,31 +203,31 @@ int ParseDirective( char* sLine )
fclose(handl_i);
}
else if ( i == 6 && memcmp ( sDirective, "define", 6 ) == 0 )
else if ( i == 6 && memcmp ( sDirective, "DEFINE", 6 ) == 0 )
ParseDefine ( sLine ); /* --- #define --- */
else if ( i == 5 && memcmp ( sDirective, "undef", 5 ) == 0 )
else if ( i == 5 && memcmp ( sDirective, "UNDEF", 5 ) == 0 )
ParseUndef ( sLine ); /* --- #undef --- */
else if ( (i == 7 && memcmp ( sDirective, "command", 7 ) == 0) ||
(i == 8 && memcmp ( sDirective, "xcommand", 8 ) == 0) )
else if ( (i == 7 && memcmp ( sDirective, "COMMAND", 7 ) == 0) ||
(i == 8 && memcmp ( sDirective, "XCOMMAND", 8 ) == 0) )
/* --- #command --- */
ParseCommand ( sLine, (i==7)? FALSE:TRUE, TRUE );
else if ( (i == 9 && memcmp ( sDirective, "translate", 9 ) == 0) ||
(i == 10 && memcmp ( sDirective, "xtranslate", 10 ) == 0) )
else if ( (i == 9 && memcmp ( sDirective, "TRANSLATE", 9 ) == 0) ||
(i == 10 && memcmp ( sDirective, "XTRANSLATE", 10 ) == 0) )
/* --- #translate --- */
ParseCommand ( sLine, (i==9)? FALSE:TRUE, FALSE );
else if ( i == 6 && memcmp ( sDirective, "stdout", 6 ) == 0 )
else if ( i == 6 && memcmp ( sDirective, "STDOUT", 6 ) == 0 )
printf ( "%s", sLine ); /* --- #stdout --- */
else if ( i == 5 && memcmp ( sDirective, "error", 5 ) == 0 )
else if ( i == 5 && memcmp ( sDirective, "ERROR", 5 ) == 0 )
{ /* --- #error --- */
printf ( "\n#error: %s\n", sLine );
exit(1);
}
else if ( i == 4 && memcmp ( sDirective, "line", 4 ) == 0 )
else if ( i == 4 && memcmp ( sDirective, "LINE", 4 ) == 0 )
return -1;
else GenError( _szPErrors, 'P', ERR_WRONG_DIRECTIVE, sDirective, NULL );
}
@@ -422,78 +424,93 @@ int ParseCommand( char* sLine, int com_or_xcom, int com_or_tra )
return 0;
}
/* ConvertPatterns()
* Converts result pattern in #command and #translate to inner format
*/
int ConvertPatterns ( char *mpatt, int mlen, char *rpatt, int rlen )
{
int i = 0, ipos, ifou;
int explen,rmlen;
char exppatt[MAX_NAME], expreal[5] = "\1 0";
char lastchar = '@', exptype;
char *ptr;
int i = 0, ipos, ifou;
int explen,rmlen;
char exppatt[MAX_NAME], expreal[5] = "\1 0";
char lastchar = '@', exptype;
char *ptr;
while ( *(mpatt+i) != '\0' )
{
if ( *(mpatt+i) == '<' )
{ /* Drag match marker, determine it type */
explen = 0; ipos = i; i++; exptype = '0';
if ( *(mpatt+i) == '*' ) { exptype = '3'; i++; }
else if ( *(mpatt+i) == '(' ) { exptype = '4'; i++; }
while ( *(mpatt+i) != '>' )
while ( *(mpatt+i) != '\0' )
{
if ( *(mpatt+i) == ',' )
{
exptype = '1';
while ( *(mpatt+i) != '>' ) i++;
break;
}
else if ( *(mpatt+i) == ':' ) { exptype = '2'; break; }
*(exppatt+explen++) = *(mpatt+i++);
}
if ( exptype == '3' )
{
if ( *(exppatt+explen-1) == '*' ) explen--;
else GenError( _szPErrors, 'P', ERR_PATTERN_DEFINITION, NULL, NULL );
}
else if ( exptype == '4' )
{
if ( *(exppatt+explen-1) == ')' ) explen--;
else GenError( _szPErrors, 'P', ERR_PATTERN_DEFINITION, NULL, NULL );
}
rmlen = i - ipos + 1;
/* Replace match marker with new marker */
lastchar = (char) ( (unsigned int)lastchar + 1 );
expreal[1] = lastchar;
expreal[2] = exptype;
pp_Stuff ( expreal, mpatt+ipos, 4, rmlen, mlen );
mlen += 4 - rmlen; i += 4 - rmlen;
if ( *(mpatt+i) == '<' )
{ /* Drag match marker, determine it type */
explen = 0; ipos = i; i++; exptype = '0';
if ( *(mpatt+i) == '*' )
{ exptype = '3'; i++; }
else if ( *(mpatt+i) == '(' )
{ exptype = '4'; i++; }
while ( *(mpatt+i) != '>' )
{
if ( *(mpatt+i) == ',' )
{
exptype = '1';
while ( *(mpatt+i) != '>' ) i++;
break;
}
else if ( *(mpatt+i) == ':' )
{ exptype = '2'; break; }
*(exppatt+explen++) = *(mpatt+i++);
}
if ( exptype == '3' )
{
if ( *(exppatt+explen-1) == '*' ) explen--;
else
GenError( _szPErrors, 'P', ERR_PATTERN_DEFINITION, NULL, NULL );
}
else if ( exptype == '4' )
{
if ( *(exppatt+explen-1) == ')' ) explen--;
else
GenError( _szPErrors, 'P', ERR_PATTERN_DEFINITION, NULL, NULL );
}
rmlen = i - ipos + 1;
/* Convert match marker into inner format */
lastchar = (char) ( (unsigned int)lastchar + 1 );
expreal[1] = lastchar;
expreal[2] = exptype;
pp_Stuff ( expreal, mpatt+ipos, 4, rmlen, mlen );
mlen += 4 - rmlen; i += 4 - rmlen;
ptr = rpatt;
while ( (ifou = pp_strAt( exppatt, explen, ptr, rlen-(ptr-rpatt) )) > 0 )
{
ptr += ifou;
if ( *(ptr-2) == '<' && *(ptr+explen-1) == '>' )
{
if ( *(ptr-3) == '#' ) { exptype = '1'; ptr -= 3; rmlen = explen+3; }
else { exptype = '0'; ptr -= 2; rmlen = explen+2; }
}
else if ( *(ptr-3) == '<' && *(ptr+explen) == '>' )
{
ptr -= 2;
if ( *ptr == '\"' ) exptype = '2';
else if ( *ptr == '(' ) exptype = '3';
else if ( *ptr == '{' ) exptype = '4';
else if ( *ptr == '.' ) exptype = '5';
ptr--;
rmlen = explen+4;
}
else continue;
expreal[2] = exptype;
pp_Stuff ( expreal, ptr, 4, rmlen, rlen );
rlen += 4 - rmlen;
/* Look for appropriate result markers */
ptr = rpatt;
while ( (ifou = pp_strAt( exppatt, explen, ptr, rlen-(ptr-rpatt) )) > 0 )
{
/* Convert result marker into inner format */
ptr += ifou;
if ( *(ptr-2) == '<' && *(ptr+explen-1) == '>' &&
*(ptr-3) != '\\' && *(ptr+explen-2) != '\\' ) /* <...> */
{
if ( *(ptr-3) == '#' && *(ptr-4) != '\\' ) /* #<...> */
{ exptype = '1'; ptr -= 3; rmlen = explen+3; }
else
{ exptype = '0'; ptr -= 2; rmlen = explen+2; }
}
else if ( *(ptr-3) == '<' && *(ptr+explen) == '>' &&
*(ptr-4) != '\\' && *(ptr+explen-1) != '\\' ) /* < ... > */
{
ptr -= 2;
if ( *ptr == '\"' ) exptype = '2';
else if ( *ptr == '(' ) exptype = '3';
else if ( *ptr == '{' ) exptype = '4';
else if ( *ptr == '.' ) exptype = '5';
ptr--;
rmlen = explen+4;
}
else continue;
expreal[2] = exptype;
pp_Stuff ( expreal, ptr, 4, rmlen, rlen );
rlen += 4 - rmlen;
}
}
i++;
}
}
i++;
}
return 0;
return 0;
}
void AddCommand ( char *cmdname )
@@ -528,7 +545,7 @@ int ParseExpression( char* sLine, char* sOutLine )
char sToken[MAX_NAME];
char *ptri, *ptro;
int lenToken, i, ndef, ipos, isdvig, lens;
int rezDef, rezDefsub, rezCom, kolpass = 0;
int rezDef, rezDefsub, rezTra, rezCom, kolpass = 0;
int kolused = 0, lastused;
DEFINES *aUsed[100], *stdef;
@@ -536,7 +553,7 @@ int ParseExpression( char* sLine, char* sOutLine )
{
strotrim ( sLine );
ptri = sLine; ptro = sOutLine;
rezDef = 0; rezCom = 0;
rezDef = 0; rezTra = 0; rezCom = 0;
lastused = kolused;
isdvig = 0;
do
@@ -604,6 +621,7 @@ int ParseExpression( char* sLine, char* sOutLine )
ptri -= lenToken;
if ( ipos > 0 ) *(sLine+isdvig+ipos-1) = ';';
pp_Stuff( ptro, ptri, i, lens+lenToken, strolen(ptri) );
rezTra = 1;
if ( ipos > 0 )
{
ipos += i - lens - lenToken;
@@ -622,7 +640,8 @@ int ParseExpression( char* sLine, char* sOutLine )
else
{
i = 0;
while ( *ptri != ' ' && *ptri != '\t' && *ptri != '\0' && !ISNAME(*ptri) )
while ( *ptri != ' ' && *ptri != '\t' && *ptri != '\0' &&
*ptri != '\"' && *ptri != '\'' && *ptri != '(' && !ISNAME(*ptri) )
{
*(sToken+i) = *ptri++;
i++;
@@ -653,13 +672,14 @@ int ParseExpression( char* sLine, char* sOutLine )
}
else if ( ipos > 0 ) *(sLine+isdvig+ipos-1) = ';';
}
else if ( ipos > 0 ) *(sLine+isdvig+ipos-1) = ';';
}
isdvig += ipos;
}
while ( ipos != 0 );
kolpass++;
}
while ( rezDef || rezCom );
while ( rezDef || rezTra || rezCom );
return 0;
}
@@ -807,84 +827,124 @@ int WorkTranslate ( char* sToken, char* ptri, char* ptro, int ndef, int *lens )
int CommandStuff ( char *ptrmp, char *inputLine, char * ptro, int *lenres, int com_or_tra )
{
int nbr = 0, endTranslation = FALSE;
char *lastopti[2];
char *ptri = inputLine, *ptr;
int nbr = 0, endTranslation = FALSE;
char *lastopti[2];
char *ptri = inputLine, *ptr;
int State = STATE_INIT, lDirective = FALSE;
SKIPTABSPACES( ptri );
if ( ptrmp == NULL ) { if ( *ptri != '\0' ) return -1; }
else
while ( *ptri != '\0' && !endTranslation )
{
SKIPTABSPACES( ptrmp );
SKIPTABSPACES( ptri );
switch ( *ptrmp ) {
case '[':
nbr++;
lastopti[Repeate++] = ptrmp;
ptrmp++;
break;
case ']':
if ( Repeate ) { Repeate--; ptrmp = lastopti[Repeate]; nbr--; }
else { nbr--; ptrmp++; }
break;
case ',':
if ( *ptri == ',' ) { ptrmp++; ptri++; }
else
{
if ( nbr )
{
SkipOptional( &ptrmp, ptro, lenres, &nbr);
}
else return -1;
}
break;
case '\1': /* Match marker */
if ( !WorkMarkers( &ptrmp, &ptri, ptro, lenres, nbr ) )
{
if ( nbr )
while ( *ptri != '\0' && !endTranslation )
{
SKIPTABSPACES( ptrmp );
SKIPTABSPACES( ptri );
switch ( *ptrmp ) {
case '[':
nbr++;
lastopti[Repeate++] = ptrmp;
ptrmp++;
break;
case ']':
if ( Repeate )
{ Repeate--; ptrmp = lastopti[Repeate]; nbr--; }
else { nbr--; ptrmp++; }
break;
case ',':
if ( *ptri == ',' ) { ptrmp++; ptri++; }
else
{
SkipOptional( &ptrmp, ptro, lenres, &nbr);
if ( nbr )
{
SkipOptional( &ptrmp, ptro, lenres, &nbr);
}
else return -1;
}
else return -1;
}
break;
case '\0':
if ( com_or_tra ) return -1; else endTranslation = TRUE;
break;
default: /* Key word */
ptr = ptrmp;
if ( *ptri == ',' || strincmp(ptri, &ptrmp ) )
{
if ( nbr )
{
SkipOptional( &ptrmp, ptro, lenres, &nbr);
}
else return -1;
}
else if ( *ptri != ',' ) ptri += (ptrmp - ptr);
}
};
break;
case '\1': /* Match marker */
if ( !WorkMarkers( &ptrmp, &ptri, ptro, lenres, nbr ) )
{
if ( nbr )
{
SkipOptional( &ptrmp, ptro, lenres, &nbr);
}
else return -1;
}
break;
case '\0':
if ( com_or_tra )
return -1;
else endTranslation = TRUE;
break;
default: /* Key word */
ptr = ptrmp;
if ( *ptri == ',' || strincmp(ptri, &ptrmp ) )
{
if ( nbr )
{
SkipOptional( &ptrmp, ptro, lenres, &nbr);
}
else return -1;
}
else if ( *ptri != ',' ) ptri += (ptrmp - ptr);
}
};
if ( *ptrmp != '\0' )
{
if ( Repeate ) { Repeate = 0; ptrmp = lastopti[0]; }
do
{
SKIPTABSPACES( ptrmp );
if ( *ptrmp != '\0' )
switch ( *ptrmp ) {
case '[':
ptrmp++;
SkipOptional( &ptrmp, ptro, lenres, NULL);
ptrmp++;
break;
case ']': ptrmp++; break;
default:
return -1;
}
}
while ( *ptrmp != '\0' );
if ( Repeate ) { Repeate = 0; ptrmp = lastopti[0]; }
do
{
SKIPTABSPACES( ptrmp );
if ( *ptrmp != '\0' )
switch ( *ptrmp ) {
case '[':
ptrmp++;
SkipOptional( &ptrmp, ptro, lenres, NULL);
ptrmp++;
break;
case ']': ptrmp++; break;
default:
return -1;
}
}
while ( *ptrmp != '\0' );
}
ptr = ptro; /* Removing '\' from result string */
while( *ptr != '\0' )
{
switch( State ) {
case STATE_INIT:
if( *ptr != ' ' && *ptr != '\t' ) State = STATE_NORMAL;
if( *ptr == '#' ) lDirective = TRUE;
case STATE_NORMAL:
if( *ptr == '\'' ) State = STATE_QUOTE1;
else if( *ptr == '\"' ) State = STATE_QUOTE2;
else if( *ptr == ';' )
{
State = STATE_INIT;
lDirective = FALSE;
}
else if( !lDirective )
{
if( *ptr == '\\' && ( *(ptr+1) == '[' || *(ptr+1) == ']' ||
*(ptr+1) == '{' || *(ptr+1) == '}' || *(ptr+1) == '<' ||
*(ptr+1) == '>' ) )
{
pp_Stuff ( "", ptr, 0, 1, *lenres - (ptr - ptro) );
(*lenres)--;
}
}
break;
case STATE_QUOTE1:
if( *ptr == '\'' ) State = STATE_NORMAL;
break;
case STATE_QUOTE2:
if( *ptr == '\"' ) State = STATE_NORMAL;
break;
}
ptr++;
}
if ( com_or_tra ) return 1; else return (ptri-inputLine);
}
@@ -1022,6 +1082,7 @@ int WorkMarkers( char **ptrmp, char **ptri, char *ptro, int *lenres, int nbr )
SearnRep( exppatt,"",0,ptro,lenres);
return 0;
}
else return 0;
}
}
else if ( *(exppatt+2) == '1' ) /* ---- list match marker */
@@ -1075,7 +1136,7 @@ int getExpReal ( char *expreal, char **ptri, int prlist, int maxrez )
case STATE_ID:
case STATE_ID_END:
if ( ( (ISNAME(**ptri) || **ptri=='\\') && State == STATE_ID_END ) ||
**ptri==',' || **ptri=='\'' || **ptri=='\"')
**ptri==',' || **ptri=='\'' || **ptri=='\"' || **ptri==')' )
{
if ( **ptri == ',' )
{
@@ -1190,14 +1251,19 @@ void SearnRep( char *exppatt,char *expreal,int lenreal,char *ptro, int *lenres)
kolmarkers = 0;
while ( ptr >= ptrOut )
{
if ( *ptr == '[' || *ptr == ']' ) break;
if ( (*ptr == '[' || *ptr == ']') && *(ptr-1) != '\\' ) break;
if ( *ptr == '\1' ) kolmarkers++;
ptr--;
}
if ( *ptr == '[' )
{
ptr2 = ptrOut + ifou + 3;
while ( *ptr2 != ']' ) { if ( *ptr2 == '\1' ) kolmarkers++; ptr2++; }
while ( *ptr2 != ']' && *(ptr-1) != '\\' )
{
if ( *ptr2 == '\1' ) kolmarkers++;
ptr2++;
}
if ( Repeate && lenreal && kolmarkers && lastchar != '0' &&
*(ptrOut + ifou + 2) == '0' )
{
@@ -1728,4 +1794,4 @@ BOOL OpenInclude( char * szFileName, PATHNAMES *pSearch, FILE** fptr, BOOL bStan
}
return ( *fptr ? TRUE : FALSE );
}
}

View File

@@ -79,7 +79,7 @@
static DEFINES sD___42 = {"_DFSET","x,y",2,"Set( _SET_DATEFORMAT, if(__SetCentury(), x, y) )", &sD___41 };
DEFINES *topDefine = &sD___42;
int kolcomm = 239;
int kolcomm = 240;
COMMANDS aCommands[] =
{
{0,"NOTE","\1A30",NULL},
@@ -336,9 +336,9 @@ COMMANDS aCommands[] =
{0,"CLEAR","","CLEAR SCREEN ; CLEAR GETS"},
{0,"CLEAR","ALL","CLOSE DATABASES ; CLOSE FORMAT ; CLEAR MEMORY ; CLEAR GETS ; SET ALTERNATE OFF ; SET ALTERNATE TO"},
{0,"INDEX","ON \1A00 [TAG \1B40 ] TO \1C40 [FOR \1D00] [\1E20ALL>] [WHILE \1F00] [NEXT \1G00] [RECORD \1H00] [\1I20REST>] [EVAL \1J00] [EVERY \1K00] [\1L20 UNIQUE>] [\1M20 ASCENDING>] [\1N20 DESCENDING>]",
"ordCondSet( \1D20, \1D40, [\1E50], \1F40, \1J40, \1K00, RECNO(), \1G00, \1H00, [\1I50], [\1N50] ) ; ordCreate(\1C30, \1B30, \1A20, \1A40, [\1L50] )"},
"ordCondSet( \1D20, \1D40, [\1E50], \1F40, \1J40, \1K00, RECNO(), \1G00, \1H00, [\1I50], [\1N50] ) ; ordCreate(\1C30, \1B30, \1A20, \1A40, [\1L50] )"},
{0,"INDEX","ON \1A00 TAG \1B40 [TO \1C40] [FOR \1D00] [\1E20ALL>] [WHILE \1F00] [NEXT \1G00] [RECORD \1H00] [\1I20REST>] [EVAL \1J00] [EVERY \1K00] [\1L20 UNIQUE>] [\1M20 ASCENDING>] [\1N20 DESCENDING>]",
"ordCondSet( \1D20, \1D40, [\1E50], \1F40, \1J40, \1K00, RECNO(), \1G00, \1H00, [\1I50], [\1N50] ) ; ordCreate(\1C30, \1B30, \1A20, \1A40, [\1L50] )"},
"ordCondSet( \1D20, \1D40, [\1E50], \1F40, \1J40, \1K00, RECNO(), \1G00, \1H00, [\1I50], [\1N50] ) ; ordCreate(\1C30, \1B30, \1A20, \1A40, [\1L50] )"},
{0,"INDEX","ON \1A00 TO \1B40 [\1C20 UNIQUE>]","dbCreateIndex( \1B30, \1A20, \1A40, if( \1C50, .t., NIL ) )"},
{0,"DELETE","TAG \1A40 [ IN \1B40 ] [, \1C40 [ IN \1D40 ] ]","ordDestroy( \1A30, \1B30 ) [; ordDestroy( \1C30, \1D30 ) ]"},
{0,"REINDEX","[EVAL \1A00] [EVERY \1B00]","ordCondSet(,,,, \1A40, \1B00,,,,,,,) ; ordListRebuild()"},
@@ -347,5 +347,6 @@ COMMANDS aCommands[] =
"if !\1C50 ; ordListClear() ; end [; ordListAdd( \1A30 )] [; ordListAdd( \1B30 )]"},
{0,"SET","ORDER TO \1A00 [IN \1B40]","ordSetFocus( \1A00 [, \1B30] )"},
{0,"SET","ORDER TO TAG \1A40 [IN \1B40]","ordSetFocus( \1A30 [, \1B30] )"},
{0,"SET","ORDER TO","ordSetFocus(0)"}
{0,"SET","ORDER TO","ordSetFocus(0)"},
{0,"ANNOUNCE","\1A10","procedure \1A00 ; return"}
};