示例#1
0
int	pa(t_element **a, t_element **b, char *letter)
{
  if (*b == NULL)
    return (1);
  my_putstr(letter);
  *a = add_top(*a, (*b)->val);
  *b = delete_top(*b);
  return (1);
}
示例#2
0
/*  show_panel    */
int
show_panel(PANEL *panel)
{
	/* Allocate the obscured nodes for the new panel */

	if (!panel || panel != panel -> below || !_alloc_overlap(_Panel_cnt))
		return (ERR);

	/* put the new panel on top of the pile */

	add_top(panel);
	(void) touchwin(panel -> win);
	return (OK);
}
示例#3
0
json_object* mico_get_device_info(struct mico_service_t service_table[])
{
  OSStatus err = kUnknownErr;
  properties_log_trace();
  json_object *dev_info_obj = NULL, *services = NULL, *properties = NULL;
  int service_index = 0, property_index = 0;
  const char *pServiceType = NULL;
  const char *pPropertyType = NULL;
  int iid = 1;
  
  services = json_object_new_array();
  require( services, exit );
  err = add_top(&dev_info_obj, MICO_PROP_KEY_RESP_SERVICES, services);
  
  for(service_index = 0, pServiceType = service_table[0].type; NULL != pServiceType; ){
    properties = json_object_new_array();
    require_action( properties, exit, err = kNoResourcesErr );
    err = add_service(services, "type", pServiceType, 
                      "iid", iid, "properties", properties);
    require_noerr( err, exit );
    iid++;
    
    for(property_index = 0, pPropertyType = service_table[service_index].properties[0].type;  NULL != pPropertyType; ){
      err = add_property(properties, service_table[service_index].properties[property_index], iid);
      require_noerr( err, exit );
      iid++;
      property_index++;
      pPropertyType = service_table[service_index].properties[property_index].type;
    }
    
    service_index++;
    pServiceType = service_table[service_index].type;
  }
  
exit:
  if(err != kNoErr && dev_info_obj){
    properties_log("ERROR: get_device_info err, err=%d", err);
    json_object_put(dev_info_obj);
    dev_info_obj = NULL;
  }
  return dev_info_obj;
}
示例#4
0
/*  new_panel    */
PANEL *
new_panel(WINDOW *window)
{
	PANEL	*panel;
	int	lines, cols;

	/* create a panel */

	if (!window || !_alloc_overlap(_Panel_cnt) ||
	    !(panel = (PANEL *) malloc(sizeof (PANEL))))
		return ((PANEL *) 0);

	panel -> win = window;
	getbegyx(window, panel -> wstarty, panel -> wstartx);
	getmaxyx(window, lines, cols);
	panel -> wendy = panel->wstarty + lines - 1;
	panel -> wendx = panel->wstartx + cols - 1;
	panel -> user = 0;

	/* put the new panel on top of the pile */

	add_top(panel);
	return (panel);
}