Exemplo n.º 1
0
Arquivo: picoc.c Projeto: 12019/picoC
	int picoc(char *SourceStr)
	{
		char *pos;

		PicocInitialise(HEAP_SIZE);

		if (SourceStr)
		{
			for (pos = SourceStr; *pos != 0; pos++)
				if (*pos == 0x1a)
					*pos = 0x20;
		}

		PicocExitBuf[40] = 0;
		PicocPlatformSetExitPoint();
		if (PicocExitBuf[40])
		{
			printf("Leaving PicoC\n\r");
		}
		else
		{
			if (SourceStr)
				PicocParse("nofile", SourceStr, strlen(SourceStr), TRUE, TRUE, FALSE);
			PicocParseInteractive();
		}
		PicocCleanup();
		return PicocExitValue;
	}
Exemplo n.º 2
0
Arquivo: picoc.c Projeto: 12019/picoC
	int picoc(char *SourceStr)
	{
		char *pos;
		PicocInitialise(&pc, HEAP_SIZE);

		if (SourceStr)
		{
			for (pos = SourceStr; *pos != 0; pos++)
				if (*pos == 0x1A)
					*pos = ' ';
		}

		pc.PicocExitBuf[40] = 0;
		if (PicocPlatformSetExitPoint(&pc))
		{
			PicocCleanup(&pc);
			return pc.PicocExitValue;
		}

		if (pc.PicocExitBuf[40])
		{
			printf("\nLeaving PicoC\n\r");
		}
		else
		{
			if (SourceStr)
			{
				printf("\n%s", SourceStr);
				PicocParse(&pc, "nofile", SourceStr, strlen(SourceStr), TRUE, TRUE, FALSE, FALSE);
			}
			PicocParseInteractive(&pc);
		}
		PicocCleanup(&pc);
		return pc.PicocExitValue;
	}
Exemplo n.º 3
0
Arquivo: picoc.c Projeto: 12019/picoC
	int main(int argc, char **argv)
	{
		int ParamCount = 1;
		int DontRunMain = FALSE;
		int StackSize = getenv("STACKSIZE") ? atoi(getenv("STACKSIZE")) : PICOC_STACK_SIZE;
		Picoc pc;

		if (argc < 2)
		{
			printf("Format: picoc <csource1.c>... [- <arg1>...]    : run a program (calls main() to start it)\n"
				   "		picoc -s <csource1.c>... [- <arg1>...] : script mode - runs the program without calling main()\n"
				   "		picoc -i                               : interactive mode\n");
			exit(1);
		}

		PicocInitialise(&pc, StackSize);

		if (strcmp(argv[ParamCount], "-s") == 0 || strcmp(argv[ParamCount], "-m") == 0)
		{
			DontRunMain = TRUE;
			PicocIncludeAllSystemHeaders(&pc);
			ParamCount++;
		}

		if (argc > ParamCount && strcmp(argv[ParamCount], "-i") == 0)
		{
			PicocIncludeAllSystemHeaders(&pc);
			PicocParseInteractive(&pc);
		}
		else
		{
			if (PicocPlatformSetExitPoint(&pc))
			{
				PicocCleanup(&pc);
				return pc.PicocExitValue;
			}

			for (; ParamCount < argc && strcmp(argv[ParamCount], "-") != 0; ParamCount++)
				PicocPlatformScanFile(&pc, argv[ParamCount]);

			if (!DontRunMain)
				PicocCallMain(&pc, argc - ParamCount, &argv[ParamCount]);
		}

		PicocCleanup(&pc);
		return pc.PicocExitValue;
	}
Exemplo n.º 4
0
std::shared_ptr<DataModelImpl> C89DataModel::create(DataModelCallbacks* callbacks) {
	std::shared_ptr<C89DataModel> dm(new C89DataModel());
	PicocInitialise(&dm->_pc, PICOC_STACK_SIZE);
	PicocIncludeAllSystemHeaders(&dm->_pc);
	return dm;
}