1 /**************************************************************************/
2 /* String to upper case */
3 /**************************************************************************/
5 void StrToUpper(inp
,out
)
13 for (i
=0; i
<strlen(inp
); i
++) {
15 at
= atomhash
[(int) (*cp
)];
16 if ((at
== Alpha
) && (*cp
>= 'a')) *cp
-= ' ';
22 /**************************************************************************/
23 /* Chop up a command line into atom values. */
24 /**************************************************************************/
26 void GetAtoms(char *buf
) {
35 /* Repeat the last command on blank command buffer */
38 || ( *buf
== '.')) return;
40 /* Start a new command */
43 bzero((void *) &(vals
[pcnt
]),sizeof(ArgVal
));
45 /* Break input string up into atoms */
50 at
= atomhash
[(int) (*cp
)];
51 vals
[pcnt
].Pos
= (unsigned int) (cp
- &buf
[0]);
55 /* Numeric atom types have their value set to the value of */
56 /* the text string. The number of bytes field corresponds to */
57 /* the number of characters in the number. */
60 vals
[pcnt
].Number
= (int) strtoul(cp
,&ep
,0);
61 vals
[pcnt
].Type
= Numeric
;
66 /* Alpha atom types are strings of letters and numbers starting with */
67 /* a letter. The text of the atom is placed in the text field of the */
68 /* atom. The number of bytes field is the number of characters in */
69 /* the name. Two special alpha strings "if" and "do", are converted */
70 /* into special atom types. */
75 vals
[pcnt
].Text
[nb
] = *cp
;
77 if (nb
>= MAX_ARG_LENGTH
) break;
78 at
= atomhash
[(int) (*cp
)];
80 vals
[pcnt
].Text
[nb
] = 0; /* Zero terminate string */
81 vals
[pcnt
].Type
= Alpha
;
82 for (i
=0; i
<CmdCMDS
; i
++) {
84 if (strcmp(cmds
[i
].Name
,vals
[pcnt
].Text
) == 0)
90 /* Seperators can be as long as they like, the only interesting */
91 /* data about them is their byte counts. */
94 while (at
== Seperator
) at
= atomhash
[(int) (*(++cp
))];
97 /* Comments are enclosed between a pair of percent marks, the only */
98 /* character not allowed in a comment is a terminator, just incase */
99 /* someone has forgotten to end one. */
102 at
= atomhash
[(int) (*(++cp
))];
103 while (at
!= Comment
) {
104 at
= atomhash
[(int) (*(cp
++))];
105 if (at
== Terminator
) return;
109 /* Operator atoms have the atom value set to indicate which operator */
110 /* the atom is. The text and number of byte fields are also set. */
114 while (at
== Operator
) {
115 vals
[pcnt
].Text
[nb
] = *cp
;
117 if (nb
>= MAX_ARG_LENGTH
) break;
118 at
= atomhash
[(int) *cp
];
120 vals
[pcnt
].Text
[nb
] = 0; /* Zero terminate string */
121 vals
[pcnt
].Type
= Operator
;
122 for (i
=0; i
<OprOPRS
; i
++) {
124 if (strcmp(oprs
[oid
].Name
,vals
[pcnt
].Text
) == 0)
125 vals
[pcnt
].OId
= oid
;
130 /* These are simple single byte operators */
132 case Open
: /* FIDO start block atom */
133 case Close
: /* FIDO end block atom */
134 case Open_index
: /* Start Object name block */
135 case Close_index
: /* End of Object name block */
136 case Bit
: /* Bit number specifier */
137 vals
[pcnt
].Type
= at
;
142 vals
[pcnt
].Type
= at
;
149 /**************************************************************************/
150 /* Absorb white space */
151 /**************************************************************************/
153 char WhiteSpace(cp
,ep
)
161 if (atomhash
[(int) c
] != Seperator
) break;