1
0
mirror of https://github.com/fachat/xa65.git synced 2025-01-16 03:30:19 +00:00

Fix ca65 unnamed labels to work across blocks (according to the ca65

creator U. v. Bassewitz, this is intentional)
This commit is contained in:
fachat 2012-07-30 13:22:57 +02:00
parent 451e446016
commit f296538a90
2 changed files with 5 additions and 41 deletions

View File

@ -189,41 +189,6 @@ int cll_getcur() {
return cll_current; return cll_current;
} }
/**********************************************************************************
* unnamed labels
*/
#if 0
static int unn_current = 0; /* the current cheap local labels block */
/**
* init the cheap local labels
*/
void unn_init() {
unn_current = 0;
}
/**
* get the block number for a new cheap local label block
*/
int unn_get() {
if (unn_current == 0) {
unn_current = b_new();
}
return unn_current;
}
/**
* clear the local labels
*/
void unn_clear() {
unn_current = 0;
}
int unn_getcur() {
return cll_current;
}
#endif
/**********************************************************************************/ /**********************************************************************************/
/** /**
@ -748,7 +713,7 @@ int l_write(FILE *fp)
* a specific block number is contained in the current block stack. * a specific block number is contained in the current block stack.
*/ */
static int bt[MAXBLK]; /* block stack */ static int bt[MAXBLK]; /* block stack */
static int labind[MAXBLK]; /* last allocated label (as index) for the current block, -1 none yet alloc'd */ static int labind; /* last allocated label, -1 none yet alloc'd - used for linking to find unnamed labels */
static int bi; /* length of the block stack (minus 1, i.e. bi[bi] has the innermost block) */ static int bi; /* length of the block stack (minus 1, i.e. bi[bi] has the innermost block) */
static int blk; /* current block number for allocation */ static int blk; /* current block number for allocation */
@ -757,7 +722,7 @@ int b_init(void)
blk =0; blk =0;
bi =0; bi =0;
bt[bi]=blk; bt[bi]=blk;
labind[bi]=-1; labind=-1;
return(E_OK); return(E_OK);
} }
@ -788,7 +753,6 @@ int b_open(void)
{ {
bi++; bi++;
bt[bi]=b_new(); bt[bi]=b_new();
labind[bi] = -1;
er=E_OK; er=E_OK;
} }
@ -874,9 +838,9 @@ static int b_ltest(int a, int b) /* testet ob bt^-1(b) in intervall [0,bt^-1(
} }
int b_link(int newlab) { int b_link(int newlab) {
int tmp = labind[bi]; int tmp = labind;
//printf("b_link: old was %d, set to %d\n", tmp, newlab); //printf("b_link: old was %d, set to %d\n", tmp, newlab);
labind[bi] = newlab; labind = newlab;
return tmp; return tmp;
} }

View File

@ -18,7 +18,7 @@ unnamed1: unnamed1.a65
unnamed2: unnamed2.a65 unnamed2: unnamed2.a65
#${CA65} $<; ${LD65} -t none -o unnamed2.ca65 unnamed2.o; rm unnamed2.o #${CA65} $<; ${LD65} -t none -o unnamed2.ca65 unnamed2.o; rm unnamed2.o
${XA} -XCA65 $< 2>a.err || true ${XA} -XCA65 $< 2>a.err || true
cmp unnamed2.err a.err cmp unnamed2.ca65 a.o65
escape1: escape1.a65 escape1: escape1.a65
${XA} $< ${XA} $<