mirror of
https://github.com/irmen/prog8.git
synced 2024-12-26 14:29:35 +00:00
removed %target directive (didn't add much, too confusing, only supported single target)
This commit is contained in:
parent
d9ab2f8b90
commit
fd1f30f92b
@ -4,7 +4,6 @@
|
||||
;
|
||||
; indent format: TABS, size=8
|
||||
|
||||
%target c64
|
||||
%option enable_floats
|
||||
|
||||
floats {
|
||||
|
@ -1,4 +1,3 @@
|
||||
%target c64
|
||||
%import textio
|
||||
|
||||
; bitmap pixel graphics module for the C64
|
||||
|
@ -5,8 +5,6 @@
|
||||
;
|
||||
; indent format: TABS, size=8
|
||||
|
||||
%target c64
|
||||
|
||||
c64 {
|
||||
&ubyte TIME_HI = $a0 ; software jiffy clock, hi byte
|
||||
&ubyte TIME_MID = $a1 ; .. mid byte
|
||||
|
@ -4,7 +4,6 @@
|
||||
;
|
||||
; indent format: TABS, size=8
|
||||
|
||||
%target c64
|
||||
%import syslib
|
||||
%import conv
|
||||
|
||||
|
@ -4,7 +4,6 @@
|
||||
;
|
||||
; indent format: TABS, size=8
|
||||
|
||||
%target cx16
|
||||
%option enable_floats
|
||||
|
||||
floats {
|
||||
|
@ -1,5 +1,3 @@
|
||||
%target cx16
|
||||
|
||||
; Bitmap pixel graphics routines for the CommanderX16
|
||||
; Custom routines to use the full-screen 640x480 and 320x240 screen modes.
|
||||
; (These modes are not supported by the documented GRAPH_xxxx kernal routines)
|
||||
|
@ -1,4 +1,3 @@
|
||||
%target cx16
|
||||
%import syslib
|
||||
%import textio
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
%target cx16
|
||||
|
||||
; Manipulate the Commander X16's display color palette.
|
||||
; Should you want to restore the default palette, you have to reinitialize the Vera yourself.
|
||||
|
||||
|
@ -5,9 +5,6 @@
|
||||
;
|
||||
; indent format: TABS, size=8
|
||||
|
||||
%target cx16
|
||||
|
||||
|
||||
c64 {
|
||||
|
||||
; ---- kernal routines, these are the same as on the Commodore-64 (hence the same block name) ----
|
||||
|
@ -4,7 +4,6 @@
|
||||
;
|
||||
; indent format: TABS, size=8
|
||||
|
||||
%target cx16
|
||||
%import syslib
|
||||
%import conv
|
||||
|
||||
|
@ -714,14 +714,6 @@ internal class AstChecker(private val program: Program,
|
||||
else if(directive.args.map{it.name in setOf("enable_floats", "force_output", "no_sysinit", "align_word", "align_page")}.any { !it })
|
||||
err("invalid option directive argument(s)")
|
||||
}
|
||||
"%target" -> {
|
||||
if(directive.parent !is Block && directive.parent !is Module)
|
||||
err("this directive may only occur in a block or at module level")
|
||||
if(directive.args.size != 1)
|
||||
err("directive requires one argument")
|
||||
if(directive.args.single().name !in setOf(C64Target.name, Cx16Target.name))
|
||||
err("invalid compilation target")
|
||||
}
|
||||
else -> throw SyntaxError("invalid directive ${directive.directive}", directive.position)
|
||||
}
|
||||
super.visit(directive)
|
||||
|
@ -33,16 +33,6 @@ internal class AstIdentifiersChecker(private val program: Program, private val e
|
||||
super.visit(block)
|
||||
}
|
||||
|
||||
override fun visit(directive: Directive) {
|
||||
if(directive.directive=="%target") {
|
||||
val compatibleTarget = directive.args.single().name
|
||||
if (compatibleTarget != compTarget.name)
|
||||
errors.err("module's compilation target ($compatibleTarget) differs from active target (${compTarget.name})", directive.position)
|
||||
}
|
||||
|
||||
super.visit(directive)
|
||||
}
|
||||
|
||||
override fun visit(decl: VarDecl) {
|
||||
decl.datatypeErrors.forEach { errors.err(it.message, it.position) }
|
||||
|
||||
|
@ -135,7 +135,7 @@ class ModuleImporter(private val program: Program,
|
||||
|
||||
private fun removeDirectivesFromImportedModule(importedModule: Module) {
|
||||
// Most global directives don't apply for imported modules, so remove them
|
||||
val moduleLevelDirectives = listOf("%output", "%launcher", "%zeropage", "%zpreserved", "%address", "%target")
|
||||
val moduleLevelDirectives = listOf("%output", "%launcher", "%zeropage", "%zpreserved", "%address")
|
||||
var directives = importedModule.statements.filterIsInstance<Directive>()
|
||||
importedModule.statements.removeAll(directives)
|
||||
directives = directives.filter{ it.directive !in moduleLevelDirectives }
|
||||
|
@ -33,13 +33,6 @@ This makes it easier to understand and relate the generated code. Examples::
|
||||
Directives
|
||||
-----------
|
||||
|
||||
.. data:: %target <target>
|
||||
|
||||
Level: module.
|
||||
Global setting, specifies that this module can only work for the given compiler target.
|
||||
If compiled with a different target, compilation is aborted with an error message.
|
||||
|
||||
|
||||
.. data:: %output <type>
|
||||
|
||||
Level: module.
|
||||
|
@ -1,4 +1,3 @@
|
||||
%target c64
|
||||
%import syslib
|
||||
%import textio
|
||||
%import test_stack
|
||||
|
@ -1,4 +1,3 @@
|
||||
%target c64
|
||||
%import syslib
|
||||
%import textio
|
||||
%zeropage basicsafe
|
||||
|
@ -1,4 +1,3 @@
|
||||
%target c64
|
||||
%import textio
|
||||
%import syslib
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
%target c64
|
||||
%import syslib
|
||||
%import textio
|
||||
%zeropage basicsafe
|
||||
|
@ -1,4 +1,3 @@
|
||||
%target c64
|
||||
%import syslib
|
||||
%import textio
|
||||
%import test_stack
|
||||
|
@ -1,4 +1,3 @@
|
||||
%target c64
|
||||
%import syslib
|
||||
%import test_stack
|
||||
%import textio
|
||||
|
@ -1,4 +1,3 @@
|
||||
%target cx16
|
||||
%import textio
|
||||
%import palette
|
||||
%import string
|
||||
|
@ -1,4 +1,3 @@
|
||||
%target cx16
|
||||
%import palette
|
||||
%import conv
|
||||
%import textio
|
||||
|
@ -1,4 +1,3 @@
|
||||
%target cx16
|
||||
%import syslib
|
||||
%import test_stack
|
||||
%import conv
|
||||
|
@ -1,4 +1,3 @@
|
||||
%target cx16
|
||||
%import textio
|
||||
|
||||
main {
|
||||
|
@ -1,6 +1,5 @@
|
||||
; CommanderX16 text datetime example!
|
||||
|
||||
%target cx16
|
||||
%import textio
|
||||
%zeropage basicsafe
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
%target cx16
|
||||
%import gfx2
|
||||
%import floats
|
||||
%import textio
|
||||
|
@ -1,4 +1,3 @@
|
||||
%target cx16
|
||||
%import palette
|
||||
%option no_sysinit
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
%target cx16
|
||||
%import textio
|
||||
%import floats
|
||||
%zeropage basicsafe
|
||||
|
@ -1,4 +1,3 @@
|
||||
%target cx16
|
||||
%import textio
|
||||
%import floats
|
||||
%zeropage basicsafe
|
||||
|
@ -1,4 +1,3 @@
|
||||
%target cx16
|
||||
%import palette
|
||||
%import gfx2
|
||||
%option no_sysinit
|
||||
|
@ -1,4 +1,3 @@
|
||||
%target cx16
|
||||
%import textio
|
||||
%import palette
|
||||
|
||||
|
@ -8,7 +8,6 @@
|
||||
; simplistic sound effects (Vera PSG)
|
||||
|
||||
|
||||
%target cx16
|
||||
%import syslib
|
||||
%import textio
|
||||
%import test_stack
|
||||
|
@ -1,4 +1,3 @@
|
||||
%target cx16
|
||||
%import gfx2
|
||||
%import textio
|
||||
%import test_stack
|
||||
|
@ -1,4 +1,3 @@
|
||||
%target cx16
|
||||
%import textio
|
||||
%option no_sysinit
|
||||
%zeropage basicsafe
|
||||
|
@ -1,4 +1,3 @@
|
||||
%target c64
|
||||
%import syslib
|
||||
%import test_stack
|
||||
%import textio
|
||||
|
@ -1,4 +1,3 @@
|
||||
%target c64
|
||||
%import syslib
|
||||
|
||||
main {
|
||||
|
@ -1,4 +1,3 @@
|
||||
%target c64
|
||||
%import textio
|
||||
%import syslib
|
||||
%zeropage basicsafe
|
||||
|
@ -8,7 +8,6 @@
|
||||
; some simple sound effects
|
||||
|
||||
|
||||
%target c64
|
||||
%import syslib
|
||||
%import textio
|
||||
%import test_stack
|
||||
|
@ -5,38 +5,43 @@ main {
|
||||
|
||||
label:
|
||||
sub start() {
|
||||
sub2(&label)
|
||||
sub2(&label_local)
|
||||
sub2(&main.sub2.label_in_sub2)
|
||||
uword xx = &label_local
|
||||
txt.print_uwhex(xx, true)
|
||||
txt.nl()
|
||||
xx = &label
|
||||
txt.print_uwhex(xx, true)
|
||||
txt.nl()
|
||||
xx = &main.label
|
||||
txt.print_uwhex(xx, true)
|
||||
txt.nl()
|
||||
xx = &main.sub2.label_in_sub2
|
||||
txt.print_uwhex(xx, true)
|
||||
txt.nl()
|
||||
xx = main.sub2.sub2var
|
||||
txt.print_uwhex(xx, true)
|
||||
txt.nl()
|
||||
xx = &main.start.label_local
|
||||
txt.print_uwhex(xx, true)
|
||||
txt.nl()
|
||||
|
||||
txt.print("hey\n")
|
||||
%breakpoint
|
||||
txt.print("hey2\n")
|
||||
|
||||
; sub2(&label)
|
||||
; sub2(&label_local)
|
||||
; sub2(&main.sub2.label_in_sub2)
|
||||
; uword xx = &label_local
|
||||
; txt.print_uwhex(xx, true)
|
||||
; txt.nl()
|
||||
; xx = &label
|
||||
; txt.print_uwhex(xx, true)
|
||||
; txt.nl()
|
||||
; xx = &main.label
|
||||
; txt.print_uwhex(xx, true)
|
||||
; txt.nl()
|
||||
; xx = &main.sub2.label_in_sub2
|
||||
; txt.print_uwhex(xx, true)
|
||||
; txt.nl()
|
||||
; xx = main.sub2.sub2var
|
||||
; txt.print_uwhex(xx, true)
|
||||
; txt.nl()
|
||||
; xx = &main.start.label_local
|
||||
; txt.print_uwhex(xx, true)
|
||||
; txt.nl()
|
||||
|
||||
label_local:
|
||||
return
|
||||
}
|
||||
|
||||
sub sub2(uword ad) {
|
||||
uword sub2var = 42
|
||||
|
||||
txt.print_uwhex(ad,true)
|
||||
txt.nl()
|
||||
label_in_sub2:
|
||||
txt.nl()
|
||||
}
|
||||
; sub sub2(uword ad) {
|
||||
; uword sub2var = 42
|
||||
;
|
||||
; txt.print_uwhex(ad,true)
|
||||
; txt.nl()
|
||||
;label_in_sub2:
|
||||
; txt.nl()
|
||||
; }
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
%target c64
|
||||
%import floats
|
||||
%import graphics
|
||||
%import test_stack
|
||||
|
@ -1,4 +1,3 @@
|
||||
%target c64
|
||||
%import syslib
|
||||
%zeropage basicsafe
|
||||
|
||||
|
@ -135,7 +135,7 @@ unconditionaljump : 'goto' (integerliteral | scoped_identifier) ;
|
||||
|
||||
directive :
|
||||
directivename=('%output' | '%launcher' | '%zeropage' | '%zpreserved' | '%address' | '%import' |
|
||||
'%breakpoint' | '%asminclude' | '%asmbinary' | '%option' | '%target' )
|
||||
'%breakpoint' | '%asminclude' | '%asmbinary' | '%option' )
|
||||
(directivearg? | directivearg (',' directivearg)*)
|
||||
;
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
<option name="HAS_STRING_ESCAPES" value="true" />
|
||||
</options>
|
||||
<keywords keywords="&;->;@;\$;and;as;asmsub;break;clobbers;do;downto;else;false;for;goto;if;if_cc;if_cs;if_eq;if_mi;if_ne;if_neg;if_nz;if_pl;if_pos;if_vc;if_vs;if_z;in;inline;not;or;repeat;return;romsub;step;sub;to;true;until;when;while;xor;~" ignore_case="false" />
|
||||
<keywords2 keywords="%address;%asm;%asmbinary;%asminclude;%breakpoint;%import;%launcher;%option;%output;%target;%zeropage;%zpreserved" />
|
||||
<keywords2 keywords="%address;%asm;%asmbinary;%asminclude;%breakpoint;%import;%launcher;%option;%output;%zeropage;%zpreserved" />
|
||||
<keywords3 keywords="byte;const;float;shared;str;ubyte;uword;void;word;zp" />
|
||||
<keywords4 keywords="abs;acos;all;any;asin;atan;avg;callfar;callrom;ceil;cmp;cos;cos16;cos16u;cos8;cos8u;deg;floor;len;ln;log2;lsb;lsl;lsr;max;memory;min;mkword;msb;peek;peekw;poke;pokew;rad;reverse;rnd;rndf;rndw;rol;rol2;ror;ror2;round;sgn;sin;sin16;sin16u;sin8;sin8u;sizeof;sort;sqrt;sqrt16;sum;swap;tan" />
|
||||
</highlighting>
|
||||
@ -20,4 +20,4 @@
|
||||
<mapping ext="p8" />
|
||||
<mapping ext="prog8" />
|
||||
</extensionMap>
|
||||
</filetype>
|
||||
</filetype>
|
||||
|
@ -25,7 +25,7 @@
|
||||
<Keywords name="Folders in comment, middle"></Keywords>
|
||||
<Keywords name="Folders in comment, close"></Keywords>
|
||||
<Keywords name="Keywords1">void const
str
byte ubyte
word uword
float
zp shared</Keywords>
|
||||
<Keywords name="Keywords2">%address
%asm
%asmbinary
%asminclude
%breakpoint
%import
%launcher
%option
%output
%target
%zeropage
%zpreserved</Keywords>
|
||||
<Keywords name="Keywords2">%address
%asm
%asmbinary
%asminclude
%breakpoint
%import
%launcher
%option
%output
%zeropage
%zpreserved</Keywords>
|
||||
<Keywords name="Keywords3">inline sub asmsub romsub
clobbers
asm
if
when else
if_cc if_cs if_eq if_mi if_neg if_nz if_pl if_pos if_vc if_vs if_z
for in step do while repeat
break return goto</Keywords>
|
||||
<Keywords name="Keywords4">abs acos all any asin atan avg callfar callrom ceil cmp cos cos16 cos16u cos8 cos8u deg floor len ln log2 lsb lsl lsr max memory min mkword msb peek peekw poke pokew rad reverse rnd rndf rndw rol rol2 ror ror2 round sgn sin sin16 sin16u sin8 sin8u sizeof sort sqrt sqrt16 sum swap tan
</Keywords>
|
||||
<Keywords name="Keywords5">true false
not and or xor
as to downto</Keywords>
|
||||
|
@ -1,4 +1,3 @@
|
||||
%target cx16
|
||||
%import textio
|
||||
%zeropage basicsafe
|
||||
%option no_sysinit
|
||||
|
@ -33,7 +33,7 @@ syn keyword prog8Repeat for while in do until repeat
|
||||
syn match prog8Label "\<\w\+\>:"
|
||||
syn keyword prog8Operator and or to downto as void
|
||||
|
||||
syn match prog8Directive "\(^\|\s\)%\(target\|output\|launcher\|zeropage\)\>"
|
||||
syn match prog8Directive "\(^\|\s\)%\(output\|launcher\|zeropage\)\>"
|
||||
syn match prog8Directive "\(^\|\s\)%\(zpreserved\|address\|import\|option\)\>"
|
||||
syn match prog8Directive "\(^\|\s\)%\(asmbinary\|asminclude\|breakpoint\)\>"
|
||||
syn match prog8Directive "\(^\|\s\)%asm\>"
|
||||
|
Loading…
Reference in New Issue
Block a user