protected boolean isField(VariablesDeclaration vd) { List<Modifier> mods = vd.getModifiers(); if (vd.hasModifier(ModifierType.Final)) { return false; } if (vd.getValueType() == null || vd.getValueType().toString().equals(VirtualTablePointer.class.getName())) { return false; } return true; }
protected boolean isField(VariablesDeclaration vd) { List<Modifier> mods = vd.getModifiers(); if (vd.hasModifier(ModifierType.Final)) { return false; } if (vd.getValueType() == null || vd.getValueType().toString().equals(VirtualTablePointer.class.getName())) { return false; } return true; }
@Override public void visitVariablesDeclaration(VariablesDeclaration v) { if (v.getDeclarators().isEmpty() && v.getValueType() instanceof TaggedTypeRef) { TaggedTypeRefDeclaration d = new TaggedTypeRefDeclaration((TaggedTypeRef) v.getValueType()); d.importComments(v); v.replaceBy(d); d.accept(this); } else { super.visitVariablesDeclaration(v); } }
@Override public void visitVariablesDeclaration(VariablesDeclaration v) { if (v.getDeclarators().isEmpty() && v.getValueType() instanceof TaggedTypeRef) { TaggedTypeRefDeclaration d = new TaggedTypeRefDeclaration((TaggedTypeRef) v.getValueType()); d.importComments(v); v.replaceBy(d); d.accept(this); } else { super.visitVariablesDeclaration(v); } }
if (v.getValueType() instanceof FunctionSignature) { return; continue; // TODO provide a mapping of exported values TypeRef mutatedType = (TypeRef) decl.mutateTypeKeepingParent(v.getValueType()); if (mutatedType == null || !mutatedType.getModifiers().contains(ModifierType.Const)
if (v.getValueType() instanceof FunctionSignature) { return; continue; // TODO provide a mapping of exported values TypeRef mutatedType = (TypeRef) decl.mutateTypeKeepingParent(v.getValueType()); if (mutatedType == null || !mutatedType.getModifiers().contains(ModifierType.Const)
Declarator decl = v.getDeclarators().get(0); TypeRef vt = v.getValueType(); MutableByDeclarator mt = decl instanceof DirectDeclarator ? vt : decl.mutateTypeKeepingParent(vt);
Declarator decl = v.getDeclarators().get(0); TypeRef vt = v.getValueType(); MutableByDeclarator mt = decl instanceof DirectDeclarator ? vt : decl.mutateTypeKeepingParent(vt);
TypeRef valueType = v.getValueType(); for (Declarator vs : v.getDeclarators()) { String name = vs.resolveName(); String st = vd.getValueType().toString(), mst = st; if (st.equals("int") || st.equals("long") || st.equals("short") || st.equals("long")) { if (bits <= 8) { Function getMethod = new Function(Function.Type.JavaMethod, ident("get" + StringUtils.capitalize(name)), vd.getValueType().clone()).setBody(block( new Statement.Return(varRef(name)))).addModifiers(ModifierType.Public); if (signatures.addMethod(getMethod)) { Function setMethod = new Function(Function.Type.JavaMethod, ident("set" + StringUtils.capitalize(name)), typeRef(Void.TYPE), new Arg(name, vd.getValueType().clone())).setBody(block( stat(expr(memberRef(thisRef(), MemberRefStyle.Dot, ident(name)), AssignmentOperator.Equal, varRef(name))))).addModifiers(ModifierType.Public); if (signatures.addMethod(setMethod)) {
Declarator.MutableByDeclarator mutatedType = vs.mutateType(v.getValueType()); if (mutatedType instanceof Function) { Function f = (Function) mutatedType; TypeRef vt = v.getValueType(); decl = new VariablesDeclaration(vt == null ? null : vt.clone(), vs.clone()); decl.importDetails(v, false); decl.importDetails(vs, false); decl.importDetails(v.getValueType(), true);
Declarator.MutableByDeclarator mutatedType = vs.mutateType(v.getValueType()); if (mutatedType instanceof Function) { Function f = (Function) mutatedType; TypeRef vt = v.getValueType(); decl = new VariablesDeclaration(vt == null ? null : vt.clone(), vs.clone()); decl.importDetails(v, false); decl.importDetails(vs, false); decl.importDetails(v.getValueType(), true);
TypeRef valueType = v.getValueType(); for (Declarator vs : v.getDeclarators()) { String name = vs.resolveName(); String st = vd.getValueType().toString(), mst = st; if (st.equals("int") || st.equals("long") || st.equals("short") || st.equals("long")) { if (bits <= 8) { Function getMethod = new Function(Function.Type.JavaMethod, ident("get" + StringUtils.capitalize(name)), vd.getValueType().clone()).setBody(block( new Statement.Return(varRef(name)))).addModifiers(ModifierType.Public); if (signatures.addMethod(getMethod)) { Function setMethod = new Function(Function.Type.JavaMethod, ident("set" + StringUtils.capitalize(name)), typeRef(Void.TYPE), new Arg(name, vd.getValueType().clone())).setBody(block( stat(expr(memberRef(thisRef(), MemberRefStyle.Dot, ident(name)), AssignmentOperator.Equal, varRef(name))))).addModifiers(ModifierType.Public); if (signatures.addMethod(setMethod)) {
@Override public boolean convertVariablesDeclaration(VariablesDeclaration v, Signatures signatures, DeclarationsHolder out, int[] iChild, boolean isGlobal, Identifier holderName, Identifier callerLibraryClass, String callerLibrary) { try { TypeRef valueType = v.getValueType(); for (Declarator vs : v.getDeclarators()) { if (vs.getDefaultValue() != null) {
@Override public boolean convertVariablesDeclaration(VariablesDeclaration v, Signatures signatures, DeclarationsHolder out, int[] iChild, boolean isGlobal, Identifier holderName, Identifier callerLibraryClass, String callerLibrary) { try { TypeRef valueType = v.getValueType(); for (Declarator vs : v.getDeclarators()) { if (vs.getDefaultValue() != null) {
TypeRef tr = vd.getValueType(); if (!isField(vd)) { continue; String name = chooseJavaArgName(vd.getDeclarators().get(0).resolveName(), iArg, names); namesById.put(vd.getId(), name); fieldsConstr.addArg(new Arg(name, vd.getValueType().clone())); iArg++; if (vd.getValueType() instanceof TypeRef.ArrayRef) { fieldsConstr.getBody().addStatement(throwIfArraySizeDifferent(uname));
decl.setName(changedName); VariablesDeclaration vd = (VariablesDeclaration) decl.getParentElement(); TypeRef tr = vd.getValueType();
decl.setName(changedName); VariablesDeclaration vd = (VariablesDeclaration) decl.getParentElement(); TypeRef tr = vd.getValueType();
TypeRef tr = vd.getValueType(); if (!isField(vd)) { continue; String name = chooseJavaArgName(vd.getDeclarators().get(0).resolveName(), iArg, names); namesById.put(vd.getId(), name); fieldsConstr.addArg(new Arg(name, vd.getValueType().clone())); iArg++; if (vd.getValueType() instanceof TypeRef.ArrayRef) { fieldsConstr.getBody().addStatement(throwIfArraySizeDifferent(uname));
try { Identifier name = result.typeConverter.getValidJavaArgumentName(ident(d.resolveName())); TypeRef type = (TypeRef) d.mutateTypeKeepingParent(globals.getValueType()); if (type == null) { continue; holderStruct.addModifiers(ModifierType.Final); VariablesDeclaration vd = ((JNADeclarationsConverter) result.declarationsConverter).convertVariablesDeclarationToJNA("value", type, new int[1], callerLibraryName); if (vd.getValueType().toString().equals(result.config.runtime.pointerClass.getName())) { isByRef = true; instType = convPointerType;
typeDef = new TypeDef(vd.getValueType(), vd.getDeclarators());