Tabnine Logo
TypeRef$FunctionSignature
Code IndexAdd Tabnine to your IDE (free)

How to use
TypeRef$FunctionSignature
in
com.ochafik.lang.jnaerator.parser

Best Java code snippets using com.ochafik.lang.jnaerator.parser.TypeRef$FunctionSignature (Showing top 20 results out of 315)

origin: nativelibs4java/JNAerator

retval.signature = mark(new FunctionSignature(new Function(Function.Type.CFunction, null, null)), getLine(tk));
retval.signature.getFunction().setType(Function.Type.CFunction);
     retval.signature.getFunction().addModifiers(m1);
     retval.pointerStyle = PointerStyle.parsePointerStyle((pt!=null?pt.getText():null));
     if ((pt!=null?pt.getText():null) != null && (pt!=null?pt.getText():null).equals("^"))
      retval.signature.setType(FunctionSignature.Type.ObjCBlock);
          retval.signature.getFunction().addModifiers(m2);
     retval.signature.getFunction().setName(new SimpleIdentifier((ii!=null?ii.getText():null)));
      retval.signature.getFunction().addArg((a1!=null?a1.arg:null)); 
          retval.signature.getFunction().addArg((ax!=null?ax.arg:null)); 
origin: nativelibs4java/JNAerator

public Identifier inferCallBackName(FunctionSignature functionSignature, boolean prependNamespaces, boolean qualify, Identifier libraryClassName) {
  List<String> nameElements = new ArrayList<String>();
  Identifier name = functionSignature.getFunction().getName();
  if (name != null) {
    name = name.clone();
  Element parent = functionSignature.getParentElement();
  if (parent instanceof TypeRef.Pointer)
    parent = parent.getParentElement();
origin: com.nativelibs4java/jnaerator

@Override
public Struct convertCallback(FunctionSignature functionSignature, Signatures signatures, Identifier callerLibraryName) {
  Struct decl = super.convertCallback(functionSignature, signatures, callerLibraryName);
  if (decl != null) {
    decl.setParents(Arrays.asList((SimpleTypeRef) (FunctionSignature.Type.ObjCBlock.equals(functionSignature.getType())
        ? result.config.runtime.typeRef(JNAeratorConfig.Runtime.Ann.ObjCBlock)
        : (SimpleTypeRef) typeRef(ident(result.config.runtime.callbackClass, expr(typeRef(decl.getTag().clone())))))));
    //addCallingConventionAnnotation(functionSignature.getFunction(), decl);
  }
  return decl;
}
origin: com.nativelibs4java/jnaerator

  return tr;
} else {
  return typeRef(((TypeRef.FunctionSignature) valueType).getFunction().getName().clone());
origin: nativelibs4java/JNAerator

  return tr;
} else {
  return typeRef(((TypeRef.FunctionSignature) valueType).getFunction().getName().clone());
origin: nativelibs4java/JNAerator

assert (f1!=null?f1.signature:null) != null && (f1!=null?f1.signature:null).getFunction() != null;
if ((f1!=null?f1.signature:null) != null && (f1!=null?f1.signature:null).getFunction() != null) {
 (f1!=null?f1.signature:null).getFunction().setValueType(type); 
 type = (f1!=null?f1.signature:null);
 if ((f1!=null?f1.pointerStyle:null) != null) {
origin: com.nativelibs4java/jnaerator

public Identifier inferCallBackName(FunctionSignature functionSignature, boolean prependNamespaces, boolean qualify, Identifier libraryClassName) {
  List<String> nameElements = new ArrayList<String>();
  Identifier name = functionSignature.getFunction().getName();
  if (name != null) {
    name = name.clone();
  Element parent = functionSignature.getParentElement();
  if (parent instanceof TypeRef.Pointer)
    parent = parent.getParentElement();
origin: nativelibs4java/JNAerator

@Override
public void visitFunctionSignature(FunctionSignature functionSignature) {
  Identifier origName = functionSignature.getFunction() == null ? null : functionSignature.getFunction().getName();
  Element parent = functionSignature.getParentElement();
    if (functionSignature.getParentElement() instanceof Arg) {
      Arg arg = (Arg) functionSignature.getParentElement();
      if (arg.getName() == null) {
        arg.setName(origName.toString());
        functionSignature.getFunction().setName(null);
  DeclarationsHolder holder = functionSignature.findParentOfType(DeclarationsHolder.class);
  Function f = functionSignature.getFunction();
  if (holder != null && f != null && !isNull(f.getName())) {
    Identifier fnameClone = f.getName().clone();
        VariablesDeclaration pvd = (VariablesDeclaration) d;
        pvd.addDeclarator(new DirectDeclarator((origName == null ? fnameClone : origName).toString()));
        functionSignature.replaceBy(functionSignatureRef(fnameClone));
      } else {
      functionSignature.replaceBy(functionSignatureRef(fnameClone));
origin: com.nativelibs4java/jnaerator

@Override
public void visitFunctionSignature(FunctionSignature functionSignature) {
  Identifier origName = functionSignature.getFunction() == null ? null : functionSignature.getFunction().getName();
  Element parent = functionSignature.getParentElement();
    if (functionSignature.getParentElement() instanceof Arg) {
      Arg arg = (Arg) functionSignature.getParentElement();
      if (arg.getName() == null) {
        arg.setName(origName.toString());
        functionSignature.getFunction().setName(null);
  DeclarationsHolder holder = functionSignature.findParentOfType(DeclarationsHolder.class);
  Function f = functionSignature.getFunction();
  if (holder != null && f != null && !isNull(f.getName())) {
    Identifier fnameClone = f.getName().clone();
        VariablesDeclaration pvd = (VariablesDeclaration) d;
        pvd.addDeclarator(new DirectDeclarator((origName == null ? fnameClone : origName).toString()));
        functionSignature.replaceBy(functionSignatureRef(fnameClone));
      } else {
      functionSignature.replaceBy(functionSignatureRef(fnameClone));
origin: nativelibs4java/JNAerator

 ((FunctionSignature)tr).getFunction().getName() != null
)) ) {
if (state.backtracking>0) {state.failed=true; return decl;}
origin: com.nativelibs4java/jnaerator

Function function = functionSignature.getFunction();
Element parent = functionSignature.getParentElement();
Element comel = parent != null && parent instanceof TypeDef ? parent : functionSignature;
origin: nativelibs4java/JNAerator

Function function = functionSignature.getFunction();
Element parent = functionSignature.getParentElement();
Element comel = parent != null && parent instanceof TypeDef ? parent : functionSignature;
origin: com.nativelibs4java/jnaerator

@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;
origin: nativelibs4java/JNAerator

@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;
origin: com.nativelibs4java/jnaerator

/**
 * @return true if the functionSignature changed and triggerered
 * revisitation
 */
private boolean chooseNameIfMissing(FunctionSignature functionSignature) {
  Function function = functionSignature.getFunction();
  Element parent = functionSignature.getParentElement();
  if (function != null && (isNull(function.getName()) || parent instanceof VariablesDeclaration || parent instanceof Arg)) {
    String name = null;
    String exact = JNAeratorUtils.getExactTypeDefName(functionSignature);
    if (exact != null) {
      name = exact;
    } else {
      List<String> ownerNames = JNAeratorUtils.guessOwnerName(function);
      if (function.getName() != null) {
        ownerNames.add(function.getName().toString());
      }
      name = chooseName(functionSignature, ownerNames, true);
    }
    if (name != null) {
      function.setName(ident(name));
      function.accept(this);
      return true;
    }
  }
  return false;
}
Map<String, Integer> nextUnnamedId = new LinkedHashMap<String, Integer>();
origin: nativelibs4java/JNAerator

/**
 * @return true if the functionSignature changed and triggerered
 * revisitation
 */
private boolean chooseNameIfMissing(FunctionSignature functionSignature) {
  Function function = functionSignature.getFunction();
  Element parent = functionSignature.getParentElement();
  if (function != null && (isNull(function.getName()) || parent instanceof VariablesDeclaration || parent instanceof Arg)) {
    String name = null;
    String exact = JNAeratorUtils.getExactTypeDefName(functionSignature);
    if (exact != null) {
      name = exact;
    } else {
      List<String> ownerNames = JNAeratorUtils.guessOwnerName(function);
      if (function.getName() != null) {
        ownerNames.add(function.getName().toString());
      }
      name = chooseName(functionSignature, ownerNames, true);
    }
    if (name != null) {
      function.setName(ident(name));
      function.accept(this);
      return true;
    }
  }
  return false;
}
Map<String, Integer> nextUnnamedId = new LinkedHashMap<String, Integer>();
origin: nativelibs4java/JNAerator

f.setValueType(new TypeRef.FunctionSignature(ff));
f.setType(Type.CFunction);
f.setArgs(getArgs());
origin: nativelibs4java/JNAerator

public void visitFunctionSignature(FunctionSignature e) {
  if (e.getFunction() == null) {
    return;
  }
  assert e.getFunction().getBody() == null;
  modifiersStringPrefix(e);
  append(e.getFunction().getValueType()).space(e.getFunction().getValueType() != null);
  if (e.getParentElement() instanceof TypeRef.Pointer) {
    append("(");
    modifiersStringPrefix(e.getFunction());
    switch (e.getType()) {
      case CFunction:
        append("*");
        break;
      case ObjCBlock:
        append("^");
        break;
    }
    append(e.getFunction().getName());
    append(")");
  } else {
    append(e.getFunction().getName());
  }
  append("(");
  implode(e.getFunction().getArgs(), ", ");
  append(")");
  append(e.getModifiers().isEmpty() ? "" : " ");
  implode(e.getModifiers(), " ");
}
origin: com.nativelibs4java/jnaerator

@Override
protected void visitStoredDeclarations(StoredDeclarations d) {
  super.visitStoredDeclarations(d);
  if (d.getDeclarators().size() == 1) {
    Declarator declarator = d.getDeclarators().get(0);
    if (declarator instanceof FunctionDeclarator) {
      FunctionDeclarator fd = (FunctionDeclarator) declarator;
      Function f = new Function(Function.Type.CFunction, null, d.getValueType(), fd.getArgs());
      f.addModifiers(fd.getTarget().getModifiers());
      FunctionSignature fs = new FunctionSignature(f);
      d.setValueType(fs);
      
      Declarator target = fd.getTarget();
      Declarator newTarget = target == null ?
        new DirectDeclarator(fd.resolveName(), fd.getDefaultValue()) :
        target.clone();
      d.setDeclarators(Arrays.asList(newTarget));
      d.accept(this);
    }
  }
}
origin: nativelibs4java/JNAerator

@Override
protected void visitStoredDeclarations(StoredDeclarations d) {
  super.visitStoredDeclarations(d);
  if (d.getDeclarators().size() == 1) {
    Declarator declarator = d.getDeclarators().get(0);
    if (declarator instanceof FunctionDeclarator) {
      FunctionDeclarator fd = (FunctionDeclarator) declarator;
      Function f = new Function(Function.Type.CFunction, null, d.getValueType(), fd.getArgs());
      f.addModifiers(fd.getTarget().getModifiers());
      FunctionSignature fs = new FunctionSignature(f);
      d.setValueType(fs);
      
      Declarator target = fd.getTarget();
      Declarator newTarget = target == null ?
        new DirectDeclarator(fd.resolveName(), fd.getDefaultValue()) :
        target.clone();
      d.setDeclarators(Arrays.asList(newTarget));
      d.accept(this);
    }
  }
}
com.ochafik.lang.jnaerator.parserTypeRef$FunctionSignature

Most used methods

  • <init>
  • getFunction
  • getParentElement
  • getType
  • changeValue
  • findParentOfType
  • getModifiers
  • getResolvedJavaIdentifier
  • importDetails
  • replaceBy
  • setFunction
  • setResolvedJavaIdentifier
  • setFunction,
  • setResolvedJavaIdentifier,
  • setType

Popular in Java

  • Parsing JSON documents to java classes using gson
  • requestLocationUpdates (LocationManager)
  • getSupportFragmentManager (FragmentActivity)
  • getSharedPreferences (Context)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • JComboBox (javax.swing)
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Top 25 Plugins for Webstorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now