public class FieldData extends java.lang.Object
LocalIdents
or describe the access to a instance, see CCodeData
.Modifier and Type | Field and Description |
---|---|
org.vishia.java2C.ClassData |
declaringClazz
The class where the identifier is member of, null if it is a local identifier.
|
org.vishia.java2C.ClassData |
elementClazz
The type of a elements of a generic container type.
|
java.lang.String[] |
fixArraySizes
If the identifier is an array with fix size, programmed in java in form of
|
org.vishia.java2C.ClassData |
instanceClazz
If this field is set, the instance referenced in the described field is guaranteed an instance
of that type, nor from a derived type.
|
org.vishia.java2C.ClassData |
keyClazz
The type of a key if it is a generic container type of keys and values.
|
char |
modeAccess
Kind of the instance.
|
char |
modeArrayElement
Kind of the access to an element, if it is an array.
|
char |
modeStatic
Char to indicate the location and kind of definition.
|
static java.lang.String |
sVersion
version, history and license.
|
org.vishia.java2C.ClassData |
typeClazz
The type respectively reference type of the field.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
gen_Declaration(org.vishia.java2C.iWriteContent generateFile)
Generates the C type declaration appropriate to the type info in this FieldData.
|
int |
getClassLevel()
level of the affiliation to a class in the inheritance level.
|
int |
getDimensionArray()
Returns 0 if it isn't an array, 1..
|
int |
getFixSizeStringBuffer()
Returns the size >0 if the type is a StringBuffer with a immediate String with fix size, else 0.
|
java.lang.String |
getName()
returns the name of the element.
|
int |
getOuterLevel()
level of the affiliation to a class in the outer class relation.
|
java.lang.String |
getTypeChar() |
java.lang.String |
getTypeName()
returns the name of the type of the element.
|
java.lang.String |
testAndcast(CCodeData src,
char modeAccessDst)
Tests whether a cast to the given FieldData type is necessary and executes it.
|
static java.lang.String |
testAndChangeAccess(char modeAccessDst,
java.lang.String sSrc1,
char modeAccessSrc)
Changes the access.
|
java.lang.String |
toString()
builds a String representation especially to test under eclipse.
|
java.lang.String |
writeStruct()
Writes the structure of this instance to a
*.stc -file. |
java.lang.String |
xxxwriteStruct()
Writes the structure of this instance to a
*.stc -file. |
public static final java.lang.String sVersion
modeAccess
can have value 'M' for a PtrVal access. Regarded for C-generation.
public final org.vishia.java2C.ClassData typeClazz
public org.vishia.java2C.ClassData keyClazz
public org.vishia.java2C.ClassData elementClazz
public final org.vishia.java2C.ClassData instanceClazz
public final org.vishia.java2C.ClassData declaringClazz
public final char modeStatic
public final java.lang.String[] fixArraySizes
Type[][] myArray = new Type[expr][expr];The
expr
translated in C-Form are stored here. This expr should be a simple value
in C. There are used to generate the initialization of an array.
null
if it isn't an array or it is a dynamic array.public final char modeArrayElement
modeAccess
.
Special case: If it is 'B', the field describes a StringBufferJc
with a fix size.
In that case the dimensionArrayOrFixSize
contains the number of chars inclusive the 4 chars
storing in the StringBufferJc
-instance with immediate buffer.public final char modeAccess
$ | an embedded struct |
% | a variable of basic primitive type such as int32, float, char, but also an embedded indivisible struct like StringJc, MemC, OS_TimeStamp, whose elements aren't accessed in Java. |
* | a simple reference, pointer in C, used for non-GC-controlled associations. |
@ | an enhanced reference, for GC (garbage collector) -controlled associations. |
m | an method table-reference. |
t | a StringJc, it is an enhanced reference ~REF also, but with special accesses |
& | an method-table reference ~MTB, containing C-jump-table with index. This type is only used for stack-local variables. GC is not possible |
~ | ythis as reference (call own method |
+ | A variable argument list |
dimensionArrayOrFixSize
>0, this element describes the access to the array head.
The kind of elements respectively the access to the data of the elements are described in modeArrayElement
.
with the same key chars as shown above. Independent of the kind of referencing the array
the elements may be embedded struct ('$'), references ('*') etc., see modeArrayElement
.
M | Reference to an array with a PtrVal in C. A PtrVal is a struct { Type* ptr__; int32 value__}
whereby Type is the type of the reference. The value__ contains the number of elements
of the array. The array is 1-dimensional.
In Java it is any array @Java4C=PtrVal Type[] .
|
B | A ByteStringJc. It is similar as StringJc, but it references bytes, not chars.
In Java it is a byte[] with java2c=ByteStringJc-designation.
Hint: A ByteStringJc is designated in this class with dimensionArrayOrFixSize =1.
It is an array with 1 dimension.
It is similar MemC (pointer to memory and size). |
P | A simple reference to the array elements without head, pointer in C, used for non-GC-controlled associations. |
Q | An embedded array without head. All elements are embedded.
The #fixArraySize is set. |
X | A simple reference to ObjectArrayJc head informations, pointer in C, to an array type, used for non-GC-controlled associations. |
Y | An embedded array with ObjectArrayJc head informations.
All elements are embedded. The #fixArraySize is set. |
@ | an enhanced reference to an array type, starting with ObjectArrayJc, for GC (garbage collector) -controlled associations. |
public int getClassLevel()
public int getDimensionArray()
public int getFixSizeStringBuffer()
public int getOuterLevel()
public java.lang.String getName()
public java.lang.String getTypeName()
public java.lang.String getTypeChar()
public java.lang.String gen_Declaration(org.vishia.java2C.iWriteContent generateFile)
int
because
the complete definition is int name[123]
or int name[] = { 1, 2, 3}
public java.lang.String xxxwriteStruct()
*.stc
-file.
It is an class level identifier, see ClassData.classLevelIdents
,
or a return type or argument of a method,
because only for such FieldData this method is called.
See LocalIdents#writeStruct(int)
and ClassData.Method#writeStruct()
*.stc
-file. The form of string is the same
described in the syntax Java2Cstc.zbnf
.public java.lang.String writeStruct()
*.stc
-file.
It is an class level identifier, see ClassData.classLevelIdents
,
or a return type or argument of a method,
because only for such FieldData this method is called.
See LocalIdents#writeStruct(int)
and ClassData.Method#writeStruct()
*.stc
-file. The form of string is the same
described in the syntax Java2Cstc.zbnf
.public java.lang.String testAndcast(CCodeData src, char modeAccessDst)
testAndChangeAccess(char, String, char)
.
StatementBlock.gen_AssignCheckCast(CCodeData, String, CCodeData)
.
srcType
- The type of the valuevalue
- The value string.src
- The Expression with its type and access modesmodeAccessDst
- A deviating mode of access for the destination or '.'. If '.', the #modeAcess
of this is valid.public static java.lang.String testAndChangeAccess(char modeAccessDst, java.lang.String sSrc1, char modeAccessSrc)
modeAccessDst
- Necessary access, ones of chars &*@~%?
, see modeAccess
sSrc1
- The cCode of srcmodeAccessSrc
- Existing access of sSrc1public java.lang.String toString()
toString
in class java.lang.Object