static void draw_file_context_action(const madshelf_state_t* state, Evas_Object* item, const char* filename, int item_num) { item_clear(item); if(ecore_file_is_dir(filename)) item_num--; if(item_num == -1) /* "open directory" */ { edje_object_part_text_set(item, "title", gettext("Open")); } if(item_num == 0) { if(has_tag(state->tags, "hidden", filename)) edje_object_part_text_set(item, "title", gettext("Unhide")); else edje_object_part_text_set(item, "title", gettext("Hide")); } if(item_num == 1) { if(has_tag(state->tags, "favorites", filename)) edje_object_part_text_set(item, "title", gettext("Remove from favorites")); else edje_object_part_text_set(item, "title", gettext("Add to favorites")); } }
static void handle_file_context_action(madshelf_state_t* state, const char* filename, int item_num, bool is_alt) { if(ecore_file_is_dir(filename)) item_num--; if(item_num == -1) /* "open directory" */ { go_to_directory(state, filename); close_file_context_menu(state->canvas, false); } if(item_num == 0) { if(has_tag(state->tags, "hidden", filename)) tag_remove(state->tags, "hidden", filename); else tag_add(state->tags, "hidden", filename); close_file_context_menu(state->canvas, true); } if(item_num == 1) { if(has_tag(state->tags, "favorites", filename)) tag_remove(state->tags, "favorites", filename); else tag_add(state->tags, "favorites", filename); close_file_context_menu(state->canvas, true); } }
void FileStore::insert_file(File* file) { files.push_back(file); //get all tags, relative to the current working directory TagSet file_tags = file->compute_tags(); //first iteration, populate the tag map with any new tags for(std::string tag: file_tags) { TagEntry* entry = NULL; if(!has_tag(tag)) { //create a new entry object for this tag entry = new TagEntry; entry->tag = tag; entry->files.insert(file); tags[tag] = entry; } else { //add the file to the correct tag FileSet entry = tags[tag]; entry->files.insert(file); } //give the file a pointer to each of its TagEntry file->tags.insert(entry); } }
static void start_sami_element (void *ctx, const xmlChar * name, const xmlChar ** atts) { GstSamiContext *sctx = (GstSamiContext *) ctx; GST_LOG ("name:%s", name); if (!xmlStrncmp ((const xmlChar *) "sync", name, 4)) { handle_start_sync (sctx, atts); sctx->in_sync = TRUE; } else if (!xmlStrncmp ((const xmlChar *) "font", name, 4)) { handle_start_font (sctx, atts); } else if (!xmlStrncmp ((const xmlChar *) "ruby", name, 4)) { sami_context_push_state (sctx, RUBY_TAG); } else if (!xmlStrncmp ((const xmlChar *) "br", name, 2)) { g_string_append_c (sctx->buf, '\n'); /* FIXME: support for furigana/ruby once implemented in pango */ } else if (!xmlStrncmp ((const xmlChar *) "rt", name, 2)) { if (has_tag (sctx->state, ITALIC_TAG)) { g_string_append (sctx->rubybuf, "<i>"); } g_string_append (sctx->rubybuf, "<span size='xx-small' rise='-100'>"); sami_context_push_state (sctx, RT_TAG); } else if (!xmlStrncmp ((const xmlChar *) "p", name, 1)) { } else if (!xmlStrncmp ((const xmlChar *) "i", name, 1)) { g_string_append (sctx->buf, "<i>"); sami_context_push_state (sctx, ITALIC_TAG); } }
static void sami_context_pop_state (GstSamiContext * sctx, char state) { GString *str = g_string_new (""); GString *context_state = sctx->state; int i; GST_LOG ("state %c", state); for (i = context_state->len - 1; i >= 0; i--) { switch (context_state->str[i]) { case ITALIC_TAG: /* <i> */ { g_string_append (str, "</i>"); break; } case SPAN_TAG: /* <span foreground= > */ { g_string_append (str, "</span>"); break; } case RUBY_TAG: /* <span size= > -- ruby */ { break; } case RT_TAG: /* ruby */ { /* FIXME: support for furigana/ruby once implemented in pango */ g_string_append (sctx->rubybuf, "</span>"); if (has_tag (context_state, ITALIC_TAG)) { g_string_append (sctx->rubybuf, "</i>"); } break; } default: break; } if (context_state->str[i] == state) { g_string_append (sctx->buf, str->str); g_string_free (str, TRUE); g_string_truncate (context_state, i); return; } } if (state == CLEAR_TAG) { g_string_append (sctx->buf, str->str); g_string_truncate (context_state, 0); } g_string_free (str, TRUE); }
void mode_list(note_db_t *db, int longout, enum sort_policy sort, int invert_order, char *tag){ int i; note_t note; sort_notes(db, sort); for(i=0;i<db->len;i++){ int tag_i; if(invert_order) note=*get_note(db, db->len-1-i); else note=*get_note(db, i); if(tag!=NULL && !has_tag(¬e, tag)) continue; if(note.importance>5){ //ANSI red printf("\x1b[31m"); if(note.importance>7) //ANSI bright printf("\x1b[1m"); } if(longout){ char date_string[20]; struct tm *time=localtime(¬e.created); strftime(date_string, 20, "%F %H:%M:%S",time); printf("%2d %d %s %s", note.id, note.importance, date_string, note.text); }else{ printf("%2d %s", note.id, note.text); } //Disable all ANSI printf("\x1b[0m"); for(tag_i=0;tag_i<note.ntags;tag_i++){ int fg, bg; putchar(' '); fg=(hash_str(note.tags[tag_i], 22))%8; bg=(hash_str(note.tags[tag_i], 19))%8; if(fg==bg) bg=(bg==7 ? bg+1 : bg-1); //ANSI: set foreground and background colors printf("\x1b[%dm\x1b[%dm", 30+fg, 40+bg); printf("#%s", note.tags[tag_i]); printf("\x1b[0m"); //Disable all ANSI } putchar('\n'); } }
void FileStore::remove_tag(Selection* const selection, const Tag & tag) { if(!has_tag(tag)) return; //tag has never been seen before. Done. TagEntry* entry = tags[tag]; for(File* file: *selection) { if(file->has_tag(entry)) file->remove_tag(entry); } //delete the TagEntry if there are no remaining files with that tag if(entry->files.size() == 0) { tags.erase(tag); delete entry; } }
void FileStore::add_tag(Selection* const selection, const Tag & tag) { //update the data sctructure for the new tag TagEntry* entry; if(has_tag(tag)) { entry = tags[tag]; } else { //create the new TagEntry entry = new TagEntry; entry->tag = tag; tags[tag] = entry; } for(File* file: *selection) { if(!file->has_tag(entry)) file->add_tag(entry); } }
static void characters_sami (void *ctx, const xmlChar * ch, int len) { GstSamiContext *sctx = (GstSamiContext *) ctx; gchar *escaped; gchar *tmp; gint i; /* Skip everything except content of the sync elements */ if (!sctx->in_sync) return; escaped = g_markup_escape_text ((const gchar *) ch, len); g_strstrip (escaped); /* Remove double spaces forom the string as those are * usually added by newlines and indention */ tmp = escaped; for (i = 0; i <= strlen (escaped); i++) { escaped[i] = *tmp; if (*tmp != ' ') { tmp++; continue; } while (*tmp == ' ') tmp++; } if (has_tag (sctx->state, RT_TAG)) { g_string_append_c (sctx->rubybuf, ' '); g_string_append (sctx->rubybuf, escaped); g_string_append_c (sctx->rubybuf, ' '); } else { g_string_append (sctx->buf, escaped); } g_free (escaped); }
bool Physical::is_fallible() const noexcept { return (State::REST == m_state || State::LAND == m_state) && !has_tag(TAG_FALL); }
OBJECT InsertSym(FULL_CHAR *str, unsigned char xtype, FILE_POS *xfpos, unsigned char xprecedence, BOOLEAN xindefinite, BOOLEAN xrecursive, unsigned xpredefined, OBJECT xenclosing, OBJECT xbody) { register int sum, rlen; register unsigned char *x; OBJECT p, q, s, tmp, link, entry, plink; int len; debug3(DST, DD, "InsertSym( %s, %s, in %s )", Image(xtype), str, SymName(xenclosing)); if( !LexLegalName(str) ) Error(29, 3, "invalid symbol name %s", WARN, xfpos, str); New(s, xtype); FposCopy(fpos(s), *xfpos); has_body(s) = FALSE; filter(s) = nilobj; use_invocation(s) = nilobj; imports(s) = nilobj; imports_encl(s) = FALSE; right_assoc(s) = TRUE; precedence(s) = xprecedence; indefinite(s) = xindefinite; recursive(s) = xrecursive; predefined(s) = xpredefined; enclosing(s) = xenclosing; sym_body(s) = xbody; base_uses(s) = nilobj; uses(s) = nilobj; marker(s) = nilobj; cross_sym(s) = nilobj; is_extern_target(s) = FALSE; uses_extern_target(s)= FALSE; visible(s) = FALSE; uses_galley(s) = FALSE; horiz_galley(s) = ROWM; has_compulsory(s) = 0; is_compulsory(s) = FALSE; uses_count(s) = 0; dirty(s) = FALSE; if( enclosing(s) != nilobj && type(enclosing(s)) == NPAR ) dirty(s) = dirty(enclosing(s)) = TRUE; has_par(s) = FALSE; has_lpar(s) = FALSE; has_rpar(s) = FALSE; if( is_par(type(s)) ) has_par(enclosing(s)) = TRUE; if( type(s) == LPAR ) has_lpar(enclosing(s)) = TRUE; if( type(s) == RPAR ) has_rpar(enclosing(s)) = TRUE; /* assign a code letter between a and z to any NPAR symbol */ if( type(s) == NPAR ) { if( LastDown(enclosing(s)) != enclosing(s) ) { Child(tmp, LastDown(enclosing(s))); if( type(tmp) == NPAR ) { if( npar_code(tmp) == 'z' || npar_code(tmp) == ' ' ) npar_code(s) = ' '; else npar_code(s) = npar_code(tmp)+1; } else npar_code(s) = 'a'; } else npar_code(s) = 'a'; } has_target(s) = FALSE; force_target(s) = FALSE; if( !StringEqual(str, KW_TARGET) ) is_target(s) = FALSE; else { is_target(s) = has_target(enclosing(s)) = TRUE; /* if @Target is found after @Key, take note of external target */ if( has_key(enclosing(s)) && xbody != nilobj && is_cross(type(xbody)) ) { if( LastDown(xbody) != Down(xbody) ) { OBJECT sym; Child(sym, Down(xbody)); if( type(sym) == CLOSURE ) { is_extern_target(actual(sym)) = TRUE; uses_extern_target(actual(sym)) = TRUE; } } } } has_tag(s) = is_tag(s) = FALSE; has_key(s) = is_key(s) = FALSE; has_optimize(s) = is_optimize(s) = FALSE; has_merge(s) = is_merge(s) = FALSE; has_enclose(s) = is_enclose(s) = FALSE; if( enclosing(s) != nilobj && type(enclosing(s)) == LOCAL ) { if( StringEqual(str, KW_TAG) ) is_tag(s) = has_tag(enclosing(s)) = dirty(enclosing(s)) = TRUE; if( StringEqual(str, KW_OPTIMIZE) ) is_optimize(s) = has_optimize(enclosing(s)) = TRUE; if( StringEqual(str, KW_KEY) ) { is_key(s) = has_key(enclosing(s)) = dirty(enclosing(s)) = TRUE; /* if @Key is found after @Target, take note of external target */ for( link=Down(enclosing(s)); link!=enclosing(s); link=NextDown(link) ) { Child(p, link); if( is_target(p) && sym_body(p)!=nilobj && is_cross(type(sym_body(p))) ) { OBJECT sym; Child(sym, Down(sym_body(p))); if( type(sym) == CLOSURE ) { is_extern_target(actual(sym)) = TRUE; uses_extern_target(actual(sym)) = TRUE; } } } } if( StringEqual(str, KW_MERGE) ) is_merge(s) = has_merge(enclosing(s)) = TRUE; if( StringEqual(str, KW_ENCLOSE) ) is_enclose(s) = has_enclose(enclosing(s)) = TRUE; } if( StringEqual(str, KW_FILTER) ) { if( type(s) != LOCAL || enclosing(s) == StartSym ) Error(29, 4, "%s must be a local definition", WARN, &fpos(s), str); else if( !has_rpar(enclosing(s)) ) Error(29, 14, "%s must lie within a symbol with a right parameter", WARN, &fpos(s), KW_FILTER); else { filter(enclosing(s)) = s; precedence(enclosing(s)) = FILTER_PREC; } } if( type(s) == RPAR && has_body(enclosing(s)) && (is_tag(s) || is_key(s) || is_optimize(s)) ) Error(29, 5, "a body parameter may not be named %s", WARN, &fpos(s), str); if( type(s) == RPAR && has_target(enclosing(s)) && (is_tag(s) || is_key(s) || is_optimize(s)) ) Error(29, 6, "the right parameter of a galley may not be called %s", WARN, &fpos(s), str); len = StringLength(str); hash(str, len, sum); ifdebug(DST, D, sym_spread[sum]++; sym_count++); entry = (OBJECT) &symtab[sum]; for( plink = Down(entry); plink != entry; plink = NextDown(plink) ) { Child(p, plink); if( length(p) == len && StringEqual(str, string(p)) ) { for( link = Down(p); link != p; link = NextDown(link) ) { Child(q, link); if( enclosing(s) == enclosing(q) ) { Error(29, 7, "symbol %s previously defined at%s", WARN, &fpos(s), str, EchoFilePos(&fpos(q)) ); if( AltErrorFormat ) { Error(29, 13, "symbol %s previously defined here", WARN, &fpos(q), str); } break; } } goto wrapup; } } /* need a new OBJECT as well as s */ NewWord(p, WORD, len, xfpos); length(p) = len; StringCopy(string(p), str); Link(entry, p); wrapup: Link(p, s); if( enclosing(s) != nilobj ) Link(enclosing(s), s); debug2(DST, DD, "InsertSym Link(%s, %s) and returning.", SymName(enclosing(s)), SymName(s)); return s; } /* end InsertSym */
int clump(DBC* orig, DB* ldb, DB* first, DB* second, DB* match, DB* prim){ int i, write_cycle, changed, m=1, ret=0, no_matches; double val; int(*key_func)(DB*, const DBT*, const DBT*, DBT*); DBC* prim_cur_i, prim_cur_j, *first_cur, *second_cur, *match_cur; DBC* fs[2]; //DBC* carray[3]; DBT match_key; DBT ldb_key, ldb_dat; DBT dummy_dat; DBT key_i, pkey_i, data_i; DBT key_j, pkey_j, data_j; db_recno_t m_count; void* old; char invnum_buf[16]; char *tagp; DBT_CLEAR(key_i); DBT_CLEAR(pkey_i); DBT_CLEAR(data_i); DBT_CLEAR(key_j); DBT_CLEAR(pkey_j); DBT_CLEAR(data_j); DBT_CLEAR(match_key); DBT_CLEAR(dummy_dat); DBT_CLEAR(ldb_key); DBT_CLEAR(ldb_dat); match_key.data = &m; match_key.size = sizeof(int); ret = first->cursor(first, NULL, &first_cur, 0); ret = second->cursor(second, NULL, &second_cur, 0); if(ret) printf("Cursor creation problem! %d\n", ret); fs[0] = first_cur; fs[1] = second_cur; /* match->cursor(match, NULL, &match_cur, 0); no_matches = match_cur->get(match_cur, &match_key, &dummy_dat, DB_SET); printf("likelihood!: %g\n", *(double*)dummy_dat.data); match_cur->count(match_cur, &m_count, 0); printf("matches: %u\n", (size_t)m_count); */ //return(0); changed=1; while(changed){ //Repeat until none of the tags change. //printf("again!\n"); changed=0; orig->dup(orig, &prim_cur_i, DB_POSITION); prim_cur_i->pget(prim_cur_i, &key_i, &pkey_i, &data_i, DB_CURRENT); //primary get. do { //Check for a tag tagp = has_tag((DbRecord*)data_i.data); if(tagp==NULL){ apply_tag((DbRecord*)data_i.data, NULL); tagp = has_tag((DbRecord*)data_i.data); if(tagp == NULL){ printf("SERIOUS PROBLEM in tag application. Aborting.\n "); exit(1); } //prim->put(prim, NULL, &pkey_i, &data_i, 0); } //memcpy(invnum_buf, tagp, 16); //printf("invnum_buf: %s\n", invnum_buf); //key_i.data = invnum_buf; //key_i.size = strlen(invnum_buf); for(write_cycle=0; write_cycle<2; ++write_cycle){ //In the first pass, find the minimum tag that this record is associated with //In the second pass, write that tag to all records. if(write_cycle) prim->put(prim, NULL, &pkey_i, &data_i, 0); for(i=0; i<2; ++i){ //For each pass here, look for the record being the first in the comparison //then the second in the comparison if(DB_NOTFOUND == (ret = fs[i]->pget(fs[i], &pkey_i, &key_i, &dummy_dat, DB_SET))){ //printf("join failed!\n"); continue; } do{ //printf("Keys: %s, ", (char*)key_i.data); //printf("Sim: %f, ", *(double*)dummy_dat.data); if(*(double*)dummy_dat.data < PR_T){ // printf("\n"); continue; } key_func = i ? first_index : second_index; key_func(first /*dummy*/, &key_i, &dummy_dat /*dummy*/, &pkey_j); old = pkey_j.data; //pkey_j.flags = DB_DBT_USERMEM; //printf("ldb_key: %s\n", (char*)key_i.data); //printf("pkey_j: %lu\n", *(u_long*)pkey_j.data); prim->get(prim, NULL, &pkey_j, &data_j, 0); if(!write_cycle){ if(tagcmp((DbRecord*)data_i.data, (DbRecord*)data_j.data) > 0){ apply_tag((DbRecord*)data_i.data, has_tag((DbRecord*)data_j.data)); //printf("\tNew Min: %s\n", has_tag((DbRecord*)data_i.data)); changed=1; } free(old); continue; } //printf("Old Invnum_N: %s, ", ((DbRecord*)data_j.data)->Invnum_N); if(tagcmp((DbRecord*)data_i.data, (DbRecord*)data_j.data)!=0){ apply_tag(((DbRecord*)data_j.data), has_tag((DbRecord*)data_i.data)); prim->put(prim, NULL, &pkey_j, &data_j, 0); prim->get(prim, NULL, &pkey_j, &data_j, 0); changed=1; } //printf("New Invnum_N: %s\n", ((DbRecord*)data_j.data)->Invnum_N); //free(pkey_j.data); free(old); } while(DB_NOTFOUND != fs[i]->pget(fs[i], &pkey_i, &key_i, &dummy_dat, DB_NEXT_DUP)); }//First, second idx }//Write cycle } while(DB_NOTFOUND != prim_cur_i->pget(prim_cur_i, &key_i, &pkey_i, &data_i, DB_NEXT_DUP)); }//changed first_cur->close(first_cur); second_cur->close(second_cur); return(0); }
OBJECT ClosureExpand(OBJECT x, OBJECT env, BOOLEAN crs_wanted, OBJECT *crs, OBJECT *res_env) { OBJECT link, y, res, prnt_env, par, prnt; debug3(DCE, D, "[ ClosureExpand( %s, %s, %s, crs, res_env )", EchoObject(x), EchoObject(env), bool(crs_wanted)); assert( type(x) == CLOSURE, "ClosureExpand given non-CLOSURE!"); assert( predefined(actual(x)) == FALSE, "ClosureExpand given predefined!" ); /* add tag to x if needed but not provided; add cross-reference to crs */ if( has_tag(actual(x)) ) CrossAddTag(x); if( crs_wanted && has_tag(actual(x)) ) { OBJECT tmp = CopyObject(x, no_fpos); AttachEnv(env, tmp); y = CrossMake(actual(x), tmp, CROSS_TARG); New(tmp, CROSS_TARG); actual(tmp) = y; Link(tmp, y); if( *crs == nilobj ) New(*crs, CR_LIST); Link(*crs, tmp); } /* case x is a parameter */ res = *res_env = nilobj; if( is_par(type(actual(x))) ) { prnt = SearchEnv(env, enclosing(actual(x))); if( prnt != nilobj ) { prnt_env = GetEnv(prnt); for( link = Down(prnt); link != prnt; link = NextDown(link) ) { Child(par, link); if( type(par) == PAR && actual(par) == actual(x) ) { assert( Down(par) != par, "ExpandCLosure: Down(par)!"); Child(res, Down(par)); if( dirty(enclosing(actual(par))) || is_enclose(actual(par)) ) { debug2(DCE, DD, "copy %s %s", SymName(actual(par)), EchoObject(res)); res = CopyObject(res, no_fpos); } else { debug2(DCE, DD, "link %s %s", FullSymName(actual(par), AsciiToFull(".")), EchoObject(res)); DeleteLink(Down(par)); y = MakeWord(WORD, STR_NOCROSS, &fpos(res)); Link(par, y); } ReplaceNode(res, x); if( type(actual(x)) == RPAR && has_body(enclosing(actual(x))) ) { debug0(DCR, DDD, " calling SetEnv from ClosureExpand (a)"); *res_env = SetEnv(prnt, nilobj); DisposeObject(x); } else if( type(actual(x)) == NPAR && imports_encl(actual(x)) ) { debug0(DCR, DDD, " calling SetEnv from ClosureExpand (x)"); AttachEnv(env, x); *res_env = SetEnv(x, nilobj); } else { AttachEnv(env, x); debug0(DCR, DDD, " calling SetEnv from ClosureExpand (b)"); *res_env = SetEnv(x, prnt_env); } break; } } } else { /* fail only if there is no default value available */ if( sym_body(actual(x)) == nilobj ) { debug3(DCE, D, "failing ClosureExpand( %s, crs, %s, %s, res_env )", EchoObject(x), bool(crs_wanted), EchoObject(env)); Error(9, 2, "no value for parameter %s of symbol %s:", WARN, &fpos(x), SymName(actual(x)), SymName(enclosing(actual(x)))); Error(9, 1, "symbol with import list misused", FATAL, &fpos(x)); } } } /* case x is a user-defined symbol or default parameter */ if( res == nilobj ) { if( sym_body(actual(x)) == nilobj ) res = MakeWord(WORD, STR_NOCROSS, &fpos(x)); else res = CopyObject(sym_body(actual(x)), &fpos(x)); ReplaceNode(res, x); AttachEnv(env, x); debug0(DCR, DDD, " calling SetEnv from ClosureExpand (c)"); *res_env = SetEnv(x, nilobj); } assert( *res_env!=nilobj && type(*res_env)==ENV, "ClosureExpand: *res_env!"); debug0(DCE, D, "] ClosureExpand returning, res ="); ifdebug(DCE, D, DebugObject(res)); debug1(DCE, D, " environment = %s", EchoObject(*res_env)); return res; } /* end ClosureExpand */
//turns Selectors into Selections Selection* FileStore::select(Selector* selector) { //result holders FileSet r_files; if(!selector->is_empty()) { /* Intersections */ bool first = true; for(Tag tag: selector->get_tag_intersections()) { //prevent unknown tags from destroying the query if(!has_tag(tag)) continue; TagEntry* entry = tags[tag]; if(first) { //the first tag to be processed is a subset of the universe r_files = entry->files; first = false; } else { FileSet r_files_intersect; set_intersect<FileSet>(r_files_intersect, r_files, entry->files); //if the intersection created a null set, disregard this tag if(r_files_intersect.size() > 0) { r_files = r_files_intersect; } } } /* Exclusions */ for(Tag tag: selector->get_tag_exclusions()) { //prevent unknown tags from destroying the query if(!has_tag(tag)) continue; TagEntry* entry = tags[tag]; //exclude these files from the selection for(File* f: entry->files) r_files.erase(f); } /* Manual Includes & Excludes */ InExclude inexclude = selector->get_inexclude(); for(auto e: inexclude) { if(e.second) r_files.insert(e.first); //include this file else r_files.erase(e.first); //exclude this file } } //done selecting delete selector; return new Selection(&files, r_files); }
/* bool SuifPrinterModule::print_pointer(ostream& output, const PointerWrapper &obj, const LString &name, int _indent,int deref = 0) { return(print_pointer(output, obj.get_address(), obj.get_meta_class(), name, _indent, deref)); } */ bool SuifPrinterModule::print_pointer(ostream& output, const PointerWrapper &ptr_obj, const LString &name, int _indent,int deref = 0) { const Address what = ptr_obj.get_address(); const PointerMetaClass* type = ptr_obj.get_meta_class(); //output << "ptr:deref = " << deref << endl; int field_deref = deref ? deref-1 : 0; // PointerMetaClass *p = (PointerMetaClass*) type; // const Address curAddr = *(Address*) what; //PointerWrapper ptr_obj(what, type); ObjectWrapper pobj = ptr_obj.get_object(); ObjectWrapper base_obj = ptr_obj.dereference(); // suif_assert(base_obj.get_meta_class() == // ptr_obj.get_meta_class()->get_base_type()->get_meta_class(*(Address*) what)); if (!print_all()) if (base_obj.is_null()) return false; String name_with_addr = String("*") + name; // LString new_name = "*"; // LString new_name_str = new_name + name; char addr_str[256]; sprintf(addr_str, " <%p>", base_obj.get_address()); // String name_with_addr = new_name_str + addr_str; name_with_addr += addr_str; if (base_obj.is_null()) { output << type->get_instance_name(); output << '(' << type->get_meta_class_id() << ")"; if (name) output << ' ' << name << ' '; output << " = NULL;"; return true; } /* * for the "print_all" style */ if (print_all()) { if (ptr_obj.get_meta_class()->is_owning_pointer()) { output << type->get_instance_name(); output << '(' << type->get_meta_class_id() << ")"; output << '<' << what << '>'; print2(output, base_obj, emptyLString, _indent, field_deref); } else { if (deref) { output << name_with_addr <<":"; } else { output << type->get_instance_name(); output << ' ' << name_with_addr; output << " (ref)"; } } return true; } /* * This is the short printing */ if (ptr_obj.get_meta_class()->is_owning_pointer()) { if (!base_obj.is_null()) { if (!print_all()) print2(output, base_obj, name_with_addr, _indent, field_deref); else { output << base_obj.get_meta_class()->get_instance_name(); output << '(' << type->get_meta_class_id() << ")"; output << '<' << what << '>'; print2(output, base_obj, emptyLString, _indent, field_deref); } } } else { // MetaClassId id = baseType->get_meta_class_id(); String ref_str = get_print_ref_string(base_obj.get_meta_class()->get_instance_name()); //ObjectWrapper obj(what, baseType); if (has_tag(pobj)) { size_t ref = get_tag(pobj); output << "@t" << ref; if (use_print_ref_string() && ref_str != emptyString) { output<<':'; return parse_and_print(output, base_obj, emptyLString, ref_str, _indent, field_deref); } } else { //ObjectWrapper obj(curAddr, baseType); if (has_tag(base_obj)) { size_t ref = get_tag(base_obj); output << "@t" << ref; if (use_print_ref_string() && ref_str != emptyString) { output<<':'; return parse_and_print(output, base_obj, emptyLString, ref_str, _indent, field_deref); } } else { // No tag on the Pointer or the Object. // Here see if there should have been a tag but just hasn't been // seen yet. If so, we can declare one now which will be used later. if (use_print_ref_string() && ref_str != emptyString) { //ObjectWrapper obj(curAddr, baseType); size_t ref = retrieve_tag(base_obj); output << "@t" << ref; output <<':'; return parse_and_print(output, base_obj, emptyLString, ref_str, _indent, field_deref); } else { output << type->get_instance_name(); output << ' ' << name_with_addr; output << " (ref)"; } } } } return true; }