for (j = 0; j < pc->n_pins; j++) {
ScfEpin* pp = pc->pins[j];
- printf("j: %ld, pp: %p, n_tos: %ld\n", j, pp, pp->n_tos);
+ printf("j: %ld, pp: %p, n_tos: %ld, cid: %ld, pid: %ld\n", j, pp, pp->n_tos, pp->cid, pp->id);
for (k = 0; k + 1 < pp->n_tos; k += 2) {
printf("k: %ld, cid: %ld, pid: %ld\n", k, pp->tos[k], pp->tos[k + 1]);
#include"scf_basic_block.h"
#include"scf_3ac.h"
+static char* component_types[SCF_EDA_Components_NB] =
+{
+ "None",
+ "Battery",
+ "Resistor",
+ "Capacitor",
+ "Inductor",
+ "Diode",
+ "Transistor",
+};
+
int scf_eda_open(scf_native_t* ctx, const char* arch)
{
scf_eda_context_t* eda = calloc(1, sizeof(scf_eda_context_t));
EDA_INST_ADD_COMPONENT(f, B, SCF_EDA_Battery);
+ B->pins[SCF_EDA_Battery_NEG]->flags = SCF_EDA_PIN_NEG;
+ B->pins[SCF_EDA_Battery_POS]->flags = SCF_EDA_PIN_POS;
+
int ret = _scf_eda_select_inst(ctx);
if (ret < 0)
return ret;
}
}
+#if 1
+ ScfEcomponent* c;
+ ScfEpin* p;
+ size_t i;
+ size_t j;
+ size_t k;
+
+ for (i = 0; i < f->ef->n_components; i++) {
+ c = f->ef->components[i];
+
+ printf("c: %ld, type: %s\n", c->id, component_types[c->type]);
+
+ for (j = 0; j < c->n_pins; j++) {
+ p = c->pins[j];
+
+ printf("cid: %ld, pid: %ld, flags: %#lx\n", p->cid, p->id, p->flags);
+
+ for (k = 0; k + 1 < p->n_tos; k += 2)
+ printf("to cid: %ld, pid: %ld\n", p->tos[k], p->tos[k + 1]);
+ }
+ printf("\n");
+ }
+#endif
+
return 0;
}
_c = NULL; \
return ret; \
} \
+ \
+ for (size_t i = 0; i < (_c)->n_pins; i++) \
+ (_c)->pins[i]->cid = (_c)->id; \
} while (0)
#endif
#include "scf_eda.pb-c.h"
-void scf_eline__init
- (ScfEline *message)
+void scf_line__init
+ (ScfLine *message)
{
- static ScfEline init_value = SCF_ELINE__INIT;
+ static ScfLine init_value = SCF_LINE__INIT;
*message = init_value;
}
-size_t scf_eline__get_packed_size
- (const ScfEline *message)
+size_t scf_line__get_packed_size
+ (const ScfLine *message)
{
- assert(message->base.descriptor == &scf_eline__descriptor);
+ assert(message->base.descriptor == &scf_line__descriptor);
return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
}
-size_t scf_eline__pack
- (const ScfEline *message,
+size_t scf_line__pack
+ (const ScfLine *message,
uint8_t *out)
{
- assert(message->base.descriptor == &scf_eline__descriptor);
+ assert(message->base.descriptor == &scf_line__descriptor);
return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
}
-size_t scf_eline__pack_to_buffer
- (const ScfEline *message,
+size_t scf_line__pack_to_buffer
+ (const ScfLine *message,
ProtobufCBuffer *buffer)
{
- assert(message->base.descriptor == &scf_eline__descriptor);
+ assert(message->base.descriptor == &scf_line__descriptor);
return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
}
-ScfEline *
- scf_eline__unpack
+ScfLine *
+ scf_line__unpack
(ProtobufCAllocator *allocator,
size_t len,
const uint8_t *data)
{
- return (ScfEline *)
- protobuf_c_message_unpack (&scf_eline__descriptor,
+ return (ScfLine *)
+ protobuf_c_message_unpack (&scf_line__descriptor,
allocator, len, data);
}
-void scf_eline__free_unpacked
- (ScfEline *message,
+void scf_line__free_unpacked
+ (ScfLine *message,
ProtobufCAllocator *allocator)
{
- assert(message->base.descriptor == &scf_eline__descriptor);
+ assert(message->base.descriptor == &scf_line__descriptor);
protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
}
void scf_epin__init
assert(message->base.descriptor == &scf_epin__descriptor);
protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
}
+void scf_econn__init
+ (ScfEconn *message)
+{
+ static ScfEconn init_value = SCF_ECONN__INIT;
+ *message = init_value;
+}
+size_t scf_econn__get_packed_size
+ (const ScfEconn *message)
+{
+ assert(message->base.descriptor == &scf_econn__descriptor);
+ return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t scf_econn__pack
+ (const ScfEconn *message,
+ uint8_t *out)
+{
+ assert(message->base.descriptor == &scf_econn__descriptor);
+ return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t scf_econn__pack_to_buffer
+ (const ScfEconn *message,
+ ProtobufCBuffer *buffer)
+{
+ assert(message->base.descriptor == &scf_econn__descriptor);
+ return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+ScfEconn *
+ scf_econn__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data)
+{
+ return (ScfEconn *)
+ protobuf_c_message_unpack (&scf_econn__descriptor,
+ allocator, len, data);
+}
+void scf_econn__free_unpacked
+ (ScfEconn *message,
+ ProtobufCAllocator *allocator)
+{
+ assert(message->base.descriptor == &scf_econn__descriptor);
+ protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void scf_eline__init
+ (ScfEline *message)
+{
+ static ScfEline init_value = SCF_ELINE__INIT;
+ *message = init_value;
+}
+size_t scf_eline__get_packed_size
+ (const ScfEline *message)
+{
+ assert(message->base.descriptor == &scf_eline__descriptor);
+ return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t scf_eline__pack
+ (const ScfEline *message,
+ uint8_t *out)
+{
+ assert(message->base.descriptor == &scf_eline__descriptor);
+ return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t scf_eline__pack_to_buffer
+ (const ScfEline *message,
+ ProtobufCBuffer *buffer)
+{
+ assert(message->base.descriptor == &scf_eline__descriptor);
+ return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+ScfEline *
+ scf_eline__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data)
+{
+ return (ScfEline *)
+ protobuf_c_message_unpack (&scf_eline__descriptor,
+ allocator, len, data);
+}
+void scf_eline__free_unpacked
+ (ScfEline *message,
+ ProtobufCAllocator *allocator)
+{
+ assert(message->base.descriptor == &scf_eline__descriptor);
+ protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
void scf_ecomponent__init
(ScfEcomponent *message)
{
assert(message->base.descriptor == &scf_eboard__descriptor);
protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
}
-static const ProtobufCFieldDescriptor scf_eline__field_descriptors[4] =
+static const ProtobufCFieldDescriptor scf_line__field_descriptors[4] =
{
{
"x0",
1,
PROTOBUF_C_LABEL_REQUIRED,
- PROTOBUF_C_TYPE_UINT32,
+ PROTOBUF_C_TYPE_INT32,
0, /* quantifier_offset */
- offsetof(ScfEline, x0),
+ offsetof(ScfLine, x0),
NULL,
NULL,
0, /* flags */
"y0",
2,
PROTOBUF_C_LABEL_REQUIRED,
- PROTOBUF_C_TYPE_UINT32,
+ PROTOBUF_C_TYPE_INT32,
0, /* quantifier_offset */
- offsetof(ScfEline, y0),
+ offsetof(ScfLine, y0),
NULL,
NULL,
0, /* flags */
"x1",
3,
PROTOBUF_C_LABEL_REQUIRED,
- PROTOBUF_C_TYPE_UINT32,
+ PROTOBUF_C_TYPE_INT32,
0, /* quantifier_offset */
- offsetof(ScfEline, x1),
+ offsetof(ScfLine, x1),
NULL,
NULL,
0, /* flags */
"y1",
4,
PROTOBUF_C_LABEL_REQUIRED,
- PROTOBUF_C_TYPE_UINT32,
+ PROTOBUF_C_TYPE_INT32,
0, /* quantifier_offset */
- offsetof(ScfEline, y1),
+ offsetof(ScfLine, y1),
NULL,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
};
-static const unsigned scf_eline__field_indices_by_name[] = {
+static const unsigned scf_line__field_indices_by_name[] = {
0, /* field[0] = x0 */
2, /* field[2] = x1 */
1, /* field[1] = y0 */
3, /* field[3] = y1 */
};
-static const ProtobufCIntRange scf_eline__number_ranges[1 + 1] =
+static const ProtobufCIntRange scf_line__number_ranges[1 + 1] =
{
{ 1, 0 },
{ 0, 4 }
};
-const ProtobufCMessageDescriptor scf_eline__descriptor =
+const ProtobufCMessageDescriptor scf_line__descriptor =
{
PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC,
- "scf_eline",
- "ScfEline",
- "ScfEline",
+ "scf_line",
+ "ScfLine",
+ "ScfLine",
"",
- sizeof(ScfEline),
+ sizeof(ScfLine),
4,
- scf_eline__field_descriptors,
- scf_eline__field_indices_by_name,
- 1, scf_eline__number_ranges,
- (ProtobufCMessageInit) scf_eline__init,
+ scf_line__field_descriptors,
+ scf_line__field_indices_by_name,
+ 1, scf_line__number_ranges,
+ (ProtobufCMessageInit) scf_line__init,
NULL,NULL,NULL /* reserved[123] */
};
-static const ProtobufCFieldDescriptor scf_epin__field_descriptors[6] =
+static const ProtobufCFieldDescriptor scf_epin__field_descriptors[7] =
{
{
"tos",
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
- "flags",
+ "cid",
3,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_UINT64,
0, /* quantifier_offset */
- offsetof(ScfEpin, flags),
+ offsetof(ScfEpin, cid),
NULL,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
- "x",
+ "lid",
4,
PROTOBUF_C_LABEL_REQUIRED,
- PROTOBUF_C_TYPE_UINT32,
+ PROTOBUF_C_TYPE_UINT64,
0, /* quantifier_offset */
- offsetof(ScfEpin, x),
+ offsetof(ScfEpin, lid),
NULL,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
- "y",
+ "flags",
5,
PROTOBUF_C_LABEL_REQUIRED,
- PROTOBUF_C_TYPE_UINT32,
+ PROTOBUF_C_TYPE_UINT64,
0, /* quantifier_offset */
- offsetof(ScfEpin, y),
+ offsetof(ScfEpin, flags),
NULL,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
- "lines",
+ "x",
6,
- PROTOBUF_C_LABEL_REPEATED,
- PROTOBUF_C_TYPE_MESSAGE,
- offsetof(ScfEpin, n_lines),
- offsetof(ScfEpin, lines),
- &scf_eline__descriptor,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_INT32,
+ 0, /* quantifier_offset */
+ offsetof(ScfEpin, x),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "y",
+ 7,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_INT32,
+ 0, /* quantifier_offset */
+ offsetof(ScfEpin, y),
+ NULL,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
};
static const unsigned scf_epin__field_indices_by_name[] = {
- 2, /* field[2] = flags */
+ 2, /* field[2] = cid */
+ 4, /* field[4] = flags */
1, /* field[1] = id */
- 5, /* field[5] = lines */
+ 3, /* field[3] = lid */
0, /* field[0] = tos */
- 3, /* field[3] = x */
- 4, /* field[4] = y */
+ 5, /* field[5] = x */
+ 6, /* field[6] = y */
};
static const ProtobufCIntRange scf_epin__number_ranges[1 + 1] =
{
{ 1, 0 },
- { 0, 6 }
+ { 0, 7 }
};
const ProtobufCMessageDescriptor scf_epin__descriptor =
{
"ScfEpin",
"",
sizeof(ScfEpin),
- 6,
+ 7,
scf_epin__field_descriptors,
scf_epin__field_indices_by_name,
1, scf_epin__number_ranges,
(ProtobufCMessageInit) scf_epin__init,
NULL,NULL,NULL /* reserved[123] */
};
+static const ProtobufCFieldDescriptor scf_econn__field_descriptors[2] =
+{
+ {
+ "lid",
+ 1,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_UINT64,
+ 0, /* quantifier_offset */
+ offsetof(ScfEconn, lid),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "cids",
+ 2,
+ PROTOBUF_C_LABEL_REPEATED,
+ PROTOBUF_C_TYPE_UINT64,
+ offsetof(ScfEconn, n_cids),
+ offsetof(ScfEconn, cids),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+};
+static const unsigned scf_econn__field_indices_by_name[] = {
+ 1, /* field[1] = cids */
+ 0, /* field[0] = lid */
+};
+static const ProtobufCIntRange scf_econn__number_ranges[1 + 1] =
+{
+ { 1, 0 },
+ { 0, 2 }
+};
+const ProtobufCMessageDescriptor scf_econn__descriptor =
+{
+ PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC,
+ "scf_econn",
+ "ScfEconn",
+ "ScfEconn",
+ "",
+ sizeof(ScfEconn),
+ 2,
+ scf_econn__field_descriptors,
+ scf_econn__field_indices_by_name,
+ 1, scf_econn__number_ranges,
+ (ProtobufCMessageInit) scf_econn__init,
+ NULL,NULL,NULL /* reserved[123] */
+};
+static const ProtobufCFieldDescriptor scf_eline__field_descriptors[5] =
+{
+ {
+ "id",
+ 1,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_UINT64,
+ 0, /* quantifier_offset */
+ offsetof(ScfEline, id),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "pins",
+ 2,
+ PROTOBUF_C_LABEL_REPEATED,
+ PROTOBUF_C_TYPE_UINT64,
+ offsetof(ScfEline, n_pins),
+ offsetof(ScfEline, pins),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "flags",
+ 3,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_UINT64,
+ 0, /* quantifier_offset */
+ offsetof(ScfEline, flags),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "conns",
+ 4,
+ PROTOBUF_C_LABEL_REPEATED,
+ PROTOBUF_C_TYPE_MESSAGE,
+ offsetof(ScfEline, n_conns),
+ offsetof(ScfEline, conns),
+ &scf_econn__descriptor,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "lines",
+ 5,
+ PROTOBUF_C_LABEL_REPEATED,
+ PROTOBUF_C_TYPE_MESSAGE,
+ offsetof(ScfEline, n_lines),
+ offsetof(ScfEline, lines),
+ &scf_line__descriptor,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+};
+static const unsigned scf_eline__field_indices_by_name[] = {
+ 3, /* field[3] = conns */
+ 2, /* field[2] = flags */
+ 0, /* field[0] = id */
+ 4, /* field[4] = lines */
+ 1, /* field[1] = pins */
+};
+static const ProtobufCIntRange scf_eline__number_ranges[1 + 1] =
+{
+ { 1, 0 },
+ { 0, 5 }
+};
+const ProtobufCMessageDescriptor scf_eline__descriptor =
+{
+ PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC,
+ "scf_eline",
+ "ScfEline",
+ "ScfEline",
+ "",
+ sizeof(ScfEline),
+ 5,
+ scf_eline__field_descriptors,
+ scf_eline__field_indices_by_name,
+ 1, scf_eline__number_ranges,
+ (ProtobufCMessageInit) scf_eline__init,
+ NULL,NULL,NULL /* reserved[123] */
+};
static const ProtobufCFieldDescriptor scf_ecomponent__field_descriptors[7] =
{
{
"x",
4,
PROTOBUF_C_LABEL_REQUIRED,
- PROTOBUF_C_TYPE_UINT32,
+ PROTOBUF_C_TYPE_INT32,
0, /* quantifier_offset */
offsetof(ScfEcomponent, x),
NULL,
"y",
5,
PROTOBUF_C_LABEL_REQUIRED,
- PROTOBUF_C_TYPE_UINT32,
+ PROTOBUF_C_TYPE_INT32,
0, /* quantifier_offset */
offsetof(ScfEcomponent, y),
NULL,
"w",
6,
PROTOBUF_C_LABEL_REQUIRED,
- PROTOBUF_C_TYPE_UINT32,
+ PROTOBUF_C_TYPE_INT32,
0, /* quantifier_offset */
offsetof(ScfEcomponent, w),
NULL,
"h",
7,
PROTOBUF_C_LABEL_REQUIRED,
- PROTOBUF_C_TYPE_UINT32,
+ PROTOBUF_C_TYPE_INT32,
0, /* quantifier_offset */
offsetof(ScfEcomponent, h),
NULL,
(ProtobufCMessageInit) scf_ecomponent__init,
NULL,NULL,NULL /* reserved[123] */
};
-static const ProtobufCFieldDescriptor scf_efunction__field_descriptors[2] =
+static const ProtobufCFieldDescriptor scf_efunction__field_descriptors[7] =
{
{
"name",
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
+ {
+ "elines",
+ 3,
+ PROTOBUF_C_LABEL_REPEATED,
+ PROTOBUF_C_TYPE_MESSAGE,
+ offsetof(ScfEfunction, n_elines),
+ offsetof(ScfEfunction, elines),
+ &scf_eline__descriptor,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "x",
+ 4,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_INT32,
+ 0, /* quantifier_offset */
+ offsetof(ScfEfunction, x),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "y",
+ 5,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_INT32,
+ 0, /* quantifier_offset */
+ offsetof(ScfEfunction, y),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "w",
+ 6,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_INT32,
+ 0, /* quantifier_offset */
+ offsetof(ScfEfunction, w),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "h",
+ 7,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_INT32,
+ 0, /* quantifier_offset */
+ offsetof(ScfEfunction, h),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
};
static const unsigned scf_efunction__field_indices_by_name[] = {
1, /* field[1] = components */
+ 2, /* field[2] = elines */
+ 6, /* field[6] = h */
0, /* field[0] = name */
+ 5, /* field[5] = w */
+ 3, /* field[3] = x */
+ 4, /* field[4] = y */
};
static const ProtobufCIntRange scf_efunction__number_ranges[1 + 1] =
{
{ 1, 0 },
- { 0, 2 }
+ { 0, 7 }
};
const ProtobufCMessageDescriptor scf_efunction__descriptor =
{
"ScfEfunction",
"",
sizeof(ScfEfunction),
- 2,
+ 7,
scf_efunction__field_descriptors,
scf_efunction__field_indices_by_name,
1, scf_efunction__number_ranges,
#endif
-typedef struct _ScfEline ScfEline;
+typedef struct _ScfLine ScfLine;
typedef struct _ScfEpin ScfEpin;
+typedef struct _ScfEconn ScfEconn;
+typedef struct _ScfEline ScfEline;
typedef struct _ScfEcomponent ScfEcomponent;
typedef struct _ScfEfunction ScfEfunction;
typedef struct _ScfEboard ScfEboard;
/* --- messages --- */
-struct _ScfEline
+struct _ScfLine
{
ProtobufCMessage base;
- uint32_t x0;
- uint32_t y0;
- uint32_t x1;
- uint32_t y1;
+ int32_t x0;
+ int32_t y0;
+ int32_t x1;
+ int32_t y1;
};
-#define SCF_ELINE__INIT \
- { PROTOBUF_C_MESSAGE_INIT (&scf_eline__descriptor) \
+#define SCF_LINE__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&scf_line__descriptor) \
, 0, 0, 0, 0 }
size_t n_tos;
uint64_t *tos;
uint64_t id;
+ uint64_t cid;
+ uint64_t lid;
uint64_t flags;
- uint32_t x;
- uint32_t y;
- size_t n_lines;
- ScfEline **lines;
+ int32_t x;
+ int32_t y;
};
#define SCF_EPIN__INIT \
{ PROTOBUF_C_MESSAGE_INIT (&scf_epin__descriptor) \
- , 0,NULL, 0, 0, 0, 0, 0,NULL }
+ , 0,NULL, 0, 0, 0, 0, 0, 0 }
+
+
+struct _ScfEconn
+{
+ ProtobufCMessage base;
+ uint64_t lid;
+ size_t n_cids;
+ uint64_t *cids;
+};
+#define SCF_ECONN__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&scf_econn__descriptor) \
+ , 0, 0,NULL }
+
+
+struct _ScfEline
+{
+ ProtobufCMessage base;
+ uint64_t id;
+ size_t n_pins;
+ uint64_t *pins;
+ uint64_t flags;
+ size_t n_conns;
+ ScfEconn **conns;
+ size_t n_lines;
+ ScfLine **lines;
+};
+#define SCF_ELINE__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&scf_eline__descriptor) \
+ , 0, 0,NULL, 0, 0,NULL, 0,NULL }
struct _ScfEcomponent
uint64_t type;
size_t n_pins;
ScfEpin **pins;
- uint32_t x;
- uint32_t y;
- uint32_t w;
- uint32_t h;
+ int32_t x;
+ int32_t y;
+ int32_t w;
+ int32_t h;
};
#define SCF_ECOMPONENT__INIT \
{ PROTOBUF_C_MESSAGE_INIT (&scf_ecomponent__descriptor) \
char *name;
size_t n_components;
ScfEcomponent **components;
+ size_t n_elines;
+ ScfEline **elines;
+ int32_t x;
+ int32_t y;
+ int32_t w;
+ int32_t h;
};
#define SCF_EFUNCTION__INIT \
{ PROTOBUF_C_MESSAGE_INIT (&scf_efunction__descriptor) \
- , NULL, 0,NULL }
+ , NULL, 0,NULL, 0,NULL, 0, 0, 0, 0 }
struct _ScfEboard
, 0,NULL }
-/* ScfEline methods */
-void scf_eline__init
- (ScfEline *message);
-size_t scf_eline__get_packed_size
- (const ScfEline *message);
-size_t scf_eline__pack
- (const ScfEline *message,
+/* ScfLine methods */
+void scf_line__init
+ (ScfLine *message);
+size_t scf_line__get_packed_size
+ (const ScfLine *message);
+size_t scf_line__pack
+ (const ScfLine *message,
uint8_t *out);
-size_t scf_eline__pack_to_buffer
- (const ScfEline *message,
+size_t scf_line__pack_to_buffer
+ (const ScfLine *message,
ProtobufCBuffer *buffer);
-ScfEline *
- scf_eline__unpack
+ScfLine *
+ scf_line__unpack
(ProtobufCAllocator *allocator,
size_t len,
const uint8_t *data);
-void scf_eline__free_unpacked
- (ScfEline *message,
+void scf_line__free_unpacked
+ (ScfLine *message,
ProtobufCAllocator *allocator);
/* ScfEpin methods */
void scf_epin__init
void scf_epin__free_unpacked
(ScfEpin *message,
ProtobufCAllocator *allocator);
+/* ScfEconn methods */
+void scf_econn__init
+ (ScfEconn *message);
+size_t scf_econn__get_packed_size
+ (const ScfEconn *message);
+size_t scf_econn__pack
+ (const ScfEconn *message,
+ uint8_t *out);
+size_t scf_econn__pack_to_buffer
+ (const ScfEconn *message,
+ ProtobufCBuffer *buffer);
+ScfEconn *
+ scf_econn__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data);
+void scf_econn__free_unpacked
+ (ScfEconn *message,
+ ProtobufCAllocator *allocator);
+/* ScfEline methods */
+void scf_eline__init
+ (ScfEline *message);
+size_t scf_eline__get_packed_size
+ (const ScfEline *message);
+size_t scf_eline__pack
+ (const ScfEline *message,
+ uint8_t *out);
+size_t scf_eline__pack_to_buffer
+ (const ScfEline *message,
+ ProtobufCBuffer *buffer);
+ScfEline *
+ scf_eline__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data);
+void scf_eline__free_unpacked
+ (ScfEline *message,
+ ProtobufCAllocator *allocator);
/* ScfEcomponent methods */
void scf_ecomponent__init
(ScfEcomponent *message);
ProtobufCAllocator *allocator);
/* --- per-message closures --- */
-typedef void (*ScfEline_Closure)
- (const ScfEline *message,
+typedef void (*ScfLine_Closure)
+ (const ScfLine *message,
void *closure_data);
typedef void (*ScfEpin_Closure)
(const ScfEpin *message,
void *closure_data);
+typedef void (*ScfEconn_Closure)
+ (const ScfEconn *message,
+ void *closure_data);
+typedef void (*ScfEline_Closure)
+ (const ScfEline *message,
+ void *closure_data);
typedef void (*ScfEcomponent_Closure)
(const ScfEcomponent *message,
void *closure_data);
/* --- descriptors --- */
-extern const ProtobufCMessageDescriptor scf_eline__descriptor;
+extern const ProtobufCMessageDescriptor scf_line__descriptor;
extern const ProtobufCMessageDescriptor scf_epin__descriptor;
+extern const ProtobufCMessageDescriptor scf_econn__descriptor;
+extern const ProtobufCMessageDescriptor scf_eline__descriptor;
extern const ProtobufCMessageDescriptor scf_ecomponent__descriptor;
extern const ProtobufCMessageDescriptor scf_efunction__descriptor;
extern const ProtobufCMessageDescriptor scf_eboard__descriptor;
syntax="proto2";
-message scf_eline
+message scf_line
{
- required uint32 x0 = 1;
- required uint32 y0 = 2;
- required uint32 x1 = 3;
- required uint32 y1 = 4;
+ required int32 x0 = 1;
+ required int32 y0 = 2;
+ required int32 x1 = 3;
+ required int32 y1 = 4;
}
message scf_epin
{
repeated uint64 tos = 1;
required uint64 id = 2;
- required uint64 flags = 3;
+ required uint64 cid = 3;
+ required uint64 lid = 4;
+ required uint64 flags = 5;
+
+ required int32 x = 6;
+ required int32 y = 7;
+}
- required uint32 x = 4;
- required uint32 y = 5;
- repeated scf_eline lines = 6;
+message scf_econn
+{
+ required uint64 lid = 1;
+ repeated uint64 cids = 2;
+}
+
+message scf_eline
+{
+ required uint64 id = 1;
+ repeated uint64 pins = 2;
+ required uint64 flags = 3;
+ repeated scf_econn conns = 4;
+ repeated scf_line lines = 5;
}
message scf_ecomponent
required uint64 type = 2;
repeated scf_epin pins = 3;
- required uint32 x = 4;
- required uint32 y = 5;
- required uint32 w = 6;
- required uint32 h = 7;
+ required int32 x = 4;
+ required int32 y = 5;
+ required int32 w = 6;
+ required int32 h = 7;
}
message scf_efunction
{
required string name = 1;
repeated scf_ecomponent components = 2;
+ repeated scf_eline elines = 3;
+
+ required int32 x = 4;
+ required int32 y = 5;
+ required int32 w = 6;
+ required int32 h = 7;
}
message scf_eboard
} \
} while (0)
+#define EDA_PIN_ADD_INPUT(_in, _i, _c, _pid) \
+ do { \
+ if (!(_in)->pins[_i]) \
+ (_in)->pins[_i] = (_c)->pins[_pid]; \
+ else { \
+ EDA_PIN_ADD_COMPONENT((_in)->pins[_i], (_c)->id, _pid); \
+ EDA_PIN_ADD_COMPONENT((_c )->pins[_pid], (_in)->pins[_i]->cid, (_in)->pins[_i]->id); \
+ } \
+ } while (0)
+
+
static int _eda_inst_bit_not_handler(scf_native_t* ctx, scf_3ac_code_t* c)
{
EDA_INST_OP2_CHECK()
EDA_INST_ADD_COMPONENT(f, T, SCF_EDA_Transistor);
EDA_INST_ADD_COMPONENT(f, R, SCF_EDA_Resistor);
- in->pins[i] = T->pins[SCF_EDA_Transistor_B];
+ EDA_PIN_ADD_INPUT(in, i, T, SCF_EDA_Transistor_B);
EDA_PIN_ADD_COMPONENT(T->pins[SCF_EDA_Transistor_C], R->id, 1);
EDA_PIN_ADD_COMPONENT(T->pins[SCF_EDA_Transistor_E], B->id, SCF_EDA_Battery_NEG);
EDA_INST_ADD_COMPONENT(f, D1, SCF_EDA_Diode);
EDA_INST_ADD_COMPONENT(f, R, SCF_EDA_Resistor);
- in0->pins[i] = D0->pins[SCF_EDA_Diode_NEG];
- in1->pins[i] = D1->pins[SCF_EDA_Diode_NEG];
+ EDA_PIN_ADD_INPUT(in0, i, D0, SCF_EDA_Diode_NEG);
+ EDA_PIN_ADD_INPUT(in1, i, D1, SCF_EDA_Diode_NEG);
EDA_PIN_ADD_COMPONENT(D0->pins[SCF_EDA_Diode_POS], D1->id, SCF_EDA_Diode_POS);
EDA_PIN_ADD_COMPONENT(D0->pins[SCF_EDA_Diode_POS], R ->id, 1);
EDA_INST_ADD_COMPONENT(f, D1, SCF_EDA_Diode);
EDA_INST_ADD_COMPONENT(f, R, SCF_EDA_Resistor);
- in0->pins[i] = D0->pins[SCF_EDA_Diode_POS];
- in1->pins[i] = D1->pins[SCF_EDA_Diode_POS];
+ EDA_PIN_ADD_INPUT(in0, i, D0, SCF_EDA_Diode_POS);
+ EDA_PIN_ADD_INPUT(in1, i, D1, SCF_EDA_Diode_POS);
EDA_PIN_ADD_COMPONENT(D0->pins[SCF_EDA_Diode_NEG], D1->id, SCF_EDA_Diode_NEG);
EDA_PIN_ADD_COMPONENT(D0->pins[SCF_EDA_Diode_NEG], R ->id, 0);
SCF_EDA_Transistor_NB,
};
+ScfEconn* scf_econn__alloc()
+{
+ ScfEconn* ec = malloc(sizeof(ScfEconn));
+ if (!ec)
+ return NULL;
+
+ scf_econn__init(ec);
+ return ec;
+}
+
+int scf_econn__add_cid(ScfEconn* ec, uint64_t cid)
+{
+ if (!ec)
+ return -EINVAL;
+
+ for (size_t i = 0; i < ec->n_cids; i++) {
+
+ if (ec->cids[i] == cid)
+ return 0;
+ }
+
+ uint64_t* p = realloc(ec->cids, sizeof(uint64_t) * (ec->n_cids + 1));
+ if (!p)
+ return -ENOMEM;
+
+ ec->cids = p;
+ ec->cids[ec->n_cids++] = cid;
+ return 0;
+}
+
+int scf_econn__del_cid(ScfEconn* ec, uint64_t cid)
+{
+ if (!ec)
+ return -EINVAL;
+
+ uint64_t* p;
+ size_t i;
+ size_t j;
+
+ for (i = 0; i < ec->n_cids; i++) {
+
+ if (ec->cids[i] == cid) {
+
+ for (j = i + 1; j < ec->n_cids; j++)
+ ec->cids[j - 1] = ec->cids[j];
+
+ ec->n_cids--;
+
+ p = realloc(ec->cids, sizeof(uint64_t) * ec->n_cids);
+ if (p)
+ ec->cids = p;
+ return 0;
+ }
+ }
+
+ return -EINVAL;
+}
+
+void scf_econn__free(ScfEconn* ec)
+{
+ if (ec) {
+ if (ec->cids)
+ free(ec->cids);
+
+ free(ec);
+ }
+}
+
ScfEline* scf_eline__alloc()
{
ScfEline* l = malloc(sizeof(ScfEline));
return l;
}
-void scf_eline__free(ScfEline* l)
+int scf_eline__add_line(ScfEline* el, ScfLine* l)
{
- if (l)
- free(l);
+ if (!el || !l)
+ return -EINVAL;
+
+ for (size_t i = 0; i < el->n_lines; i++) {
+
+ if (el->lines[i] == l)
+ return 0;
+
+ if (el->lines[i]->x0 == l->x0
+ && el->lines[i]->y0 == l->y0
+ && el->lines[i]->x1 == l->x1
+ && el->lines[i]->y1 == l->y1)
+ return 0;
+ }
+
+ void* p = realloc(el->lines, sizeof(ScfLine*) * (el->n_lines + 1));
+ if (!p)
+ return -ENOMEM;
+
+ el->lines = p;
+ el->lines[el->n_lines++] = l;
+ return 0;
}
-ScfEpin* scf_epin__alloc()
+int scf_eline__del_line(ScfEline* el, ScfLine* l)
{
- ScfEpin* pin = malloc(sizeof(ScfEpin));
- if (!pin)
- return NULL;
+ if (!el || !l)
+ return -EINVAL;
- scf_epin__init(pin);
- return pin;
+ void* p;
+ size_t i;
+ size_t j;
+
+ for (i = 0; i < el->n_lines; i++) {
+
+ if (el->lines[i]->x0 == l->x0
+ && el->lines[i]->y0 == l->y0
+ && el->lines[i]->x1 == l->x1
+ && el->lines[i]->y1 == l->y1) {
+
+ for (j = i + 1; j < el->n_lines; j++)
+ el->lines[j - 1] = el->lines[j];
+
+ el->n_lines--;
+
+ p = realloc(el->lines, sizeof(ScfLine*) * el->n_lines);
+ if (p)
+ el->lines = p;
+ return 0;
+ }
+ }
+
+ return -EINVAL;
}
-int scf_epin__add_component(ScfEpin* pin, uint64_t cid, uint64_t pid)
+int scf_eline__add_pin(ScfEline* el, uint64_t cid, uint64_t pid)
{
- if (!pin)
+ if (!el)
return -EINVAL;
- for (size_t i = 0; i + 1 < pin->n_tos; i += 2) {
+ for (size_t i = 0; i + 1 < el->n_pins; i += 2) {
- if (pin->tos[i] == cid && pin->tos[i + 1] == pid)
+ if (el->pins[i] == cid && el->pins[i + 1] == pid)
return 0;
}
- uint64_t* p = realloc(pin->tos, sizeof(uint64_t) * (pin->n_tos + 2));
+ uint64_t* p = realloc(el->pins, sizeof(uint64_t) * (el->n_pins + 2));
if (!p)
return -ENOMEM;
- pin->tos = p;
- pin->tos[pin->n_tos++] = cid;
- pin->tos[pin->n_tos++] = pid;
+ el->pins = p;
+ el->pins[el->n_pins++] = cid;
+ el->pins[el->n_pins++] = pid;
return 0;
}
-int scf_epin__del_component(ScfEpin* pin, uint64_t cid, uint64_t pid)
+int scf_eline__del_pin(ScfEline* el, uint64_t cid, uint64_t pid)
{
- if (!pin)
+ if (!el)
return -EINVAL;
uint64_t* p;
size_t i;
size_t j;
- for (i = 0; i + 1 < pin->n_tos; i += 2) {
+ for (i = 0; i + 1 < el->n_pins; i += 2) {
- if (pin->tos[i] == cid && pin->tos[i + 1] == pid) {
+ if (el->pins[i] == cid && el->pins[i + 1] == pid) {
- for (j = i + 2; j < pin->n_tos; j++)
- pin->tos[j - 2] = pin->tos[j];
+ for (j = i + 2; j < el->n_pins; j++)
+ el->pins[j - 2] = el->pins[j];
- pin->n_tos -= 2;
+ el->n_pins -= 2;
- p = realloc(pin->tos, sizeof(uint64_t) * pin->n_tos);
+ p = realloc(el->pins, sizeof(uint64_t) * el->n_pins);
if (p)
- pin->tos = p;
+ el->pins = p;
return 0;
}
}
return -EINVAL;
}
-int scf_epin__add_line(ScfEpin* pin, ScfEline* l)
+int scf_eline__add_conn(ScfEline* el, ScfEconn* ec)
{
- if (!pin || !l)
+ if (!el || !ec)
return -EINVAL;
- for (size_t i = 0; i < pin->n_lines; i++) {
+ for (size_t i = 0; i < el->n_conns; i++) {
- if (pin->lines[i]->x0 == l->x0
- && pin->lines[i]->y0 == l->y0
- && pin->lines[i]->x1 == l->x1
- && pin->lines[i]->y1 == l->y1)
+ if (el->conns[i] == ec)
return 0;
}
- void* p = realloc(pin->lines, sizeof(ScfEline*) * (pin->n_lines + 1));
+ void* p = realloc(el->conns, sizeof(ScfEconn*) * (el->n_conns + 1));
if (!p)
return -ENOMEM;
- pin->lines = p;
- pin->lines[pin->n_lines++] = l;
+ el->conns = p;
+ el->conns[el->n_conns++] = ec;
return 0;
}
-int scf_epin__del_line(ScfEpin* pin, ScfEline* l)
+int scf_eline__del_conn(ScfEline* el, ScfEconn* ec)
{
- if (!pin || !l)
+ if (!el || !ec)
return -EINVAL;
- void* p;
- size_t i;
- size_t j;
- size_t n = pin->n_lines;
+ void* p;
+ size_t i;
+ size_t j;
- for (i = 0; i < pin->n_lines; ) {
+ for (i = 0; i < el->n_conns; i++) {
- if (pin->lines[i]->x0 == l->x0
- && pin->lines[i]->y0 == l->y0
- && pin->lines[i]->x1 == l->x1
- && pin->lines[i]->y1 == l->y1) {
+ if (el->conns[i] == ec) {
- for (j = i + 1; j < pin->n_lines; j++)
- pin->lines[j - 1] = pin->lines[j];
+ for (j = i + 1; j < el->n_conns; j++)
+ el->conns[j - 1] = el->conns[j];
- pin->n_lines--;
- } else
- i++;
+ el->n_conns--;
+
+ p = realloc(el->conns, sizeof(ScfEconn*) * el->n_conns);
+ if (p)
+ el->conns = p;
+ return 0;
+ }
}
- if (pin->n_lines < n) {
- p = realloc(pin->lines, sizeof(ScfEline*) * pin->n_lines);
- if (p)
- pin->lines = p;
+ return -EINVAL;
+}
+
+void scf_eline__free(ScfEline* l)
+{
+ if (l) {
+ size_t i;
+
+ if (l->pins)
+ free(l->pins);
+
+ if (l->conns) {
+ for (i = 0; i < l->n_conns; i++)
+ scf_econn__free(l->conns[i]);
+
+ free(l->conns);
+ }
+
+ if (l->lines) {
+ for (i = 0; i < l->n_lines; i++)
+ free(l->lines[i]);
+
+ free(l->lines);
+ }
+
+ free(l);
+ }
+}
+
+ScfEpin* scf_epin__alloc()
+{
+ ScfEpin* pin = malloc(sizeof(ScfEpin));
+ if (!pin)
+ return NULL;
+
+ scf_epin__init(pin);
+ return pin;
+}
+
+int scf_epin__add_component(ScfEpin* pin, uint64_t cid, uint64_t pid)
+{
+ if (!pin)
+ return -EINVAL;
+
+ for (size_t i = 0; i + 1 < pin->n_tos; i += 2) {
+
+ if (pin->tos[i] == cid && pin->tos[i + 1] == pid)
+ return 0;
}
+ uint64_t* p = realloc(pin->tos, sizeof(uint64_t) * (pin->n_tos + 2));
+ if (!p)
+ return -ENOMEM;
+
+ pin->tos = p;
+ pin->tos[pin->n_tos++] = cid;
+ pin->tos[pin->n_tos++] = pid;
return 0;
}
-void scf_epin__free(ScfEpin* pin)
+int scf_epin__del_component(ScfEpin* pin, uint64_t cid, uint64_t pid)
{
- if (pin) {
- scf_logd("pin: %p\n", pin);
+ if (!pin)
+ return -EINVAL;
- if (pin->lines) {
- size_t i;
+ uint64_t* p;
+ size_t i;
+ size_t j;
- for (i = 0; i < pin->n_lines; i++)
- scf_eline__free(pin->lines[i]);
+ for (i = 0; i + 1 < pin->n_tos; i += 2) {
- free(pin->lines);
+ if (pin->tos[i] == cid && pin->tos[i + 1] == pid) {
+
+ for (j = i + 2; j < pin->n_tos; j++)
+ pin->tos[j - 2] = pin->tos[j];
+
+ pin->n_tos -= 2;
+
+ p = realloc(pin->tos, sizeof(uint64_t) * pin->n_tos);
+ if (p)
+ pin->tos = p;
+ return 0;
}
+ }
+
+ return -EINVAL;
+}
+
+void scf_epin__free(ScfEpin* pin)
+{
+ if (pin) {
+ scf_logd("pin: %p\n", pin);
if (pin->tos)
free(pin->tos);
int scf_efunction__del_component(ScfEfunction* f, ScfEcomponent* c)
{
- if (!f)
+ if (!f || !c)
return -EINVAL;
size_t i;
f->n_components--;
- p = realloc(f->components, sizeof(ScfEfunction*) * f->n_components);
+ p = realloc(f->components, sizeof(ScfEcomponent*) * f->n_components);
if (p)
f->components = p;
return 0;
return -EINVAL;
}
+int scf_efunction__add_eline(ScfEfunction* f, ScfEline* el)
+{
+ if (!f || !el)
+ return -EINVAL;
+
+ void* p = realloc(f->elines, sizeof(ScfEline*) * (f->n_elines + 1));
+ if (!p)
+ return -ENOMEM;
+
+ f->elines = p;
+ f->elines[f->n_elines++] = el;
+ return 0;
+}
+
+int scf_efunction__del_eline(ScfEfunction* f, ScfEline* el)
+{
+ if (!f || !el)
+ return -EINVAL;
+
+ size_t i;
+ size_t j;
+ void* p;
+
+ for (i = 0; i < f->n_elines; i++) {
+
+ if (f->elines[i] == el) {
+
+ for (j = i + 1; j < f->n_elines; j++)
+ f->elines[j - 1] = f->elines[j];
+
+ f->n_elines--;
+
+ p = realloc(f->elines, sizeof(ScfEline*) * f->n_elines);
+ if (p)
+ f->elines = p;
+ return 0;
+ }
+ }
+
+ return -EINVAL;
+}
+
void scf_efunction__free(ScfEfunction* f)
{
if (f) {
#define SCF_EDA_PIN_NONE 0
#define SCF_EDA_PIN_IN 1
#define SCF_EDA_PIN_OUT 2
+#define SCF_EDA_PIN_POS 4
+#define SCF_EDA_PIN_NEG 8
enum {
SCF_EDA_Battery_NEG,
SCF_EDA_Transistor_NB,
};
+ScfEconn* scf_econn__alloc();
+int scf_econn__add_cid(ScfEconn* ec, uint64_t cid);
+int scf_econn__del_cid(ScfEconn* ec, uint64_t cid);
+void scf_econn__free(ScfEconn* ec);
+
ScfEline* scf_eline__alloc();
-void scf_eline__free (ScfEline* l);
+int scf_eline__add_line(ScfEline* el, ScfLine* l);
+int scf_eline__del_line(ScfEline* el, ScfLine* l);
+
+int scf_eline__add_pin (ScfEline* el, uint64_t cid, uint64_t pid);
+int scf_eline__del_pin (ScfEline* el, uint64_t cid, uint64_t pid);
+
+int scf_eline__add_conn(ScfEline* el, ScfEconn* ec);
+int scf_eline__del_conn(ScfEline* el, ScfEconn* ec);
+void scf_eline__free (ScfEline* el);
ScfEpin* scf_epin__alloc();
int scf_epin__add_component(ScfEpin* pin, uint64_t cid, uint64_t pid);
int scf_epin__del_component(ScfEpin* pin, uint64_t cid, uint64_t pid);
-int scf_epin__add_line (ScfEpin* pin, ScfEline* l);
-int scf_epin__del_line (ScfEpin* pin, ScfEline* l);
void scf_epin__free (ScfEpin* pin);
-ScfEcomponent* scf_ecomponent__alloc(uint64_t type);
+ScfEcomponent* scf_ecomponent__alloc (uint64_t type);
int scf_ecomponent__add_pin(ScfEcomponent* c, ScfEpin* pin);
int scf_ecomponent__del_pin(ScfEcomponent* c, ScfEpin* pin);
void scf_ecomponent__free (ScfEcomponent* c);
ScfEfunction* scf_efunction__alloc (const char* name);
int scf_efunction__add_component(ScfEfunction* f, ScfEcomponent* c);
int scf_efunction__del_component(ScfEfunction* f, ScfEcomponent* c);
+
+int scf_efunction__add_eline (ScfEfunction* f, ScfEline* el);
+int scf_efunction__del_eline (ScfEfunction* f, ScfEline* el);
void scf_efunction__free (ScfEfunction* f);
ScfEboard* scf_eboard__alloc();