diff options
author | Silenio Quarti <silenio> | 2004-02-28 09:45:46 +0000 |
---|---|---|
committer | Silenio Quarti <silenio> | 2004-02-28 09:45:46 +0000 |
commit | 89d88139f9e2cae0710fade32dcb1296489cc848 (patch) | |
tree | 395b6e6f9f7248755e25663e099a7ba97d4bf70c /bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/NativesGenerator.java | |
parent | d763f8fad682ea7ed6c091da1282e33c25dfa015 (diff) | |
download | eclipse.platform.swt-89d88139f9e2cae0710fade32dcb1296489cc848.tar.gz eclipse.platform.swt-89d88139f9e2cae0710fade32dcb1296489cc848.tar.xz eclipse.platform.swt-89d88139f9e2cae0710fade32dcb1296489cc848.zip |
*** empty log message ***
Diffstat (limited to 'bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/NativesGenerator.java')
-rw-r--r-- | bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/NativesGenerator.java | 75 |
1 files changed, 42 insertions, 33 deletions
diff --git a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/NativesGenerator.java b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/NativesGenerator.java index b3e45d4790..47b5da5e03 100644 --- a/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/NativesGenerator.java +++ b/bundles/org.eclipse.swt.tools/JNI Generation/org/eclipse/swt/tools/internal/NativesGenerator.java @@ -91,6 +91,48 @@ public void generate(Method[] methods) { } } +public void generate(Method method) { + MethodData methodData = getMetaData().getMetaData(method); + if (methodData.getFlag("no_gen")) return; + Class returnType = method.getReturnType(); + Class[] paramTypes = method.getParameterTypes(); + String function = getFunctionName(method); + + if (!(returnType == Void.TYPE || returnType.isPrimitive())) { + output("Warnning: bad return type. :" + method); + outputDelimiter(); + return; + } + + generateSourceStart(function); + generateFunctionPrototype(method, function, paramTypes, returnType); + generateFunctionBody(method, methodData, function, paramTypes, returnType); + generateSourceEnd(function); + outputDelimiter(); +} + +public void setEnterExitMacro(boolean enterExitMacro) { + this.enterExitMacro = enterExitMacro; +} + +public void setNativeMacro(boolean nativeMacro) { + this.nativeMacro = nativeMacro; +} + +public void setUseCritical(boolean useCritical) { + this.useCritical = useCritical; +} + +void generateNativeMacro(Class clazz) { + output("#define "); + output(getClassName(clazz)); + output("_NATIVE(func) Java_"); + output(toC(clazz.getName())); + output("_##func"); + outputDelimiter(); + outputDelimiter(); +} + void generateGetParameter(int i, Class paramType, ParameterData paramData) { if (paramType.isPrimitive()) return; output("\tif (arg" + i); @@ -454,42 +496,10 @@ void generateSourceEnd(String function) { outputDelimiter(); } -public void generate(Method method) { - MethodData methodData = getMetaData().getMetaData(method); - if (methodData.getFlag("no_gen")) return; - Class returnType = method.getReturnType(); - Class[] paramTypes = method.getParameterTypes(); - String function = getFunctionName(method); - - if (!(returnType == Void.TYPE || returnType.isPrimitive())) { - output("Warnning: bad return type. :" + method); - outputDelimiter(); - return; - } - - generateSourceStart(function); - generateFunctionPrototype(method, function, paramTypes, returnType); - generateFunctionBody(method, methodData, function, paramTypes, returnType); - generateSourceEnd(function); - outputDelimiter(); -} - boolean isUnique(Method method) { return isUnique(method, Modifier.NATIVE); } -public void setEnterExitMacro(boolean enterExitMacro) { - this.enterExitMacro = enterExitMacro; -} - -public void setNativeMacro(boolean nativeMacro) { - this.nativeMacro = nativeMacro; -} - -public void setUseCritical(boolean useCritical) { - this.useCritical = useCritical; -} - public static void main(String[] args) { // args = new String[]{"org.eclipse.swt.internal.win32.OS"}; if (args.length < 1) { @@ -498,7 +508,6 @@ public static void main(String[] args) { } try { NativesGenerator gen = new NativesGenerator(); - gen.setNativeMacro(true); for (int i = 0; i < args.length; i++) { String clazzName = args[i]; Class clazz = Class.forName(clazzName); |