Пример #1
0
SC_DLLEXPORT_C bool compileLibrary()
{
	//printf("->compileLibrary\n");
	shutdownLibrary();

	pthread_mutex_lock (&gLangMutex);
	gNumCompiledFiles = 0;
	compiledOK = false;

	// FIXME: the library config should have been initialized earlier!
	if (!gLibraryConfig)
		SC_LanguageConfig::readDefaultLibraryConfig();

	compileStartTime = elapsedTime();

	totalByteCodes = 0;

#ifdef NDEBUG
	postfl("compiling class library...\n");
#else
	postfl("compiling class library (debug build)...\n");
#endif

	bool res = passOne();
	if (res) {

		postfl("\tpass 1 done\n");

		if (!compileErrors) {
			buildDepTree();
			traverseFullDepTree();
			traverseFullDepTree2();
			flushPostBuf();

			if (!compileErrors && gShowWarnings) {
				SymbolTable* symbolTable = gMainVMGlobals->symbolTable;
				symbolTable->CheckSymbols();
			}
		}
		pyr_pool_compile->FreeAll();
		flushPostBuf();
		compileSucceeded();
	} else {
		compiledOK = false;
	}

	pthread_mutex_unlock (&gLangMutex);
	//printf("<-compileLibrary\n");
	return compiledOK;
}
Пример #2
0
SC_DLLEXPORT_C bool compileLibrary(bool standalone)
{
	//printf("->compileLibrary\n");
	shutdownLibrary();

	gLangMutex.lock();
	gNumCompiledFiles = 0;
	compiledOK = false;

	SC_LanguageConfig::readLibraryConfig(standalone);

	compileStartTime = elapsedRealTime();

	totalByteCodes = 0;

#ifdef NDEBUG
	postfl("compiling class library...\n");
#else
	postfl("compiling class library (debug build)...\n");
#endif

	bool res = passOne();
	if (res) {

		postfl("\tpass 1 done\n");

		if (!compileErrors) {
			buildDepTree();
			traverseFullDepTree();
			traverseFullDepTree2();
			flushPostBuf();

			if (!compileErrors && gShowWarnings) {
				SymbolTable* symbolTable = gMainVMGlobals->symbolTable;
				symbolTable->CheckSymbols();
			}
		}
		pyr_pool_compile->FreeAll();
		flushPostBuf();
		compileSucceeded();
	} else {
		compiledOK = false;
	}

	gLangMutex.unlock();
	//printf("<-compileLibrary\n");
	return compiledOK;
}
Пример #3
0
void compileSucceeded()
{
	compiledOK = !(parseFailed || compileErrors);
	if (compiledOK) {
		compiledOK = true;

		compiledOK = initRuntime(gMainVMGlobals, 128*1024, pyr_pool_runtime);

		if (compiledOK) {
			VMGlobals *g = gMainVMGlobals;

			g->canCallOS = true;
			//++g->sp; SetObject(g->sp, g->process);
			//runInterpreter(g, s_hardwaresetup, 1);

			++g->sp; SetObject(g->sp, g->process);
			runInterpreter(g, s_startup, 1);
                        g->canCallOS = false;

			schedRun();
		}
		flushPostBuf();
	}
}