*** empty log message ***
This commit is contained in:
@@ -1,3 +1,28 @@
|
||||
19990731-08:22 CET Victor Szel <info@szelvesz.hu>
|
||||
* source/rtl/natmsg/*.c
|
||||
GenericErrors renamed to hb_errorsGeneric
|
||||
static removed from the declarations.
|
||||
* source/rtl/msgxxx.c - Small cleanup.
|
||||
* source/rtl/natmsg/*.c
|
||||
source/rtl/msgxxx.c
|
||||
All files and language manifest constants renamed, so that
|
||||
they use the RFC language code.
|
||||
msgr1251 renamed to msgruwin, I may be wrong that
|
||||
codepage 1251 can be called russian windows codepage, but
|
||||
the name could not fit in 8 chars otherwise.
|
||||
* include/error.ch - Small modification.
|
||||
+ source/rtl/natmsg.c - msg_tpl.c
|
||||
Added template language file. Contributors should use this to add
|
||||
support for a new language.
|
||||
+ source/tools/Makefile
|
||||
source/tools/strfmt.c - StrFormat() added, see the file for
|
||||
documentation. StrFormat("%1 %2", "Hello", "world!") -> "Hello world!"
|
||||
+ source/tools/Makefile
|
||||
source/tools/numtxthu.prg - NumToTxtHU() function to convert a
|
||||
number (especially currency) to a text. This is the Hungarian
|
||||
version. ( 115 -> "One hundred fifteen" )
|
||||
!! If you have such a function for your language, please add it, too.
|
||||
|
||||
19990731-02:30 EDT David G. Holm <dholm@jsd-llc.com>
|
||||
* source/hbpp/hbpplib.c
|
||||
! ParseExpression() expects a null-terminated string.
|
||||
|
||||
@@ -6,55 +6,55 @@
|
||||
#define _ERROR_CH
|
||||
|
||||
/* Severity levels (oError:severity) */
|
||||
#define ES_WHOCARES 0
|
||||
#define ES_WARNING 1
|
||||
#define ES_ERROR 2
|
||||
#define ES_CATASTROPHIC 3
|
||||
#define ES_WHOCARES 0
|
||||
#define ES_WARNING 1
|
||||
#define ES_ERROR 2
|
||||
#define ES_CATASTROPHIC 3
|
||||
|
||||
/* Generic error codes (oError:genCode) */
|
||||
#define EG_ARG 1
|
||||
#define EG_BOUND 2
|
||||
#define EG_STROVERFLOW 3
|
||||
#define EG_NUMOVERFLOW 4
|
||||
#define EG_ZERODIV 5
|
||||
#define EG_NUMERR 6
|
||||
#define EG_SYNTAX 7
|
||||
#define EG_COMPLEXITY 8
|
||||
#define EG_ARG 1
|
||||
#define EG_BOUND 2
|
||||
#define EG_STROVERFLOW 3
|
||||
#define EG_NUMOVERFLOW 4
|
||||
#define EG_ZERODIV 5
|
||||
#define EG_NUMERR 6
|
||||
#define EG_SYNTAX 7
|
||||
#define EG_COMPLEXITY 8
|
||||
|
||||
#define EG_MEM 11
|
||||
#define EG_NOFUNC 12
|
||||
#define EG_NOMETHOD 13
|
||||
#define EG_NOVAR 14
|
||||
#define EG_NOALIAS 15
|
||||
#define EG_NOVARMETHOD 16
|
||||
#define EG_BADALIAS 17
|
||||
#define EG_DUPALIAS 18
|
||||
#define EG_MEM 11
|
||||
#define EG_NOFUNC 12
|
||||
#define EG_NOMETHOD 13
|
||||
#define EG_NOVAR 14
|
||||
#define EG_NOALIAS 15
|
||||
#define EG_NOVARMETHOD 16
|
||||
#define EG_BADALIAS 17
|
||||
#define EG_DUPALIAS 18
|
||||
|
||||
#define EG_CREATE 20
|
||||
#define EG_OPEN 21
|
||||
#define EG_CLOSE 22
|
||||
#define EG_READ 23
|
||||
#define EG_WRITE 24
|
||||
#define EG_PRINT 25
|
||||
#define EG_CREATE 20
|
||||
#define EG_OPEN 21
|
||||
#define EG_CLOSE 22
|
||||
#define EG_READ 23
|
||||
#define EG_WRITE 24
|
||||
#define EG_PRINT 25
|
||||
|
||||
#define EG_UNSUPPORTED 30
|
||||
#define EG_LIMIT 31
|
||||
#define EG_CORRUPTION 32
|
||||
#define EG_DATATYPE 33
|
||||
#define EG_DATAWIDTH 34
|
||||
#define EG_NOTABLE 35
|
||||
#define EG_NOORDER 36
|
||||
#define EG_SHARED 37
|
||||
#define EG_UNLOCKED 38
|
||||
#define EG_READONLY 39
|
||||
#define EG_UNSUPPORTED 30
|
||||
#define EG_LIMIT 31
|
||||
#define EG_CORRUPTION 32
|
||||
#define EG_DATATYPE 33
|
||||
#define EG_DATAWIDTH 34
|
||||
#define EG_NOTABLE 35
|
||||
#define EG_NOORDER 36
|
||||
#define EG_SHARED 37
|
||||
#define EG_UNLOCKED 38
|
||||
#define EG_READONLY 39
|
||||
|
||||
#define EG_APPENDLOCK 40
|
||||
#define EG_LOCK 41
|
||||
#define EG_APPENDLOCK 40
|
||||
#define EG_LOCK 41
|
||||
|
||||
#define EG_ARGCOUNT 45
|
||||
#define EG_ARRACCESS 46
|
||||
#define EG_ARRASSIGN 47
|
||||
#define EG_NOTARRAY 48
|
||||
#define EG_CONDITION 49
|
||||
#define EG_ARGCOUNT 45 /* Harbour special */
|
||||
#define EG_ARRACCESS 46 /* Harbour special */
|
||||
#define EG_ARRASSIGN 47 /* Harbour special */
|
||||
#define EG_NOTARRAY 48 /* Harbour special */
|
||||
#define EG_CONDITION 49 /* Harbour special */
|
||||
|
||||
#endif /* _ERROR_CH */
|
||||
|
||||
@@ -5,58 +5,58 @@
|
||||
#include "hbdefs.h"
|
||||
#include "hbsetup.h"
|
||||
|
||||
#if defined(HARBOUR_LANGUAGE_BAS)
|
||||
#include "natmsg/msgbas.c"
|
||||
#elif defined(HARBOUR_LANGUAGE_DUT)
|
||||
#include "natmsg/msgdut.c"
|
||||
#if defined(HARBOUR_LANGUAGE_EU)
|
||||
#include "natmsg/msgeu.c"
|
||||
#elif defined(HARBOUR_LANGUAGE_NL)
|
||||
#include "natmsg/msgnl.c"
|
||||
#elif defined(HARBOUR_LANGUAGE_EO)
|
||||
#include "natmsg/msgeo.c"
|
||||
#elif defined(HARBOUR_LANGUAGE_GAL)
|
||||
#include "natmsg/msggal.c"
|
||||
#elif defined(HARBOUR_LANGUAGE_GER)
|
||||
#include "natmsg/msgger.c"
|
||||
#elif defined(HARBOUR_LANGUAGE_INA)
|
||||
#include "natmsg/msgia.c"
|
||||
#elif defined(HARBOUR_LANGUAGE_GL)
|
||||
#include "natmsg/msggl.c"
|
||||
#elif defined(HARBOUR_LANGUAGE_DE)
|
||||
#include "natmsg/msgde.c"
|
||||
#elif defined(HARBOUR_LANGUAGE_ID)
|
||||
#include "natmsg/msgid.c"
|
||||
#elif defined(HARBOUR_LANGUAGE_HU852)
|
||||
#include "natmsg/msghu852.c"
|
||||
#elif defined(HARBOUR_LANGUAGE_HUCWI)
|
||||
#include "natmsg/msghucwi.c"
|
||||
#elif defined(HARBOUR_LANGUAGE_HUWIN)
|
||||
#include "natmsg/msghuwin.c"
|
||||
#elif defined(HARBOUR_LANGUAGE_KOR)
|
||||
#include "natmsg/msgkor.c"
|
||||
#elif defined(HARBOUR_LANGUAGE_POR)
|
||||
#include "natmsg/msgpor.c"
|
||||
#elif defined(HARBOUR_LANGUAGE_R1251)
|
||||
#include "natmsg/msgr1251.c"
|
||||
#elif defined(HARBOUR_LANGUAGE_KO)
|
||||
#include "natmsg/msgko.c"
|
||||
#elif defined(HARBOUR_LANGUAGE_PT)
|
||||
#include "natmsg/msgpt.c"
|
||||
#elif defined(HARBOUR_LANGUAGE_RUWIN)
|
||||
#include "natmsg/msgruwin.c"
|
||||
#elif defined(HARBOUR_LANGUAGE_RU886)
|
||||
#include "natmsg/msgru886.c"
|
||||
#elif defined(HARBOUR_LANGUAGE_SPA)
|
||||
#include "natmsg/msgspa.c"
|
||||
#elif defined(HARBOUR_LANGUAGE_CAT)
|
||||
#include "natmsg/msgcat.c"
|
||||
#elif defined(HARBOUR_LANGUAGE_ITA)
|
||||
#include "natmsg/msgita.c"
|
||||
#elif defined(HARBOUR_LANGUAGE_FRE)
|
||||
#include "natmsg/msgfre.c"
|
||||
#elif defined(HARBOUR_LANGUAGE_CZ852)
|
||||
#include "natmsg/msgcz852.c"
|
||||
#elif defined(HARBOUR_LANGUAGE_CZKAM)
|
||||
#include "natmsg/msgczkam.c"
|
||||
#elif defined(HARBOUR_LANGUAGE_YU852)
|
||||
#include "natmsg/msgyu852.c"
|
||||
#elif defined(HARBOUR_LANGUAGE_ES)
|
||||
#include "natmsg/msges.c"
|
||||
#elif defined(HARBOUR_LANGUAGE_CA)
|
||||
#include "natmsg/msgca.c"
|
||||
#elif defined(HARBOUR_LANGUAGE_IT)
|
||||
#include "natmsg/msgit.c"
|
||||
#elif defined(HARBOUR_LANGUAGE_FR)
|
||||
#include "natmsg/msgfr.c"
|
||||
#elif defined(HARBOUR_LANGUAGE_CS852)
|
||||
#include "natmsg/msgcs852.c"
|
||||
#elif defined(HARBOUR_LANGUAGE_CSKAM)
|
||||
#include "natmsg/msgcskam.c"
|
||||
#elif defined(HARBOUR_LANGUAGE_SR852)
|
||||
#include "natmsg/msgsr852.c"
|
||||
#elif defined(HARBOUR_LANGUAGE_PL852)
|
||||
#include "natmsg/msgpl852.c"
|
||||
#elif defined(HARBOUR_LANGUAGE_PLMAZ)
|
||||
#include "natmsg/msgplmaz.c"
|
||||
#else
|
||||
#include "natmsg/msguk.c"
|
||||
#include "natmsg/msgen.c"
|
||||
#endif
|
||||
|
||||
char *hb_errorNatDescription( ULONG ulGenError )
|
||||
{
|
||||
if( ulGenError < sizeof(genericErrors)/sizeof(char*) )
|
||||
return genericErrors[ ulGenError ];
|
||||
if( ulGenError < sizeof(hb_errorsGeneric) / sizeof(hb_errorsGeneric[ 0 ]) )
|
||||
return hb_errorsGeneric[ ulGenError ];
|
||||
else
|
||||
return genericErrors[ 0 ];
|
||||
return hb_errorsGeneric[ 0 ];
|
||||
}
|
||||
|
||||
92
harbour/source/rtl/natmsg/msg_tpl.c
Normal file
92
harbour/source/rtl/natmsg/msg_tpl.c
Normal file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/* Language Support Module */
|
||||
|
||||
/* Language name: <Your language> */
|
||||
/* ISO language code (2 chars): (please look it up in /doc/lang_id.txt) */
|
||||
/* Codepage: <Your codepage> */
|
||||
|
||||
#include "hbdefs.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"
|
||||
};
|
||||
|
||||
char *hb_errorsGeneric[] =
|
||||
{
|
||||
"Unknown error",
|
||||
"Argument error",
|
||||
"Bound error",
|
||||
"String overflow",
|
||||
"Numeric overflow",
|
||||
"Divide by zero",
|
||||
"Numeric error",
|
||||
"Syntax error",
|
||||
"Operation too complex",
|
||||
"",
|
||||
"",
|
||||
"Memory low",
|
||||
"Undefined function",
|
||||
"No exported method",
|
||||
"Variable does not exists",
|
||||
"Alias does not exists",
|
||||
"No exported variable",
|
||||
"Incorrect alias name",
|
||||
"Duplicated alias name",
|
||||
"",
|
||||
"Create error",
|
||||
"Open error",
|
||||
"Close error",
|
||||
"Read error",
|
||||
"Write error",
|
||||
"Print error",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"Unsupported operation",
|
||||
"Limit exeeded",
|
||||
"Index corruption detected",
|
||||
"Incorrect type of data",
|
||||
"Data width too long",
|
||||
"Workarea not in use",
|
||||
"Workarea not indexed",
|
||||
"Exclusive use required",
|
||||
"Lock required",
|
||||
"Write not allowed",
|
||||
"Append lock failed",
|
||||
"Lock failure",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"Incorrect number of arguments",
|
||||
"array access",
|
||||
"array assign",
|
||||
"not an array",
|
||||
"conditional"
|
||||
};
|
||||
@@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] =
|
||||
"Disabte"
|
||||
};
|
||||
|
||||
static char *genericErrors[] =
|
||||
char *hb_errorsGeneric[] =
|
||||
{
|
||||
"Unknown error",
|
||||
"Argument error",
|
||||
@@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] =
|
||||
"sobota"
|
||||
};
|
||||
|
||||
static char *genericErrors[] =
|
||||
char *hb_errorsGeneric[] =
|
||||
{
|
||||
"Unknown error",
|
||||
"Argument error",
|
||||
@@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] =
|
||||
"sobota"
|
||||
};
|
||||
|
||||
static char *genericErrors[] =
|
||||
char *hb_errorsGeneric[] =
|
||||
{
|
||||
"Unknown error",
|
||||
"Argument error",
|
||||
@@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] =
|
||||
"Samstag"
|
||||
};
|
||||
|
||||
static char *genericErrors[] =
|
||||
char *hb_errorsGeneric[] =
|
||||
{
|
||||
"Unknown error",
|
||||
"Argument error",
|
||||
@@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] =
|
||||
"Saturday"
|
||||
};
|
||||
|
||||
static char *genericErrors[] =
|
||||
char *hb_errorsGeneric[] =
|
||||
{
|
||||
"Unknown error",
|
||||
"Argument error",
|
||||
@@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] =
|
||||
"sabato"
|
||||
};
|
||||
|
||||
static char *genericErrors[] =
|
||||
char *hb_errorsGeneric[] =
|
||||
{
|
||||
"Unknown error",
|
||||
"Argument error",
|
||||
|
||||
@@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] =
|
||||
"S bado"
|
||||
};
|
||||
|
||||
static char *genericErrors[] =
|
||||
char *hb_errorsGeneric[] =
|
||||
{
|
||||
"Error desconocido",
|
||||
"Error de argumento",
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include "hbdefs.h"
|
||||
|
||||
char *hb_monthsname[ 12 ] =
|
||||
char *hb_monthsname[ 12 ] =
|
||||
{
|
||||
"Urtarrila",
|
||||
"Otsaila",
|
||||
@@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] =
|
||||
"Larunbata"
|
||||
};
|
||||
|
||||
static char *genericErrors[] =
|
||||
char *hb_errorsGeneric[] =
|
||||
{
|
||||
"Unknown error",
|
||||
"Argument error",
|
||||
@@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] =
|
||||
"Samedi"
|
||||
};
|
||||
|
||||
static char *genericErrors[] =
|
||||
char *hb_errorsGeneric[] =
|
||||
{
|
||||
"Unknown error",
|
||||
"Argument error",
|
||||
@@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] =
|
||||
"S bado"
|
||||
};
|
||||
|
||||
static char *genericErrors[] =
|
||||
char *hb_errorsGeneric[] =
|
||||
{
|
||||
"Unknown error",
|
||||
"Argument error",
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
@@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] =
|
||||
"szombat"
|
||||
};
|
||||
|
||||
static char *genericErrors[] =
|
||||
char *hb_errorsGeneric[] =
|
||||
{
|
||||
"Ismeretlen hiba",
|
||||
"Param‚ter hiba",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
@@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] =
|
||||
"szombat"
|
||||
};
|
||||
|
||||
static char *genericErrors[] =
|
||||
char *hb_errorsGeneric[] =
|
||||
{
|
||||
"Ismeretlen hiba",
|
||||
"Param‚ter hiba",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
@@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] =
|
||||
"szombat"
|
||||
};
|
||||
|
||||
static char *genericErrors[] =
|
||||
char *hb_errorsGeneric[] =
|
||||
{
|
||||
"Ismeretlen hiba",
|
||||
"Paraméter hiba",
|
||||
|
||||
@@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] =
|
||||
"Sabtu"
|
||||
};
|
||||
|
||||
static char *genericErrors[] =
|
||||
char *hb_errorsGeneric[] =
|
||||
{
|
||||
"Unknown error",
|
||||
"Argument error",
|
||||
@@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] =
|
||||
"Sabato"
|
||||
};
|
||||
|
||||
static char *genericErrors[] =
|
||||
char *hb_errorsGeneric[] =
|
||||
{
|
||||
"Errore sconosciuto",
|
||||
"Errore di parametri",
|
||||
@@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] =
|
||||
"토요일"
|
||||
};
|
||||
|
||||
static char *genericErrors[] =
|
||||
char *hb_errorsGeneric[] =
|
||||
{
|
||||
"Unknown error",
|
||||
"Argument error",
|
||||
@@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] =
|
||||
"zaterdag"
|
||||
};
|
||||
|
||||
static char *genericErrors[] =
|
||||
char *hb_errorsGeneric[] =
|
||||
{
|
||||
"Unknown error",
|
||||
"Argument error",
|
||||
@@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] =
|
||||
"Sobota"
|
||||
};
|
||||
|
||||
static char *genericErrors[] =
|
||||
char *hb_errorsGeneric[] =
|
||||
{
|
||||
"B<EFBFBD>Ąd bez opisu",
|
||||
"Nieprawid<EFBFBD>owy argument",
|
||||
|
||||
@@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] =
|
||||
"Sobota"
|
||||
};
|
||||
|
||||
static char *genericErrors[] =
|
||||
char *hb_errorsGeneric[] =
|
||||
{
|
||||
"Bł±d bez opisu",
|
||||
"Nieprawidłowy argument",
|
||||
|
||||
@@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] =
|
||||
"Sobota"
|
||||
};
|
||||
|
||||
static char *genericErrors[] =
|
||||
char *hb_errorsGeneric[] =
|
||||
{
|
||||
"B’†d bez opisu",
|
||||
"Nieprawid’owy argument",
|
||||
|
||||
@@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] =
|
||||
"Sábado"
|
||||
};
|
||||
|
||||
static char *genericErrors[] =
|
||||
char *hb_errorsGeneric[] =
|
||||
{
|
||||
"Erro desconhecido",
|
||||
"Erro nos parâmetros",
|
||||
@@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] =
|
||||
"‘ã¡¡®â "
|
||||
};
|
||||
|
||||
static char *genericErrors[] =
|
||||
char *hb_errorsGeneric[] =
|
||||
{
|
||||
"Unknown error",
|
||||
"Argument error",
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
/* Language name: Russian */
|
||||
/* ISO language code (2 chars): RU */
|
||||
/* Codepage: 1251 */
|
||||
/* Codepage: Windows-1251 */
|
||||
|
||||
#include "hbdefs.h"
|
||||
|
||||
@@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] =
|
||||
"Ñóááîòà"
|
||||
};
|
||||
|
||||
static char *genericErrors[] =
|
||||
char *hb_errorsGeneric[] =
|
||||
{
|
||||
"Unknown error",
|
||||
"Argument error",
|
||||
@@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] =
|
||||
"subota"
|
||||
};
|
||||
|
||||
static char *genericErrors[] =
|
||||
char *hb_errorsGeneric[] =
|
||||
{
|
||||
"Unknown error",
|
||||
"Argument error",
|
||||
@@ -25,6 +25,7 @@ C_SOURCES=\
|
||||
strcspn.c \
|
||||
strdiff.c \
|
||||
strexpan.c \
|
||||
strfmt.c \
|
||||
stringsx.c \
|
||||
strleft.c \
|
||||
strpbrk.c \
|
||||
@@ -32,6 +33,7 @@ C_SOURCES=\
|
||||
|
||||
PRG_SOURCES=\
|
||||
fileread.prg \
|
||||
numtxthu.prg \
|
||||
stringp.prg \
|
||||
|
||||
LIB=tools
|
||||
|
||||
98
harbour/source/tools/numtxthu.prg
Normal file
98
harbour/source/tools/numtxthu.prg
Normal file
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
Harbour Project source code
|
||||
|
||||
Function to convert a number to text.
|
||||
|
||||
Copyright 1992-1999 Victor Szel <info@szelvesz.hu>
|
||||
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/).
|
||||
*/
|
||||
|
||||
FUNCTION NumToTxtHU(nValue)
|
||||
LOCAL aTort := { "tized", "sz zad", "ezred", "t¡zezred", "sz zezred", "milliomod" }
|
||||
LOCAL cRetVal
|
||||
LOCAL tmp, tmp1, tmp2
|
||||
|
||||
IF nValue == 0
|
||||
RETURN "nulla"
|
||||
ENDIF
|
||||
|
||||
IF nValue < 0
|
||||
nValue := -nValue
|
||||
cRetVal := "m¡nusz "
|
||||
ELSE
|
||||
cRetVal := ""
|
||||
ENDIF
|
||||
|
||||
cRetVal += NumToTxtRaw(tmp := Int(nValue))
|
||||
|
||||
IF (tmp := (nValue-tmp)) > 0 .AND. tmp < 1
|
||||
|
||||
tmp1 := Len(tmp2 := SubStr(Str(tmp, 8, 6), 3))
|
||||
|
||||
WHILE SubStr(tmp2, tmp1, 1) == "0" .AND. tmp1 > 0
|
||||
tmp1--
|
||||
ENDDO
|
||||
|
||||
cRetVal += " eg‚sz " + NumToTxtRaw(tmp * (10 ^ tmp1))
|
||||
IF tmp1 >= 1 .AND. tmp1 <= Len(aTort)
|
||||
cRetVal += " " + aTort[tmp1]
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
RETURN cRetVal
|
||||
|
||||
#define NTT_MAXLENGTH 18
|
||||
|
||||
STATIC FUNCTION NumToTxtRaw(nValue)
|
||||
LOCAL aDigit[NTT_MAXLENGTH]
|
||||
LOCAL cValue := StrZero(nValue, NTT_MAXLENGTH)
|
||||
LOCAL aEgesz := {"", "ezer" , "milli¢", "milli rd", "billi¢" , "ezerbilli¢"}
|
||||
LOCAL aEgyes := {{"", "egy" , "kett‹" , "h rom" , "n‚gy" , "”t" , "hat" , "h‚t" , "nyolc" , "kilenc" },;
|
||||
{"", "egy" , "kett‹" , "h rom" , "n‚gy" , "”t" , "hat" , "h‚t" , "nyolc" , "kilenc" }}
|
||||
LOCAL aTizes := {{"", "t¡z" , "h£sz" , "harminc" , "negyven", "”tven", "hatvan", "hetven", "nyolcvan", "kilencven" },;
|
||||
{"", "tizen", "huszon", "harminc" , "negyven", "”tven", "hatvan", "hetven", "nyolcvan", "kilencven" }}
|
||||
LOCAL tmp
|
||||
|
||||
FOR tmp := 1 TO NTT_MAXLENGTH
|
||||
aDigit[tmp] := Val(SubStr(cValue, NTT_MAXLENGTH - tmp + 1, 1))
|
||||
NEXT
|
||||
|
||||
cValue := ""
|
||||
FOR tmp := 1 TO 16 STEP 3
|
||||
IF aDigit[tmp] != 0 .OR. aDigit[tmp + 1] != 0 .OR. aDigit[tmp + 2] != 0
|
||||
cValue := aEgyes[iif(tmp == 1, 1, 2)][aDigit[tmp] + 1] + aEgesz[(tmp - 1) / 3 + 1] + iif(Empty(cValue), "", "-") + cValue
|
||||
cValue := aTizes[iif(aDigit[tmp] == 0, 1, 2)][aDigit[tmp + 1] + 1] + cValue
|
||||
IF aDigit[tmp + 2] != 0
|
||||
cValue := aEgyes[ 2][aDigit[tmp + 2] + 1] + "sz z" + cValue
|
||||
ENDIF
|
||||
ENDIF
|
||||
NEXT
|
||||
|
||||
RETURN cValue
|
||||
|
||||
191
harbour/source/tools/strfmt.c
Normal file
191
harbour/source/tools/strfmt.c
Normal file
@@ -0,0 +1,191 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
Harbour Project source code
|
||||
|
||||
Simple string formatter.
|
||||
|
||||
Copyright 1997-1999 Victor Szel <info@szelvesz.hu>
|
||||
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/).
|
||||
*/
|
||||
|
||||
#include "extend.h"
|
||||
|
||||
/* $DOC$
|
||||
* $FUNCNAME$
|
||||
* StrFormat()
|
||||
* $CATEGORY$
|
||||
* String
|
||||
* $ONELINER$
|
||||
* ...
|
||||
* $SYNTAX$
|
||||
* StrFormat(<cMask>[, <cPar1>[, <cParn>[, ...]])
|
||||
* $ARGUMENTS$
|
||||
* <cMask> Holds the mask for the resulting string
|
||||
* <cParn> Holds the strings to be inserted in the mask
|
||||
* maximum 9 of them can be specified.
|
||||
* $RETURNS$
|
||||
* Return the mask with all the parameters inserted.
|
||||
* $DESCRIPTION$
|
||||
* String replacment, can be useful when writing international
|
||||
* apps. You can separate the constant strings from the variable ones.
|
||||
* Each %1 - %9 marks will be replaced with the appropriate parameter
|
||||
* from the parameter list.
|
||||
* Marks can be in any order, and can be duplicated.
|
||||
* You can print "%" character with "%%".
|
||||
* $EXAMPLES$
|
||||
* StrFormat("Please insert disk %1 to drive %2", LTrim(Str(2)), "A:")
|
||||
* StrFormat("This is %1 from %2", "Victor", "Hungary")
|
||||
* StrFormat("%2 %1 %2", "Param1", "Param2")
|
||||
* $TESTS$
|
||||
* ? StrFormat("Please insert disk %1 to drive %2", LTrim(Str(2)), "A:")
|
||||
* ? StrFormat("This is %1 from %2", "Victor", "Hungary")
|
||||
* ? StrFormat("%2 %1 %2", "Param1", "Param2")
|
||||
* ? StrFormat("Hello")
|
||||
* ? StrFormat("%1 - %2", "one")
|
||||
* ? StrFormat("%1 - %2", "one", "two")
|
||||
* ? StrFormat("%2 - %1", "one", "two")
|
||||
* ? StrFormat("%2 - %", "one", "two")
|
||||
* ? StrFormat("%% - %", "one", "two")
|
||||
* ? StrFormat("%9 - %", "one", "two")
|
||||
* $STATUS$
|
||||
* Done
|
||||
* $COMPLIANCE$
|
||||
* All platforms
|
||||
* $SEEALSO$
|
||||
*
|
||||
* $END$
|
||||
*/
|
||||
|
||||
#define HB_STRFORMAT_PARNUM_MAX_ 9
|
||||
|
||||
HARBOUR HB_STRFORMAT (void) /* StrFormat() */
|
||||
{
|
||||
char* pszMask = hb_parc(1);
|
||||
ULONG nMaskLen = hb_parclen(1);
|
||||
ULONG nMaskPos;
|
||||
ULONG nParNum = PCOUNT;
|
||||
ULONG nLenTable [HB_STRFORMAT_PARNUM_MAX_];
|
||||
char* pszVarTable [HB_STRFORMAT_PARNUM_MAX_];
|
||||
|
||||
ULONG nRetValLen;
|
||||
char* pszRetVal;
|
||||
char* pszRetValSave;
|
||||
|
||||
ULONG tmp;
|
||||
|
||||
if (nParNum < 1)
|
||||
{
|
||||
hb_retc("");
|
||||
return;
|
||||
}
|
||||
|
||||
nParNum--;
|
||||
|
||||
if (nParNum > HB_STRFORMAT_PARNUM_MAX_) nParNum = HB_STRFORMAT_PARNUM_MAX_;
|
||||
|
||||
for (tmp = 0; tmp < nParNum; tmp++)
|
||||
{
|
||||
nLenTable[tmp] = hb_parclen(tmp + 2);
|
||||
pszVarTable[tmp] = hb_parc(tmp + 2);
|
||||
}
|
||||
|
||||
nMaskPos = 0;
|
||||
|
||||
nRetValLen = 0;
|
||||
while (nMaskPos < nMaskLen)
|
||||
{
|
||||
if (pszMask[nMaskPos] == '%')
|
||||
{
|
||||
nMaskPos++;
|
||||
|
||||
if (pszMask[nMaskPos] == '\0')
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (pszMask[nMaskPos] == '%')
|
||||
{
|
||||
nRetValLen++;
|
||||
}
|
||||
else if (pszMask[nMaskPos] >= '1' && pszMask[nMaskPos] <= (int)(nParNum + '0'))
|
||||
{
|
||||
nRetValLen += nLenTable[pszMask[nMaskPos] - '1'];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* ; do nothing */
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nRetValLen++;
|
||||
}
|
||||
|
||||
nMaskPos++;
|
||||
}
|
||||
|
||||
nMaskPos = 0;
|
||||
|
||||
pszRetVal = pszRetValSave = hb_xgrab(nRetValLen + 1);
|
||||
while (nMaskPos < nMaskLen)
|
||||
{
|
||||
if (pszMask[nMaskPos] == '%')
|
||||
{
|
||||
nMaskPos++;
|
||||
|
||||
if (pszMask[nMaskPos] == '\0')
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (pszMask[nMaskPos] == '%')
|
||||
{
|
||||
*pszRetVal++ = pszMask[nMaskPos];
|
||||
}
|
||||
else if (pszMask[nMaskPos] >= '1' && pszMask[nMaskPos] <= (int)(nParNum + '0'))
|
||||
{
|
||||
ULONG nPos = pszMask[nMaskPos] - '1';
|
||||
|
||||
memcpy(pszRetVal, pszVarTable[nPos], nLenTable[nPos]);
|
||||
pszRetVal += nLenTable[nPos];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* ; do nothing */
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*pszRetVal++ = pszMask[nMaskPos];
|
||||
}
|
||||
|
||||
nMaskPos++;
|
||||
}
|
||||
|
||||
hb_retclen(pszRetValSave, nRetValLen);
|
||||
|
||||
hb_xfree(pszRetValSave);
|
||||
}
|
||||
Reference in New Issue
Block a user