From 5d4790a1378f6f4ab1c668a58fb9d49db3393870 Mon Sep 17 00:00:00 2001 From: uz Date: Thu, 21 Aug 2008 19:35:39 +0000 Subject: [PATCH] Enable use of new C like comments only if the new feature "c_comments" is enabled. git-svn-id: svn://svn.cc65.org/cc65/trunk@3889 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/ca65/feature.c | 2 ++ src/ca65/feature.h | 1 + src/ca65/global.c | 5 +++-- src/ca65/global.h | 3 ++- src/ca65/scanner.c | 6 +++--- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/ca65/feature.c b/src/ca65/feature.c index fbd5e1561..e138bfe74 100644 --- a/src/ca65/feature.c +++ b/src/ca65/feature.c @@ -60,6 +60,7 @@ static const char* FeatureKeys[FEAT_COUNT] = { "pc_assignment", "missing_char_term", "ubiquitous_idents", + "c_comments", }; @@ -113,6 +114,7 @@ feature_t SetFeature (const StrBuf* Key) case FEAT_PC_ASSIGNMENT: PCAssignment = 1; break; case FEAT_MISSING_CHAR_TERM: MissingCharTerm = 1; break; case FEAT_UBIQUITOUS_IDENTS: UbiquitousIdents = 1; break; + case FEAT_C_COMMENTS: CComments = 1; break; default: /* Keep gcc silent */ break; } diff --git a/src/ca65/feature.h b/src/ca65/feature.h index d3bf08e06..31ebae223 100644 --- a/src/ca65/feature.h +++ b/src/ca65/feature.h @@ -62,6 +62,7 @@ typedef enum { FEAT_PC_ASSIGNMENT, FEAT_MISSING_CHAR_TERM, FEAT_UBIQUITOUS_IDENTS, + FEAT_C_COMMENTS, /* Special value: Number of features available */ FEAT_COUNT diff --git a/src/ca65/global.c b/src/ca65/global.c index dea1dc690..91041d067 100644 --- a/src/ca65/global.c +++ b/src/ca65/global.c @@ -6,7 +6,7 @@ /* */ /* */ /* */ -/* (C) 1998-2007 Ullrich von Bassewitz */ +/* (C) 1998-2008 Ullrich von Bassewitz */ /* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ @@ -65,7 +65,7 @@ unsigned char DbgSyms = 0; /* Add debug symbols */ unsigned char Listing = 0; /* Create listing file */ unsigned char LineCont = 0; /* Allow line continuation */ -/* Emulation features */ +/* Emulation features */ unsigned char DollarIsPC = 0; /* Allow the $ symbol as current PC */ unsigned char NoColonLabels = 0; /* Allow labels without a colon */ unsigned char LooseStringTerm = 0; /* Allow ' as string terminator */ @@ -77,6 +77,7 @@ unsigned char PCAssignment = 0; /* Allow "* = $XXX" or "$ = $XXX" */ unsigned char MissingCharTerm = 0; /* Allow lda #'a (no closing term) */ unsigned char UbiquitousIdents = 0; /* Allow ubiquitous identifiers */ unsigned char OrgPerSeg = 0; /* Make .org local to current seg */ +unsigned char CComments = 0; /* Allow C like comments */ /* Misc stuff */ const char Copyright[] = "(C) Copyright 1998-2005 Ullrich von Bassewitz"; diff --git a/src/ca65/global.h b/src/ca65/global.h index 3d286c408..92d83b9af 100644 --- a/src/ca65/global.h +++ b/src/ca65/global.h @@ -6,7 +6,7 @@ /* */ /* */ /* */ -/* (C) 1998-2007 Ullrich von Bassewitz */ +/* (C) 1998-2008 Ullrich von Bassewitz */ /* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ @@ -74,6 +74,7 @@ extern unsigned char PCAssignment; /* Allow "* = $XXX" or "$ = $XXX" */ extern unsigned char MissingCharTerm; /* Allow lda #'a (no closing term) */ extern unsigned char UbiquitousIdents; /* Allow ubiquitous identifiers */ extern unsigned char OrgPerSeg; /* Make .org local to current seg */ +extern unsigned char CComments; /* Allow C like comments */ /* Misc stuff */ extern const char Copyright[]; /* Copyright string */ diff --git a/src/ca65/scanner.c b/src/ca65/scanner.c index 51cc998bc..c1fe25189 100644 --- a/src/ca65/scanner.c +++ b/src/ca65/scanner.c @@ -1063,7 +1063,7 @@ CharAgain: NextChar (); if (C != '*') { Tok = TOK_DIV; - } else { + } else if (CComments) { /* Remember the position, then skip the '*' */ FilePos Pos = CurPos; NextChar (); @@ -1071,14 +1071,14 @@ CharAgain: while (C != '*') { if (C == EOF) { PError (&Pos, "Unterminated comment"); - goto Again; + goto CharAgain; } NextChar (); } NextChar (); } while (C != '/'); NextChar (); - goto Again; + goto Again; } return; -- 2.39.5