|
|
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 o
Length: 2458 (0x99a)
Types: TextFile
Names: »or_add.c«
└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
└─⟦dc59850a2⟧ »EurOpenD22/pp5.0/pp-5.tar.Z«
└─⟦e5a54fb17⟧
└─⟦this⟧ »pp-5.0/Lib/or/or_add.c«
/* or_add.c: add an orname component to the list */
# ifndef lint
static char Rcsid[] = "@(#)$Header: /cs/research/pp/hubris/pp-beta/Lib/or/RCS/or_add.c,v 5.0 90/09/20 16:07:40 pp Exp Locker: pp $";
# endif
/*
* $Header: /cs/research/pp/hubris/pp-beta/Lib/or/RCS/or_add.c,v 5.0 90/09/20 16:07:40 pp Exp Locker: pp $
*
* $Log: or_add.c,v $
* Revision 5.0 90/09/20 16:07:40 pp
* rcsforce : 5.0 public release
*
*/
#include "util.h"
#include "or.h"
OR_ptr or_add (tree, or, before)
OR_ptr tree;
OR_ptr or;
int before; /* if true then add equal values at front */
{
OR_ptr current;
PP_DBG (("or_util.c/or_add ('%d', '%s')",
or -> or_type, or -> or_value));
if (tree == NULLOR) {
or -> or_next = NULLOR;
or -> or_prev = NULLOR;
return (or);
}
if (or -> or_type < tree -> or_type) {
or -> or_next = tree;
tree -> or_prev = or;
or -> or_prev = NULLOR;
return (or);
}
if (or -> or_type == tree -> or_type) {
if (or -> or_type != OR_OU && or -> or_type != OR_DD) {
PP_LOG (LLOG_EXCEPTIONS,
("or_add: Illegal duplicate component type '%s' (%s & %s)",
or_type2name (or -> or_type),
or -> or_value, tree -> or_value));
return NULLOR;
}
if (before) {
or -> or_next = tree;
tree -> or_prev = or;
or -> or_prev = NULLOR;
return (or);
}
}
for (current = tree; current != NULLOR; current = current -> or_next) {
if (current -> or_next == NULLOR) {
current -> or_next = or;
or -> or_prev = current;
or -> or_next = NULLOR;
return (tree);
}
if (or -> or_type < current -> or_next -> or_type) {
or -> or_next = current -> or_next;
current -> or_next -> or_prev = or;
or -> or_prev = current;
current -> or_next = or;
return (tree);
}
if (or -> or_type == current -> or_next -> or_type) {
if (or -> or_type == current -> or_type)
if (or -> or_type != OR_OU && or -> or_type != OR_DD) {
PP_LOG (LLOG_EXCEPTIONS,
("or_add: Illegal duplicate type '%s' (%s & %s)",
or_type2name (or -> or_type),
or -> or_value, current -> or_value));
return NULLOR;
}
if (before) {
or -> or_next = current -> or_next;
current -> or_next -> or_prev = or;
or -> or_prev = current;
current -> or_next = or;
return (tree);
}
} /* end of if */
} /* end of for */
PP_LOG (LLOG_EXCEPTIONS, ("or_util.c/or_add () - serious problem"));
return NULLOR;
}