diff options
author | Sven Gothel <[email protected]> | 2023-06-17 06:58:51 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-06-17 06:58:51 +0200 |
commit | a0abee0deb699fc97fc1146200c9057de15798d6 (patch) | |
tree | b1be6dacff251bfaec8214924b66781b3930b21e /src/java/com/jogamp/gluegen/cgram | |
parent | 8b1db2e6cce3289ed043f85660505551b11e3374 (diff) |
GlueGen Struct [8]: Revised setter (resolved shrinking array, using 'subset' flag), added (detailed) JavaDoc in generated code
Revised setter:
A) int32_t val[10] -> setter for a subset change only, as-is with args[src, srcPos, destPos, length]
- no new memory, reuse only
- no special action to be performed
B) int32_t* val -> setter with toggle 'subset' with args[subset, src, srcPos, destPos, length],
- replace memory w/ 'subset==false' where it also may copy 'destPos' gap from old -> new
- reuse memory w/ 'subset==true', where destPos+length <= elementCount
C) const int32_t* val -> setter to replace referenced memory only args[src, srcPos, length]
- always replaces memory, no copy of a gap (no destPos)
Hence:
- case (A) stays as is
- case (B) will be revised and argument 'boolean subset' added
- case (C) will be revised (simplified) and argument 'destPos' removed
Diffstat (limited to 'src/java/com/jogamp/gluegen/cgram')
-rw-r--r-- | src/java/com/jogamp/gluegen/cgram/types/Type.java | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/java/com/jogamp/gluegen/cgram/types/Type.java b/src/java/com/jogamp/gluegen/cgram/types/Type.java index 04c46af..2c32235 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/Type.java +++ b/src/java/com/jogamp/gluegen/cgram/types/Type.java @@ -170,11 +170,11 @@ public abstract class Type implements SemanticEqualityOp, ASTLocusTagProvider { sb.append(val); return sb; } - // For debugging - public final String getDebugString() { - final StringBuilder sb = new StringBuilder(); + public final StringBuilder getSignature(StringBuilder sb) { + if( null == sb ) { + sb = new StringBuilder(); + } boolean prepComma = false; - sb.append("CType["); sb.append("(").append(getClass().getSimpleName()).append(") "); if( isTypedef() ) { sb.append("typedef "); @@ -211,7 +211,6 @@ public abstract class Type implements SemanticEqualityOp, ASTLocusTagProvider { } else { sb.append(" ZERO"); } - append(sb, "[", prepComma); prepComma=false; { append(sb, "const[", prepComma); prepComma=false; { @@ -268,8 +267,15 @@ public abstract class Type implements SemanticEqualityOp, ASTLocusTagProvider { if( isVoid() ) { append(sb, "void", prepComma); prepComma=true; } - sb.append("]"); } + return sb; + } + + // For debugging + public final String getDebugString() { + final StringBuilder sb = new StringBuilder(); + sb.append("CType["); + getSignature(sb); sb.append("]"); return sb.toString(); } |