printf() now works!
Fixed a bug in pointer sizing. git-svn-id: http://picoc.googlecode.com/svn/trunk@98 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
parent
4821d689ad
commit
7f6503d1e0
|
@ -175,16 +175,14 @@ void IntrinsicInit(struct Table *GlobalTable)
|
|||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
void IntrinsicHostPrintf(const char *Format, ...)
|
||||
{
|
||||
va_list Args;
|
||||
|
||||
va_start(Args, Format);
|
||||
vStrPrintf(Format, Args);
|
||||
IntrinsicHostVPrintf(Format, Args);
|
||||
va_end(Args);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* printf for compiler error reporting */
|
||||
void IntrinsicHostVPrintf(const char *Format, va_list Args)
|
||||
|
|
12
picoc.c
12
picoc.c
|
@ -15,11 +15,11 @@ void ProgramFail(struct ParseState *Parser, const char *Message, ...)
|
|||
va_list Args;
|
||||
|
||||
if (Parser != NULL)
|
||||
printf("%s:%d: ", Parser->FileName, Parser->Line);
|
||||
IntrinsicHostPrintf("%s:%d: ", Parser->FileName, Parser->Line);
|
||||
|
||||
va_start(Args, Message);
|
||||
vprintf(Message, Args);
|
||||
printf("\n");
|
||||
IntrinsicHostVPrintf(Message, Args);
|
||||
IntrinsicHostPrintf("\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -28,10 +28,10 @@ void LexFail(struct LexState *Lexer, const char *Message, ...)
|
|||
{
|
||||
va_list Args;
|
||||
|
||||
printf("%s:%d: ", Lexer->FileName, Lexer->Line);
|
||||
IntrinsicHostPrintf("%s:%d: ", Lexer->FileName, Lexer->Line);
|
||||
va_start(Args, Message);
|
||||
vprintf(Message, Args);
|
||||
printf("\n");
|
||||
IntrinsicHostVPrintf(Message, Args);
|
||||
IntrinsicHostPrintf("\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
1
picoc.h
1
picoc.h
|
@ -262,6 +262,7 @@ struct ValueType *TypeGetMatching(struct ParseState *Parser, struct ValueType *P
|
|||
|
||||
/* intrinsic.c */
|
||||
void IntrinsicInit(struct Table *GlobalTable);
|
||||
void IntrinsicHostPrintf(const char *Format, ...);
|
||||
void IntrinsicHostVPrintf(const char *Format, va_list Args);
|
||||
|
||||
/* heap.c */
|
||||
|
|
2
table.c
2
table.c
|
@ -8,7 +8,7 @@ char *StrEmpty = NULL;
|
|||
/* initialise the shared string system */
|
||||
void TableInit()
|
||||
{
|
||||
TableInit(&StringTable, &StringHashTable[0], STRING_TABLE_SIZE, TRUE);
|
||||
TableInitTable(&StringTable, &StringHashTable[0], STRING_TABLE_SIZE, TRUE);
|
||||
StrEmpty = TableStrRegister("");
|
||||
}
|
||||
|
||||
|
|
2
type.c
2
type.c
|
@ -97,7 +97,7 @@ void TypeInit()
|
|||
TypeAddBaseType(&MacroType, TypeMacro, sizeof(int));
|
||||
TypeAddBaseType(&Type_Type, TypeType, sizeof(struct ValueType *));
|
||||
TypeAddBaseType(&CharType, TypeChar, sizeof(char));
|
||||
CharPtrType = TypeAdd(NULL, &CharType, TypePointer, 0, StrEmpty, sizeof(char));
|
||||
CharPtrType = TypeAdd(NULL, &CharType, TypePointer, 0, StrEmpty, sizeof(struct PointerValue));
|
||||
CharArrayType = TypeAdd(NULL, &CharType, TypeArray, 0, StrEmpty, sizeof(char));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue