picoc/platform/library_unix.c

32 lines
709 B
C
Raw Normal View History

#include "../interpreter.h"
void UnixSetupFunc()
2015-06-07 00:51:02 -04:00
{
}
void Ctest (struct ParseState *Parser, struct Value *ReturnValue,
struct Value **Param, int NumArgs)
{
printf("test(%d)\n", Param[0]->Val->Integer);
Param[0]->Val->Integer = 1234;
}
void Clineno (struct ParseState *Parser, struct Value *ReturnValue,
struct Value **Param, int NumArgs)
{
ReturnValue->Val->Integer = Parser->Line;
}
/* list of all library functions and their prototypes */
struct LibraryFunction UnixFunctions[] =
{
2015-06-07 00:51:02 -04:00
{Ctest, "void test(int);"},
{Clineno, "int lineno();"},
{NULL, NULL}
};
void PlatformLibraryInit(Picoc *pc)
{
IncludeRegister(pc, "picoc_unix.h", &UnixSetupFunc, &UnixFunctions[0], NULL);
}