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