See ChangeLog entry 19990604-20:20 EDT David G. Holm <dholm@jsd-llc.com>

This commit is contained in:
David G. Holm
1999-06-05 01:27:32 +00:00
parent 4e2d7cc0b4
commit 71b8dd0275
12 changed files with 309 additions and 59 deletions

View File

@@ -1,3 +1,34 @@
19990604-20:20 EDT David G. Holm <dholm@jsd-llc.com>
Thanks go to Jose Lalin <dezac@corevia.com> for CDOW() and CMONTH() (and
their support functions), msggal.c, msgspa.c, and msguk.c and cdow.prg,
to Felipe G. Coury <fcoury@flexsys-ci.com> for msgpor.c, and to Eddie
Runia <runia@solair1.inter.NL.net> for msgdut.c
* makefile.dos
- Added source/rtl/natmsg
* source/rtl/console.c
- Separated screen and printer coordinates
- Moved HARBOUR ROW() and HARBOUR COL() from gtapi.c
- Added rudimentary screen positioning when not using the GT API
* source/rtl/dates.c
- Added HARBOUR CDOW(), HARBOUR CMONTH(), and support functions
* source/rtl/gtapi.c
- Moved HARBOUR ROW() and HARBOUR COL() to console.c
+ source/rtl/natmsg/makefile.dos
- New DJGPP makefile for national language message files
Note: Only msguk goes into the library
+ source/rtl/natmsg/msgdut.c
- National language message file for Dutch
+ source/rtl/natmsg/msggal.c
- National language message file for ?
+ source/rtl/natmsg/msgpor.c
- National language message file for Portugese
+ source/rtl/natmsg/msgsp.c
- National language message file for Spanish
+ source/rtl/natmsg/msguk.c
- National language message file for English
+ tests/working/cdow.prg
- Test program for CDOW() and CMONTH()
19990605-00:22 CET Eddie Runia
* tests/broken/exittest.prg; tests/broken/codebloc.prg
removed, since they work !

View File

@@ -3,7 +3,7 @@
.phony: compiler vm rtl tests
all: compiler vm rtl tools
all: compiler nat vm rtl tools
compiler:
make -r -w --directory=source/compiler -f makefile.dos
@@ -14,6 +14,9 @@ vm:
rtl:
make -w --directory=source/rtl -f makefile.dos
nat:
make -w --directory=source/rtl/natmsg -f makefile.dos
tools:
make -w --directory=source/tools -f makefile.dos
@@ -25,5 +28,6 @@ clean:
make -r -w --directory=source/compiler -f makefile.dos clean
make -w --directory=source/vm -f makefile.dos clean
make -w --directory=source/rtl -f makefile.dos clean
make -w --directory=source/rtl/natmsg -f makefile.dos clean
make -w --directory=source/tools -f makefile.dos clean
# make -w --directory=tests -f makefile.dos clean

View File

@@ -11,12 +11,14 @@
#include <ctoharb.h>
#include <dates.h>
#include <set.h>
#ifdef __DJGPP__
#include <unistd.h>
#endif
#ifdef USE_GTAPI
#include <gtapi.h>
#endif
static unsigned short dev_row;
static unsigned short dev_col;
static unsigned short dev_row, dev_col, p_row, p_col;
static char CrLf [3];
void InitializeConsole( void )
@@ -31,6 +33,25 @@ void InitializeConsole( void )
#else
dev_row = 0;
dev_col = 0;
#endif
p_row = p_col = 0;
}
USHORT hb_maxrow( void )
{
#ifdef USE_GTAPI
return _gtMaxRow ();
#else
return 23;
#endif
}
USHORT hb_maxcol( void )
{
#ifdef USE_GTAPI
return _gtMaxCol ();
#else
return 79;
#endif
}
@@ -62,7 +83,6 @@ static void hb_out( WORD wParam, void_func_int * hb_out_func )
{
char * szText;
PHB_ITEM pItem = _param( wParam, IT_ANY );
ULONG ulLenText;
char szBuffer [11];
switch( _parinfo( wParam ) )
@@ -153,6 +173,12 @@ static void hb_altout( char * fpStr, WORD uiLen )
WORD uiCount;
for( uiCount = 0; uiCount < uiLen; uiCount++ )
printf( "%c", fpStr[ uiCount ] );
dev_col += uiLen;
if( dev_col > hb_maxcol() )
{
dev_row += (uiLen / (hb_maxcol() + 1));
dev_col -= (uiLen % (hb_maxcol() + 1));
}
#endif
}
if( hb_set.HB_SET_ALTERNATE && hb_set_althan >= 0 )
@@ -170,7 +196,7 @@ static void hb_devout( char * fpStr, WORD uiLen )
{
/* Display to printer if SET DEVICE TO PRINTER and valid printer file */
write( hb_set_printhan, fpStr, uiLen );
dev_col += uiLen;
p_col += uiLen;
}
else
{
@@ -182,32 +208,46 @@ static void hb_devout( char * fpStr, WORD uiLen )
WORD uiCount;
for( uiCount = 0; uiCount < uiLen; uiCount++ )
printf( "%c", fpStr[ uiCount ] );
dev_col += uiLen;
if( dev_col > hb_maxcol() )
{
dev_row += (uiLen / (hb_maxcol() + 1));
dev_col -= (uiLen % (hb_maxcol() + 1));
}
#endif
}
}
void hb_devpos( int row, int col )
void hb_devpos( USHORT row, USHORT col )
{
int count;
/* Position printer if SET DEVICE TO PRINTER and valid printer file
otherwise position console */
if( stricmp( hb_set.HB_SET_DEVICE, "PRINTER" ) == 0 && hb_set_printhan >= 0 )
{
if( row < dev_row )
if( row < p_row )
{
write( hb_set_printhan, "\x0C", 1 );
dev_row = dev_col = 0;
p_row = p_col = 0;
}
for( count = dev_row; count < row; count++ ) write( hb_set_printhan, CrLf, strlen (CrLf) );
for( count = p_row; count < row; count++ ) write( hb_set_printhan, CrLf, strlen (CrLf) );
if( row > p_row ) p_col = 0;
for( count = p_col; count < col; count++ ) write( hb_set_printhan, " ", 1 );
p_row = row;
p_col = col;
}
else
{
#ifdef USE_GTAPI
_gtSetPos( row, col );
#else
for( count = dev_row; count < row; count++ ) printf("\n");
if( row > dev_row ) dev_col = 0;
for( count = dev_col; count < col; count++ ) write( hb_set_printhan, " ", 1 );
for( count = dev_col; count < col; count++ ) printf(" ");
#endif
dev_row = row;
dev_col = col;
}
#ifdef USE_GTAPI
else
_gtSetPos( row, col );
#endif
}
HARBOUR OUTSTD( void ) /* writes a list of values to the standard output device */
@@ -234,7 +274,6 @@ HARBOUR OUTERR( void ) /* writes a list of values to the standard error device *
HARBOUR QQOUT( void ) /* writes a list of values to the current device (screen or printer) and is affected by SET ALTERNATE */
{
BOOL bScreen;
WORD w;
for( w = 0; w < _pcount(); w++ )
@@ -268,7 +307,6 @@ HARBOUR DEVPOS( void ) /* Sets the screen and/or printer position */
HARBOUR DEVOUT( void ) /* writes a single values to the current device (screen or printer), but is not affected by SET ALTERNATE */
{
BOOL bScreen;
if( _pcount() > 0 )
{
char fpOldColor[ 64 ];
@@ -296,18 +334,18 @@ HARBOUR EJECT( void ) /* Ejects the current page from the printer */
if( stricmp( hb_set.HB_SET_DEVICE, "PRINTER" ) == 0 && hb_set_printhan >= 0 )
{
write( hb_set_printhan, "\x0C", 1 );
dev_row = dev_col = 0;
p_row = p_col = 0;
}
}
HARBOUR PROW( void ) /* Returns the current printer row position */
{
_retni( dev_row );
_retni( p_row );
}
HARBOUR PCOL( void ) /* Returns the current printer row position */
{
_retni( dev_col );
_retni( p_col );
}
HARBOUR SETPRC( void ) /* Sets the current printer row and column positions */
@@ -318,48 +356,61 @@ HARBOUR SETPRC( void ) /* Sets the current printer row and column positions */
PHB_ITEM pCol = _param( 1, IT_NUMERIC );
if( pRow && pCol )
{
dev_row = _parni( 1 );
dev_col = _parni( 2 );
p_row = _parni( 1 );
p_col = _parni( 2 );
}
}
}
HARBOUR SCROLL( void ) /* Scrolls a screen region (requires the GT API) */
{
#ifdef USE_GTAPI
int top = 0, left = 0, bottom = _gtMaxRow(), right = _gtMaxCol(),
v_scroll = 0, h_scroll = 0;
int top = 0, left = 0, bottom = hb_maxrow(), right = hb_maxcol(),
v_scroll = 0, h_scroll = 0;
if( _pcount() > 0 && _param( 1, IT_NUMERIC ) )
top = _parni( 1 );
if( _pcount() > 1 && _param( 2, IT_NUMERIC ) )
left = _parni( 2 );
if( _pcount() > 2 && _param( 3, IT_NUMERIC ) )
bottom = _parni( 3 );
if( _pcount() > 3 && _param( 4, IT_NUMERIC ) )
right = _parni( 4 );
if( _pcount() > 4 && _param( 5, IT_NUMERIC ) )
v_scroll = _parni( 5 );
if( _pcount() > 5 && _param( 6, IT_NUMERIC ) )
h_scroll = _parni( 6 );
_gtScroll( top, left, bottom, right, v_scroll, h_scroll );
if( _pcount() > 0 && _param( 1, IT_NUMERIC ) )
top = _parni( 1 );
if( _pcount() > 1 && _param( 2, IT_NUMERIC ) )
left = _parni( 2 );
if( _pcount() > 2 && _param( 3, IT_NUMERIC ) )
bottom = _parni( 3 );
if( _pcount() > 3 && _param( 4, IT_NUMERIC ) )
right = _parni( 4 );
if( _pcount() > 4 && _param( 5, IT_NUMERIC ) )
v_scroll = _parni( 5 );
if( _pcount() > 5 && _param( 6, IT_NUMERIC ) )
h_scroll = _parni( 6 );
#ifdef USE_GTAPI
_gtScroll( top, left, bottom, right, v_scroll, h_scroll );
#else
if( top == 0 && bottom == hb_maxrow()
&& left == 0 && right == hb_maxcol()
&& v_scroll == 0 && h_scroll == 0 )
{
int count;
dev_row = hb_maxrow();
for( count = 0; count < dev_row ; count++ ) printf( "\n" );
dev_row = dev_col = 0;
}
#endif
}
HARBOUR MAXROW( void ) /* Return the maximum screen row number (zero origin) */
{
#ifdef USE_GTAPI
_retni( _gtMaxRow () );
#else
_retni( 23 );
#endif
_retni( hb_maxrow () );
}
HARBOUR MAXCOL( void ) /* Return the maximum screen column number (zero origin) */
{
#ifdef USE_GTAPI
_retni( _gtMaxCol () );
#else
_retni( 79 );
#endif
_retni( hb_maxcol () );
}
HARBOUR ROW( void ) /* Return the current screen row position (zero origin) */
{
_retni( dev_row );
}
HARBOUR COL( void ) /* Return the current screen column position (zero origin) */
{
_retni( dev_col );
}

View File

@@ -18,6 +18,26 @@ ADJ is 7 for ISO, 6 for no ISO
extern STACK stack;
/* In msgxxx.c modules */
extern char *hb_monthsname[];
extern char *hb_daysname[];
char *hb_cmonth( month )
{
if( month >= 1 && month <= 12 )
return hb_monthsname[ month - 1 ];
return "";
}
char *hb_cdow( day )
{
if( day >= 1 && day <= 7 )
return hb_daysname[ day - 1 ];
return "";
}
long hb_dateEncode( long lDay, long lMonth, long lYear )
{
BOOL bValid = FALSE;
@@ -486,3 +506,63 @@ HARBOUR DOW( void )
_errRelease(pError);
}
}
HARBOUR CMONTH( void )
{
PHB_ITEM pDate = _param( 1, IT_DATE );
long lDay, lMonth, lYear;
if( _pcount() )
{
if( pDate )
{
hb_dateDecode( pDate->value.lDate, &lDay, &lMonth, &lYear );
_retc( hb_cmonth( lMonth ) );
}
else
{
PHB_ITEM pError = _errNew();
_errPutDescription(pError, "Error BASE/1116 Argument error: CMONTH");
_errLaunch(pError);
_errRelease(pError);
}
}
else
{
/* QUESTION: Clipper catches this at compile time! */
PHB_ITEM pError = _errNew();
_errPutDescription(pError, "Incorrect number of arguments: CMONTH");
_errLaunch(pError);
_errRelease(pError);
}
}
HARBOUR CDOW( void )
{
PHB_ITEM pDate = _param( 1, IT_DATE );
long lDay, lMonth, lYear;
if( _pcount() )
{
if( pDate )
{
hb_dateDecode( pDate->value.lDate, &lDay, &lMonth, &lYear );
_retc( hb_cdow( hb_dow( lDay, lMonth, lYear ) ) );
}
else
{
PHB_ITEM pError = _errNew();
_errPutDescription(pError, "Error BASE/1117 Argument error: CDOW");
_errLaunch(pError);
_errRelease(pError);
}
}
else
{
/* QUESTION: Clipper catches this at compile time! */
PHB_ITEM pError = _errNew();
_errPutDescription(pError, "Incorrect number of arguments: CDOW");
_errLaunch(pError);
_errRelease(pError);
}
}

View File

@@ -23,18 +23,6 @@ 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"};
/* Harbour functions */
HARBOUR ROW()
{
_retni(s_uiCurrentRow);
}
HARBOUR COL()
{
_retni(s_uiCurrentCol);
}
/* gt API functions */
void _gtInit(void)

View File

@@ -0,0 +1,19 @@
# $Id$
# Make file for DOS DJGPP
#
include ../../../makedos.env
SRCPRG:= $(wildcard *.prg)
CPRG=$(SRCPRG:.prg=.c)
OBJPRG=$(CPRG:.c=.o)
SRCC:= $(wildcard *.c)
OBJC=$(SRCC:.c=.o)
all: $(HARBOURLIB)
$(HARBOURLIB): ${OBJPRG} $(OBJC)
ar r $(HARBOURLIB) msguk.o
clean:
-del *.o

View File

@@ -0,0 +1,12 @@
#include <extend.h>
#include <ctype.h>
char *hb_monthsname[ 12 ] = {
"januari", "februari", "maart",
"april", "mei", "juni", "juli",
"augustus", "september", "oktober",
"november", "december" };
char *hb_daysname[ 7 ] = {
"maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag",
"zondag" };

View File

@@ -0,0 +1,13 @@
#include <extend.h>
#include <ctype.h>
char *hb_monthsname[ 12 ] = {
"Xaneiro", "Febreiro", "Marzal",
"Abril", "Maio", "Xunio", "Xullo",
"Agosto", "Setembro", "Outubro",
"Novembro", "Decembro" };
char *hb_daysname[ 7 ] = {
"Domingo", "Luns", "Martes",
"Mrcores", "Xoves", "Venres",
"S bado" };

View File

@@ -0,0 +1,14 @@
#include <extend.h>
#include <ctype.h>
char *hb_monthsname[ 12 ] = {
"Janeiro", "Fevereiro", "Março",
"Abril", "Maio", "Junho", "Julho",
"Agosto", "Setembro", "Outubro",
"Novembro", "Dezembro" };
char *hb_daysname[ 7 ] = {
"Domingo", "Segunda-feira", "Terça-feira",
"Quarta-feira", "Quinta-feira", "Sexta-feira",
"Sábado" };

View File

@@ -0,0 +1,14 @@
#include <extend.h>
#include <ctype.h>
char *hb_monthsname[ 12 ] = {
"Enero", "Febrero", "Marzo",
"Abril", "Mayo", "Junio", "Julio",
"Agosto", "Septiembre", "Octubre",
"Noviembre", "Diciembre" };
char *hb_daysname[ 7 ] = {
"Domingo", "Lunes", "Martes",
"Mircoles", "Jueves", "Virnes",
"S bado" };

View File

@@ -0,0 +1,13 @@
#include <extend.h>
#include <ctype.h>
char *hb_monthsname[ 12 ] = {
"January", "February", "March",
"April", "May", "June", "July",
"August", "September", "October",
"November", "December" };
char *hb_daysname[ 7 ] = {
"Sunday", "Monday", "Tuesday",
"Wednesday", "Thursday", "Friday",
"Saturday" };

View File

@@ -0,0 +1,11 @@
function main()
OutStd( cMonth( date() ) + chr(10) )
OutStd( cMonth( date() + 31 ) + chr(10) )
OutStd( cMonth( date() + 60 ) + chr(10) )
OutStd( cDow( date() ) + chr(10) )
OutStd( cDow( date() + 6 ) + chr(10) )
OutStd( cDow( date() + 7 ) + chr(10) )
return nil