1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-12 02:30:44 +00:00

Initialize translation tables

git-svn-id: svn://svn.cc65.org/cc65/trunk@327 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2000-09-14 19:26:13 +00:00
parent 2ff9f2fc1d
commit 1b4039be3b
10 changed files with 49 additions and 9 deletions

View File

@ -42,6 +42,7 @@
/* common */
#include "cmdline.h"
#include "target.h"
#include "tgttrans.h"
#include "version.h"
/* ca65 */
@ -529,7 +530,7 @@ int main (int argc, char* argv [])
LongOption (&I, OptTab, sizeof(OptTab)/sizeof(OptTab[0]));
break;
case 'g':
case 'g':
OptDebugInfo (Arg, 0);
break;
@ -574,7 +575,7 @@ int main (int argc, char* argv [])
break;
case 'V':
OptVersion (Arg, 0);
OptVersion (Arg, 0);
break;
case 'W':
@ -607,6 +608,9 @@ int main (int argc, char* argv [])
exit (EXIT_FAILURE);
}
/* Intialize the target translation tables */
TgtTranslateInit ();
/* Initialize the scanner, open the input file */
InitScanner (InFile);

View File

@ -18,6 +18,7 @@
#include "anonname.h"
#include "codegen.h"
#include "datatype.h"
#include "declattr.h"
#include "error.h"
#include "expr.h"
#include "funcdesc.h"
@ -621,7 +622,7 @@ static void ParseAnsiParamList (FuncDesc* F)
DeclSpec Spec;
Declaration Decl;
DeclAttr Attr;
/* Allow an ellipsis as last parameter */
if (curtok == TOK_ELLIPSIS) {
@ -658,6 +659,9 @@ static void ParseAnsiParamList (FuncDesc* F)
Spec.StorageClass &= ~SC_DEF;
}
/* Parse an attribute */
ParseAttribute (&Decl, &Attr);
/* Create a symbol table entry */
AddLocalSym (Decl.Ident, ParamTypeCvt (Decl.Type), Spec.StorageClass, 0);

View File

@ -79,6 +79,7 @@ static char* ErrMsg [ERR_COUNT-1] = {
"`\"' expected",
"`:' expected",
"`;' expected",
"`,' expected",
"`(' expected",
"`)' expected",
"`[' expected",
@ -138,6 +139,7 @@ static char* ErrMsg [ERR_COUNT-1] = {
"Illegal modifier",
"Illegal type qualifier",
"Illegal storage class",
"Illegal attribute",
"Illegal segment name: `%s'",
"Division by zero",
"Modulo operation with zero",

View File

@ -37,7 +37,7 @@
#define ERROR_H
/* common */
#include "attrib.h"
@ -79,6 +79,7 @@ enum Errors {
ERR_QUOTE_EXPECTED,
ERR_COLON_EXPECTED,
ERR_SEMICOLON_EXPECTED,
ERR_COMMA_EXPECTED,
ERR_LPAREN_EXPECTED,
ERR_RPAREN_EXPECTED,
ERR_LBRACK_EXPECTED,
@ -138,6 +139,7 @@ enum Errors {
ERR_ILLEGAL_MODIFIER,
ERR_ILLEGAL_QUALIFIER,
ERR_ILLEGAL_STORAGE_CLASS,
ERR_ILLEGAL_ATTRIBUTE,
ERR_ILLEGAL_SEG_NAME,
ERR_DIV_BY_ZERO,
ERR_MOD_BY_ZERO,

View File

@ -33,8 +33,10 @@
#include "../common/xmalloc.h"
/* common */
#include "xmalloc.h"
/* cc65 */
#include "anonname.h"
#include "asmlabel.h"
#include "codegen.h"

View File

@ -44,6 +44,7 @@
#include "cmdline.h"
#include "fname.h"
#include "target.h"
#include "tgttrans.h"
#include "version.h"
#include "xmalloc.h"
@ -173,7 +174,10 @@ static void SetSys (const char* Sys)
default:
AbEnd ("Unknown target system type");
}
}
/* Initialize the translation tables for the target system */
TgtTranslateInit ();
}

View File

@ -21,6 +21,7 @@ OBJS = anonname.o \
cpu.o \
datatype.o \
declare.o \
declattr.o \
error.o \
expr.o \
exprheap.o \

View File

@ -76,6 +76,7 @@ OBJS = anonname.obj \
cpu.obj \
datatype.obj \
declare.obj \
declattr.obj \
error.obj \
expr.obj \
exprheap.obj \
@ -134,6 +135,7 @@ FILE compile.obj
FILE cpu.obj
FILE datatype.obj
FILE declare.obj
FILE declattr.obj
FILE error.obj
FILE expr.obj
FILE exprheap.obj

View File

@ -11,7 +11,7 @@
#include <string.h>
#include <errno.h>
#include <ctype.h>
/* common */
#include "tgttrans.h"
@ -331,7 +331,7 @@ static void CharConst (void)
nxtval = SignExtendChar (TgtTranslateChar (C));
/* Character constants have type int */
nxttype = type_int;
nxttype = type_int;
}
@ -806,6 +806,22 @@ void ConsumeSemi (void)
void ConsumeComma (void)
/* Check for a comma and skip it. */
{
/* Try do be smart about typos... */
if (CurTok.Tok == TOK_COMMA) {
NextToken ();
} else {
Error (ERR_COMMA_EXPECTED);
if (CurTok.Tok == TOK_SEMI) {
NextToken ();
}
}
}
void ConsumeLParen (void)
/* Check for a left parenthesis and skip it */
{

View File

@ -198,6 +198,9 @@ void ConsumeColon (void);
void ConsumeSemi (void);
/* Check for a semicolon and skip it. */
void ConsumeComma (void);
/* Check for a comma and skip it. */
void ConsumeLParen (void);
/* Check for a left parenthesis and skip it */