36 #include "loc/ident.h" 37 #include "loc/kword.h" 40 #include <clib/locale_protos.h> 42 AmigaLanguage::AmigaLanguage() :
45 locale = OpenLocale(
nullptr);
46 helpcatalog = OpenCatalog(locale, CATALOG_HELP, CATALOG_DEF, TAG_DONE);
47 identcatalog = OpenCatalog(locale, CATALOG_IDEN, CATALOG_DEF, TAG_DONE);
48 textcatalog = OpenCatalog(locale, CATALOG_TEXT, CATALOG_DEF, TAG_DONE);
49 keywordcatalog = OpenCatalog(locale, CATALOG_KEYW, CATALOG_DEF, TAG_DONE);
51 if (keywordcatalog !=
nullptr) {
52 keywordsloc =
new keyworddef[keywordcount];
53 for (
unsigned int j = 0; j < keywordcount; j++) {
54 keywordsloc[j].id = j;
55 keywordsloc[j].name = GetCatalogStr(keywordcatalog, j,
nullptr);
56 keywordsloc[j].symbol = keywords[j].symbol;
61 AmigaLanguage::~AmigaLanguage()
63 if (helpcatalog !=
nullptr) {
64 CloseCatalog(helpcatalog);
67 if (identcatalog !=
nullptr) {
68 CloseCatalog(identcatalog);
71 if (textcatalog !=
nullptr) {
72 CloseCatalog(textcatalog);
75 if (keywordcatalog !=
nullptr) {
76 CloseCatalog(keywordcatalog);
79 if (locale !=
nullptr) {
84 char* AmigaLanguage::Translate(textdef *def)
86 return (
char*)GetCatalogStr(textcatalog, def->id, (
char*)def->text);
89 char* AmigaLanguage::Translate(helptextdef *def)
91 return (
char*)GetCatalogStr(helpcatalog, def->id, (
char*)def->text);
94 char* AmigaLanguage::Translate(identhelpdef *def)
96 return (
char*)GetCatalogStr(identcatalog, def->id, (
char*)def->text);
99 char AmigaLanguage::GetFractionPoint()
101 return locale->loc_DecimalPoint[0];
104 bool AmigaLanguage::CharIsAlNum(
long unsigned int character)
106 return IsAlNum(locale, character);
109 bool AmigaLanguage::CharIsAlpha(
long unsigned int character)
111 return IsAlpha(locale, character);
114 bool AmigaLanguage::CharIsDigit(
long unsigned int character)
116 return IsDigit(locale, character);
119 bool AmigaLanguage::CharIsPunct(
long unsigned int character)
121 return IsPunct(locale, character);
124 bool AmigaLanguage::CharIsSpace(
long unsigned int character)
126 return IsSpace(locale, character);
129 bool AmigaLanguage::CharIsCntrl(
long unsigned int character)
131 return IsCntrl(locale, character);
134 bool AmigaLanguage::StrIsEqualLoc(
const char* s1,
const char* s2)
136 return (StrnCmp(locale, (
char*)s1, (
char*)s2, -1, SC_COLLATE1) == 0);
139 bool AmigaLanguage::Validate(
char c)
141 return CharIsAlNum(c) ||