FreeCalypso > hg > fc-magnetite
annotate src/gpf2/misc/tok.c @ 605:07d0dc4431f4
bootloader.s: same MEMIF fix as in int.s plus DPLL BYPASS fix
Both MEMIF and DPLL settings are now the same between int.s and bootloader.s
assembly code paths. Previously bootloader.s was setting DPLL BYPASS /2 mode,
which persisted until _INT_Initialize code with the bootloader body omitted,
or was changed to /1 in the hardware init function in the
bootloader.lib:start.obj module.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 17 Jun 2019 18:40:32 +0000 |
parents | cd37d228dae0 |
children |
rev | line source |
---|---|
294
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 +------------------------------------------------------------------------------ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 | File: tok.c |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 +------------------------------------------------------------------------------ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 | Copyright 2002 Texas Instruments Berlin, AG |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 | All rights reserved. |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 | |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 | This file is confidential and a trade secret of Texas |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 | Instruments Berlin, AG |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 | The receipt of or possession of this file does not convey |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 | any rights to reproduce or disclose its contents or to |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 | manufacture, use, or sell anything it may describe, in |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 | whole, or in part, without the specific written consent of |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 | Texas Instruments Berlin, AG. |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 +----------------------------------------------------------------------------- |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 | Purpose : This Modul performs Configuration string functions |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 +----------------------------------------------------------------------------- |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 */ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 #ifndef __TOK_C__ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 #define __TOK_C__ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 #include "typedefs.h" |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 #include <string.h> |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 #include <ctype.h> |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 #include "tok.h" |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 #ifdef _VXWORKS_ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 #undef ERROR -1 /* Token types */ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 #undef EOS 1 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 #endif |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 #define ERROR -1 /* Token types */ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 #define EOS 1 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 #define COMMA 2 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 #define EQUAL 3 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 #define IDENT 4 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 #define STRING 5 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 #define LBRACK 6 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 #define RBRACK 7 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 static SHORT tok_gettok (char **); |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 static SHORT tok_value (char **); |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 static int tok_issep (char); |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 /* |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 Format: |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 List ::= Token |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 ::= Token , Token, ... |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 Token ::= Ident |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 ::= Ident = Values |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 Values ::= Value |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 ::= (Value) |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 ::= (Value , Value , ... ) |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 ::= () |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 Value ::= Ident |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 ::= "String" |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 */ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 #ifndef RUN_INT_RAM |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 static TOK_DCB tok_dcb; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 static char tok_buf[80]; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 #endif |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 #ifndef RUN_INT_RAM |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 /* |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 | PROJEKT : TETRA-PS (6143) MODUL : TOK.C | |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 | STATUS : code ROUTINE : tok_key | |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 PURPOSE : Return code value of a keyword from table. |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 */ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 SHORT tok_key (KW_DATA * keytab, char * keyword) |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 { |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 /* |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 * Empty string terminates |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 */ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 while (keytab->keyword[0]) |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 { |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 if (strcmp (keytab->keyword, keyword ) == 0) |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 return (keytab->code); |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 keytab++; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 } |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 return (TOK_NOT_FOUND); |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 } |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 #endif |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 #ifndef RUN_INT_RAM |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 /* |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 | PROJEKT : TETRA-PS (6143) MODUL : TOK.C | |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 | STATUS : code ROUTINE : tok_init | |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 PURPOSE : Initialize token scanner. |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 */ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 void tok_init (char * s) |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 { |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 tok_dcb.tokbuf = tok_buf; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 strncpy (tok_dcb.tokbuf, s, 79); |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 tok_dcb.tokbuf[79] = '\0'; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 tok_dcb.nexttok = tok_dcb.tokbuf; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 tok_dcb.lastchar = 0; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 } |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 #endif |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 #ifndef RUN_INT_RAM |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
119 /* |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 | PROJEKT : TETRA-PS (6143) MODUL : TOK.C | |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 | STATUS : code ROUTINE : tok_next | |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 PURPOSE : Get next token (and its values) from token string. |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
126 Return number of value strings. |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
127 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
128 */ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
129 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 SHORT tok_next (char ** keyw, char * value []) |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
131 { |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
132 char * val; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 if (tok_dcb.nexttok == NULL) |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 return (TOK_EOCS); |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
136 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 if (tok_gettok (keyw) != IDENT) |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 { |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
139 tok_dcb.nexttok = NULL; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
140 return (TOK_EOCS); |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
141 } |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 /* |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 * Check next token |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
145 */ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
146 switch (tok_gettok (&val)) |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
147 { |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
148 /* |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
149 * No value present |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
150 */ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
151 case COMMA: |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
152 return (0); |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
153 /* |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
154 * Value(s) follows |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
155 */ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
156 case EQUAL: |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
157 return (tok_value (value)); |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
158 /* |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
159 * No value present and EOS |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
160 */ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
161 case EOS: |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
162 tok_dcb.nexttok = NULL; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
163 return (0); |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
164 /* |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
165 * Syntax error |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
166 */ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
167 default: |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
168 tok_dcb.nexttok = NULL; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
169 return (TOK_EOCS); |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
170 } |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
171 } |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
172 #endif |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
173 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
174 #ifndef RUN_INT_RAM |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
175 /* |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
176 ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
177 | PROJEKT : TETRA-PS (6143) MODUL : TOK.C | |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
178 | STATUS : code ROUTINE : tok_value | |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
179 ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
180 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
181 PURPOSE : Get list of values for token. |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
182 Return number of values found. |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
183 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
184 Formats: Value |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
185 (Value) |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
186 (Value, Value,...) |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
187 () |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
188 */ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
189 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
190 static SHORT tok_value (char * value []) |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
191 { |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
192 SHORT count; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
193 SHORT tok; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
194 SHORT inbrack; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
195 char * val; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
196 char * val2; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
197 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
198 inbrack = 0; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
199 /* |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
200 * Get next token |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
201 */ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
202 tok = tok_gettok (&val); |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
203 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
204 switch (tok) |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
205 { |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
206 case LBRACK: |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
207 inbrack++; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
208 break; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
209 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
210 case IDENT : |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
211 case STRING : |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
212 tok = tok_gettok (&val2); |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
213 if ((tok != COMMA) && (tok != EOS)) |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
214 { |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
215 tok_dcb.nexttok = NULL; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
216 return (0); |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
217 } |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
218 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
219 value[0] = val; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
220 return (1); |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
221 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
222 case EOS : |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
223 default : |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
224 tok_dcb.nexttok = NULL; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
225 return (0); |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
226 } |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
227 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
228 /* |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
229 * Get first token of list |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
230 */ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
231 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
232 tok = tok_gettok (&val); |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
233 count = 0; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
234 for(;;) |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
235 { |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
236 if ((tok == IDENT) || (tok == STRING)) |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
237 value[count++] = val; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
238 else |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
239 { |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
240 tok_dcb.nexttok = NULL; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
241 return (0); |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
242 } |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
243 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
244 tok = tok_gettok (&val); |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
245 switch (tok) |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
246 { |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
247 case COMMA: |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
248 break; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
249 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
250 case RBRACK : |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
251 if (inbrack) |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
252 { |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
253 if (((tok = tok_gettok (&val)) == COMMA) || |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
254 (tok == EOS)) |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
255 return (count); |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
256 } |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
257 /* |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
258 * Fall through |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
259 */ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
260 /*lint -fallthrough */ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
261 default: |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
262 tok_dcb.nexttok = NULL; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
263 return (0); |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
264 } |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
265 tok = tok_gettok (&val); |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
266 } |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
267 /*lint -e527 suppress Warning -- Unreachable */ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
268 return (0); |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
269 /*lint +e527 */ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
270 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
271 } |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
272 #endif |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
273 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
274 #ifndef RUN_INT_RAM |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
275 /* |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
276 ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
277 | PROJEKT : TETRA-PS (6143) MODUL : TOK.C | |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
278 | STATUS : code ROUTINE : tok_gettok | |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
279 ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
280 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
281 PURPOSE : Return next token in input string. |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
282 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
283 */ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
284 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
285 static SHORT tok_gettok (char ** token) |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
286 { |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
287 SHORT tok; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
288 char hadnull; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
289 char * cp; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
290 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
291 cp = tok_dcb.nexttok; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
292 hadnull = tok_dcb.lastchar != 0; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
293 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
294 if (tok_dcb.lastchar) |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
295 { |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
296 * tok_dcb.nexttok = tok_dcb.lastchar; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
297 tok_dcb.lastchar = 0; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
298 } |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
299 /* |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
300 * Skip leading white space |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
301 */ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
302 while (isspace (* tok_dcb.nexttok)) |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
303 tok_dcb.nexttok++; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
304 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
305 * token = tok_dcb.nexttok++; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
306 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
307 switch (** token) |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
308 { |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
309 case '\0': /* End of string */ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
310 case '\n': |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
311 tok = EOS; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
312 break; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
313 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
314 case ',': |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
315 ** token = '\0'; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
316 tok = COMMA; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
317 break; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
318 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
319 case '=': |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
320 ** token = '\0'; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
321 tok = EQUAL; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
322 break; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
323 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
324 case '(': |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
325 case '<': |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
326 case '[': |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
327 ** token = '\0'; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
328 tok = LBRACK; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
329 break; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
330 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
331 case ')': |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
332 case '>': |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
333 case ']': |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
334 ** token = '\0'; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
335 tok = RBRACK; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
336 break; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
337 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
338 case '"': |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
339 /* |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
340 * Get first char of string |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
341 */ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
342 * token = tok_dcb.nexttok; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
343 while ((* tok_dcb.nexttok != '\0') && (* tok_dcb.nexttok != '"')) |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
344 tok_dcb.nexttok++; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
345 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
346 if (* tok_dcb.nexttok != '\0') |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
347 * tok_dcb.nexttok++ = '\0'; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
348 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
349 tok = STRING; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
350 break; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
351 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
352 default: |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
353 /* |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
354 * Read an identifier |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
355 */ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
356 if (!tok_issep (** token)) |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
357 { |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
358 while (!tok_issep (* tok_dcb.nexttok)) |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
359 tok_dcb.nexttok++; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
360 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
361 tok_dcb.lastchar = * tok_dcb.nexttok; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
362 * tok_dcb.nexttok = '\0'; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
363 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
364 tok = IDENT; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
365 } |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
366 else |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
367 tok = ERROR; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
368 break; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
369 } |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
370 /* |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
371 * '\0 was replaced with char |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
372 * Replace original '\0' |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
373 */ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
374 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
375 if (hadnull) |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
376 * cp = '\0'; |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
377 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
378 return (tok); |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
379 } |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
380 #endif |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
381 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
382 #ifndef RUN_INT_RAM |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
383 /* |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
384 ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
385 | PROJEKT : TETRA-PS (6143) MODUL : TOK.C | |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
386 | STATUS : code ROUTINE : tok_issep | |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
387 ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
388 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
389 PURPOSE : Return 1 if special character. |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
390 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
391 */ |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
392 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
393 static int tok_issep (char c) |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
394 { |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
395 switch (c) |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
396 { |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
397 case '\0' : |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
398 case '\n' : |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
399 case ',' : |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
400 case '=' : |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
401 case '(' : |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
402 case '<' : |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
403 case '[' : |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
404 case ')' : |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
405 case '>' : |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
406 case ']' : |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
407 case '"' : return (1); |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
408 |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
409 default : return (isspace (c)); |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
410 } |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
411 } |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
412 #endif |
cd37d228dae0
src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
413 #endif |