Net2/usr/src/contrib/isode/pepsy/pepsydefs.h.gnrc

%BEGIN(PEPSY)%
/* pepsydefs.h - definitions for pepsy */
%END(PEPSY)%
%BEGIN(PEPY)%
/* pepy.h - definitions for pepy */
%END(PEPY)%
%BEGIN(ROSY)%
/* rosy-defs.h - definitions for rosy */
%END(ROSY)%
%BEGIN(MOSY)%
/* mosy-defs.h - definitions for mosy */
%END(MOSY)%
/* %WARNING% */

/* 
 * $Header: /f/osi/pepsy/RCS/pepsydefs.h.gnrc,v 7.6 91/02/22 09:49:51 mrose Interim $
 *
 *
 * $Log:	pepsydefs.h.gnrc,v $
 * Revision 7.6  91/02/22  09:49:51  mrose
 * Interim 6.8
 * 
 * Revision 7.5  91/01/08  12:50:51  mrose
 * update
 * 
 * Revision 7.4  90/12/23  17:25:17  mrose
 * patches
 * 
 * Revision 7.3  90/12/11  10:41:06  mrose
 * sync
 * 
 * Revision 7.2  90/11/11  10:54:16  mrose
 * update
 * 
 * Revision 7.1  90/11/04  19:19:12  mrose
 * update
 * 
 * Revision 7.0  90/07/01  19:54:38  mrose
 * *** empty log message ***
 * 
 * Revision 7.0  89/11/23  22:11:48  mrose
 * Release 6.0
 * 
 * Revision 6.1  89/07/30  12:16:16  mrose
 */

/*
 *				  NOTICE
 *
 *    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
 *    this agreement.
 *
 */


#include "psap.h"

struct tuple {
    int     t_type;
    char   *t_class;
    char   *t_form;
    char   *t_id;
    PElementClass t_classnum;
    int	    t_idnum;
};

typedef struct ypv {
    int     yv_code;
#define	YV_UNDF		0x00	/* ??? */
#define	YV_NUMBER	0x01	/* LITNUMBER */
#define	YV_BOOL		0x02	/* TRUE | FALSE */
#define	YV_STRING	0x03	/* LITSTRING */
#define	YV_IDEFINED	0x04	/* ID */
#define	YV_IDLIST	0x05	/* IdentifierList */
#define	YV_VALIST	0x06	/* { Values } */
#define	YV_NULL		0x07	/* NULL */
#define YV_ABSENT	0x08	/* WITH COMPONENTS .. ABSENT */
#define YV_PRESENT	0x09	/*  "	"	   .. PRESENT */
#define YV_INCLUDES	0x0a	/* INCLUDES ... */
#define YV_WITHCOMPS	0x0b	/* WITH COMPONENTS */
#define	YV_OIDLIST	0x0c	/* { object identifier } */
#define YV_REAL		0x0d	/* real value */
#define YV_HSTRING	0x0e	/* Hex String */
#define YV_BSTRING	0x0f	/* Bit String */

    union {
	int	    yv_un_number;		/* code = YV_NUMBER
						   code = YV_BOOL */

	double	    yv_un_real;			/* code = YV_REAL */

	char	   *yv_un_string;		/* code = YV_STRING */

	struct {				/* code = YV_IDEFINED */
	    char   *yv_st_module;
	    char   *yv_st_modid;
	    char   *yv_st_identifier;
	}		yv_st;

        struct ypv *yv_un_idlist;		/* code = YV_IDLIST
						   code = YV_VALIST
						   code = YV_OIDLIST */

	struct {				
	    char	*yv_sl_xstring;		   
	    int		yv_sl_xlength;
	}		yv_sl;			 /* code = YV_HSTRING
						    code = YV_BSTRING */
    }                   yv_un;
#define	yv_number	yv_un.yv_un_number
#define	yv_string	yv_un.yv_un_string
#define	yv_identifier	yv_un.yv_st.yv_st_identifier
#define	yv_module	yv_un.yv_st.yv_st_module
#define yv_modid	yv_un.yv_st.yv_st_modid
#define yv_idlist	yv_un.yv_un_idlist
#define yv_real		yv_un.yv_un_real
#define yv_xstring	yv_un.yv_sl.yv_sl_xstring
#define yv_xlength	yv_un.yv_sl.yv_sl_xlength

    char   *yv_action;
    int	    yv_act_lineno;

    int	    yv_flags;
#define	YV_NOFLAGS	0x00	/* no flags */
#define	YV_ID		0x01	/* ID Value */
#define	YV_NAMED	0x02	/* NamedNumber */
#define	YV_TYPE		0x04	/* TYPE Value */
#define	YV_BOUND	0x08	/* named value */
#define	YVBITS	"\020\01ID\02NAMED\03TYPE\04BOUND"

    char   *yv_id;				/* flags & YV_ID */

    char   *yv_named;				/* flags & YV_NAMED */

    struct ype *yv_type;			/* flags & YV_TYPE */

    struct ypv *yv_next;
}			ypv, *YV;
#define	NULLYV	((YV) 0)

YV	new_value (), add_value (), copy_value ();

/*  */

typedef struct ypt {
    PElementClass   yt_class;

    YV		    yt_value;
}			ypt, *YT;
#define	NULLYT	((YT) 0)

YT	new_tag (), copy_tag ();

%BEGIN(PEPSY)%
/* Encoding functions definitions */
typedef struct yfn {
	char	*yfn_enc; /* Encoding function name */
	char	*yfn_dec; /* Decoding function name */
	char	*yfn_prt; /* Printing function name */
	char	*yfn_fre; /* Freeing function name */
}	yfn, *YFN;

#define NULLYFN	((YFN) 0)

extern YFN new_yfn(), join_yfn();

typedef struct action_t	{
	char	*a_data;	/* actual C text of action statement */
	int	a_line;		/* line number of input we came from */
	int	a_num;		/* number for case statement */
}	action_t, *Action;
#define NULLAction	((Action)0)

extern Action	new_action_t();

typedef struct yactlist	{
	Action	yal_enc;
	Action	yal_dec;
	Action	yal_prn;
	char	*yal_comment;	/* A comment as to where the line comes from */
	char	*yal_type;	/* the C type of the parm used in this action */
}   yactlist_t, *YAL;
#define NULLYAL	((YAL)0)

extern YAL	new_yal(), yal_join();

extern Action	start_action, final_action;

extern int	e_actions, d_actions, p_actions;

#define ER_UNKNOWN	0	/* Unknown what the type is - warn if used */
#define ER_NORMAL	1	/* Implicit works normally */
#define ER_EXPLICIT	2	/* Implicit should be translated to explicit */


%END(PEPSY)%

/*  */

typedef struct ype {
    int     yp_code;
#define	YP_UNDF		0x00	/* type not yet known */
#define	YP_BOOL		0x01	/* BOOLEAN */
#define	YP_INT		0x02	/* INTEGER */
#define	YP_INTLIST	0x03	/* INTEGER [ NamedNumberList ] */
#define	YP_BIT		0x04	/* BITSTRING */
#define	YP_BITLIST	0x05	/* BITSTRING [ NamedNumberList ] */
#define	YP_OCT		0x06	/* OCTETSTRING */
#define	YP_NULL		0x07	/* NULL */
#define	YP_SEQ		0x08	/* SEQUENCE */
#define	YP_SEQTYPE	0x09	/* SEQUENCE OF Type */
#define	YP_SEQLIST	0x0a	/* SEQUENCE [ ElementTypes ] */
#define	YP_SET		0x0b	/* SET */
#define	YP_SETTYPE	0x0c	/* SET OF Type */
#define	YP_SETLIST	0x0d	/* SET [ MemberTypes ] */
#define	YP_CHOICE	0x0e	/* CHOICE [ AlternativeTypeList ] */
#define	YP_ANY		0x0f	/* ANY */
#define	YP_OID		0x10	/* OBJECT IDENTIFIER */
#define	YP_IDEFINED	0x11	/* identifier */
#define YP_ENUMLIST	0x12	/* ENUMERATED */
#define YP_REAL		0x13	/* Real (floating-point) */
#define YP_IMPTYPE	0x14	/* Imported - real type unknown */

    int     yp_direction;
#define YP_DECODER	0x01
#define YP_ENCODER	0x02
#define	YP_PRINTER	0x04

    union {
	struct {				/* code = YP_IDEFINED */
	    char   *yp_st_module;		    /* module name */
	    OID	    yp_st_modid;		    /* module id */
	    char   *yp_st_identifier;		    /* definition name */
	}		yp_st;

	struct ype *yp_un_type;			/* code = YP_SEQTYPE
						   code = YP_SEQLIST
						   code = YP_SETTYPE
						   code = YP_SETLIST
						   code = YP_CHOICE */

	YV	    yp_un_value;		/* code = YP_INTLIST
						   code = YP_BITLIST */
    }                   yp_un;
#define	yp_identifier	yp_un.yp_st.yp_st_identifier
#define	yp_module	yp_un.yp_st.yp_st_module
#define yp_modid	yp_un.yp_st.yp_st_modid
#define	yp_type		yp_un.yp_un_type
#define	yp_value	yp_un.yp_un_value

    char   *yp_intexp;		/* expressions to pass (use) as extra */
    char   *yp_strexp;		/* parameters (primitive values) */
    char    yp_prfexp;

    char   *yp_declexp;
    char   *yp_varexp;

    char   *yp_structname;
    char   *yp_ptrname;

    char   *yp_param_type;

    char   *yp_action0;
    int     yp_act0_lineno;

    char   *yp_action05;
    int	    yp_act05_lineno;

    char   *yp_action1;
    int	    yp_act1_lineno;

    char   *yp_action2;
    int	    yp_act2_lineno;

    char   *yp_action3;
    int	    yp_act3_lineno;

    int     yp_flags;
#define	YP_NOFLAGS	0x0000	/* no flags */
#define	YP_OPTIONAL	0x0001	/* OPTIONAL */
#define	YP_COMPONENTS	0x0002	/* COMPONENTS OF */
#define	YP_IMPLICIT	0x0004	/* IMPLICIT */
#define	YP_DEFAULT	0x0008	/* DEFAULT */
#define	YP_ID		0x0010	/* ID */
#define	YP_TAG		0x0020	/* Tag */
#define	YP_BOUND	0x0040	/* ID LANGLE */
#define	YP_PULLEDUP	0x0080	/* member is a choice */
#define YP_PARMVAL	0x0100	/* value to be passed to parm is present */
#define YP_CONTROLLED	0x0200	/* encoding item has a controller */
#define	YP_OPTCONTROL	0x0400	/*   .. */
#define	YP_ACTION1	0x0800	/* action1 acted upon */
#define	YP_PARMISOID	0x1000	/* value to be passed to parm is OID */
#define YP_ENCRYPTED	0x2000	/* encypted - which is a bit hazy */
#define YP_IMPORTED	0x4000  /* value imported from another module */
#define YP_EXPORTED	0x8000  /* value exported to another module */
#define YP_WANTIMPLICIT 0x10000 /* Keep the implicit tag */
#define	YPBITS	"\020\01OPTIONAL\02COMPONENTS\03IMPLICIT\04DEFAULT\05ID\06TAG\
\07BOUND\010PULLEDUP\011PARMVAL\012CONTROLLED\013OPTCONTROL\
\014ACTION1\015PARMISOID\016ENCRYPTED\017IMPORTED\020EXPORTED"

    YV	    yp_default;				/* flags & YP_DEFAULT */

    char   *yp_id;				/* flags & YP_ID */

    YT	    yp_tag;				/* flags & YP_TAG */

    char   *yp_bound;				/* flags & YP_BOUND */

    char   *yp_parm;				/* flags & YP_PARMVAL */

    char   *yp_control;				/* flags & YP_CONTROLLED */

    char   *yp_optcontrol;			/* flags & YP_OPTCONTROL */

    char   *yp_offset;

    struct ype *yp_next;

%BEGIN(PEPSY)%
    YFN	   yp_yfn;	/* encoding/decoding functions */

    YAL    yp_bef_alist;	/* list of before this */
    YAL    yp_aft_alist;	/* list of after this */

    YAL	   yp_control_act;	/* controlled actions */
    YAL	   yp_optional_act;	/* optional actions */
%END(PEPSY)%
    
    int	   yp_lineno;		/* line number for diagnostics */

} 			ype, *YP;
#define	NULLYP	((YP) 0)

YP	new_type (), add_type (), copy_type (), lkup();

char   *new_string ();

#define	TBL_EXPORT	0
#define TBL_IMPORT	1
#define MAX_TBLS	2

extern int tagcontrol;
#define TAG_UNKNOWN 	0
#define TAG_IMPLICIT	1
#define TAG_EXPLICIT	2

#define CH_FULLY	0
#define CH_PARTIAL	1

typedef struct yop {
    char   *yo_name;

    YP	    yo_arg;
    YP	    yo_result;
    YV	    yo_errors;
    YV	    yo_linked;

    int	    yo_opcode;
}		yop, *YO;
#define	NULLYO	((YO) 0)


typedef struct yerr {
    char   *ye_name;

    YP	    ye_param;

    int	    ye_errcode;

    int	    ye_offset;
}	    yerr, *YE;
#define	NULLYE	((YE) 0)

/*  */

%BEGIN(PEPSY)%
extern char *pepsyversion;
%END(PEPSY)%
%BEGIN(PEPY)%
extern char *pepyversion;
%END(PEPY)%

extern int yysection;
extern char *yyencpref;
extern char *yydecpref;
extern char *yyprfpref;
extern char *yyencdflt;
extern char *yydecdflt;
extern char *yyprfdflt;

extern int yydebug;
extern int yylineno;

#ifndef	HPUX
extern char yytext[];
#else
extern unsigned char yytext[];
#endif

extern char *mymodule;

extern OID   mymoduleid;

extern char *bflag;
extern int   Cflag;
extern int   dflag;
extern int   Pflag;
extern char *sysin;

extern char *module_actions;

OID	addoid ();
OID	int2oid ();
OID	oidlookup ();
char	*oidname ();
char	*oidprint ();

extern int errno;