*** empty log message ***

This commit is contained in:
Paul Tucker
1999-08-18 18:52:46 +00:00
parent 5ca1289210
commit 51ad1afd0f
5 changed files with 138 additions and 38 deletions

View File

@@ -1,3 +1,13 @@
19990818-14:33 EDT Paul Tucker <ptucker@sympatico.ca>
* source/rtl/console.c
* source/rtl/gtapi.c
* a number of small changes to improve speed.
* source/rtl/gt/gtwin.c
* correction to cursor positioning when dispend called
* tests/working/dirtest.prg
* comment out (for now) asort
it works, but it's rather slow on a larger directory
19990818-14:13 GMT+1 Bruno Cantero <bruno@issnet.net>
* include/rddapi.h
source/rdd/dbcmd.c

View File

@@ -254,6 +254,10 @@ static void hb_out( WORD wParam, hb_out_func_typedef * hb_out_func )
switch( hb_parinfo( wParam ) )
{
case IT_STRING:
hb_out_func( hb_parc( wParam ), hb_parclen( wParam ) );
break;
case IT_DATE:
szText = hb_dtoc( hb_pards( wParam ), szBuffer, hb_set.HB_SET_DATEFORMAT );
if( szText )
@@ -282,10 +286,6 @@ static void hb_out( WORD wParam, hb_out_func_typedef * hb_out_func )
hb_out_func( ".F.", 3 );
break;
case IT_STRING:
hb_out_func( hb_parc( wParam ), hb_parclen( wParam ) );
break;
default:
break;
}
@@ -297,7 +297,10 @@ static void hb_outstd( char * fpStr, ULONG len )
ULONG count = len;
char * fpPtr = fpStr;
while( count-- ) printf( "%c", *fpPtr++ );
if( strlen( fpStr ) != count )
while( count-- ) printf( "%c", *fpPtr++ );
else
printf( "%s", fpStr );
fflush( stdout );
#ifdef HARBOUR_USE_GTAPI
#ifndef __CYGWIN__
@@ -318,7 +321,11 @@ static void hb_outerr( char * fpStr, ULONG len )
{
ULONG count = len;
char * fpPtr = fpStr;
while( count-- ) fprintf( stderr, "%c", *fpPtr++ );
if( strlen( fpStr ) != count )
while( count-- ) fprintf( stderr, "%c", *fpPtr++ );
else
fprintf( stderr, "%s", fpStr );
fflush( stderr );
#ifdef HARBOUR_USE_GTAPI
#ifndef __CYGWIN__
@@ -345,7 +352,10 @@ static void hb_altout( char * fpStr, ULONG len )
hb_gtGetPos( &dev_row, &dev_col );
#else
ULONG count = len;
while( count-- ) printf( "%c", *fpPtr++ );
if( strlen( fpStr ) != count )
while( count-- ) printf( "%c", *fpPtr++ );
else
printf( "%s", fpStr );
adjust_pos( fpStr, len, &dev_row, &dev_col, hb_max_row(), hb_max_col() );
#endif
}
@@ -422,7 +432,7 @@ static void hb_altout( char * fpStr, ULONG len )
/* Output an item to the screen and/or printer */
static void hb_devout( char * fpStr, ULONG len )
{
if( hb_stricmp( hb_set.HB_SET_DEVICE, "PRINTER" ) == 0 && hb_set_printhan >= 0 )
if( hb_set_printhan >= 0 && hb_stricmp( hb_set.HB_SET_DEVICE, "PRINTER" ) == 0 )
{
/* Display to printer if SET DEVICE TO PRINTER and valid printer file */
unsigned write_len;
@@ -455,7 +465,10 @@ static void hb_devout( char * fpStr, ULONG len )
#else
ULONG count = len;
char * fpPtr = fpStr;
while( count-- ) printf( "%c", *fpPtr++ );
if( strlen( fpStr ) != count )
while( count-- ) printf( "%c", *fpPtr++ );
else
printf( "%s", fpStr );
adjust_pos( fpStr, len, &dev_row, &dev_col, hb_max_row(), hb_max_col() );
#endif
}
@@ -471,7 +484,10 @@ static void hb_dispout( char * fpStr, ULONG len )
#else
ULONG count = len;
char * fpPtr = fpStr;
while( count-- ) printf( "%c", *fpPtr++ );
if( strlen( fpStr ) != count )
while( count-- ) printf( "%c", *fpPtr++ );
else
printf( "%s", fpStr );
adjust_pos( fpStr, len, &dev_row, &dev_col, hb_max_row(), hb_max_col() );
#endif
}
@@ -629,7 +645,6 @@ HARBOUR HB_DEVOUT( void ) /* writes a single value to the current device (screen
{
#ifdef HARBOUR_USE_GTAPI
char fpOldColor[ CLR_STRLEN ];
if( ISCHAR(2) )
{
hb_gtGetColorStr( fpOldColor );

View File

@@ -79,7 +79,6 @@ void hb_gt_Done(void)
hb_gtDispBegin(); /* must use these versions ! */
hb_gtDispEnd();
SetConsoleActiveScreenBuffer(HOutput);
}
CloseHandle(HInput);
HInput = INVALID_HANDLE_VALUE;
@@ -106,7 +105,8 @@ char hb_gt_GetScreenWidth(void)
LOG("GetScreenWidth");
GetConsoleScreenBufferInfo(HOutput, &csbi);
/* return (char)csbi.dwMaximumWindowSize.X; */
return (char)max(csbi.srWindow.Right - csbi.srWindow.Left +1,40);
/* return (char)max(csbi.srWindow.Right - csbi.srWindow.Left +1,40); */
return (char)max(csbi.dwSize.X,40);
}
char hb_gt_GetScreenHeight(void)
@@ -116,7 +116,8 @@ char hb_gt_GetScreenHeight(void)
LOG("GetScreenHeight");
GetConsoleScreenBufferInfo(HOutput, &csbi);
/* return (char)csbi.dwMaximumWindowSize.Y; */
return (char)max(csbi.srWindow.Bottom - csbi.srWindow.Top +1,25);
/* return (char)max(csbi.srWindow.Bottom - csbi.srWindow.Top +1,25); */
return (char)max(csbi.dwSize.Y,25);
}
void hb_gt_SetPos(char cRow, char cCol)
@@ -381,16 +382,20 @@ void hb_gt_Scroll( char cTop, char cLeft, char cBottom, char cRight, char attrib
void hb_gt_DispBegin(void)
{
/* ptucker */
COORD coDest = {0, 0};
COORD coBuf; /* the size of the buffer to read into */
CHAR_INFO *pCharInfo; /* buffer to store info from ReadConsoleOutput */
SMALL_RECT srWin; /* source rectangle to read from */
if( hb_gtDispCount() == 1 )
{
COORD coDest = {0, 0};
COORD coBuf; /* the size of the buffer to read into */
CHAR_INFO *pCharInfo; /* buffer to store info from ReadConsoleOutput */
SMALL_RECT srWin; /* source rectangle to read from */
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(HOutput, &csbi);
srWin.Top = srWin.Left = 0;
srWin.Bottom = (coBuf.Y = hb_gt_GetScreenHeight()) -1;
srWin.Right = (coBuf.X = hb_gt_GetScreenWidth()) -1;
// srWin.Bottom = (cobuf.Y = hb_gt_GetScreenHeight()) -1;
// srWin.Right = (coBuf.X = hb_gt_GetScreenWidth()) -1;
srWin.Bottom = (coBuf.Y = csbi.dwSize.Y) -1;
srWin.Right = (coBuf.X = csbi.dwSize.X) -1;
/* allocate a buffer for the screen rectangle */
pCharInfo = (CHAR_INFO *)hb_xgrab(coBuf.Y * coBuf.X * sizeof(CHAR_INFO));
@@ -400,7 +405,7 @@ void hb_gt_DispBegin(void)
pCharInfo, /* transfer area */
coBuf, /* size of destination buffer */
coDest, /* upper-left cell to write data to */
&srWin); /* screen buffer rectangle to read from */
&csbi.srWindow); /* screen buffer rectangle to read from */
if( HStealth == INVALID_HANDLE_VALUE )
{
@@ -418,7 +423,7 @@ void hb_gt_DispBegin(void)
pCharInfo, /* data to write */
coBuf, /* col/row size of source buffer */
coDest, /* upper-left cell to write data from in src */
&srWin); /* screen buffer rect to write data to */
&csbi.srWindow); /* screen buffer rect to write data to */
hb_xfree(pCharInfo);
}
@@ -431,8 +436,11 @@ void hb_gt_DispEnd(void)
if( hb_gtDispCount() == 0 )
{
CONSOLE_CURSOR_INFO cci;
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleCursorInfo(HCursor, &cci);
GetConsoleScreenBufferInfo(HCursor, &csbi);
SetConsoleCursorInfo(HOutput, &cci);
SetConsoleCursorPosition(HOutput, csbi.dwCursorPosition);
SetConsoleActiveScreenBuffer(HOutput);
HStealth = HCursor;
HCursor = HOutput;
@@ -456,8 +464,8 @@ static BOOL hb_gt_SetScreenBuffer( HANDLE HNew, HANDLE HOld )
srWin.Right = csbi.dwSize.X - 1;
SetConsoleScreenBufferSize(HNew, csbi.dwSize);
SetConsoleWindowInfo(HNew, FALSE, &srWin);
SetConsoleWindowInfo(HNew, TRUE, &csbi.srWindow);
SetConsoleWindowInfo(HNew, FALSE, &srWin);
return 0;
}

View File

@@ -6,6 +6,8 @@
* GTAPI.C: Generic Terminal for Harbour
*
* Latest mods:
* 1.58 19990811 ptucker changes to gtWriteCon and gtWrite to improve
* speed.
* 1.56 19990811 ptucker Corrected initial MaxRow/col
* 1.53 19990807 ptucker Modified Dispbegin/end support
* 1.47 19990802 ptucker DispBegin/End and SetMode for gtWin
@@ -619,7 +621,7 @@ int hb_gtSetSnowFlag(BOOL bNoSnow)
int hb_gtWrite(char * fpStr, ULONG length)
{
int iRow, iCol, iMaxCol, iMaxRow, iTemp;
ULONG size;
ULONG size = length;
char attr=_Color[s_uiColorIndex] & 0xff,
*fpPointer = fpStr;
@@ -629,9 +631,10 @@ int hb_gtWrite(char * fpStr, ULONG length)
iMaxRow = s_uiMaxRow;
iMaxCol = s_uiMaxCol;
length = ( length < hb_gtMaxCol()-iCol+1 ) ? length : hb_gtMaxCol()-iCol+1;
length = ( length < iMaxCol-iCol+1 ) ? length : iMaxCol-iCol+1;
size = length;
#ifndef HARBOUR_USE_WIN_GTAPI
if (iCol + size > iMaxCol)
{
/* Calculate eventual row position and the remainder size for the column adjust */
@@ -658,7 +661,7 @@ int hb_gtWrite(char * fpStr, ULONG length)
iTemp = 0;
if (s_uiCurrentCol > 0)
{
/* Ensure that the truncated text will fill the screen */
/* Ensure that the truncated text will fill the screen */
fpPointer -= s_uiCurrentCol;
s_uiCurrentCol = 0;
}
@@ -670,13 +673,17 @@ int hb_gtWrite(char * fpStr, ULONG length)
iRow = iMaxRow;
}
else size = length;
#endif
/* Now the text string can be displayed */
hb_gt_Puts( s_uiCurrentRow, s_uiCurrentCol, attr, fpPointer, size);
#ifdef HARBOUR_USE_WIN_GTAPI
/* yeah yeah, looks weird */
hb_gtSetPos( iRow, iCol+size);
#else
/* Finally, save the new cursor position */
hb_gtSetPos (iRow, iCol);
#endif
return(0);
}
@@ -692,11 +699,15 @@ int hb_gtWriteAt(USHORT uiRow, USHORT uiCol, char * fpStr, ULONG length)
int hb_gtWriteCon(char * fpStr, ULONG length)
{
int rc = 0;
int rc = 0, ldisp=FALSE, nLen = 0;
USHORT uiRow = s_uiCurrentRow, uiCol = s_uiCurrentCol;
USHORT tmpRow = s_uiCurrentRow, tmpCol = s_uiCurrentCol;
ULONG count;
char ch[2];
char * fpPtr = fpStr;
char strng[500];
hb_gtDispBegin();
ch[1] = 0;
for(count = 0; count < length; count++)
@@ -707,6 +718,7 @@ int hb_gtWriteCon(char * fpStr, ULONG length)
case 7:
break;
case 8:
/*
if(uiCol > 0) uiCol--;
else if(uiRow > 0)
{
@@ -718,28 +730,82 @@ int hb_gtWriteCon(char * fpStr, ULONG length)
hb_gtScroll(0, 0, s_uiMaxRow, s_uiMaxCol, -1, 0);
uiCol=s_uiMaxCol;
}
hb_gtSetPos (uiRow, uiCol);
*/
if( nLen > 0 )
--nLen;
if( uiCol > 0 )
--uiCol;
break;
case 10:
/*
if(uiRow < s_uiMaxRow) uiRow++;
else
{
hb_gtScroll(0, 0, s_uiMaxRow, s_uiMaxCol, 1, 0);
}
hb_gtSetPos (uiRow, uiCol);
*/
++uiRow;
ldisp=TRUE;
break;
case 13:
uiCol = 0;
hb_gtSetPos (uiRow, uiCol);
/* hb_gtSetPos (uiRow, uiCol); */
break;
default:
rc = hb_gtWrite(ch, 1);
hb_gtGetPos (&uiRow, &uiCol);
if( ++uiCol > s_uiMaxCol )
{
uiCol = 0;
++uiRow;
ldisp = TRUE;
}
if( ldisp )
{
hb_gtSetPos (tmpRow, tmpCol);
if( nLen )
rc = hb_gtWrite(strng, nLen );
hb_gtDispEnd();
hb_gtDispBegin();
nLen=0;
}
if( uiRow > s_uiMaxRow )
{
hb_gtScroll(0, 0, s_uiMaxRow, s_uiMaxCol, uiRow - s_uiMaxRow, 0);
uiRow = s_uiMaxRow;
uiCol = 0;
}
if( ldisp )
{
tmpRow=uiRow; tmpCol=uiCol;
hb_gtSetPos( uiRow, uiCol);
ldisp = FALSE;
}
strng[nLen++] = ch[0];
}
if(rc)
return(rc);
break;
}
return(0);
if( !rc )
{
hb_gtSetPos (tmpRow, tmpCol);
if( nLen )
rc = hb_gtWrite(strng, nLen );
if( uiRow > s_uiMaxRow )
{
hb_gtScroll(0, 0, s_uiMaxRow, s_uiMaxCol, uiRow - s_uiMaxRow, 0);
uiRow = s_uiMaxRow;
uiCol = 0;
}
hb_gtSetPos (uiRow, uiCol);
}
hb_gtDispEnd();
return rc;
}
int hb_gtScroll(USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, SHORT iRows, SHORT iCols)
@@ -756,7 +822,7 @@ int hb_gtScroll(USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, SH
{
char * fpBlank = (char *)hb_xgrab (iLength);
char * fpBuff = (char *)hb_xgrab (iLength * 2);
if (fpBlank && fpBuff)
* if (fpBlank && fpBuff)
{
char attr = _Color[s_uiColorIndex] & 0xff;

View File

@@ -15,7 +15,8 @@ local cOs := OS(), cNewLine
cNewLine := CHR( 10 )
END IF
adir := asort( directory(filespec,attribs),,, {|x,y|upper(x[1]) < upper(y[1])} )
// adir := asort( directory(filespec,attribs),,, {|x,y|upper(x[1]) < upper(y[1])} )
adir := directory(filespec,attribs)
for x := 1 to len(adir)
outstd(cNewLine)