19991006-02:26 GMT+1

This commit is contained in:
Viktor Szakats
1999-10-06 00:41:55 +00:00
parent dc07764904
commit 5e3700a532
8 changed files with 107 additions and 91 deletions

View File

@@ -1,3 +1,16 @@
19991006-02:26 GMT+1 Victor Szel <info@szelvesz.hu>
* include/set.h
source/rtl/set.c
source/rtl/console.c
source/rtl/transfrm.c
! 64 changed to CLR_STRLEN in set.h
* Separate global "set" variables moved inside HB_SET_STRUCT
* include/caundoc.api
+ _bset, _bmove, _bcopy undocumented Clipper functions added, they are
mapped to mem*() functions.
* source/vm/main*.c
! Typo fixed.
19991006-00:32 GMT+1 Victor Szel <info@szelvesz.hu>
* include/extend.h
source/vm/debug.c

View File

@@ -43,12 +43,12 @@
#include "clipdefs.h"
#include "filesys.h"
/* Undocumented Extend API calls */
/* Undocumented Extend API */
#define _reta hb_reta
#define _pcount hb_pcount
/* Undocumented TSUPPORT API */
/* Undocumented TSupport API */
#define _tcreat hb_fsCreate
#define _tunlink hb_fsDelete
@@ -61,4 +61,10 @@
#define _tlock hb_fsLock
#define _tcommit hb_fsCommit
/* Undocumented support functions */
#define _bset memset
#define _bmove memmove
#define _bcopy memcpy
#endif /* HB_CAUNDOC_API_ */

View File

@@ -83,6 +83,7 @@
#include "hbdefs.h"
#include "filesys.h"
#include "gtapi.h"
#include "setcurs.h"
#include "inkey.h"
@@ -139,52 +140,52 @@ typedef enum
typedef struct
{
BOOL HB_SET_EXACT;
BOOL HB_SET_FIXED;
int HB_SET_DECIMALS;
char * HB_SET_DATEFORMAT;
int HB_SET_EPOCH;
char * HB_SET_PATH;
char * HB_SET_DEFAULT;
BOOL HB_SET_EXCLUSIVE;
BOOL HB_SET_SOFTSEEK;
BOOL HB_SET_UNIQUE;
BOOL HB_SET_DELETED;
BOOL HB_SET_CANCEL;
BOOL HB_SET_DEBUG;
int HB_SET_TYPEAHEAD;
char HB_SET_COLOR[ 64 ];
BOOL HB_SET_EXACT;
BOOL HB_SET_FIXED;
BOOL hb_set_century;
int HB_SET_DECIMALS;
char * HB_SET_DATEFORMAT;
int HB_SET_EPOCH;
char * HB_SET_PATH;
char * HB_SET_DEFAULT;
BOOL HB_SET_EXCLUSIVE;
BOOL HB_SET_SOFTSEEK;
BOOL HB_SET_UNIQUE;
BOOL HB_SET_DELETED;
BOOL HB_SET_CANCEL;
BOOL HB_SET_DEBUG;
int HB_SET_TYPEAHEAD;
char HB_SET_COLOR[ CLR_STRLEN ];
HB_cursor_enum HB_SET_CURSOR;
BOOL HB_SET_CONSOLE;
BOOL HB_SET_ALTERNATE;
char * HB_SET_ALTFILE;
char * HB_SET_DEVICE;
BOOL HB_SET_EXTRA;
char * HB_SET_EXTRAFILE;
BOOL HB_SET_PRINTER;
char * HB_SET_PRINTFILE;
int HB_SET_MARGIN;
BOOL HB_SET_BELL;
BOOL HB_SET_CONFIRM;
BOOL HB_SET_ESCAPE;
BOOL HB_SET_INSERT;
BOOL HB_SET_EXIT;
BOOL HB_SET_INTENSITY;
BOOL HB_SET_SCOREBOARD;
char * HB_SET_DELIMCHARS;
BOOL HB_SET_DELIMITERS;
BOOL HB_SET_WRAP;
int HB_SET_MESSAGE;
BOOL HB_SET_MCENTER;
BOOL HB_SET_SCROLLBREAK; /* QUESTION: What does this do ? */
BOOL HB_SET_CONSOLE;
BOOL HB_SET_ALTERNATE;
char * HB_SET_ALTFILE;
FHANDLE hb_set_althan;
char * HB_SET_DEVICE;
BOOL HB_SET_EXTRA;
char * HB_SET_EXTRAFILE;
FHANDLE hb_set_extrahan;
BOOL HB_SET_PRINTER;
char * HB_SET_PRINTFILE;
FHANDLE hb_set_printhan;
int HB_SET_MARGIN;
BOOL HB_SET_BELL;
BOOL HB_SET_CONFIRM;
BOOL HB_SET_ESCAPE;
BOOL HB_SET_INSERT;
BOOL HB_SET_EXIT;
BOOL HB_SET_INTENSITY;
BOOL HB_SET_SCOREBOARD;
char * HB_SET_DELIMCHARS;
BOOL HB_SET_DELIMITERS;
BOOL HB_SET_WRAP;
int HB_SET_MESSAGE;
BOOL HB_SET_MCENTER;
BOOL HB_SET_SCROLLBREAK; /* QUESTION: What does this do ? */
HB_inkey_enum HB_SET_EVENTMASK;
} HB_set_struct;
} HB_SET_STRUCT;
extern HB_set_struct hb_set;
extern BOOL hb_set_century;
extern FHANDLE hb_set_althan;
extern FHANDLE hb_set_extrahan;
extern FHANDLE hb_set_printhan;
extern HB_SET_STRUCT hb_set;
extern void hb_setInitialize( void );
extern void hb_setRelease( void );

View File

@@ -417,27 +417,27 @@ static void hb_altout( char * pStr, ULONG ulLen )
#endif
}
if( hb_set.HB_SET_ALTERNATE && hb_set_althan != FS_ERROR )
if( hb_set.HB_SET_ALTERNATE && hb_set.hb_set_althan != FS_ERROR )
{
/* Print to alternate file if SET ALTERNATE ON and valid alternate file */
USHORT user_ferror = hb_fsError(); /* Save current user file error code */
hb_fsWriteLarge( hb_set_althan, ( BYTE * ) pStr, ulLen );
hb_fsWriteLarge( hb_set.hb_set_althan, ( BYTE * ) pStr, ulLen );
hb_fsSetError( user_ferror ); /* Restore last user file error code */
}
if( hb_set_extrahan != FS_ERROR )
if( hb_set.hb_set_extrahan != FS_ERROR )
{
/* Print to extra file if valid alternate file */
USHORT user_ferror = hb_fsError(); /* Save current user file error code */
hb_fsWriteLarge( hb_set_extrahan, ( BYTE * ) pStr, ulLen );
hb_fsWriteLarge( hb_set.hb_set_extrahan, ( BYTE * ) pStr, ulLen );
hb_fsSetError( user_ferror ); /* Restore last user file error code */
}
if( hb_set.HB_SET_PRINTER && hb_set_printhan != FS_ERROR )
if( hb_set.HB_SET_PRINTER && hb_set.hb_set_printhan != FS_ERROR )
{
/* Print to printer if SET PRINTER ON and valid printer file */
USHORT user_ferror = hb_fsError(); /* Save current user file error code */
hb_fsWriteLarge( hb_set_printhan, ( BYTE * ) pStr, ulLen );
hb_fsWriteLarge( hb_set.hb_set_printhan, ( BYTE * ) pStr, ulLen );
hb_fsSetError( user_ferror ); /* Restore last user file error code */
if( ulLen + s_uiPCol > USHRT_MAX ) s_uiPCol = USHRT_MAX;
else s_uiPCol += ulLen;
@@ -447,11 +447,11 @@ static void hb_altout( char * pStr, ULONG ulLen )
/* Output an item to the screen and/or printer */
static void hb_devout( char * pStr, ULONG ulLen )
{
if( hb_set_printhan != FS_ERROR && hb_stricmp( hb_set.HB_SET_DEVICE, "PRINTER" ) == 0 )
if( hb_set.hb_set_printhan != FS_ERROR && hb_stricmp( hb_set.HB_SET_DEVICE, "PRINTER" ) == 0 )
{
/* Display to printer if SET DEVICE TO PRINTER and valid printer file */
USHORT user_ferror = hb_fsError(); /* Save current user file error code */
hb_fsWriteLarge( hb_set_printhan, ( BYTE * ) pStr, ulLen );
hb_fsWriteLarge( hb_set.hb_set_printhan, ( BYTE * ) pStr, ulLen );
hb_fsSetError( user_ferror ); /* Restore last user file error code */
if( ulLen + s_uiPCol > USHRT_MAX ) s_uiPCol = USHRT_MAX;
else s_uiPCol += ulLen;
@@ -516,23 +516,23 @@ void hb_devpos( USHORT row, USHORT col )
USHORT uiCount;
/* Position printer if SET DEVICE TO PRINTER and valid printer file
otherwise position console */
if( hb_set_printhan != FS_ERROR && hb_stricmp( hb_set.HB_SET_DEVICE, "PRINTER" ) == 0 )
if( hb_set.hb_set_printhan != FS_ERROR && hb_stricmp( hb_set.HB_SET_DEVICE, "PRINTER" ) == 0 )
{
USHORT user_ferror = hb_fsError(); /* Save current user file error code */
if( row < s_uiPRow )
{
hb_fsWrite( hb_set_printhan, ( BYTE * ) "\x0C", 1 );
hb_fsWrite( hb_set.hb_set_printhan, ( BYTE * ) "\x0C", 1 );
s_uiPRow = s_uiPCol = 0;
}
for( uiCount = s_uiPRow; uiCount < row; uiCount++ )
hb_fsWrite( hb_set_printhan, ( BYTE * ) s_szCrLf, CRLF_BUFFER_LEN-1 );
hb_fsWrite( hb_set.hb_set_printhan, ( BYTE * ) s_szCrLf, CRLF_BUFFER_LEN-1 );
if( row > s_uiPRow ) s_uiPCol = 0;
col += hb_set.HB_SET_MARGIN;
for( uiCount = s_uiPCol; uiCount < col; uiCount++ )
hb_fsWrite( hb_set_printhan, ( BYTE * ) " ", 1 );
hb_fsWrite( hb_set.hb_set_printhan, ( BYTE * ) " ", 1 );
s_uiPRow = row;
s_uiPCol = col;
@@ -584,14 +584,14 @@ HARBOUR HB_QOUT( void )
hb_altout( s_szCrLf, CRLF_BUFFER_LEN - 1 );
if( hb_set.HB_SET_PRINTER && hb_set_printhan != FS_ERROR )
if( hb_set.HB_SET_PRINTER && hb_set.hb_set_printhan != FS_ERROR )
{
USHORT user_ferror = hb_fsError(); /* Save current user file error code */
s_uiPRow++;
s_uiPCol = hb_set.HB_SET_MARGIN;
uiCount = s_uiPCol;
while( uiCount-- > 0 )
hb_fsWrite( hb_set_printhan, ( BYTE * ) " ", 1 );
hb_fsWrite( hb_set.hb_set_printhan, ( BYTE * ) " ", 1 );
hb_fsSetError( user_ferror ); /* Restore last user file error code */
}
@@ -749,10 +749,10 @@ HARBOUR HB_DISPOUTAT( void ) /* writes a single value to the screen at speficic
HARBOUR HB___EJECT( void ) /* Ejects the current page from the printer */
{
if( hb_stricmp( hb_set.HB_SET_DEVICE, "PRINTER" ) == 0 && hb_set_printhan != FS_ERROR )
if( hb_stricmp( hb_set.HB_SET_DEVICE, "PRINTER" ) == 0 && hb_set.hb_set_printhan != FS_ERROR )
{
USHORT user_ferror = hb_fsError(); /* Save current user file error code */
hb_fsWrite( hb_set_printhan, ( BYTE * ) "\x0C\x0D", 2 );
hb_fsWrite( hb_set.hb_set_printhan, ( BYTE * ) "\x0C\x0D", 2 );
s_uiPRow = s_uiPCol = 0;
hb_fsSetError( user_ferror ); /* Restore last user file error code */
}

View File

@@ -181,11 +181,7 @@
#include "set.h"
#include "inkey.h"
HB_set_struct hb_set;
BOOL hb_set_century;
FHANDLE hb_set_althan;
FHANDLE hb_set_extrahan;
FHANDLE hb_set_printhan;
HB_SET_STRUCT hb_set;
static BOOL set_logical( PHB_ITEM pItem )
{
@@ -374,14 +370,14 @@ HARBOUR HB_SETCANCEL( void )
*/
HARBOUR HB___SETCENTURY( void )
{
BOOL old_century_setting = hb_set_century;
BOOL old_century_setting = hb_set.hb_set_century;
/*
* Change the setting if the parameter is a logical value, or is
* either "ON" or "OFF" (regardless of case)
*/
if( ISLOG( 1 ) )
hb_set_century = hb_parl( 1 );
hb_set.hb_set_century = hb_parl( 1 );
else if( ISCHAR( 1 ) )
{
char * szString = hb_parc( 1 );
@@ -390,19 +386,19 @@ HARBOUR HB___SETCENTURY( void )
if( ulLen >= 2
&& toupper( szString[ 0 ] ) == 'O'
&& toupper( szString[ 1 ] ) == 'N' )
hb_set_century = TRUE;
hb_set.hb_set_century = TRUE;
else if( ulLen >= 3
&& toupper( szString[ 0 ] ) == 'O'
&& toupper( szString[ 1 ] ) == 'F'
&& toupper( szString[ 2 ] ) == 'F' )
hb_set_century = FALSE;
hb_set.hb_set_century = FALSE;
}
/*
* Finally, if the setting changed, adjust the current date format to use
* the correct number of year digits.
*/
if( old_century_setting != hb_set_century )
if( old_century_setting != hb_set.hb_set_century )
{
int count, digit, size, y_size, y_start, y_stop;
char * szDateFormat, * szNewFormat;
@@ -431,7 +427,7 @@ HARBOUR HB___SETCENTURY( void )
y_size = y_stop - y_start;
/* Calculate size of new format */
size -= y_size;
if( hb_set_century ) size += 4;
if( hb_set.hb_set_century ) size += 4;
else size += 2;
/* Create the new date format */
@@ -442,7 +438,7 @@ HARBOUR HB___SETCENTURY( void )
if( y_start > 0 ) memcpy( szNewFormat, szDateFormat, y_start );
szNewFormat[ y_start ] = '\0';
strcat( szNewFormat, "YY" );
if( hb_set_century ) strcat( szNewFormat, "YY" );
if( hb_set.hb_set_century ) strcat( szNewFormat, "YY" );
format_len = strlen( szDateFormat );
if( y_stop < format_len ) strcat( szNewFormat, szDateFormat + y_stop );
hb_xfree( szDateFormat );
@@ -713,9 +709,9 @@ HARBOUR HB_SET( void )
else bFlag = FALSE;
if( args > 1 )
{
close_text( hb_set_althan );
close_text( hb_set.hb_set_althan );
if( hb_set.HB_SET_ALTFILE && strlen( hb_set.HB_SET_ALTFILE ) > 0 )
hb_set_althan = open_handle( hb_set.HB_SET_ALTFILE, bFlag, ".txt", HB_SET_ALTFILE );
hb_set.hb_set_althan = open_handle( hb_set.HB_SET_ALTFILE, bFlag, ".txt", HB_SET_ALTFILE );
}
break;
case HB_SET_BELL :
@@ -787,9 +783,9 @@ HARBOUR HB_SET( void )
{
/* If the print file is not already open, open it in overwrite mode. */
hb_set.HB_SET_DEVICE = set_string( pArg2, hb_set.HB_SET_DEVICE );
if( hb_stricmp( hb_set.HB_SET_DEVICE, "PRINTER" ) == 0 && hb_set_printhan == FS_ERROR
if( hb_stricmp( hb_set.HB_SET_DEVICE, "PRINTER" ) == 0 && hb_set.hb_set_printhan == FS_ERROR
&& hb_set.HB_SET_PRINTFILE && strlen( hb_set.HB_SET_PRINTFILE ) > 0 )
hb_set_printhan = open_handle( hb_set.HB_SET_PRINTFILE, FALSE, ".prn", HB_SET_PRINTFILE );
hb_set.hb_set_printhan = open_handle( hb_set.HB_SET_PRINTFILE, FALSE, ".prn", HB_SET_PRINTFILE );
}
break;
case HB_SET_EPOCH :
@@ -834,9 +830,9 @@ HARBOUR HB_SET( void )
else bFlag = FALSE;
if( args > 1 )
{
close_text( hb_set_extrahan );
close_text( hb_set.hb_set_extrahan );
if( hb_set.HB_SET_EXTRAFILE && strlen( hb_set.HB_SET_EXTRAFILE ) > 0 )
hb_set_extrahan = open_handle( hb_set.HB_SET_EXTRAFILE, bFlag, ".prn", HB_SET_EXTRAFILE );
hb_set.hb_set_extrahan = open_handle( hb_set.HB_SET_EXTRAFILE, bFlag, ".prn", HB_SET_EXTRAFILE );
}
break;
case HB_SET_FIXED :
@@ -892,9 +888,9 @@ HARBOUR HB_SET( void )
else bFlag = FALSE;
if( args > 1 )
{
close_binary( hb_set_printhan );
close_binary( hb_set.hb_set_printhan );
if( hb_set.HB_SET_PRINTFILE && strlen( hb_set.HB_SET_PRINTFILE ) > 0 )
hb_set_printhan = open_handle( hb_set.HB_SET_PRINTFILE, bFlag, ".prn", HB_SET_PRINTFILE );
hb_set.hb_set_printhan = open_handle( hb_set.HB_SET_PRINTFILE, bFlag, ".prn", HB_SET_PRINTFILE );
}
break;
case HB_SET_SCOREBOARD :
@@ -939,14 +935,12 @@ HARBOUR HB_SET( void )
void hb_setInitialize( void )
{
hb_set_century = FALSE;
hb_set_althan = FS_ERROR;
hb_set_extrahan = FS_ERROR;
hb_set_printhan = FS_ERROR;
hb_set.HB_SET_ALTERNATE = FALSE;
hb_set.HB_SET_ALTFILE = NULL;
hb_set.hb_set_althan = FS_ERROR;
hb_set.HB_SET_BELL = FALSE;
hb_set.HB_SET_CANCEL = TRUE;
hb_set.hb_set_century = FALSE;
strncpy( hb_set.HB_SET_COLOR, "W/N,N/W,N/N,N/N,N/W", sizeof( hb_set.HB_SET_COLOR ) );
hb_set.HB_SET_COLOR[ sizeof( hb_set.HB_SET_COLOR ) - 1 ] = '\0';
hb_set.HB_SET_CONFIRM = FALSE;
@@ -972,6 +966,7 @@ void hb_setInitialize( void )
hb_set.HB_SET_EXIT = FALSE;
hb_set.HB_SET_EXTRA = FALSE;
hb_set.HB_SET_EXTRAFILE = NULL;
hb_set.hb_set_extrahan = FS_ERROR;
hb_set.HB_SET_FIXED = FALSE;
hb_set.HB_SET_INSERT = FALSE;
hb_set.HB_SET_INTENSITY = TRUE;
@@ -983,6 +978,7 @@ void hb_setInitialize( void )
hb_set.HB_SET_PRINTER = FALSE;
hb_set.HB_SET_PRINTFILE = ( char * ) hb_xgrab( 4 );
memcpy( hb_set.HB_SET_PRINTFILE, "PRN", 4 ); /* Default printer device */
hb_set.hb_set_printhan = FS_ERROR;
hb_set.HB_SET_SCOREBOARD = TRUE;
hb_set.HB_SET_SCROLLBREAK = TRUE;
hb_set.HB_SET_SOFTSEEK = FALSE;
@@ -993,9 +989,9 @@ void hb_setInitialize( void )
void hb_setRelease( void )
{
close_text( hb_set_althan );
close_text( hb_set_extrahan );
close_binary( hb_set_printhan );
close_text( hb_set.hb_set_althan );
close_text( hb_set.hb_set_extrahan );
close_binary( hb_set.hb_set_printhan );
if( hb_set.HB_SET_ALTFILE ) hb_xfree( hb_set.HB_SET_ALTFILE );
if( hb_set.HB_SET_DATEFORMAT ) hb_xfree( hb_set.HB_SET_DATEFORMAT );

View File

@@ -371,7 +371,7 @@ static char * NumPicture( char * szPic, ULONG ulPic, USHORT uiPicFlags, double d
static char * DatePicture( char * szDate, USHORT uiPicFlags, char * szResult )
{
if( uiPicFlags & PF_BRITISH )
hb_dtoc( szDate, szResult, hb_set_century ? "DD/MM/YYYY" : "DD/MM/YY" );
hb_dtoc( szDate, szResult, hb_set.hb_set_century ? "DD/MM/YYYY" : "DD/MM/YY" );
else
hb_dtoc( szDate, szResult, hb_set.HB_SET_DATEFORMAT );

View File

@@ -42,7 +42,7 @@ int main( int argc, char * argv[] )
hb_vmInit();
hb_vmQuit();
/* NOTE: The exit value is set by _exit() */
/* NOTE: The exit value is set by exit() */
/* NOTE: This point is never reached */
return 0;

View File

@@ -55,7 +55,7 @@ int WINAPI WinMain( HINSTANCE hInstance, /* handle to current instance */
hb_vmInit();
hb_vmQuit();
/* NOTE: The exit value is set by _exit() */
/* NOTE: The exit value is set by exit() */
/* NOTE: This point is never reached */
return 0;