From 9636ca0b2af7dc7be604ce959b213b2afab1286b Mon Sep 17 00:00:00 2001 From: Joseph Poirier Date: Sat, 13 Jun 2015 19:06:23 -0500 Subject: [PATCH] minor format changes --- lex.c | 12 ++++++++---- parse.c | 12 ++++++++---- platform.c | 3 ++- table.c | 13 +++++++++---- type.c | 6 ++++-- variable.c | 3 ++- 6 files changed, 33 insertions(+), 16 deletions(-) diff --git a/lex.c b/lex.c index 3bca8ac..e69f392 100644 --- a/lex.c +++ b/lex.c @@ -755,7 +755,8 @@ enum LexToken LexGetRawToken(struct ParseState *Parser, struct Value **Value, Token = (enum LexToken)*(unsigned char *)Parser->Pos; } - } while ((Parser->FileName == pc->StrEmpty && Token == TokenEOF) || Token == TokenEndOfLine); + } while ((Parser->FileName == pc->StrEmpty && + Token == TokenEOF) || Token == TokenEndOfLine); Parser->CharacterPos = *((unsigned char *)Parser->Pos + 1); ValueSize = LexTokenSize(Token); @@ -966,7 +967,8 @@ enum LexToken LexGetToken(struct ParseState *Parser, struct Value **Value, break; } - /* if we're going to reject this token, increment the token pointer to the next one */ + /* if we're going to reject this token, increment the token + pointer to the next one */ TryNextToken = (Parser->HashIfEvaluateToLevel < Parser->HashIfLevel && Token != TokenEOF) || WasPreProcToken; if (!IncPos && TryNextToken) @@ -1060,7 +1062,8 @@ void *LexCopyTokens(struct ParseState *StartParser, struct ParseState *EndParser return NewTokens; } -/* indicate that we've completed up to this point in the interactive input and free expired tokens */ +/* indicate that we've completed up to this point in the interactive input + and free expired tokens */ void LexInteractiveClear(Picoc *pc, struct ParseState *Parser) { while (pc->InteractiveHead != NULL) { @@ -1077,7 +1080,8 @@ void LexInteractiveClear(Picoc *pc, struct ParseState *Parser) pc->InteractiveTail = NULL; } -/* indicate that we've completed up to this point in the interactive input and free expired tokens */ +/* indicate that we've completed up to this point in the interactive + input and free expired tokens */ void LexInteractiveCompleted(Picoc *pc, struct ParseState *Parser) { while (pc->InteractiveHead != NULL && diff --git a/parse.c b/parse.c index 321f8c4..2b86ac1 100644 --- a/parse.c +++ b/parse.c @@ -83,7 +83,8 @@ struct Value *ParseFunctionDefinition(struct ParseState *Parser, ProgramFail(Parser, "too many parameters (%d allowed)", PARAMETER_MAX); FuncValue = VariableAllocValueAndData(pc, Parser, - sizeof(struct FuncDef)+sizeof(struct ValueType*)*ParamCount+sizeof(const char*)*ParamCount, + sizeof(struct FuncDef) + sizeof(struct ValueType*)*ParamCount + + sizeof(const char*)*ParamCount, false, NULL, true); FuncValue->Typ = &pc->FunctionType; FuncValue->Val->FuncDef.ReturnType = ReturnType; @@ -582,7 +583,8 @@ enum ParseResult ParseStatement(struct ParseState *Parser, ; - /* take note of where we are and then grab a token to see what statement we have */ + /* take note of where we are and then grab a token to see what + statement we have */ ParserCopy(&PreState, Parser); Token = LexGetToken(Parser, &LexerValue, true); @@ -590,7 +592,8 @@ enum ParseResult ParseStatement(struct ParseState *Parser, case TokenEOF: return ParseResultEOF; case TokenIdentifier: - /* might be a typedef-typed variable declaration or it might be an expression */ + /* might be a typedef-typed variable declaration or it might + be an expression */ if (VariableDefined(Parser->pc, LexerValue->Val->Identifier)) { VariableGet(Parser->pc, Parser, LexerValue->Val->Identifier, &VarValue); if (VarValue->Typ->Base == Type_Type) { @@ -866,7 +869,8 @@ void PicocParse(Picoc *pc, const char *FileName, const char *Source, } /* do the parsing */ - LexInitParser(&Parser, pc, Source, Tokens, RegFileName, RunIt, EnableDebugger); + LexInitParser(&Parser, pc, Source, Tokens, RegFileName, RunIt, + EnableDebugger); do { Ok = ParseStatement(&Parser, true); diff --git a/platform.c b/platform.c index 040b507..bdff573 100644 --- a/platform.c +++ b/platform.c @@ -129,7 +129,8 @@ void PrintSourceTextErrorLine(IOFILE *Stream, const char *FileName, PrintCh(' ', Stream); } } else { - /* assume we're in interactive mode - try to make the arrow match up with the input text */ + /* assume we're in interactive mode - try to make the arrow match + up with the input text */ for (CCount = 0; CCount < CharacterPos+(int)strlen(INTERACTIVE_PROMPT_STATEMENT); CCount++) diff --git a/table.c b/table.c index 070692a..993a67d 100644 --- a/table.c +++ b/table.c @@ -42,7 +42,8 @@ void TableInitTable(struct Table *Tbl, struct TableEntry **HashTable, int Size, static struct TableEntry *TableSearch(struct Table *Tbl, const char *Key, int *AddAt) { - int HashValue = ((unsigned long)Key) % Tbl->Size; /* shared strings have unique addresses so we don't need to hash them */ + /* shared strings have unique addresses so we don't need to hash them */ + int HashValue = ((unsigned long)Key) % Tbl->Size; struct TableEntry *Entry; for (Entry = Tbl->HashTable[HashValue]; Entry != NULL; Entry = Entry->Next) { @@ -102,7 +103,8 @@ int TableGet(struct Table *Tbl, const char *Key, struct Value **Val, /* remove an entry from the table */ struct Value *TableDelete(Picoc *pc, struct Table *Tbl, const char *Key) { - int HashValue = ((unsigned long)Key) % Tbl->Size; /* shared strings have unique addresses so we don't need to hash them */ + /* shared strings have unique addresses so we don't need to hash them */ + int HashValue = ((unsigned long)Key) % Tbl->Size; struct TableEntry **EntryPtr; for (EntryPtr = &Tbl->HashTable[HashValue]; @@ -144,9 +146,12 @@ char *TableSetIdentifier(Picoc *pc, struct Table *Tbl, const char *Ident, int Id if (FoundEntry != NULL) return &FoundEntry->p.Key[0]; - else { /* add it to the table - we economise by not allocating the whole structure here */ + else { + /* add it to the table - we economise by not allocating + the whole structure here */ struct TableEntry *NewEntry = HeapAllocMem(pc, - sizeof(struct TableEntry) - sizeof(union TableEntryPayload) + IdentLen + 1); + sizeof(struct TableEntry) - + sizeof(union TableEntryPayload) + IdentLen + 1); if (NewEntry == NULL) ProgramFailNoParser(pc, "(TableSetIdentifier) out of memory"); diff --git a/type.c b/type.c index 1bc80b8..0bc55d6 100644 --- a/type.c +++ b/type.c @@ -302,7 +302,8 @@ struct ValueType *TypeCreateOpaqueStruct(Picoc *pc, struct ParseState *Parser, Typ->Members = VariableAlloc(pc, Parser, sizeof(struct Table)+STRUCT_TABLE_SIZE*sizeof(struct TableEntry), true); - Typ->Members->HashTable = (struct TableEntry**)((char*)Typ->Members + sizeof(struct Table)); + Typ->Members->HashTable = (struct TableEntry**)((char*)Typ->Members + + sizeof(struct Table)); TableInitTable(Typ->Members, (struct TableEntry**)((char*)Typ->Members+sizeof(struct Table)), STRUCT_TABLE_SIZE, true); @@ -460,7 +461,8 @@ int TypeParseFront(struct ParseState *Parser, struct ValueType **Typ, return true; } -/* parse a type - the part at the end after the identifier. eg. array specifications etc. */ +/* parse a type - the part at the end after the identifier. eg. + array specifications etc. */ struct ValueType *TypeParseBack(struct ParseState *Parser, struct ValueType *FromType) { diff --git a/variable.c b/variable.c index ed766d0..857d923 100644 --- a/variable.c +++ b/variable.c @@ -373,7 +373,8 @@ struct Value *VariableDefineButIgnoreIdentical(struct ParseState *Parser, if (Parser->Line != 0 && TableGet((pc->TopStackFrame == NULL) ? &pc->GlobalTable : &pc->TopStackFrame->LocalTable, Ident, &ExistingValue, &DeclFileName, &DeclLine, &DeclColumn) - && DeclFileName == Parser->FileName && DeclLine == Parser->Line && DeclColumn == Parser->CharacterPos) + && DeclFileName == Parser->FileName && DeclLine == Parser->Line && + DeclColumn == Parser->CharacterPos) return ExistingValue; else return VariableDefine(Parser->pc, Parser, Ident, NULL, Typ, true);