See ChangeLog entry 19990719-03:10 EDT David G. Holm <dholm@jsd-llc.com>

This commit is contained in:
David G. Holm
1999-07-19 07:27:36 +00:00
parent 8413d021cf
commit 4c136f5cab
18 changed files with 131 additions and 74 deletions

View File

@@ -1,3 +1,55 @@
19990719-03:10 EDT David G. Holm <dholm@jsd-llc.com>
* config/os2/icc.cf
+ Added /Gs+ option to enable runtime stack checking
* include/dates.h
+ Added prototype for hb_dow()
* include/gtapi.h
+ Added prototype for hb_gtExit()
* include/set.h
+ Added prototype for hb_setColor()
* Changed hb_set.HB_SET_COLOR from char * to char[64]
* source/compiler/harbour.y
* Replaced _StdFunc table with new table supplied by Jose Lalin,
while keeping the entry for SET that Paul Tucker had CVSed
* source/hbpp/hbpp.c
* Made mpatt and rpatt buffers in ParseCommand() static.
* source/hbpp/hbppint.c
* Allocate sBuffer in Hp_Parse() using _xgrab() (and
release with _xfree() before exiting)
* source/rtl/console.c
+ Added call to hb_gtInit() to InitializeConsole()
- Removed all gt...() calls from InitializeConsole()
* source/rtl/gtapi.c
+ Added gt...() calls that used to be in InitializeConsole()
to hb_gtInit() and also added a call to gtInit()
* Renamed hb_gtexit() to hb_gtExit() to match Harbour style
* Converted three // style comments to /* style comments */
* source/rtl/set.c
* Simplified handling of HB_SET_COLOR by just calling hb_setColor()
* Made changes related to hb_set.HB_SET_COLOR now being char[64]
* source/rtl/setcolor.c
+ Added #include <set.h>
* Replaced gt prototypes with #include <gtapi.h>
* Changed hb_SetColor() to hb_setColor() to match Harbour style
* Changed hb_setColor() to use hb_set.HB_SET_COLOR instead of
allocating a buffer and requiring the caller to free the buffer
+ Added conditional logic for not using the GT API
* source/rtl/gt/gtwin.c
- Removed call to hb_gtInit()
* source/tools/dates2.c
+ Added #include <dates.h>
! Added missing semicolon to HB_INIT_SYMBOLS_END()
- Removed prototypes for hb_dow() and hb_dateDecode()
* tests/working/Makefile
- Removed strings4.prg
+ Added tstcolor.prg
* tests/working/empty.prg
- Removed call to empty() with no parameters, because
it now results in a compile error
- tests/working/string4.prg
- Removed this test program, because Harbour now checks for
the correct number of arguments when compiling
19990719-00:55 EDT Paul Tucker <ptucker@sympatico.ca>
* source/rtl/set.c
* Trap for NIL param in Set( _SET_SETCOLOR, NIL )

View File

@@ -13,7 +13,7 @@ CC = icc
CC_IN = /C+ /Tp
CC_OUT = /Fo
CPPFLAGS = /I$(GRANDP) /I$(HB_INC_COMPILE) /DHARBOUR_USE_GTAPI /DHARBOUR_USE_OS2_GTAPI
CFLAGS = /W2 /Se /Sd+ /Ti+
CFLAGS = /Gs+ /W2 /Se /Sd+ /Ti+
LD = icc
LD_OUT = /Fe

View File

@@ -5,6 +5,7 @@
#ifndef HB_DATES_H_
#define HB_DATES_H_
long hb_dow( long d, long m, long y );
char * hb_dtoc( const char * szDate, char * szFormattedDate, const char * szDateFormat );
long hb_dateEncode( long lDay, long lMonth, long lYear );
void hb_dateDecode( long julian, long * plDay, long * plMonth, long * plYear );

View File

@@ -49,6 +49,7 @@
/* Public interface. These should never change, only be added to. */
void hb_gtInit(void);
void hb_gtExit(void);
int hb_gtBox(USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, char * fpBoxString);
int hb_gtBoxD(USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight);
int hb_gtBoxS(USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight);

View File

@@ -29,6 +29,9 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
their web site at http://www.gnu.org/).
V 1.47 David G. Holm Changed hb_set.HB_SET_COLOR to be a
fixed 64 byte buffer. Added prototype
for hb_setColor()
V 1.14 David G. Holm Removed the obsolete hb_set_fixed
and HB_SETFIXED(), which I should
have done when I took HB_SETFIXED()
@@ -62,6 +65,7 @@
HARBOUR HB_SET (void);
HARBOUR HB_SETCENTURY (void);
char * hb_setColor (char *);
void hb_setInitialize (void);
void hb_setRelease (void);
@@ -134,7 +138,7 @@ typedef struct
char *HB_SET_ALTFILE; /* Character */
BOOL HB_SET_BELL; /* Logical */
BOOL HB_SET_CANCEL; /* Logical */
char *HB_SET_COLOR; /* Character */
char HB_SET_COLOR[ 64 ]; /* Character */
BOOL HB_SET_CONFIRM; /* Logical */
BOOL HB_SET_CONSOLE; /* Logical */
HB_cursor_enum HB_SET_CURSOR; /* Numeric */

View File

@@ -4951,13 +4951,13 @@ static FUNCINFO _StdFun[] = {
{ "AADD" , 2, 2 },
{ "ABS" , 1, 1 },
{ "ASC" , 1, 1 },
{ "AT" , 1, 1 },
{ "AT" , 2, 2 },
{ "BOF" , 0, 0 },
{ "BREAK" , 1, 1 },
{ "BREAK" , 0, 1 },
{ "CDOW" , 1, 1 },
{ "CHR" , 1, 1 },
{ "CMONTH" , 1, 1 },
{ "COL" , 1, 1 },
{ "COL" , 0, 0 },
{ "CTOD" , 1, 1 },
{ "DATE" , 0, 0 },
{ "DAY" , 1, 1 },
@@ -4969,16 +4969,15 @@ static FUNCINFO _StdFun[] = {
{ "EMPTY" , 1, 1 },
{ "EOF" , 0, 0 },
{ "EXP" , 1, 1 },
{ "FCOUNT" , 1, 1 },
{ "FCOUNT" , 0, 0 },
{ "FIELDNAME" , 1, 1 },
{ "FILE" , 1, 1 },
{ "FLOCK" , 0, 0 },
{ "FOUND" , 0, 0 },
{ "INKEY" , 1, 1 },
{ "INKEY" , 1, 2 },
{ "INT" , 1, 1 },
{ "LASTREC" , 0, 0 },
{ "LEN" , 1, 1 },
{ "LOCK" , 0, 0 },
{ "LOG" , 1, 1 },
{ "LOWER" , 1, 1 },
{ "LTRIM" , 1, 1 },
@@ -4986,13 +4985,13 @@ static FUNCINFO _StdFun[] = {
{ "MIN" , 2, 2 },
{ "MONTH" , 1, 1 },
{ "PCOL" , 0, 0 },
{ "PCOUNT" , 1, 1 },
{ "PCOUNT" , 0, 0 },
{ "PROW" , 0, 0 },
{ "RECCOUNT" , 0, 0 },
{ "RECNO" , 0, 0 },
{ "REPLICATE" , 2, 2 },
{ "RLOCK" , 0, 0 },
{ "ROUND" , 1, 2 },
{ "ROUND" , 2, 2 },
{ "ROW" , 0, 0 },
{ "RTRIM" , 1, 1 },
{ "SECONDS" , 0, 0 },
@@ -5001,7 +5000,7 @@ static FUNCINFO _StdFun[] = {
{ "SETPOS" , 2, 2 },
{ "SPACE" , 1, 1 },
{ "SQRT" , 1, 1 },
{ "STR" , 1, 2 },
{ "STR" , 1, 3 },
{ "SUBSTR" , 2, 3 },
{ "TIME" , 0, 0 },
{ "TRANSFORM" , 2, 2 },

View File

@@ -383,8 +383,8 @@ int TraSearch(char *cmdname, int ncmd)
int ParseCommand( char* sLine, int com_or_xcom, int com_or_tra )
{
static char mpatt[STR_SIZE], rpatt[STR_SIZE];
char cmdname[MAX_NAME];
char mpatt[STR_SIZE], rpatt[STR_SIZE];
int mlen,rlen;
int ipos, rez;

View File

@@ -142,7 +142,7 @@ int PreProcess( FILE* handl_i, FILE* handl_o, char *sOut )
int Hp_Parse( FILE* handl_i, FILE* handl_o )
{
char sBuffer[BUFF_SIZE]; /* File read buffer */
char *sBuffer = (char *)_xgrab( BUFF_SIZE ); /* File read buffer */
char *ptr;
int lContinue = 0;
int iBuffer = 10, lenBuffer = 10;
@@ -177,6 +177,7 @@ int Hp_Parse( FILE* handl_i, FILE* handl_o )
}
}
}
_xfree( sBuffer );
return 0;
}

View File

@@ -138,10 +138,8 @@ HB_CALL_ON_STARTUP_BEGIN( InitializeConsole )
#endif
#ifdef HARBOUR_USE_GTAPI
gtInit();
dev_row = gtWhereY();
dev_col = gtWhereX();
hb_gtSetPos( dev_row, dev_col );
hb_gtInit();
hb_gtGetPos( &dev_row, & dev_col);
#else
dev_row = 0;
dev_col = 0;

View File

@@ -51,7 +51,6 @@ void gtInit(void)
LOG("Initializing");
HInput = GetStdHandle(STD_INPUT_HANDLE);
HOutput = GetStdHandle(STD_OUTPUT_HANDLE);
hb_gtInit(); /* in ..\gtapi.c */
}
HARBOUR GTINIT( void )

View File

@@ -6,12 +6,18 @@
* GTAPI.C: Generic Terminal for Harbour
*
* Latest mods:
* 1.25 19990718 dholm Moved calls to various gtFunctions out of
* InitializeConsole() in console.c and put
* them in hb_gtInit() in this module. Use
* hb_set.HB_SET_COLOR to initialize the GT
* API color string. Converted // comments.
* 1.24 19990718 ptucker corrected returned color strings so ordering
* is the same as clipper.
* 1.23 19990718 ptucker implimented surface for gtGet/SetColorStr()
* changed to allow unlimited color pairs.
*/
#include <set.h>
#include <gtapi.h>
/* TODO: functions not implemented yet
@@ -25,7 +31,6 @@ static USHORT s_uiCurrentRow = 0;
static USHORT s_uiCurrentCol = 0;
static USHORT s_uiDispCount = 0;
static USHORT s_uiColorIndex = 0;
static char s_szColorStr[CLR_STRLEN] = {"W/N, N/W, N/N, N/N, N/W"};
int *_Color;
int _ColorCount;
@@ -34,12 +39,14 @@ int _ColorCount;
void hb_gtInit(void)
{
gtInit();
hb_gtSetPos( gtWhereY(), gtWhereX() );
_Color = (int *)hb_xgrab(5*sizeof(int));
_ColorCount = 5;
hb_gtSetColorStr( s_szColorStr );
hb_gtSetColorStr( hb_set.HB_SET_COLOR );
}
void hb_gtexit(void)
void hb_gtExit(void)
{
hb_xfree( _Color );
}
@@ -210,7 +217,7 @@ int hb_gtSetColorStr(char * fpColorString)
case '*':
nBack |= 128;
break;
case 'I': // =N/W
case 'I': /* =N/W */
if( npos == _ColorCount )
{
_Color = (int *)hb_xrealloc( _Color, sizeof(int)*(npos +1) );
@@ -220,7 +227,7 @@ int hb_gtSetColorStr(char * fpColorString)
nBack = nColor = 0;
nSkip = 1;
break;
case 'X': // always sets forground to 'N'
case 'X': /* always sets forground to 'N' */
nColor=0;
break;
case ',':
@@ -251,7 +258,7 @@ int hb_gtGetColorStr(char * fpColorString)
char *sColors;
int i,j=0,k = 0, nColor;
sColors = (char *)hb_xgrab( _ColorCount * 8 + 1 ); // max possible
sColors = (char *)hb_xgrab( _ColorCount * 8 + 1 ); /* max possible */
for( i=0; i<_ColorCount; i++ )
{

View File

@@ -29,6 +29,10 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
their web site at http://www.gnu.org/).
V 1.48 David G. Holm Simplified SET_COLOR handling.
Made changes to deal with the
hb_set.HB_SET_COLOR string having
a fixed 64 byte size.
V 1.46 Paul Tucker Modifed SetColor handling.
V 1.43 David G. Holm Removed the obsolete hb_set_fixed,
which I should have done when I took
@@ -173,7 +177,6 @@ BOOL hb_set_century;
int hb_set_althan;
int hb_set_extrahan;
int hb_set_printhan;
char *hb_SetColor( char *sColor );
HARBOUR HB_SET( void );
HARBOUR HB___SETCENTURY( void );
@@ -666,13 +669,7 @@ HARBOUR HB_SET (void)
if (args > 1) hb_set.HB_SET_CANCEL = set_logical (pArg2);
break;
case HB_SET_COLOR :
/*
if (hb_set.HB_SET_COLOR) hb_retc (hb_set.HB_SET_COLOR);
else hb_retc ("");
if (args > 1) hb_set.HB_SET_COLOR = set_string (pArg2, hb_set.HB_SET_COLOR);
*/
if (hb_set.HB_SET_COLOR) hb_xfree(hb_set.HB_SET_COLOR );
hb_retc( hb_set.HB_SET_COLOR = hb_SetColor( args>1 ? IS_NIL(pArg2) ? "" : pArg2->item.asString.value : (char *)0));
hb_retc( hb_setColor( args ? pArg2->item.asString.value : (char *)0) );
break;
case HB_SET_CONFIRM :
hb_retl (hb_set.HB_SET_CONFIRM);
@@ -899,8 +896,8 @@ void hb_setInitialize (void)
hb_set.HB_SET_ALTFILE = 0; /* NULL pointer */
hb_set.HB_SET_BELL = FALSE;
hb_set.HB_SET_CANCEL = TRUE;
hb_set.HB_SET_COLOR = (char*)hb_xgrab (20UL);
memcpy (hb_set.HB_SET_COLOR, "W/N,N/W,N/N,N/N,N/W", 20);
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;
hb_set.HB_SET_CONSOLE = TRUE;
hb_set.HB_SET_CURSOR = SC_NORMAL;
@@ -951,8 +948,6 @@ void hb_setRelease (void)
if (hb_set.HB_SET_ALTFILE)
hb_xfree (hb_set.HB_SET_ALTFILE);
if (hb_set.HB_SET_COLOR)
hb_xfree (hb_set.HB_SET_COLOR);
if (hb_set.HB_SET_DATEFORMAT)
hb_xfree (hb_set.HB_SET_DATEFORMAT);
if (hb_set.HB_SET_DEFAULT)

View File

@@ -24,23 +24,40 @@
#include "pcode.h"
#include <init.h>
#include <set.h>
#ifdef HARBOUR_USE_GTAPI
#include <gtapi.h>
#else
static char old_string[ sizeof( hb_set.HB_SET_COLOR ) ];
#endif
int hb_gtSetColorStr(char * fpColorString);
int hb_gtGetColorStr(char * fpColorString);
void hb_gtexit(void);
/* From strings.c */
char *hb_strUpper(char *szText, long lLen);
char *hb_SetColor( char *sColor )
char *hb_setColor( char *sColor )
{
char *color;
#ifdef HARBOUR_USE_GTAPI
hb_gtGetColorStr( hb_set.HB_SET_COLOR );
#else
strncpy (old_string, hb_set.HB_SET_COLOR, sizeof( hb_set.HB_SET_COLOR ) );
old_string[ sizeof( hb_set.HB_SET_COLOR ) - 1 ] = 0;
#endif
color = (char *)hb_xgrab( 256 );
hb_gtGetColorStr( color );
if( sColor )
hb_gtSetColorStr( sColor );
/* The caller is responsible for releasing this */
return (char *)hb_xrealloc( color, strlen( color )+1 );
if( sColor )
{
#ifdef HARBOUR_USE_GTAPI
hb_gtSetColorStr( sColor );
#else
strncpy (hb_set.HB_SET_COLOR, sColor, sizeof( hb_set.HB_SET_COLOR ) );
hb_set.HB_SET_COLOR[ sizeof( hb_set.HB_SET_COLOR ) - 1 ] = 0;
hb_strUpper( hb_set.HB_SET_COLOR, strlen( hb_set.HB_SET_COLOR ) );
#endif
}
#ifdef HARBOUR_USE_GTAPI
return hb_set.HB_SET_COLOR;
#else
return old_string;
#endif
}
HARBOUR HB_SETCOLOR( void );
@@ -56,15 +73,14 @@ HB_INIT_SYMBOLS_END( SETCOLOR__InitSymbols );
HARBOUR HB_SETCOLOR( void )
{
char *color;
hb_retc( color = hb_SetColor( hb_pcount() == 1 ? hb_parc(1) : NULL ) );
hb_xfree( color );
hb_retc( hb_setColor( hb_pcount() ? hb_parc(1) : NULL ) );
}
/* TODO: This is a temporary fix - Call it on exit if you use SetColor() */
HARBOUR HB_GTEXIT( void )
{
hb_gtexit();
#ifdef HARBOUR_USE_GTAPI
hb_gtExit();
#endif
}

View File

@@ -42,6 +42,7 @@
#include <itemapi.h>
#include <ctype.h>
#include <time.h>
#include <dates.h>
HARBOUR HB_ADAYS(void);
HARBOUR HB_AMONTHS(void);
@@ -67,16 +68,11 @@ HB_INIT_SYMBOLS_BEGIN( Dates2__InitSymbols )
{ "ISLEAPYEAR", FS_PUBLIC, HB_ISLEAPYEAR , 0 },
{ "WOM", FS_PUBLIC, HB_WOM , 0 },
{ "WOY", FS_PUBLIC, HB_WOY , 0 }
HB_INIT_SYMBOLS_END( Dates2__InitSymbols )
HB_INIT_SYMBOLS_END( Dates2__InitSymbols );
#if ! defined(__GNUC__)
#pragma startup Dates2__InitSymbols
#endif
/* In dates.c module */
void hb_dateDecode( long julian, long * plDay, long * plMonth, long * plYear );
long hb_dow( long d, long m, long y );
/* In msgxxx.c modules */
extern char *hb_monthsname[];
extern char *hb_daysname[];

View File

@@ -89,7 +89,6 @@ PRG_SOURCES=\
strings.prg \
strings2.prg \
strings3.prg \
strings4.prg \
strip.prg \
syserror.prg \
t1.prg \
@@ -108,6 +107,7 @@ PRG_SOURCES=\
testtok.prg \
testvars.prg \
testwarn.prg \
tstcolor.prg \
transfrm.prg \
val.prg \
version.prg \

View File

@@ -52,7 +52,6 @@ function Main()
QOut( "L .T. ", empty( .T. ) )
QOut( "L .F. ", empty( .F. ) )
QOut( "U NIL ", empty( NIL ) )
QOut( "U ", empty( ) )
QOut( "A {1} ", empty( {1} ) )
QOut( "A {} ", empty( {} ) )
QOut( "A {0} ", empty( {0} ) )

View File

@@ -8,7 +8,7 @@ so there!!!=
another=section
[Date Test]
Today=19990617
Today=19990718
[Bool Test]
True=.t.

View File

@@ -1,11 +0,0 @@
//
// $Id$
//
function Main()
QOut( "Inside strings4" )
At() // generating an error
return nil