See ChangeLog entry 2003-07-28 22:00 UTC-0400 David G. Holm <dholm@jsd-llc.com>

This commit is contained in:
David G. Holm
2003-07-29 02:01:25 +00:00
parent 460b82b2d3
commit 763ccea561
7 changed files with 52 additions and 20 deletions

View File

@@ -8,6 +8,18 @@
2002-12-01 23:12 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2003-07-28 22:00 UTC-0400 David G. Holm <dholm@jsd-llc.com>
* include/hbset.h
* include/set.ch
* source/pp/pptable.c
* source/rtl/dbdelim.prg
* source/rtl/dbsdf.prg
* source/rtl/set.c
+ New SET value named _SET_EOF. Defaults to FALSE on UN*X, but defaults
to TRUE on everything else. If set to FALSE, then CHR(26) does not get
written when using COPY TO DELIMITED, COPY TO SDF, or when closing any
of the various text files that are created using various SET values.
2003-07-21 11:10 UTC-0300 Antonio Carlos Pantaglione <toninho@fwi.com.br>
* source/rtl/transfrm.c
! Fixed the problem with @E and negative numbers.

View File

@@ -6,7 +6,7 @@
* Harbour Project source code:
* Header file for the Set API
*
* Copyright 1999 David G. Holm <dholm@jsd-llc.com>
* Copyright 1999-2003 David G. Holm <dholm@jsd-llc.com>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
@@ -127,7 +127,8 @@ typedef enum
HB_SET_IDLEREPEAT = 101,
HB_SET_FILECASE = 102,
HB_SET_DIRCASE = 103,
HB_SET_DIRSEPARATOR = 104
HB_SET_DIRSEPARATOR = 104,
HB_SET_EOF = 105
} HB_set_enum;
@@ -158,6 +159,7 @@ typedef struct
char * HB_SET_DELIMCHARS;
BOOL HB_SET_DELIMITERS;
char * HB_SET_DEVICE;
BOOL HB_SET_EOF;
int HB_SET_EPOCH;
BOOL HB_SET_ESCAPE;
HB_inkey_enum HB_SET_EVENTMASK;

View File

@@ -6,7 +6,7 @@
* Harbour Project source code:
* Header file for SET() function
*
* Copyright 1999 David G. Holm <dholm@jsd-llc.com>
* Copyright 1999-2003 David G. Holm <dholm@jsd-llc.com>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
@@ -119,6 +119,7 @@
#define _SET_FILECASE 102 /* Harbour extension */
#define _SET_DIRCASE 103 /* Harbour extension */
#define _SET_DIRSEPARATOR 104 /* Harbour extension */
#define _SET_EOF 105 /* Harbour extension */
#define HB_SET_BASE 100
#define HB_SET_COUNT 2

View File

@@ -124,6 +124,7 @@ void hb_pp_Table( void )
static DEFINES sD___53 = {"_SET_FILECASE",NULL,-1,"102", &sD___52 };
static DEFINES sD___54 = {"_SET_DIRCASE",NULL,-1,"103", &sD___53 };
static DEFINES sD___55 = {"_SET_DIRSEPARATOR",NULL,-1,"104", &sD___54 };
static DEFINES sD___56 = {"_SET_EOF",NULL,-1,"105", &sD___55 };
static COMMANDS sC___1 = {0,"NOTE","\1A30",NULL,NULL };
static COMMANDS sC___2 = {0,"DO","WHILE \1A00","while \1A00",&sC___1 };
@@ -433,7 +434,7 @@ void hb_pp_Table( void )
static COMMANDS sC___249 = {0,"SET","DIRSEPARATOR \1A30","Set(_SET_DIRSEPARATOR, \1A10 )",&sC___248 };
static COMMANDS sC___250 = {0,"SET","DIRSEPARATOR ( \1A00 )","Set(_SET_DIRSEPARATOR, \1A00 )",&sC___249 };
hb_pp_topDefine = &sD___55;
hb_pp_topDefine = &sD___56;
hb_pp_topCommand = &sC___250;
hb_pp_topTranslate = NULL;
}

View File

@@ -7,7 +7,7 @@
* Copies the contents of a database to a delimited text file.
* Appends the contents of a delimited text file to a database.
*
* Copyright 2001-2002 David G. Holm <dholm@jsd-llc.com>
* Copyright 2001-2003 David G. Holm <dholm@jsd-llc.com>
* www - http://www.harbour-project.org
* APPEND FROM code submitted by Marco Braida <marcobra@elart.it>
*
@@ -55,6 +55,7 @@
#include "hbcommon.ch"
#include "fileio.ch"
#include "error.ch"
#include "set.ch"
HB_FILE_VER( "$Id$" )
@@ -193,7 +194,9 @@ local lcisonoeol
END IF
SKIP
END WHILE
AppendEOF( handle )
IF SET(_SET_EOF)
AppendEOF( handle )
END IF
FCLOSE( handle )
END IF
ELSE

View File

@@ -54,6 +54,7 @@
#include "hbcommon.ch"
#include "fileio.ch"
#include "error.ch"
#include "set.ch"
HB_FILE_VER( "$Id$" )
@@ -156,7 +157,9 @@ PROCEDURE __dbSDF( lExport, cFile, aFields, bFor, bWhile, nNext, nRecord, lRest
END IF
SKIP
END WHILE
AppendEOF( handle )
IF SET(_SET_EOF)
AppendEOF( handle )
END IF
FCLOSE( handle )
END IF
ELSE

View File

@@ -6,7 +6,7 @@
* Harbour Project source code:
* Set functions
*
* Copyright 1999-2001 David G. Holm <dholm@jsd-llc.com>
* Copyright 1999-2003 David G. Holm <dholm@jsd-llc.com>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
@@ -213,9 +213,10 @@ static void close_text( FHANDLE handle )
/* Close the file handle without disrupting the current
user file error value */
USHORT user_ferror = hb_fsError();
#if ! defined(OS_UNIX_COMPATIBLE)
if( hb_set.HB_SET_EOF )
{
hb_fsWrite( handle, ( BYTE * ) "\x1A", 1 );
#endif
}
hb_fsClose( handle );
hb_fsSetError( user_ferror );
}
@@ -275,28 +276,28 @@ static FHANDLE open_handle( char * file_name, BOOL bAppend, char * def_ext, HB_s
handle = hb_fsOpen( ( BYTE * ) path, FO_READWRITE | FO_DENYWRITE );
if( handle != FS_ERROR )
{ /* Position to EOF */
#if ! defined(OS_UNIX_COMPATIBLE)
/* Non-Unix needs special binary vs. text file handling */
/* Special binary vs. text file handling - even for UN*X, now
that there's an HB_SET_EOF flag. */
if( set_specifier == HB_SET_PRINTFILE )
{ /* PRINTFILE is binary and needs no special handling. */
#endif
{ /* PRINTFILE is always binary and needs no special handling. */
hb_fsSeek( handle, 0, FS_END );
#if ! defined(OS_UNIX_COMPATIBLE)
}
else
{ /* All other files are text files and may have an EOF
('\x1A') character at the end (non-UNIX only). */
('\x1A') character at the end (both UN*X and non-UN*X,
now that theres an HB_SET_EOF flag). */
char cEOF = '\0';
hb_fsSeek( handle, -1, FS_END ); /* Position to last char. */
hb_fsRead( handle, ( BYTE * ) &cEOF, 1 ); /* Read the last char. */
if( cEOF == '\x1A' ) /* If it's an EOF, */
{
hb_fsSeek( handle, -1, FS_END ); /* Then write over it. */
}
}
#endif
}
}
}
}
else bCreate = TRUE; /* Otherwise create a new file. */
}
}
else bCreate = TRUE; /* Always create a new file for overwrite mode. */
if( bCreate )
@@ -592,6 +593,10 @@ HB_FUNC( SET )
hb_set.hb_set_printhan = open_handle( hb_set.HB_SET_PRINTFILE, FALSE, ".prn", HB_SET_PRINTFILE );
}
break;
case HB_SET_EOF :
hb_retl( hb_set.HB_SET_EOF );
if( args > 1 ) hb_set.HB_SET_EOF = set_logical( pArg2 );
break;
case HB_SET_EPOCH :
hb_retni( hb_set.HB_SET_EPOCH );
if( args > 1 )
@@ -906,6 +911,11 @@ void hb_setInitialize( void )
hb_set.HB_SET_DELIMITERS = FALSE;
hb_set.HB_SET_DEVICE = ( char * ) hb_xgrab( 7 );
memcpy( hb_set.HB_SET_DEVICE, "SCREEN", 7 );
#if defined(OS_UNIX_COMPATIBLE)
hb_set.HB_SET_EOF = FALSE;
#else
hb_set.HB_SET_EOF = TRUE;
#endif
hb_set.HB_SET_EPOCH = 1900;
hb_set.HB_SET_ESCAPE = TRUE;
hb_set.HB_SET_EVENTMASK = INKEY_KEYBOARD;