当前位置: 首页>>代码示例>>C++>>正文


C++ dict_lookup函数代码示例

本文整理汇总了C++中dict_lookup函数的典型用法代码示例。如果您正苦于以下问题:C++ dict_lookup函数的具体用法?C++ dict_lookup怎么用?C++ dict_lookup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了dict_lookup函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: dict_lookup

void *TA_DictGetValue_S2( TA_Dict *dict, const char *key1, const char *key2 )
{
   TA_PrivDictInfo *theDict;
   dnode_t *node;
   TA_PrivDictInfo *subDict;
   TA_Libc *libHandle;

   theDict = (TA_PrivDictInfo *)dict;

   if( (theDict == NULL) || (key1 == NULL) || (key2 == NULL))
      return NULL;
   libHandle = theDict->libHandle;

   /* Find the dictionary for key1. */
   node = dict_lookup( libHandle, &theDict->d, key1 );

   if( !node )
      return NULL;

   subDict = dnode_get(node);

   /* Find the key-value pair using key2. */
   node = dict_lookup( libHandle, &subDict->d, key2 );

   if( !node )
      return NULL;

   return dnode_get(node);
}
开发者ID:royratcliffe,项目名称:ta-lib,代码行数:29,代码来源:ta_dict.c

示例2: history_processFlags

void history_processFlags(history_t* past)
// to be called after completely recording this history, before calculating any values.
{
    state_t* flagState = dict_lookup(past->states, "flags");
    state_t* nextState;
    U16 nextFlags, toggledFlags, currentFlags = (U16)flagState->value;
    while (flagState->next)
    {
    	nextState = flagState->next;
    	nextFlags = (U16)nextState->value;
    	toggledFlags = currentFlags ^ nextFlags;
    	if (toggledFlags & IF_FIXED_ALIGNMENT)
    	{ // the IF_FIXED_ALIGNMENT bit will change in the next state
    	    if (nextFlags & IF_FIXED_ALIGNMENT)
    	    { // the IF_FIXED_ALIGNMENT bit will be set
    	    	int onFrame = nextState->frame;
	    	state_t* rotations = dict_lookup(past->states, "rotate");
	    	nextState->params.instanceAngle = state_value(rotations, onFrame);
	    	state_t* resetRotate = state_new(onFrame, CF_JUMP, 0, 0);
	    	state_insert(rotations, resetRotate);
	    	if (onFrame == past->firstFrame)
	    	    onFrame++;
	    	state_t *x, *y;
	    	float dx, dy;
	    	do
	    	{
    	    	    x = dict_lookup(past->states, "x");
    	    	    dx = state_tangent(x, onFrame, T_SYMMETRIC);
    	    	    y = dict_lookup(past->states, "y");
    	    	    dy = state_tangent(y, onFrame, T_SYMMETRIC);
    	    	    onFrame++;
	    	}
	    	while (dx == 0 && dy == 0 && onFrame < past->lastFrame);
	    	if (onFrame == past->lastFrame)
    	    	    nextState->params.pathAngle = 0;
	    	else
    	    	    nextState->params.pathAngle = getAngle(dx, dy) / M_PI * 180;
    	    }
    	    else // the IF_FIXED_ALIGNMENT bit will be reset
    	    {
    	    	int offFrame = nextState->frame;
	    	state_t* rotations = dict_lookup(past->states, "rotate");
	    	state_t* setRotate = state_new(offFrame, CF_JUMP, flagState->params.instanceAngle + state_value(rotations, offFrame), 0);
	    	state_insert(rotations, setRotate);
    	    }
    	}
    	else // the IF_FIXED_ALIGNMENT bit will not change but some processing may be
    	     // required just the same
    	{
    	    if (nextFlags & IF_FIXED_ALIGNMENT)
    	    {
    	    	nextState->params.instanceAngle = flagState->params.instanceAngle;
    	    	nextState->params.pathAngle = flagState->params.pathAngle;
    	    }
    	}
// and so on for all the other bits.
    	flagState = nextState;
    	currentFlags = nextFlags;
	}
}
开发者ID:SenecaCDOT-BigBlueButton,项目名称:swftools,代码行数:60,代码来源:swfc-history.c

示例3: initialize_file

void initialize_file(char*filename)
{
    if(state) {
        syntaxerror("invalid call to initialize_file during parsing of another file");
    }
    
    new_state();
    state->package = internal_filename_package = strdup(filename);
    
    global->token2info = dict_lookup(global->file2token2info, 
                                     current_filename // use long version
                                    );
    if(!global->token2info) {
        global->token2info = dict_new2(&ptr_type);
        dict_put(global->file2token2info, current_filename, global->token2info);
    }
  
    if(as3_pass==1) {
        state->method = rfx_calloc(sizeof(methodstate_t));
        dict_put(global->token2info, (void*)(ptroff_t)as3_tokencount, state->method);
        state->method->late_binding = 1; // init scripts use getglobalscope, so we need a getlocal0/pushscope
	state->method->allvars = dict_new();
    } else {
        state->method = dict_lookup(global->token2info, (void*)(ptroff_t)as3_tokencount);
        state->method->variable_count = 0;
        if(!state->method)
            syntaxerror("internal error: skewed tokencount");
        function_initvars(state->method, 0, 0, 0, 1);
        global->init = 0;
    }
}
开发者ID:DJwa163,项目名称:swftools,代码行数:31,代码来源:parser_help.c

示例4: add_dupe

/*
 * Add a duplicate block record
 */
static void add_dupe(e2fsck_t ctx, ext2_ino_t ino, blk64_t cluster,
		     struct ext2_inode *inode)
{
	dnode_t	*n;
	struct dup_cluster	*db;
	struct dup_inode	*di;
	struct cluster_el	*cluster_el;
	struct inode_el 	*ino_el;

	n = dict_lookup(&clstr_dict, INT_TO_VOIDPTR(cluster));
	if (n)
		db = (struct dup_cluster *) dnode_get(n);
	else {
		db = (struct dup_cluster *) e2fsck_allocate_memory(ctx,
			sizeof(struct dup_cluster), "duplicate cluster header");
		db->num_bad = 0;
		db->inode_list = 0;
		dict_alloc_insert(&clstr_dict, INT_TO_VOIDPTR(cluster), db);
	}
	ino_el = (struct inode_el *) e2fsck_allocate_memory(ctx,
			 sizeof(struct inode_el), "inode element");
	ino_el->inode = ino;
	ino_el->next = db->inode_list;
	db->inode_list = ino_el;
	db->num_bad++;

	n = dict_lookup(&ino_dict, INT_TO_VOIDPTR(ino));
	if (n)
		di = (struct dup_inode *) dnode_get(n);
	else {
		di = (struct dup_inode *) e2fsck_allocate_memory(ctx,
			 sizeof(struct dup_inode), "duplicate inode header");
		if (ino == EXT2_ROOT_INO) {
			di->dir = EXT2_ROOT_INO;
			dup_inode_founddir++;
		} else
			di->dir = 0;

		di->num_dupblocks = 0;
		di->cluster_list = 0;
		di->inode = *inode;
		dict_alloc_insert(&ino_dict, INT_TO_VOIDPTR(ino), di);
	}
	cluster_el = (struct cluster_el *) e2fsck_allocate_memory(ctx,
			 sizeof(struct cluster_el), "cluster element");
	cluster_el->cluster = cluster;
	cluster_el->next = di->cluster_list;
	di->cluster_list = cluster_el;
	di->num_dupblocks++;
}
开发者ID:ESOS-Lab,项目名称:MOST,代码行数:53,代码来源:pass1b.c

示例5: ddb_lookup

int
ddb_lookup (const dict_t *config,
	    const char *startup,
	    char name[HDL_GAME_NAME_MAX + 1],
	    compat_flags_t *flags)
{
  int result;
  const char *disc_db = dict_lookup (config, CONFIG_DISC_DATABASE_FILE);
  dict_t *list = disc_db != NULL ? dict_restore (NULL, disc_db) : NULL;
  *name = '\0'; *flags = 0;
  if (list != NULL)
    {
      const char *entry = dict_lookup (list, startup);
      if (entry != NULL)
	{ /* game info has been found */
	  size_t entry_len = strlen (entry);
	  char *pos = strrchr (entry, ';');

	  result = RET_OK;
	  if (pos != NULL && pos[1] != 'x')
	    { /* scan for compatibility flags */
	      compat_flags_t flags2 = 0;
	      if (strcmp (pos + 1, "0") != 0)
		flags2 = parse_compat_flags (pos + 1);
	      if (flags2 != COMPAT_FLAGS_INVALID)
		{ /* we have compatibility flags */
		  *flags = flags2;
		  entry_len = pos - entry;
		}
	    }
	  else if (pos != NULL && pos[1] == 'x')
	    { /* marked as incompatible; warn */
	      result = RET_DDB_INCOMPATIBLE;
	      entry_len = pos - entry;
	    }
	  /* entry has been found => fill game name */
	  memcpy (name, entry, (entry_len < HDL_GAME_NAME_MAX ?
				entry_len : HDL_GAME_NAME_MAX));
	  name[entry_len < HDL_GAME_NAME_MAX ? entry_len : HDL_GAME_NAME_MAX] = '\0';
	}
      else
	result = RET_NO_DDBENTRY;
      dict_free (list);
    }
  else
    result = RET_NO_DISC_DB;
  return (result);
}
开发者ID:dyzz,项目名称:hdldumb,代码行数:48,代码来源:common.c

示例6: index_storage_attribute_get

int index_storage_attribute_get(struct mailbox *box,
				enum mail_attribute_type type, const char *key,
				struct mail_attribute_value *value_r,
				bool internal_attribute)
{
	struct dict *dict;
	const char *mailbox_prefix, *error;
	int ret;

	memset(value_r, 0, sizeof(*value_r));

	if (!internal_attribute &&
	    !MAILBOX_ATTRIBUTE_KEY_IS_USER_ACCESSIBLE(key))
		return 0;

	if (index_storage_get_dict(box, type, &dict, &mailbox_prefix) < 0)
		return -1;

	ret = dict_lookup(dict, pool_datastack_create(),
			  key_get_prefixed(type, mailbox_prefix, key),
			  &value_r->value, &error);
	if (ret < 0) {
		mail_storage_set_critical(box->storage,
			"Failed to set attribute %s: %s", key, error);
		return -1;
	}
	return ret;
}
开发者ID:nikwrt,项目名称:dovecot-core,代码行数:28,代码来源:index-attribute.c

示例7: match_string

int     match_string(int unused_flags, const char *string, const char *pattern)
{
    char   *myname = "match_string";
    int     match;
    char   *key;

    if (msg_verbose)
	msg_info("%s: %s ~? %s", myname, string, pattern);

    /*
     * Try dictionary lookup: exact match.
     */
    if (strchr(pattern, ':') != 0) {
	key = lowercase(mystrdup(string));
	match = (dict_lookup(pattern, key) != 0);
	myfree(key);
	if (match != 0)
	    return (1);
	if (dict_errno != 0)
	    msg_fatal("%s: table lookup problem", pattern);
	return (0);
    }

    /*
     * Try an exact string match.
     */
    if (strcasecmp(string, pattern) == 0) {
	return (1);
    }

    /*
     * No match found.
     */
    return (0);
}
开发者ID:TonyChengTW,项目名称:Rmail,代码行数:35,代码来源:match_ops.c

示例8: ruby_function_proxy

static VALUE ruby_function_proxy(VALUE self, VALUE _args)
{
    ID id = rb_frame_last_func();

    value_t* value = dict_lookup(global->functions, (void*)id);

    if(!value) {
        language_error(global->li, "[ruby] couldn't retrieve constant %s", rb_id2name(id));
        return Qnil;
    }

    if(value->type == TYPE_FUNCTION) {
        log_dbg("[ruby] calling function %s", rb_id2name(id));
        value_t*args = ruby_to_value(_args);
        value_t*ret = value->call(value, args);
        value_destroy(args);
        volatile VALUE r = value_to_ruby(ret);
        value_destroy(ret);
        log_dbg("[rb] returning from callback");
        return r;
    } else {
        log_dbg("[ruby] retrieving constant %s (%s)", rb_id2name(id), type_to_string(value->type));
        volatile VALUE r = value_to_ruby(value);
        return r;
    }
    return Qnil;
}
开发者ID:luiseduardohdbackup,项目名称:cagekeeper,代码行数:27,代码来源:language_rb.c

示例9: call_userflow_lookup_alloc

int call_userflow_lookup_alloc(struct userflow **ufp,
			       bool *allocated,
			       struct call *call,
			       const char *userid, const char *username)
{
	struct userflow *uf = NULL;
	int err = 0;

	if (!ufp || !call)
		return EINVAL;

	uf = dict_lookup(call->users, userid);
	if (uf) {
		if (allocated)
			*allocated = false;
	}
	else {
		err = userflow_alloc(&uf, call, userid, username);
		if (err) {
			warning("flowmgr: call: userflow_alloc (%m)\n", err);
			goto out;
		}

		if (allocated)
			*allocated = true;
	}

 out:
	if (err == 0)
		*ufp = uf;

	return err;
}
开发者ID:LampmanYao,项目名称:wire-audio-video-signaling,代码行数:33,代码来源:call.c

示例10: return

dnode_t *
RP_mapping::is_presented(ea_t addr)
{ 
  if ( NULL == mapping )
   return (dnode_t *)NULL;
  return dict_lookup(mapping, (const void *)addr);  
}
开发者ID:IDA-RE-things,项目名称:cyrplw,代码行数:7,代码来源:ds.cpp

示例11: passdb_dict_lookup_key

static enum passdb_result
passdb_dict_lookup_key(struct auth_request *auth_request,
		       struct dict_passdb_module *module, const char *key)
{
	const char *value;
	int ret;

	auth_request_log_debug(auth_request, "dict", "lookup %s", key);
	ret = dict_lookup(module->conn->dict, pool_datastack_create(),
			  key, &value);
	if (ret < 0) {
		auth_request_log_error(auth_request, "dict", "Lookup failed");
		return PASSDB_RESULT_INTERNAL_FAILURE;
	} else if (ret == 0) {
		auth_request_log_unknown_user(auth_request, "dict");
		return PASSDB_RESULT_USER_UNKNOWN;
	} else {
		auth_request_log_debug(auth_request, "dict",
				       "result: %s", value);
		if (dict_query_save_results(auth_request, module->conn, value) < 0)
			return PASSDB_RESULT_INTERNAL_FAILURE;

		if (auth_request->passdb_password == NULL &&
		    !auth_fields_exists(auth_request->extra_fields, "nopassword")) {
			auth_request_log_info(auth_request, "dict",
				"No password returned (and no nopassword)");
			return PASSDB_RESULT_PASSWORD_MISMATCH;
		} else {
			return PASSDB_RESULT_OK;
		}
	}
}
开发者ID:damoxc,项目名称:dovecot,代码行数:32,代码来源:passdb-dict.c

示例12: ddb_update

int
ddb_update (const dict_t *config,
	    const char *startup,
	    const char *name,
	    compat_flags_t flags)
{
  int result = RET_OK;
  const char *disc_db = dict_lookup (config, CONFIG_DISC_DATABASE_FILE);
  dict_t *list = dict_restore (NULL, disc_db);
  if (list != NULL)
    {
      char tmp[500];
      compat_flags_t dummy;
      result = ddb_lookup (config, startup, tmp, &dummy);
      if (result != RET_DDB_INCOMPATIBLE)
	{ /* do not overwrite entries, marked as incompatible */
	  sprintf (tmp, "%s;0x%02x", name, flags);
	  (void) dict_put (list, startup, tmp);

	  result = dict_store (list, disc_db);
	}
      dict_free (list), list = NULL;
    }
  else
    result = RET_NO_DISC_DB;
  return (result);
}
开发者ID:dyzz,项目名称:hdldumb,代码行数:27,代码来源:common.c

示例13: index_storage_attribute_get

int index_storage_attribute_get(struct mailbox_transaction_context *t,
				enum mail_attribute_type type, const char *key,
				struct mail_attribute_value *value_r)
{
	struct dict *dict;
	const char *mailbox_prefix;
	int ret;

	memset(value_r, 0, sizeof(*value_r));

	if (strncmp(key, MAILBOX_ATTRIBUTE_PREFIX_DOVECOT_PVT,
		    strlen(MAILBOX_ATTRIBUTE_PREFIX_DOVECOT_PVT)) == 0)
		return 0;

	if (index_storage_get_dict(t->box, type, &dict, &mailbox_prefix) < 0)
		return -1;

	ret = dict_lookup(dict, pool_datastack_create(),
			  key_get_prefixed(type, mailbox_prefix, key),
			  &value_r->value);
	if (ret < 0) {
		mail_storage_set_internal_error(t->box->storage);
		return -1;
	}
	return ret;
}
开发者ID:jwm,项目名称:dovecot-notmuch,代码行数:26,代码来源:index-attribute.c

示例14: find_variable

variable_t* find_variable(state_t*s, const char*name)
{
    if(s->method->no_variable_scoping) {
        return dict_lookup(s->method->allvars, name);
    } else {
        state_t*top = s;
        while(s) {
            variable_t*v = 0;
            v = dict_lookup(s->vars, name);
            if(v) return v;
            if(s->new_vars) break;
            s = s->old;
        }
        return 0;
    }
}
开发者ID:DJwa163,项目名称:swftools,代码行数:16,代码来源:parser_help.c

示例15: TA_DictDeletePair_S

TA_RetCode TA_DictDeletePair_S( TA_Dict *dict, const char *key )
{
   TA_PrivDictInfo *theDict;
   TA_String *stringToDelete;
   void      *valueToDelete;
   dnode_t   *node;
   TA_Libc   *libHandle;
   dict_t    *kazlibDict;

   theDict = (TA_PrivDictInfo *)dict;

   if( (theDict == NULL) || (key == NULL) )
      return TA_BAD_PARAM;
   kazlibDict = &theDict->d;
   libHandle  = theDict->libHandle;

   /* Find the key-value pair. */
   node = dict_lookup( libHandle, kazlibDict, key );

   if( node )
   {
      /* Free the 'node', the 'key' string and the 'value'. */
      stringToDelete = TA_StringFromChar( dnode_getkey(node) );
      valueToDelete  = dnode_get(node);
      dict_delete_free( libHandle, kazlibDict, node );
      TA_StringFree( TA_GetGlobalStringCache( libHandle ), stringToDelete );
      if( theDict->freeValueFunc )
         theDict->freeValueFunc( libHandle, valueToDelete );
   }
   else
      return TA_KEY_NOT_FOUND;

   return TA_SUCCESS;
}
开发者ID:royratcliffe,项目名称:ta-lib,代码行数:34,代码来源:ta_dict.c


注:本文中的dict_lookup函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。