picoc/picoc.c
zik.saleeba 9f8770047f Fixed test program for Surveyor
git-svn-id: http://picoc.googlecode.com/svn/trunk@122 21eae674-98b7-11dd-bd71-f92a316d2d60
2009-02-28 05:49:14 +00:00

52 lines
1,010 B
C

#include "picoc.h"
/* initialise everything */
void Initialise()
{
HeapInit();
TableInit();
VariableInit();
LexInit();
VariableInit();
TypeInit();
LibraryInit(&GlobalTable, "c library", &CLibrary);
LibraryInit(&GlobalTable, "platform library", &PlatformLibrary);
}
/* platform-dependent code for running programs is in this file */
#ifdef UNIX_HOST
int main(int argc, char **argv)
{
if (argc < 2)
ProgramFail(NULL, "Format: picoc <program.c> <args>...\n");
Initialise();
if (PlatformSetExitPoint())
return 1;
PlatformScanFile(argv[1]);
return 0;
}
#else
# ifdef SURVEYOR_HOST
static char *SourceStr = "\n\
int Count;\n\
\n\
printf(\"This is a test program\n\");\n\
for (Count = 1; Count <= 10; Count++)\n\
printf(\"%d\n\", Count);\n\
";
int picoc()
{
Initialise();
if (PlatformSetExitPoint())
return 1;
Parse("test.c", SourceStr, strlen(SourceStr), TRUE);
return 0;
}
# endif
#endif