#include <config.h>
#include "lexer.h"
#include <libpspp/message.h>
-#include <ctype.h>
+#include <c-ctype.h>
+#include <c-strtod.h>
#include <errno.h>
#include <limits.h>
#include <math.h>
for (;;)
{
/* Skip whitespace. */
- while (isspace ((unsigned char) *lexer->prog))
+ while (c_isspace ((unsigned char) *lexer->prog))
lexer->prog++;
if (*lexer->prog)
if (*lexer->prog == '-')
{
ds_put_char (&lexer->tokstr, *lexer->prog++);
- while (isspace ((unsigned char) *lexer->prog))
+ while (c_isspace ((unsigned char) *lexer->prog))
lexer->prog++;
- if (!isdigit ((unsigned char) *lexer->prog) && *lexer->prog != '.')
+ if (!c_isdigit ((unsigned char) *lexer->prog) && *lexer->prog != '.')
{
lexer->token = '-';
break;
lexer->token = T_POS_NUM;
/* Parse the number, copying it into tokstr. */
- while (isdigit ((unsigned char) *lexer->prog))
+ while (c_isdigit ((unsigned char) *lexer->prog))
ds_put_char (&lexer->tokstr, *lexer->prog++);
if (*lexer->prog == '.')
{
ds_put_char (&lexer->tokstr, *lexer->prog++);
- while (isdigit ((unsigned char) *lexer->prog))
+ while (c_isdigit ((unsigned char) *lexer->prog))
ds_put_char (&lexer->tokstr, *lexer->prog++);
}
if (*lexer->prog == 'e' || *lexer->prog == 'E')
ds_put_char (&lexer->tokstr, *lexer->prog++);
if (*lexer->prog == '+' || *lexer->prog == '-')
ds_put_char (&lexer->tokstr, *lexer->prog++);
- while (isdigit ((unsigned char) *lexer->prog))
+ while (c_isdigit ((unsigned char) *lexer->prog))
ds_put_char (&lexer->tokstr, *lexer->prog++);
}
/* Parse as floating point. */
- lexer->tokval = strtod (ds_cstr (&lexer->tokstr), &tail);
+ lexer->tokval = c_strtod (ds_cstr (&lexer->tokstr), &tail);
if (*tail)
{
msg (SE, _("%s does not form a valid number."),
}
else
{
- if (isgraph ((unsigned char) *lexer->prog))
+ if (c_isgraph ((unsigned char) *lexer->prog))
msg (SE, _("Bad character in input: `%c'."), *lexer->prog++);
else
msg (SE, _("Bad character in input: `\\%o'."), *lexer->prog++);
for (;;)
{
- while (isspace ((unsigned char) *lexer->prog))
+ while (c_isspace ((unsigned char) *lexer->prog))
lexer->prog++;
if (*lexer->prog)
break;
if (syntax == GETL_BATCH)
{
int first = ds_first (line);
- *line_starts_command = !isspace (first);
+ *line_starts_command = !c_isspace (first);
if (first == '+' || first == '-')
*ds_data (line) = ' ';
}
char *sp, *dp;
for (sp = ds_cstr (&lexer->tokstr); sp < ds_end (&lexer->tokstr); sp++)
- if (!isprint ((unsigned char) *sp))
+ if (!c_isprint ((unsigned char) *sp))
{
hexstring = 1;
break;
break;
for (;;)
{
- while (isspace ((unsigned char) *lexer->prog))
+ while (c_isspace ((unsigned char) *lexer->prog))
lexer->prog++;
if (*lexer->prog)
break;
break;
for (;;)
{
- while (isspace ((unsigned char) *lexer->prog))
+ while (c_isspace ((unsigned char) *lexer->prog))
lexer->prog++;
if (*lexer->prog)
break;