FreeCalypso > hg > ueda-linux
comparison ueda/libueda/mclacc.c @ 0:cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 20 Jul 2015 00:24:37 +0000 |
parents | |
children | c91e7a30fab3 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:cd92449fdb51 |
---|---|
1 /* | |
2 * These are the libueda routines for accessing the parsed MCL. | |
3 */ | |
4 | |
5 #include <stdio.h> | |
6 #include <strings.h> | |
7 #include "mcl.h" | |
8 | |
9 extern struct component components[], partdefs[]; | |
10 extern int ncomponents, npartdefs; | |
11 | |
12 struct component * | |
13 find_partdef_by_name(partname) | |
14 register char *partname; | |
15 { | |
16 register struct component *part; | |
17 register int i; | |
18 | |
19 for (part = partdefs, i = 0; i < npartdefs; part++, i++) | |
20 if (!strcmp(part->name, partname)) | |
21 return(part); | |
22 return(NULL); | |
23 } | |
24 | |
25 char * | |
26 get_comp_attr(comp, attrname) | |
27 struct component *comp; | |
28 char *attrname; | |
29 { | |
30 register struct attrib *attr; | |
31 register int i; | |
32 | |
33 for (; comp; comp = comp->partdef) { | |
34 attr = comp->attrs; | |
35 for (i = 0; i < comp->nattrs; attr++, i++) | |
36 if (!strcmp(attr->name, attrname)) | |
37 return(attr->value); | |
38 if (comp->partdef == comp) | |
39 break; | |
40 } | |
41 return(NULL); | |
42 } | |
43 | |
44 char * | |
45 get_comp_multiattr(comp, attrname, cntp) | |
46 struct component *comp; | |
47 char *attrname; | |
48 int *cntp; | |
49 { | |
50 register struct attrib *attrs; | |
51 register int i; | |
52 | |
53 attrs = comp->attrs; | |
54 for (i = *cntp; i < comp->nattrs; i++) | |
55 if (!strcmp(attrs[i].name, attrname)) { | |
56 *cntp = i + 1; | |
57 return(attrs[i].value); | |
58 } | |
59 return(NULL); | |
60 } |