Commit | Line | Data |
---|---|---|
459ebbd7 C |
1 | /* vprint.c - pepy printer support */ |
2 | ||
3 | #ifndef lint | |
4 | static char *rcsid = "$Header: /f/osi/pepsy/RCS/vprint.c,v 7.4 91/02/22 09:50:15 mrose Interim $"; | |
5 | #endif | |
6 | ||
7 | /* | |
8 | * $Header: /f/osi/pepsy/RCS/vprint.c,v 7.4 91/02/22 09:50:15 mrose Interim $ | |
9 | * | |
10 | * | |
11 | * $Log: vprint.c,v $ | |
12 | * Revision 7.4 91/02/22 09:50:15 mrose | |
13 | * Interim 6.8 | |
14 | * | |
15 | * Revision 7.3 90/12/23 18:42:12 mrose | |
16 | * update | |
17 | * | |
18 | * Revision 7.2 90/11/11 09:59:04 mrose | |
19 | * touch-up | |
20 | * | |
21 | * Revision 7.1 90/07/27 08:49:12 mrose | |
22 | * update | |
23 | * | |
24 | * Revision 7.0 90/07/01 19:54:34 mrose | |
25 | * *** empty log message *** | |
26 | * | |
27 | * Revision 7.0 89/11/23 22:12:08 mrose | |
28 | * Release 6.0 | |
29 | * | |
30 | */ | |
31 | ||
32 | /* | |
33 | * NOTICE | |
34 | * | |
35 | * Acquisition, use, and distribution of this module and related | |
36 | * materials are subject to the restrictions of a license agreement. | |
37 | * Consult the Preface in the User's Manual for the full terms of | |
38 | * this agreement. | |
39 | * | |
40 | */ | |
41 | ||
42 | ||
43 | /* LINTLIBRARY */ | |
44 | ||
45 | #include <ctype.h> | |
46 | #include <stdio.h> | |
47 | #include <varargs.h> | |
48 | #include "UNIV-types.h" | |
49 | #include "psap.h" | |
50 | #include "pepsy.h" | |
51 | #include "logger.h" | |
52 | ||
53 | ||
54 | int fprintf (); | |
55 | ||
56 | /* \f DATA */ | |
57 | ||
58 | #define VPRINT(s) vprint1 (), vwrite ((s)), vprint2 () | |
59 | ||
60 | static int vlevel = 0; | |
61 | ||
62 | static int didname = 0; | |
63 | static int didvpop = 0; | |
64 | static int didvpush = 0; | |
65 | static int docomma = 0; | |
66 | ||
67 | static char *py_classlist[] = { | |
68 | "UNIVERSAL", "APPLICATION", "", "PRIVATE" | |
69 | }; | |
70 | ||
71 | static char *vbp = NULL; | |
72 | static char *vsp; | |
73 | ||
74 | IFP vfnx = fprintf; | |
75 | FILE *vfp = stdout; | |
76 | static PS vps = NULLPS; | |
77 | ||
78 | char *oct2str (), *newbuf (); | |
79 | ||
80 | /* \f VPUSH/VPOP */ | |
81 | ||
82 | vpush () { | |
83 | if (didvpush) | |
84 | vwrite ("\n"), didvpush = 0; | |
85 | else | |
86 | if (!didname && docomma) | |
87 | vwrite (",\n"); | |
88 | ||
89 | if (didname) | |
90 | vwrite (" "); | |
91 | else | |
92 | if (vfp && vlevel > 0) | |
93 | (*vfnx) (vfp, "%*s", vlevel * 3, ""); | |
94 | vwrite ("{"); | |
95 | vlevel++; | |
96 | ||
97 | didname = didvpop = docomma = 0, didvpush = 1; | |
98 | } | |
99 | ||
100 | ||
101 | vpop () { | |
102 | if (didname || docomma) | |
103 | vwrite ("\n"); | |
104 | ||
105 | vlevel--; | |
106 | if (!didvpush && vfp && vlevel > 0) | |
107 | (*vfnx) (vfp, "%*s", vlevel * 3, ""); | |
108 | vwrite ("}"); | |
109 | if (vlevel == 0) | |
110 | vwrite ("\n"); | |
111 | ||
112 | didname = didvpush = 0, didvpop = docomma = vlevel ? 1 : 0; | |
113 | } | |
114 | ||
115 | /* \f VNAME/VTAG */ | |
116 | ||
117 | vname (name) | |
118 | char *name; | |
119 | { | |
120 | if (didvpush) | |
121 | vwrite ("\n"), didvpush = 0; | |
122 | else | |
123 | if (docomma) | |
124 | vwrite (",\n"); | |
125 | ||
126 | if (vfp && vlevel > 0) | |
127 | (*vfnx) (vfp, "%*s", vlevel * 3, ""); | |
128 | vwrite (name); | |
129 | ||
130 | didname = 1; | |
131 | } | |
132 | ||
133 | ||
134 | vtag (class, id) | |
135 | int class, | |
136 | id; | |
137 | { | |
138 | register char *bp; | |
139 | static char buffer[BUFSIZ]; | |
140 | ||
141 | if (didname) | |
142 | return; | |
143 | ||
144 | bp = buffer; | |
145 | *bp++ = '['; | |
146 | switch (class) { | |
147 | case PE_CLASS_UNIV: | |
148 | case PE_CLASS_APPL: | |
149 | case PE_CLASS_PRIV: | |
150 | (void) sprintf (bp, "%s ", py_classlist[class]); | |
151 | bp += strlen (bp); | |
152 | break; | |
153 | ||
154 | case PE_CLASS_CONT: | |
155 | default: | |
156 | break; | |
157 | } | |
158 | (void) sprintf (bp, "%d]", id); | |
159 | ||
160 | vname (buffer); | |
161 | } | |
162 | ||
163 | /* \f VPRINT */ | |
164 | ||
165 | #ifndef lint | |
166 | vprint (va_alist) | |
167 | va_dcl | |
168 | { | |
169 | char buffer[BUFSIZ]; | |
170 | va_list ap; | |
171 | ||
172 | vprint1 (); | |
173 | ||
174 | va_start (ap); | |
175 | ||
176 | _asprintf (buffer, NULLCP, ap); | |
177 | ||
178 | va_end (ap); | |
179 | ||
180 | vwrite (buffer); | |
181 | ||
182 | vprint2 (); | |
183 | } | |
184 | #else | |
185 | /* VARARGS */ | |
186 | ||
187 | vprint (fmt) | |
188 | char *fmt; | |
189 | { | |
190 | vprint (fmt); | |
191 | } | |
192 | #endif | |
193 | ||
194 | ||
195 | static vprint1 () | |
196 | { | |
197 | if (didvpush) { | |
198 | vwrite ("\n"), didvpush = 0; | |
199 | goto indent; | |
200 | } | |
201 | else | |
202 | if (didname) | |
203 | vwrite (" "); | |
204 | else { | |
205 | if (docomma) | |
206 | vwrite (",\n"); | |
207 | indent: ; | |
208 | if (vfp && vlevel > 0) | |
209 | (*vfnx) (vfp, "%*s", vlevel * 3, ""); | |
210 | } | |
211 | } | |
212 | ||
213 | ||
214 | static vprint2 () | |
215 | { | |
216 | if (vlevel == 0) | |
217 | vwrite ("\n"); | |
218 | ||
219 | didname = didvpop = 0, docomma = vlevel ? 1 : 0; | |
220 | } | |
221 | ||
222 | /* \f */ | |
223 | ||
224 | static vwrite (s) | |
225 | char *s; | |
226 | { | |
227 | if (vfp) | |
228 | (*vfnx) (vfp, "%s", s); | |
229 | else { | |
230 | register char c, | |
231 | *cp; | |
232 | ||
233 | if (vps) | |
234 | for (cp = s; *cp; cp++) { | |
235 | if (*cp == '\n' ) | |
236 | (void) ps_write (vps, (PElementData) " ", 1); | |
237 | else | |
238 | (void) ps_write (vps, (PElementData) cp, 1); | |
239 | } | |
240 | else | |
241 | for (cp = s; *cp; ) | |
242 | *vbp++ = (c = *cp++) != '\n' ? c : ' '; | |
243 | } | |
244 | } | |
245 | ||
246 | /* \f VSTRING */ | |
247 | ||
248 | vstring (pe) | |
249 | register PE pe; | |
250 | { | |
251 | register PE p; | |
252 | ||
253 | switch (pe -> pe_form) { | |
254 | case PE_FORM_PRIM: | |
255 | case PE_FORM_ICONS: | |
256 | VPRINT (oct2str ((char *) pe -> pe_prim, (int) pe -> pe_len)); | |
257 | break; | |
258 | ||
259 | case PE_FORM_CONS: | |
260 | vpush (); | |
261 | for (p = pe -> pe_cons; p; p = p -> pe_next) | |
262 | vstring (p); | |
263 | vpop (); | |
264 | break; | |
265 | } | |
266 | } | |
267 | ||
268 | /* \f */ | |
269 | ||
270 | static char *oct2str (s, len) | |
271 | register char *s; | |
272 | register int len; | |
273 | { | |
274 | int ia5ok; | |
275 | register int k; | |
276 | register char *bp, | |
277 | *cp, | |
278 | *dp, | |
279 | *zp; | |
280 | ||
281 | ia5ok = 1, k = 0; | |
282 | for (dp = (cp = s) + len; cp < dp; cp++) { | |
283 | switch (*cp) { | |
284 | case ' ': | |
285 | continue; | |
286 | ||
287 | case '"': | |
288 | break; | |
289 | ||
290 | case '\b': | |
291 | case '\f': | |
292 | case '\n': | |
293 | case '\r': | |
294 | case '\t': | |
295 | case '\\': | |
296 | ia5ok = -1, k++; | |
297 | continue; | |
298 | ||
299 | case '-': | |
300 | if (cp > s && *(cp + 1) == '-') | |
301 | break; | |
302 | continue; | |
303 | ||
304 | default: | |
305 | if (iscntrl (*cp) || isspace (*cp) || (*cp & 0x80)) | |
306 | break; | |
307 | continue; | |
308 | } | |
309 | ia5ok = 0; | |
310 | break; | |
311 | } | |
312 | ||
313 | switch (ia5ok) { | |
314 | case 1: | |
315 | zp = newbuf (len + 2); | |
316 | (void) sprintf (zp, "\"%*.*s\"", len, len, s); | |
317 | break; | |
318 | ||
319 | case -1: | |
320 | bp = zp = newbuf (len + k + 2); | |
321 | *bp++ = '"'; | |
322 | for (cp = s; cp < dp; cp++) | |
323 | if (*cp >= ' ' && *cp != '\\') | |
324 | *bp++ = *cp; | |
325 | else { | |
326 | *bp++ = '\\'; | |
327 | switch (*cp) { | |
328 | case '\b': | |
329 | *bp++ = 'b'; | |
330 | break; | |
331 | case '\f': | |
332 | *bp++ = 'f'; | |
333 | break; | |
334 | case '\n': | |
335 | *bp++ = 'n'; | |
336 | break; | |
337 | case '\r': | |
338 | *bp++ = 'r'; | |
339 | break; | |
340 | case '\t': | |
341 | *bp++ = 't'; | |
342 | break; | |
343 | ||
344 | case '\\': | |
345 | *bp++ = '\\'; | |
346 | break; | |
347 | } | |
348 | } | |
349 | (void) sprintf (bp, "\""); | |
350 | break; | |
351 | ||
352 | case 0: | |
353 | default: | |
354 | bp = zp = newbuf (len * 2 + 3); | |
355 | *bp++ = '\''; | |
356 | for (cp = s; cp < dp; cp++) { | |
357 | (void) sprintf (bp, "%02x", *cp & 0xff); | |
358 | bp += strlen (bp); | |
359 | } | |
360 | (void) sprintf (bp, "'H"); | |
361 | break; | |
362 | } | |
363 | ||
364 | return zp; | |
365 | } | |
366 | ||
367 | /* \f */ | |
368 | ||
369 | char *bit2str (pe, s) | |
370 | PE pe; | |
371 | char *s; | |
372 | { | |
373 | int ia5ok; | |
374 | register int hit, | |
375 | i, | |
376 | j, | |
377 | k; | |
378 | register char *bp, | |
379 | *cp, | |
380 | *zp; | |
381 | ||
382 | j = pe -> pe_nbits; | |
383 | if ((cp = s) && *++cp) { | |
384 | ia5ok = 1, hit = 0; | |
385 | for (i = 0; i < j;) | |
386 | if (bit_test (pe, i++) == 1) { | |
387 | do { | |
388 | if (!(k = *cp++ & 0xff)) | |
389 | break; | |
390 | if (k == i) { | |
391 | hit += hit ? 2 : 1; | |
392 | for (; *cp > ' '; cp++) | |
393 | hit++; | |
394 | } | |
395 | else | |
396 | for (; *cp > ' '; cp++) | |
397 | continue; | |
398 | } while (k != 0 && k < i); | |
399 | if (k == 0 || k > i) { | |
400 | ia5ok = 0; | |
401 | break; | |
402 | } | |
403 | } | |
404 | } | |
405 | else | |
406 | ia5ok = 0; | |
407 | ||
408 | if (ia5ok) { | |
409 | bp = zp = newbuf (hit + 3); | |
410 | *bp++ = '{'; | |
411 | ||
412 | cp = s, cp++; | |
413 | for (i = hit = 0; i < j;) | |
414 | if (bit_test (pe, i++) == 1) { | |
415 | do { | |
416 | if (!(k = *cp++ & 0xff)) | |
417 | break; | |
418 | if (k == i) { | |
419 | if (hit) | |
420 | *bp++ = ','; | |
421 | *bp++ = ' '; | |
422 | for (; *cp > ' '; cp++) | |
423 | *bp++ = *cp; | |
424 | } | |
425 | else | |
426 | for (; *cp > ' '; cp++) | |
427 | continue; | |
428 | } while (k != 0 && k < i); | |
429 | if (k == 0 || k > i) | |
430 | break; | |
431 | hit++; | |
432 | } | |
433 | ||
434 | (void) sprintf (bp, "%s}", hit ? " " : ""); | |
435 | } | |
436 | else { | |
437 | bp = zp = newbuf (j + 3); | |
438 | *bp++ = '\''; | |
439 | for (i = 0; i < j; i++) | |
440 | *bp++ = bit_test (pe, i) ? '1' : '0'; | |
441 | (void) sprintf (bp, "'B"); | |
442 | } | |
443 | ||
444 | return zp; | |
445 | } | |
446 | ||
447 | /* \f */ | |
448 | ||
449 | #ifdef vunknown | |
450 | #undef vunknown | |
451 | #endif | |
452 | ||
453 | vunknown (pe) | |
454 | register PE pe; | |
455 | { | |
456 | int i; | |
457 | #ifdef notyet /* could comment this in, but then all programs need -lm */ | |
458 | double j; | |
459 | #endif | |
460 | OID oid; | |
461 | register PE p; | |
462 | ||
463 | switch (pe -> pe_form) { | |
464 | case PE_FORM_PRIM: | |
465 | switch (PE_ID (pe -> pe_class, pe -> pe_id)) { | |
466 | case PE_ID (PE_CLASS_UNIV, PE_PRIM_BOOL): | |
467 | if ((i = prim2flag (pe)) == NOTOK) | |
468 | goto bad_pe; | |
469 | VPRINT (i ? "TRUE" : "FALSE"); | |
470 | break; | |
471 | ||
472 | case PE_ID (PE_CLASS_UNIV, PE_PRIM_INT): | |
473 | case PE_ID (PE_CLASS_UNIV, PE_PRIM_ENUM): | |
474 | if ((i = prim2num (pe)) == NOTOK | |
475 | && pe -> pe_errno != PE_ERR_NONE) | |
476 | goto bad_pe; | |
477 | vprint ("%d", i); | |
478 | break; | |
479 | ||
480 | #ifdef notyet | |
481 | case PE_ID (PE_CLASS_UNIV, PE_PRIM_REAL): | |
482 | if ((j = prim2real (pe)) == NOTOK | |
483 | && pe -> pe_errno != PE_ERR_NONE) | |
484 | goto bad_pe; | |
485 | vprint ("%g", j); | |
486 | break; | |
487 | #endif | |
488 | ||
489 | case PE_ID (PE_CLASS_UNIV, PE_PRIM_BITS): | |
490 | if ((p = prim2bit (pe)) == NULLPE) | |
491 | goto bad_pe; | |
492 | if (p -> pe_nbits < LOTSOFBITS) { | |
493 | VPRINT (bit2str (p, "\020")); | |
494 | break; | |
495 | } | |
496 | /* else fall... */ | |
497 | ||
498 | default: | |
499 | bad_pe: ; | |
500 | vtag ((int) pe -> pe_class, (int) pe -> pe_id); | |
501 | /* fall */ | |
502 | ||
503 | case PE_ID (PE_CLASS_UNIV, PE_PRIM_OCTS): | |
504 | case PE_ID (PE_CLASS_UNIV, PE_DEFN_IA5S): | |
505 | case PE_ID (PE_CLASS_UNIV, PE_DEFN_NUMS): | |
506 | case PE_ID (PE_CLASS_UNIV, PE_DEFN_PRTS): | |
507 | case PE_ID (PE_CLASS_UNIV, PE_DEFN_T61S): | |
508 | case PE_ID (PE_CLASS_UNIV, PE_DEFN_VTXS): | |
509 | case PE_ID (PE_CLASS_UNIV, PE_DEFN_GENT): | |
510 | case PE_ID (PE_CLASS_UNIV, PE_DEFN_UTCT): | |
511 | case PE_ID (PE_CLASS_UNIV, PE_DEFN_GFXS): | |
512 | case PE_ID (PE_CLASS_UNIV, PE_DEFN_VISS): | |
513 | case PE_ID (PE_CLASS_UNIV, PE_DEFN_GENS): | |
514 | case PE_ID (PE_CLASS_UNIV, PE_DEFN_CHRS): | |
515 | case PE_ID (PE_CLASS_UNIV, PE_PRIM_ODE): | |
516 | vstring (pe); | |
517 | break; | |
518 | ||
519 | case PE_ID (PE_CLASS_UNIV, PE_PRIM_NULL): | |
520 | VPRINT ("NULL"); | |
521 | break; | |
522 | ||
523 | case PE_ID (PE_CLASS_UNIV, PE_PRIM_OID): | |
524 | if ((oid = prim2oid (pe)) == NULLOID) | |
525 | goto bad_pe; | |
526 | VPRINT (oid2ode (oid)); | |
527 | break; | |
528 | } | |
529 | break; | |
530 | ||
531 | case PE_FORM_CONS: | |
532 | switch (PE_ID (pe -> pe_class, pe -> pe_id)) { | |
533 | case PE_ID (PE_CLASS_UNIV, PE_CONS_SEQ): | |
534 | case PE_ID (PE_CLASS_UNIV, PE_CONS_SET): | |
535 | break; | |
536 | ||
537 | case PE_ID (PE_CLASS_UNIV, PE_CONS_EXTN): | |
538 | (void) print_UNIV_EXTERNAL (pe, 1, NULLIP, NULLVP, | |
539 | NULLCP); | |
540 | return; | |
541 | ||
542 | default: | |
543 | vtag ((int) pe -> pe_class, (int) pe -> pe_id); | |
544 | break; | |
545 | } | |
546 | vpush (); | |
547 | for (p = pe -> pe_cons; p; p = p -> pe_next) | |
548 | vunknown (p); | |
549 | vpop (); | |
550 | break; | |
551 | ||
552 | case PE_FORM_ICONS: | |
553 | vtag ((int) pe -> pe_class, (int) pe -> pe_id); | |
554 | vstring (pe); | |
555 | break; | |
556 | } | |
557 | } | |
558 | ||
559 | /* \f VPUSHFP/VPOPFP */ | |
560 | ||
561 | vpushfp (fp, pe, s, rw) | |
562 | FILE *fp; | |
563 | PE pe; | |
564 | char *s; | |
565 | int rw; | |
566 | { | |
567 | vpushpp ((caddr_t) fp, fprintf, pe, s, rw); | |
568 | } | |
569 | ||
570 | vsetfp (fp, s) | |
571 | FILE * fp; | |
572 | char * s; | |
573 | { | |
574 | vfp = fp; | |
575 | vfnx = fprintf; | |
576 | ||
577 | if(s != NULLCP) | |
578 | (*vfnx) (vfp, "%s\n", s); | |
579 | ||
580 | vlevel = didname = didvpush = didvpop = docomma = 0; | |
581 | } | |
582 | ||
583 | vpopfp () | |
584 | { | |
585 | (*vfnx) (vfp, "-------\n"); | |
586 | (void) fflush (vfp); | |
587 | ||
588 | vpopp (); | |
589 | } | |
590 | ||
591 | /* \f VPUSHSTR/VPOPSTR */ | |
592 | ||
593 | vpushstr (cp) | |
594 | char *cp; | |
595 | { | |
596 | vfp = NULL; | |
597 | vbp = vsp = cp; | |
598 | ||
599 | vlevel = didname = didvpush = didvpop = docomma = 0; | |
600 | } | |
601 | ||
602 | ||
603 | vpopstr () | |
604 | { | |
605 | while (--vbp >= vsp) | |
606 | if (*vbp != ' ') | |
607 | break; | |
608 | *++vbp = NULL; | |
609 | ||
610 | vfp = stdout; | |
611 | } | |
612 | ||
613 | /* \f VPUSHPP */ | |
614 | ||
615 | vpushpp (pv, pfnx, pe, text, rw) | |
616 | caddr_t pv; | |
617 | IFP pfnx; | |
618 | register PE pe; | |
619 | char *text; | |
620 | int rw; | |
621 | { | |
622 | vfp = (FILE *) pv, vfnx = pfnx; | |
623 | ||
624 | (*vfnx) (vfp, "%s %s", rw ? "read" : "wrote", text ? text : "pdu"); | |
625 | if (pe -> pe_context != PE_DFLT_CTX) | |
626 | (*vfnx) (vfp, ", context %d", pe -> pe_context); | |
627 | (*vfnx) (vfp, "\n"); | |
628 | ||
629 | vlevel = didname = didvpush = didvpop = docomma = 0; | |
630 | } | |
631 | ||
632 | vpopp () | |
633 | { | |
634 | vfp = stdout, vfnx = fprintf; | |
635 | } | |
636 | ||
637 | ||
638 | vpushquipu (ps) | |
639 | PS ps; | |
640 | { | |
641 | vps = ps; | |
642 | vfp = NULL; | |
643 | ||
644 | vlevel = didname = didvpush = didvpop = docomma = 0; | |
645 | } | |
646 | ||
647 | ||
648 | vpopquipu () | |
649 | { | |
650 | vpopp(); | |
651 | vps = NULLPS; | |
652 | } | |
653 | ||
654 | /* \f PVPDU - for pepsy */ | |
655 | ||
656 | #undef pvpdu | |
657 | ||
658 | pvpdu (lp, ind, mod, pe, text, rw) | |
659 | register LLog *lp; | |
660 | int ind; /* index into tables */ | |
661 | modtyp *mod; /* pointer to tables */ | |
662 | register PE pe; | |
663 | char *text; | |
664 | int rw; | |
665 | { | |
666 | register char *bp; | |
667 | char buffer[BUFSIZ]; | |
668 | ||
669 | vfp = (FILE *) lp, vfnx = ll_printf; | |
670 | ||
671 | bp = buffer; | |
672 | (void) sprintf (bp, "%s %s", rw ? "read" : "wrote", | |
673 | text ? text : "pdu"); | |
674 | bp += strlen (bp); | |
675 | if (pe -> pe_context != PE_DFLT_CTX) { | |
676 | (void) sprintf (bp, ", context %d", pe -> pe_context); | |
677 | bp += strlen (bp); | |
678 | } | |
679 | LLOG (lp, LLOG_ALL, ("%s", buffer)); | |
680 | ||
681 | vlevel = didname = didvpush = didvpop = docomma = 0; | |
682 | ||
683 | if (mod == NULL) | |
684 | (void) vunknown (pe); | |
685 | else | |
686 | (void) prnt_f (ind, mod, pe, 1, NULLIP, NULLVP); | |
687 | ||
688 | (void) ll_printf (lp, "-------\n"); | |
689 | ||
690 | (void) ll_sync (lp); | |
691 | ||
692 | vfp = stdout, vfnx = fprintf; | |
693 | } | |
694 | ||
695 | /* \f MISC */ | |
696 | ||
697 | static char *bp = NULL; | |
698 | ||
699 | static char *newbuf (i) | |
700 | int i; | |
701 | { | |
702 | static unsigned int len = 0; | |
703 | ||
704 | if (i++ < len) | |
705 | return bp; | |
706 | ||
707 | if (bp) | |
708 | free (bp); | |
709 | if ((bp = malloc ((unsigned int) i))) | |
710 | len = i; | |
711 | else | |
712 | len = 0; | |
713 | ||
714 | return bp; | |
715 | } | |
716 | /* VPDU - support for backwards compatibility */ | |
717 | ||
718 | _vpdu (lp, fnx, pe, text, rw) | |
719 | register LLog *lp; | |
720 | IFP fnx; | |
721 | register PE pe; | |
722 | char *text; | |
723 | int rw; | |
724 | { | |
725 | register char *bp; | |
726 | char buffer[BUFSIZ]; | |
727 | ||
728 | vfp = (FILE *) lp, vfnx = ll_printf; | |
729 | ||
730 | bp = buffer; | |
731 | (void) sprintf (bp, "%s %s", rw ? "read" : "wrote", | |
732 | text ? text : "pdu"); | |
733 | bp += strlen (bp); | |
734 | if (pe -> pe_context != PE_DFLT_CTX) { | |
735 | (void) sprintf (bp, ", context %d", pe -> pe_context); | |
736 | bp += strlen (bp); | |
737 | } | |
738 | LLOG (lp, LLOG_ALL, ("%s", buffer)); | |
739 | ||
740 | vlevel = didname = didvpush = didvpop = docomma = 0; | |
741 | ||
742 | (void) (*fnx) (pe, 1, NULLIP, NULLVP, NULLCP); | |
743 | ||
744 | (void) ll_printf (lp, "-------\n"); | |
745 | ||
746 | (void) ll_sync (lp); | |
747 | ||
748 | vfp = stdout, vfnx = fprintf; | |
749 | } | |
750 | ||
751 | #ifdef PEP_TEST | |
752 | free_bp() | |
753 | { | |
754 | if (bp) | |
755 | free(bp); | |
756 | } | |
757 | #endif |