/* Define a symbol, possibly implicitly by calling a function */ static save_sym( tab, decl, frame_off, is_typedef ) { auto name = &decl[4][3]; auto e = grow_tab( tab, 24, name ); /* sizeof(sym_entry) */ e[2] = is_typedef; e[3] = frame_off; e[4] = scope_id; e[5] = add_ref(decl); }
/* Generate a private/public keypair. */ OSStatus SecKeyGeneratePair(CFDictionaryRef parameters, SecKeyRef *publicKey, SecKeyRef *privateKey) { OSStatus result = errSecUnsupportedAlgorithm; SecKeyRef privKey = NULL; SecKeyRef pubKey = NULL; CFMutableDictionaryRef pubParams = merge_params(parameters, kSecPublicKeyAttrs), privParams = merge_params(parameters, kSecPrivateKeyAttrs); CFStringRef ktype = CFDictionaryGetValue(parameters, kSecAttrKeyType); require(ktype, errOut); if (CFEqual(ktype, kSecAttrKeyTypeEC)) { result = SecECKeyGeneratePair(parameters, &pubKey, &privKey); } else if (CFEqual(ktype, kSecAttrKeyTypeRSA)) { result = SecRSAKeyGeneratePair(parameters, &pubKey, &privKey); } require_noerr(result, errOut); /* Store the keys in the keychain if they are marked as permanent. */ if (getBoolForKey(pubParams, kSecAttrIsPermanent, false)) { require_noerr_quiet(result = add_ref(pubKey, pubParams), errOut); } if (getBoolForKey(privParams, kSecAttrIsPermanent, false)) { require_noerr_quiet(result = add_ref(privKey, privParams), errOut); } if (publicKey) { *publicKey = pubKey; pubKey = NULL; } if (privateKey) { *privateKey = privKey; privKey = NULL; } errOut: CFReleaseSafe(pubParams); CFReleaseSafe(privParams); CFReleaseSafe(pubKey); CFReleaseSafe(privKey); return result; }
MediaBuffer *MediaBuffer::clone() { MediaBuffer *buffer = new MediaBuffer(mData, mSize); buffer->set_range(mRangeOffset, mRangeLength); buffer->mMetaData = new MetaData(*mMetaData.get()); add_ref(); buffer->mOriginal = this; return buffer; }
frame::frame():_hwnd(0),_next(0),_prev(0) { sync::critical_section _(_guard); init_class(); if(_first) _first->_prev = this; _next = _first; _first = this; add_ref(); }
void set_ternary_table( TERNARY_TABLE *table, TERNARY_TABLE_UPDATES *updates, VALUE_STORE *vs1, VALUE_STORE *vs2, VALUE_STORE *vs3, VALUE_STORE_UPDATES *vsu1, VALUE_STORE_UPDATES *vsu2, VALUE_STORE_UPDATES *vsu3, OBJ rel, int idx1, int idx2, int idx3 ) { ternary_table_clear(table, updates); if (is_empty_rel(rel)) return; TERN_REL_OBJ *ptr = get_tern_rel_ptr(rel); uint32 size = ptr->size; OBJ *col1 = get_col_array_ptr(ptr, idx1); OBJ *col2 = get_col_array_ptr(ptr, idx2); OBJ *col3 = get_col_array_ptr(ptr, idx3); for (uint32 i=0 ; i < size ; i++) { OBJ obj = col1[i]; uint32 ref1 = lookup_value_ex(vs1, vsu1, obj); if (ref1 == -1) { add_ref(obj); ref1 = value_store_insert(vs1, vsu1, obj); } obj = col2[i]; uint32 ref2 = lookup_value_ex(vs2, vsu2, obj); if (ref2 == -1) { add_ref(obj); ref2 = value_store_insert(vs2, vsu2, obj); } obj = col3[i]; uint32 ref3 = lookup_value_ex(vs3, vsu3, obj); if (ref3 == -1) { add_ref(obj); ref3 = value_store_insert(vs3, vsu3, obj); } ternary_table_insert(updates, ref1, ref2, ref3); } }
/* 将ob设置为master对象 */ void set_master(object_t * ob) { #if defined(PACKAGE_UIDS) || defined(PACKAGE_MUDLIB_STATS) int first_load = (!master_ob); #endif #ifdef PACKAGE_UIDS svalue_t *ret; #endif get_master_applies(ob); /* master load好之后,要apply一下? */ master_ob = ob; /* Make sure master_ob is never made a dangling pointer. */ add_ref(master_ob, "set_master"); #ifndef PACKAGE_UIDS # ifdef PACKAGE_MUDLIB_STATS if (first_load) { set_backbone_domain("BACKBONE"); set_master_author("NONAME"); } # endif #else ret = apply_master_ob(APPLY_GET_ROOT_UID, 0); /* can't be -1 or we wouldn't be here */ if (!ret) { debug_message("No function %s() in master object; possibly the mudlib doesn't want PACKAGE_UIDS to be defined.\n", applies_table[APPLY_GET_ROOT_UID]); exit(-1); } if (ret->type != T_STRING) { debug_message("%s() in master object does not work.\n", applies_table[APPLY_GET_ROOT_UID]); exit(-1); } if (first_load) { /* 第一次load master? */ master_ob->uid = set_root_uid(ret->u.string); master_ob->euid = master_ob->uid; # ifdef PACKAGE_MUDLIB_STATS set_master_author(ret->u.string); # endif ret = apply_master_ob(APPLY_GET_BACKBONE_UID, 0); if (ret == 0 || ret->type != T_STRING) { debug_message("%s() in the master file does not work\n", applies_table[APPLY_GET_BACKBONE_UID]); /* apply有多个,装table */ exit(-1); } set_backbone_uid(ret->u.string); # ifdef PACKAGE_MUDLIB_STATS set_backbone_domain(ret->u.string); # endif } else { master_ob->uid = add_uid(ret->u.string); master_ob->euid = master_ob->uid; } #endif }
static void init_ldap(struct object *o) { base_str = make_shared_string("base"); add_ref(base_str); scope_str = make_shared_string("scope"); add_ref(scope_str); filter_str = make_shared_string("filter"); add_ref(filter_str); attrs_str = make_shared_string("attrs"); add_ref(attrs_str); attrsonly_str = make_shared_string("attrsonly"); add_ref(attrsonly_str); timeout_str = make_shared_string("timeout"); add_ref(timeout_str); empty_str = make_shared_string(""); add_ref(empty_str); modify_op = make_shared_string("op"); add_ref(modify_op); modify_type = make_shared_string("type"); add_ref(modify_type); modify_values = make_shared_string("values"); add_ref(modify_values); THIS->conn = NULL; THIS->server_url = NULL; THIS->basedn = empty_str; THIS->scope = LDAP_SCOPE_DEFAULT; THIS->bound = 0; THIS->lerrno = 0; THIS->caching = 0; }
void ColumnMajorMatrixTest::setUp() { // Define commonly used matrices for testing a = new ColumnMajorMatrix(3, 3); ColumnMajorMatrix & a_ref = *a; a_ref(0, 0) = 1; a_ref(1, 0) = 2; a_ref(2, 0) = 3; a_ref(0, 1) = 4; a_ref(1, 1) = 5; a_ref(2, 1) = 6; a_ref(0, 2) = 7; a_ref(1, 2) = 8; a_ref(2, 2) = 9; t = new ColumnMajorMatrix(3, 2); ColumnMajorMatrix & t_ref = *t; t_ref(0, 0) = 1; t_ref(1, 0) = 2; t_ref(2, 0) = 3; t_ref(0, 1) = 4; t_ref(1, 1) = 5; t_ref(2, 1) = 6; two_mat = new ColumnMajorMatrix(2, 2); ColumnMajorMatrix & mat = *two_mat; mat(0, 0) = 1; mat(1, 0) = 2; mat(0, 1) = 3; mat(1, 1) = 4; add = new ColumnMajorMatrix(3, 2); add_solution = new ColumnMajorMatrix(3, 2); ColumnMajorMatrix & add_ref = *add; ColumnMajorMatrix & a_sol_ref = *add_solution; add_ref(0, 0) = 6; a_sol_ref(0, 0) = 7; add_ref(1, 0) = 5; a_sol_ref(1, 0) = 7; add_ref(2, 0) = 4; a_sol_ref(2, 0) = 7; add_ref(0, 1) = 1; a_sol_ref(0, 1) = 5; add_ref(1, 1) = 1; a_sol_ref(1, 1) = 6; add_ref(2, 1) = 1; a_sol_ref(2, 1) = 7; sub = new ColumnMajorMatrix(3, 2); sub_solution = new ColumnMajorMatrix(3, 2); ColumnMajorMatrix & sub_ref = *sub; ColumnMajorMatrix & s_sol_ref = *sub_solution; sub_ref(0, 0) = 0; s_sol_ref(0, 0) = 1; sub_ref(1, 0) = 1; s_sol_ref(1, 0) = 1; sub_ref(2, 0) = 2; s_sol_ref(2, 0) = 1; sub_ref(0, 1) = 1; s_sol_ref(0, 1) = 3; sub_ref(1, 1) = 1; s_sol_ref(1, 1) = 4; sub_ref(2, 1) = 1; s_sol_ref(2, 1) = 5; }
inline void server_node::set_parent(abstract_group * parent) { add_ref(); assert(parent_ == 0); parent_ = parent; if (is_synth()) ++parent->child_synth_count; else { ++parent->child_group_count; static_cast<abstract_group*>(this)->register_as_child(); } }
DSN_API dsn_message_t dsn_rpc_get_response(dsn_task_t rpc_call) { ::dsn::rpc_response_task* task = (::dsn::rpc_response_task*)rpc_call; dassert(task->spec().type == TASK_TYPE_RPC_RESPONSE, ""); auto msg = task->get_response(); if (nullptr != msg) { msg->add_ref(); // released by callers return msg; } else return nullptr; }
/*! @decl PathIterator _get_iterator() *! *! Get an iterator for a given path. The iterator is implicitly used in the *! @tt{foreach(;;)@} statement. *! *! @example *! *! Cairo.Context ctx = ...; *! Cairo.Path p = ctx->copy_path(); *! foreach(p; int i; Cairo.PathElement e) *! { *! ... examine e here ... *! } *! */ static void f_path_get_iterator(INT32 args) { struct object* iterator_object; struct cairo_mod_path_iterator* iterator; iterator_object = clone_object(cairo_mod_path_iterator_program, 0); iterator = (struct cairo_mod_path_iterator*)get_storage(iterator_object, cairo_mod_path_iterator_program); assert(iterator); iterator->path_obj = Pike_fp->current_object; add_ref(Pike_fp->current_object); push_object(iterator_object); }
Error contains(Stack* S, Stack* scope_arr) { require(2); V haystack = popS(); V needle = popS(); if (getType(needle) != T_STR || getType(haystack) != T_STR) { clear_ref(needle); clear_ref(haystack); return TypeError; } NewString *needle_s = toNewString(needle); NewString *haystack_s = toNewString(haystack); if (string_length(needle_s) > string_length(haystack_s)) { pushS(add_ref(v_false)); } else { uint32_t i; utf8index index = 0; for (i = 0; i <= string_length(haystack_s) - string_length(needle_s); i++) { if (!memcmp(haystack_s->text + index, needle_s->text, needle_s->size)) { pushS(add_ref(v_true)); clear_ref(needle); clear_ref(haystack); return Nothing; } index = nextchar(haystack_s->text, index); } pushS(add_ref(v_false)); } clear_ref(needle); clear_ref(haystack); return Nothing; }
static void f_buf_create( INT32 args ) { if(BUF->data != NULL) Pike_error("Create already called!\n"); switch(args) { default: Pike_error("Wrong number of arguments to create. Expected 2 or 3.\n"); break; case 3: if(Pike_sp[-1].type != T_INT) { Pike_error("Wrong argument 3 to create. Expected int.\n"); } else if(Pike_sp[-1].u.integer < 100) { Pike_error("Specified buffer too small.\n"); } else { BUF->free = Pike_sp[-1].u.integer; } /* fall through */ case 2: if(Pike_sp[-(args - 1)].type != T_MAPPING) Pike_error("Wrong argument 2 to create. Expected mapping.\n"); if(Pike_sp[-args].type != T_MAPPING) Pike_error("Wrong argument 1 to create. Expected mapping.\n"); break; } if(BUF->free) { BUF->data = (char*)malloc(BUF->free * sizeof(char)); if(!BUF->data) Pike_error("Cannot allocate the request buffer. Out of memory?\n"); } BUF->pos = BUF->data; add_ref(BUF->headers = Pike_sp[-(args - 1)].u.mapping); add_ref(BUF->other = Pike_sp[-args].u.mapping); pop_n_elems(args); }
static void really_clear_projectile(ProjectileList *projlist, Projectile *proj) { Projectile *effect = spawn_projectile_clear_effect(proj); Item *clear_item = NULL; if(!(proj->flags & PFLAG_NOCLEARBONUS)) { clear_item = create_clear_item(proj->pos, proj->clear_flags); } if(clear_item != NULL && effect != NULL) { effect->args[0] = add_ref(clear_item); } delete_projectile(projlist, proj); }
/* Compute negation. Creates CUDD reference. For ZDDs, records as reference */ ref_t shadow_negate(shadow_mgr mgr, ref_t a) { ref_t r = REF_INVALID; if (REF_IS_INVALID(a)) return a; if (do_ref(mgr)) r = REF_NEGATE(a); else { DdNode *an = get_ddnode(mgr, a); if (is_zdd(mgr, a)) { DdNode *zone = Cudd_ReadZddOne(mgr->bdd_manager, 0); reference_dd(mgr, zone); DdNode *ann = Cudd_zddDiff(mgr->bdd_manager, zone, an); reference_dd(mgr, ann); unreference_dd(mgr, zone, IS_ZDD); r = dd2ref(ann, IS_ZDD); // For ZDDs, don't already have negated values recorded add_ref(mgr, r, ann); } else if (is_add(mgr, a)) { DdNode *ann = Cudd_addCmpl(mgr->bdd_manager, an); reference_dd(mgr, ann); r = dd2ref(ann, IS_ADD); // For ADDs, don't already have negated values recorded add_ref(mgr, r, ann); } else { DdNode *ann = Cudd_Not(an); reference_dd(mgr, ann); r = dd2ref(ann, IS_BDD); } } #if RPT >= 5 char buf[24], nbuf[24]; shadow_show(mgr, a, buf); shadow_show(mgr, r, nbuf); report(5, "Negated %s to get %s", buf, nbuf); #endif return r; }
void task_enqueue(Task * task) { if (task->next || head == task) return; // already enqueued. add_ref(task); if (!head) { tail = head = task; } else if (tail) { tail->next = task; tail = task; } else { panic("Head without a tail"); } }
struct vector * users() { int i; struct vector *ret; if (!num_player) return allocate_array(0); ret = allocate_array(num_player); for (i = 0; i < num_player; i++) { ret->item[i].type = T_OBJECT; add_ref(ret->item[i].u.ob = get_interactive_object(i),"users"); } return ret; }
void f_named_livings() { int i; int nob; #ifdef F_SET_HIDE int apply_valid_hide, display_hidden = 0; #endif object_t *ob, **obtab; array_t *vec; nob = 0; #ifdef F_SET_HIDE apply_valid_hide = 1; #endif obtab = CALLOCATE(max_array_size, object_t *, TAG_TEMPORARY, "named_livings"); for (i = 0; i < CFG_LIVING_HASH_SIZE; i++) { for (ob = hashed_living[i]; ob; ob = ob->next_hashed_living) { if (!(ob->flags & O_ENABLE_COMMANDS)) continue; #ifdef F_SET_HIDE if (ob->flags & O_HIDDEN) { if (apply_valid_hide) { apply_valid_hide = 0; display_hidden = valid_hide(current_object); } if (!display_hidden) continue; } #endif if (nob == max_array_size) break; obtab[nob++] = ob; } } vec = allocate_empty_array(nob); while (--nob >= 0) { vec->item[nob].type = T_OBJECT; vec->item[nob].u.ob = obtab[nob]; add_ref(obtab[nob], "livings"); } FREE(obtab); push_refed_array(vec); }
bool thread::start(bool start_suspended /*=false*/) { if (handle_ == (void*)INVALID_HANDLE_VALUE) { add_ref(); stop_requested_ = 0; THOR_ASSERT(stack_size_ <= UINT_MAX); handle_ = (void*)_beginthreadex(0, (unsigned int)stack_size_, &internal::thread_base::start_thread_proc, static_cast<internal::thread_base*>(this), start_suspended ? CREATE_SUSPENDED : 0, &thread_id_.thread_id_); if (handle_ != (void*)INVALID_HANDLE_VALUE) { debug::set_thread_name(name_.c_str(), thread_id_); if (start_suspended) ++suspend_count_; return true; } } return false; }
/* ADD conversion for external command */ ref_t shadow_aconvert(shadow_mgr mgr, ref_t r) { if (do_ref(mgr)) /* Only applies when in pure CUDD mode */ return r; DdNode *n = get_ddnode(mgr, r); if (is_add(mgr, r)) { return r; } if (is_zdd(mgr, r)) { err(false, "Can't convert ADD to ZDD"); return REF_INVALID; } DdNode *an = aconvert(mgr, n); ref_t ar = dd2ref(an, IS_ADD); add_ref(mgr, ar, an); return ar; }
static enum status_code read_repo_info(char *name, size_t namelen, char *value, size_t valuelen, void *data) { struct repo_info_state *state = data; const char *arg = *state->argv ? *state->argv++ : ""; if (!strcmp(arg, REPO_INFO_GIT_DIR)) { string_ncopy(repo.git_dir, name, namelen); } else if (!strcmp(arg, REPO_INFO_WORK_TREE)) { /* This can be 3 different values depending on the * version of git being used. If git-rev-parse does not * understand --is-inside-work-tree it will simply echo * the option else either "true" or "false" is printed. * Default to true for the unknown case. */ repo.is_inside_work_tree = strcmp(name, "false") ? true : false; } else if (!strcmp(arg, REPO_INFO_SHOW_CDUP)) { string_ncopy(repo.cdup, name, namelen); } else if (!strcmp(arg, REPO_INFO_SHOW_PREFIX)) { /* Some versions of Git does not emit anything for --show-prefix * when the user is in the repository root directory. Try to detect * this special case by looking at the emitted value. If it looks * like a commit ID and there's no cdup path assume that no value * was emitted. */ if (!*repo.cdup && namelen == 40 && iscommit(name)) return read_repo_info(name, namelen, value, valuelen, data); string_ncopy(repo.prefix, name, namelen); } else if (!strcmp(arg, REPO_INFO_RESOLVED_HEAD)) { string_ncopy(repo.head_id, name, namelen); } else if (!strcmp(arg, REPO_INFO_SYMBOLIC_HEAD)) { if (!prefixcmp(name, "refs/heads/")) { const char *head = name + STRING_SIZE("refs/heads/"); string_ncopy(repo.head, head, strlen(head) + 1); add_ref(repo.head_id, name, repo.remote, repo.head); } state->argv++; } return SUCCESS; }
/* ZDD conversion for external command */ ref_t shadow_zconvert(shadow_mgr mgr, ref_t r) { if (do_ref(mgr)) /* Only applies when in pure CUDD mode */ return r; DdNode *n = get_ddnode(mgr, r); if (is_zdd(mgr, r)) { return r; } if (is_add(mgr, r)) { err(false, "Can't convert ADD to ZDD"); return REF_INVALID; } DdNode *zn = zconvert(mgr, n); ref_t zr = dd2ref(zn, IS_ZDD); add_ref(mgr, zr, zn); return zr; }
void ReachingDefinitionBase:: collect_refs ( AstInterface& fa, const AstNodePtr& h, FunctionSideEffectInterface* a, AstInterface::AstNodeList* in) { for (AstInterface::AstNodeList::iterator p = in->begin(); p != in->end(); ++p) { AstNodePtr cur = *p; std::string varname; AstNodePtr scope; if (fa.IsVarRef( cur, 0, &varname, &scope)) add_ref(varname, scope, std::pair<AstNodePtr, AstNodePtr>(cur, AST_NULL) ); } ConstructReachingDefinitionBase collect(fa, *this); StmtSideEffectCollect op(a); op(fa, h, &collect); }
static void arp_request(struct netdevice * device, uint32_t targetIp) { sbuff * buf = ethernet_sbuff_alloc(sizeof(struct arp_packet)); add_ref(buf); struct arp_packet * arp = (struct arp_packet*)buf->head; arp->htype = ntos(1); arp->ptype = ntos(0x0800); arp->hlen = 6; arp->plen = 4; arp->operation = ntos(1); memcpy(arp->senderMac, device->mac, 6); arp->senderIp = ntol(device->ip); bzero(arp->targetMac, 6); arp->targetIp = ntol(targetIp); ethernet_send(buf, 0x0806, BROADCAST_MAC, device); release_ref(buf, sbuff_free); }
bool change_bucket(Bucket* b, V key, V value) { if (equal(b->key, key)) { V tmp = b->value; b->value = add_ref(value); clear_ref(tmp); return true; } if (b->next == NULL) { return false; } else { return change_bucket(b->next, key, value); } }
static struct ref_list *get_ref_dir(const char *base, struct ref_list *list) { DIR *dir = opendir(git_path("%s", base)); if (dir) { struct dirent *de; int baselen = strlen(base); char *ref = xmalloc(baselen + 257); memcpy(ref, base, baselen); if (baselen && base[baselen-1] != '/') ref[baselen++] = '/'; while ((de = readdir(dir)) != NULL) { unsigned char sha1[20]; struct stat st; int flag; int namelen; if (de->d_name[0] == '.') continue; namelen = strlen(de->d_name); if (namelen > 255) continue; if (has_extension(de->d_name, ".lock")) continue; memcpy(ref + baselen, de->d_name, namelen+1); if (stat(git_path("%s", ref), &st) < 0) continue; if (S_ISDIR(st.st_mode)) { list = get_ref_dir(ref, list); continue; } if (!resolve_ref(ref, sha1, 1, &flag)) { hashclr(sha1); flag |= REF_BROKEN; } list = add_ref(ref, sha1, flag, list, NULL); } free(ref); closedir(dir); } return sort_ref_list(list); }
static void reply(struct netdevice* dev, mac target, uint32_t ip, int broadcast) { sbuff * buf = raw_sbuff_alloc(sizeof(struct ethernet_frame) + sizeof(struct arp_packet)); add_ref(buf); sbuff_push(buf, sizeof(struct ethernet_frame)); struct arp_packet * arp = (struct arp_packet*)buf->head; arp->htype = ntos(1); arp->ptype = ntos(0x0800); arp->hlen = 6; arp->plen = 4; arp->operation = ntos(2); memcpy(arp->senderMac, dev->mac, 6); arp->senderIp = ntol(dev->ip); memcpy(arp->targetMac, target, 6); arp->targetIp = ntol(ip); ethernet_send(buf, 0x0806, broadcast ? BROADCAST_MAC : target, dev); release_ref(buf, sbuff_free); }
/* Set the output file (file object) */ static void f_output(INT32 args) { if(args) { if(ARG(1).type != T_OBJECT) { SIMPLE_BAD_ARG_ERROR("_Caudium.nbio()->output", 1, "object"); } else { output *outp; if(THIS->outp != NULL) { free_output(THIS->outp); THIS->outp = NULL; } outp = malloc(sizeof(output)); outp->file = ARG(1).u.object; outp->fd = fd_from_object(outp->file); outp->set_nb_off = find_identifier("set_nonblocking", outp->file->prog); outp->set_b_off = find_identifier("set_blocking", outp->file->prog); outp->write_off = find_identifier("write", outp->file->prog); if (outp->write_off < 0 || outp->set_nb_off < 0 || outp->set_b_off < 0) { free(outp); Pike_error("_Caudium.nbio()->output: illegal file object%s%s%s\n", ((outp->write_off < 0)?"; no write":""), ((outp->set_nb_off < 0)?"; no set_nonblocking":""), ((outp->set_b_off < 0)?"; no set_blocking":"")); } DERR(fprintf(stderr, "New output (fd = %d)\n", outp->fd)); outp->mode = ACTIVE; add_ref(outp->file); THIS->outp = outp; noutputs++; /* Set up the read callback. We don't need a close callback since * it never will be called w/o a read_callback (which we don't want one). */ set_outp_write_cb(outp); } } else { SIMPLE_TOO_FEW_ARGS_ERROR("_Caudium.nbio()->output", 1); } pop_n_elems(args-1); }
/*! @decl void write(string bytes) *! *! Add an input string to this pipe. */ static void pipe_write(INT32 args) { struct input *i; if (args<1 || sp[-args].type!=T_STRING) Pike_error("illegal argument to pipe->write()\n"); if (!THIS->firstinput) { append_buffer(sp[-args].u.string); pop_n_elems(args); push_int(0); return; } i=new_input(); i->type=I_STRING; nstrings++; add_ref(i->u.str=sp[-args].u.string); pop_n_elems(args-1); }
ref_t shadow_get_variable(shadow_mgr mgr, size_t index) { if (index >= mgr->nvars) { err(fatal, "Invalid variable index %lu", index); index = 0; } ref_t r = 0; DdNode *n = NULL; if (mgr->do_cudd) { n = Cudd_bddIthVar(mgr->bdd_manager, index); reference_dd(mgr, n); } if (do_ref(mgr)) { r = REF_VAR(index); if (!mgr->do_cudd) n = ref2dd(mgr, r); } else { r = dd2ref(n, IS_BDD); } add_ref(mgr, r, n); return r; }