Ejemplo n.º 1
0
WHndlInfo *WFindHndlInfoR( WStringEditInfo *info )
{
    WHndlInfo   *hinfo;
    LIST        *l;

    for( l = WHndlList; l != NULL; l = ListNext( l ) ) {
        hinfo = ListElement( l );
        if( hinfo->info == info ) {
            return( hinfo );
        }
    }

    return( NULL );
}
Ejemplo n.º 2
0
WdeResDlgItem *WdeFindDialogInResInfo( WdeResInfo *res_info, int dlg )
{
    LIST            *dlist;

    if( dlg != -1 ) {
        for( dlist = res_info->dlg_item_list; dlist != NULL; dlist = ListNext( dlist ) ) {
            if( dlg-- == 0 ) {
                return( (WdeResDlgItem *)ListElement( dlist ) );
            }
        }
    }

    return( NULL );
}
Ejemplo n.º 3
0
WHndlInfo *WFindHndlInfo( WStringHandle hndl )
{
    WHndlInfo   *hinfo;
    LIST        *l;

    for( l = WHndlList; l != NULL; l = ListNext( l ) ) {
        hinfo = ListElement( l );
        if( hinfo->hndl == hndl ) {
            return( hinfo );
        }
    }

    return( NULL );
}
Ejemplo n.º 4
0
WREToolBar *WREFindToolBar( HWND win )
{
    WREToolBar *tbar;
    LIST       *tlist;

    for( tlist = WREToolBarList; tlist != NULL; tlist = ListNext( tlist ) ) {
        tbar = ListElement( tlist );
        if( tbar->win == win ) {
            return( tbar );
        }
    }

    return( NULL );
}
Ejemplo n.º 5
0
WdePopupListItem *WdeFindPopupListItem( HMENU menu )
{
    LIST             *plist;
    WdePopupListItem *p;

    for( plist = WdePopupList; plist != NULL; plist = ListNext( plist ) ) {
        p = (WdePopupListItem *)ListElement( plist );
        if( p->menu == menu ) {
            return( p );
        }
    }

    return( NULL );
}
Ejemplo n.º 6
0
OBJPTR WdeIsDialogInList( LIST *l )
{
    OBJ_ID  oid;
    OBJPTR  obj;

    for( ; l != NULL; l = ListNext( l ) ) {
        obj = ListElement( l );
        if( Forward( obj, IDENTIFY, &oid, NULL ) && oid == DIALOG_OBJ ) {
            return( obj );
        }
    }

    return( NULL );
}
Ejemplo n.º 7
0
void CloseSkins( void )
{
    DmOpenRef dbRef;

    if ( NULL == resourceDBList )
        return;

    dbRef = ListFirst( resourceDBList );
    while ( dbRef != NULL ) {
        DmCloseDatabase( dbRef );
        dbRef = ListNext( resourceDBList, dbRef );
    }

    ListDelete( resourceDBList );
}
Ejemplo n.º 8
0
void WdeFreeResList( void )
{
    LIST       *rlist;
    WdeResInfo *res_info;

    if( WdeResList != NULL ) {
        for( rlist = WdeResList; rlist != NULL; rlist = ListNext( rlist ) ) {
            res_info = (WdeResInfo *)ListElement( rlist );
            WdeSetCurrentRes( res_info );
            WdeFreeResInfo( res_info );
        }
        ListFree( WdeResList );
        WdeResList = NULL;
    }
}
Ejemplo n.º 9
0
static void s_Delete_Object(t_FAKE_OBJ *fake_hnd)
{
	ListNode *node = ListHead(&s_object_list);
	
	while( node )
	{
		if( node->item == (void*)fake_hnd )
		{
			free(fake_hnd);
			ListDelNode(&s_object_list, node, 0);
			break;
		}
		node = ListNext(&s_object_list, node);
	}
}
Ejemplo n.º 10
0
////////////////////////////////////////////////////
// 功能: 检查当前有几个声音通道
// 输入: 
// 输出:
// 返回: 
// 说明: 
////////////////////////////////////////////////////
int GetDacChannel(void)
{
	PLIST head, n;
	int chs;
	// 获取采样数据到临时缓冲区
	kMutexWait(hDacMutex);
	head = &DacList;
	chs = 0;
	for(n=ListFirst(head); n!=head; n=ListNext(n))
	{
		if(++chs == 4)
			break;		// 最多合成4通道
	}
	kMutexRelease(hDacMutex);
	return chs;
}
Ejemplo n.º 11
0
int ChtblLookup(const CHTbl *htbl, void **data)
{
	ListElmt *element = NULL;
	int nBucket = 0;

	nBucket = htbl->hash(*data) % htbl->nBuckets;
	for (element = ListHead(&htbl->table[nBucket]); element != NULL; element = ListNext(element))
	{
		if (htbl->match(*data, ListData(element)))
		{
			*data = ListData(element);
			return 0;
		}
	}
	return -1;
}
uint16_t calculateParentRcv(Node_t *node, Tree_t *tree)
{
    List listChildren; memset(&listChildren, 0, sizeof(List)); ListInit(&listChildren);

    Tree_t *subTree = getSubTree(tree, node);
    getListNodesInTree(subTree, &listChildren);

    uint16_t res = 0;
    for (ListElem *elem = ListFirst(&listChildren); elem != NULL; elem = ListNext(&listChildren, elem))
    {
        Node_t *node = (Node_t *)elem->obj;
        res += node->q;
    }

    return (res);
}
Ejemplo n.º 13
0
void WdeFreeCustLibControls ( LIST **control_list )
{
    LIST           *clist;
    WdeCustControl *control;

    if ( (control_list != NULL) && (*control_list != NULL) ) {
        for ( clist = *control_list; clist; clist = ListNext(clist) ) {
            control = (WdeCustControl *) ListElement(clist);
            WdeFreeCustControl ( control );
        }
        ListFree ( *control_list );
        *control_list = NULL;
    } else {
        WdeWriteTrail("WdeFreeCustLibControls: NULL control_list!");
    }
}
Ejemplo n.º 14
0
////////////////////////////////////////////////////
// 功能: 
// 输入: 
// 输出:
// 返回: 
// 说明: 
////////////////////////////////////////////////////
int DacGetOwners(void)
{
	PLIST head;
	PLIST n;
	int owners;

	// 获取打开设备数量
	kMutexWait(hDacMutex);
	head = &DacList;
	owners = 0;
	for(n=ListFirst(head); n!=head; n=ListNext(n))
		owners++;
	kMutexRelease(hDacMutex);

	return owners;
}
Ejemplo n.º 15
0
static int ExtraHTTPHeaders(
	/*! [in] HTTP Request message. */
	http_message_t *Req,
	struct Extra_Headers **ExtraHeaders)
{
	http_header_t *header;
	ListNode *node;
	int index, nb_extra = 0;
	struct Extra_Headers *extra_headers;

	node = ListHead(&Req->headers);
	extra_headers = *ExtraHeaders =
		(struct Extra_Headers*) malloc(MAX_EXTRA_HEADERS * sizeof(struct Extra_Headers));
	if (!extra_headers) {
		return HTTP_INTERNAL_SERVER_ERROR;
	}
	while (node != NULL) {
		header = (http_header_t *) node->item;
		/* find header type. */
		index = map_str_to_int((const char *)header->name.buf,
				header->name.length, Http_Header_Names,
				NUM_HTTP_HEADER_NAMES, FALSE);
		if (index < 0) {
			extra_headers->name = (char *)malloc(header->name.length + 1);
			extra_headers->value = (char *)malloc(header->value.length + 1);
			if (!extra_headers->name || !extra_headers->value) {
				/* cleanup will be made by caller */
				return HTTP_INTERNAL_SERVER_ERROR;
			}
			memcpy(extra_headers->name, header->name.buf, header->name.length);
			memcpy(extra_headers->value, header->value.buf, header->value.length);
			extra_headers->name[header->name.length] = '\0';
			extra_headers->value[header->value.length] = '\0';
			extra_headers->resp = NULL;

			extra_headers++;
			nb_extra++;

			if (nb_extra == MAX_EXTRA_HEADERS - 1) {
				break;
			}
		}
		node = ListNext(&Req->headers, node);
	}
	extra_headers->name = extra_headers->value = extra_headers->resp = NULL;
	return HTTP_OK;
}
Ejemplo n.º 16
0
////////////////////////////////////////////////////
// 功能:
// 输入:
// 输出:
// 返回:
// 说明:
////////////////////////////////////////////////////
int MediaSrvDestroyNotify(void *media)
{
	PLIST head;
	PLIST n;
	PMEDIA_OBJECT obj;
	
//	kMutexWait(hMediaMutex);
	head = &MediaObjList;
	
	// 搜索指定音频任务
	for(n = ListFirst(head); n != head; n = ListNext(n))
	{
		obj = ListEntry(n, MEDIA_OBJECT, Link);
		if(obj->Media == media)
		{
			// 释放当前节点
			kdebug(mod_media, PRINT_INFO, "CLOSE Notify: 0x%x\n", obj->Header.Handle);
			ListRemove(&obj->Link);
			HandleDestroy(obj->Header.Handle, MEDIA_MAGIC);			
			if(obj->MediaInfo)
				kfree(obj->MediaInfo);
			kfree(obj);
			
			// 启动下一个等待任务
			n = ListFirst(head);
			if(n != head)
			{
				obj = ListEntry(n, MEDIA_OBJECT, Link);
				if(obj->Mode == MEDIA_MODE_WAIT)
				{
					if(obj->Cb.MediaOpen(obj->Media) < 0)
					{
						ListRemove(&obj->Link);
						HandleDestroy(obj->Header.Handle, MEDIA_MAGIC);
						if(obj->MediaInfo)
							kfree(obj->MediaInfo);
						kfree(obj);
					}
				}
			}
//			kMutexRelease(hMediaMutex);
			return 0;
		}
	}
//	kMutexRelease(hMediaMutex);
	return -1;	
}
Ejemplo n.º 17
0
PLISTLINK *ListGetPointers(HSLIST &hList, int &iListCount)
{
	iListCount = ListGetCount(hList);

	PLISTLINK *pPointers = (PLISTLINK *) SysAlloc((iListCount + 1) * sizeof(PLISTLINK));

	if (pPointers != NULL) {
		int i;
		PLISTLINK lpCurr = ListFirst(hList);

		for (i = 0; lpCurr != INVALID_SLIST_PTR; lpCurr = ListNext(hList, lpCurr), i++)
			pPointers[i] = lpCurr;
		pPointers[i] = INVALID_SLIST_PTR;
	}

	return pPointers;
}
uint8_t fhssCentralizedBlacklistChan(Node_t *parent, List *blacklist, uint64_t asn)
{
    uint8_t freq = 0;

    for (ListElem *elem = ListFirst(&parent->channels); elem != NULL; elem = ListNext(&parent->channels, elem))
    {
        uint8_t freq_offset = (uint8_t)elem->obj;

        freq = fhssOpenwsnChan(freq_offset, asn);
        if (!ListFind(blacklist, (void *)freq))
        {
            break;
        }
    }

    return (freq);
}
Ejemplo n.º 19
0
void
ListFreeAllButHead(List *l)
{
	List *p, *next;

	p = ListFirst(l);

	while (p)
	{
	    next = ListNext (p);
	    XtFree((char *) p);
	    p = next;
	}

	l->next = l;
	l->prev = l;
}
Ejemplo n.º 20
0
/*!
 * \brief
 */
static void searchExpired(
	/* [in] . */
	void *arg)
{

	int *id = (int *)arg;
	int handle = -1;
	struct Handle_Info *ctrlpt_info = NULL;

	/* remove search Target from list and call client back */
	ListNode *node = NULL;
	SsdpSearchArg *item;
	Upnp_FunPtr ctrlpt_callback;
	void *cookie = NULL;
	int found = 0;

	HandleLock();

	/* remove search target from search list */
	if (GetClientHandleInfo(&handle, &ctrlpt_info) != HND_CLIENT) {
		free(id);
		HandleUnlock();
		return;
	}
	ctrlpt_callback = ctrlpt_info->Callback;
	node = ListHead(&ctrlpt_info->SsdpSearchList);
	while (node != NULL) {
		item = (SsdpSearchArg *) node->item;
		if (item->timeoutEventId == (*id)) {
			free(item->searchTarget);
			cookie = item->cookie;
			found = 1;
			item->searchTarget = NULL;
			free(item);
			ListDelNode(&ctrlpt_info->SsdpSearchList, node, 0);
			break;
		}
		node = ListNext(&ctrlpt_info->SsdpSearchList, node);
	}
	HandleUnlock();

	if (found)
		ctrlpt_callback(UPNP_DISCOVERY_SEARCH_TIMEOUT, NULL, cookie);

	free(id);
}
Ejemplo n.º 21
0
WdeResInfo *WdeResInfoFromWin( HWND win )
{
    WdeResInfo  *info;
    LIST        *rlist;

    if( win != NULL ) {
        info = NULL;
        for( rlist = WdeResList; rlist != NULL; rlist = ListNext( rlist ) ) {
            info = (WdeResInfo *)ListElement( rlist );
            if( info->res_win == win ) {
                return( info );
            }
        }
    }

    return( NULL );
}
Ejemplo n.º 22
0
void WdeShowResourceWindows( int show )
{
    LIST        *rlist;
    WdeResInfo  *res_info;

    for( rlist = WdeResList; rlist != NULL; rlist = ListNext( rlist ) ) {
        res_info = (WdeResInfo *)ListElement( rlist );
        if( show == SW_HIDE ) {
            WdeSetEditMode( res_info, FALSE );
        }
        ShowWindow( res_info->res_win, show );
        EnableWindow( res_info->res_win, show != SW_HIDE );
        if( show != SW_HIDE ) {
            WdeSetEditMode( res_info, TRUE );
        }
    }
}
Ejemplo n.º 23
0
Bool WREIsResInfoWinMsg( LPMSG pmsg )
{
    WREResInfo *info;
    LIST       *rlist;

    info = NULL;
    for( rlist = WREResList; rlist != NULL; rlist = ListNext( rlist ) ) {
        info = (WREResInfo *)ListElement( rlist );
        if( info->info_win != (HWND)NULL ) {
            if( IsDialogMessage( info->info_win, pmsg ) ) {
                return( TRUE );
            }
        }
    }

    return( FALSE );
}
Ejemplo n.º 24
0
static void
_XtProcessIceMsgProc(XtPointer client_data, int *source, XtInputId *id)
{
    IceConn			ice_conn = (IceConn) client_data;
    IceProcessMessagesStatus	status;

    status = IceProcessMessages (ice_conn, NULL, NULL);

    if (status == IceProcessMessagesIOError)
    {
	List *cl;
	int found = 0;

	if (verbose)
	{
	    printf ("IO error on connection (fd = %d)\n",
	        IceConnectionNumber (ice_conn));
	    printf ("\n");
	}

	for (cl = ListFirst (RunningList); cl; cl = ListNext (cl))
	{
	    ClientRec *client = (ClientRec *) cl->thing;

	    if (client->ice_conn == ice_conn)
	    {
		CloseDownClient (client);
		found = 1;
		break;
	    }
	}
	 
	if (!found)
	{
	    /*
	     * The client must have disconnected before it was added
	     * to the session manager's running list (i.e. before the
	     * NewClientProc callback was invoked).
	     */

	    IceSetShutdownNegotiation (ice_conn, False);
	    IceCloseConnection (ice_conn);
	}
    }
}
Ejemplo n.º 25
0
void WREFreeResList( void )
{
    LIST        *rlist;
    WREResInfo  *info;
    HWND        frame;

    if( WREResList != NULL ) {
        frame = WREGetMDIWindowHandle();
        for( rlist = WREResList; rlist != NULL; rlist = ListNext( rlist ) ) {
            info = (WREResInfo *)ListElement( rlist );
            SendMessage( frame, WM_MDIACTIVATE, (WPARAM)info->res_win, 0 );
            WREFreeResInfo( info );
        }
        ListFree( WREResList );
        WREResList = NULL;
        WRENumRes = 0;
    }
}
Ejemplo n.º 26
0
bool WdeFindObjectsInRect( RECT *r, LIST **obj_list, LIST *olist )
{
    OBJPTR   child;
    RECT     child_rect;
    RECT     irect;

    *obj_list = NULL;

    for( ; olist != NULL; olist = ListNext( olist ) ) {
        child = ListElement( olist );
        Location( child, &child_rect );
        if( IntersectRect( &irect, &child_rect, r ) ) {
            WdeInsertObject( obj_list, child );
        }
    }

    return( *obj_list != NULL );
}
uint8_t fhssDistributedBlacklistOptimalChan(Node_t *parent, Node_t *child, uint8_t prrMatrix[][MAX_NODES][NUM_CHANNELS], uint64_t asn)
{
    uint8_t best_freq = 0, best_prr = 0;

    for (ListElem *elem = ListFirst(&parent->channels); elem != NULL; elem = ListNext(&parent->channels, elem))
    {
        uint8_t freq_off = (uint8_t)elem->obj;

        uint8_t freq = fhssOpenwsnChan(freq_off, asn);
        if (prrMatrix[child->id][parent->id][freq] > best_prr)
        {
            best_freq = freq;
            best_prr = prrMatrix[child->id][parent->id][freq];
        }
    }

    return (best_freq);
}
Ejemplo n.º 28
0
////////////////////////////////////////////////////
// 功能: 根据媒体类型,获取媒体回调函数
// 输入:
// 输出:
// 返回:
// 说明:
////////////////////////////////////////////////////
static int MediaSrvGetCallback(int type, PMEDIA_CALLBACK callback)
{
	PLIST n;
	PLIST head;
	PCALLBACK_LINK link;

	// 检查设备是否已经注册
	head = &MediaCallbackList;
	for(n=ListFirst(head); n!=head; n=ListNext(n))
	{
		link = ListEntry(n, CALLBACK_LINK, Link);
		if((link->Type & type) == type)
		{
			kmemcpy(callback, &link->Callback, sizeof(MEDIA_CALLBACK));
			return 0;
		}
	}
	return -1;
}
uint8_t fhssDistributedBlacklistMABExplore(Node_t *parent, uint64_t asn)
{
    uint8_t offset_to_explore = rand() % ListLength(&parent->channels);

    //PRINTF("FHSS exploring at %lld\n", (long long)asn);

    uint8_t i = 0;
    for (ListElem *elem = ListFirst(&parent->channels); elem != NULL; elem = ListNext(&parent->channels, elem))
    {
        if (i++ == offset_to_explore)
        {
            uint8_t freq_off = (uint8_t)elem->obj;

            return (fhssOpenwsnChan(freq_off, asn));
        }
    }

    return (0);
}
bool mrhofUpdateParents(List *nodesList, uint8_t rpl_algo)
{
    bool ret = false;

    /* Update the information for all nodes */
    for(ListElem *elem = ListFirst(nodesList); elem != NULL; elem = ListNext(nodesList, elem))
    {
        Node_t *node = (Node_t *)elem->obj;

        if (node->type != SINK && node->synced)
        {
            if (mrhofUpdateDAGRanks(node, nodesList))
            {
                ret = true;
            }
        }
    }

    return (ret);
}