com.sun.tools.corba.se.idl.constExpr.Expression Java Examples

The following examples show how to use com.sun.tools.corba.se.idl.constExpr.Expression. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SequenceGen.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) {
  int offsetOfType = tcoffsets.offset (entry.type ().fullName ());
  if (offsetOfType >= 0)
  {
    // This is a recursive sequence
    tcoffsets.set (null);

    // Need to fix later: how to get repositoryId of IDL type containing this sequence?
    // entry.repositoryID().ID() returns empty string and
    // Util.javaQualifiedName(entry) returns internal name which is not valid repId

    stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_recursive_tc (" + "\"\"" + ");");
    tcoffsets.bumpCurrentOffset (4); // add indirection field
  }
  else
  {
    // This is a normal sequence
    tcoffsets.set (entry);
    index = ((JavaGenerator)entry.type ().generator ()).type (index + 1, indent, tcoffsets, name, entry.type (), stream);
    Expression maxSize = ((SequenceEntry)entry).maxSize ();
    if (maxSize == null)
      stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_sequence_tc (0, " + name + ");");
    else
      stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_sequence_tc (" + Util.parseExpression (maxSize) + ", " + name + ");");
  }
  //stream.println (indent + name + " = " + Util.helperName (entry, true) + ".type ();"); // <d61056>
  return index;
}
 
Example #2
Source File: UnionGen.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
private int writeNonBoolean (String disName, int index, String indent, String name, UnionEntry u, PrintWriter stream)
{
  SymtabEntry utype = Util.typeOf (u.type ());
  if (utype instanceof EnumEntry)
    stream.println (indent + "switch (" + name + ".discriminator ().value ())");
  else
    stream.println (indent + "switch (" + name + ".discriminator ())");
  stream.println (indent + "{");
  String typePackage = Util.javaQualifiedName (utype) + '.';
  Enumeration e = u.branches ().elements ();
  while (e.hasMoreElements ())
  {
    UnionBranch branch = (UnionBranch)e.nextElement ();
    Enumeration labels = branch.labels.elements ();
    while (labels.hasMoreElements ())
    {
      Expression label = (Expression)labels.nextElement ();
      if (utype instanceof EnumEntry)
      {
        String key = Util.parseExpression (label);
        stream.println (indent + "  case " + typePackage + '_' + key + ":");
      }
      else
        stream.println (indent + "  case " + cast (label, utype) + ':');
    }
    if (!branch.typedef.equals (u.defaultBranch ()))
    {
      index = writeBranch (index, indent + "    ", name, branch.typedef, stream);
      stream.println (indent + "    break;");
    }
  }
  if (u.defaultBranch () != null) {
    stream.println (indent + "  default:");
    index = writeBranch (index, indent + "    ", name, u.defaultBranch (), stream);
    stream.println (indent + "    break;");
  }
  stream.println (indent + "}");
  return index;
}
 
Example #3
Source File: MethodGen.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
private void writeType (String indent, String name, SymtabEntry type, PrintWriter stream)
{
  if (type instanceof PrimitiveEntry)
  {
    // RJB does something have to be done with TC offsets?
    if (type.name ().equals ("long long"))
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_longlong));");
    else if (type.name ().equals ("unsigned short"))
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ushort));");
    else if (type.name ().equals ("unsigned long"))
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ulong));");
    else if (type.name ().equals ("unsigned long long"))
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ulonglong));");
    else
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_" + type.name () + "));");
  }
  else if (type instanceof StringEntry)
  {
    StringEntry s = (StringEntry)type;
    Expression e  = s.maxSize ();
    if (e == null)
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().create_" + type.name () + "_tc (" + Util.parseExpression (e) + "));");
   else
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().create_" + type.name () + "_tc (0));");
  }
  else
    stream.println (indent + name + '(' + Util.helperName (type, true) + ".type ());"); // <d61056>
}
 
Example #4
Source File: UnionGen.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
private Vector vectorizeLabels (Vector branchVector, boolean useIntsForEnums )
{
  Vector mergedLabels = new Vector ();
  Enumeration branches = branchVector.elements ();
  while (branches.hasMoreElements ())
  {
    UnionBranch branch = (UnionBranch)branches.nextElement ();
    Enumeration labels = branch.labels.elements ();
    while (labels.hasMoreElements ())
    {
      Expression expr = (Expression)labels.nextElement ();
      String str ;

      if (unionIsEnum)
        if (useIntsForEnums)
          str = typePackage + "_" + Util.parseExpression( expr ) ;
        else
          str = typePackage + Util.parseExpression( expr ) ;
      else
        str = Util.parseExpression( expr ) ;

      mergedLabels.addElement (str);
    }
  }
  return mergedLabels;
}
 
Example #5
Source File: MethodGen.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
private void writeType (String indent, String name, SymtabEntry type, PrintWriter stream)
{
  if (type instanceof PrimitiveEntry)
  {
    // RJB does something have to be done with TC offsets?
    if (type.name ().equals ("long long"))
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_longlong));");
    else if (type.name ().equals ("unsigned short"))
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ushort));");
    else if (type.name ().equals ("unsigned long"))
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ulong));");
    else if (type.name ().equals ("unsigned long long"))
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ulonglong));");
    else
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_" + type.name () + "));");
  }
  else if (type instanceof StringEntry)
  {
    StringEntry s = (StringEntry)type;
    Expression e  = s.maxSize ();
    if (e == null)
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().create_" + type.name () + "_tc (" + Util.parseExpression (e) + "));");
   else
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().create_" + type.name () + "_tc (0));");
  }
  else
    stream.println (indent + name + '(' + Util.helperName (type, true) + ".type ());"); // <d61056>
}
 
Example #6
Source File: UnionEntry.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
boolean has (Expression label)
{
  Enumeration eBranches = _branches.elements ();
  while (eBranches.hasMoreElements ())
  {
    Enumeration eLabels = ((UnionBranch)eBranches.nextElement ()).labels.elements ();
    while (eLabels.hasMoreElements ())
    {
      Expression exp = (Expression)eLabels.nextElement ();
      if (exp.equals (label) || exp.value ().equals (label.value ()))
        return true;
    }
  }
  return false;
}
 
Example #7
Source File: UnionGen.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
private int writeNonBoolean (String disName, int index, String indent, String name, UnionEntry u, PrintWriter stream)
{
  SymtabEntry utype = Util.typeOf (u.type ());
  if (utype instanceof EnumEntry)
    stream.println (indent + "switch (" + name + ".discriminator ().value ())");
  else
    stream.println (indent + "switch (" + name + ".discriminator ())");
  stream.println (indent + "{");
  String typePackage = Util.javaQualifiedName (utype) + '.';
  Enumeration e = u.branches ().elements ();
  while (e.hasMoreElements ())
  {
    UnionBranch branch = (UnionBranch)e.nextElement ();
    Enumeration labels = branch.labels.elements ();
    while (labels.hasMoreElements ())
    {
      Expression label = (Expression)labels.nextElement ();
      if (utype instanceof EnumEntry)
      {
        String key = Util.parseExpression (label);
        stream.println (indent + "  case " + typePackage + '_' + key + ":");
      }
      else
        stream.println (indent + "  case " + cast (label, utype) + ':');
    }
    if (!branch.typedef.equals (u.defaultBranch ()))
    {
      index = writeBranch (index, indent + "    ", name, branch.typedef, stream);
      stream.println (indent + "    break;");
    }
  }
  if (u.defaultBranch () != null) {
    stream.println (indent + "  default:");
    index = writeBranch (index, indent + "    ", name, u.defaultBranch (), stream);
    stream.println (indent + "    break;");
  }
  stream.println (indent + "}");
  return index;
}
 
Example #8
Source File: UnionGen.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
private int writeNonBoolean (String disName, int index, String indent, String name, UnionEntry u, PrintWriter stream)
{
  SymtabEntry utype = Util.typeOf (u.type ());
  if (utype instanceof EnumEntry)
    stream.println (indent + "switch (" + name + ".discriminator ().value ())");
  else
    stream.println (indent + "switch (" + name + ".discriminator ())");
  stream.println (indent + "{");
  String typePackage = Util.javaQualifiedName (utype) + '.';
  Enumeration e = u.branches ().elements ();
  while (e.hasMoreElements ())
  {
    UnionBranch branch = (UnionBranch)e.nextElement ();
    Enumeration labels = branch.labels.elements ();
    while (labels.hasMoreElements ())
    {
      Expression label = (Expression)labels.nextElement ();
      if (utype instanceof EnumEntry)
      {
        String key = Util.parseExpression (label);
        stream.println (indent + "  case " + typePackage + '_' + key + ":");
      }
      else
        stream.println (indent + "  case " + cast (label, utype) + ':');
    }
    if (!branch.typedef.equals (u.defaultBranch ()))
    {
      index = writeBranch (index, indent + "    ", name, branch.typedef, stream);
      stream.println (indent + "    break;");
    }
  }
  if (u.defaultBranch () != null) {
    stream.println (indent + "  default:");
    index = writeBranch (index, indent + "    ", name, u.defaultBranch (), stream);
    stream.println (indent + "    break;");
  }
  stream.println (indent + "}");
  return index;
}
 
Example #9
Source File: UnionGen.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
private Vector vectorizeLabels (Vector branchVector, boolean useIntsForEnums )
{
  Vector mergedLabels = new Vector ();
  Enumeration branches = branchVector.elements ();
  while (branches.hasMoreElements ())
  {
    UnionBranch branch = (UnionBranch)branches.nextElement ();
    Enumeration labels = branch.labels.elements ();
    while (labels.hasMoreElements ())
    {
      Expression expr = (Expression)labels.nextElement ();
      String str ;

      if (unionIsEnum)
        if (useIntsForEnums)
          str = typePackage + "_" + Util.parseExpression( expr ) ;
        else
          str = typePackage + Util.parseExpression( expr ) ;
      else
        str = Util.parseExpression( expr ) ;

      mergedLabels.addElement (str);
    }
  }
  return mergedLabels;
}
 
Example #10
Source File: SequenceGen.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) {
  int offsetOfType = tcoffsets.offset (entry.type ().fullName ());
  if (offsetOfType >= 0)
  {
    // This is a recursive sequence
    tcoffsets.set (null);

    // Need to fix later: how to get repositoryId of IDL type containing this sequence?
    // entry.repositoryID().ID() returns empty string and
    // Util.javaQualifiedName(entry) returns internal name which is not valid repId

    stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_recursive_tc (" + "\"\"" + ");");
    tcoffsets.bumpCurrentOffset (4); // add indirection field
  }
  else
  {
    // This is a normal sequence
    tcoffsets.set (entry);
    index = ((JavaGenerator)entry.type ().generator ()).type (index + 1, indent, tcoffsets, name, entry.type (), stream);
    Expression maxSize = ((SequenceEntry)entry).maxSize ();
    if (maxSize == null)
      stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_sequence_tc (0, " + name + ");");
    else
      stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_sequence_tc (" + Util.parseExpression (maxSize) + ", " + name + ");");
  }
  //stream.println (indent + name + " = " + Util.helperName (entry, true) + ".type ();"); // <d61056>
  return index;
}
 
Example #11
Source File: MethodGen.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
private void writeType (String indent, String name, SymtabEntry type, PrintWriter stream)
{
  if (type instanceof PrimitiveEntry)
  {
    // RJB does something have to be done with TC offsets?
    if (type.name ().equals ("long long"))
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_longlong));");
    else if (type.name ().equals ("unsigned short"))
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ushort));");
    else if (type.name ().equals ("unsigned long"))
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ulong));");
    else if (type.name ().equals ("unsigned long long"))
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ulonglong));");
    else
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_" + type.name () + "));");
  }
  else if (type instanceof StringEntry)
  {
    StringEntry s = (StringEntry)type;
    Expression e  = s.maxSize ();
    if (e == null)
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().create_" + type.name () + "_tc (" + Util.parseExpression (e) + "));");
   else
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().create_" + type.name () + "_tc (0));");
  }
  else
    stream.println (indent + name + '(' + Util.helperName (type, true) + ".type ());"); // <d61056>
}
 
Example #12
Source File: UnionGen.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
private int writeNonBoolean (String disName, int index, String indent, String name, UnionEntry u, PrintWriter stream)
{
  SymtabEntry utype = Util.typeOf (u.type ());
  if (utype instanceof EnumEntry)
    stream.println (indent + "switch (" + name + ".discriminator ().value ())");
  else
    stream.println (indent + "switch (" + name + ".discriminator ())");
  stream.println (indent + "{");
  String typePackage = Util.javaQualifiedName (utype) + '.';
  Enumeration e = u.branches ().elements ();
  while (e.hasMoreElements ())
  {
    UnionBranch branch = (UnionBranch)e.nextElement ();
    Enumeration labels = branch.labels.elements ();
    while (labels.hasMoreElements ())
    {
      Expression label = (Expression)labels.nextElement ();
      if (utype instanceof EnumEntry)
      {
        String key = Util.parseExpression (label);
        stream.println (indent + "  case " + typePackage + '_' + key + ":");
      }
      else
        stream.println (indent + "  case " + cast (label, utype) + ':');
    }
    if (!branch.typedef.equals (u.defaultBranch ()))
    {
      index = writeBranch (index, indent + "    ", name, branch.typedef, stream);
      stream.println (indent + "    break;");
    }
  }
  if (u.defaultBranch () != null) {
    stream.println (indent + "  default:");
    index = writeBranch (index, indent + "    ", name, u.defaultBranch (), stream);
    stream.println (indent + "    break;");
  }
  stream.println (indent + "}");
  return index;
}
 
Example #13
Source File: UnionEntry.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
boolean has (Expression label)
{
  Enumeration eBranches = _branches.elements ();
  while (eBranches.hasMoreElements ())
  {
    Enumeration eLabels = ((UnionBranch)eBranches.nextElement ()).labels.elements ();
    while (eLabels.hasMoreElements ())
    {
      Expression exp = (Expression)eLabels.nextElement ();
      if (exp.equals (label) || exp.value ().equals (label.value ()))
        return true;
    }
  }
  return false;
}
 
Example #14
Source File: UnionEntry.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
boolean has (Expression label)
{
  Enumeration eBranches = _branches.elements ();
  while (eBranches.hasMoreElements ())
  {
    Enumeration eLabels = ((UnionBranch)eBranches.nextElement ()).labels.elements ();
    while (eLabels.hasMoreElements ())
    {
      Expression exp = (Expression)eLabels.nextElement ();
      if (exp.equals (label) || exp.value ().equals (label.value ()))
        return true;
    }
  }
  return false;
}
 
Example #15
Source File: UnionGen.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
private Vector vectorizeLabels (Vector branchVector, boolean useIntsForEnums )
{
  Vector mergedLabels = new Vector ();
  Enumeration branches = branchVector.elements ();
  while (branches.hasMoreElements ())
  {
    UnionBranch branch = (UnionBranch)branches.nextElement ();
    Enumeration labels = branch.labels.elements ();
    while (labels.hasMoreElements ())
    {
      Expression expr = (Expression)labels.nextElement ();
      String str ;

      if (unionIsEnum)
        if (useIntsForEnums)
          str = typePackage + "_" + Util.parseExpression( expr ) ;
        else
          str = typePackage + Util.parseExpression( expr ) ;
      else
        str = Util.parseExpression( expr ) ;

      mergedLabels.addElement (str);
    }
  }
  return mergedLabels;
}
 
Example #16
Source File: SequenceGen.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) {
  int offsetOfType = tcoffsets.offset (entry.type ().fullName ());
  if (offsetOfType >= 0)
  {
    // This is a recursive sequence
    tcoffsets.set (null);

    // Need to fix later: how to get repositoryId of IDL type containing this sequence?
    // entry.repositoryID().ID() returns empty string and
    // Util.javaQualifiedName(entry) returns internal name which is not valid repId

    stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_recursive_tc (" + "\"\"" + ");");
    tcoffsets.bumpCurrentOffset (4); // add indirection field
  }
  else
  {
    // This is a normal sequence
    tcoffsets.set (entry);
    index = ((JavaGenerator)entry.type ().generator ()).type (index + 1, indent, tcoffsets, name, entry.type (), stream);
    Expression maxSize = ((SequenceEntry)entry).maxSize ();
    if (maxSize == null)
      stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_sequence_tc (0, " + name + ");");
    else
      stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_sequence_tc (" + Util.parseExpression (maxSize) + ", " + name + ");");
  }
  //stream.println (indent + name + " = " + Util.helperName (entry, true) + ".type ();"); // <d61056>
  return index;
}
 
Example #17
Source File: UnionGen.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
private int writeNonBoolean (String disName, int index, String indent, String name, UnionEntry u, PrintWriter stream)
{
  SymtabEntry utype = Util.typeOf (u.type ());
  if (utype instanceof EnumEntry)
    stream.println (indent + "switch (" + name + ".discriminator ().value ())");
  else
    stream.println (indent + "switch (" + name + ".discriminator ())");
  stream.println (indent + "{");
  String typePackage = Util.javaQualifiedName (utype) + '.';
  Enumeration e = u.branches ().elements ();
  while (e.hasMoreElements ())
  {
    UnionBranch branch = (UnionBranch)e.nextElement ();
    Enumeration labels = branch.labels.elements ();
    while (labels.hasMoreElements ())
    {
      Expression label = (Expression)labels.nextElement ();
      if (utype instanceof EnumEntry)
      {
        String key = Util.parseExpression (label);
        stream.println (indent + "  case " + typePackage + '_' + key + ":");
      }
      else
        stream.println (indent + "  case " + cast (label, utype) + ':');
    }
    if (!branch.typedef.equals (u.defaultBranch ()))
    {
      index = writeBranch (index, indent + "    ", name, branch.typedef, stream);
      stream.println (indent + "    break;");
    }
  }
  if (u.defaultBranch () != null) {
    stream.println (indent + "  default:");
    index = writeBranch (index, indent + "    ", name, u.defaultBranch (), stream);
    stream.println (indent + "    break;");
  }
  stream.println (indent + "}");
  return index;
}
 
Example #18
Source File: MethodGen.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
private void writeType (String indent, String name, SymtabEntry type, PrintWriter stream)
{
  if (type instanceof PrimitiveEntry)
  {
    // RJB does something have to be done with TC offsets?
    if (type.name ().equals ("long long"))
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_longlong));");
    else if (type.name ().equals ("unsigned short"))
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ushort));");
    else if (type.name ().equals ("unsigned long"))
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ulong));");
    else if (type.name ().equals ("unsigned long long"))
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ulonglong));");
    else
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_" + type.name () + "));");
  }
  else if (type instanceof StringEntry)
  {
    StringEntry s = (StringEntry)type;
    Expression e  = s.maxSize ();
    if (e == null)
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().create_" + type.name () + "_tc (" + Util.parseExpression (e) + "));");
   else
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().create_" + type.name () + "_tc (0));");
  }
  else
    stream.println (indent + name + '(' + Util.helperName (type, true) + ".type ());"); // <d61056>
}
 
Example #19
Source File: UnionEntry.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
boolean has (Expression label)
{
  Enumeration eBranches = _branches.elements ();
  while (eBranches.hasMoreElements ())
  {
    Enumeration eLabels = ((UnionBranch)eBranches.nextElement ()).labels.elements ();
    while (eLabels.hasMoreElements ())
    {
      Expression exp = (Expression)eLabels.nextElement ();
      if (exp.equals (label) || exp.value ().equals (label.value ()))
        return true;
    }
  }
  return false;
}
 
Example #20
Source File: MethodGen.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
private void writeType (String indent, String name, SymtabEntry type, PrintWriter stream)
{
  if (type instanceof PrimitiveEntry)
  {
    // RJB does something have to be done with TC offsets?
    if (type.name ().equals ("long long"))
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_longlong));");
    else if (type.name ().equals ("unsigned short"))
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ushort));");
    else if (type.name ().equals ("unsigned long"))
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ulong));");
    else if (type.name ().equals ("unsigned long long"))
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ulonglong));");
    else
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_" + type.name () + "));");
  }
  else if (type instanceof StringEntry)
  {
    StringEntry s = (StringEntry)type;
    Expression e  = s.maxSize ();
    if (e == null)
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().create_" + type.name () + "_tc (" + Util.parseExpression (e) + "));");
   else
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().create_" + type.name () + "_tc (0));");
  }
  else
    stream.println (indent + name + '(' + Util.helperName (type, true) + ".type ());"); // <d61056>
}
 
Example #21
Source File: SequenceGen.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) {
  int offsetOfType = tcoffsets.offset (entry.type ().fullName ());
  if (offsetOfType >= 0)
  {
    // This is a recursive sequence
    tcoffsets.set (null);

    // Need to fix later: how to get repositoryId of IDL type containing this sequence?
    // entry.repositoryID().ID() returns empty string and
    // Util.javaQualifiedName(entry) returns internal name which is not valid repId

    stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_recursive_tc (" + "\"\"" + ");");
    tcoffsets.bumpCurrentOffset (4); // add indirection field
  }
  else
  {
    // This is a normal sequence
    tcoffsets.set (entry);
    index = ((JavaGenerator)entry.type ().generator ()).type (index + 1, indent, tcoffsets, name, entry.type (), stream);
    Expression maxSize = ((SequenceEntry)entry).maxSize ();
    if (maxSize == null)
      stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_sequence_tc (0, " + name + ");");
    else
      stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_sequence_tc (" + Util.parseExpression (maxSize) + ", " + name + ");");
  }
  //stream.println (indent + name + " = " + Util.helperName (entry, true) + ".type ();"); // <d61056>
  return index;
}
 
Example #22
Source File: UnionEntry.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
boolean has (Expression label)
{
  Enumeration eBranches = _branches.elements ();
  while (eBranches.hasMoreElements ())
  {
    Enumeration eLabels = ((UnionBranch)eBranches.nextElement ()).labels.elements ();
    while (eLabels.hasMoreElements ())
    {
      Expression exp = (Expression)eLabels.nextElement ();
      if (exp.equals (label) || exp.value ().equals (label.value ()))
        return true;
    }
  }
  return false;
}
 
Example #23
Source File: MethodGen.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
private void writeType (String indent, String name, SymtabEntry type, PrintWriter stream)
{
  if (type instanceof PrimitiveEntry)
  {
    // RJB does something have to be done with TC offsets?
    if (type.name ().equals ("long long"))
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_longlong));");
    else if (type.name ().equals ("unsigned short"))
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ushort));");
    else if (type.name ().equals ("unsigned long"))
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ulong));");
    else if (type.name ().equals ("unsigned long long"))
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ulonglong));");
    else
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_" + type.name () + "));");
  }
  else if (type instanceof StringEntry)
  {
    StringEntry s = (StringEntry)type;
    Expression e  = s.maxSize ();
    if (e == null)
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().create_" + type.name () + "_tc (" + Util.parseExpression (e) + "));");
   else
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().create_" + type.name () + "_tc (0));");
  }
  else
    stream.println (indent + name + '(' + Util.helperName (type, true) + ".type ());"); // <d61056>
}
 
Example #24
Source File: MethodGen.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
private void writeType (String indent, String name, SymtabEntry type, PrintWriter stream)
{
  if (type instanceof PrimitiveEntry)
  {
    // RJB does something have to be done with TC offsets?
    if (type.name ().equals ("long long"))
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_longlong));");
    else if (type.name ().equals ("unsigned short"))
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ushort));");
    else if (type.name ().equals ("unsigned long"))
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ulong));");
    else if (type.name ().equals ("unsigned long long"))
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ulonglong));");
    else
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_" + type.name () + "));");
  }
  else if (type instanceof StringEntry)
  {
    StringEntry s = (StringEntry)type;
    Expression e  = s.maxSize ();
    if (e == null)
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().create_" + type.name () + "_tc (" + Util.parseExpression (e) + "));");
   else
      stream.println (indent + name + " (org.omg.CORBA.ORB.init ().create_" + type.name () + "_tc (0));");
  }
  else
    stream.println (indent + name + '(' + Util.helperName (type, true) + ".type ());"); // <d61056>
}
 
Example #25
Source File: SequenceGen.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) {
  int offsetOfType = tcoffsets.offset (entry.type ().fullName ());
  if (offsetOfType >= 0)
  {
    // This is a recursive sequence
    tcoffsets.set (null);

    // Need to fix later: how to get repositoryId of IDL type containing this sequence?
    // entry.repositoryID().ID() returns empty string and
    // Util.javaQualifiedName(entry) returns internal name which is not valid repId

    stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_recursive_tc (" + "\"\"" + ");");
    tcoffsets.bumpCurrentOffset (4); // add indirection field
  }
  else
  {
    // This is a normal sequence
    tcoffsets.set (entry);
    index = ((JavaGenerator)entry.type ().generator ()).type (index + 1, indent, tcoffsets, name, entry.type (), stream);
    Expression maxSize = ((SequenceEntry)entry).maxSize ();
    if (maxSize == null)
      stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_sequence_tc (0, " + name + ");");
    else
      stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_sequence_tc (" + Util.parseExpression (maxSize) + ", " + name + ");");
  }
  //stream.println (indent + name + " = " + Util.helperName (entry, true) + ".type ();"); // <d61056>
  return index;
}
 
Example #26
Source File: UnionGen.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
private Vector vectorizeLabels (Vector branchVector, boolean useIntsForEnums )
{
  Vector mergedLabels = new Vector ();
  Enumeration branches = branchVector.elements ();
  while (branches.hasMoreElements ())
  {
    UnionBranch branch = (UnionBranch)branches.nextElement ();
    Enumeration labels = branch.labels.elements ();
    while (labels.hasMoreElements ())
    {
      Expression expr = (Expression)labels.nextElement ();
      String str ;

      if (unionIsEnum)
        if (useIntsForEnums)
          str = typePackage + "_" + Util.parseExpression( expr ) ;
        else
          str = typePackage + Util.parseExpression( expr ) ;
      else
        str = Util.parseExpression( expr ) ;

      mergedLabels.addElement (str);
    }
  }
  return mergedLabels;
}
 
Example #27
Source File: UnionGen.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
private int writeNonBoolean (String disName, int index, String indent, String name, UnionEntry u, PrintWriter stream)
{
  SymtabEntry utype = Util.typeOf (u.type ());
  if (utype instanceof EnumEntry)
    stream.println (indent + "switch (" + name + ".discriminator ().value ())");
  else
    stream.println (indent + "switch (" + name + ".discriminator ())");
  stream.println (indent + "{");
  String typePackage = Util.javaQualifiedName (utype) + '.';
  Enumeration e = u.branches ().elements ();
  while (e.hasMoreElements ())
  {
    UnionBranch branch = (UnionBranch)e.nextElement ();
    Enumeration labels = branch.labels.elements ();
    while (labels.hasMoreElements ())
    {
      Expression label = (Expression)labels.nextElement ();
      if (utype instanceof EnumEntry)
      {
        String key = Util.parseExpression (label);
        stream.println (indent + "  case " + typePackage + '_' + key + ":");
      }
      else
        stream.println (indent + "  case " + cast (label, utype) + ':');
    }
    if (!branch.typedef.equals (u.defaultBranch ()))
    {
      index = writeBranch (index, indent + "    ", name, branch.typedef, stream);
      stream.println (indent + "    break;");
    }
  }
  if (u.defaultBranch () != null) {
    stream.println (indent + "  default:");
    index = writeBranch (index, indent + "    ", name, u.defaultBranch (), stream);
    stream.println (indent + "    break;");
  }
  stream.println (indent + "}");
  return index;
}
 
Example #28
Source File: UnionGen.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
private int writeNonBoolean (String disName, int index, String indent, String name, UnionEntry u, PrintWriter stream)
{
  SymtabEntry utype = Util.typeOf (u.type ());
  if (utype instanceof EnumEntry)
    stream.println (indent + "switch (" + name + ".discriminator ().value ())");
  else
    stream.println (indent + "switch (" + name + ".discriminator ())");
  stream.println (indent + "{");
  String typePackage = Util.javaQualifiedName (utype) + '.';
  Enumeration e = u.branches ().elements ();
  while (e.hasMoreElements ())
  {
    UnionBranch branch = (UnionBranch)e.nextElement ();
    Enumeration labels = branch.labels.elements ();
    while (labels.hasMoreElements ())
    {
      Expression label = (Expression)labels.nextElement ();
      if (utype instanceof EnumEntry)
      {
        String key = Util.parseExpression (label);
        stream.println (indent + "  case " + typePackage + '_' + key + ":");
      }
      else
        stream.println (indent + "  case " + cast (label, utype) + ':');
    }
    if (!branch.typedef.equals (u.defaultBranch ()))
    {
      index = writeBranch (index, indent + "    ", name, branch.typedef, stream);
      stream.println (indent + "    break;");
    }
  }
  if (u.defaultBranch () != null) {
    stream.println (indent + "  default:");
    index = writeBranch (index, indent + "    ", name, u.defaultBranch (), stream);
    stream.println (indent + "    break;");
  }
  stream.println (indent + "}");
  return index;
}
 
Example #29
Source File: UnionGen.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
private Vector vectorizeLabels (Vector branchVector, boolean useIntsForEnums )
{
  Vector mergedLabels = new Vector ();
  Enumeration branches = branchVector.elements ();
  while (branches.hasMoreElements ())
  {
    UnionBranch branch = (UnionBranch)branches.nextElement ();
    Enumeration labels = branch.labels.elements ();
    while (labels.hasMoreElements ())
    {
      Expression expr = (Expression)labels.nextElement ();
      String str ;

      if (unionIsEnum)
        if (useIntsForEnums)
          str = typePackage + "_" + Util.parseExpression( expr ) ;
        else
          str = typePackage + Util.parseExpression( expr ) ;
      else
        str = Util.parseExpression( expr ) ;

      mergedLabels.addElement (str);
    }
  }
  return mergedLabels;
}
 
Example #30
Source File: UnionEntry.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
boolean has (Expression label)
{
  Enumeration eBranches = _branches.elements ();
  while (eBranches.hasMoreElements ())
  {
    Enumeration eLabels = ((UnionBranch)eBranches.nextElement ()).labels.elements ();
    while (eLabels.hasMoreElements ())
    {
      Expression exp = (Expression)eLabels.nextElement ();
      if (exp.equals (label) || exp.value ().equals (label.value ()))
        return true;
    }
  }
  return false;
}