/* ETAK Inc. Jan 1995 */ /* #ident "@(#)idxdump.c 1.1 :/tmp_mnt/vol/consrc/nra/rep/s.idxdump.c 12/6/95 16:11:48" */ /* ETAK Inc. Mar 1993 */ /* #ident "@(#)nradump.c 1.1 :/tmp_mnt/vol/consrc/nra/ktree/s.nradump.c 3/17/93 18:26:33" */ #include #include #include #include "stdtype.h" #include "index.h" #include "ktree.h" #include "packing.h" #if 0 #define IDX_DEBUG 1 #endif /*----------------------------------------------------------------------*/ int xErr (err, msg) int err; char *msg; { extern FILE *llog; fprintf (llog? llog:stdout, "%s error code %d\n", msg, err); return (err); } /*----------------------------------------------------------------------*/ int nraDumpObj (pIdx, buf, id) nraHandle pIdx; char *buf; int id; { treeDef *tree; char *rec; U16 d1, d2, d3, d4, d5, d6; int i; U16 dummy; char s[128], s1[128]; unsigned short fnt; tree = pIdx->ptree; if (id >=0) fprintf (pIdx->log2,"%3d", id); for (i=0; i < tree->tableD.fieldDefCnt; i++) { rec = buf + tree->fldD[i].recFieldOff; if ((i > 0) && (id > -1)) fprintf (pIdx->log2," "); memcpy (s, rec, tree->fldD[i].fieldSize); s[tree->fldD[i].fieldSize] = 0; if (((unsigned char)s[0]) > 0xf0) { fprintf (pIdx->log2, " Fld%d ", i); putFonted (pIdx->log2, s, tree->fldD[i].fieldSize, &fnt); } else fprintf (pIdx->log2," Fld%d '%s'\n", i, s1); } rec = buf + OBJ_HDR_SIZE; if (buf[0] == IIS_TYPE) { memcpy (&dummy, rec, 2); d1 = GetNRAShort (dummy); memcpy (&dummy, rec+2, 2); d2 = GetNRAShort (dummy); fprintf (pIdx->log2," IIS Obj: Stack %3d card %3d\n", d1, d2); } else if (buf[0] == CRD_TYPE) { memcpy (&dummy, rec, 2); /* quad */ d1 = GetNRAShort (dummy); d2 = rec[3]; /* vewSet */ memcpy (&dummy, rec + 4, 2); /* unit */ d3 = GetNRAShort (dummy); memcpy (&dummy, rec + 6, 2); /* x */ d4 = GetNRAShort (dummy); memcpy (&dummy, rec + 8, 2); /* y */ d5 = GetNRAShort (dummy); fprintf (pIdx->log2," COORD Obj: Quad %4d VSet %x unit %4d xy %4x %4x\n", d1, d2, d3, d4, d5); } else if (buf[0] == LAYER_TYPE) { memcpy (&dummy, rec, 2); /* quad num */ d1 = GetNRAShort (dummy); d2 = (U16) rec[3]; /* viewSet */ memcpy (&dummy, rec+4, 2); /* unit code */ d3 = GetNRAShort (dummy); d4 = (U16) rec[6]; /* layer num */ d5 = (U16) rec[7]; /* layer fmt */ memcpy (&dummy, rec+8, 2); /* dataRecOff*/ d6 = GetNRAShort (dummy); fprintf (pIdx->log2," LayerOBJ: Quad %d VSet %d unit %d layer# %d fmt %d recff %d\n", d1, d2, d3, d4, d5, d6); } else return (xErr (-47, "Uknown object type!\n")); return (0); } /*----------------------------------------------------------------------*/ void put_jis_name (pIdx, siz, name) nraHandle pIdx; int siz; char *name; { int i; if (pIdx->jis_fd) { for ( i = 0; i < siz; i++) fprintf (pIdx->jis_fd, "%x", (unsigned char)name[i]); fprintf (pIdx->jis_fd, "\n"); } return; } /*----------------------------------------------------------------------*/ void put_fld_def (pIdx, pfieldD) nraHandle pIdx; nraFieldDef *pfieldD; { #ifdef IDX_DEBUG fprintf (pIdx->log, "RELATED FIELD DEFINITION\n"); fprintf (pIdx->log, "nextFldDefOff: %d\n", pfieldD->nextFldDefOff); fprintf (pIdx->log, "nameOff : %d\n", pfieldD->nameOff); fprintf (pIdx->log, "recFieldOff : %d\n", pfieldD->recFieldOff); fprintf (pIdx->log, "fieldSize : %d\n", pfieldD->fieldSize); fprintf (pIdx->log, "reserve : %d\n", pfieldD->reserve); fprintf (pIdx->log, "name.SIZE : %d\n", pfieldD->name.size); #endif if (pIdx->nra_file) put_jis_name (pIdx, pfieldD->name.size, pfieldD->name.str); #ifdef IDX_DEBUG else fprintf (pIdx->log, "Field name: '%s'\n", pfieldD->name.str); fprintf (pIdx->log, "\n"); #endif return; } /*----------------------------------------------------------------------*/ void put_tbl_desc (pIdx, tableD) nraHandle pIdx; nraTableDesc *tableD; { #ifdef IDX_DEBUG fprintf (pIdx->log, "RELATED TABLE DESCRIPTOR : \n"); fprintf (pIdx->log, "recAdrMSF : %x min %x sec %x frame\n", tableD->recAdrMSF.min, tableD->recAdrMSF.sec, tableD->recAdrMSF.frame); fprintf (pIdx->log, "Reserve1 : %d %d %d\n", tableD->Reserve1.data[0], tableD->Reserve1.data[1], tableD->Reserve1.data[2]); fprintf (pIdx->log, "tableSize : %d\n", tableD->tableSize); fprintf (pIdx->log, "nameOff : %d\n", tableD->nameOff); fprintf (pIdx->log, "recordSize : %d\n", tableD->recordSize); fprintf (pIdx->log, "objectSize : %d\n", tableD->objectSize); fprintf (pIdx->log, "Reserve2 : %d %d %d\n", tableD->Reserve2.data[0], tableD->Reserve2.data[1], tableD->Reserve2.data[2]); fprintf (pIdx->log, "fieldDefOff : %d\n", tableD->fieldDefOff); fprintf (pIdx->log, "fieldDefCnt : %d\n", tableD->fieldDefCnt); fprintf (pIdx->log, "name.size : %d\n", tableD->name.size); #endif if (pIdx->nra_file && pIdx->jis_fd) put_jis_name (pIdx, tableD->name.size, tableD->name.str); #ifdef IDX_DEBUG else fprintf (pIdx->log, "Table name: '%s'\n", tableD->name.str); fprintf (pIdx->log, "\n"); #endif return; } /*----------------------------------------------------------------------*/ void put_tree_desc (pIdx, ptreeD) nraHandle pIdx; nraTreeDesc *ptreeD; { #ifdef IDX_DEBUG fprintf (pIdx->log, "RETRIEVE TREE DESCRIPTOR : %d\n", ptreeD->treeNum); fprintf (pIdx->log, "nextTreeDesc: %d\n", ptreeD->nextTreeDesc); fprintf (pIdx->log, "nameOff : %d\n", ptreeD->nameOff); fprintf (pIdx->log, "relTableOff : %d\n", ptreeD->relTableOff); fprintf (pIdx->log, "treeAdrMSF : %x min %x sec %x frame\n", ptreeD->treeAdrMSF.min, ptreeD->treeAdrMSF.sec, ptreeD->treeAdrMSF.frame); fprintf (pIdx->log, "Reserve : %d %d %d\n", ptreeD->Reserve.data[0], ptreeD->Reserve.data[1], ptreeD->Reserve.data[2]); fprintf (pIdx->log, "rootOff : %d\n", ptreeD->rootOff); fprintf (pIdx->log, "nodeSize : %d\n", ptreeD->nodeSize); fprintf (pIdx->log, "cellSize : %d\n", ptreeD->cellSize); fprintf (pIdx->log, "treeNum : %d\n", ptreeD->treeNum); fprintf (pIdx->log, "Name size : %d\n", ptreeD->name.size); #endif if (pIdx->nra_file) put_jis_name (pIdx, ptreeD->name.size, ptreeD->name.str); #ifdef IDX_DEBUG else fprintf (pIdx->log, "Tree name : '%s'\n", ptreeD->name.str); fprintf (pIdx->log, "\n"); #endif return; }