From 2592cb0111c2f0d830722e798862f8cacf3debdb Mon Sep 17 00:00:00 2001 From: "Gonzalo A. Diethelm" Date: Thu, 6 May 1999 18:27:47 +0000 Subject: [PATCH] ChangeLogTag:Thu May 06 13:09:45 1999 Gonzalo A. Diethelm --- harbour/ChangeLog | 30 ++++++++++++++++++++++++ harbour/config/bin.cf | 3 +++ harbour/config/c.cf | 4 +--- harbour/config/lib.cf | 4 ++++ harbour/config/prg.cf | 9 +++----- harbour/config/test.cf | 1 + harbour/source/Makefile | 1 + harbour/source/rtl/Makefile | 5 ++++ harbour/source/rtl/dates.c | 4 +++- harbour/source/tools/Makefile | 18 +++++++++++++++ harbour/source/tools/genobj.c | 16 +++++++------ harbour/tests/working/Makefile | 4 ++++ harbour/tests/working/statics.prg | 38 ------------------------------- 13 files changed, 82 insertions(+), 55 deletions(-) create mode 100644 harbour/source/tools/Makefile diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 017953010d..913dfd954e 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,33 @@ +Thu May 06 13:09:45 1999 Gonzalo A. Diethelm + + * config/bin.cf: + * config/c.cf: + * config/lib.cf: + * config/prg.cf: + * config/test.cf: + * source/rtl/Makefile: + By mistake, we were not compiling the PRG files into OBJS for the + rtl library. + + * source/rtl/dates.c: + Changed the use of min with explicit code. min and max are macros + in some platforms, functions in others, and it is usually a mess + to link against them. + + * source/Makefile: + * source/tools/Makefile: + This directory was not being compiled. + + * source/tools/genobj.c: + Got rid of most (all?) the warnings. + + * tests/working/Makefile: + Now the libs to link against are explicitly specified in the + Makefile. + + * tests/working/statics.prg: + Cleaned up all ^M characters. + Thu May 06 12:34:45 1999 Gonzalo A. Diethelm * source/compiler/harbour.l: diff --git a/harbour/config/bin.cf b/harbour/config/bin.cf index 72b50b0416..72e1c9e9b0 100644 --- a/harbour/config/bin.cf +++ b/harbour/config/bin.cf @@ -2,11 +2,14 @@ # $Id$ # +include $(TOP)$(ROOT)config/global.cf include $(TOP)$(ROOT)config/c.cf EXE_NAME = $(C_MAIN:.c=$(EXE_EXT)) EXE_ARCH = $(ARCH_DIR)$(EXE_NAME) +ALL_OBJS = $(ALL_C_OBJS) $(ALL_PRG_OBJS) + first : dirbase descend descend : diff --git a/harbour/config/c.cf b/harbour/config/c.cf index 7f6c224828..109b139524 100644 --- a/harbour/config/c.cf +++ b/harbour/config/c.cf @@ -2,8 +2,6 @@ # $Id$ # -include $(TOP)$(ROOT)config/global.cf - C_OBJS = $(C_SOURCES:.c=$(OBJ_EXT)) MAIN_OBJ = $(C_MAIN:.c=$(OBJ_EXT)) @@ -21,7 +19,7 @@ LEX_C = $(shell echo $(LEX_SOURCE) | cut -c1-4)_l.c LEX_OBJ = $(LEX_C:.c=$(OBJ_EXT)) endif -ALL_OBJS = $(C_OBJS) $(MAIN_OBJ) $(YACC_OBJ) $(LEX_OBJ) +ALL_C_OBJS = $(C_OBJS) $(MAIN_OBJ) $(YACC_OBJ) $(LEX_OBJ) $(YACC_OBJ) : $(YACC_C) diff --git a/harbour/config/lib.cf b/harbour/config/lib.cf index f58ae2691f..b452de1539 100644 --- a/harbour/config/lib.cf +++ b/harbour/config/lib.cf @@ -2,11 +2,15 @@ # $Id$ # +include $(TOP)$(ROOT)config/global.cf include $(TOP)$(ROOT)config/c.cf +include $(TOP)$(ROOT)config/prg.cf LIB_NAME = $(LIB_PREF)$(LIB)$(LIB_EXT) LIB_ARCH = $(ARCH_DIR)$(LIB_NAME) +ALL_OBJS = $(ALL_C_OBJS) $(ALL_PRG_OBJS) + first : dirbase descend descend : diff --git a/harbour/config/prg.cf b/harbour/config/prg.cf index 39825ab75c..abef307f11 100644 --- a/harbour/config/prg.cf +++ b/harbour/config/prg.cf @@ -2,17 +2,14 @@ # $Id$ # -LIBS += vm rtl - -include $(TOP)$(ROOT)config/global.cf - -C_SOURCES = $(PRG_SOURCES:.prg=.c) +PRG_C_SOURCES = $(PRG_SOURCES:.prg=.c) PRG_OBJS = $(PRG_SOURCES:.prg=$(OBJ_EXT)) PRG_EXES = $(PRG_SOURCES:.prg=$(EXE_EXT)) +ALL_PRG_OBJS = $(PRG_OBJS) $(PRG_EXES) : %$(EXE_EXT) : %$(OBJ_EXT) $(PRG_OBJS) : %$(OBJ_EXT) : %.c -$(C_SOURCES) : %.c : ../../%.prg +$(PRG_C_SOURCES) : %.c : ../../%.prg diff --git a/harbour/config/test.cf b/harbour/config/test.cf index 5f05e701c1..520f962c8f 100644 --- a/harbour/config/test.cf +++ b/harbour/config/test.cf @@ -2,6 +2,7 @@ # $Id$ # +include $(TOP)$(ROOT)config/global.cf include $(TOP)$(ROOT)config/prg.cf first : dirbase descend diff --git a/harbour/source/Makefile b/harbour/source/Makefile index 9d0c2736cb..39e953527d 100644 --- a/harbour/source/Makefile +++ b/harbour/source/Makefile @@ -8,5 +8,6 @@ DIRS=\ compiler \ rtl \ vm \ + tools \ include $(ROOT)config/dir.cf diff --git a/harbour/source/rtl/Makefile b/harbour/source/rtl/Makefile index 2e75f03b02..ddad6c0610 100644 --- a/harbour/source/rtl/Makefile +++ b/harbour/source/rtl/Makefile @@ -21,6 +21,11 @@ C_SOURCES=\ strings.c \ transfrm.c \ +PRG_SOURCES=\ + error.prg \ + errorsys.prg \ + tclass.prg \ + LIB=rtl include $(TOP)$(ROOT)config/lib.cf diff --git a/harbour/source/rtl/dates.c b/harbour/source/rtl/dates.c index 46f5f84ad8..fa7bdde371 100644 --- a/harbour/source/rtl/dates.c +++ b/harbour/source/rtl/dates.c @@ -122,7 +122,9 @@ char * hb_dtoc (char * szDate, char * szDateFormat) /* * Determine the maximum size of the formatted date string */ - size = min (10, strlen (hb_set.HB_SET_DATEFORMAT)); + size = strlen (hb_set.HB_SET_DATEFORMAT); + if (size > 10) + size = 10; format_count = 0; used_d = used_m = used_y = FALSE; diff --git a/harbour/source/tools/Makefile b/harbour/source/tools/Makefile new file mode 100644 index 0000000000..b234ce8cb0 --- /dev/null +++ b/harbour/source/tools/Makefile @@ -0,0 +1,18 @@ +# +# $Id$ +# + +ROOT = ../../ + +C_SOURCES=\ + datesx.c \ + debug.c \ + genobj.c \ + mathx.c \ + stringsx.c \ + +# io.c should be in the list, but it is DOS-specific. + +LIB=tools + +include $(TOP)$(ROOT)config/lib.cf diff --git a/harbour/source/tools/genobj.c b/harbour/source/tools/genobj.c index 473dcaf941..777ab763a4 100644 --- a/harbour/source/tools/genobj.c +++ b/harbour/source/tools/genobj.c @@ -10,6 +10,10 @@ #include #include +#if defined(__GNUC__) || defined(__DJGPP__) + #include +#endif + void CompiledFileName( int hObjFile, char * szFileName ); void CompilerVersion( int hObjFile, char * szFileName ); void LocalNames( int hObjFile, char * szNames[] ); @@ -47,7 +51,7 @@ int main( int argc, char * argv[] ) 3, /* "CODE" position + 1 into localNames */ 0x3D ); /* segment length */ - PubDef( hObjFile, "MAIN", 1, 0x10 ); /* 1 = _TEXT segment, 0x10 offset into it ); + PubDef( hObjFile, "MAIN", 1, 0x10 ); /* 1 = _TEXT segment, 0x10 offset into it ); */ /* data segment */ DefineSegment( hObjFile, 4, /* "_DATA" position + 1 into localNames */ @@ -82,6 +86,7 @@ int main( int argc, char * argv[] ) End( hObjFile ); close( hObjFile ); + return 0; } void putbyte( BYTE b, int hObjFile ) @@ -110,7 +115,7 @@ void CompiledFileName( int hObjFile, char * szFileName ) putbyte( wLen, hObjFile ); /* szFileName length */ bChk += wLen; - while( bChar = * szFileName++ ) + while( (bChar = * szFileName++) ) { putbyte( bChar, hObjFile ); /* each of the szFileName characters */ bChk += bChar; @@ -134,7 +139,7 @@ void CompilerVersion( int hObjFile, char * szVersion ) putword( 0, hObjFile ); - while( bChar = * szVersion++ ) + while( (bChar = * szVersion++) ) { putbyte( bChar, hObjFile ); /* each of the szFileName characters */ bChk += bChar; @@ -148,7 +153,6 @@ void LocalNames( int hObjFile, char * szNames[] ) BYTE b = 0, c; WORD wTotalLen = 0; BYTE bChk = 0; - BYTE bChar; while( szNames[ b ] ) wTotalLen += strlen( szNames[ b++ ] ); @@ -201,7 +205,7 @@ void PubDef( int hObjFile, char * szName, WORD wSegment, WORD wOffset ) putbyte( strlen( szName ), hObjFile ); bChk += strlen( szName ); - while( bChar = * szName++ ) + while( (bChar = * szName++) ) { putbyte( bChar, hObjFile ); bChk += bChar; @@ -220,7 +224,6 @@ void ExternalNames( int hObjFile, char * szNames[] ) BYTE b = 0, c; WORD wTotalLen = 0; BYTE bChk = 0; - BYTE bChar; while( szNames[ b ] ) wTotalLen += strlen( szNames[ b++ ] ) + 1; @@ -389,7 +392,6 @@ void Fixup( int hObjFile, BYTE bType, WORD wOffset, BYTE bFlags, BYTE bSymbol ) void End( int hObjFile ) { BYTE bChk = 0; - BYTE bChar; putbyte( 0x8A, hObjFile ); bChk += 0x8A; diff --git a/harbour/tests/working/Makefile b/harbour/tests/working/Makefile index b1fc0d05f9..51139ca566 100644 --- a/harbour/tests/working/Makefile +++ b/harbour/tests/working/Makefile @@ -47,4 +47,8 @@ PRG_SOURCES=\ val.prg \ while.prg \ +LIBS=\ + vm \ + rtl \ + include $(TOP)$(ROOT)config/test.cf diff --git a/harbour/tests/working/statics.prg b/harbour/tests/working/statics.prg index 43035bbbb0..2d0227c072 100644 --- a/harbour/tests/working/statics.prg +++ b/harbour/tests/working/statics.prg @@ -1,77 +1,39 @@ // Testing Harbour statics variables management - - static z := "First" - - function Main() - LOCAL i - - static a := "Hello", b := { 1, 3 } - - QOut( a ) - QOut( b[ 2 ] ) - - Two() - - QOut( "Ok!" ) - - FOR i:=1 TO 10 - NumStat() - NEXT - - return nil - - function Two() - - static a := "Test" - - QOut( a ) - - return nil - - FUNCTION THREE( p ) - QOut( p ) - RETURN p - - PROCEDURE NumStat() - STATIC n:=0 - QOut( ++n ) - QOut( z ) - RETURN \ No newline at end of file