コード例 #1
0
ファイル: queues.c プロジェクト: joelmoniz/emu_r060
void test_id_queue() {
  id_queue q;
  q = initialize_id_queue(3);
  insert_id(&q, "abcdefs");
  insert_id(&q, "joelmoniz");
  insert_id(&q, "gokuluf");
  insert_id(&q, "sleepy");
  insert_id(&q, "iendorseyou");
  print_id_queue(q);
  char* x = get_first_id(&q);
  while (strcmp(x,"NULL")) {
    printf("Remove: %s\n", x);
    print_id_queue(q);
    x = get_first_id(&q);
  }
}
コード例 #2
0
ファイル: g-euclid.c プロジェクト: kanzure/brlcad
static int
get_reg_id(struct db_tree_state *tsp, const struct db_full_path *UNUSED(pathp), const struct rt_comb_internal *UNUSED(combp), void *UNUSED(client_data))
{
    if (verbose)
	bu_log("get_reg_id: Adding id %d to list\n", tsp->ts_regionid);
    insert_id(tsp->ts_regionid);
    return -1;
}
コード例 #3
0
// If not present, inserts key into trie
// If the key is prefix of trie node, just marks leaf node
void insert(struct trie *pTrie, char *key,int id)
{
    int level;
    int length = strlen(key);
    int index;
    trie_node_t *pCrawl;
    pTrie->count++;
    pCrawl = pTrie->root;
 
    for( level = 0; level < length; level++)
    {
        if(key[level]>=97&&key[level]<=122)
		index = CHAR_TO_INDEX(key[level]);
		else
		index = CHAR_TO_INDEX1(key[level]);
        if( !pCrawl->children[index] )
        {
            pCrawl->children[index] = getNode();
            
        }
 
        pCrawl = pCrawl->children[index];
    }
    struct id *temp;

	if(pCrawl->mode==NULL)
    {
    pCrawl->mode=createnode_id();
    temp=pCrawl->mode;
    temp->id=id;
    
	}
    else
    {
    temp=pCrawl->mode;
    insert_id(temp,id);
    }
	
    // mark last node as leaf
    pCrawl->value = pTrie->count;
}
コード例 #4
0
ファイル: SQLiteQuery.cpp プロジェクト: sconemad/sconeserver
//=========================================================================
scx::ScriptRef* SQLiteQuery::script_op(const scx::ScriptAuth& auth,
                                       const scx::ScriptRef& ref,
                                       const scx::ScriptOp& op,
                                       const scx::ScriptRef* right)
{
  if (op.type() == scx::ScriptOp::Lookup) {
    const std::string name = right->object()->get_string();

    if (name == "exec" ||
	name == "next_result") {
      return new scx::ScriptMethodRef(ref,name);
    }

    if (name == "error") return scx::ScriptString::new_ref(m_error_string);
    if (name == "result") return result();
    if (name == "result_list") return result_list();
    if (name == "insert_id")
      return scx::ScriptInt::new_ref(insert_id());
  }
  
  return scx::ScriptObject::script_op(auth,ref,op,right);
}
コード例 #5
0
ファイル: g-tankill.c プロジェクト: cciechad/brlcad
/* routine used in tree walker to collect region ident numbers */
static int
get_reg_id(register struct db_tree_state *tsp, struct db_full_path *pathp, const struct rt_comb_internal *combp, genptr_t client_data)
{
    insert_id( tsp->ts_regionid );
    return( -1 );
}