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:
parent
3c24084d94
commit
7003b55ead
|
@ -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;
|
||||
|
|
2
parse.c
2
parse.c
|
@ -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();
|
||||
}
|
||||
|
|
2
picoc.h
2
picoc.h
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue