2008-08-20 23:06 UTC+0200 Viktor Szakats (harbour.01 syenar hu)

* contrib/mtpl_b32.mak
   * contrib/mtpl_gcc.mak
   * contrib/mtpl_vc.mak
     ! Added -km switch to contribs by default.
       This way it's synced with the GNU-make system, too.

   * utils/hbdoc/hbdocdef.ch
   * utils/hbdoc/fclass1.prg
   * utils/hbdoc/ffile1.prg
   * utils/hbdoc/ft_funcs.prg
   * utils/hbmake/hbdocdef.ch
   * utils/hbmake/fclass1.prg
   * utils/hbmake/ffile1.prg
   * utils/hbmake/ft_funcs.prg
     * Cleanups, optimizations (in ft_funcs.prg)
     ! Synced these for common files to be completely 
       identical. In fact this is a fix, as their name 
       is common so they were "randomly" interchanged 
       along the non-GNU build process even before.
       There was only one very small functional difference, 
       though.
     ; Please test.
This commit is contained in:
Viktor Szakats
2008-08-20 21:09:16 +00:00
parent 6293d45a2c
commit ba2734dab9
12 changed files with 212 additions and 449 deletions

View File

@@ -8,6 +8,30 @@
2008-12-31 13:59 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2008-08-20 23:06 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* contrib/mtpl_b32.mak
* contrib/mtpl_gcc.mak
* contrib/mtpl_vc.mak
! Added -km switch to contribs by default.
This way it's synced with the GNU-make system, too.
* utils/hbdoc/hbdocdef.ch
* utils/hbdoc/fclass1.prg
* utils/hbdoc/ffile1.prg
* utils/hbdoc/ft_funcs.prg
* utils/hbmake/hbdocdef.ch
* utils/hbmake/fclass1.prg
* utils/hbmake/ffile1.prg
* utils/hbmake/ft_funcs.prg
* Cleanups, optimizations (in ft_funcs.prg)
! Synced these for common files to be completely
identical. In fact this is a fix, as their name
is common so they were "randomly" interchanged
along the non-GNU build process even before.
There was only one very small functional difference,
though.
; Please test.
2008-08-20 19:07 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* source/debug/dbgentry.c
! HB_DBG_*() -> __DBG*().

View File

@@ -140,7 +140,7 @@ CFLAGS = -I$(INCLUDE_DIR) $(C_USR) $(CFLAGS) $(HB_BUILD_MODE)
#**********************************************************
CLIBFLAGS = -c -q -d -w -w-sig- $(CFLAGS) $(CLIBFLAGS)
HARBOURFLAGS = -i$(INCLUDE_DIR) -n -q0 -w3 -es2 -gc0 $(PRG_USR) $(HARBOURFLAGS)
HARBOURFLAGS = -i$(INCLUDE_DIR) -n -q0 -w3 -es2 -gc0 -km $(PRG_USR) $(HARBOURFLAGS)
LDFLAGS = $(LDFLAGS)
#**********************************************************

View File

@@ -128,7 +128,7 @@ endif
CFLAGS := -W -Wall -I$(INCLUDE_DIR) $(C_USR) $(CFLAGS) -I$(OBJ_DIR)
CLIBFLAGS := -c $(CFLAGS) $(CLIBFLAGS)
HARBOURFLAGS := -i$(INCLUDE_DIR) -n -q0 -w3 -es2 -gc0 $(PRG_USR) $(HARBOURFLAGS)
HARBOURFLAGS := -i$(INCLUDE_DIR) -n -q0 -w3 -es2 -gc0 -km $(PRG_USR) $(HARBOURFLAGS)
LDFLAGS := $(LDFLAGS)
#**********************************************************

View File

@@ -140,7 +140,7 @@ CFLAGS = -MT$(DBGMARKER) $(CFLAGS)
#**********************************************************
CLIBFLAGS = -c $(CFLAGS) $(CLIBFLAGS)
HARBOURFLAGS = -i$(INCLUDE_DIR) -n -q0 -w3 -es2 -gc0 $(PRG_USR) $(HARBOURFLAGS)
HARBOURFLAGS = -i$(INCLUDE_DIR) -n -q0 -w3 -es2 -gc0 -km $(PRG_USR) $(HARBOURFLAGS)
LDFLAGS = $(LDFLAGS)
#**********************************************************

View File

@@ -102,7 +102,7 @@ METHOD new() CLASS FileMan
::nLastDosMessage := 0
ENDIF
RETURN ( self )
RETURN self
// The following are global operations that need to be performed by all
// files regardless of their format
@@ -123,7 +123,7 @@ METHOD closeAll() CLASS FileMan
AEVAL( ::aDosHandles, { | aFile | FCLOSE( aFile[ pDOS_HANDLE ] ) } )
ENDIF
RETURN ( self )
RETURN self
/* Method: ::rewindAll()
Params: N/A
@@ -141,7 +141,7 @@ METHOD rewindAll() CLASS FileMan
AEVAL( ::aDosHandles, { | aFile | FSEEK( aFile[ pDOS_HANDLE ], 0, 0 ) } )
ENDIF
RETURN ( self )
RETURN self
/* Method: ::writeAll()
Params: N/A
@@ -158,7 +158,7 @@ METHOD writeAll() CLASS FileMan
AEVAL( ::aDosHandles, { | aFile | FWRITE( aFile[ pDOS_HANDLE ], "", 0 ) } )
ENDIF
RETURN ( self )
RETURN self
/* Method: ::getFileName( <nId> )
Params: <nId> DOS File handle / ID
@@ -181,7 +181,7 @@ METHOD getFileName( nId ) CLASS FileMan // Obtains the name
ENDIF
ENDIF
RETURN ( cName )
RETURN cName
/* Method: ::getFileId( <cName> )
Params: <cName> File names used to store item to stack
@@ -204,7 +204,7 @@ METHOD getFileId( cName ) CLASS FileMan // Obtains the ID ba
ENDIF
ENDIF
RETURN ( nId )
RETURN nId
/* Method: ::getFilePath( <xItem> )
Params: <xItem> DOS File handle / ID or stored file name
@@ -238,7 +238,7 @@ METHOD getFilePath( xItem ) CLASS FileMan // Obtains file path
ENDCASE
ENDIF
RETURN ( cPath )
RETURN cPath
// The following two methods are for the sole purpose of manipulating the
// array of DOS file handles
@@ -262,7 +262,7 @@ METHOD addItem( nDos, cFile, cPath ) CLASS FileMan
AADD( ::aDosHandles, { nDos, cFile, cPath } )
ENDIF
RETURN ( self )
RETURN self
/* Method: ::delItem( <xItem> )
Params: <xItem> DOS file handle or file name
@@ -323,7 +323,7 @@ METHOD delItem( xItem ) CLASS FileMan
ENDIF
RETURN ( lSuccess )
RETURN lSuccess
/* Method: noDosError()
Params: N/A
@@ -363,4 +363,4 @@ METHOD openfile( cFile, nMethod ) CLASS FileMan
::addItem( nFileHandle, cFileName, cPath )
ENDIF
::nHan := nFileHandle
RETURN ( nFileHandle )
RETURN nFileHandle

View File

@@ -51,7 +51,10 @@
*/
#include "hbclass.ch"
#include "common.ch"
#include "fileio.ch"
#include "hbdocdef.ch"
*+--------------------------------------------------------------------
@@ -106,7 +109,7 @@ METHOD new( cName ) CLASS FileBase
// first thing to do is check to see if there is a valid file
::nSkipLength := 1
::nOpenMode := 2 // Mode for which to open the file
::nOpenMode := FO_READWRITE // Mode for which to open the file
::nCreateMode := 0 // Mode for which to create the file
::cName := cName

View File

@@ -49,253 +49,118 @@
* If you do not wish that, delete this exception notice.
*
*/
#include "common.ch"
#include "directry.ch"
#include "fileio.ch"
#include "inkey.ch"
#include "hbdocdef.ch"
#include "common.ch"
#define xReadBuffer 4096
DECLARE FT_FUSE(CFILE AS STRING,NMODE AS NUMERIC) AS NUMERIC
DECLARE ft_FEOF() AS LOGICAL
DECLARE FReadLn( cLine ) AS STRING
DECLARE FT_FReadLn() AS STRING
DECLARE FT_FGotop() //AS USUAL
DECLARE FT_FSKIP(n AS NUMERIC) //AS USUAL
DECLARE FT_MKDIR( CDIR AS STRING ) //AS USUAL
DECLARE StrPos( cBuffer AS STRING ) AS NUMERIC
DECLARE GetNumberofTableItems( cBuffer AS STRING ) AS NUMERIC
DECLARE FREADline( nH AS NUMERIC, @cB AS STRING, nMaxLine AS NUMERIC )
//DECLARE FILEBASE() AS OBJECT
DECLARE FILEBASE ;
New( cname AS STRING) AS CLASS FILEBASE;
FOPEN() AS OBJECT;
closefile() AS OBJECT;
fskip( OPTIONAL n AS NUMERIC) AS OBJECT;
FWRITE( c AS STRING) AS OBJECT;
retrieve() AS STRING;
fgoTop() AS OBJECT;
fgoBottom() AS OBJECT;
fgoto() AS NUMERIC;
create() AS OBJECT;
fappendByte( cByte ) AS OBJECT;
BuffGet METHOD BufferGet( OPTIONAL lDirection AS LOGICAL ) AS NUMERIC;
SKIP( OPTIONAL nRecord AS NUMERIC ) AS OBJECT;
WRITE( cChar AS STRING ) AS OBJECT;
goTop() AS OBJECT;
goBottom() AS OBJECT;
GOTO( OPTIONAL nValue AS NUMERIC) AS NUMERIC;
OPEN() AS OBJECT;
append(OPTIONAL cline AS STRING) AS OBJECT
STATIC s_TheHandle
STATIC TheHandle As Object
/****
* FT_FUSE(cFile,nMode) ---> nHandle
* FT_FUSE( cFile, nMode ) ---> nHandle
* Open a File
*/
FUNCTION FT_FUSE( cFile, nMode )
*+--------------------------------------------------------------------
*+
*+ Function FT_FUSE()
*+
*+--------------------------------------------------------------------
*+
FUNCTION FT_FUSE( cFile AS STRING, nMode AS NUMERIC)
Local nHandle as numeric
IF nMode == nil
nMode := 2
ENDIF
IF cFile == Nil
theHandle:closefile()
ENDIF
IF cFile != Nil
IF nMode != 0
theHandle := FileBase():new( cFile ):open()
ELSE
theHandle := FileBase():new( cFile ):open()
DEFAULT cFile TO s_TheHandle:closefile()
IF cFile != NIL
s_TheHandle := FileBase():new( cFile )
IF nMode != NIL
s_TheHandle:nOpenMode := nMode
ENDIF
s_TheHandle:open()
ENDIF
nHandle:= theHandle:nHan
RETURN nHandle
*+--------------------------------------------------------------------
*+
*+ Function ft_FEOF()
*+
*+ Called from ( hbdoc.prg ) 1 - function readln()
*+
*+--------------------------------------------------------------------
*+
RETURN s_TheHandle:nHan
FUNCTION ft_FEOF()
LOCAL lRETURN as LOGICAL := theHandle:lAtBottom
RETURN lRETURN
RETURN s_TheHandle:lAtBottom
*+--------------------------------------------------------------------
*+
*+ Function FReadLn()
*+
*+ Called from ( ft_funcs.prg ) 1 - function ft_freadln()
*+
*+--------------------------------------------------------------------
*+
FUNCTION FReadLn( cLine AS STRING)
FUNCTION FReadLn()
RETURN s_TheHandle:retrieve()
cLine := theHandle:retrieve()
RETURN cLine
*+--------------------------------------------------------------------
*+
*+ Function FT_FReadLn()
*+
*+ Called from ( hbdoc.prg ) 1 - function readln()
*+
*+--------------------------------------------------------------------
*+
FUNCTION FT_FReadLn()
RETURN StrTran( FReadLn(), Chr( 13 ), "" )
LOCAL cBuffer AS STRING := ""
PROCEDURE FT_FGotop()
s_TheHandle:Gotop()
RETURN
cBuffer := FReadLn( @cBuffer )
PROCEDURE FT_FSKIP( n )
s_TheHandle:Skip( n )
RETURN
cBuffer := STRTRAN( cBuffer, CHR( 13 ), "" )
RETURN cBuffer
*+--------------------------------------------------------------------
*+
*+ Function FT_FGotop()
*+
*+ Called from ( genng.prg ) 1 - static function readfromtop()
*+ ( genrtf.prg ) 1 - static function readfromtop()
*+
*+--------------------------------------------------------------------
*+
FUNCTION FT_FGotop()
theHandle:Gotop()
RETURN NIL
*+--------------------------------------------------------------------
*+
*+ Function FT_FSKIP()
*+
*+--------------------------------------------------------------------
*+
FUNCTION FT_FSKIP( n AS NUMERIC)
TheHandle:Skip( n )
RETURN nil
*+--------------------------------------------------------------------
*+
*+ Function FT_MKDIR()
*+
*+ Called from ( hbdoc.prg ) 6 - function main()
*+
*+--------------------------------------------------------------------
*+
FUNCTION FT_MKDIR( CDIR AS STRING)
PROCEDURE FT_MKDIR( cDir )
#ifdef HB_COMPAT_C53
MAKEDIR( cdir )
MakeDir( cDir )
#else
HB_SYMBOL_UNUSED( cDir ) // TOFIX
#endif
RETURN nil
RETURN
*+--------------------------------------------------------------------
*+
*+ Function StrPos()
*+
*+ Called from ( genhtm1.prg ) 1 - function prochtmtable()
*+ ( genhtm2.prg ) 1 - function prochtmtable()
*+
*+--------------------------------------------------------------------
*+
FUNCTION StrPos( cBuffer AS STRING)
FUNCTION StrPos( cBuffer )
LOCAL x
LOCAL cChar
LOCAL nPos AS NUMERIC :=0
LOCAL x AS NUMERIC
LOCAL cChar AS STRING
FOR x := 1 TO LEN( cBuffer )
cChar := SUBSTR( cBuffer, x, 1 )
IF cChar >= CHR( 64 ) .AND. cChar <= CHR( 90 ) .OR. cChar >= CHR( 97 ) ;
.AND. cChar <= CHR( 122 ) .OR. cChar >= CHR( 48 ) .AND. cChar <= CHR( 57 ) ;
.OR. cChar == CHR( 60 ) .OR. cchar == CHR( ASC( "-" ) ) ;
.OR. cchar == CHR( ASC( "(" ) ) .OR. cchar == CHR( ASC( "|" ) ) .OR. ;
cchar == CHR( ASC( "." ) ) .OR. cchar == CHR( ASC( "*" ) ) .OR. ;
cchar == CHR( ASC( "#" ) ) .OR. cchar == CHR( ASC( '"' ) ) .OR. ;
cchar == CHR( ASC( "/" ) ) .OR. cchar == CHR( ASC( "@" ) ) ;
.OR. cchar == CHR( ASC( "=" ) ) .OR. cchar == CHR( ASC( "Ä" ) ) ;
.OR. cchar == CHR( ASC( "?" ) ) .OR. cchar == CHR( ASC( "!" ) ) ;
.OR. cchar == CHR( ASC( "<" ) ) .OR. cchar == CHR( ASC( ">" ) ) ;
.OR. cchar == CHR( ASC( "!" ) ) .OR. cchar == CHR( ASC( "+" ) )
nPos := x
IF cChar >= "A" .AND. cChar <= "Z" .OR. ;
cChar >= "a" .AND. cChar <= "z" .OR. ;
cChar >= "0" .AND. cChar <= "9" .OR. ;
cChar $ "@-(|.*#/=?!<>+" .OR. ;
cChar == '"'
EXIT
RETURN x
ENDIF
NEXT
RETURN nPos
RETURN 0
*+--------------------------------------------------------------------
*+
*+ Function GetNumberofTableItems()
*+
*+ Called from ( genhtm.prg ) 1 - function prochtmdesc()
*+ ( genng.prg ) 1 - function procngdesc()
*+ ( genng1.prg ) 1 - function procngdesc()
*+
*+--------------------------------------------------------------------
*+
FUNCTION GetNumberofTableItems( cBuffer )
LOCAL cItem AS STRING
LOCAL nItem AS NUMERIC := 0
LOCAL cItem
LOCAL nItem := 0
cBuffer := ALLTRIM( cBuffer )
DO WHILE AT( SPACE( 3 ), cBuffer ) > 0
cItem := SUBSTR( cBuffer, 1, AT( SPACE( 3 ), cBuffer ) - 1 )
IF AT( SPACE( 3 ), cBuffer ) == 0
nItem ++
nItem++
ELSE
cBuffer := ALLTRIM( STRTRAN( cBuffer, cItem, "" ) )
nItem ++
nItem++
ENDIF
ENDDO
nItem ++
nItem++
RETURN nItem
#define EOL hb_osnewline()
FUNCTION FREADline( nH, cB, nMaxLine )
*+--------------------------------------------------------------------
*+
*+ Function FREADline()
*+
*+ Called from ( genng.prg ) 1 - static function readfromtop()
*+ ( genrtf.prg ) 1 - static function readfromtop()
*+
*+--------------------------------------------------------------------
*+
FUNCTION FREADline( nH as Numeric, cB AS STRING, nMaxLine as Numeric)
LOCAL cLine := SPACE( nMaxLine )
LOCAL nSavePos
LOCAL nEol
LOCAL nNumRead
LOCAL cLine AS STRING
LOCAL nSavePos AS NUMERIC
LOCAL nEol AS NUMERIC
LOCAL nNumRead AS NUMERIC
LOCAL lReturn as Logical
cLine := SPACE( nMaxLine )
cB := ""
nSavePos := FSEEK( nH, 0, FS_RELATIVE )
nNumRead := FREAD( nH, @cLine, nMaxLine )
IF ( nEol := AT( EOL, SUBSTR( cLine, 1, nNumRead ) ) ) == 0
IF ( nEol := AT( hb_OSNewLine(), SUBSTR( cLine, 1, nNumRead ) ) ) == 0
cB := cLine
ELSE
cB := SUBSTR( cLine, 1, nEol - 1 )
FSEEK( nH, nSavePos + nEol + 1, FS_SET )
ENDIF
lReturn := (nNumRead != 0)
RETURN lReturn
RETURN nNumRead != 0

View File

@@ -90,7 +90,7 @@
#xtranslate DOSFILENAME(<c>) => substr( <c>, rat("\",<c>)+1 )
#xcommand IF <var> IS <type> => if valtype(<var>) = <type>
#xcommand IF <var> IS <type> => if valtype(<var>) == <type>
#xcommand IF <var> IS NOT <type> => if !( valtype(<var>) == <type> )
#xcommand IF <ele> IS IN <array> => if !(len( <array> ) \< <ele> )
#xcommand IF <ele> IS NOT IN <array> => if len( <array> ) \< <ele>

View File

@@ -47,7 +47,7 @@
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
#include "hbclass.ch"
@@ -102,7 +102,7 @@ METHOD new() CLASS FileMan
::nLastDosMessage := 0
ENDIF
RETURN ( self )
RETURN self
// The following are global operations that need to be performed by all
// files regardless of their format
@@ -123,7 +123,7 @@ METHOD closeAll() CLASS FileMan
AEVAL( ::aDosHandles, { | aFile | FCLOSE( aFile[ pDOS_HANDLE ] ) } )
ENDIF
RETURN ( self )
RETURN self
/* Method: ::rewindAll()
Params: N/A
@@ -141,7 +141,7 @@ METHOD rewindAll() CLASS FileMan
AEVAL( ::aDosHandles, { | aFile | FSEEK( aFile[ pDOS_HANDLE ], 0, 0 ) } )
ENDIF
RETURN ( self )
RETURN self
/* Method: ::writeAll()
Params: N/A
@@ -158,7 +158,7 @@ METHOD writeAll() CLASS FileMan
AEVAL( ::aDosHandles, { | aFile | FWRITE( aFile[ pDOS_HANDLE ], "", 0 ) } )
ENDIF
RETURN ( self )
RETURN self
/* Method: ::getFileName( <nId> )
Params: <nId> DOS File handle / ID
@@ -181,7 +181,7 @@ METHOD getFileName( nId ) CLASS FileMan // Obtains the name
ENDIF
ENDIF
RETURN ( cName )
RETURN cName
/* Method: ::getFileId( <cName> )
Params: <cName> File names used to store item to stack
@@ -204,7 +204,7 @@ METHOD getFileId( cName ) CLASS FileMan // Obtains the ID ba
ENDIF
ENDIF
RETURN ( nId )
RETURN nId
/* Method: ::getFilePath( <xItem> )
Params: <xItem> DOS File handle / ID or stored file name
@@ -238,7 +238,7 @@ METHOD getFilePath( xItem ) CLASS FileMan // Obtains file path
ENDCASE
ENDIF
RETURN ( cPath )
RETURN cPath
// The following two methods are for the sole purpose of manipulating the
// array of DOS file handles
@@ -262,7 +262,7 @@ METHOD addItem( nDos, cFile, cPath ) CLASS FileMan
AADD( ::aDosHandles, { nDos, cFile, cPath } )
ENDIF
RETURN ( self )
RETURN self
/* Method: ::delItem( <xItem> )
Params: <xItem> DOS file handle or file name
@@ -323,7 +323,7 @@ METHOD delItem( xItem ) CLASS FileMan
ENDIF
RETURN ( lSuccess )
RETURN lSuccess
/* Method: noDosError()
Params: N/A
@@ -363,4 +363,4 @@ METHOD openfile( cFile, nMethod ) CLASS FileMan
::addItem( nFileHandle, cFileName, cPath )
ENDIF
::nHan := nFileHandle
RETURN ( nFileHandle )
RETURN nFileHandle

View File

@@ -51,16 +51,19 @@
*/
#include "hbclass.ch"
#include "common.ch"
#include "fileio.ch"
#include "hbdocdef.ch"
*+--------------------------------------------------------------------
*+
*+ Class HBMake_FileBase
*+ Class FileBase
*+
*+--------------------------------------------------------------------
*+
CLASS HBMake_FileBase FROM FileMan
CLASS FileBase FROM FileMan
DATA nOpenMode // Holds the value to use when opening the file
DATA nCreateMode // Holds the value to use when creating the file
@@ -100,13 +103,13 @@ ENDCLASS
Returns: Self
Purpose: Constructor
*/
METHOD new( cName ) CLASS HBMake_FileBase
METHOD new( cName ) CLASS FileBase
::super:new()
super:new()
// first thing to do is check to see if there is a valid file
::nSkipLength := 1
::nOpenMode := 2 // Mode for which to open the file
::nOpenMode := FO_READWRITE // Mode for which to open the file
::nCreateMode := 0 // Mode for which to create the file
::cName := cName
@@ -121,7 +124,7 @@ METHOD new( cName ) CLASS HBMake_FileBase
on the value of ::nSkipLength which holds the skipping base.
This class's purpose is to do one byte movements.
*/
METHOD fskip( nRecords ) CLASS HBMake_FileBase
METHOD fskip( nRecords ) CLASS FileBase
DEFAULT nRecords TO 1
@@ -148,7 +151,7 @@ METHOD fskip( nRecords ) CLASS HBMake_FileBase
Returns: Self
Purpose: Move the byte pointer to the top of the file
*/
METHOD fgotop() CLASS HBMake_FileBase
METHOD fgotop() CLASS FileBase
IF ::noDosError() .AND. ::nDosHandle > 0
::nPosition := FSEEK( ::nDosHandle, 0, 0 )
@@ -164,7 +167,7 @@ METHOD fgotop() CLASS HBMake_FileBase
Returns: Self
Purpose: Move hte byte pointer of the file to tbe bottom.
*/
METHOD fgoBottom() CLASS HBMake_FileBase
METHOD fgoBottom() CLASS FileBase
IF ::noDosError() .AND. ::nDosHandle > 0
::nPosition := FSEEK( ::nDosHandle, 0, 2 )
@@ -180,7 +183,7 @@ METHOD fgoBottom() CLASS HBMake_FileBase
Returns: Self
Purpose: To close the file
*/
METHOD closefile() CLASS HBMake_FileBase
METHOD closefile() CLASS FileBase
IF ::noDosError() .AND. ::nDosHandle > 0
FCLOSE( ::nDosHandle )
@@ -198,7 +201,7 @@ METHOD closefile() CLASS HBMake_FileBase
Purpose: To return the contents of the file at the current position based
on the length of ::nSkipLength.
*/
METHOD retrieve() CLASS HBMake_FileBase
METHOD retrieve() CLASS FileBase
LOCAL cReturn // as char
LOCAL nMoved // as int
@@ -218,7 +221,7 @@ METHOD retrieve() CLASS HBMake_FileBase
Purpose: To write out to the contents of the file the value in the
parameter <cChar>.
*/
METHOD FWRITE( cChar ) CLASS HBMake_FileBase
METHOD FWRITE( cChar ) CLASS FileBase
IF ::noDosError() .AND. ::nDosHandle > 0
IF cChar IS pCHARACTER
@@ -239,7 +242,7 @@ METHOD FWRITE( cChar ) CLASS HBMake_FileBase
within the file. It is also based on the value stored to the
::nSkipLength instance variable
*/
METHOD fgoto( nValue ) CLASS HBMake_FileBase
METHOD fgoto( nValue ) CLASS FileBase
IF ::noDosError() .AND. ::nDosHandle > 0
IF nValue IS pNUMERIC
@@ -269,7 +272,7 @@ METHOD fgoto( nValue ) CLASS HBMake_FileBase
Returns: Self
Purpose: Creates the specified file with the proper access code
*/
METHOD Create() CLASS HBMake_FileBase
METHOD Create() CLASS FileBase
LOCAL nFile // as int
@@ -289,7 +292,7 @@ METHOD Create() CLASS HBMake_FileBase
Returns: Self
Purpose: Opens the file with the proper access code
*/
METHOD FOPEN() CLASS HBMake_FileBase
METHOD FOPEN() CLASS FileBase
IF ::noDosError()
::nDosHandle :=::openfile( ::cName, ::nOpenMode )
@@ -301,7 +304,7 @@ METHOD FOPEN() CLASS HBMake_FileBase
RETURN ( self )
METHOD fappendByte( cByte ) CLASS HBMake_FileBase
METHOD fappendByte( cByte ) CLASS FileBase
DEFAULT cByte TO ""
@@ -319,7 +322,7 @@ METHOD fappendByte( cByte ) CLASS HBMake_FileBase
RETURN ( self )
// End of File: FFile1.prg
METHOD OPEN() CLASS HBMake_FileBase
METHOD OPEN() CLASS FileBase
Self:nDosHandle := Self:openfile( ::cName, ::nOpenMode )
::nEndOfFile := FSEEK( Self:nDosHandle, 0, 2 )
@@ -335,7 +338,7 @@ METHOD OPEN() CLASS HBMake_FileBase
Returns: Self
Purpose: Move the byte pointer to the top of the file
*/
METHOD gotop() CLASS HBMake_FileBase
METHOD gotop() CLASS FileBase
IF Self:noDosError() .AND. Self:nDosHandle > 0
::fgotop()
@@ -349,7 +352,7 @@ METHOD gotop() CLASS HBMake_FileBase
Returns: Self
Purpose: Move hte byte pointer of the file to tbe bottom.
*/
METHOD goBottom() CLASS HBMake_FileBase
METHOD goBottom() CLASS FileBase
LOCAL cBuffer // as char
LOCAL lWithCRLF := pFALSE // as logical
@@ -380,10 +383,9 @@ METHOD goBottom() CLASS HBMake_FileBase
Purpose: To close the file
*/
/* Should not any more exist here ... Not sure so I just keep it remed */
/* JFL in all case it is not anymore declared from the Class */
/*
METHOD FCLOSE() CLASS HBMake_FileBase
/* Not declared in class creation, which means the super version is used. */
#ifdef BUG
METHOD FCLOSE() CLASS FileBase
IF Self:noDosError() .AND. Self:nDosHandle > 0
FCLOSE( Self:nDosHandle )
@@ -394,14 +396,15 @@ METHOD FCLOSE() CLASS HBMake_FileBase
ENDIF
RETURN ( self )
*/
#endif
/* Method: write(<cChar>)
Params: <cChar>
Returns: Self
Purpose: To write out to the contents of the file the value in the
parameter <cChar>.
*/
METHOD WRITE( cChar ) CLASS HBMake_FileBase
METHOD WRITE( cChar ) CLASS FileBase
IF Self:noDosError() .AND. Self:nDosHandle > 0
IF cChar IS pCHARACTER
@@ -431,13 +434,9 @@ METHOD WRITE( cChar ) CLASS HBMake_FileBase
(.T.) value.
*/
/* Should not any more exist here ... Not sure so I just keep it remed */
/* JFL in all case it is not anymore declared from the Class */
/*
/*
METHOD Buffget( lForward ) CLASS HBMake_FileBase
/* Class declaration send message BuffGet to BufferGet. */
#ifdef BUG
METHOD Buffget( lForward ) CLASS FileBase
LOCAL cBuffer // as char
LOCAL nLocation // as int
@@ -484,7 +483,8 @@ METHOD Buffget( lForward ) CLASS HBMake_FileBase
ENDIF
RETURN ( nLocation )
*/
#endif
/* Method: appendLine( <cLine )
Params: <cLine> Character line to append
Returns: Self
@@ -492,7 +492,7 @@ METHOD Buffget( lForward ) CLASS HBMake_FileBase
If <cLine> is not passed or if it an empty line with 0 bytes
in length, the function will not operate.
*/
METHOD appendLine( cLine ) CLASS HBMake_FileBase
METHOD appendLine( cLine ) CLASS FileBase
DEFAULT cLine TO ""
@@ -521,7 +521,7 @@ METHOD appendLine( cLine ) CLASS HBMake_FileBase
This class's purpose is to do one byte movements.
*/
METHOD SKIP( nRecords ) CLASS HBMake_FileBase
METHOD SKIP( nRecords ) CLASS FileBase
LOCAL nCount := 0 // as int
@@ -557,7 +557,7 @@ METHOD SKIP( nRecords ) CLASS HBMake_FileBase
within the file. It is also based on the value stored to the
Self:nSkipLength instance variable
*/
METHOD GOTO( nValue ) CLASS HBMake_FileBase
METHOD GOTO( nValue ) CLASS FileBase
LOCAL cLine := "" // as char
LOCAL nCount := 0 // as int
@@ -602,7 +602,7 @@ RETURN ( nCount )
// End of File: FFile2.prg
METHOD BufferGet( lForward ) CLASS HBMake_FileBase
METHOD BufferGet( lForward ) CLASS FileBase
LOCAL cBuffer // as char
LOCAL nLocation // as int

View File

@@ -49,251 +49,118 @@
* If you do not wish that, delete this exception notice.
*
*/
#include "common.ch"
#include "directry.ch"
#include "fileio.ch"
#include "inkey.ch"
#include "hbdocdef.ch"
#include "common.ch"
#define xReadBuffer 4096
DECLARE FT_FUSE(CFILE AS STRING,NMODE AS NUMERIC) AS NUMERIC
DECLARE ft_FEOF() AS LOGICAL
DECLARE FReadLn( cLine ) AS STRING
DECLARE FT_FReadLn() AS STRING
DECLARE FT_FGotop() //AS USUAL
DECLARE FT_FSKIP(n AS NUMERIC) //AS USUAL
DECLARE FT_MKDIR( CDIR AS STRING ) //AS USUAL
DECLARE StrPos( cBuffer AS STRING ) AS NUMERIC
DECLARE GetNumberofTableItems( cBuffer AS STRING ) AS NUMERIC
DECLARE FREADline( nH AS NUMERIC, @cB AS STRING, nMaxLine AS NUMERIC )
//DECLARE HBMAKE_FILEBASE() AS OBJECT
DECLARE HBMAKE_FILEBASE ;
New( cname AS STRING) AS CLASS HBMAKE_FILEBASE;
FOPEN() AS OBJECT;
closefile() AS OBJECT;
fskip( OPTIONAL n AS NUMERIC) AS OBJECT;
FWRITE( c AS STRING) AS OBJECT;
retrieve() AS STRING;
fgoTop() AS OBJECT;
fgoBottom() AS OBJECT;
fgoto() AS NUMERIC;
create() AS OBJECT;
fappendByte( cByte ) AS OBJECT;
BuffGet METHOD BufferGet( OPTIONAL lDirection AS LOGICAL ) AS NUMERIC;
SKIP( OPTIONAL nRecord AS NUMERIC ) AS OBJECT;
WRITE( cChar AS STRING ) AS OBJECT;
goTop() AS OBJECT;
goBottom() AS OBJECT;
GOTO( OPTIONAL nValue AS NUMERIC) AS NUMERIC;
OPEN() AS OBJECT;
append(OPTIONAL cline AS STRING) AS OBJECT
STATIC s_TheHandle
STATIC TheHandle As Object
/****
* FT_FUSE(cFile,nMode) ---> nHandle
* FT_FUSE( cFile, nMode ) ---> nHandle
* Open a File
*/
FUNCTION FT_FUSE( cFile, nMode )
*+--------------------------------------------------------------------
*+
*+ Function FT_FUSE()
*+
*+--------------------------------------------------------------------
*+
FUNCTION FT_FUSE( cFile AS STRING, nMode AS NUMERIC)
Local nHandle as numeric
IF nMode == nil
nMode := 2
ENDIF
IF cFile == Nil
theHandle:closefile()
ENDIF
IF cFile <> Nil
theHandle := HBMake_FileBase():new( cFile )
theHandle:nOpenMode := nMode
theHandle:open()
ENDIF
nHandle:= theHandle:nHan
RETURN nHandle
DEFAULT cFile TO s_TheHandle:closefile()
IF cFile != NIL
s_TheHandle := FileBase():new( cFile )
IF nMode != NIL
s_TheHandle:nOpenMode := nMode
ENDIF
s_TheHandle:open()
ENDIF
RETURN s_TheHandle:nHan
*+--------------------------------------------------------------------
*+
*+ Function ft_FEOF()
*+
*+ Called from ( hbdoc.prg ) 1 - function readln()
*+
*+--------------------------------------------------------------------
*+
FUNCTION ft_FEOF()
LOCAL lRETURN as LOGICAL := theHandle:lAtBottom
RETURN lRETURN
RETURN s_TheHandle:lAtBottom
*+--------------------------------------------------------------------
*+
*+ Function FReadLn()
*+
*+ Called from ( ft_funcs.prg ) 1 - function ft_freadln()
*+
*+--------------------------------------------------------------------
*+
FUNCTION FReadLn( cLine AS STRING)
FUNCTION FReadLn()
RETURN s_TheHandle:retrieve()
cLine := theHandle:retrieve()
RETURN cLine
*+--------------------------------------------------------------------
*+
*+ Function FT_FReadLn()
*+
*+ Called from ( hbdoc.prg ) 1 - function readln()
*+
*+--------------------------------------------------------------------
*+
FUNCTION FT_FReadLn()
RETURN StrTran( FReadLn(), Chr( 13 ), "" )
LOCAL cBuffer AS STRING := ""
PROCEDURE FT_FGotop()
s_TheHandle:Gotop()
RETURN
cBuffer := FReadLn( @cBuffer )
PROCEDURE FT_FSKIP( n )
s_TheHandle:Skip( n )
RETURN
cBuffer := STRTRAN( cBuffer, CHR( 13 ), "" )
RETURN cBuffer
*+--------------------------------------------------------------------
*+
*+ Function FT_FGotop()
*+
*+ Called from ( genng.prg ) 1 - static function readfromtop()
*+ ( genrtf.prg ) 1 - static function readfromtop()
*+
*+--------------------------------------------------------------------
*+
FUNCTION FT_FGotop()
theHandle:Gotop()
RETURN NIL
*+--------------------------------------------------------------------
*+
*+ Function FT_FSKIP()
*+
*+--------------------------------------------------------------------
*+
FUNCTION FT_FSKIP( n AS NUMERIC)
TheHandle:Skip( n )
RETURN nil
*+--------------------------------------------------------------------
*+
*+ Function FT_MKDIR()
*+
*+ Called from ( hbdoc.prg ) 6 - function main()
*+
*+--------------------------------------------------------------------
*+
FUNCTION FT_MKDIR( CDIR AS STRING)
PROCEDURE FT_MKDIR( cDir )
#ifdef HB_COMPAT_C53
MAKEDIR( cdir )
MakeDir( cDir )
#else
HB_SYMBOL_UNUSED( cDir ) // TOFIX
#endif
RETURN nil
RETURN
*+--------------------------------------------------------------------
*+
*+ Function StrPos()
*+
*+ Called from ( genhtm1.prg ) 1 - function prochtmtable()
*+ ( genhtm2.prg ) 1 - function prochtmtable()
*+
*+--------------------------------------------------------------------
*+
FUNCTION StrPos( cBuffer AS STRING)
FUNCTION StrPos( cBuffer )
LOCAL x
LOCAL cChar
LOCAL nPos AS NUMERIC :=0
LOCAL x AS NUMERIC
LOCAL cChar AS STRING
FOR x := 1 TO LEN( cBuffer )
cChar := SUBSTR( cBuffer, x, 1 )
IF cChar >= CHR( 64 ) .AND. cChar <= CHR( 90 ) .OR. cChar >= CHR( 97 ) ;
.AND. cChar <= CHR( 122 ) .OR. cChar >= CHR( 48 ) .AND. cChar <= CHR( 57 ) ;
.OR. cChar == CHR( 60 ) .OR. cchar == CHR( ASC( "-" ) ) ;
.OR. cchar == CHR( ASC( "(" ) ) .OR. cchar == CHR( ASC( "|" ) ) .OR. ;
cchar == CHR( ASC( "." ) ) .OR. cchar == CHR( ASC( "*" ) ) .OR. ;
cchar == CHR( ASC( "#" ) ) .OR. cchar == CHR( ASC( '"' ) ) .OR. ;
cchar == CHR( ASC( "/" ) ) .OR. cchar == CHR( ASC( "@" ) ) ;
.OR. cchar == CHR( ASC( "=" ) ) .OR. cchar == CHR( ASC( "Ä" ) ) ;
.OR. cchar == CHR( ASC( "?" ) ) .OR. cchar == CHR( ASC( "!" ) ) ;
.OR. cchar == CHR( ASC( "<" ) ) .OR. cchar == CHR( ASC( ">" ) ) ;
.OR. cchar == CHR( ASC( "!" ) ) .OR. cchar == CHR( ASC( "+" ) )
nPos := x
IF cChar >= "A" .AND. cChar <= "Z" .OR. ;
cChar >= "a" .AND. cChar <= "z" .OR. ;
cChar >= "0" .AND. cChar <= "9" .OR. ;
cChar $ "@-(|.*#/=?!<>+" .OR. ;
cChar == '"'
EXIT
RETURN x
ENDIF
NEXT
RETURN nPos
RETURN 0
*+--------------------------------------------------------------------
*+
*+ Function GetNumberofTableItems()
*+
*+ Called from ( genhtm.prg ) 1 - function prochtmdesc()
*+ ( genng.prg ) 1 - function procngdesc()
*+ ( genng1.prg ) 1 - function procngdesc()
*+
*+--------------------------------------------------------------------
*+
FUNCTION GetNumberofTableItems( cBuffer )
LOCAL cItem AS STRING
LOCAL nItem AS NUMERIC := 0
LOCAL cItem
LOCAL nItem := 0
cBuffer := ALLTRIM( cBuffer )
DO WHILE AT( SPACE( 3 ), cBuffer ) > 0
cItem := SUBSTR( cBuffer, 1, AT( SPACE( 3 ), cBuffer ) - 1 )
IF AT( SPACE( 3 ), cBuffer ) == 0
nItem ++
nItem++
ELSE
cBuffer := ALLTRIM( STRTRAN( cBuffer, cItem, "" ) )
nItem ++
nItem++
ENDIF
ENDDO
nItem ++
nItem++
RETURN nItem
#define EOL hb_osnewline()
FUNCTION FREADline( nH, cB, nMaxLine )
*+--------------------------------------------------------------------
*+
*+ Function FREADline()
*+
*+ Called from ( genng.prg ) 1 - static function readfromtop()
*+ ( genrtf.prg ) 1 - static function readfromtop()
*+
*+--------------------------------------------------------------------
*+
FUNCTION FREADline( nH as Numeric, cB AS STRING, nMaxLine as Numeric)
LOCAL cLine := SPACE( nMaxLine )
LOCAL nSavePos
LOCAL nEol
LOCAL nNumRead
LOCAL cLine AS STRING
LOCAL nSavePos AS NUMERIC
LOCAL nEol AS NUMERIC
LOCAL nNumRead AS NUMERIC
LOCAL lReturn as Logical
cLine := SPACE( nMaxLine )
cB := ""
nSavePos := FSEEK( nH, 0, FS_RELATIVE )
nNumRead := FREAD( nH, @cLine, nMaxLine )
IF ( nEol := AT( EOL, SUBSTR( cLine, 1, nNumRead ) ) ) == 0
IF ( nEol := AT( hb_OSNewLine(), SUBSTR( cLine, 1, nNumRead ) ) ) == 0
cB := cLine
ELSE
cB := SUBSTR( cLine, 1, nEol - 1 )
FSEEK( nH, nSavePos + nEol + 1, FS_SET )
ENDIF
lReturn := (nNumRead != 0)
RETURN lReturn
RETURN nNumRead != 0

View File

@@ -4,7 +4,7 @@
/*
* Harbour Project source code:
* Header file common definition of HBDOc
* Header file common definition of hbdoc
*
* Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net>
* www - http://www.harbour-project.org
@@ -49,6 +49,7 @@
* If you do not wish that, delete this exception notice.
*
*/
#ifndef _HBDOCDEF_CH_
#define _HBDOCDEF_CH_
@@ -82,18 +83,21 @@
#define pMEMO "M"
#define pNUMERIC "N"
#define pOBJECT "O"
#define pTRUE .t.
#define pFALSE .f.
#define pTRUE .T.
#define pFALSE .F.
#define pCRLF HB_OSNEWLINE()
#xtranslate DOSFILENAME(<c>) => substr( <c>, rat("\",<c>)+1 )
#xcommand IF <var> IS <type> => if valtype(<var>) = <type>
#xcommand IF <var> IS NOT <type> => if valtype(<var>) != <type>
#xcommand IF <var> IS <type> => if valtype(<var>) == <type>
#xcommand IF <var> IS NOT <type> => if !( valtype(<var>) == <type> )
#xcommand IF <ele> IS IN <array> => if !(len( <array> ) \< <ele> )
#xcommand IF <ele> IS NOT IN <array> => if len( <array> ) \< <ele>
#xtranslate (<var> IS <type> ) => ( valtype(<var>) = <type> )
#xtranslate (<var> IS NOT <type>) => ( valtype(<var>) != <type> )
#xtranslate (<var> IS <type> ) => ( valtype(<var>) == <type> )
#xtranslate (<var> IS NOT <type>) => ( !( valtype(<var>) == <type> ) )
#define pBUFFER_LENGTH 4096
#endif