1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-26 13:53:09 +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,
enum fig_shape shape)
enum dwg_shape shape)
{
struct text txt = {
.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,
enum fig_shape shape)
enum dwg_shape shape)
{
struct text txt = {
.s = s,
@ -118,16 +118,16 @@ void dwg_glabel(int x, int y, const char *s, int dir, int dim,
bool anchor_right = 1;
switch (shape) {
case fig_unspec:
case dwg_unspec:
box = box_simple;
break;
case fig_in:
case dwg_in:
box = box_right;
break;
case fig_out:
case dwg_out:
box = box_left;
break;
case fig_bidir:
case dwg_bidir:
box = box_both;
break;
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,
enum fig_shape shape)
enum dwg_shape shape)
{
struct text txt = {
.s = s,
@ -307,16 +307,16 @@ void dwg_hlabel(int x, int y, const char *s, int dir, int dim,
int n, i;
switch (shape) {
case fig_unspec:
case dwg_unspec:
n = make_box(box_simple, dim, vx, vy);
break;
case fig_in:
case dwg_in:
n = make_box(box_left, dim, vx, vy);
break;
case fig_out:
case dwg_out:
n = make_box(box_right, dim, vx, vy);
break;
case fig_bidir:
case dwg_bidir:
n = make_box(box_both, dim, vx, vy);
break;
default:

View File

@ -17,12 +17,21 @@
#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,
enum fig_shape shape);
enum dwg_shape shape);
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,
enum fig_shape shape);
enum dwg_shape shape);
void dwg_junction(int x, int y);
void dwg_noconn(int x, int y);

View File

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

View File

@ -31,26 +31,26 @@
/* ----- (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"))
return fig_unspec;
return dwg_unspec;
if (!strcmp(s, "Input"))
return fig_in;
return dwg_in;
if (!strcmp(s, "Output"))
return fig_out;
return dwg_out;
if (!strcmp(s, "3State"))
return fig_tri;
return dwg_tri;
if (!strcmp(s, "BiDi"))
return fig_bidir;
return dwg_bidir;
fprintf(stderr, "unknown shape: \"%s\"\n", s);
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);
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,
enum fig_shape shape)
enum dwg_shape shape)
{
struct text txt = {
.s = s,
@ -259,19 +259,19 @@ static void dump_fields(struct sch_field *fields, int m[6])
/* ----- Sheet field ------------------------------------------------------- */
static enum fig_shape decode_form(char form)
static enum dwg_shape decode_form(char form)
{
switch (form) {
case 'O':
return fig_in;
return dwg_in;
case 'I':
return fig_out;
return dwg_out;
case 'B':
/* fall through */
case 'T':
return fig_bidir;
return dwg_bidir;
case 'U':
return fig_unspec;
return dwg_unspec;
default:
fprintf(stderr, "unknown form: \"%c\"\n", form);
exit(1);

View File

@ -16,6 +16,7 @@
#include <stdbool.h>
#include "dwg.h"
#include "text.h"
#include "lib.h"
@ -40,10 +41,10 @@ struct sch_ctx {
/* text */
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 dim; /* dimension */
enum fig_shape shape;
enum dwg_shape shape;
/* component */