Changed multi-line C comments into another style.
The left side doesn't look unbalanced.
This commit is contained in:
110
src/ca65/macro.c
110
src/ca65/macro.c
@@ -70,9 +70,9 @@ static const void* HT_GetKey (const void* Entry);
|
||||
|
||||
static int HT_Compare (const void* Key1, const void* Key2);
|
||||
/* Compare two keys. The function must return a value less than zero if
|
||||
* Key1 is smaller than Key2, zero if both are equal, and a value greater
|
||||
* than zero if Key1 is greater then Key2.
|
||||
*/
|
||||
** Key1 is smaller than Key2, zero if both are equal, and a value greater
|
||||
** than zero if Key1 is greater then Key2.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -176,9 +176,9 @@ static const void* HT_GetKey (const void* Entry)
|
||||
|
||||
static int HT_Compare (const void* Key1, const void* Key2)
|
||||
/* Compare two keys. The function must return a value less than zero if
|
||||
* Key1 is smaller than Key2, zero if both are equal, and a value greater
|
||||
* than zero if Key1 is greater then Key2.
|
||||
*/
|
||||
** Key1 is smaller than Key2, zero if both are equal, and a value greater
|
||||
** than zero if Key1 is greater then Key2.
|
||||
*/
|
||||
{
|
||||
return SB_Compare (Key1, Key2);
|
||||
}
|
||||
@@ -399,8 +399,8 @@ void MacDef (unsigned Style)
|
||||
return;
|
||||
} else if (!UbiquitousIdents && FindInstruction (&CurTok.SVal) >= 0) {
|
||||
/* The identifier is a name of a 6502 instruction, which is not
|
||||
* allowed if not explicitly enabled.
|
||||
*/
|
||||
** allowed if not explicitly enabled.
|
||||
*/
|
||||
Error ("Cannot use an instruction as macro name");
|
||||
MacSkipDef (Style);
|
||||
return;
|
||||
@@ -423,8 +423,8 @@ void MacDef (unsigned Style)
|
||||
NextTok ();
|
||||
|
||||
/* If we have a DEFINE style macro, we may have parameters in braces,
|
||||
* otherwise we may have parameters without braces.
|
||||
*/
|
||||
** otherwise we may have parameters without braces.
|
||||
*/
|
||||
if (Style == MAC_STYLE_CLASSIC) {
|
||||
HaveParams = 1;
|
||||
} else {
|
||||
@@ -476,8 +476,8 @@ void MacDef (unsigned Style)
|
||||
}
|
||||
|
||||
/* For class macros, we expect a separator token, for define style macros,
|
||||
* we expect the closing paren.
|
||||
*/
|
||||
** we expect the closing paren.
|
||||
*/
|
||||
if (Style == MAC_STYLE_CLASSIC) {
|
||||
ConsumeSep ();
|
||||
} else if (HaveParams) {
|
||||
@@ -485,10 +485,10 @@ void MacDef (unsigned Style)
|
||||
}
|
||||
|
||||
/* Preparse the macro body. We will read the tokens until we reach end of
|
||||
* file, or a .endmacro (or end of line for DEFINE style macros) and store
|
||||
* them into an token list internal to the macro. For classic macros, there
|
||||
* the .LOCAL command is detected and removed at this time.
|
||||
*/
|
||||
** file, or a .endmacro (or end of line for DEFINE style macros) and store
|
||||
** them into an token list internal to the macro. For classic macros, there
|
||||
** the .LOCAL command is detected and removed at this time.
|
||||
*/
|
||||
while (1) {
|
||||
|
||||
/* Check for end of macro */
|
||||
@@ -597,8 +597,8 @@ Done:
|
||||
|
||||
void MacUndef (const StrBuf* Name, unsigned char Style)
|
||||
/* Undefine the macro with the given name and style. A style mismatch is
|
||||
* treated as if the macro didn't exist.
|
||||
*/
|
||||
** treated as if the macro didn't exist.
|
||||
*/
|
||||
{
|
||||
/* Search for the macro */
|
||||
Macro* M = HT_Find (&MacroTab, Name);
|
||||
@@ -624,9 +624,9 @@ void MacUndef (const StrBuf* Name, unsigned char Style)
|
||||
|
||||
static int MacExpand (void* Data)
|
||||
/* If we're currently expanding a macro, set the the scanner token and
|
||||
* attribute to the next value and return true. If we are not expanding
|
||||
* a macro, return false.
|
||||
*/
|
||||
** attribute to the next value and return true. If we are not expanding
|
||||
** a macro, return false.
|
||||
*/
|
||||
{
|
||||
/* Cast the Data pointer to the actual data structure */
|
||||
MacExp* Mac = (MacExp*) Data;
|
||||
@@ -645,8 +645,8 @@ static int MacExpand (void* Data)
|
||||
}
|
||||
|
||||
/* We're expanding a macro. Check if we are expanding one of the
|
||||
* macro parameters.
|
||||
*/
|
||||
** macro parameters.
|
||||
*/
|
||||
ExpandParam:
|
||||
if (Mac->ParamExp) {
|
||||
|
||||
@@ -674,8 +674,8 @@ ExpandParam:
|
||||
}
|
||||
|
||||
/* We're not expanding macro parameters. Check if we have tokens left from
|
||||
* the macro itself.
|
||||
*/
|
||||
** the macro itself.
|
||||
*/
|
||||
if (Mac->Exp) {
|
||||
|
||||
/* Use next macro token */
|
||||
@@ -716,10 +716,10 @@ ExpandParam:
|
||||
while (I) {
|
||||
if (SB_Compare (&CurTok.SVal, &I->Id) == 0) {
|
||||
/* This is in fact a local symbol, change the name. Be sure
|
||||
* to generate a local label name if the original name was
|
||||
* a local label, and also generate a name that cannot be
|
||||
* generated by a user.
|
||||
*/
|
||||
** to generate a local label name if the original name was
|
||||
** a local label, and also generate a name that cannot be
|
||||
** generated by a user.
|
||||
*/
|
||||
if (SB_At (&I->Id, 0) == LocalStart) {
|
||||
/* Must generate a local symbol */
|
||||
SB_Printf (&CurTok.SVal, "%cLOCAL-MACRO_SYMBOL-%04X",
|
||||
@@ -753,14 +753,14 @@ ExpandParam:
|
||||
Mac->Final = 0;
|
||||
|
||||
/* Problem: When a .define style macro is expanded within the call
|
||||
* of a classic one, the latter may be terminated and removed while
|
||||
* the expansion of the .define style macro is still active. Because
|
||||
* line info slots are "stacked", this runs into a CHECK FAILED. For
|
||||
* now, we will fix that by removing the .define style macro expansion
|
||||
* immediately, once the final token is placed. The better solution
|
||||
* would probably be to not require AllocLineInfoSlot/FreeLineInfoSlot
|
||||
* to be called in FIFO order, but this is a bigger change.
|
||||
*/
|
||||
** of a classic one, the latter may be terminated and removed while
|
||||
** the expansion of the .define style macro is still active. Because
|
||||
** line info slots are "stacked", this runs into a CHECK FAILED. For
|
||||
** now, we will fix that by removing the .define style macro expansion
|
||||
** immediately, once the final token is placed. The better solution
|
||||
** would probably be to not require AllocLineInfoSlot/FreeLineInfoSlot
|
||||
** to be called in FIFO order, but this is a bigger change.
|
||||
*/
|
||||
/* End of macro expansion and pop the input function */
|
||||
FreeMacExp (Mac);
|
||||
PopInput ();
|
||||
@@ -836,8 +836,8 @@ static void StartExpClassic (MacExp* E)
|
||||
++E->ParamCount;
|
||||
|
||||
/* If the macro argument was enclosed in curly braces, end-of-line
|
||||
* is an error. Skip the closing curly brace.
|
||||
*/
|
||||
** is an error. Skip the closing curly brace.
|
||||
*/
|
||||
if (Term == TOK_RCURLY) {
|
||||
if (CurTok.Tok == TOK_SEP) {
|
||||
Error ("End of line encountered within macro argument");
|
||||
@@ -867,8 +867,8 @@ static void StartExpDefine (MacExp* E)
|
||||
/* Start expanding a DEFINE style macro */
|
||||
{
|
||||
/* A define style macro must be called with as many actual parameters
|
||||
* as there are formal ones. Get the parameter count.
|
||||
*/
|
||||
** as there are formal ones. Get the parameter count.
|
||||
*/
|
||||
unsigned Count = E->M->ParamCount;
|
||||
|
||||
/* Skip the current token */
|
||||
@@ -915,8 +915,8 @@ static void StartExpDefine (MacExp* E)
|
||||
++E->ParamCount;
|
||||
|
||||
/* If the macro argument was enclosed in curly braces, end-of-line
|
||||
* is an error. Skip the closing curly brace.
|
||||
*/
|
||||
** is an error. Skip the closing curly brace.
|
||||
*/
|
||||
if (Term == TOK_RCURLY) {
|
||||
if (TokIsSep (CurTok.Tok)) {
|
||||
Error ("End of line encountered within macro argument");
|
||||
@@ -936,10 +936,10 @@ static void StartExpDefine (MacExp* E)
|
||||
}
|
||||
|
||||
/* Macro expansion will overwrite the current token. This is a problem
|
||||
* for define style macros since these are called from the scanner level.
|
||||
* To avoid it, remember the current token and re-insert it, once macro
|
||||
* expansion is done.
|
||||
*/
|
||||
** for define style macros since these are called from the scanner level.
|
||||
** To avoid it, remember the current token and re-insert it, once macro
|
||||
** expansion is done.
|
||||
*/
|
||||
E->Final = NewTokNode ();
|
||||
|
||||
/* Insert a new token input function */
|
||||
@@ -963,8 +963,8 @@ void MacExpandStart (Macro* M)
|
||||
}
|
||||
|
||||
/* Don't allow too many nested macro expansions - otherwise it is possible
|
||||
* to force an endless loop and assembler crash.
|
||||
*/
|
||||
** to force an endless loop and assembler crash.
|
||||
*/
|
||||
if (MacExpansions >= MAX_MACEXPANSIONS) {
|
||||
Error ("Too many nested macro expansions");
|
||||
return;
|
||||
@@ -997,8 +997,8 @@ void MacAbort (void)
|
||||
|
||||
Macro* FindMacro (const StrBuf* Name)
|
||||
/* Try to find the macro with the given name and return it. If no macro with
|
||||
* this name was found, return NULL.
|
||||
*/
|
||||
** this name was found, return NULL.
|
||||
*/
|
||||
{
|
||||
Macro* M = HT_Find (&MacroTab, Name);
|
||||
return (M != 0 && M->Style == MAC_STYLE_CLASSIC)? M : 0;
|
||||
@@ -1008,8 +1008,8 @@ Macro* FindMacro (const StrBuf* Name)
|
||||
|
||||
Macro* FindDefine (const StrBuf* Name)
|
||||
/* Try to find the define style macro with the given name and return it. If no
|
||||
* such macro was found, return NULL.
|
||||
*/
|
||||
** such macro was found, return NULL.
|
||||
*/
|
||||
{
|
||||
Macro* M;
|
||||
|
||||
@@ -1043,8 +1043,8 @@ void DisableDefineStyleMacros (void)
|
||||
|
||||
void EnableDefineStyleMacros (void)
|
||||
/* Re-enable define style macros previously disabled with
|
||||
* DisableDefineStyleMacros.
|
||||
*/
|
||||
** DisableDefineStyleMacros.
|
||||
*/
|
||||
{
|
||||
PRECONDITION (DisableDefines > 0);
|
||||
--DisableDefines;
|
||||
|
||||
Reference in New Issue
Block a user