Exemplo n.º 1
0
static int tek_lib_exec_base_gc(lua_State *L)
{
	TAPTR *pexec = luaL_checkudata(L, 1, "tek.lib.exec.base.meta");
	if (*pexec)
	{
		TAPTR basetask = TExecFindTask(*pexec, TTASKNAME_ENTRY);
		TDestroy(basetask);
		TDBPRINTF(5,("Exec closed\n"));
		*pexec = TNULL;
	}
	return 0;
}
Exemplo n.º 2
0
TLIBAPI TAPTR
TNewInstance(TAPTR mod, TUINT possize, TUINT negsize)
{
	TAPTR exec = TGetExecBase(mod);
	TAPTR inst = TExecAlloc(exec, TNULL, possize + negsize);
	if (inst)
	{
		TUINT size = TMIN(((struct TModule *) mod)->tmd_NegSize, negsize);
		inst = (TINT8 *) inst + negsize;
		if (size > 0)
			TExecCopyMem(exec, (TINT8 *) mod - size, (TINT8 *) inst - size,
				size);
		size = TMIN(((struct TModule *) mod)->tmd_PosSize, possize);
		TExecCopyMem(exec, mod, inst, size);
		((struct TModule *) inst)->tmd_PosSize = possize;
		((struct TModule *) inst)->tmd_NegSize = negsize;
		((struct TModule *) inst)->tmd_InitTask = TExecFindTask(exec, TNULL);
	}
	return inst;
}
Exemplo n.º 3
0
Arquivo: init.c Projeto: callcc/tekui
static void init_tek_destroy(TAPTR apptask)
{
	TAPTR exec, exectask, boot;
	struct TEKlibInit *init;

	exec = TGetExecBase(apptask);
	exectask = TExecFindTask(exec, TTASKNAME_EXEC);
	init = TExecGetInitData(exec, exectask);
	boot = init->tli_BootHnd;

	init_destroyatom(exec, init->tli_AtomUnique, "sys.unique");
	init_destroyatom(exec, init->tli_AtomRetValP, "sys.returnvalue");
	init_destroyatom(exec, init->tli_AtomProgName, "sys.progname");
	init_destroyatom(exec, init->tli_AtomArgs, "sys.arguments");
	init_destroyatom(exec, init->tli_AtomArgV, "sys.argv");
	init_destroyatom(exec, init->tli_AtomInitMods, "sys.imods");

	/* deinitializations in basetask: */
	TExecDoExec(init->tli_ExecBase, TEXEC_CMD_EXIT, TNULL);

	TExecSignal(init->tli_ExecBase, init->tli_ExecTask, TTASK_SIG_ABORT);
	TExecSignal(init->tli_ExecBase, init->tli_IOTask, TTASK_SIG_ABORT);
	TDESTROY(init->tli_ExecTask);
	TDESTROY(init->tli_IOTask);

	TCALLHOOKPKT(&init->tli_OrgAppTaskHook, apptask, TNULL);

	init_closeexecmodule(init);
	init_closehalmodule(init);

	TEKlib_FreeVec(boot, init->tli_ProgDir);
	TEKlib_FreeVec(boot, init->tli_SysDir);
	TEKlib_FreeVec(boot, init->tli_ModDir);
	TEKlib_Free(boot, init, sizeof(struct TEKlibInit));

	TEKlib_Exit(boot);
}