19990921-20:30 GMT+1

This commit is contained in:
Viktor Szakats
1999-09-21 19:42:02 +00:00
parent bb603a067b
commit c21e4ba7b3
22 changed files with 135 additions and 57 deletions

View File

@@ -1,3 +1,34 @@
19990921-20:30 GMT+1 Victor Szel <info@szelvesz.hu>
* source/hbpp/hbpp.c
! One warning about unused variable fixed in strincmp()
* source/rtl/console.c
+ HB_OSNEWLINE() function added.
* source/rtl/inkey.c
! // style comment changed to ANSI /**/
+ Added #include "inkey.ch"
* Some keyboard code constants changed to manifest constant.
* source/runner/runlib.c
! Two casts added for MSVC 4
* adirtest.prg
cdow.prg
dates.prg
dates2.prg
dates3.prg
dates4.prg
dirtest.prg
longstr2.prg
output.prg
readfile.prg
round.prg
rtl_test.prg
seconds.prg
set_num.prg
set_test.prg
testcgi.prg
testhtml.prg
* OS_NewLine() -> HB_OSNewLine()
19990921-14:25 EDT David G. Holm <dholm@jsd-llc.com>
* source/rtl/set.c
@@ -55,20 +86,20 @@
source/vm/hvm.c
! printf() calls changed to hb_outerr() calls, since Clipper is sending
these to STDERR, too. The other issues fixed are file buffering and
these to STDERR, too. The other issues fixed are file buffering and
console inconsistency.
In general one should not use printf(), fprintf(), or any f*() file
functions to handle STDOUT/STDERR(), since this can cause anomalies due
to both direct and buffered access to the same device, and also the
internal cursor positions cannot be tracked that way. When using
In general one should not use printf(), fprintf(), or any f*() file
functions to handle STDOUT/STDERR(), since this can cause anomalies due
to both direct and buffered access to the same device, and also the
internal cursor positions cannot be tracked that way. When using
f*() functions from console.c an fflush() call must be issued after
them.
* source/rtl/console.c
include/extend.h
+ hb_outerr(), hb_outstd() are now public functions.
+ hb_outerr(), hb_outstd() now automatically determines the length
+ hb_outerr(), hb_outstd() now automatically determines the length
if the length parameter is zero.
+ hb_outerr(), hb_outstd() now don't call GT after hb_consoleRelease()
has been called. This is needed since these functions are used in such
@@ -125,14 +156,14 @@
* tests/working/rtl_test.prg
+ Added Empty(ErrorNew()) test.
* source/rtl/fm.c
* Changed the ending message, since this is not the maximum memory
* Changed the ending message, since this is not the maximum memory
consumed, but the total. Made it more compact, and meaningful.
19990919-15:45 GMT+2 Ryszard Glab <rglab@imid.med.pl>
*source/vm/hvm.c
* added checking if starting symbol name points to a function
* added checking if starting symbol name points to a function
19990919-14:25 GMT+2 Ryszard Glab <rglab@imid.med.pl>
*source/rtl/console.c
@@ -973,7 +1004,7 @@
* source/rtl/adir.prg
! Default flags reset to "HSD"
* tests/working/adirtest.prg
! Fixed a bug which caused an error when zero files was found.
! Fixed a bug which caused an error when zero file was found.
+ Added: SET DATE ANSI, SET CENTURY ON
! Newline handling made platform compatible.
! Some other fixes.

View File

@@ -856,7 +856,7 @@ int CommandStuff ( char *ptrmp, char *inputLine, char * ptro, int *lenres, int c
}
else
ptrmp = lastopti[Repeate];
}
}
else ptrmp++;
numBrackets--;
}
@@ -1803,7 +1803,7 @@ int truncmp (char* ptro, char** ptri, int lTrunc )
int strincmp (char* ptro, char** ptri )
{
char *ptrb = ptro, co, ci;
char co, ci;
for ( ; **ptri != ',' && **ptri != '[' && **ptri != ']' &&
**ptri != '\1' && **ptri != '\0' && toupper(**ptri)==toupper(*ptro);

View File

@@ -48,6 +48,7 @@
* HB_SETPOS(), HB_SETPRC(), HB_SCROLL(), and hb_consoleInitialize()
*
* Copyright 1999 Victor Szel <info@szelvesz.hu>
* hb_consoleGetNewLine()
* HB_SETPOSBS()
* HB_DISPBOX() (GT version)
* HB_DISPBEGIN()
@@ -171,6 +172,50 @@ char * hb_consoleGetNewLine( void )
return s_szCrLf;
}
/* $DOC$
* $FUNCNAME$
* HB_OSNewLine
* $CATEGORY$
* Operating System Specific
* $ONELINER$
* Returns the newline character(s) to use with the current OS
* $SYNTAX$
* HB_OSNewLine() --> cString
* $ARGUMENTS$
* $RETURNS$
* A character string containing the character or characters required
* to move the screen cursor or print head to the start of a new line.
* The string will hold either CHR( 10 ) or CHR( 13 ) + CHR( 10 ).
* $DESCRIPTION$
* Returns a character string containing the character or characters
* required to move the screen cursor or print head to the start of a
* new line for the operating system that the program is running on
* (or thinks it is running on, if an OS emulator is being used).
* $EXAMPLES$
* // Get the newline character(s) for the current OS using defaults.
* STATIC s_cNewLine
* ...
* s_cNewLine := HB_OSNewLine()
* ...
* OutStd( "Hello World!" + s_cNewLine )
* ...
* $TESTS$
* valtype( HB_OSNewLine() ) == "C"
* LEN( HB_OSNewLine( { "ANOTHERDOS" }, { "" } ) ) == 1
* $STATUS$
* C
* $COMPLIANCE$
* This is an add-on Operating System Tool function.
* $SEEALSO$
* OS(), OUTSTD(), OUTERR()
* $END$
*/
HARBOUR HB_HB_OSNEWLINE( void )
{
hb_retc( s_szCrLf );
}
USHORT hb_max_row( void )
{
#ifdef HARBOUR_USE_GTAPI

View File

@@ -1,4 +1,4 @@
/*
/*
* $Id$
*/
@@ -83,6 +83,7 @@
#include "errorapi.h"
#include "itemapi.h"
#include "inkey.h"
#include "inkey.ch"
#include "init.h"
#if defined(__TURBOC__) || defined(__BORLANDC__) || defined(_MSC_VER) || defined(__MINGW32__)
@@ -206,7 +207,7 @@ int hb_inkey( double seconds, HB_inkey_enum event_mask, BOOL wait, BOOL forever
/* Check or wait for input events */
if( wait ) end_clock = clock() + seconds * CLOCKS_PER_SEC;
s_inkeyPoll = TRUE; /* Force polling */
while( wait && hb_inkeyNext() == 0 )
{
/* Release the CPU between checks */
@@ -283,7 +284,7 @@ void hb_inkeyPoll( void ) /* Poll the console keyboard to stuff the Harbour
ch = _read_kbd( 0, 0, 0 );
if( ch != -1 ) ch += 256; /* If it's really a scan code, offset it */
}
/* _read_kbd() returns -1 for no key, the switch statement will handle
/* _read_kbd() returns -1 for no key, the switch statement will handle
this. */
#else
if( kbhit() )
@@ -323,55 +324,55 @@ void hb_inkeyPoll( void ) /* Poll the console keyboard to stuff the Harbour
case -1: /* No key available */
return;
case 328: /* Up arrow */
ch = 5;
ch = K_UP;
break;
case 336: /* Down arrow */
ch = 24;
ch = K_DOWN;
break;
case 331: /* Left arrow */
ch = 19;
ch = K_LEFT;
break;
case 333: /* Right arrow */
ch = 4;
ch = K_RIGHT;
break;
case 327: /* Home */
ch = 1;
ch = K_HOME;
break;
case 335: /* End */
ch = 6;
ch = K_END;
break;
case 329: /* Page Up */
ch = 18;
ch = K_PGUP;
break;
case 337: /* Page Down */
ch = 3;
ch = K_PGDN;
break;
case 371: /* Ctrl + Left arrow */
ch = 26;
ch = K_CTRL_LEFT;
break;
case 372: /* Ctrl + Right arrow */
ch = 2;
ch = K_CTRL_RIGHT;
break;
case 375: /* Ctrl + Home */
ch = 29;
ch = K_CTRL_HOME;
break;
case 373: /* Ctrl + End */
ch = 23;
ch = K_CTRL_END;
break;
case 388: /* Ctrl + Page Up */
ch = 31;
ch = K_CTRL_PGUP;
break;
case 374: /* Ctrl + Page Down */
ch = 30;
ch = K_CTRL_PGDN;
break;
case 338: /* Insert */
ch = 22;
ch = K_INS;
break;
case 339: /* Delete */
ch = 7;
ch = K_DEL;
break;
case 315: /* F1 */
ch = 28;
ch = K_F1;
break;
case 316: /* F2 */
case 317: /* F3 */
@@ -440,12 +441,13 @@ void hb_inkeyPoll( void ) /* Poll the console keyboard to stuff the Harbour
/* Only read keyboard input here if not called
from the HVM and the typeahead buffer is empty. */
read( STDIN_FILENO, &ch, 1 ); /* Read a key */
/// if( ch == '\n' ) ch = '\r'; /* Convert LF to CR */
/* if( ch == '\n' )
ch = '\r'; */ /* Convert LF to CR */
}
#else
/* TODO: Support for other platforms, such as Mac */
#endif
if( ch == 302 ) /* K_ALT_C */
if( ch == K_ALT_C )
hb_vmRequestCancel( ); /* Alt-C was pressed */
hb_inkeyPut( ch );

View File

@@ -187,7 +187,7 @@ HARBOUR HB___HRBRUN( void )
ulSize = hb_hrbFileReadLong( file, szFileName ); /* Read size of function */
pDynFunc[ ul ].pCode = ( BYTE * ) hb_xgrab( ulSize );
hb_hrbFileRead( file, szFileName, pDynFunc[ ul ].pCode, 1, ulSize );
hb_hrbFileRead( file, szFileName, ( char * ) pDynFunc[ ul ].pCode, 1, ulSize );
/* Read the block */
pDynFunc[ ul ].pAsmCall = hb_hrbAsmCreateFun( pSymRead,
@@ -370,7 +370,7 @@ static BYTE hb_hrbFileReadByte( FILE * file, char * szFileName )
{
BYTE bRet;
hb_hrbFileRead( file, szFileName, &bRet, 1, 1 );
hb_hrbFileRead( file, szFileName, ( char * ) &bRet, 1, 1 );
return bRet;
}

View File

@@ -20,7 +20,7 @@ STATIC FUNCTION TestIt( cSpec )
LOCAL a4
LOCAL a5
LOCAL cNewLine := OS_NewLine()
LOCAL cNewLine := HB_OSNewLine()
SET DATE ANSI
SET CENTURY ON

View File

@@ -3,7 +3,7 @@
//
function main()
local cNewLine := OS_NewLine()
local cNewLine := HB_OSNewLine()
OutStd( cMonth( date() ) + cNewLine )
OutStd( cMonth( date() + 31 ) + cNewLine )

View File

@@ -7,13 +7,13 @@
#include "set.ch"
function Main()
local cNewLine := OS_NewLine()
local cNewLine := HB_OSNewLine()
local dDate, dDate2, cMask, cDate
OUTSTD (cNewLine, "Testing Harbour dates management on", DATE())
TestCentury(cNewLine)
TestCentury(cNewLine)
OUTSTD (cNewLine, "")
OUTSTD (cNewLine, "dDate = CToD( '02/04/1999' ) =>", dDate := CToD( "02/04/1999" ))

View File

@@ -4,7 +4,7 @@
#include "set.ch"
function main()
local newline := OS_NewLine()
local newline := HB_OSNewLine()
local dDate := CTOD ("04/30/99")
outstd (SET (_SET_DATEFORMAT), dDate, newline)

View File

@@ -8,7 +8,7 @@
function main()
LOCAL dDate, i, cNewLine := OS_NewLine()
LOCAL dDate, i, cNewLine := HB_OSNewLine()
set( _SET_DATEFORMAT, "dd/mm/yyyy" )
dDate := cToD( "25/05/1999" )
@@ -35,7 +35,7 @@ function main()
dDate += 4
OutStd( dDate, dow( dDate ), cNewLine )
OutStd( cNewLine )
dDate := DATE ()
FOR i := 1 TO 7

View File

@@ -11,7 +11,7 @@ function main()
LOCAL i
LOCAL dDate := date()
s_cNewLine := OS_NewLine()
s_cNewLine := HB_OSNewLine()
set( _SET_DATEFORMAT, "dd/mm/yyyy" )

View File

@@ -6,7 +6,7 @@
function main(filespec,attribs,cshort)
local adir := {}
local x := 0, lShort := .f., cNewLine := OS_NewLine()
local x := 0, lShort := .f., cNewLine := HB_OSNewLine()
IF !cshort == NIL .and. (Upper( cShort ) == "TRUE" .or. Upper( cShort ) == ".T.")
lShort := .t.

View File

@@ -9,7 +9,7 @@ function Main()
local short := "1234567890"
local i, long, very_long, cNewLine
cNewLine := OS_NewLine()
cNewLine := HB_OSNewLine()
long := short
for i := 1 TO 12

View File

@@ -12,7 +12,7 @@
#include "set.ch"
function Main()
local cNewLine := OS_NewLine()
local cNewLine := HB_OSNewLine()
OUTSTD (cNewLine, "Testing Harbour device management on", DATE())
SET ALTERNATE TO OUTPUT_A ADDITIVE

View File

@@ -13,7 +13,7 @@
PROCEDURE Main( cFile )
LOCAL oFile := TFileRead():New( cFile )
LOCAL cNewLine := OS_NewLine()
LOCAL cNewLine := HB_OSNewLine()
oFile:Open()
IF oFile:Error()

View File

@@ -11,7 +11,7 @@
function main()
local n, value := -5
local cNewLine := OS_NewLine()
local cNewLine := HB_OSNewLine()
for n := 1 to 100
OUTSTD(cNewLine)

View File

@@ -375,8 +375,8 @@ STATIC FUNCTION Main_HVM()
//NOTE: These expressions have to be written with no separators!
TEST_LINE( mnIntP==10.or.mnIntP=0 , .T. )
TEST_LINE( mnIntP==10.and.mnLongP=0 , .F. )
TEST_LINE( mnIntP==10.and.mnLongP=0 , .F. )
TEST_LINE( NIL + 1 , "E BASE 1081 Argument error + F:S" )
TEST_LINE( NIL - 1 , "E BASE 1082 Argument error - F:S" )
@@ -2068,7 +2068,7 @@ STATIC FUNCTION TEST_BEGIN( cParam )
s_nStartTime := Seconds()
#ifdef __HARBOUR__
s_cNewLine := OS_NewLine()
s_cNewLine := HB_OSNewLine()
#else
s_cNewLine := Chr( 13 ) + Chr( 10 )
#endif

View File

@@ -11,7 +11,7 @@
function Main( cParam )
local n, limit := 10
local cNewLine := OS_NewLine()
local cNewLine := HB_OSNewLine()
IF( ! EMPTY( cParam ) )
limit := VAL( cParam )

View File

@@ -5,7 +5,7 @@
// Testing SET
function Main()
local n, cNewLine := OS_NewLine()
local n, cNewLine := HB_OSNewLine()
for n := 1 to 39
outstd (cNewLine)

View File

@@ -12,7 +12,7 @@ function Main()
// for Clipper, this drags in the terminal driver
@ Row(), col() say ""
s_cNewLine := OS_NewLine()
s_cNewLine := HB_OSNewLine()
TestLine( "_SET_EXACT", 1)
TestLine( "_SET_FIXED", 2)

View File

@@ -35,7 +35,7 @@ FUNCTION Main()
LOCAL oHTML := THTML():New()
LOCAL hFile, nPos, cString, cBuf, i, cTable, cLine
s_cNewLine := OS_NewLine()
s_cNewLine := HB_OSNewLine()
oHTML:SetHTMLFile( "function.cfm" )

View File

@@ -21,7 +21,7 @@ FUNCTION Main()
LOCAL oHTML := THTML():New()
s_cNewLine := OS_NewLine()
s_cNewLine := HB_OSNewLine()
oHTML:SetTitle( "Harbour Power Demonstration" )
oHTML:AddHead( "Harbour Project" )