1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-02 20:05:20 +02:00
eda-tools/sch2fig/sch.h

64 lines
1.3 KiB
C
Raw Normal View History

/*
* 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>
#include "text.h"
2016-07-24 04:52:15 +03:00
#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 fig_shape shape);
int dir; /* orientation */
int dim; /* dimension */
enum fig_shape shape;
/* component */
2016-07-24 04:52:15 +03:00
const struct comp *comp; /* current component */
unsigned unit; /* unit of current component */
2016-07-23 20:59:37 +03:00
struct sch_field *fields;
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 */