From: yu.dongliang <18588496441@163.com>
Date: Wed, 12 Jul 2023 07:04:40 +0000 (+0800)
Subject: print components of board
X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=1170679c3f0f1a773fe3fb789987375164c45609;p=ses.git

print components of board
---

diff --git a/main.c b/main.c
index 451ef17..c78a0b3 100644
--- a/main.c
+++ b/main.c
@@ -3,6 +3,17 @@
 #include<string.h>
 #include"ses_layout.h"
 
+char* component_types[SCF_EDA_Components_NB] =
+{
+	"None",
+	"Battery",
+	"Resistor",
+	"Capacitor",
+	"Inductor",
+	"Diode",
+	"Transistor",
+};
+
 int main(int argc, char* argv[])
 {
 	if (argc < 2) {
@@ -47,11 +58,11 @@ int main(int argc, char* argv[])
 	ScfEboard* b = scf_eboard__unpack(NULL, len, pb);
 
 	ses_layout_board(b, 0, 0, 500, 500);
-#if 0
+#if 1
 	size_t i;
 	size_t j;
 	size_t k;
-	size_t l;
+	size_t m;
 
 	for (i = 0; i < b->n_functions; i++) {
 		f  =        b->functions[i];
@@ -61,15 +72,18 @@ int main(int argc, char* argv[])
 		for (j = 0; j < f->n_components; j++) {
 			c  =        f->components[j];
 
-			printf("c: %ld\n", c->id);
+			printf("c: %ld, type: %s\n", c->id, component_types[c->type]);
 
 			for (k = 0; k < c->n_pins; k++) {
 				p  =        c->pins[k];
 
 				printf("cid: %ld, pid: %ld\n", p->cid, p->id);
+
+				for (m = 0; m + 1 < p->n_tos; m += 2)
+					printf("to cid: %ld, pid: %ld\n", p->tos[m], p->tos[m + 1]);
 			}
+			printf("\n");
 		}
-		printf("\n\n");
 	}
 #endif