mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-11-16 21:07:56 +00:00
Fixed problem with automatic C-file loading included the same file twice. Closes #697
This commit is contained in:
parent
f01db23d0d
commit
ce8e34b16a
@ -1,4 +1,4 @@
|
||||
//KICKC FRAGMENT CACHE 81e098389 81e09a3d7
|
||||
//KICKC FRAGMENT CACHE 81bc8cd4f 81bc8edac
|
||||
//FRAGMENT vbuzz=vbuc1
|
||||
ldz #{c1}
|
||||
//FRAGMENT vbuzz_lt_vbuc1_then_la1
|
||||
|
@ -1,4 +1,4 @@
|
||||
//KICKC FRAGMENT CACHE 81e098389 81e09a3d7
|
||||
//KICKC FRAGMENT CACHE 81bc8cd4f 81bc8edac
|
||||
//FRAGMENT _deref_pbuc1=vbuc2
|
||||
lda #{c2}
|
||||
sta {c1}
|
||||
|
@ -1,4 +1,4 @@
|
||||
//KICKC FRAGMENT CACHE 81e098389 81e09a3d7
|
||||
//KICKC FRAGMENT CACHE 81bc8cd4f 81bc8edac
|
||||
//FRAGMENT vbuz1=vbuc1
|
||||
lda #{c1}
|
||||
sta {z1}
|
||||
|
@ -1,4 +1,4 @@
|
||||
//KICKC FRAGMENT CACHE 81e098389 81e09a3d7
|
||||
//KICKC FRAGMENT CACHE 81bc8cd4f 81bc8edac
|
||||
//FRAGMENT vbuz1=vbuc1
|
||||
lda #{c1}
|
||||
sta {z1}
|
||||
@ -3594,6 +3594,26 @@ sta {z1}+1
|
||||
//FRAGMENT vwuz1=vwuz1_rol_1
|
||||
asl {z1}
|
||||
rol {z1}+1
|
||||
//FRAGMENT pssz1=pssc1
|
||||
lda #<{c1}
|
||||
sta {z1}
|
||||
lda #>{c1}
|
||||
sta {z1}+1
|
||||
//FRAGMENT pbuz1=qbuz2_derefidx_vbuc1
|
||||
ldy #{c1}
|
||||
lda ({z2}),y
|
||||
sta {z1}
|
||||
iny
|
||||
lda ({z2}),y
|
||||
sta {z1}+1
|
||||
//FRAGMENT pssz1=pssz1_plus_vbuc1
|
||||
lda #{c1}
|
||||
clc
|
||||
adc {z1}
|
||||
sta {z1}
|
||||
bcc !+
|
||||
inc {z1}+1
|
||||
!:
|
||||
//FRAGMENT vwuz1=_deref_pwuc1_minus_vwuc2
|
||||
sec
|
||||
lda {c1}
|
||||
@ -8688,18 +8708,6 @@ tax
|
||||
lda {c1}
|
||||
eor #$ff
|
||||
tay
|
||||
//FRAGMENT pssz1=pssc1
|
||||
lda #<{c1}
|
||||
sta {z1}
|
||||
lda #>{c1}
|
||||
sta {z1}+1
|
||||
//FRAGMENT pbuz1=qbuz2_derefidx_vbuc1
|
||||
ldy #{c1}
|
||||
lda ({z2}),y
|
||||
sta {z1}
|
||||
iny
|
||||
lda ({z2}),y
|
||||
sta {z1}+1
|
||||
//FRAGMENT vwuz1=pwuz2_derefidx_vbuc1
|
||||
ldy #{c1}
|
||||
lda ({z2}),y
|
||||
@ -8707,14 +8715,6 @@ sta {z1}
|
||||
iny
|
||||
lda ({z2}),y
|
||||
sta {z1}+1
|
||||
//FRAGMENT pssz1=pssz1_plus_vbuc1
|
||||
lda #{c1}
|
||||
clc
|
||||
adc {z1}
|
||||
sta {z1}
|
||||
bcc !+
|
||||
inc {z1}+1
|
||||
!:
|
||||
//FRAGMENT _deref_pwsc1=vwsc2
|
||||
lda #<{c2}
|
||||
sta {c1}
|
||||
|
@ -1,4 +1,4 @@
|
||||
//KICKC FRAGMENT CACHE 81e098389 81e09a3d7
|
||||
//KICKC FRAGMENT CACHE 81bc8cd4f 81bc8edac
|
||||
//FRAGMENT _deref_pbuc1=_inc__deref_pbuc1
|
||||
inc {c1}
|
||||
//FRAGMENT isr_hardware_all_entry
|
||||
|
@ -1,4 +1,4 @@
|
||||
//KICKC FRAGMENT CACHE 81e098389 81e09a3d7
|
||||
//KICKC FRAGMENT CACHE 81bc8cd4f 81bc8edac
|
||||
//FRAGMENT vbuz1=_deref_pbuc1
|
||||
lda {c1}
|
||||
sta {z1}
|
||||
|
@ -228,19 +228,20 @@ public class CParser {
|
||||
return null;
|
||||
else
|
||||
throw new CompileError("File not found " + fileName);
|
||||
Path filePath = file.toPath().toAbsolutePath().normalize();
|
||||
List<String> included = program.getLoadedFiles();
|
||||
if(included.contains(file.getAbsolutePath())) {
|
||||
if(included.contains(filePath.toString())) {
|
||||
return null;
|
||||
}
|
||||
final CharStream fileStream = CharStreams.fromPath(file.toPath().toAbsolutePath());
|
||||
included.add(file.getAbsolutePath());
|
||||
final CharStream fileStream = CharStreams.fromPath(filePath);
|
||||
included.add(filePath.toString());
|
||||
if(program.getLog().isVerboseParse()) {
|
||||
program.getLog().append("PARSING " + file.getPath().replace("\\", "/"));
|
||||
program.getLog().append("PARSING " + filePath.toString().replace("\\", "/"));
|
||||
program.getLog().append(fileStream.toString());
|
||||
}
|
||||
KickCLexer lexer = makeLexer(fileStream);
|
||||
CFile cFile = new CFile(file, lexer);
|
||||
cFiles.put(file.getAbsolutePath(), cFile);
|
||||
cFiles.put(filePath.toString(), cFile);
|
||||
return lexer;
|
||||
} catch(IOException e) {
|
||||
throw new CompileError("Error parsing file " + fileName, e);
|
||||
|
Loading…
Reference in New Issue
Block a user