List<Declaration> vds = convertVariablesDeclarationToBridJ(name, mutatedType, iChild, vs.getBits(), isGlobal, holderName, callerLibraryClass, callerLibrary, v, vs); if (vs.getBits() > 0) { for (Declaration vd : vds) { vd.addAnnotation(new Annotation(result.config.runtime.typeRef(JNAeratorConfig.Runtime.Ann.Bits), expr(vs.getBits())));
List<Declaration> vds = convertVariablesDeclarationToBridJ(name, mutatedType, iChild, vs.getBits(), isGlobal, holderName, callerLibraryClass, callerLibrary, v, vs); if (vs.getBits() > 0) { for (Declaration vd : vds) { vd.addAnnotation(new Annotation(result.config.runtime.typeRef(JNAeratorConfig.Runtime.Ann.Bits), expr(vs.getBits())));
public void visitDeclarator(Declarator e) { if (e.isParenthesized()) { append('('); } implode(e.getModifiers(), " ").space(!e.getModifiers().isEmpty()); if (e instanceof DirectDeclarator) { append(((DirectDeclarator) e).getName()); } else if (e instanceof PointerDeclarator) { PointerDeclarator d = (PointerDeclarator) e; append(d.getPointerStyle(), d.getTarget()); } else if (e instanceof FunctionDeclarator) { FunctionDeclarator d = (FunctionDeclarator) e; append(d.getTarget(), '(').implode(d.getArgs(), ", ").append(")"); } else if (e instanceof ArrayDeclarator) { ArrayDeclarator d = (ArrayDeclarator) e; append(d.getTarget(), '[').implode(d.getDimensions(), "][").append("]"); } if (e.isParenthesized()) { append(')'); } if (e.getBits() >= 0) { append(":", e.getBits()); } if (e.getDefaultValue() != null) { append(" = ", e.getDefaultValue()); } }
@Override public void visitArg(Arg arg) { Declarator d = arg.getDeclarator(); if (d == null) { TypeRef tr = arg.getValueType(); if (tr instanceof TypeRef.Pointer) { TypeRef target = ((TypeRef.Pointer)tr).getTarget(); if (target instanceof TypeRef.FunctionSignature) { TypeRef.FunctionSignature fs = (TypeRef.FunctionSignature) target; Identifier name = fs.getFunction() == null ? null : fs.getFunction().getName(); if (name != null) { arg.setDeclarator(new DirectDeclarator(name.toString())); fs.getFunction().setName(null); } } } } else if (!(d instanceof DirectDeclarator)) { MutableByDeclarator type = d.mutateType(arg.getValueType()); if (type instanceof TypeRef) { arg.setValueType((TypeRef) type); arg.setDeclarator(new DirectDeclarator(d.resolveName(), d.getBits(), arg.getDefaultValue())); } else { type = null; } } super.visitArg(arg); } private static final boolean mutateDeclaratorTypes = true;
@Override public void visitArg(Arg arg) { Declarator d = arg.getDeclarator(); if (d == null) { TypeRef tr = arg.getValueType(); if (tr instanceof TypeRef.Pointer) { TypeRef target = ((TypeRef.Pointer)tr).getTarget(); if (target instanceof TypeRef.FunctionSignature) { TypeRef.FunctionSignature fs = (TypeRef.FunctionSignature) target; Identifier name = fs.getFunction() == null ? null : fs.getFunction().getName(); if (name != null) { arg.setDeclarator(new DirectDeclarator(name.toString())); fs.getFunction().setName(null); } } } } else if (!(d instanceof DirectDeclarator)) { MutableByDeclarator type = d.mutateType(arg.getValueType()); if (type instanceof TypeRef) { arg.setValueType((TypeRef) type); arg.setDeclarator(new DirectDeclarator(d.resolveName(), d.getBits(), arg.getDefaultValue())); } else { type = null; } } super.visitArg(arg); } private static final boolean mutateDeclaratorTypes = true;
if (mutatedType instanceof TypeRef) { TypeRef tr = (TypeRef) mutatedType; decl = new VariablesDeclaration(tr, new DirectDeclarator(vs.resolveName(), vs.getBits(), vs.getDefaultValue())); decl.importDetails(v, false); decl.importDetails(vs, false);
if (mutatedType instanceof TypeRef) { TypeRef tr = (TypeRef) mutatedType; decl = new VariablesDeclaration(tr, new DirectDeclarator(vs.resolveName(), vs.getBits(), vs.getDefaultValue())); decl.importDetails(v, false); decl.importDetails(vs, false);