-
-//parseByteCode :: String -> BCValue
-//parseByteCode "b" = BCValue True
-//parseByteCode "i" = BCValue 0
-
-instance fromByteCode Bool where fromByteCode s = fromByteCode s == 1
-instance fromByteCode Int where fromByteCode s = (toInt s.[0])*256 + toInt s.[1]
-instance fromByteCode Long where fromByteCode s = L $ fromByteCode s
-instance fromByteCode Char where fromByteCode s = fromInt $ fromByteCode s
-instance fromByteCode String where fromByteCode s = abort $ "Undef on fromBytecode String" +++ s
-instance fromByteCode Button where fromByteCode s = conses{|*|} !! fromByteCode s
-instance fromByteCode UserLED where fromByteCode s = conses{|*|} !! fromByteCode s
-instance fromByteCode BCValue
- where
- fromByteCode s = let tail = subString 1 (size s) s in case s.[0] of
- 'b' = BCValue $ castfbc True tail
- 'i' = BCValue $ castfbc 0 tail
- 'l' = BCValue $ castfbc (L 0) tail
- 'c' = BCValue $ castfbc ('0') tail
- 'B' = BCValue $ castfbc (NoButton) tail
- 'L' = BCValue $ castfbc (LED1) tail
- where
- castfbc :: a -> (String -> a) | mTaskType a
- castfbc _ = fromByteCode
-