picoc/platform_library.c
zik.saleeba d6c73f42d4 Fixed lexer issue temporarily
Diked out failing pointer test case for now
Added platform return value example


git-svn-id: http://picoc.googlecode.com/svn/trunk@127 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-28 19:57:03 +00:00

31 lines
698 B
C

#include "picoc.h"
void SayHello(struct Value *ReturnValue, struct Value **Param, int NumArgs)
{
PlatformPrintf("Hello\n");
}
void PrintInteger(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)
{
ReturnValue->Val->Integer = random();
}
#endif
/* list of all library functions and their prototypes */
struct LibraryFunction PlatformLibrary[] =
{
{ SayHello, "void sayhello()" },
{ PrintInteger, "void printint(int)" },
#ifdef UNIX_HOST
{ Random, "int random()" },
#endif
{ NULL, NULL }
};