/* * sch.h - Parse Eeschema .sch file * * Written 2016 by Werner Almesberger * Copyright 2016 by Werner Almesberger * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */ #ifndef SCH_H #define SCH_H #include #include "dwg.h" #include "text.h" #include "lib.h" enum sch_state { sch_basic, /* basic state */ sch_descr, /* prelude and description */ sch_comp, /* component */ sch_sheet, /* sub-sheet */ sch_text, /* text or label */ sch_wire, /* wire */ }; struct sch_ctx { enum sch_state state; void (*wire)(int sx, int sy, int ex, int ey); /* text and component */ int x, y; /* saved coordinates */ /* text */ void (*text)(int x, int y, const char *s, int dir, int dim, enum dwg_shape shape); int dir; /* orientation */ int dim; /* dimension */ enum dwg_shape shape; /* component */ const struct comp *comp; /* current component */ unsigned unit; /* unit of current component */ struct sch_field *fields; /* subsheet */ unsigned h, w; const char *sheet; unsigned sheet_dim; const char *file; unsigned file_dim; bool rotated; unsigned lineno; }; void decode_alignment(struct text *txt, char hor, char vert); bool sch_parse(struct sch_ctx *ctx, const char *line); void sch_init(struct sch_ctx *ctx); #endif /* !SCH_H */