From 72526bc28323b625e0b5d916e6f84ac1f542e613 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Fri, 26 Oct 2007 23:26:59 +0000 Subject: [PATCH] 2007-10-27 01:23 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * include/hbsetup.h - Removed HOST_OS_UNIX_COMPATIBLE which was a misleading alias for OS_UNIX_COMPATIBLE. * source/compiler/hbcomp.c % HOST_OS_UNIX_COMPATIBLE -> OS_UNIX_COMPATIBLE * common.mak * harbour-ce-spec * make_xmingw.sh * make_xmingwce.sh * makefile.bc * makefile.gc * makefile.vc * source/pp/Makefile - source/pp/ppgen.c + source/pp/hbppgen.c ! executable ppgen renamed to hbppgen. * samples/pe/editorlo.c * samples/pe/pe.prg + samples/pe/bld_b32.bat + Added BCC build batch file. ! Fixed to compile under current Harbour. ! Fixed filename casing. ! Fixed several warnings (quite some signedness problem still remain). ; This is a very nice editor written in C (Harbour callable), I think it is the work of Ryszard. * samples/hscript/bld_b32.bat * samples/hscript/hscript.prg * samples/hscript/dir.hs * samples/hscript/multiply.hs * samples/hscript/ugly.hs * samples/hscript/hello.hs ! Fixed build batch file. ! Fixed to use NFLib file IO rather than libmisc, because latter was broken (it is a clone of the NFLib file IO). ! Fixed scripts to use Start instead of Main as an entry point otherwise __hrbRun() got confused and called the app Main(). ! Fixed some other problems to make it run. --- harbour/ChangeLog | 44 +++++++++ harbour/common.mak | 4 +- harbour/harbour-ce-spec | 2 +- harbour/include/hbsetup.h | 1 - harbour/make_xmingw.sh | 2 +- harbour/make_xmingwce.sh | 4 +- harbour/makefile.bc | 2 +- harbour/makefile.gc | 2 +- harbour/makefile.vc | 2 +- harbour/samples/hscript/bld_b32.bat | 6 +- harbour/samples/hscript/dir.hs | 2 +- harbour/samples/hscript/hello.hs | 2 +- harbour/samples/hscript/hscript.prg | 73 +++++++-------- harbour/samples/hscript/multiply.hs | 2 +- harbour/samples/hscript/ugly.hs | 2 +- harbour/samples/pe/bld_b32.bat | 28 ++++++ harbour/samples/pe/editorlo.c | 110 ++++++++++++----------- harbour/samples/pe/pe.prg | 59 ++++++------ harbour/source/compiler/hbcomp.c | 2 +- harbour/source/pp/Makefile | 4 +- harbour/source/pp/{ppgen.c => hbppgen.c} | 2 +- 21 files changed, 212 insertions(+), 143 deletions(-) create mode 100644 harbour/samples/pe/bld_b32.bat rename harbour/source/pp/{ppgen.c => hbppgen.c} (99%) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index d3f791dbba..e29f891716 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,50 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2007-10-27 01:23 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * include/hbsetup.h + - Removed HOST_OS_UNIX_COMPATIBLE which was a misleading + alias for OS_UNIX_COMPATIBLE. + + * source/compiler/hbcomp.c + % HOST_OS_UNIX_COMPATIBLE -> OS_UNIX_COMPATIBLE + + * common.mak + * harbour-ce-spec + * make_xmingw.sh + * make_xmingwce.sh + * makefile.bc + * makefile.gc + * makefile.vc + * source/pp/Makefile + - source/pp/ppgen.c + + source/pp/hbppgen.c + ! executable ppgen renamed to hbppgen. + + * samples/pe/editorlo.c + * samples/pe/pe.prg + + samples/pe/bld_b32.bat + + Added BCC build batch file. + ! Fixed to compile under current Harbour. + ! Fixed filename casing. + ! Fixed several warnings (quite some signedness problem still remain). + ; This is a very nice editor written in C (Harbour callable), + I think it is the work of Ryszard. + + * samples/hscript/bld_b32.bat + * samples/hscript/hscript.prg + * samples/hscript/dir.hs + * samples/hscript/multiply.hs + * samples/hscript/ugly.hs + * samples/hscript/hello.hs + ! Fixed build batch file. + ! Fixed to use NFLib file IO rather than libmisc, because + latter was broken (it is a clone of the NFLib file IO). + ! Fixed scripts to use Start instead of Main as an entry + point otherwise __hrbRun() got confused and called the + app Main(). + ! Fixed some other problems to make it run. + 2007-10-26 20:46 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/win32/w32_prn.c + Using hb_retptrGC()/hb_parptrGC(). diff --git a/harbour/common.mak b/harbour/common.mak index b82834f09e..25c8942377 100644 --- a/harbour/common.mak +++ b/harbour/common.mak @@ -207,7 +207,7 @@ GTXWC_LIB = $(LIB_DIR)\$(LIBPREF)gtxwc$(LIBEXT) HARBOUR_EXE = $(BIN_DIR)\harbour$(EXEEXT) # required (intermediate) utility # to generate pptable.c -HBPPGEN_EXE = $(BIN_DIR)\ppgen$(EXEEXT) +HBPPGEN_EXE = $(BIN_DIR)\hbppgen$(EXEEXT) HBPP_EXE = $(BIN_DIR)\hbpp$(EXEEXT) HBPPTEST_EXE = $(BIN_DIR)\hbpptest$(EXEEXT) HBRUN_EXE = $(BIN_DIR)\hbrun$(EXEEXT) @@ -937,7 +937,7 @@ HBPP_EXE_OBJS = \ #********************************************************** HBPPGEN_EXE_OBJS = \ - $(OBJ_DIR)\ppgen$(OBJEXT) \ + $(OBJ_DIR)\hbppgen$(OBJEXT) \ #********************************************************** diff --git a/harbour/harbour-ce-spec b/harbour/harbour-ce-spec index 798beafc9b..1a34b581d7 100644 --- a/harbour/harbour-ce-spec +++ b/harbour/harbour-ce-spec @@ -97,7 +97,7 @@ export HB_ARCHITECTURE=w32 export HB_COMPILER=cemgw mkdir -p source/pp/${HB_ARCHITECTURE}/${HB_COMPILER} -ln -s ../../linux/gcc/ppgen source/pp/${HB_ARCHITECTURE}/${HB_COMPILER}/ppgen.exe +ln -s ../../linux/gcc/hbppgen source/pp/${HB_ARCHITECTURE}/${HB_COMPILER}/hbppgen.exe mkdir -p source/main/${HB_ARCHITECTURE}/${HB_COMPILER} ln -s ../../linux/gcc/harbour source/main/${HB_ARCHITECTURE}/${HB_COMPILER}/harbour.exe diff --git a/harbour/include/hbsetup.h b/harbour/include/hbsetup.h index 280d672168..7c2d673f28 100644 --- a/harbour/include/hbsetup.h +++ b/harbour/include/hbsetup.h @@ -280,7 +280,6 @@ ! ( defined(__DJGPP__) || defined(__EMX__) || defined(__RSXNT__) || \ defined(_Windows) || defined(_WIN32) || defined(_WINCE) ) ) || \ ( defined(__WATCOMC__) && defined(__LINUX__) ) - #define HOST_OS_UNIX_COMPATIBLE #define OS_UNIX_COMPATIBLE #define OS_PATH_LIST_SEPARATOR ':' #define OS_PATH_DELIMITER '/' diff --git a/harbour/make_xmingw.sh b/harbour/make_xmingw.sh index d41b1291eb..a3075fee48 100755 --- a/harbour/make_xmingw.sh +++ b/harbour/make_xmingw.sh @@ -60,7 +60,7 @@ else exit 1 fi -(cd `dirname $0`; ln -s `pwd`/source/pp/linux/gcc/ppgen ${HB_BIN_COMPILE}/ppgen.exe) +(cd `dirname $0`; ln -s `pwd`/source/pp/linux/gcc/hbppgen ${HB_BIN_COMPILE}/hbppgen.exe) export HB_PPGEN_PATH=${HB_BIN_COMPILE} export PATH CCPATH CCPREFIX diff --git a/harbour/make_xmingwce.sh b/harbour/make_xmingwce.sh index 50f1065885..5f05fd03c4 100755 --- a/harbour/make_xmingwce.sh +++ b/harbour/make_xmingwce.sh @@ -42,8 +42,8 @@ else fi (cd `dirname $0` -ln -s `pwd`/source/pp/`echo "$UNAME"|tr A-Z a-z`/gcc/ppgen \ - ${HB_BIN_COMPILE}/ppgen.exe) +ln -s `pwd`/source/pp/`echo "$UNAME"|tr A-Z a-z`/gcc/hbppgen \ + ${HB_BIN_COMPILE}/hbppgen.exe) export HB_PPGEN_PATH=${HB_BIN_COMPILE} case "$1" in diff --git a/harbour/makefile.bc b/harbour/makefile.bc index e139cb047d..0f4edc1885 100644 --- a/harbour/makefile.bc +++ b/harbour/makefile.bc @@ -609,7 +609,7 @@ $(DLL_OBJ_DIR)\mainstd.obj : $(VM_DIR)\mainstd.c #********************************************************** #********************************************************** -# Generated by an intermediate utility ppgen.exe +# Generated by an intermediate utility hbppgen.exe # built at the initial phase of build process $(OBJ_DIR)\pptable.obj : $(PP_DIR)\pptable.c $(PP_DIR)\pptable.c : include\hbstdgen.ch diff --git a/harbour/makefile.gc b/harbour/makefile.gc index 953a5792f7..98742a9400 100644 --- a/harbour/makefile.gc +++ b/harbour/makefile.gc @@ -399,7 +399,7 @@ $(HBVER_EXE) :: $(HBVER_EXE_OBJS) # EXTRA Object's DEPENDENCIES #********************************************************** -# Generated by an intermediate utility ppgen.exe +# Generated by an intermediate utility hbppgen.exe # built at the initial phase of build process $(OBJ_DIR)/pptable$(OBJEXT) : $(OBJ_DIR)/pptable.c $(OBJ_DIR)/pptable.c : $(HBPPGEN) include/hbstdgen.ch include/std.ch $(PP_DIR)/ppcore.c $(PP_DIR)/ppgen.c diff --git a/harbour/makefile.vc b/harbour/makefile.vc index 4689efb2b3..16468b8916 100644 --- a/harbour/makefile.vc +++ b/harbour/makefile.vc @@ -975,7 +975,7 @@ $(DLL_OBJ_DIR)\mainstd.obj : $(VM_DIR)\mainstd.c # EXTRA Object's DEPENDENCIES #********************************************************** -# Generated by an intermediate utility ppgen.exe +# Generated by an intermediate utility hbppgen.exe # built at the initial phase of build process $(OBJ_DIR)\pptable.obj : $(PP_DIR)\pptable.c $(PP_DIR)\pptable.c : include\hbstdgen.ch diff --git a/harbour/samples/hscript/bld_b32.bat b/harbour/samples/hscript/bld_b32.bat index 2210226746..7c211164d4 100644 --- a/harbour/samples/hscript/bld_b32.bat +++ b/harbour/samples/hscript/bld_b32.bat @@ -3,6 +3,8 @@ rem rem $Id$ rem +rem NOTE: This sample program need nf.lib from contrib/libnf + ..\..\bin\harbour hscript /n /i..\..\include -bcc32 -O2 -I..\..\include -L..\..\lib -ehscript.exe hscript.c debug.lib vm.lib rtl.lib gtwin.lib lang.lib rdd.lib macro.lib pp.lib dbfntx.lib dbfcdx.lib dbffpt.lib hbsix.lib common.lib -rem del hscript.c +bcc32 -O2 -I..\..\include -L..\..\lib -ehscript.exe hscript.c debug.lib vm.lib rtl.lib gtwin.lib lang.lib rdd.lib macro.lib pp.lib dbfntx.lib dbfcdx.lib dbffpt.lib codepage.lib hbsix.lib common.lib hbpcre.lib hsx.lib nf.lib +del hscript.c diff --git a/harbour/samples/hscript/dir.hs b/harbour/samples/hscript/dir.hs index 89ed4adbcd..e55b27aaf8 100644 --- a/harbour/samples/hscript/dir.hs +++ b/harbour/samples/hscript/dir.hs @@ -4,7 +4,7 @@ * www - http://www.harbour-project.org * */ -FUNCTION Main() +FUNCTION Start() LOCAL aDir := directory( "c:\*.*" ) LOCAL i diff --git a/harbour/samples/hscript/hello.hs b/harbour/samples/hscript/hello.hs index 529b80ddc5..9249db4b73 100644 --- a/harbour/samples/hscript/hello.hs +++ b/harbour/samples/hscript/hello.hs @@ -9,7 +9,7 @@ * */ -FUNCTION Main() +FUNCTION Start() // Add content-type parameter if using active page on a Web Server IF !empty( GetEnv( "SERVER_NAME" ) ) diff --git a/harbour/samples/hscript/hscript.prg b/harbour/samples/hscript/hscript.prg index 043d0431ce..4cccc94a77 100644 --- a/harbour/samples/hscript/hscript.prg +++ b/harbour/samples/hscript/hscript.prg @@ -51,66 +51,60 @@ * * 1999/06/13 First implementation. * 1999/06/24 Enhanced tag matching routines. - * 1999/07/26 Corrections to CGI output, qOut() -> OutStd(). + * 1999/07/26 Corrections to CGI output, QOut() -> OutStd(). * */ #include "hbextern.ch" #include "cgi.ch" -#define IF_BUFFER 65535 -REQUEST DIRECTORY -REQUEST GETENV -REQUEST ASORT +#define IF_BUFFER 65535 FUNCTION Main( cScript ) LOCAL aHRSHandle := {} // Handle for script lines LOCAL aResult := {} // Handle for transl'd lines - LOCAL cLocation := {} // Location of scripts + LOCAL cLocation // Location of scripts LOCAL cHarbourDir := GetEnv( "HARBOURDIR" ) // Harbour.exe dir with '\' - LOCAL cHost := strtran( alltrim( ; // Random (not et al) - str( seconds() ) ), '.' ) // file name + LOCAL cHost := StrTran( alltrim( ; // Random (not et al) + Str( Seconds() ) ), '.' ) // file name LOCAL cScriptName, cFile, cLine, cTrans, c LOCAL hFile, i, lOpen, nLen - WHILE .t. + WHILE .T. - IF empty( GetEnv( "SERVER_NAME" ) ) + IF Empty( GetEnv( "SERVER_NAME" ) ) cScriptName := cScript cLocation := cHarbourDir ELSE cScriptName := GetEnv( "QUERY_STRING" ) - IF at( "=", cScriptName ) != 0 + IF At( "=", cScriptName ) != 0 cScriptName := ParseString( cScriptName, "=", 2 ) ENDIF cLocation := GetEnv( "PATH_TRANSLATED" ) + ; - strtran( GetEnv( "SCRIPT_NAME" ), "/", "\" ) - cLocation := substr( cLocation, 1, rat( "\", cLocation ) ) + StrTran( GetEnv( "SCRIPT_NAME" ), "/", "\" ) + cLocation := SubStr( cLocation, 1, RAt( "\", cLocation ) ) cHarbourDir := cLocation ENDIF - IF empty( cScriptName ) - IF !empty( GetEnv( "SERVER_NAME" ) ) + IF Empty( cScriptName ) + IF !Empty( GetEnv( "SERVER_NAME" ) ) OutStd( "content-type: text/html" + hb_OSNewLine() ) OutStd( hb_OSNewLine() ) OutStd( "

Server Error

" + hb_OSNewLine() ) OutStd( "Must specify scriptname using hscript.exe?script=" + hb_OSNewLine() ) OutStd( "" + hb_OSNewLine() ) - ELSE OutStd( "Please give .hs name" + hb_OSNewLine() ) - ENDIF - EXIT ENDIF // Script not found - IF !file( cScriptName ) - IF !empty( GetEnv( "SERVER_NAME" ) ) + IF !File( cScriptName ) + IF !Empty( GetEnv( "SERVER_NAME" ) ) OutStd( "CONTENT-TYPE: text/html" + hb_OSNewLine() ) ENDIF OutStd( "

Server Error

Script not found: " + cScriptName + hb_OSNewLine() ) @@ -118,12 +112,12 @@ FUNCTION Main( cScript ) ENDIF lOpen := .f. - hb_fUse( cScriptName ) - WHILE !hb_fEof() + ft_FUse( cScriptName ) + WHILE !ft_FEof() - cLine := alltrim( hb_fReadLn() ) + cLine := AllTrim( ft_FReadLn() ) cTrans := "" - nLen := len( cLine ) + nLen := Len( cLine ) IF lOpen cTrans += "OutStd( '" @@ -131,12 +125,11 @@ FUNCTION Main( cScript ) FOR i := 1 TO nLen - c := substr( cLine, i, 1 ) + c := SubStr( cLine, i, 1 ) IF c = "%" .AND. substr( cLine, i + 1, 1 ) = ">" IF lOpen // Error - Already in htm mode - ELSE // Abre script IF i > 1 @@ -154,7 +147,6 @@ FUNCTION Main( cScript ) ELSEIF c = "<" .AND. substr( cLine, i + 1, 1 ) = "%" IF !lOpen // Error - Not in htm mode - ELSE // Fecha script cTrans += "' + chr(10) )" @@ -169,46 +161,43 @@ FUNCTION Main( cScript ) ELSE cTrans += c - ENDIF - NEXT IF lOpen .AND. substr( cLine, nLen - 1, 2 ) <> "%>" cTrans += "' + chr(10) )" ENDIF - aadd( aResult, cTrans ) + AAdd( aResult, cTrans ) - hb_fSkip() + ft_FSkip() ENDDO - hb_fUse() + ft_FUse() cFile := cLocation + cHost + ".prg" // Output file name - hFile := fCreate( cFile ) - FOR i := 1 TO len( aResult ) - fWrite( hFile, aResult[i] + chr(13)+chr(10) ) + hFile := FCreate( cFile ) + FOR i := 1 TO Len( aResult ) + FWrite( hFile, aResult[i] + hb_OSNewLine() ) NEXT - fClose( hFile ) + FClose( hFile ) // Creates the temporary HRB, erases the PRG - __Run( cHarbourDir + "harbour.exe " + cFile + " /q /n /gh /o" + ; - left( cHarbourDir, len( cHarbourDir ) - 1 ) + "\" ) - fErase( cFile ) + __Run( cHarbourDir + "harbour.exe " + cFile + " /q /n /gh /o" + Left( cHarbourDir, Len( cHarbourDir ) - 1 ) + iif( !Empty( Left( cHarbourDir, Len( cHarbourDir ) - 1 ) ), "\", "" ) ) + FErase( cFile ) // Runs using Tugboat - cFile := strtran( upper( cFile ), ".PRG", ".hrb" ) + cFile := StrTran( Upper( cFile ), ".PRG", ".hrb" ) __hrbRun( cFile ) // Erases the HRB file - fErase( cFile ) + FErase( cFile ) // That's all, folks! EXIT ENDDO - RETURN( NIL ) + RETURN NIL FUNCTION ParseString( cString, cDelim, nRet ) diff --git a/harbour/samples/hscript/multiply.hs b/harbour/samples/hscript/multiply.hs index 0b2d8cb3b4..810f33767f 100644 --- a/harbour/samples/hscript/multiply.hs +++ b/harbour/samples/hscript/multiply.hs @@ -9,7 +9,7 @@ * */ -FUNCTION Main() +FUNCTION Start() LOCAL i, j diff --git a/harbour/samples/hscript/ugly.hs b/harbour/samples/hscript/ugly.hs index 18c0961359..3e24c59a69 100644 --- a/harbour/samples/hscript/ugly.hs +++ b/harbour/samples/hscript/ugly.hs @@ -1,4 +1,4 @@ -<% FUNCTION Main() +<% FUNCTION Start() /* Written by Felipe Coury * www - http://www.harbour-project.org diff --git a/harbour/samples/pe/bld_b32.bat b/harbour/samples/pe/bld_b32.bat new file mode 100644 index 0000000000..2350240c0e --- /dev/null +++ b/harbour/samples/pe/bld_b32.bat @@ -0,0 +1,28 @@ +@echo off +rem +rem $Id$ +rem + +..\..\bin\harbour /n pe /i..\..\include\ +..\..\bin\harbour /n editorhi /i..\..\include\ + +echo -O2 -I..\..\include -L..\..\lib > build.tmp +echo -epe.exe >> build.tmp +echo pe.c editorhi.c editorlo.c >> build.tmp +echo debug.lib >> build.tmp +echo vm.lib >> build.tmp +echo rtl.lib >> build.tmp +echo gtwin.lib >> build.tmp +echo lang.lib >> build.tmp +echo rdd.lib >> build.tmp +echo macro.lib >> build.tmp +echo pp.lib >> build.tmp +echo dbfntx.lib >> build.tmp +echo dbfcdx.lib >> build.tmp +echo dbffpt.lib >> build.tmp +echo hbsix.lib >> build.tmp +echo common.lib >> build.tmp +bcc32 @build.tmp +del build.tmp + +pe diff --git a/harbour/samples/pe/editorlo.c b/harbour/samples/pe/editorlo.c index 5a9c537b9b..f8bada12c4 100644 --- a/harbour/samples/pe/editorlo.c +++ b/harbour/samples/pe/editorlo.c @@ -29,7 +29,7 @@ #define TRUE !0 #endif -#define CLIPPER_ACTION(action) void pascal action( void ) +#define CLIPPER_ACTION(action) HB_FUNC( action ) #define Eof '\x0' @@ -253,7 +253,7 @@ static void New(EDITOR *E, int tab, int ll, long int BuforSize) ** Creates new editor and returns index into internal editors table */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_NEW ) +CLIPPER_ACTION( ED_NEW ) #else int HB_ED_NEW( int ll, int tab, long int BuforSize ) #endif @@ -346,7 +346,7 @@ static void FormatText ( EDITOR *E ) * operation if a very large file is edited */ wsk =E->begin +E->last_line; - while( (wsk = strchr( wsk, '\t' )) ) + while( (wsk = strchr( wsk, '\t' )) != 0 ) { j = wsk - E->begin; @@ -379,7 +379,8 @@ static void FormatText ( EDITOR *E ) */ static void NewText( EDITOR *E ) { - unsigned int i, dl; + unsigned int dl; + int i; /* text in buffer have to end with CR/LF */ @@ -443,7 +444,7 @@ static void AddText( int nEdit, char *adres ) ** Appends passed text at the end of existing one */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_ADDTEXT ) +CLIPPER_ACTION( ED_ADDTEXT ) #else CLIPPER HB_ED_ADDTEXT ( int nEdit, char *adres ) #endif @@ -497,7 +498,7 @@ static long int GoToLine( EDITOR *E, int linia ) i =0; p =E->begin; - while( (++i <= linia) && (p=strchr( p, '\n' )) ) + while( (++i <= linia) && (p=strchr( p, '\n' )) != 0 ) p +=2; if( i > linia ) @@ -626,7 +627,7 @@ static long int InsText ( EDITOR *E, char *adres, long int line ) ** Inserts passed text into text buffer */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_INSTEXT ) +CLIPPER_ACTION( ED_INSTEXT ) #else unsigned int HB_ED_INSTEXT ( int nEdit, char *adres, long int linia ) #endif @@ -659,7 +660,7 @@ unsigned int HB_ED_INSTEXT ( int nEdit, char *adres, long int linia ) ** */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_PUSH ) +CLIPPER_ACTION( ED_PUSH ) { int i; @@ -670,7 +671,7 @@ CLIPPER_ACTION( HB_ED_PUSH ) EStack[ i ] =ED; } -CLIPPER_ACTION( HB_ED_POP ) +CLIPPER_ACTION( ED_POP ) { int i; @@ -691,7 +692,7 @@ CLIPPER_ACTION( HB_ED_POP ) * to this editor. */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_CONFIG ) +CLIPPER_ACTION( ED_CONFIG ) #else CLIPPER HB_ED_CONFIG(int nEdit, int top, int left, int bottom, int right, int nRow, int nCol) @@ -868,7 +869,7 @@ CLIPPER HB_ED_CONFIG(int nEdit, int top, int left, int bottom, int right, ** Returns current text buffer */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_GETTEXT ) +CLIPPER_ACTION( ED_GETTEXT ) #else char *HB_ED_GETTEXT(int nEdit, int Case, int mietka ) #endif @@ -945,7 +946,7 @@ char *HB_ED_GETTEXT(int nEdit, int Case, int mietka ) ** Returns given line of text and positions caret at the beginning of next line */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_GETLINE ) +CLIPPER_ACTION( ED_GETLINE ) #else char *HB_ED_GETLINE(int nEdit, long int linia ) #endif @@ -954,7 +955,8 @@ char *HB_ED_GETLINE(int nEdit, long int linia ) long int tmp; char *bufor; EDITOR *E; - int rdl, i, dl; + int rdl, dl; + long int i; #ifdef mc51 long int linia; @@ -968,7 +970,7 @@ char *HB_ED_GETLINE(int nEdit, long int linia ) l = 1; tmp = E->first_line; - for(i = 1; i < (unsigned int) linia; i++) + for(i = 1; i < linia; i++) { j = Next ( E, tmp ); if ( j >= 0 ) @@ -1005,7 +1007,7 @@ char *HB_ED_GETLINE(int nEdit, long int linia ) ** Returns current line pointed by caret position and advances it to the beginning of next line */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_GETNEXT ) +CLIPPER_ACTION( ED_GETNEXT ) #else char *HB_ED_GETNEXT(int nEdit) #endif @@ -1067,7 +1069,7 @@ static void KillText ( EDITOR *E ) ** Stores new text into editor */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_SETTEXT ) +CLIPPER_ACTION( ED_SETTEXT ) #else CLIPPER HB_ED_SETTEXT(int nEdit, char *adres) #endif @@ -1095,12 +1097,12 @@ CLIPPER HB_ED_SETTEXT(int nEdit, char *adres) ** Reads a text from the file */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_READTEXT ) +CLIPPER_ACTION( ED_READTEXT ) { unsigned int nEdit, nFile, nSize, lSuccess=FALSE; long int nSeek, nRead; EDITOR *E; - BOOL lConv; +/* BOOL lConv; */ nEdit =_parni( 1 ); E =ETab[ nEdit ]; @@ -1111,7 +1113,7 @@ CLIPPER_ACTION( HB_ED_READTEXT ) nFile =_parni( 2 ); nSeek =_parnl( 3 ); nSize =_parni( 4 ); - lConv =_parl( 5 ); +/* lConv =_parl( 5 ); */ nRead =_fsSeek( nFile, nSeek, FS_SET ); if( nRead == nSeek ) @@ -1159,7 +1161,7 @@ CLIPPER_ACTION( HB_ED_READTEXT ) ** Releases memory occupied by the editor */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_KILL ) +CLIPPER_ACTION( ED_KILL ) #else CLIPPER HB_ED_KILL(int nEdit) #endif @@ -1192,7 +1194,7 @@ CLIPPER HB_ED_KILL(int nEdit) /* Sorry - I don't remember why it is here */ -CLIPPER_ACTION( HB_ED_UNLOCK ) +CLIPPER_ACTION( ED_UNLOCK ) { } @@ -1203,7 +1205,7 @@ CLIPPER_ACTION( HB_ED_UNLOCK ) * Incremental stabilisation was too slow */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_STABILIZE ) +CLIPPER_ACTION( ED_STABILIZE ) #else int HB_ED_STABILI( void ) #endif @@ -1296,7 +1298,7 @@ int HB_ED_STABILI( void ) nTop =ED->top +nRow; if( nLen ) { - if( ED->escape && ( EscPtr = strchr( adres, ED->escape ) ) ) + if( ED->escape && ( EscPtr = strchr( adres, ED->escape ) ) != 0 ) { i =(unsigned int)(EscPtr - adres); nLeft =ED->left +i; @@ -1452,7 +1454,7 @@ static void Down( EDITOR *E ) ** Moves cursor to the next line of text */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_DOWN ) +CLIPPER_ACTION( ED_DOWN ) #else CLIPPER HB_ED_DOWN(void) #endif @@ -1525,7 +1527,7 @@ static void Up( void ) ** Moves the cursor to the previous line */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_UP ) +CLIPPER_ACTION( ED_UP ) #else CLIPPER HB_ED_UP(void) #endif @@ -1541,7 +1543,7 @@ CLIPPER HB_ED_UP(void) ** Moves the cursor to the next page of text */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_PGDOWN ) +CLIPPER_ACTION( ED_PGDOWN ) #else CLIPPER HB_ED_PGDOWN(void) #endif @@ -1614,7 +1616,7 @@ CLIPPER HB_ED_PGDOWN(void) ** Moves the cursor to the previous page of text */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_PGUP ) +CLIPPER_ACTION( ED_PGUP ) #else CLIPPER HB_ED_PGUP(void) #endif @@ -1679,7 +1681,7 @@ CLIPPER HB_ED_PGUP(void) ** Move the cursor to the beginning of the text */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_TOP ) +CLIPPER_ACTION( ED_TOP ) #else CLIPPER HB_ED_TOP(void) #endif @@ -1714,7 +1716,7 @@ CLIPPER HB_ED_TOP(void) ** Move the cursor to the last line of text */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_BOTTOM ) +CLIPPER_ACTION( ED_BOTTOM ) #else CLIPPER HB_ED_BOTTOM(void) #endif @@ -1798,7 +1800,7 @@ static void GoTo(int line) ** Move the cursor to the given line using line number */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_GOTO ) +CLIPPER_ACTION( ED_GOTO ) #else CLIPPER HB_ED_GOTO(long int line) #endif @@ -1838,7 +1840,7 @@ static void Left(void) ** Move the cursor to the previous character */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_LEFT ) +CLIPPER_ACTION( ED_LEFT ) #else CLIPPER HB_ED_LEFT(void) #endif @@ -1875,7 +1877,7 @@ static void Right( EDITOR *E ) ** Move the cursor to the next character */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_RIGHT ) +CLIPPER_ACTION( ED_RIGHT ) #else CLIPPER HB_ED_RIGHT(void) #endif @@ -1911,7 +1913,7 @@ static void Home( EDITOR *E ) ** Move the cursor to the beginning of the line */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_HOME ) +CLIPPER_ACTION( ED_HOME ) #else CLIPPER HB_ED_HOME(void) #endif @@ -1960,7 +1962,7 @@ static void End( EDITOR *E ) ** Move the cursor the the end of line (after the last non-space character) */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_END ) +CLIPPER_ACTION( ED_END ) #else CLIPPER HB_ED_END(void) #endif @@ -2090,7 +2092,7 @@ static void DelChar ( EDITOR *E ) ** Delete the character at current cursor position */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_DELCHAR ) +CLIPPER_ACTION( ED_DELCHAR ) #else CLIPPER HB_ED_DELCHAR(void) #endif @@ -2187,7 +2189,7 @@ static void BackSpace( int INS ) /* find the first space in current line (the new line will * be wrapped eventually at this position) */ - if( ( w = strchr ( tmp, ' ') ) ) + if( ( w = strchr ( tmp, ' ') ) != 0 ) ww = (int)(w - tmp); else ww = nLen+rdl; @@ -2268,7 +2270,7 @@ static void BackSpace( int INS ) ** Delete a character on the left side of the cursor */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_BSPACE ) +CLIPPER_ACTION( ED_BSPACE ) #else CLIPPER HB_ED_BSPACE(int INS) #endif @@ -2360,7 +2362,7 @@ static void NextWord(void) ** Move the cursor to the next word */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_NWORD ) +CLIPPER_ACTION( ED_NWORD ) #else CLIPPER HB_ED_NWORD(void) #endif @@ -2443,7 +2445,7 @@ static void PreviousWord(void) ** Move the cursor to the previous word */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_PWORD ) +CLIPPER_ACTION( ED_PWORD ) #else CLIPPER HB_ED_PWORD(void) #endif @@ -2676,7 +2678,7 @@ static void PutChar( int INS, int znak ) ** Insert or replace the character into the text buffer */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_PUTCHAR ) +CLIPPER_ACTION( ED_PUTCHAR ) #else CLIPPER HB_ED_PUTCHAR(int INS, int znak) #endif @@ -2710,7 +2712,7 @@ static void Tab ( int INS ) /* #ifdef mc51 -CLIPPER_ACTION( HB_ED_TAB ) +CLIPPER_ACTION( ED_TAB ) #else CLIPPER HB_ED_TAB(int INS) #endif @@ -2729,7 +2731,7 @@ CLIPPER HB_ED_TAB(int INS) ** Delete the current line */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_DELLINE ) +CLIPPER_ACTION( ED_DELLINE ) #else CLIPPER HB_ED_DELLINE(void) #endif @@ -2786,7 +2788,7 @@ CLIPPER HB_ED_DELLINE(void) ** Delete the word on the right side of the cursor */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_DELWORD ) +CLIPPER_ACTION( ED_DELWORD ) #else CLIPPER HB_ED_DELWORD(void) #endif @@ -2836,7 +2838,11 @@ CLIPPER HB_ED_DELWORD(void) { if( ( GetLineLength( ED, ED->current_line, &rdl ) ) == 0 ) { +#ifdef mc51 + HB_FUNC_EXEC( ED_DELLINE ) +#else HB_ED_DELLINE( ); +#endif Home( ED ); } } @@ -2941,7 +2947,7 @@ static void Return(int INS) ** Insert the CRLF characters */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_RETURN ) +CLIPPER_ACTION( ED_RETURN ) #else CLIPPER HB_ED_RETURN(int INS) #endif @@ -2958,7 +2964,7 @@ CLIPPER HB_ED_RETURN(int INS) ** Returns the current cursor row inside the editor's window */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_WINROW ) +CLIPPER_ACTION( ED_WINROW ) #else int HB_ED_WINROW(void) #endif @@ -2974,7 +2980,7 @@ int HB_ED_WINROW(void) ** Returns the line number where the cursor is positioned */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_ROW ) +CLIPPER_ACTION( ED_ROW ) #else int HB_ED_ROW(void) #endif @@ -2991,7 +2997,7 @@ int HB_ED_ROW(void) ** Return the current cursor column inside the editor's window */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_WINCOL ) +CLIPPER_ACTION( ED_WINCOL ) #else int HB_ED_WINCOL(void) #endif @@ -3007,7 +3013,7 @@ int HB_ED_WINCOL(void) ** Returns the current cursor position inside the line */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_COL ) +CLIPPER_ACTION( ED_COL ) #else int HB_ED_COL(void) #endif @@ -3024,7 +3030,7 @@ int HB_ED_COL(void) ** Returns the total number of lines */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_MAXLINE ) +CLIPPER_ACTION( ED_MAXLINE ) #else long int HB_ED_MAXLINE(void) #endif @@ -3040,7 +3046,7 @@ long int HB_ED_MAXLINE(void) ** Counts the total number of lines in passed editor */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_LCOUNT ) +CLIPPER_ACTION( ED_LCOUNT ) #else long int HB_ED_LCOUNT(int nEdit) #endif @@ -3063,7 +3069,7 @@ long int HB_ED_LCOUNT(int nEdit) ** Returns if the editor is correctly displayed */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_STABLE ) +CLIPPER_ACTION( ED_STABLE ) #else int HB_ED_STABLE(void) #endif @@ -3080,7 +3086,7 @@ int HB_ED_STABLE(void) ** Returns the number of bytes stored in the text buffer */ #ifdef mc51 -CLIPPER_ACTION( HB_ED_LENGTH ) +CLIPPER_ACTION( ED_LENGTH ) #else long int HB_ED_LENGTH(void) #endif diff --git a/harbour/samples/pe/pe.prg b/harbour/samples/pe/pe.prg index c7a940cb70..ed06fb7f69 100644 --- a/harbour/samples/pe/pe.prg +++ b/harbour/samples/pe/pe.prg @@ -1,41 +1,42 @@ /* * $Id$ */ + #define EDIT_EDIT .T. #define EDIT_VIEW .F. -PROCEDURE MAIN( cFile ) -LOCAL cText -LOCAL lMode:=EDIT_EDIT +PROCEDURE Main( cFile ) + LOCAL cText + LOCAL lMode := EDIT_EDIT - IF( cFile == NIL ) - cFile ="license.txt" - IF( !FILE(cFile) ) - cFile ="../../license.txt" - ENDIF - lMode =EDIT_VIEW - ENDIF - - cText =MEMOREAD( cFile ) - cText =MEMOEDITOR( cText, 0,0, MAXROW(), MAXCOL(), lMode ) - MEMOWRIT( "OUTPUT.TXT", cText ) + IF cFile == NIL + cFile := "license.txt" + IF !File( cFile ) + cFile := "../../license.txt" + ENDIF + lMode := EDIT_VIEW + ENDIF + + cText := MemoRead( cFile ) + cText := MemoEditor( cText, 0, 0, MaxRow(), MaxCol(), lMode ) + MemoWrit( "output.txt", cText ) -RETURN + RETURN STATIC FUNCTION MEMOEDITOR( cText, nTop, nLeft, nBottom, nRight, lMode ) -LOCAL oED + LOCAL oED - /* NOTE: In current design of editor it doesn't reallocate the memory - buffer used to hold the text - */ - oED :=EditorNew( nTop, nLeft, nBottom, nRight, 254, , , , LEN(cText)*2, 168 ) - IF( oED != NIL ) - EditorSetText( oED, cText ) - EditorEdit( oED, lMode, .T. ) - cText :=EditorGetText( oED ) - EditorKill( oED ) - ELSE - ? "Editor not created" - ENDIF + /* NOTE: In current design of editor it doesn't reallocate the memory + buffer used to hold the text + */ + oED := EditorNew( nTop, nLeft, nBottom, nRight, 254, , , , Len( cText ) * 2, 168 ) + IF oED != NIL + EditorSetText( oED, cText ) + EditorEdit( oED, lMode, .T. ) + cText := EditorGetText( oED ) + EditorKill( oED ) + ELSE + ? "Editor not created" + ENDIF -RETURN( cText ) \ No newline at end of file + RETURN cText diff --git a/harbour/source/compiler/hbcomp.c b/harbour/source/compiler/hbcomp.c index b1480674a6..b1f50c4f4c 100644 --- a/harbour/source/compiler/hbcomp.c +++ b/harbour/source/compiler/hbcomp.c @@ -308,7 +308,7 @@ void hb_compOutErr( HB_COMP_DECL, const char * szMessage ) HB_COMP_PARAM->outErrFunc( HB_COMP_PARAM->cargo, szMessage ); else { -#if defined( HOST_OS_UNIX_COMPATIBLE ) +#if defined( OS_UNIX_COMPATIBLE ) fprintf( stderr, "%s", szMessage ); fflush( stderr ); #else fprintf( stdout, "%s", szMessage ); fflush( stdout ); diff --git a/harbour/source/pp/Makefile b/harbour/source/pp/Makefile index d3a39b1a21..1d15fbcf25 100644 --- a/harbour/source/pp/Makefile +++ b/harbour/source/pp/Makefile @@ -26,6 +26,6 @@ ifneq ($(HB_PP_RULES),) pptable.c : $(HB_PP_RULES) $(CP) $(subst /,$(DIRSEP),$<) $@ else -pptable.c : ppgen$(EXE_EXT) - $(HB_PPGEN_PATH)/ppgen$(EXE_EXT) $(TOP)$(ROOT)include/hbstdgen.ch -opptable.c -q +pptable.c : hbppgen$(EXE_EXT) + $(HB_PPGEN_PATH)/hbppgen$(EXE_EXT) $(TOP)$(ROOT)include/hbstdgen.ch -opptable.c -q endif diff --git a/harbour/source/pp/ppgen.c b/harbour/source/pp/hbppgen.c similarity index 99% rename from harbour/source/pp/ppgen.c rename to harbour/source/pp/hbppgen.c index 26b06d0627..9ecc5bc7d6 100644 --- a/harbour/source/pp/ppgen.c +++ b/harbour/source/pp/hbppgen.c @@ -319,7 +319,7 @@ int WINAPI WinMain( HINSTANCE hInstance, /* handle to current instance */ int iResult, i; /* hack - we do not want to create real binaries */ int argc = 1; - char * argv[] = { "ppgen" }; + char * argv[] = { "hbppgen" }; HB_SYMBOL_UNUSED( hInstance ); HB_SYMBOL_UNUSED( hPrevInstance );