mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-27 02:49:22 +02:00
sch2fig/: add unit letter(s) to component reference of multi-unit components
This commit is contained in:
parent
f3abf8f622
commit
c2e1d60e2e
@ -4,7 +4,6 @@
|
|||||||
- unify alignment, direction
|
- unify alignment, direction
|
||||||
- support fonts attributes ?
|
- support fonts attributes ?
|
||||||
- support line thickness ?
|
- support line thickness ?
|
||||||
- show unit in component reference
|
|
||||||
- ~ as space (grep for ~ in out.fig)
|
- ~ as space (grep for ~ in out.fig)
|
||||||
- ~ as overline (grep for ~ in out.fig)
|
- ~ as overline (grep for ~ in out.fig)
|
||||||
- support pin name not inside component
|
- support pin name not inside component
|
||||||
|
@ -92,19 +92,6 @@ struct obj {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct comp {
|
|
||||||
const char *name;
|
|
||||||
|
|
||||||
unsigned visible; /* visible fields, bit mask */
|
|
||||||
bool show_pin_name;
|
|
||||||
bool show_pin_num;
|
|
||||||
unsigned name_offset;
|
|
||||||
|
|
||||||
struct obj *objs;
|
|
||||||
struct comp *next;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* ----- Drawing ----------------------------------------------------------- */
|
/* ----- Drawing ----------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
@ -436,15 +423,17 @@ static bool parse_def(const char *line)
|
|||||||
char *s;
|
char *s;
|
||||||
char draw_num, draw_name;
|
char draw_num, draw_name;
|
||||||
unsigned name_offset;
|
unsigned name_offset;
|
||||||
|
unsigned units;
|
||||||
|
|
||||||
if (sscanf(line, "DEF %ms %*s %*d %u %c %c",
|
if (sscanf(line, "DEF %ms %*s %*d %u %c %c %u",
|
||||||
&s, &name_offset, &draw_num, &draw_name) != 4)
|
&s, &name_offset, &draw_num, &draw_name, &units) != 5)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
curr_comp = alloc_type(struct comp);
|
curr_comp = alloc_type(struct comp);
|
||||||
if (*s == '~')
|
if (*s == '~')
|
||||||
s++;
|
s++;
|
||||||
curr_comp->name = s;
|
curr_comp->name = s;
|
||||||
|
curr_comp->units = units;
|
||||||
|
|
||||||
curr_comp->visible = 0;
|
curr_comp->visible = 0;
|
||||||
curr_comp->show_pin_name = draw_name == 'Y';
|
curr_comp->show_pin_name = draw_name == 'Y';
|
||||||
|
@ -28,7 +28,21 @@ struct lib_ctx {
|
|||||||
unsigned lineno;
|
unsigned lineno;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct comp;
|
struct obj;
|
||||||
|
|
||||||
|
struct comp {
|
||||||
|
const char *name;
|
||||||
|
unsigned units;
|
||||||
|
|
||||||
|
unsigned visible; /* visible fields, bit mask */
|
||||||
|
bool show_pin_name;
|
||||||
|
bool show_pin_num;
|
||||||
|
unsigned name_offset;
|
||||||
|
|
||||||
|
struct obj *objs;
|
||||||
|
struct comp *next;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const struct comp *lib_find(const char *name);
|
const struct comp *lib_find(const char *name);
|
||||||
|
@ -122,6 +122,24 @@ static bool parse_field(struct sch_ctx *ctx, const char *line)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (n == 0 && ctx->comp->units > 1) {
|
||||||
|
int len = strlen(txt->s);
|
||||||
|
char *s;
|
||||||
|
|
||||||
|
s = realloc((void *) txt->s, len + 3);
|
||||||
|
if (!s) {
|
||||||
|
perror("realloc");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (ctx->unit <= 26)
|
||||||
|
sprintf(s + len, "%c", 'A' + ctx->unit - 1);
|
||||||
|
else
|
||||||
|
sprintf(s + len, "%c%c",
|
||||||
|
'A' + (ctx->unit - 1) / 26 - 1,
|
||||||
|
'A' + (ctx->unit - 1) % 26);
|
||||||
|
txt->s = s;
|
||||||
|
}
|
||||||
|
|
||||||
field->next = ctx->fields;
|
field->next = ctx->fields;
|
||||||
ctx->fields = field;
|
ctx->fields = field;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user