com.sun.tools.corba.se.idl.SequenceEntry Java Examples

The following examples show how to use com.sun.tools.corba.se.idl.SequenceEntry. 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: ValueBoxGen.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
protected void streamableRead (String entryName, SymtabEntry entry, PrintWriter stream)
{
  Vector vMembers = ( (ValueBoxEntry) entry ).state ();
  TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry;
  SymtabEntry mType = member.type ();
  if (mType instanceof PrimitiveEntry || mType instanceof SequenceEntry || mType instanceof TypedefEntry ||
      mType instanceof StringEntry || !member.arrayInfo ().isEmpty ())
  {
    SymtabEntry mEntry = (SymtabEntry) ((InterfaceState) vMembers.elementAt (0)).entry;
    ((JavaGenerator)member.generator ()).read (0, "    ", entryName + ".value", member, stream);
  }
  else if (mType instanceof ValueEntry || mType instanceof ValueBoxEntry)
    stream.println ("    " + entryName + ".value = (" + Util.javaQualifiedName (mType) + ") ((org.omg.CORBA_2_3.portable.InputStream)istream).read_value (" + Util.helperName(mType, true) + ".get_instance ());"); // <d60929> // <d61056>
  else
    stream.println ("    " + entryName + ".value = " + Util.helperName (mType, true) + ".read (istream);"); // <d61056>
}
 
Example #2
Source File: ValueBoxGen.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
{
  Vector vMembers = ( (ValueEntry) entry ).state ();
  TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry;
  SymtabEntry mType = member.type ();

  if (mType instanceof PrimitiveEntry || !member.arrayInfo ().isEmpty ())
    index = ((JavaGenerator)member.generator ()).write (index, indent, name + ".value", member, stream);
  else if (mType instanceof SequenceEntry || mType instanceof StringEntry || mType instanceof TypedefEntry || !member.arrayInfo ().isEmpty ())
    index = ((JavaGenerator)member.generator ()).write (index, indent, name, member, stream);
  else if (mType instanceof ValueEntry || mType instanceof ValueBoxEntry)
    stream.println (indent
                    + "((org.omg.CORBA_2_3.portable.OutputStream)ostream).write_value ((java.io.Serializable) value, " // <d60929>
                    +  Util.helperName (mType, true)  // <d61056>
                    + ".get_instance ());"); // <d61056>
  else
    stream.println (indent + Util.helperName (mType, true) + ".write (ostream, " + name + ");"); // <d61056>
  return index;
}
 
Example #3
Source File: UnionGen.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private int readBranch (int index, String indent, String name, String disName, TypedefEntry entry, PrintWriter stream)
{
    SymtabEntry type = entry.type ();
    Util.writeInitializer (indent, '_' + name, "", entry, stream);

    if (!entry.arrayInfo ().isEmpty () ||
        type instanceof SequenceEntry ||
        type instanceof PrimitiveEntry ||
        type instanceof StringEntry) {
        index = ((JavaGenerator)entry.generator ()).read (index, indent, '_' + name, entry, stream);
    } else {
        stream.println (indent + '_' + name + " = " + Util.helperName (type, true) + ".read (istream);");
    }

    stream.print (indent + "value." + name + " (");
    if( disName == "" )
        stream.println("_" + name + ");");
    else
        stream.println(disName + ", " + "_" + name + ");");

    return index;
}
 
Example #4
Source File: UnionGen.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
protected void generateContainedTypes ()
{
  Enumeration e = u.contained ().elements ();
  while (e.hasMoreElements ())
  {
    SymtabEntry entry = (SymtabEntry)e.nextElement ();

    // Don't generate contained entries if they are sequences.
    // Sequences are unnamed and since they translate to arrays,
    // no classes are generated for them, not even holders in this
    // case since they cannot be accessed outside of this union.
    if (!(entry instanceof SequenceEntry))
      entry.generate (symbolTable, stream);
  }
}
 
Example #5
Source File: UnionGen.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
protected void generateContainedTypes ()
{
  Enumeration e = u.contained ().elements ();
  while (e.hasMoreElements ())
  {
    SymtabEntry entry = (SymtabEntry)e.nextElement ();

    // Don't generate contained entries if they are sequences.
    // Sequences are unnamed and since they translate to arrays,
    // no classes are generated for them, not even holders in this
    // case since they cannot be accessed outside of this union.
    if (!(entry instanceof SequenceEntry))
      entry.generate (symbolTable, stream);
  }
}
 
Example #6
Source File: StructGen.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
protected void generateContainedTypes ()
{
  // Generate all of the contained types
  Enumeration e = s.contained ().elements ();
  while (e.hasMoreElements ())
  {
    SymtabEntry entry = (SymtabEntry)e.nextElement ();

    // Don't generate contained entries if they are sequences.
    // Sequences are unnamed and since they translate to arrays,
    // no classes are generated for them, not even holders in this
    // case since they cannot be accessed outside of this struct.

    if (!(entry instanceof SequenceEntry))
      entry.generate (symbolTable, stream);
  }
}
 
Example #7
Source File: UnionGen.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private int readBranch (int index, String indent, String name, String disName, TypedefEntry entry, PrintWriter stream)
{
    SymtabEntry type = entry.type ();
    Util.writeInitializer (indent, '_' + name, "", entry, stream);

    if (!entry.arrayInfo ().isEmpty () ||
        type instanceof SequenceEntry ||
        type instanceof PrimitiveEntry ||
        type instanceof StringEntry) {
        index = ((JavaGenerator)entry.generator ()).read (index, indent, '_' + name, entry, stream);
    } else {
        stream.println (indent + '_' + name + " = " + Util.helperName (type, true) + ".read (istream);");
    }

    stream.print (indent + "value." + name + " (");
    if( disName == "" )
        stream.println("_" + name + ");");
    else
        stream.println(disName + ", " + "_" + name + ");");

    return index;
}
 
Example #8
Source File: ValueBoxGen.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
protected void streamableRead (String entryName, SymtabEntry entry, PrintWriter stream)
{
  Vector vMembers = ( (ValueBoxEntry) entry ).state ();
  TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry;
  SymtabEntry mType = member.type ();
  if (mType instanceof PrimitiveEntry || mType instanceof SequenceEntry || mType instanceof TypedefEntry ||
      mType instanceof StringEntry || !member.arrayInfo ().isEmpty ())
  {
    SymtabEntry mEntry = (SymtabEntry) ((InterfaceState) vMembers.elementAt (0)).entry;
    ((JavaGenerator)member.generator ()).read (0, "    ", entryName + ".value", member, stream);
  }
  else if (mType instanceof ValueEntry || mType instanceof ValueBoxEntry)
    stream.println ("    " + entryName + ".value = (" + Util.javaQualifiedName (mType) + ") ((org.omg.CORBA_2_3.portable.InputStream)istream).read_value (" + Util.helperName(mType, true) + ".get_instance ());"); // <d60929> // <d61056>
  else
    stream.println ("    " + entryName + ".value = " + Util.helperName (mType, true) + ".read (istream);"); // <d61056>
}
 
Example #9
Source File: ValueBoxGen.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
protected void streamableRead (String entryName, SymtabEntry entry, PrintWriter stream)
{
  Vector vMembers = ( (ValueBoxEntry) entry ).state ();
  TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry;
  SymtabEntry mType = member.type ();
  if (mType instanceof PrimitiveEntry || mType instanceof SequenceEntry || mType instanceof TypedefEntry ||
      mType instanceof StringEntry || !member.arrayInfo ().isEmpty ())
  {
    SymtabEntry mEntry = (SymtabEntry) ((InterfaceState) vMembers.elementAt (0)).entry;
    ((JavaGenerator)member.generator ()).read (0, "    ", entryName + ".value", member, stream);
  }
  else if (mType instanceof ValueEntry || mType instanceof ValueBoxEntry)
    stream.println ("    " + entryName + ".value = (" + Util.javaQualifiedName (mType) + ") ((org.omg.CORBA_2_3.portable.InputStream)istream).read_value (" + Util.helperName(mType, true) + ".get_instance ());"); // <d60929> // <d61056>
  else
    stream.println ("    " + entryName + ".value = " + Util.helperName (mType, true) + ".read (istream);"); // <d61056>
}
 
Example #10
Source File: ValueBoxGen.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
{
  Vector vMembers = ( (ValueEntry) entry ).state ();
  TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry;
  SymtabEntry mType = member.type ();

  if (mType instanceof PrimitiveEntry || !member.arrayInfo ().isEmpty ())
    index = ((JavaGenerator)member.generator ()).write (index, indent, name + ".value", member, stream);
  else if (mType instanceof SequenceEntry || mType instanceof StringEntry || mType instanceof TypedefEntry || !member.arrayInfo ().isEmpty ())
    index = ((JavaGenerator)member.generator ()).write (index, indent, name, member, stream);
  else if (mType instanceof ValueEntry || mType instanceof ValueBoxEntry)
    stream.println (indent
                    + "((org.omg.CORBA_2_3.portable.OutputStream)ostream).write_value ((java.io.Serializable) value, " // <d60929>
                    +  Util.helperName (mType, true)  // <d61056>
                    + ".get_instance ());"); // <d61056>
  else
    stream.println (indent + Util.helperName (mType, true) + ".write (ostream, " + name + ");"); // <d61056>
  return index;
}
 
Example #11
Source File: StructGen.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
protected void generateContainedTypes ()
{
  // Generate all of the contained types
  Enumeration e = s.contained ().elements ();
  while (e.hasMoreElements ())
  {
    SymtabEntry entry = (SymtabEntry)e.nextElement ();

    // Don't generate contained entries if they are sequences.
    // Sequences are unnamed and since they translate to arrays,
    // no classes are generated for them, not even holders in this
    // case since they cannot be accessed outside of this struct.

    if (!(entry instanceof SequenceEntry))
      entry.generate (symbolTable, stream);
  }
}
 
Example #12
Source File: UnionGen.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
protected void generateContainedTypes ()
{
  Enumeration e = u.contained ().elements ();
  while (e.hasMoreElements ())
  {
    SymtabEntry entry = (SymtabEntry)e.nextElement ();

    // Don't generate contained entries if they are sequences.
    // Sequences are unnamed and since they translate to arrays,
    // no classes are generated for them, not even holders in this
    // case since they cannot be accessed outside of this union.
    if (!(entry instanceof SequenceEntry))
      entry.generate (symbolTable, stream);
  }
}
 
Example #13
Source File: StructGen.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
protected void generateContainedTypes ()
{
  // Generate all of the contained types
  Enumeration e = s.contained ().elements ();
  while (e.hasMoreElements ())
  {
    SymtabEntry entry = (SymtabEntry)e.nextElement ();

    // Don't generate contained entries if they are sequences.
    // Sequences are unnamed and since they translate to arrays,
    // no classes are generated for them, not even holders in this
    // case since they cannot be accessed outside of this struct.

    if (!(entry instanceof SequenceEntry))
      entry.generate (symbolTable, stream);
  }
}
 
Example #14
Source File: ValueBoxGen.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
{
  Vector vMembers = ( (ValueEntry) entry ).state ();
  TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry;
  SymtabEntry mType = member.type ();

  if (mType instanceof PrimitiveEntry || !member.arrayInfo ().isEmpty ())
    index = ((JavaGenerator)member.generator ()).write (index, indent, name + ".value", member, stream);
  else if (mType instanceof SequenceEntry || mType instanceof StringEntry || mType instanceof TypedefEntry || !member.arrayInfo ().isEmpty ())
    index = ((JavaGenerator)member.generator ()).write (index, indent, name, member, stream);
  else if (mType instanceof ValueEntry || mType instanceof ValueBoxEntry)
    stream.println (indent
                    + "((org.omg.CORBA_2_3.portable.OutputStream)ostream).write_value ((java.io.Serializable) value, " // <d60929>
                    +  Util.helperName (mType, true)  // <d61056>
                    + ".get_instance ());"); // <d61056>
  else
    stream.println (indent + Util.helperName (mType, true) + ".write (ostream, " + name + ");"); // <d61056>
  return index;
}
 
Example #15
Source File: Util.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Determine the import lines for template types.
 **/
static private void checkForBounds (SymtabEntry entry, Vector importTypes, Vector importList)
{
  // Obtain actual type, just to be complete.
  SymtabEntry entryType = entry;
  while (entryType instanceof TypedefEntry)
    entryType = entryType.type ();

  if (entryType instanceof StringEntry && ((StringEntry)entryType).maxSize () != null)
    checkForGlobalConstants (((StringEntry)entryType).maxSize ().rep (), importTypes, importList);
  else
    if (entryType instanceof SequenceEntry && ((SequenceEntry)entryType).maxSize () != null)
      checkForGlobalConstants (((SequenceEntry)entryType).maxSize ().rep (), importTypes, importList);
}
 
Example #16
Source File: ValueBoxGen24.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <d62023>
 **/
public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
{
  stream.println ("    if (!(istream instanceof org.omg.CORBA_2_3.portable.InputStream)) {");
  stream.println ("      throw new org.omg.CORBA.BAD_PARAM(); }");
  stream.println ("    return (" + entryName +") ((org.omg.CORBA_2_3.portable.InputStream) istream).read_value (_instance);");
  stream.println ("  }");
  stream.println ();

  // done with "read", now do "read_value with real marshalling code.

  stream.println ("  public java.io.Serializable read_value (org.omg.CORBA.portable.InputStream istream)"); // <d60929>
  stream.println ("  {");

  String indent = "    ";
  Vector vMembers = ((ValueBoxEntry) entry).state ();
  TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry;
  SymtabEntry mType = member.type ();
  if (mType instanceof PrimitiveEntry ||
      mType instanceof SequenceEntry ||
      mType instanceof TypedefEntry ||
      mType instanceof StringEntry ||
      !member.arrayInfo ().isEmpty ()) {
    stream.println (indent + Util.javaName (mType) + " tmp;");
    ((JavaGenerator)member.generator ()).read (0, indent, "tmp", member, stream);
  }
  else
    stream.println (indent + Util.javaName (mType) + " tmp = " +
                    Util.helperName ( mType, true ) + ".read (istream);");
  if (mType instanceof PrimitiveEntry)
    stream.println (indent + "return new " + entryName + " (tmp);");
  else
    stream.println (indent + "return (java.io.Serializable) tmp;");
}
 
Example #17
Source File: Util.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
public static void writeInitializer (String indent, String name, String arrayDcl, SymtabEntry entry, PrintWriter stream)
{
  if (entry instanceof TypedefEntry)
  {
    TypedefEntry td = (TypedefEntry)entry;
    writeInitializer (indent, name, arrayDcl + sansArrayInfo (td.arrayInfo ()), td.type (), stream);
  }
  else if (entry instanceof SequenceEntry)
    writeInitializer (indent, name, arrayDcl + "[]", entry.type (), stream);
  else if (entry instanceof EnumEntry)
    if (arrayDcl.length () > 0)
      stream.println (indent + javaName (entry) + ' ' + name + arrayDcl + " = null;");
    else
      stream.println (indent + javaName (entry) + ' ' + name + " = null;");
  else if (entry instanceof PrimitiveEntry)
  {
    boolean array = arrayDcl.length () > 0;
    String tname = javaPrimName (entry.name ());
    if (tname.equals ("boolean"))
      stream.println (indent + "boolean " + name + arrayDcl + " = " + (array ? "null;" : "false;"));
    else if (tname.equals ("org.omg.CORBA.TypeCode"))
      stream.println (indent + "org.omg.CORBA.TypeCode " + name + arrayDcl + " = null;");
    else if (tname.equals ("org.omg.CORBA.Any"))
      stream.println (indent + "org.omg.CORBA.Any " + name + arrayDcl + " = null;");
    else if (tname.equals ("org.omg.CORBA.Principal")) // <d61961>
      stream.println (indent + "org.omg.CORBA.Principal " + name + arrayDcl + " = null;");
    else
      stream.println (indent + tname + ' ' + name + arrayDcl + " = " + (array ? "null;" : '(' + tname + ")0;"));
  }
  // <f46082.51> Remove -stateful feature. This case is identical to next one
  // because javaName() supplants javaStatefulName().
  //else if (entry instanceof InterfaceEntry && ((InterfaceEntry)entry).state () != null)
  //  stream.println (indent + javaStatefulName ((InterfaceEntry)entry) + ' ' + name + arrayDcl + " = null;");
  else
    stream.println (indent + javaName (entry) + ' ' + name + arrayDcl + " = null;");
}
 
Example #18
Source File: Util.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
public static void writeInitializer (String indent, String name, String arrayDcl, SymtabEntry entry, String initializer, PrintWriter stream)
{
  if (entry instanceof TypedefEntry)
  {
    TypedefEntry td = (TypedefEntry)entry;
    writeInitializer (indent, name, arrayDcl + sansArrayInfo (td.arrayInfo ()), td.type (), initializer, stream);
  }
  else if (entry instanceof SequenceEntry)
    writeInitializer (indent, name, arrayDcl + "[]", entry.type (), initializer, stream);
  else if (entry instanceof EnumEntry)
    if (arrayDcl.length () > 0)
      stream.println (indent + javaName (entry) + ' ' + name + arrayDcl + " = " + initializer + ';');
    else
      stream.println (indent + javaName (entry) + ' ' + name + " = " + initializer + ';');
  else if (entry instanceof PrimitiveEntry)
  {
    boolean array = arrayDcl.length () > 0;
    String tname = javaPrimName (entry.name ());
    if (tname.equals ("boolean"))
      stream.println (indent + "boolean " + name + arrayDcl + " = " + initializer + ';');
    else if (tname.equals ("org.omg.CORBA.TypeCode"))
      stream.println (indent + "org.omg.CORBA.TypeCode " + name + arrayDcl + " = " + initializer + ';');
    else if (tname.equals ("org.omg.CORBA.Any"))
      stream.println (indent + "org.omg.CORBA.Any " + name + arrayDcl + " = " + initializer + ';');
    else if (tname.equals ("org.omg.CORBA.Principal")) // <d61961>
      stream.println (indent + "org.omg.CORBA.Principal " + name + arrayDcl + " = " + initializer + ';');
    else
      stream.println (indent + tname + ' ' + name + arrayDcl + " = " + initializer + ';');
  }
  // <f46082.51> Remove -stateful feature. This case is identical to next one
  // because javaName() supplants javaStatefulName().
  //else if (entry instanceof InterfaceEntry && ((InterfaceEntry)entry).state () != null)
  //  stream.println (indent + javaStatefulName ((InterfaceEntry)entry) + ' ' + name + arrayDcl + " = " + initializer + ';');
  else
    stream.println (indent + javaName (entry) + ' ' + name + arrayDcl + " = " + initializer + ';');
}
 
Example #19
Source File: StructGen.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
{
  if (thisIsReallyAnException)
  {
    stream.println (indent + "// write the repository ID");
    stream.println (indent + "ostream.write_string (id ());");
  }

  Vector members = ((StructEntry)entry).members ();
  for (int i = 0; i < members.size (); ++i)
  {
    TypedefEntry member = (TypedefEntry)members.elementAt (i);
    SymtabEntry  mType = member.type ();

    if (!member.arrayInfo ().isEmpty () || mType instanceof SequenceEntry ||
         mType instanceof TypedefEntry || mType instanceof PrimitiveEntry ||
         mType instanceof StringEntry)
      index = ((JavaGenerator)member.generator ()).write (index, "    ", name + '.' + member.name (), member, stream);

    // <d62023-klr> for corbaLevel 2.4 and up, use Helper.write like
    //                everything else
    else if ((mType instanceof ValueEntry || mType instanceof ValueBoxEntry)
              && !Util.corbaLevel (2.4f, 99.0f)) { // <d62023>
      stream.println (indent + "((org.omg.CORBA_2_3.portable.OutputStream)ostream).write_value ((java.io.Serializable) " // <d60929>
                      + name + '.' + member.name () + ", "
                      + Util.helperName (member.type (), true) // <d61056>
                      + ".get_instance ());"); // <d61056>
    }
    else
      stream.println (indent + Util.helperName (member.type (), true) + ".write (ostream, " + name + '.' + member.name () + ");"); // <d61056>
  }
  return index;
}
 
Example #20
Source File: ValueBoxGen.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
{
// <d59418 - KLR> per Simon, make "static" read call istream.read_value.
//                put real marshalling code in read_value.
  stream.println ("    return (" + entryName +") ((org.omg.CORBA_2_3.portable.InputStream) istream).read_value (get_instance());"); // <d60929>
  stream.println ("  }");
  stream.println ();

  // done with "read", now do "read_value with real marshalling code.

  stream.println ("  public java.io.Serializable read_value (org.omg.CORBA.portable.InputStream istream)"); // <d60929>
  stream.println ("  {");
  // end of <d59418> changes

  String indent = "    ";
  Vector vMembers = ((ValueBoxEntry) entry).state ();
  TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry;
  SymtabEntry mType = member.type ();
  if (mType instanceof PrimitiveEntry ||
      mType instanceof SequenceEntry ||
      mType instanceof TypedefEntry ||
      mType instanceof StringEntry ||
      !member.arrayInfo ().isEmpty ()) {
    stream.println (indent + Util.javaName (mType) + " tmp;"); // <d62023>
    ((JavaGenerator)member.generator ()).read (0, indent, "tmp", member, stream);
  }
  else if (mType instanceof ValueEntry || mType instanceof ValueBoxEntry)
    stream.println (indent + Util.javaQualifiedName (mType) + " tmp = (" +
                    Util.javaQualifiedName (mType) + ") ((org.omg.CORBA_2_3.portable.InputStream)istream).read_value (" + Util.helperName (mType, true) + ".get_instance ());"); // <d60929> // <d61056>
  else
    stream.println (indent + Util.javaName (mType) + " tmp = " +
                    Util.helperName ( mType, true ) + ".read (istream);"); // <d61056>
  if (mType instanceof PrimitiveEntry)
    stream.println (indent + "return new " + entryName + " (tmp);");
  else
    stream.println (indent + "return tmp;");
}
 
Example #21
Source File: Util.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
public static void writeInitializer (String indent, String name, String arrayDcl, SymtabEntry entry, PrintWriter stream)
{
  if (entry instanceof TypedefEntry)
  {
    TypedefEntry td = (TypedefEntry)entry;
    writeInitializer (indent, name, arrayDcl + sansArrayInfo (td.arrayInfo ()), td.type (), stream);
  }
  else if (entry instanceof SequenceEntry)
    writeInitializer (indent, name, arrayDcl + "[]", entry.type (), stream);
  else if (entry instanceof EnumEntry)
    if (arrayDcl.length () > 0)
      stream.println (indent + javaName (entry) + ' ' + name + arrayDcl + " = null;");
    else
      stream.println (indent + javaName (entry) + ' ' + name + " = null;");
  else if (entry instanceof PrimitiveEntry)
  {
    boolean array = arrayDcl.length () > 0;
    String tname = javaPrimName (entry.name ());
    if (tname.equals ("boolean"))
      stream.println (indent + "boolean " + name + arrayDcl + " = " + (array ? "null;" : "false;"));
    else if (tname.equals ("org.omg.CORBA.TypeCode"))
      stream.println (indent + "org.omg.CORBA.TypeCode " + name + arrayDcl + " = null;");
    else if (tname.equals ("org.omg.CORBA.Any"))
      stream.println (indent + "org.omg.CORBA.Any " + name + arrayDcl + " = null;");
    else if (tname.equals ("org.omg.CORBA.Principal")) // <d61961>
      stream.println (indent + "org.omg.CORBA.Principal " + name + arrayDcl + " = null;");
    else
      stream.println (indent + tname + ' ' + name + arrayDcl + " = " + (array ? "null;" : '(' + tname + ")0;"));
  }
  // <f46082.51> Remove -stateful feature. This case is identical to next one
  // because javaName() supplants javaStatefulName().
  //else if (entry instanceof InterfaceEntry && ((InterfaceEntry)entry).state () != null)
  //  stream.println (indent + javaStatefulName ((InterfaceEntry)entry) + ' ' + name + arrayDcl + " = null;");
  else
    stream.println (indent + javaName (entry) + ' ' + name + arrayDcl + " = null;");
}
 
Example #22
Source File: UnionGen.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
private int writeBranch (int index, String indent, String name, TypedefEntry entry, PrintWriter stream)
{
  SymtabEntry type = entry.type ();
  if (!entry.arrayInfo ().isEmpty () || type instanceof SequenceEntry || type instanceof PrimitiveEntry || type instanceof StringEntry)
    index = ((JavaGenerator)entry.generator ()).write (index, indent, name + '.' + entry.name () + " ()", entry, stream);
  else
    stream.println (indent + Util.helperName (type, true) + ".write (ostream, " + name + '.' + entry.name () + " ());"); // <d61056>
  return index;
}
 
Example #23
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 #24
Source File: ValueBoxGen.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
{
// <d59418 - KLR> per Simon, make "static" read call istream.read_value.
//                put real marshalling code in read_value.
  stream.println ("    return (" + entryName +") ((org.omg.CORBA_2_3.portable.InputStream) istream).read_value (get_instance());"); // <d60929>
  stream.println ("  }");
  stream.println ();

  // done with "read", now do "read_value with real marshalling code.

  stream.println ("  public java.io.Serializable read_value (org.omg.CORBA.portable.InputStream istream)"); // <d60929>
  stream.println ("  {");
  // end of <d59418> changes

  String indent = "    ";
  Vector vMembers = ((ValueBoxEntry) entry).state ();
  TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry;
  SymtabEntry mType = member.type ();
  if (mType instanceof PrimitiveEntry ||
      mType instanceof SequenceEntry ||
      mType instanceof TypedefEntry ||
      mType instanceof StringEntry ||
      !member.arrayInfo ().isEmpty ()) {
    stream.println (indent + Util.javaName (mType) + " tmp;"); // <d62023>
    ((JavaGenerator)member.generator ()).read (0, indent, "tmp", member, stream);
  }
  else if (mType instanceof ValueEntry || mType instanceof ValueBoxEntry)
    stream.println (indent + Util.javaQualifiedName (mType) + " tmp = (" +
                    Util.javaQualifiedName (mType) + ") ((org.omg.CORBA_2_3.portable.InputStream)istream).read_value (" + Util.helperName (mType, true) + ".get_instance ());"); // <d60929> // <d61056>
  else
    stream.println (indent + Util.javaName (mType) + " tmp = " +
                    Util.helperName ( mType, true ) + ".read (istream);"); // <d61056>
  if (mType instanceof PrimitiveEntry)
    stream.println (indent + "return new " + entryName + " (tmp);");
  else
    stream.println (indent + "return tmp;");
}
 
Example #25
Source File: StructGen.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
{
  if (thisIsReallyAnException)
  {
    stream.println (indent + "// write the repository ID");
    stream.println (indent + "ostream.write_string (id ());");
  }

  Vector members = ((StructEntry)entry).members ();
  for (int i = 0; i < members.size (); ++i)
  {
    TypedefEntry member = (TypedefEntry)members.elementAt (i);
    SymtabEntry  mType = member.type ();

    if (!member.arrayInfo ().isEmpty () || mType instanceof SequenceEntry ||
         mType instanceof TypedefEntry || mType instanceof PrimitiveEntry ||
         mType instanceof StringEntry)
      index = ((JavaGenerator)member.generator ()).write (index, "    ", name + '.' + member.name (), member, stream);

    // <d62023-klr> for corbaLevel 2.4 and up, use Helper.write like
    //                everything else
    else if ((mType instanceof ValueEntry || mType instanceof ValueBoxEntry)
              && !Util.corbaLevel (2.4f, 99.0f)) { // <d62023>
      stream.println (indent + "((org.omg.CORBA_2_3.portable.OutputStream)ostream).write_value ((java.io.Serializable) " // <d60929>
                      + name + '.' + member.name () + ", "
                      + Util.helperName (member.type (), true) // <d61056>
                      + ".get_instance ());"); // <d61056>
    }
    else
      stream.println (indent + Util.helperName (member.type (), true) + ".write (ostream, " + name + '.' + member.name () + ");"); // <d61056>
  }
  return index;
}
 
Example #26
Source File: ValueBoxGen24.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <d62023>
 **/
public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
{
  Vector vMembers = ( (ValueEntry) entry ).state ();
  TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry;
  SymtabEntry mType = member.type ();

  if (mType instanceof PrimitiveEntry || !member.arrayInfo ().isEmpty ())
    index = ((JavaGenerator)member.generator ()).write (index, indent, name + ".value", member, stream);
  else if (mType instanceof SequenceEntry || mType instanceof StringEntry || mType instanceof TypedefEntry || !member.arrayInfo ().isEmpty ())
    index = ((JavaGenerator)member.generator ()).write (index, indent, name, member, stream);
  else
    stream.println (indent + Util.helperName (mType, true) + ".write (ostream, " + name + ");"); // <d61056>
  return index;
}
 
Example #27
Source File: ValueBoxGen24.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <d62023>
 **/
public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
{
  stream.println ("    if (!(istream instanceof org.omg.CORBA_2_3.portable.InputStream)) {");
  stream.println ("      throw new org.omg.CORBA.BAD_PARAM(); }");
  stream.println ("    return (" + entryName +") ((org.omg.CORBA_2_3.portable.InputStream) istream).read_value (_instance);");
  stream.println ("  }");
  stream.println ();

  // done with "read", now do "read_value with real marshalling code.

  stream.println ("  public java.io.Serializable read_value (org.omg.CORBA.portable.InputStream istream)"); // <d60929>
  stream.println ("  {");

  String indent = "    ";
  Vector vMembers = ((ValueBoxEntry) entry).state ();
  TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry;
  SymtabEntry mType = member.type ();
  if (mType instanceof PrimitiveEntry ||
      mType instanceof SequenceEntry ||
      mType instanceof TypedefEntry ||
      mType instanceof StringEntry ||
      !member.arrayInfo ().isEmpty ()) {
    stream.println (indent + Util.javaName (mType) + " tmp;");
    ((JavaGenerator)member.generator ()).read (0, indent, "tmp", member, stream);
  }
  else
    stream.println (indent + Util.javaName (mType) + " tmp = " +
                    Util.helperName ( mType, true ) + ".read (istream);");
  if (mType instanceof PrimitiveEntry)
    stream.println (indent + "return new " + entryName + " (tmp);");
  else
    stream.println (indent + "return (java.io.Serializable) tmp;");
}
 
Example #28
Source File: TypedefGen.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
public void generate (Hashtable symbolTable, TypedefEntry t, PrintWriter stream)
{
  this.symbolTable = symbolTable;
  this.t           = t;

  if (t.arrayInfo ().size () > 0 || t.type () instanceof SequenceEntry)
    generateHolder ();
  generateHelper ();
}
 
Example #29
Source File: Util.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 **/
public static void writeInitializer (String indent, String name, String arrayDcl, SymtabEntry entry, String initializer, PrintWriter stream)
{
  if (entry instanceof TypedefEntry)
  {
    TypedefEntry td = (TypedefEntry)entry;
    writeInitializer (indent, name, arrayDcl + sansArrayInfo (td.arrayInfo ()), td.type (), initializer, stream);
  }
  else if (entry instanceof SequenceEntry)
    writeInitializer (indent, name, arrayDcl + "[]", entry.type (), initializer, stream);
  else if (entry instanceof EnumEntry)
    if (arrayDcl.length () > 0)
      stream.println (indent + javaName (entry) + ' ' + name + arrayDcl + " = " + initializer + ';');
    else
      stream.println (indent + javaName (entry) + ' ' + name + " = " + initializer + ';');
  else if (entry instanceof PrimitiveEntry)
  {
    boolean array = arrayDcl.length () > 0;
    String tname = javaPrimName (entry.name ());
    if (tname.equals ("boolean"))
      stream.println (indent + "boolean " + name + arrayDcl + " = " + initializer + ';');
    else if (tname.equals ("org.omg.CORBA.TypeCode"))
      stream.println (indent + "org.omg.CORBA.TypeCode " + name + arrayDcl + " = " + initializer + ';');
    else if (tname.equals ("org.omg.CORBA.Any"))
      stream.println (indent + "org.omg.CORBA.Any " + name + arrayDcl + " = " + initializer + ';');
    else if (tname.equals ("org.omg.CORBA.Principal")) // <d61961>
      stream.println (indent + "org.omg.CORBA.Principal " + name + arrayDcl + " = " + initializer + ';');
    else
      stream.println (indent + tname + ' ' + name + arrayDcl + " = " + initializer + ';');
  }
  // <f46082.51> Remove -stateful feature. This case is identical to next one
  // because javaName() supplants javaStatefulName().
  //else if (entry instanceof InterfaceEntry && ((InterfaceEntry)entry).state () != null)
  //  stream.println (indent + javaStatefulName ((InterfaceEntry)entry) + ' ' + name + arrayDcl + " = " + initializer + ';');
  else
    stream.println (indent + javaName (entry) + ' ' + name + arrayDcl + " = " + initializer + ';');
}
 
Example #30
Source File: ValueGen24.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <d62023> Call super._write()
 **/
public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
{
  // First do the state members from concrete parent hierarchy
  Vector vParents = ((ValueEntry)entry).derivedFrom ();
  if (vParents != null && vParents.size () != 0)
  {
    ValueEntry parent = (ValueEntry)vParents.elementAt (0);
    if (parent == null)
      return index;
    // call super._read if non-abstract value parent
    if ((!parent.isAbstract ()) && (! Util.javaQualifiedName(parent).equals ("java.io.Serializable"))) // <d60929>
        stream.println(indent + "super._write (ostream);");
  }

  Vector vMembers = ((ValueEntry) entry ).state ();
  int noOfMembers = vMembers == null ? 0 : vMembers.size ();
  for (int k = 0; k < noOfMembers; k++)
  {
    TypedefEntry member = (TypedefEntry)((InterfaceState)vMembers.elementAt (k)).entry;
    String memberName = member.name ();
    SymtabEntry mType = member.type ();

    if (mType instanceof PrimitiveEntry ||
        mType instanceof TypedefEntry   ||
        mType instanceof SequenceEntry  ||
        mType instanceof StringEntry    ||
        !member.arrayInfo ().isEmpty ())
      index = ((JavaGenerator)member.generator ()).write (index, indent, name + '.' + memberName, member, stream);
    else
      stream.println (indent + Util.helperName (mType, true) + // <d61056>
                            ".write (ostream, " + name + '.' + memberName + ");");
  }

  return index;
}