Skip to content

Commit

Permalink
initialize
Browse files Browse the repository at this point in the history
  • Loading branch information
jpoirier committed Jun 19, 2015
1 parent 26b21d0 commit 9c05060
Show file tree
Hide file tree
Showing 19 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ void PlatformLibraryInit()
```

This code takes the structure definition in StructDefinition and runs the lexical
analyser over it. This returns some lexical tokens. Then we initialise the parser
analyser over it. This returns some lexical tokens. Then we initialize the parser
and have it parse the type of the structure definition from the tokens we made.
That's enough to define the structure in the system. Finally we free the tokens.

Expand Down
2 changes: 1 addition & 1 deletion cstdlib/stdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct StdVararg
int NumArgs;
};

/* initialises the I/O system so error reporting works */
/* initializes the I/O system so error reporting works */
void BasicIOInit(Picoc *pc)
{
pc->CStdOut = stdout;
Expand Down
2 changes: 1 addition & 1 deletion debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#define BREAKPOINT_HASH(p) (((unsigned long)(p)->FileName) ^ (((p)->Line << 16) | ((p)->CharacterPos << 16)))

#ifdef DEBUGGER
/* initialise the debugger by clearing the breakpoint table */
/* initialize the debugger by clearing the breakpoint table */
void DebugInit(Picoc *pc)
{
TableInitTable(&pc->BreakpointTable, &pc->BreakpointHashTable[0],
Expand Down
2 changes: 1 addition & 1 deletion heap.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void ShowBigList(Picoc *pc)
}
#endif

/* initialise the stack and heap storage */
/* initialize the stack and heap storage */
void HeapInit(Picoc *pc, int StackOrHeapSize)
{
int Count;
Expand Down
2 changes: 1 addition & 1 deletion include.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "interpreter.h"


/* initialise the built-in include libraries */
/* initialize the built-in include libraries */
void IncludeInit(Picoc *pc)
{
IncludeRegister(pc, "ctype.h", NULL, &StdCtypeFunctions[0], NULL);
Expand Down
2 changes: 1 addition & 1 deletion interpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ extern void LibPrintf(struct ParseState *Parser, struct Value *ReturnValue,
/* the following are defined in picoc.h:
* void PicocCallMain(int argc, char **argv);
* int PicocPlatformSetExitPoint();
* void PicocInitialise(int StackSize);
* void PicocInitialize(int StackSize);
* void PicocCleanup();
* void PicocPlatformScanFile(const char *FileName);
* extern int PicocExitValue; */
Expand Down
2 changes: 1 addition & 1 deletion lex.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ static struct ReservedWord ReservedWords[] = {



/* initialise the lexer */
/* initialize the lexer */
void LexInit(Picoc *pc)
{
int Count;
Expand Down
22 changes: 11 additions & 11 deletions parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
static enum ParseResult ParseStatementMaybeRun(struct ParseState *Parser,
int Condition, int CheckTrailingSemicolon);
static int ParseCountParams(struct ParseState *Parser);
static int ParseArrayInitialiser(struct ParseState *Parser,
static int ParseArrayInitializer(struct ParseState *Parser,
struct Value *NewVariable, int DoAssignment);
static void ParseDeclarationAssignment(struct ParseState *Parser,
struct Value *NewVariable, int DoAssignment);
Expand Down Expand Up @@ -186,8 +186,8 @@ struct Value *ParseFunctionDefinition(struct ParseState *Parser,
return FuncValue;
}

/* parse an array initialiser and assign to a variable */
int ParseArrayInitialiser(struct ParseState *Parser, struct Value *NewVariable,
/* parse an array initializer and assign to a variable */
int ParseArrayInitializer(struct ParseState *Parser, struct Value *NewVariable,
int DoAssignment)
{
int ArrayIndex = 0;
Expand All @@ -200,7 +200,7 @@ int ParseArrayInitialiser(struct ParseState *Parser, struct Value *NewVariable,
int NumElements;

ParserCopy(&CountParser, Parser);
NumElements = ParseArrayInitialiser(&CountParser, NewVariable, false);
NumElements = ParseArrayInitializer(&CountParser, NewVariable, false);

if (NewVariable->Typ->Base != TypeArray)
AssignFail(Parser, "%t from array initializer", NewVariable->Typ,
Expand All @@ -218,11 +218,11 @@ int ParseArrayInitialiser(struct ParseState *Parser, struct Value *NewVariable,
#endif
}

/* parse the array initialiser */
/* parse the array initializer */
Token = LexGetToken(Parser, NULL, false);
while (Token != TokenRightBrace) {
if (LexGetToken(Parser, NULL, false) == TokenLeftBrace) {
/* this is a sub-array initialiser */
/* this is a sub-array initializer */
int SubArraySize = 0;
struct Value *SubArray = NewVariable;
if (Parser->Mode == RunModeRun && DoAssignment) {
Expand All @@ -245,7 +245,7 @@ int ParseArrayInitialiser(struct ParseState *Parser, struct Value *NewVariable,
ProgramFail(Parser, "too many array elements");
}
LexGetToken(Parser, NULL, true);
ParseArrayInitialiser(Parser, SubArray, DoAssignment);
ParseArrayInitializer(Parser, SubArray, DoAssignment);
} else {
struct Value *ArrayElement = NULL;

Expand Down Expand Up @@ -281,7 +281,7 @@ int ParseArrayInitialiser(struct ParseState *Parser, struct Value *NewVariable,
true, NewVariable);
}

/* this is a normal expression initialiser */
/* this is a normal expression initializer */
if (!ExpressionParse(Parser, &CValue))
ProgramFail(Parser, "expression expected");

Expand Down Expand Up @@ -318,11 +318,11 @@ void ParseDeclarationAssignment(struct ParseState *Parser,
struct Value *CValue;

if (LexGetToken(Parser, NULL, false) == TokenLeftBrace) {
/* this is an array initialiser */
/* this is an array initializer */
LexGetToken(Parser, NULL, true);
ParseArrayInitialiser(Parser, NewVariable, DoAssignment);
ParseArrayInitializer(Parser, NewVariable, DoAssignment);
} else {
/* this is a normal expression initialiser */
/* this is a normal expression initializer */
if (!ExpressionParse(Parser, &CValue))
ProgramFail(Parser, "expression expected");

Expand Down
2 changes: 1 addition & 1 deletion picoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ int main(int argc, char **argv)
return 0;
}

PicocInitialise(&pc, StackSize);
PicocInitialize(&pc, StackSize);

if (strcmp(argv[ParamCount], "-s") == 0) {
DontRunMain = true;
Expand Down
2 changes: 1 addition & 1 deletion picoc.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ extern void PicocParseInteractive(Picoc *pc);

/* platform.c */
extern void PicocCallMain(Picoc *pc, int argc, char **argv);
extern void PicocInitialise(Picoc *pc, int StackSize);
extern void PicocInitialize(Picoc *pc, int StackSize);
extern void PicocCleanup(Picoc *pc);
extern void PicocPlatformScanFile(Picoc *pc, const char *FileName);

Expand Down
6 changes: 3 additions & 3 deletions platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ static int gEnableDebugger = false;
#endif


/* initialise everything */
void PicocInitialise(Picoc *pc, int StackSize)
/* initialize everything */
void PicocInitialize(Picoc *pc, int StackSize)
{
memset(pc, '\0', sizeof(*pc));
PlatformInit(pc);
Expand Down Expand Up @@ -255,7 +255,7 @@ void PlatformVPrintf(IOFILE *Stream, const char *Format, va_list Args)
}

/* make a new temporary name. takes a static buffer of char [7] as a parameter.
* should be initialised to "XX0000"
* should be initialized to "XX0000"
* where XX can be any characters */
char *PlatformMakeTempName(Picoc *pc, char *TempNameBuffer)
{
Expand Down
4 changes: 2 additions & 2 deletions table.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ static struct TableEntry *TableSearch(struct Table *Tbl, const char *Key,
static struct TableEntry *TableSearchIdentifier(struct Table *Tbl,
const char *Key, int Len, int *AddAt);

/* initialise the shared string system */
/* initialize the shared string system */
void TableInit(Picoc *pc)
{
TableInitTable(&pc->StringTable, &pc->StringHashTable[0],
Expand All @@ -35,7 +35,7 @@ unsigned int TableHash(const char *Key, int Len)
return Hash;
}

/* initialise a table */
/* initialize a table */
void TableInitTable(struct Table *Tbl, struct TableEntry **HashTable, int Size,
int OnHeap)
{
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ TESTS= 00_assignment.test \
33_ternary_op.test \
34_array_assignment.test \
35_sizeof.test \
36_array_initialisers.test \
36_array_initializers.test \
37_sprintf.test \
38_multiple_array_index.test \
39_typedef.test \
Expand All @@ -49,7 +49,7 @@ TESTS= 00_assignment.test \
51_static.test \
52_unnamed_enum.test \
54_goto.test \
55_array_initialiser.test \
55_array_initializer.test \
56_cross_structure.test \
57_macro_bug.test \
58_return_outside.test \
Expand Down
2 changes: 1 addition & 1 deletion type.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ void TypeAddBaseType(Picoc *pc, struct ValueType *TypeNode, enum BaseType Base,
pc->UberType.DerivedTypeList = TypeNode;
}

/* initialise the type system */
/* initialize the type system */
void TypeInit(Picoc *pc)
{
struct IntAlign {char x; int y;} ia;
Expand Down
2 changes: 1 addition & 1 deletion variable.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#define MAX_TMP_COPY_BUF (256)


/* initialise the variable system */
/* initialize the variable system */
void VariableInit(Picoc *pc)
{
TableInitTable(&(pc->GlobalTable), &(pc->GlobalHashTable)[0],
Expand Down

0 comments on commit 9c05060

Please sign in to comment.