int i = 0;
int max = 0, num, base = 0;
char ch1;
-
+
ch1 = *p++;
-
+
switch (ch1)
{
default: num = ch1; break;
case 'r': num = '\r'; break;
case 'f': num = '\f'; break;
case 'E': case 'e': num = 27; break;
- case 'a': num = 7;
+ case 'a': num = 7;
break;
-
+
/* octal */
- case '0': case '1': case '2': case '3':
- case '4': case '5': case '6': case '7':
- max = '7';
+ case '0': case '1': case '2': case '3':
+ case '4': case '5': case '6': case '7':
+ max = '7';
base = 8; i = 2; num = ch1 - '0';
break;
-
+
case 'd': /* decimal -- S-Lang extension */
- base = 10;
+ base = 10;
i = 3;
max = '9';
num = 0;
break;
-
+
case 'x': /* hex */
base = 16;
max = '9';
num = 0;
break;
}
-
+
while (i--)
{
ch1 = *p;
-
+
if ((ch1 <= max) && (ch1 >= '0'))
{
num = base * num + (ch1 - '0');
else break;
p++;
}
-
+
*ch = (char) num;
return p;
}
-void SLexpand_escaped_string (register char *s, register char *t,
+void SLexpand_escaped_string (register char *s, register char *t,
register char *tmax)
{
char ch;
-
+
while (t < tmax)
{
ch = *t++;
int string;
char ch1;
char *word_max;
-
+
word_max = word + 250;
-
+
line = *linep;
/* skip white space */
- while (((ch = *line) == ' ')
+ while (((ch = *line) == ' ')
|| (ch == '\t')) line++;
if ((!ch) || (ch == '\n'))
*linep = line;
return(0);
}
-
+
*word++ = ch;
line++;
-
+
/* Look for -something and rule out --something and -= something */
- if ((ch == '-') &&
+ if ((ch == '-') &&
(*line != '-') && (*line != '=') && ((*line > '9') || (*line < '0')))
{
*word = 0;
*linep = line;
return 1;
}
-
-
+
+
if (ch == '"') string = 1; else string = 0;
if (ch == '\'')
{
if ((ch = *line++) != 0)
{
- if (ch == '\\')
+ if (ch == '\\')
{
line = SLexpand_escaped_char(line, &ch1);
ch = ch1;
}
else if (!special_chars[(unsigned char) ch])
{
- while (ch = *line++,
- (ch > '"') ||
+ while (ch = *line++,
+ (ch > '"') ||
((ch != '\n') && (ch != 0) && (ch != '"')))
{
if (string)
ch = *line++;
if ((ch == 0) || (ch == '\n')) break;
if (byte_comp) *word++ = '\\';
- else
+ else
{
line = SLexpand_escaped_char(line - 1, &ch1);
ch = ch1;
line--;
break;
}
-
+
*word++ = ch;
if (word > word_max)
{
}
}
}
-
+
if ((!ch) || (ch == '\n')) line--;
if ((ch == '"') && string) *word++ = '"'; else if (string) SLang_Error = SYNTAX_ERROR;
*word = 0;
if (*t == '-') t++;
p = t;
#ifdef FLOAT_TYPE
- if (*p != '.')
+ if (*p != '.')
{
#endif
while ((*p >= '0') && (*p <= '9')) p++;
if ((*p == 'x') && (p == t + 1)) /* 0x?? */
{
p++;
- while (ch = *p,
+ while (ch = *p,
((ch >= '0') && (ch <= '9'))
|| (((ch | 0x20) >= 'a') && ((ch | 0x20) <= 'f'))) p++;
}
return(STRING_TYPE);
#else
}
-
+
/* now down to float case */
if (*p == '.')
{
register unsigned char ch;
register unsigned int value;
register int base;
-
+
if (*s != '0') return atoi((char *) s);
/* look for 'x' which indicates hex */
s++;
- if ((*s | 0x20) == 'x')
+ if ((*s | 0x20) == 'x')
{
base = 16;
s++;
- if (*s == 0)
+ if (*s == 0)
{
SLang_Error = SYNTAX_ERROR;
return -1;
}
}
else base = 8;
-
-
+
+
value = 0;
while ((ch = *s++) != 0)
{
case '7':
ch1 -= '0';
break;
-
+
case 'a':
case 'b':
case 'c':