From 6ccb0fdfa47547d7a4ca1da8839aed38ae7786cc Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sat, 31 Jul 1999 07:22:03 +0000 Subject: [PATCH] *** empty log message *** --- harbour/ChangeLog | 25 +++ harbour/include/error.ch | 86 ++++---- harbour/source/rtl/msgxxx.c | 68 +++---- harbour/source/rtl/natmsg/msg_tpl.c | 92 +++++++++ .../source/rtl/natmsg/{msgcat.c => msgca.c} | 2 +- .../rtl/natmsg/{msgcz852.c => msgcs852.c} | 2 +- .../rtl/natmsg/{msgczkam.c => msgcskam.c} | 2 +- .../source/rtl/natmsg/{msgger.c => msgde.c} | 2 +- .../source/rtl/natmsg/{msguk.c => msgen.c} | 2 +- harbour/source/rtl/natmsg/msgeo.c | 2 +- .../source/rtl/natmsg/{msgspa.c => msges.c} | 2 +- .../source/rtl/natmsg/{msgbas.c => msgeu.c} | 4 +- .../source/rtl/natmsg/{msgfre.c => msgfr.c} | 2 +- .../source/rtl/natmsg/{msggal.c => msggl.c} | 2 +- harbour/source/rtl/natmsg/msghu852.c | 4 +- harbour/source/rtl/natmsg/msghucwi.c | 4 +- harbour/source/rtl/natmsg/msghuwin.c | 4 +- .../source/rtl/natmsg/{msgia.c => msgid.c} | 2 +- .../source/rtl/natmsg/{msgita.c => msgit.c} | 2 +- .../source/rtl/natmsg/{msgkor.c => msgko.c} | 2 +- .../source/rtl/natmsg/{msgdut.c => msgnl.c} | 2 +- harbour/source/rtl/natmsg/msgpl852.c | 2 +- harbour/source/rtl/natmsg/msgpliso.c | 2 +- harbour/source/rtl/natmsg/msgplmaz.c | 2 +- .../source/rtl/natmsg/{msgpor.c => msgpt.c} | 2 +- harbour/source/rtl/natmsg/msgru866.c | 2 +- .../rtl/natmsg/{msgr1251.c => msgruwin.c} | 4 +- .../rtl/natmsg/{msgyu852.c => msgsr852.c} | 2 +- harbour/source/tools/Makefile | 2 + harbour/source/tools/numtxthu.prg | 98 +++++++++ harbour/source/tools/strfmt.c | 191 ++++++++++++++++++ 31 files changed, 514 insertions(+), 106 deletions(-) create mode 100644 harbour/source/rtl/natmsg/msg_tpl.c rename harbour/source/rtl/natmsg/{msgcat.c => msgca.c} (97%) rename harbour/source/rtl/natmsg/{msgcz852.c => msgcs852.c} (97%) rename harbour/source/rtl/natmsg/{msgczkam.c => msgcskam.c} (97%) rename harbour/source/rtl/natmsg/{msgger.c => msgde.c} (97%) rename harbour/source/rtl/natmsg/{msguk.c => msgen.c} (97%) rename harbour/source/rtl/natmsg/{msgspa.c => msges.c} (98%) rename harbour/source/rtl/natmsg/{msgbas.c => msgeu.c} (96%) rename harbour/source/rtl/natmsg/{msgfre.c => msgfr.c} (97%) rename harbour/source/rtl/natmsg/{msggal.c => msggl.c} (97%) rename harbour/source/rtl/natmsg/{msgia.c => msgid.c} (97%) rename harbour/source/rtl/natmsg/{msgita.c => msgit.c} (98%) rename harbour/source/rtl/natmsg/{msgkor.c => msgko.c} (97%) rename harbour/source/rtl/natmsg/{msgdut.c => msgnl.c} (97%) rename harbour/source/rtl/natmsg/{msgpor.c => msgpt.c} (98%) rename harbour/source/rtl/natmsg/{msgr1251.c => msgruwin.c} (96%) rename harbour/source/rtl/natmsg/{msgyu852.c => msgsr852.c} (97%) create mode 100644 harbour/source/tools/numtxthu.prg create mode 100644 harbour/source/tools/strfmt.c diff --git a/harbour/ChangeLog b/harbour/ChangeLog index b6f42505c7..eeb3b886eb 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,28 @@ +19990731-08:22 CET Victor Szel + * 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 * source/hbpp/hbpplib.c ! ParseExpression() expects a null-terminated string. diff --git a/harbour/include/error.ch b/harbour/include/error.ch index 717c15124a..7e15406953 100644 --- a/harbour/include/error.ch +++ b/harbour/include/error.ch @@ -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 */ diff --git a/harbour/source/rtl/msgxxx.c b/harbour/source/rtl/msgxxx.c index 351f1083ec..bd7c239bd9 100644 --- a/harbour/source/rtl/msgxxx.c +++ b/harbour/source/rtl/msgxxx.c @@ -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 ]; } diff --git a/harbour/source/rtl/natmsg/msg_tpl.c b/harbour/source/rtl/natmsg/msg_tpl.c new file mode 100644 index 0000000000..fc60e2663a --- /dev/null +++ b/harbour/source/rtl/natmsg/msg_tpl.c @@ -0,0 +1,92 @@ +/* + * $Id$ + */ + +/* Language Support Module */ + +/* Language name: */ +/* ISO language code (2 chars): (please look it up in /doc/lang_id.txt) */ +/* 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" +}; diff --git a/harbour/source/rtl/natmsg/msgcat.c b/harbour/source/rtl/natmsg/msgca.c similarity index 97% rename from harbour/source/rtl/natmsg/msgcat.c rename to harbour/source/rtl/natmsg/msgca.c index 2aff74ade2..d2273a0508 100644 --- a/harbour/source/rtl/natmsg/msgcat.c +++ b/harbour/source/rtl/natmsg/msgca.c @@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] = "Disabte" }; -static char *genericErrors[] = +char *hb_errorsGeneric[] = { "Unknown error", "Argument error", diff --git a/harbour/source/rtl/natmsg/msgcz852.c b/harbour/source/rtl/natmsg/msgcs852.c similarity index 97% rename from harbour/source/rtl/natmsg/msgcz852.c rename to harbour/source/rtl/natmsg/msgcs852.c index 454d78cb7f..3c724faf77 100644 --- a/harbour/source/rtl/natmsg/msgcz852.c +++ b/harbour/source/rtl/natmsg/msgcs852.c @@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] = "sobota" }; -static char *genericErrors[] = +char *hb_errorsGeneric[] = { "Unknown error", "Argument error", diff --git a/harbour/source/rtl/natmsg/msgczkam.c b/harbour/source/rtl/natmsg/msgcskam.c similarity index 97% rename from harbour/source/rtl/natmsg/msgczkam.c rename to harbour/source/rtl/natmsg/msgcskam.c index b54783b038..b2a71353a2 100644 --- a/harbour/source/rtl/natmsg/msgczkam.c +++ b/harbour/source/rtl/natmsg/msgcskam.c @@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] = "sobota" }; -static char *genericErrors[] = +char *hb_errorsGeneric[] = { "Unknown error", "Argument error", diff --git a/harbour/source/rtl/natmsg/msgger.c b/harbour/source/rtl/natmsg/msgde.c similarity index 97% rename from harbour/source/rtl/natmsg/msgger.c rename to harbour/source/rtl/natmsg/msgde.c index 03aad4dc48..6a99a92f48 100644 --- a/harbour/source/rtl/natmsg/msgger.c +++ b/harbour/source/rtl/natmsg/msgde.c @@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] = "Samstag" }; -static char *genericErrors[] = +char *hb_errorsGeneric[] = { "Unknown error", "Argument error", diff --git a/harbour/source/rtl/natmsg/msguk.c b/harbour/source/rtl/natmsg/msgen.c similarity index 97% rename from harbour/source/rtl/natmsg/msguk.c rename to harbour/source/rtl/natmsg/msgen.c index 3679124195..7de3268ebf 100644 --- a/harbour/source/rtl/natmsg/msguk.c +++ b/harbour/source/rtl/natmsg/msgen.c @@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] = "Saturday" }; -static char *genericErrors[] = +char *hb_errorsGeneric[] = { "Unknown error", "Argument error", diff --git a/harbour/source/rtl/natmsg/msgeo.c b/harbour/source/rtl/natmsg/msgeo.c index 660035ecaa..af761fba9b 100644 --- a/harbour/source/rtl/natmsg/msgeo.c +++ b/harbour/source/rtl/natmsg/msgeo.c @@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] = "sabato" }; -static char *genericErrors[] = +char *hb_errorsGeneric[] = { "Unknown error", "Argument error", diff --git a/harbour/source/rtl/natmsg/msgspa.c b/harbour/source/rtl/natmsg/msges.c similarity index 98% rename from harbour/source/rtl/natmsg/msgspa.c rename to harbour/source/rtl/natmsg/msges.c index 5b4df1147d..fe4c3bbeca 100644 --- a/harbour/source/rtl/natmsg/msgspa.c +++ b/harbour/source/rtl/natmsg/msges.c @@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] = "S bado" }; -static char *genericErrors[] = +char *hb_errorsGeneric[] = { "Error desconocido", "Error de argumento", diff --git a/harbour/source/rtl/natmsg/msgbas.c b/harbour/source/rtl/natmsg/msgeu.c similarity index 96% rename from harbour/source/rtl/natmsg/msgbas.c rename to harbour/source/rtl/natmsg/msgeu.c index 6ec8298d3e..b5c94227e7 100644 --- a/harbour/source/rtl/natmsg/msgbas.c +++ b/harbour/source/rtl/natmsg/msgeu.c @@ -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", diff --git a/harbour/source/rtl/natmsg/msgfre.c b/harbour/source/rtl/natmsg/msgfr.c similarity index 97% rename from harbour/source/rtl/natmsg/msgfre.c rename to harbour/source/rtl/natmsg/msgfr.c index 41d1b893e8..20cccc436e 100644 --- a/harbour/source/rtl/natmsg/msgfre.c +++ b/harbour/source/rtl/natmsg/msgfr.c @@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] = "Samedi" }; -static char *genericErrors[] = +char *hb_errorsGeneric[] = { "Unknown error", "Argument error", diff --git a/harbour/source/rtl/natmsg/msggal.c b/harbour/source/rtl/natmsg/msggl.c similarity index 97% rename from harbour/source/rtl/natmsg/msggal.c rename to harbour/source/rtl/natmsg/msggl.c index 272db5c629..fc6be92ef0 100644 --- a/harbour/source/rtl/natmsg/msggal.c +++ b/harbour/source/rtl/natmsg/msggl.c @@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] = "S bado" }; -static char *genericErrors[] = +char *hb_errorsGeneric[] = { "Unknown error", "Argument error", diff --git a/harbour/source/rtl/natmsg/msghu852.c b/harbour/source/rtl/natmsg/msghu852.c index 1ec0fafb88..f96e2958b1 100644 --- a/harbour/source/rtl/natmsg/msghu852.c +++ b/harbour/source/rtl/natmsg/msghu852.c @@ -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", diff --git a/harbour/source/rtl/natmsg/msghucwi.c b/harbour/source/rtl/natmsg/msghucwi.c index 77603e6ba0..4a5cc3aed5 100644 --- a/harbour/source/rtl/natmsg/msghucwi.c +++ b/harbour/source/rtl/natmsg/msghucwi.c @@ -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", diff --git a/harbour/source/rtl/natmsg/msghuwin.c b/harbour/source/rtl/natmsg/msghuwin.c index 897f920308..524cc45807 100644 --- a/harbour/source/rtl/natmsg/msghuwin.c +++ b/harbour/source/rtl/natmsg/msghuwin.c @@ -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", diff --git a/harbour/source/rtl/natmsg/msgia.c b/harbour/source/rtl/natmsg/msgid.c similarity index 97% rename from harbour/source/rtl/natmsg/msgia.c rename to harbour/source/rtl/natmsg/msgid.c index b05c014408..db326d7f20 100644 --- a/harbour/source/rtl/natmsg/msgia.c +++ b/harbour/source/rtl/natmsg/msgid.c @@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] = "Sabtu" }; -static char *genericErrors[] = +char *hb_errorsGeneric[] = { "Unknown error", "Argument error", diff --git a/harbour/source/rtl/natmsg/msgita.c b/harbour/source/rtl/natmsg/msgit.c similarity index 98% rename from harbour/source/rtl/natmsg/msgita.c rename to harbour/source/rtl/natmsg/msgit.c index 9c3a0eee84..0151c07dca 100644 --- a/harbour/source/rtl/natmsg/msgita.c +++ b/harbour/source/rtl/natmsg/msgit.c @@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] = "Sabato" }; -static char *genericErrors[] = +char *hb_errorsGeneric[] = { "Errore sconosciuto", "Errore di parametri", diff --git a/harbour/source/rtl/natmsg/msgkor.c b/harbour/source/rtl/natmsg/msgko.c similarity index 97% rename from harbour/source/rtl/natmsg/msgkor.c rename to harbour/source/rtl/natmsg/msgko.c index 50033d8a44..b3fe18fddd 100644 --- a/harbour/source/rtl/natmsg/msgkor.c +++ b/harbour/source/rtl/natmsg/msgko.c @@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] = "Åä¿äÀÏ" }; -static char *genericErrors[] = +char *hb_errorsGeneric[] = { "Unknown error", "Argument error", diff --git a/harbour/source/rtl/natmsg/msgdut.c b/harbour/source/rtl/natmsg/msgnl.c similarity index 97% rename from harbour/source/rtl/natmsg/msgdut.c rename to harbour/source/rtl/natmsg/msgnl.c index 9131bcfbb9..45f70ac4c6 100644 --- a/harbour/source/rtl/natmsg/msgdut.c +++ b/harbour/source/rtl/natmsg/msgnl.c @@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] = "zaterdag" }; -static char *genericErrors[] = +char *hb_errorsGeneric[] = { "Unknown error", "Argument error", diff --git a/harbour/source/rtl/natmsg/msgpl852.c b/harbour/source/rtl/natmsg/msgpl852.c index fdf2e94676..b164aa4d47 100644 --- a/harbour/source/rtl/natmsg/msgpl852.c +++ b/harbour/source/rtl/natmsg/msgpl852.c @@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] = "Sobota" }; -static char *genericErrors[] = +char *hb_errorsGeneric[] = { "Bˆ¥d bez opisu", "Nieprawidˆowy argument", diff --git a/harbour/source/rtl/natmsg/msgpliso.c b/harbour/source/rtl/natmsg/msgpliso.c index a66054d261..4338c242c8 100644 --- a/harbour/source/rtl/natmsg/msgpliso.c +++ b/harbour/source/rtl/natmsg/msgpliso.c @@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] = "Sobota" }; -static char *genericErrors[] = +char *hb_errorsGeneric[] = { "B³±d bez opisu", "Nieprawid³owy argument", diff --git a/harbour/source/rtl/natmsg/msgplmaz.c b/harbour/source/rtl/natmsg/msgplmaz.c index e0c66ce5f8..e068eda96f 100644 --- a/harbour/source/rtl/natmsg/msgplmaz.c +++ b/harbour/source/rtl/natmsg/msgplmaz.c @@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] = "Sobota" }; -static char *genericErrors[] = +char *hb_errorsGeneric[] = { "B’†d bez opisu", "Nieprawid’owy argument", diff --git a/harbour/source/rtl/natmsg/msgpor.c b/harbour/source/rtl/natmsg/msgpt.c similarity index 98% rename from harbour/source/rtl/natmsg/msgpor.c rename to harbour/source/rtl/natmsg/msgpt.c index c9024a2414..517d0039b2 100644 --- a/harbour/source/rtl/natmsg/msgpor.c +++ b/harbour/source/rtl/natmsg/msgpt.c @@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] = "Sábado" }; -static char *genericErrors[] = +char *hb_errorsGeneric[] = { "Erro desconhecido", "Erro nos parâmetros", diff --git a/harbour/source/rtl/natmsg/msgru866.c b/harbour/source/rtl/natmsg/msgru866.c index bffe07f76f..a7e7bc620b 100644 --- a/harbour/source/rtl/natmsg/msgru866.c +++ b/harbour/source/rtl/natmsg/msgru866.c @@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] = "‘ã¡¡®â " }; -static char *genericErrors[] = +char *hb_errorsGeneric[] = { "Unknown error", "Argument error", diff --git a/harbour/source/rtl/natmsg/msgr1251.c b/harbour/source/rtl/natmsg/msgruwin.c similarity index 96% rename from harbour/source/rtl/natmsg/msgr1251.c rename to harbour/source/rtl/natmsg/msgruwin.c index 94414b9471..cacc3edec6 100644 --- a/harbour/source/rtl/natmsg/msgr1251.c +++ b/harbour/source/rtl/natmsg/msgruwin.c @@ -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", diff --git a/harbour/source/rtl/natmsg/msgyu852.c b/harbour/source/rtl/natmsg/msgsr852.c similarity index 97% rename from harbour/source/rtl/natmsg/msgyu852.c rename to harbour/source/rtl/natmsg/msgsr852.c index 211bd43108..cfe0d8fa2b 100644 --- a/harbour/source/rtl/natmsg/msgyu852.c +++ b/harbour/source/rtl/natmsg/msgsr852.c @@ -37,7 +37,7 @@ char *hb_daysname[ 7 ] = "subota" }; -static char *genericErrors[] = +char *hb_errorsGeneric[] = { "Unknown error", "Argument error", diff --git a/harbour/source/tools/Makefile b/harbour/source/tools/Makefile index 7af7943bb6..e41a7224e6 100644 --- a/harbour/source/tools/Makefile +++ b/harbour/source/tools/Makefile @@ -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 diff --git a/harbour/source/tools/numtxthu.prg b/harbour/source/tools/numtxthu.prg new file mode 100644 index 0000000000..a05f115b99 --- /dev/null +++ b/harbour/source/tools/numtxthu.prg @@ -0,0 +1,98 @@ +/* + * $Id$ + */ + +/* + Harbour Project source code + + Function to convert a number to text. + + Copyright 1992-1999 Victor Szel + 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 + diff --git a/harbour/source/tools/strfmt.c b/harbour/source/tools/strfmt.c new file mode 100644 index 0000000000..65ab75c1f9 --- /dev/null +++ b/harbour/source/tools/strfmt.c @@ -0,0 +1,191 @@ +/* + * $Id$ + */ + +/* + Harbour Project source code + + Simple string formatter. + + Copyright 1997-1999 Victor Szel + 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([, [, [, ...]]) + * $ARGUMENTS$ + * Holds the mask for the resulting string + * 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); +}