1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-23 12:47:31 +02:00

sch2fig/sch.c, sch.h (decode_alignment): prepare for future sharing with lib.c

This commit is contained in:
Werner Almesberger 2016-07-26 20:34:12 -03:00
parent fb19aeae0a
commit 76013a5b04
2 changed files with 36 additions and 27 deletions

View File

@ -102,6 +102,38 @@ struct sch_field {
}; };
void decode_alignment(struct text *txt, char hor, char vert)
{
switch (hor) {
case 'L':
txt->hor = text_min;
break;
case 'C':
txt->hor = text_mid;
break;
case 'R':
txt->hor = text_max;
break;
default:
assert(0);
}
switch (vert) {
case 'B':
txt->vert = text_min;
break;
case 'C':
txt->vert = text_mid;
break;
case 'T':
txt->vert = text_max;
break;
default:
assert(0);
}
}
static bool parse_field(struct sch_ctx *ctx, const char *line) static bool parse_field(struct sch_ctx *ctx, const char *line)
{ {
int n; int n;
@ -161,33 +193,7 @@ static bool parse_field(struct sch_ctx *ctx, const char *line)
assert(0); assert(0);
} }
switch (hor) { decode_alignment(txt, hor, vert);
case 'L':
txt->hor = text_min;
break;
case 'C':
txt->hor = text_mid;
break;
case 'R':
txt->hor = text_max;
break;
default:
assert(0);
}
switch (vert) {
case 'B':
txt->vert = text_min;
break;
case 'C':
txt->vert = text_mid;
break;
case 'T':
txt->vert = text_max;
break;
default:
assert(0);
}
// @@@ decode font // @@@ decode font

View File

@ -16,6 +16,7 @@
#include <stdbool.h> #include <stdbool.h>
#include "text.h"
#include "lib.h" #include "lib.h"
@ -54,6 +55,8 @@ struct sch_ctx {
}; };
void decode_alignment(struct text *txt, char hor, char vert);
bool sch_parse(struct sch_ctx *ctx, const char *line); bool sch_parse(struct sch_ctx *ctx, const char *line);
void sch_init(struct sch_ctx *ctx); void sch_init(struct sch_ctx *ctx);