See ChangeLog entry for 19990512-01:15:00 EDT David G. Holm <dholm@jsd-llc.com>

This commit is contained in:
David G. Holm
1999-05-12 06:16:29 +00:00
parent f06e46c342
commit 0bd4aafd73
3 changed files with 217 additions and 11 deletions

View File

@@ -1,3 +1,15 @@
19990512-01:15:00 EDT David G. Holm <dholm@jsd-llc.com>
* makefile.b31
- Added genobj32.c and sybmols.asm
- Made more developer friendly (you no longer have to remember
which intermediate files to delete when a build fails due to an
error in the makefile or an error in an intermediate step).
- Added fixflex to split flexyy.c into flexyy.c and flex_tab.c
+ source/compiler/fixflex.c
- New source module to split flexyy.c into smaller flexyy.c with
the two largest tables in flex_tab.c.
NB! Not needed for 32-bit compilers.
Tue May 11 18:53:43 1999 Gonzalo A. Diethelm <Gonzalo.Diethelm@jda.cl>
* Makefile:

View File

@@ -1,5 +1,6 @@
# makefile for Borland C/C++ 16 bits
.path.asm = source\compiler
.path.c = source\rtl
.path.h = include
.path.l = source\compiler
@@ -15,7 +16,7 @@ harbour.lib : arrays.obj asort.obj classes.obj codebloc.obj dates.obj \
dynsym.obj environ.obj error.obj \
errorapi.obj errorsys.obj extend.obj files.obj itemapi.obj \
math.obj objfunc.obj \
set.obj strings.obj strcmp.obj tclass.obj transfrm.obj
set.obj strings.obj strcmp.obj symbols.obj tclass.obj transfrm.obj
hbtools.lib : datesx.obj debug.obj genobj.obj io.obj mathx.obj \
stringp.obj stringsx.obj
@@ -55,6 +56,7 @@ strcmp.obj : strcmp.c extend.h types.h
stringp.obj : source\tools\stringp.prg extend.h types.h init.h harbour.exe
strings.obj : strings.c extend.h types.h
stringsx.obj : source\tools\stringsx.c extend.h types.h
symbols.obj : symbols.asm
tclass.obj : tclass.prg extend.h types.h init.h harbour.exe
transfrm.obj : transfrm.c extend.h types.h
@@ -71,23 +73,38 @@ transfrm.obj : transfrm.c extend.h types.h
bcc -c -mh -O2 -I.\include -o$@ $<
tlib .\libs\b16\hbtools.lib -+$@,,
{source\compiler}.c{obj}.obj:
bcc -c -mh -O2 -I.\include;source\compiler -o$@ $<
.c.obj:
bcc -c -mh -O2 -I.\include -o$@ $<
tlib .\libs\b16\harbour.lib -+$@,,
harbour.exe : source\compiler\y_tab.c source\compiler\lexyy.c source\compiler\harbour.obj
echo -mh -O2 -ebin\harbour.exe -Iinclude;source\compiler source\compiler\y_tab.c > b31.bc
echo source\compiler\lexyy.c source\compiler\harbour.obj >> b31.bc
bcc @b31.bc
del b31.bc
del y_tab.obj
del lexyy.obj
.asm.obj:
tasm -I.\include $< $@
tlib .\libs\b16\harbour.lib -+$@,,
source\compiler\harbour.obj : source\compiler\harbour.c
bcc -c -mh -O2 -I.\include -o$@ $*.c
harbour.exe : y_tab.obj lexyy.obj lex_tab.obj harbour.obj genobj32.obj
echo -mh -O2 -ebin\harbour.exe -Iinclude;source\compiler obj\y_tab.obj > b31.bc
echo obj\lexyy.obj obj\lex_tab.obj >> b31.bc
echo obj\harbour.obj obj\genobj32.obj >> b31.bc
bcc @b31.bc
fixflex.obj : source\compiler\fixflex.c
genobj32.obj : source\compiler\genobj32.c
harbour.obj : source\compiler\harbour.c
lexyy.obj : source\compiler\lexyy.c harbour.l
lex_tab.obj : source\compiler\lex_tab.c harbour.l
y_tab.obj : source\compiler\y_tab.c harbour.y
source\compiler\y_tab.c : harbour.y
bison -d -v -y -osource\compiler\y_tab.c source\compiler\harbour.y
source\compiler\lexyy.c : harbour.l
fixflex.exe : fixflex.obj
bcc -mh -O2 -I.\include -ebin\fixflex.exe obj\fixflex.obj
source\compiler\lex_tab.c :: harbour.l fixflex.exe
source\compiler\lexyy.c :: harbour.l fixflex.exe
flex -i -8 -osource\compiler\lexyy.c source\compiler\harbour.l
if exist source\compiler\lexyy.bak del source\compiler\lexyy.bak
fixflex source\compiler\lexyy.c source\compiler\lex_tab.c

View File

@@ -0,0 +1,177 @@
#include <dir.h>
#include <errno.h>
#include <fcntl.h>
#include <io.h>
#include <share.h>
#include <stdio.h>
#include <string.h>
int main (int argc, char * argv [])
{
int rc = 0;
char backup [MAXPATH];
if (argc < 3)
{
// Must have 2 arguments.
rc = 1;
puts ("\nUsage: FIX_FLEX source dest\n\nWhere source is the name of the generated FLEX source file and dest\nis the name of the source file to extract the two largest flex tables into.");
}
else
{
// Rename source to backup.
int i;
size_t len;
strcpy (backup, argv[1]);
len = strlen (backup);
for (i = 1; i < 4; i++) if (backup [len - i] == '.') backup [len - i] = 0;
strcat (backup, ".bak");
if (rename (argv[1], backup))
{
rc = 10;
printf ("\nError %d (DOS error %02xd) renaming %s to %s.", errno, _doserrno, argv[1], backup);
}
}
if (rc == 0)
{
// Read from backup as source.
FILE * source = fopen (backup, "r");
if (!source)
{
rc = 11;
printf ("\nUnable to open %s for reading.", backup);
}
else
{
// Create new source.
FILE * replace = fopen (argv[1], "w");
if (!replace)
{
rc = 12;
printf ("\nUnable to create %s for writing (after renaming to %s).", argv[1], backup);
}
else
{
// Create dest.
FILE * dest = fopen (argv[2], "w");
if (!dest)
{
rc = 13;
printf ("\nUnable to create %s for writing.", argv[2]);
}
else
{
// Initialize.
int copy = 0, move = 0, check_count = 3;
int defer_move = 0, defer_end = 0;
#define BUF_SIZE 4095
static char inbuf [BUF_SIZE + 1];
static char outbuf [sizeof (inbuf)];
do
{
// Read from source
fgets (inbuf, BUF_SIZE, source);
if (ferror (source))
{
rc = 14;
printf ("\nError %d (DOS error %02xd) reading from %s.", errno, _doserrno, backup);
}
else
{
char * ptr;
strcpy (outbuf, inbuf);
// Check for stuff to copy or move to dest.
if (check_count > 0 && !move && !copy)
{
ptr = strstr (inbuf, "yy_nxt");
if (ptr)
{
// It's the first of the two big tables.
// Move it out of source into dest, leaving only
// an extern declaration.
strcpy (outbuf, inbuf + 7); // skip "static "
memcpy (inbuf, "extern", 6);
ptr = strchr (inbuf, '=');
if (ptr) *ptr = ';';
move = 1;
defer_move = 1;
check_count--;
}
else
{
ptr = strstr (inbuf, "yy_chk");
if (ptr)
{
// It's the second of the two big tables.
// Move it out of source into dest, leaving only
// an extern declaration.
strcpy (outbuf, inbuf + 7); // skip "static "
memcpy (inbuf, "extern", 6);
ptr = strchr (inbuf, '=');
if (ptr) *ptr = ';';
move = 1;
defer_move = 1;
check_count--;
}
else
{
ptr = strstr (inbuf, "#define FLEX_SCANNER");
if (ptr)
{
// It's the start of various #defines that
// need to be copied from source to dest in
// order to set up the yyconst define.
copy = 1;
check_count--;
}
}
}
}
else if (move || copy)
{
// Check for stuff to end copy or move.
ptr = strstr (inbuf, "}");
if (ptr && move) defer_end = 1; // End of table to move.
else
{
ptr = strstr (inbuf, "#ifdef YY_USE_PROTOS");
if (ptr && copy) copy = 0; // End of #defines to copy.
}
}
if (move || copy)
{
// If moving or copying from source to dest, do so.
fputs (outbuf, dest);
if (ferror (dest))
{
rc = 15;
printf ("\nError %d (DOS error %02xd) writing to %s.", errno, _doserrno, argv[2]);
}
}
if (!feof (source) && (!move || defer_move) && rc == 0)
{
// If not moving to dest, then write to new source.
fputs (inbuf, replace);
if (ferror (replace))
{
rc = 16;
printf ("\nError %d (DOS error %02xd) writing to %s (after renaming to %s).", errno, _doserrno, argv[1], backup);
}
}
// Clean up.
if (defer_move) defer_move = 0;
if (defer_end)
{
move = 0;
defer_end = 0;
}
}
} while (!feof (source) && rc == 0);
}
}
}
}
return (rc);
}