annotate gsm-fw/gpf/misc/tok.c @ 407:f2cc551e597f

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