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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
|
/*
* Copyright (C) 1992, Board of Trustees of the University of Illinois.
*
* Permission is granted to copy and distribute source with out fee.
* Commercialization of this product requires prior licensing
* from the National Center for Supercomputing Applications of the
* University of Illinois. Commercialization includes the integration of this
* code in part or whole into a product for resale. Free distribution of
* unmodified source and use of NCSA software is not considered
* commercialization.
*
*/
#if ! defined(lint) && ! defined(LINT)
static char rcs_id[] = "$Id: netdata.c,v 1.1.1.1 1995/01/11 00:03:39 alanb Exp $";
#endif
#include <stdlib.h>
#include <string.h>
#include "netdata.h"
#include "list.h"
static List dataList;
InitData()
{
if (!(dataList = ListCreate()))
return(0);
return(1);
}
Data *DataNew()
{
Data *d;
if (!(d = (Data *)calloc(1,sizeof(Data))))
{
ErrMesg("Out of Memory\n");
}
else
{
d->label = d->associated = (char *) 0;
d->group = (Data *) 0;
d->magicPath = (VdataPathElement **) 0;
d->nodeName = d->fields = (char *) 0;
d->expandX = d->expandY = 1.0;
}
return(d);
}
void DataDestroy(d)
Data *d;
{
(void)ListDeleteEntry(dataList,d);
if (d->label)
FREE(d->label);
if (d->data)
FREE(d->data);
FREE(d);
}
void DataAddEntry(d)
Data *d;
{
ListAddEntry(dataList,d);
}
Data *DataSearchByLabel(s)
char *s;
{
Data *d;
d = (Data *) ListHead(dataList);
while (d) {
if (d->label && (!strcmp(s,d->label))) {
return(d);
}
d = (Data *) ListNext(dataList);
}
return( (Data *) 0);
}
Data *DataSearchByLabelAndDOT(s,dot)
char *s;
int dot; /*data object type */
{
Data *d;
d = (Data *) ListHead(dataList);
while (d) {
if ((d->label) && (!strcmp(s,d->label)) && (d->dot == dot)) {
return(d);
}
d = (Data *) ListNext(dataList);
}
return( (Data *) 0);
}
Data *DataSearchByLabelAndDOTAndDOST(s,dot,dost)
char *s;
int dot; /*data object type */
int dost; /* data object sub type */
{
Data *d;
d = (Data *) ListHead(dataList);
while (d) {
if ((d->label)&&((!strcmp(s,d->label)) && (d->dot == dot)
&& (d->dost == dost))) {
return(d);
}
d = (Data *) ListNext(dataList);
}
return( (Data *) 0);
}
int DataInList(inList)
/* is this Data set in the list */
Data *inList;
{
Data *d;
d = (Data *) ListHead(dataList);
while (d) {
if (d == inList) {
return(1);
}
d = (Data *) ListNext(dataList);
}
return(0);
}
|