Пример #1
0
//show entry index sequences -- for debug purposes.
void XmlSync::check1()
{
    QDomElement codeNode_in, codeNode_out;
    QDomElement entryNode_in, entryNode_out;
    quint32 i, index;

    GET_NODE(root_in, "code", codeNode_in);
    GET_NODE(root_out, "code", codeNode_out);
    GET_FIRST_CHILD_NODE(codeNode_in, entryNode_in);
    GET_FIRST_CHILD_NODE(codeNode_out, entryNode_out);

    for (i = 0; i < 30; i++)
    {
        ATTRIBUTE_TO_UINT(entryNode_in, "index", index, quint32);
        printf("%d ", index);
        entryNode_in = entryNode_in.nextSiblingElement();
    }

    printf("\n\n");

    for (i = 0; i < 30; i++)
    {
        ATTRIBUTE_TO_UINT(entryNode_out, "index", index, quint32);
        printf("%i ", index);
        entryNode_out=entryNode_out.nextSiblingElement();
    }

    printf("\n\n");
}
Пример #2
0
bool ehgraph_transfer_edge(ehgraph_t* dest, enode_t n1, ehgraph_t* src, enode_t n2, size_t link) {
  bool bRet = false; 
  do {
    CheckNotNULL(dest);
    CheckNotNULL(src);
    CheckLessThan(n1, dest->size);
    CheckLessThan(n2, src->size);
    CheckEqual(src->nLinks, dest->nLinks);
    CheckLessThan(link, src->nLinks);

    size_t nL = src->nLinks;
    
    enode_info_t* nDst = &GET_NODE(dest, n1);
    enode_info_t* nSrc = &GET_NODE(src, n2);
    
    if (link == 0) 
      nDst->outDoubleLink = nSrc->outDoubleLink;
    
    if (1 == link)
      nDst->inDoubleLink = nSrc->inDoubleLink;
    

    nDst->links[link] = nSrc->links[link];
    nDst->superEdge[link] = nSrc->superEdge[link];
      
    for (size_t ld = 0; ld < nL; ++ld) {
      nDst->isPredicate[link][ld] = nSrc->isPredicate[link][ld];
      nDst->predicateTarget[link][ld] = nSrc->predicateTarget[link][ld];
    }

    bRet = true;
  } while(0);

  return bRet;
}
int reset_pnodes(int curr, int pnode)
{
	struct msm_bus_inode_info *info;
	struct msm_bus_fabric_device *fabdev;
	int index, next_pnode;
	fabdev = msm_bus_get_fabric_device(GET_FABID(curr));
	if (!fabdev) {
		MSM_BUS_ERR("Fabric not found for: %d\n",
			(GET_FABID(curr)));
			return -ENXIO;
	}

	index = GET_INDEX(pnode);
	info = fabdev->algo->find_node(fabdev, curr);
	if (!info) {
		MSM_BUS_ERR("Cannot find node info!\n");
		return -ENXIO;
	}

	MSM_BUS_DBG("Starting the loop--remove\n");
	do {
		struct msm_bus_inode_info *hop;
		fabdev = msm_bus_get_fabric_device(GET_FABID(curr));
		if (!fabdev) {
			MSM_BUS_ERR("Fabric not found\n");
				return -ENXIO;
		}

		next_pnode = info->pnode[index].next;
		info->pnode[index].next = -2;
		curr = GET_NODE(next_pnode);
		index = GET_INDEX(next_pnode);
		if (IS_NODE(curr))
			hop = fabdev->algo->find_node(fabdev, curr);
		else
			hop = fabdev->algo->find_gw_node(fabdev, curr);
		if (!hop) {
			MSM_BUS_ERR("Null Info found for hop\n");
			return -ENXIO;
		}

		MSM_BUS_DBG("%d[%d] = %d\n", info->node_info->priv_id, index,
			info->pnode[index].next);
		MSM_BUS_DBG("num_pnodes: %d: %d\n", info->node_info->priv_id,
			info->num_pnodes);
		info = hop;
	} while (GET_NODE(info->pnode[index].next) != info->node_info->priv_id);

	info->pnode[index].next = -2;
	MSM_BUS_DBG("%d[%d] = %d\n", info->node_info->priv_id, index,
		info->pnode[index].next);
	MSM_BUS_DBG("num_pnodes: %d: %d\n", info->node_info->priv_id,
		info->num_pnodes);
	return 0;
}
Пример #4
0
bool ehgraph_set_pred(ehgraph_t* graph, enode_t node, size_t edge, size_t link, size_t target) {
  if (NULL == graph) {
    DB_ERROR("null argument");
    return false;
  }

  GET_NODE(graph, node).superEdge[edge] = true;
  GET_NODE(graph, node).isPredicate[edge][link] = true;
  GET_NODE(graph, node).predicateTarget[edge][link] = target;
  return true;
}
Пример #5
0
void AnimationTreePlayer::oneshot_node_set_fadeout_time(const StringName& p_node,float p_time) {

	GET_NODE( NODE_ONESHOT, OneShotNode );
	n->fade_out=p_time;


}
Пример #6
0
void AnimationTreePlayer::timeseek_node_seek(const StringName& p_node,float p_pos) {


	GET_NODE( NODE_TIMESEEK, TimeSeekNode );
	n->seek_pos=p_pos;

}
Пример #7
0
void AnimationTreePlayer::timescale_node_set_scale(const StringName& p_node,float p_scale) {


	GET_NODE( NODE_TIMESCALE, TimeScaleNode );
	n->scale=p_scale;

}
Пример #8
0
void AnimationTreePlayer::oneshot_node_start(const StringName& p_node) {

	GET_NODE( NODE_ONESHOT, OneShotNode );
	n->active=true;
	n->start=true;

}
Пример #9
0
void XmlSync::processEntryType05(QDomElement &parentNode, QByteArray *data)
{
    QDomElement entryNode = parentNode.firstChildElement();
    QTextCodec *codec = QTextCodec::codecForName("Shift-JIS");

    while(!entryNode.isNull())
    {
        if(entryNode.tagName() == QString("text"))
        {
            QDomElement originalNode;
            QString originalText;

            GET_NODE(entryNode, "original", originalNode);
            GET_NODE_TEXT(originalNode, originalText);

            data->append(codec->fromUnicode(originalText));
        }
        else if (entryNode.tagName() == QString("ctrl"))
        {
            QString ctrlString;

            ATTRIBUTE_TO_STRING_NOT_EMPTY(entryNode, "value", ctrlString);
            data->append(ctrlString);
        }
        else
        {
            fatalExit("Unknown tag (not 'text' or 'ctrl')");
        }

        entryNode = entryNode.nextSiblingElement();
    }
}
Пример #10
0
/**
 * build mtree from serialized mtree data
 *
 * @params[in] pointer to serialized data
 * @returns handle to new mtree
 *
 */
H _m_unserialize(void *s) {
    M *m = malloc(sizeof(M));
    m->magic = ((M *)s)->magic;
    m->levels = ((M *)s)->levels;
    m->lP = malloc(sizeof(L)*m->levels);
    H h = {m,{0,0}};
    void *blob = ((S *)s)->blob_offset + (void *)s;

    uint32_t s_size = SERIALIZED_HEADER_SIZE(m->levels);
    for(h.a.l=0; h.a.l<m->levels; h.a.l++) {
    L *sl = (L *) (((void *)s) + s_size + ((S *)s)->level_offsets[h.a.l]);
    L *l = GET_LEVEL(h);
    l->nodes = sl->nodes;
    l->nP = malloc(sizeof(N)*l->nodes);
    N *sn = sizeof(Mindex)+(void *)sl;
    for(h.a.i=0;h.a.i < l->nodes;h.a.i++) {
        N *n = GET_NODE(h,l);
        *n = *sn;
        void *surface = blob+*(size_t *)&sn->surface;
        if (n->flags & TFLAG_ALLOCATED) {
        n->surface = malloc(sn->size);
        memcpy(n->surface,surface,sn->size);
        }
        else {
        *((int *)&n->surface) = *((int *)&sn->surface);
        }
        sn = (N *) (SERIALIZED_NODE_SIZE + ((void*)sn));
    }
    }
    h.a.i = h.a.l = 0;
    return h;
}
Пример #11
0
void AnimationTreePlayer::transition_node_set_input_auto_advance(const StringName& p_node, int p_input,bool p_auto_advance) {

	GET_NODE( NODE_TRANSITION, TransitionNode );
	ERR_FAIL_INDEX(p_input,n->input_data.size());

	n->input_data[p_input].auto_advance=p_auto_advance;

}
Пример #12
0
ehgraph_t* permute_graph(ehgraph_t* graph, int* perm) {
  ehgraph_t* ret = NULL, *b = NULL;

  do {
    CheckNotNULL(graph);
    CheckNotNULL(perm);

    if (0 != perm[0]) {
      DB_ERROR("the null element should remain unchanged in the permutation");
      break;
    }
    
    b = ehgraph_alloc(NULL, graph->size, graph->ptrdim, graph->nLinks);
    if (!b) {
      DB_ERROR("allocation failed");
      break;
    }

    b->closed = graph->closed;

    for (enode_t i = 0; i < graph->ptrdim; ++i) 
      VAR2NODE(b, i) = perm[ VAR2NODE(graph, i) ];

    for (enode_t i = 0; i < graph->size; ++i) {
      GET_NODE(b, perm[i]).inDoubleLink = GET_NODE(graph, i).inDoubleLink;
      GET_NODE(b, perm[i]).outDoubleLink = GET_NODE(graph, i).outDoubleLink;

      for (size_t l = 0; l < graph->nLinks; ++l) {
	GET_LINK(b, perm[i], l) = perm[ GET_LINK(graph, i, l) ];
	GET_NODE(b, perm[i]).superEdge[l] = GET_NODE(graph, i).superEdge[l];

	for (size_t lp = 0; lp < graph->nLinks; ++lp) {
	  GET_NODE(b, perm[i]).isPredicate[l][lp] = GET_NODE(graph, i).isPredicate[l][lp];
	  GET_NODE(b, perm[i]).predicateTarget[l][lp] = perm[ GET_NODE(graph, i).predicateTarget[l][lp] ];
	}
      }
    }
	   
    ret = b;
  } while(0);
  
  if (!ret)
    SafeFree(b);
  
  return ret;
}
Пример #13
0
void AnimationTreePlayer::animation_node_set_animation(const StringName& p_node,const Ref<Animation>& p_animation) {

	GET_NODE( NODE_ANIMATION, AnimationNode );
	n->animation=p_animation;
	dirty_caches=true;


}
/**
 * add_path_node: Adds the path information to the current node
 * @info: Internal node info structure
 * @next: Combination of the id and index of the next node
 * Function returns: Number of pnodes (path_nodes) on success,
 * error on failure.
 *
 * Every node maintains the list of path nodes. A path node is
 * reached by finding the node-id and index stored at the current
 * node. This makes updating the paths with requested bw and clock
 * values efficient, as it avoids lookup for each update-path request.
 */
static int add_path_node(struct msm_bus_inode_info *info, int next)
{
	struct path_node *pnode;
	int i;
	if (ZERO_OR_NULL_PTR(info)) {
		MSM_BUS_ERR("Cannot find node info!: id :%d\n",
				info->node_info->priv_id);
		return -ENXIO;
	}

	for (i = 0; i <= info->num_pnodes; i++) {
		if (info->pnode[i].next == -2) {
			MSM_BUS_DBG("Reusing pnode for info: %d at index: %d\n",
				info->node_info->priv_id, i);
			info->pnode[i].clk[DUAL_CTX] = 0;
			info->pnode[i].clk[ACTIVE_CTX] = 0;
			info->pnode[i].bw[DUAL_CTX] = 0;
			info->pnode[i].bw[ACTIVE_CTX] = 0;
			info->pnode[i].next = next;
			MSM_BUS_DBG("%d[%d] : (%d, %d)\n",
				info->node_info->priv_id, i, GET_NODE(next),
				GET_INDEX(next));
			return i;
		}
	}

	info->num_pnodes++;
	pnode = krealloc(info->pnode,
		((info->num_pnodes + 1) * sizeof(struct path_node))
		, GFP_KERNEL);
	if (ZERO_OR_NULL_PTR(pnode)) {
		MSM_BUS_ERR("Error creating path node!\n");
		info->num_pnodes--;
		return -ENOMEM;
	}
	info->pnode = pnode;
	info->pnode[info->num_pnodes].clk[DUAL_CTX] = 0;
	info->pnode[info->num_pnodes].clk[ACTIVE_CTX] = 0;
	info->pnode[info->num_pnodes].bw[DUAL_CTX] = 0;
	info->pnode[info->num_pnodes].bw[ACTIVE_CTX] = 0;
	info->pnode[info->num_pnodes].next = next;
	MSM_BUS_DBG("%d[%d] : (%d, %d)\n", info->node_info->priv_id,
		info->num_pnodes, GET_NODE(next), GET_INDEX(next));
	return info->num_pnodes;
}
Пример #15
0
sl_iter_t *sl_iter_begin (skiplist_t *sl, map_key_t key) {
    sl_iter_t *iter = (sl_iter_t *)nbd_malloc(sizeof(sl_iter_t));
    if (key != DOES_NOT_EXIST) {
        find_preds(NULL, &iter->next, 1, sl, key, DONT_UNLINK);
    } else {
        iter->next = GET_NODE(sl->head->next[0]);
    }
    return iter;
}
Пример #16
0
bool ehgraph_del_pred(ehgraph_t* graph, enode_t node, size_t edge, size_t link) {
  if (NULL == graph) {
    DB_ERROR("null argument");
    return false;
  }

  GET_NODE(graph, node).isPredicate[edge][link] = false;
  return true;
}
Пример #17
0
map_key_t sl_min_key (skiplist_t *sl) {
    node_t *item = GET_NODE(sl->head->next[0]);
    while (item != NULL) {
        markable_t next = item->next[0];
        if (!HAS_MARK(next))
            return item->key;
        item = STRIP_MARK(next);
    }
    return DOES_NOT_EXIST;
}
Пример #18
0
void AnimationTreePlayer::oneshot_node_set_filter_path(const StringName& p_node,const NodePath& p_filter,bool p_enable) {

	GET_NODE( NODE_ONESHOT, OneShotNode );

	if (p_enable)
		n->filter[p_filter]=true;
	else
		n->filter.erase(p_filter);

}
Пример #19
0
void AnimationTreePlayer::blend2_node_set_filter_path(const StringName& p_node,const NodePath& p_filter,bool p_enable) {

	GET_NODE( NODE_BLEND2, Blend2Node );

	if (p_enable)
		n->filter[p_filter]=true;
	else
		n->filter.erase(p_filter);

}
Пример #20
0
void AnimationTreePlayer::animation_node_set_master_animation(const StringName& p_node,const String& p_master_animation) {

	GET_NODE( NODE_ANIMATION, AnimationNode );
	n->from=p_master_animation;
	dirty_caches=true;
	if (master!=NodePath())
		_update_sources();


}
Пример #21
0
void sl_free (skiplist_t *sl) {
    node_t *item = GET_NODE(sl->head->next[0]);
    while (item) {
        node_t *next = STRIP_MARK(item->next[0]);
        if (sl->key_type != NULL) {
            nbd_free((void *)item->key);
        }
        nbd_free(item);
        item = next;
    }
}
Пример #22
0
size_t sl_count (skiplist_t *sl) {
    size_t count = 0;
    node_t *item = GET_NODE(sl->head->next[0]);
    while (item) {
        if (!HAS_MARK(item->next[0])) {
            count++;
        }
        item = STRIP_MARK(item->next[0]);
    }
    return count;
}
Пример #23
0
void AnimationTreePlayer::transition_node_set_input_count(const StringName& p_node, int p_inputs) {


	GET_NODE( NODE_TRANSITION, TransitionNode );
	ERR_FAIL_COND(p_inputs<1);

	n->inputs.resize(p_inputs);
	n->input_data.resize(p_inputs);
	last_error=_cycle_test(out_name);

}
Пример #24
0
void XmlSync::replaceEntries(quint32 in_index, quint32 out_index)
{
    QDomElement codeNode_in, codeNode_out;
    QDomElement entryNode_in, entryNode_out;
    QDomNode res;
    quint32 i;

    //Get to the nodes
    GET_NODE(root_in, "code", codeNode_in);
    GET_NODE(root_out, "code", codeNode_out);
    GET_FIRST_CHILD_NODE(codeNode_in, entryNode_in);
    GET_FIRST_CHILD_NODE(codeNode_out, entryNode_out);

    //maybe include warning about non-equal indexes?

    for (i = 0; i < in_index; i++)
    {
        entryNode_in=entryNode_in.nextSiblingElement();
    }

    for (i = 0; i < out_index; i++)
    {
        entryNode_out=entryNode_out.nextSiblingElement();
    }

    if (out_index != in_index)
    {
        //index consistency fix -- easy, hopefully safe.
        QDomAttr index_attr = entryNode_in.attributeNode("index");
        index_attr.setNodeValue(QString().sprintf("%d", out_index));
    }

    res = codeNode_out.replaceChild(entryNode_in.cloneNode(), entryNode_out);

    if (res.isNull())
    {
        //fatalExit("failed to replace entry node");
        printf("WARNING: Failed to replace entry node\n");
    }
}
Пример #25
0
DesignFlowStep_Status HDLFunctionDeclFix::Exec()
{
   bool changed_tree = false;
   const tree_managerRef TM = AppM->get_tree_manager();
   const auto hdl_writer_type = static_cast<HDLWriter_Language>(parameters->getOption<unsigned int>(OPT_writer_language));
   const auto hdl_writer = language_writer::create_writer(hdl_writer_type, GetPointer<HLS_manager>(AppM)->get_HLS_target()->get_technology_manager(), parameters);
   const auto hdl_reserved_names = hdl_writer->GetHDLReservedNames();
   std::remove_const<decltype(hdl_reserved_names)>::type found_names;
   if(hdl_writer_type == HDLWriter_Language::VHDL)
   {
      for(const auto hdl_reserved_name : hdl_reserved_names)
      {
         found_names.insert(boost::to_upper_copy<std::string>(hdl_reserved_name));
      }
   }
   else
   {
      found_names = hdl_reserved_names;
   }

   for(const auto function : TM->GetAllFunctions())
   {
      auto fd = GetPointer<function_decl>(TM->get_tree_node_const(function));
      if(not fd->name)
         continue;
      auto in = GetPointer<identifier_node>(GET_NODE(fd->name));
      const auto identifier = hdl_writer_type == HDLWriter_Language::VHDL ? boost::to_upper_copy<std::string>(in->strg) : in->strg;
      if(found_names.find(identifier) != found_names.end())
      {
         std::map<TreeVocabularyTokenTypes_TokenEnum, std::string> IR_schema;
         unsigned int var_decl_name_nid_test;
         unsigned var_decl_unique_id=0;
         do
         {
            IR_schema[TOK(TOK_STRG)] = in->strg + STR(var_decl_unique_id++);
            var_decl_name_nid_test = TM->find(identifier_node_K, IR_schema);
         } while(var_decl_name_nid_test);
         found_names.insert(in->strg + STR(var_decl_unique_id - 1));
         unsigned int var_decl_name_nid = TM->new_tree_node_id();
         TM->create_tree_node(var_decl_name_nid, identifier_node_K, IR_schema);
         IR_schema.clear();
         tree_nodeRef tr_new_id = TM->GetTreeReindex(var_decl_name_nid);
         fd->name = tr_new_id;
      }
      else
      {
         found_names.insert(identifier);
      }
   }
   return changed_tree ? DesignFlowStep_Status::SUCCESS : DesignFlowStep_Status::UNCHANGED;

}
Пример #26
0
void AnimationTreePlayer::transition_node_delete_input(const StringName& p_node, int p_input) {

	GET_NODE(NODE_TRANSITION, TransitionNode);
	ERR_FAIL_INDEX(p_input,n->inputs.size());

	if (n->inputs.size()<=1)
		return;


	n->inputs.remove(p_input);
	n->input_data.remove(p_input);
	last_error=_cycle_test(out_name);
}
Пример #27
0
void
lwan_trie_add(struct lwan_trie *trie, const char *key, void *data)
{
    if (UNLIKELY(!trie || !key || !data))
        return;

    struct lwan_trie_node **knode, *node;
    const char *orig_key = key;

    /* Traverse the trie, allocating nodes if necessary */
    for (knode = &trie->root; *key; knode = &node->next[(int)(*key++ & 7)])
        GET_NODE();

    /* Get the leaf node (allocate it if necessary) */
    GET_NODE();

    struct lwan_trie_leaf *leaf = find_leaf_with_key(node, orig_key, (size_t)(key - orig_key));
    bool had_key = leaf;
    if (!leaf) {
        leaf = malloc(sizeof(*leaf));
        if (!leaf)
            lwan_status_critical_perror("malloc");
    } else if (trie->free_node) {
        trie->free_node(leaf->data);
    }

    leaf->data = data;
    if (!had_key) {
        leaf->key = strdup(orig_key);
        leaf->next = node->leaf;
        node->leaf = leaf;
    }
    return;

oom:
    lwan_status_critical_perror("calloc");
}
Пример #28
0
void AnimationTreePlayer::transition_node_set_current(const StringName& p_node, int p_current) {

	GET_NODE( NODE_TRANSITION, TransitionNode );
	ERR_FAIL_INDEX(p_current,n->inputs.size());

	if (n->current==p_current)
		return;

	n->prev=n->current;
	n->prev_xfading=n->xfade;
	n->prev_time=n->time;
	n->time=0;
	n->current=p_current;

}
void msm_bus_scale_client_reset_pnodes(uint32_t cl)
{
	int i, src, pnode, index;
	struct msm_bus_client *client = (struct msm_bus_client *)(cl);
	if (IS_ERR(client)) {
		MSM_BUS_ERR("msm_bus_scale_reset_pnodes error\n");
		return;
	}
	index = 0;
	for (i = 0; i < client->pdata->usecase->num_paths; i++) {
		src = msm_bus_board_get_iid(
			client->pdata->usecase[index].vectors[i].src);
		pnode = client->src_pnode[i];
		MSM_BUS_DBG("(%d, %d)\n", GET_NODE(pnode), GET_INDEX(pnode));
		reset_pnodes(src, pnode);
	}
}
Пример #30
0
static int
lru_ass_sub(LRU *self, PyObject *key, PyObject *value)
{
    int res = 0;
    Node *node = GET_NODE(self->dict, key);
    PyErr_Clear();  /* GET_NODE sets an exception on miss. Shut it up. */

    if (value) {
        if (node) {
            Py_INCREF(value);
            Py_DECREF(node->value);
            node->value = value;

            lru_remove_node(self, node);
            lru_add_node_at_head(self, node);

            res = 0;
        } else {
            node = PyObject_NEW(Node, &NodeType);
            node->key = key;
            node->value = value;
            node->next = node->prev = NULL;

            Py_INCREF(key);
            Py_INCREF(value);

            res = PUT_NODE(self->dict, key, node);
            if (res == 0) {
                if (lru_length(self) > self->size) {
                    lru_delete_last(self);
                }

                lru_add_node_at_head(self, node);
            }
        }
    } else {
        res = PUT_NODE(self->dict, key, NULL);
        if (res == 0) {
            assert(node && PyObject_TypeCheck(node, &NodeType));
            lru_remove_node(self, node);
        }
    }

    Py_XDECREF(node);
    return res;
}