Commit a06ae71e authored by John van Groningen's avatar John van Groningen

fix inline code

parent dbdb6680
......@@ -11,130 +11,106 @@ instance == {#Char}
where
(==) :: !{#Char} !{#Char} -> Bool
(==) a b
= code {
.inline ==;#
= code inline {
.d 2 0
jsr eqAC
.o 0 1 b
.end
}
instance < {#Char}
where
(<) :: !{#Char} !{#Char} -> Bool
(<) a b
= code {
.inline <;#
= code inline {
.d 2 0
jsr cmpAC
.o 0 1 i
pushI 0
gtI
.end
}
instance toString Int
where
toString a
= code {
.inline toString;i
= code inline {
.d 0 1 i
jsr ItoAC
.o 1 0
.end
}
instance toString Char
where
toString a
= code {
.inline toString;c
= code inline {
CtoAC
.end
}
instance toString Real
where
toString a
= code {
.inline toString;r
= code inline {
.d 0 2 r
jsr RtoAC
.o 1 0
.end
}
instance toString Bool
where
toString :: !Bool -> {#Char}
toString a
= code {
.inline toString;b
= code inline {
.d 0 1 b
jsr BtoAC
.o 1 0
.end
}
instance toString {#Char}
where
toString :: !{#Char} -> {#Char} // dummy
toString a
= code {
.inline toString;#
no_op
.end
= code inline {
no_op
}
instance fromString {#Char}
where
fromString :: !{#Char} -> {#Char} // dummy
fromString a
= code {
.inline fromString;#
no_op
.end
= code inline {
no_op
}
instance % {#Char}
where
(%) ::!{#Char} !(!Int,!Int) -> {#Char}
(%) str (a,b)
= code {
.inline %;#
= code inline {
.d 1 2 ii
jsr sliceAC
.o 1 0
.end
}
instance +++ {#Char}
where
(+++) :: !{#Char} !{#Char} -> {#Char}
(+++) a b
= code {
.inline +++;#
= code inline {
.d 2 0
jsr catAC
.o 1 0
.end
}
(+++.) infixr 5 :: !{#Char} !{#Char} -> .{#Char}
(+++.) a b
= code {
.inline +++.
= code inline {
.d 2 0
jsr catAC
.o 1 0
.end
}
(:=) infixl 9 :: !{#Char} !(!Int,!Char) -> {#Char} // update i-th element
(:=) s (i,c)
= code {
.inline :=
= code inline {
.d 1 2 ic
jsr updateAC
.o 1 0
.end
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment