1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-10-04 10:20:24 +03: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)
{
int n;
@ -161,33 +193,7 @@ static bool parse_field(struct sch_ctx *ctx, const char *line)
assert(0);
}
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);
}
decode_alignment(txt, hor, vert);
// @@@ decode font

View File

@ -16,6 +16,7 @@
#include <stdbool.h>
#include "text.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);
void sch_init(struct sch_ctx *ctx);