Ejemplo n.º 1
0
void list_dump(const list_node * const node)
{
	MESSAGE_DEBUG("node:%p\n", node);
	list_node *lp = (list_node *) node;
	LIST_FOR_EACH (lp)
		MESSAGE_DEBUG("list:%p prev:%p next:%p\n", lp, lp->prev, lp->next);
}
Ejemplo n.º 2
0
int list_count(list_node * node)
{
	MESSAGE_DEBUG("node:%p\n", node);
	int i = 0;
	LIST_FOR_EACH (node) i++;
	MESSAGE_DEBUG("return:%d\n", i);
	return i;
}
Ejemplo n.º 3
0
void si2bin_task_list_done(void)
{
	int index;
	
	LIST_FOR_EACH(si2bin_task_list, index)
		si2bin_task_free(list_get(si2bin_task_list, index));
	list_free(si2bin_task_list);
}
Ejemplo n.º 4
0
int LIST_NumOfObjs(t_List *p_List)
{
    t_List *p_Tmp;
    int    numOfObjs = 0;

    if (!LIST_IsEmpty(p_List))
        LIST_FOR_EACH(p_Tmp, p_List)
            numOfObjs++;

    return numOfObjs;
}
Ejemplo n.º 5
0
void vi_net_free(struct vi_net_t *net)
{
	int i;

	/* Free nodes */
	LIST_FOR_EACH(net->node_list, i)
		vi_net_node_free(list_get(net->node_list, i));
	list_free(net->node_list);

	/* Free network */
	free(net->name);
	free(net);
}
Ejemplo n.º 6
0
static void
CursorsIpc(const char *params)
{
   const char         *p;
   char                cmd[128], prm[4096];
   int                 len;
   ECursor            *ec;

   cmd[0] = prm[0] = '\0';
   p = params;
   if (p)
     {
	len = 0;
	sscanf(p, "%100s %4000s %n", cmd, prm, &len);
     }

   if (!strncmp(cmd, "list", 2))
     {
	LIST_FOR_EACH(ECursor, &cursor_list, ec) IpcPrintf("%s\n", ec->name);
     }
}
Ejemplo n.º 7
0
static void
ImageclassIpc(const char *params)
{
   char                param1[1024];
   char                param2[1024];
   int                 l;
   const char         *p;
   ImageClass         *ic;

   if (!params)
     {
	IpcPrintf("Please specify...\n");
	return;
     }

   p = params;
   l = 0;
   param1[0] = param2[0] = '\0';
   sscanf(p, "%1000s %1000s %n", param1, param2, &l);
   p += l;

   if (!strncmp(param1, "list", 2))
     {
	LIST_FOR_EACH(ImageClass, &iclass_list, ic) IpcPrintf("%s\n", ic->name);
	return;
     }

   if (!param1[0])
     {
	IpcPrintf("ImageClass not specified\n");
	return;
     }

   if (!strcmp(param2, "free_pixmap"))
     {
	EX_Pixmap           pmap;

	pmap = (EX_Pixmap) strtol(p, NULL, 0);
	EImagePixmapsFree(pmap, NoXID);
	return;
     }

   ic = ImageclassFind(param1, 0);
   if (!ic)
     {
	IpcPrintf("ImageClass not found: %s\n", param1);
	return;
     }

   if (!strcmp(param2, "get_padding"))
     {
	IpcPrintf("%i %i %i %i\n",
		  ic->padding.left, ic->padding.right,
		  ic->padding.top, ic->padding.bottom);
     }
   else if (!strcmp(param2, "get_image_size"))
     {
	ImagestateRealize(ic->norm.normal);
	if (ic->norm.normal->im)
	  {
	     int                 w, h;

	     EImageGetSize(ic->norm.normal->im, &w, &h);
	     EImageFree(ic->norm.normal->im);
	     IpcPrintf("%i %i\n", w, h);
	  }
     }
   else if (!strcmp(param2, "apply"))
     {
	EX_Window           xwin;
	Win                 win;
	char                state[20];
	int                 st, w, h;

	/* 3:xwin 4:state 5:w 6:h */
	xwin = NoXID;
	state[0] = '\0';
	w = h = -1;
	sscanf(p, "%x %16s %d %d", &xwin, state, &w, &h);

	win = ECreateWinFromXwin(xwin);
	if (!win)
	   return;

	if (!strcmp(state, "normal"))
	   st = STATE_NORMAL;
	else if (!strcmp(state, "hilited"))
	   st = STATE_HILITED;
	else if (!strcmp(state, "clicked"))
	   st = STATE_CLICKED;
	else if (!strcmp(state, "disabled"))
	   st = STATE_DISABLED;
	else
	   st = STATE_NORMAL;

	ImageclassApply(ic, win, 0, 0, st, ST_SOLID);
	EDestroyWin(win);
     }
   else if (!strcmp(param2, "apply_copy"))
     {
	EX_Window           xwin;
	Win                 win;
	char                state[20];
	int                 st, w, h;
	PmapMask            pmm;

	/* 3:xwin 4:state 5:w 6:h */
	xwin = NoXID;
	state[0] = '\0';
	w = h = -1;
	sscanf(p, "%x %16s %d %d", &xwin, state, &w, &h);

	win = ECreateWinFromXwin(xwin);
	if (!win)
	   return;

	if (!strcmp(state, "normal"))
	   st = STATE_NORMAL;
	else if (!strcmp(state, "hilited"))
	   st = STATE_HILITED;
	else if (!strcmp(state, "clicked"))
	   st = STATE_CLICKED;
	else if (!strcmp(state, "disabled"))
	   st = STATE_DISABLED;
	else
	   st = STATE_NORMAL;

	if (w < 0 || h < 0)
	  {
	     IpcPrintf("Error:  missing width and/or height\n");
	     return;
	  }

	ImageclassApplyCopy(ic, win, w, h, 0, 0, st, &pmm,
			    IC_FLAG_MAKE_MASK | IC_FLAG_FULL_SIZE, ST_SOLID);
	IpcPrintf("0x%08x 0x%08x\n", pmm.pmap, pmm.mask);
	EDestroyWin(win);
     }
   else if (!strcmp(param2, "query"))
     {
	IpcPrintf("ImageClass %s found\n", ic->name);
     }
   else if (!strcmp(param2, "ref_count"))
     {
	IpcPrintf("%u references remain\n", ic->ref_count);
     }
   else
     {
	IpcPrintf("Error: unknown operation specified\n");
     }
}