1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-05 17:07:11 +02:00
eda-tools/sch2fig/sch.h
2016-07-23 14:59:37 -03:00

59 lines
1.2 KiB
C

/*
* 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 <stdbool.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 fig_shape shape);
int dir; /* orientation */
int dim; /* dimension */
enum fig_shape shape;
/* component */
char *comp; /* current component */
unsigned unit; /* unit of current component */
struct sch_field *fields;
unsigned lineno;
};
bool sch_parse(struct sch_ctx *ctx, const char *line);
void sch_init(struct sch_ctx *ctx);
#endif /* !SCH_H */