diff --git a/library_unix.c b/library_unix.c index d28531b..47b455b 100644 --- a/library_unix.c +++ b/library_unix.c @@ -2,7 +2,6 @@ void PlatformLibraryInit() { -#if 0 struct ParseState Parser; char *Identifier; struct ValueType *ParsedType; @@ -15,12 +14,10 @@ void PlatformLibraryInit() LexInitParser(&Parser, Tokens, IntrinsicName, 1, TRUE); TypeParse(&Parser, &ParsedType, &Identifier); HeapFree(Tokens); -#endif } void ShowComplex(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) { -#if 0 struct Value *ComplexVal = Param[0]->Val->Pointer.Segment; /* dereferences the pointer */ struct Value *RealOffset; struct Value *ComplexOffset; @@ -29,7 +26,7 @@ void ShowComplex(struct ParseState *Parser, struct Value *ReturnValue, struct Va struct ValueType *StructComplexType; /* find the type */ - StructComplexType = TypeGetMatching(Parser, NULL, TypeStruct, 0, TableStrRegister("complex")); + StructComplexType = TypeGetMatching(Parser, &UberType, TypeStruct, 0, TableStrRegister("complex")); /* get the real and complex members */ TableGet(StructComplexType->Members, TableStrRegister("i"), &RealOffset); @@ -42,13 +39,12 @@ void ShowComplex(struct ParseState *Parser, struct Value *ReturnValue, struct Va PrintInt(RealPart, PlatformPutc); PlatformPutc(','); PrintInt(ComplexPart, PlatformPutc); -#endif } /* list of all library functions and their prototypes */ struct LibraryFunction PlatformLibrary[] = { -// { ShowComplex, "void ShowComplex(struct complex *)" }, + { ShowComplex, "void ShowComplex(struct complex *)" }, { NULL, NULL } }; diff --git a/picoc.c b/picoc.c index 867ef67..e7a84b7 100644 --- a/picoc.c +++ b/picoc.c @@ -9,8 +9,8 @@ void Initialise() LexInit(); TypeInit(); LibraryInit(&GlobalTable, "c library", &CLibrary); - LibraryInit(&GlobalTable, "platform library", &PlatformLibrary); PlatformLibraryInit(); + LibraryInit(&GlobalTable, "platform library", &PlatformLibrary); } /* free memory */ diff --git a/picoc.h b/picoc.h index bdb0a19..c3b01b4 100644 --- a/picoc.h +++ b/picoc.h @@ -228,6 +228,7 @@ typedef void CharWriter(unsigned char); /* globals */ extern struct Table GlobalTable; extern struct StackFrame *TopStackFrame; +extern struct ValueType UberType; extern struct ValueType IntType; extern struct ValueType CharType; #ifndef NO_FP