1
0
mirror of https://gitlab.com/rnger/amath synced 2025-10-06 02:49:59 +00:00
Files
amath/doc/man/man3/StandardLanguage.3
2017-01-24 22:03:15 +01:00

519 lines
12 KiB
Groff

.TH "StandardLanguage" 3 "Tue Jan 24 2017" "Version 1.6.2" "amath" \" -*- nroff -*-
.ad l
.nh
.SH NAME
StandardLanguage \-
.SH SYNOPSIS
.br
.PP
.PP
\fC#include <language_stdc\&.h>\fP
.PP
Inherits \fBLanguage\fP\&.
.SS "Public Member Functions"
.in +1c
.ti -1c
.RI "\fBStandardLanguage\fP ()"
.br
.ti -1c
.RI "\fB~StandardLanguage\fP ()"
.br
.ti -1c
.RI "char \fBGetFractionPoint\fP ()"
.br
.ti -1c
.RI "\fBbool\fP \fBCharIsAlNum\fP (unsigned long character)"
.br
.ti -1c
.RI "\fBbool\fP \fBCharIsAlpha\fP (unsigned long character)"
.br
.ti -1c
.RI "\fBbool\fP \fBCharIsDigit\fP (unsigned long character)"
.br
.ti -1c
.RI "\fBbool\fP \fBCharIsPunct\fP (unsigned long character)"
.br
.ti -1c
.RI "\fBbool\fP \fBCharIsSpace\fP (unsigned long character)"
.br
.ti -1c
.RI "\fBbool\fP \fBCharIsCntrl\fP (unsigned long character)"
.br
.ti -1c
.RI "\fBbool\fP \fBStrIsEqualLoc\fP (const char *s1, const char *s2)"
.br
.ti -1c
.RI "\fBbool\fP \fBValidate\fP (char c)"
.br
.in -1c
.SS "Protected Member Functions"
.in +1c
.ti -1c
.RI "char * \fBTranslate\fP (\fBtextdef\fP *def)"
.br
.ti -1c
.RI "char * \fBTranslate\fP (\fBhelptextdef\fP *def)"
.br
.ti -1c
.RI "char * \fBTranslate\fP (\fBidenthelpdef\fP *def)"
.br
.in -1c
.SS "Private Member Functions"
.in +1c
.ti -1c
.RI "void \fBLoadCatalogs\fP ()"
.br
.ti -1c
.RI "void \fBLoadCatalog\fP (char **dest, const char *file)"
.br
.ti -1c
.RI "void \fBGetNextPair\fP (const char **key, const char **value)"
.br
.ti -1c
.RI "void \fBGetNextLine\fP ()"
.br
.ti -1c
.RI "void \fBSkipComments\fP ()"
.br
.in -1c
.SS "Private Attributes"
.in +1c
.ti -1c
.RI "char * \fBtextbase\fP"
.br
.ti -1c
.RI "char * \fBhelpbase\fP"
.br
.ti -1c
.RI "char * \fBidentbase\fP"
.br
.ti -1c
.RI "char * \fBkwordbase\fP"
.br
.ti -1c
.RI "char * \fBptr\fP"
.br
.ti -1c
.RI "\fBtextdef\fP * \fBtextcatalog\fP"
.br
.ti -1c
.RI "\fBhelptextdef\fP * \fBhelpcatalog\fP"
.br
.ti -1c
.RI "\fBidenthelpdef\fP * \fBidentcatalog\fP"
.br
.in -1c
.SS "Additional Inherited Members"
.SH "Detailed Description"
.PP
Definition at line 35 of file language_stdc\&.h\&.
.SH "Constructor & Destructor Documentation"
.PP
.SS "StandardLanguage::StandardLanguage ()"
.PP
Definition at line 38 of file language_stdc\&.cpp\&.
.PP
References Language::Language(), and LoadCatalogs()\&.
.PP
Referenced by CreateLanguage()\&.
.PP
.nf
38 :
39 Language()
40 {
41 LoadCatalogs();
42 }
.fi
.SS "StandardLanguage::~StandardLanguage ()"
.PP
Definition at line 44 of file language_stdc\&.cpp\&.
.PP
References helpbase, identbase, kwordbase, and textbase\&.
.PP
.nf
45 {
46 if (textbase != NOMEM) {
47 delete textbase;
48 }
49
50 if (helpbase != NOMEM) {
51 delete helpbase;
52 }
53
54 if (identbase != NOMEM) {
55 delete identbase;
56 }
57
58 if (kwordbase != NOMEM) {
59 delete kwordbase;
60 }
61 }
.fi
.SH "Member Function Documentation"
.PP
.SS "\fBbool\fP StandardLanguage::CharIsAlNum (unsigned long character)\fC [virtual]\fP"
.PP
Implements \fBLanguage\fP\&.
.PP
Definition at line 89 of file language_stdc\&.cpp\&.
.PP
.nf
90 {
91 return (character >= 'a' && character <= 'z') ||
92 (character >= 'A' && character <= 'Z') ||
93 (character >= '0' && character <= '9');
94 }
.fi
.SS "\fBbool\fP StandardLanguage::CharIsAlpha (unsigned long character)\fC [virtual]\fP"
.PP
Implements \fBLanguage\fP\&.
.PP
Definition at line 96 of file language_stdc\&.cpp\&.
.PP
.nf
97 {
98 return (character >= 'a' && character <= 'z') ||
99 (character >= 'A' && character <= 'Z');
100 }
.fi
.SS "\fBbool\fP StandardLanguage::CharIsCntrl (unsigned long character)\fC [virtual]\fP"
.PP
Implements \fBLanguage\fP\&.
.PP
Definition at line 117 of file language_stdc\&.cpp\&.
.PP
.nf
118 {
119 return (character < 32 || character > 125);
120 }
.fi
.SS "\fBbool\fP StandardLanguage::CharIsDigit (unsigned long character)\fC [virtual]\fP"
.PP
Implements \fBLanguage\fP\&.
.PP
Definition at line 102 of file language_stdc\&.cpp\&.
.PP
.nf
103 {
104 return (character >= '0' && character <= '9');
105 }
.fi
.SS "\fBbool\fP StandardLanguage::CharIsPunct (unsigned long character)\fC [virtual]\fP"
.PP
Implements \fBLanguage\fP\&.
.PP
Definition at line 107 of file language_stdc\&.cpp\&.
.PP
.nf
108 {
109 return (character == '\&.');
110 }
.fi
.SS "\fBbool\fP StandardLanguage::CharIsSpace (unsigned long character)\fC [virtual]\fP"
.PP
Implements \fBLanguage\fP\&.
.PP
Definition at line 112 of file language_stdc\&.cpp\&.
.PP
.nf
113 {
114 return (character == 32);
115 }
.fi
.SS "char StandardLanguage::GetFractionPoint ()\fC [virtual]\fP"
.PP
Implements \fBLanguage\fP\&.
.PP
Definition at line 84 of file language_stdc\&.cpp\&.
.PP
.nf
85 {
86 return '\&.';
87 }
.fi
.SS "void StandardLanguage::GetNextLine ()\fC [private]\fP"
.PP
Definition at line 210 of file language_stdc\&.cpp\&.
.PP
References ptr\&.
.PP
Referenced by GetNextPair(), and SkipComments()\&.
.PP
.nf
211 {
212 while ((*ptr) != '\0' && (*ptr) != '\n') {
213 ptr++;
214 }
215
216 if ((*ptr) == '\n') {
217 *ptr++ = '\0';
218 }
219 }
.fi
.SS "void StandardLanguage::GetNextPair (const char ** key, const char ** value)\fC [private]\fP"
.PP
Definition at line 200 of file language_stdc\&.cpp\&.
.PP
References GetNextLine(), ptr, and SkipComments()\&.
.PP
.nf
201 {
202 SkipComments();
203 *key = ptr;
204 GetNextLine();
205 SkipComments();
206 *value = ptr;
207 GetNextLine();
208 }
.fi
.SS "void StandardLanguage::LoadCatalog (char ** dest, const char * file)\fC [private]\fP"
.PP
Definition at line 184 of file language_stdc\&.cpp\&.
.PP
References AllocAndCopy(), CreateFilesystem(), CharBuffer::GetString(), FilesystemBase::LoadTextFile(), and ptr\&.
.PP
.nf
185 {
186 FilesystemBase *filesystem = CreateFilesystem();
187 CharBuffer *cbuf = filesystem->LoadTextFile(file);
188
189 if (cbuf != NOMEM) {
190 AllocAndCopy(dest, cbuf->GetString());
191 ptr = *dest;
192 delete cbuf;
193 } else {
194 *dest = NOMEM;
195 }
196
197 delete filesystem;
198 }
.fi
.SS "void StandardLanguage::LoadCatalogs ()\fC [private]\fP"
.PP
Definition at line 132 of file language_stdc\&.cpp\&.
.PP
Referenced by StandardLanguage()\&.
.PP
.nf
133 {
134 /* Just use english for now
135
136 const char* key;
137 const char* value;
138
139 LoadCatalog(&textbase, "utext/dk-text\&.dict");
140 if (textbase != NOMEM) {
141 textcatalog = new textdef[textcount];
142 for (unsigned int j = 0; j < textcount; j++) {
143 GetNextPair(&key, &value);
144 textcatalog[j]\&.id = j;
145 textcatalog[j]\&.text = value;
146 }
147 }
148
149 LoadCatalog(&helpbase, "utext/dk-help\&.dict");
150 if (helpbase != NOMEM) {
151 helpcatalog = new helptextdef[helpcount];
152 for (unsigned int j = 0; j < helpcount; j++) {
153 GetNextPair(&key, &value);
154 helpcatalog[j]\&.id = j;
155 helpcatalog[j]\&.symbol = helptexts[j]\&.symbol;
156 helpcatalog[j]\&.text = value;
157 }
158 }
159
160 LoadCatalog(&identbase, "utext/dk-ident\&.dict");
161 if (identbase != NOMEM) {
162 identcatalog = new identhelpdef[identcount];
163 for (unsigned int j = 0; j < identcount; j++) {
164 GetNextPair(&key, &value);
165 identcatalog[j]\&.id = j;
166 identcatalog[j]\&.ident = key;
167 identcatalog[j]\&.text = value;
168 }
169 }
170
171 LoadCatalog(&kwordbase, "utext/dk-keyword\&.dict");
172 if (kwordbase != NOMEM) {
173 keywordsloc = new keyworddef[keywordcount];
174 for (unsigned int j = 0; j < keywordcount; j++) {
175 GetNextPair(&key, &value);
176 keywordsloc[j]\&.id = j;
177 keywordsloc[j]\&.name = value;
178 keywordsloc[j]\&.symbol = keywords[j]\&.symbol;
179 }
180 }
181 */
182 }
.fi
.SS "void StandardLanguage::SkipComments ()\fC [private]\fP"
.PP
Definition at line 221 of file language_stdc\&.cpp\&.
.PP
References GetNextLine(), and ptr\&.
.PP
Referenced by GetNextPair()\&.
.PP
.nf
222 {
223 bool skipping;
224 do {
225 if ((*ptr) == ';') {
226 GetNextLine();
227 skipping = true;
228 } else if ((*ptr) == '#' && *(ptr + sizeof(char)) == '#') {
229 GetNextLine();
230 skipping = true;
231 } else {
232 skipping = false;
233 }
234 } while (skipping);
235 }
.fi
.SS "\fBbool\fP StandardLanguage::StrIsEqualLoc (const char * s1, const char * s2)\fC [virtual]\fP"
.PP
Implements \fBLanguage\fP\&.
.PP
Definition at line 122 of file language_stdc\&.cpp\&.
.PP
References StrIsEqual()\&.
.PP
.nf
123 {
124 return StrIsEqual(s1, s2);
125 }
.fi
.SS "char * StandardLanguage::Translate (\fBtextdef\fP * def)\fC [protected]\fP, \fC [virtual]\fP"
.PP
Implements \fBLanguage\fP\&.
.PP
Definition at line 63 of file language_stdc\&.cpp\&.
.PP
References textdef::id, textdef::text, and textcatalog\&.
.PP
.nf
64 {
65 return textcatalog == NOMEM ?
66 (char*)def->text :
67 (char*)textcatalog[def->id]\&.text;
68 }
.fi
.SS "char * StandardLanguage::Translate (\fBhelptextdef\fP * def)\fC [protected]\fP, \fC [virtual]\fP"
.PP
Implements \fBLanguage\fP\&.
.PP
Definition at line 70 of file language_stdc\&.cpp\&.
.PP
References helpcatalog, helptextdef::id, and helptextdef::text\&.
.PP
.nf
71 {
72 return helpcatalog == NOMEM ?
73 (char*)def->text :
74 (char*)helpcatalog[def->id]\&.text;
75 }
.fi
.SS "char * StandardLanguage::Translate (\fBidenthelpdef\fP * def)\fC [protected]\fP, \fC [virtual]\fP"
.PP
Implements \fBLanguage\fP\&.
.PP
Definition at line 77 of file language_stdc\&.cpp\&.
.PP
References identhelpdef::id, identcatalog, and identhelpdef::text\&.
.PP
.nf
78 {
79 return identcatalog == NOMEM ?
80 (char*)def->text :
81 (char*)identcatalog[def->id]\&.text;
82 }
.fi
.SS "\fBbool\fP StandardLanguage::Validate (char c)\fC [virtual]\fP"
.PP
Implements \fBLanguage\fP\&.
.PP
Definition at line 127 of file language_stdc\&.cpp\&.
.PP
.nf
128 {
129 return (c >= 32 && c <= 126);
130 }
.fi
.SH "Member Data Documentation"
.PP
.SS "char* StandardLanguage::helpbase\fC [private]\fP"
.PP
Definition at line 62 of file language_stdc\&.h\&.
.PP
Referenced by ~StandardLanguage()\&.
.SS "\fBhelptextdef\fP* StandardLanguage::helpcatalog\fC [private]\fP"
.PP
Definition at line 68 of file language_stdc\&.h\&.
.PP
Referenced by Translate()\&.
.SS "char* StandardLanguage::identbase\fC [private]\fP"
.PP
Definition at line 63 of file language_stdc\&.h\&.
.PP
Referenced by ~StandardLanguage()\&.
.SS "\fBidenthelpdef\fP* StandardLanguage::identcatalog\fC [private]\fP"
.PP
Definition at line 69 of file language_stdc\&.h\&.
.PP
Referenced by Translate()\&.
.SS "char* StandardLanguage::kwordbase\fC [private]\fP"
.PP
Definition at line 64 of file language_stdc\&.h\&.
.PP
Referenced by ~StandardLanguage()\&.
.SS "char* StandardLanguage::ptr\fC [private]\fP"
.PP
Definition at line 66 of file language_stdc\&.h\&.
.PP
Referenced by GetNextLine(), GetNextPair(), LoadCatalog(), and SkipComments()\&.
.SS "char* StandardLanguage::textbase\fC [private]\fP"
.PP
Definition at line 61 of file language_stdc\&.h\&.
.PP
Referenced by ~StandardLanguage()\&.
.SS "\fBtextdef\fP* StandardLanguage::textcatalog\fC [private]\fP"
.PP
Definition at line 67 of file language_stdc\&.h\&.
.PP
Referenced by Translate()\&.
.SH "Author"
.PP
Generated automatically by Doxygen for amath from the source code\&.