public String getLibraryFileExpression(String library) { Class<?> platformClass = config.runtime.hasJNA ? com.sun.jna.Platform.class : SystemUtils.class; if (library.equals("c")) return "(" + platformClass.getName() + ".isWindows() ? \"msvcrt\" : \"c\")"; return "\"" + library + "\""; }
Runtime( boolean hasFastStructs, boolean hasJNA, boolean hasBitFields, Class<?> callbackClass, Class<?> pointerClass, Class<?> memoryClass, Class<?> structClass, Class<?> unionClass, Class<?> structIOClass, Class<?> arrayClass, Class<?> libraryClass, Class<? extends Annotation> someAnnotationClass, String runtimeFilesListFileName) { this.hasFastStructs = hasFastStructs; this.hasBitFields = hasBitFields; this.hasJNA = hasJNA; this.callbackClass = callbackClass; this.pointerClass = pointerClass; this.memoryClass = memoryClass; this.structClass = structClass; this.libraryClass = libraryClass; this.unionClass = unionClass; this.structIOClass = structIOClass; this.arrayClass = arrayClass; this.runtimeFilesListFileName = runtimeFilesListFileName; annotationPackage = someAnnotationClass == null ? null : someAnnotationClass.getPackage().getName(); }
public Struct notifyBeforeWritingClass( Identifier fullClassName, Struct interf, Signatures signatures, String currentLibrary) { for (Class<?> c : overwrittenClassesThatNeedToKeepAllTheirMethods) { if (fullClassName.equals(c.getName())) { declarationsConverter.addMissingMethods(c, signatures, interf); break; } } if (fullClassName.resolveLastSimpleIdentifier().equals("char")) return null; // if (fullClassName.equals(NSString.class)) { /* @Override public String toString() { return Foundation.toString(id()); } public static NSString getGlobalString(String libraryName, String globalVarName) { return Rococoa.wrap(ID.getGlobal(libraryName, globalVarName), NSString.class); } public static NSString getGlobalString(String globalVarName) { return getGlobalString("AppKit", globalVarName); }*/ // } String runtimeSpecificHelp = config.runtime == JNAeratorConfig.Runtime.BridJ ? "or <a href=\"http://bridj.googlecode.com/\">BridJ</a> " : ", <a href=\"http://rococoa.dev.java.net/\">Rococoa</a>, " + "or <a href=\"http://jna.dev.java.net/\">JNA</a>"; interf.addToCommentBefore( "This file was autogenerated by <a href=\"http://jnaerator.googlecode.com/\">JNAerator</a>, ", "a tool written by <a href=\"http://ochafik.com/\">Olivier Chafik</a> that <a href=\"http://code.google.com/p/jnaerator/wiki/CreditsAndLicense\">uses a few opensource projects.</a>.", "For help, please visit <a href=\"http://nativelibs4java.googlecode.com/\">NativeLibs4Java</a> " + runtimeSpecificHelp + "."); for (ClassWritingNotifiable n : classWritingNotifiables) { interf = n.writingClass(fullClassName, interf, signatures, currentLibrary); if (interf == null) return null; } return interf; }
public static synchronized Pair<List<Pair<Function, String>>, Set<String>> getMethodsAndTheirSignatures(Class<?> originalLib) { if (cachedForcedMethodsAndTheirSignatures == null) cachedForcedMethodsAndTheirSignatures = new HashMap<Class<?>, Pair<List<Pair<Function, String>>, Set<String>>>(); Pair<List<Pair<Function, String>>, Set<String>> pair = cachedForcedMethodsAndTheirSignatures.get(originalLib); if (pair == null) { pair = new Pair<List<Pair<Function, String>>, Set<String>>( new ArrayList<Pair<Function, String>>(), new HashSet<String>()); for (Method m : originalLib.getDeclaredMethods()) { Function f = Function.fromMethod(m); String sig = f.computeSignature(Function.SignatureType.JavaStyle); // if (m.getDeclaringClass().equals(NSObject.class) && f.getName().equals("as")) { // Declaration // } pair.getFirst().add(new Pair<Function, String>(f, sig)); pair.getSecond().add(sig); } } return pair; }