Java Code Examples for com.sun.tools.corba.se.idl.TypedefEntry#dynamicVariable()

The following examples show how to use com.sun.tools.corba.se.idl.TypedefEntry#dynamicVariable() . 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: Util.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
static private String checkForArrayBase (TypedefEntry t, Vector importTypes, Vector importList)
{
  String arrays = "";
  try
  {
    String name = (String)t.dynamicVariable (Compile.typedefInfo);
    int index = name.indexOf ('[');
    if (index >= 0)
    {
      arrays = name.substring (index);
      name = name.substring (0, index);
    }

    // See if the base type should be added to the list.
    SymtabEntry typeEntry = (SymtabEntry)symbolTable.get (name);
    if (typeEntry != null && importTypes.contains (typeEntry))
      addTo (importList, typeEntry.name ());
  }
  catch (NoSuchFieldException e)
  {}
  return arrays;
}
 
Example 2
Source File: Util.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
static private String checkForArrayBase (TypedefEntry t, Vector importTypes, Vector importList)
{
  String arrays = "";
  try
  {
    String name = (String)t.dynamicVariable (Compile.typedefInfo);
    int index = name.indexOf ('[');
    if (index >= 0)
    {
      arrays = name.substring (index);
      name = name.substring (0, index);
    }

    // See if the base type should be added to the list.
    SymtabEntry typeEntry = (SymtabEntry)symbolTable.get (name);
    if (typeEntry != null && importTypes.contains (typeEntry))
      addTo (importList, typeEntry.name ());
  }
  catch (NoSuchFieldException e)
  {}
  return arrays;
}
 
Example 3
Source File: Util.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
static private String checkForArrayBase (TypedefEntry t, Vector importTypes, Vector importList)
{
  String arrays = "";
  try
  {
    String name = (String)t.dynamicVariable (Compile.typedefInfo);
    int index = name.indexOf ('[');
    if (index >= 0)
    {
      arrays = name.substring (index);
      name = name.substring (0, index);
    }

    // See if the base type should be added to the list.
    SymtabEntry typeEntry = (SymtabEntry)symbolTable.get (name);
    if (typeEntry != null && importTypes.contains (typeEntry))
      addTo (importList, typeEntry.name ());
  }
  catch (NoSuchFieldException e)
  {}
  return arrays;
}
 
Example 4
Source File: Util.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
static private String checkForArrayBase (TypedefEntry t, Vector importTypes, Vector importList)
{
  String arrays = "";
  try
  {
    String name = (String)t.dynamicVariable (Compile.typedefInfo);
    int index = name.indexOf ('[');
    if (index >= 0)
    {
      arrays = name.substring (index);
      name = name.substring (0, index);
    }

    // See if the base type should be added to the list.
    SymtabEntry typeEntry = (SymtabEntry)symbolTable.get (name);
    if (typeEntry != null && importTypes.contains (typeEntry))
      addTo (importList, typeEntry.name ());
  }
  catch (NoSuchFieldException e)
  {}
  return arrays;
}
 
Example 5
Source File: Util.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
static private String checkForArrayBase (TypedefEntry t, Vector importTypes, Vector importList)
{
  String arrays = "";
  try
  {
    String name = (String)t.dynamicVariable (Compile.typedefInfo);
    int index = name.indexOf ('[');
    if (index >= 0)
    {
      arrays = name.substring (index);
      name = name.substring (0, index);
    }

    // See if the base type should be added to the list.
    SymtabEntry typeEntry = (SymtabEntry)symbolTable.get (name);
    if (typeEntry != null && importTypes.contains (typeEntry))
      addTo (importList, typeEntry.name ());
  }
  catch (NoSuchFieldException e)
  {}
  return arrays;
}
 
Example 6
Source File: Util.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
static private String checkForArrayBase (TypedefEntry t, Vector importTypes, Vector importList)
{
  String arrays = "";
  try
  {
    String name = (String)t.dynamicVariable (Compile.typedefInfo);
    int index = name.indexOf ('[');
    if (index >= 0)
    {
      arrays = name.substring (index);
      name = name.substring (0, index);
    }

    // See if the base type should be added to the list.
    SymtabEntry typeEntry = (SymtabEntry)symbolTable.get (name);
    if (typeEntry != null && importTypes.contains (typeEntry))
      addTo (importList, typeEntry.name ());
  }
  catch (NoSuchFieldException e)
  {}
  return arrays;
}
 
Example 7
Source File: Util.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
static private String checkForArrayBase (TypedefEntry t, Vector importTypes, Vector importList)
{
  String arrays = "";
  try
  {
    String name = (String)t.dynamicVariable (Compile.typedefInfo);
    int index = name.indexOf ('[');
    if (index >= 0)
    {
      arrays = name.substring (index);
      name = name.substring (0, index);
    }

    // See if the base type should be added to the list.
    SymtabEntry typeEntry = (SymtabEntry)symbolTable.get (name);
    if (typeEntry != null && importTypes.contains (typeEntry))
      addTo (importList, typeEntry.name ());
  }
  catch (NoSuchFieldException e)
  {}
  return arrays;
}
 
Example 8
Source File: Util.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
static private String checkForArrayBase (TypedefEntry t, Vector importTypes, Vector importList)
{
  String arrays = "";
  try
  {
    String name = (String)t.dynamicVariable (Compile.typedefInfo);
    int index = name.indexOf ('[');
    if (index >= 0)
    {
      arrays = name.substring (index);
      name = name.substring (0, index);
    }

    // See if the base type should be added to the list.
    SymtabEntry typeEntry = (SymtabEntry)symbolTable.get (name);
    if (typeEntry != null && importTypes.contains (typeEntry))
      addTo (importList, typeEntry.name ());
  }
  catch (NoSuchFieldException e)
  {}
  return arrays;
}
 
Example 9
Source File: TypedefGen.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
{
  TypedefEntry td = (TypedefEntry)entry;
  String modifier = Util.arrayInfo (td.arrayInfo ());
  if (!modifier.equals (""))
  {
    // arrayInfo is a vector of Expressions which indicate the
    // number of array dimensions for this typedef.  But what if
    // this is a typedef of a sequence?
    // The `new' statement being generated must know the full
    // number of brackets.  That can be found in td.info.
    // For instance:
    // typedef sequence<short> A[10][10];
    // void proc (out A a);
    // typeModifier = "[10][10]"
    // td.info    = "short[][][]";
    // The first new statement generated is:
    // a.value = new short[10][][];
    // Note that the 3 sets of brackets come from td.info, not
    // arrayInfo;
    // The second new statement generated is:
    // a.value[_i1] = new short[10][];
    // ------------     ---- ------
    //    \           \    \
    //    name      baseName   arrayDcl
    int closingBrackets = 0;
    String loopIndex = "";
    String baseName;
    try
    {
      baseName = (String)td.dynamicVariable (Compile.typedefInfo);
    }
    catch (NoSuchFieldException e)
    {
      baseName = td.name ();
    }
    int startArray = baseName.indexOf ('[');
    String arrayDcl = Util.sansArrayInfo (baseName.substring (startArray)) + "[]"; // Add an extra set because the first gets stripped off in the loop.
    baseName = baseName.substring (0, startArray);

    // For interfaces having state, e.g., valuetypes.
    SymtabEntry baseEntry = (SymtabEntry)Util.symbolTable.get (baseName.replace ('.', '/'));
    if (baseEntry instanceof InterfaceEntry && ((InterfaceEntry)baseEntry).state () != null)
      // <f46082.51> Remove -stateful feature; javaStatefulName() obsolete.
      //baseName = Util.javaStatefulName ((InterfaceEntry)baseEntry);
      baseName = Util.javaName ((InterfaceEntry)baseEntry);

    int end1stArray;
    while (!modifier.equals (""))
    {
      int rbracket = modifier.indexOf (']');
      String size = modifier.substring (1, rbracket);
      end1stArray = arrayDcl.indexOf (']');
      arrayDcl = '[' + size + arrayDcl.substring (end1stArray + 2);
      stream.println (indent + name + " = new " + baseName + arrayDcl + ';');
      loopIndex = "_o" + index++;
      stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < (" + size + "); ++" + loopIndex + ')');
      stream.println (indent + '{');
      ++closingBrackets;
      modifier = modifier.substring (rbracket + 1);
      indent = indent + "  ";
      name = name + '[' + loopIndex + ']';
    }
    end1stArray = arrayDcl.indexOf (']');
    if (td.type () instanceof SequenceEntry || td.type () instanceof PrimitiveEntry || td.type () instanceof StringEntry)
      index = ((JavaGenerator)td.type ().generator ()).read (index, indent, name, td.type (), stream);
    else if (td.type () instanceof InterfaceEntry && td.type ().fullName ().equals ("org/omg/CORBA/Object"))
      stream.println (indent + name + " = istream.read_Object ();");
    else
      stream.println (indent + name + " = " + Util.helperName (td.type (), true) + ".read (istream);"); // <d61056>
    for (int i = 0; i < closingBrackets; ++i)
    {
      indent = indent.substring (2);
      stream.println (indent + '}');
    }
  }
  else
  {
    SymtabEntry tdtype = Util.typeOf (td.type ());
    if (tdtype instanceof SequenceEntry || tdtype instanceof PrimitiveEntry || tdtype instanceof StringEntry)
      index = ((JavaGenerator)tdtype.generator ()).read (index, indent, name, tdtype, stream);
    else if (tdtype instanceof InterfaceEntry && tdtype.fullName ().equals ("org/omg/CORBA/Object"))
      stream.println (indent + name + " = istream.read_Object ();");
    else
      stream.println (indent + name + " = " + Util.helperName (tdtype, true) + ".read (istream);"); // <d61056>
  }
  return index;
}
 
Example 10
Source File: TypedefGen.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
{
  TypedefEntry td = (TypedefEntry)entry;
  String modifier = Util.arrayInfo (td.arrayInfo ());
  if (!modifier.equals (""))
  {
    // arrayInfo is a vector of Expressions which indicate the
    // number of array dimensions for this typedef.  But what if
    // this is a typedef of a sequence?
    // The `new' statement being generated must know the full
    // number of brackets.  That can be found in td.info.
    // For instance:
    // typedef sequence<short> A[10][10];
    // void proc (out A a);
    // typeModifier = "[10][10]"
    // td.info    = "short[][][]";
    // The first new statement generated is:
    // a.value = new short[10][][];
    // Note that the 3 sets of brackets come from td.info, not
    // arrayInfo;
    // The second new statement generated is:
    // a.value[_i1] = new short[10][];
    // ------------     ---- ------
    //    \           \    \
    //    name      baseName   arrayDcl
    int closingBrackets = 0;
    String loopIndex = "";
    String baseName;
    try
    {
      baseName = (String)td.dynamicVariable (Compile.typedefInfo);
    }
    catch (NoSuchFieldException e)
    {
      baseName = td.name ();
    }
    int startArray = baseName.indexOf ('[');
    String arrayDcl = Util.sansArrayInfo (baseName.substring (startArray)) + "[]"; // Add an extra set because the first gets stripped off in the loop.
    baseName = baseName.substring (0, startArray);

    // For interfaces having state, e.g., valuetypes.
    SymtabEntry baseEntry = (SymtabEntry)Util.symbolTable.get (baseName.replace ('.', '/'));
    if (baseEntry instanceof InterfaceEntry && ((InterfaceEntry)baseEntry).state () != null)
      // <f46082.51> Remove -stateful feature; javaStatefulName() obsolete.
      //baseName = Util.javaStatefulName ((InterfaceEntry)baseEntry);
      baseName = Util.javaName ((InterfaceEntry)baseEntry);

    int end1stArray;
    while (!modifier.equals (""))
    {
      int rbracket = modifier.indexOf (']');
      String size = modifier.substring (1, rbracket);
      end1stArray = arrayDcl.indexOf (']');
      arrayDcl = '[' + size + arrayDcl.substring (end1stArray + 2);
      stream.println (indent + name + " = new " + baseName + arrayDcl + ';');
      loopIndex = "_o" + index++;
      stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < (" + size + "); ++" + loopIndex + ')');
      stream.println (indent + '{');
      ++closingBrackets;
      modifier = modifier.substring (rbracket + 1);
      indent = indent + "  ";
      name = name + '[' + loopIndex + ']';
    }
    end1stArray = arrayDcl.indexOf (']');
    if (td.type () instanceof SequenceEntry || td.type () instanceof PrimitiveEntry || td.type () instanceof StringEntry)
      index = ((JavaGenerator)td.type ().generator ()).read (index, indent, name, td.type (), stream);
    else if (td.type () instanceof InterfaceEntry && td.type ().fullName ().equals ("org/omg/CORBA/Object"))
      stream.println (indent + name + " = istream.read_Object ();");
    else
      stream.println (indent + name + " = " + Util.helperName (td.type (), true) + ".read (istream);"); // <d61056>
    for (int i = 0; i < closingBrackets; ++i)
    {
      indent = indent.substring (2);
      stream.println (indent + '}');
    }
  }
  else
  {
    SymtabEntry tdtype = Util.typeOf (td.type ());
    if (tdtype instanceof SequenceEntry || tdtype instanceof PrimitiveEntry || tdtype instanceof StringEntry)
      index = ((JavaGenerator)tdtype.generator ()).read (index, indent, name, tdtype, stream);
    else if (tdtype instanceof InterfaceEntry && tdtype.fullName ().equals ("org/omg/CORBA/Object"))
      stream.println (indent + name + " = istream.read_Object ();");
    else
      stream.println (indent + name + " = " + Util.helperName (tdtype, true) + ".read (istream);"); // <d61056>
  }
  return index;
}
 
Example 11
Source File: TypedefGen.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
{
  TypedefEntry td = (TypedefEntry)entry;
  String modifier = Util.arrayInfo (td.arrayInfo ());
  if (!modifier.equals (""))
  {
    // arrayInfo is a vector of Expressions which indicate the
    // number of array dimensions for this typedef.  But what if
    // this is a typedef of a sequence?
    // The `new' statement being generated must know the full
    // number of brackets.  That can be found in td.info.
    // For instance:
    // typedef sequence<short> A[10][10];
    // void proc (out A a);
    // typeModifier = "[10][10]"
    // td.info    = "short[][][]";
    // The first new statement generated is:
    // a.value = new short[10][][];
    // Note that the 3 sets of brackets come from td.info, not
    // arrayInfo;
    // The second new statement generated is:
    // a.value[_i1] = new short[10][];
    // ------------     ---- ------
    //    \           \    \
    //    name      baseName   arrayDcl
    int closingBrackets = 0;
    String loopIndex = "";
    String baseName;
    try
    {
      baseName = (String)td.dynamicVariable (Compile.typedefInfo);
    }
    catch (NoSuchFieldException e)
    {
      baseName = td.name ();
    }
    int startArray = baseName.indexOf ('[');
    String arrayDcl = Util.sansArrayInfo (baseName.substring (startArray)) + "[]"; // Add an extra set because the first gets stripped off in the loop.
    baseName = baseName.substring (0, startArray);

    // For interfaces having state, e.g., valuetypes.
    SymtabEntry baseEntry = (SymtabEntry)Util.symbolTable.get (baseName.replace ('.', '/'));
    if (baseEntry instanceof InterfaceEntry && ((InterfaceEntry)baseEntry).state () != null)
      // <f46082.51> Remove -stateful feature; javaStatefulName() obsolete.
      //baseName = Util.javaStatefulName ((InterfaceEntry)baseEntry);
      baseName = Util.javaName ((InterfaceEntry)baseEntry);

    int end1stArray;
    while (!modifier.equals (""))
    {
      int rbracket = modifier.indexOf (']');
      String size = modifier.substring (1, rbracket);
      end1stArray = arrayDcl.indexOf (']');
      arrayDcl = '[' + size + arrayDcl.substring (end1stArray + 2);
      stream.println (indent + name + " = new " + baseName + arrayDcl + ';');
      loopIndex = "_o" + index++;
      stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < (" + size + "); ++" + loopIndex + ')');
      stream.println (indent + '{');
      ++closingBrackets;
      modifier = modifier.substring (rbracket + 1);
      indent = indent + "  ";
      name = name + '[' + loopIndex + ']';
    }
    end1stArray = arrayDcl.indexOf (']');
    if (td.type () instanceof SequenceEntry || td.type () instanceof PrimitiveEntry || td.type () instanceof StringEntry)
      index = ((JavaGenerator)td.type ().generator ()).read (index, indent, name, td.type (), stream);
    else if (td.type () instanceof InterfaceEntry && td.type ().fullName ().equals ("org/omg/CORBA/Object"))
      stream.println (indent + name + " = istream.read_Object ();");
    else
      stream.println (indent + name + " = " + Util.helperName (td.type (), true) + ".read (istream);"); // <d61056>
    for (int i = 0; i < closingBrackets; ++i)
    {
      indent = indent.substring (2);
      stream.println (indent + '}');
    }
  }
  else
  {
    SymtabEntry tdtype = Util.typeOf (td.type ());
    if (tdtype instanceof SequenceEntry || tdtype instanceof PrimitiveEntry || tdtype instanceof StringEntry)
      index = ((JavaGenerator)tdtype.generator ()).read (index, indent, name, tdtype, stream);
    else if (tdtype instanceof InterfaceEntry && tdtype.fullName ().equals ("org/omg/CORBA/Object"))
      stream.println (indent + name + " = istream.read_Object ();");
    else
      stream.println (indent + name + " = " + Util.helperName (tdtype, true) + ".read (istream);"); // <d61056>
  }
  return index;
}
 
Example 12
Source File: TypedefGen.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
{
  TypedefEntry td = (TypedefEntry)entry;
  String modifier = Util.arrayInfo (td.arrayInfo ());
  if (!modifier.equals (""))
  {
    // arrayInfo is a vector of Expressions which indicate the
    // number of array dimensions for this typedef.  But what if
    // this is a typedef of a sequence?
    // The `new' statement being generated must know the full
    // number of brackets.  That can be found in td.info.
    // For instance:
    // typedef sequence<short> A[10][10];
    // void proc (out A a);
    // typeModifier = "[10][10]"
    // td.info    = "short[][][]";
    // The first new statement generated is:
    // a.value = new short[10][][];
    // Note that the 3 sets of brackets come from td.info, not
    // arrayInfo;
    // The second new statement generated is:
    // a.value[_i1] = new short[10][];
    // ------------     ---- ------
    //    \           \    \
    //    name      baseName   arrayDcl
    int closingBrackets = 0;
    String loopIndex = "";
    String baseName;
    try
    {
      baseName = (String)td.dynamicVariable (Compile.typedefInfo);
    }
    catch (NoSuchFieldException e)
    {
      baseName = td.name ();
    }
    int startArray = baseName.indexOf ('[');
    String arrayDcl = Util.sansArrayInfo (baseName.substring (startArray)) + "[]"; // Add an extra set because the first gets stripped off in the loop.
    baseName = baseName.substring (0, startArray);

    // For interfaces having state, e.g., valuetypes.
    SymtabEntry baseEntry = (SymtabEntry)Util.symbolTable.get (baseName.replace ('.', '/'));
    if (baseEntry instanceof InterfaceEntry && ((InterfaceEntry)baseEntry).state () != null)
      // <f46082.51> Remove -stateful feature; javaStatefulName() obsolete.
      //baseName = Util.javaStatefulName ((InterfaceEntry)baseEntry);
      baseName = Util.javaName ((InterfaceEntry)baseEntry);

    int end1stArray;
    while (!modifier.equals (""))
    {
      int rbracket = modifier.indexOf (']');
      String size = modifier.substring (1, rbracket);
      end1stArray = arrayDcl.indexOf (']');
      arrayDcl = '[' + size + arrayDcl.substring (end1stArray + 2);
      stream.println (indent + name + " = new " + baseName + arrayDcl + ';');
      loopIndex = "_o" + index++;
      stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < (" + size + "); ++" + loopIndex + ')');
      stream.println (indent + '{');
      ++closingBrackets;
      modifier = modifier.substring (rbracket + 1);
      indent = indent + "  ";
      name = name + '[' + loopIndex + ']';
    }
    end1stArray = arrayDcl.indexOf (']');
    if (td.type () instanceof SequenceEntry || td.type () instanceof PrimitiveEntry || td.type () instanceof StringEntry)
      index = ((JavaGenerator)td.type ().generator ()).read (index, indent, name, td.type (), stream);
    else if (td.type () instanceof InterfaceEntry && td.type ().fullName ().equals ("org/omg/CORBA/Object"))
      stream.println (indent + name + " = istream.read_Object ();");
    else
      stream.println (indent + name + " = " + Util.helperName (td.type (), true) + ".read (istream);"); // <d61056>
    for (int i = 0; i < closingBrackets; ++i)
    {
      indent = indent.substring (2);
      stream.println (indent + '}');
    }
  }
  else
  {
    SymtabEntry tdtype = Util.typeOf (td.type ());
    if (tdtype instanceof SequenceEntry || tdtype instanceof PrimitiveEntry || tdtype instanceof StringEntry)
      index = ((JavaGenerator)tdtype.generator ()).read (index, indent, name, tdtype, stream);
    else if (tdtype instanceof InterfaceEntry && tdtype.fullName ().equals ("org/omg/CORBA/Object"))
      stream.println (indent + name + " = istream.read_Object ();");
    else
      stream.println (indent + name + " = " + Util.helperName (tdtype, true) + ".read (istream);"); // <d61056>
  }
  return index;
}
 
Example 13
Source File: TypedefGen.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
{
  TypedefEntry td = (TypedefEntry)entry;
  String modifier = Util.arrayInfo (td.arrayInfo ());
  if (!modifier.equals (""))
  {
    // arrayInfo is a vector of Expressions which indicate the
    // number of array dimensions for this typedef.  But what if
    // this is a typedef of a sequence?
    // The `new' statement being generated must know the full
    // number of brackets.  That can be found in td.info.
    // For instance:
    // typedef sequence<short> A[10][10];
    // void proc (out A a);
    // typeModifier = "[10][10]"
    // td.info    = "short[][][]";
    // The first new statement generated is:
    // a.value = new short[10][][];
    // Note that the 3 sets of brackets come from td.info, not
    // arrayInfo;
    // The second new statement generated is:
    // a.value[_i1] = new short[10][];
    // ------------     ---- ------
    //    \           \    \
    //    name      baseName   arrayDcl
    int closingBrackets = 0;
    String loopIndex = "";
    String baseName;
    try
    {
      baseName = (String)td.dynamicVariable (Compile.typedefInfo);
    }
    catch (NoSuchFieldException e)
    {
      baseName = td.name ();
    }
    int startArray = baseName.indexOf ('[');
    String arrayDcl = Util.sansArrayInfo (baseName.substring (startArray)) + "[]"; // Add an extra set because the first gets stripped off in the loop.
    baseName = baseName.substring (0, startArray);

    // For interfaces having state, e.g., valuetypes.
    SymtabEntry baseEntry = (SymtabEntry)Util.symbolTable.get (baseName.replace ('.', '/'));
    if (baseEntry instanceof InterfaceEntry && ((InterfaceEntry)baseEntry).state () != null)
      // <f46082.51> Remove -stateful feature; javaStatefulName() obsolete.
      //baseName = Util.javaStatefulName ((InterfaceEntry)baseEntry);
      baseName = Util.javaName ((InterfaceEntry)baseEntry);

    int end1stArray;
    while (!modifier.equals (""))
    {
      int rbracket = modifier.indexOf (']');
      String size = modifier.substring (1, rbracket);
      end1stArray = arrayDcl.indexOf (']');
      arrayDcl = '[' + size + arrayDcl.substring (end1stArray + 2);
      stream.println (indent + name + " = new " + baseName + arrayDcl + ';');
      loopIndex = "_o" + index++;
      stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < (" + size + "); ++" + loopIndex + ')');
      stream.println (indent + '{');
      ++closingBrackets;
      modifier = modifier.substring (rbracket + 1);
      indent = indent + "  ";
      name = name + '[' + loopIndex + ']';
    }
    end1stArray = arrayDcl.indexOf (']');
    if (td.type () instanceof SequenceEntry || td.type () instanceof PrimitiveEntry || td.type () instanceof StringEntry)
      index = ((JavaGenerator)td.type ().generator ()).read (index, indent, name, td.type (), stream);
    else if (td.type () instanceof InterfaceEntry && td.type ().fullName ().equals ("org/omg/CORBA/Object"))
      stream.println (indent + name + " = istream.read_Object ();");
    else
      stream.println (indent + name + " = " + Util.helperName (td.type (), true) + ".read (istream);"); // <d61056>
    for (int i = 0; i < closingBrackets; ++i)
    {
      indent = indent.substring (2);
      stream.println (indent + '}');
    }
  }
  else
  {
    SymtabEntry tdtype = Util.typeOf (td.type ());
    if (tdtype instanceof SequenceEntry || tdtype instanceof PrimitiveEntry || tdtype instanceof StringEntry)
      index = ((JavaGenerator)tdtype.generator ()).read (index, indent, name, tdtype, stream);
    else if (tdtype instanceof InterfaceEntry && tdtype.fullName ().equals ("org/omg/CORBA/Object"))
      stream.println (indent + name + " = istream.read_Object ();");
    else
      stream.println (indent + name + " = " + Util.helperName (tdtype, true) + ".read (istream);"); // <d61056>
  }
  return index;
}
 
Example 14
Source File: TypedefGen.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
{
  TypedefEntry td = (TypedefEntry)entry;
  String modifier = Util.arrayInfo (td.arrayInfo ());
  if (!modifier.equals (""))
  {
    // arrayInfo is a vector of Expressions which indicate the
    // number of array dimensions for this typedef.  But what if
    // this is a typedef of a sequence?
    // The `new' statement being generated must know the full
    // number of brackets.  That can be found in td.info.
    // For instance:
    // typedef sequence<short> A[10][10];
    // void proc (out A a);
    // typeModifier = "[10][10]"
    // td.info    = "short[][][]";
    // The first new statement generated is:
    // a.value = new short[10][][];
    // Note that the 3 sets of brackets come from td.info, not
    // arrayInfo;
    // The second new statement generated is:
    // a.value[_i1] = new short[10][];
    // ------------     ---- ------
    //    \           \    \
    //    name      baseName   arrayDcl
    int closingBrackets = 0;
    String loopIndex = "";
    String baseName;
    try
    {
      baseName = (String)td.dynamicVariable (Compile.typedefInfo);
    }
    catch (NoSuchFieldException e)
    {
      baseName = td.name ();
    }
    int startArray = baseName.indexOf ('[');
    String arrayDcl = Util.sansArrayInfo (baseName.substring (startArray)) + "[]"; // Add an extra set because the first gets stripped off in the loop.
    baseName = baseName.substring (0, startArray);

    // For interfaces having state, e.g., valuetypes.
    SymtabEntry baseEntry = (SymtabEntry)Util.symbolTable.get (baseName.replace ('.', '/'));
    if (baseEntry instanceof InterfaceEntry && ((InterfaceEntry)baseEntry).state () != null)
      // <f46082.51> Remove -stateful feature; javaStatefulName() obsolete.
      //baseName = Util.javaStatefulName ((InterfaceEntry)baseEntry);
      baseName = Util.javaName ((InterfaceEntry)baseEntry);

    int end1stArray;
    while (!modifier.equals (""))
    {
      int rbracket = modifier.indexOf (']');
      String size = modifier.substring (1, rbracket);
      end1stArray = arrayDcl.indexOf (']');
      arrayDcl = '[' + size + arrayDcl.substring (end1stArray + 2);
      stream.println (indent + name + " = new " + baseName + arrayDcl + ';');
      loopIndex = "_o" + index++;
      stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < (" + size + "); ++" + loopIndex + ')');
      stream.println (indent + '{');
      ++closingBrackets;
      modifier = modifier.substring (rbracket + 1);
      indent = indent + "  ";
      name = name + '[' + loopIndex + ']';
    }
    end1stArray = arrayDcl.indexOf (']');
    if (td.type () instanceof SequenceEntry || td.type () instanceof PrimitiveEntry || td.type () instanceof StringEntry)
      index = ((JavaGenerator)td.type ().generator ()).read (index, indent, name, td.type (), stream);
    else if (td.type () instanceof InterfaceEntry && td.type ().fullName ().equals ("org/omg/CORBA/Object"))
      stream.println (indent + name + " = istream.read_Object ();");
    else
      stream.println (indent + name + " = " + Util.helperName (td.type (), true) + ".read (istream);"); // <d61056>
    for (int i = 0; i < closingBrackets; ++i)
    {
      indent = indent.substring (2);
      stream.println (indent + '}');
    }
  }
  else
  {
    SymtabEntry tdtype = Util.typeOf (td.type ());
    if (tdtype instanceof SequenceEntry || tdtype instanceof PrimitiveEntry || tdtype instanceof StringEntry)
      index = ((JavaGenerator)tdtype.generator ()).read (index, indent, name, tdtype, stream);
    else if (tdtype instanceof InterfaceEntry && tdtype.fullName ().equals ("org/omg/CORBA/Object"))
      stream.println (indent + name + " = istream.read_Object ();");
    else
      stream.println (indent + name + " = " + Util.helperName (tdtype, true) + ".read (istream);"); // <d61056>
  }
  return index;
}
 
Example 15
Source File: TypedefGen.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
{
  TypedefEntry td = (TypedefEntry)entry;
  String modifier = Util.arrayInfo (td.arrayInfo ());
  if (!modifier.equals (""))
  {
    // arrayInfo is a vector of Expressions which indicate the
    // number of array dimensions for this typedef.  But what if
    // this is a typedef of a sequence?
    // The `new' statement being generated must know the full
    // number of brackets.  That can be found in td.info.
    // For instance:
    // typedef sequence<short> A[10][10];
    // void proc (out A a);
    // typeModifier = "[10][10]"
    // td.info    = "short[][][]";
    // The first new statement generated is:
    // a.value = new short[10][][];
    // Note that the 3 sets of brackets come from td.info, not
    // arrayInfo;
    // The second new statement generated is:
    // a.value[_i1] = new short[10][];
    // ------------     ---- ------
    //    \           \    \
    //    name      baseName   arrayDcl
    int closingBrackets = 0;
    String loopIndex = "";
    String baseName;
    try
    {
      baseName = (String)td.dynamicVariable (Compile.typedefInfo);
    }
    catch (NoSuchFieldException e)
    {
      baseName = td.name ();
    }
    int startArray = baseName.indexOf ('[');
    String arrayDcl = Util.sansArrayInfo (baseName.substring (startArray)) + "[]"; // Add an extra set because the first gets stripped off in the loop.
    baseName = baseName.substring (0, startArray);

    // For interfaces having state, e.g., valuetypes.
    SymtabEntry baseEntry = (SymtabEntry)Util.symbolTable.get (baseName.replace ('.', '/'));
    if (baseEntry instanceof InterfaceEntry && ((InterfaceEntry)baseEntry).state () != null)
      // <f46082.51> Remove -stateful feature; javaStatefulName() obsolete.
      //baseName = Util.javaStatefulName ((InterfaceEntry)baseEntry);
      baseName = Util.javaName ((InterfaceEntry)baseEntry);

    int end1stArray;
    while (!modifier.equals (""))
    {
      int rbracket = modifier.indexOf (']');
      String size = modifier.substring (1, rbracket);
      end1stArray = arrayDcl.indexOf (']');
      arrayDcl = '[' + size + arrayDcl.substring (end1stArray + 2);
      stream.println (indent + name + " = new " + baseName + arrayDcl + ';');
      loopIndex = "_o" + index++;
      stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < (" + size + "); ++" + loopIndex + ')');
      stream.println (indent + '{');
      ++closingBrackets;
      modifier = modifier.substring (rbracket + 1);
      indent = indent + "  ";
      name = name + '[' + loopIndex + ']';
    }
    end1stArray = arrayDcl.indexOf (']');
    if (td.type () instanceof SequenceEntry || td.type () instanceof PrimitiveEntry || td.type () instanceof StringEntry)
      index = ((JavaGenerator)td.type ().generator ()).read (index, indent, name, td.type (), stream);
    else if (td.type () instanceof InterfaceEntry && td.type ().fullName ().equals ("org/omg/CORBA/Object"))
      stream.println (indent + name + " = istream.read_Object ();");
    else
      stream.println (indent + name + " = " + Util.helperName (td.type (), true) + ".read (istream);"); // <d61056>
    for (int i = 0; i < closingBrackets; ++i)
    {
      indent = indent.substring (2);
      stream.println (indent + '}');
    }
  }
  else
  {
    SymtabEntry tdtype = Util.typeOf (td.type ());
    if (tdtype instanceof SequenceEntry || tdtype instanceof PrimitiveEntry || tdtype instanceof StringEntry)
      index = ((JavaGenerator)tdtype.generator ()).read (index, indent, name, tdtype, stream);
    else if (tdtype instanceof InterfaceEntry && tdtype.fullName ().equals ("org/omg/CORBA/Object"))
      stream.println (indent + name + " = istream.read_Object ();");
    else
      stream.println (indent + name + " = " + Util.helperName (tdtype, true) + ".read (istream);"); // <d61056>
  }
  return index;
}
 
Example 16
Source File: TypedefGen.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
{
  TypedefEntry td = (TypedefEntry)entry;
  String modifier = Util.arrayInfo (td.arrayInfo ());
  if (!modifier.equals (""))
  {
    // arrayInfo is a vector of Expressions which indicate the
    // number of array dimensions for this typedef.  But what if
    // this is a typedef of a sequence?
    // The `new' statement being generated must know the full
    // number of brackets.  That can be found in td.info.
    // For instance:
    // typedef sequence<short> A[10][10];
    // void proc (out A a);
    // typeModifier = "[10][10]"
    // td.info    = "short[][][]";
    // The first new statement generated is:
    // a.value = new short[10][][];
    // Note that the 3 sets of brackets come from td.info, not
    // arrayInfo;
    // The second new statement generated is:
    // a.value[_i1] = new short[10][];
    // ------------     ---- ------
    //    \           \    \
    //    name      baseName   arrayDcl
    int closingBrackets = 0;
    String loopIndex = "";
    String baseName;
    try
    {
      baseName = (String)td.dynamicVariable (Compile.typedefInfo);
    }
    catch (NoSuchFieldException e)
    {
      baseName = td.name ();
    }
    int startArray = baseName.indexOf ('[');
    String arrayDcl = Util.sansArrayInfo (baseName.substring (startArray)) + "[]"; // Add an extra set because the first gets stripped off in the loop.
    baseName = baseName.substring (0, startArray);

    // For interfaces having state, e.g., valuetypes.
    SymtabEntry baseEntry = (SymtabEntry)Util.symbolTable.get (baseName.replace ('.', '/'));
    if (baseEntry instanceof InterfaceEntry && ((InterfaceEntry)baseEntry).state () != null)
      // <f46082.51> Remove -stateful feature; javaStatefulName() obsolete.
      //baseName = Util.javaStatefulName ((InterfaceEntry)baseEntry);
      baseName = Util.javaName ((InterfaceEntry)baseEntry);

    int end1stArray;
    while (!modifier.equals (""))
    {
      int rbracket = modifier.indexOf (']');
      String size = modifier.substring (1, rbracket);
      end1stArray = arrayDcl.indexOf (']');
      arrayDcl = '[' + size + arrayDcl.substring (end1stArray + 2);
      stream.println (indent + name + " = new " + baseName + arrayDcl + ';');
      loopIndex = "_o" + index++;
      stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < (" + size + "); ++" + loopIndex + ')');
      stream.println (indent + '{');
      ++closingBrackets;
      modifier = modifier.substring (rbracket + 1);
      indent = indent + "  ";
      name = name + '[' + loopIndex + ']';
    }
    end1stArray = arrayDcl.indexOf (']');
    if (td.type () instanceof SequenceEntry || td.type () instanceof PrimitiveEntry || td.type () instanceof StringEntry)
      index = ((JavaGenerator)td.type ().generator ()).read (index, indent, name, td.type (), stream);
    else if (td.type () instanceof InterfaceEntry && td.type ().fullName ().equals ("org/omg/CORBA/Object"))
      stream.println (indent + name + " = istream.read_Object ();");
    else
      stream.println (indent + name + " = " + Util.helperName (td.type (), true) + ".read (istream);"); // <d61056>
    for (int i = 0; i < closingBrackets; ++i)
    {
      indent = indent.substring (2);
      stream.println (indent + '}');
    }
  }
  else
  {
    SymtabEntry tdtype = Util.typeOf (td.type ());
    if (tdtype instanceof SequenceEntry || tdtype instanceof PrimitiveEntry || tdtype instanceof StringEntry)
      index = ((JavaGenerator)tdtype.generator ()).read (index, indent, name, tdtype, stream);
    else if (tdtype instanceof InterfaceEntry && tdtype.fullName ().equals ("org/omg/CORBA/Object"))
      stream.println (indent + name + " = istream.read_Object ();");
    else
      stream.println (indent + name + " = " + Util.helperName (tdtype, true) + ".read (istream);"); // <d61056>
  }
  return index;
}