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;
 }
  public Pair<List<VariablesDeclaration>, List<VariablesDeclaration>> getParentAndOwnDeclarations(
      Struct structJavaClass, Struct nativeStruct) throws IOException {
    Pair<List<VariablesDeclaration>, List<VariablesDeclaration>> ret =
        new Pair<List<VariablesDeclaration>, List<VariablesDeclaration>>(
            new ArrayList<VariablesDeclaration>(), new ArrayList<VariablesDeclaration>());
    if (!nativeStruct.getParents().isEmpty()) {
      for (SimpleTypeRef parentName : nativeStruct.getParents()) {
        Struct parent = result.structsByName.get(parentName.getName());
        if (parent == null) {
          // TODO report error
          continue;
        }
        Struct parentJavaClass = convertStruct(parent, new Signatures(), null, null, true);
        Pair<List<VariablesDeclaration>, List<VariablesDeclaration>> parentDecls =
            getParentAndOwnDeclarations(parentJavaClass, parent);
        ret.getFirst().addAll(parentDecls.getFirst());
        ret.getFirst().addAll(parentDecls.getSecond());
      }
    }
    for (Declaration d : structJavaClass.getDeclarations()) {
      if (!(d instanceof VariablesDeclaration)) continue;
      VariablesDeclaration vd = (VariablesDeclaration) d;
      if (vd.getDeclarators().size() != 1) continue; // should not happen !
      if (!isField(vd)) continue;

      ret.getSecond().add(vd);
    }

    return ret;
  }
  @Override
  public void visitVariablesDeclaration(VariablesDeclaration v) {
    super.visitVariablesDeclaration(v);
    if (v.findParentOfTypes(Struct.class, Function.class, Enum.class) != null) return;

    for (Declarator d : v.getDeclarators()) globalVariablesByName.put(ident(d.resolveName()), v);
    getList(globalsByLibrary, getLibrary(v)).add(v);
  }
  protected void outputNSString(
      String name,
      String value,
      DeclarationsHolder out,
      Signatures signatures,
      Element... elementsToTakeCommentsFrom) {

    if (!signatures.addVariable(name)) return;

    TypeRef tr = typeRef(String.class);
    VariablesDeclaration vd = new VariablesDeclaration(tr, new DirectDeclarator(name, expr(value)));
    if (!result.config.noComments)
      for (Element e : elementsToTakeCommentsFrom) {
        vd.addToCommentBefore(e.getCommentBefore());
        vd.addToCommentBefore(e.getCommentAfter());
      }
    vd.addModifiers(ModifierType.Public);
    out.addDeclaration(vd);
  }