types.c 542 Bytes
Newer Older
ram's avatar
ram committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
/* types.c */

#include "types.h"

/*
// AddToList - list utility (append elem at end of list, return head)
*/
Packet *AddToList(Packet *list, Packet *elem)
{   Packet *p, *next;

    elem->SetLink(NoWork);
    if (list != NoWork) {
         p = list;
         while((next = p->Link()) != NoWork) p = next;
         p->SetLink(elem);
    }
    else list = elem;
    return list;
}

Packet::Packet(Packet *l, Identity id, PacketKind k)
{
    link = l;
    ident = id;
    kind = k;
    datum = 1;
    for(int i = 0; i < 4; i++) data[i] = 0;
}