|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T a
Length: 2968 (0xb98)
Types: TextFile
Names: »attrt.c«
└─⟦3d0c2be1b⟧ Bits:30001254 ISODE-5.0 Tape
└─⟦eba4602b1⟧ »./isode-5.0.tar.Z«
└─⟦d3ac74d73⟧
└─⟦this⟧ »isode-5.0/dsap/common/attrt.c«
/* attrt.c - Attribute Type routines */
#ifndef lint
static char *rcsid = "$Header: /f/osi/dsap/common/RCS/attrt.c,v 6.0 89/03/18 23:27:22 mrose Rel $";
#endif
/*
* $Header: /f/osi/dsap/common/RCS/attrt.c,v 6.0 89/03/18 23:27:22 mrose Rel $
*
*
* $Log: attrt.c,v $
* Revision 6.0 89/03/18 23:27:22 mrose
* Release 5.0
*
*/
/*
* 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.
*
*/
/* LINTLIBRARY */
#include "quipu/util.h"
#include "quipu/name.h"
extern int oidformat;
extern LLog * log_dsap;
AttributeType last_at;
AttrT_free (x)
register AttributeType x;
{
if (x == NULLAttrT)
return;
if ( x -> at_table == NULLTABLE_ATTR )
oid_free (x->at_oid);
free ((char *) x);
}
AttributeType AttrT_new (name)
register char * name;
{
register AttributeType y;
y = (AttributeType) smalloc (sizeof (attrType));
y -> at_oid = NULLOID;
if ((y -> at_table = name2attr (name)) == NULLTABLE_ATTR) {
AttrT_free (y);
return (NULLAttrT);
}
return (y);
}
AttrT_decode (x)
register AttributeType x;
{
if (x->at_table != NULLTABLE_ATTR)
return;
if (x->at_oid == NULLOID) {
LLOG (log_dsap,LLOG_EXCEPTIONS,("Null oid to decode"));
return;
}
if ((x->at_table = oid2attr (x->at_oid)) == NULLTABLE_ATTR) {
LLOG (log_dsap,LLOG_EXCEPTIONS,("Unknown attribute type oid"));
return;
}
oid_free (x->at_oid);
x->at_oid = NULLOID;
}
AttributeType AttrT_cpy (x)
register AttributeType x;
{
register AttributeType y;
if (x == NULLAttrT)
return(NULLAttrT);
if (x->at_table == NULLTABLE_ATTR)
AttrT_decode(x);
y = (AttributeType) smalloc (sizeof (attrType));
if (x->at_oid != NULLOID)
y -> at_oid = oid_cpy(x->at_oid);
else
y -> at_oid = NULLOID;
y -> at_table = x->at_table;
return (y);
}
AttrT_cmp (x,y)
register AttributeType x,y;
{
if ( x == NULLAttrT )
return (y ? -1 : 0);
if ( y == NULLAttrT )
return (1);
if (x->at_table == NULLTABLE_ATTR)
AttrT_decode(x);
if (y->at_table == NULLTABLE_ATTR)
AttrT_decode(y);
if ((x->at_table == NULLTABLE_ATTR) && (x->at_table == NULLTABLE_ATTR))
/* not in tables */
return (quipu_oid_cmp (x->at_oid,y->at_oid));
if (x->at_table == y->at_table)
return (0);
return ((x->at_table > y->at_table) ? 1 : -1);
}
AttrT_print (ps,x,format)
register PS ps;
register AttributeType x;
register int format;
{
char * attr2name_aux();
if (x == NULLAttrT) {
ps_print(ps,"Unknown Type");
return;
}
last_at = x;
if (x->at_table == NULLTABLE_ATTR)
AttrT_decode(x);
if (x->at_table == NULLTABLE_ATTR) {
/* can't decode */
ps_printf (ps,"%s",oid2name (x->at_oid,oidformat));
return;
}
if (format == READOUT)
ps_printf (ps,"%s",attr2name (x->at_table,oidformat));
else
ps_printf (ps,"%s",attr2name_aux (x->at_table));
}