diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 0ac26fb5d3..6f3bcd4365 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,91 @@ +20000326-08:06 GMT+1 Victor Szakats + + * include/hbdefs.h + * include/clipdefs.h + * Now the HARBOUR keyword requires the function name to be in uppercase. + The compatibility CLIPPER keyword still allows for mixed case function + names on some platforms. The reason is that "pascal" keyword is + non-portable, and the above requiremenet was already there for some + platforms, now it's a generic rule. + - Removed the __attribute__ ((stdcall)) for the __GNUC__ branch. Setting + any specific calling convention is not needed, since we don't need to + deal with compatibility with precompiled legacy libs, there's no + such thing, CA-Cl*pper never supported GNU C. + ; Now the HARBOUR macro is quite simple, it's plain "void". + + * source/pp/ppcore.c + + Added predefined macro __HB_MAIN__. The macro is undefined or holds the + value of HARBOUR_START_PROCEDURE depending on the compiler. + Use this code to make your Harbour startup procedure platform + independent: + #ifndef __HB_MAIN__ + #define __HB_MAIN__ AppMain /* Or whatever you wish to call it */ + #endif + FUNCTION __HB_MAIN__() + + + contrib/hbclip/hbclip.h + + Added header file which can be used to maintain common C source code + for CA-Cl*pper and Harbour. The legacy code need a one-time conversion + to make this work. + + * source/rtl/dir.c + ! Fixed #elif guard (BCC31 was not working). (|| -> &&) + + * source/rtl/gete.c + * source/rtl/math.c + * source/rtl/abs.c + * source/rtl/minmax.c + * source/rtl/mod.c + * source/rtl/round.c + * source/rtl/dir.c + * source/rtl/binnum.c + * source/rtl/philes.c + * source/rtl/empty.c + * source/rtl/setpos.c + * source/rtl/saverest.c + * source/rtl/setcurs.c + * source/rtl/gx.c + * source/rtl/len.c + * source/rtl/valtype.c + * source/rtl/msgxxx.c + * source/vm/pcount.c + * source/vm/proc.c + * source/vm/break.c + * source/vm/initexit.c + + Added copyrights for some files which didn't have any. The source is + the Harbour mailing list archive. + + * source/tools/html.prg -> utils/hbdoc/ + * source/tools/ng.prg -> utils/hbdoc/ + * source/tools/os2.prg -> utils/hbdoc/ + * source/tools/rtf.prg -> utils/hbdoc/ + * source/tools/troff.prg -> utils/hbdoc/ + * source/tools/fileread.prg -> utils/hbdoc/ (copied) + * source/tools/Makefile + * utils/hbdoc/Makefile + * makefile.vc + * makefile.bc + * Some HBDOC specific source files moved to their local directory. + * One tools file copied to hbdoc for local usage. + - Removed tools lib. + + * samples/guestbk/testcgi.prg + * samples/guestbk/Makefile + * samples/guestbk/bld_b32.bat + ! #include hbclip.ch guarded + - Removed tools lib. + + * samples/misc/Makefile + * samples/pe/Makefile + - Removed tools lib. + + * utils/hbtest/hbtest.prg + ! Typo (suit -> suite) + * source/rtl/gtwin/gtwin.c + ! Unused variable warning fixed. + * doc/gmake.txt + ! make_tpl -> make_gnu + 20000326-03:37 GMT+1 Victor Szakats - make_tpl.* diff --git a/harbour/contrib/hbclip/hbclip.h b/harbour/contrib/hbclip/hbclip.h new file mode 100644 index 0000000000..82b1a25440 --- /dev/null +++ b/harbour/contrib/hbclip/hbclip.h @@ -0,0 +1,48 @@ +/* + * $Id$ + */ + +/* + * Harbour Compatibility Library for CA-Cl*pper source code: + * Header file to help compile C file for both Harbour and Clipper + * + * Copyright 2000 Victor Szakats + * 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/). + * + */ + +#ifndef HB_CLIP_H_ +#define HB_CLIP_H_ + +#ifdef __HARBOUR__ + #include "hbdefs.h" + #define HB_FUNCL( funcname, funcshort ) HB_FUNC( funcname ) +#else + #define HB_FUNC( funcname ) CLIPPER funcname ( void ) + #define HB_FUNCL( funcname, funcshort ) CLIPPER funcshort ( void ) +#endif + +#endif /* HB_CLIP_H_ */ + diff --git a/harbour/doc/gmake.txt b/harbour/doc/gmake.txt index 1e3aa6cfe1..f112d0a875 100644 --- a/harbour/doc/gmake.txt +++ b/harbour/doc/gmake.txt @@ -155,7 +155,7 @@ For MSVC on Win95/WinNT: If you have MAKE_MODE in your dos environment, make sure it is not set to unix - For best results, in your copy of make_tpl.bat, also set: + For best results, in your copy of make_gnu.bat, also set: C_USR=-TP HB_ARCHITECTURE w32 HB_COMPILER msvc diff --git a/harbour/include/clipdefs.h b/harbour/include/clipdefs.h index 726d2e1c0d..dabe4bca5b 100644 --- a/harbour/include/clipdefs.h +++ b/harbour/include/clipdefs.h @@ -96,7 +96,11 @@ typedef USHORT ( * FUNCP )( USHORT param, ...); typedef FUNCP * FUNCPP; #define HIDE static -#define CLIPPER HARBOUR +#if defined(_MSC_VER) || defined(__IBMCPP__) + #define CLIPPER HARBOUR +#else + #define CLIPPER HARBOUR pascal +#endif #ifndef NIL #define NIL '\0' diff --git a/harbour/include/hbdefs.h b/harbour/include/hbdefs.h index f76c1e734b..8ffd6a30e5 100644 --- a/harbour/include/hbdefs.h +++ b/harbour/include/hbdefs.h @@ -120,13 +120,7 @@ #define HB_SYMBOL_UNUSED( symbol ) ( void ) symbol -#if defined(__GNUC__) - #define HARBOUR void __attribute__ ((stdcall)) -#elif defined(_MSC_VER) || defined(__IBMCPP__) - #define HARBOUR void -#else - #define HARBOUR void pascal -#endif +#define HARBOUR void #define __HARBOUR__ diff --git a/harbour/makefile.bc b/harbour/makefile.bc index 4ac0d37f39..cc85f466fa 100644 --- a/harbour/makefile.bc +++ b/harbour/makefile.bc @@ -312,15 +312,10 @@ TOOLS_LIB_OBJS = \ $(OBJ_DIR)\strright.obj \ \ $(OBJ_DIR)\fileread.obj \ - $(OBJ_DIR)\html.obj \ $(OBJ_DIR)\nconvert.obj \ - $(OBJ_DIR)\ng.obj \ $(OBJ_DIR)\numtxten.obj \ $(OBJ_DIR)\numtxthu.obj \ - $(OBJ_DIR)\os2.obj \ - $(OBJ_DIR)\rtf.obj \ - $(OBJ_DIR)\stringp.obj \ - $(OBJ_DIR)\troff.obj + $(OBJ_DIR)\stringp.obj # # MACRO.LIB rules @@ -518,7 +513,13 @@ HBDOC_EXE_OBJS = \ $(OBJ_DIR)\genng.obj \ $(OBJ_DIR)\genos2.obj \ $(OBJ_DIR)\genrtf.obj \ - $(OBJ_DIR)\gentrf.obj + $(OBJ_DIR)\gentrf.obj \ + $(OBJ_DIR)\html.obj \ + $(OBJ_DIR)\ng.obj \ + $(OBJ_DIR)\os2.obj \ + $(OBJ_DIR)\rtf.obj \ + $(OBJ_DIR)\troff.obj \ + $(OBJ_DIR)\fileread.obj # # Our default target @@ -1564,13 +1565,6 @@ $(OBJ_DIR)\hb_f.obj : $(TOOLS_DIR)\hb_f.c $(CC) $(CLIBFLAGS) -o$@ $** tlib $(TOOLS_LIB) -+$@,, -$(OBJ_DIR)\html.c : $(TOOLS_DIR)\html.prg - $(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@ - -$(OBJ_DIR)\html.obj : $(OBJ_DIR)\html.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) -+$@,, - $(OBJ_DIR)\mathx.obj : $(TOOLS_DIR)\mathx.c $(CC) $(CLIBFLAGS) -o$@ $** tlib $(TOOLS_LIB) -+$@,, @@ -1582,13 +1576,6 @@ $(OBJ_DIR)\nconvert.obj : $(OBJ_DIR)\nconvert.c $(CC) $(CLIBFLAGS) -o$@ $** tlib $(TOOLS_LIB) -+$@,, -$(OBJ_DIR)\ng.c : $(TOOLS_DIR)\ng.prg - $(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@ - -$(OBJ_DIR)\ng.obj : $(OBJ_DIR)\ng.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) -+$@,, - $(OBJ_DIR)\numtxten.c : $(TOOLS_DIR)\numtxten.prg $(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@ @@ -1603,20 +1590,6 @@ $(OBJ_DIR)\numtxthu.obj : $(OBJ_DIR)\numtxthu.c $(CC) $(CLIBFLAGS) -o$@ $** tlib $(TOOLS_LIB) -+$@,, -$(OBJ_DIR)\os2.c : $(TOOLS_DIR)\os2.prg - $(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@ - -$(OBJ_DIR)\os2.obj : $(OBJ_DIR)\os2.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) -+$@,, - -$(OBJ_DIR)\rtf.c : $(TOOLS_DIR)\rtf.prg - $(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@ - -$(OBJ_DIR)\rtf.obj : $(OBJ_DIR)\rtf.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) -+$@,, - $(OBJ_DIR)\strasint.obj : $(TOOLS_DIR)\strasint.c $(CC) $(CLIBFLAGS) -o$@ $** tlib $(TOOLS_LIB) -+$@,, @@ -1664,13 +1637,6 @@ $(OBJ_DIR)\strright.obj : $(TOOLS_DIR)\strright.c $(CC) $(CLIBFLAGS) -o$@ $** tlib $(TOOLS_LIB) -+$@,, -$(OBJ_DIR)\troff.c : $(TOOLS_DIR)\troff.prg - $(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@ - -$(OBJ_DIR)\troff.obj : $(OBJ_DIR)\troff.c - $(CC) $(CLIBFLAGS) -o$@ $** - tlib $(TOOLS_LIB) -+$@,, - # # MACRO.LIB dependencies # @@ -1970,6 +1936,12 @@ $(HBDOC_EXE) : $(HBDOC_EXE_OBJS) echo. $(OBJ_DIR)\genos2.obj >> make.tmp echo. $(OBJ_DIR)\genrtf.obj >> make.tmp echo. $(OBJ_DIR)\gentrf.obj >> make.tmp + echo. $(OBJ_DIR)\html.obj >> make.tmp + echo. $(OBJ_DIR)\ng.obj >> make.tmp + echo. $(OBJ_DIR)\os2.obj >> make.tmp + echo. $(OBJ_DIR)\rtf.obj >> make.tmp + echo. $(OBJ_DIR)\troff.obj >> make.tmp + echo. $(OBJ_DIR)\fileread.obj >> make.tmp echo. $(PP_LIB) >> make.tmp echo. $(COMMON_LIB) >> make.tmp echo. $(VM_LIB) >> make.tmp @@ -2031,3 +2003,38 @@ $(OBJ_DIR)\gentrf.c : $(HBDOC_DIR)\gentrf.prg $(OBJ_DIR)\gentrf.obj : $(OBJ_DIR)\gentrf.c $(CC) $(CLIBFLAGS) -o$@ $** +$(OBJ_DIR)\html.c : $(HBDOC_DIR)\html.prg + $(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@ + +$(OBJ_DIR)\html.obj : $(OBJ_DIR)\html.c + $(CC) $(CLIBFLAGS) -o$@ $** + +$(OBJ_DIR)\ng.c : $(HBDOC_DIR)\ng.prg + $(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@ + +$(OBJ_DIR)\ng.obj : $(OBJ_DIR)\ng.c + $(CC) $(CLIBFLAGS) -o$@ $** + +$(OBJ_DIR)\os2.c : $(HBDOC_DIR)\os2.prg + $(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@ + +$(OBJ_DIR)\os2.obj : $(OBJ_DIR)\os2.c + $(CC) $(CLIBFLAGS) -o$@ $** + +$(OBJ_DIR)\rtf.c : $(HBDOC_DIR)\rtf.prg + $(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@ + +$(OBJ_DIR)\rtf.obj : $(OBJ_DIR)\rtf.c + $(CC) $(CLIBFLAGS) -o$@ $** + +$(OBJ_DIR)\troff.c : $(HBDOC_DIR)\troff.prg + $(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@ + +$(OBJ_DIR)\troff.obj : $(OBJ_DIR)\troff.c + $(CC) $(CLIBFLAGS) -o$@ $** + +$(OBJ_DIR)\fileread.c : $(HBDOC_DIR)\fileread.prg + $(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@ + +$(OBJ_DIR)\fileread.obj : $(OBJ_DIR)\fileread.c + $(CC) $(CLIBFLAGS) -o$@ $** diff --git a/harbour/makefile.vc b/harbour/makefile.vc index 68d5837ddd..1a689008ae 100644 --- a/harbour/makefile.vc +++ b/harbour/makefile.vc @@ -359,15 +359,10 @@ TOOLS_LIB_OBJS = \ $(OBJ_DIR)\strright.obj \ \ $(OBJ_DIR)\fileread.obj \ - $(OBJ_DIR)\html.obj \ $(OBJ_DIR)\nconvert.obj \ - $(OBJ_DIR)\ng.obj \ $(OBJ_DIR)\numtxten.obj \ $(OBJ_DIR)\numtxthu.obj \ - $(OBJ_DIR)\os2.obj \ - $(OBJ_DIR)\rtf.obj \ - $(OBJ_DIR)\stringp.obj \ - $(OBJ_DIR)\troff.obj + $(OBJ_DIR)\stringp.obj # # MACRO.LIB rules @@ -701,9 +696,15 @@ $(HBDOC_EXE) : \ $(HBDOC_DIR)\genhtm.prg \ $(HBDOC_DIR)\genrtf.prg \ $(HBDOC_DIR)\genhpc.prg \ - $(HBDOC_DIR)\genasc.prg + $(HBDOC_DIR)\genasc.prg \ + $(HBDOC_DIR)\html.prg \ + $(HBDOC_DIR)\ng.prg \ + $(HBDOC_DIR)\os2.prg \ + $(HBDOC_DIR)\rtf.prg \ + $(HBDOC_DIR)\troff.prg \ + $(HBDOC_DIR)\fileread.prg $(HARBOUR_EXE) $(HARBOURFLAGS) -o$(OBJ_DIR)\ $** - $(CC) $(CFLAGS) -Fo$(OBJ_DIR)\ $(OBJ_DIR)\hbdoc.c $(OBJ_DIR)\genos2.c $(OBJ_DIR)\gentrf.c $(OBJ_DIR)\genng.c $(OBJ_DIR)\genhtm.c $(OBJ_DIR)\genrtf.c $(OBJ_DIR)\genhpc.c $(OBJ_DIR)\genasc.c -o $(HBDOC_EXE) /link $(LIBS2) + $(CC) $(CFLAGS) -Fo$(OBJ_DIR)\ $(OBJ_DIR)\hbdoc.c $(OBJ_DIR)\genos2.c $(OBJ_DIR)\gentrf.c $(OBJ_DIR)\genng.c $(OBJ_DIR)\genhtm.c $(OBJ_DIR)\genrtf.c $(OBJ_DIR)\genhpc.c $(OBJ_DIR)\genasc.c $(OBJ_DIR)\html.c $(OBJ_DIR)\ng.c $(OBJ_DIR)\os2.c $(OBJ_DIR)\rtf.c $(OBJ_DIR)\troff.c $(OBJ_DIR)\fileread.c -o $(HBDOC_EXE) /link $(LIBS2) # # HARBOUR.EXE rules diff --git a/harbour/samples/guestbk/Makefile b/harbour/samples/guestbk/Makefile index faa8161cee..44740ebb43 100644 --- a/harbour/samples/guestbk/Makefile +++ b/harbour/samples/guestbk/Makefile @@ -12,7 +12,6 @@ PRG_SOURCES=\ PRG_MAIN=guestbk.prg LIBS=\ - tools \ debug \ vm \ rtl \ diff --git a/harbour/samples/guestbk/bld_b32.bat b/harbour/samples/guestbk/bld_b32.bat index 05724e54da..1ed549a385 100644 --- a/harbour/samples/guestbk/bld_b32.bat +++ b/harbour/samples/guestbk/bld_b32.bat @@ -10,7 +10,6 @@ rem echo -O2 -I..\..\include -L..\..\lib > build.tmp echo -eguestbk.exe >> build.tmp echo guestbk.c inifiles.c testcgi.c >> build.tmp -echo tools.lib >> build.tmp echo debug.lib >> build.tmp echo vm.lib >> build.tmp echo rtl.lib >> build.tmp diff --git a/harbour/samples/guestbk/testcgi.prg b/harbour/samples/guestbk/testcgi.prg index 495433be39..cc35e2e4b3 100644 --- a/harbour/samples/guestbk/testcgi.prg +++ b/harbour/samples/guestbk/testcgi.prg @@ -26,7 +26,10 @@ **/ #include "cgi.ch" -#include "hbclip.ch" + +#ifndef __HARBOUR__ + #include "hbclip.ch" +#endif #define IF_BUFFER 65535 diff --git a/harbour/samples/hscript/Makefile b/harbour/samples/hscript/Makefile index 9823c8a9d9..a4b217eb07 100644 --- a/harbour/samples/hscript/Makefile +++ b/harbour/samples/hscript/Makefile @@ -10,7 +10,6 @@ PRG_SOURCES=\ PRG_MAIN=hscript.prg LIBS=\ - tools \ debug \ vm \ rtl \ diff --git a/harbour/samples/hscript/bld_b32.bat b/harbour/samples/hscript/bld_b32.bat index 66161e508e..0808fab332 100644 --- a/harbour/samples/hscript/bld_b32.bat +++ b/harbour/samples/hscript/bld_b32.bat @@ -4,5 +4,5 @@ rem $Id$ rem ..\..\bin\harbour hscript /n /i..\..\include -bcc32 -O2 -I..\..\include -L..\..\lib -ehscript.exe %hscript.c tools.lib debug.lib vm.lib rtl.lib rdd.lib macro.lib pp.lib dbfntx.lib dbfcdx.lib common.lib +bcc32 -O2 -I..\..\include -L..\..\lib -ehscript.exe hscript.c debug.lib vm.lib rtl.lib gtwin.lib rdd.lib macro.lib pp.lib dbfntx.lib dbfcdx.lib common.lib rem del hscript.c diff --git a/harbour/samples/misc/Makefile b/harbour/samples/misc/Makefile index 0469b3b4aa..c193f549a7 100644 --- a/harbour/samples/misc/Makefile +++ b/harbour/samples/misc/Makefile @@ -5,7 +5,6 @@ ROOT = ../../ LIBS=\ - tools \ debug \ vm \ rtl \ diff --git a/harbour/samples/pe/Makefile b/harbour/samples/pe/Makefile index af6ba5bc6e..15a4d17568 100644 --- a/harbour/samples/pe/Makefile +++ b/harbour/samples/pe/Makefile @@ -13,7 +13,6 @@ C_SOURCES=\ PRG_MAIN=pe.prg LIBS=\ - tools \ debug \ vm \ rtl \ diff --git a/harbour/source/pp/ppcore.c b/harbour/source/pp/ppcore.c index a22a198881..222137c37f 100644 --- a/harbour/source/pp/ppcore.c +++ b/harbour/source/pp/ppcore.c @@ -42,7 +42,7 @@ * See doc/pragma.txt * * Copyright 2000 Victor Szakats - * __DATE__, __TIME__ support + * __DATE__, __TIME__, __HB_MAIN__ support * * See doc/license.txt for licensing terms. * @@ -261,6 +261,10 @@ void hb_pp_Init( void ) sprintf( szResult, "\"%02d:%02d:%02d\"", oTime->tm_hour, oTime->tm_min, oTime->tm_sec ); hb_pp_AddDefine( "__TIME__", szResult ); } + +#ifdef HARBOUR_START_PROCEDURE + hb_pp_AddDefine( "__HB_MAIN__", HARBOUR_START_PROCEDURE ); +#endif } /* Table with parse warnings */ diff --git a/harbour/source/rtl/abs.c b/harbour/source/rtl/abs.c index bd9bbb0c47..6989a74155 100644 --- a/harbour/source/rtl/abs.c +++ b/harbour/source/rtl/abs.c @@ -6,7 +6,7 @@ * Harbour Project source code: * ABS() function * - * Copyright 1999 {list of individual authors and e-mail addresses} + * Copyright 1999 Matthew Hamilton * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify diff --git a/harbour/source/rtl/binnum.c b/harbour/source/rtl/binnum.c index b929863a29..b947b2fd44 100644 --- a/harbour/source/rtl/binnum.c +++ b/harbour/source/rtl/binnum.c @@ -6,7 +6,7 @@ * Harbour Project source code: * BIN2W(), BIN2I(), BIN2L(), I2BIN(), L2BIN() functions * - * Copyright 1999 {list of individual authors and e-mail addresses} + * Copyright 1999 Manuel Ruiz * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify diff --git a/harbour/source/rtl/dir.c b/harbour/source/rtl/dir.c index 39d630c0f4..cdc6dc6720 100644 --- a/harbour/source/rtl/dir.c +++ b/harbour/source/rtl/dir.c @@ -6,7 +6,7 @@ * Harbour Project source code: * DIRECTORY() function * - * Copyright 1999 {list of individual authors and e-mail addresses} + * Copyright 1999 Leslee Griffith * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify @@ -623,7 +623,7 @@ HB_FUNC( DIRECTORY ) strcpy( filename, ++pos ); } - #elif defined(__BORLANDC__) || (__BORLANDC__ >= 1280) + #elif defined(__BORLANDC__) && (__BORLANDC__ >= 1280) /* NOTE: _chmod( f, 0 ) => Get attribs _chmod( f, 1, n ) => Set attribs chmod() though, _will_ change the attributes */ diff --git a/harbour/source/rtl/empty.c b/harbour/source/rtl/empty.c index a9e41926ef..aa6e731704 100644 --- a/harbour/source/rtl/empty.c +++ b/harbour/source/rtl/empty.c @@ -6,7 +6,7 @@ * Harbour Project source code: * EMPTY() function * - * Copyright 1999 {list of individual authors and e-mail addresses} + * Copyright 1999 Antonio Linares * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify diff --git a/harbour/source/rtl/gete.c b/harbour/source/rtl/gete.c index ed3310816a..221053046d 100644 --- a/harbour/source/rtl/gete.c +++ b/harbour/source/rtl/gete.c @@ -6,7 +6,7 @@ * Harbour Project source code: * GETENV(), GETE() functions * - * Copyright 1999 {list of individual authors and e-mail addresses} + * Copyright 1999 Matthew Hamilton * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify diff --git a/harbour/source/rtl/gtapi.c b/harbour/source/rtl/gtapi.c index 372d11cb60..2c87d2162b 100644 --- a/harbour/source/rtl/gtapi.c +++ b/harbour/source/rtl/gtapi.c @@ -6,7 +6,7 @@ * Harbour Project source code: * The Terminal API * - * Copyright 1999 {list of individual authors and e-mail addresses} + * Copyright 1999 Bil Simser * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify diff --git a/harbour/source/rtl/gtwin/gtwin.c b/harbour/source/rtl/gtwin/gtwin.c index 3aeacaa56d..923cf83289 100644 --- a/harbour/source/rtl/gtwin/gtwin.c +++ b/harbour/source/rtl/gtwin/gtwin.c @@ -84,7 +84,9 @@ typedef WORD far * LPWORD; #endif +#if 0 static HANDLE s_HOsave; +#endif static HANDLE s_HDOutput; static HANDLE s_HOriginal; static HANDLE s_HOutput; diff --git a/harbour/source/rtl/gx.c b/harbour/source/rtl/gx.c index 05708a796d..81841cc9be 100644 --- a/harbour/source/rtl/gx.c +++ b/harbour/source/rtl/gx.c @@ -37,7 +37,7 @@ * The following parts are Copyright of the individual authors. * www - http://www.harbour-project.org * - * Copyright 1999 {list of individual authors and e-mail addresses} + * Copyright 1999 Paul Tucker * SETMODE() * * See doc/license.txt for licensing terms. diff --git a/harbour/source/rtl/len.c b/harbour/source/rtl/len.c index 2c847f6c54..94e36fb7e7 100644 --- a/harbour/source/rtl/len.c +++ b/harbour/source/rtl/len.c @@ -6,7 +6,7 @@ * Harbour Project source code: * LEN() function * - * Copyright 1999 {list of individual authors and e-mail addresses} + * Copyright 1999 Antonio Linares * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify diff --git a/harbour/source/rtl/math.c b/harbour/source/rtl/math.c index 3945223b8f..7103d964fa 100644 --- a/harbour/source/rtl/math.c +++ b/harbour/source/rtl/math.c @@ -6,7 +6,7 @@ * Harbour Project source code: * Math functions * - * Copyright 1999 {list of individual authors and e-mail addresses} + * Copyright 1999 Matthew Hamilton * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify diff --git a/harbour/source/rtl/minmax.c b/harbour/source/rtl/minmax.c index 2c653a034b..a9a1400d80 100644 --- a/harbour/source/rtl/minmax.c +++ b/harbour/source/rtl/minmax.c @@ -6,7 +6,7 @@ * Harbour Project source code: * MIN(), MAX() functions * - * Copyright 1999 {list of individual authors and e-mail addresses} + * Copyright 1999 Matthew Hamilton * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify diff --git a/harbour/source/rtl/mod.c b/harbour/source/rtl/mod.c index 6d59e72973..81dc83f998 100644 --- a/harbour/source/rtl/mod.c +++ b/harbour/source/rtl/mod.c @@ -6,7 +6,7 @@ * Harbour Project source code: * MOD() function * - * Copyright 1999 {list of individual authors and e-mail addresses} + * Copyright 1999 Matthew Hamilton * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify diff --git a/harbour/source/rtl/msgxxx.c b/harbour/source/rtl/msgxxx.c index c8c0b9dd0c..18b32151ed 100644 --- a/harbour/source/rtl/msgxxx.c +++ b/harbour/source/rtl/msgxxx.c @@ -6,7 +6,7 @@ * Harbour Project source code: * Localization module includer for GNU compilers * - * Copyright 1999 {list of individual authors and e-mail addresses} + * Copyright 1999 Gonzalo Diethelm * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify diff --git a/harbour/source/rtl/philes.c b/harbour/source/rtl/philes.c index cacd4138cc..f5113a73d9 100644 --- a/harbour/source/rtl/philes.c +++ b/harbour/source/rtl/philes.c @@ -6,7 +6,7 @@ * Harbour Project source code: * The FileSys API (Harbour level) * - * Copyright 1999 {list of individual authors and e-mail addresses} + * Copyright 1999 Manuel Ruiz * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify diff --git a/harbour/source/rtl/round.c b/harbour/source/rtl/round.c index b57ec5a31a..713aa1cb6f 100644 --- a/harbour/source/rtl/round.c +++ b/harbour/source/rtl/round.c @@ -6,7 +6,7 @@ * Harbour Project source code: * ROUND(), INT() functions * - * Copyright 1999 {list of individual authors and e-mail addresses} + * Copyright 1999 David G. Holm * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify @@ -37,8 +37,8 @@ * The following parts are Copyright of the individual authors. * www - http://www.harbour-project.org * - * Copyright 1999 David G. Holm - * ROUND() + * Copyright 1999 Matthew Hamilton + * INT() * * See doc/license.txt for licensing terms. * diff --git a/harbour/source/rtl/saverest.c b/harbour/source/rtl/saverest.c index bf87a75e03..f7c12658da 100644 --- a/harbour/source/rtl/saverest.c +++ b/harbour/source/rtl/saverest.c @@ -6,7 +6,7 @@ * Harbour Project source code: * SAVESCREEN(), RESTSCREEN() functions * - * Copyright 1999 {list of individual authors and e-mail addresses} + * Copyright 1999 Antonio Linares * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify diff --git a/harbour/source/rtl/setcurs.c b/harbour/source/rtl/setcurs.c index 6c793c8bf1..e042b8ba6f 100644 --- a/harbour/source/rtl/setcurs.c +++ b/harbour/source/rtl/setcurs.c @@ -6,7 +6,7 @@ * Harbour Project source code: * SETCURSOR() function * - * Copyright 1999 {list of individual authors and e-mail addresses} + * Copyright 1999 Antonio Linares * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify diff --git a/harbour/source/rtl/setpos.c b/harbour/source/rtl/setpos.c index 7229b6ac60..45833fa27a 100644 --- a/harbour/source/rtl/setpos.c +++ b/harbour/source/rtl/setpos.c @@ -6,7 +6,8 @@ * Harbour Project source code: * SETPOS(), SETPOSBS() functions * - * Copyright 1999 {list of individual authors and e-mail addresses} + * Copyright 1999 David G. Holm + * Copyright 1999 Victor Szakats * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify diff --git a/harbour/source/rtl/valtype.c b/harbour/source/rtl/valtype.c index befdfca584..2be58137f5 100644 --- a/harbour/source/rtl/valtype.c +++ b/harbour/source/rtl/valtype.c @@ -6,7 +6,7 @@ * Harbour Project source code: * VALTYPE() function * - * Copyright 1999 {list of individual authors and e-mail addresses} + * Copyright 1999 Antonio Linares * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify diff --git a/harbour/source/tools/Makefile b/harbour/source/tools/Makefile index b1789b28a8..73a9e338b0 100644 --- a/harbour/source/tools/Makefile +++ b/harbour/source/tools/Makefile @@ -34,15 +34,10 @@ C_SOURCES=\ PRG_SOURCES=\ fileread.prg \ - html.prg \ nconvert.prg \ - ng.prg \ numtxthu.prg \ numtxten.prg \ - os2.prg \ - rtf.prg \ stringp.prg \ - troff.prg \ LIBNAME=tools diff --git a/harbour/source/vm/break.c b/harbour/source/vm/break.c index f75ac207e8..fbbfa659e3 100644 --- a/harbour/source/vm/break.c +++ b/harbour/source/vm/break.c @@ -6,7 +6,7 @@ * Harbour Project source code: * BREAK() function * - * Copyright 1999 {list of individual authors and e-mail addresses} + * Copyright 1999 Ryszard Glab * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify diff --git a/harbour/source/vm/initexit.c b/harbour/source/vm/initexit.c index 6816e7f27b..b7f9f1188e 100644 --- a/harbour/source/vm/initexit.c +++ b/harbour/source/vm/initexit.c @@ -6,7 +6,7 @@ * Harbour Project source code: * __QUIT() function * - * Copyright 1999 {list of individual authors and e-mail addresses} + * Copyright 1999 Antonio Linares * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify diff --git a/harbour/source/vm/pcount.c b/harbour/source/vm/pcount.c index 77f11a7f27..f48a956eca 100644 --- a/harbour/source/vm/pcount.c +++ b/harbour/source/vm/pcount.c @@ -6,7 +6,7 @@ * Harbour Project source code: * PCOUNT() function * - * Copyright 1999 {list of individual authors and e-mail addresses} + * Copyright 1999 Antonio Linares * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify diff --git a/harbour/source/vm/proc.c b/harbour/source/vm/proc.c index 60e01154e2..8a9490ea79 100644 --- a/harbour/source/vm/proc.c +++ b/harbour/source/vm/proc.c @@ -6,7 +6,7 @@ * Harbour Project source code: * PROCNAME(), PROCLINE() and PROCFILE() functions * - * Copyright 1999 {list of individual authors and e-mail addresses} + * Copyright 1999 Antonio Linares * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify diff --git a/harbour/utils/hbdoc/Makefile b/harbour/utils/hbdoc/Makefile index 19dbe437af..eed7d28c3b 100644 --- a/harbour/utils/hbdoc/Makefile +++ b/harbour/utils/hbdoc/Makefile @@ -9,19 +9,24 @@ endif ROOT = ../../ PRG_SOURCES=\ - hbdoc.prg \ - genos2.prg \ - gentrf.prg \ - genng.prg \ - genhtm.prg \ - genrtf.prg \ - genhpc.prg \ - genasc.prg \ + hbdoc.prg \ + genos2.prg \ + gentrf.prg \ + genng.prg \ + genhtm.prg \ + genrtf.prg \ + genhpc.prg \ + genasc.prg \ + html.prg \ + ng.prg \ + os2.prg \ + rtf.prg \ + troff.prg \ + fileread.prg \ PRG_MAIN=hbdoc.prg LIBS=\ - tools \ debug \ vm \ rtl \ diff --git a/harbour/utils/hbdoc/fileread.prg b/harbour/utils/hbdoc/fileread.prg new file mode 100644 index 0000000000..8f6b06ea58 --- /dev/null +++ b/harbour/utils/hbdoc/fileread.prg @@ -0,0 +1,276 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * A class that reads a file one line at a time + * + * Copyright 1999 David G. Holm + * 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 "fileio.ch" + +#define oF_ERROR_MIN 1 +#define oF_CREATE_OBJECT 1 +#define oF_OPEN_FILE 2 +#define oF_READ_FILE 3 +#define oF_CLOSE_FILE 4 +#define oF_ERROR_MAX 4 +#define oF_DEFAULT_READ_SIZE 4096 + +FUNCTION TFileRead() + STATIC s_oClass + + IF s_oClass == NIL + s_oClass := TClass():New( "TFile" ) // New class + s_oClass:AddClassData( "cFile" ) // The filename + s_oClass:AddClassData( "nHan" ) // The open file handle + s_oClass:AddClassData( "lEOF" ) // The end of file reached flag + s_oClass:AddClassData( "nError" ) // The current file error code + s_oClass:AddClassData( "nLastOp" ) // The last operation done (for error messages) + s_oClass:AddClassData( "cBuffer" ) // The readahead buffer + s_oClass:AddClassData( "nReadSize" ) // How much to add to the readahead buffer on + // each read from the file + + s_oClass:AddMethod( "New", @f_new() ) // Create a new class instance + s_oClass:AddMethod( "Open", @f_open() ) // Open the file for reading + s_oClass:AddMethod( "Close", @f_close() ) // Close the file when done + s_oClass:AddMethod( "ReadLine", @f_read() ) // Read a line from the file + s_oClass:AddMethod( "Name", @f_name() ) // Retunrs the file name + s_oClass:AddMethod( "IsOpen", @f_is_open() ) // Returns .T. if file is open + s_oClass:AddMethod( "MoreToRead", @f_more() ) // Returns .T. if more to be read + s_oClass:AddMethod( "Error", @f_error() ) // Returns .T. if error occurred + s_oClass:AddMethod( "ErrorNo", @f_error_no() ) // Returns current error code + s_oClass:AddMethod( "ErrorMsg", @f_error_msg() ) // Returns formatted error message + s_oClass:Create() + ENDIF + + RETURN s_oClass:Instance() + +STATIC FUNCTION f_new( cFile, nSize ) + LOCAL oSelf := Qself() + + IF nSize == NIL .OR. nSize < 1 + // The readahead size can be set to as little as 1 byte, or as much as + // 65535 bytes, but venturing out of bounds forces the default size. + nSize := oF_DEFAULT_READ_SIZE + ENDIF + + oSelf:cFile := cFile // Save the file name + oSelf:nHan := -1 // It's not open yet + oSelf:lEOF := .T. // So it must be at EOF + oSelf:nError := 0 // But there haven't been any errors + oSelf:nLastOp := oF_CREATE_OBJECT // Because we just created the class + oSelf:cBuffer := "" // and nothing has been read yet + oSelf:nReadSize := nSize // But will be in this size chunks + + RETURN oSelf + +STATIC FUNCTION f_open( nMode ) + LOCAL oSelf := Qself() + + IF oSelf:nHan == -1 + // Only open the file if it isn't already open. + IF nMode == NIL + nMode := FO_READ + FO_SHARED // Default to shared read-only mode + ENDIF + oSelf:nLastOp := oF_OPEN_FILE + oSelf:nHan := FOPEN( oSelf:cFile, nMode ) // Try to open the file + IF oSelf:nHan == -1 + oSelf:nError := FERROR() // It didn't work + oSelf:lEOF := .T. // So force EOF + ELSE + oSelf:nError := 0 // It worked + oSelf:lEOF := .F. // So clear EOF + ENDIF + ELSE + // The file is already open, so rewind to the beginning. + IF FSEEK( oSelf:nHan, 0 ) == 0 + oSelf:lEOF := .F. // Definitely not at EOF + ELSE + oSelf:nError := FERROR() // Save error code if not at BOF + ENDIF + oSelf:cBuffer := "" // Clear the readahead buffer + ENDIF + + RETURN oSelf + +STATIC FUNCTION f_read() + LOCAL oSelf := Qself() + LOCAL cLine := "" + LOCAL nPos + + oSelf:nLastOp := oF_READ_FILE + + IF oSelf:nHan == -1 + oSelf:nError := -1 // Set unknown error if file not open + ELSE + // Is there a whole line in the readahead buffer? + nPos := f_EOL_pos( oSelf ) + WHILE ( nPos <= 0 .OR. nPos > LEN( oSelf:cBuffer ) - 3 ) .AND. !oSelf:lEOF + // Either no or maybe, but there is possibly more to be read. + // Maybe means that we found either a CR or an LF, but we don't + // have enough characters to discriminate between the three types + // of end of line conditions that the class recognizes (see below). + cLine := FREADSTR( oSelf:nHan, oSelf:nReadSize ) + IF EMPTY( cLine ) + // There was nothing more to be read. Why? (Error or EOF.) + oSelf:nError := FERROR() + IF oSelf:nError == 0 + // Because the file is at EOF. + oSelf:lEOF := .T. + ENDIF + ELSE + // Add what was read to the readahead buffer. + oSelf:cBuffer += cLine + cLine := "" + ENDIF + // Is there a whole line in the readahead buffer yet? + nPos := f_EOL_pos( oSelf ) + END WHILE + // Is there a whole line in the readahead buffer? + IF nPos <= 0 + // No, which means that there is nothing left in the file either, so + // return the entire buffer contents as the last line in the file. + cLine := oSelf:cBuffer + oSelf:cBuffer := "" + ELSE + // Yes. Is there anything in the line? + IF nPos > 1 + // Yes, so return the contents. + cLine := LEFT( oSelf:cBuffer, nPos - 1 ) + ELSE + // No, so return an empty string. + cLine := "" + ENDIF + // Deal with multiple possible end of line conditions. + DO CASE + CASE SUBSTR( oSelf:cBuffer, nPos, 3 ) == CHR( 13 ) + CHR( 13 ) + CHR( 10 ) + // It's a messed up DOS newline (such as that created by a program + // that uses "\r\n" as newline when writing to a text mode file, + // which causes the '\n' to expand to "\r\n", giving "\r\r\n"). + nPos += 3 + CASE SUBSTR( oSelf:cBuffer, nPos, 2 ) == CHR( 13 ) + CHR( 10 ) + // It's a standard DOS newline + nPos += 2 + OTHERWISE + // It's probably a Mac or Unix newline + nPos++ + ENDCASE + oSelf:cBuffer := SUBSTR( oSelf:cBuffer, nPos ) + ENDIF + ENDIF + + RETURN cLine + +STATIC FUNCTION f_EOL_pos( oFile ) + LOCAL nCRpos, nLFpos, nPos + + // Look for both CR and LF in the file read buffer. + nCRpos := AT( CHR( 13 ), oFile:cBuffer ) + nLFpos := AT( CHR( 10 ), oFile:cBuffer ) + DO CASE + CASE nCRpos == 0 + // If there's no CR, use the LF position. + nPos := nLFpos + CASE nLFpos == 0 + // If there's no LF, use the CR position. + nPos := nCRpos + OTHERWISE + // If there's both a CR and an LF, use the position of the first one. + nPos := MIN( nCRpos, nLFpos ) + ENDCASE + + RETURN nPos + +STATIC FUNCTION f_close() + LOCAL oSelf := Qself() + + oSelf:nLastOp := oF_CLOSE_FILE + oSelf:lEOF := .T. + // Is the file already closed. + IF oSelf:nHan == -1 + // Yes, so indicate an unknown error. + oSelf:nError := -1 + ELSE + // No, so close it already! + FCLOSE( oSelf:nHan ) + oSelf:nError := FERROR() + oSelf:nHan := -1 // The file is no longer open + oSelf:lEOF := .T. // So force an EOF condition + ENDIF + + RETURN oSelf + +STATIC FUNCTION f_name() + LOCAL oSelf := Qself() + // Returns the filename associated with this class instance. + RETURN oSelf:cFile + +STATIC FUNCTION f_is_open() + LOCAL oSelf := Qself() + // Returns .T. if the file is open. + RETURN oSelf:nHan != -1 + +STATIC FUNCTION f_more() + LOCAL oSelf := Qself() + // Returns .T. if there is more to be read from either the file or the + // readahead buffer. Only when both are exhausted is there no more to read. + RETURN !oSelf:lEOF .OR. !EMPTY( oSelf:cBuffer ) + +STATIC FUNCTION f_error() + LOCAL oSelf := Qself() + // Returns .T. if an error was recorded. + RETURN oSelf:nError != 0 + +STATIC FUNCTION f_error_no() + LOCAL oSelf := Qself() + // Returns the last error code that was recorded. + RETURN oSelf:nError + +STATIC FUNCTION f_error_msg( cText ) + STATIC s_cAction := {"on", "creating object for", "opening", "reading from", "closing"} + LOCAL oSelf := Qself() + LOCAL cMessage, nTemp + + // Has an error been recorded? + IF oSelf:nError == 0 + // No, so report that. + cMessage := "No errors have been recorded for " + oSelf:cFile + ELSE + // Yes, so format a nice error message, while avoiding a bounds error. + IF oSelf:nLastOp < oF_ERROR_MIN .OR. oSelf:nLastOp > oF_ERROR_MAX + nTemp := 1 + ELSE + nTemp := oSelf:nLastOp + 1 + ENDIF + cMessage := IF( EMPTY( cText ), "", cText ) + "Error " + ALLTRIM( STR( oSelf:nError ) ) + " " + s_cAction[ nTemp ] + " " + oSelf:cFile + ENDIF + + RETURN cMessage + diff --git a/harbour/source/tools/html.prg b/harbour/utils/hbdoc/html.prg similarity index 100% rename from harbour/source/tools/html.prg rename to harbour/utils/hbdoc/html.prg diff --git a/harbour/source/tools/ng.prg b/harbour/utils/hbdoc/ng.prg similarity index 100% rename from harbour/source/tools/ng.prg rename to harbour/utils/hbdoc/ng.prg diff --git a/harbour/source/tools/os2.prg b/harbour/utils/hbdoc/os2.prg similarity index 100% rename from harbour/source/tools/os2.prg rename to harbour/utils/hbdoc/os2.prg diff --git a/harbour/source/tools/rtf.prg b/harbour/utils/hbdoc/rtf.prg similarity index 100% rename from harbour/source/tools/rtf.prg rename to harbour/utils/hbdoc/rtf.prg diff --git a/harbour/source/tools/troff.prg b/harbour/utils/hbdoc/troff.prg similarity index 100% rename from harbour/source/tools/troff.prg rename to harbour/utils/hbdoc/troff.prg diff --git a/harbour/utils/hbtest/hbtest.prg b/harbour/utils/hbtest/hbtest.prg index f531d6c0c7..5597fbe72c 100644 --- a/harbour/utils/hbtest/hbtest.prg +++ b/harbour/utils/hbtest/hbtest.prg @@ -37,7 +37,7 @@ /* EMPTY() tests written by Eddie Runia */ /* :class* tests written by Dave Pearson */ -/* NOTE: The test suit will not work if the DTOS() function is not included +/* NOTE: The test suite will not work if the DTOS() function is not included in Harbour (-DHB_COMPAT_XPP). */ /* NOTE: Always compile with /n switch */ /* NOTE: It's worth to make tests with and without the /z switch */ @@ -75,7 +75,7 @@ STATIC s_nEndTime FUNCTION Main( cPar1, cPar2 ) - OutStd( "Harbour Regression Test Suit" + HB_OSNewLine() +; + OutStd( "Harbour Regression Test Suite" + HB_OSNewLine() +; "Copyright 1999-2000, http://www.harbour-project.org" + HB_OSNewLine() ) IF cPar1 == NIL