The SWORD Project  1.9.0.svnversion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HebrewMCIM Class Reference

#include <hebrewmcim.h>

+ Inheritance diagram for HebrewMCIM:
+ Collaboration diagram for HebrewMCIM:

Public Member Functions

virtual void clearState ()
 
virtual int getState ()
 
 HebrewMCIM ()
 
int * translate (char in)
 

Protected Member Functions

virtual void setState (int state)
 

Private Member Functions

void init ()
 

Private Attributes

map< int, int * > multiChars
 
int subst [255]
 
map< int, int > subst2 [12]
 

Detailed Description

Title: Keyboard mapping for Michigan-Claremont Hebrew input Description: Copyright: Copyright (c) 2001 CrossWire Bible Society under the terms of the GNU GPL Company:

Author
Troy A. Griffitts
Version
1.0

Definition at line 42 of file hebrewmcim.h.

Constructor & Destructor Documentation

HebrewMCIM::HebrewMCIM ( )

Definition at line 26 of file hebrewmcim.cpp.

27  :SWInputMethod() {
28 
29  init();
30 }
void init()
Definition: hebrewmcim.cpp:83

Member Function Documentation

void SWInputMethod::clearState ( )
virtualinherited

Definition at line 37 of file swinputmeth.cpp.

37  {
38  state = 0;
39 }
int SWInputMethod::getState ( )
virtualinherited

Definition at line 33 of file swinputmeth.cpp.

33  {
34  return state;
35 }
void HebrewMCIM::init ( )
private

Definition at line 83 of file hebrewmcim.cpp.

83  {
84  memset(subst, 0, 255);
85 
86  subst[')'] = 1488;
87  subst['B'] = 1489;
88  subst['G'] = 1490;
89  subst['D'] = 1491;
90  subst['H'] = 1492;
91  subst['W'] = 1493;
92  subst['Z'] = 1494;
93  subst['X'] = 1495;
94  subst['+'] = 1496;
95  subst['Y'] = 1497;
96 
97  subst['k'] = 1498; // finals
98  subst['m'] = 1501;
99  subst['n'] = 1503;
100  subst['c'] = 1509;
101 
102  subst['P'] = 1508;
103  subst['K'] = 1499;
104  subst['L'] = 1500;
105  subst['M'] = 1502;
106  subst['N'] = 1504;
107  subst['S'] = 1505;
108  subst['('] = 1506;
109  subst['p'] = 1507;
110  subst['C'] = 1510;
111  subst['Q'] = 1511;
112  subst['R'] = 1512;
113  subst['#'] = 1513;
114 
115  // special multiChars
116  subst['&'] = 50;
117  subst['$'] = 50;
118 
119  static int x[] = {1513, 1474};
120  multiChars['&'] = x;
121  static int y[] = {1513, 1473};
122  multiChars['$'] = y;
123 
124  subst['T'] = 1514;
125 
126  // VOWELS
127  subst['A'] = 1463;
128  subst['F'] = 1464;
129  subst['E'] = 1462;
130  subst['"'] = 1461;
131  subst['I'] = 1460;
132  subst['O'] = 1465;
133  subst['U'] = 1467;
134 
135 
136 
137  // OTHER DIACRITICS
138  subst['.'] = 1468;
139  subst['-'] = 1470;
140  subst[','] = 1471;
141 
142  // Compound input
143 
144  // CANTILLATION
145 
146  subst[':'] = 2;
147  subst2[2]['A'] = 1458;
148  subst2[2]['E'] = 1457;
149  subst2[2]['F'] = 1459;
150 
151 
152  /* Telisha qetana is postpositive as in '04' above. However, Michigan
153 # code '24' is for a medial telisha. Graphically, there is no
154 # difference.
155  */
156  subst['2'] = 5;
157  subst2[5]['4'] = 1449;
158 
159 
160  /* Note Michigan encoding distinguishes between medial metheg '35' (occuring
161 # on the left of the vowel), and the ordinary meteg '95' (occuring on the
162 # right of the vowel). It is also used for silluq.
163  */
164  subst['3'] = 6;
165  subst2[6]['3'] = 1433;
166  subst2[6]['5'] = 1469;
167 
168 
169  /* The Michigan code of telisha gedola in medial position. Graphically,
170 # there is no difference.
171  */
172  subst['4'] = 7;
173  subst2[7]['4'] = 1440;
174 
175  subst['6'] = 8;
176  subst2[8]['0'] = 1451;
177  subst2[8]['1'] = 1436;
178 
179  subst['1'] = 4;
180  subst2[4]['0'] = 1434;
181 
182  /* In the poetic books, prepositive dehi occurs; it's unclear whether
183 # tipeha also occurs in the poetic books. Otherwise, we could simply
184 # check for what book in the Tanach we are in. Michigan uses the same
185 # code for each.
186  */
187 
188  subst2[4]['3'] = 1430;
189 
190  /* This is the poetic accent mugrash, which also includes rebia, but is
191 # encoded separately as '81' in the Michigan text.
192  */
193  subst2[4]['1'] = 1437;
194  subst2[4]['4'] = 1440;
195 
196 
197  subst['0'] = 3;
198  subst2[3]['0'] = 1475;
199  subst2[3]['1'] = 1426;
200 
201  /* According to BHS, zarqa and sinnor are both postpositive. However,
202 # the Michigan encoding uses one code for both. The Unicode zarqa
203 # (0x0598) is definitely NOT postpositive. And further, the shape of
204 # the symbol is different in BHS and Uniocde. This needs further
205 # research to determine what's going on here. For now, we follow BHS
206 # and use the postpositive Unicode zinor or both accents.
207  */
208 
209  subst2[3]['2'] = 1454;
210 
211  /* Pashta is postpositive, and the Unicode equivalent reflects
212 # this. However, there is a poetic equivalent -- azla legarmeh --
213 # which is not postpositive, but no equivalent code point exists in
214 # Unicode. The Michigan encoding does not distinguish between the two,
215 # although it could be algorithmically determined.
216  */
217 
218  subst2[3]['3'] = 1433;
219  subst2[3]['4'] = 1449;
220  subst2[3]['5'] = 1472;
221 
222 
223  /* This is the Unicode Hebrew *accent*; there is also another Hebrew
224 # *punctuation* called GERSHAYIM 0x05F4. I'm using the more
225 # traditional rounded marks, rather than the alternate straight
226 # marks.
227  */
228 
229  subst2[8]['2'] = 1438;
230 
231  // Also known as azla
232  subst2[8]['3'] = 1448;
233  subst2[8]['4'] = 1452;
234  subst2[8]['5'] = 1427;
235 
236 
237  subst['8'] = 9;
238  subst2[9]['0'] = 1428;
239  subst2[9]['1'] = 1431;
240 
241  /* Note, this accent is actually sinnorit, but it does not exist as a
242 # separate glyph in the Unicode standard. The 'ZINOR' Unicode accent
243 # is postpositive, while sinnorit is not. ZARQA is as close as I can
244 # get to this.
245  */
246  subst2[9]['2'] = 1432;
247 
248  /* The Unicode form does not match the form used by BHS, but the names
249 # are the same.
250  */
251  subst2[9]['3'] = 1441;
252  subst2[9]['4'] = 1439;
253  subst2[9]['5'] = 1429;
254 
255  subst['7'] = 10;
256  subst2[10]['0'] = 1444;
257  subst2[10]['1'] = 1445;
258  subst2[10]['2'] = 1446;
259  subst2[10]['3'] = 1430; // also '13', '73' also is used for majela
260  subst2[10]['4'] = 1443;
261  subst2[10]['5'] = 1469; // this is silluq; should appear to the left of the vowel
262 
263  subst['9'] = 11;
264  subst2[11]['1'] = 1435;
265  subst2[11]['2'] = 1425;
266  subst2[11]['3'] = 1450;
267  subst2[11]['4'] = 1447;
268  subst2[11]['5'] = 1469; // should appear to the right of the vowel
269 
270 }
map< int, int > subst2[12]
Definition: hebrewmcim.h:47
map< int, int * > multiChars
Definition: hebrewmcim.h:48
int subst[255]
Definition: hebrewmcim.h:46
void SWInputMethod::setState ( int  state)
protectedvirtualinherited

Definition at line 29 of file swinputmeth.cpp.

29  {
30  this->state = state;
31 }
int * HebrewMCIM::translate ( char  in)
virtual

Implements SWInputMethod.

Definition at line 33 of file hebrewmcim.cpp.

33  {
34  int retVal = 0;
35  static int retString[5];
36  int retStringIndex = 0;
37 
38  memset(retString, 0, 5);
39 
40  if (getState() > 1) {
41  if (getState() >= 12) { // serious issue with internal structure
42  setState(0);
43  retString[retStringIndex++] = in;
44  return retString;
45  }
46  map<int, int>::iterator find = subst2[getState()].find(in);
47  if (find != subst2[getState()].end())
48  retVal = find->second;
49  else retVal = in;
50 
51  setState(0);
52  retString[retStringIndex++] = retVal;
53  return retString;
54  }
55  else {
56  retVal = subst[in];
57 
58  if (retVal == 0) {
59  setState(0);
60  retString[retStringIndex++] = in;
61  return retString;
62  }
63  if (retVal > 100) {
64  setState(1);
65  retString[retStringIndex++] = retVal;
66  return retString;
67  }
68  if (retVal == 50) { // multiChar
69  setState(1);
70  int *chars = multiChars[in];
71  if (chars != 0) {
72  retString[retStringIndex++] = chars[0];
73  retString[retStringIndex++] = chars[1];
74  return retString;
75  }
76  }
77  }
78  setState(retVal);
79  return 0;
80 }
virtual int getState()
Definition: swinputmeth.cpp:33
map< int, int > subst2[12]
Definition: hebrewmcim.h:47
map< int, int * > multiChars
Definition: hebrewmcim.h:48
int subst[255]
Definition: hebrewmcim.h:46
virtual void setState(int state)
Definition: swinputmeth.cpp:29

Member Data Documentation

map<int, int*> HebrewMCIM::multiChars
private

Definition at line 48 of file hebrewmcim.h.

int HebrewMCIM::subst[255]
private

Definition at line 46 of file hebrewmcim.h.

map<int, int> HebrewMCIM::subst2[12]
private

Definition at line 47 of file hebrewmcim.h.


The documentation for this class was generated from the following files: