@@ -477,6 +477,7 @@ nextIntTy (ITFixed IT16) = (ITFixed IT32)
477nextIntTy (ITFixed IT32) = (ITFixed IT64)
477nextIntTy (ITFixed IT32) = (ITFixed IT64)
478nextIntTy (ITFixed IT64) = (ITFixed IT64)
478nextIntTy (ITFixed IT64) = (ITFixed IT64)
479nextIntTy ITNative = (ITFixed IT64)
479nextIntTy ITNative = (ITFixed IT64)
480+nextIntTy ITChar = (ITFixed IT64)
481intTyToIdent :: IntTy -> Ident
482intTyToIdent :: IntTy -> Ident
482intTyToIdent (ITFixed IT8) = Ident "Byte"
483intTyToIdent (ITFixed IT8) = Ident "Byte"
@@ -485,6 +486,7 @@ intTyToIdent (ITFixed IT32) = Ident "Integer"
485intTyToIdent (ITFixed IT64) = Ident "Long"
486intTyToIdent (ITFixed IT64) = Ident "Long"
486intTyToIdent ITNative = Ident "Integer"
487intTyToIdent ITNative = Ident "Integer"
487intTyToIdent ITBig = Ident "BigInteger"
488intTyToIdent ITBig = Ident "BigInteger"
489+intTyToIdent ITChar = Ident "Integer"
489intTyToClass :: IntTy -> ClassType
491intTyToClass :: IntTy -> ClassType
490intTyToClass ty = ClassType [(intTyToIdent ty, [])]
492intTyToClass ty = ClassType [(intTyToIdent ty, [])]
@@ -495,6 +497,7 @@ intTyToMethod (ITFixed IT16) = "shortValue"
495intTyToMethod (ITFixed IT32) = "intValue"
497intTyToMethod (ITFixed IT32) = "intValue"
496intTyToMethod (ITFixed IT64) = "longValue"
498intTyToMethod (ITFixed IT64) = "longValue"
497intTyToMethod ITNative = "intValue"
499intTyToMethod ITNative = "intValue"
500+intTyToMethod ITChar = "intValue"
499intTyToPrimTy :: IntTy -> PrimType
502intTyToPrimTy :: IntTy -> PrimType
500intTyToPrimTy (ITFixed IT8) = ByteT
503intTyToPrimTy (ITFixed IT8) = ByteT
@@ -502,6 +505,7 @@ intTyToPrimTy (ITFixed IT16) = ShortT
502intTyToPrimTy (ITFixed IT32) = IntT
505intTyToPrimTy (ITFixed IT32) = IntT
503intTyToPrimTy (ITFixed IT64) = LongT
506intTyToPrimTy (ITFixed IT64) = LongT
504intTyToPrimTy ITNative = IntT
507intTyToPrimTy ITNative = IntT
508+intTyToPrimTy ITChar = IntT
506bigIntegerType :: ClassType
510bigIntegerType :: ClassType
507bigIntegerType = ClassType [(Ident "BigInteger", [])]
511bigIntegerType = ClassType [(Ident "BigInteger", [])]
@@ -997,7 +1001,6 @@ mkStringAtIndex var indexExp =
997mkForeignType :: FType -> Maybe ClassType
1001mkForeignType :: FType -> Maybe ClassType
998mkForeignType (FArith (ATInt ity)) = return (intTyToClass ity)
1002mkForeignType (FArith (ATInt ity)) = return (intTyToClass ity)
999mkForeignType (FArith ATFloat) = return doubleType
1003mkForeignType (FArith ATFloat) = return doubleType
1000−mkForeignType FChar = return integerType
1001mkForeignType FString = return stringType
1004mkForeignType FString = return stringType
1002mkForeignType FPtr = return objectType
1005mkForeignType FPtr = return objectType
1003mkForeignType FAny = return objectType
1006mkForeignType FAny = return objectType
@@ -1011,7 +1014,7 @@ mkForeignVarAccess (FArith (ATInt ty)) var =
1013 <$> mkVarAccess (Just $ intTyToClass ty) var
1016 <$> mkVarAccess (Just $ intTyToClass ty) var
1014−mkForeignVarAccess FChar var = Cast (PrimType CharT) <$> mkForeignVarAccess (FArith (ATInt (ITFixed IT32))) var
1017+-- mkForeignVarAccess (FArith (ATInt ITChar)) var = Cast (PrimType CharT) <$> mkForeignVarAccess (FArith (ATInt (ITFixed IT32))) var
1015mkForeignVarAccess (FArith ATFloat) var =
1018mkForeignVarAccess (FArith ATFloat) var =
1016 (\ var -> MethodInv $ PrimaryMethodCall (var)
1019 (\ var -> MethodInv $ PrimaryMethodCall (var)
@@ -1022,12 +1025,12 @@ mkForeignVarAccess (FArith ATFloat) var =
1022mkForeignVarAccess otherType var = mkVarAccess (mkForeignType otherType) var
1025mkForeignVarAccess otherType var = mkVarAccess (mkForeignType otherType) var
1024mkFromForeignType :: FType -> Exp -> Exp
1027mkFromForeignType :: FType -> Exp -> Exp
1025−mkFromForeignType (FArith (ATInt ty)) from =
1028+{-mkFromForeignType (FArith (ATInt ty)) from =
1026 MethodInv $ TypeMethodCall (J.Name [intTyToIdent ty])
1029 MethodInv $ TypeMethodCall (J.Name [intTyToIdent ty])
1028 (Ident "valueOf")
1031 (Ident "valueOf")
1029− [from]
1032+ [from] -}
1030−mkFromForeignType FChar from = mkFromForeignType (FArith (ATInt (ITFixed IT32))) from
1033+mkFromForeignType (FArith (ATInt ITChar)) from = mkFromForeignType (FArith (ATInt (ITFixed IT32))) from
1031mkFromForeignType (FArith ATFloat) from =
1034mkFromForeignType (FArith ATFloat) from =
1032 MethodInv $ TypeMethodCall (J.Name [Ident "Double"])
1035 MethodInv $ TypeMethodCall (J.Name [Ident "Double"])
@@ -1272,7 +1275,7 @@ mkExp (SConst (Str x)) = return $ Lit $ String x
1272mkExp (SConst (AType (ATInt ITNative))) = return $ mkClass integerType
1275mkExp (SConst (AType (ATInt ITNative))) = return $ mkClass integerType
1273mkExp (SConst (AType (ATInt ITBig))) = return $ mkClass bigIntegerType
1276mkExp (SConst (AType (ATInt ITBig))) = return $ mkClass bigIntegerType
1274mkExp (SConst (AType ATFloat)) = return $ mkClass doubleType
1277mkExp (SConst (AType ATFloat)) = return $ mkClass doubleType
1275−mkExp (SConst ChType) = return $ mkClass charType
1278+mkExp (SConst (AType (ATInt ITChar))) = return $ mkClass charType
1276mkExp (SConst StrType) = return $ mkClass stringType
1279mkExp (SConst StrType) = return $ mkClass stringType
1277mkExp (SConst (B8 x)) = return $ mkPrimitive "Byte" (String (show x))
1280mkExp (SConst (B8 x)) = return $ mkPrimitive "Byte" (String (show x))
1278mkExp (SConst (B16 x)) = return $ mkPrimitive "Short" (String (show x))
1281mkExp (SConst (B16 x)) = return $ mkPrimitive "Short" (String (show x))