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

The following examples show how to use com.sun.tools.corba.se.idl.StructEntry. 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: StructGen.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
public void generate (Hashtable symbolTable, StructEntry s, PrintWriter str)
{
  this.symbolTable = symbolTable;
  this.s           = s;
  //init ();

  openStream ();
  if (stream == null)
    return;
  generateHelper ();
  generateHolder ();
  writeHeading ();
  writeBody ();
  writeClosing ();
  closeStream ();
  generateContainedTypes ();
}
 
Example #2
Source File: StructGen.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
public void generate (Hashtable symbolTable, StructEntry s, PrintWriter str)
{
  this.symbolTable = symbolTable;
  this.s           = s;
  //init ();

  openStream ();
  if (stream == null)
    return;
  generateHelper ();
  generateHolder ();
  writeHeading ();
  writeBody ();
  writeClosing ();
  closeStream ();
  generateContainedTypes ();
}
 
Example #3
Source File: Util.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private static String doContainerFullName (SymtabEntry container)
{
  String name = "";

  if (container == null)
    name = "";
  else
  {
    if (container instanceof InterfaceEntry ||
        container instanceof StructEntry ||
        container instanceof UnionEntry)
      name = container.name () + "Package";
    else
      name = container.name ();

    if (container.container () != null &&
      !container.container ().name ().equals (""))
      name = doContainerFullName (container.container ()) + '/' + name;
  }

  return name;
}
 
Example #4
Source File: StructGen.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
public void generate (Hashtable symbolTable, StructEntry s, PrintWriter str)
{
  this.symbolTable = symbolTable;
  this.s           = s;
  //init ();

  openStream ();
  if (stream == null)
    return;
  generateHelper ();
  generateHolder ();
  writeHeading ();
  writeBody ();
  writeClosing ();
  closeStream ();
  generateContainedTypes ();
}
 
Example #5
Source File: Util.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private static String doContainerFullName (SymtabEntry container)
{
  String name = "";

  if (container == null)
    name = "";
  else
  {
    if (container instanceof InterfaceEntry ||
        container instanceof StructEntry ||
        container instanceof UnionEntry)
      name = container.name () + "Package";
    else
      name = container.name ();

    if (container.container () != null &&
      !container.container ().name ().equals (""))
      name = doContainerFullName (container.container ()) + '/' + name;
  }

  return name;
}
 
Example #6
Source File: StructGen.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
public void generate (Hashtable symbolTable, StructEntry s, PrintWriter str)
{
  this.symbolTable = symbolTable;
  this.s           = s;
  //init ();

  openStream ();
  if (stream == null)
    return;
  generateHelper ();
  generateHolder ();
  writeHeading ();
  writeBody ();
  writeClosing ();
  closeStream ();
  generateContainedTypes ();
}
 
Example #7
Source File: Util.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private static String doContainerFullName (SymtabEntry container)
{
  String name = "";

  if (container == null)
    name = "";
  else
  {
    if (container instanceof InterfaceEntry ||
        container instanceof StructEntry ||
        container instanceof UnionEntry)
      name = container.name () + "Package";
    else
      name = container.name ();

    if (container.container () != null &&
      !container.container ().name ().equals (""))
      name = doContainerFullName (container.container ()) + '/' + name;
  }

  return name;
}
 
Example #8
Source File: StructGen.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
public void generate (Hashtable symbolTable, StructEntry s, PrintWriter str)
{
  this.symbolTable = symbolTable;
  this.s           = s;
  //init ();

  openStream ();
  if (stream == null)
    return;
  generateHelper ();
  generateHolder ();
  writeHeading ();
  writeBody ();
  writeClosing ();
  closeStream ();
  generateContainedTypes ();
}
 
Example #9
Source File: Util.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private static String doContainerFullName (SymtabEntry container)
{
  String name = "";

  if (container == null)
    name = "";
  else
  {
    if (container instanceof InterfaceEntry ||
        container instanceof StructEntry ||
        container instanceof UnionEntry)
      name = container.name () + "Package";
    else
      name = container.name ();

    if (container.container () != null &&
      !container.container ().name ().equals (""))
      name = doContainerFullName (container.container ()) + '/' + name;
  }

  return name;
}
 
Example #10
Source File: StructGen.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
public void generate (Hashtable symbolTable, StructEntry s, PrintWriter str)
{
  this.symbolTable = symbolTable;
  this.s           = s;
  //init ();

  openStream ();
  if (stream == null)
    return;
  generateHelper ();
  generateHolder ();
  writeHeading ();
  writeBody ();
  writeClosing ();
  closeStream ();
  generateContainedTypes ();
}
 
Example #11
Source File: Util.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private static String doContainerFullName (SymtabEntry container)
{
  String name = "";

  if (container == null)
    name = "";
  else
  {
    if (container instanceof InterfaceEntry ||
        container instanceof StructEntry ||
        container instanceof UnionEntry)
      name = container.name () + "Package";
    else
      name = container.name ();

    if (container.container () != null &&
      !container.container ().name ().equals (""))
      name = doContainerFullName (container.container ()) + '/' + name;
  }

  return name;
}
 
Example #12
Source File: StructGen.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
public void generate (Hashtable symbolTable, StructEntry s, PrintWriter str)
{
  this.symbolTable = symbolTable;
  this.s           = s;
  //init ();

  openStream ();
  if (stream == null)
    return;
  generateHelper ();
  generateHolder ();
  writeHeading ();
  writeBody ();
  writeClosing ();
  closeStream ();
  generateContainedTypes ();
}
 
Example #13
Source File: Util.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private static String doContainerFullName (SymtabEntry container)
{
  String name = "";

  if (container == null)
    name = "";
  else
  {
    if (container instanceof InterfaceEntry ||
        container instanceof StructEntry ||
        container instanceof UnionEntry)
      name = container.name () + "Package";
    else
      name = container.name ();

    if (container.container () != null &&
      !container.container ().name ().equals (""))
      name = doContainerFullName (container.container ()) + '/' + name;
  }

  return name;
}
 
Example #14
Source File: Util.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private static String doContainerFullName (SymtabEntry container)
{
  String name = "";

  if (container == null)
    name = "";
  else
  {
    if (container instanceof InterfaceEntry ||
        container instanceof StructEntry ||
        container instanceof UnionEntry)
      name = container.name () + "Package";
    else
      name = container.name ();

    if (container.container () != null &&
      !container.container ().name ().equals (""))
      name = doContainerFullName (container.container ()) + '/' + name;
  }

  return name;
}
 
Example #15
Source File: Util.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private static String doContainerFullName (SymtabEntry container)
{
  String name = "";

  if (container == null)
    name = "";
  else
  {
    if (container instanceof InterfaceEntry ||
        container instanceof StructEntry ||
        container instanceof UnionEntry)
      name = container.name () + "Package";
    else
      name = container.name ();

    if (container.container () != null &&
      !container.container ().name ().equals (""))
      name = doContainerFullName (container.container ()) + '/' + name;
  }

  return name;
}
 
Example #16
Source File: StructGen.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
public void generate (Hashtable symbolTable, StructEntry s, PrintWriter str)
{
  this.symbolTable = symbolTable;
  this.s           = s;
  //init ();

  openStream ();
  if (stream == null)
    return;
  generateHelper ();
  generateHolder ();
  writeHeading ();
  writeBody ();
  writeClosing ();
  closeStream ();
  generateContainedTypes ();
}
 
Example #17
Source File: Helper.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Generate the typecode variable and type method.
 **/
protected void writeType ()
{
  boolean canRecurse = entry instanceof ValueEntry
      || entry instanceof ValueBoxEntry
      || entry instanceof StructEntry;
  stream.println ("  private static org.omg.CORBA.TypeCode __typeCode = null;");
  if (canRecurse)
    stream.println ("  private static boolean __active = false;");
  stream.println ("  synchronized public static org.omg.CORBA.TypeCode type ()");
  stream.println ("  {");
  stream.println ("    if (__typeCode == null)");
  stream.println ("    {");
  if (canRecurse) {
  stream.println ("      synchronized (org.omg.CORBA.TypeCode.class)");
  stream.println ("      {");
  stream.println ("        if (__typeCode == null)");
  stream.println ("        {");
  stream.println ("          if (__active)");
  stream.println ("          {");
  stream.println ("            return org.omg.CORBA.ORB.init().create_recursive_tc ( _id );");
  stream.println ("          }");
  stream.println ("          __active = true;");
  ((JavaGenerator)entry.generator ()).helperType (0, "          ", new TCOffsets (), "__typeCode", entry, stream);
  }
  else
  ((JavaGenerator)entry.generator ()).helperType (0, "      ", new TCOffsets (), "__typeCode", entry, stream);

  // Generate body of type() method

  if (canRecurse) {
  stream.println ("          __active = false;");
  stream.println ("        }");
  stream.println ("      }");
  }
  stream.println ("    }");
  stream.println ("    return __typeCode;");
  stream.println ("  }");
  stream.println ();
}
 
Example #18
Source File: Helper.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Generate the typecode variable and type method.
 **/
protected void writeType ()
{
  boolean canRecurse = entry instanceof ValueEntry
      || entry instanceof ValueBoxEntry
      || entry instanceof StructEntry;
  stream.println ("  private static org.omg.CORBA.TypeCode __typeCode = null;");
  if (canRecurse)
    stream.println ("  private static boolean __active = false;");
  stream.println ("  synchronized public static org.omg.CORBA.TypeCode type ()");
  stream.println ("  {");
  stream.println ("    if (__typeCode == null)");
  stream.println ("    {");
  if (canRecurse) {
  stream.println ("      synchronized (org.omg.CORBA.TypeCode.class)");
  stream.println ("      {");
  stream.println ("        if (__typeCode == null)");
  stream.println ("        {");
  stream.println ("          if (__active)");
  stream.println ("          {");
  stream.println ("            return org.omg.CORBA.ORB.init().create_recursive_tc ( _id );");
  stream.println ("          }");
  stream.println ("          __active = true;");
  ((JavaGenerator)entry.generator ()).helperType (0, "          ", new TCOffsets (), "__typeCode", entry, stream);
  }
  else
  ((JavaGenerator)entry.generator ()).helperType (0, "      ", new TCOffsets (), "__typeCode", entry, stream);

  // Generate body of type() method

  if (canRecurse) {
  stream.println ("          __active = false;");
  stream.println ("        }");
  stream.println ("      }");
  }
  stream.println ("    }");
  stream.println ("    return __typeCode;");
  stream.println ("  }");
  stream.println ();
}
 
Example #19
Source File: Helper.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Generate the typecode variable and type method.
 **/
protected void writeType ()
{
  boolean canRecurse = entry instanceof ValueEntry
      || entry instanceof ValueBoxEntry
      || entry instanceof StructEntry;
  stream.println ("  private static org.omg.CORBA.TypeCode __typeCode = null;");
  if (canRecurse)
    stream.println ("  private static boolean __active = false;");
  stream.println ("  synchronized public static org.omg.CORBA.TypeCode type ()");
  stream.println ("  {");
  stream.println ("    if (__typeCode == null)");
  stream.println ("    {");
  if (canRecurse) {
  stream.println ("      synchronized (org.omg.CORBA.TypeCode.class)");
  stream.println ("      {");
  stream.println ("        if (__typeCode == null)");
  stream.println ("        {");
  stream.println ("          if (__active)");
  stream.println ("          {");
  stream.println ("            return org.omg.CORBA.ORB.init().create_recursive_tc ( _id );");
  stream.println ("          }");
  stream.println ("          __active = true;");
  ((JavaGenerator)entry.generator ()).helperType (0, "          ", new TCOffsets (), "__typeCode", entry, stream);
  }
  else
  ((JavaGenerator)entry.generator ()).helperType (0, "      ", new TCOffsets (), "__typeCode", entry, stream);

  // Generate body of type() method

  if (canRecurse) {
  stream.println ("          __active = false;");
  stream.println ("        }");
  stream.println ("      }");
  }
  stream.println ("    }");
  stream.println ("    return __typeCode;");
  stream.println ("  }");
  stream.println ();
}
 
Example #20
Source File: StructGen.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream)
{
  TCOffsets innerOffsets = new TCOffsets ();
  innerOffsets.set (entry);
  int offsetForStruct = innerOffsets.currentOffset ();
  StructEntry s = (StructEntry)entry;
  String membersName = "_members" + index++;
  stream.println (indent + "org.omg.CORBA.StructMember[] " + membersName + " = new org.omg.CORBA.StructMember [" + s.members ().size () + "];");
  String tcOfMembers = "_tcOf" + membersName;
  stream.println (indent + "org.omg.CORBA.TypeCode " + tcOfMembers + " = null;");
  for (int i = 0; i < s.members ().size (); ++i)
  {
    TypedefEntry member = (TypedefEntry)s.members ().elementAt (i);
    String memberName = member.name ();
    // Generate and assign member TypeCode to tcofMembers
    index = ((JavaGenerator)member.generator ()).type (index, indent, innerOffsets, tcOfMembers, member, stream);
    stream.println (indent + membersName + '[' + i + "] = new org.omg.CORBA.StructMember (");
    stream.println (indent + "  \"" + Util.stripLeadingUnderscores (memberName) + "\",");
    stream.println (indent + "  " + tcOfMembers + ',');
    stream.println (indent + "  null);");
    int offsetSoFar = innerOffsets.currentOffset ();
    innerOffsets = new TCOffsets ();
    innerOffsets.set (entry);
    innerOffsets.bumpCurrentOffset (offsetSoFar - offsetForStruct);

  }
  tcoffsets.bumpCurrentOffset (innerOffsets.currentOffset ());
  // <54697>
  //stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_struct_tc (id (), \"" + Util.stripLeadingUnderscores (entry.name ()) + "\", " + membersName + ");");
  stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_" + (thisIsReallyAnException ? "exception" : "struct") + "_tc (" + Util.helperName (s, true) + ".id (), \"" + Util.stripLeadingUnderscores (entry.name ()) + "\", " + membersName + ");"); // <d61056>
  return index;
}
 
Example #21
Source File: StructGen.java    From hottub 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 #22
Source File: Helper.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Generate the typecode variable and type method.
 **/
protected void writeType ()
{
  boolean canRecurse = entry instanceof ValueEntry
      || entry instanceof ValueBoxEntry
      || entry instanceof StructEntry;
  stream.println ("  private static org.omg.CORBA.TypeCode __typeCode = null;");
  if (canRecurse)
    stream.println ("  private static boolean __active = false;");
  stream.println ("  synchronized public static org.omg.CORBA.TypeCode type ()");
  stream.println ("  {");
  stream.println ("    if (__typeCode == null)");
  stream.println ("    {");
  if (canRecurse) {
  stream.println ("      synchronized (org.omg.CORBA.TypeCode.class)");
  stream.println ("      {");
  stream.println ("        if (__typeCode == null)");
  stream.println ("        {");
  stream.println ("          if (__active)");
  stream.println ("          {");
  stream.println ("            return org.omg.CORBA.ORB.init().create_recursive_tc ( _id );");
  stream.println ("          }");
  stream.println ("          __active = true;");
  ((JavaGenerator)entry.generator ()).helperType (0, "          ", new TCOffsets (), "__typeCode", entry, stream);
  }
  else
  ((JavaGenerator)entry.generator ()).helperType (0, "      ", new TCOffsets (), "__typeCode", entry, stream);

  // Generate body of type() method

  if (canRecurse) {
  stream.println ("          __active = false;");
  stream.println ("        }");
  stream.println ("      }");
  }
  stream.println ("    }");
  stream.println ("    return __typeCode;");
  stream.println ("  }");
  stream.println ();
}
 
Example #23
Source File: StructGen.java    From TencentKona-8 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 #24
Source File: StructGen.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream)
{
  TCOffsets innerOffsets = new TCOffsets ();
  innerOffsets.set (entry);
  int offsetForStruct = innerOffsets.currentOffset ();
  StructEntry s = (StructEntry)entry;
  String membersName = "_members" + index++;
  stream.println (indent + "org.omg.CORBA.StructMember[] " + membersName + " = new org.omg.CORBA.StructMember [" + s.members ().size () + "];");
  String tcOfMembers = "_tcOf" + membersName;
  stream.println (indent + "org.omg.CORBA.TypeCode " + tcOfMembers + " = null;");
  for (int i = 0; i < s.members ().size (); ++i)
  {
    TypedefEntry member = (TypedefEntry)s.members ().elementAt (i);
    String memberName = member.name ();
    // Generate and assign member TypeCode to tcofMembers
    index = ((JavaGenerator)member.generator ()).type (index, indent, innerOffsets, tcOfMembers, member, stream);
    stream.println (indent + membersName + '[' + i + "] = new org.omg.CORBA.StructMember (");
    stream.println (indent + "  \"" + Util.stripLeadingUnderscores (memberName) + "\",");
    stream.println (indent + "  " + tcOfMembers + ',');
    stream.println (indent + "  null);");
    int offsetSoFar = innerOffsets.currentOffset ();
    innerOffsets = new TCOffsets ();
    innerOffsets.set (entry);
    innerOffsets.bumpCurrentOffset (offsetSoFar - offsetForStruct);

  }
  tcoffsets.bumpCurrentOffset (innerOffsets.currentOffset ());
  // <54697>
  //stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_struct_tc (id (), \"" + Util.stripLeadingUnderscores (entry.name ()) + "\", " + membersName + ");");
  stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_" + (thisIsReallyAnException ? "exception" : "struct") + "_tc (" + Util.helperName (s, true) + ".id (), \"" + Util.stripLeadingUnderscores (entry.name ()) + "\", " + membersName + ");"); // <d61056>
  return index;
}
 
Example #25
Source File: StructGen.java    From openjdk-8-source 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: Helper.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Generate the typecode variable and type method.
 **/
protected void writeType ()
{
  boolean canRecurse = entry instanceof ValueEntry
      || entry instanceof ValueBoxEntry
      || entry instanceof StructEntry;
  stream.println ("  private static org.omg.CORBA.TypeCode __typeCode = null;");
  if (canRecurse)
    stream.println ("  private static boolean __active = false;");
  stream.println ("  synchronized public static org.omg.CORBA.TypeCode type ()");
  stream.println ("  {");
  stream.println ("    if (__typeCode == null)");
  stream.println ("    {");
  if (canRecurse) {
  stream.println ("      synchronized (org.omg.CORBA.TypeCode.class)");
  stream.println ("      {");
  stream.println ("        if (__typeCode == null)");
  stream.println ("        {");
  stream.println ("          if (__active)");
  stream.println ("          {");
  stream.println ("            return org.omg.CORBA.ORB.init().create_recursive_tc ( _id );");
  stream.println ("          }");
  stream.println ("          __active = true;");
  ((JavaGenerator)entry.generator ()).helperType (0, "          ", new TCOffsets (), "__typeCode", entry, stream);
  }
  else
  ((JavaGenerator)entry.generator ()).helperType (0, "      ", new TCOffsets (), "__typeCode", entry, stream);

  // Generate body of type() method

  if (canRecurse) {
  stream.println ("          __active = false;");
  stream.println ("        }");
  stream.println ("      }");
  }
  stream.println ("    }");
  stream.println ("    return __typeCode;");
  stream.println ("  }");
  stream.println ();
}
 
Example #27
Source File: StructGen.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream)
{
  TCOffsets innerOffsets = new TCOffsets ();
  innerOffsets.set (entry);
  int offsetForStruct = innerOffsets.currentOffset ();
  StructEntry s = (StructEntry)entry;
  String membersName = "_members" + index++;
  stream.println (indent + "org.omg.CORBA.StructMember[] " + membersName + " = new org.omg.CORBA.StructMember [" + s.members ().size () + "];");
  String tcOfMembers = "_tcOf" + membersName;
  stream.println (indent + "org.omg.CORBA.TypeCode " + tcOfMembers + " = null;");
  for (int i = 0; i < s.members ().size (); ++i)
  {
    TypedefEntry member = (TypedefEntry)s.members ().elementAt (i);
    String memberName = member.name ();
    // Generate and assign member TypeCode to tcofMembers
    index = ((JavaGenerator)member.generator ()).type (index, indent, innerOffsets, tcOfMembers, member, stream);
    stream.println (indent + membersName + '[' + i + "] = new org.omg.CORBA.StructMember (");
    stream.println (indent + "  \"" + Util.stripLeadingUnderscores (memberName) + "\",");
    stream.println (indent + "  " + tcOfMembers + ',');
    stream.println (indent + "  null);");
    int offsetSoFar = innerOffsets.currentOffset ();
    innerOffsets = new TCOffsets ();
    innerOffsets.set (entry);
    innerOffsets.bumpCurrentOffset (offsetSoFar - offsetForStruct);

  }
  tcoffsets.bumpCurrentOffset (innerOffsets.currentOffset ());
  // <54697>
  //stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_struct_tc (id (), \"" + Util.stripLeadingUnderscores (entry.name ()) + "\", " + membersName + ");");
  stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_" + (thisIsReallyAnException ? "exception" : "struct") + "_tc (" + Util.helperName (s, true) + ".id (), \"" + Util.stripLeadingUnderscores (entry.name ()) + "\", " + membersName + ");"); // <d61056>
  return index;
}
 
Example #28
Source File: StructGen.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream)
{
  TCOffsets innerOffsets = new TCOffsets ();
  innerOffsets.set (entry);
  int offsetForStruct = innerOffsets.currentOffset ();
  StructEntry s = (StructEntry)entry;
  String membersName = "_members" + index++;
  stream.println (indent + "org.omg.CORBA.StructMember[] " + membersName + " = new org.omg.CORBA.StructMember [" + s.members ().size () + "];");
  String tcOfMembers = "_tcOf" + membersName;
  stream.println (indent + "org.omg.CORBA.TypeCode " + tcOfMembers + " = null;");
  for (int i = 0; i < s.members ().size (); ++i)
  {
    TypedefEntry member = (TypedefEntry)s.members ().elementAt (i);
    String memberName = member.name ();
    // Generate and assign member TypeCode to tcofMembers
    index = ((JavaGenerator)member.generator ()).type (index, indent, innerOffsets, tcOfMembers, member, stream);
    stream.println (indent + membersName + '[' + i + "] = new org.omg.CORBA.StructMember (");
    stream.println (indent + "  \"" + Util.stripLeadingUnderscores (memberName) + "\",");
    stream.println (indent + "  " + tcOfMembers + ',');
    stream.println (indent + "  null);");
    int offsetSoFar = innerOffsets.currentOffset ();
    innerOffsets = new TCOffsets ();
    innerOffsets.set (entry);
    innerOffsets.bumpCurrentOffset (offsetSoFar - offsetForStruct);

  }
  tcoffsets.bumpCurrentOffset (innerOffsets.currentOffset ());
  // <54697>
  //stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_struct_tc (id (), \"" + Util.stripLeadingUnderscores (entry.name ()) + "\", " + membersName + ");");
  stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_" + (thisIsReallyAnException ? "exception" : "struct") + "_tc (" + Util.helperName (s, true) + ".id (), \"" + Util.stripLeadingUnderscores (entry.name ()) + "\", " + membersName + ");"); // <d61056>
  return index;
}
 
Example #29
Source File: StructGen.java    From openjdk-8 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 #30
Source File: StructGen.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream)
{
  TCOffsets innerOffsets = new TCOffsets ();
  innerOffsets.set (entry);
  int offsetForStruct = innerOffsets.currentOffset ();
  StructEntry s = (StructEntry)entry;
  String membersName = "_members" + index++;
  stream.println (indent + "org.omg.CORBA.StructMember[] " + membersName + " = new org.omg.CORBA.StructMember [" + s.members ().size () + "];");
  String tcOfMembers = "_tcOf" + membersName;
  stream.println (indent + "org.omg.CORBA.TypeCode " + tcOfMembers + " = null;");
  for (int i = 0; i < s.members ().size (); ++i)
  {
    TypedefEntry member = (TypedefEntry)s.members ().elementAt (i);
    String memberName = member.name ();
    // Generate and assign member TypeCode to tcofMembers
    index = ((JavaGenerator)member.generator ()).type (index, indent, innerOffsets, tcOfMembers, member, stream);
    stream.println (indent + membersName + '[' + i + "] = new org.omg.CORBA.StructMember (");
    stream.println (indent + "  \"" + Util.stripLeadingUnderscores (memberName) + "\",");
    stream.println (indent + "  " + tcOfMembers + ',');
    stream.println (indent + "  null);");
    int offsetSoFar = innerOffsets.currentOffset ();
    innerOffsets = new TCOffsets ();
    innerOffsets.set (entry);
    innerOffsets.bumpCurrentOffset (offsetSoFar - offsetForStruct);

  }
  tcoffsets.bumpCurrentOffset (innerOffsets.currentOffset ());
  // <54697>
  //stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_struct_tc (id (), \"" + Util.stripLeadingUnderscores (entry.name ()) + "\", " + membersName + ");");
  stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_" + (thisIsReallyAnException ? "exception" : "struct") + "_tc (" + Util.helperName (s, true) + ".id (), \"" + Util.stripLeadingUnderscores (entry.name ()) + "\", " + membersName + ");"); // <d61056>
  return index;
}