Commit e3cf166f authored by Claes Sjofors's avatar Claes Sjofors

More 64 bit, offset pointer size = size of pointed entity

parent 8a8a9f57
...@@ -864,9 +864,11 @@ Volume ABB $ClassVolume 0.0.250.2 ...@@ -864,9 +864,11 @@ Volume ABB $ClassVolume 0.0.250.2
EndBody EndBody
EndObject EndObject
Object IoStatus $Attribute 44 12-OCT-2005 12:58:20.00 Object IoStatus $Attribute 44 12-OCT-2005 12:58:20.00
Body SysBody 01-JAN-1970 01:00:00.00 Body SysBody 11-JUN-2009 13:48:29.65
Attr PgmName = "IoStatus" Attr PgmName = "IoStatus"
Attr Size = 4
Attr Flags = 1 Attr Flags = 1
Attr ParamIndex = 60
Attr TypeRef = "pwrs:Type-$Status" Attr TypeRef = "pwrs:Type-$Status"
EndBody EndBody
EndObject EndObject
...@@ -11737,9 +11739,11 @@ ABB ACS800 Typ 1" ...@@ -11737,9 +11739,11 @@ ABB ACS800 Typ 1"
EndBody EndBody
EndObject EndObject
Object IoStatus $Attribute 127 13-MAR-2006 09:34:22.38 Object IoStatus $Attribute 127 13-MAR-2006 09:34:22.38
Body SysBody 13-MAR-2006 09:34:22.38 Body SysBody 11-JUN-2009 13:48:49.80
Attr PgmName = "IoStatus" Attr PgmName = "IoStatus"
Attr Size = 4
Attr Flags = 1 Attr Flags = 1
Attr ParamIndex = 77
Attr TypeRef = "pwrs:Type-$Status" Attr TypeRef = "pwrs:Type-$Status"
EndBody EndBody
EndObject EndObject
...@@ -125367,9 +125367,11 @@ Err (error) = err" ...@@ -125367,9 +125367,11 @@ Err (error) = err"
EndBody EndBody
EndObject EndObject
Object IoStatus $Attribute 127 12-MAR-2008 13:25:58.76 Object IoStatus $Attribute 127 12-MAR-2008 13:25:58.76
Body SysBody 12-MAR-2008 13:25:58.76 Body SysBody 11-JUN-2009 13:46:01.53
Attr PgmName = "IoStatus" Attr PgmName = "IoStatus"
Attr Size = 4
Attr Flags = 1 Attr Flags = 1
Attr ParamIndex = 63
Attr TypeRef = "pwrs:Type-$Status" Attr TypeRef = "pwrs:Type-$Status"
EndBody EndBody
EndObject EndObject
...@@ -145290,9 +145292,11 @@ Fc PPO5 Motor Aggregate ...@@ -145290,9 +145292,11 @@ Fc PPO5 Motor Aggregate
EndBody EndBody
EndObject EndObject
Object IoStatus $Attribute 195 13-MAR-2008 14:07:37.80 Object IoStatus $Attribute 195 13-MAR-2008 14:07:37.80
Body SysBody 13-MAR-2008 14:07:37.80 Body SysBody 11-JUN-2009 13:40:52.72
Attr PgmName = "IoStatus" Attr PgmName = "IoStatus"
Attr Size = 4
Attr Flags = 1 Attr Flags = 1
Attr ParamIndex = 36
Attr TypeRef = "pwrs:Type-$Status" Attr TypeRef = "pwrs:Type-$Status"
EndBody EndBody
EndObject EndObject
...@@ -286,6 +286,7 @@ SObject NMps:Class ...@@ -286,6 +286,7 @@ SObject NMps:Class
Body SysBody Body SysBody
Attr TypeRef = "pwrs:Type-$Float32" Attr TypeRef = "pwrs:Type-$Float32"
Attr Flags |= PWR_MASK_INVISIBLE Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_PRIVATE
Attr Flags |= PWR_MASK_POINTER Attr Flags |= PWR_MASK_POINTER
EndBody EndBody
EndObject EndObject
......
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
#define CALLBACK #define CALLBACK
#define INVALID_HANDLE_VALUE ((HANDLE) NULL) #define INVALID_HANDLE_VALUE ((HANDLE) NULL)
#define getch() getchar() #define getch() getchar()
typedef int HANDLE; typedef long int HANDLE;
typedef unsigned long DWORD; typedef unsigned long DWORD;
#ifdef PB_API_FUNC_NOT_USED #ifdef PB_API_FUNC_NOT_USED
#undef CALL_CONV #undef CALL_CONV
......
...@@ -373,6 +373,16 @@ endl; ...@@ -373,6 +373,16 @@ endl;
return 1; return 1;
} }
//
// Alignment rules for gcc on x86_64:
// Pointer long, double, pointer or struct that contains long, double or pointer:
// aligned on 8 byte.
//
// Struct that contains long, double or pointer: next element aligned on 8 bytes.
//
//
//
int CnvWblToH::attribute_exec() int CnvWblToH::attribute_exec()
{ {
int i; int i;
...@@ -392,12 +402,15 @@ int CnvWblToH::attribute_exec() ...@@ -392,12 +402,15 @@ int CnvWblToH::attribute_exec()
strcmp( CnvCtx::low(ctx->rw->attr_typeref), "time") == 0 || strcmp( CnvCtx::low(ctx->rw->attr_typeref), "time") == 0 ||
strcmp( CnvCtx::low(ctx->rw->attr_typeref), "deltatime") == 0 || strcmp( CnvCtx::low(ctx->rw->attr_typeref), "deltatime") == 0 ||
strcmp( CnvCtx::low(ctx->rw->attr_typeref), "castid") == 0 || strcmp( CnvCtx::low(ctx->rw->attr_typeref), "castid") == 0 ||
strcmp( CnvCtx::low(ctx->rw->attr_typeref), "disableattr") == 0) strcmp( CnvCtx::low(ctx->rw->attr_typeref), "disableattr") == 0 ||
strcmp( ctx->rw->attr_name, "TimerFlag") == 0)
strcpy( alignstr, " pwr_dAlignLW"); strcpy( alignstr, " pwr_dAlignLW");
else else
strcpy( alignstr, " pwr_dAlignW"); strcpy( alignstr, " pwr_dAlignW");
if ( ctx->rw->attr_pointer || if ( ctx->rw->attr_isclass ||
strcmp( CnvCtx::low(ctx->rw->attr_type), "buffer") == 0 ||
ctx->rw->attr_pointer ||
strcmp( CnvCtx::low(ctx->rw->attr_typeref), "castid") == 0 || strcmp( CnvCtx::low(ctx->rw->attr_typeref), "castid") == 0 ||
strcmp( CnvCtx::low(ctx->rw->attr_typeref), "disableattr") == 0) strcmp( CnvCtx::low(ctx->rw->attr_typeref), "disableattr") == 0)
// Align next attribute on longword // Align next attribute on longword
......
...@@ -704,7 +704,11 @@ mvol_LinkClass ( ...@@ -704,7 +704,11 @@ mvol_LinkClass (
printf("--- %s, idx: %d, mof: %d\n", aop->g.f.name.orig, i, cp->attr[i].moffset); printf("--- %s, idx: %d, mof: %d\n", aop->g.f.name.orig, i, cp->attr[i].moffset);
#endif #endif
pwr_Assert(i == count); pwr_Assert(i == count);
if (count > 0) pwr_Assert(cp->attr[i-1].moffset < cp->attr[i].moffset); if (count > 0) {
if ( !(cp->attr[i-1].moffset < cp->attr[i].moffset))
printf("--- Class: %s, Attribute: %s\n", cop->g.f.name.orig, aop->g.f.name.orig);
pwr_Assert(cp->attr[i-1].moffset < cp->attr[i].moffset);
}
} }
pwr_Assert(count == cp->acount); pwr_Assert(count == cp->acount);
......
...@@ -57,6 +57,9 @@ ...@@ -57,6 +57,9 @@
#endif #endif
static const unsigned int pwr_cInputOffset = pwr_AlignLW(sizeof(void*)) + pwr_AlignLW(sizeof(pwr_tBoolean));
typedef struct plc_sProcess plc_sProcess; typedef struct plc_sProcess plc_sProcess;
typedef struct plc_sThread plc_sThread; typedef struct plc_sThread plc_sThread;
typedef struct plc_sDlink plc_sDlink; typedef struct plc_sDlink plc_sDlink;
......
...@@ -46,10 +46,7 @@ void sum_exec( ...@@ -46,10 +46,7 @@ void sum_exec(
pwr_sClass_sum *object) pwr_sClass_sum *object)
{ {
#define sumsize 8 #define sumsize 8
char *charp; pwr_tFloat32 **ptr; /* Pointer to ptr to input */
float **ptr; /* Pointer to ptr to input */
static ptrdiff_t offset = (char *)&object->In2 - (char *)&object->In1;
/* Offset to next input */
int i; /* Loopindex */ int i; /* Loopindex */
float sum; /* Result */ float sum; /* Result */
/* Initialize */ /* Initialize */
...@@ -61,9 +58,7 @@ void sum_exec( ...@@ -61,9 +58,7 @@ void sum_exec(
if ( *ptr != NULL ) if ( *ptr != NULL )
sum += **ptr * object->FVect[i]; sum += **ptr * object->FVect[i];
charp = (char *) ptr; ptr = (pwr_tFloat32 **)((char *)ptr + pwr_cInputOffset);
charp += offset;
ptr = (float **)charp;
} }
/* Result */ /* Result */
object->ActVal = sum; object->ActVal = sum;
...@@ -88,8 +83,6 @@ void maxmin_exec( ...@@ -88,8 +83,6 @@ void maxmin_exec(
float minval; /* Lowest value */ float minval; /* Lowest value */
float maxval; /* Highest value */ float maxval; /* Highest value */
int i; /* Loopcounter */ int i; /* Loopcounter */
static ptrdiff_t offset = (char *)&object->In2 - (char *)&object->In1; /* Offset to next input */
char *charp;
float **ptr; /* Pointer to ptr to digin */ float **ptr; /* Pointer to ptr to digin */
/* Initialize */ /* Initialize */
...@@ -104,9 +97,7 @@ void maxmin_exec( ...@@ -104,9 +97,7 @@ void maxmin_exec(
if ( **ptr > maxval) maxval = **ptr; if ( **ptr > maxval) maxval = **ptr;
if ( **ptr < minval) minval = **ptr; if ( **ptr < minval) minval = **ptr;
} }
charp = (char *) ptr; ptr = (pwr_tFloat32 **)((char *)ptr + pwr_cInputOffset);
charp += offset;
ptr = (float **)charp;
} }
/* Set Output */ /* Set Output */
object->MaxVal = maxval; object->MaxVal = maxval;
...@@ -594,8 +585,8 @@ void DtoMask_exec( ...@@ -594,8 +585,8 @@ void DtoMask_exec(
*d = **dp; *d = **dp;
if ( *d) if ( *d)
val |= m; val |= m;
d += 2; d = (pwr_tBoolean *)((char *)d + pwr_cInputOffset);
dp += 2; dp = (pwr_tBoolean **)((char *)dp + pwr_cInputOffset);
m = m << 1; m = m << 1;
} }
object->Mask = val; object->Mask = val;
...@@ -649,8 +640,8 @@ void DtoEnum_exec( ...@@ -649,8 +640,8 @@ void DtoEnum_exec(
val = object->EnumValues[i]; val = object->EnumValues[i];
break; break;
} }
d += 2; d = (pwr_tBoolean *)((char *)d + pwr_cInputOffset);
dp += 2; dp = (pwr_tBoolean **)((char *)dp + pwr_cInputOffset);
} }
object->Enum = val; object->Enum = val;
} }
...@@ -845,7 +836,6 @@ void IAdd_exec( ...@@ -845,7 +836,6 @@ void IAdd_exec(
pwr_sClass_IAdd *o) pwr_sClass_IAdd *o)
{ {
#define IADD_SIZE 8 #define IADD_SIZE 8
static ptrdiff_t offset = (char *)&o->In2 - (char *)&o->In1;
int i; int i;
pwr_tInt32 **inp = &o->In1P; pwr_tInt32 **inp = &o->In1P;
pwr_tInt32 sum = 0; pwr_tInt32 sum = 0;
...@@ -853,7 +843,7 @@ void IAdd_exec( ...@@ -853,7 +843,7 @@ void IAdd_exec(
for ( i = 0; i < IADD_SIZE; i++) { for ( i = 0; i < IADD_SIZE; i++) {
sum += **inp; sum += **inp;
inp = (pwr_tInt32 **)((char *)inp + offset); inp = (pwr_tInt32 **)((char *)inp + pwr_cInputOffset);
} }
o->ActVal = sum; o->ActVal = sum;
} }
...@@ -867,13 +857,12 @@ void IMul_exec( ...@@ -867,13 +857,12 @@ void IMul_exec(
pwr_sClass_IMul *o) pwr_sClass_IMul *o)
{ {
#define IMUL_SIZE 8 #define IMUL_SIZE 8
static ptrdiff_t offset = (char *)&o->In2 - (char *)&o->In1;
int i; int i;
pwr_tInt32 **inp = &o->In1P; pwr_tInt32 **inp = &o->In1P;
pwr_tInt32 result = **inp; pwr_tInt32 result = **inp;
for ( i = 1; i < IMUL_SIZE; i++) { for ( i = 1; i < IMUL_SIZE; i++) {
inp = (pwr_tInt32 **)((char *)inp + offset); inp = (pwr_tInt32 **)((char *)inp + pwr_cInputOffset);
result *= **inp; result *= **inp;
} }
o->ActVal = result; o->ActVal = result;
...@@ -913,7 +902,6 @@ void IMax_exec( ...@@ -913,7 +902,6 @@ void IMax_exec(
pwr_sClass_IMax *o) pwr_sClass_IMax *o)
{ {
#define IMAX_SIZE 8 #define IMAX_SIZE 8
static ptrdiff_t offset = (char *)&o->In2 - (char *)&o->In1;
int i; int i;
pwr_tInt32 **inp = &o->In1P; pwr_tInt32 **inp = &o->In1P;
pwr_tInt32 result = INT_MIN; pwr_tInt32 result = INT_MIN;
...@@ -921,7 +909,7 @@ void IMax_exec( ...@@ -921,7 +909,7 @@ void IMax_exec(
for ( i = 0; i < IMAX_SIZE; i++) { for ( i = 0; i < IMAX_SIZE; i++) {
if ( **inp > result) if ( **inp > result)
result = **inp; result = **inp;
inp = (pwr_tInt32 **)((char *)inp + offset); inp = (pwr_tInt32 **)((char *)inp + pwr_cInputOffset);
} }
o->ActVal = result; o->ActVal = result;
} }
...@@ -935,7 +923,6 @@ void IMin_exec( ...@@ -935,7 +923,6 @@ void IMin_exec(
pwr_sClass_IMin *o) pwr_sClass_IMin *o)
{ {
#define IMIN_SIZE 8 #define IMIN_SIZE 8
static ptrdiff_t offset = (char *)&o->In2 - (char *)&o->In1;
int i; int i;
pwr_tInt32 **inp = &o->In1P; pwr_tInt32 **inp = &o->In1P;
pwr_tInt32 result = INT_MAX; pwr_tInt32 result = INT_MAX;
...@@ -943,7 +930,7 @@ void IMin_exec( ...@@ -943,7 +930,7 @@ void IMin_exec(
for ( i = 0; i < IMIN_SIZE; i++) { for ( i = 0; i < IMIN_SIZE; i++) {
if ( **inp < result) if ( **inp < result)
result = **inp; result = **inp;
inp = (pwr_tInt32 **)((char *)inp + offset); inp = (pwr_tInt32 **)((char *)inp + pwr_cInputOffset);
} }
o->ActVal = result; o->ActVal = result;
} }
...@@ -1007,13 +994,12 @@ void IMux_exec( ...@@ -1007,13 +994,12 @@ void IMux_exec(
pwr_sClass_IMux *o) pwr_sClass_IMux *o)
{ {
#define IMUX_SIZE 24 #define IMUX_SIZE 24
static ptrdiff_t offset = (char *)&o->In1 - (char *)&o->In0;
int idx; int idx;
pwr_tInt32 **inp = &o->In0P; pwr_tInt32 **inp = &o->In0P;
idx = o->Index = *o->IndexP; idx = o->Index = *o->IndexP;
idx = idx < 0 ? 0 : ( idx > IMUX_SIZE - 1 ? IMUX_SIZE - 1 : idx); idx = idx < 0 ? 0 : ( idx > IMUX_SIZE - 1 ? IMUX_SIZE - 1 : idx);
inp = (pwr_tInt32 **)((char *)inp + idx * offset); inp = (pwr_tInt32 **)((char *)inp + idx * pwr_cInputOffset);
o->ActVal = **inp; o->ActVal = **inp;
} }
...@@ -1026,13 +1012,12 @@ void Mux_exec( ...@@ -1026,13 +1012,12 @@ void Mux_exec(
pwr_sClass_Mux *o) pwr_sClass_Mux *o)
{ {
#define MUX_SIZE 24 #define MUX_SIZE 24
static ptrdiff_t offset = (char *)&o->In1 - (char *)&o->In0;
int idx; int idx;
pwr_tFloat32 **inp = &o->In0P; pwr_tFloat32 **inp = &o->In0P;
idx = o->Index = *o->IndexP; idx = o->Index = *o->IndexP;
idx = idx < 0 ? 0 : ( idx > MUX_SIZE - 1 ? MUX_SIZE - 1 : idx); idx = idx < 0 ? 0 : ( idx > MUX_SIZE - 1 ? MUX_SIZE - 1 : idx);
inp = (pwr_tFloat32 **)((char *)inp + idx * offset); inp = (pwr_tFloat32 **)((char *)inp + idx * pwr_cInputOffset);
o->ActVal = **inp; o->ActVal = **inp;
} }
...@@ -1089,7 +1074,6 @@ void Add_exec( ...@@ -1089,7 +1074,6 @@ void Add_exec(
pwr_sClass_Add *o) pwr_sClass_Add *o)
{ {
#define ADD_SIZE 8 #define ADD_SIZE 8
static ptrdiff_t offset = (char *)&o->In2 - (char *)&o->In1;
int i; int i;
pwr_tFloat32 **inp = &o->In1P; pwr_tFloat32 **inp = &o->In1P;
pwr_tFloat32 sum = 0; pwr_tFloat32 sum = 0;
...@@ -1097,7 +1081,7 @@ void Add_exec( ...@@ -1097,7 +1081,7 @@ void Add_exec(
for ( i = 0; i < ADD_SIZE; i++) { for ( i = 0; i < ADD_SIZE; i++) {
sum += **inp; sum += **inp;
inp = (pwr_tFloat32 **)((char *)inp + offset); inp = (pwr_tFloat32 **)((char *)inp + pwr_cInputOffset);
} }
o->ActVal = sum; o->ActVal = sum;
} }
...@@ -1111,13 +1095,12 @@ void Mul_exec( ...@@ -1111,13 +1095,12 @@ void Mul_exec(
pwr_sClass_Mul *o) pwr_sClass_Mul *o)
{ {
#define MUL_SIZE 8 #define MUL_SIZE 8
static ptrdiff_t offset = (char *)&o->In2 - (char *)&o->In1;
int i; int i;
pwr_tFloat32 **inp = &o->In1P; pwr_tFloat32 **inp = &o->In1P;
pwr_tFloat32 result = **inp; pwr_tFloat32 result = **inp;
for ( i = 1; i < MUL_SIZE; i++) { for ( i = 1; i < MUL_SIZE; i++) {
inp = (pwr_tFloat32 **)((char *)inp + offset); inp = (pwr_tFloat32 **)((char *)inp + pwr_cInputOffset);
result *= **inp; result *= **inp;
} }
o->ActVal = result; o->ActVal = result;
...@@ -1154,7 +1137,6 @@ void Max_exec( ...@@ -1154,7 +1137,6 @@ void Max_exec(
pwr_sClass_Max *o) pwr_sClass_Max *o)
{ {
#define AMAX_SIZE 8 #define AMAX_SIZE 8
static ptrdiff_t offset = (char *)&o->In2 - (char *)&o->In1;
int i; int i;
pwr_tFloat32 **inp = &o->In1P; pwr_tFloat32 **inp = &o->In1P;
pwr_tFloat32 result = -1E37; pwr_tFloat32 result = -1E37;
...@@ -1162,7 +1144,7 @@ void Max_exec( ...@@ -1162,7 +1144,7 @@ void Max_exec(
for ( i = 0; i < AMAX_SIZE; i++) { for ( i = 0; i < AMAX_SIZE; i++) {
if ( **inp > result) if ( **inp > result)
result = **inp; result = **inp;
inp = (pwr_tFloat32 **)((char *)inp + offset); inp = (pwr_tFloat32 **)((char *)inp + pwr_cInputOffset);
} }
o->ActVal = result; o->ActVal = result;
} }
...@@ -1176,7 +1158,6 @@ void Min_exec( ...@@ -1176,7 +1158,6 @@ void Min_exec(
pwr_sClass_Min *o) pwr_sClass_Min *o)
{ {
#define AMIN_SIZE 8 #define AMIN_SIZE 8
static ptrdiff_t offset = (char *)&o->In2 - (char *)&o->In1;
int i; int i;
pwr_tFloat32 **inp = &o->In1P; pwr_tFloat32 **inp = &o->In1P;
pwr_tFloat32 result = 1E37; pwr_tFloat32 result = 1E37;
...@@ -1184,7 +1165,7 @@ void Min_exec( ...@@ -1184,7 +1165,7 @@ void Min_exec(
for ( i = 0; i < AMIN_SIZE; i++) { for ( i = 0; i < AMIN_SIZE; i++) {
if ( **inp < result) if ( **inp < result)
result = **inp; result = **inp;
inp = (pwr_tFloat32 **)((char *)inp + offset); inp = (pwr_tFloat32 **)((char *)inp + pwr_cInputOffset);
} }
o->ActVal = result; o->ActVal = result;
} }
......
...@@ -195,7 +195,6 @@ void dibcd_exec ( ...@@ -195,7 +195,6 @@ void dibcd_exec (
int i; /* Loop index*/ int i; /* Loop index*/
int j; /* Loop index*/ int j; /* Loop index*/
int res; /* Result */ int res; /* Result */
ptrdiff_t offset; /* Offset to next pointer */
char *ptr; /* Pointer to pointer */ char *ptr; /* Pointer to pointer */
pwr_tBoolean *p2; /* Pointer to digin */ pwr_tBoolean *p2; /* Pointer to digin */
pwr_tBoolean err; /* Error flag */ pwr_tBoolean err; /* Error flag */
...@@ -203,9 +202,7 @@ void dibcd_exec ( ...@@ -203,9 +202,7 @@ void dibcd_exec (
/* Initialize */ /* Initialize */
res = 0; res = 0;
err = FALSE; err = FALSE;
offset = (char *)&object->BCD1P - (char *)&object->BCD0P; ptr = (char *)&object->BCD0P + (DIBCDSIZE -1) * pwr_cInputOffset;
ptr = (char *)&object->BCD0P;
ptr += (DIBCDSIZE -1) * offset;
/* Double loop for convert */ /* Double loop for convert */
for ( i = 0; i < (DIBCDSIZE / 4); i++) { for ( i = 0; i < (DIBCDSIZE / 4); i++) {
...@@ -214,7 +211,7 @@ void dibcd_exec ( ...@@ -214,7 +211,7 @@ void dibcd_exec (
val += val; /* Mult 2 */ val += val; /* Mult 2 */
p2 = *(pwr_tBoolean **)ptr; /* Pointer to input */ p2 = *(pwr_tBoolean **)ptr; /* Pointer to input */
if (*p2 != object->Inv) val++; /* Signal till ? */ if (*p2 != object->Inv) val++; /* Signal till ? */
ptr -= offset; /* Pointer to next pointer */ ptr -= pwr_cInputOffset; /* Pointer to next pointer */
} }
if ( val > 9 ) err = TRUE; if ( val > 9 ) err = TRUE;
res = 10 * res + val; res = 10 * res + val;
...@@ -280,16 +277,13 @@ void gray_exec ( ...@@ -280,16 +277,13 @@ void gray_exec (
pwr_tBoolean in; /* Digital in after invert */ pwr_tBoolean in; /* Digital in after invert */
pwr_tBoolean odd; /* Convert flag */ pwr_tBoolean odd; /* Convert flag */
int sum; /* Convert sum */ int sum; /* Convert sum */
ptrdiff_t offset; /* Offset to next pointer */
char *ptr; /* Pointer to ptr to digin */ char *ptr; /* Pointer to ptr to digin */
pwr_tBoolean *p2; /* Pointer to digin */ pwr_tBoolean *p2; /* Pointer to digin */
/* Init */ /* Init */
odd = 0; odd = 0;
sum = 0; sum = 0;
offset = (char *)&object->Din1P - (char *)&object->Din0P; ptr = (char *)&object->Din0P + (GRAYSIZE - 1) * pwr_cInputOffset;
ptr = (char *)&object->Din0P;
ptr += (GRAYSIZE - 1) * offset;
/* Graycode convert loop */ /* Graycode convert loop */
for (i = 0; i < GRAYSIZE; i++) { for (i = 0; i < GRAYSIZE; i++) {
...@@ -298,7 +292,7 @@ void gray_exec ( ...@@ -298,7 +292,7 @@ void gray_exec (
in = (*p2 != object->Inv); /* Invert ? */ in = (*p2 != object->Inv); /* Invert ? */
odd = in ? !odd : odd; /* Odd up to now ? */ odd = in ? !odd : odd; /* Odd up to now ? */
sum += odd; /* Inc if odd input */ sum += odd; /* Inc if odd input */
ptr -= offset; ptr -= pwr_cInputOffset;
} }
/* Result */ /* Result */
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#endif #endif
typedef struct { typedef struct {
pwr_tBoolean TimerFlag pwr_dAlignW; pwr_tBoolean TimerFlag pwr_dAlignLW;
pwr_tBoolean *TimerNext pwr_dAlignLW; pwr_tBoolean *TimerNext pwr_dAlignLW;
pwr_tUInt32 TimerCount pwr_dAlignLW; pwr_tUInt32 TimerCount pwr_dAlignLW;
pwr_tBoolean *TimerDO pwr_dAlignLW; pwr_tBoolean *TimerDO pwr_dAlignLW;
......
...@@ -85,6 +85,7 @@ SObject pwrb:Class ...@@ -85,6 +85,7 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$Float32" Attr TypeRef = "pwrs:Type-$Float32"
Attr Flags |= PWR_MASK_POINTER Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_STATE Attr Flags |= PWR_MASK_STATE
Attr Size = 4
EndBody EndBody
EndObject EndObject
!/** !/**
......
...@@ -85,6 +85,7 @@ SObject pwrb:Class ...@@ -85,6 +85,7 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$Float32" Attr TypeRef = "pwrs:Type-$Float32"
Attr Flags |= PWR_MASK_POINTER Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_STATE Attr Flags |= PWR_MASK_STATE
Attr Size = 4
EndBody EndBody
EndObject EndObject
!/** !/**
......
...@@ -76,6 +76,7 @@ SObject pwrb:Class ...@@ -76,6 +76,7 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$Float32" Attr TypeRef = "pwrs:Type-$Float32"
Attr Flags |= PWR_MASK_POINTER Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_STATE Attr Flags |= PWR_MASK_STATE
Attr Size = 4
EndBody EndBody
EndObject EndObject
!/** !/**
......
...@@ -129,6 +129,7 @@ SObject pwrb:Class ...@@ -129,6 +129,7 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$Int32" Attr TypeRef = "pwrs:Type-$Int32"
Attr Flags |= PWR_MASK_POINTER Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_STATE Attr Flags |= PWR_MASK_STATE
Attr Size = 4
EndBody EndBody
EndObject EndObject
!/** !/**
...@@ -141,6 +142,7 @@ SObject pwrb:Class ...@@ -141,6 +142,7 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$Int32" Attr TypeRef = "pwrs:Type-$Int32"
Attr Flags |= PWR_MASK_POINTER Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_STATE Attr Flags |= PWR_MASK_STATE
Attr Size = 4
EndBody EndBody
EndObject EndObject
!/** !/**
......
...@@ -253,6 +253,7 @@ SObject pwrb:Class ...@@ -253,6 +253,7 @@ SObject pwrb:Class
Body SysBody Body SysBody
Attr TypeRef = "pwrs:Type-$Float32" Attr TypeRef = "pwrs:Type-$Float32"
Attr Flags |= PWR_MASK_POINTER Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_PRIVATE
Attr Flags |= PWR_MASK_STATE Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_ARRAY Attr Flags |= PWR_MASK_ARRAY
......
...@@ -103,6 +103,7 @@ SObject pwrb:Class ...@@ -103,6 +103,7 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$Boolean" Attr TypeRef = "pwrs:Type-$Boolean"
Attr Flags |= PWR_MASK_POINTER Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_STATE Attr Flags |= PWR_MASK_STATE
Attr Size = 4
EndBody EndBody
EndObject EndObject
!/** !/**
......
...@@ -85,6 +85,7 @@ SObject pwrb:Class ...@@ -85,6 +85,7 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$Boolean" Attr TypeRef = "pwrs:Type-$Boolean"
Attr Flags |= PWR_MASK_POINTER Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_STATE Attr Flags |= PWR_MASK_STATE
Attr Size = 4
EndBody EndBody
EndObject EndObject
!/** !/**
......
...@@ -180,6 +180,7 @@ SObject pwrb:Class ...@@ -180,6 +180,7 @@ SObject pwrb:Class
Body SysBody Body SysBody
Attr TypeRef = "pwrs:Type-$Boolean" Attr TypeRef = "pwrs:Type-$Boolean"
Attr Flags |= PWR_MASK_POINTER Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_PRIVATE
Attr Flags |= PWR_MASK_STATE Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_INVISIBLE Attr Flags |= PWR_MASK_INVISIBLE
EndBody EndBody
...@@ -238,6 +239,7 @@ SObject pwrb:Class ...@@ -238,6 +239,7 @@ SObject pwrb:Class
Body SysBody Body SysBody
Attr TypeRef = "pwrs:Type-$Float32" Attr TypeRef = "pwrs:Type-$Float32"
Attr Flags |= PWR_MASK_POINTER Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_PRIVATE
Attr Flags |= PWR_MASK_STATE Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_INVISIBLE Attr Flags |= PWR_MASK_INVISIBLE
EndBody EndBody
......
...@@ -164,6 +164,7 @@ SObject pwrb:Class ...@@ -164,6 +164,7 @@ SObject pwrb:Class
Body SysBody Body SysBody
Attr TypeRef = "pwrs:Type-$Float32" Attr TypeRef = "pwrs:Type-$Float32"
Attr Flags |= PWR_MASK_POINTER Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_PRIVATE
Attr Flags |= PWR_MASK_STATE Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_INVISIBLE Attr Flags |= PWR_MASK_INVISIBLE
EndBody EndBody
......
...@@ -78,6 +78,7 @@ SObject pwrb:Class ...@@ -78,6 +78,7 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$Boolean" Attr TypeRef = "pwrs:Type-$Boolean"
Attr Flags |= PWR_MASK_POINTER Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_STATE Attr Flags |= PWR_MASK_STATE
Attr Size = 4
EndBody EndBody
EndObject EndObject
!/** !/**
......
...@@ -85,6 +85,7 @@ SObject pwrb:Class ...@@ -85,6 +85,7 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$Int32" Attr TypeRef = "pwrs:Type-$Int32"
Attr Flags |= PWR_MASK_POINTER Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_STATE Attr Flags |= PWR_MASK_STATE
Attr Size = 4
EndBody EndBody
EndObject EndObject
!/** !/**
......
...@@ -179,6 +179,7 @@ SObject pwrb:Class ...@@ -179,6 +179,7 @@ SObject pwrb:Class
Object OpenP $Intern 8 Object OpenP $Intern 8
Body SysBody Body SysBody
Attr Flags |= PWR_MASK_POINTER Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_PRIVATE
Attr Flags |= PWR_MASK_STATE Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_INVISIBLE Attr Flags |= PWR_MASK_INVISIBLE
...@@ -188,6 +189,7 @@ SObject pwrb:Class ...@@ -188,6 +189,7 @@ SObject pwrb:Class
Object CloseP $Intern 9 Object CloseP $Intern 9
Body SysBody Body SysBody
Attr Flags |= PWR_MASK_POINTER Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_PRIVATE
Attr Flags |= PWR_MASK_STATE Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_INVISIBLE Attr Flags |= PWR_MASK_INVISIBLE
......
...@@ -82,6 +82,7 @@ SObject pwrb:Class ...@@ -82,6 +82,7 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$Int32" Attr TypeRef = "pwrs:Type-$Int32"
Attr Flags |= PWR_MASK_POINTER Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_STATE Attr Flags |= PWR_MASK_STATE
Attr Size = 4
EndBody EndBody
EndObject EndObject
!/** !/**
......
...@@ -71,6 +71,7 @@ SObject pwrb:Class ...@@ -71,6 +71,7 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$Int32" Attr TypeRef = "pwrs:Type-$Int32"
Attr Flags |= PWR_MASK_POINTER Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_STATE Attr Flags |= PWR_MASK_STATE
Attr Size = 4
EndBody EndBody
EndObject EndObject
!/** !/**
......
...@@ -182,6 +182,7 @@ SObject pwrb:Class ...@@ -182,6 +182,7 @@ SObject pwrb:Class
Object OpenP $Intern 8 Object OpenP $Intern 8
Body SysBody Body SysBody
Attr Flags |= PWR_MASK_POINTER Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_PRIVATE
Attr Flags |= PWR_MASK_STATE Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT Attr Flags |= PWR_MASK_NOEDIT
Attr TypeRef = "pwrs:Type-$Boolean" Attr TypeRef = "pwrs:Type-$Boolean"
...@@ -190,6 +191,7 @@ SObject pwrb:Class ...@@ -190,6 +191,7 @@ SObject pwrb:Class
Object CloseP $Intern 9 Object CloseP $Intern 9
Body SysBody Body SysBody
Attr Flags |= PWR_MASK_POINTER Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_PRIVATE
Attr Flags |= PWR_MASK_STATE Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT Attr Flags |= PWR_MASK_NOEDIT
Attr TypeRef = "pwrs:Type-$Boolean" Attr TypeRef = "pwrs:Type-$Boolean"
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
! !
SObject pwrs:Type SObject pwrs:Type
!/** !/**
! @Version 1.0 ! @Version 2.0
! @Code pwr.h ! @Code pwr.h
! @Group BasicTypes,Types ! @Group BasicTypes,Types
! Delta time. Basic type. ! Delta time. Basic type.
...@@ -34,7 +34,7 @@ SObject pwrs:Type ...@@ -34,7 +34,7 @@ SObject pwrs:Type
Object $DeltaTime pwr_eClass_Type pwr_eTix_DeltaTime Object $DeltaTime pwr_eClass_Type pwr_eTix_DeltaTime
Body SysBody Body SysBody
Attr Type = pwr_eType_DeltaTime Attr Type = pwr_eType_DeltaTime
Attr Size = 8 Attr Size = 16
EndBody EndBody
EndObject EndObject
EndSObject EndSObject
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
! !
SObject pwrs:Type SObject pwrs:Type
!/** !/**
! @Version 1.0 ! @Version 2.0
! @Code pwr.h ! @Code pwr.h
! @Group BasicTypes,Types ! @Group BasicTypes,Types
! Absolute time. Basic type. ! Absolute time. Basic type.
...@@ -33,7 +33,7 @@ SObject pwrs:Type ...@@ -33,7 +33,7 @@ SObject pwrs:Type
Object $Time pwr_eClass_Type pwr_eTix_Time Object $Time pwr_eClass_Type pwr_eTix_Time
Body SysBody Body SysBody
Attr Type = pwr_eType_Time Attr Type = pwr_eType_Time
Attr Size = 8 Attr Size = 16
EndBody EndBody
EndObject EndObject
EndSObject EndSObject
...@@ -66,10 +66,12 @@ wb_print_wbl::~wb_print_wbl() ...@@ -66,10 +66,12 @@ wb_print_wbl::~wb_print_wbl()
void wb_print_wbl::printAttribute(wb_volume& v, void wb_print_wbl::printAttribute(wb_volume& v,
wb_attribute& attr, wb_attribute& attr,
wb_attribute& tattr, ///< template wb_attribute& tattr, ///< template
wb_adef& adef) wb_adef& adef,
int force)
{ {
if (adef.flags() & PWR_MASK_POINTER || if ( !force &&
adef.flags() & PWR_MASK_NOWBL) (adef.flags() & PWR_MASK_POINTER ||
adef.flags() & PWR_MASK_NOWBL))
return; return;
if (attr.isClass() && adef.cid() == pwr_eClass_Buffer) if (attr.isClass() && adef.cid() == pwr_eClass_Buffer)
...@@ -109,6 +111,7 @@ void wb_print_wbl::printBody(wb_volume& v, ...@@ -109,6 +111,7 @@ void wb_print_wbl::printBody(wb_volume& v,
wb_attribute tattr; wb_attribute tattr;
const char* bname; const char* bname;
char timestr[40] = " "; char timestr[40] = " ";
int force = 0;
wb_bdef bdef = cdef.bdef(bix); wb_bdef bdef = cdef.bdef(bix);
...@@ -150,11 +153,19 @@ void wb_print_wbl::printBody(wb_volume& v, ...@@ -150,11 +153,19 @@ void wb_print_wbl::printBody(wb_volume& v,
indent(1) << "Body " << bdef.name() << timestr << endl; indent(1) << "Body " << bdef.name() << timestr << endl;
for (adef = bdef.adef(); adef; adef = adef.next()) { for (adef = bdef.adef(); adef; adef = adef.next()) {
if ( cdef.cid() == pwr_eClass_Param && strcmp( adef.name(), "Size") == 0) {
// Print Size for Pointers that is not private
wb_attribute flags_attr = o.attribute(bname, "Flags");
pwr_tMask *flagsp = (pwr_tMask *)flags_attr.value();
if (*flagsp & PWR_MASK_POINTER && !(*flagsp & PWR_MASK_PRIVATE))
force = 1;
}
attr = o.attribute(bname, adef.name()); attr = o.attribute(bname, adef.name());
tattr = templ.attribute(bname, adef.name()); tattr = templ.attribute(bname, adef.name());
// if (tattr == attr) // if (tattr == attr)
// continue; // continue;
printAttribute(v, attr, tattr, adef); printAttribute(v, attr, tattr, adef, force);
} }
indent(-1) << "EndBody" << endl; indent(-1) << "EndBody" << endl;
...@@ -227,7 +238,7 @@ void wb_print_wbl::printBuffer(wb_volume& v, ...@@ -227,7 +238,7 @@ void wb_print_wbl::printBuffer(wb_volume& v,
while (1) { while (1) {
tattr2 = templ.attribute(bname, adef2.name()); tattr2 = templ.attribute(bname, adef2.name());
printAttribute(v, attr2, tattr2, adef2); printAttribute(v, attr2, tattr2, adef2, 0);
if (!(adef2 = adef2.next())) if (!(adef2 = adef2.next()))
break; break;
...@@ -282,7 +293,7 @@ void wb_print_wbl::printClass(wb_volume& v, ...@@ -282,7 +293,7 @@ void wb_print_wbl::printClass(wb_volume& v,
adef2 = bdef.adef( attr2.attrName()); adef2 = bdef.adef( attr2.attrName());
printAttribute(v, attr2, tattr2, adef2); printAttribute(v, attr2, tattr2, adef2, 0);
attr2 = attr2.after(); attr2 = attr2.after();
tattr2 = tattr2.after(); tattr2 = tattr2.after();
...@@ -335,7 +346,7 @@ void wb_print_wbl::printClass(wb_volume& v, ...@@ -335,7 +346,7 @@ void wb_print_wbl::printClass(wb_volume& v,
while (1) { while (1) {
tattr2 = templ.attribute(bname, adef2.name()); tattr2 = templ.attribute(bname, adef2.name());
printAttribute(v, attr2, tattr2, adef2); printAttribute(v, attr2, tattr2, adef2, 0);
if (!(adef2 = adef2.next())) if (!(adef2 = adef2.next()))
break; break;
...@@ -362,7 +373,7 @@ void wb_print_wbl::printClass(wb_volume& v, ...@@ -362,7 +373,7 @@ void wb_print_wbl::printClass(wb_volume& v,
attr2 attr2
tattr2 = templ.attribute(bname, adef2.name()); tattr2 = templ.attribute(bname, adef2.name());
printAttribute(v, attr2, tattr2, adef2); printAttribute(v, attr2, tattr2, adef2, 0);
if (!(adef2 = adef2.next())) if (!(adef2 = adef2.next()))
break; break;
......
...@@ -59,7 +59,8 @@ protected: ...@@ -59,7 +59,8 @@ protected:
void printAttribute(wb_volume& v, void printAttribute(wb_volume& v,
wb_attribute& attr, wb_attribute& attr,
wb_attribute& tattr, ///< template attribute wb_attribute& tattr, ///< template attribute
wb_adef& adef); wb_adef& adef,
int force);
void printBody(wb_volume& v, void printBody(wb_volume& v,
wb_object& o, wb_object& o,
......
...@@ -1809,7 +1809,8 @@ bool wb_vrepced::buildClass( pwr_tStatus *sts, wb_orep *co) ...@@ -1809,7 +1809,8 @@ bool wb_vrepced::buildClass( pwr_tStatus *sts, wb_orep *co)
typeref == pwr_eType_UInt64 || typeref == pwr_eType_UInt64 ||
typeref == pwr_eType_Float64 || typeref == pwr_eType_Float64 ||
typeref == pwr_eType_CastId || typeref == pwr_eType_CastId ||
typeref == pwr_eType_DisableAttr) typeref == pwr_eType_DisableAttr ||
strcmp( ao->name(), "TimerFlag") == 0)
offset = pwr_AlignLW( offset); offset = pwr_AlignLW( offset);
// Store data in Attribute object // Store data in Attribute object
...@@ -1838,8 +1839,13 @@ bool wb_vrepced::buildClass( pwr_tStatus *sts, wb_orep *co) ...@@ -1838,8 +1839,13 @@ bool wb_vrepced::buildClass( pwr_tStatus *sts, wb_orep *co)
if ( EVEN(*sts)) return false; if ( EVEN(*sts)) return false;
// Alignment for next attribute // Alignment for next attribute
if ( flags & PWR_MASK_POINTER && !(flags & PWR_MASK_PRIVATE))
offset += pwr_cAlignLW;
else
offset += size; offset += size;
if ( flags & PWR_MASK_POINTER ||
if ( cdh_tidIsCid( typeref) ||
flags & PWR_MASK_POINTER ||
typeref == pwr_eType_CastId || typeref == pwr_eType_CastId ||
typeref == pwr_eType_DisableAttr) typeref == pwr_eType_DisableAttr)
offset = pwr_AlignLW( offset); offset = pwr_AlignLW( offset);
...@@ -1917,7 +1923,7 @@ bool wb_vrepced::buildClass( pwr_tStatus *sts, wb_orep *co) ...@@ -1917,7 +1923,7 @@ bool wb_vrepced::buildClass( pwr_tStatus *sts, wb_orep *co)
sizeof(type), &type); sizeof(type), &type);
if ( EVEN(*sts)) return false; if ( EVEN(*sts)) return false;
offset += size; offset += pwr_AlignW( size);
paramindex++; paramindex++;
break; break;
} }
...@@ -1992,7 +1998,7 @@ bool wb_vrepced::buildClass( pwr_tStatus *sts, wb_orep *co) ...@@ -1992,7 +1998,7 @@ bool wb_vrepced::buildClass( pwr_tStatus *sts, wb_orep *co)
sizeof(type), &type); sizeof(type), &type);
if ( EVEN(*sts)) return false; if ( EVEN(*sts)) return false;
offset += size; offset += pwr_AlignLW( size);
paramindex++; paramindex++;
break; break;
} }
...@@ -2364,6 +2370,7 @@ void wb_vrepced::printStructFile( bool hpp) ...@@ -2364,6 +2370,7 @@ void wb_vrepced::printStructFile( bool hpp)
pwr_tFileName filename; pwr_tFileName filename;
pwr_tFileName fname, incname; pwr_tFileName fname, incname;
char *s; char *s;
char alignstr[40];
if ( hpp) if ( hpp)
sprintf( filename, "$pwrp_inc/pwr_%sclasses.hpp", m_vrep->name()); sprintf( filename, "$pwrp_inc/pwr_%sclasses.hpp", m_vrep->name());
...@@ -2517,7 +2524,9 @@ void wb_vrepced::printStructFile( bool hpp) ...@@ -2517,7 +2524,9 @@ void wb_vrepced::printStructFile( bool hpp)
pwr_tObjName pgmname; pwr_tObjName pgmname;
pwr_eBix bix = cdh_oixToBix( o_bdef->oid().oix); pwr_eBix bix = cdh_oixToBix( o_bdef->oid().oix);
char structstype[3]; char structstype[3];
#if 0
int struct_filler_cnt = 0; int struct_filler_cnt = 0;
#endif
m_vrep->readBody( &sts, o_bdef, pwr_eBix_sys, &bdef_body); m_vrep->readBody( &sts, o_bdef, pwr_eBix_sys, &bdef_body);
if ( EVEN(sts)) throw wb_error(sts); if ( EVEN(sts)) throw wb_error(sts);
...@@ -2554,6 +2563,7 @@ void wb_vrepced::printStructFile( bool hpp) ...@@ -2554,6 +2563,7 @@ void wb_vrepced::printStructFile( bool hpp)
} }
bool attr_found = false; bool attr_found = false;
int attr_next_alignlw = 0;
for ( o_adef = o_bdef->first( &sts); ODD(sts);) { for ( o_adef = o_bdef->first( &sts); ODD(sts);) {
o_adef->ref(); o_adef->ref();
...@@ -2604,6 +2614,34 @@ void wb_vrepced::printStructFile( bool hpp) ...@@ -2604,6 +2614,34 @@ void wb_vrepced::printStructFile( bool hpp)
throw wb_error(sts); throw wb_error(sts);
} }
if ( attr_next_alignlw ||
adef_body.Info.Flags & PWR_MASK_POINTER ||
adef_body.Info.Flags & PWR_MASK_CLASS ||
o_adef->cid() == pwr_eClass_Input ||
o_adef->cid() == pwr_eClass_Buffer ||
adef_body.TypeRef == pwr_eType_Int64 ||
adef_body.TypeRef == pwr_eType_UInt64 ||
adef_body.TypeRef == pwr_eType_Float64 ||
adef_body.TypeRef == pwr_eType_Time ||
adef_body.TypeRef == pwr_eType_DeltaTime ||
adef_body.TypeRef == pwr_eType_CastId ||
adef_body.TypeRef == pwr_eType_DisableAttr ||
adef_body.TypeRef == pwr_eType_Int64 ||
strcmp( o_adef->name(), "TimerFlag") == 0)
strcpy( alignstr, " pwr_dAlignLW");
else
strcpy( alignstr, " pwr_dAlignW");
if ( adef_body.Info.Flags & PWR_MASK_CLASS ||
adef_body.Info.Flags & PWR_MASK_POINTER ||
o_adef->cid() == pwr_eClass_Buffer ||
adef_body.TypeRef == pwr_eType_CastId ||
adef_body.TypeRef == pwr_eType_DisableAttr)
// Align next attribute on longword
attr_next_alignlw = 1;
else
attr_next_alignlw = 0;
bool super_attr = false; bool super_attr = false;
if ( hpp && adef_body.Info.ParamIndex == 0) { if ( hpp && adef_body.Info.ParamIndex == 0) {
...@@ -2626,16 +2664,17 @@ void wb_vrepced::printStructFile( bool hpp) ...@@ -2626,16 +2664,17 @@ void wb_vrepced::printStructFile( bool hpp)
if ( o_adef->cid() == pwr_eClass_Input) if ( o_adef->cid() == pwr_eClass_Input)
fp << " " << attr_typeref_pgmname << fp << " " << attr_typeref_pgmname <<
fill( fp, 35-strlen(attr_typeref_pgmname)) << " " << pointertype << fill( fp, 35-strlen(attr_typeref_pgmname)) << " " << pointertype <<
"*" << attr_pgmname << "P;" << endl; "*" << attr_pgmname << "P" << alignstr << ";" << endl;
fp << " " << attr_typeref_pgmname << fp << " " << attr_typeref_pgmname <<
fill( fp, 35-strlen(attr_typeref_pgmname)) << " " << pointertype << fill( fp, 35-strlen(attr_typeref_pgmname)) << " " << pointertype <<
attr_pgmname; attr_pgmname;
if ( adef_body.Info.Elements > 1) if ( adef_body.Info.Elements > 1)
fp << "[" << adef_body.Info.Elements << "];" << endl; fp << "[" << adef_body.Info.Elements << "]" << alignstr << ";" << endl;
else else
fp << ";" << endl; fp << alignstr << ";" << endl;
#if 0
int filler; int filler;
if ( adef_body.Info.Size < 4) { if ( adef_body.Info.Size < 4) {
filler = 4 - ((adef_body.Info.Elements * adef_body.Info.Size) % 4); filler = 4 - ((adef_body.Info.Elements * adef_body.Info.Size) % 4);
...@@ -2656,6 +2695,7 @@ void wb_vrepced::printStructFile( bool hpp) ...@@ -2656,6 +2695,7 @@ void wb_vrepced::printStructFile( bool hpp)
} }
struct_filler_cnt++; struct_filler_cnt++;
} }
#endif
} }
break; break;
...@@ -2665,6 +2705,8 @@ void wb_vrepced::printStructFile( bool hpp) ...@@ -2665,6 +2705,8 @@ void wb_vrepced::printStructFile( bool hpp)
pwr_tObjName attr_pgmname; pwr_tObjName attr_pgmname;
pwr_tObjName attr_typeref_pgmname; pwr_tObjName attr_typeref_pgmname;
strcpy( alignstr, " pwr_dAlignLW");
attr_next_alignlw = 1;
m_vrep->readBody( &sts, o_adef, pwr_eBix_sys, &adef_body); m_vrep->readBody( &sts, o_adef, pwr_eBix_sys, &adef_body);
if ( EVEN(sts)) throw wb_error(sts); if ( EVEN(sts)) throw wb_error(sts);
...@@ -2690,9 +2732,9 @@ void wb_vrepced::printStructFile( bool hpp) ...@@ -2690,9 +2732,9 @@ void wb_vrepced::printStructFile( bool hpp)
if ( adef_body.Info.Elements > 1) if ( adef_body.Info.Elements > 1)
fp << "[" << adef_body.Info.Elements << "];" << endl; fp << "[" << adef_body.Info.Elements << "]" << alignstr << ";" << endl;
else else
fp << ";" << endl; fp << alignstr << ";" << endl;
break; break;
} }
...@@ -2700,6 +2742,12 @@ void wb_vrepced::printStructFile( bool hpp) ...@@ -2700,6 +2742,12 @@ void wb_vrepced::printStructFile( bool hpp)
pwr_sObjXRef adef_body; pwr_sObjXRef adef_body;
pwr_tObjName attr_pgmname; pwr_tObjName attr_pgmname;
if ( attr_next_alignlw)
strcpy( alignstr, " pwr_dAlignLW");
else
strcpy( alignstr, " pwr_dAlignW");
attr_next_alignlw = 0;
m_vrep->readBody( &sts, o_adef, pwr_eBix_sys, &adef_body); m_vrep->readBody( &sts, o_adef, pwr_eBix_sys, &adef_body);
if ( EVEN(sts)) throw wb_error(sts); if ( EVEN(sts)) throw wb_error(sts);
...@@ -2716,9 +2764,9 @@ void wb_vrepced::printStructFile( bool hpp) ...@@ -2716,9 +2764,9 @@ void wb_vrepced::printStructFile( bool hpp)
fill( fp, 35-strlen("pwr_tOid")) << " " << attr_pgmname; fill( fp, 35-strlen("pwr_tOid")) << " " << attr_pgmname;
if ( adef_body.Info.Elements > 1) if ( adef_body.Info.Elements > 1)
fp << "[" << adef_body.Info.Elements << "];" << endl; fp << "[" << adef_body.Info.Elements << "]" << alignstr << ";" << endl;
else else
fp << ";" << endl; fp << alignstr << ";" << endl;
break; break;
} }
...@@ -2726,6 +2774,12 @@ void wb_vrepced::printStructFile( bool hpp) ...@@ -2726,6 +2774,12 @@ void wb_vrepced::printStructFile( bool hpp)
pwr_sAttrXRef adef_body; pwr_sAttrXRef adef_body;
pwr_tObjName attr_pgmname; pwr_tObjName attr_pgmname;
if ( attr_next_alignlw)
strcpy( alignstr, " pwr_dAlignLW");
else
strcpy( alignstr, " pwr_dAlignW");
attr_next_alignlw = 0;
m_vrep->readBody( &sts, o_adef, pwr_eBix_sys, &adef_body); m_vrep->readBody( &sts, o_adef, pwr_eBix_sys, &adef_body);
if ( EVEN(sts)) throw wb_error(sts); if ( EVEN(sts)) throw wb_error(sts);
...@@ -2743,9 +2797,9 @@ void wb_vrepced::printStructFile( bool hpp) ...@@ -2743,9 +2797,9 @@ void wb_vrepced::printStructFile( bool hpp)
fill( fp, 35-strlen("pwr_tAttrRef")) << " " << attr_pgmname; fill( fp, 35-strlen("pwr_tAttrRef")) << " " << attr_pgmname;
if ( adef_body.Info.Elements > 1) if ( adef_body.Info.Elements > 1)
fp << "[" << adef_body.Info.Elements << "];" << endl; fp << "[" << adef_body.Info.Elements << "]" << alignstr << ";" << endl;
else else
fp << ";" << endl; fp << alignstr << ";" << endl;
break; break;
} }
......
...@@ -937,7 +937,8 @@ void wb_wblnode::buildAttribute( ref_wblnode classdef, ref_wblnode objbodydef, ...@@ -937,7 +937,8 @@ void wb_wblnode::buildAttribute( ref_wblnode classdef, ref_wblnode objbodydef,
o->a.tid == pwr_eType_UInt64 || o->a.tid == pwr_eType_UInt64 ||
o->a.tid == pwr_eType_Float64 || o->a.tid == pwr_eType_Float64 ||
o->a.tid == pwr_eType_CastId || o->a.tid == pwr_eType_CastId ||
o->a.tid == pwr_eType_DisableAttr) { o->a.tid == pwr_eType_DisableAttr ||
strcmp( name(), "TimerFlag") == 0) {
// Align on longword // Align on longword
*boffset = pwr_AlignLW(*boffset); *boffset = pwr_AlignLW(*boffset);
} }
...@@ -966,11 +967,18 @@ void wb_wblnode::buildAttribute( ref_wblnode classdef, ref_wblnode objbodydef, ...@@ -966,11 +967,18 @@ void wb_wblnode::buildAttribute( ref_wblnode classdef, ref_wblnode objbodydef,
*boffset += pwr_AlignW( o->a.size); *boffset += pwr_AlignW( o->a.size);
} }
else { else {
o->a.size = ((pwr_sParam *)o->rbody)->Info.Size = size;
o->a.offset = ((pwr_sParam *)o->rbody)->Info.Offset = *boffset; o->a.offset = ((pwr_sParam *)o->rbody)->Info.Offset = *boffset;
if ( o->a.flags & pwr_mAdef_pointer && !(o->a.flags & pwr_mAdef_private)) {
// Size contains the size if the pointed entity
*boffset += pwr_cAlignLW;
}
else {
o->a.size = ((pwr_sParam *)o->rbody)->Info.Size = size;
*boffset += pwr_AlignW( o->a.size); *boffset += pwr_AlignW( o->a.size);
} }
if ( o->a.flags & pwr_mAdef_pointer || }
if ( cdh_tidIsCid( o->a.tid) ||
o->a.flags & pwr_mAdef_pointer ||
o->a.tid == pwr_eType_CastId || o->a.tid == pwr_eType_CastId ||
o->a.tid == pwr_eType_DisableAttr) { o->a.tid == pwr_eType_DisableAttr) {
// Align next attribute on longword // Align next attribute on longword
...@@ -1051,10 +1059,11 @@ void wb_wblnode::buildBuffer( ref_wblnode classdef, ref_wblnode objbodydef, ...@@ -1051,10 +1059,11 @@ void wb_wblnode::buildBuffer( ref_wblnode classdef, ref_wblnode objbodydef,
return; return;
} }
*boffset = pwr_AlignLW( *boffset);
o->a.size = ((pwr_sBuffer *)o->rbody)->Info.Size = o->a.elements * rsize; o->a.size = ((pwr_sBuffer *)o->rbody)->Info.Size = o->a.elements * rsize;
o->a.offset = ((pwr_sBuffer *)o->rbody)->Info.Offset = pwr_AlignLW( *boffset); o->a.offset = ((pwr_sBuffer *)o->rbody)->Info.Offset = *boffset;
((pwr_sBuffer *)o->rbody)->Info.ParamIndex = *bindex; ((pwr_sBuffer *)o->rbody)->Info.ParamIndex = *bindex;
*boffset += pwr_AlignW(o->a.size); *boffset += pwr_AlignLW( o->a.size);
(*bindex)++; (*bindex)++;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment