Fixed a problem with declarations for libraries not being compatible with
some C90 compilers. git-svn-id: http://picoc.googlecode.com/svn/trunk@449 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
parent
b313de2aa1
commit
5efb924e6a
10
clibrary.c
10
clibrary.c
|
@ -1,7 +1,7 @@
|
|||
#include "picoc.h"
|
||||
|
||||
/* initialise a library */
|
||||
void LibraryInit(struct Table *GlobalTable, const char *LibraryName, struct LibraryFunction (*FuncList)[])
|
||||
void LibraryInit(struct Table *GlobalTable, const char *LibraryName, struct LibraryFunction *FuncList)
|
||||
{
|
||||
struct ParseState Parser;
|
||||
int Count;
|
||||
|
@ -11,13 +11,13 @@ void LibraryInit(struct Table *GlobalTable, const char *LibraryName, struct Libr
|
|||
void *Tokens;
|
||||
const char *IntrinsicName = TableStrRegister("c library");
|
||||
|
||||
for (Count = 0; (*FuncList)[Count].Prototype != NULL; Count++)
|
||||
for (Count = 0; FuncList[Count].Prototype != NULL; Count++)
|
||||
{
|
||||
Tokens = LexAnalyse(IntrinsicName, (*FuncList)[Count].Prototype, strlen((char *)(*FuncList)[Count].Prototype), NULL);
|
||||
LexInitParser(&Parser, (*FuncList)[Count].Prototype, Tokens, IntrinsicName, TRUE);
|
||||
Tokens = LexAnalyse(IntrinsicName, FuncList[Count].Prototype, strlen((char *)FuncList[Count].Prototype), NULL);
|
||||
LexInitParser(&Parser, FuncList[Count].Prototype, Tokens, IntrinsicName, TRUE);
|
||||
TypeParse(&Parser, &ReturnType, &Identifier);
|
||||
NewValue = ParseFunctionDefinition(&Parser, ReturnType, Identifier);
|
||||
NewValue->Val->FuncDef.Intrinsic = (*FuncList)[Count].Func;
|
||||
NewValue->Val->FuncDef.Intrinsic = FuncList[Count].Func;
|
||||
HeapFreeMem(Tokens);
|
||||
}
|
||||
}
|
||||
|
|
16
include.c
16
include.c
|
@ -7,7 +7,7 @@ struct IncludeLibrary
|
|||
{
|
||||
const char *IncludeName;
|
||||
void (*SetupFunction)(void);
|
||||
struct LibraryFunction (*FuncList)[];
|
||||
struct LibraryFunction *FuncList;
|
||||
const char *SetupCSource;
|
||||
struct IncludeLibrary *NextLib;
|
||||
};
|
||||
|
@ -18,13 +18,13 @@ struct IncludeLibrary *IncludeLibList = NULL;
|
|||
/* initialise the built-in include libraries */
|
||||
void IncludeInit()
|
||||
{
|
||||
IncludeRegister("ctype.h", NULL, &StdCtypeFunctions, NULL);
|
||||
IncludeRegister("ctype.h", NULL, &StdCtypeFunctions[0], NULL);
|
||||
IncludeRegister("errno.h", &StdErrnoSetupFunc, NULL, NULL);
|
||||
IncludeRegister("stdio.h", &StdioSetupFunc, &StdioFunctions, StdioDefs);
|
||||
IncludeRegister("math.h", &MathSetupFunc, &MathFunctions, NULL);
|
||||
IncludeRegister("string.h", &StringSetupFunc, &StringFunctions, NULL);
|
||||
IncludeRegister("stdlib.h", &StdlibSetupFunc, &StdlibFunctions, NULL);
|
||||
IncludeRegister("time.h", &StdTimeSetupFunc, &StdTimeFunctions, StdTimeDefs);
|
||||
IncludeRegister("stdio.h", &StdioSetupFunc, &StdioFunctions[0], StdioDefs);
|
||||
IncludeRegister("math.h", &MathSetupFunc, &MathFunctions[0], NULL);
|
||||
IncludeRegister("string.h", &StringSetupFunc, &StringFunctions[0], NULL);
|
||||
IncludeRegister("stdlib.h", &StdlibSetupFunc, &StdlibFunctions[0], NULL);
|
||||
IncludeRegister("time.h", &StdTimeSetupFunc, &StdTimeFunctions[0], StdTimeDefs);
|
||||
}
|
||||
|
||||
/* clean up space used by the include system */
|
||||
|
@ -42,7 +42,7 @@ void IncludeCleanup()
|
|||
}
|
||||
|
||||
/* register a new build-in include file */
|
||||
void IncludeRegister(const char *IncludeName, void (*SetupFunction)(void), struct LibraryFunction (*FuncList)[], const char *SetupCSource)
|
||||
void IncludeRegister(const char *IncludeName, void (*SetupFunction)(void), struct LibraryFunction *FuncList, const char *SetupCSource)
|
||||
{
|
||||
struct IncludeLibrary *NewLib = HeapAllocMem(sizeof(struct IncludeLibrary));
|
||||
NewLib->IncludeName = TableStrRegister(IncludeName);
|
||||
|
|
4
picoc.h
4
picoc.h
|
@ -381,7 +381,7 @@ void *VariableDereferencePointer(struct ParseState *Parser, struct Value *Pointe
|
|||
|
||||
/* clibrary.c */
|
||||
void BasicIOInit();
|
||||
void LibraryInit(struct Table *GlobalTable, const char *LibraryName, struct LibraryFunction (*FuncList)[]);
|
||||
void LibraryInit(struct Table *GlobalTable, const char *LibraryName, struct LibraryFunction *FuncList);
|
||||
void CLibraryInit();
|
||||
void PrintCh(char OutCh, IOFILE *Stream);
|
||||
void PrintSimpleInt(long Num, FILE *Stream);
|
||||
|
@ -411,7 +411,7 @@ void Cleanup();
|
|||
/* include.c */
|
||||
void IncludeInit();
|
||||
void IncludeCleanup();
|
||||
void IncludeRegister(const char *IncludeName, void (*SetupFunction)(void), struct LibraryFunction (*FuncList)[], const char *SetupCSource);
|
||||
void IncludeRegister(const char *IncludeName, void (*SetupFunction)(void), struct LibraryFunction *FuncList, const char *SetupCSource);
|
||||
void IncludeFile(char *Filename);
|
||||
|
||||
/* stdio.c */
|
||||
|
|
Loading…
Reference in a new issue