Library functions now get Parser as a parameter

git-svn-id: http://picoc.googlecode.com/svn/trunk@134 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
zik.saleeba 2009-02-28 22:14:55 +00:00
parent 3c24084d94
commit 7003b55ead
4 changed files with 6 additions and 6 deletions

View file

@ -87,7 +87,7 @@ void PrintFP(double Num, CharWriter *PutCh)
#endif
/* intrinsic functions made available to the language */
void LibPrintf(struct Value *ReturnValue, struct Value **Param, int NumArgs)
void LibPrintf(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
{
struct Value *CharArray = Param[0]->Val->Pointer.Segment;
char *Format;

View file

@ -87,7 +87,7 @@ void ParseFunctionCall(struct ParseState *Parser, struct Value **Result, const c
VariableStackFramePop(Parser);
}
else
FuncValue->Val->FuncDef.Intrinsic(*Result, ParamArray, ArgCount);
FuncValue->Val->FuncDef.Intrinsic(Parser, *Result, ParamArray, ArgCount);
HeapPopStackFrame();
}

View file

@ -210,7 +210,7 @@ struct LexState
/* library function definition */
struct LibraryFunction
{
void (*Func)(struct Value *, struct Value **, int);
void (*Func)(struct ParseState *Parser, struct Value *, struct Value **, int);
const char *Prototype;
};

View file

@ -1,17 +1,17 @@
#include "picoc.h"
void SayHello(struct Value *ReturnValue, struct Value **Param, int NumArgs)
void SayHello(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
{
PlatformPrintf("Hello\n");
}
void PrintInteger(struct Value *ReturnValue, struct Value **Param, int NumArgs)
void PrintInteger(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
{
PlatformPrintf("%d\n", Param[0]->Val->Integer);
}
#ifdef UNIX_HOST
void Random(struct Value *ReturnValue, struct Value **Param, int NumArgs)
void Random(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
{
ReturnValue->Val->Integer = random();
}