示例#1
0
static void vis_destroyports(struct TVisualBase *mod)
{
	if (mod->vis_Flags & TVISFL_CMDRPORT_OWNER)
		TDestroy(mod->vis_CmdRPort);
	if (mod->vis_Flags & TVISFL_IMSGPORT_OWNER)
		TDestroy(mod->vis_IMsgPort);
}
示例#2
0
static void rfb_exittask(struct rfb_Display *mod)
{
	TAPTR TExecBase = TGetExecBase(mod);
	struct TNode *imsg, *node, *next;

#if defined(ENABLE_LINUXFB)
	rfb_linux_exit(mod);
#endif

	TFree(mod->rfb_PtrBackBuffer.data);
	if (mod->rfb_Flags & RFBFL_PTR_ALLOCATED)
		TFree(mod->rfb_PtrImage.tpb_Data);

	/* free pooled input messages: */
	while ((imsg = TRemHead(&mod->rfb_IMsgPool)))
		TFree(imsg);

	/* close all fonts */
	node = mod->rfb_FontManager.openfonts.tlh_Head.tln_Succ;
	for (; (next = node->tln_Succ); node = next)
		rfb_hostclosefont(mod, (TAPTR) node);

	if (mod->rfb_Flags & RFBFL_BUFFER_OWNER)
		TFree(mod->rfb_PixBuf.tpb_Data);

	TDestroy(mod->rfb_RndIMsgPort);
	TFree(mod->rfb_RndRequest);
	TCloseModule(mod->rfb_RndDevice);
	TDestroy((struct THandle *) mod->rfb_RndRPort);
	TDestroy((struct THandle *) mod->rfb_InstanceLock);

	region_free(&mod->rfb_RectPool, &mod->rfb_DirtyRegion);

	region_destroypool(&mod->rfb_RectPool);
}
示例#3
0
static void rfb_exittask(RFBDISPLAY *mod)
{
	TAPTR TExecBase = TGetExecBase(mod);
	struct TNode *imsg, *node, *next;

	/* free pooled input messages: */
	while ((imsg = TRemHead(&mod->rfb_IMsgPool)))
		TFree(imsg);

	/* close all fonts */
	node = mod->rfb_FontManager.openfonts.tlh_Head;
	for (; (next = node->tln_Succ); node = next)
		rfb_hostclosefont(mod, (TAPTR) node);

	if (mod->rfb_BufferOwner)
		TFree(mod->rfb_BufPtr);
	
	TDestroy(mod->rfb_RndIMsgPort);
	TFree(mod->rfb_RndRequest);
	TCloseModule(mod->rfb_RndDevice);
	TDestroy((struct THandle *) mod->rfb_RndRPort);
	TDestroy((struct THandle *) mod->rfb_InstanceLock);
	
	if (mod->rfb_DirtyRegion)
		region_destroy(&mod->rfb_RectPool, mod->rfb_DirtyRegion);
	
	region_destroypool(&mod->rfb_RectPool);
}
示例#4
0
文件: rtree_v1.c 项目: edomerz/rtree
/* destroys the tree*/
void RTreeDestroy(rtree_t *tree)
{
/*	TO DO - */
	if(!tree)
	{
		return;
	}
	
	TDestroy(tree->r.next[0]);
	
	TDestroy(tree->r.next[1]);
	
	free(tree);
}
示例#5
0
文件: rtree_v1.c 项目: edomerz/rtree
/* destroy subtree*/
static void TDestroy(rtn_t *root)
{
	if(!root)
	{
		return;
	}
	
	TDestroy(root->l);
	root->next[0] = NULL;
	
	TDestroy(root->r);
	root->next[1] = NULL;
	
	free(root);
}
示例#6
0
LOCAL void rfb_exit(RFBDISPLAY *mod)
{
	TAPTR TExecBase = TGetExecBase(mod);
	if (mod->rfb_Task)
	{
		TSignal(mod->rfb_Task, TTASK_SIG_ABORT);
		TDestroy((struct THandle *) mod->rfb_Task);
	}
}
示例#7
0
static void rfb_destroy(RFBDISPLAY *mod)
{
	TDestroy((struct THandle *) mod->rfb_Lock);
	if (mod->rfb_FTLibrary)
	{
		if (mod->rfb_FTCManager)
			FTC_Manager_Done(mod->rfb_FTCManager);
		FT_Done_FreeType(mod->rfb_FTLibrary);
	}
}
示例#8
0
LOCAL void
fb_exit(WINDISPLAY *mod)
{
	struct TExecBase *TExecBase = TGetExecBase(mod);
	if (mod->fbd_Task)
	{
		TSignal(mod->fbd_Task, TTASK_SIG_ABORT);
		TDestroy((struct THandle *) mod->fbd_Task);
	}
}
示例#9
0
LOCAL void
fb_closewindow(WINDISPLAY *mod, struct TVRequest *req)
{
	struct TExecBase *TExecBase = TGetExecBase(mod);
	WINWINDOW *win = req->tvr_Op.CloseWindow.Window;
	if (win == TNULL)
		return;
	TSignal(win->fbv_Task, TTASK_SIG_ABORT);
	PostMessage(win->fbv_HWnd, WM_USER, 0, 0);
	TDestroy(win->fbv_Task);
}
示例#10
0
文件: exec_lua.c 项目: ld-test/tekui
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;
}
示例#11
0
static void rfb_exit(struct rfb_Display *mod)
{
	TAPTR TExecBase = TGetExecBase(mod);

	if (mod->rfb_Task)
	{
		TSignal(mod->rfb_Task, TTASK_SIG_ABORT);
#if defined(ENABLE_LINUXFB)
		rfb_linux_wake(mod);
#endif
		TDestroy((struct THandle *) mod->rfb_Task);
	}
}
示例#12
0
文件: rtree.c 项目: edomerz/rtree
/* destroys the tree*/
void RTreeDestroy(rtree_t *tree)
{
/*	TO DO - */
	if(!tree)
	{
		return;
	}
	
	TDestroy(tree->r);
	
/*	TDestroy(tree->r->nex);*/
	
	free(tree);
}
示例#13
0
文件: visual_io.c 项目: callcc/tekui
LOCAL void tek_lib_visual_io_close(TEKVisual *vis)
{
	if (vis->vis_IOTask)
	{
		struct TExecBase *TExecBase = vis->vis_ExecBase;
		TSignal(vis->vis_IOTask, TTASK_SIG_ABORT);
		#if defined(ENABLE_FILENO) || defined(ENABLE_DGRAM)
		struct IOData *iodata = vis->vis_IOData;
		tek_lib_visual_io_wake(iodata);
		#endif
		TDestroy((struct THandle *) vis->vis_IOTask);
		vis->vis_IOTask = TNULL;
		TFree(vis->vis_IOData);
		vis->vis_IOData = TNULL;
	}
}
示例#14
0
LOCAL TAPTR fb_hostopenfont(WINDISPLAY *mod, TTAGITEM *tags)
{
	TSTRPTR name = (TSTRPTR) TGetTag(tags, TVisual_FontName, TNULL);
	TUINT sz = (TUINT) TGetTag(tags, TVisual_FontPxSize, 0);
	HFONT font;
	TBOOL italic = (TBOOL) TGetTag(tags, TVisual_FontItalic, (TTAG) TFALSE);
	TBOOL bold = (TBOOL) TGetTag(tags, TVisual_FontBold, (TTAG) TFALSE);

	/* check availability: */
	TAPTR fqh = fb_hostqueryfonts(mod, tags);
	if (fqh)
	{
		TBOOL have_font = fb_hostgetnextfont(mod, fqh) != TNULL;
		TDestroy(fqh);
		if (!have_font)
		{
			TDBPRINTF(TDB_INFO,("Failed to open font '%s':%d\n", name, sz));
			return TNULL;
		}
	}
	else
		return TNULL;
	
	font = CreateFont(
		sz,
		0,
		0,
		0,
		bold ? FW_BOLD : FW_NORMAL,
		italic,
		0,				/* underline */
		0,				/* strikeout */
		ANSI_CHARSET,	/* charset */
		OUT_DEFAULT_PRECIS,	/* precision */
		CLIP_DEFAULT_PRECIS,
		DEFAULT_QUALITY,
		FF_DONTCARE | DEFAULT_PITCH,
		name);

	TDBPRINTF(TDB_INFO,("CreateFont %s:%d => %p\n", name, sz, font));

	return font;
}
示例#15
0
static int tek_lib_exec_base_gc(lua_State *L)
{
	struct LuaExecTask *lexec = (struct LuaExecTask *)luaL_checkudata(L, 1, TEK_LIB_EXEC_CLASSNAME);
	struct TExecBase *TExecBase = lexec->exec;
	if (TExecBase)
	{
#if defined(ENABLE_TASKS)
		TAPTR atom = TLockAtom(TEK_LIB_BASETASK_ATOMNAME, TATOMF_NAME);
		TUnlockAtom(atom, TATOMF_DESTROY);
		if (lexec->parent == TNULL)
		{
			/* free shared state */
			TFree(lexec->shared);
		}
#endif
		TDestroy((struct THandle *) lexec->task);
		lexec->exec = TNULL;
	}
	return 0;
}
示例#16
0
文件: hal.c 项目: callcc/tekui
LOCAL TCALLBACK void
hal_close(struct THALBase *hal, struct TTask *task)
{
	struct HALSpecific *hws = hal->hmb_Specific;

	EnterCriticalSection(&hws->hsp_DevLock);

	if (hws->hsp_DevTask)
	{
		if (--hws->hsp_RefCount == 0)
		{
			TDBPRINTF(2,("hal.device refcount dropped to 0\n"));
			TExecSignal(hws->hsp_ExecBase, hws->hsp_DevTask, TTASK_SIG_ABORT);
			TDBPRINTF(2,("destroy hal.device task...\n"));
			TDestroy(hws->hsp_DevTask);
			hws->hsp_DevTask = TNULL;
		}
	}

	LeaveCriticalSection(&hws->hsp_DevLock);
}
示例#17
0
static void
fb_destroy(WINDISPLAY *mod)
{
	TDBPRINTF(TDB_TRACE,("Module destroy...\n"));
	TDestroy((struct THandle *) mod->fbd_Lock);
}
示例#18
0
static void
vis_destroy(struct TVisualBase *mod)
{
	TDestroy(mod->vis_Lock);
}
示例#19
0
LOCAL TAPTR fb_hostqueryfonts(WINDISPLAY *mod, TTAGITEM *tags)
{
    struct TExecBase *TExecBase = TGetExecBase(mod);
    TSTRPTR names;
    LOGFONT logfont;
    char *namebuf = logfont.lfFaceName;
    struct FontQueryHandle *fqh;

    fqh = TAlloc0(TNULL, sizeof(struct FontQueryHandle));
    if (fqh == TNULL)
        return TNULL;

    fqh->handle.thn_Owner = mod;
    TInitHook(&fqh->handle.thn_Hook, fqhdestroy, fqh);
    TInitList(&fqh->reslist);

    fqh->fpxsize = (TINT) TGetTag(tags, TVisual_FontPxSize, (TTAG) FNTQUERY_UNDEFINED);
    fqh->fitalic = (TBOOL) TGetTag(tags, TVisual_FontItalic, (TTAG) FNTQUERY_UNDEFINED);
    fqh->fbold = (TBOOL) TGetTag(tags, TVisual_FontBold, (TTAG) FNTQUERY_UNDEFINED);
    fqh->fscale = (TBOOL) TGetTag(tags, TVisual_FontScaleable, (TTAG) FNTQUERY_UNDEFINED);
    fqh->fnum = (TINT) TGetTag(tags, TVisual_FontNumResults, (TTAG) INT_MAX);
    fqh->success = TTRUE;

    names = (TSTRPTR) TGetTag(tags, TVisual_FontName, TNULL);
    if (names == TNULL)
        names = "";

    for (;;)
    {
        TSTRPTR p = strchr(names, ',');
        if (p)
        {
            size_t len2 = TMIN(p - names, LF_FACESIZE - 1);
            memcpy(namebuf, names, len2);
            namebuf[len2] = 0;
            names += p - names + 1;
        }
        else
        {
            size_t len = strlen(names);
            size_t len2 = TMIN(len, LF_FACESIZE - 1);
            memcpy(namebuf, names, len2);
            namebuf[len2] = 0;
            names += len;
        }

        logfont.lfCharSet = ANSI_CHARSET;
        logfont.lfPitchAndFamily = 0;

        TDBPRINTF(TDB_INFO,("query font: %s\n", namebuf));

        if (strcmp(namebuf, "") == 0)
            fqh->match_depth = 0; /* find font first */
        else
            fqh->match_depth = 1; /* find style */

        EnumFontFamiliesEx(
            mod->fbd_DeviceHDC,
            &logfont,
            (FONTENUMPROCA) fontenumcb,
            (LPARAM) fqh, 0);

        if (strlen(names) == 0)
            break;
    }

    fqh->nptr = &fqh->reslist.tlh_Head;
    if (fqh->success)
        return fqh;

    TDestroy(&fqh->handle);
    return TNULL;
}