/* vprint.c - pepy printer support */
static char *rcsid
= "$Header: /f/osi/pepsy/RCS/vprint.c,v 7.4 91/02/22 09:50:15 mrose Interim $";
* $Header: /f/osi/pepsy/RCS/vprint.c,v 7.4 91/02/22 09:50:15 mrose Interim $
* Revision 7.4 91/02/22 09:50:15 mrose
* Revision 7.3 90/12/23 18:42:12 mrose
* Revision 7.2 90/11/11 09:59:04 mrose
* Revision 7.1 90/07/27 08:49:12 mrose
* Revision 7.0 90/07/01 19:54:34 mrose
* *** empty log message ***
* Revision 7.0 89/11/23 22:12:08 mrose
* Acquisition, use, and distribution of this module and related
* materials are subject to the restrictions of a license agreement.
* Consult the Preface in the User's Manual for the full terms of
#define VPRINT(s) vprint1 (), vwrite ((s)), vprint2 ()
static char *py_classlist
[] = {
"UNIVERSAL", "APPLICATION", "", "PRIVATE"
char *oct2str (), *newbuf ();
vwrite ("\n"), didvpush
= 0;
(*vfnx
) (vfp
, "%*s", vlevel
* 3, "");
didname
= didvpop
= docomma
= 0, didvpush
= 1;
if (!didvpush
&& vfp
&& vlevel
> 0)
(*vfnx
) (vfp
, "%*s", vlevel
* 3, "");
didname
= didvpush
= 0, didvpop
= docomma
= vlevel
? 1 : 0;
vwrite ("\n"), didvpush
= 0;
(*vfnx
) (vfp
, "%*s", vlevel
* 3, "");
static char buffer
[BUFSIZ
];
(void) sprintf (bp
, "%s ", py_classlist
[class]);
(void) sprintf (bp
, "%d]", id
);
_asprintf (buffer
, NULLCP
, ap
);
vwrite ("\n"), didvpush
= 0;
(*vfnx
) (vfp
, "%*s", vlevel
* 3, "");
didname
= didvpop
= 0, docomma
= vlevel
? 1 : 0;
for (cp
= s
; *cp
; cp
++) {
(void) ps_write (vps
, (PElementData
) " ", 1);
(void) ps_write (vps
, (PElementData
) cp
, 1);
*vbp
++ = (c
= *cp
++) != '\n' ? c
: ' ';
VPRINT (oct2str ((char *) pe
-> pe_prim
, (int) pe
-> pe_len
));
for (p
= pe
-> pe_cons
; p
; p
= p
-> pe_next
)
static char *oct2str (s
, len
)
for (dp
= (cp
= s
) + len
; cp
< dp
; cp
++) {
if (cp
> s
&& *(cp
+ 1) == '-')
if (iscntrl (*cp
) || isspace (*cp
) || (*cp
& 0x80))
(void) sprintf (zp
, "\"%*.*s\"", len
, len
, s
);
bp
= zp
= newbuf (len
+ k
+ 2);
for (cp
= s
; cp
< dp
; cp
++)
if (*cp
>= ' ' && *cp
!= '\\')
(void) sprintf (bp
, "\"");
bp
= zp
= newbuf (len
* 2 + 3);
for (cp
= s
; cp
< dp
; cp
++) {
(void) sprintf (bp
, "%02x", *cp
& 0xff);
(void) sprintf (bp
, "'H");
if (bit_test (pe
, i
++) == 1) {
} while (k
!= 0 && k
< i
);
bp
= zp
= newbuf (hit
+ 3);
for (i
= hit
= 0; i
< j
;)
if (bit_test (pe
, i
++) == 1) {
} while (k
!= 0 && k
< i
);
(void) sprintf (bp
, "%s}", hit
? " " : "");
bp
= zp
= newbuf (j
+ 3);
*bp
++ = bit_test (pe
, i
) ? '1' : '0';
(void) sprintf (bp
, "'B");
#ifdef notyet /* could comment this in, but then all programs need -lm */
switch (PE_ID (pe
-> pe_class
, pe
-> pe_id
)) {
case PE_ID (PE_CLASS_UNIV
, PE_PRIM_BOOL
):
if ((i
= prim2flag (pe
)) == NOTOK
)
VPRINT (i
? "TRUE" : "FALSE");
case PE_ID (PE_CLASS_UNIV
, PE_PRIM_INT
):
case PE_ID (PE_CLASS_UNIV
, PE_PRIM_ENUM
):
if ((i
= prim2num (pe
)) == NOTOK
&& pe
-> pe_errno
!= PE_ERR_NONE
)
case PE_ID (PE_CLASS_UNIV
, PE_PRIM_REAL
):
if ((j
= prim2real (pe
)) == NOTOK
&& pe
-> pe_errno
!= PE_ERR_NONE
)
case PE_ID (PE_CLASS_UNIV
, PE_PRIM_BITS
):
if ((p
= prim2bit (pe
)) == NULLPE
)
if (p
-> pe_nbits
< LOTSOFBITS
) {
VPRINT (bit2str (p
, "\020"));
vtag ((int) pe
-> pe_class
, (int) pe
-> pe_id
);
case PE_ID (PE_CLASS_UNIV
, PE_PRIM_OCTS
):
case PE_ID (PE_CLASS_UNIV
, PE_DEFN_IA5S
):
case PE_ID (PE_CLASS_UNIV
, PE_DEFN_NUMS
):
case PE_ID (PE_CLASS_UNIV
, PE_DEFN_PRTS
):
case PE_ID (PE_CLASS_UNIV
, PE_DEFN_T61S
):
case PE_ID (PE_CLASS_UNIV
, PE_DEFN_VTXS
):
case PE_ID (PE_CLASS_UNIV
, PE_DEFN_GENT
):
case PE_ID (PE_CLASS_UNIV
, PE_DEFN_UTCT
):
case PE_ID (PE_CLASS_UNIV
, PE_DEFN_GFXS
):
case PE_ID (PE_CLASS_UNIV
, PE_DEFN_VISS
):
case PE_ID (PE_CLASS_UNIV
, PE_DEFN_GENS
):
case PE_ID (PE_CLASS_UNIV
, PE_DEFN_CHRS
):
case PE_ID (PE_CLASS_UNIV
, PE_PRIM_ODE
):
case PE_ID (PE_CLASS_UNIV
, PE_PRIM_NULL
):
case PE_ID (PE_CLASS_UNIV
, PE_PRIM_OID
):
if ((oid
= prim2oid (pe
)) == NULLOID
)
switch (PE_ID (pe
-> pe_class
, pe
-> pe_id
)) {
case PE_ID (PE_CLASS_UNIV
, PE_CONS_SEQ
):
case PE_ID (PE_CLASS_UNIV
, PE_CONS_SET
):
case PE_ID (PE_CLASS_UNIV
, PE_CONS_EXTN
):
(void) print_UNIV_EXTERNAL (pe
, 1, NULLIP
, NULLVP
,
vtag ((int) pe
-> pe_class
, (int) pe
-> pe_id
);
for (p
= pe
-> pe_cons
; p
; p
= p
-> pe_next
)
vtag ((int) pe
-> pe_class
, (int) pe
-> pe_id
);
vpushpp ((caddr_t
) fp
, fprintf
, pe
, s
, rw
);
(*vfnx
) (vfp
, "%s\n", s
);
vlevel
= didname
= didvpush
= didvpop
= docomma
= 0;
(*vfnx
) (vfp
, "-------\n");
/* \f VPUSHSTR/VPOPSTR */
vlevel
= didname
= didvpush
= didvpop
= docomma
= 0;
vpushpp (pv
, pfnx
, pe
, text
, rw
)
vfp
= (FILE *) pv
, vfnx
= pfnx
;
(*vfnx
) (vfp
, "%s %s", rw
? "read" : "wrote", text
? text
: "pdu");
if (pe
-> pe_context
!= PE_DFLT_CTX
)
(*vfnx
) (vfp
, ", context %d", pe
-> pe_context
);
vlevel
= didname
= didvpush
= didvpop
= docomma
= 0;
vfp
= stdout
, vfnx
= fprintf
;
vlevel
= didname
= didvpush
= didvpop
= docomma
= 0;
/* \f PVPDU - for pepsy */
pvpdu (lp
, ind
, mod
, pe
, text
, rw
)
int ind
; /* index into tables */
modtyp
*mod
; /* pointer to tables */
vfp
= (FILE *) lp
, vfnx
= ll_printf
;
(void) sprintf (bp
, "%s %s", rw
? "read" : "wrote",
if (pe
-> pe_context
!= PE_DFLT_CTX
) {
(void) sprintf (bp
, ", context %d", pe
-> pe_context
);
LLOG (lp
, LLOG_ALL
, ("%s", buffer
));
vlevel
= didname
= didvpush
= didvpop
= docomma
= 0;
(void) prnt_f (ind
, mod
, pe
, 1, NULLIP
, NULLVP
);
(void) ll_printf (lp
, "-------\n");
vfp
= stdout
, vfnx
= fprintf
;
static unsigned int len
= 0;
if ((bp
= malloc ((unsigned int) i
)))
/* VPDU - support for backwards compatibility */
_vpdu (lp
, fnx
, pe
, text
, rw
)
vfp
= (FILE *) lp
, vfnx
= ll_printf
;
(void) sprintf (bp
, "%s %s", rw
? "read" : "wrote",
if (pe
-> pe_context
!= PE_DFLT_CTX
) {
(void) sprintf (bp
, ", context %d", pe
-> pe_context
);
LLOG (lp
, LLOG_ALL
, ("%s", buffer
));
vlevel
= didname
= didvpush
= didvpop
= docomma
= 0;
(void) (*fnx
) (pe
, 1, NULLIP
, NULLVP
, NULLCP
);
(void) ll_printf (lp
, "-------\n");
vfp
= stdout
, vfnx
= fprintf
;