annotate ueda/libuschem/matchtomcl.c @ 128:e90e948e9368

m4-fp: SRAM_TSOPII_44 footprint added
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 16 Jul 2020 18:23:22 +0000
parents cd92449fdb51
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
1 /*
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
2 * Logic to match uschem component instances to MCL components
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
3 */
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
4
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
5 #include <sys/types.h>
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
6 #include <stdio.h>
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
7 #include <ctype.h>
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
8 #include <strings.h>
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
9 #include "../libueda/mcl.h"
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
10 #include "schemstruct.h"
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
11
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
12 extern struct component *find_comp_by_refdes();
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
13 extern char *get_comp_attr();
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
14
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
15 match_schem_to_mcl(schem)
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
16 struct schem *schem;
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
17 {
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
18 register struct schemobj *obj;
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
19 int errflag = 0;
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
20
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
21 for (obj = schem->obj_next; obj != (struct schemobj *)schem;
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
22 obj = obj->obj_next)
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
23 if (obj->obj_type == OBJTYPE_COMPINST)
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
24 if (match_compinst_to_mcl(schem, obj))
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
25 errflag = 1;
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
26 if (errflag)
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
27 exit(1);
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
28 return(0);
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
29 }
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
30
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
31 match_compinst_to_mcl(schem, obj)
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
32 struct schem *schem;
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
33 register struct schemobj *obj;
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
34 {
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
35 char refdes[256];
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
36 register char *cp;
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
37 register struct component *comp;
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
38
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
39 strcpy(refdes, obj->compobj_instname);
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
40 cp = index(refdes, '\0');
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
41 while (cp > refdes && islower(cp[-1]))
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
42 cp--;
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
43 *cp = '\0';
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
44 comp = find_comp_by_refdes(refdes);
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
45 if (comp) {
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
46 obj->compobj_mclcomp = comp;
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
47 return(0);
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
48 } else {
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
49 fprintf(stderr,
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
50 "%s: line %d: component %s not found in the MCL\n",
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
51 schem->orig_filename, obj->obj_lineno, refdes);
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
52 return(-1);
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
53 }
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
54 }
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
55
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
56 char *
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
57 get_compinst_attr(obj, attrname)
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
58 struct schemobj *obj;
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
59 register char *attrname;
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
60 {
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
61 register struct decoration *decor;
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
62
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
63 for (decor = obj->obj_decorations; decor; decor = decor->decor_next)
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
64 if (decor->decor_type == DECOR_TYPE_ATTR &&
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
65 !strcmp(decor->decorattr_name, attrname))
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
66 return(decor->decorattr_value);
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
67 return(get_comp_attr(obj->compobj_mclcomp, attrname));
cd92449fdb51 initial import of ueda and ifctf-part-lib from ifctfvax CVS
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
68 }