print components of board
authoryu.dongliang <18588496441@163.com>
Wed, 12 Jul 2023 07:04:40 +0000 (15:04 +0800)
committeryu.dongliang <18588496441@163.com>
Wed, 12 Jul 2023 07:04:46 +0000 (15:04 +0800)
main.c

diff --git a/main.c b/main.c
index 451ef178fc6814b39decb60c59fcc341547ee2ed..c78a0b3815406bd2ea10f94d3c89b9bbb52ef6c6 100644 (file)
--- 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