Java Code Examples for com.sun.tools.corba.se.idl.StringEntry

The following examples show how to use com.sun.tools.corba.se.idl.StringEntry. These examples are extracted from open source projects. 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 Project: TencentKona-8   Source File: MethodGen.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
private void writeInsert (String indent, String target, String source, SymtabEntry type, PrintWriter stream)
{
  String typeName = type.name ();
  if (type instanceof PrimitiveEntry)
  {
    // RJB does something have to be done with TC offsets?
    if (typeName.equals ("long long"))
      stream.println (indent + source + ".insert_longlong (" + target + ");");
    else if (typeName.equals ("unsigned short"))
      stream.println (indent + source + ".insert_ushort (" + target + ");");
    else if (typeName.equals ("unsigned long"))
      stream.println (indent + source + ".insert_ulong (" + target + ");");
    else if (typeName.equals ("unsigned long long"))
      stream.println (indent + source + ".insert_ulonglong (" + target + ");");
    else
      stream.println (indent + source + ".insert_" + typeName + " (" + target + ");");
  }
  else if (type instanceof StringEntry)
    stream.println (indent + source + ".insert_" + typeName + " (" + target + ");");
  else
    stream.println (indent + Util.helperName (type, true) + ".insert (" + source + ", " + target + ");"); // <d61056>
}
 
Example 2
Source Project: TencentKona-8   Source File: MethodGen.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
private void writeExtract (String indent, String target, String source, SymtabEntry type, PrintWriter stream)
{
  if (type instanceof PrimitiveEntry)
  {
    if (type.name ().equals ("long long"))
      stream.println (indent + target + " = " + source + ".extract_longlong ();");
    else if (type.name ().equals ("unsigned short"))
      stream.println (indent + target + " = " + source + ".extract_ushort ();");
    else if (type.name ().equals ("unsigned long"))
      stream.println (indent + target + " = " + source + ".extract_ulong ();");
    else if (type.name ().equals ("unsigned long long"))
      stream.println (indent + target + " = " + source + ".extract_ulonglong ();");
    else
      stream.println (indent + target + " = " + source + ".extract_" + type.name () + " ();");
  }
  else if (type instanceof StringEntry)
    stream.println (indent + target + " = " + source + ".extract_" + type.name () + " ();");
  else
    stream.println (indent + target + " = " + Util.helperName (type, true) + ".extract (" + source + ");"); // <d61056>
}
 
Example 3
Source Project: TencentKona-8   Source File: MethodGen.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
private String writeExtract (String source, SymtabEntry type)
{
  String extract;
  if (type instanceof PrimitiveEntry)
  {
    if (type.name ().equals ("long long"))
      extract = source + ".extract_longlong ()";
    else if (type.name ().equals ("unsigned short"))
      extract = source + ".extract_ushort ()";
    else if (type.name ().equals ("unsigned long"))
      extract = source + ".extract_ulong ()";
    else if (type.name ().equals ("unsigned long long"))
      extract = source + ".extract_ulonglong ()";
    else
      extract = source + ".extract_" + type.name () + " ()";
  }
  else if (type instanceof StringEntry)
    extract = source + ".extract_" + type.name () + " ()";
  else
    extract = Util.helperName (type, true) + ".extract (" + source + ')'; // <d61056>
  return extract;
}
 
Example 4
Source Project: openjdk-jdk9   Source File: ConstGen.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Write the constant's value according to its type.
 **/
private void writeConstValue (SymtabEntry type)
{
  if (type instanceof PrimitiveEntry)
    stream.println ('(' + Util.javaName (type) + ")(" + Util.parseExpression (c.value ()) + ");");
  else if (type instanceof StringEntry)
    stream.println (Util.parseExpression (c.value ()) + ';');
  else if (type instanceof TypedefEntry)
  {
    while (type instanceof TypedefEntry)
      type = type.type ();
    writeConstValue (type);
  }
  else
    stream.println (Util.parseExpression (c.value ()) + ';');
}
 
Example 5
Source Project: TencentKona-8   Source File: MethodGen.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
private String writeInputStreamRead (String source, SymtabEntry type)
{
  String read = "";
  if (type instanceof PrimitiveEntry)
  {
    if (type.name ().equals ("long long"))
      read = source + ".read_longlong ()";
    else if (type.name ().equals ("unsigned short"))
      read = source + ".read_ushort ()";
    else if (type.name ().equals ("unsigned long"))
      read = source + ".read_ulong ()";
    else if (type.name ().equals ("unsigned long long"))
      read = source + ".read_ulonglong ()";
    else
      read = source + ".read_" + type.name () + " ()";
  }
  else if (type instanceof StringEntry)
    read = source + ".read_" + type.name () + " ()";
  else
    read = Util.helperName (type, true) + ".read (" + source + ')'; // <d61056>
  return read;
}
 
Example 6
Source Project: openjdk-jdk9   Source File: StringGen.java    License: GNU General Public License v2.0 6 votes vote down vote up
public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) {
  tcoffsets.set (entry);
  StringEntry stringEntry = (StringEntry)entry;
  String bound;
  if (stringEntry.maxSize () == null)
    bound = "0";
  else
    bound = Util.parseExpression (stringEntry.maxSize ());

  // entry.name() is necessary to determine whether it is a
  // string or wstring

  stream.println (indent
                  + name
                  + " = org.omg.CORBA.ORB.init ().create_"
                  + entry.name()
                  + "_tc ("
                  + bound + ");");
  return index;
}
 
Example 7
Source Project: TencentKona-8   Source File: StringGen.java    License: GNU General Public License v2.0 6 votes vote down vote up
public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) {
  tcoffsets.set (entry);
  StringEntry stringEntry = (StringEntry)entry;
  String bound;
  if (stringEntry.maxSize () == null)
    bound = "0";
  else
    bound = Util.parseExpression (stringEntry.maxSize ());

  // entry.name() is necessary to determine whether it is a
  // string or wstring

  stream.println (indent
                  + name
                  + " = org.omg.CORBA.ORB.init ().create_"
                  + entry.name()
                  + "_tc ("
                  + bound + ");");
  return index;
}
 
Example 8
Source Project: openjdk-jdk9   Source File: ValueBoxGen.java    License: 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 9
Source Project: TencentKona-8   Source File: Util.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Given a symtabEntry, return the name of this entry. This
 * method does not do any conversions like javaName does.
 **/
public static String javaQualifiedName (SymtabEntry entry)
{
  String name = "";
  if (entry instanceof PrimitiveEntry)
    name = javaPrimName (entry.name ());
  else if (entry instanceof StringEntry)
    name = "String";
  else if (entry instanceof ValueEntry && entry.name ().equals ("ValueBase"))
    name = "java.io.Serializable";
  else
  {
    SymtabEntry container = entry.container ();
    if (container != null)
      name = container.name ();
    if (name.equals (""))
      name = entry.name ();
    else
      name = containerFullName (entry.container ()) + '.' + entry.name ();
  }
  return name.replace ('/', '.');
}
 
Example 10
Source Project: openjdk-jdk8u   Source File: Util.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Given a symtabEntry, return the name of this entry. This
 * method does not do any conversions like javaName does.
 **/
public static String javaQualifiedName (SymtabEntry entry)
{
  String name = "";
  if (entry instanceof PrimitiveEntry)
    name = javaPrimName (entry.name ());
  else if (entry instanceof StringEntry)
    name = "String";
  else if (entry instanceof ValueEntry && entry.name ().equals ("ValueBase"))
    name = "java.io.Serializable";
  else
  {
    SymtabEntry container = entry.container ();
    if (container != null)
      name = container.name ();
    if (name.equals (""))
      name = entry.name ();
    else
      name = containerFullName (entry.container ()) + '.' + entry.name ();
  }
  return name.replace ('/', '.');
}
 
Example 11
Source Project: openjdk-jdk8u   Source File: ValueBoxGen.java    License: 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 12
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 13
Source Project: openjdk-jdk9   Source File: MethodGen.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
private String writeExtract (String source, SymtabEntry type)
{
  String extract;
  if (type instanceof PrimitiveEntry)
  {
    if (type.name ().equals ("long long"))
      extract = source + ".extract_longlong ()";
    else if (type.name ().equals ("unsigned short"))
      extract = source + ".extract_ushort ()";
    else if (type.name ().equals ("unsigned long"))
      extract = source + ".extract_ulong ()";
    else if (type.name ().equals ("unsigned long long"))
      extract = source + ".extract_ulonglong ()";
    else
      extract = source + ".extract_" + type.name () + " ()";
  }
  else if (type instanceof StringEntry)
    extract = source + ".extract_" + type.name () + " ()";
  else
    extract = Util.helperName (type, true) + ".extract (" + source + ')'; // <d61056>
  return extract;
}
 
Example 14
Source Project: TencentKona-8   Source File: ValueBoxGen.java    License: 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 Project: TencentKona-8   Source File: ValueBoxGen.java    License: 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 16
Source Project: TencentKona-8   Source File: Holder.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Generate the _read method.
 **/
protected void writeRead ()
{
  stream.println ("  public void _read (org.omg.CORBA.portable.InputStream i)");
  stream.println ("  {");
  if (entry instanceof ValueBoxEntry)
  {
    TypedefEntry member = ((InterfaceState) ((ValueBoxEntry) entry).state ().elementAt (0)).entry;
    SymtabEntry mType = member.type ();
    if (mType instanceof StringEntry)
      stream.println ("    value = i.read_string ();");

    else if (mType instanceof PrimitiveEntry)
      stream.println ("    value = " + helperClass + ".read (i).value;");

    else
      stream.println ("    value = " + helperClass + ".read (i);");
  }
  else
    stream.println ("    value = " + helperClass + ".read (i);");
  stream.println ("  }");
  stream.println ();
}
 
Example 17
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 18
public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) {
  tcoffsets.set (entry);
  StringEntry stringEntry = (StringEntry)entry;
  String bound;
  if (stringEntry.maxSize () == null)
    bound = "0";
  else
    bound = Util.parseExpression (stringEntry.maxSize ());

  // entry.name() is necessary to determine whether it is a
  // string or wstring

  stream.println (indent
                  + name
                  + " = org.omg.CORBA.ORB.init ().create_"
                  + entry.name()
                  + "_tc ("
                  + bound + ");");
  return index;
}
 
Example 19
Source Project: openjdk-jdk9   Source File: ValueBoxGen.java    License: 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 20
Source Project: openjdk-jdk9   Source File: MethodGen.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
private String writeInputStreamRead (String source, SymtabEntry type)
{
  String read = "";
  if (type instanceof PrimitiveEntry)
  {
    if (type.name ().equals ("long long"))
      read = source + ".read_longlong ()";
    else if (type.name ().equals ("unsigned short"))
      read = source + ".read_ushort ()";
    else if (type.name ().equals ("unsigned long"))
      read = source + ".read_ulong ()";
    else if (type.name ().equals ("unsigned long long"))
      read = source + ".read_ulonglong ()";
    else
      read = source + ".read_" + type.name () + " ()";
  }
  else if (type instanceof StringEntry)
    read = source + ".read_" + type.name () + " ()";
  else
    read = Util.helperName (type, true) + ".read (" + source + ')'; // <d61056>
  return read;
}
 
Example 21
/**
 * Write the constant's value according to its type.
 **/
private void writeConstValue (SymtabEntry type)
{
  if (type instanceof PrimitiveEntry)
    stream.println ('(' + Util.javaName (type) + ")(" + Util.parseExpression (c.value ()) + ");");
  else if (type instanceof StringEntry)
    stream.println (Util.parseExpression (c.value ()) + ';');
  else if (type instanceof TypedefEntry)
  {
    while (type instanceof TypedefEntry)
      type = type.type ();
    writeConstValue (type);
  }
  else
    stream.println (Util.parseExpression (c.value ()) + ';');
}
 
Example 22
Source Project: openjdk-jdk8u   Source File: UnionGen.java    License: 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 23
/**
 *
 **/
private void writeInsert (String indent, String target, String source, SymtabEntry type, PrintWriter stream)
{
  String typeName = type.name ();
  if (type instanceof PrimitiveEntry)
  {
    // RJB does something have to be done with TC offsets?
    if (typeName.equals ("long long"))
      stream.println (indent + source + ".insert_longlong (" + target + ");");
    else if (typeName.equals ("unsigned short"))
      stream.println (indent + source + ".insert_ushort (" + target + ");");
    else if (typeName.equals ("unsigned long"))
      stream.println (indent + source + ".insert_ulong (" + target + ");");
    else if (typeName.equals ("unsigned long long"))
      stream.println (indent + source + ".insert_ulonglong (" + target + ");");
    else
      stream.println (indent + source + ".insert_" + typeName + " (" + target + ");");
  }
  else if (type instanceof StringEntry)
    stream.println (indent + source + ".insert_" + typeName + " (" + target + ");");
  else
    stream.println (indent + Util.helperName (type, true) + ".insert (" + source + ", " + target + ");"); // <d61056>
}
 
Example 24
/**
 *
 **/
private String writeExtract (String source, SymtabEntry type)
{
  String extract;
  if (type instanceof PrimitiveEntry)
  {
    if (type.name ().equals ("long long"))
      extract = source + ".extract_longlong ()";
    else if (type.name ().equals ("unsigned short"))
      extract = source + ".extract_ushort ()";
    else if (type.name ().equals ("unsigned long"))
      extract = source + ".extract_ulong ()";
    else if (type.name ().equals ("unsigned long long"))
      extract = source + ".extract_ulonglong ()";
    else
      extract = source + ".extract_" + type.name () + " ()";
  }
  else if (type instanceof StringEntry)
    extract = source + ".extract_" + type.name () + " ()";
  else
    extract = Util.helperName (type, true) + ".extract (" + source + ')'; // <d61056>
  return extract;
}
 
Example 25
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 26
/**
 *
 **/
private String writeInputStreamRead (String source, SymtabEntry type)
{
  String read = "";
  if (type instanceof PrimitiveEntry)
  {
    if (type.name ().equals ("long long"))
      read = source + ".read_longlong ()";
    else if (type.name ().equals ("unsigned short"))
      read = source + ".read_ushort ()";
    else if (type.name ().equals ("unsigned long"))
      read = source + ".read_ulong ()";
    else if (type.name ().equals ("unsigned long long"))
      read = source + ".read_ulonglong ()";
    else
      read = source + ".read_" + type.name () + " ()";
  }
  else if (type instanceof StringEntry)
    read = source + ".read_" + type.name () + " ()";
  else
    read = Util.helperName (type, true) + ".read (" + source + ')'; // <d61056>
  return read;
}
 
Example 27
Source Project: openjdk-jdk9   Source File: Holder.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Generate the _read method.
 **/
protected void writeRead ()
{
  stream.println ("  public void _read (org.omg.CORBA.portable.InputStream i)");
  stream.println ("  {");
  if (entry instanceof ValueBoxEntry)
  {
    TypedefEntry member = ((InterfaceState) ((ValueBoxEntry) entry).state ().elementAt (0)).entry;
    SymtabEntry mType = member.type ();
    if (mType instanceof StringEntry)
      stream.println ("    value = i.read_string ();");

    else if (mType instanceof PrimitiveEntry)
      stream.println ("    value = " + helperClass + ".read (i).value;");

    else
      stream.println ("    value = " + helperClass + ".read (i);");
  }
  else
    stream.println ("    value = " + helperClass + ".read (i);");
  stream.println ("  }");
  stream.println ();
}
 
Example 28
Source Project: openjdk-jdk9   Source File: MethodGen.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
private void writeExtract (String indent, String target, String source, SymtabEntry type, PrintWriter stream)
{
  if (type instanceof PrimitiveEntry)
  {
    if (type.name ().equals ("long long"))
      stream.println (indent + target + " = " + source + ".extract_longlong ();");
    else if (type.name ().equals ("unsigned short"))
      stream.println (indent + target + " = " + source + ".extract_ushort ();");
    else if (type.name ().equals ("unsigned long"))
      stream.println (indent + target + " = " + source + ".extract_ulong ();");
    else if (type.name ().equals ("unsigned long long"))
      stream.println (indent + target + " = " + source + ".extract_ulonglong ();");
    else
      stream.println (indent + target + " = " + source + ".extract_" + type.name () + " ();");
  }
  else if (type instanceof StringEntry)
    stream.println (indent + target + " = " + source + ".extract_" + type.name () + " ();");
  else
    stream.println (indent + target + " = " + Util.helperName (type, true) + ".extract (" + source + ");"); // <d61056>
}
 
Example 29
Source Project: jdk8u60   Source File: UnionGen.java    License: 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 30
Source Project: jdk8u60   Source File: ConstGen.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Write the constant's value according to its type.
 **/
private void writeConstValue (SymtabEntry type)
{
  if (type instanceof PrimitiveEntry)
    stream.println ('(' + Util.javaName (type) + ")(" + Util.parseExpression (c.value ()) + ");");
  else if (type instanceof StringEntry)
    stream.println (Util.parseExpression (c.value ()) + ';');
  else if (type instanceof TypedefEntry)
  {
    while (type instanceof TypedefEntry)
      type = type.type ();
    writeConstValue (type);
  }
  else
    stream.println (Util.parseExpression (c.value ()) + ';');
}