--- /dev/null
+/* Generated by the protocol buffer compiler. DO NOT EDIT! */
+/* Generated from: scf_eda.proto */
+
+/* Do not generate deprecated warnings for self */
+#ifndef PROTOBUF_C__NO_DEPRECATED
+#define PROTOBUF_C__NO_DEPRECATED
+#endif
+
+#include "scf_eda.pb-c.h"
+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_epin__init
+ (ScfEpin *message)
+{
+ static ScfEpin init_value = SCF_EPIN__INIT;
+ *message = init_value;
+}
+size_t scf_epin__get_packed_size
+ (const ScfEpin *message)
+{
+ assert(message->base.descriptor == &scf_epin__descriptor);
+ return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t scf_epin__pack
+ (const ScfEpin *message,
+ uint8_t *out)
+{
+ assert(message->base.descriptor == &scf_epin__descriptor);
+ return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t scf_epin__pack_to_buffer
+ (const ScfEpin *message,
+ ProtobufCBuffer *buffer)
+{
+ assert(message->base.descriptor == &scf_epin__descriptor);
+ return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+ScfEpin *
+ scf_epin__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data)
+{
+ return (ScfEpin *)
+ protobuf_c_message_unpack (&scf_epin__descriptor,
+ allocator, len, data);
+}
+void scf_epin__free_unpacked
+ (ScfEpin *message,
+ ProtobufCAllocator *allocator)
+{
+ assert(message->base.descriptor == &scf_epin__descriptor);
+ protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void scf_ecomponent__init
+ (ScfEcomponent *message)
+{
+ static ScfEcomponent init_value = SCF_ECOMPONENT__INIT;
+ *message = init_value;
+}
+size_t scf_ecomponent__get_packed_size
+ (const ScfEcomponent *message)
+{
+ assert(message->base.descriptor == &scf_ecomponent__descriptor);
+ return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t scf_ecomponent__pack
+ (const ScfEcomponent *message,
+ uint8_t *out)
+{
+ assert(message->base.descriptor == &scf_ecomponent__descriptor);
+ return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t scf_ecomponent__pack_to_buffer
+ (const ScfEcomponent *message,
+ ProtobufCBuffer *buffer)
+{
+ assert(message->base.descriptor == &scf_ecomponent__descriptor);
+ return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+ScfEcomponent *
+ scf_ecomponent__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data)
+{
+ return (ScfEcomponent *)
+ protobuf_c_message_unpack (&scf_ecomponent__descriptor,
+ allocator, len, data);
+}
+void scf_ecomponent__free_unpacked
+ (ScfEcomponent *message,
+ ProtobufCAllocator *allocator)
+{
+ assert(message->base.descriptor == &scf_ecomponent__descriptor);
+ protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void scf_efunction__init
+ (ScfEfunction *message)
+{
+ static ScfEfunction init_value = SCF_EFUNCTION__INIT;
+ *message = init_value;
+}
+size_t scf_efunction__get_packed_size
+ (const ScfEfunction *message)
+{
+ assert(message->base.descriptor == &scf_efunction__descriptor);
+ return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t scf_efunction__pack
+ (const ScfEfunction *message,
+ uint8_t *out)
+{
+ assert(message->base.descriptor == &scf_efunction__descriptor);
+ return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t scf_efunction__pack_to_buffer
+ (const ScfEfunction *message,
+ ProtobufCBuffer *buffer)
+{
+ assert(message->base.descriptor == &scf_efunction__descriptor);
+ return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+ScfEfunction *
+ scf_efunction__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data)
+{
+ return (ScfEfunction *)
+ protobuf_c_message_unpack (&scf_efunction__descriptor,
+ allocator, len, data);
+}
+void scf_efunction__free_unpacked
+ (ScfEfunction *message,
+ ProtobufCAllocator *allocator)
+{
+ assert(message->base.descriptor == &scf_efunction__descriptor);
+ protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+void scf_eboard__init
+ (ScfEboard *message)
+{
+ static ScfEboard init_value = SCF_EBOARD__INIT;
+ *message = init_value;
+}
+size_t scf_eboard__get_packed_size
+ (const ScfEboard *message)
+{
+ assert(message->base.descriptor == &scf_eboard__descriptor);
+ return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
+}
+size_t scf_eboard__pack
+ (const ScfEboard *message,
+ uint8_t *out)
+{
+ assert(message->base.descriptor == &scf_eboard__descriptor);
+ return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
+}
+size_t scf_eboard__pack_to_buffer
+ (const ScfEboard *message,
+ ProtobufCBuffer *buffer)
+{
+ assert(message->base.descriptor == &scf_eboard__descriptor);
+ return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
+}
+ScfEboard *
+ scf_eboard__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data)
+{
+ return (ScfEboard *)
+ protobuf_c_message_unpack (&scf_eboard__descriptor,
+ allocator, len, data);
+}
+void scf_eboard__free_unpacked
+ (ScfEboard *message,
+ ProtobufCAllocator *allocator)
+{
+ assert(message->base.descriptor == &scf_eboard__descriptor);
+ protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
+}
+static const ProtobufCFieldDescriptor scf_eline__field_descriptors[4] =
+{
+ {
+ "x0",
+ 1,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_UINT32,
+ 0, /* quantifier_offset */
+ offsetof(ScfEline, x0),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "y0",
+ 2,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_UINT32,
+ 0, /* quantifier_offset */
+ offsetof(ScfEline, y0),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "x1",
+ 3,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_UINT32,
+ 0, /* quantifier_offset */
+ offsetof(ScfEline, x1),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "y1",
+ 4,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_UINT32,
+ 0, /* quantifier_offset */
+ offsetof(ScfEline, y1),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+};
+static const unsigned scf_eline__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] =
+{
+ { 1, 0 },
+ { 0, 4 }
+};
+const ProtobufCMessageDescriptor scf_eline__descriptor =
+{
+ PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC,
+ "scf_eline",
+ "ScfEline",
+ "ScfEline",
+ "",
+ sizeof(ScfEline),
+ 4,
+ 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_epin__field_descriptors[6] =
+{
+ {
+ "tos",
+ 1,
+ PROTOBUF_C_LABEL_REPEATED,
+ PROTOBUF_C_TYPE_UINT64,
+ offsetof(ScfEpin, n_tos),
+ offsetof(ScfEpin, tos),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "id",
+ 2,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_UINT64,
+ 0, /* quantifier_offset */
+ offsetof(ScfEpin, id),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "flags",
+ 3,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_UINT64,
+ 0, /* quantifier_offset */
+ offsetof(ScfEpin, flags),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "x",
+ 4,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_UINT32,
+ 0, /* quantifier_offset */
+ offsetof(ScfEpin, x),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "y",
+ 5,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_UINT32,
+ 0, /* quantifier_offset */
+ offsetof(ScfEpin, y),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "lines",
+ 6,
+ PROTOBUF_C_LABEL_REPEATED,
+ PROTOBUF_C_TYPE_MESSAGE,
+ offsetof(ScfEpin, n_lines),
+ offsetof(ScfEpin, lines),
+ &scf_eline__descriptor,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+};
+static const unsigned scf_epin__field_indices_by_name[] = {
+ 2, /* field[2] = flags */
+ 1, /* field[1] = id */
+ 5, /* field[5] = lines */
+ 0, /* field[0] = tos */
+ 3, /* field[3] = x */
+ 4, /* field[4] = y */
+};
+static const ProtobufCIntRange scf_epin__number_ranges[1 + 1] =
+{
+ { 1, 0 },
+ { 0, 6 }
+};
+const ProtobufCMessageDescriptor scf_epin__descriptor =
+{
+ PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC,
+ "scf_epin",
+ "ScfEpin",
+ "ScfEpin",
+ "",
+ sizeof(ScfEpin),
+ 6,
+ 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_ecomponent__field_descriptors[7] =
+{
+ {
+ "id",
+ 1,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_UINT64,
+ 0, /* quantifier_offset */
+ offsetof(ScfEcomponent, id),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "type",
+ 2,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_UINT64,
+ 0, /* quantifier_offset */
+ offsetof(ScfEcomponent, type),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "pins",
+ 3,
+ PROTOBUF_C_LABEL_REPEATED,
+ PROTOBUF_C_TYPE_MESSAGE,
+ offsetof(ScfEcomponent, n_pins),
+ offsetof(ScfEcomponent, pins),
+ &scf_epin__descriptor,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "x",
+ 4,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_UINT32,
+ 0, /* quantifier_offset */
+ offsetof(ScfEcomponent, x),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "y",
+ 5,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_UINT32,
+ 0, /* quantifier_offset */
+ offsetof(ScfEcomponent, y),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "w",
+ 6,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_UINT32,
+ 0, /* quantifier_offset */
+ offsetof(ScfEcomponent, w),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "h",
+ 7,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_UINT32,
+ 0, /* quantifier_offset */
+ offsetof(ScfEcomponent, h),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+};
+static const unsigned scf_ecomponent__field_indices_by_name[] = {
+ 6, /* field[6] = h */
+ 0, /* field[0] = id */
+ 2, /* field[2] = pins */
+ 1, /* field[1] = type */
+ 5, /* field[5] = w */
+ 3, /* field[3] = x */
+ 4, /* field[4] = y */
+};
+static const ProtobufCIntRange scf_ecomponent__number_ranges[1 + 1] =
+{
+ { 1, 0 },
+ { 0, 7 }
+};
+const ProtobufCMessageDescriptor scf_ecomponent__descriptor =
+{
+ PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC,
+ "scf_ecomponent",
+ "ScfEcomponent",
+ "ScfEcomponent",
+ "",
+ sizeof(ScfEcomponent),
+ 7,
+ scf_ecomponent__field_descriptors,
+ scf_ecomponent__field_indices_by_name,
+ 1, scf_ecomponent__number_ranges,
+ (ProtobufCMessageInit) scf_ecomponent__init,
+ NULL,NULL,NULL /* reserved[123] */
+};
+static const ProtobufCFieldDescriptor scf_efunction__field_descriptors[2] =
+{
+ {
+ "name",
+ 1,
+ PROTOBUF_C_LABEL_REQUIRED,
+ PROTOBUF_C_TYPE_STRING,
+ 0, /* quantifier_offset */
+ offsetof(ScfEfunction, name),
+ NULL,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+ {
+ "components",
+ 2,
+ PROTOBUF_C_LABEL_REPEATED,
+ PROTOBUF_C_TYPE_MESSAGE,
+ offsetof(ScfEfunction, n_components),
+ offsetof(ScfEfunction, components),
+ &scf_ecomponent__descriptor,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+};
+static const unsigned scf_efunction__field_indices_by_name[] = {
+ 1, /* field[1] = components */
+ 0, /* field[0] = name */
+};
+static const ProtobufCIntRange scf_efunction__number_ranges[1 + 1] =
+{
+ { 1, 0 },
+ { 0, 2 }
+};
+const ProtobufCMessageDescriptor scf_efunction__descriptor =
+{
+ PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC,
+ "scf_efunction",
+ "ScfEfunction",
+ "ScfEfunction",
+ "",
+ sizeof(ScfEfunction),
+ 2,
+ scf_efunction__field_descriptors,
+ scf_efunction__field_indices_by_name,
+ 1, scf_efunction__number_ranges,
+ (ProtobufCMessageInit) scf_efunction__init,
+ NULL,NULL,NULL /* reserved[123] */
+};
+static const ProtobufCFieldDescriptor scf_eboard__field_descriptors[1] =
+{
+ {
+ "functions",
+ 1,
+ PROTOBUF_C_LABEL_REPEATED,
+ PROTOBUF_C_TYPE_MESSAGE,
+ offsetof(ScfEboard, n_functions),
+ offsetof(ScfEboard, functions),
+ &scf_efunction__descriptor,
+ NULL,
+ 0, /* flags */
+ 0,NULL,NULL /* reserved1,reserved2, etc */
+ },
+};
+static const unsigned scf_eboard__field_indices_by_name[] = {
+ 0, /* field[0] = functions */
+};
+static const ProtobufCIntRange scf_eboard__number_ranges[1 + 1] =
+{
+ { 1, 0 },
+ { 0, 1 }
+};
+const ProtobufCMessageDescriptor scf_eboard__descriptor =
+{
+ PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC,
+ "scf_eboard",
+ "ScfEboard",
+ "ScfEboard",
+ "",
+ sizeof(ScfEboard),
+ 1,
+ scf_eboard__field_descriptors,
+ scf_eboard__field_indices_by_name,
+ 1, scf_eboard__number_ranges,
+ (ProtobufCMessageInit) scf_eboard__init,
+ NULL,NULL,NULL /* reserved[123] */
+};
--- /dev/null
+/* Generated by the protocol buffer compiler. DO NOT EDIT! */
+/* Generated from: scf_eda.proto */
+
+#ifndef PROTOBUF_C_scf_5feda_2eproto__INCLUDED
+#define PROTOBUF_C_scf_5feda_2eproto__INCLUDED
+
+#include <protobuf-c/protobuf-c.h>
+
+PROTOBUF_C__BEGIN_DECLS
+
+#if PROTOBUF_C_VERSION_NUMBER < 1000000
+# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers.
+#elif 1002001 < PROTOBUF_C_MIN_COMPILER_VERSION
+# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c.
+#endif
+
+
+typedef struct _ScfEline ScfEline;
+typedef struct _ScfEpin ScfEpin;
+typedef struct _ScfEcomponent ScfEcomponent;
+typedef struct _ScfEfunction ScfEfunction;
+typedef struct _ScfEboard ScfEboard;
+
+
+/* --- enums --- */
+
+
+/* --- messages --- */
+
+struct _ScfEline
+{
+ ProtobufCMessage base;
+ uint32_t x0;
+ uint32_t y0;
+ uint32_t x1;
+ uint32_t y1;
+};
+#define SCF_ELINE__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&scf_eline__descriptor) \
+ , 0, 0, 0, 0 }
+
+
+struct _ScfEpin
+{
+ ProtobufCMessage base;
+ size_t n_tos;
+ uint64_t *tos;
+ uint64_t id;
+ uint64_t flags;
+ uint32_t x;
+ uint32_t y;
+ size_t n_lines;
+ ScfEline **lines;
+};
+#define SCF_EPIN__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&scf_epin__descriptor) \
+ , 0,NULL, 0, 0, 0, 0, 0,NULL }
+
+
+struct _ScfEcomponent
+{
+ ProtobufCMessage base;
+ uint64_t id;
+ uint64_t type;
+ size_t n_pins;
+ ScfEpin **pins;
+ uint32_t x;
+ uint32_t y;
+ uint32_t w;
+ uint32_t h;
+};
+#define SCF_ECOMPONENT__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&scf_ecomponent__descriptor) \
+ , 0, 0, 0,NULL, 0, 0, 0, 0 }
+
+
+struct _ScfEfunction
+{
+ ProtobufCMessage base;
+ char *name;
+ size_t n_components;
+ ScfEcomponent **components;
+};
+#define SCF_EFUNCTION__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&scf_efunction__descriptor) \
+ , NULL, 0,NULL }
+
+
+struct _ScfEboard
+{
+ ProtobufCMessage base;
+ size_t n_functions;
+ ScfEfunction **functions;
+};
+#define SCF_EBOARD__INIT \
+ { PROTOBUF_C_MESSAGE_INIT (&scf_eboard__descriptor) \
+ , 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,
+ 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);
+/* ScfEpin methods */
+void scf_epin__init
+ (ScfEpin *message);
+size_t scf_epin__get_packed_size
+ (const ScfEpin *message);
+size_t scf_epin__pack
+ (const ScfEpin *message,
+ uint8_t *out);
+size_t scf_epin__pack_to_buffer
+ (const ScfEpin *message,
+ ProtobufCBuffer *buffer);
+ScfEpin *
+ scf_epin__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data);
+void scf_epin__free_unpacked
+ (ScfEpin *message,
+ ProtobufCAllocator *allocator);
+/* ScfEcomponent methods */
+void scf_ecomponent__init
+ (ScfEcomponent *message);
+size_t scf_ecomponent__get_packed_size
+ (const ScfEcomponent *message);
+size_t scf_ecomponent__pack
+ (const ScfEcomponent *message,
+ uint8_t *out);
+size_t scf_ecomponent__pack_to_buffer
+ (const ScfEcomponent *message,
+ ProtobufCBuffer *buffer);
+ScfEcomponent *
+ scf_ecomponent__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data);
+void scf_ecomponent__free_unpacked
+ (ScfEcomponent *message,
+ ProtobufCAllocator *allocator);
+/* ScfEfunction methods */
+void scf_efunction__init
+ (ScfEfunction *message);
+size_t scf_efunction__get_packed_size
+ (const ScfEfunction *message);
+size_t scf_efunction__pack
+ (const ScfEfunction *message,
+ uint8_t *out);
+size_t scf_efunction__pack_to_buffer
+ (const ScfEfunction *message,
+ ProtobufCBuffer *buffer);
+ScfEfunction *
+ scf_efunction__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data);
+void scf_efunction__free_unpacked
+ (ScfEfunction *message,
+ ProtobufCAllocator *allocator);
+/* ScfEboard methods */
+void scf_eboard__init
+ (ScfEboard *message);
+size_t scf_eboard__get_packed_size
+ (const ScfEboard *message);
+size_t scf_eboard__pack
+ (const ScfEboard *message,
+ uint8_t *out);
+size_t scf_eboard__pack_to_buffer
+ (const ScfEboard *message,
+ ProtobufCBuffer *buffer);
+ScfEboard *
+ scf_eboard__unpack
+ (ProtobufCAllocator *allocator,
+ size_t len,
+ const uint8_t *data);
+void scf_eboard__free_unpacked
+ (ScfEboard *message,
+ ProtobufCAllocator *allocator);
+/* --- per-message closures --- */
+
+typedef void (*ScfEline_Closure)
+ (const ScfEline *message,
+ void *closure_data);
+typedef void (*ScfEpin_Closure)
+ (const ScfEpin *message,
+ void *closure_data);
+typedef void (*ScfEcomponent_Closure)
+ (const ScfEcomponent *message,
+ void *closure_data);
+typedef void (*ScfEfunction_Closure)
+ (const ScfEfunction *message,
+ void *closure_data);
+typedef void (*ScfEboard_Closure)
+ (const ScfEboard *message,
+ void *closure_data);
+
+/* --- services --- */
+
+
+/* --- descriptors --- */
+
+extern const ProtobufCMessageDescriptor scf_eline__descriptor;
+extern const ProtobufCMessageDescriptor scf_epin__descriptor;
+extern const ProtobufCMessageDescriptor scf_ecomponent__descriptor;
+extern const ProtobufCMessageDescriptor scf_efunction__descriptor;
+extern const ProtobufCMessageDescriptor scf_eboard__descriptor;
+
+PROTOBUF_C__END_DECLS
+
+
+#endif /* PROTOBUF_C_scf_5feda_2eproto__INCLUDED */
--- /dev/null
+#include "scf_eda_pb.h"
+#include "scf_def.h"
+
+static int component_pins[SCF_EDA_Components_NB] =
+{
+ 0, // None
+ SCF_EDA_Battery_NB, // SCF_EDA_Battery
+
+ 2, // SCF_EDA_Resistor
+ 2, // SCF_EDA_Capacitor
+ 2, // SCF_EDA_Inductor
+
+ SCF_EDA_Diode_NB,
+ SCF_EDA_Transistor_NB,
+};
+
+ScfEline* scf_eline__alloc()
+{
+ ScfEline* l = malloc(sizeof(ScfEline));
+ if (!l)
+ return NULL;
+
+ scf_eline__init(l);
+ return l;
+}
+
+void scf_eline__free(ScfEline* l)
+{
+ if (l)
+ 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;
+}
+
+int scf_epin__del_component(ScfEpin* pin, uint64_t cid, uint64_t pid)
+{
+ if (!pin)
+ return -EINVAL;
+
+ uint64_t* p;
+ size_t i;
+ size_t j;
+
+ for (i = 0; i + 1 < pin->n_tos; i += 2) {
+
+ 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;
+}
+
+int scf_epin__add_line(ScfEpin* pin, ScfEline* l)
+{
+ if (!pin || !l)
+ return -EINVAL;
+
+ for (size_t i = 0; i < pin->n_lines; 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)
+ return 0;
+ }
+
+ void* p = realloc(pin->lines, sizeof(ScfEline*) * (pin->n_lines + 1));
+ if (!p)
+ return -ENOMEM;
+
+ pin->lines = p;
+ pin->lines[pin->n_lines++] = l;
+ return 0;
+}
+
+int scf_epin__del_line(ScfEpin* pin, ScfEline* l)
+{
+ if (!pin || !l)
+ return -EINVAL;
+
+ void* p;
+ size_t i;
+ size_t j;
+ size_t n = pin->n_lines;
+
+ for (i = 0; i < pin->n_lines; ) {
+
+ 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) {
+
+ for (j = i + 1; j < pin->n_lines; j++)
+ pin->lines[j - 1] = pin->lines[j];
+
+ pin->n_lines--;
+ } else
+ i++;
+ }
+
+ if (pin->n_lines < n) {
+ p = realloc(pin->lines, sizeof(ScfEline*) * pin->n_lines);
+ if (p)
+ pin->lines = p;
+ }
+
+ return 0;
+}
+
+void scf_epin__free(ScfEpin* pin)
+{
+ if (pin) {
+ scf_logd("pin: %p\n", pin);
+
+ if (pin->lines) {
+ size_t i;
+
+ for (i = 0; i < pin->n_lines; i++)
+ scf_eline__free(pin->lines[i]);
+
+ free(pin->lines);
+ }
+
+ if (pin->tos)
+ free(pin->tos);
+ free(pin);
+ }
+}
+
+ScfEcomponent* scf_ecomponent__alloc(uint64_t type)
+{
+ if (type >= SCF_EDA_Components_NB)
+ return NULL;
+
+ ScfEcomponent* c = malloc(sizeof(ScfEcomponent));
+ if (!c)
+ return NULL;
+
+ scf_ecomponent__init(c);
+
+ c->type = type;
+
+ int i;
+ for (i = 0; i < component_pins[type]; i++) {
+
+ ScfEpin* pin = scf_epin__alloc();
+ if (!pin) {
+ scf_ecomponent__free(c);
+ return NULL;
+ }
+
+ pin->id = i;
+
+ if (scf_ecomponent__add_pin(c, pin) < 0) {
+ scf_ecomponent__free(c);
+ scf_epin__free(pin);
+ return NULL;
+ }
+ }
+
+ return c;
+}
+
+int scf_ecomponent__add_pin(ScfEcomponent* c, ScfEpin* pin)
+{
+ if (!c || !pin)
+ return -EINVAL;
+
+ void* p = realloc(c->pins, sizeof(ScfEpin*) * (c->n_pins + 1));
+ if (!p)
+ return -ENOMEM;
+
+ c->pins = p;
+ c->pins[c->n_pins++] = pin;
+ return 0;
+}
+
+int scf_ecomponent__del_pin(ScfEcomponent* c, ScfEpin* pin)
+{
+ if (!c)
+ return -EINVAL;
+
+ size_t i;
+ size_t j;
+ void* p;
+
+ for (i = 0; i < c->n_pins; i++) {
+
+ if (c->pins[i] == pin) {
+
+ for (j = i + 1; j < c->n_pins; j++)
+ c->pins[j - 1] = c->pins[j];
+
+ c->n_pins--;
+
+ p = realloc(c->pins, sizeof(ScfEpin*) * c->n_pins);
+ if (p)
+ c->pins = p;
+ return 0;
+ }
+ }
+
+ return -EINVAL;
+}
+
+void scf_ecomponent__free(ScfEcomponent* c)
+{
+ if (c) {
+ scf_logd("c: %ld\n", c->id);
+
+ if (c->pins) {
+ size_t i;
+
+ for (i = 0; i < c->n_pins; i++)
+ scf_epin__free(c->pins[i]);
+
+ free(c->pins);
+ }
+
+ free(c);
+ }
+}
+
+ScfEfunction* scf_efunction__alloc(const char* name)
+{
+ ScfEfunction* f = malloc(sizeof(ScfEfunction));
+ if (!f)
+ return NULL;
+
+ scf_efunction__init(f);
+
+ f->name = strdup(name);
+ if (!f->name) {
+ free(f);
+ return NULL;
+ }
+
+ return f;
+}
+
+int scf_efunction__add_component(ScfEfunction* f, ScfEcomponent* c)
+{
+ if (!f || !c)
+ return -EINVAL;
+
+ void* p = realloc(f->components, sizeof(ScfEcomponent*) * (f->n_components + 1));
+ if (!p)
+ return -ENOMEM;
+
+ f->components = p;
+ f->components[f->n_components++] = c;
+ return 0;
+}
+
+int scf_efunction__del_component(ScfEfunction* f, ScfEcomponent* c)
+{
+ if (!f)
+ return -EINVAL;
+
+ size_t i;
+ size_t j;
+ void* p;
+
+ for (i = 0; i < f->n_components; i++) {
+
+ if (f->components[i] == c) {
+
+ for (j = i + 1; j < f->n_components; j++)
+ f->components[j - 1] = f->components[j];
+
+ f->n_components--;
+
+ p = realloc(f->components, sizeof(ScfEfunction*) * f->n_components);
+ if (p)
+ f->components = p;
+ return 0;
+ }
+ }
+
+ return -EINVAL;
+}
+
+void scf_efunction__free(ScfEfunction* f)
+{
+ if (f) {
+ scf_logd("f: %s\n", f->name);
+
+ if (f->components) {
+ size_t i;
+
+ for (i = 0; i < f->n_components; i++)
+ scf_ecomponent__free(f->components[i]);
+
+ free(f->components);
+ }
+
+ free(f->name);
+ free(f);
+ }
+}
+
+ScfEboard* scf_eboard__alloc()
+{
+ ScfEboard* b = malloc(sizeof(ScfEboard));
+ if (!b)
+ return NULL;
+
+ scf_eboard__init(b);
+ return b;
+}
+
+int scf_eboard__add_function(ScfEboard* b, ScfEfunction* f)
+{
+ if (!b || !f)
+ return -EINVAL;
+
+ void* p = realloc(b->functions, sizeof(ScfEfunction*) * (b->n_functions + 1));
+ if (!p)
+ return -ENOMEM;
+
+ b->functions = p;
+ b->functions[b->n_functions++] = f;
+ return 0;
+}
+
+int scf_eboard__del_function(ScfEboard* b, ScfEfunction* f)
+{
+ if (!b)
+ return -EINVAL;
+
+ size_t i;
+ size_t j;
+ void* p;
+
+ for (i = 0; i < b->n_functions; i++) {
+
+ if (b->functions[i] == f) {
+
+ for (j = i + 1; j < b->n_functions; j++)
+ b->functions[j - 1] = b->functions[j];
+
+ b->n_functions--;
+
+ p = realloc(b->functions, sizeof(ScfEfunction*) * b->n_functions);
+ if (p)
+ b->functions = p;
+ return 0;
+ }
+ }
+
+ return -EINVAL;
+}
+
+void scf_eboard__free(ScfEboard* b)
+{
+ if (b) {
+ if (b->functions) {
+ size_t i;
+
+ for (i = 0; i < b->n_functions; i++)
+ scf_efunction__free(b->functions[i]);
+
+ free(b->functions);
+ }
+
+ free(b);
+ }
+}