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
EndBody
EndObject
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 Size = 4
Attr Flags = 1
Attr ParamIndex = 60
Attr TypeRef = "pwrs:Type-$Status"
EndBody
EndObject
......@@ -11737,9 +11739,11 @@ ABB ACS800 Typ 1"
EndBody
EndObject
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 Size = 4
Attr Flags = 1
Attr ParamIndex = 77
Attr TypeRef = "pwrs:Type-$Status"
EndBody
EndObject
......@@ -26217,45 +26217,45 @@ Start/Stop, Manual/Auto, Local/Remote"
! - in manual mode they are fetched from the increment and decrement
! buttons in the object graph.
! - at local mode, they are fetched from the local inputs, LocalIncr and LocalDecr.
!
!
! @b Internal control (default)
! The operator selects auto or manual mode from the object graph with the Auto/Man
! buttons. The ExtControl input is not used.
!
!
! @b Manual mode only
! Only the manual mode is available. The ExtControl input is not used, and the
! Man/Auto buttons in the object graph are hidden. This is configured by setting
! OpIntOnly to 1.
!
!
! @b Auto mode only
! Only the auto mode is available. The ExtControl input is not used, and the
! Man/Auto buttons in the object graph are hidden. This is configured by setting
! OpExtOnly to 1.
!
!
! @b External control
! This mode is controlled by the ExtControl input. At 0 the mode is manual, and at
! 1 the mode is auto. The Auto/Man buttons in the object graph are hidden. This is
! configured by setting OpExtAndIntMan to 1.
!
!
! If the ready signal is lost, the default action is to set manual mode if the
! current mode is auto, if the manual mode is available. To suppress this behavior
! set OpNoAutoToMan to 1.
!
!
! @b Incr/Decr buttons
! The function of the Incr and Decr buttons for manual control can be configured
! to set the corresponding output as long as the button is pressed, or to set
! the output when the Incr/Decr button is clicked, and to reset when the Stop button
! is clicked, or when the Incr/Decr button is clicked again. This is configured with
! OpNoStopButton.
!
!
! @b Limit switches
! If limit switches are present the manual increment and decrement output is set
! until the corresponding limit switch is affected, or until the OrderTimeLimit
! (default 10 s) is reached.
!
!
! If the limitswitches should not be used, or is not present, OpNoLimitSwitch should
! be set.
!
!
! @b Plc coding
! For plc coding the function object CompModeD2Fo is used.
! @image orm_compmoded2fo_fo.gif
......@@ -26464,8 +26464,8 @@ Start/Stop, Manual/Auto, Local/Remote"
Attr TypeRef = "pwrs:Type-$Boolean"
EndBody
EndObject
!/**
! Configures that only the manual mode is available. The ExtControl input
!/**
! Configures that only the manual mode is available. The ExtControl input
! is not used, and the Man/Auto buttons in the object graph are hidden.
!*/
Object OpIntOnly $Attribute 108 13-DEC-2005 17:30:24.26
......@@ -26474,8 +26474,8 @@ Start/Stop, Manual/Auto, Local/Remote"
Attr TypeRef = "pwrs:Type-$Boolean"
EndBody
EndObject
!/**
! Configures that local mode is not used.
!/**
! Configures that local mode is not used.
!*/
Object OpNoLocal $Attribute 109 05-DEC-2005 10:06:13.33
Body SysBody 05-DEC-2005 10:06:13.33
......@@ -26483,8 +26483,8 @@ Start/Stop, Manual/Auto, Local/Remote"
Attr TypeRef = "pwrs:Type-$Boolean"
EndBody
EndObject
!/**
! Configures that if the Ready input is reset, and the mode is auto,
!/**
! Configures that if the Ready input is reset, and the mode is auto,
! the auto-mode is kept. If OpNoAutoToMan is false, the mode will
! switch to manual.
!*/
......@@ -26494,8 +26494,8 @@ Start/Stop, Manual/Auto, Local/Remote"
Attr TypeRef = "pwrs:Type-$Boolean"
EndBody
EndObject
!/**
! Configures that only auto mode is available, and there is
!/**
! Configures that only auto mode is available, and there is
! no way to switch to manual mode.
!*/
Object OpExtOnly $Attribute 111 13-DEC-2005 17:30:52.25
......@@ -26504,8 +26504,8 @@ Start/Stop, Manual/Auto, Local/Remote"
Attr TypeRef = "pwrs:Type-$Boolean"
EndBody
EndObject
!/**
! Configures that the ExtControl input controls whether the mode
!/**
! Configures that the ExtControl input controls whether the mode
! is auto or manual. When ExtControl is 0, the mode is manual, and
! when ExtControl is 1, the mode is auto. The operator can not
! swich the mode from the object graph.
......@@ -78209,7 +78209,7 @@ Alarm HH, H, L, LL"
!
! @b Simulate
! For simulation of the sensor value, use the plc object BaseCValveSim.
!
!
! @b See also
! @classlink BaseCValveFo basecomponent_basecvalvefo.html
! @classlink BaseActuatorA basecomponent_baseactuatora.html
......@@ -125367,9 +125367,11 @@ Err (error) = err"
EndBody
EndObject
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 Size = 4
Attr Flags = 1
Attr ParamIndex = 63
Attr TypeRef = "pwrs:Type-$Status"
EndBody
EndObject
......@@ -145290,9 +145292,11 @@ Fc PPO5 Motor Aggregate
EndBody
EndObject
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 Size = 4
Attr Flags = 1
Attr ParamIndex = 36
Attr TypeRef = "pwrs:Type-$Status"
EndBody
EndObject
......@@ -162825,10 +162829,10 @@ Fc PPO3 Motor Aggregate
! @image orm_basevalveincrdecrfo_fo.gif
! Create a function object in the plc editor and connect it to the current
! object with the connect function.
!
!
! @b Simulate
! For simulation of the sensor value, use the plc object BaseCValveSim.
!
!
!
! @b See also
! @classlink BaseValveIncrDecrFo basecomponent_basevalveincrdecrfo.html
......@@ -286,6 +286,7 @@ SObject NMps:Class
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_PRIVATE
Attr Flags |= PWR_MASK_POINTER
EndBody
EndObject
......
......@@ -86,7 +86,7 @@
#define CALLBACK
#define INVALID_HANDLE_VALUE ((HANDLE) NULL)
#define getch() getchar()
typedef int HANDLE;
typedef long int HANDLE;
typedef unsigned long DWORD;
#ifdef PB_API_FUNC_NOT_USED
#undef CALL_CONV
......
......@@ -373,6 +373,16 @@ endl;
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 i;
......@@ -392,12 +402,15 @@ int CnvWblToH::attribute_exec()
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), "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");
else
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), "disableattr") == 0)
// Align next attribute on longword
......
......@@ -704,7 +704,11 @@ mvol_LinkClass (
printf("--- %s, idx: %d, mof: %d\n", aop->g.f.name.orig, i, cp->attr[i].moffset);
#endif
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);
......
......@@ -57,6 +57,9 @@
#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_sThread plc_sThread;
typedef struct plc_sDlink plc_sDlink;
......
......@@ -46,12 +46,9 @@ void sum_exec(
pwr_sClass_sum *object)
{
#define sumsize 8
char *charp;
float **ptr; /* Pointer to ptr to input */
static ptrdiff_t offset = (char *)&object->In2 - (char *)&object->In1;
/* Offset to next input */
int i; /* Loopindex */
float sum; /* Result */
pwr_tFloat32 **ptr; /* Pointer to ptr to input */
int i; /* Loopindex */
float sum; /* Result */
/* Initialize */
sum = object->Const;
ptr = &object->In1P;
......@@ -61,9 +58,7 @@ void sum_exec(
if ( *ptr != NULL )
sum += **ptr * object->FVect[i];
charp = (char *) ptr;
charp += offset;
ptr = (float **)charp;
ptr = (pwr_tFloat32 **)((char *)ptr + pwr_cInputOffset);
}
/* Result */
object->ActVal = sum;
......@@ -88,8 +83,6 @@ void maxmin_exec(
float minval; /* Lowest value */
float maxval; /* Highest value */
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 */
/* Initialize */
......@@ -104,9 +97,7 @@ void maxmin_exec(
if ( **ptr > maxval) maxval = **ptr;
if ( **ptr < minval) minval = **ptr;
}
charp = (char *) ptr;
charp += offset;
ptr = (float **)charp;
ptr = (pwr_tFloat32 **)((char *)ptr + pwr_cInputOffset);
}
/* Set Output */
object->MaxVal = maxval;
......@@ -594,8 +585,8 @@ void DtoMask_exec(
*d = **dp;
if ( *d)
val |= m;
d += 2;
dp += 2;
d = (pwr_tBoolean *)((char *)d + pwr_cInputOffset);
dp = (pwr_tBoolean **)((char *)dp + pwr_cInputOffset);
m = m << 1;
}
object->Mask = val;
......@@ -649,8 +640,8 @@ void DtoEnum_exec(
val = object->EnumValues[i];
break;
}
d += 2;
dp += 2;
d = (pwr_tBoolean *)((char *)d + pwr_cInputOffset);
dp = (pwr_tBoolean **)((char *)dp + pwr_cInputOffset);
}
object->Enum = val;
}
......@@ -845,7 +836,6 @@ void IAdd_exec(
pwr_sClass_IAdd *o)
{
#define IADD_SIZE 8
static ptrdiff_t offset = (char *)&o->In2 - (char *)&o->In1;
int i;
pwr_tInt32 **inp = &o->In1P;
pwr_tInt32 sum = 0;
......@@ -853,7 +843,7 @@ void IAdd_exec(
for ( i = 0; i < IADD_SIZE; i++) {
sum += **inp;
inp = (pwr_tInt32 **)((char *)inp + offset);
inp = (pwr_tInt32 **)((char *)inp + pwr_cInputOffset);
}
o->ActVal = sum;
}
......@@ -867,13 +857,12 @@ void IMul_exec(
pwr_sClass_IMul *o)
{
#define IMUL_SIZE 8
static ptrdiff_t offset = (char *)&o->In2 - (char *)&o->In1;
int i;
pwr_tInt32 **inp = &o->In1P;
pwr_tInt32 result = **inp;
for ( i = 1; i < IMUL_SIZE; i++) {
inp = (pwr_tInt32 **)((char *)inp + offset);
inp = (pwr_tInt32 **)((char *)inp + pwr_cInputOffset);
result *= **inp;
}
o->ActVal = result;
......@@ -913,7 +902,6 @@ void IMax_exec(
pwr_sClass_IMax *o)
{
#define IMAX_SIZE 8
static ptrdiff_t offset = (char *)&o->In2 - (char *)&o->In1;
int i;
pwr_tInt32 **inp = &o->In1P;
pwr_tInt32 result = INT_MIN;
......@@ -921,7 +909,7 @@ void IMax_exec(
for ( i = 0; i < IMAX_SIZE; i++) {
if ( **inp > result)
result = **inp;
inp = (pwr_tInt32 **)((char *)inp + offset);
inp = (pwr_tInt32 **)((char *)inp + pwr_cInputOffset);
}
o->ActVal = result;
}
......@@ -935,7 +923,6 @@ void IMin_exec(
pwr_sClass_IMin *o)
{
#define IMIN_SIZE 8
static ptrdiff_t offset = (char *)&o->In2 - (char *)&o->In1;
int i;
pwr_tInt32 **inp = &o->In1P;
pwr_tInt32 result = INT_MAX;
......@@ -943,7 +930,7 @@ void IMin_exec(
for ( i = 0; i < IMIN_SIZE; i++) {
if ( **inp < result)
result = **inp;
inp = (pwr_tInt32 **)((char *)inp + offset);
inp = (pwr_tInt32 **)((char *)inp + pwr_cInputOffset);
}
o->ActVal = result;
}
......@@ -1007,13 +994,12 @@ void IMux_exec(
pwr_sClass_IMux *o)
{
#define IMUX_SIZE 24
static ptrdiff_t offset = (char *)&o->In1 - (char *)&o->In0;
int idx;
pwr_tInt32 **inp = &o->In0P;
idx = o->Index = *o->IndexP;
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;
}
......@@ -1026,13 +1012,12 @@ void Mux_exec(
pwr_sClass_Mux *o)
{
#define MUX_SIZE 24
static ptrdiff_t offset = (char *)&o->In1 - (char *)&o->In0;
int idx;
pwr_tFloat32 **inp = &o->In0P;
idx = o->Index = *o->IndexP;
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;
}
......@@ -1089,7 +1074,6 @@ void Add_exec(
pwr_sClass_Add *o)
{
#define ADD_SIZE 8
static ptrdiff_t offset = (char *)&o->In2 - (char *)&o->In1;
int i;
pwr_tFloat32 **inp = &o->In1P;
pwr_tFloat32 sum = 0;
......@@ -1097,7 +1081,7 @@ void Add_exec(
for ( i = 0; i < ADD_SIZE; i++) {
sum += **inp;
inp = (pwr_tFloat32 **)((char *)inp + offset);
inp = (pwr_tFloat32 **)((char *)inp + pwr_cInputOffset);
}
o->ActVal = sum;
}
......@@ -1111,13 +1095,12 @@ void Mul_exec(
pwr_sClass_Mul *o)
{
#define MUL_SIZE 8
static ptrdiff_t offset = (char *)&o->In2 - (char *)&o->In1;
int i;
pwr_tFloat32 **inp = &o->In1P;
pwr_tFloat32 result = **inp;
for ( i = 1; i < MUL_SIZE; i++) {
inp = (pwr_tFloat32 **)((char *)inp + offset);
inp = (pwr_tFloat32 **)((char *)inp + pwr_cInputOffset);
result *= **inp;
}
o->ActVal = result;
......@@ -1154,7 +1137,6 @@ void Max_exec(
pwr_sClass_Max *o)
{
#define AMAX_SIZE 8
static ptrdiff_t offset = (char *)&o->In2 - (char *)&o->In1;
int i;
pwr_tFloat32 **inp = &o->In1P;
pwr_tFloat32 result = -1E37;
......@@ -1162,7 +1144,7 @@ void Max_exec(
for ( i = 0; i < AMAX_SIZE; i++) {
if ( **inp > result)
result = **inp;
inp = (pwr_tFloat32 **)((char *)inp + offset);
inp = (pwr_tFloat32 **)((char *)inp + pwr_cInputOffset);
}
o->ActVal = result;
}
......@@ -1176,7 +1158,6 @@ void Min_exec(
pwr_sClass_Min *o)
{
#define AMIN_SIZE 8
static ptrdiff_t offset = (char *)&o->In2 - (char *)&o->In1;
int i;
pwr_tFloat32 **inp = &o->In1P;
pwr_tFloat32 result = 1E37;
......@@ -1184,7 +1165,7 @@ void Min_exec(
for ( i = 0; i < AMIN_SIZE; i++) {
if ( **inp < result)
result = **inp;
inp = (pwr_tFloat32 **)((char *)inp + offset);
inp = (pwr_tFloat32 **)((char *)inp + pwr_cInputOffset);
}
o->ActVal = result;
}
......
......@@ -195,7 +195,6 @@ void dibcd_exec (
int i; /* Loop index*/
int j; /* Loop index*/
int res; /* Result */
ptrdiff_t offset; /* Offset to next pointer */
char *ptr; /* Pointer to pointer */
pwr_tBoolean *p2; /* Pointer to digin */
pwr_tBoolean err; /* Error flag */
......@@ -203,9 +202,7 @@ void dibcd_exec (
/* Initialize */
res = 0;
err = FALSE;
offset = (char *)&object->BCD1P - (char *)&object->BCD0P;
ptr = (char *)&object->BCD0P;
ptr += (DIBCDSIZE -1) * offset;
ptr = (char *)&object->BCD0P + (DIBCDSIZE -1) * pwr_cInputOffset;
/* Double loop for convert */
for ( i = 0; i < (DIBCDSIZE / 4); i++) {
......@@ -214,7 +211,7 @@ void dibcd_exec (
val += val; /* Mult 2 */
p2 = *(pwr_tBoolean **)ptr; /* Pointer to input */
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;
res = 10 * res + val;
......@@ -280,16 +277,13 @@ void gray_exec (
pwr_tBoolean in; /* Digital in after invert */
pwr_tBoolean odd; /* Convert flag */
int sum; /* Convert sum */
ptrdiff_t offset; /* Offset to next pointer */
char *ptr; /* Pointer to ptr to digin */
pwr_tBoolean *p2; /* Pointer to digin */
/* Init */
odd = 0;
sum = 0;
offset = (char *)&object->Din1P - (char *)&object->Din0P;
ptr = (char *)&object->Din0P;
ptr += (GRAYSIZE - 1) * offset;
ptr = (char *)&object->Din0P + (GRAYSIZE - 1) * pwr_cInputOffset;
/* Graycode convert loop */
for (i = 0; i < GRAYSIZE; i++) {
......@@ -298,7 +292,7 @@ void gray_exec (
in = (*p2 != object->Inv); /* Invert ? */
odd = in ? !odd : odd; /* Odd up to now ? */
sum += odd; /* Inc if odd input */
ptr -= offset;
ptr -= pwr_cInputOffset;
}
/* Result */
......
......@@ -37,7 +37,7 @@
#endif
typedef struct {
pwr_tBoolean TimerFlag pwr_dAlignW;
pwr_tBoolean TimerFlag pwr_dAlignLW;
pwr_tBoolean *TimerNext pwr_dAlignLW;
pwr_tUInt32 TimerCount pwr_dAlignLW;
pwr_tBoolean *TimerDO pwr_dAlignLW;
......
......@@ -85,6 +85,7 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$Float32"
Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_STATE
Attr Size = 4
EndBody
EndObject
!/**
......
......@@ -85,6 +85,7 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$Float32"
Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_STATE
Attr Size = 4
EndBody
EndObject
!/**
......
......@@ -76,6 +76,7 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$Float32"
Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_STATE
Attr Size = 4
EndBody
EndObject
!/**
......
......@@ -129,6 +129,7 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$Int32"
Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_STATE
Attr Size = 4
EndBody
EndObject
!/**
......@@ -141,6 +142,7 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$Int32"
Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_STATE
Attr Size = 4
EndBody
EndObject
!/**
......
......@@ -253,6 +253,7 @@ SObject pwrb:Class
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_PRIVATE
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_ARRAY
......
......@@ -103,6 +103,7 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$Boolean"
Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_STATE
Attr Size = 4
EndBody
EndObject
!/**
......
......@@ -85,6 +85,7 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$Boolean"
Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_STATE
Attr Size = 4
EndBody
EndObject
!/**
......
......@@ -180,6 +180,7 @@ SObject pwrb:Class
Body SysBody
Attr TypeRef = "pwrs:Type-$Boolean"
Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_PRIVATE
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_INVISIBLE
EndBody
......@@ -238,6 +239,7 @@ SObject pwrb:Class
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_PRIVATE
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_INVISIBLE
EndBody
......
......@@ -164,6 +164,7 @@ SObject pwrb:Class
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_PRIVATE
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_INVISIBLE
EndBody
......
......@@ -78,6 +78,7 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$Boolean"
Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_STATE
Attr Size = 4
EndBody
EndObject
!/**
......
......@@ -85,6 +85,7 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$Int32"
Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_STATE
Attr Size = 4
EndBody
EndObject
!/**
......
......@@ -179,6 +179,7 @@ SObject pwrb:Class
Object OpenP $Intern 8
Body SysBody
Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_PRIVATE
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_INVISIBLE
......@@ -188,6 +189,7 @@ SObject pwrb:Class
Object CloseP $Intern 9
Body SysBody
Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_PRIVATE
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_INVISIBLE
......
......@@ -82,6 +82,7 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$Int32"
Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_STATE
Attr Size = 4
EndBody
EndObject
!/**
......
......@@ -71,6 +71,7 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$Int32"
Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_STATE
Attr Size = 4
EndBody
EndObject
!/**
......
......@@ -182,6 +182,7 @@ SObject pwrb:Class
Object OpenP $Intern 8
Body SysBody
Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_PRIVATE
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
Attr TypeRef = "pwrs:Type-$Boolean"
......@@ -190,6 +191,7 @@ SObject pwrb:Class
Object CloseP $Intern 9
Body SysBody
Attr Flags |= PWR_MASK_POINTER
Attr Flags |= PWR_MASK_PRIVATE
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
Attr TypeRef = "pwrs:Type-$Boolean"
......
......@@ -20,7 +20,7 @@
!
SObject pwrs:Type
!/**
! @Version 1.0
! @Version 2.0
! @Code pwr.h
! @Group BasicTypes,Types
! Delta time. Basic type.
......@@ -34,7 +34,7 @@ SObject pwrs:Type
Object $DeltaTime pwr_eClass_Type pwr_eTix_DeltaTime
Body SysBody
Attr Type = pwr_eType_DeltaTime
Attr Size = 8
Attr Size = 16
EndBody
EndObject
EndSObject
......@@ -20,7 +20,7 @@
!
SObject pwrs:Type
!/**
! @Version 1.0
! @Version 2.0
! @Code pwr.h
! @Group BasicTypes,Types
! Absolute time. Basic type.
......@@ -33,7 +33,7 @@ SObject pwrs:Type
Object $Time pwr_eClass_Type pwr_eTix_Time
Body SysBody
Attr Type = pwr_eType_Time
Attr Size = 8
Attr Size = 16
EndBody
EndObject
EndSObject
......@@ -66,10 +66,12 @@ wb_print_wbl::~wb_print_wbl()
void wb_print_wbl::printAttribute(wb_volume& v,
wb_attribute& attr,
wb_attribute& tattr, ///< template
wb_adef& adef)
wb_adef& adef,
int force)
{
if (adef.flags() & PWR_MASK_POINTER ||
adef.flags() & PWR_MASK_NOWBL)
if ( !force &&
(adef.flags() & PWR_MASK_POINTER ||
adef.flags() & PWR_MASK_NOWBL))
return;
if (attr.isClass() && adef.cid() == pwr_eClass_Buffer)
......@@ -109,6 +111,7 @@ void wb_print_wbl::printBody(wb_volume& v,
wb_attribute tattr;
const char* bname;
char timestr[40] = " ";
int force = 0;
wb_bdef bdef = cdef.bdef(bix);
......@@ -150,11 +153,19 @@ void wb_print_wbl::printBody(wb_volume& v,
indent(1) << "Body " << bdef.name() << timestr << endl;
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());
tattr = templ.attribute(bname, adef.name());
// if (tattr == attr)
// continue;
printAttribute(v, attr, tattr, adef);
printAttribute(v, attr, tattr, adef, force);
}
indent(-1) << "EndBody" << endl;
......@@ -227,7 +238,7 @@ void wb_print_wbl::printBuffer(wb_volume& v,
while (1) {
tattr2 = templ.attribute(bname, adef2.name());
printAttribute(v, attr2, tattr2, adef2);
printAttribute(v, attr2, tattr2, adef2, 0);
if (!(adef2 = adef2.next()))
break;
......@@ -282,7 +293,7 @@ void wb_print_wbl::printClass(wb_volume& v,
adef2 = bdef.adef( attr2.attrName());
printAttribute(v, attr2, tattr2, adef2);
printAttribute(v, attr2, tattr2, adef2, 0);
attr2 = attr2.after();
tattr2 = tattr2.after();
......@@ -335,7 +346,7 @@ void wb_print_wbl::printClass(wb_volume& v,
while (1) {
tattr2 = templ.attribute(bname, adef2.name());
printAttribute(v, attr2, tattr2, adef2);
printAttribute(v, attr2, tattr2, adef2, 0);
if (!(adef2 = adef2.next()))
break;
......@@ -362,7 +373,7 @@ void wb_print_wbl::printClass(wb_volume& v,
attr2
tattr2 = templ.attribute(bname, adef2.name());
printAttribute(v, attr2, tattr2, adef2);
printAttribute(v, attr2, tattr2, adef2, 0);
if (!(adef2 = adef2.next()))
break;
......
......@@ -59,7 +59,8 @@ protected:
void printAttribute(wb_volume& v,
wb_attribute& attr,
wb_attribute& tattr, ///< template attribute
wb_adef& adef);
wb_adef& adef,
int force);
void printBody(wb_volume& v,
wb_object& o,
......
......@@ -1809,7 +1809,8 @@ bool wb_vrepced::buildClass( pwr_tStatus *sts, wb_orep *co)
typeref == pwr_eType_UInt64 ||
typeref == pwr_eType_Float64 ||
typeref == pwr_eType_CastId ||
typeref == pwr_eType_DisableAttr)
typeref == pwr_eType_DisableAttr ||
strcmp( ao->name(), "TimerFlag") == 0)
offset = pwr_AlignLW( offset);
// Store data in Attribute object
......@@ -1838,8 +1839,13 @@ bool wb_vrepced::buildClass( pwr_tStatus *sts, wb_orep *co)
if ( EVEN(*sts)) return false;
// Alignment for next attribute
offset += size;
if ( flags & PWR_MASK_POINTER ||
if ( flags & PWR_MASK_POINTER && !(flags & PWR_MASK_PRIVATE))
offset += pwr_cAlignLW;
else
offset += size;
if ( cdh_tidIsCid( typeref) ||
flags & PWR_MASK_POINTER ||
typeref == pwr_eType_CastId ||
typeref == pwr_eType_DisableAttr)
offset = pwr_AlignLW( offset);
......@@ -1917,7 +1923,7 @@ bool wb_vrepced::buildClass( pwr_tStatus *sts, wb_orep *co)
sizeof(type), &type);
if ( EVEN(*sts)) return false;
offset += size;
offset += pwr_AlignW( size);
paramindex++;
break;
}
......@@ -1992,7 +1998,7 @@ bool wb_vrepced::buildClass( pwr_tStatus *sts, wb_orep *co)
sizeof(type), &type);
if ( EVEN(*sts)) return false;
offset += size;
offset += pwr_AlignLW( size);
paramindex++;
break;
}
......@@ -2364,6 +2370,7 @@ void wb_vrepced::printStructFile( bool hpp)
pwr_tFileName filename;
pwr_tFileName fname, incname;
char *s;
char alignstr[40];
if ( hpp)
sprintf( filename, "$pwrp_inc/pwr_%sclasses.hpp", m_vrep->name());
......@@ -2517,7 +2524,9 @@ void wb_vrepced::printStructFile( bool hpp)
pwr_tObjName pgmname;
pwr_eBix bix = cdh_oixToBix( o_bdef->oid().oix);
char structstype[3];
#if 0
int struct_filler_cnt = 0;
#endif
m_vrep->readBody( &sts, o_bdef, pwr_eBix_sys, &bdef_body);
if ( EVEN(sts)) throw wb_error(sts);
......@@ -2554,6 +2563,7 @@ void wb_vrepced::printStructFile( bool hpp)
}
bool attr_found = false;
int attr_next_alignlw = 0;
for ( o_adef = o_bdef->first( &sts); ODD(sts);) {
o_adef->ref();
......@@ -2604,6 +2614,34 @@ void wb_vrepced::printStructFile( bool hpp)
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;
if ( hpp && adef_body.Info.ParamIndex == 0) {
......@@ -2626,16 +2664,17 @@ void wb_vrepced::printStructFile( bool hpp)
if ( o_adef->cid() == pwr_eClass_Input)
fp << " " << attr_typeref_pgmname <<
fill( fp, 35-strlen(attr_typeref_pgmname)) << " " << pointertype <<
"*" << attr_pgmname << "P;" << endl;
"*" << attr_pgmname << "P" << alignstr << ";" << endl;
fp << " " << attr_typeref_pgmname <<
fill( fp, 35-strlen(attr_typeref_pgmname)) << " " << pointertype <<
attr_pgmname;
if ( adef_body.Info.Elements > 1)
fp << "[" << adef_body.Info.Elements << "];" << endl;
fp << "[" << adef_body.Info.Elements << "]" << alignstr << ";" << endl;
else
fp << ";" << endl;
fp << alignstr << ";" << endl;
#if 0
int filler;
if ( 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)
}
struct_filler_cnt++;
}
#endif
}
break;
......@@ -2665,6 +2705,8 @@ void wb_vrepced::printStructFile( bool hpp)
pwr_tObjName attr_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);
if ( EVEN(sts)) throw wb_error(sts);
......@@ -2690,9 +2732,9 @@ void wb_vrepced::printStructFile( bool hpp)
if ( adef_body.Info.Elements > 1)
fp << "[" << adef_body.Info.Elements << "];" << endl;
fp << "[" << adef_body.Info.Elements << "]" << alignstr << ";" << endl;
else
fp << ";" << endl;
fp << alignstr << ";" << endl;
break;
}
......@@ -2700,6 +2742,12 @@ void wb_vrepced::printStructFile( bool hpp)
pwr_sObjXRef adef_body;
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);
if ( EVEN(sts)) throw wb_error(sts);
......@@ -2716,9 +2764,9 @@ void wb_vrepced::printStructFile( bool hpp)
fill( fp, 35-strlen("pwr_tOid")) << " " << attr_pgmname;
if ( adef_body.Info.Elements > 1)
fp << "[" << adef_body.Info.Elements << "];" << endl;
fp << "[" << adef_body.Info.Elements << "]" << alignstr << ";" << endl;
else
fp << ";" << endl;
fp << alignstr << ";" << endl;
break;
}
......@@ -2726,6 +2774,12 @@ void wb_vrepced::printStructFile( bool hpp)
pwr_sAttrXRef adef_body;
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);
if ( EVEN(sts)) throw wb_error(sts);
......@@ -2743,9 +2797,9 @@ void wb_vrepced::printStructFile( bool hpp)
fill( fp, 35-strlen("pwr_tAttrRef")) << " " << attr_pgmname;
if ( adef_body.Info.Elements > 1)
fp << "[" << adef_body.Info.Elements << "];" << endl;
fp << "[" << adef_body.Info.Elements << "]" << alignstr << ";" << endl;
else
fp << ";" << endl;
fp << alignstr << ";" << endl;
break;
}
......
......@@ -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_Float64 ||
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
*boffset = pwr_AlignLW(*boffset);
}
......@@ -966,11 +967,18 @@ void wb_wblnode::buildAttribute( ref_wblnode classdef, ref_wblnode objbodydef,
*boffset += pwr_AlignW( o->a.size);
}
else {
o->a.size = ((pwr_sParam *)o->rbody)->Info.Size = size;
o->a.offset = ((pwr_sParam *)o->rbody)->Info.Offset = *boffset;
*boffset += pwr_AlignW( o->a.size);
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);
}
}
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_DisableAttr) {
// Align next attribute on longword
......@@ -1051,10 +1059,11 @@ void wb_wblnode::buildBuffer( ref_wblnode classdef, ref_wblnode objbodydef,
return;
}
*boffset = pwr_AlignLW( *boffset);
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;
*boffset += pwr_AlignW(o->a.size);
*boffset += pwr_AlignLW( o->a.size);
(*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