org.vishia.java2C
Class Docu.C_StaticDataOfConversion

java.lang.Object
  extended by org.vishia.java2C.Docu.C_StaticDataOfConversion
Enclosing class:
Docu

public class Docu.C_StaticDataOfConversion
extends java.lang.Object

While the translation processes the type or affiliation of some identifiers should be evaluated. In java this is done by the javac-Compiler. In C some more informations should be appropriated to the C-Compiler. Therefore all identifiers are stored in Lists. This lists are TreeMap mostly to support a fast searching.


Constructor Summary
Docu.C_StaticDataOfConversion()
           
 
Method Summary
(package private)  void B1_LocalIdents()
          LocalIdents
Identifiers are valid always in a local context.
(package private)  void B2_identifiersForOuterOrSuperLevels()
          

Identifiers of super and outer levels
Super levels are the levels above a statement block; the parent statement block, the whole method, the class the super class and the outer class the super.super class etc, the outer.outer class etc.
(package private)  void B3_searchMethodIdentifier()
          


searching a method identifier with parameters
Methods can't defined in a local context, only at class level.
 void B4_InstancesWhichContainsStaticData()
          

ClassData
That are the type informations.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Docu.C_StaticDataOfConversion

public Docu.C_StaticDataOfConversion()
Method Detail

B1_LocalIdents

void B1_LocalIdents()
LocalIdents
Identifiers are valid always in a local context. This context may be a class context, a method context or a context of a statement block (some statements in {...}). The class LocalIdents holds references to identifiers and types, with some add- and access methods, for all the contexts:
The LocalIdents contains TreeMaps for An instance of LocalIdents in any scope contains all field and type identifiers from the super (parent) scope too as a copy of the identifier Strings and references from the parents TreeMaps. To prevent effort, In StatementBlock a new LocalIdents is created only with the first definition of an type or variable. But the types of the standard language level, it is CRuntimeJavalikeClassData.stdTypes,isn't copy to prevent effort. It contains only types and the root packages. Therefore searching of types (see LocalIdents.getTypeInfo(String, LocalIdents)) should regard three locations:

The searching of a identifier uses always the Java name of identifier. In the found FieldData than the C name is contained.


B2_identifiersForOuterOrSuperLevels

void B2_identifiersForOuterOrSuperLevels()


Identifiers of super and outer levels
Super levels are the levels above a statement block; In generally, there may be two ways to search identifiers of super levels:
  1. An instance of LocalIdents contains only the identifiers of the current level. It contains a reference to the super and outer LocalIdents. Than the searching process is lengthy, if a identifier isn't found locally, it should be searched in the next super and outer level and so on.
  2. An instance of LocalIdents contains all identifiers visible at this level. If a new instance of LocalIdents is created, the identifiers of the parent level should be copied and designated with its context oriented from the current level. This copy process necessitates some calculation time, but only one time per new level. Some more memory spaces is needed, but only temporary (the garbage collector have to be tidy up). But the searching is simple and fast.
The solution is:

The knowledge of field-identifiers and types of the outer classes and the sibling- inner classes in inner classes and the knowledge of this one of the super classes in the derived classes is an adequate topic. But additionally the field-idents should be designated as outer or super ones. That designation is contained in the fields FieldData.nClassLevel and FieldData.nOuterLevel. See Docu.E_Inner_classes.


B3_searchMethodIdentifier

void B3_searchMethodIdentifier()



searching a method identifier with parameters
Methods can't defined in a local context, only at class level. To know and search methods in the actual context, the ClassData of the appropriate class of the local context can be used. They are access-able in the methods of SecondPass via GenerateClass.classData See #methodCall_WithParameterSensitivity()


B4_InstancesWhichContainsStaticData

public void B4_InstancesWhichContainsStaticData()


ClassData
That are the type informations. The ClassData are referenced in LocalIdents.typeIdents. Classes have their own ClassData.classLevelIdents.

FieldData
That are the variable and field informations. The FieldData are referenced in LocalIdents.fieldIdents. Fields based on FieldData.typeClazz, but have some additional properties, also especially for the C-Code-representation. Also arrays with theire special properties are considered.

CCodeData
That are peaces of C-Code with its type-information CCodeData.identInfo, but also special properties. If an array element is addressed from a array-field, it may be possible to store the access information in an extra CCodeData.identInfo. But the solution is: The FieldData of the whole array is referenced, and the access properties to the array element are stored in extra data fields: CCodeData.dimensionArrayOrFixSize and CCodeData.modeAccess of the element.