diff ueda/sverp-bind/output.c @ 32:6c7c79d37eff

unet-bind: attribute output implemented
author Space Falcon <falcon@ivan.Harhan.ORG>
date Sat, 08 Aug 2015 21:52:33 +0000
parents 558269596a5c
children
line wrap: on
line diff
--- a/ueda/sverp-bind/output.c	Sat Aug 08 21:44:10 2015 +0000
+++ b/ueda/sverp-bind/output.c	Sat Aug 08 21:52:33 2015 +0000
@@ -6,6 +6,8 @@
 #include "../libunet/nethash.h"
 #include "struct.h"
 
+extern char *get_comp_attr();
+
 extern char *MCLfile;
 extern char *input_filename;
 extern char *output_filename;
@@ -14,6 +16,7 @@
 extern int ncomponents;
 extern struct outcomp *netlist_comps;
 extern struct outcomp *starpoint_list_head;
+extern struct wantattr *want_attr_list;
 
 static FILE *outF;
 
@@ -113,6 +116,8 @@
 	fprintf(outF, "\n%s %s {\n", comp_type_kw, oc->name);
 	if (oc->altname)
 		fprintf(outF, "  ALTNAME %s\n", oc->altname);
+	if (want_attr_list && oc->mclcomp)
+		emit_component_attributes(oc->mclcomp);
 	for (pinidx = 0; pinidx < oc->npins; pinidx++) {
 		if (oc->grid_pkg && oc->grid_pkg->holes_array[pinidx])
 			continue;
@@ -120,3 +125,17 @@
 	}
 	fputs("}\n", outF);
 }
+
+emit_component_attributes(comp)
+	struct component *comp;
+{
+	register struct wantattr *wa;
+	register char *value;
+
+	for (wa = want_attr_list; wa; wa = wa->next) {
+		value = get_comp_attr(comp, wa->name);
+		if (!value)
+			continue;
+		fprintf(outF, "  ATTR %s=%s\n", wa->name, value);
+	}
+}