#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <time.h>
/* common */
+#include "chartype.h"
#include "cmdline.h"
#include "target.h"
#include "tgttrans.h"
char SymName [MAX_STR_LEN+1];
/* The symbol must start with a character or underline */
- if (Def [0] != '_' && !isalpha (Def [0])) {
+ if (Def [0] != '_' && !IsAlpha (Def [0])) {
InvDef (Def);
}
P = Def;
/* Copy the symbol, checking the rest */
I = 0;
- while (isalnum (*P) || *P == '_') {
+ while (IsAlNum (*P) || *P == '_') {
if (I <= MAX_STR_LEN) {
SymName [I++] = *P;
}
#include <string.h>
#include <errno.h>
-#include <ctype.h>
/* common */
+#include "chartype.h"
#include "check.h"
#include "segdefs.h"
#include "xmalloc.h"
/* Check the segment name for invalid names */
N = Name;
- if ((*N != '_' && !isalpha (*N)) || strlen (Name) > 80) {
+ if ((*N != '_' && !IsAlpha (*N)) || strlen (Name) > 80) {
Error (ERR_ILLEGAL_SEGMENT, Name);
}
do {
- if (*N != '_' && !isalnum (*N)) {
+ if (*N != '_' && !IsAlNum (*N)) {
Error (ERR_ILLEGAL_SEGMENT, Name);
break;
}
#include <sys/stat.h>
/* common */
+#include "chartype.h"
#include "check.h"
#include "fname.h"
#include "xmalloc.h"
-static int IsBlank (int C)
-/* Return true if the character is a blank or tab */
-{
- return (C == ' ' || C == '\t');
-}
-
-
-
-static int IsDigit (int C)
-/* Return true if the character is a digit */
-{
- return isdigit (C);
-}
-
-
-
-static int IsXDigit (int C)
-/* Return true if the character is a hexadecimal digit */
-{
- return isxdigit (C);
-}
-
-
-
-static int IsDDigit (int C)
-/* Return true if the character is a dual digit */
-{
- return (C == '0' || C == '1');
-}
-
-
-
static int IsIdChar (int C)
/* Return true if the character is a valid character for an identifier */
{
- return isalnum (C) ||
+ return IsAlNum (C) ||
(C == '_') ||
(C == '@' && AtInIdents) ||
(C == '$' && DollarInIdents);
static int IsIdStart (int C)
/* Return true if the character may start an identifier */
{
- return isalpha (C) || C == '_';
+ return IsAlpha (C) || C == '_';
}
NextChar ();
/* 0 or 1 must follow */
- if (!IsDDigit (C)) {
+ if (!IsBDigit (C)) {
Error (ERR_01_EXPECTED);
}
/* Read the number */
IVal = 0;
- while (IsDDigit (C)) {
+ while (IsBDigit (C)) {
if (IVal & 0x80000000) {
Error (ERR_NUM_OVERFLOW);
IVal = 0;
#include <stdio.h>
#include <string.h>
#include <errno.h>
-#include <ctype.h>
/* common */
#include "xmalloc.h"
case TOK_CONST:
if (Q & T_QUAL_CONST) {
Error ("Duplicate qualifier: `const'");
- }
+ }
Q |= T_QUAL_CONST;
break;
-#include <ctype.h>
-
+/* common */
+#include "chartype.h"
+
+/* cc65 */
#include "ident.h"
int IsIdent (char c)
/* Return true if the given char may start an identifier */
{
- return (isalpha (c) || c == '_');
+ return (IsAlpha (c) || c == '_');
}
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
-#include <ctype.h>
#include <errno.h>
/* common */
#include "abend.h"
+#include "chartype.h"
#include "cmdline.h"
#include "fname.h"
#include "target.h"
const char* P = Def;
/* The symbol must start with a character or underline */
- if (Def [0] != '_' && !isalpha (Def [0])) {
+ if (Def [0] != '_' && !IsAlpha (Def [0])) {
InvDef (Def);
}
/* Check the symbol name */
- while (isalnum (*P) || *P == '_') {
+ while (IsAlNum (*P) || *P == '_') {
++P;
}
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
-#include <ctype.h>
+//#include <ctype.h>
/* common */
#include "attrib.h"
+#include "chartype.h"
#include "check.h"
#include "xmalloc.h"
#include "xsprintf.h"
static int IsLocalLabel (const Line* L)
/* Return true if the line is a local label line */
{
- return (L->Line [0] == 'L' && isxdigit (L->Line [1]));
+ return (L->Line [0] == 'L' && IsXDigit (L->Line [1]));
}
static int IsLabel (const Line* L)
/* Return true if the line is a label line */
{
- return (L->Line [0] == 'L' && isxdigit (L->Line [1])) ||
+ return (L->Line [0] == 'L' && IsXDigit (L->Line [1])) ||
(L->Line [0] == '_');;
}
{
unsigned I = 0;
unsigned Val = 0;
- while (isxdigit (S [I])) {
+ while (IsXDigit (S [I])) {
int C = (unsigned char) (S [I++]);
if (C >= 'A') {
C -= 'A' - 10;
Line* L = FirstCode;
while (L) {
/* Is this a jump to a numbered label? */
- if (LineMatch (L, "\tjmp\t") && L->Line [5] == 'L' && isdigit (L->Line [6])) {
+ if (LineMatch (L, "\tjmp\t") && L->Line [5] == 'L' && IsDigit (L->Line [6])) {
/* Yes. Get the target label */
Line* Target = GetTargetLine (L->Line+5);
#include <stdlib.h>
#include <string.h>
-#include <ctype.h>
-
+
/* cc65 */
#include "codegen.h"
#include "error.h"
#include <string.h>
#include <stdlib.h>
#include <errno.h>
-#include <ctype.h>
-#include "../common/xmalloc.h"
+/* common */
+#include "chartype.h"
+#include "xmalloc.h"
+/* cc65 */
#include "codegen.h"
#include "error.h"
#include "expr.h"
#include <ctype.h>
/* common */
+#include "chartype.h"
#include "tgttrans.h"
/* cc65 */
*s++ = CurC;
}
NextChar ();
- } while (IsIdent (CurC) || isdigit (CurC));
+ } while (IsIdent (CurC) || IsDigit (CurC));
*s = '\0';
}
static unsigned hexval (int c)
/* Convert a hex digit into a value */
{
- if (!isxdigit (c)) {
+ if (!IsXDigit (c)) {
Error ("Invalid hexadecimal digit: `%c'", c);
}
- if (isdigit (c)) {
+ if (IsDigit (c)) {
return c - '0';
} else {
return toupper (c) - 'A' + 10;
}
/* Determine the next token from the lookahead */
- if (isdigit (CurC)) {
+ if (IsDigit (CurC)) {
/* A number */
int HaveSuffix; /* True if we have a type suffix */
}
}
while (1) {
- if (isdigit (CurC)) {
+ if (IsDigit (CurC)) {
k = k * base + (CurC - '0');
- } else if (base == 16 && isxdigit (CurC)) {
+ } else if (base == 16 && IsXDigit (CurC)) {
k = (k << 4) + hexval (CurC);
} else {
break; /* not digit */
#include <string.h>
-#include <ctype.h>
/* common */
+#include "chartype.h"
#include "check.h"
#include "xmalloc.h"
/*****************************************************************************/
-/* Data */
+/* Data */
/*****************************************************************************/
/*****************************************************************************/
-/* Code */
+/* Code */
/*****************************************************************************/
/* Return true if the given segment name is valid, return false otherwise */
{
/* Must start with '_' or a letter */
- if ((*Name != '_' && !isalpha(*Name)) || strlen(Name) > 80) {
+ if ((*Name != '_' && !IsAlpha(*Name)) || strlen(Name) > 80) {
return 0;
}
/* Can have letters, digits or the underline */
while (*++Name) {
- if (*Name != '_' && !isalnum(*Name)) {
+ if (*Name != '_' && !IsAlNum(*Name)) {
return 0;
}
}
-int IsBlank (char c)
-/* Return true if c is a space, tab or newline */
-{
- return (c == ' ' || c == '\t' || c == '\n');
-}
-
-
-
int IsQuoteChar (char c)
/* Return true if c is a single or double quote */
{
-int IsBlank (char c);
-/* Return true if c is a space, tab or newline */
-
int IsQuoteChar (char c);
/* Return true if c is a single or double quote */