From 117324bc6a75bf004a0d03b3c0bd128643e4997a Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Tue, 25 Mar 2008 11:27:04 +0000 Subject: [PATCH] 2008-03-25 12:26 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/common.mak * harbour/source/lang/Makefile + harbour/source/lang/msgskiso.c + harbour/source/lang/msgskwin.c + harbour/source/lang/msgskkam.c + harbour/source/lang/msgsk852.c + added Slovak national messages by Gyula Bartal - many thanks * harbour/include/hbapi.h * harbour/source/vm/arrays.c ! Guarded hb_arraySetNLL() declaration with #ifndef HB_LONG_LONG_OFF. ! Fixed trace in hb_arraySetNInt(). By Phil Krylov borrowed from xHarbour * harbour/include/hbgtcore.h ! added missing HB_EXTERN_BEGIN / HB_EXTERN_END By Ron Pinkas borrowed from xHarbour * harbour/source/rtl/gtos2/gtos2.c % updated for much faster screen updating in OS2 console - many thanks for Maurilio Longo for tests and code. * harbour/source/rtl/cdpapi.c ! fixed CP string translation for CPs with accented equal characters + added HB_UTF8CHR( ) -> It's compatible with the function HB_UTF8CHR() by Phil Krylov in xHarbour * harbour/source/rtl/gtsln/gtsln.h * removed repeated #include * harbour/contrib/hbct/files.c ! fixed FILESEEK() called with 3-rd parameter set to .T. (exact attribute match) * harbour/config/os2/global.cf ! added fixes by David Arturo Macias Corona + harbour/make_os2_gcc.cmd + added build file for GCC OS2 users with minimal environment settings --- harbour/ChangeLog | 42 ++++++ harbour/common.mak | 4 + harbour/config/os2/global.cf | 10 +- harbour/contrib/hbct/files.c | 25 +++- harbour/include/hbapi.h | 2 + harbour/include/hbgtcore.h | 4 + harbour/make_os2_gcc.cmd | 15 +++ harbour/source/lang/Makefile | 4 + harbour/source/lang/msgsk852.c | 219 +++++++++++++++++++++++++++++++ harbour/source/lang/msgskiso.c | 219 +++++++++++++++++++++++++++++++ harbour/source/lang/msgskkam.c | 219 +++++++++++++++++++++++++++++++ harbour/source/lang/msgskwin.c | 219 +++++++++++++++++++++++++++++++ harbour/source/rtl/cdpapi.c | 155 ++++++++++++++++------ harbour/source/rtl/gtos2/gtos2.c | 49 +++++-- harbour/source/rtl/gtsln/gtsln.h | 1 - harbour/source/vm/arrays.c | 2 +- 16 files changed, 1127 insertions(+), 62 deletions(-) create mode 100644 harbour/make_os2_gcc.cmd create mode 100644 harbour/source/lang/msgsk852.c create mode 100644 harbour/source/lang/msgskiso.c create mode 100644 harbour/source/lang/msgskkam.c create mode 100644 harbour/source/lang/msgskwin.c diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 5f6341e355..3c7f3ff5d6 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,48 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2008-03-25 12:26 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/common.mak + * harbour/source/lang/Makefile + + harbour/source/lang/msgskiso.c + + harbour/source/lang/msgskwin.c + + harbour/source/lang/msgskkam.c + + harbour/source/lang/msgsk852.c + + added Slovak national messages by Gyula Bartal - many thanks + + * harbour/include/hbapi.h + * harbour/source/vm/arrays.c + ! Guarded hb_arraySetNLL() declaration with #ifndef HB_LONG_LONG_OFF. + ! Fixed trace in hb_arraySetNInt(). + By Phil Krylov borrowed from xHarbour + + * harbour/include/hbgtcore.h + ! added missing HB_EXTERN_BEGIN / HB_EXTERN_END + By Ron Pinkas borrowed from xHarbour + + * harbour/source/rtl/gtos2/gtos2.c + % updated for much faster screen updating in OS2 console - many + thanks for Maurilio Longo for tests and code. + + * harbour/source/rtl/cdpapi.c + ! fixed CP string translation for CPs with accented equal characters + + added HB_UTF8CHR( ) -> + It's compatible with the function HB_UTF8CHR() by Phil Krylov in + xHarbour + + * harbour/source/rtl/gtsln/gtsln.h + * removed repeated #include + + * harbour/contrib/hbct/files.c + ! fixed FILESEEK() called with 3-rd parameter set to .T. (exact + attribute match) + + * harbour/config/os2/global.cf + ! added fixes by David Arturo Macias Corona + + + harbour/make_os2_gcc.cmd + + added build file for GCC OS2 users with minimal environment settings + 2008-03-15 16:58 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/contrib/hbzlib/zip.c ! fixed to not ignore errors in zipFlushWriteBuffer() diff --git a/harbour/common.mak b/harbour/common.mak index 6aee982b3e..9ce0b76fb0 100644 --- a/harbour/common.mak +++ b/harbour/common.mak @@ -722,6 +722,10 @@ LANG_LIB_OBJS = \ $(OBJ_DIR)\msgru866$(OBJEXT) \ $(OBJ_DIR)\msgrukoi$(OBJEXT) \ $(OBJ_DIR)\msgruwin$(OBJEXT) \ + $(OBJ_DIR)\msgskiso$(OBJEXT) \ + $(OBJ_DIR)\msgskwin$(OBJEXT) \ + $(OBJ_DIR)\msgskkam$(OBJEXT) \ + $(OBJ_DIR)\msgsk852$(OBJEXT) \ $(OBJ_DIR)\msgsl437$(OBJEXT) \ $(OBJ_DIR)\msgsl852$(OBJEXT) \ $(OBJ_DIR)\msgsliso$(OBJEXT) \ diff --git a/harbour/config/os2/global.cf b/harbour/config/os2/global.cf index e8600ec731..a230ab7b29 100644 --- a/harbour/config/os2/global.cf +++ b/harbour/config/os2/global.cf @@ -22,9 +22,9 @@ endif ifeq ($(SHLVL),) # An OS/2 command shell ARCH_DIR = $(HB_ARCH) -OS2_ARCH_DIR = $(subst /,\\,$(HB_ARCH)) -OS2_LIB_DIR = $(subst /,\\,$(LIB_DIR)) -OS2_LIB_PATH = $(subst /,\\,$(LIB_PATH)) +OS2_ARCH_DIR = $(subst /,\,$(HB_ARCH)) +OS2_LIB_DIR = $(subst /,\,$(LIB_DIR)) +OS2_LIB_PATH = $(subst /,\,$(LIB_PATH)) OS2_LIB_ARCH = $(subst /,\\,$(LIB_ARCH)) DIRSEP = $(subst /,\,\) @@ -48,7 +48,7 @@ dirbase:: -CMD.EXE /C FOR %d IN ($(HB_ARCHITECTURE) $(OS2_ARCH_DIR)) DO IF NOT EXIST %d $(MD) %d clean:: - -CMD.EXE /C FOR %f IN ($(OS2_ARCH_DIR)\*.*) DO $(RM) %f + -CMD.EXE /C IF EXIST $(OS2_ARCH_DIR)\*.* $(RM) $(OS2_ARCH_DIR)\\*.* -CMD.EXE /C FOR %d IN ($(OS2_ARCH_DIR) $(HB_ARCHITECTURE)) DO IF EXIST %d $(RD) %d else @@ -57,7 +57,7 @@ dirbase:: -CMD.EXE /C FOR %d IN ($(HB_ARCHITECTURE) $(OS2_ARCH_DIR) $(OS2_LIB_PATH) $(OS2_LIB_DIR)) DO IF NOT EXIST %d $(MD) %d clean:: - -CMD.EXE /C FOR %f IN ($(OS2_ARCH_DIR)\*.*) DO $(RM) %f + -CMD.EXE /C IF EXIST $(OS2_ARCH_DIR)\*.* $(RM) $(OS2_ARCH_DIR)\\*.* -CMD.EXE /C FOR %d IN ($(OS2_ARCH_DIR) $(HB_ARCHITECTURE)) DO IF EXIST %d $(RD) %d -CMD.EXE /C IF EXIST $(OS2_LIB_ARCH) $(RM) $(OS2_LIB_ARCH) diff --git a/harbour/contrib/hbct/files.c b/harbour/contrib/hbct/files.c index 682aa92f86..ed2661c7b0 100644 --- a/harbour/contrib/hbct/files.c +++ b/harbour/contrib/hbct/files.c @@ -94,6 +94,7 @@ #endif static PHB_FFIND s_ffind = NULL; +static USHORT s_uiAttr = 0; static BOOL s_fInit = FALSE; static void _hb_fileClose( void * cargo ) @@ -129,14 +130,34 @@ static PHB_FFIND _hb_fileStart( BOOL fNext, USHORT uiAttr ) } szFile = ( char * ) hb_fsNameConv( ( BYTE * ) szFile, &fFree ); if( ISNUM( 2 ) ) - uiAttr = hb_parni( 2 ); + uiAttr = ( USHORT ) hb_parni( 2 ); + s_uiAttr = ISLOG( 3 ) && hb_parl( 3 ) ? uiAttr : 0; s_ffind = hb_fsFindFirst( szFile, uiAttr ); if( fFree ) hb_xfree( szFile ); + while( s_ffind && s_uiAttr && s_ffind->attr != s_uiAttr ) + { + if( !hb_fsFindNext( s_ffind ) ) + { + hb_fsFindClose( s_ffind ); + s_ffind = NULL; + } + } } } else if( fNext && s_ffind ) - hb_fsFindNext( s_ffind ); + { + do + { + if( !hb_fsFindNext( s_ffind ) ) + { + hb_fsFindClose( s_ffind ); + s_ffind = NULL; + break; + } + } + while( s_uiAttr && s_ffind->attr != s_uiAttr ); + } return s_ffind; } diff --git a/harbour/include/hbapi.h b/harbour/include/hbapi.h index bd10de3c5c..399b909412 100644 --- a/harbour/include/hbapi.h +++ b/harbour/include/hbapi.h @@ -719,7 +719,9 @@ extern HB_EXPORT BOOL hb_arraySetDL( PHB_ITEM pArray, ULONG ulIndex, LONG l extern HB_EXPORT BOOL hb_arraySetL( PHB_ITEM pArray, ULONG ulIndex, BOOL fValue ); extern HB_EXPORT BOOL hb_arraySetNI( PHB_ITEM pArray, ULONG ulIndex, int iNumber ); extern HB_EXPORT BOOL hb_arraySetNL( PHB_ITEM pArray, ULONG ulIndex, LONG lNumber ); +#ifndef HB_LONG_LONG_OFF extern HB_EXPORT BOOL hb_arraySetNLL( PHB_ITEM pArray, ULONG ulIndex, LONGLONG llNumber ); +#endif extern HB_EXPORT BOOL hb_arraySetNInt( PHB_ITEM pArray, ULONG ulIndex, HB_LONG lNumber ); extern HB_EXPORT BOOL hb_arraySetND( PHB_ITEM pArray, ULONG ulIndex, double dNumber ); extern HB_EXPORT BOOL hb_arraySetC( PHB_ITEM pArray, ULONG ulIndex, const char * szText ); diff --git a/harbour/include/hbgtcore.h b/harbour/include/hbgtcore.h index 4633a55e7a..885c0fb9a3 100644 --- a/harbour/include/hbgtcore.h +++ b/harbour/include/hbgtcore.h @@ -61,6 +61,8 @@ #include "hbapigt.h" #include "hbapicdp.h" +HB_EXTERN_BEGIN + /* extended attributes used by core screen buffer */ #define HB_GT_ATTR_BOX 0x01 #define HB_GT_ATTR_SHADOW 0x02 @@ -603,4 +605,6 @@ extern void hb_gt_w32_tone( double dFrequency, double dDuration ); int hb_gt_dos_keyCodeTranslate( int iKey ); #endif /* HB_OS_DOS || HB_OS_WIN_32 || HB_OS_OS2 */ +HB_EXTERN_END + #endif /* HB_GTCORE_H_ */ diff --git a/harbour/make_os2_gcc.cmd b/harbour/make_os2_gcc.cmd new file mode 100644 index 0000000000..64ef9adf36 --- /dev/null +++ b/harbour/make_os2_gcc.cmd @@ -0,0 +1,15 @@ +@echo off + +rem +rem $Id$ +rem + +rem Minimal initialization of environment variables for OS2 GCC build +rem for further information about see make_gnu.bat + + +if "%HB_ARCHITECTURE%" == "" set HB_ARCHITECTURE=os2 +if "%HB_COMPILER%" == "" set HB_COMPILER=gcc +if "%HB_GT_LIB%" == "" set HB_GT_LIB= + +make -r %1 %2 %3 %4 %5 %6 %7 %8 %9 > make_gnu.log diff --git a/harbour/source/lang/Makefile b/harbour/source/lang/Makefile index 78bd0403c8..2f0fb55762 100644 --- a/harbour/source/lang/Makefile +++ b/harbour/source/lang/Makefile @@ -51,6 +51,10 @@ C_SOURCES=\ msgru866.c \ msgrukoi.c \ msgruwin.c \ + msgskiso.c \ + msgskwin.c \ + msgskkam.c \ + msgsk852.c \ msgsl437.c \ msgsl852.c \ msgsliso.c \ diff --git a/harbour/source/lang/msgsk852.c b/harbour/source/lang/msgsk852.c new file mode 100644 index 0000000000..311e469ffc --- /dev/null +++ b/harbour/source/lang/msgsk852.c @@ -0,0 +1,219 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * Language Support Module (SK852) SK852 + * + * Copyright 2008 Gyula Bartal (from msgskwin.c) + * 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, or (at your option) + * any later version. + * + * 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 software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries 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 Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +/* Language name: Slovak */ +/* ISO language code (2 chars): SK */ +/* Codepage: 852 */ + +#include "hbapilng.h" + +static HB_LANG s_lang = +{ + { + /* Identification */ + + "SK852", /* ID */ + "Slovak", /* Name (in English) */ + "Slovensky", /* Name (in native language) */ + "SK", /* RFC ID */ + "852", /* Codepage */ + "$Revision$ $Date$", /* Version */ + + /* Month names */ + + "janu r", + "febru r", + "marec", + "aprĄl", + "m j", + "jŁn", + "jŁl", + "august", + "september", + "okt˘ber", + "november", + "december", + + /* Day names */ + + "nede–a", + "pondelok", + "utorok", + "streda", + "çtvrtok", + "piatok", + "sobota", + + /* CA-Cl*pper compatible natmsg items */ + + "D tab ze # Vety Aktualiz cia Ve–kosœ", + "Chcete viac prĄkladov?", + "Strana", + "** Medzisٟet **", + "* Medzimedzisٟet *", + "*** Sٟet ***", + "Ins", + " ", + "Chybně d tum", + "Rozsah: ", + " - ", + "A/N", + "CHYBNí VíRAZ", + + /* Error description names */ + + "Nezn m  chyba", + "Chyba argumentu", + "Chyba medzĄ", + "Preplnenie reœazca", + "Preplnenie ŸĄsla", + "Delenie nulou", + "Numerick  chyba", + "Chyba syntaxe", + "Oper cia prĄliç komplexn ", + "", + "", + "Nedostatok pam„te", + "Nedefinovan  funkcia", + "Nezn ma met˘da", + "Premenn  neexistuje", + "Oblasœ neexistuje", + "Nezn ma premenn ", + "Nepovolen‚ znaky v oblasti", + "Oblasœ u§ pou§it ", + "", + "Chyba vytvorenia", + "Chyba otvorenia", + "Chyba zatvorenia", + "Chyba ŸĄtania", + "Chyba z pisu", + "Chyba tlaŸe", + "", + "", + "", + "", + "Nepodporov na oper cia", + "PrekroŸeně limit", + "Index poçkodeně", + "Chyba typu d t", + "Chyba d’§ky d t", + "Nepou§it  pracovn  oblasœ ", + "Nezoraden  pracovn  oblasœ", + "Nutně věhradně prĄstup", + "Uzamknutie nutn‚", + "Zlyhanie z mka pri prid v nie", + "Zlyhanie z mka", + "", + "", + "", + "", + "prĄstup k polom", + "priradenie k pole", + "zmena dimenze pole", + "nie je polom", + "podmienka", + + /* Internal error names */ + + "Unrecoverable error %lu: ", + "Error recovery failure", + "No ERRORBLOCK() for error", + "Too many recursive error handler calls", + "RDD invalid or failed to load", + "Invalid method type from %s", + "hb_xgrab can't allocate memory", + "hb_xrealloc called with a NULL pointer", + "hb_xrealloc called with an invalid pointer", + "hb_xrealloc can't reallocate memory", + "hb_xfree called with an invalid pointer", + "hb_xfree called with a NULL pointer", + "Can\'t locate the starting procedure: \'%s\'", + "No starting procedure", + "Unsupported VM opcode", + "Symbol item expected from %s", + "Invalid symbol type for self from %s", + "Codeblock expected from %s", + "Incorrect item type on the stack trying to pop from %s", + "Stack underflow", + "An item was going to be copied to itself from %s", + "Invalid symbol item passed as memvar %s", + "Memory buffer overflow", + "hb_xgrab requested to allocate zero bytes", + "hb_xrealloc requested to resize to zero bytes", + "hb_xalloc requested to allocate zero bytes", + + /* Texts */ + + "DD.MM.YYYY", + "A", + "N" + } +}; + +HB_LANG_ANNOUNCE( SK852 ); + +HB_CALL_ON_STARTUP_BEGIN( hb_lang_Init_SK852 ) + hb_langRegister( &s_lang ); +HB_CALL_ON_STARTUP_END( hb_lang_Init_SK852 ) + +#if defined(HB_PRAGMA_STARTUP) + #pragma startup hb_lang_Init_SK852 +#elif defined(HB_MSC_STARTUP) + #if _MSC_VER >= 1010 + #pragma data_seg( ".CRT$XIY" ) + #pragma comment( linker, "/Merge:.CRT=.data" ) + #else + #pragma data_seg( "XIY" ) + #endif + static HB_$INITSYM hb_vm_auto_hb_lang_Init_SK852 = hb_lang_Init_SK852; + #pragma data_seg() +#endif diff --git a/harbour/source/lang/msgskiso.c b/harbour/source/lang/msgskiso.c new file mode 100644 index 0000000000..d9fe9dc1ec --- /dev/null +++ b/harbour/source/lang/msgskiso.c @@ -0,0 +1,219 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * Language Support Module (SK ISO-8859-2) + * + * Copyright 2008 Gyula Bartal (from msgskwin.c) + * 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, or (at your option) + * any later version. + * + * 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 software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries 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 Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +/* Language name: Slovak */ +/* ISO language code (2 chars): SK */ +/* Codepage: ISO-8859-2 */ + +#include "hbapilng.h" + +static HB_LANG s_lang = +{ + { + /* Identification */ + + "SKISO", /* ID */ + "Slovak", /* Name (in English) */ + "Slovensky", /* Name (in native language) */ + "SK", /* RFC ID */ + "ISO-8859-2", /* Codepage */ + "$Revision$ $Date$", /* Version */ + + /* Month names */ + + "január", + "február", + "marec", + "apríl", + "máj", + "jún", + "júl", + "august", + "september", + "október", + "november", + "december", + + /* Day names */ + + "nedeľa", + "pondelok", + "utorok", + "streda", + "štvrtok", + "piatok", + "sobota", + + /* CA-Cl*pper compatible natmsg items */ + + "Dátabáze # Vety Aktualizácia Veľkosť", + "Chcete viac príkladov?", + "Strana", + "** Medzisúčet **", + "* Medzimedzisúčet *", + "*** Súčet ***", + "Ins", + " ", + "Chybný dátum", + "Rozsah: ", + " - ", + "A/N", + "CHYBNÝ VÝRAZ", + + /* Error description names */ + + "Neznámá chyba", + "Chyba argumentu", + "Chyba medzí", + "Preplnenie reťazca", + "Preplnenie čísla", + "Delenie nulou", + "Numerická chyba", + "Chyba syntaxe", + "Operácia príliš komplexná", + "", + "", + "Nedostatok pamäte", + "Nedefinovaná funkcia", + "Neznámá metóda", + "Premenná neexistuje", + "Oblasť neexistuje", + "Neznáma premenná", + "Nepovolené znaky v oblasti", + "Oblasť už použitá", + "", + "Chyba vytvorenia", + "Chyba otvorenia", + "Chyba zatvorenia", + "Chyba čítania", + "Chyba zápisu", + "Chyba tlače", + "", + "", + "", + "", + "Nepodporována operácia", + "Prekročený limit", + "Index poškodený", + "Chyba typu dát", + "Chyba dĺžky dát", + "Nepoužitá pracovná oblasť ", + "Nezoradená pracovná oblasť", + "Nutný výhradný prístup", + "Uzamknutie nutné", + "Zlyhanie zámka pri pridávánie", + "Zlyhanie zámka", + "", + "", + "", + "", + "prístup k polom", + "priradenie k pole", + "zmena dimenze pole", + "nie je polom", + "podmienka", + + /* Internal error names */ + + "Unrecoverable error %lu: ", + "Error recovery failure", + "No ERRORBLOCK() for error", + "Too many recursive error handler calls", + "RDD invalid or failed to load", + "Invalid method type from %s", + "hb_xgrab can't allocate memory", + "hb_xrealloc called with a NULL pointer", + "hb_xrealloc called with an invalid pointer", + "hb_xrealloc can't reallocate memory", + "hb_xfree called with an invalid pointer", + "hb_xfree called with a NULL pointer", + "Can\'t locate the starting procedure: \'%s\'", + "No starting procedure", + "Unsupported VM opcode", + "Symbol item expected from %s", + "Invalid symbol type for self from %s", + "Codeblock expected from %s", + "Incorrect item type on the stack trying to pop from %s", + "Stack underflow", + "An item was going to be copied to itself from %s", + "Invalid symbol item passed as memvar %s", + "Memory buffer overflow", + "hb_xgrab requested to allocate zero bytes", + "hb_xrealloc requested to resize to zero bytes", + "hb_xalloc requested to allocate zero bytes", + + /* Texts */ + + "DD.MM.YYYY", + "A", + "N" + } +}; + +HB_LANG_ANNOUNCE( SKISO ); + +HB_CALL_ON_STARTUP_BEGIN( hb_lang_Init_SKISO ) + hb_langRegister( &s_lang ); +HB_CALL_ON_STARTUP_END( hb_lang_Init_SKISO ) + +#if defined(HB_PRAGMA_STARTUP) + #pragma startup hb_lang_Init_SKISO +#elif defined(HB_MSC_STARTUP) + #if _MSC_VER >= 1010 + #pragma data_seg( ".CRT$XIY" ) + #pragma comment( linker, "/Merge:.CRT=.data" ) + #else + #pragma data_seg( "XIY" ) + #endif + static HB_$INITSYM hb_vm_auto_hb_lang_Init_SKISO = hb_lang_Init_SKISO; + #pragma data_seg() +#endif diff --git a/harbour/source/lang/msgskkam.c b/harbour/source/lang/msgskkam.c new file mode 100644 index 0000000000..218caab173 --- /dev/null +++ b/harbour/source/lang/msgskkam.c @@ -0,0 +1,219 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * Language Support Module (SK Kamenicky ["895"]) + * + * Copyright 2008 Gyula Bartal (from msgskwin.c) + * 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, or (at your option) + * any later version. + * + * 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 software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries 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 Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +/* Language name: Slovak */ +/* ISO language code (2 chars): SK */ +/* Codepage: Kamenicky ("895") */ + +#include "hbapilng.h" + +static HB_LANG s_lang = +{ + { + /* Identification */ + + "SKKAM", /* ID */ + "Slovak", /* Name (in English) */ + "Slovensky", /* Name (in native language) */ + "SK", /* RFC ID */ + "kamenicky", /* Codepage */ + "$Revision$ $Date$", /* Version */ + + /* Month names */ + + "janu r", + "febru r", + "marec", + "aprĄl", + "m j", + "jŁn", + "jŁl", + "august", + "september", + "okt˘ber", + "november", + "december", + + /* Day names */ + + "nedeŒa", + "pondelok", + "utorok", + "streda", + "¨tvrtok", + "piatok", + "sobota", + + /* CA-Cl*pper compatible natmsg items */ + + "D tab ze # Vety Aktualiz cia VeŒkosŸ", + "Chcete viac prĄkladov?", + "Strana", + "** Medzisهet **", + "* Medzimedzisهet *", + "*** Sهet ***", + "Ins", + " ", + "Chybn˜ d tum", + "Rozsah: ", + " - ", + "A/N", + "CHYBN VRAZ", + + /* Error description names */ + + "Nezn m  chyba", + "Chyba argumentu", + "Chyba medzĄ", + "Preplnenie reŸazca", + "Preplnenie ‡Ąsla", + "Delenie nulou", + "Numerick  chyba", + "Chyba syntaxe", + "Oper cia prĄli¨ komplexn ", + "", + "", + "Nedostatok pam„te", + "Nedefinovan  funkcia", + "Nezn m  met˘da", + "Premenn  neexistuje", + "OblasŸ neexistuje", + "Nezn ma premenn ", + "Nepovolen‚ znaky v oblasti", + "OblasŸ u‘ pou‘it ", + "", + "Chyba vytvorenia", + "Chyba otvorenia", + "Chyba zatvorenia", + "Chyba ‡Ątania", + "Chyba z pisu", + "Chyba tla‡e", + "", + "", + "", + "", + "Nepodporov na oper cia", + "Prekro‡en˜ limit", + "Index po¨koden˜", + "Chyba typu d t", + "Chyba d‘ky d t", + "Nepou‘it  pracovn  oblasŸ ", + "Nezoraden  pracovn  oblasŸ", + "Nutn˜ v˜hradn˜ prĄstup", + "Uzamknutie nutn‚", + "Zlyhanie z mka pri prid v nie", + "Zlyhanie z mka", + "", + "", + "", + "", + "prĄstup k polom", + "priradenie k pole", + "zmena dimenze pole", + "nie je polom", + "podmienka", + + /* Internal error names */ + + "Unrecoverable error %lu: ", + "Error recovery failure", + "No ERRORBLOCK() for error", + "Too many recursive error handler calls", + "RDD invalid or failed to load", + "Invalid method type from %s", + "hb_xgrab can't allocate memory", + "hb_xrealloc called with a NULL pointer", + "hb_xrealloc called with an invalid pointer", + "hb_xrealloc can't reallocate memory", + "hb_xfree called with an invalid pointer", + "hb_xfree called with a NULL pointer", + "Can\'t locate the starting procedure: \'%s\'", + "No starting procedure", + "Unsupported VM opcode", + "Symbol item expected from %s", + "Invalid symbol type for self from %s", + "Codeblock expected from %s", + "Incorrect item type on the stack trying to pop from %s", + "Stack underflow", + "An item was going to be copied to itself from %s", + "Invalid symbol item passed as memvar %s", + "Memory buffer overflow", + "hb_xgrab requested to allocate zero bytes", + "hb_xrealloc requested to resize to zero bytes", + "hb_xalloc requested to allocate zero bytes", + + /* Texts */ + + "DD.MM.YYYY", + "A", + "N" + } +}; + +HB_LANG_ANNOUNCE( SKKAM ); + +HB_CALL_ON_STARTUP_BEGIN( hb_lang_Init_SKKAM ) + hb_langRegister( &s_lang ); +HB_CALL_ON_STARTUP_END( hb_lang_Init_SKKAM ) + +#if defined(HB_PRAGMA_STARTUP) + #pragma startup hb_lang_Init_SKKAM +#elif defined(HB_MSC_STARTUP) + #if _MSC_VER >= 1010 + #pragma data_seg( ".CRT$XIY" ) + #pragma comment( linker, "/Merge:.CRT=.data" ) + #else + #pragma data_seg( "XIY" ) + #endif + static HB_$INITSYM hb_vm_auto_hb_lang_Init_SKKAM = hb_lang_Init_SKKAM; + #pragma data_seg() +#endif diff --git a/harbour/source/lang/msgskwin.c b/harbour/source/lang/msgskwin.c new file mode 100644 index 0000000000..72f9ebb62d --- /dev/null +++ b/harbour/source/lang/msgskwin.c @@ -0,0 +1,219 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * Language Support Module (SKWIN) WIN1250 + * + * Copyright 2008 Gyula Bartal (from msgcswin.c) + * 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, or (at your option) + * any later version. + * + * 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 software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries 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 Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +/* Language name: Slovak */ +/* ISO language code (2 chars): SK */ +/* Codepage: 1250 */ + +#include "hbapilng.h" + +static HB_LANG s_lang = +{ + { + /* Identification */ + + "SKWIN", /* ID */ + "Slovak", /* Name (in English) */ + "Slovensky", /* Name (in native language) */ + "SK", /* RFC ID */ + "1250", /* Codepage */ + "$Revision$ $Date$", /* Version */ + + /* Month names */ + + "január", + "február", + "marec", + "apríl", + "máj", + "jún", + "júl", + "august", + "september", + "október", + "november", + "december", + + /* Day names */ + + "nedeža", + "pondelok", + "utorok", + "streda", + "štvrtok", + "piatok", + "sobota", + + /* CA-Cl*pper compatible natmsg items */ + + "Dátabáze # Vety Aktualizácia Vežkos", + "Chcete viac príkladov?", + "Strana", + "** Medzisúčet **", + "* Medzimedzisúčet *", + "*** Súčet ***", + "Ins", + " ", + "Chybný dátum", + "Rozsah: ", + " - ", + "A/N", + "CHYBNÝ VÝRAZ", + + /* Error description names */ + + "Neznámá chyba", + "Chyba argumentu", + "Chyba medzí", + "Preplnenie reazca", + "Preplnenie čísla", + "Delenie nulou", + "Numerická chyba", + "Chyba syntaxe", + "Operácia príliš komplexná", + "", + "", + "Nedostatok pamäte", + "Nedefinovaná funkcia", + "Neznámá metóda", + "Premenná neexistuje", + "Oblas neexistuje", + "Neznáma premenná", + "Nepovolené znaky v oblasti", + "Oblas už použitá", + "", + "Chyba vytvorenia", + "Chyba otvorenia", + "Chyba zatvorenia", + "Chyba čítania", + "Chyba zápisu", + "Chyba tlače", + "", + "", + "", + "", + "Nepodporována operácia", + "Prekročený limit", + "Index poškodený", + "Chyba typu dát", + "Chyba dĺžky dát", + "Nepoužitá pracovná oblas ", + "Nezoradená pracovná oblas", + "Nutný výhradný prístup", + "Uzamknutie nutné", + "Zlyhanie zámka pri pridávánie", + "Zlyhanie zámka", + "", + "", + "", + "", + "prístup k polom", + "priradenie k pole", + "zmena dimenze pole", + "nie je polom", + "podmienka", + + /* Internal error names */ + + "Unrecoverable error %lu: ", + "Error recovery failure", + "No ERRORBLOCK() for error", + "Too many recursive error handler calls", + "RDD invalid or failed to load", + "Invalid method type from %s", + "hb_xgrab can't allocate memory", + "hb_xrealloc called with a NULL pointer", + "hb_xrealloc called with an invalid pointer", + "hb_xrealloc can't reallocate memory", + "hb_xfree called with an invalid pointer", + "hb_xfree called with a NULL pointer", + "Can\'t locate the starting procedure: \'%s\'", + "No starting procedure", + "Unsupported VM opcode", + "Symbol item expected from %s", + "Invalid symbol type for self from %s", + "Codeblock expected from %s", + "Incorrect item type on the stack trying to pop from %s", + "Stack underflow", + "An item was going to be copied to itself from %s", + "Invalid symbol item passed as memvar %s", + "Memory buffer overflow", + "hb_xgrab requested to allocate zero bytes", + "hb_xrealloc requested to resize to zero bytes", + "hb_xalloc requested to allocate zero bytes", + + /* Texts */ + + "DD.MM.YYYY", + "A", + "N" + } +}; + +HB_LANG_ANNOUNCE( SKWIN ); + +HB_CALL_ON_STARTUP_BEGIN( hb_lang_Init_SKWIN ) + hb_langRegister( &s_lang ); +HB_CALL_ON_STARTUP_END( hb_lang_Init_SKWIN ) + +#if defined(HB_PRAGMA_STARTUP) + #pragma startup hb_lang_Init_SKWIN +#elif defined(HB_MSC_STARTUP) + #if _MSC_VER >= 1010 + #pragma data_seg( ".CRT$XIY" ) + #pragma comment( linker, "/Merge:.CRT=.data" ) + #else + #pragma data_seg( "XIY" ) + #endif + static HB_$INITSYM hb_vm_auto_hb_lang_Init_SKWIN = hb_lang_Init_SKWIN; + #pragma data_seg() +#endif diff --git a/harbour/source/rtl/cdpapi.c b/harbour/source/rtl/cdpapi.c index f350aef5d7..1c1e458c11 100644 --- a/harbour/source/rtl/cdpapi.c +++ b/harbour/source/rtl/cdpapi.c @@ -58,6 +58,15 @@ # include "hbapicdp.h" # include "hbapierr.h" + /* Now we are using only 16bit Unicode values so the maximum size + * of single character encoded in UTF8 is 3 though ISO 10646 Universal + * Character Set (UCS) occupies even a 31-bit code space and to encode + * all UCS values we will need 6 bytes. Now in practice no one uses + * Unicode character over 0xFFFF but it may change in the future so + * it's safer to use macro for maximum UTF8 character size. [druzus] + */ +# define HB_MAX_UTF8 3 + # define NUMBER_OF_CHARS 256 static USHORT s_uniCodes[NUMBER_OF_CHARS] = { @@ -98,8 +107,7 @@ static USHORT s_uniCodes[NUMBER_OF_CHARS] = { HB_UNITABLE hb_uniTbl_437 = { HB_CPID_437, NUMBER_OF_CHARS, FALSE, s_uniCodes }; static HB_CODEPAGE s_en_codepage = - { "EN", HB_CPID_437, HB_UNITB_437, 0, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0, -NULL }; + { "EN", HB_CPID_437, HB_UNITB_437, 0, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0, NULL }; # define HB_CDP_MAX_ 64 @@ -476,19 +484,39 @@ HB_EXPORT void hb_cdpTranslate( char *psz, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdpO { if( cdpIn != cdpOut && cdpIn->nChars == cdpOut->nChars ) { - int nAddLower = ( cdpIn->lLatin ) ? 6 : 0; - - for( ; *psz; psz++ ) + if( cdpIn->lAccEqual ) { - int n = ( int ) cdpIn->s_chars[( UCHAR ) * psz]; - - if( n != 0 && - ( n <= cdpOut->nChars || ( n > ( cdpOut->nChars + nAddLower ) && - n <= ( cdpOut->nChars * 2 + nAddLower ) ) ) ) + for( ; *psz; psz++ ) { - n--; - *psz = ( n >= ( cdpOut->nChars + nAddLower ) ) ? - cdpOut->CharsLower[n - cdpOut->nChars - nAddLower] : cdpOut->CharsUpper[n]; + char * ptr; + + ptr = strchr( cdpIn->CharsUpper, *psz ); + if( ptr ) + *psz = cdpOut->CharsUpper[ ptr - cdpIn->CharsUpper ]; + else + { + ptr = strchr( cdpIn->CharsLower, *psz ); + if( ptr ) + *psz = cdpOut->CharsLower[ ptr - cdpIn->CharsLower ]; + } + } + } + else + { + int nAddLower = ( cdpIn->lLatin ) ? 6 : 0; + + for( ; *psz; psz++ ) + { + int n = ( int ) cdpIn->s_chars[( UCHAR ) * psz]; + + if( n != 0 && + ( n <= cdpOut->nChars || ( n > ( cdpOut->nChars + nAddLower ) && + n <= ( cdpOut->nChars * 2 + nAddLower ) ) ) ) + { + n--; + *psz = ( n >= ( cdpOut->nChars + nAddLower ) ) ? + cdpOut->CharsLower[n - cdpOut->nChars - nAddLower] : cdpOut->CharsUpper[n]; + } } } } @@ -498,19 +526,39 @@ HB_EXPORT void hb_cdpnTranslate( char *psz, PHB_CODEPAGE cdpIn, PHB_CODEPAGE cdp { if( cdpIn != cdpOut && cdpIn->nChars == cdpOut->nChars ) { - int nAddLower = ( cdpIn->lLatin ) ? 6 : 0; - - for( ; nChars--; psz++ ) + if( cdpIn->lAccEqual ) { - int n = ( int ) cdpIn->s_chars[( UCHAR ) * psz]; - - if( n != 0 && - ( n <= cdpOut->nChars || ( n > ( cdpOut->nChars + nAddLower ) && - n <= ( cdpOut->nChars * 2 + nAddLower ) ) ) ) + for( ; nChars--; psz++ ) { - n--; - *psz = ( n >= ( cdpOut->nChars + nAddLower ) ) ? - cdpOut->CharsLower[n - cdpOut->nChars - nAddLower] : cdpOut->CharsUpper[n]; + char * ptr; + + ptr = strchr( cdpIn->CharsUpper, *psz ); + if( ptr ) + *psz = cdpOut->CharsUpper[ ptr - cdpIn->CharsUpper ]; + else + { + ptr = strchr( cdpIn->CharsLower, *psz ); + if( ptr ) + *psz = cdpOut->CharsLower[ ptr - cdpIn->CharsLower ]; + } + } + } + else + { + int nAddLower = ( cdpIn->lLatin ) ? 6 : 0; + + for( ; nChars--; psz++ ) + { + int n = ( int ) cdpIn->s_chars[( UCHAR ) * psz]; + + if( n != 0 && + ( n <= cdpOut->nChars || ( n > ( cdpOut->nChars + nAddLower ) && + n <= ( cdpOut->nChars * 2 + nAddLower ) ) ) ) + { + n--; + *psz = ( n >= ( cdpOut->nChars + nAddLower ) ) ? + cdpOut->CharsLower[n - cdpOut->nChars - nAddLower] : cdpOut->CharsUpper[n]; + } } } } @@ -1196,37 +1244,61 @@ HB_FUNC( HB_STRTOUTF8 ) hb_retc( NULL ); } +HB_FUNC( HB_UTF8CHR ) +{ + if( ISNUM( 1 ) ) + { + char utf8Char[ HB_MAX_UTF8 ]; + int iLen; + + iLen = u16toutf8( ( BYTE * ) utf8Char, ( USHORT ) hb_parni( 1 ) ); + hb_retclen( utf8Char, iLen ); + } + else + { + hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, &hb_errFuncName, HB_ERR_ARGS_BASEPARAMS ); + } +} + HB_FUNC( HB_UTF8TOSTR ) { - ULONG ulLen = hb_parclen( 1 ), ulDest = 0; - char *szString, *szDest = NULL; + char *szString = hb_parc( 1 ); - if( ulLen ) + if( szString ) { - PHB_CODEPAGE cdp = ISCHAR( 2 ) ? hb_cdpFind( hb_parc( 2 ) ) : hb_cdp_page; + ULONG ulLen = hb_parclen( 1 ), ulDest = 0; + char *szDest = NULL; - if( cdp ) + if( ulLen ) { - szString = hb_parc( 1 ); - ulDest = hb_cdpUTF8StringLength( ( BYTE * ) szString, ulLen ); - szDest = ( char * ) hb_xgrab( ulDest + 1 ); - hb_cdpUTF8ToStrn( cdp, FALSE, ( BYTE * ) szString, ulLen, ( BYTE * ) szDest, ulDest ); - } - } + PHB_CODEPAGE cdp = ISCHAR( 2 ) ? hb_cdpFind( hb_parc( 2 ) ) : hb_cdp_page; - if( szDest ) - hb_retclen_buffer( szDest, ulDest ); + if( cdp ) + { + szString = hb_parc( 1 ); + ulDest = hb_cdpUTF8StringLength( ( BYTE * ) szString, ulLen ); + szDest = ( char * ) hb_xgrab( ulDest + 1 ); + hb_cdpUTF8ToStrn( cdp, FALSE, ( BYTE * ) szString, ulLen, ( BYTE * ) szDest, ulDest ); + } + } + + if( szDest ) + hb_retclen_buffer( szDest, ulDest ); + else + hb_retc( NULL ); + } else - hb_retc( NULL ); + hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, &hb_errFuncName, HB_ERR_ARGS_BASEPARAMS ); } HB_FUNC( HB_UTF8SUBSTR ) { + char *szString = hb_parc( 1 ); int iPCount = hb_pcount(); - if( ISCHAR( 1 ) && ( iPCount < 2 || ( ISNUM( 2 ) && ( iPCount < 3 || ISNUM( 3 ) ) ) ) ) + if( szString && ( iPCount < 2 || ( ISNUM( 2 ) && ( iPCount < 3 || ISNUM( 3 ) ) ) ) ) { - char *szString = hb_parc( 1 ), *szDest = NULL; + char *szDest = NULL; ULONG ulLen = hb_parclen( 1 ), ulDest = 0; LONG lFrom = hb_parnl( 2 ); LONG lCount = iPCount < 3 ? ( LONG ) ulLen : hb_parnl( 3 ); @@ -1436,6 +1508,7 @@ HB_FUNC_EXTERN( STRTRAN ); HB_FUNC( HB_UTF8STRTRAN ) { -HB_FUNC_EXEC( STRTRAN )} + HB_FUNC_EXEC( STRTRAN ) +} #endif /* HB_CDP_SUPPORT_OFF */ diff --git a/harbour/source/rtl/gtos2/gtos2.c b/harbour/source/rtl/gtos2/gtos2.c index 6230c22883..2d243cd6f7 100644 --- a/harbour/source/rtl/gtos2/gtos2.c +++ b/harbour/source/rtl/gtos2/gtos2.c @@ -134,6 +134,10 @@ static int s_iCurRow; static int s_iCurCol; static int s_iCursorStyle; +/* buffer for single screen line */ +static int s_iLineBufSize = 0; +static USHORT * s_sLineBuf; + /* pointer to offscreen video buffer */ static ULONG s_ulLVBptr; /* length of video buffer */ @@ -517,7 +521,7 @@ static PVOID hb_gt_os2_allocMem( int iSize ) rc = DosAllocMem( &pMem, iSize, PAG_COMMIT | OBJ_TILE | PAG_WRITE ); if( rc != NO_ERROR ) - hb_errInternal( HB_EI_XGRABALLOC, "hb_gt_os2_ReadKey() memory allocation failure.", NULL, NULL ); + hb_errInternal( HB_EI_XGRABALLOC, "hb_gt_os2_allocMem() memory allocation failure.", NULL, NULL ); return pMem; } @@ -591,6 +595,12 @@ static void hb_gt_os2_Exit( PHB_GT pGT ) HB_GTSUPER_EXIT( pGT ); + if( s_iLineBufSize > 0 ) + { + DosFreeMem( ( PVOID ) s_sLineBuf ); + s_iLineBufSize = 0; + } + DosFreeMem( s_key ); DosFreeMem( s_hk ); VioSetCp( 0, s_usOldCodePage, 0 ); @@ -712,6 +722,27 @@ static char * hb_gt_os2_Version( PHB_GT pGT, int iType ) return "Harbour Terminal: OS/2 console"; } +static BOOL hb_gt_os2_Resize( PHB_GT pGT, int iRows, int iCols ) +{ + HB_TRACE(HB_TR_DEBUG, ("hb_gt_os2_Resize(%p,%d,%d)", pGT, iRows, iCols)); + + if( HB_GTSUPER_RESIZE( pGT, iRows, iCols ) ) + { + HB_GTSELF_GETSIZE( pGT, &iRows, &iCols ); + iRows <<= 1; + if( s_iLineBufSize != iRows ) + { + if( s_iLineBufSize != 0 ) + DosFreeMem( ( PVOID ) s_sLineBuf ); + if( iRows ) + s_sLineBuf = ( USHORT * ) hb_gt_os2_allocMem( iRows ); + s_iLineBufSize = iRows; + } + return TRUE; + } + return FALSE; +} + static BOOL hb_gt_os2_SetMode( PHB_GT pGT, int iRows, int iCols ) { BOOL fResult; @@ -772,7 +803,7 @@ static BOOL hb_gt_os2_Resume( PHB_GT pGT ) static void hb_gt_os2_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize ) { BYTE bColor, bAttr; - USHORT usChar, usCell; + USHORT usChar; int iLen = 0; HB_TRACE( HB_TR_DEBUG, ( "hb_gt_os2_Redraw(%p,%d,%d,%d)", pGT, iRow, iCol, iSize ) ); @@ -782,17 +813,10 @@ static void hb_gt_os2_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize ) if( !HB_GTSELF_GETSCRCHAR( pGT, iRow, iCol + iLen, &bColor, &bAttr, &usChar ) ) break; - /* - * TODO: it can be very slow (I haven't tested it) because it - * update screen with single characters so if necessary optimize - * it by grouping cells for the whole line or characters with - * the same color. [druzus] - */ - usCell = ( bColor << 8 ) + ( usChar & 0xff ); - VioWrtNCell( ( PBYTE ) &usCell, 1, iRow, iCol + iLen, 0 ); - - iLen++; + s_sLineBuf[ iLen++ ] = ( bColor << 8 ) + ( usChar & 0xff ); } + + VioWrtCellStr( ( PCH ) s_sLineBuf, iSize << 1, iRow, iCol, 0 ); } static void hb_gt_os2_Refresh( PHB_GT pGT ) @@ -842,6 +866,7 @@ static BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable ) pFuncTable->Init = hb_gt_os2_Init; pFuncTable->Exit = hb_gt_os2_Exit; pFuncTable->IsColor = hb_gt_os2_IsColor; + pFuncTable->Resize = hb_gt_os2_Resize; pFuncTable->SetMode = hb_gt_os2_SetMode; pFuncTable->Redraw = hb_gt_os2_Redraw; pFuncTable->Refresh = hb_gt_os2_Refresh; diff --git a/harbour/source/rtl/gtsln/gtsln.h b/harbour/source/rtl/gtsln/gtsln.h index 392f43d1d3..aa76040187 100644 --- a/harbour/source/rtl/gtsln/gtsln.h +++ b/harbour/source/rtl/gtsln/gtsln.h @@ -72,7 +72,6 @@ #include #include #include -#include #include #ifndef HB_OS_DARWIN diff --git a/harbour/source/vm/arrays.c b/harbour/source/vm/arrays.c index 39fa2c1546..e0c4203f5a 100644 --- a/harbour/source/vm/arrays.c +++ b/harbour/source/vm/arrays.c @@ -691,7 +691,7 @@ HB_EXPORT BOOL hb_arraySetNLL( PHB_ITEM pArray, ULONG ulIndex, LONGLONG llNumber HB_EXPORT BOOL hb_arraySetNInt( PHB_ITEM pArray, ULONG ulIndex, HB_LONG lNumber ) { - HB_TRACE(HB_TR_DEBUG, ("hb_arraySetNLL(%p, %lu, %" PFHL "d)", pArray, ulIndex, lNumber)); + HB_TRACE(HB_TR_DEBUG, ("hb_arraySetNInt(%p, %lu, %" PFHL "d)", pArray, ulIndex, lNumber)); if( HB_IS_ARRAY( pArray ) && ulIndex > 0 && ulIndex <= pArray->item.asArray.value->ulLen ) {