1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-26 18:23:08 +02:00

sch2fig/fig.h (enum fig_shape): move to dwg.h and rename

This commit is contained in:
Werner Almesberger 2016-07-30 21:33:36 -03:00
parent 3ca2130db5
commit b933c9976f
5 changed files with 40 additions and 39 deletions

View File

@ -53,7 +53,7 @@ static enum box_type flip_box(enum box_type box)
void dwg_label(int x, int y, const char *s, int dir, int dim, void dwg_label(int x, int y, const char *s, int dir, int dim,
enum fig_shape shape) enum dwg_shape shape)
{ {
struct text txt = { struct text txt = {
.s = s, .s = s,
@ -98,7 +98,7 @@ void dwg_label(int x, int y, const char *s, int dir, int dim,
void dwg_glabel(int x, int y, const char *s, int dir, int dim, void dwg_glabel(int x, int y, const char *s, int dir, int dim,
enum fig_shape shape) enum dwg_shape shape)
{ {
struct text txt = { struct text txt = {
.s = s, .s = s,
@ -118,16 +118,16 @@ void dwg_glabel(int x, int y, const char *s, int dir, int dim,
bool anchor_right = 1; bool anchor_right = 1;
switch (shape) { switch (shape) {
case fig_unspec: case dwg_unspec:
box = box_simple; box = box_simple;
break; break;
case fig_in: case dwg_in:
box = box_right; box = box_right;
break; break;
case fig_out: case dwg_out:
box = box_left; box = box_left;
break; break;
case fig_bidir: case dwg_bidir:
box = box_both; box = box_both;
break; break;
default: default:
@ -291,7 +291,7 @@ static int make_box(enum box_type box, int h, int *vx, int *vy)
void dwg_hlabel(int x, int y, const char *s, int dir, int dim, void dwg_hlabel(int x, int y, const char *s, int dir, int dim,
enum fig_shape shape) enum dwg_shape shape)
{ {
struct text txt = { struct text txt = {
.s = s, .s = s,
@ -307,16 +307,16 @@ void dwg_hlabel(int x, int y, const char *s, int dir, int dim,
int n, i; int n, i;
switch (shape) { switch (shape) {
case fig_unspec: case dwg_unspec:
n = make_box(box_simple, dim, vx, vy); n = make_box(box_simple, dim, vx, vy);
break; break;
case fig_in: case dwg_in:
n = make_box(box_left, dim, vx, vy); n = make_box(box_left, dim, vx, vy);
break; break;
case fig_out: case dwg_out:
n = make_box(box_right, dim, vx, vy); n = make_box(box_right, dim, vx, vy);
break; break;
case fig_bidir: case dwg_bidir:
n = make_box(box_both, dim, vx, vy); n = make_box(box_both, dim, vx, vy);
break; break;
default: default:

View File

@ -17,12 +17,21 @@
#include "fig.h" #include "fig.h"
enum dwg_shape {
dwg_unspec, // UnSpc
dwg_in, // Input
dwg_out, // Output
dwg_tri, // 3State
dwg_bidir, // Bidirectional
};
void dwg_label(int x, int y, const char *s, int dir, int dim, void dwg_label(int x, int y, const char *s, int dir, int dim,
enum fig_shape shape); enum dwg_shape shape);
void dwg_hlabel(int x, int y, const char *s, int dir, int dim, void dwg_hlabel(int x, int y, const char *s, int dir, int dim,
enum fig_shape shape); enum dwg_shape shape);
void dwg_glabel(int x, int y, const char *s, int dir, int dim, void dwg_glabel(int x, int y, const char *s, int dir, int dim,
enum fig_shape shape); enum dwg_shape shape);
void dwg_junction(int x, int y); void dwg_junction(int x, int y);
void dwg_noconn(int x, int y); void dwg_noconn(int x, int y);

View File

@ -17,15 +17,6 @@
#include "text.h" #include "text.h"
enum fig_shape {
fig_unspec, // UnSpc
fig_in, // Input
fig_out, // Output
fig_tri, // 3State
fig_bidir, // Bidirectional
};
/* schematics */ /* schematics */
void fig_line(int sx, int sy, int ex, int ey); void fig_line(int sx, int sy, int ex, int ey);

View File

@ -31,26 +31,26 @@
/* ----- (Global) Labels --------------------------------------------------- */ /* ----- (Global) Labels --------------------------------------------------- */
static enum fig_shape do_decode_shape(const char *s) static enum dwg_shape do_decode_shape(const char *s)
{ {
if (!strcmp(s, "UnSpc")) if (!strcmp(s, "UnSpc"))
return fig_unspec; return dwg_unspec;
if (!strcmp(s, "Input")) if (!strcmp(s, "Input"))
return fig_in; return dwg_in;
if (!strcmp(s, "Output")) if (!strcmp(s, "Output"))
return fig_out; return dwg_out;
if (!strcmp(s, "3State")) if (!strcmp(s, "3State"))
return fig_tri; return dwg_tri;
if (!strcmp(s, "BiDi")) if (!strcmp(s, "BiDi"))
return fig_bidir; return dwg_bidir;
fprintf(stderr, "unknown shape: \"%s\"\n", s); fprintf(stderr, "unknown shape: \"%s\"\n", s);
exit(1); exit(1);
} }
static enum fig_shape decode_shape(const char *s) static enum dwg_shape decode_shape(const char *s)
{ {
enum fig_shape res; enum dwg_shape res;
res = do_decode_shape(s); res = do_decode_shape(s);
free((void *) s); free((void *) s);
@ -62,7 +62,7 @@ static enum fig_shape decode_shape(const char *s)
static void draw_text(int x, int y, const char *s, int dir, int dim, static void draw_text(int x, int y, const char *s, int dir, int dim,
enum fig_shape shape) enum dwg_shape shape)
{ {
struct text txt = { struct text txt = {
.s = s, .s = s,
@ -259,19 +259,19 @@ static void dump_fields(struct sch_field *fields, int m[6])
/* ----- Sheet field ------------------------------------------------------- */ /* ----- Sheet field ------------------------------------------------------- */
static enum fig_shape decode_form(char form) static enum dwg_shape decode_form(char form)
{ {
switch (form) { switch (form) {
case 'O': case 'O':
return fig_in; return dwg_in;
case 'I': case 'I':
return fig_out; return dwg_out;
case 'B': case 'B':
/* fall through */ /* fall through */
case 'T': case 'T':
return fig_bidir; return dwg_bidir;
case 'U': case 'U':
return fig_unspec; return dwg_unspec;
default: default:
fprintf(stderr, "unknown form: \"%c\"\n", form); fprintf(stderr, "unknown form: \"%c\"\n", form);
exit(1); exit(1);

View File

@ -16,6 +16,7 @@
#include <stdbool.h> #include <stdbool.h>
#include "dwg.h"
#include "text.h" #include "text.h"
#include "lib.h" #include "lib.h"
@ -40,10 +41,10 @@ struct sch_ctx {
/* text */ /* text */
void (*text)(int x, int y, const char *s, int dir, int dim, void (*text)(int x, int y, const char *s, int dir, int dim,
enum fig_shape shape); enum dwg_shape shape);
int dir; /* orientation */ int dir; /* orientation */
int dim; /* dimension */ int dim; /* dimension */
enum fig_shape shape; enum dwg_shape shape;
/* component */ /* component */