Package com.sun.tools.corba.se.idl

Examples of com.sun.tools.corba.se.idl.SymtabEntry


   **/
  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);
View Full Code Here


        return;
    } else
        stream.print ("public abstract class " + v.name ());

    // There should always be at least one parent: ValueBase
    SymtabEntry parent = (SymtabEntry) v.derivedFrom ().elementAt (0);

    // If parent is ValueBase, it's mapped to java.io.Serializable
    String parentName = Util.javaName (parent);
    boolean cv = false; // true if we've already implemented CustomValue
View Full Code Here

      return;

    for (int i = 0; i < v.state ().size (); i ++)
    {
      InterfaceState member = (InterfaceState) v.state ().elementAt (i);
      SymtabEntry entry = (SymtabEntry) member.entry;
      Util.fillInfo (entry);

      if (entry.comment () != null)
        entry.comment ().generate (" ", stream);

      String modifier = "  ";
      if (member.modifier == InterfaceState.Public)
        modifier = "  public ";
      else
        modifier = "  protected ";
      Util.writeInitializer (modifier, entry.name (), "", entry, stream);
    }
    stream.println();
  } // writeMembers
View Full Code Here

    // of a state member, e.g   struct x {boolean b;}  memberx;
    // the generation of the nested type must be handled here.
    Enumeration e = v.contained ().elements ();
    while (e.hasMoreElements ())
    {
      SymtabEntry contained = (SymtabEntry)e.nextElement ();
      if (contained instanceof AttributeEntry)
      {
        AttributeEntry element = (AttributeEntry)contained;
        ((AttributeGen24)element.generator ()).abstractMethod (symbolTable, element, stream);
      }
      else if (contained instanceof MethodEntry)
      {
        MethodEntry element = (MethodEntry)contained;
        ((MethodGen24)element.generator ()).abstractMethod (symbolTable, element, stream);
      }
      else
      {
        // Generate the type referenced by the typedef.
        if (contained instanceof TypedefEntry)
          contained.type ().generate (symbolTable, stream);

        // Note that we also need to generate the typedef itself if
        // contained is a typedef.
        contained.generate (symbolTable, stream);
      }
    }

    // Abstract values are mapped to interfaces. There is no need to generate
    // the bindings for inheriting methods in case of inheritance from other
View Full Code Here

    for (int k = 0; k < noOfMembers; k++)
    {
      TypedefEntry member = (TypedefEntry)((InterfaceState)vMembers.elementAt (k)).entry;
      String memberName = member.name ();
      SymtabEntry mType = member.type ();

      if (mType instanceof PrimitiveEntry ||
          mType instanceof TypedefEntry   ||
          mType instanceof SequenceEntry  ||
          mType instanceof StringEntry    ||
View Full Code Here

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

      if (mType instanceof PrimitiveEntry ||
          mType instanceof TypedefEntry   ||
          mType instanceof SequenceEntry  ||
          mType instanceof StringEntry    ||
View Full Code Here

  /**
   *
   **/
  static void fillValueBoxInfo (ValueBoxEntry vb)
  {
    SymtabEntry stateMember = (((InterfaceState) vb.state ().elementAt (0)).entry);
    if (stateMember.type() != null)
      Util.fillInfo (stateMember.type ());
    Util.fillInfo (stateMember);
  } // fillValueBoxInfo
View Full Code Here

      {
        // Examine interface parents in supports vector.
        Enumeration e = ((ValueEntry)i).supports ().elements ();
        while (e.hasMoreElements ())
        {
          SymtabEntry parent = (SymtabEntry)e.nextElement ();
          if (importTypes.contains (parent))
          {
            addTo (importList, parent.name () + "Operations");
          }
          // If this is a stub, then recurse to the parents
          if (type == StubFile)
          {
            if (importTypes.contains (parent))
              addTo (importList, parent.name ());
            Vector subImportList = addImportLines (parent, importTypes, StubFile);
            Enumeration en = subImportList.elements ();
            while (en.hasMoreElements ())
            {
              addTo (importList, (String)en.nextElement ());
            }
          }
        }
      }
      // Interface or valuetype -- Examine interface and valuetype parents,
      // Look through derivedFrom vector
      Enumeration e = i.derivedFrom ().elements ();
      while (e.hasMoreElements ())
      {
        SymtabEntry parent = (SymtabEntry)e.nextElement ();
        if (importTypes.contains (parent))
        {
          addTo (importList, parent.name ());
          // <d59512> Always add both imports, even though superfluous.  Cannot
          // tell when writing Operations or Signature interface!
          if (!(parent instanceof ValueEntry)) // && parent.name ().equals ("ValueBase")))
            addTo (importList, parent.name () + "Operations");
        }
        // If this is a stub, then recurse to the parents
        if (type == StubFile)
        {
          Vector subImportList = addImportLines (parent, importTypes, StubFile);
          Enumeration en = subImportList.elements ();
          while (en.hasMoreElements ())
          {
            addTo (importList, (String)en.nextElement ());
          }
        }
      }
      // Look through methods vector
      e = i.methods ().elements ();
      while (e.hasMoreElements ())
      {
        MethodEntry m = (MethodEntry)e.nextElement ();

        // Look at method type
        SymtabEntry mtype = typeOf (m.type ());
        if (mtype != null && importTypes.contains (mtype))
          if (type == TypeFile || type == StubFile)
          {
            addTo (importList, mtype.name ());
            addTo (importList, mtype.name () + "Holder");
            if (type == StubFile)
              addTo (importList, mtype.name () + "Helper");
          }
        checkForArrays (mtype, importTypes, importList);
        // <d42256> Print import lines for globals constants and constants
        // within global interfaces.
        if (type == StubFile)
          checkForBounds (mtype, importTypes, importList);

        // Look through exceptions
        Enumeration exEnum = m.exceptions ().elements ();
        while (exEnum.hasMoreElements ())
        {
          ExceptionEntry ex = (ExceptionEntry)exEnum.nextElement ();
          if (importTypes.contains (ex))
          {
            addTo (importList, ex.name ());
            addTo (importList, ex.name () + "Helper"); // <d59063>
          }
        }

        // Look through parameters
        Enumeration parms = m.parameters ().elements ();
        while (parms.hasMoreElements ())
        {
          ParameterEntry parm = (ParameterEntry)parms.nextElement ();
          SymtabEntry parmType = typeOf (parm.type ());
          if (importTypes.contains (parmType))
          {
            // <d59771> Helper needed in stubs.
            if (type == StubFile)
              addTo (importList, parmType.name () + "Helper");
            if (parm.passType () == ParameterEntry.In)
              addTo (importList, parmType.name ());
            else
              addTo (importList, parmType.name () + "Holder");
          }
          checkForArrays (parmType, importTypes, importList);
          // <d42256>
          if (type == StubFile)
            checkForBounds (parmType, importTypes, importList);
        }
      }
    }
    else if (entry instanceof StructEntry)
    {
      StructEntry s = (StructEntry)entry;

      // Look through the members
      Enumeration members = s.members ().elements ();
      while (members.hasMoreElements ())
      {
        SymtabEntry member = (TypedefEntry)members.nextElement ();
        // <d48034> Need to add helper name for typedef members.  This name
        // is referenced at typecode generation in Helper class.
        SymtabEntry memberType = member.type ();
        member = typeOf (member);
        if (importTypes.contains (member))
        {
          // If this IS a typedef, then there are only Helper/Holder classes.
          //if (!(member instanceof TypedefEntry))
          // <d59437>  Valueboxes
          if (!(member instanceof TypedefEntry) && !(member instanceof ValueBoxEntry))
            addTo (importList, member.name ());
          // <d48034> Add helper name of alias, too, if member is a typedef.
          //if (type == HelperFile)
          //  addTo (importList, member.name () + "Helper");
          if (type == HelperFile)
          {
            addTo (importList, member.name () + "Helper");
            if (memberType instanceof TypedefEntry)
              addTo (importList, memberType.name () + "Helper");
          }
        }
        checkForArrays (member, importTypes, importList);
        checkForBounds (member, importTypes, importList);
      }
    }
    else if (entry instanceof TypedefEntry)
    {
      TypedefEntry t = (TypedefEntry)entry;
      String arrays = checkForArrayBase (t, importTypes, importList);
      if (type == HelperFile)
      {
        checkForArrayDimensions (arrays, importTypes, importList);
        try
        {
          String name = (String)t.dynamicVariable (Compile.typedefInfo);
          int index = name.indexOf ('[');
          if (index >= 0)
            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 () + "Helper");
        }
        catch (NoSuchFieldException e)
        {}

        // <d42256> Typedefs for global bounded strings need import
        // statement when bound expression contains non-literal constants.
        checkForBounds (typeOf (t), importTypes, importList);
      }
      Vector subImportList = addImportLines (t.type (), importTypes, type);
      Enumeration e = subImportList.elements ();
      while (e.hasMoreElements ())
        addTo (importList, (String)e.nextElement ());
    }
    else if (entry instanceof UnionEntry)
    {
      UnionEntry u = (UnionEntry)entry;

      // Look at the discriminant type
      SymtabEntry utype = typeOf (u.type ());
      if (utype instanceof EnumEntry && importTypes.contains (utype))
        addTo (importList, utype.name ());

      // Look through the branches
      Enumeration branches = u.branches ().elements ();
      while (branches.hasMoreElements ())
      {
        UnionBranch branch = (UnionBranch)branches.nextElement ();
        SymtabEntry branchEntry = typeOf (branch.typedef);
        if (importTypes.contains (branchEntry))
        {
          addTo (importList, branchEntry.name ());
          if (type == HelperFile)
            addTo (importList, branchEntry.name () + "Helper");
        }
        checkForArrays (branchEntry, importTypes, importList);
        // <d42256>
        checkForBounds (branchEntry, importTypes, importList);
      }
    }

    // If a typedef is not a sequence or an array, only holders and
    // helpers are generated for it.  Remove references to such
    // class names.
    Enumeration en = importList.elements ();
    while (en.hasMoreElements ())
    {
      String name = (String)en.nextElement ();
      SymtabEntry e = (SymtabEntry)symbolTable.get (name);
      if (e != null && e instanceof TypedefEntry)
      {
        TypedefEntry t = (TypedefEntry)e;
        if (t.arrayInfo ().size () == 0 || !(t.type () instanceof SequenceEntry))
          importList.removeElement (name);
View Full Code Here

        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;
  } // checkForArrayBase
View Full Code Here

    while (!arrays.equals (""))
    {
      int index = arrays.indexOf (']');
      String dim = arrays.substring (1, index);
      arrays = arrays.substring (index + 1);
      SymtabEntry constant = (SymtabEntry)symbolTable.get (dim);
      if (constant == null)
      {
        // A constant expr could be of the form <const> OR
        // <interface>.<const>.  This if branch checks for that case.
        int i = dim.lastIndexOf ('.');
        if (i >= 0)
          constant = (SymtabEntry)symbolTable.get (dim.substring (0, i));
      }
      if (constant != null && importTypes.contains (constant))
        addTo (importList, constant.name ());
    }
  } // checkForArrayDimensions
View Full Code Here

TOP

Related Classes of com.sun.tools.corba.se.idl.SymtabEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.