ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/grkelot.C
(Generate patch)

Comparing rxvt-unicode/src/grkelot.C (file contents):
Revision 1.2 by pcg, Mon Nov 24 17:31:27 2003 UTC vs.
Revision 1.3 by pcg, Sat Jan 31 00:20:21 2004 UTC

1/*---------------------------------*C*--------------------------------------* 1/*---------------------------------*C*--------------------------------------*
2 * File: grkelot.c 2 * File: grkelot.c
3 *--------------------------------------------------------------------------* 3 *--------------------------------------------------------------------------*
4 * $Id: grkelot.C,v 1.2 2003/11/24 17:31:27 pcg Exp $ 4 * $Id: grkelot.C,v 1.3 2004/01/31 00:20:21 pcg Exp $
5 * 5 *
6 * All portions of code are copyright by their respective author/s. 6 * All portions of code are copyright by their respective author/s.
7 * Copyright (c) 1994,1995 Angelo Haritsis. All rights reserved. 7 * Copyright (c) 1994,1995 Angelo Haritsis. All rights reserved.
8 * - original version 8 * - original version
9 * Copyright (c) 1997,1998 Oezger Kesim <kesim@math.fu-berlin.de> 9 * Copyright (c) 1997,1998 Oezger Kesim <kesim@math.fu-berlin.de>
162static void kstate_add_xlat(char *str); 162static void kstate_add_xlat(char *str);
163static void kstate_add_switcher(char *str); 163static void kstate_add_switcher(char *str);
164static void kstate_set_life(char *str); 164static void kstate_set_life(char *str);
165 165
166/* --- Functions ------------- */ 166/* --- Functions ------------- */
167/* INTPROTO */
168void 167void
169kstate_setcurr(int stateno) 168kstate_setcurr(int stateno)
170{ 169{
171 u_char prev_state; 170 u_char prev_state;
172 171
178 prev_state = nStateNow; 177 prev_state = nStateNow;
179 pStateNow = &State[nStateNow = stateno]; 178 pStateNow = &State[nStateNow = stateno];
180 pStateNow->prev_state = prev_state; 179 pStateNow->prev_state = prev_state;
181} 180}
182 181
183/* INTPROTO */
184void 182void
185kstate_init(void) 183kstate_init(void)
186{ 184{
187 pStateNow->num_xlat = pStateNow->num_switcher = pStateNow->life = pStateNow->prev_state = 0; 185 pStateNow->num_xlat = pStateNow->num_switcher = pStateNow->life = pStateNow->prev_state = 0;
188 pStateNow->xlat = NULL; 186 pStateNow->xlat = NULL;
189} 187}
190 188
191/* INTPROTO */
192void 189void
193kstate_end(void) 190kstate_end(void)
194{ 191{
195 int i; 192 int i;
196 193
202 199
203/* 200/*
204 * Hard coded ELOT-928 translations. Could read these from an rc-type file 201 * Hard coded ELOT-928 translations. Could read these from an rc-type file
205 * to support other remappers. 202 * to support other remappers.
206 */ 203 */
207/* INTPROTO */
208void 204void
209kstate_init_all(int greek_mode) 205kstate_init_all(int greek_mode)
210{ 206{
211/* the translation tables for the 4 FSM states for ELOT-928 mappings */ 207/* the translation tables for the 4 FSM states for ELOT-928 mappings */
212 int i; 208 int i;
238 kstate_setcurr(3); 234 kstate_setcurr(3);
239 kstate_add_xlat(xlat_now->acc_uml); 235 kstate_add_xlat(xlat_now->acc_uml);
240 kstate_set_life("L1"); 236 kstate_set_life("L1");
241} 237}
242 238
243/* INTPROTO */
244void 239void
245kstate_end_all(void) 240kstate_end_all(void)
246{ 241{
247 int i; 242 int i;
248 243
254} 249}
255 250
256/* 251/*
257 * reset FSM 252 * reset FSM
258 */ 253 */
259/* INTPROTO */
260void 254void
261kstate_reset(void) 255kstate_reset(void)
262{ 256{
263 kstate_setcurr(0); 257 kstate_setcurr(0);
264} 258}
265 259
266/* INTPROTO */
267void 260void
268kstate_add_xlat(char *str) 261kstate_add_xlat(char *str)
269{ 262{
270 K_XLAT *xlat; 263 K_XLAT *xlat;
271 u_int *pval_tmp; 264 u_int *pval_tmp;
295} 288}
296 289
297/* 290/*
298 * Ascii only for this implementation 291 * Ascii only for this implementation
299 */ 292 */
300/* INTPROTO */
301void 293void
302kstate_add_switcher(char *str) 294kstate_add_switcher(char *str)
303{ 295{
304 K_SWITCH *switcher; 296 K_SWITCH *switcher;
305 297
317 switcher->on = 0; 309 switcher->on = 0;
318 pStateNow->num_switcher++; 310 pStateNow->num_switcher++;
319} 311}
320 312
321/* L1 or L0 */ 313/* L1 or L0 */
322/* INTPROTO */
323void 314void
324kstate_set_life(char *str) 315kstate_set_life(char *str)
325{ 316{
326 pStateNow->life = atoi(&str[1]); 317 pStateNow->life = atoi(&str[1]);
327} 318}
328 319
329/* INTPROTO */
330unsigned int 320unsigned int
331kstate_cxlat(unsigned int c) 321kstate_cxlat(unsigned int c)
332{ 322{
333 int i; 323 int i;
334 324
351 kstate_setcurr(pStateNow->prev_state); 341 kstate_setcurr(pStateNow->prev_state);
352 return (c); 342 return (c);
353} 343}
354 344
355#ifdef RXVT 345#ifdef RXVT
356/* EXTPROTO */
357void 346void
358greek_init(void) 347greek_init(void)
359{ 348{
360 kstate_init_all(GreekMode); 349 kstate_init_all(GreekMode);
361} 350}
362 351
363/* EXTPROTO */
364void 352void
365greek_end(void) 353greek_end(void)
366{ 354{
367 kstate_end_all(); 355 kstate_end_all();
368} 356}
369 357
370/* EXTPROTO */
371void 358void
372greek_reset(void) 359greek_reset(void)
373{ 360{
374 kstate_reset(); 361 kstate_reset();
375} 362}
376 363
377/* EXTPROTO */
378void 364void
379greek_setmode(int greek_mode) 365greek_setmode(int greek_mode)
380{ 366{
381 GreekMode = greek_mode; 367 GreekMode = greek_mode;
382} 368}
383 369
384/* EXTPROTO */
385int 370int
386greek_getmode(void) 371greek_getmode(void)
387{ 372{
388 return (GreekMode); 373 return (GreekMode);
389} 374}
390 375
391/* 376/*
392 * xlate a given string in-place - return new string length 377 * xlate a given string in-place - return new string length
393 */ 378 */
394/* EXTPROTO */
395int 379int
396greek_xlat(char *s, int num_chars) 380greek_xlat(char *s, int num_chars)
397{ 381{
398 int i, count; 382 int i, count;
399 unsigned int c; 383 unsigned int c;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines