src/macosx/native/jobjc/src/core/PrimitiveCoder.hs
Print this page
@@ -1,10 +1,10 @@
#!/usr/bin/env runhaskell
{-
/*
- * Copyright (c) 2011,2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -32,11 +32,11 @@
Otherwise, see http://www.haskell.org/ghc/
-}
import Data.List
import Data.Maybe
-import Char
+import Data.Char
data Width = W32 | W64
deriving (Show, Eq, Bounded, Enum)
data NType = NBOOL | Nschar | Nuchar | Nsshort | Nushort | Nsint | Nuint
@@ -194,12 +194,10 @@
-- Generate a coder class for a given NType.
c2java ntype =
unlines [
"// native " ++ ntypeS ++ " -> java " ++ jprimS,
- "/* No native methods here, but the constants are needed in the supporting JNI code */",
- "@GenerateNativeHeader",
"public static final class " ++ className ++ " extends PrimitiveCoder<" ++ jclassS ++ ">{",
"\tpublic static final " ++ className ++ " INST = new " ++ className ++ "();",
"\tpublic " ++ className ++ "(){ super("++ffitypeVal ntype++", \"" ++ [encoding ntype] ++ "\", "++jclassS++".class, "++jprimS++".class); }",
"\t// compile time",
"\t@Override public void push(JObjCRuntime rt, long addr, " ++ jprimS ++ " x){",
@@ -246,17 +244,14 @@
main = do
putStrLn "package com.apple.jobjc;"
putStrLn "import com.apple.jobjc.JObjCRuntime.Width;"
- putStrLn "import javax.tools.annotation.GenerateNativeHeader;"
putStrLn "// Auto generated by PrimitiveCoder.hs"
putStrLn "// Do not edit by hand."
- putStrLn "/* No native methods here, but the constants are needed in the supporting JNI code */"
- putStrLn "@GenerateNativeHeader"
putStrLn "public abstract class PrimitiveCoder<T> extends Coder<T>{"
putStrLn "\tpublic PrimitiveCoder(int ffiTypeCode, String objCEncoding, Class jclass, Class jprim){"
putStrLn "\t\tsuper(ffiTypeCode, objCEncoding, jclass, jprim);"
putStrLn "\t}"