DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T p

⟦8b460b853⟧ TextFile

    Length: 5579 (0x15cb)
    Types: TextFile
    Names: »pe2or.py«

Derivation

└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
    └─⟦dc59850a2⟧ »EurOpenD22/pp5.0/pp-5.tar.Z« 
        └─⟦e5a54fb17⟧ 
            └─⟦this⟧ »pp-5.0/Lib/or/pe2or.py« 

TextFile

-- pe2or: P1 O/R to OR_ptr conversion routines


-- @(#) $Header: /cs/research/pp/hubris/pp-beta/Lib/or/RCS/pe2or.py,v 5.0 90/09/20 16:08:59 pp Exp Locker: pp $
--
-- $Log:	pe2or.py,v $
-- Revision 5.0  90/09/20  16:08:59  pp
-- rcsforce : 5.0 public release
-- 
--



-- SEK add application 1 tag back into PE

OR DEFINITIONS ::=

%{
#ifndef lint
static char Rcsid[] = "@(#)$Header";
#endif  lint

#include "util.h"
#include "or.h"

static void or_concat ();

#define PEPYPARM        OR_ptr *

OR_ptr  pe2or (pe)
PE      pe;
{
        OR_ptr  or = NULLOR;
	PE  tpe;

		/* SEK put in an extra tage */
	tpe = pe_alloc (PE_CLASS_APPL, PE_FORM_CONS, 0);
	tpe -> pe_cons = pe;
        if (decode_OR_ORName (tpe, 1, NULLIP, NULLVP, &or) == NOTOK) {
                if (or)
                        or_free (or);
		or = NULLOR;
        }
	tpe -> pe_cons = NULLPE;
	pe_free (tpe);
        return or;
}

#undef DEBUG
%}

BEGIN

DECODER decode

-- O/R name

ORName ::=
        [APPLICATION 0]
            IMPLICIT SEQUENCE {
                standard
                    StandardAttributeList [[p parm]],

                domaindefined
                    DomainDefinedAttributeList [[p parm]] OPTIONAL
            }

StandardAttributeList 
        %{
                char    *str;
        %} ::=
        SEQUENCE {
                CountryName [[p parm]] OPTIONAL,

                AdministrationDomainName [[p parm]] OPTIONAL,

            [0]
                IMPLICIT X121Address [[s str]]
                %{ or_concat (parm, OR_X121, NULLCP, str); %}
                OPTIONAL,

            [1]
                IMPLICIT TerminalID [[s str]]
                %{ or_concat (parm, OR_TID, NULLCP, str); %}
                OPTIONAL,

            [2]
                PrivateDomainName [[p parm]] OPTIONAL,

            [3]
                IMPLICIT OrganizationName [[s str]]
                %{ or_concat (parm, OR_O, NULLCP, str); %}
                OPTIONAL,

            [4]
                IMPLICIT UniqueUAIdentifier [[s str]]
                %{ or_concat (parm, OR_UAID, NULLCP, str); %}
                OPTIONAL,

            [5]
                IMPLICIT PersonalName [[p parm]] OPTIONAL,

            [6]
                IMPLICIT SEQUENCE OF OrganizationalUnit [[s str]]
                %{
                        or_concat (parm, OR_OU, NULLCP, str);
                %}
                OPTIONAL
        }


DomainDefinedAttributeList ::=
        SEQUENCE OF DomainDefinedAttribute [[p parm]]


DomainDefinedAttribute
        %{
                char    *dd_type, *dd_val;
        %}
        ::=
        SEQUENCE {
            type
                PrintableString [[s dd_type]],

            value
                PrintableString [[s dd_val]]
        }
        %{
                or_concat (parm, OR_DD, dd_type, dd_val);
        %}


CountryName
        %{
                char    *country;
        %} ::=
        [APPLICATION 1]
            CHOICE {
                NumericString [[s country]],

                PrintableString [[s country]]
            }
        %{
                or_concat (parm, OR_C, NULLCP, country);
        %}


AdministrationDomainName
        %{
                char    *admd;
        %} ::=
        [APPLICATION 2]
            CHOICE {
                NumericString [[s admd]],
                PrintableString [[s admd]]
            }
        %{
                or_concat (parm, OR_ADMD, NULLCP, admd);
        %}


PrivateDomainIdentifier
        %{
                char    *prmd;
        %} ::=
        CHOICE {
            NumericString [[s prmd]],

            PrintableString [[s prmd]]
        }
        %{
                or_concat (parm, OR_PRMD, NULLCP, prmd);
        %}

X121Address ::=
        NumericString

TerminalID ::=
        PrintableString

OrganizationName ::=
        PrintableString

UniqueUAIdentifier ::=
        NumericString

PersonalName
        %{
                char    *str;
        %} ::=
        SET {
            surName[0]
                IMPLICIT PrintableString [[s str]]
                %{
                        or_concat (parm, OR_S, NULLCP, str);
                %},

            givenName[1]
                IMPLICIT PrintableString [[s str]]
                %{
                        or_concat (parm, OR_G, NULLCP, str);
                %}
                OPTIONAL,

            initials[2]
                IMPLICIT PrintableString [[s str]]
                %{
                        or_concat (parm, OR_I, NULLCP, str);
                %}
                OPTIONAL,

            generalQualifier[3]
                IMPLICIT PrintableString [[s str]]
                %{
                        or_concat (parm, OR_GQ, NULLCP, str);
                %}
                OPTIONAL
    }


OrganizationalUnit ::=
        PrintableString

PrivateDomainName
        %{
                char *prmd;
        %} ::=
        CHOICE {
            NumericString [[s prmd]],

            PrintableString [[s prmd]]
        }
        %{ or_concat (parm, OR_PRMD, NULLCP, prmd); %}




END

%{



static void    or_concat (orp, type, str1, str2)
OR_ptr  *orp;
int     type;
char    *str1, *str2;
{
        OR_ptr  or1, 
		or2;

        if (*orp == NULLOR)
                *orp = or_new (type, str1, str2);
        else {
                or1 = or_new (type, str1, str2);

		if (type == OR_OU)
			or2 = or_add (*orp, or1, FALSE);
		else 
			or2 = or_add (*orp, or1, TRUE);

		if (or2 != NULLOR)
			*orp = or2;
		else 
			PP_LOG (LLOG_EXCEPTIONS, ("or_add failed on %s %s",
				str1 ? str1 : "", str2 ? str2 : "" ));
        }
}

%}