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; } 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 List<ClassWritingNotifiable> classWritingNotifiables = new ArrayList<ClassWritingNotifiable>();
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; } 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 List<ClassWritingNotifiable> classWritingNotifiables = new ArrayList<ClassWritingNotifiable>();
ptClass.addToCommentBefore("Pointer to unknown (opaque) type"); ptClass.addToCommentBefore("Undefined type"); declarations.addDeclaration(decl(ptClass));
ptClass.addToCommentBefore("Pointer to unknown (opaque) type"); ptClass.addToCommentBefore("Undefined type"); declarations.addDeclaration(decl(ptClass));
interf.addToCommentBefore("Wrapper around the OpenCL program " + name); interf.addModifiers(ModifierType.Public); interf.setTag(ident(name));
implementations.addToCommentBefore("Wrapper for library <b>" + library + "</b>", result.declarationsConverter.getFileCommentContent(result.config.libraryProjectSources.get(library), null)); implementations.addModifiers(ModifierType.Public); declarations = new Struct(); declarations.setType(Struct.Type.JavaInterface); declarations.addToCommentBefore("Interface for library <b>" + library + "</b>", result.declarationsConverter.getFileCommentContent(result.config.libraryProjectSources.get(library), null)); declarations.addModifiers(ModifierType.Public);
public void convertEnum(Enum e, Signatures signatures, DeclarationsHolder out, Identifier libraryClassName) { if (e.isForwardDeclaration()) { return; } Identifier rawEnumName = getActualTaggedTypeName(e); Map<String, EnumItemResult> results = result.typeConverter.getEnumValuesAndCommentsByName(e, libraryClassName); boolean hasEnumClass = false; if (rawEnumName != null && rawEnumName.resolveLastSimpleIdentifier().getName() != null) { Identifier enumName = result.typeConverter.getValidJavaIdentifier(rawEnumName); if (!signatures.addClass(enumName)) { return; } hasEnumClass = true; Struct struct = publicStaticClass(enumName, null, Struct.Type.JavaInterface, e); out.addDeclaration(new TaggedTypeRefDeclaration(struct)); if (!result.config.noComments) { struct.addToCommentBefore("enum values"); } out = struct; signatures = new Signatures(); } outputEnumItemsAsConstants(results, out, signatures, libraryClassName, hasEnumClass); } Map<String, Pair<Function, List<Function>>> functionAlternativesByNativeSignature = new LinkedHashMap<String, Pair<Function, List<Function>>>();
implementations.addToCommentBefore("Wrapper for library <b>" + library + "</b>", result.declarationsConverter.getFileCommentContent(result.config.libraryProjectSources.get(library), null)); implementations.addModifiers(ModifierType.Public); declarations = new Struct(); declarations.setType(Struct.Type.JavaInterface); declarations.addToCommentBefore("Interface for library <b>" + library + "</b>", result.declarationsConverter.getFileCommentContent(result.config.libraryProjectSources.get(library), null)); declarations.addModifiers(ModifierType.Public);
public void convertEnum(Enum e, Signatures signatures, DeclarationsHolder out, Identifier libraryClassName) { if (e.isForwardDeclaration()) { return; } Identifier rawEnumName = getActualTaggedTypeName(e); Map<String, EnumItemResult> results = result.typeConverter.getEnumValuesAndCommentsByName(e, libraryClassName); boolean hasEnumClass = false; if (rawEnumName != null && rawEnumName.resolveLastSimpleIdentifier().getName() != null) { Identifier enumName = result.typeConverter.getValidJavaIdentifier(rawEnumName); if (!signatures.addClass(enumName)) { return; } hasEnumClass = true; Struct struct = publicStaticClass(enumName, null, Struct.Type.JavaInterface, e); out.addDeclaration(new TaggedTypeRefDeclaration(struct)); if (!result.config.noComments) { struct.addToCommentBefore("enum values"); } out = struct; signatures = new Signatures(); } outputEnumItemsAsConstants(results, out, signatures, libraryClassName, hasEnumClass); } Map<String, Pair<Function, List<Function>>> functionAlternativesByNativeSignature = new LinkedHashMap<String, Pair<Function, List<Function>>>();
callbackStruct.addToCommentBefore(comel.getCommentBefore(), comel.getCommentAfter(), getFileCommentContent(comel));
callbackStruct.addToCommentBefore(comel.getCommentBefore(), comel.getCommentAfter(), getFileCommentContent(comel));
if (result.config.entryName != null) { librariesHub = new Struct(); librariesHub.addToCommentBefore("JNA Wrappers instances"); librariesHub.setType(Struct.Type.JavaClass); librariesHub.addModifiers(ModifierType.Public, ModifierType.Abstract); interf.addToCommentBefore("JNA Wrapper for library <b>" + library + "</b>", result.declarationsConverter.getFileCommentContent(result.config.libraryProjectSources.get(library), null)); if (hubOut != null) { interf.addToCommentBefore("@see " + result.config.entryName + "." + library);
if (result.config.entryName != null) { librariesHub = new Struct(); librariesHub.addToCommentBefore("JNA Wrappers instances"); librariesHub.setType(Struct.Type.JavaClass); librariesHub.addModifiers(ModifierType.Public, ModifierType.Abstract); interf.addToCommentBefore("JNA Wrapper for library <b>" + library + "</b>", result.declarationsConverter.getFileCommentContent(result.config.libraryProjectSources.get(library), null)); if (hubOut != null) { interf.addToCommentBefore("@see " + result.config.entryName + "." + library);
instanceStruct.addToCommentBefore(in.getCommentAfter()); instanceStruct.setTag(isCategory ? ident(in.getCategoryName()) : in.getTag().clone()); if (isProtocol || isCategory) {
instanceStruct.addToCommentBefore(in.getCommentAfter()); instanceStruct.setTag(isCategory ? ident(in.getCategoryName()) : in.getTag().clone()); if (isProtocol || isCategory) {
annotateActualName(structJavaClass, structName); addParentNamespaceAnnotation(structJavaClass, struct.getParentNamespace()); structJavaClass.addToCommentBefore(preComments);
annotateActualName(structJavaClass, structName); addParentNamespaceAnnotation(structJavaClass, struct.getParentNamespace()); structJavaClass.addToCommentBefore(preComments);