See ChangeLog entry 19990704-23:45 EDT David G. Holm <dholm@jsd-llc.com>
This commit is contained in:
@@ -1,3 +1,40 @@
|
||||
19990704-23:45 EDT David G. Holm <dholm@jsd-llc.com>
|
||||
* makefile.b16
|
||||
+ Added devoutp
|
||||
* makefile.b31
|
||||
+ Added devoutp
|
||||
* makefile.b32
|
||||
+ Added devoutp
|
||||
* makefile.icc
|
||||
+ Added devoutp
|
||||
* makefile.vc
|
||||
+ Added devoutp
|
||||
+ Added commands to compile .prg to .c
|
||||
* include/dates.h
|
||||
+ Added date format parameter to hb_dtoc()
|
||||
* source/rtl/Makefile
|
||||
+ Added devoutp
|
||||
* source/rtl/console.c
|
||||
! Corrected non-GT API version of DISPBOX() to also draw lines
|
||||
+ Added date format parameter to call to hb_dtoc()
|
||||
* source/rtl/dates.c
|
||||
+ Added date format parameter to hb_dtoc() instead of always
|
||||
using hb_set.HB_SET_DATEFORMAT, so that TRANSFORM() can use it
|
||||
+ Added hb_set.HB_SET_DATEFORMAT as parameter in call to hb_dtoc()
|
||||
+ source/rtl/devoutp.prg
|
||||
+ New module for HARBOUR DEVOUTPICT(<xExp>,<cPict>,[<cColor>])
|
||||
* source/rtl/gtapi.c
|
||||
! Corrected hb_gtBox to also draw lines
|
||||
* source/rtl/strings.c
|
||||
+ Added hb_set.HB_SET_DATEFORMAT as parameter in call to hb_dtoc()
|
||||
* source/rtl/transfrm.c
|
||||
! Corrected date transformation to call hb_dtoc() with either
|
||||
hb_set.HB_SET_DATEFORMAT, the 2-digit year british date format,
|
||||
or the 4-digit year british date format (depending upon the use
|
||||
of the format function "@E" and the setting for SET CENTURY
|
||||
+ tests/working/say.prg
|
||||
+ Demonstrates DEVPICT() by use of @ ... SAY ... PICTURE ...
|
||||
|
||||
19990704-18:50 EDT David G. Holm <dholm@jsd-llc.com>
|
||||
* include/ctoharb.h
|
||||
* Converted length parameter in PushString to ULONG
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#ifndef HB_DATES_H_
|
||||
#define HB_DATES_H_
|
||||
|
||||
char * hb_dtoc (char * szDate, char * szDateFormat);
|
||||
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 );
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
PROJECT: harbour.lib libs\b16\terminal.lib libs\win16\terminal.lib harbour.exe
|
||||
|
||||
harbour.lib : arrays.obj asort.obj classes.obj codebloc.obj dates.obj datesx.obj \
|
||||
debug.obj descend.obj dynsym.obj environ.obj error.obj \
|
||||
debug.obj descend.obj devoutp.obj dynsym.obj environ.obj error.obj \
|
||||
errorapi.obj errorsys.obj extend.obj files.obj \
|
||||
hardcr.obj initsymb.obj itemapi.obj math.obj \
|
||||
mathx.obj mtran.obj objfunc.obj set.obj stringp.obj strings.obj \
|
||||
@@ -36,6 +36,7 @@ dates.obj : dates.c extend.h hbdefs.h
|
||||
datesx.obj : datesx.c extend.h hbdefs.h
|
||||
debug.obj : debug.c extend.h hbdefs.h
|
||||
descend.obj : descend.c extend.h hbdefs.h
|
||||
devoutp.obj : devoutp.c extend.h hbdefs.h
|
||||
dynsym.obj : dynsym.c extend.h hbdefs.h
|
||||
environ.obj : environ.c extend.h hbdefs.h
|
||||
error.obj : error.c extend.h hbdefs.h
|
||||
@@ -59,6 +60,7 @@ tclass.obj : tclass.c extend.h hbdefs.h
|
||||
transfrm.obj : transfrm.c extend.h hbdefs.h
|
||||
|
||||
asort.c : asort.prg harbour.exe
|
||||
devout.c : devout.prg harbour.exe
|
||||
error.c : error.prg harbour.exe
|
||||
errorsys.c : errorsys.prg harbour.exe
|
||||
objfunc.c : objfunc.prg harbour.exe
|
||||
|
||||
@@ -15,7 +15,7 @@ c_opt = -mh -O2 -I.\include -DHARBOUR_USE_GTAPI
|
||||
PROJECT: harbour.lib hbtools.lib terminal.lib libs\win16\terminal.lib
|
||||
|
||||
harbour.lib : arrays.obj asort.obj classes.obj codebloc.obj copyfile.obj \
|
||||
dates.obj descend.obj dir.obj dynsym.obj environ.obj \
|
||||
dates.obj descend.obj devoutp.obj dir.obj dynsym.obj environ.obj \
|
||||
error.obj errorapi.obj errorsys.obj extend.obj \
|
||||
files.obj gtapi.obj hardcr.obj initsymb.obj itemapi.obj \
|
||||
math.obj mtran.obj msguk.obj objfunc.obj \
|
||||
@@ -48,6 +48,7 @@ codebloc.obj : codebloc.c extend.h hbdefs.h
|
||||
copyfile.obj : copyfile.c extend.h hbdefs.h itemapi.h errorapi.h error.ch filesys.h fileio.ch filesys.api
|
||||
dates.obj : dates.c extend.h hbdefs.h dates.h set.h
|
||||
descend.obj : descend.c extend.h hbdefs.h
|
||||
devoutp.obj : devoutp.prg extend.h hbdefs.h init.h pcode.h
|
||||
dir.obj : dir.c extend.h hbdefs.h
|
||||
environ.obj : environ.c extend.h hbdefs.h
|
||||
error.obj : error.prg extend.h hbdefs.h init.h pcode.h
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
PROJECT: harbour.exe harbour.lib libs\b32\terminal.lib libs\win32\terminal.lib
|
||||
|
||||
harbour.lib : arrays.obj asort.obj classes.obj codebloc.obj \
|
||||
dates.obj datesx.obj \
|
||||
debug.obj descend.obj dir.obj dynsym.obj environ.obj error.obj \
|
||||
dates.obj datesx.obj debug.obj descend.obj devoutp.obj \
|
||||
dir.obj dynsym.obj environ.obj error.obj \
|
||||
errorapi.obj errorsys.obj extend.obj files.obj \
|
||||
hardcr.obj hb_f.obj initsymb.obj itemapi.obj \
|
||||
math.obj mathx.obj msguk.obj mtran.obj objfunc.obj set.obj \
|
||||
@@ -32,6 +32,7 @@ dates.obj : dates.c extend.h hbdefs.h
|
||||
datesx.obj : datesx.c extend.h hbdefs.h
|
||||
debug.obj : debug.c extend.h hbdefs.h
|
||||
descend.obj : descend.c extend.h hbdefs.h
|
||||
devout.obj : devout.c extend.h hbdefs.h
|
||||
dir.obj : dir.c extend.h hbdefs.h
|
||||
dynsym.obj : dynsym.c extend.h hbdefs.h
|
||||
environ.obj : environ.c extend.h hbdefs.h
|
||||
@@ -58,6 +59,7 @@ tclass.obj : tclass.c extend.h hbdefs.h
|
||||
transfrm.obj : transfrm.c extend.h hbdefs.h
|
||||
|
||||
asort.c : asort.prg harbour.exe
|
||||
devoutp.c : devoutp.prg harbour.exe
|
||||
error.c : error.prg harbour.exe
|
||||
errorsys.c : errorsys.prg harbour.exe
|
||||
objfunc.c : objfunc.prg harbour.exe
|
||||
|
||||
@@ -23,6 +23,7 @@ $(path_lib)\harbour.lib : \
|
||||
$(path_obj)\console.obj \
|
||||
$(path_obj)\copyfile.obj \
|
||||
$(path_obj)\descend.obj \
|
||||
$(path_obj)\devoutp.obj \
|
||||
$(path_obj)\dates.obj \
|
||||
$(path_obj)\dir.obj \
|
||||
$(path_obj)\dynsym.obj \
|
||||
@@ -147,6 +148,11 @@ $(path_obj)\asort.obj : {$(path_prg)}\asort.prg $(path_h)\pcode.h $(path_h)\i
|
||||
icc /C+ $(c_opt) /Fo$@ /Tpsource\rtl\asort.c
|
||||
ilib .\libs\icc\harbour.lib -+$@,,
|
||||
|
||||
$(path_obj)\devoutp.obj : {$(path_prg)}\devoutp.prg $(path_h)\pcode.h $(path_h)\init.h $(path_h)\extend.h $(path_h)\hbdefs.h {$(path_exe)}harbour.exe
|
||||
$(path_exe)\harbour source\rtl\devoutp /n /osource\rtl
|
||||
icc /C+ $(c_opt) /Fo$@ /Tpsource\rtl\devoutp.c
|
||||
ilib .\libs\icc\harbour.lib -+$@,,
|
||||
|
||||
$(path_obj)\error.obj : {$(path_prg)}\error.prg $(path_h)\pcode.h $(path_h)\init.h $(path_h)\extend.h $(path_h)\hbdefs.h {$(path_exe)}harbour.exe
|
||||
$(path_exe)\harbour source\rtl\error /n /osource\rtl
|
||||
icc /C+ $(c_opt) /Fo$@ /Tpsource\rtl\error.c
|
||||
|
||||
@@ -52,6 +52,7 @@ HARBOUR_LIB_OBJS = \
|
||||
$(OBJ_DIR)\codebloc.obj \
|
||||
$(OBJ_DIR)\console.obj \
|
||||
$(OBJ_DIR)\descend.obj \
|
||||
$(OBJ_DIR)\devoutp.obj \
|
||||
$(OBJ_DIR)\dates.obj \
|
||||
$(OBJ_DIR)\dir.obj \
|
||||
$(OBJ_DIR)\dynsym.obj \
|
||||
@@ -164,12 +165,24 @@ $(COMPILER_DIR)\harbourl.c : $(COMPILER_DIR)\harbour.l
|
||||
# RTL source depencies below. Add as needed
|
||||
#
|
||||
|
||||
$(RTL_DIR)\achoice.c : $(RTL_DIR)\achoice.prg
|
||||
$(HARBOUR_EXE) $(HARBOURFLAGS) -o$@ $**
|
||||
|
||||
$(OBJ_DIR)\achoice.obj : $(RTL_DIR)\achoice.c
|
||||
$(CC) $(CLIBFLAGS) -Fo$@ $**
|
||||
|
||||
$(OBJ_DIR)\arrays.obj : $(RTL_DIR)\arrays.c
|
||||
$(CC) $(CLIBFLAGS) -Fo$@ $**
|
||||
|
||||
$(RTL_DIR)\asort.c : $(RTL_DIR)\asort.prg
|
||||
$(HARBOUR_EXE) $(HARBOURFLAGS) -o$@ $**
|
||||
|
||||
$(OBJ_DIR)\asort.obj : $(RTL_DIR)\asort.c
|
||||
$(CC) $(CLIBFLAGS) -Fo$@ $**
|
||||
|
||||
$(RTL_DIR)\classes.c : $(RTL_DIR)\classes.prg
|
||||
$(HARBOUR_EXE) $(HARBOURFLAGS) -o$@ $**
|
||||
|
||||
$(OBJ_DIR)\classes.obj : $(RTL_DIR)\classes.c
|
||||
$(CC) $(CLIBFLAGS) -Fo$@ $**
|
||||
|
||||
@@ -185,6 +198,12 @@ $(OBJ_DIR)\dates.obj : $(RTL_DIR)\dates.c
|
||||
$(OBJ_DIR)\descend.obj : $(RTL_DIR)\descend.c
|
||||
$(CC) $(CLIBFLAGS) -Fo$@ $**
|
||||
|
||||
$(RTL_DIR)\devoutp.c : $(RTL_DIR)\devoutp.prg
|
||||
$(HARBOUR_EXE) $(HARBOURFLAGS) -o$@ $**
|
||||
|
||||
$(OBJ_DIR)\devoutp.obj : $(RTL_DIR)\devoutp.c
|
||||
$(CC) $(CLIBFLAGS) -Fo$@ $**
|
||||
|
||||
$(OBJ_DIR)\dir.obj : $(RTL_DIR)\dir.c
|
||||
$(CC) $(CLIBFLAGS) -Fo$@ $**
|
||||
|
||||
@@ -194,9 +213,15 @@ $(OBJ_DIR)\environ.obj : $(RTL_DIR)\environ.c
|
||||
$(OBJ_DIR)\errorapi.obj : $(RTL_DIR)\errorapi.c
|
||||
$(CC) $(CLIBFLAGS) -Fo$@ $**
|
||||
|
||||
$(RTL_DIR)\errorsys.c : $(RTL_DIR)\errorsys.prg
|
||||
$(HARBOUR_EXE) $(HARBOURFLAGS) -o$@ $**
|
||||
|
||||
$(OBJ_DIR)\errorsys.obj : $(RTL_DIR)\errorsys.c
|
||||
$(CC) $(CLIBFLAGS) -Fo$@ $**
|
||||
|
||||
$(RTL_DIR)\error.c : $(RTL_DIR)\error.prg
|
||||
$(HARBOUR_EXE) $(HARBOURFLAGS) -o$@ $**
|
||||
|
||||
$(OBJ_DIR)\error.obj : $(RTL_DIR)\error.c
|
||||
$(CC) $(CLIBFLAGS) -Fo$@ $**
|
||||
|
||||
@@ -224,6 +249,9 @@ $(OBJ_DIR)\msguk.obj : $(RTL_DIR)\natmsg\msguk.c
|
||||
$(OBJ_DIR)\mtran.obj : $(RTL_DIR)\mtran.c
|
||||
$(CC) $(CLIBFLAGS) -Fo$@ $**
|
||||
|
||||
$(RTL_DIR)\objfunc.c : $(RTL_DIR)\objfunc.prg
|
||||
$(HARBOUR_EXE) $(HARBOURFLAGS) -o$@ $**
|
||||
|
||||
$(OBJ_DIR)\objfunc.obj : $(RTL_DIR)\objfunc.c
|
||||
$(CC) $(CLIBFLAGS) -Fo$@ $**
|
||||
|
||||
@@ -236,8 +264,8 @@ $(OBJ_DIR)\strcmp.obj : $(RTL_DIR)\strcmp.c
|
||||
$(OBJ_DIR)\strings.obj : $(RTL_DIR)\strings.c
|
||||
$(CC) $(CLIBFLAGS) -Fo$@ $**
|
||||
|
||||
$(OBJ_DIR)\stringp.obj : $(RTL_DIR)\stringp.c
|
||||
$(CC) $(CLIBFLAGS) -Fo$@ $**
|
||||
$(RTL_DIR)\tclass.c : $(RTL_DIR)\tclass.prg
|
||||
$(HARBOUR_EXE) $(HARBOURFLAGS) -o$@ $**
|
||||
|
||||
$(OBJ_DIR)\tclass.obj : $(RTL_DIR)\tclass.c
|
||||
$(CC) $(CLIBFLAGS) -Fo$@ $**
|
||||
@@ -325,6 +353,12 @@ $(OBJ_DIR)\strdiff.obj : $(TOOLS_DIR)\strdiff.c
|
||||
$(OBJ_DIR)\strexpan.obj : $(TOOLS_DIR)\strexpan.c
|
||||
$(CC) $(CLIBFLAGS) -Fo$@ $**
|
||||
|
||||
$(RTL_DIR)\stringp.c : $(RTL_DIR)\stringp.prg
|
||||
$(HARBOUR_EXE) $(HARBOURFLAGS) -o$@ $**
|
||||
|
||||
$(OBJ_DIR)\stringp.obj : $(RTL_DIR)\stringp.c
|
||||
$(CC) $(CLIBFLAGS) -Fo$@ $**
|
||||
|
||||
$(OBJ_DIR)\stringsx.obj : $(TOOLS_DIR)\stringsx.c
|
||||
$(CC) $(CLIBFLAGS) -Fo$@ $**
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ C_SOURCES=\
|
||||
copyfile.c \
|
||||
dates.c \
|
||||
descend.c \
|
||||
devoutp.c \
|
||||
dir.c \
|
||||
environ.c \
|
||||
errorapi.c \
|
||||
@@ -31,6 +32,7 @@ C_SOURCES=\
|
||||
|
||||
PRG_SOURCES=\
|
||||
asort.prg \
|
||||
devoutp.prg \
|
||||
error.prg \
|
||||
errorsys.prg \
|
||||
objfunc.prg \
|
||||
|
||||
@@ -200,7 +200,7 @@ static void hb_out( WORD wParam, hb_out_func_typedef * hb_out_func )
|
||||
switch( hb_parinfo( wParam ) )
|
||||
{
|
||||
case IT_DATE:
|
||||
szText = hb_dtoc( hb_pards( wParam ), szBuffer );
|
||||
szText = hb_dtoc( hb_pards( wParam ), szBuffer, hb_set.HB_SET_DATEFORMAT );
|
||||
if( szText )
|
||||
hb_out_func( szText, strlen( szText ) );
|
||||
break;
|
||||
@@ -424,7 +424,7 @@ void hb_setpos( WORD row, WORD col )
|
||||
#else
|
||||
WORD count;
|
||||
|
||||
if( row < dev_row && col < dev_col )
|
||||
if( row < dev_row || col < dev_col )
|
||||
{
|
||||
printf("\n");
|
||||
dev_col = 0;
|
||||
@@ -764,7 +764,8 @@ HARBOUR HB_DISPBOX (void)
|
||||
char * szBorderStyle = B_SINGLE;
|
||||
int i_top = hb_parni( 1 ), i_left = hb_parni( 2 );
|
||||
int i_bottom = hb_parni( 3 ), i_right = hb_parni( 4 );
|
||||
WORD top, left, bottom, right, count, size = strlen( B_SINGLE );
|
||||
WORD top, left, bottom, right, size = strlen( B_SINGLE );
|
||||
WORD row, col, width, height;
|
||||
char Borders[ 9 ];
|
||||
|
||||
/* Set limits on the box coordinates to (0,0) and (max_row(),max_col()) */
|
||||
@@ -792,6 +793,8 @@ HARBOUR HB_DISPBOX (void)
|
||||
right = left;
|
||||
left = temp;
|
||||
}
|
||||
width = right - left + 1;
|
||||
height = bottom - top + 1;
|
||||
|
||||
/* Determine the box style */
|
||||
if( ISCHAR( 5 ) )
|
||||
@@ -839,24 +842,32 @@ HARBOUR HB_DISPBOX (void)
|
||||
|
||||
/* Draw the box */
|
||||
hb_setpos( top, left );
|
||||
printf( "%c", Borders[ 0 ] ); /* Upper left corner */
|
||||
for( size = left + 1; size < right; size++ )
|
||||
if( height > 1 && width > 1 )
|
||||
printf( "%c", Borders[ 0 ] ); /* Upper left corner */
|
||||
for( col = (height > 1 ? left + 1 : left ); col < (height > 1 ? right : right + 1); col++ )
|
||||
printf( "%c", Borders[ 1 ] ); /* Top line */
|
||||
printf( "%c", Borders[ 2 ] ); /* Upper right corner */
|
||||
hb_setpos( top + 1, left );
|
||||
for( count = top + 1; count < bottom; count++ )
|
||||
if( height > 1 && width > 1 )
|
||||
printf( "%c", Borders[ 2 ] ); /* Upper right corner */
|
||||
for( row = (height > 1 ? top + 1 : top); row < (width > 1 ? bottom : bottom + 1); row++ )
|
||||
{
|
||||
printf( "%c", Borders[ 3 ] ); /* Left side */
|
||||
for( size = left + 1; size < right; size++ )
|
||||
hb_setpos( row, left );
|
||||
if( height > 1 )
|
||||
printf( "%c", Borders[ 3 ] ); /* Left side */
|
||||
if( height > 1 && width > 1) for( col = left + 1; col < right; col++ )
|
||||
printf( "%c", Borders[ 8 ] ); /* Fill */
|
||||
printf( "%c", Borders[ 7 ] ); /* Right side */
|
||||
hb_setpos( count + 1, left );
|
||||
if( height > 1 && width > 1 )
|
||||
printf( "%c", Borders[ 7 ] ); /* Right side */
|
||||
}
|
||||
printf( "%c", Borders[ 6 ] ); /* Bottom left corner */
|
||||
for( size = left + 1; size < right; size++ )
|
||||
printf( "%c", Borders[ 5 ] ); /* Bottom line */
|
||||
printf( "%c", Borders[ 4 ] ); /* Bottom right corner */
|
||||
dev_col += (right - left);
|
||||
if( height > 1 && width > 1)
|
||||
{
|
||||
hb_setpos( bottom, left );
|
||||
col = left;
|
||||
printf( "%c", Borders[ 6 ] ); /* Bottom left corner */
|
||||
for( col = left + 1; col < right; col++ )
|
||||
printf( "%c", Borders[ 5 ] ); /* Bottom line */
|
||||
printf( "%c", Borders[ 4 ] ); /* Bottom right corner */
|
||||
}
|
||||
hb_setpos( bottom + 1, right + 1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -902,4 +913,3 @@ HARBOUR HB_NOSNOW (void)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -208,26 +208,27 @@ HARBOUR HB_CTOD( void )
|
||||
hb_retds( szDateFormat );
|
||||
}
|
||||
|
||||
char * hb_dtoc (char * szDate, char * szDateFormat)
|
||||
char * hb_dtoc (const char * szDate, char * szFormattedDate, const char * szDateFormat)
|
||||
{
|
||||
/*
|
||||
* NOTE: szDateFormat must point to a buffer of at least 11 bytes
|
||||
*/
|
||||
* NOTE: szFormattedDate must point to a buffer of at least 11 bytes.
|
||||
* szDateFormat must point to a buffer holding the date format to use.
|
||||
*/
|
||||
int digit, digit_count, format_count, size;
|
||||
BOOL used_d, used_m, used_y;
|
||||
char *szPtr;
|
||||
const char *szPtr;
|
||||
|
||||
/*
|
||||
* Determine the maximum size of the formatted date string
|
||||
*/
|
||||
size = strlen (hb_set.HB_SET_DATEFORMAT);
|
||||
* Determine the maximum size of the formatted date string
|
||||
*/
|
||||
size = strlen (szDateFormat);
|
||||
if (size > 10) size = 10;
|
||||
|
||||
if( szDate && szDateFormat && strlen( szDate ) == 8 ) /* A valid date is always 8 characters */
|
||||
if( szDate && szFormattedDate && strlen( szDate ) == 8 ) /* A valid date is always 8 characters */
|
||||
{
|
||||
format_count = 0;
|
||||
used_d = used_m = used_y = FALSE;
|
||||
szPtr = hb_set.HB_SET_DATEFORMAT;
|
||||
szPtr = szDateFormat;
|
||||
while (format_count < size)
|
||||
{
|
||||
digit = toupper (*szPtr);
|
||||
@@ -246,28 +247,28 @@ char * hb_dtoc (char * szDate, char * szDateFormat)
|
||||
case 4:
|
||||
if (!used_d && format_count < size)
|
||||
{
|
||||
szDateFormat [format_count++] = '0';
|
||||
szFormattedDate [format_count++] = '0';
|
||||
digit_count--;
|
||||
}
|
||||
case 3:
|
||||
if (!used_d && format_count < size)
|
||||
{
|
||||
szDateFormat [format_count++] = '0';
|
||||
szFormattedDate [format_count++] = '0';
|
||||
digit_count--;
|
||||
}
|
||||
case 2:
|
||||
if (!used_d && format_count < size)
|
||||
{
|
||||
szDateFormat [format_count++] = szDate [6];
|
||||
szFormattedDate [format_count++] = szDate [6];
|
||||
digit_count--;
|
||||
}
|
||||
default:
|
||||
if (!used_d && format_count < size)
|
||||
{
|
||||
szDateFormat [format_count++] = szDate [7];
|
||||
szFormattedDate [format_count++] = szDate [7];
|
||||
digit_count--;
|
||||
}
|
||||
while (digit_count-- > 0 && format_count < size) szDateFormat [format_count++] = digit;
|
||||
while (digit_count-- > 0 && format_count < size) szFormattedDate [format_count++] = digit;
|
||||
}
|
||||
used_d = TRUE;
|
||||
break;
|
||||
@@ -277,28 +278,28 @@ char * hb_dtoc (char * szDate, char * szDateFormat)
|
||||
case 4:
|
||||
if (!used_m && format_count < size)
|
||||
{
|
||||
szDateFormat [format_count++] = '0';
|
||||
szFormattedDate [format_count++] = '0';
|
||||
digit_count--;
|
||||
}
|
||||
case 3:
|
||||
if (!used_m && format_count < size)
|
||||
{
|
||||
szDateFormat [format_count++] = '0';
|
||||
szFormattedDate [format_count++] = '0';
|
||||
digit_count--;
|
||||
}
|
||||
case 2:
|
||||
if (!used_m && format_count < size)
|
||||
{
|
||||
szDateFormat [format_count++] = szDate [4];
|
||||
szFormattedDate [format_count++] = szDate [4];
|
||||
digit_count--;
|
||||
}
|
||||
default:
|
||||
if (!used_m && format_count < size)
|
||||
{
|
||||
szDateFormat [format_count++] = szDate [5];
|
||||
szFormattedDate [format_count++] = szDate [5];
|
||||
digit_count--;
|
||||
}
|
||||
while (digit_count-- > 0 && format_count < size) szDateFormat [format_count++] = digit;
|
||||
while (digit_count-- > 0 && format_count < size) szFormattedDate [format_count++] = digit;
|
||||
}
|
||||
used_m = TRUE;
|
||||
break;
|
||||
@@ -308,33 +309,33 @@ char * hb_dtoc (char * szDate, char * szDateFormat)
|
||||
case 4:
|
||||
if (!used_y && format_count < size)
|
||||
{
|
||||
szDateFormat [format_count++] = szDate [0];
|
||||
szFormattedDate [format_count++] = szDate [0];
|
||||
digit_count--;
|
||||
}
|
||||
case 3:
|
||||
if (!used_y && format_count < size)
|
||||
{
|
||||
szDateFormat [format_count++] = szDate [1];
|
||||
szFormattedDate [format_count++] = szDate [1];
|
||||
digit_count--;
|
||||
}
|
||||
case 2:
|
||||
if (!used_y && format_count < size)
|
||||
{
|
||||
szDateFormat [format_count++] = szDate [2];
|
||||
szFormattedDate [format_count++] = szDate [2];
|
||||
digit_count--;
|
||||
}
|
||||
default:
|
||||
if (!used_y && format_count < size)
|
||||
{
|
||||
szDateFormat [format_count++] = szDate [3];
|
||||
szFormattedDate [format_count++] = szDate [3];
|
||||
digit_count--;
|
||||
}
|
||||
while (digit_count-- > 0 && format_count < size) szDateFormat [format_count++] = digit;
|
||||
while (digit_count-- > 0 && format_count < size) szFormattedDate [format_count++] = digit;
|
||||
}
|
||||
used_y = TRUE;
|
||||
break;
|
||||
default:
|
||||
while (digit_count-- > 0 && format_count < size) szDateFormat [format_count++] = digit;
|
||||
while (digit_count-- > 0 && format_count < size) szFormattedDate [format_count++] = digit;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -342,9 +343,9 @@ char * hb_dtoc (char * szDate, char * szDateFormat)
|
||||
{
|
||||
/* Not a valid date string, so return a blank date with separators */
|
||||
format_count = size; /* size is either 8 or 10 */
|
||||
strncpy( szDateFormat, hb_set.HB_SET_DATEFORMAT, size );
|
||||
strncpy( szFormattedDate, szDateFormat, size );
|
||||
for (digit_count = 0; digit_count < size; digit_count++)
|
||||
switch (szDateFormat [digit_count])
|
||||
switch (szFormattedDate [digit_count])
|
||||
{
|
||||
case 'D':
|
||||
case 'd':
|
||||
@@ -352,18 +353,18 @@ char * hb_dtoc (char * szDate, char * szDateFormat)
|
||||
case 'm':
|
||||
case 'Y':
|
||||
case 'y':
|
||||
szDateFormat [digit_count] = ' ';
|
||||
szFormattedDate [digit_count] = ' ';
|
||||
}
|
||||
}
|
||||
szDateFormat [format_count] = 0;
|
||||
return (szDateFormat);
|
||||
szFormattedDate [format_count] = 0;
|
||||
return (szFormattedDate);
|
||||
}
|
||||
|
||||
HARBOUR HB_DTOC( void )
|
||||
{
|
||||
char * szDate = hb_pards( 1 );
|
||||
char szDateFormat[ 11 ];
|
||||
hb_retc( hb_dtoc (szDate, szDateFormat) );
|
||||
char szFormatted[ 11 ];
|
||||
hb_retc( hb_dtoc( szDate, szFormatted, hb_set.HB_SET_DATEFORMAT ) );
|
||||
}
|
||||
|
||||
/* QUESTION: Should we drop error checkings to make it faster ? */
|
||||
|
||||
75
harbour/source/rtl/devoutp.prg
Normal file
75
harbour/source/rtl/devoutp.prg
Normal file
@@ -0,0 +1,75 @@
|
||||
/* $Id$
|
||||
|
||||
Harbour Project source code
|
||||
|
||||
This file contains the Harbour function that outputs expressions
|
||||
using picture transformations
|
||||
|
||||
Copyright (C) 1999 David G. Holm
|
||||
www - http://www.Harbour-Project.org
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version, with one exception:
|
||||
|
||||
The exception is that if you link the Harbour Runtime Library (HRL)
|
||||
and/or the Harbour Virtual Machine (HVM) with other files to produce
|
||||
an executable, this does not by itself cause the resulting executable
|
||||
to be covered by the GNU General Public License. Your use of that
|
||||
executable is in no way restricted on account of linking the HRL
|
||||
and/or HVM code into it.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
|
||||
their web site at http://www.gnu.org/).
|
||||
|
||||
V 1.0 1999-07-04 - Initial version
|
||||
*/
|
||||
|
||||
/* $DOC$
|
||||
* $FUNCNAME$
|
||||
* DEVOUTPICT
|
||||
* $CATEGORY$
|
||||
* Terminal
|
||||
* $ONELINER$
|
||||
* Outputs the result of any expression using a picture transformation
|
||||
* $SYNTAX$
|
||||
* DEVOUTPICT(<xExp>,<cPicture>[,<cColorString>]) --> NIL
|
||||
* $ARGUMENTS$
|
||||
* <xExp> is any valid expression.
|
||||
* <cPicture> is any picture transformation that TRANSFORM() can use.
|
||||
* <cColorString> is an optional string that specifies a screen color to
|
||||
* use in place of the default color when the output goes to the screen.
|
||||
* $RETURNS$
|
||||
* NIL
|
||||
* $DESCRIPTION$
|
||||
* Outputs any expression using a picture transformation instead of using
|
||||
* the default transformation for the type of expression.
|
||||
* $EXAMPLES$
|
||||
* // Output a negative dollar amount using debit notation.
|
||||
* DEVOUTPICT( -1.25, "@D$ 99,999.99 )
|
||||
* $TESTS$
|
||||
* @ 3,1 SAY -1.25 PICTURE "@D$ 99,999.99"
|
||||
* will display "$( 1.25)" starting on row four, column two of the
|
||||
* current device (without the double quotation marks, of course).
|
||||
* $STATUS$
|
||||
* C
|
||||
* $COMPLIANCE$
|
||||
* DEVOUTPICT() is mostly CA-Clipper compliant. Any differences are due
|
||||
* to enhancements in the Harbour TRANSFORM() over CA-Clipper.
|
||||
* $SEEALSO$
|
||||
* DEVOUT(), TRANSFORM().
|
||||
* $END$
|
||||
*/
|
||||
|
||||
FUNCTION DEVOUTPICT( xValue, cPicture, cColor )
|
||||
LOCAL cText := TRANSFORM( xValue, cPicture )
|
||||
DEVOUT( cText, cPicture )
|
||||
RETURN NIL
|
||||
@@ -35,7 +35,7 @@ int hb_gtBox (USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, char
|
||||
|
||||
USHORT uiRow = uiTop;
|
||||
USHORT uiCol = uiLeft;
|
||||
USHORT tmp;
|
||||
USHORT height, width, tmp;
|
||||
|
||||
if (uiTop > hb_gtMaxRow() || uiBottom > hb_gtMaxRow() ||
|
||||
uiLeft > hb_gtMaxCol() || uiRight > hb_gtMaxCol() ||
|
||||
@@ -50,42 +50,62 @@ int hb_gtBox (USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, char
|
||||
for (tmp = 0; *pbyFrame && tmp < 9; tmp++) cPadChar = pszBox[tmp] = *pbyFrame++;
|
||||
while (tmp < 8) pszBox[tmp++] = cPadChar;
|
||||
pszBox[tmp] = '\0';
|
||||
|
||||
hb_gtDispBegin();
|
||||
|
||||
hb_gtWriteAt(uiRow, uiCol, pszBox + 0, sizeof(BYTE));
|
||||
hb_gtWriteAt(uiRow, uiRight, pszBox + 2, sizeof(BYTE));
|
||||
hb_gtWriteAt(uiBottom, uiCol, pszBox + 6, sizeof(BYTE));
|
||||
hb_gtWriteAt(uiBottom, uiRight, pszBox + 4, sizeof(BYTE));
|
||||
|
||||
for (tmp = uiCol + 1; tmp < uiRight; tmp++)
|
||||
|
||||
/* Ensure that box is drawn from top left to bottom right. */
|
||||
if( uiTop > uiBottom )
|
||||
{
|
||||
hb_gtWriteAt(uiRow, tmp, pszBox + 1, sizeof(BYTE));
|
||||
hb_gtWriteAt(uiBottom, tmp, pszBox + 5, sizeof(BYTE));
|
||||
tmp = uiTop;
|
||||
uiTop = uiBottom;
|
||||
uiBottom = tmp;
|
||||
}
|
||||
if( uiLeft > uiRight )
|
||||
{
|
||||
tmp = uiLeft;
|
||||
uiLeft = uiRight;
|
||||
uiRight = tmp;
|
||||
}
|
||||
|
||||
if (pszBox[8])
|
||||
/* Draw the box or line as specified */
|
||||
height = uiBottom - uiTop + 1;
|
||||
width = uiRight - uiLeft + 1;
|
||||
hb_gtDispBegin();
|
||||
|
||||
if( height > 1 && width > 1 )
|
||||
{
|
||||
for (++uiRow; uiRow < uiBottom; uiRow++)
|
||||
hb_gtWriteAt(uiRow, uiCol, pszBox + 0, sizeof(BYTE));
|
||||
hb_gtWriteAt(uiRow, uiRight, pszBox + 2, sizeof(BYTE));
|
||||
hb_gtWriteAt(uiBottom, uiCol, pszBox + 6, sizeof(BYTE));
|
||||
hb_gtWriteAt(uiBottom, uiRight, pszBox + 4, sizeof(BYTE));
|
||||
}
|
||||
|
||||
for (uiCol = (height > 1 ? uiLeft + 1 : uiLeft); uiCol < (height > 1 ? uiRight : uiRight + 1 ); uiCol++)
|
||||
{
|
||||
hb_gtWriteAt(uiRow, uiCol, pszBox + 1, sizeof(BYTE));
|
||||
if( height > 1 ) hb_gtWriteAt(uiBottom, uiCol, pszBox + 5, sizeof(BYTE));
|
||||
}
|
||||
|
||||
if( pszBox[8] && height > 2 && width > 2 )
|
||||
{
|
||||
for (uiRow = uiTop + 1; uiRow < uiBottom; uiRow++)
|
||||
{
|
||||
tmp = uiCol;
|
||||
hb_gtWriteAt(uiRow, tmp++, pszBox + 7, sizeof(BYTE));
|
||||
while (tmp < uiRight) hb_gtWriteAt(uiRow, tmp++, pszBox + 8, sizeof(BYTE));
|
||||
hb_gtWriteAt(uiRow, tmp, pszBox + 3, sizeof(BYTE));
|
||||
uiCol = uiLeft;
|
||||
hb_gtWriteAt(uiRow, uiCol++, pszBox + 7, sizeof(BYTE));
|
||||
while (uiCol < uiRight) hb_gtWriteAt(uiRow, uiCol++, pszBox + 8, sizeof(BYTE));
|
||||
hb_gtWriteAt(uiRow, uiCol, pszBox + 3, sizeof(BYTE));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (++uiRow; uiRow < uiBottom; uiRow++)
|
||||
for( uiRow = (width > 1 ? uiTop + 1 : uiTop); uiRow < (width > 1 ? uiBottom : uiBottom + 1); uiRow++ )
|
||||
{
|
||||
hb_gtWriteAt(uiRow, uiCol, pszBox + 7, sizeof(BYTE));
|
||||
hb_gtWriteAt(uiRow, uiRight, pszBox + 3, sizeof(BYTE));
|
||||
hb_gtWriteAt(uiRow, uiLeft, pszBox + 7, sizeof(BYTE));
|
||||
if( width > 1 ) hb_gtWriteAt(uiRow, uiRight, pszBox + 3, sizeof(BYTE));
|
||||
}
|
||||
}
|
||||
|
||||
hb_gtDispEnd();
|
||||
|
||||
hb_gtSetPos(uiTop + 1, uiLeft + 1);
|
||||
hb_gtSetPos(uiBottom + 1, uiRight + 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -265,7 +265,7 @@ static char * hb_pad_prep( PHB_ITEM pItem, char * buffer, WORD * pwSize )
|
||||
if( pItem ) switch( pItem->type )
|
||||
{
|
||||
case IT_DATE:
|
||||
szText = hb_dtoc( hb_pards( 1 ), buffer );
|
||||
szText = hb_dtoc( hb_pards( 1 ), buffer, hb_set.HB_SET_DATEFORMAT );
|
||||
*pwSize = strlen( szText );
|
||||
break;
|
||||
case IT_INTEGER:
|
||||
|
||||
@@ -32,7 +32,7 @@ void StackPop( void ); /* TOFIX: Should go away */
|
||||
|
||||
#define PF_LEFT 0x0001 /* @B */
|
||||
#define PF_CREDIT 0x0002 /* @C */
|
||||
#define PF_DEBIT 0x0004 /* @D */
|
||||
#define PF_DEBIT 0x0004 /* @X */
|
||||
#define PF_ZERO 0x0008 /* @0 */
|
||||
#define PF_PARNEG 0x0010 /* @( */
|
||||
#define PF_REMAIN 0x0020 /* @R */
|
||||
@@ -53,15 +53,12 @@ void StackPop( void ); /* TOFIX: Should go away */
|
||||
#define DF_YMD 2
|
||||
#define DF_EOT 3 /* End of table for Century */
|
||||
|
||||
BYTE bCentury = DF_CENTURY; /* Century on */
|
||||
|
||||
/* Multiplication factors for different formats. */
|
||||
|
||||
long lFactDay [] = { 10000, 100, 1, 1000000, 10000, 1 };
|
||||
long lFactMonth[] = { 100, 10000, 100, 10000, 1000000, 100 };
|
||||
long lFactYear [] = { 1, 1, 10000, 1, 1, 10000 };
|
||||
|
||||
char *szDatePict = "DD/MM/YYYY"; /* TODO:Drop SET DATE */
|
||||
char *szBritish[] = { "DD/MM/YY", "DD/MM/YYYY" }; /* For @E */
|
||||
|
||||
/*
|
||||
@@ -126,8 +123,6 @@ int PictFunc( char **szPict, long *lPicLen )
|
||||
/*
|
||||
NumPicture -> Handle a numeric picture.
|
||||
|
||||
This function is ALSO called by DatePicture.
|
||||
|
||||
szPic : Picture
|
||||
lPic : Length of picture
|
||||
iPicFlags : Function flags. NUM_DATE tells whether its a number or date
|
||||
@@ -339,97 +334,20 @@ PHB_ITEM NumDefault( double dValue )
|
||||
/*
|
||||
DatePicture -> Handle dates.
|
||||
|
||||
lDate : Date to handle
|
||||
szDate : Date to handle
|
||||
iPicFlags : Function flags
|
||||
szResult : Buffer of at least size 11 to hold formatted date
|
||||
lRetSize : The size of the returned string is passed here !
|
||||
*/
|
||||
char *DatePicture( long lDate, int iPicFlags, long *lRetSize )
|
||||
char *DatePicture( char * szDate, int iPicFlags, char * szResult, long *lRetSize )
|
||||
{
|
||||
BYTE bFormat;
|
||||
|
||||
int n;
|
||||
int iLenPic; /* Length picture */
|
||||
|
||||
char *szDateFormat; /* Date format to be used */
|
||||
char *szIntPicture; /* Internal picture used */
|
||||
char *szResult;
|
||||
char c;
|
||||
|
||||
long lDay;
|
||||
long lMonth;
|
||||
long lYear;
|
||||
|
||||
double dIn;
|
||||
|
||||
char * szDateFormat;
|
||||
if( iPicFlags & PF_BRITISH )
|
||||
{
|
||||
bFormat = DF_DMY; /* Just use british */
|
||||
szDateFormat = szBritish[ bCentury ];
|
||||
szDateFormat = szBritish[ ( hb_set_century ? 1 : 0 ) ];
|
||||
}
|
||||
else
|
||||
{
|
||||
szDateFormat = szDatePict; /* Analyze date format */
|
||||
c = toupper( *szDateFormat );
|
||||
if( c == 'D' )
|
||||
bFormat = DF_DMY;
|
||||
else if ( c == 'M' )
|
||||
bFormat = DF_MDY;
|
||||
else if ( c == 'Y' )
|
||||
bFormat = DF_YMD;
|
||||
else /* QUESTION: Error ? */
|
||||
bFormat = DF_DMY;
|
||||
}
|
||||
|
||||
if( lDate <= 0 ) /* Missing date */
|
||||
{
|
||||
lDay = 0;
|
||||
lMonth = 0;
|
||||
lYear = 0;
|
||||
iPicFlags |= PF_EMPTY; /* Suppress empty */
|
||||
}
|
||||
else
|
||||
{
|
||||
iPicFlags |= PF_ZERO; /* Pad with zeros */
|
||||
hb_dateDecode( lDate, &lDay, &lMonth, &lYear );
|
||||
/* Calculate d/m/y */
|
||||
}
|
||||
iLenPic = strlen( szDateFormat );
|
||||
szIntPicture = (char *) hb_xgrab( iLenPic+1 );
|
||||
for( n = 0; n < iLenPic; n++ ) /* Create internal picture */
|
||||
{
|
||||
c = toupper(szDateFormat[n]);
|
||||
if( c == 'D' || c == 'M' || c == 'Y' ) /* Change format markers */
|
||||
{
|
||||
szIntPicture[n] = lDay ? '9' : ' '; /* Empty date -> No picture */
|
||||
}
|
||||
else
|
||||
szIntPicture[n] = szDateFormat[n]; /* Copy the pattern */
|
||||
}
|
||||
szIntPicture[n] = 0; /* Close the string */
|
||||
|
||||
iPicFlags |= PF_NUMDATE; /* Internal date flag */
|
||||
|
||||
if( bCentury )
|
||||
bFormat += DF_EOT; /* Use the second part */
|
||||
|
||||
/* */
|
||||
/* Transfer the date to a number. Example : */
|
||||
/* */
|
||||
/* bFormat == DMY 12/05/1925 => 12051925 d*1M + m*10K + y */
|
||||
/* bFormat == YMD 1998.05.25 => 19980525 d + m*100 + y*10K */
|
||||
/* */
|
||||
|
||||
dIn = ( (double) lDay ) * lFactDay [ bFormat ];
|
||||
dIn += ( (double) lMonth ) * lFactMonth[ bFormat ];
|
||||
if( iLenPic == 8 ) /* 2 digit year. Y2K? */
|
||||
dIn += ( (double) (lYear % 100) ) * lFactYear [ bFormat ];
|
||||
else /* 4 digit year */
|
||||
dIn += ( (double) lYear ) * lFactYear [ bFormat ];
|
||||
|
||||
szResult = NumPicture( szIntPicture, iLenPic, iPicFlags, dIn, lRetSize );
|
||||
/* And give to NumPicture */
|
||||
hb_xfree( szIntPicture );
|
||||
|
||||
else szDateFormat = hb_set.HB_SET_DATEFORMAT;
|
||||
* lRetSize = strlen( hb_dtoc( szDate, szResult, szDateFormat ) );
|
||||
return( szResult );
|
||||
}
|
||||
|
||||
@@ -615,10 +533,10 @@ HARBOUR HB_TRANSFORM( void )
|
||||
break;
|
||||
}
|
||||
case IT_DATE:
|
||||
{ /* Date is currently British; Century is on */
|
||||
szResult = DatePicture( pExp->item.asDate.value, iPicFlags, &lResultPos );
|
||||
{
|
||||
char szResult[ 11 ];
|
||||
DatePicture( hb_pards( 1 ), iPicFlags, szResult, &lResultPos );
|
||||
hb_retclen( szResult, lResultPos );
|
||||
hb_xfree( szResult );
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -669,9 +587,9 @@ HARBOUR HB_TRANSFORM( void )
|
||||
}
|
||||
case IT_DATE:
|
||||
{
|
||||
szResult = DatePicture( pExp->item.asDate.value, iPicFlags, &lResultPos );
|
||||
char szResult[ 11 ];
|
||||
DatePicture( hb_pards( 1 ), iPicFlags, szResult, &lResultPos );
|
||||
hb_retclen( szResult, lResultPos );
|
||||
hb_xfree( szResult );
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
18
harbour/tests/working/say.prg
Normal file
18
harbour/tests/working/say.prg
Normal file
@@ -0,0 +1,18 @@
|
||||
// Tests @ SAY with and without PICTURE clauses
|
||||
|
||||
function Main()
|
||||
CLS
|
||||
SET CENTURY ON
|
||||
@ 2,39 TO 7,39 DOUBLE
|
||||
@ 0,0 SAY "Testing @ SAY with and without PICTURE clauses"
|
||||
@ 0,60 SAY DATE()
|
||||
SET CENTURY OFF
|
||||
@ 2,1 SAY -1.25
|
||||
@ 2,41 SAY -1.25 PICTURE "@( 99,999.99"
|
||||
@ 3,1 SAY 1.25 PICTURE "@( 9,999.99"
|
||||
@ 3,41 SAY 1.25 PICTURE "@( $9,999.99"
|
||||
@ 5,1 SAY DATE()
|
||||
@ 5,41 SAY DATE() PICTURE "@E"
|
||||
@ 7,1 SAY "Hello"
|
||||
@ 7,41 SAY "Hello" PICTURE "@!"
|
||||
return nil
|
||||
Reference in New Issue
Block a user