diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 2592c7e14f..f673095ad3 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,7 @@ +19990804-19:07 GMT+1 Victor Szel + + include/langapi.h + Added. (Missed from the previous CVS session, sorry) + 19990804-00:40 EDT Paul Tucker * source/rtl/gtwin.c * reduced the internal buffering to 1 level to improve speed. diff --git a/harbour/include/langapi.h b/harbour/include/langapi.h new file mode 100644 index 0000000000..395c178a85 --- /dev/null +++ b/harbour/include/langapi.h @@ -0,0 +1,81 @@ +/* + * $Id$ + */ + +/* + Harbour Project source code + + Language API Header + + Copyright (C) 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/). +*/ + +#ifndef HB_LANGAPI_H_ +#define HB_LANGAPI_H_ + +#define HB_LANG_TEXT_DATEFMT 0 +#define HB_LANG_TEXT_YESCHAR 1 +#define HB_LANG_TEXT_NOCHAR 2 +#define HB_LANG_TEXT_MAX_ 3 + +#define HB_LANG_ED_MAX_ 50 +#define HB_LANG_EI_MAX_ 6 + +/* ; */ + +typedef struct +{ + BYTE nWeight; + BYTE nFlags; +} HB_LANGCHAR; + +typedef struct +{ + char * szName; + char * szID; + char * szCodepage; + char * szTextList [ HB_LANG_TEXT_MAX_ ]; + char * szMonthNameList [ 12 ]; + char * szDayNameList [ 7 ]; + char * szErrorDescList [ HB_LANG_ED_MAX_ ]; + char * szErrorIntrList [ HB_LANG_EI_MAX_ ]; + HB_LANGCHAR * langcharList [ 256 ]; +} HB_LANG, * PHB_LANG, * HB_LANG_PTR; + +extern PHB_LANG langDef; + +extern void hb_langDSet ( PHB_LANG lang ); +extern PHB_LANG hb_langDGet ( void ); + +extern char * hb_langDGetName ( void ); +extern char * hb_langDGetID ( void ); +extern char * hb_langDGetText ( ULONG ulIndex ); +extern char * hb_langDGetDayName ( ULONG ulIndex ); +extern char * hb_langDGetMonthName ( ULONG ulIndex ); +extern char * hb_langDGetErrorDesc ( ULONG ulIndex ); +extern char * hb_langDGetErrorIntr ( ULONG ulIndex ); + +#endif /* HB_LANGAPI_H_ */ diff --git a/harbour/source/rtl/langapi.c b/harbour/source/rtl/langapi.c new file mode 100644 index 0000000000..5d60a2cf7e --- /dev/null +++ b/harbour/source/rtl/langapi.c @@ -0,0 +1,197 @@ +/* + * $Id$ + */ + +/* + Harbour Project source code + + Language API + + Copyright (C) 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 "hbdefs.h" +#include "hbsetup.h" +#include "langapi.h" + +static HB_LANG langEN = +{ + "English", /* Name */ + "EN", /* RFC ID */ + "437", /* Codepage */ + + /* Texts */ + + { + "YYYY/MM/DD", + "Y", + "N", + }, + + /* Month names */ + + { + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December" + }, + + /* Day names */ + + { + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday" + }, + + /* Error description names */ + + { + "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" + }, + + /* Internal error names */ + + { + "Can't locate starting procedure", + "Can't allocate memory (%s)", + "Can't reallocate memory (%s)", + "Free called with null pointer", /* DEBUG */ + "Not implemented opcode (%s)", + "Not implemented (%s)" + } +}; + +static PHB_LANG langDef = &langEN; + +void hb_langDSet ( PHB_LANG lang ) +{ + if (lang) + langDef = lang; +} + +PHB_LANG hb_langDGet ( void ) +{ + return langDef; +} + +char * hb_langDGetName ( void ) +{ + return langDef->szName; +} + +char * hb_langDGetID ( void ) +{ + return langDef->szID; +} + +char * hb_langDGetText ( ULONG ulIndex ) +{ + return langDef->szTextList[ ( ulIndex < sizeof( langDef->szTextList ) / sizeof( langDef->szTextList[ 0 ] ) ) ? ulIndex : 0 ]; +} + +char * hb_langDGetDayName ( ULONG ulIndex ) +{ + return langDef->szDayNameList[ ( ulIndex < sizeof( langDef->szDayNameList ) / sizeof( langDef->szDayNameList[ 0 ] ) ) ? ulIndex : 0 ]; +} + +char * hb_langDGetMonthName ( ULONG ulIndex ) +{ + return langDef->szMonthNameList[ ( ulIndex < sizeof( langDef->szMonthNameList ) / sizeof( langDef->szMonthNameList[ 0 ] ) ) ? ulIndex : 0 ]; +} + +char * hb_langDGetErrorDesc ( ULONG ulIndex ) +{ + return langDef->szErrorDescList[ ( ulIndex < sizeof( langDef->szErrorDescList ) / sizeof( langDef->szErrorDescList[ 0 ] ) ) ? ulIndex : 0 ]; +} + +char * hb_langDGetErrorIntr ( ULONG ulIndex ) +{ + return langDef->szErrorIntrList[ ( ulIndex < sizeof( langDef->szErrorIntrList ) / sizeof( langDef->szErrorIntrList[ 0 ] ) ) ? ulIndex : 0 ]; +} +