/*================================= * node_lineprint -- print a node line * in a node tree * This is used in gedcom view & extended * gedcom views * returns static buffer * Created: 2001/01/27, Perry Rapp *===============================*/ static STRING node_lineprint (INT width, void * param) { static char line[120]; STRING ptr=line; INT mylen=sizeof(line); NODE_PRINT_PARAM npp = (NODE_PRINT_PARAM)param; NODE node=npp->node; if (mylen>width) mylen=width; if (nxref(node)) { llstrcatn(&ptr, nxref(node), &mylen); llstrcatn(&ptr, " ", &mylen); } if (ntag(node)) { llstrcatn(&ptr, ntag(node), &mylen); llstrcatn(&ptr, " ", &mylen); } if (nval(node)) { llstrcatn(&ptr, nval(node), &mylen); llstrcatn(&ptr, " ", &mylen); } if (npp->gdvw == GDVW_EXPANDED && nval(node)) { STRING key = rmvat(nval(node)), str; if (key) { str = generic_to_list_string(NULL, key, mylen, ",", &disp_long_rfmt, TRUE); llstrcatn(&ptr, " : ", &mylen); llstrcatn(&ptr, str, &mylen); } } return line; }
/*==================================================== * disp_pvalue -- Display details of specified pvalue * Drilldown in variable debugger * This is primarily to display contents of container values * val: [IN] value to display *==================================================*/ static void disp_pvalue (PVALUE val) { switch (which_pvalue_type(val)) { case PGNODE: { NODE node = pvalue_to_node(val); char buffer[256] = ""; size_t len = sizeof(buffer); STRING str = buffer; if (ntag(node)) { llstrappf(str, len, uu8, "%s: ", ntag(node)); } if (nval(node)) { llstrapps(str, len, uu8, nval(node)); } msg_info(str); } return; case PINDI: case PFAM: case PSOUR: case PEVEN: case POTHR: { RECORD rec = pvalue_to_record(val); NODE node = nztop(rec); size_t len = 128; STRING txt = generic_to_list_string(node, NULL, len, " ", NULL, TRUE); msg_info(txt); } return; case PLIST: { LIST list = pvalue_to_list(val); disp_list(list); } return; case PTABLE: { TABLE tab = pvalue_to_table(val); disp_table(tab); } return; case PSET: { INDISEQ seq = pvalue_to_seq(val); disp_seq(seq); } return; } }
/*======================================================= * annotate_node -- Alter a node by * expanding refns (eg, "@S25@" to "<1850.Census>") * annotating pointers (eg, "@I1@" to "@I1@ {{ John/SMITH }}") * Used during editing *=====================================================*/ static void annotate_node (NODE node, BOOLEAN expand_refns, BOOLEAN annotate_pointers, RFMT rfmt) { STRING key=0; RECORD rec=0; key = value_to_xref(nval(node)); if (!key) return; rec = key_possible_to_record(key, *key); if (!rec) return; if (expand_refns) { NODE refn = REFN(nztop(rec)); char buffer[60]; /* if there is a REFN, and it fits in our buffer, and it doesn't have any (confusing) > in it */ if (refn && nval(refn) && !strchr(nval(refn), '>') && strlen(nval(refn))<=sizeof(buffer)-3) { /* then replace, eg, @S25@, with, eg, <1850.Census> */ buffer[0]=0; strcpy(buffer, "<"); strcat(buffer, nval(refn)); strcat(buffer, ">"); stdfree(nval(node)); nval(node) = strsave(buffer); } } if (annotate_pointers) { STRING str = generic_to_list_string(nztop(rec), key, 60, ", ", rfmt, FALSE); ZSTR zstr = zs_news(nval(node)); zs_apps(zstr, " {{"); zs_apps(zstr, str); zs_apps(zstr, " }}"); stdfree(nval(node)); nval(node) = strsave(zs_str(zstr)); zs_free(&zstr); } }