Skip to content
Extraits de code Groupes Projets
Valider a4d69e9e rédigé par Etienne BRATEAU's avatar Etienne BRATEAU
Parcourir les fichiers

Reindent loghier

parent d9cebc06
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -7,27 +7,27 @@ ...@@ -7,27 +7,27 @@
typedef short log_shintarray[log_million]; typedef short log_shintarray[log_million];
extern void hier_init (log_action_t *act); void hier_init (log_action_t *act);
extern int commandlabel (log_lrec *lp, char *cmd, char *args); int commandlabel (log_lrec *lp, char *cmd, char *args);
extern log_brec *labelbox (log_lrec *lp, int pg); log_brec *labelbox (log_lrec *lp, int pg);
extern int pointinbox (log_brec *bp, int x, int y); int pointinbox (log_brec *bp, int x, int y);
extern int gateinbox (log_brec *bp, log_grec *g); int gateinbox (log_brec *bp, log_grec *g);
extern int labelinbox (log_brec *bp, log_lrec *l); int labelinbox (log_brec *bp, log_lrec *l);
extern int boxinbox (log_brec *bp, log_brec *bp2); int boxinbox (log_brec *bp, log_brec *bp2);
extern int boxtouchbox (log_brec *bp, log_brec *bp2); int boxtouchbox (log_brec *bp, log_brec *bp2);
extern int isinstgate (log_grec *g); int isinstgate (log_grec *g);
extern int isgenericinstgate (log_grec *g); int isgenericinstgate (log_grec *g);
extern char *gateinstof (char *Result, log_grec *g); char *gateinstof (char *Result, log_grec *g);
extern char *gateinstname (char *Result, log_grec *g); char *gateinstname (char *Result, log_grec *g);
extern strlist_t *defndirectory (int pg); strlist_t *defndirectory (int pg);
extern void examinetemplate (log_grec *g, log_nrec **pp, long ppsize, void examinetemplate (log_grec *g, log_nrec **pp, long ppsize,
int isgeneric, short **pnum, long *lastnorth, int isgeneric, short **pnum, long *lastnorth,
long *lasteast, long *lastsouth, long *lasteast, long *lastsouth,
long *lastwest); long *lastwest);
extern void Log_7_ginst (log_action_t *act); void Log_7_ginst (log_action_t *act);
#endif /*LOGHIER_H*/ #endif /*LOGHIER_H*/
......
/* Output from p2c, the Pascal-to-C translator */
/* From input file "loghier.text" */
/* "LOG", the circuit editing and simulation system, /* "LOG", the circuit editing and simulation system,
"DigLOG", the digital simulator for LOG. "DigLOG", the digital simulator for LOG.
Copyright (C) 1985, 1990 David Gillespie. Copyright (C) 1985, 1990 David Gillespie.
...@@ -22,7 +18,8 @@ GNU General Public License for more details. ...@@ -22,7 +18,8 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*caged_process='newcom -g $F$M'*/ /*caged_process='newcom -g $F$M'*/
...@@ -42,19 +39,14 @@ static log_krec *attrkind; ...@@ -42,19 +39,14 @@ static log_krec *attrkind;
static short attrinstof, attrinstname; static short attrinstof, attrinstname;
void hier_init(log_action_t *act)
void hier_init(act)
log_action_t *act;
{ {
lact = act; lact = act;
attrkind = NULL; attrkind = NULL;
} }
int commandlabel(lp, cmd, args) int commandlabel(log_lrec *lp, char *cmd, char *args)
log_lrec *lp;
char *cmd, *args;
{ {
int Result; int Result;
long i, j; long i, j;
...@@ -64,32 +56,47 @@ char *cmd, *args; ...@@ -64,32 +56,47 @@ char *cmd, *args;
j = strlen(lp->name); j = strlen(lp->name);
while (i < j && lp->name[i - 1] == ' ') while (i < j && lp->name[i - 1] == ' ')
i++; i++;
if (i >= j) if (i >= j)
return Result; return Result;
while (j > i && lp->name[j - 1] == ' ') while (j > i && lp->name[j - 1] == ' ')
j--; j--;
if (lp->name[i - 1] == '"') {
if (lp->name[i - 1] == '"')
{
if (j <= i || lp->name[j - 1] != '"') if (j <= i || lp->name[j - 1] != '"')
return Result; return Result;
strpart(args, lp->name, (int)(i + 1), (int)(j - 1)); strpart(args, lp->name, (int)(i + 1), (int)(j - 1));
if (((char *) strpbrk(args, " \"")) == NULL) { if (((char *) strpbrk(args, " \"")) == NULL)
{
strcpy(cmd, "NAME"); strcpy(cmd, "NAME");
return true; return true;
} }
return Result; return Result;
} else { }
else
{
if (lp->name[i - 1] != '<' || lp->name[j - 1] != '>') if (lp->name[i - 1] != '<' || lp->name[j - 1] != '>')
return Result; return Result;
do { do
{
i++; i++;
} while (lp->name[i - 1] == ' '); }
do { while (lp->name[i - 1] == ' ');
do
{
j--; j--;
} while (lp->name[j - 1] == ' '); }
while (lp->name[j - 1] == ' ');
strpart(args, lp->name, (int)i, (int)j); strpart(args, lp->name, (int)i, (int)j);
i = 1; i = 1;
while (i <= strlen(args) && args[i - 1] != ':' && args[i - 1] != ' ') while (i <= strlen(args) && args[i - 1] != ':' && args[i - 1] != ' ')
i++; i++;
if (i <= strlen(args)) if (i <= strlen(args))
args[i - 1] = ' '; args[i - 1] = ' ';
strword(args, cmd); strword(args, cmd);
...@@ -100,25 +107,27 @@ char *cmd, *args; ...@@ -100,25 +107,27 @@ char *cmd, *args;
} }
log_brec *labelbox(log_lrec *lp, int pg)
log_brec *labelbox(lp, pg)
log_lrec *lp;
short pg;
{ {
log_brec *bp, *bp2; log_brec *bp, *bp2;
char STR2[256]; char STR2[256];
bp2 = NULL; bp2 = NULL;
bp = lact->pages[pg - 1]->bbase; bp = lact->pages[pg - 1]->bbase;
while (bp != NULL) { /*find smallest box containing the label*/ while (bp != NULL)
{ /*find smallest box containing the label*/
if (P_ibetween((long)bp->x1, (long)lp->x, (long)(bp->x2 - lp->w)) && if (P_ibetween((long)bp->x1, (long)lp->x, (long)(bp->x2 - lp->w)) &&
P_ibetween((long)bp->y1, (long)lp->y, (long)bp->y2)) { P_ibetween((long)bp->y1, (long)lp->y, (long)bp->y2))
{
if (bp2 == NULL || if (bp2 == NULL ||
(bp2->x1 <= bp->x1 && bp->x2 <= bp2->x2 && bp2->y1 <= bp->y1 && (bp2->x1 <= bp->x1 && bp->x2 <= bp2->x2 && bp2->y1 <= bp->y1 &&
bp->y2 <= bp2->y2)) bp->y2 <= bp2->y2))
{
bp2 = bp; bp2 = bp;
}
else if (bp->x1 > bp2->x1 || bp2->x2 > bp->x2 || bp->y1 > bp2->y1 || else if (bp->x1 > bp2->x1 || bp2->x2 > bp->x2 || bp->y1 > bp2->y1 ||
bp2->y2 > bp->y2) { bp2->y2 > bp->y2)
{
sprintf(STR2, "Warning: Label %s appears in more than one box", sprintf(STR2, "Warning: Label %s appears in more than one box",
lp->name); lp->name);
(*lact->hook.vmessage)(STR2); (*lact->hook.vmessage)(STR2);
...@@ -130,28 +139,21 @@ short pg; ...@@ -130,28 +139,21 @@ short pg;
} }
int pointinbox(log_brec *bp, int x, int y)
int pointinbox(bp, x, y)
log_brec *bp;
short x, y;
{ {
return (bp == NULL || (P_ibetween((long)bp->x1, (long)x, (long)bp->x2) && return (bp == NULL || (P_ibetween((long)bp->x1, (long)x, (long)bp->x2) &&
P_ibetween((long)bp->y1, (long)y, (long)bp->y2))); P_ibetween((long)bp->y1, (long)y, (long)bp->y2)));
} }
int gateinbox(bp, g) int gateinbox(log_brec *bp, log_grec *g)
log_brec *bp;
log_grec *g;
{ {
return (bp == NULL || (P_ibetween((long)bp->x1, (long)g->x, (long)bp->x2) && return (bp == NULL || (P_ibetween((long)bp->x1, (long)g->x, (long)bp->x2) &&
P_ibetween((long)bp->y1, (long)g->y, (long)bp->y2))); P_ibetween((long)bp->y1, (long)g->y, (long)bp->y2)));
} }
int labelinbox(bp, l) int labelinbox(log_brec *bp, log_lrec *l)
log_brec *bp;
log_lrec *l;
{ {
return (bp == NULL || return (bp == NULL ||
(P_ibetween((long)bp->x1, (long)l->x, (long)(bp->x2 - l->w)) && (P_ibetween((long)bp->x1, (long)l->x, (long)(bp->x2 - l->w)) &&
...@@ -159,16 +161,14 @@ log_lrec *l; ...@@ -159,16 +161,14 @@ log_lrec *l;
} }
int boxinbox(bp, bp2) int boxinbox(log_brec *bp, log_brec *bp2)
log_brec *bp, *bp2;
{ {
return (bp == NULL || (bp->x1 <= bp2->x1 && bp2->x2 <= bp->x2 && return (bp == NULL || (bp->x1 <= bp2->x1 && bp2->x2 <= bp->x2 &&
bp->y1 <= bp2->y1 && bp2->y2 <= bp->y2)); bp->y1 <= bp2->y1 && bp2->y2 <= bp->y2));
} }
int boxtouchbox(bp, bp2) int boxtouchbox(log_brec *bp, log_brec *bp2)
log_brec *bp, *bp2;
{ {
return (bp != NULL && bp2 != NULL && return (bp != NULL && bp2 != NULL &&
(P_ibetween((long)bp->x1, (long)bp2->x1, (long)bp->x2) || (P_ibetween((long)bp->x1, (long)bp2->x1, (long)bp->x2) ||
...@@ -178,9 +178,7 @@ log_brec *bp, *bp2; ...@@ -178,9 +178,7 @@ log_brec *bp, *bp2;
} }
int isinstgate(log_grec *g)
int isinstgate(g)
log_grec *g;
{ {
if (g->kind == attrkind) if (g->kind == attrkind)
return (attrinstof != 0 && *g->attr[attrinstof - 1].UU.c != '\0'); return (attrinstof != 0 && *g->attr[attrinstof - 1].UU.c != '\0');
...@@ -191,11 +189,11 @@ log_grec *g; ...@@ -191,11 +189,11 @@ log_grec *g;
} }
int isgenericinstgate(g) int isgenericinstgate(log_grec *g)
log_grec *g;
{ {
short num; short num;
if (isinstgate(g)) { if (isinstgate(g))
{
(*lact->hook2->findattrnum)(g->kind, "is-generic", "V", &num); (*lact->hook2->findattrnum)(g->kind, "is-generic", "V", &num);
if (num == 0 || g->attr[num - 1].UU.nv != 0) if (num == 0 || g->attr[num - 1].UU.nv != 0)
return true; return true;
...@@ -204,34 +202,33 @@ short num; ...@@ -204,34 +202,33 @@ short num;
} }
char *gateinstof(Result, g) char *gateinstof(char *Result, log_grec *g)
char *Result;
log_grec *g;
{ {
log_gattrrec *WITH; log_gattrrec *WITH;
if (isinstgate(g)) { if (isinstgate(g))
{
WITH = &g->attr[attrinstof - 1]; WITH = &g->attr[attrinstof - 1];
if (strlen(WITH->UU.c) > 2 && *WITH->UU.c == '"' && if (strlen(WITH->UU.c) > 2 && *WITH->UU.c == '"' &&
strends(WITH->UU.c, "\"")) strends(WITH->UU.c, "\""))
return (strpart(Result, WITH->UU.c, 2, (int)(strlen(WITH->UU.c) - 1L))); return (strpart(Result, WITH->UU.c, 2, (int)(strlen(WITH->UU.c) - 1L)));
else else
return strcpy(Result, WITH->UU.c); return strcpy(Result, WITH->UU.c);
} else
return strcpy(Result, g->kind->name);
} }
return strcpy(Result, g->kind->name);
}
char *gateinstname(Result, g) char *gateinstname(char *Result, log_grec *g)
char *Result; {
log_grec *g; if (g->kind != attrkind)
{ {
if (g->kind != attrkind) {
attrkind = g->kind; attrkind = g->kind;
(*lact->hook2->findattrnum)(g->kind, "inst-of", "CA", &attrinstof); (*lact->hook2->findattrnum)(g->kind, "inst-of", "CA", &attrinstof);
(*lact->hook2->findattrnum)(g->kind, "gate-name", "CA", &attrinstname); (*lact->hook2->findattrnum)(g->kind, "gate-name", "CA", &attrinstname);
} }
if (attrinstname > 0) if (attrinstname > 0)
return strcpy(Result, g->attr[attrinstname - 1].UU.c); return strcpy(Result, g->attr[attrinstname - 1].UU.c);
else else
...@@ -239,10 +236,8 @@ log_grec *g; ...@@ -239,10 +236,8 @@ log_grec *g;
} }
/* Find a list of all definitions on the page, sorted according to dependencies */ /* Find a list of all definitions on the page, sorted according to dependencies */
strlist_t *defndirectory(pg) strlist_t *defndirectory(int pg)
short pg;
{ {
char buf[256], buf2[256]; char buf[256], buf2[256];
strlist_t *dir, *l1, *l2, **lprev; strlist_t *dir, *l1, *l2, **lprev;
...@@ -260,14 +255,19 @@ short pg; ...@@ -260,14 +255,19 @@ short pg;
boxless = false; boxless = false;
numdefs = 0; numdefs = 0;
lp = lact->pages[pg - 1]->lbase; lp = lact->pages[pg - 1]->lbase;
while (lp != NULL) { while (lp != NULL)
{
if (commandlabel(lp, buf, buf2) && !strcmp(buf, "NAME") && if (commandlabel(lp, buf, buf2) && !strcmp(buf, "NAME") &&
*strcpy(STR1, strltrim(buf2)) != '\0' && *buf2 != '(') { *strcpy(STR1, strltrim(buf2)) != '\0' && *buf2 != '(')
if (strlist_cifind(dir, buf2) != NULL) { {
if (strlist_cifind(dir, buf2) != NULL)
{
sprintf(STR3, "More than one cell-name label for \"%s\"", buf2); sprintf(STR3, "More than one cell-name label for \"%s\"", buf2);
(*lact->hook.message)(STR3); (*lact->hook.message)(STR3);
errors = true; errors = true;
} else { }
else
{
bp = labelbox(lp, pg); bp = labelbox(lp, pg);
if (bp != NULL) if (bp != NULL)
boxed = true; boxed = true;
...@@ -275,14 +275,18 @@ short pg; ...@@ -275,14 +275,18 @@ short pg;
boxless = true; boxless = true;
lprev = &dir; lprev = &dir;
g = lact->pages[pg - 1]->gbase; g = lact->pages[pg - 1]->gbase;
while (g != NULL) { /*check inter-dependencies of definitions*/ while (g != NULL)
if (gateinbox(bp, g)) { { /*check inter-dependencies of definitions*/
if (gateinbox(bp, g))
{
gateinstof(buf, g); gateinstof(buf, g);
do { do
{
l1 = strlist_cifind(*lprev, buf); l1 = strlist_cifind(*lprev, buf);
if (l1 != NULL) if (l1 != NULL)
lprev = &l1->next; lprev = &l1->next;
} while (l1 != NULL); }
while (l1 != NULL);
} }
g = g->next; g = g->next;
} }
...@@ -293,7 +297,9 @@ short pg; ...@@ -293,7 +297,9 @@ short pg;
} }
lp = lp->next; lp = lp->next;
} }
if (boxless && numdefs > 1) {
if (boxless && numdefs > 1)
{
if (boxed) if (boxed)
(*lact->hook.message)("Not all definitions have boxes!"); (*lact->hook.message)("Not all definitions have boxes!");
else else
...@@ -301,36 +307,36 @@ short pg; ...@@ -301,36 +307,36 @@ short pg;
"More than one <name: xxx> or \"xxx\" label on the page!"); "More than one <name: xxx> or \"xxx\" label on the page!");
errors = true; errors = true;
} }
if (!boxless) {
if (!boxless)
{
l1 = dir; l1 = dir;
l2 = NULL; l2 = NULL;
while (l1 != NULL && l2 == NULL) { while (l1 != NULL && l2 == NULL)
{
l2 = l1->next; l2 = l1->next;
while (l2 != NULL && while (l2 != NULL &&
!boxtouchbox((log_brec *)l1->value, (log_brec *)l2->value)) !boxtouchbox((log_brec *)l1->value, (log_brec *)l2->value))
l2 = l2->next; l2 = l2->next;
l1 = l1->next; l1 = l1->next;
} }
if (l2 != NULL) {
if (l2 != NULL)
{
(*lact->hook.message)("Definition boxes intersect!"); (*lact->hook.message)("Definition boxes intersect!");
errors = true; errors = true;
} }
} }
if (errors) if (errors)
strlist_empty(&dir); strlist_empty(&dir);
return dir; return dir;
} }
void examinetemplate(log_grec *g, log_nrec **pp, long ppsize, int isgeneric, short **pnum, long *lastnorth, long *lasteast,
void examinetemplate(g, pp, ppsize, isgeneric, pnum, lastnorth, lasteast, long *lastsouth, long *lastwest)
lastsouth, lastwest)
log_grec *g;
log_nrec **pp;
long ppsize;
int isgeneric;
short **pnum;
long *lastnorth, *lasteast, *lastsouth, *lastwest;
{ {
long i, j; long i, j;
short xx1, xx2; short xx1, xx2;
...@@ -343,85 +349,112 @@ long *lastnorth, *lasteast, *lastsouth, *lastwest; ...@@ -343,85 +349,112 @@ long *lastnorth, *lasteast, *lastsouth, *lastwest;
xx2 = P_imax2((kind->x2 - 1L) / log_scale0, (long)xx1); xx2 = P_imax2((kind->x2 - 1L) / log_scale0, (long)xx1);
if (*pnum == NULL) if (*pnum == NULL)
*pnum = Malloc(kind->numpins * 2); *pnum = Malloc(kind->numpins * 2);
numrefs = (short *)Malloc(kind->numpins * 2); numrefs = (short *)Malloc(kind->numpins * 2);
FORLIM = kind->numpins; FORLIM = kind->numpins;
for (i = 0; i < FORLIM; i++) for (i = 0; i < FORLIM; i++)
numrefs[i] = 1; numrefs[i] = 1;
FORLIM = kind->numpins; FORLIM = kind->numpins;
for (i = 0; i < FORLIM; i++) { for (i = 0; i < FORLIM; i++)
if (numrefs[i] == 1) { {
if (numrefs[i] == 1)
{
j = kind->pin[i].c; j = kind->pin[i].c;
while (j != 0 && j != i + 1) { while (j != 0 && j != i + 1)
{
numrefs[i]++; numrefs[i]++;
numrefs[j - 1] = 32767; numrefs[j - 1] = 32767;
j = kind->pin[j - 1].c; j = kind->pin[j - 1].c;
} }
} }
} }
if (isgeneric) {
if (isgeneric)
{
*lastnorth = 0; *lastnorth = 0;
FORLIM = kind->numpins; FORLIM = kind->numpins;
for (i = 1; i <= FORLIM; i++) { for (i = 1; i <= FORLIM; i++)
{
if (g->pin[i - 1]->ref > numrefs[i - 1] && if (g->pin[i - 1]->ref > numrefs[i - 1] &&
P_ibetween((long)xx1, (long)kind->pin[i - 1].x, (long)xx2) && P_ibetween((long)xx1, (long)kind->pin[i - 1].x, (long)xx2) &&
kind->pin[i - 1].y <= 0) { kind->pin[i - 1].y <= 0)
{
(*lastnorth)++; (*lastnorth)++;
j = *lastnorth; j = *lastnorth;
while (j > 1 && kind->pin[(*pnum)[j - 2] - 1].x > kind->pin[i - 1].x) { while (j > 1 && kind->pin[(*pnum)[j - 2] - 1].x > kind->pin[i - 1].x)
{
(*pnum)[j - 1] = (*pnum)[j - 2]; (*pnum)[j - 1] = (*pnum)[j - 2];
j--; j--;
} }
(*pnum)[j - 1] = i; (*pnum)[j - 1] = i;
} }
} }
*lasteast = *lastnorth; *lasteast = *lastnorth;
FORLIM = kind->numpins; FORLIM = kind->numpins;
for (i = 1; i <= FORLIM; i++) { for (i = 1; i <= FORLIM; i++)
if (g->pin[i - 1]->ref > numrefs[i - 1] && kind->pin[i - 1].x > xx2) { {
if (g->pin[i - 1]->ref > numrefs[i - 1] && kind->pin[i - 1].x > xx2)
{
(*lasteast)++; (*lasteast)++;
j = *lasteast; j = *lasteast;
while (j > *lastnorth + 1 && while (j > *lastnorth + 1 &&
kind->pin[(*pnum)[j - 2] - 1].y > kind->pin[i - 1].y) { kind->pin[(*pnum)[j - 2] - 1].y > kind->pin[i - 1].y)
{
(*pnum)[j - 1] = (*pnum)[j - 2]; (*pnum)[j - 1] = (*pnum)[j - 2];
j--; j--;
} }
(*pnum)[j - 1] = i; (*pnum)[j - 1] = i;
} }
} }
*lastsouth = *lasteast; *lastsouth = *lasteast;
FORLIM = kind->numpins; FORLIM = kind->numpins;
for (i = 1; i <= FORLIM; i++) { for (i = 1; i <= FORLIM; i++)
{
if (g->pin[i - 1]->ref > numrefs[i - 1] && if (g->pin[i - 1]->ref > numrefs[i - 1] &&
P_ibetween((long)xx1, (long)kind->pin[i - 1].x, (long)xx2) && P_ibetween((long)xx1, (long)kind->pin[i - 1].x, (long)xx2) &&
kind->pin[i - 1].y > 0) { kind->pin[i - 1].y > 0)
{
(*lastsouth)++; (*lastsouth)++;
j = *lastsouth; j = *lastsouth;
while (j > *lasteast + 1 && while (j > *lasteast + 1 &&
kind->pin[(*pnum)[j - 2] - 1].x < kind->pin[i - 1].x) { kind->pin[(*pnum)[j - 2] - 1].x < kind->pin[i - 1].x)
{
(*pnum)[j - 1] = (*pnum)[j - 2]; (*pnum)[j - 1] = (*pnum)[j - 2];
j--; j--;
} }
(*pnum)[j - 1] = i; (*pnum)[j - 1] = i;
} }
} }
*lastwest = *lastsouth; *lastwest = *lastsouth;
FORLIM = kind->numpins; FORLIM = kind->numpins;
for (i = 1; i <= FORLIM; i++) { for (i = 1; i <= FORLIM; i++)
if (g->pin[i - 1]->ref > numrefs[i - 1] && kind->pin[i - 1].x < xx1) { {
if (g->pin[i - 1]->ref > numrefs[i - 1] && kind->pin[i - 1].x < xx1)
{
(*lastwest)++; (*lastwest)++;
j = *lastwest; j = *lastwest;
while (j > *lastsouth + 1 && while (j > *lastsouth + 1 &&
kind->pin[(*pnum)[j - 2] - 1].y < kind->pin[i - 1].y) { kind->pin[(*pnum)[j - 2] - 1].y < kind->pin[i - 1].y)
{
(*pnum)[j - 1] = (*pnum)[j - 2]; (*pnum)[j - 1] = (*pnum)[j - 2];
j--; j--;
} }
(*pnum)[j - 1] = i; (*pnum)[j - 1] = i;
} }
} }
} else { }
else
{
j = 0; j = 0;
for (i = 1; i <= ppsize; i++) { for (i = 1; i <= ppsize; i++)
if (numrefs[i - 1] < 32767) { {
if (numrefs[i - 1] < 32767)
{
j++; j++;
(*pnum)[j - 1] = i; (*pnum)[j - 1] = i;
} }
...@@ -431,11 +464,14 @@ long *lastnorth, *lasteast, *lastsouth, *lastwest; ...@@ -431,11 +464,14 @@ long *lastnorth, *lasteast, *lastsouth, *lastwest;
*lastsouth = 0; *lastsouth = 0;
*lastwest = j; *lastwest = j;
} }
if (pp != NULL) {
if (pp != NULL)
{
FORLIM = P_imin2(*lastwest, ppsize); FORLIM = P_imin2(*lastwest, ppsize);
for (i = 0; i < FORLIM; i++) for (i = 0; i < FORLIM; i++)
pp[i] = g->pin[(*pnum)[i] - 1]; pp[i] = g->pin[(*pnum)[i] - 1];
} }
Free(numrefs); Free(numrefs);
} }
...@@ -447,11 +483,7 @@ typedef struct ginstinfo { ...@@ -447,11 +483,7 @@ typedef struct ginstinfo {
} ginstinfo; } ginstinfo;
void Log_7_ginst(log_action_t *act)
void Log_7_ginst(act)
log_action_t *act;
{ {
ginstinfo *ii; ginstinfo *ii;
char newname[256]; char newname[256];
...@@ -466,7 +498,8 @@ log_action_t *act; ...@@ -466,7 +498,8 @@ log_action_t *act;
char STR3[256]; char STR3[256];
WITH = act; WITH = act;
switch (WITH->action) { switch (WITH->action)
{
case act_newgate: case act_newgate:
case act_copygate: case act_copygate:
...@@ -491,9 +524,11 @@ log_action_t *act; ...@@ -491,9 +524,11 @@ log_action_t *act;
case act_configchgate: case act_configchgate:
WITH1 = &WITH->actgate->attr[WITH->actx - 1]; WITH1 = &WITH->actgate->attr[WITH->actx - 1];
ii = (ginstinfo *)WITH->actgate->info; ii = (ginstinfo *)WITH->actgate->info;
if (WITH->actx == ii->instattr) { if (WITH->actx == ii->instattr)
{
if (*WITH1->UU.c != '\0' && *WITH1->UU.c != '"' && if (*WITH1->UU.c != '\0' && *WITH1->UU.c != '"' &&
!strends(WITH1->UU.c, "\"")) { !strends(WITH1->UU.c, "\""))
{
sprintf(STR2, "\"%s\"", WITH1->UU.c); sprintf(STR2, "\"%s\"", WITH1->UU.c);
(*WITH->hook2->setgattr)(WITH->actgate, (int)WITH->actx, STR2); (*WITH->hook2->setgattr)(WITH->actgate, (int)WITH->actx, STR2);
} }
...@@ -501,11 +536,13 @@ log_action_t *act; ...@@ -501,11 +536,13 @@ log_action_t *act;
break; break;
case act_pass: case act_pass:
if (WITH->actgate != NULL && WITH->actflag) { if (WITH->actgate != NULL && WITH->actflag)
{
ii = (ginstinfo *)WITH->actgate->info; ii = (ginstinfo *)WITH->actgate->info;
WITH2 = WITH->actgate; WITH2 = WITH->actgate;
WITH3 = ii; WITH3 = ii;
if (WITH->gattrstamp != WITH3->oldgattrstamp) { if (WITH->gattrstamp != WITH3->oldgattrstamp)
{
WITH3->oldgattrstamp = WITH->gattrstamp; WITH3->oldgattrstamp = WITH->gattrstamp;
if (WITH3->nameattr > 0 && if (WITH3->nameattr > 0 &&
*WITH2->attr[WITH3->nameattr - 1].UU.c != '\0') *WITH2->attr[WITH3->nameattr - 1].UU.c != '\0')
...@@ -516,26 +553,38 @@ log_action_t *act; ...@@ -516,26 +553,38 @@ log_action_t *act;
(int)(strlen(WITH2->attr[WITH3->instattr - 1].UU.c) - 1L)); (int)(strlen(WITH2->attr[WITH3->instattr - 1].UU.c) - 1L));
else else
*newname = '\0'; *newname = '\0';
if (*newname != '\0') {
if (WITH3->dispattr == 0 || WITH2->attr[WITH3->dispattr - 1].blnk) { if (*newname != '\0')
if (WITH2->rot & 1) { {
if (WITH3->dispattr == 0 || WITH2->attr[WITH3->dispattr - 1].blnk)
{
if (WITH2->rot & 1)
{
if (m_strwidth(NULL, newname) > if (m_strwidth(NULL, newname) >
WITH2->kind->y2 - WITH2->kind->y1 - 3) WITH2->kind->y2 - WITH2->kind->y1 - 3)
*newname = '\0'; *newname = '\0';
} else { }
else
{
if (m_strwidth(NULL, newname) > if (m_strwidth(NULL, newname) >
WITH2->kind->x2 - WITH2->kind->x1 - 3) WITH2->kind->x2 - WITH2->kind->x1 - 3)
*newname = '\0'; *newname = '\0';
} }
} else if (!WITH2->attr[WITH3->dispattr - 1].UU.b) }
else if (!WITH2->attr[WITH3->dispattr - 1].UU.b)
{
*newname = '\0'; *newname = '\0';
} }
}
if (*newname == '\0') if (*newname == '\0')
drawflag = (WITH3->wasdrawn != NULL); drawflag = (WITH3->wasdrawn != NULL);
else else
drawflag = (WITH3->wasdrawn == NULL || drawflag = (WITH3->wasdrawn == NULL ||
strcmp(WITH3->wasdrawn, newname)); strcmp(WITH3->wasdrawn, newname));
if (drawflag && WITH3->wasdrawn != NULL) {
if (drawflag && WITH3->wasdrawn != NULL)
{
drawx = 0; drawx = 0;
drawy = 0; drawy = 0;
(*WITH->hook.xform)(WITH->actgate, &drawx, &drawy); (*WITH->hook.xform)(WITH->actgate, &drawx, &drawy);
...@@ -544,15 +593,22 @@ log_action_t *act; ...@@ -544,15 +593,22 @@ log_action_t *act;
m_centerstr((long)drawx, drawy - 4L, NULL, WITH3->wasdrawn); m_centerstr((long)drawx, drawy - 4L, NULL, WITH3->wasdrawn);
(*WITH->hook.unhidecursor)(); (*WITH->hook.unhidecursor)();
} }
if (drawflag) {
if (drawflag)
{
if (*newname == '\0') if (*newname == '\0')
strdispose(&WITH3->wasdrawn); strdispose(&WITH3->wasdrawn);
else else
strchange(&WITH3->wasdrawn, newname); strchange(&WITH3->wasdrawn, newname);
} }
} else }
else
{
drawflag = false; drawflag = false;
if ((drawflag || WITH->refrflag) && WITH3->wasdrawn != NULL) { }
if ((drawflag || WITH->refrflag) && WITH3->wasdrawn != NULL)
{
drawx = 0; drawx = 0;
drawy = 0; drawy = 0;
(*WITH->hook.xform)(WITH->actgate, &drawx, &drawy); (*WITH->hook.xform)(WITH->actgate, &drawx, &drawy);
...@@ -566,7 +622,8 @@ log_action_t *act; ...@@ -566,7 +622,8 @@ log_action_t *act;
case act_erasegate: case act_erasegate:
ii = (ginstinfo *)WITH->actgate->info; ii = (ginstinfo *)WITH->actgate->info;
if (ii->wasdrawn != NULL) { if (ii->wasdrawn != NULL)
{
drawx = 0; drawx = 0;
drawy = 0; drawy = 0;
(*WITH->hook.xform)(WITH->actgate, &drawx, &drawy); (*WITH->hook.xform)(WITH->actgate, &drawx, &drawy);
...@@ -578,7 +635,8 @@ log_action_t *act; ...@@ -578,7 +635,8 @@ log_action_t *act;
break; break;
case act_gengate: case act_gengate:
if (!strcmp(WITH->genfunc, "PLOT") && WITH->actgate != NULL) { if (!strcmp(WITH->genfunc, "PLOT") && WITH->actgate != NULL)
{
ii = (ginstinfo *)WITH->actgate->info; ii = (ginstinfo *)WITH->actgate->info;
if (ii->wasdrawn != NULL) { if (ii->wasdrawn != NULL) {
sl1 = strlist_append(&WITH->actstrlist, "color gate"); sl1 = strlist_append(&WITH->actstrlist, "color gate");
...@@ -596,14 +654,3 @@ log_action_t *act; ...@@ -596,14 +654,3 @@ log_action_t *act;
} }
} }
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter