formatting
This commit is contained in:
parent
f551e28a49
commit
6ed4aa1b63
4
debug.c
4
debug.c
|
@ -21,7 +21,7 @@ void DebugCleanup(Picoc *pc)
|
||||||
|
|
||||||
for (Count = 0; Count < pc->BreakpointTable.Size; Count++) {
|
for (Count = 0; Count < pc->BreakpointTable.Size; Count++) {
|
||||||
for (Entry = pc->BreakpointHashTable[Count]; Entry != NULL;
|
for (Entry = pc->BreakpointHashTable[Count]; Entry != NULL;
|
||||||
Entry = NextEntry) {
|
Entry = NextEntry) {
|
||||||
NextEntry = Entry->Next;
|
NextEntry = Entry->Next;
|
||||||
HeapFreeMem(pc, Entry);
|
HeapFreeMem(pc, Entry);
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ static struct TableEntry *DebugTableSearchBreakpoint(struct ParseState *Parser,
|
||||||
int HashValue = BREAKPOINT_HASH(Parser) % pc->BreakpointTable.Size;
|
int HashValue = BREAKPOINT_HASH(Parser) % pc->BreakpointTable.Size;
|
||||||
|
|
||||||
for (Entry = pc->BreakpointHashTable[HashValue];
|
for (Entry = pc->BreakpointHashTable[HashValue];
|
||||||
Entry != NULL; Entry = Entry->Next) {
|
Entry != NULL; Entry = Entry->Next) {
|
||||||
if (Entry->p.b.FileName == Parser->FileName &&
|
if (Entry->p.b.FileName == Parser->FileName &&
|
||||||
Entry->p.b.Line == Parser->Line &&
|
Entry->p.b.Line == Parser->Line &&
|
||||||
Entry->p.b.CharacterPos == Parser->CharacterPos)
|
Entry->p.b.CharacterPos == Parser->CharacterPos)
|
||||||
|
|
6
heap.c
6
heap.c
|
@ -34,7 +34,7 @@ void HeapInit(Picoc *pc, int StackOrHeapSize)
|
||||||
|
|
||||||
pc->StackFrame = &(pc->HeapMemory)[AlignOffset];
|
pc->StackFrame = &(pc->HeapMemory)[AlignOffset];
|
||||||
pc->HeapStackTop = &(pc->HeapMemory)[AlignOffset];
|
pc->HeapStackTop = &(pc->HeapMemory)[AlignOffset];
|
||||||
*(void **)(pc->StackFrame) = NULL;
|
*(void**)(pc->StackFrame) = NULL;
|
||||||
pc->HeapBottom =
|
pc->HeapBottom =
|
||||||
&(pc->HeapMemory)[StackOrHeapSize-sizeof(ALIGN_TYPE)+AlignOffset];
|
&(pc->HeapMemory)[StackOrHeapSize-sizeof(ALIGN_TYPE)+AlignOffset];
|
||||||
pc->FreeListBig = NULL;
|
pc->FreeListBig = NULL;
|
||||||
|
@ -98,7 +98,7 @@ void HeapPushStackFrame(Picoc *pc)
|
||||||
#ifdef DEBUG_HEAP
|
#ifdef DEBUG_HEAP
|
||||||
printf("Adding stack frame at 0x%lx\n", (unsigned long)pc->HeapStackTop);
|
printf("Adding stack frame at 0x%lx\n", (unsigned long)pc->HeapStackTop);
|
||||||
#endif
|
#endif
|
||||||
*(void **)pc->HeapStackTop = pc->StackFrame;
|
*(void**)pc->HeapStackTop = pc->StackFrame;
|
||||||
pc->StackFrame = pc->HeapStackTop;
|
pc->StackFrame = pc->HeapStackTop;
|
||||||
pc->HeapStackTop = (void*)((char*)pc->HeapStackTop +
|
pc->HeapStackTop = (void*)((char*)pc->HeapStackTop +
|
||||||
MEM_ALIGN(sizeof(ALIGN_TYPE)));
|
MEM_ALIGN(sizeof(ALIGN_TYPE)));
|
||||||
|
@ -108,7 +108,7 @@ void HeapPushStackFrame(Picoc *pc)
|
||||||
frame. can return NULL */
|
frame. can return NULL */
|
||||||
int HeapPopStackFrame(Picoc *pc)
|
int HeapPopStackFrame(Picoc *pc)
|
||||||
{
|
{
|
||||||
if (*(void **)pc->StackFrame != NULL) {
|
if (*(void**)pc->StackFrame != NULL) {
|
||||||
pc->HeapStackTop = pc->StackFrame;
|
pc->HeapStackTop = pc->StackFrame;
|
||||||
pc->StackFrame = *(void**)pc->StackFrame;
|
pc->StackFrame = *(void**)pc->StackFrame;
|
||||||
#ifdef DEBUG_HEAP
|
#ifdef DEBUG_HEAP
|
||||||
|
|
|
@ -73,9 +73,9 @@ void PicocCallMain(Picoc *pc, int argc, char **argv)
|
||||||
if (FuncValue->Val->FuncDef.NumParams != 0) {
|
if (FuncValue->Val->FuncDef.NumParams != 0) {
|
||||||
/* define the arguments */
|
/* define the arguments */
|
||||||
VariableDefinePlatformVar(pc, NULL, "__argc", &pc->IntType,
|
VariableDefinePlatformVar(pc, NULL, "__argc", &pc->IntType,
|
||||||
(union AnyValue *)&argc, false);
|
(union AnyValue*)&argc, false);
|
||||||
VariableDefinePlatformVar(pc, NULL, "__argv", pc->CharPtrPtrType,
|
VariableDefinePlatformVar(pc, NULL, "__argv", pc->CharPtrPtrType,
|
||||||
(union AnyValue *)&argv, false);
|
(union AnyValue*)&argv, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FuncValue->Val->FuncDef.ReturnType == &pc->VoidType) {
|
if (FuncValue->Val->FuncDef.ReturnType == &pc->VoidType) {
|
||||||
|
@ -226,7 +226,7 @@ void PlatformVPrintf(IOFILE *Stream, const char *Format, va_list Args)
|
||||||
FPos++;
|
FPos++;
|
||||||
switch (*FPos) {
|
switch (*FPos) {
|
||||||
case 's':
|
case 's':
|
||||||
PrintStr(va_arg(Args, char *), Stream);
|
PrintStr(va_arg(Args, char*), Stream);
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
PrintSimpleInt(va_arg(Args, int), Stream);
|
PrintSimpleInt(va_arg(Args, int), Stream);
|
||||||
|
@ -235,7 +235,7 @@ void PlatformVPrintf(IOFILE *Stream, const char *Format, va_list Args)
|
||||||
PrintCh(va_arg(Args, int), Stream);
|
PrintCh(va_arg(Args, int), Stream);
|
||||||
break;
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
PrintType(va_arg(Args, struct ValueType *), Stream);
|
PrintType(va_arg(Args, struct ValueType*), Stream);
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
PrintFP(va_arg(Args, double), Stream);
|
PrintFP(va_arg(Args, double), Stream);
|
||||||
|
|
2
table.c
2
table.c
|
@ -137,7 +137,7 @@ struct TableEntry *TableSearchIdentifier(struct Table *Tbl,
|
||||||
struct TableEntry *Entry;
|
struct TableEntry *Entry;
|
||||||
|
|
||||||
for (Entry = Tbl->HashTable[HashValue]; Entry != NULL; Entry = Entry->Next) {
|
for (Entry = Tbl->HashTable[HashValue]; Entry != NULL; Entry = Entry->Next) {
|
||||||
if (strncmp(&Entry->p.Key[0], (char *)Key, Len) == 0 &&
|
if (strncmp(&Entry->p.Key[0], (char*)Key, Len) == 0 &&
|
||||||
Entry->p.Key[Len] == '\0')
|
Entry->p.Key[Len] == '\0')
|
||||||
return Entry; /* found */
|
return Entry; /* found */
|
||||||
}
|
}
|
||||||
|
|
2
type.c
2
type.c
|
@ -368,7 +368,7 @@ void TypeParseEnum(struct ParseState *Parser, struct ValueType **Typ)
|
||||||
|
|
||||||
LexGetToken(Parser, NULL, true);
|
LexGetToken(Parser, NULL, true);
|
||||||
(*Typ)->Members = &pc->GlobalTable;
|
(*Typ)->Members = &pc->GlobalTable;
|
||||||
memset((void *)&InitValue, '\0', sizeof(struct Value));
|
memset((void*)&InitValue, '\0', sizeof(struct Value));
|
||||||
InitValue.Typ = &pc->IntType;
|
InitValue.Typ = &pc->IntType;
|
||||||
InitValue.Val = (union AnyValue*)&EnumValue;
|
InitValue.Val = (union AnyValue*)&EnumValue;
|
||||||
do {
|
do {
|
||||||
|
|
|
@ -25,11 +25,11 @@ void VariableFree(Picoc *pc, struct Value *Val)
|
||||||
if (Val->Typ == &pc->FunctionType &&
|
if (Val->Typ == &pc->FunctionType &&
|
||||||
Val->Val->FuncDef.Intrinsic == NULL &&
|
Val->Val->FuncDef.Intrinsic == NULL &&
|
||||||
Val->Val->FuncDef.Body.Pos != NULL)
|
Val->Val->FuncDef.Body.Pos != NULL)
|
||||||
HeapFreeMem(pc, (void *)Val->Val->FuncDef.Body.Pos);
|
HeapFreeMem(pc, (void*)Val->Val->FuncDef.Body.Pos);
|
||||||
|
|
||||||
/* free macro bodies */
|
/* free macro bodies */
|
||||||
if (Val->Typ == &pc->MacroType)
|
if (Val->Typ == &pc->MacroType)
|
||||||
HeapFreeMem(pc, (void *)Val->Val->MacroDef.Body.Pos);
|
HeapFreeMem(pc, (void*)Val->Val->MacroDef.Body.Pos);
|
||||||
|
|
||||||
/* free the AnyValue */
|
/* free the AnyValue */
|
||||||
if (Val->AnyValOnHeap)
|
if (Val->AnyValOnHeap)
|
||||||
|
@ -338,7 +338,7 @@ struct Value *VariableDefineButIgnoreIdentical(struct ParseState *Parser,
|
||||||
|
|
||||||
/* make the mangled static name (avoiding using sprintf()
|
/* make the mangled static name (avoiding using sprintf()
|
||||||
to minimise library impact) */
|
to minimise library impact) */
|
||||||
memset((void *)&MangledName, '\0', sizeof(MangledName));
|
memset((void*)&MangledName, '\0', sizeof(MangledName));
|
||||||
*MNPos++ = '/';
|
*MNPos++ = '/';
|
||||||
strncpy(MNPos, (char*)Parser->FileName, MNEnd - MNPos);
|
strncpy(MNPos, (char*)Parser->FileName, MNEnd - MNPos);
|
||||||
MNPos += strlen(MNPos);
|
MNPos += strlen(MNPos);
|
||||||
|
|
Loading…
Reference in a new issue