コード例 #1
0
ファイル: feed_list_view.c プロジェクト: lwindolf/liferea
static void
feed_list_view_selection_changed_cb (GtkTreeSelection *selection, gpointer data)
{
	GtkTreeIter		iter;
	GtkTreeModel	*model;
	nodePtr			node;

	if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
	 	gtk_tree_model_get (model, &iter, FS_PTR, &node, -1);

		debug1 (DEBUG_GUI, "feed list selection changed to \"%s\"", node_get_title (node));

		/* 1.) update feed list and item list states */
		g_signal_emit_by_name (FEED_LIST_VIEW (flv), "selection-changed", node->id);

		/* 2.) Refilter the GtkTreeView to get rid of nodes with 0 unread
		   messages when in reduced mode. */
		gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (flv->filter));

		if (node) {
			gboolean allowModify = (NODE_SOURCE_TYPE (node->source->root)->capabilities & NODE_SOURCE_CAPABILITY_WRITABLE_FEEDLIST);
			liferea_shell_update_update_menu ((NODE_TYPE (node)->capabilities & NODE_CAPABILITY_UPDATE) ||
			                                  (NODE_TYPE (node)->capabilities & NODE_CAPABILITY_UPDATE_CHILDS));
			liferea_shell_update_feed_menu (allowModify, TRUE, allowModify);
		} else {
			liferea_shell_update_feed_menu (TRUE, FALSE, FALSE);
		}
	} else {
		/* If we cannot get the new selection we keep the old one
		   this happens when we're doing drag&drop for example. */
	}
}
コード例 #2
0
ファイル: traverse.c プロジェクト: SLiV9/coconut-icecream
node *TRAVdo(node *arg_node, info *arg_info)
{
  DBUG_ASSERT( (arg_node != NULL),
                 "Trav: tried to traverse into subtree NULL !");
  
  DBUG_ASSERT( (NODE_TYPE( arg_node) <= MAX_NODES),
               "Trav: illegal node type !");

  DBUG_ASSERT( (travstack != NULL),
      "no traversal on stack!");

  global.line = NODE_LINE( arg_node);

  if (pretable[ travstack->traversal] != NULL) {
    arg_node = pretable[ travstack->traversal]( arg_node, arg_info);
  }

  arg_node = (travstack->funs[ NODE_TYPE( arg_node)])( arg_node, arg_info);

  if (posttable[ travstack->traversal] != NULL) {
    arg_node = posttable[ travstack->traversal]( arg_node, arg_info);
  }

  return( arg_node);
}
コード例 #3
0
ファイル: opt_sub.c プロジェクト: TammeThijs/Compilerbouw
node *OSbinop (node *arg_node, info *arg_info)
{
  DBUG_ENTER("OSbinop");

  /*
   * Extremely important:
   *  we must continue to traverse the abstract syntax tree !!
   */
  BINOP_LEFT( arg_node) = TRAVdo( BINOP_LEFT( arg_node), arg_info);
  BINOP_RIGHT( arg_node) = TRAVdo( BINOP_RIGHT( arg_node), arg_info);

  if (BINOP_OP( arg_node) == BO_sub) {
    if ((NODE_TYPE( BINOP_LEFT( arg_node)) == N_var)
	&& (NODE_TYPE( BINOP_RIGHT( arg_node)) == N_var)
	&& STReq( VAR_NAME( BINOP_LEFT( arg_node)), VAR_NAME( BINOP_RIGHT( arg_node)))) {
      arg_node = FREEdoFreeTree( arg_node);
      arg_node = TBmakeNum( 0);
    }
    else if  ((NODE_TYPE( BINOP_LEFT( arg_node)) == N_num)
	      && (NODE_TYPE( BINOP_RIGHT( arg_node)) == N_num)
	      && (NUM_VALUE( BINOP_LEFT( arg_node)) == NUM_VALUE( BINOP_RIGHT( arg_node)))) {
      arg_node = FREEdoFreeTree( arg_node);
      arg_node = TBmakeNum( 0);
    }
  }

  DBUG_RETURN( arg_node);
}
コード例 #4
0
ファイル: node.c プロジェクト: hinovana/rabbitlang
NODE node_list_add( NODE list_node, NODE add_node )
{
	NODE new_list;
	NODE last;
	
	assert( list_node );
	assert( add_node );
	
	if( list_node == 0 || NODE_TYPE(list_node) != NODE_E_LIST ) {
		fprintf( stderr, "type error - node type %d\n", NODE_TYPE(list_node) );
		abort();
	}

	NODE2LIST(list_node)->len++;

	if( NODE2LIST(list_node)->node == (NODE)NULL ) {
		NODE2LIST(list_node)->node = add_node;
		return list_node;
	}

	new_list = node_list_new( add_node );
	last = list_node;

	while(1) {
		if( NODE2LIST(last)->next == 0 ) {
			break;
		}
		last = NODE2LIST(last)->next;
	}
	NODE2LIST(last)->next = new_list;
	
	return list_node;
}
コード例 #5
0
void
validate_desc(struct node *np)
{
	NODE_TYPE(np) = USBMGR_TYPE_NONE;	
	if (NODE_VENDOR(np) != VENDOR_NONE)
		NODE_TYPE(np) |= USBMGR_TYPE_VENDOR;
	if (NODE_CLASS(np) != CLASS_NONE) 
		NODE_TYPE(np) |= USBMGR_TYPE_CLASS;
}
コード例 #6
0
void
print_device(struct node *np)
{
	if (NODE_TYPE(np) & USBMGR_TYPE_VENDOR)
		syslog(LOG_INFO,mesg[MSG_VENDOR_S],
			NODE_VENDOR(np),NODE_PRODUCT(np));
	if (NODE_TYPE(np) & USBMGR_TYPE_CLASS)
		syslog(LOG_INFO,mesg[MSG_CLASS_S],
			NODE_CLASS(np),NODE_SUBCLASS(np),NODE_PROTOCOL(np));
}
コード例 #7
0
ファイル: cpl_run.c プロジェクト: 2pac/kamailio
struct cpl_interpreter* new_cpl_interpreter( struct sip_msg *msg, str *script)
{
	struct cpl_interpreter *intr = 0;

	intr = (struct cpl_interpreter*)shm_malloc(sizeof(struct cpl_interpreter));
	if (!intr) {
		LM_ERR("no more shm free memory!\n");
		goto error;
	}
	memset( intr, 0, sizeof(struct cpl_interpreter));

	/* init the interpreter*/
	intr->script.s = script->s;
	intr->script.len = script->len;
	intr->recv_time = time(0);
	intr->ip = script->s;
	intr->msg = msg;

	/* check the beginning of the script */
	if ( NODE_TYPE(intr->ip)!=CPL_NODE ) {
		LM_ERR("first node is not CPL!!\n");
		goto error;
	}

	return intr;
error:
	return 0;
}
コード例 #8
0
ファイル: feed_list_view.c プロジェクト: lwindolf/liferea
void
on_menu_properties (GSimpleAction *action, GVariant *parameter, gpointer user_data)
{
	nodePtr node = feedlist_get_selected ();

	NODE_TYPE (node)->request_properties (node);
}
コード例 #9
0
ファイル: calcconst.c プロジェクト: SLiV9/coconut-icecream
node* CALCCONSTmonop(node *arg_node, info *arg_info){
  DBUG_ENTER ("CALCCONSTmonop");
  node * ret;
  MONOP_EXPR( arg_node) = TRAVopt( MONOP_EXPR( arg_node), NULL);
  nodetype nt = NODE_TYPE(MONOP_EXPR( arg_node));
  if(MONOP_OP(arg_node) == MO_not && nt == N_bool){
    ret = TBmakeBool(! BOOL_VALUE(MONOP_EXPR( arg_node)));
    FREEdoFreeNode(arg_node);
    DBUG_RETURN(ret);
  }else if(MONOP_OP(arg_node) == MO_neg){
    if(nt == N_int){
      ret = TBmakeInt(-INT_VALUE(MONOP_EXPR( arg_node)));
    FREEdoFreeNode(arg_node);
    DBUG_RETURN(ret);

    }else if(nt == N_float){
      ret = TBmakeFloat(-FLOAT_VALUE(MONOP_EXPR( arg_node)));
    FREEdoFreeNode(arg_node);
    DBUG_RETURN(ret);

    }else{
      DBUG_RETURN (arg_node);
    }
  }else{
    DBUG_RETURN (arg_node);
  }

}
コード例 #10
0
ファイル: my_fs.c プロジェクト: lori-lee/my-file-system
int32 write_file (int32 i_file_node_index, const void *p_addr, int32 offset, int32 len)
{
    directory _tmp_directory;
    int32 i_page_index, i_page_offset, i_page_real_index, i_rt_code;

    if (len <= 0) return 0;

    _get_directory_node_value (i_file_node_index, &_tmp_directory);
    if (TYPE_FILE != NODE_TYPE (_tmp_directory)
        || NODE_IS_FREE(_tmp_directory) || _tmp_directory.parent_filesize < 0) {
        return E_INVALID_PARAM;
    }
    offset = MAX (MIN (offset, _tmp_directory.parent_filesize - 1), 0);
    if (offset + len + 1 > _tmp_directory.parent_filesize) {
        INIT_SUPER_PAGE ();
        if (g_p_super_page->idle_pages_num < PAGES_OCCUPIED (offset + len + 1 - _tmp_directory.parent_filesize)) return E_LACK_SPACE;
    }

    if (offset < _tmp_directory.parent_filesize) {
        i_page_offset= offset & ~(PAGE_SIZE - 1);
        if (!offset) {
            i_page_real_index = _tmp_directory.first_data_page;
        } else {
            i_page_index = offset >> PAGE_SCALE;
            i_page_real_index = _get_page_index_by_link_node_index (_tmp_directory.first_data_page, i_page_index);
        }
    }
コード例 #11
0
ファイル: xinput.c プロジェクト: ra-one/snet-rts
/* Read one record from the parser. */
input_state_t SNetGetNextInputRecord(landing_t *land)
{
  landing_input_t       *linp = LAND_SPEC(land, input);
  input_arg_t           *iarg = NODE_SPEC(land->node, input);
  snet_record_t         *record = NULL;

  trace(__func__);
  assert(NODE_TYPE(land->node) == NODE_input);

  if (iarg->state == INPUT_reading) {
    // Ask parser for a new input record.
    while (SNetInParserGetNextRecord(&record) == SNET_PARSE_CONTINUE) {
      if (record) {
        break;
      }
    }
    if (record) {
      if (REC_DESCR(record) == REC_terminate) {
        SNetRecDestroy(record);
        iarg->state = INPUT_terminating;
      } else {
        linp->num_inputs += 1;
        SNetWrite(&linp->outdesc, record, false);
        return INPUT_reading;
      }
    } else {
      iarg->state = INPUT_terminating;
    }
    return iarg->state;
  } else {
    return INPUT_terminated;
  }
}
コード例 #12
0
ファイル: node.c プロジェクト: hinovana/rabbitlang
NODE node_if_elsif_list_set( NODE if_node, NODE elsif_list )
{
	assert( if_node );
	assert( elsif_list );
	
	if( NODE_TYPE(if_node) != NODE_E_IF ) {
		fprintf( stderr, "type error(if_node) - node_if_elsif_list_set\n" );
		abort();
	}
	if( NODE_TYPE(elsif_list) != NODE_E_LIST ) {
		fprintf( stderr, "type error(elseif_list) - node_if_elsif_list_set\n" );
		abort();
	}
	NODE2IF(if_node)->elsif_list = elsif_list;
	return (NODE)if_node;
}
コード例 #13
0
ファイル: node.c プロジェクト: lwindolf/liferea
/* determines the nodes favicon or default icon */
gpointer
node_get_icon (nodePtr node)
{
	if (!node->icon)
		return (gpointer) NODE_TYPE(node)->icon;

	return node->icon;
}
コード例 #14
0
ファイル: compiler.c プロジェクト: sanchapereira/tinyrb-ist
static int TrCompiler_compile_node_to_RK(VM, TrCompiler *c, TrBlock *b, TrNode *n, int reg) {
  int i;
  
  /* k value */
  if (NODE_TYPE(n) == NODE_VALUE) {
    return TrBlock_push_value(b, NODE_ARG(n, 0)) | 0x100;
    
  /* local */
  } else if (NODE_TYPE(n) == NODE_SEND && (i = TrBlock_find_local(b, NODE_ARG(NODE_ARG(n, 1), 0))) != -1) {
    return i;
  
  /* not a local, need to compile */
  } else {
    COMPILE_NODE(b, n, reg);
    return reg;
  }
  
}
コード例 #15
0
ファイル: feedlist.c プロジェクト: dmitryvk/liferea
gboolean
feedlist_is_writable (void)
{
	nodePtr node;
	
	node = feedlist_get_parent_node ();
	
	return (0 != (NODE_TYPE (node->source->root)->capabilities & NODE_CAPABILITY_ADD_CHILDS));
}
コード例 #16
0
ファイル: node.c プロジェクト: lwindolf/liferea
void
node_remove (nodePtr node)
{
	/* using itemlist_remove_all_items() ensures correct unread
	   and item counters for all parent folders and matching
	   search folders */
	itemlist_remove_all_items (node);

	NODE_TYPE (node)->remove (node);
}
コード例 #17
0
ファイル: node.c プロジェクト: lwindolf/liferea
gboolean
node_can_add_child_folder (nodePtr node)
{
	g_assert (node->source->root);

	if (!(NODE_TYPE (node->source->root)->capabilities & NODE_CAPABILITY_ADD_CHILDS))
		return FALSE;

	return (NODE_SOURCE_TYPE (node)->capabilities & NODE_SOURCE_CAPABILITY_ADD_FOLDER);
}
コード例 #18
0
ファイル: node.c プロジェクト: lwindolf/liferea
static void
node_calc_counters (nodePtr node)
{
	/* Order is important! First update all children
	   so that hierarchical nodes (folders and feed
	   list sources) can determine their own unread
	   count as the sum of all childs afterwards */
	node_foreach_child (node, node_calc_counters);

	NODE_TYPE (node)->update_counters (node);
}
コード例 #19
0
ファイル: node.c プロジェクト: hinovana/rabbitlang
NODE node_method_call_block_set( NODE mcall_node, NODE params_nd, NODE list_nd )
{
	assert( mcall_node );
	
	if( NODE_TYPE(mcall_node) != NODE_E_METHOD_CALL ) {
		fprintf( stderr, "parser error - %s:%d \n", __FILE__, __LINE__ );
		abort();
	}
	NODE2MCALL(mcall_node)->func_block = node_function_new( params_nd, list_nd );

	return mcall_node;
}
コード例 #20
0
/* UPDATED + CHECKED
 */
static inline char *run_sub( struct cpl_interpreter *intr )
{
	char  *p;
	unsigned short offset;
	unsigned short attr_name;
	int i;

	/* sanity check */
	if (NR_OF_KIDS(intr->ip)!=0) {
		LOG(L_ERR,"ERROR:cpl_c:run_sub: SUB node doesn't suppose to have any "
			"sub-nodes. Found %d!\n",NR_OF_KIDS(intr->ip));
		goto script_error;
	}

	/* check the number of attr */
	i = NR_OF_ATTR( intr->ip );
	if (i!=1) {
		LOG(L_ERR,"ERROR:cpl_c:run_sub: incorrect nr. of attr. %d (<>1) in "
			"SUB node\n",i);
		goto script_error;
	}
	/* get attr's name */
	p = ATTR_PTR(intr->ip);
	get_basic_attr( p, attr_name, offset, intr, script_error);
	if (attr_name!=REF_ATTR) {
		LOG(L_ERR,"ERROR:cpl_c:run_sub: invalid attr. %d (expected %d)in "
			"SUB node\n", attr_name, REF_ATTR);
		goto script_error;
	}
	/* make the jump */
	p = intr->ip - offset;
	/* check the destination pointer -> are we still inside the buffer ;-) */
	if (((char*)p)<intr->script.s) {
		LOG(L_ERR,"ERROR:cpl_c:run_sub: jump offset lower than the script "
			"beginning -> underflow!\n");
		goto script_error;
	}
	check_overflow_by_ptr( p+SIMPLE_NODE_SIZE(intr->ip), intr, script_error);
	/* check to see if we hit a subaction node */
	if ( NODE_TYPE(p)!=SUBACTION_NODE ) {
		LOG(L_ERR,"ERROR:cpl_c:run_sub: sub. jump hit a nonsubaction node!\n");
		goto script_error;
	}
	if ( NR_OF_ATTR(p)!=0 ) {
		LOG(L_ERR,"ERROR:cpl_c:run_sub: inavlid subaction node reached "
		"(attrs=%d); expected (0)!\n",NR_OF_ATTR(p));
		goto script_error;
	}

	return get_first_child(p);
script_error:
	return CPL_SCRIPT_ERROR;
}
コード例 #21
0
ファイル: node.c プロジェクト: lwindolf/liferea
gchar *
node_default_render (nodePtr node)
{
	gchar		*result;
	xmlDocPtr	doc;

	doc = node_to_xml (node);
	result = render_xml (doc, NODE_TYPE(node)->id, NULL);
	xmlFreeDoc (doc);

	return result;
}
コード例 #22
0
ファイル: node.c プロジェクト: hinovana/rabbitlang
NODE node_if_else_block_set( NODE if_node, NODE else_block )
{
	assert( if_node );
	assert( else_block );
	
	if( NODE_TYPE(if_node) != NODE_E_IF ) {
		fprintf( stderr, "type error - node_if_else_block_set\n" );
		abort();
	}
	NODE2IF(if_node)->else_block = else_block;
	return (NODE)if_node;
}
コード例 #23
0
ファイル: node.c プロジェクト: lwindolf/liferea
void
node_update_favicon (nodePtr node)
{
	if (NODE_TYPE (node)->capabilities & NODE_CAPABILITY_UPDATE_FAVICON) {
		debug1 (DEBUG_UPDATE, "favicon of node %s needs to be updated...", node->title);
		subscription_update_favicon (node->subscription);
	}

	/* Recursion */
	if (node->children)
		node_foreach_child (node, node_update_favicon);
}
コード例 #24
0
ファイル: cpl_run.c プロジェクト: 2pac/kamailio
/* UPDATED + CHECKED
 */
static inline char *run_cpl_node( struct cpl_interpreter *intr )
{
	char *kid;
	unsigned char start;
	int i;

	start = (intr->flags&CPL_RUN_INCOMING)?INCOMING_NODE:OUTGOING_NODE;
	/* look for the starting node (incoming or outgoing) */
	for(i=0;i<NR_OF_KIDS(intr->ip);i++) {
		kid= intr->ip + KID_OFFSET(intr->ip,i);
		if ( NODE_TYPE(kid)==start ) {
			return get_first_child(kid);
		} else
		if (NODE_TYPE(kid)==SUBACTION_NODE ||
		NODE_TYPE(kid)==ANCILLARY_NODE ||
		NODE_TYPE(kid)==INCOMING_NODE  ||
		NODE_TYPE(kid)==OUTGOING_NODE ) {
			continue;
		} else {
			LM_ERR("unknown child type (%d) "
				"for CPL node!!\n",NODE_TYPE(kid));
			return CPL_SCRIPT_ERROR;
		}
	}

	LM_DBG("CPL node has no %d subnode -> default\n", start);
	return DEFAULT_ACTION;
}
コード例 #25
0
ファイル: node.c プロジェクト: lwindolf/liferea
void
node_free (nodePtr node)
{
	if (node->data && NODE_TYPE (node)->free)
		NODE_TYPE (node)->free (node);

	g_assert (NULL == node->children);

	g_hash_table_remove (nodes, node->id);

	update_job_cancel_by_owner (node);

	if (node->subscription)
		subscription_free (node->subscription);

	if (node->icon)
		g_object_unref (node->icon);
	g_free (node->iconFile);
	g_free (node->title);
	g_free (node->id);
	g_free (node);
}
コード例 #26
0
struct node *
create_device(struct usbmgr_device *dev)
{
	struct node *np;

	np = create_node_data_link(&device_ring,dev,sizeof(struct usbmgr_device)); 
	if (np == NULL)
		return NULL;
	NODE_STATUS(np) = USBMGR_ST_UNKNOWN;
	NODE_TYPE(np) = USBMGR_TYPE_NONE;

	return np;
}
コード例 #27
0
ファイル: feedlist.c プロジェクト: dmitryvk/liferea
void
feedlist_add_folder (const gchar *title)
{
	nodePtr		parent;
	
	g_assert (NULL != title);

	parent = feedlist_get_parent_node ();

	if(0 == (NODE_TYPE (parent->source->root)->capabilities & NODE_CAPABILITY_ADD_CHILDS))
		return;	

	node_source_add_folder (parent->source->root, title);
}
コード例 #28
0
ファイル: feedlist.c プロジェクト: dmitryvk/liferea
void
feedlist_add_subscription (const gchar *source, const gchar *filter, updateOptionsPtr options, gint flags)
{
	nodePtr		parent;

	g_assert (NULL != source);

	parent = feedlist_get_parent_node ();

	if (0 == (NODE_TYPE (parent->source->root)->capabilities & NODE_CAPABILITY_ADD_CHILDS)) {
		g_warning ("feedlist_add_subscription: this should never happen!");
		return;
	}

	node_source_add_subscription (parent->source->root, subscription_new (source, filter, options));
}
コード例 #29
0
ファイル: itemview.c プロジェクト: LMephisto/liferea
void
itemview_update (void)
{
	item_list_view_update (itemview->priv->itemListView, itemview->priv->hasEnclosures);
	
	if (itemview->priv->node) {
		item_list_view_enable_favicon_column (itemview->priv->itemListView, NODE_TYPE (itemview->priv->node)->capabilities & NODE_CAPABILITY_SHOW_ITEM_FAVICONS);
		item_list_view_set_sort_column (itemview->priv->itemListView, itemview->priv->node->sortColumn, itemview->priv->node->sortReversed);
	}
	
	if (itemview->priv->needsHTMLViewUpdate) {
		itemview->priv->needsHTMLViewUpdate = FALSE;
		htmlview_update (itemview->priv->htmlview, itemview->priv->mode);
	}
	if (itemview->priv->node)
		liferea_shell_update_allitems_actions (0 != itemview->priv->node->itemCount, 0 != itemview->priv->node->unreadCount);
}
コード例 #30
0
ファイル: traverse.c プロジェクト: foliern/LUT_relocate
node *TRAVdo(node *arg_node, info *arg_info)
{
  nodetype arg_node_type;
  char *old_file = global.nodefile;
  int old_line = global.nodeline;
  int old_col = global.nodecol;

  /*
   * check whether the node is non null as this
   * is a common reason for segfaults
   */
  DBUG_ASSERT( (arg_node != NULL),
               "tried to traverse a node which is NULL!");

  /*
   * Make sure the location will be set
   * correctly in case MakeXxx is called.
   */
  global.nodefile = NODE_FILE(arg_node);
  global.nodeline = NODE_LINE(arg_node);
  global.nodecol  = NODE_COL( arg_node);

  /*
   * Save node type as it might be modified during traversal
   */
  arg_node_type = NODE_TYPE( arg_node);

  if (pretable[ travstack->traversal] != NULL) {
    arg_node = pretable[ travstack->traversal]( arg_node, arg_info);
  }

  arg_node = (travstack->funs[ arg_node_type])( arg_node, arg_info);

  if (posttable[ travstack->traversal] != NULL) {
    arg_node = posttable[ travstack->traversal]( arg_node, arg_info);
  }

  global.nodefile = old_file;
  global.nodeline = old_line;
  global.nodecol  = old_col;

  return( arg_node);
}