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);
}
}
return importList;
} // addImportLines