From 23f154863ea591a2838784f859792ca65827f4ae Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sun, 14 Oct 2012 22:44:32 +0000 Subject: [PATCH] 2012-10-15 00:37 UTC+0200 Viktor Szakats (harbour syenar.net) + contrib/hbnf/tests/fttext.prg + added test code for FTTEXT API * contrib/hbnf/fttext.c + added MT compatibility by moving static vars to a structure and that structure to TSD * contrib/hbnf/menutonf.prg * use HB_KEYPUT() instead of FT_PUTKEY() * extras/gtwvw/tests/cbtest1.prg * extras/gtwvw/tests/cbtest6.prg * extras/gtwvw/tests/inpfocus.prg * extras/gtwvw/tests/wvwmouse.prg * KEYBOARD/__KEYBOARD() -> hb_keyPut() * extras/gtwvw/tests/inpfocus.prg ! Do not use K_* constants for characters. * contrib/gtwvg/tests/demowvg.prg * extras/gtwvw/tests/wvwtest9.prg * minor code cleanup * contrib/gtwvg/class.prg * contrib/gtwvg/menubar.prg * contrib/gtwvg/paint.prg * contrib/hbct/fcopy.prg * contrib/hbcups/tests/test.prg * contrib/hbcurl/tests/ftp_uldl.prg * contrib/hbmisc/hb_f.c * contrib/hbmisc/tests/testhbf.prg * contrib/hbmysql/utils/dbf2mysq.prg * contrib/hbnf/amedian.prg * contrib/hbnf/tests/dfile.prg * contrib/hbpgsql/tests/dbf2pg.prg * contrib/hbpgsql/tests/test.prg * contrib/hbtip/tests/upld_ftp.prg * contrib/hbwin/tests/testcopy.prg * contrib/hbwin/tests/testmapi.prg * contrib/xhb/tests/testcp.prg * contrib/xhb/xhbtedit.prg * tests/ac_test.prg * tests/db_brows.prg * tests/stripem.prg * tests/testhtml.prg * deleted references to self-filename, or replaced them with __FILE__, so they will continue to work (and there won't be outdated comments) when files are renamed. * tests/sbartest.prg * minor --- harbour/ChangeLog | 53 ++ harbour/contrib/gtwvg/class.prg | 10 +- harbour/contrib/gtwvg/menubar.prg | 4 +- harbour/contrib/gtwvg/paint.prg | 2 - harbour/contrib/gtwvg/tests/demowvg.prg | 2 +- harbour/contrib/hbct/fcopy.prg | 1 - harbour/contrib/hbcups/tests/test.prg | 8 +- harbour/contrib/hbcurl/tests/ftp_uldl.prg | 2 +- harbour/contrib/hbmisc/hb_f.c | 2 - harbour/contrib/hbmisc/tests/testhbf.prg | 2 +- harbour/contrib/hbmysql/utils/dbf2mysq.prg | 2 +- harbour/contrib/hbnf/amedian.prg | 6 +- harbour/contrib/hbnf/fttext.c | 626 ++++++++++----------- harbour/contrib/hbnf/menutonf.prg | 2 +- harbour/contrib/hbnf/tests/dfile.prg | 2 +- harbour/contrib/hbnf/tests/fttext.prg | 44 ++ harbour/contrib/hbpgsql/tests/dbf2pg.prg | 2 +- harbour/contrib/hbpgsql/tests/test.prg | 2 +- harbour/contrib/hbtip/tests/upld_ftp.prg | 1 - harbour/contrib/hbwin/tests/testcopy.prg | 4 +- harbour/contrib/hbwin/tests/testmapi.prg | 4 +- harbour/contrib/xhb/tests/testcp.prg | 2 +- harbour/contrib/xhb/xhbtedit.prg | 10 +- harbour/extras/gtwvw/tests/cbtest1.prg | 4 +- harbour/extras/gtwvw/tests/cbtest6.prg | 2 +- harbour/extras/gtwvw/tests/inpfocus.prg | 4 +- harbour/extras/gtwvw/tests/wvwmouse.prg | 2 +- harbour/extras/gtwvw/tests/wvwtest9.prg | 12 +- harbour/tests/ac_test.prg | 2 - harbour/tests/db_brows.prg | 2 - harbour/tests/sbartest.prg | 2 +- harbour/tests/stripem.prg | 2 +- harbour/tests/testhtml.prg | 1 - 33 files changed, 427 insertions(+), 399 deletions(-) create mode 100644 harbour/contrib/hbnf/tests/fttext.prg diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 73534ce2f2..00dd1ef6cc 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,59 @@ The license applies to all entries newer than 2009-04-28. */ +2012-10-15 00:37 UTC+0200 Viktor Szakats (harbour syenar.net) + + contrib/hbnf/tests/fttext.prg + + added test code for FTTEXT API + + * contrib/hbnf/fttext.c + + added MT compatibility by moving static vars to a structure + and that structure to TSD + + * contrib/hbnf/menutonf.prg + * use HB_KEYPUT() instead of FT_PUTKEY() + + * extras/gtwvw/tests/cbtest1.prg + * extras/gtwvw/tests/cbtest6.prg + * extras/gtwvw/tests/inpfocus.prg + * extras/gtwvw/tests/wvwmouse.prg + * KEYBOARD/__KEYBOARD() -> hb_keyPut() + + * extras/gtwvw/tests/inpfocus.prg + ! Do not use K_* constants for characters. + + * contrib/gtwvg/tests/demowvg.prg + * extras/gtwvw/tests/wvwtest9.prg + * minor code cleanup + + * contrib/gtwvg/class.prg + * contrib/gtwvg/menubar.prg + * contrib/gtwvg/paint.prg + * contrib/hbct/fcopy.prg + * contrib/hbcups/tests/test.prg + * contrib/hbcurl/tests/ftp_uldl.prg + * contrib/hbmisc/hb_f.c + * contrib/hbmisc/tests/testhbf.prg + * contrib/hbmysql/utils/dbf2mysq.prg + * contrib/hbnf/amedian.prg + * contrib/hbnf/tests/dfile.prg + * contrib/hbpgsql/tests/dbf2pg.prg + * contrib/hbpgsql/tests/test.prg + * contrib/hbtip/tests/upld_ftp.prg + * contrib/hbwin/tests/testcopy.prg + * contrib/hbwin/tests/testmapi.prg + * contrib/xhb/tests/testcp.prg + * contrib/xhb/xhbtedit.prg + * tests/ac_test.prg + * tests/db_brows.prg + * tests/stripem.prg + * tests/testhtml.prg + * deleted references to self-filename, or replaced them + with __FILE__, so they will continue to work (and there + won't be outdated comments) when files are renamed. + + * tests/sbartest.prg + * minor + 2012-10-14 22:43 UTC+0200 Viktor Szakats (harbour syenar.net) * contrib/hbnf/dispc.c ! static vars moved to a structure and that structure diff --git a/harbour/contrib/gtwvg/class.prg b/harbour/contrib/gtwvg/class.prg index d23706ce07..0bbc834299 100644 --- a/harbour/contrib/gtwvg/class.prg +++ b/harbour/contrib/gtwvg/class.prg @@ -3365,7 +3365,7 @@ METHOD wvtMenu:Create( cCaption ) IF Empty( ::hMenu := Wvt_CreateMenu() ) #if 0 - Throw( ErrorNew( "wvtMenu", 1000, "wvtMenu:Init()", "Create Menu Error", { cCaption, cCaption },"wvt.prg" ) ) + Throw( ErrorNew( "wvtMenu", 1000, "wvtMenu:Init()", "Create Menu Error", { cCaption, cCaption }, __FILE__ ) ) #endif ENDIF ::Caption := iif( cCaption == NIL, "", cCaption ) @@ -3381,7 +3381,7 @@ METHOD wvtMenu:Destroy() IF !Wvt_DestroyMenu( ::hMenu ) #if 0 - Throw( ErrorNew( "wvtMenu", 1000, "wvtMenu:Destroy()", "Destroy menu FAILED", {},"wvt.prg" ) ) + Throw( ErrorNew( "wvtMenu", 1000, "wvtMenu:Destroy()", "Destroy menu FAILED", {},__FILE__ ) ) #endif ENDIF ::hMenu := 0 @@ -3405,13 +3405,13 @@ METHOD wvtMenu:AddItem( cCaption, bAction ) aItem := { MF_SEPARATOR, 0, 0, NIL } ELSE #if 0 - Throw( ErrorNew( "wvtMenu", 3101, "wvtMenu:AddItem()", "Argument Error", { cCaption, bAction },"wvt.prg" ) ) + Throw( ErrorNew( "wvtMenu", 3101, "wvtMenu:AddItem()", "Argument Error", { cCaption, bAction },__FILE__ ) ) #endif ENDIF IF !Wvt_AppendMenu( ::hMenu, aItem[WVT_MENU_TYPE], aItem[WVT_MENU_IDENTIFIER], aItem[WVT_MENU_CAPTION] ) #if 0 - Throw( ErrorNew( "wvtMenu", 1000, "wvtMenu:AddItem()", "Add menu item", { cCaption, bAction },"wvt.prg" ) ) + Throw( ErrorNew( "wvtMenu", 1000, "wvtMenu:AddItem()", "Add menu item", { cCaption, bAction },__FILE__ ) ) #endif ENDIF @@ -3450,7 +3450,7 @@ METHOD wvtMenu:DelItem( nItemNum ) hb_ADel( ::aItems, nItemNum, .T. ) ELSE #if 0 - Throw( ErrorNew( "wvtMenu", 1000, "wvtMenu:DelItem()", "Delete menu item FAILED", { nItemNum },"wvt.prg" ) ) + Throw( ErrorNew( "wvtMenu", 1000, "wvtMenu:DelItem()", "Delete menu item FAILED", { nItemNum },__FILE__ ) ) #endif ENDIF ENDIF diff --git a/harbour/contrib/gtwvg/menubar.prg b/harbour/contrib/gtwvg/menubar.prg index 8267425334..2716c14f9e 100644 --- a/harbour/contrib/gtwvg/menubar.prg +++ b/harbour/contrib/gtwvg/menubar.prg @@ -217,7 +217,7 @@ METHOD WvgMenuBar:destroy() IF !WVG_DestroyMenu( ::hMenu ) #if 0 - Throw( ErrorNew( "wvtMenu", 1000, "wvtMenu:Destroy()", "Destroy menu FAILED", {},"wvt.prg" ) ) + Throw( ErrorNew( "wvtMenu", 1000, "wvtMenu:Destroy()", "Destroy menu FAILED", {},__FILE__ ) ) #endif ENDIF @@ -255,7 +255,7 @@ METHOD WvgMenuBar:delItem( nItemNum ) hb_ADel( ::aMenuItems, nItemNum, .T. ) ELSE #if 0 - Throw( ErrorNew( "wvtMenu", 1000, "wvtMenu:DelItem()", "Delete menu item FAILED", { nItemNum },"wvt.prg" ) ) + Throw( ErrorNew( "wvtMenu", 1000, "wvtMenu:DelItem()", "Delete menu item FAILED", { nItemNum },__FILE__ ) ) #endif ENDIF ENDIF diff --git a/harbour/contrib/gtwvg/paint.prg b/harbour/contrib/gtwvg/paint.prg index 7394a5b66b..0662fe6284 100644 --- a/harbour/contrib/gtwvg/paint.prg +++ b/harbour/contrib/gtwvg/paint.prg @@ -52,8 +52,6 @@ // // /* - * WvtPaint.prg - * * Routines to manage Wvt*Classes Gui Painting */ // diff --git a/harbour/contrib/gtwvg/tests/demowvg.prg b/harbour/contrib/gtwvg/tests/demowvg.prg index 6d2da4d5cc..3f8f817f32 100644 --- a/harbour/contrib/gtwvg/tests/demowvg.prg +++ b/harbour/contrib/gtwvg/tests/demowvg.prg @@ -448,7 +448,7 @@ FUNCTION WvtLines() @ 15, 8 SAY "D" @ 16, 9 SAY "E" - DO WHILE ( Inkey( 0 ) != K_ESC ) + DO WHILE Inkey( 0 ) != K_ESC ENDDO // Restore Environments diff --git a/harbour/contrib/hbct/fcopy.prg b/harbour/contrib/hbct/fcopy.prg index 58a5fb81c8..93add85b22 100644 --- a/harbour/contrib/hbct/fcopy.prg +++ b/harbour/contrib/hbct/fcopy.prg @@ -7,7 +7,6 @@ * CT3 file functions: * FILECOPY(), FILECOPEN(), FILECCLOSE(), FILEAPPEND() * - * Program..: fcopy.prg * Author...: Frederic J. Bell * Dated....: Jun,17 94 * Revised..: Sep,20 94 diff --git a/harbour/contrib/hbcups/tests/test.prg b/harbour/contrib/hbcups/tests/test.prg index 0dcb771530..0c74807a26 100644 --- a/harbour/contrib/hbcups/tests/test.prg +++ b/harbour/contrib/hbcups/tests/test.prg @@ -26,12 +26,12 @@ PROCEDURE Main() CLS aPrinter := cupsGetDests() i := AChoice( 2, 5, 30, Len( aPrinter ) + 2, aPrinter ) - ? "Printing... Job ID:", cupsPrintFile( aPrinter[ i ], "test.prg", "Harbour CUPS Printing" ) + ? "Printing... Job ID:", cupsPrintFile( aPrinter[ i ], __FILE__, "Harbour CUPS Printing" ) /* for duplex printing, tested on OKI B410 */ -/* ? "Printing... Job ID:", cupsPrintFile( aPrinter[ i ], "../../../tests/speedstr.prg", "Harbour CUPS Printing", { "sides=two-sided-short-edge" } ) */ +/* ? "Printing... Job ID:", cupsPrintFile( aPrinter[ i ], ".." + hb_ps() + "core.c", "Harbour CUPS Printing", { "sides=two-sided-short-edge" } ) */ ELSE - ? "Printing... Job ID:", cupsPrintFile( cupsGetDefault(), "test.prg", "Harbour CUPS Printing", { "sides=one-sided" } ) -/* ? "Printing... Job ID:", cupsPrintFile( cupsGetDefault(), "test.prg", "Harbour CUPS Printing", { "sides" => "one-sided" } ) */ + ? "Printing... Job ID:", cupsPrintFile( cupsGetDefault(), __FILE__, "Harbour CUPS Printing", { "sides=one-sided" } ) +/* ? "Printing... Job ID:", cupsPrintFile( cupsGetDefault(), __FILE__, "Harbour CUPS Printing", { "sides" => "one-sided" } ) */ ENDIF RETURN diff --git a/harbour/contrib/hbcurl/tests/ftp_uldl.prg b/harbour/contrib/hbcurl/tests/ftp_uldl.prg index f23e7c0b5a..11c76a7927 100644 --- a/harbour/contrib/hbcurl/tests/ftp_uldl.prg +++ b/harbour/contrib/hbcurl/tests/ftp_uldl.prg @@ -53,7 +53,7 @@ PROCEDURE Main( cDL, cUL ) ? "Press key..." Inkey( 0 ) - hb_default( @cUL, "ftp_uldl.prg" ) + hb_default( @cUL, __FILE__ ) ? curl_easy_setopt( curl, HB_CURLOPT_UPLOAD ) ? curl_easy_setopt( curl, HB_CURLOPT_URL, REMOTE_URL ) diff --git a/harbour/contrib/hbmisc/hb_f.c b/harbour/contrib/hbmisc/hb_f.c index e23de63ce2..7c3ab35fb5 100644 --- a/harbour/contrib/hbmisc/hb_f.c +++ b/harbour/contrib/hbmisc/hb_f.c @@ -50,8 +50,6 @@ * */ -/* please run tests\testhbf.prg for testing */ - #include "hbapifs.h" #define _B_SIZE 4096 diff --git a/harbour/contrib/hbmisc/tests/testhbf.prg b/harbour/contrib/hbmisc/tests/testhbf.prg index 015d4cdee2..89a1245273 100644 --- a/harbour/contrib/hbmisc/tests/testhbf.prg +++ b/harbour/contrib/hbmisc/tests/testhbf.prg @@ -22,7 +22,7 @@ inplementation of : PROCEDURE Main() // open a text file here - IF hb_fuse( "testhbf.prg", 0 ) > 1 + IF hb_fuse( __FILE__, 0 ) > 1 DO WHILE ! hb_FEof() ? "line " + Str( hb_frecno(), 2 ) + " " + hb_freadln() diff --git a/harbour/contrib/hbmysql/utils/dbf2mysq.prg b/harbour/contrib/hbmysql/utils/dbf2mysq.prg index 47d07ae0ca..baa9958b38 100644 --- a/harbour/contrib/hbmysql/utils/dbf2mysq.prg +++ b/harbour/contrib/hbmysql/utils/dbf2mysq.prg @@ -4,7 +4,7 @@ /* * Harbour Project source code: - * dbf2mysq.prg - converts a .dbf file into a MySQL table + * Converts a .dbf file into a MySQL table * * Copyright 2000 Maurilio Longo * www - http://harbour-project.org diff --git a/harbour/contrib/hbnf/amedian.prg b/harbour/contrib/hbnf/amedian.prg index e64a741a47..53d20d3288 100644 --- a/harbour/contrib/hbnf/amedian.prg +++ b/harbour/contrib/hbnf/amedian.prg @@ -9,8 +9,8 @@ * This is an original work by Ralph Oliver and is placed in the * public domain. * - * This program uses the preprocessor #defines and #command in - * Aavg.prg by David Husnian. + * This program uses the preprocessor #defines and #command + * by David Husnian. * * Modification history: * --------------------- @@ -23,7 +23,7 @@ * */ -#define FORCE_BETWEEN( x, y, z ) ( y := MAX( MIN( y, z ), x ) ) +#define FORCE_BETWEEN( x, y, z ) ( y := Max( Min( y, z ), x ) ) FUNCTION FT_AMEDIAN( aArray, nStart, nEnd ) diff --git a/harbour/contrib/hbnf/fttext.c b/harbour/contrib/hbnf/fttext.c index 991b80d56f..28c7d12ef6 100644 --- a/harbour/contrib/hbnf/fttext.c +++ b/harbour/contrib/hbnf/fttext.c @@ -80,12 +80,12 @@ * - Function changes/additions (refer to the individual doc headers for * details): * - * FT_FSELECT( [ < nArea > ] ) -> nArea - * FT_FUSE( [ < cFile > ][, < nMode > ] ) -> nHandle | NIL - * FT_FWRITELN( < cData > [, < lInsert > ] ) -> NIL - * FT_FINSERT( [ < nLines > ] ) -> NIL - * FT_FDELETE( [ < nLines > ] ) -> NIL - * FT_FAPPEND( [ < nLines > ] ) -> NIL + * FT_FSELECT( [ ] ) -> nArea + * FT_FUSE( [ ][, ] ) -> nHandle | NIL + * FT_FWRITELN( [, ] ) -> NIL + * FT_FINSERT( [ ] ) -> NIL + * FT_FDELETE( [ ] ) -> NIL + * FT_FAPPEND( [ ] ) -> NIL * * Internal Steve Larsen revisions: * @@ -120,39 +120,6 @@ * */ -/* Notes: - - The Clipper internal functions used seem to be stable across - versions but nothing is guaranteed. These functions begin - with _t, are used for file I/O, and are compatible with their - ANSI counterparts (just strip the _t and you have the ANSI name). - See text.h for the prototypes. - - This revision utilizes the in-line assembler feature found in MSC - 6.0. If compiling with TurboC substitute "_asm" with "asm". - - I compile these functions with the following MicroSoft C parameters: - - cl /c /AL /Od /Zl /Zi /FPa /Gs /W3 fttext.c - - Note that the /Od defeats optimization and is necessary only for - compatibility with Blinker, Warplink, etc. If you are not overlaying - this code you may want to change this to /Oalt. Likewise, the - /Zi is for symbolic debugging info which you will want to omit in - any final compiles. - - Some sample Clipper code which would use these functions is listed - below. It will print out the contents of this file. - - ft_fuse( "text.c" ) - do while !ft_feof() - ? ft_freadln() - ft_fskip() - enddo - ft_fuse() - - */ - /* * The following parts are Copyright of the individual authors. * www - http://harbour-project.org @@ -164,6 +131,19 @@ * */ +/* + Some sample Clipper code which would use these functions is listed + below. It will print out the contents of this file. + + ft_fuse( "text.c" ) + DO WHILE ! ft_feof() + ? ft_freadln() + ft_fskip() + ENDDO + ft_fuse() + + */ + /* up this number if you need more than 10 text file areas */ #define TEXT_WORKAREAS 10 /* raise or lower this number for best performance on your system @@ -173,6 +153,7 @@ #include "hbapi.h" #include "hbapifs.h" +#include "hbstack.h" /* MSC compiler switch */ #if defined( _MSC_VER ) @@ -180,42 +161,55 @@ #pragma warning( disable : 4704 ) #endif -#define VALLOC_FLAG 0 +typedef struct +{ + int area; + int doInt; /* for debugging purposes */ + /* arrays used by the text workareas */ + long recno[ TEXT_WORKAREAS ]; + HB_FOFFSET offset[ TEXT_WORKAREAS ]; + HB_FHANDLE handles[ TEXT_WORKAREAS ]; + long last_rec[ TEXT_WORKAREAS ]; + HB_FOFFSET last_off[ TEXT_WORKAREAS ]; + HB_FOFFSET lastbyte[ TEXT_WORKAREAS ]; + HB_BOOL isBof[ TEXT_WORKAREAS ]; + HB_BOOL isEof[ TEXT_WORKAREAS ]; + HB_ERRCODE error[ TEXT_WORKAREAS ]; +} FT_TEXT, * PFT_TEXT; + +static void s_fttext_init_init( void * cargo ) +{ + PFT_TEXT ft_text = ( PFT_TEXT ) cargo; + + ft_text->area = 0; + ft_text->doInt = 0; +} + +static HB_TSD_NEW( s_fttext, sizeof( FT_TEXT ), s_fttext_init_init, NULL ); /* routines internal to this module */ static HB_ISIZ _findeol( char * buf, HB_ISIZ buf_len ); static HB_ISIZ _findbol( char * buf, HB_ISIZ buf_len ); -static int _ins_buff( HB_ISIZ bytes ); -static int _del_buff( HB_ISIZ bytes ); +static int _ins_buff( PFT_TEXT ft_text, HB_ISIZ iLen ); +static int _del_buff( PFT_TEXT ft_text, HB_ISIZ iLen ); static long _ft_skip( long recs ); -static int _writeLine( const char * theData, HB_SIZE iDataLen ); +static int _writeLine( PFT_TEXT ft_text, const char * theData, HB_SIZE iDataLen ); static HB_BOOL _writeeol( HB_FHANDLE fhnd ); -/* arrays used by the text workareas */ -static int area = 0; -static long recno[ TEXT_WORKAREAS ]; -static HB_FOFFSET offset[ TEXT_WORKAREAS ]; -static HB_FHANDLE handles[ TEXT_WORKAREAS ]; -static long last_rec[ TEXT_WORKAREAS ]; -static HB_FOFFSET last_off[ TEXT_WORKAREAS ]; -static HB_FOFFSET lastbyte[ TEXT_WORKAREAS ]; -static HB_BOOL isBof[ TEXT_WORKAREAS ]; -static HB_BOOL isEof[ TEXT_WORKAREAS ]; -static HB_ERRCODE error[ TEXT_WORKAREAS ]; - -/* for debugging purposes */ -static int doInt = 0; - HB_FUNC_EXTERN( FT_GOBOT ); HB_FUNC( FTSETINT ) { - doInt ^= 0xFF; + PFT_TEXT ft_text = ( PFT_TEXT ) hb_stackGetTSD( &s_fttext ); + + ft_text->doInt ^= 0xFF; } HB_FUNC( FT_FOFFSET ) { - hb_retnint( offset[ area ] ); + PFT_TEXT ft_text = ( PFT_TEXT ) hb_stackGetTSD( &s_fttext ); + + hb_retnint( ft_text->offset[ ft_text->area ] ); } #define FT_CHR_CR 13 @@ -224,42 +218,46 @@ HB_FUNC( FT_FOFFSET ) HB_FUNC( FT_FUSE ) { - int attr = hb_parnidef( 2, FO_READWRITE | FO_DENYNONE ); + PFT_TEXT ft_text = ( PFT_TEXT ) hb_stackGetTSD( &s_fttext ); - error[ area ] = 0; + int attr = hb_parnidef( 2, FO_READWRITE | FO_DENYNONE ); + + ft_text->error[ ft_text->area ] = 0; if( HB_ISCHAR( 1 ) ) { - handles[ area ] = hb_fsOpen( hb_parc( 1 ), ( HB_USHORT ) attr ); - if( handles[ area ] <= 0 ) - error[ area ] = hb_fsError(); - offset[ area ] = 0; - recno[ area ] = 1; - lastbyte[ area ] = hb_fsSeekLarge( handles[ area ], 0, FS_END ); - hb_retnint( handles[ area ] ); + ft_text->handles[ ft_text->area ] = hb_fsOpen( hb_parc( 1 ), ( HB_USHORT ) attr ); + if( ft_text->handles[ ft_text->area ] <= 0 ) + ft_text->error[ ft_text->area ] = hb_fsError(); + ft_text->offset[ ft_text->area ] = 0; + ft_text->recno[ ft_text->area ] = 1; + ft_text->lastbyte[ ft_text->area ] = hb_fsSeekLarge( ft_text->handles[ ft_text->area ], 0, FS_END ); + hb_retnint( ft_text->handles[ ft_text->area ] ); } else { - if( handles[ area ] != 0 ) + if( ft_text->handles[ ft_text->area ] != 0 ) { - hb_fsClose( handles[ area ] ); + hb_fsClose( ft_text->handles[ ft_text->area ] ); hb_retnint( 0 ); - recno[ area ] = 0L; - offset[ area ] = 0L; - handles[ area ] = 0; - last_rec[ area ] = 0L; - last_off[ area ] = 0L; - lastbyte[ area ] = 0L; - isBof[ area ] = HB_FALSE; - isEof[ area ] = HB_FALSE; + ft_text->recno[ ft_text->area ] = 0L; + ft_text->offset[ ft_text->area ] = 0L; + ft_text->handles[ ft_text->area ] = 0; + ft_text->last_rec[ ft_text->area ] = 0L; + ft_text->last_off[ ft_text->area ] = 0L; + ft_text->lastbyte[ ft_text->area ] = 0L; + ft_text->isBof[ ft_text->area ] = HB_FALSE; + ft_text->isEof[ ft_text->area ] = HB_FALSE; } } } HB_FUNC( FT_FSELECT ) { - int oldarea = area + 1; - int newArea; + PFT_TEXT ft_text = ( PFT_TEXT ) hb_stackGetTSD( &s_fttext ); + + int oldarea = ft_text->area + 1; + int newArea; if( HB_ISNUM( 1 ) ) { @@ -270,15 +268,15 @@ HB_FUNC( FT_FSELECT ) { for(; newArea < TEXT_WORKAREAS - 1; newArea++ ) { - if( handles[ newArea ] == 0 ) + if( ft_text->handles[ newArea ] == 0 ) { - area = newArea; + ft_text->area = newArea; break; } } } else - area = newArea - 1; + ft_text->area = newArea - 1; } } hb_retni( oldarea ); @@ -286,38 +284,44 @@ HB_FUNC( FT_FSELECT ) HB_FUNC( FT_FGOTOP ) { - error[ area ] = 0; - offset[ area ] = 0L; - recno[ area ] = 1L; - isBof[ area ] = HB_FALSE; - isEof[ area ] = HB_FALSE; + PFT_TEXT ft_text = ( PFT_TEXT ) hb_stackGetTSD( &s_fttext ); + + ft_text->error[ ft_text->area ] = 0; + ft_text->offset[ ft_text->area ] = 0L; + ft_text->recno[ ft_text->area ] = 1L; + ft_text->isBof[ ft_text->area ] = HB_FALSE; + ft_text->isEof[ ft_text->area ] = HB_FALSE; } HB_FUNC( FT_FERROR ) { - hb_retni( error[ area ] ); + PFT_TEXT ft_text = ( PFT_TEXT ) hb_stackGetTSD( &s_fttext ); + + hb_retni( ft_text->error[ ft_text->area ] ); } HB_FUNC( FT_FRECNO ) { - hb_retnl( recno[ area ] ); + PFT_TEXT ft_text = ( PFT_TEXT ) hb_stackGetTSD( &s_fttext ); + + hb_retnl( ft_text->recno[ ft_text->area ] ); } HB_FUNC( FT_FGOBOT ) { + PFT_TEXT ft_text = ( PFT_TEXT ) hb_stackGetTSD( &s_fttext ); - error[ area ] = 0; - if( ! last_rec[ area ] ) + ft_text->error[ ft_text->area ] = 0; + if( ! ft_text->last_rec[ ft_text->area ] ) { /* if the last record has not already been found */ _ft_skip( 0 ); } - recno[ area ] = last_rec[ area ]; - offset[ area ] = last_off[ area ]; - isBof[ area ] = HB_FALSE; - isEof[ area ] = HB_FALSE; - + ft_text->recno[ ft_text->area ] = ft_text->last_rec[ ft_text->area ]; + ft_text->offset[ ft_text->area ] = ft_text->last_off[ ft_text->area ]; + ft_text->isBof[ ft_text->area ] = HB_FALSE; + ft_text->isEof[ ft_text->area ] = HB_FALSE; } HB_FUNC( FT_FSKIP ) @@ -339,6 +343,7 @@ HB_FUNC( FT_FSKIP ) Returns a long indicating the number of records skipped */ static long _ft_skip( long iRecs ) { + PFT_TEXT ft_text = ( PFT_TEXT ) hb_stackGetTSD( &s_fttext ); HB_ISIZ iByteCount; HB_ISIZ iBytesRead, iBytesRemaining; @@ -346,17 +351,17 @@ static long _ft_skip( long iRecs ) long iSkipped = 0; char * cBuff = ( char * ) hb_xgrab( BUFFSIZE ); - HB_FOFFSET fpOffset = offset[ area ]; + HB_FOFFSET fpOffset = ft_text->offset[ ft_text->area ]; - isBof[ area ] = HB_FALSE; - isEof[ area ] = HB_FALSE; - error[ area ] = 0; + ft_text->isBof[ ft_text->area ] = HB_FALSE; + ft_text->isEof[ ft_text->area ] = HB_FALSE; + ft_text->error[ ft_text->area ] = 0; /* iRecs is zero if they want to find the EOF, start a top of file */ if( iRecs == 0 ) { - fpOffset = 0L; - recno[ area ] = 1; + fpOffset = 0L; + ft_text->recno[ ft_text->area ] = 1; } if( iRecs >= 0 ) @@ -366,18 +371,18 @@ static long _ft_skip( long iRecs ) cPtr = cBuff; /* position file pointer to beginning of current record */ - hb_fsSeekLarge( handles[ area ], fpOffset, FS_SET ); + hb_fsSeekLarge( ft_text->handles[ ft_text->area ], fpOffset, FS_SET ); /* read a chunk */ - iBytesRead = hb_fsRead( handles[ area ], cBuff, BUFFSIZE ); + iBytesRead = hb_fsRead( ft_text->handles[ ft_text->area ], cBuff, BUFFSIZE ); if( ! iBytesRead ) { /* buffer is empty thus EOF, set vars and quit */ - isEof[ area ] = HB_TRUE; - last_rec[ area ] = recno[ area ]; - last_off[ area ] = offset[ area ]; - error[ area ] = hb_fsError(); + ft_text->isEof[ ft_text->area ] = HB_TRUE; + ft_text->last_rec[ ft_text->area ] = ft_text->recno[ ft_text->area ]; + ft_text->last_off[ ft_text->area ] = ft_text->offset[ ft_text->area ]; + ft_text->error[ ft_text->area ] = hb_fsError(); break; } @@ -394,11 +399,11 @@ static long _ft_skip( long iRecs ) { /* found a CRLF, iByteCount points to first char of next record */ - iBytesRemaining -= iByteCount; - fpOffset += iByteCount; - cPtr += iByteCount; - offset[ area ] = fpOffset; - recno[ area ]++; + iBytesRemaining -= iByteCount; + fpOffset += iByteCount; + cPtr += iByteCount; + ft_text->offset[ ft_text->area ] = fpOffset; + ft_text->recno[ ft_text->area ]++; iSkipped++; if( iRecs && ( iSkipped == iRecs ) ) iBytesRemaining = iBytesRead = 0; @@ -413,18 +418,18 @@ static long _ft_skip( long iRecs ) if( iBytesRead != BUFFSIZE ) { /* buffer was not full, thus EOF, set vars and quit */ - iBytesRemaining = 0; - last_rec[ area ] = recno[ area ]; - last_off[ area ] = offset[ area ]; + iBytesRemaining = 0; + ft_text->last_rec[ ft_text->area ] = ft_text->recno[ ft_text->area ]; + ft_text->last_off[ ft_text->area ] = ft_text->offset[ ft_text->area ]; if( iRecs ) - isEof[ area ] = HB_TRUE; + ft_text->isEof[ ft_text->area ] = HB_TRUE; } else { /* buffer was full, so probably not EOF, but maybe CRLF straddled end of buffer, so back up pointer a bit before doing the next read */ - fpOffset = hb_fsSeekLarge( handles[ area ], 0, FS_RELATIVE ) - 1; + fpOffset = hb_fsSeekLarge( ft_text->handles[ ft_text->area ], 0, FS_RELATIVE ) - 1; iBytesRemaining = 0; } } @@ -438,35 +443,35 @@ static long _ft_skip( long iRecs ) /* skip backwards */ iRecs = -iRecs; - if( recno[ area ] > iRecs ) + if( ft_text->recno[ ft_text->area ] > iRecs ) { do { /* calc offset to read area of file ahead of current pointer */ - fpOffset = HB_MAX( offset[ area ] - BUFFSIZE, 0L ); + fpOffset = HB_MAX( ft_text->offset[ ft_text->area ] - BUFFSIZE, 0L ); /* move file pointer */ - hb_fsSeekLarge( handles[ area ], fpOffset, FS_SET ); + hb_fsSeekLarge( ft_text->handles[ ft_text->area ], fpOffset, FS_SET ); /* read a chunk */ iBytesRead = - hb_fsRead( handles[ area ], cBuff, BUFFSIZE ); + hb_fsRead( ft_text->handles[ ft_text->area ], cBuff, BUFFSIZE ); if( ! iBytesRead ) { /* buffer is empty thus file is zero len, set vars and quit */ - isBof[ area ] = HB_TRUE; - isEof[ area ] = HB_TRUE; - recno[ area ] = 0; - offset[ area ] = 0; - last_rec[ area ] = 0; - error[ area ] = hb_fsError(); + ft_text->isBof[ ft_text->area ] = HB_TRUE; + ft_text->isEof[ ft_text->area ] = HB_TRUE; + ft_text->recno[ ft_text->area ] = 0; + ft_text->offset[ ft_text->area ] = 0; + ft_text->last_rec[ ft_text->area ] = 0; + ft_text->error[ ft_text->area ] = hb_fsError(); break; } /* set pointer within buffer */ - iBytesRemaining = ( int ) ( offset[ area ] - fpOffset ); + iBytesRemaining = ( int ) ( ft_text->offset[ ft_text->area ] - fpOffset ); cPtr = cBuff + iBytesRemaining; @@ -481,11 +486,11 @@ static long _ft_skip( long iRecs ) { /* found a CRLF, iByteCount points to first char of next record */ - iBytesRemaining -= iByteCount; - offset[ area ] -= iByteCount; - cPtr -= iByteCount; - fpOffset = offset[ area ]; - recno[ area ]--; + iBytesRemaining -= iByteCount; + ft_text->offset[ ft_text->area ] -= iByteCount; + cPtr -= iByteCount; + fpOffset = ft_text->offset[ ft_text->area ]; + ft_text->recno[ ft_text->area ]--; iSkipped++; if( iSkipped == iRecs ) iBytesRemaining = iBytesRead = 0; @@ -499,10 +504,10 @@ static long _ft_skip( long iRecs ) if( iBytesRead != BUFFSIZE ) { /* buffer was not full, thus BOF, set vars and quit */ - iBytesRemaining = 0; - offset[ area ] = 0; - recno[ area ] = 1; - isBof[ area ] = HB_TRUE; + iBytesRemaining = 0; + ft_text->offset[ ft_text->area ] = 0; + ft_text->recno[ ft_text->area ] = 1; + ft_text->isBof[ ft_text->area ] = HB_TRUE; } else { @@ -518,9 +523,9 @@ static long _ft_skip( long iRecs ) else { - offset[ area ] = 0; - recno[ area ] = 1; - isBof[ area ] = HB_TRUE; + ft_text->offset[ ft_text->area ] = 0; + ft_text->recno[ ft_text->area ] = 1; + ft_text->isBof[ ft_text->area ] = HB_TRUE; } } @@ -530,18 +535,19 @@ static long _ft_skip( long iRecs ) HB_FUNC( FT_FREADLN ) { + PFT_TEXT ft_text = ( PFT_TEXT ) hb_stackGetTSD( &s_fttext ); HB_ISIZ iByteCount; HB_ISIZ iBytesRead; char * cPtr = ( char * ) hb_xgrab( BUFFSIZE ); - hb_fsSeekLarge( handles[ area ], offset[ area ], FS_SET ); - iBytesRead = hb_fsReadLarge( handles[ area ], cPtr, BUFFSIZE ); + hb_fsSeekLarge( ft_text->handles[ ft_text->area ], ft_text->offset[ ft_text->area ], FS_SET ); + iBytesRead = hb_fsReadLarge( ft_text->handles[ ft_text->area ], cPtr, BUFFSIZE ); - error[ area ] = 0; + ft_text->error[ ft_text->area ] = 0; if( ! iBytesRead ) - error[ area ] = hb_fsError(); + ft_text->error[ ft_text->area ] = hb_fsError(); iByteCount = _findeol( cPtr, iBytesRead ); @@ -555,73 +561,77 @@ HB_FUNC( FT_FREADLN ) HB_FUNC( FT_FDELETE ) { + PFT_TEXT ft_text = ( PFT_TEXT ) hb_stackGetTSD( &s_fttext ); + int iBytesRead; HB_FOFFSET srcPtr; HB_FOFFSET destPtr; - long cur_rec = recno[ area ]; - HB_FOFFSET cur_off = offset[ area ]; + long cur_rec = ft_text->recno[ ft_text->area ]; + HB_FOFFSET cur_off = ft_text->offset[ ft_text->area ]; char * Buff = ( char * ) hb_xgrab( BUFFSIZE ); /* save address to current record ( first record to be deleted ) */ - destPtr = offset[ area ]; + destPtr = ft_text->offset[ ft_text->area ]; /* skip over deleted records, point to first 'to be retained' record */ _ft_skip( hb_parnldef( 1, 1 ) ); - srcPtr = hb_fsSeekLarge( handles[ area ], offset[ area ], FS_SET ); + srcPtr = hb_fsSeekLarge( ft_text->handles[ ft_text->area ], ft_text->offset[ ft_text->area ], FS_SET ); /* buffer read retained data, write atop old data */ do { - hb_fsSeekLarge( handles[ area ], srcPtr, FS_SET ); - iBytesRead = hb_fsRead( handles[ area ], Buff, BUFFSIZE ); /* now read in a big glob */ + hb_fsSeekLarge( ft_text->handles[ ft_text->area ], srcPtr, FS_SET ); + iBytesRead = hb_fsRead( ft_text->handles[ ft_text->area ], Buff, BUFFSIZE ); /* now read in a big glob */ srcPtr += iBytesRead; - hb_fsSeekLarge( handles[ area ], destPtr, FS_SET ); - destPtr += hb_fsWriteLarge( handles[ area ], Buff, iBytesRead ); + hb_fsSeekLarge( ft_text->handles[ ft_text->area ], destPtr, FS_SET ); + destPtr += hb_fsWriteLarge( ft_text->handles[ ft_text->area ], Buff, iBytesRead ); } while( iBytesRead > 0 ); /* move DOS EOF marker */ - hb_fsSeekLarge( handles[ area ], srcPtr, FS_SET ); - hb_fsWrite( handles[ area ], Buff, 0 ); + hb_fsSeekLarge( ft_text->handles[ ft_text->area ], srcPtr, FS_SET ); + hb_fsWrite( ft_text->handles[ ft_text->area ], Buff, 0 ); - error[ area ] = hb_fsError(); + ft_text->error[ ft_text->area ] = hb_fsError(); /* restore pointers */ - recno[ area ] = cur_rec; - offset[ area ] = cur_off; + ft_text->recno[ ft_text->area ] = cur_rec; + ft_text->offset[ ft_text->area ] = cur_off; /* re_calc EOF */ - lastbyte[ area ] = hb_fsSeekLarge( handles[ area ], 0L, FS_END ); + ft_text->lastbyte[ ft_text->area ] = hb_fsSeekLarge( ft_text->handles[ ft_text->area ], 0L, FS_END ); _ft_skip( 0 ); /* restore pointers again */ - recno[ area ] = cur_rec; - offset[ area ] = cur_off; + ft_text->recno[ ft_text->area ] = cur_rec; + ft_text->offset[ ft_text->area ] = cur_off; /* if we've deleted to EOF, leave EOF flag set, otherwise clear it */ - if( recno[ area ] != last_rec[ area ] ) - isEof[ area ] = HB_FALSE; + if( ft_text->recno[ ft_text->area ] != ft_text->last_rec[ ft_text->area ] ) + ft_text->isEof[ ft_text->area ] = HB_FALSE; hb_xfree( Buff ); - hb_retl( error[ area ] ? 0 : 1 ); + hb_retl( ft_text->error[ ft_text->area ] ? 0 : 1 ); } HB_FUNC( FT_FINSERT ) { + PFT_TEXT ft_text = ( PFT_TEXT ) hb_stackGetTSD( &s_fttext ); + int no_lines = hb_parnidef( 1, 1 ); HB_ISIZ no_bytes = no_lines * 2; int err = 1; - if( _ins_buff( no_bytes ) ) + if( _ins_buff( ft_text, no_bytes ) ) err = 0; else { while( no_lines-- ) - if( ! _writeeol( handles[ area ] ) ) + if( ! _writeeol( ft_text->handles[ ft_text->area ] ) ) { - error[ area ] = hb_fsError(); - err = 0; + ft_text->error[ ft_text->area ] = hb_fsError(); + err = 0; break; } } @@ -631,66 +641,70 @@ HB_FUNC( FT_FINSERT ) HB_FUNC( FT_FAPPEND ) { + PFT_TEXT ft_text = ( PFT_TEXT ) hb_stackGetTSD( &s_fttext ); + int no_lines = hb_parnidef( 1, 1 ); HB_ISIZ iRead; HB_ISIZ iByteCount; char * buff = ( char * ) hb_xgrab( BUFFSIZE ); - error[ area ] = 0; + ft_text->error[ ft_text->area ] = 0; -/* go to end of file */ + /* go to end of file */ HB_FUNC_EXEC( FT_FGOBOT ); -/* find end of record */ + /* find end of record */ - hb_fsSeekLarge( handles[ area ], offset[ area ], FS_SET ); - iRead = hb_fsRead( handles[ area ], buff, BUFFSIZE ); /* now read in a big glob */ + hb_fsSeekLarge( ft_text->handles[ ft_text->area ], ft_text->offset[ ft_text->area ], FS_SET ); + iRead = hb_fsRead( ft_text->handles[ ft_text->area ], buff, BUFFSIZE ); /* now read in a big glob */ -/* determine if CRLF pair exists, if not, add one */ + /* determine if CRLF pair exists, if not, add one */ /* get count of chars in this line */ iByteCount = _findeol( buff, iRead ); if( iByteCount == 0 ) - hb_fsSeekLarge( handles[ area ], 0, FS_END ); + hb_fsSeekLarge( ft_text->handles[ ft_text->area ], 0, FS_END ); else { - offset[ area ] = hb_fsSeekLarge( handles[ area ], offset[ area ] + iByteCount, FS_SET ); - recno[ area ]++; + ft_text->offset[ ft_text->area ] = hb_fsSeekLarge( ft_text->handles[ ft_text->area ], ft_text->offset[ ft_text->area ] + iByteCount, FS_SET ); + ft_text->recno[ ft_text->area ]++; no_lines--; } while( no_lines-- ) { - if( ! _writeeol( handles[ area ] ) ) + if( ! _writeeol( ft_text->handles[ ft_text->area ] ) ) { - error[ area ] = hb_fsError(); + ft_text->error[ ft_text->area ] = hb_fsError(); break; } - recno[ area ]++; - offset[ area ] = hb_fsSeekLarge( handles[ area ], 0, FS_RELATIVE ); + ft_text->recno[ ft_text->area ]++; + ft_text->offset[ ft_text->area ] = hb_fsSeekLarge( ft_text->handles[ ft_text->area ], 0, FS_RELATIVE ); /* no_lines--; !Harbour FIX! */ } - if( ! error[ area ] ) + if( ! ft_text->error[ ft_text->area ] ) { /* move DOS eof marker */ - hb_fsWrite( handles[ area ], buff, 0 ); - error[ area ] = hb_fsError(); + hb_fsWrite( ft_text->handles[ ft_text->area ], buff, 0 ); + ft_text->error[ ft_text->area ] = hb_fsError(); } /* force recalc of last record/offset */ - last_rec[ area ] = 0; + ft_text->last_rec[ ft_text->area ] = 0; hb_xfree( buff ); - hb_retl( error[ area ] ? 0 : 1 ); + hb_retl( ft_text->error[ ft_text->area ] ? 0 : 1 ); } HB_FUNC( FT_FWRITELN ) { + PFT_TEXT ft_text = ( PFT_TEXT ) hb_stackGetTSD( &s_fttext ); + const char * theData = hb_parc( 1 ); HB_ISIZ iDataLen = hb_parclen( 1 ); HB_BOOL bInsert = hb_parl( 2 ); @@ -701,17 +715,17 @@ HB_FUNC( FT_FWRITELN ) char * buffer; /* position file pointer to insertion point */ - hb_fsSeekLarge( handles[ area ], offset[ area ], FS_SET ); + hb_fsSeekLarge( ft_text->handles[ ft_text->area ], ft_text->offset[ ft_text->area ], FS_SET ); if( bInsert ) { /* insert mode, insert the length of new string + crlf */ - err = _ins_buff( iDataLen + 2 ); + err = _ins_buff( ft_text, iDataLen + 2 ); if( ! err ) { - hb_fsSeekLarge( handles[ area ], offset[ area ], FS_SET ); - err = _writeLine( theData, iDataLen ); + hb_fsSeekLarge( ft_text->handles[ ft_text->area ], ft_text->offset[ ft_text->area ], FS_SET ); + err = _writeLine( ft_text, theData, iDataLen ); } } else @@ -722,7 +736,7 @@ HB_FUNC( FT_FWRITELN ) /* find length of current line, loop if longer than buffer */ do { - iRead = hb_fsRead( handles[ area ], buffer, BUFFSIZE ); + iRead = hb_fsRead( ft_text->handles[ ft_text->area ], buffer, BUFFSIZE ); iEOL = _findeol( buffer, iRead ); if( iEOL == 0 ) { @@ -741,21 +755,21 @@ HB_FUNC( FT_FWRITELN ) if( ( iDataLen + 2 ) <= iLineLen ) { /* delete excess bytes from current record */ - _del_buff( iLineLen - iDataLen - 2 ); + _del_buff( ft_text, iLineLen - iDataLen - 2 ); /* write the new record's contents */ - hb_fsWriteLarge( handles[ area ], theData, iDataLen ); + hb_fsWriteLarge( ft_text->handles[ ft_text->area ], theData, iDataLen ); } else { /* insert extra bytes into current record */ - _ins_buff( iDataLen - iLineLen + 2 ); + _ins_buff( ft_text, iDataLen - iLineLen + 2 ); /* write the new record's contents */ - hb_fsWriteLarge( handles[ area ], theData, iDataLen ); + hb_fsWriteLarge( ft_text->handles[ ft_text->area ], theData, iDataLen ); } - error[ area ] = hb_fsError(); - err = ( error[ area ] ) ? 0 : 1; + ft_text->error[ ft_text->area ] = hb_fsError(); + err = ( ft_text->error[ ft_text->area ] ) ? 0 : 1; } hb_retl( err ); } @@ -767,38 +781,46 @@ HB_FUNC( FT_FWRITEL ) HB_FUNC( FT_FLASTRE ) { + PFT_TEXT ft_text = ( PFT_TEXT ) hb_stackGetTSD( &s_fttext ); + long cur_rec; HB_FOFFSET cur_offset; - cur_rec = recno[ area ]; - cur_offset = offset[ area ]; + cur_rec = ft_text->recno[ ft_text->area ]; + cur_offset = ft_text->offset[ ft_text->area ]; HB_FUNC_EXEC( FT_FGOBOT ); - hb_retnl( last_rec[ area ] ); + hb_retnl( ft_text->last_rec[ ft_text->area ] ); - recno[ area ] = cur_rec; - offset[ area ] = cur_offset; + ft_text->recno[ ft_text->area ] = cur_rec; + ft_text->offset[ ft_text->area ] = cur_offset; } HB_FUNC( FT_FEOF ) { - hb_retl( isEof[ area ] ); + PFT_TEXT ft_text = ( PFT_TEXT ) hb_stackGetTSD( &s_fttext ); + + hb_retl( ft_text->isEof[ ft_text->area ] ); } HB_FUNC( FT_FBOF ) { - hb_retl( isBof[ area ] ); + PFT_TEXT ft_text = ( PFT_TEXT ) hb_stackGetTSD( &s_fttext ); + + hb_retl( ft_text->isBof[ ft_text->area ] ); } HB_FUNC( FT_FGOTO ) { - long target = hb_parnl( 1 ); + PFT_TEXT ft_text = ( PFT_TEXT ) hb_stackGetTSD( &s_fttext ); + + long target = hb_parnl( 1 ); /* if a recno was passed, do a relative skip */ if( target ) { /* skip relative */ - target -= recno[ area ]; + target -= ft_text->recno[ ft_text->area ]; if( target ) _ft_skip( target ); @@ -806,17 +828,17 @@ HB_FUNC( FT_FGOTO ) else { /* goto 0 passed, go top then skip back */ - target = recno[ area ]; + target = ft_text->recno[ ft_text->area ]; - offset[ area ] = 0L; - recno[ area ] = 1L; - isBof[ area ] = HB_FALSE; - isEof[ area ] = HB_FALSE; + ft_text->offset[ ft_text->area ] = 0L; + ft_text->recno[ ft_text->area ] = 1L; + ft_text->isBof[ ft_text->area ] = HB_FALSE; + ft_text->isEof[ ft_text->area ] = HB_FALSE; if( --target ) _ft_skip( target ); } - error[ area ] = hb_fsError(); + ft_text->error[ ft_text->area ] = hb_fsError(); } /*---------------------------------------------------------------------- @@ -846,38 +868,7 @@ static HB_ISIZ _findeol( char * buf, HB_ISIZ buf_len ) } return 0; - -/* - ASM - { - push di ; save flags and registers - push es - pushf - cld ; move forward - les di, buf ; point to buffer - mov bx, di ; save buffer start for offset calc later - mov cx, buf_len ; scan entire buffer - mov al, 13 - _feol1:repne scasb ; look for a CR - jcxz _feolerr ; no find, return entire buffer - - cmp es:[di], 10 ; got a CRLF pair? - jne _feol1 ; no, try again - - inc di ; yes, point to first character after CR and return - mov ax, di ; subtract current pointer pos from start to - sub ax, bx ; learn offset within buffer - jmp _feoldone - - _feolerr: - mov ax, 0 - _feoldone: - popf - pop es - pop di - } - */ -} /* end _findeol() */ +} /*---------------------------------------------------------------------- @@ -937,59 +928,14 @@ static HB_ISIZ _findbol( char * buf, HB_ISIZ buf_len ) } return buf_len; - -/* - ASM - { - std ; move backwards - les di, buf ; point to buffer tail - mov bx, di ; save buffer start for offset calc later - dec di ; point to preceeding character - mov cx, buf_len ; scan entire buffer - dec cx - jcxz _fbolerr - - mov al, es:[di] ; if we're at EOF there might be a 1Ah there - cmp al, 1Ah ; if so, ignore it - jne _fbst - - dec di - dec cx - jnz _fbst - jmp _fbolerr - _fbst: - cmp al, 0Ah ; check if pointer is sitting on a CRLF pair - jne _fbol1 ; if not a LF go ahead and scan entire buffer - dec di ; got LF, look at next character for CR - dec cx - jcxz _fbolerr - - cmp es:[di], 0Dh - jne _fbol1 ; - dec di ; skip over the CR - dec cx - jcxz _fbolerr - _fbol1: - mov al, 0Ah ; look for a LF - repne scasb - jcxz _fbolerr ; if no find return entire buffer - cmp es:[di], 0Dh ; got one, check for CRLF pair? - jne _fbol1 ; no keep trying - add di, 2 ; adjust pointer to beginning of string - return bx - di ; subtract current pointer pos from start to learn offset within buffer - _fbolerr: - return buf_len ; on no find return length of buffer - } - */ -} /* end _findbol() */ +} /*--------------------------------------------------------------------------*/ /* inserts xxx bytes into the current file, beginning at the current record */ /* the contents of the inserted bytes are indeterminate, i.e. you'll have to write to them before they mean anything */ -static int _ins_buff( HB_ISIZ iLen ) +static int _ins_buff( PFT_TEXT ft_text, HB_ISIZ iLen ) { - char * ReadBuff = ( char * ) hb_xgrab( BUFFSIZE ); char * WriteBuff = ( char * ) hb_xgrab( BUFFSIZE ); char * SaveBuff; @@ -1004,35 +950,35 @@ static int _ins_buff( HB_ISIZ iLen ) iLenRemaining -= iLen; /* initialize file pointers */ - fpRead = offset[ area ]; - fpWrite = offset[ area ] + iLen; + fpRead = ft_text->offset[ ft_text->area ]; + fpWrite = ft_text->offset[ ft_text->area ] + iLen; /* do initial load of both buffers */ - hb_fsSeekLarge( handles[ area ], fpRead, FS_SET ); - WriteLen = hb_fsRead( handles[ area ], WriteBuff, BUFFSIZE ); - fpRead += WriteLen; + hb_fsSeekLarge( ft_text->handles[ ft_text->area ], fpRead, FS_SET ); + WriteLen = hb_fsRead( ft_text->handles[ ft_text->area ], WriteBuff, BUFFSIZE ); + fpRead += WriteLen; - ReadLen = hb_fsRead( handles[ area ], ReadBuff, BUFFSIZE ); - fpRead += ReadLen; + ReadLen = hb_fsRead( ft_text->handles[ ft_text->area ], ReadBuff, BUFFSIZE ); + fpRead += ReadLen; - error[ area ] = 0; + ft_text->error[ ft_text->area ] = 0; - while( ! error[ area ] && iLen > 0 ) + while( ! ft_text->error[ ft_text->area ] && iLen > 0 ) { while( WriteLen > 0 ) { /* position to beginning of write area */ - if( hb_fsSeekLarge( handles[ area ], fpWrite, FS_SET ) != fpWrite ) + if( hb_fsSeekLarge( ft_text->handles[ ft_text->area ], fpWrite, FS_SET ) != fpWrite ) { - error[ area ] = hb_fsError(); + ft_text->error[ ft_text->area ] = hb_fsError(); break; } - SaveLen = hb_fsWriteLarge( handles[ area ], WriteBuff, WriteLen ); + SaveLen = hb_fsWriteLarge( ft_text->handles[ ft_text->area ], WriteBuff, WriteLen ); if( ! SaveLen ) { - error[ area ] = hb_fsError(); + ft_text->error[ ft_text->area ] = hb_fsError(); break; } @@ -1042,7 +988,7 @@ static int _ins_buff( HB_ISIZ iLen ) if( SaveLen != WriteLen ) { /* error, fetch errcode and quit */ - error[ area ] = hb_fsError(); + ft_text->error[ ft_text->area ] = hb_fsError(); break; } /* WriteLen = SaveLen; */ @@ -1054,8 +1000,8 @@ static int _ins_buff( HB_ISIZ iLen ) WriteLen = ReadLen; /* return to read area and read another buffer */ - hb_fsSeekLarge( handles[ area ], fpRead, FS_SET ); - ReadLen = hb_fsRead( handles[ area ], ReadBuff, BUFFSIZE ); + hb_fsSeekLarge( ft_text->handles[ ft_text->area ], fpRead, FS_SET ); + ReadLen = hb_fsRead( ft_text->handles[ ft_text->area ], ReadBuff, BUFFSIZE ); fpRead += ReadLen; } @@ -1064,23 +1010,22 @@ static int _ins_buff( HB_ISIZ iLen ) } /* store length in bytes, set EOF marker for DOS */ - lastbyte[ area ] = hb_fsSeekLarge( handles[ area ], fpWrite, FS_SET ); - hb_fsWrite( handles[ area ], WriteBuff, 0 ); + ft_text->lastbyte[ ft_text->area ] = hb_fsSeekLarge( ft_text->handles[ ft_text->area ], fpWrite, FS_SET ); + hb_fsWrite( ft_text->handles[ ft_text->area ], WriteBuff, 0 ); /* clear last_rec so next gobot will recount the records */ - last_rec[ area ] = 0L; - hb_fsSeekLarge( handles[ area ], offset[ area ], FS_SET ); + ft_text->last_rec[ ft_text->area ] = 0L; + hb_fsSeekLarge( ft_text->handles[ ft_text->area ], ft_text->offset[ ft_text->area ], FS_SET ); hb_xfree( ReadBuff ); hb_xfree( WriteBuff ); - return error[ area ]; + return ft_text->error[ ft_text->area ]; } -/* _ins_buff */ /*--------------------------------------------------------------------------*/ /* deletes xxx bytes from the current file, beginning at the current record */ -static int _del_buff( HB_ISIZ iLen ) +static int _del_buff( PFT_TEXT ft_text, HB_ISIZ iLen ) { char * WriteBuff = ( char * ) hb_xgrab( BUFFSIZE ); HB_FOFFSET fpRead, fpWrite; @@ -1088,21 +1033,21 @@ static int _del_buff( HB_ISIZ iLen ) HB_ISIZ SaveLen; /* initialize file pointers */ - fpWrite = offset[ area ]; - fpRead = offset[ area ] + iLen; + fpWrite = ft_text->offset[ ft_text->area ]; + fpRead = ft_text->offset[ ft_text->area ] + iLen; /* do initial load of buffer */ - hb_fsSeekLarge( handles[ area ], fpRead, FS_SET ); - WriteLen = hb_fsRead( handles[ area ], WriteBuff, BUFFSIZE ); - fpRead += WriteLen; + hb_fsSeekLarge( ft_text->handles[ ft_text->area ], fpRead, FS_SET ); + WriteLen = hb_fsRead( ft_text->handles[ ft_text->area ], WriteBuff, BUFFSIZE ); + fpRead += WriteLen; - error[ area ] = 0; + ft_text->error[ ft_text->area ] = 0; while( WriteLen > 0 ) { /* position to beginning of write area */ - hb_fsSeekLarge( handles[ area ], fpWrite, FS_SET ); - SaveLen = hb_fsWriteLarge( handles[ area ], WriteBuff, WriteLen ); + hb_fsSeekLarge( ft_text->handles[ ft_text->area ], fpWrite, FS_SET ); + SaveLen = hb_fsWriteLarge( ft_text->handles[ ft_text->area ], WriteBuff, WriteLen ); /* move write pointer */ fpWrite += SaveLen; @@ -1110,46 +1055,45 @@ static int _del_buff( HB_ISIZ iLen ) if( SaveLen != WriteLen ) { /* error, fetch errcode and quit */ - error[ area ] = hb_fsError(); + ft_text->error[ ft_text->area ] = hb_fsError(); break; } /* return to read area and read another buffer */ - hb_fsSeekLarge( handles[ area ], fpRead, FS_SET ); - WriteLen = hb_fsRead( handles[ area ], WriteBuff, BUFFSIZE ); + hb_fsSeekLarge( ft_text->handles[ ft_text->area ], fpRead, FS_SET ); + WriteLen = hb_fsRead( ft_text->handles[ ft_text->area ], WriteBuff, BUFFSIZE ); fpRead += WriteLen; } /* store length in bytes, set EOF marker for DOS */ - lastbyte[ area ] = hb_fsSeekLarge( handles[ area ], fpWrite, FS_SET ); - hb_fsWrite( handles[ area ], WriteBuff, 0 ); + ft_text->lastbyte[ ft_text->area ] = hb_fsSeekLarge( ft_text->handles[ ft_text->area ], fpWrite, FS_SET ); + hb_fsWrite( ft_text->handles[ ft_text->area ], WriteBuff, 0 ); /* clear last_rec so next gobot will recount the records */ - last_rec[ area ] = 0L; - hb_fsSeekLarge( handles[ area ], offset[ area ], FS_SET ); + ft_text->last_rec[ ft_text->area ] = 0L; + hb_fsSeekLarge( ft_text->handles[ ft_text->area ], ft_text->offset[ ft_text->area ], FS_SET ); hb_xfree( WriteBuff ); - return error[ area ]; + return ft_text->error[ ft_text->area ]; } -/* _del_buff */ /*--------------------------------------------------------------------------*/ /* writes a line of data to the file, including the terminating CRLF */ -static int _writeLine( const char * theData, HB_SIZE iDataLen ) +static int _writeLine( PFT_TEXT ft_text, const char * theData, HB_SIZE iDataLen ) { int err = 0; - if( ! ( hb_fsWriteLarge( handles[ area ], theData, iDataLen ) == iDataLen ) ) + if( !( hb_fsWriteLarge( ft_text->handles[ ft_text->area ], theData, iDataLen ) == iDataLen ) ) { - err = 1; - error[ area ] = hb_fsError(); + err = 1; + ft_text->error[ ft_text->area ] = hb_fsError(); } else - if( ! _writeeol( handles[ area ] ) ) + if( ! _writeeol( ft_text->handles[ ft_text->area ] ) ) { - err = 1; - error[ area ] = hb_fsError(); + err = 1; + ft_text->error[ ft_text->area ] = hb_fsError(); } return err; } @@ -1161,5 +1105,3 @@ static HB_BOOL _writeeol( HB_FHANDLE fhnd ) return hb_fsWriteLarge( fhnd, crlf, len ) == len; } - -/* eof */ diff --git a/harbour/contrib/hbnf/menutonf.prg b/harbour/contrib/hbnf/menutonf.prg index f937356059..cae90af884 100644 --- a/harbour/contrib/hbnf/menutonf.prg +++ b/harbour/contrib/hbnf/menutonf.prg @@ -356,7 +356,7 @@ FUNCTION FT_MenuTo( bGetSet, cReadVar, lCold ) CASE ( nScan := AScan( t_aTriggerInkey[ nMenu ], nKey ) ) > 0 nActive := nScan IF ! lCold - FT_PutKey( K_ENTER ) + hb_keyPut( K_ENTER ) ENDIF ENDCASE diff --git a/harbour/contrib/hbnf/tests/dfile.prg b/harbour/contrib/hbnf/tests/dfile.prg index 34fba732a0..0ca0048786 100644 --- a/harbour/contrib/hbnf/tests/dfile.prg +++ b/harbour/contrib/hbnf/tests/dfile.prg @@ -6,7 +6,7 @@ PROCEDURE Main() - LOCAL cInFile := "dfile.prg" + LOCAL cInFile := __FILE__ LOCAL CKEY LOCAL NNCOLOR := 7 LOCAL NHCOLOR := 15 diff --git a/harbour/contrib/hbnf/tests/fttext.prg b/harbour/contrib/hbnf/tests/fttext.prg new file mode 100644 index 0000000000..30ea16ca50 --- /dev/null +++ b/harbour/contrib/hbnf/tests/fttext.prg @@ -0,0 +1,44 @@ +/* + * $Id$ + */ + +#require "hbnf" + +PROCEDURE Main() + + // open a text file here + IF ft_fuse( __FILE__, 0 ) > 1 + + DO WHILE ! ft_fEof() + ? "line " + Str( ft_frecno(), 2 ) + " " + ft_freadln() + ft_fskip( 1 ) + ENDDO + ? + my_goto( 18 ) + my_goto( 2 ) + + ft_fgobot() + ? + ? "after ft_fgobot() now in line # " + hb_ntos( ft_frecno() ) + + ft_fgotop() + ? + ? "after ft_fgotop() now in line # " + hb_ntos( ft_frecno() ) + + ? + ? "ft_flastre() = " + hb_ntos( ft_flastre() ) + + // close the file + ft_fuse() + ENDIF + + RETURN + +STATIC PROCEDURE my_goto( n_go ) + + ft_fgoto( n_go ) + ? + ? "after ft_fgoto(" + hb_ntos( n_go ) + ")" + ? "line " + hb_ntos( ft_frecno() ) + " is " + LTrim( ft_freadln() ) + + RETURN diff --git a/harbour/contrib/hbpgsql/tests/dbf2pg.prg b/harbour/contrib/hbpgsql/tests/dbf2pg.prg index 878335cdaf..8f4a4883ec 100644 --- a/harbour/contrib/hbpgsql/tests/dbf2pg.prg +++ b/harbour/contrib/hbpgsql/tests/dbf2pg.prg @@ -4,7 +4,7 @@ /* * Harbour Project source code: - * dbf2pg.prg - converts a .dbf file into a Postgres table + * Converts a .dbf file into a Postgres table * * Copyright 2000 Maurilio Longo * (The original file was ported from mysql and changed by Rodrigo Moreno rodrigo_moreno@yahoo.com) diff --git a/harbour/contrib/hbpgsql/tests/test.prg b/harbour/contrib/hbpgsql/tests/test.prg index bdcc267f72..1dbbbfc32a 100644 --- a/harbour/contrib/hbpgsql/tests/test.prg +++ b/harbour/contrib/hbpgsql/tests/test.prg @@ -82,7 +82,7 @@ PROCEDURE main() PQexec( conn, "begin" ) - ? ( x := lo_Import( conn, "test.prg" ) ) + ? ( x := lo_Import( conn, __FILE__ ) ) ? lo_Export( conn, x, "test.new" ) ? lo_Unlink( conn, x ) diff --git a/harbour/contrib/hbtip/tests/upld_ftp.prg b/harbour/contrib/hbtip/tests/upld_ftp.prg index a3cd04158c..3ed2173421 100644 --- a/harbour/contrib/hbtip/tests/upld_ftp.prg +++ b/harbour/contrib/hbtip/tests/upld_ftp.prg @@ -3,7 +3,6 @@ */ /* - * Uploadftp.prg * Send an file or list of files to ftp server */ diff --git a/harbour/contrib/hbwin/tests/testcopy.prg b/harbour/contrib/hbwin/tests/testcopy.prg index e3a7fbcd0f..ba252877ce 100644 --- a/harbour/contrib/hbwin/tests/testcopy.prg +++ b/harbour/contrib/hbwin/tests/testcopy.prg @@ -19,7 +19,7 @@ PROCEDURE Main() LOCAL lAbort LOCAL tmp - ? "0x" + hb_numtohex( WIN_SHFileOperation( NIL, WIN_FO_COPY, { "testcopy.prg", "olesrv1.prg" }, { "testcopy1" },; + ? "0x" + hb_numtohex( WIN_SHFileOperation( NIL, WIN_FO_COPY, { __FILE__, "olesrv1.prg" }, { "testcopy1" },; NIL, @lAbort,; NIL, "Harbour SHFile 1" ) ) ? lAbort @@ -40,7 +40,7 @@ PROCEDURE Main() FErase( "rename1.txt" ) - ? "0x" + hb_numtohex( WIN_SHFileOperation( NIL, WIN_FO_COPY, "testcopy.prg" + Chr( 0 ) + "olesrv1.prg" + Chr( 0 ), "testcopy2",; + ? "0x" + hb_numtohex( WIN_SHFileOperation( NIL, WIN_FO_COPY, __FILE__ + Chr( 0 ) + "olesrv1.prg" + Chr( 0 ), "testcopy2",; NIL, @lAbort,; NIL, "Harbour SHFile 3" ) ) ? lAbort diff --git a/harbour/contrib/hbwin/tests/testmapi.prg b/harbour/contrib/hbwin/tests/testmapi.prg index 4afde957c0..8c41152fbf 100644 --- a/harbour/contrib/hbwin/tests/testmapi.prg +++ b/harbour/contrib/hbwin/tests/testmapi.prg @@ -14,7 +14,7 @@ PROCEDURE Main() LOCAL lFromUser := .T. LOCAL aSender := { "test from", "from@test.com" } LOCAL aDest := { { "test to", "to@test.com", WIN_MAPI_TO } } - LOCAL aFiles := { { "testmapi.prg", "testmapi" } } + LOCAL aFiles := { { __FILE__, "testmapi" } } ? win_MAPISendMail( cSubject, ; // subject cBody, ; // menssage @@ -39,7 +39,7 @@ PROCEDURE Main() lFromUser, ; // user intervention "from@test.com", ; // sender { "to@test.com" }, ; // destinators - { "testmapi.prg" } ; // attach + { __FILE__ } ; // attach ) RETURN diff --git a/harbour/contrib/xhb/tests/testcp.prg b/harbour/contrib/xhb/tests/testcp.prg index f922d1273e..d10b39c3a8 100644 --- a/harbour/contrib/xhb/tests/testcp.prg +++ b/harbour/contrib/xhb/tests/testcp.prg @@ -6,6 +6,6 @@ PROCEDURE Main() - XHB_COPYFILE( "testcp.prg", "testcp.bak", {| x | QOut( x ) } ) + XHB_COPYFILE( __FILE__, "testcp.bak", {| x | QOut( x ) } ) RETURN diff --git a/harbour/contrib/xhb/xhbtedit.prg b/harbour/contrib/xhb/xhbtedit.prg index 798f0167cc..1fb9a0b56c 100644 --- a/harbour/contrib/xhb/xhbtedit.prg +++ b/harbour/contrib/xhb/xhbtedit.prg @@ -63,7 +63,7 @@ /* * - * Teditor Fix: teditorx.prg -- V 3.0beta 2004/04/17 + * Teditor Fix: v3.0beta 2004/04/17 * Copyright 2004 Giancarlo Niccolai * * Minimal revision for proper working (expecially with word warping). @@ -75,7 +75,7 @@ */ /* - * Teditor Fix: teditorx.prg -- v2.0 2003-11-17 + * Teditor Fix: v2.0 2003-11-17 * Copyright 2003 Lance Owens * * This Revised Version has a completely rewritten edit method key commands, with dynamic line & paragraph reformatting. @@ -459,7 +459,7 @@ METHOD RefreshWindow() CLASS XHBEditor FOR i := 0 TO Min( ::nNumRows - 1, ::LastRow() - 1 ) // 2006/JUL/23 - E.F. Adjusted to avoid out of bound. - // Don't replace ::GetLine(nRow) by ::aText[nRow]:cText here, + // Don't replace ::GetLine( nRow ) by ::aText[ nRow ]:cText here, // because getline return line number in tbrwtext.prg (debug). hb_DispOutAt( Min( ::nTop + i,::nBottom ), ::nLeft, ; PadR( iif( ::nFirstRow + i <= ::LastRow(), SubStr( ::GetLine( ::nFirstRow + i ), ::nFirstCol, ::nNumCols ), Space(::nNumCols ) ), ::nNumCols ), ; @@ -530,7 +530,7 @@ METHOD RefreshLine( lRefreshColSel ) CLASS XHBEditor DispBegin() // 2006/AUG/02 - E.F. - // Don't replace ::GetLine(nRow) by ::aText[nRow]:cText here + // Don't replace ::GetLine( nRow ) by ::aText[ nRow ]:cText here // because getline return line number in tbrwtext.prg (debug). hb_DispOutAt( ::Row(), ::nLeft, PadR( SubStr( ::GetLine( ::nRow ), ::nFirstCol, ::nNumCols ), ::nNumCols, " " ), ::LineColor( ::nRow ) ) @@ -573,7 +573,7 @@ METHOD RefreshColumn() CLASS XHBEditor DispBegin() // 2006/AUG/02 - E.F. - // Don't replace ::GetLine(nRow) by ::aText[nRow]:cText here + // Don't replace ::GetLine( nRow ) by ::aText[ nRow ]:cText here // because getline return line number in tbrwtext.prg (debug). FOR i := 0 TO Min( ::nNumRows - 1, ::LastRow() - 1 ) hb_DispOutAt( ::nTop + i, nOCol, SubStr( ::GetLine(::nFirstRow + i ), ::nCol, 1 ), ::LineColor( ::nFirstRow + i ) ) diff --git a/harbour/extras/gtwvw/tests/cbtest1.prg b/harbour/extras/gtwvw/tests/cbtest1.prg index 0fec8af9da..3785b940ed 100644 --- a/harbour/extras/gtwvw/tests/cbtest1.prg +++ b/harbour/extras/gtwvw/tests/cbtest1.prg @@ -58,7 +58,7 @@ PROCEDURE Main() CBhandler( nWinNum, nId, nEvent, nIndex, nPBid ) } ) nPBid := wvw_pbCreate( NIL, 4, 1 + nMaxWidth + 1, 4, 1 + nMaxWidth + 1 + 10 - 1, "OK", NIL, ; - {|| __Keyboard( _SECRET_KEY ) }, { 0, 0, + 2, 0 } ) + {|| hb_keyPut( _SECRET_KEY ) }, { 0, 0, + 2, 0 } ) wvw_cbSetFocus( NIL, nCBid ) @@ -69,7 +69,7 @@ PROCEDURE Main() DO CASE CASE ch == K_TAB .OR. ch == K_ENTER IF nPos == 2 .AND. ch == K_ENTER .AND. wvw_pbEnable( NIL, nPBid ) - KEYBOARD( _SECRET_KEY ) + hb_keyPut( _SECRET_KEY ) LOOP ELSE nPos++ diff --git a/harbour/extras/gtwvw/tests/cbtest6.prg b/harbour/extras/gtwvw/tests/cbtest6.prg index 8a1a9c6f4b..c67131c9a6 100644 --- a/harbour/extras/gtwvw/tests/cbtest6.prg +++ b/harbour/extras/gtwvw/tests/cbtest6.prg @@ -170,7 +170,7 @@ FUNCTION CBhandler( nWinNum, nId, nEvent, nIndex, cVar, GetList ) SetWinFocus( nWinNum ) MSetPos( GetList[i]:row, GetList[i]:col + 1 ) - KEYBOARD( K_LBUTTONDOWN ) + hb_keyPut( K_LBUTTONDOWN ) ENDIF //oGet:HasFocus ELSE //i==0 diff --git a/harbour/extras/gtwvw/tests/inpfocus.prg b/harbour/extras/gtwvw/tests/inpfocus.prg index e1a6eed13f..a39cc0ec4a 100644 --- a/harbour/extras/gtwvw/tests/inpfocus.prg +++ b/harbour/extras/gtwvw/tests/inpfocus.prg @@ -195,7 +195,7 @@ STATIC FUNCTION CloseLastWindow() LOCAL nWinNum := wvw_nNumWindows() - 1 wvw_nSetCurWindow( nWinNum ) - __Keyboard( K_ESC ) + hb_keyPut( K_ESC ) RETURN NIL @@ -215,7 +215,7 @@ STATIC FUNCTION typing( ch ) IF ch == K_ENTER ?? Chr( 10 ) ELSEIF ch == K_BS - ?? " " + Chr( K_BS ) + ?? " " + Chr( 8 ) ENDIF ENDIF diff --git a/harbour/extras/gtwvw/tests/wvwmouse.prg b/harbour/extras/gtwvw/tests/wvwmouse.prg index 6930edffe9..987d1118c3 100644 --- a/harbour/extras/gtwvw/tests/wvwmouse.prg +++ b/harbour/extras/gtwvw/tests/wvwmouse.prg @@ -573,7 +573,7 @@ STATIC PROCEDURE xKeyRepeater( lInit ) // mouse is down long enough since last valid check // let's repeat it - __Keyboard( K_LBUTTONDOWN ) + hb_keyPut( K_LBUTTONDOWN ) // to be more precise s_nLastValidCheck := Seconds() //nNow diff --git a/harbour/extras/gtwvw/tests/wvwtest9.prg b/harbour/extras/gtwvw/tests/wvwtest9.prg index ea67dbc67d..1e867f9bee 100644 --- a/harbour/extras/gtwvw/tests/wvwtest9.prg +++ b/harbour/extras/gtwvw/tests/wvwtest9.prg @@ -283,7 +283,7 @@ PROCEDURE Main() @ MaxRow() - 1, 0 SAY "This is line " + hb_ntos( MaxRow() - 1 ) @ MaxRow(), 0 SAY "This is line " + hb_ntos( MaxRow() ) - DO WHILE !( ( ch := Inkey(0 ) ) == K_ESC ) + DO WHILE ( ch := Inkey( 0 ) ) != K_ESC // experiment with different paintrefresh interval: #if 0 DO CASE @@ -385,7 +385,7 @@ PROCEDURE Demo_Console( nTop, nLeft, nBottom, nRight ) ? DO WHILE Inkey() != 0; ENDDO //clear typeahead ch := Inkey( 0 ) - DO WHILE !( ch == K_ESC ) + DO WHILE ch != K_ESC IF ch == K_ENTER ?? hb_keyChar( ch ) + Chr( 10 ) IF lEchoing @@ -415,10 +415,10 @@ PROCEDURE Demo_Console( nTop, nLeft, nBottom, nRight ) //*********** end typewriter mode *************** -// epilogue + // epilogue WVW_lCloseWindow() -// restore state + // restore state wvwm_ResetMouseObjects( nCurWindow ) ResetMiscObjects( nCurWindow ) SetCursor( nCursor ) @@ -727,8 +727,8 @@ FUNCTION HXBscroller( oBrowse, nWinNum, XBid, XBmsg ) LOCAL nOldWin LOCAL lNeedStabilize -//if we can't handle non topmost window we must return right away -//if nWinNum != wvw_nNumWindows()-1 ; return ; endif + //if we can't handle non topmost window we must return right away + //if nWinNum != wvw_nNumWindows()-1 ; return ; endif nOldWin := wvw_nSetCurWindow( nWinNum ) diff --git a/harbour/tests/ac_test.prg b/harbour/tests/ac_test.prg index 4cfe94479a..8ce960a2bc 100644 --- a/harbour/tests/ac_test.prg +++ b/harbour/tests/ac_test.prg @@ -4,8 +4,6 @@ //+==================================================================== //+ -//+ Source Module => ac_test.prg -//+ //+ Released to Public Domain. //+ //+ Functions: Procedure test() diff --git a/harbour/tests/db_brows.prg b/harbour/tests/db_brows.prg index f81b522896..7730fa34b9 100644 --- a/harbour/tests/db_brows.prg +++ b/harbour/tests/db_brows.prg @@ -9,8 +9,6 @@ //+ //+ Placed in the public domain //+ -//+ Source Module => db_brows.prg -//+ //+ Functions: PROCEDURE Main() //+ Function DBFLIST() //+ Function DBFLIST() diff --git a/harbour/tests/sbartest.prg b/harbour/tests/sbartest.prg index d07bf6faea..036cbd108a 100644 --- a/harbour/tests/sbartest.prg +++ b/harbour/tests/sbartest.prg @@ -73,7 +73,7 @@ FUNCTION InitScrlBar() // function used to update scrollbar -FUNCTION updateFilesScroll( modo ) +STATIC FUNCTION updateFilesScroll( modo ) LOCAL newPos, valRet := AC_CONT // Default to continue LOCAL ultTecla := LastKey() diff --git a/harbour/tests/stripem.prg b/harbour/tests/stripem.prg index e461f04daf..ad82d5d9d5 100644 --- a/harbour/tests/stripem.prg +++ b/harbour/tests/stripem.prg @@ -30,7 +30,7 @@ PROCEDURE Main( cFrom, cTo ) LOCAL oTo LOCAL cOut - cFrom := Default( cFrom, "strip.prg" ) + cFrom := Default( cFrom, __FILE__ ) cTo := Default( cTo, "strip.out" ) oFrom := TTextFile() diff --git a/harbour/tests/testhtml.prg b/harbour/tests/testhtml.prg index f80655a227..f5cf7e8933 100644 --- a/harbour/tests/testhtml.prg +++ b/harbour/tests/testhtml.prg @@ -4,7 +4,6 @@ /* * -* testhtml.prg * Harbour Test of a HTML-Generator class. * * Tips: - Use ShowResults to make dynamic html (to test dynamic