|
|
1.1 ! root 1: # include <tree.h> ! 2: # include <pv.h> ! 3: # include <sccs.h> ! 4: ! 5: SCCSID(@(#)prvect.c 7.1 2/5/81) ! 6: ! 7: /* ! 8: ** PRVECT -- prints parameter vector ! 9: ** ! 10: ** Prvect merely prints all of the entries in a PARM. If ! 11: ** a tree is included in the PARM, then the tree is printed. ! 12: ** ! 13: ** Parameters: ! 14: ** pc -- parameter count ! 15: ** if 0 then pv must be PV_EOF terminated. ! 16: ** pv -- parameter vector (PARM style). ! 17: ** cannot be NULL. ! 18: ** ! 19: ** Returns: ! 20: ** nothing ! 21: */ ! 22: ! 23: prvect(pc, pv) ! 24: int pc; ! 25: register PARM *pv; ! 26: { ! 27: register int pno; ! 28: ! 29: if (pv == NULL) ! 30: syserr("prvect -- null pv"); ! 31: ! 32: for (pno = 0; pv->pv_type != PV_EOF && pno < pc; pv++, pno++) ! 33: { ! 34: printf(" %3d ", pno); ! 35: pr_parm(pv); ! 36: } ! 37: } ! 38: /* ! 39: ** PR_PARM -- print a single parameter ! 40: ** ! 41: ** Parameters: ! 42: ** pv -- ptr to the parameter to print. ! 43: ** ! 44: ** Returns: ! 45: ** none. ! 46: ** ! 47: ** Side Effects: ! 48: ** none. ! 49: */ ! 50: ! 51: pr_parm(pv) ! 52: register PARM *pv; ! 53: { ! 54: register int i; ! 55: register char *p; ! 56: ! 57: printf("(len=%3d): ", pv->pv_len); ! 58: switch (pv->pv_type) ! 59: { ! 60: case PV_INT: ! 61: printf("%d\n", pv->pv_val.pv_int); ! 62: break; ! 63: ! 64: case PV_STR: ! 65: printf("\""); ! 66: for (p = pv->pv_val.pv_str; *p != '\0'; p++) ! 67: xputchar(*p); ! 68: printf("\"\n"); ! 69: break; ! 70: ! 71: case PV_TUPLE: ! 72: p = pv->pv_val.pv_tuple; ! 73: for (i = pv->pv_len; i > 0; i--) ! 74: printf("\%o", *p++); ! 75: printf("\n"); ! 76: break; ! 77: ! 78: case PV_QTREE: ! 79: printf("(query tree) \n"); ! 80: break; ! 81: ! 82: default: ! 83: printf("Unknown type %d\n", pv->pv_type); ! 84: break; ! 85: } ! 86: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.