/*
 * ProviewR   Open Source Process Control.
 * Copyright (C) 2005-2023 SSAB EMEA AB.
 *
 * This file is part of ProviewR.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation, either version 2 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with ProviewR. If not, see <http://www.gnu.org/licenses/>
 *
 * Linking ProviewR statically or dynamically with other modules is
 * making a combined work based on ProviewR. Thus, the terms and
 * conditions of the GNU General Public License cover the whole
 * combination.
 *
 * In addition, as a special exception, the copyright holders of
 * ProviewR give you permission to, from the build function in the
 * ProviewR Configurator, combine ProviewR with modules generated by the
 * ProviewR PLC Editor to a PLC program, regardless of the license
 * terms of these modules. You may copy and distribute the resulting
 * combined work under the terms of your choice, provided that every
 * copy of the combined work is accompanied by a complete copy of
 * the source code of ProviewR (the version used to produce the
 * combined work), being distributed under the terms of the GNU
 * General Public License plus this exception.
 */
#ifndef pwr_h
#define pwr_h
#ifndef PWR_LOADED
#define PWR_LOADED 1
#endif
/* pwr.h -- basic definitions for PROVIEW/R
 */
#include <stdlib.h> /* EXIT_FAILURE */
#include <limits.h>
/*! \file pwr.h
    \brief Basic type definitions.
   This include file contains the Proview basic type definitions.
*/
/*! \addtogroup Pwr */
/*@{*/
#if defined __cplusplus
extern "C" {
#endif
#define pwr_dExport
#define pwr_dImport extern
/* Environment variable which MUST be defined.
 * eg. export PWR_BUS_ID="300"
 */
#define pwr_dEnvBusId "PWR_BUS_ID"
#ifndef pwr_dPacked
#if defined(__GNUC__) || defined(__GNUG__)
#define pwr_dPacked __attribute__((packed))
#else
#define pwr_dPacked
#endif
#endif
#define pwr_dLittleEndian 1
#define pwr_dBigEndian 2
#if defined(__powerpc__)
#define pwr_dHost_byteOrder pwr_dBigEndian
#if 0
#define pwr_Bit(b) (1 << (31 - b))
#define pwr_SetByte(byte, val) (val << ((3 - byte) << 3))
#endif
#else
#define pwr_dHost_byteOrder pwr_dLittleEndian
#endif
#define pwr_Bit(b) (1 << b)
#define pwr_SetByte(byte, val) (val << (byte << 3))
#if defined(HW_X86_64)
#define pwr_cAlignW 4
#define pwr_cAlignLW 8
#else
#define pwr_cAlignW 4
#define pwr_cAlignLW 8
#endif
#define pwr_dAlignW __attribute__((aligned(4)))
#define pwr_dAlignLW __attribute__((aligned(8)))
#define pwr_AlignW(offs) (((offs) + (pwr_cAlignW - 1)) & ~(pwr_cAlignW - 1))
#define pwr_AlignLW(offs) (((offs) + (pwr_cAlignLW - 1)) & ~(pwr_cAlignLW - 1))
#define pwr_Align(offs, align) ((offs + (align - 1)) & ~(align - 1))
/* PROVIEW/R types  */
#define pwr_cSizObjName 31
#define pwr_cSizPgmName 31
#define pwr_cSizStructName 31
#define pwr_cSizGraphName 15
#define pwr_cSizXRef 31
#define pwr_cSizAttrName 31
#define pwr_cSizPathName 63
#define pwr_cSizFullName 199
#define pwr_cSizOName 199
#define pwr_cSizAName 399
#define pwr_cSizFileName 255
#define pwr_cSizCmd 399
typedef void* pwr_tAddress; //!< Generic pointer type.
typedef unsigned int pwr_tBit; //!< Bit type.
typedef unsigned int pwr_tBitMask; //!< Bitmask type.

Boolean


typedef unsigned int pwr_tBoolean; //!< Boolean type.

Float32


typedef float pwr_tFloat32; //!< 32-bit float.

Float64


typedef double pwr_tFloat64; //!< 64-bit float.

Char


typedef char pwr_tChar; //!< Character type.

String


typedef char pwr_tString[]; //!< String type.

Text


typedef char pwr_tText[]; //!< Text type.

Int8


typedef char pwr_tInt8; //!< 8-bit integer type.

Int16


typedef short pwr_tInt16; //!< 16-bit integer type.

Int32


typedef int pwr_tInt32; //!< 32-bit integer type.
//! 64-bit integer type.

Int64


typedef struct {
  unsigned int low;
  int high;
} __pwr_tInt64;
#if defined HW_X86_64
typedef long int pwr_tInt64;
#define PWR_INT64MAX LONG_MAX
#define PWR_INT64MIN LONG_MIN
#else
typedef long long int pwr_tInt64;
#define PWR_INT64MAX LLONG_MAX
#define PWR_INT64MIN LLONG_MIN
#endif
//! 64-bit unsigned integer type.

UInt64


typedef struct {
  unsigned int low;
  unsigned int high;
} __pwr_tUInt64;
#if defined HW_X86_64
typedef unsigned long int pwr_tUInt64;
#define PWR_UINT64MAX ULONG_MAX
#else
typedef unsigned long long int pwr_tUInt64;
#define PWR_UINT64MAX ULLONG_MAX
#endif
#define PWR_INT8_MAX SCHAR_MAX
#define PWR_INT8_MIN SCHAR_MIN
#define PWR_UINT8_MAX UCHAR_MAX
#define PWR_INT16_MAX SHRT_MAX
#define PWR_INT16_MIN SHRT_MIN
#define PWR_UINT16_MAX USHRT_MAX
#define PWR_INT32_MAX INT_MAX
#define PWR_INT32_MIN INT_MIN
#define PWR_UINT32_MAX UINT_MAX
#define PWR_ATTIME_MAX                                                         \
  {                                                                            \
    PWR_INT64MAX, 1000000000 - 1                                               \
  }
#define PWR_ATTIME_MIN                                                         \
  {                                                                            \
    0, 0                                                                       \
  }
#define PWR_DTTIME_MAX                                                         \
  {                                                                            \
    PWR_INT64MAX, 1000000000 - 1                                               \
  }
#define PWR_DTTIME_MIN                                                         \
  {                                                                            \
    PWR_INT64MIN, -(1000000000 - 1)                                            \
  }

UInt8


typedef unsigned char pwr_tUInt8; //!< 8-bit unsigned integer type.

UInt16


typedef unsigned short pwr_tUInt16; //!< 16-bit unsigned integer type.

UInt32


typedef unsigned int pwr_tUInt32; //!< 32-bit unsigned integer type.

VolumeId


typedef unsigned int pwr_tVid; //!< Volume identity type.
typedef pwr_tVid pwr_tVolumeId; //!< Volume identity type.
typedef unsigned int pwr_tAix; //!< Attribute index type.

ObjectIx


typedef unsigned int pwr_tOix; //!< Object index type.
typedef pwr_tOix pwr_tObjectIx; //!< Object index type.

Mask


typedef pwr_tUInt32 pwr_tMask; //!< Mask type.

Enum


typedef pwr_tInt32 pwr_tEnum; //!< Enumeration type.

Void


typedef void pwr_tVoid; //!< Void type.
//! Object identity type.

Objid


typedef struct {
  pwr_tOix oix;
  pwr_tVid vid;
} pwr_tOid;
typedef pwr_tOid pwr_tObjid; //!< Object identity type.
typedef pwr_tOid pwr_tObjDId;

ClassId


typedef unsigned int pwr_tCid; //!< Class identity type.
typedef pwr_tCid pwr_tClassId; //!< Class identity type.

TypeId


typedef unsigned int pwr_tTid; //!< Type identity type.
typedef pwr_tTid pwr_tTypeId; //!< Type identity type.

Status


typedef int pwr_tStatus; //!< Status type.

NetStatus


typedef int pwr_tNetStatus; //!< Network status type.
typedef unsigned int pwr_tGeneration;
typedef unsigned int pwr_tBid;
typedef unsigned int pwr_tVersion;
typedef unsigned int pwr_tPwrVersion;
typedef unsigned int pwr_tProjVersion;
typedef unsigned int pwr_tUserId;
typedef unsigned int pwr_tDbId;
typedef pwr_tVolumeId pwr_tNid; //!< Node identity type.
typedef pwr_tNid pwr_tNodeId; //!< Node identity type.
typedef pwr_tNid pwr_tNodeIndex; //!< Node index type.
typedef unsigned int pwr_tSid; //!< Server identity type.

RefId


typedef struct {
  pwr_tUInt32 rix;
  pwr_tNid nid;
} pwr_tRid; //!< Reference identity type.
typedef pwr_tRid pwr_tRefId; //!< Reference identity type.
typedef pwr_tRid pwr_tDlid; //!< Direct link identity type.
typedef pwr_tRid pwr_tSubid; //!< Subscription identity type.

Bix


//! Body index enumeration.
typedef enum {
  pwr_eBix__ = 0,
  pwr_eBix_sys = 1,
  pwr_eBix_rt = 1,
  pwr_eBix_dev = 2,
  pwr_eBix_template = 7,
  pwr_eBix_
} pwr_eBix;
//! Vax time.
typedef struct {
  int low;
  int high;
} pwr_tVaxTime;
//! Proview version type
typedef union {
  pwr_tPwrVersion i;
  //! Word representation
  struct {
#if (pwr_dHost_byteOrder == pwr_dLittleEndian)
    pwr_tChar Char;
    pwr_tUInt8 Major;
    pwr_tUInt8 Minor;
    pwr_tUInt8 Update;
#elif (pwr_dHost_byteOrder == pwr_dBigEndian)
    pwr_tUInt8 Update;
    pwr_tUInt8 Minor;
    pwr_tUInt8 Major;
    pwr_tChar Char;
#endif
  } s;
} pwr_uPwrVersion;

Time


// typedef struct timespec pwr_tTime;	//!< Abolute time type.
typedef struct {
  pwr_tInt64 tv_sec;
  pwr_tInt64 tv_nsec;
} pwr_tTime;
//! Delta time type.

DeltaTime


typedef struct {
  pwr_tInt64 tv_sec;
  pwr_tInt64 tv_nsec;
} pwr_tDeltaTime;

ObjName


typedef char pwr_tObjName[pwr_cSizObjName + 1]; //!< Object name type.

PgmName


typedef char pwr_tPgmName[pwr_cSizPgmName + 1]; //!< PgmName type.

XRef


typedef char pwr_tXRef[pwr_cSizXRef + 1]; //!< XRef type.

GraphName


typedef char pwr_tGraphName[pwr_cSizGraphName + 1]; //!< GraphName type.
typedef char pwr_tStructName[pwr_cSizStructName + 1]; //!< StructName type.
typedef char pwr_tAttrName[pwr_cSizAttrName + 1]; //!< AttrName type.
typedef char pwr_tPathName[pwr_cSizPathName + 1]; //!< PathName type.
typedef char pwr_tFullName[pwr_cSizFullName + 1]; //!< FullName type.
typedef char pwr_tOName[pwr_cSizOName + 1]; //!< Full Object Name type.
typedef char pwr_tAName[pwr_cSizAName + 1]; //!< Full Aref Name type.
typedef char pwr_tFileName[pwr_cSizFileName + 1]; //!< FileName type.
typedef char pwr_tCmd[pwr_cSizCmd + 1]; //!< Command string type.

String256


typedef char pwr_tString256[256]; //!< 256 byte string type.

String132


typedef char pwr_tString132[132]; //!< 132 byte string type.

String80


typedef char pwr_tString80[80]; //!< 80 byte string type.

String64


typedef char pwr_tString64[64]; //!< 64 byte string type.

String40


typedef char pwr_tString40[40]; //!< 40 byte string type.

String32


typedef char pwr_tString32[32]; //!< 32 byte string type.

String16


typedef char pwr_tString16[16]; //!< 16 byte string type.

String8


typedef char pwr_tString8[8]; //!< 8 byte string type.

String1


typedef char pwr_tString1[1]; //!< 1 byte string type.

ProString40


typedef char pwr_tProString40[40]; //!< 40 byte protected string type.

Text256


typedef char pwr_tText256[256]; //!< 256 byte text type.

Text1024


typedef char pwr_tText1024[1024]; //!< 1024 byte text type.

Text8192


typedef char pwr_tText8192[8192]; //!< 8192 byte text type.

URL


typedef char pwr_tURL[160]; //!< URL type.

CastId


typedef pwr_tTypeId pwr_tCastId; //!< CastId type.

DisableAttr


typedef unsigned int pwr_tDisableAttr; //!< DisableAttr type.

EmergBreakSelectEnum


typedef enum {
  pwr_eEmergBreakSelectEnum_NoAction = 0,
  pwr_eEmergBreakSelectEnum_Reboot = 1,
  pwr_eEmergBreakSelectEnum_FixedOutputValues = 2,
  pwr_eEmergBreakSelectEnum_StopIO = 3
} pwr_eEmergBreakSelectEnum;
typedef pwr_tEnum pwr_tEmergBreakSelectEnum; //!< Node attribute enum.

OpSysEnum


typedef pwr_tEnum pwr_tOpSysEnum; //!< Operating system enum.

OpSysMask


typedef pwr_tMask pwr_tOpSysMask; //!< Operating system Mask.

PopEditorEnum


typedef pwr_tEnum pwr_tPopEditorEnum; //!< Pop editor enum.

RefListFilterMask


typedef enum {
  pwr_mRefListFilterMask_CurrentVolume = 1,
  pwr_mRefListFilterMask_AllVolumes = 2,
  pwr_mRefListFilterMask_RootVolume = 4,
  pwr_mRefListFilterMask_SharedVolume = 8,
  pwr_mRefListFilterMask_Siblings = 16,
  pwr_mRefListFilterMask_AttrObjects = 32,
  pwr_mRefListFilterMask_PwrsVolume = 64,
  pwr_mRefListFilterMask_Other = 128,
  pwr_mRefListFilterMask_Children = 256
} pwr_mRefListFilterMask;
typedef pwr_tMask pwr_tRefListFilterMask; //!< Reference list filter Mask.

AttrRefFlag


//! Attribute reference flags type.
typedef union {
  pwr_tBitMask m;
  //! Bitmask representation.
  struct {
#if (pwr_dHost_byteOrder == pwr_dLittleEndian)
    pwr_tBit Indirect : 1;
    pwr_tBit Object : 1;
    pwr_tBit ObjectAttr : 1;
    pwr_tBit Array : 1;
    pwr_tBit Shadowed : 1;
    pwr_tBit CastAttr : 1;
    pwr_tBit DisableAttr : 1;
    pwr_tBit fill : 25;
#elif (pwr_dHost_byteOrder == pwr_dBigEndian)
    pwr_tBit fill : 25;
    pwr_tBit DisableAttr : 1;
    pwr_tBit CastAttr : 1;
    pwr_tBit Shadowed : 1;
    pwr_tBit Array : 1;
    pwr_tBit ObjectAttr : 1;
    pwr_tBit Object : 1;
    pwr_tBit Indirect : 1;
#endif
  } b;
#define pwr_mAttrRef_Indirect pwr_Bit(0)
#define pwr_mAttrRef_Object pwr_Bit(1)
#define pwr_mAttrRef_ObjectAttr pwr_Bit(2)
#define pwr_mAttrRef_Array pwr_Bit(3)
#define pwr_mAttrRef_Shadowed pwr_Bit(4)
#define pwr_mAttrRef_CastAttr pwr_Bit(5)
#define pwr_mAttrRef_DisableAttr pwr_Bit(6)
} pwr_mAttrRef;
//! Attribute reference.

AttrRef


typedef struct {
  pwr_tOid Objid; //!< Object identity.
  pwr_tCid Body; //!< Typeid of attribute, body or class.
  pwr_tUInt32 Offset; //!< Offset in body.
  pwr_tUInt32 Size; //!< Attribute size.
  pwr_mAttrRef Flags; //!< Attribute flags.
} pwr_sAttrRef;
typedef pwr_sAttrRef pwr_tAttrRef;

DataRef


typedef struct {
  pwr_tVoid* Ptr pwr_dAlignLW; //!< Private plc pointer to data object.
  pwr_tAttrRef Aref pwr_dAlignLW; //!< Attribute reference to data object.
} pwr_tDataRef;

Constants


//! Zero attribute reference constant.
static const pwr_sAttrRef pwr_cNAttrRef = { { 0, 0 }, 0, 0, 0, { 0 } };
static const pwr_tOid pwr_cNOid = { 0, 0 }; //!< Zero object identity constant.
static const pwr_tObjid pwr_cNObjid
    = { 0, 0 }; //!< Zero object identity constant.
static const pwr_tDlid pwr_cNRefId
    = { 0, 0 }; //!< Zero reference identity constant.
#define pwr_cNSubid pwr_cNRefId //!< Zero subscription identity constant.
#define pwr_cNDlid pwr_cNRefId //!< Zero direct link identity constant.
static const pwr_tOix pwr_cNOix = 0; //!< Zero object index constant.
static const pwr_tObjectIx pwr_cNObjectIx = 0; //!< Zero object index constant.
static const pwr_tClassId pwr_cNClassId = 0; //!< Zero class identity constant.
static const pwr_tTypeId pwr_cNTypeId = 0; //!< Zero type identity constant.
static const pwr_tCastId pwr_cNCastId = 0; //!< Zero cast identity constant.
static const pwr_tDisableAttr pwr_cNDisableAttr
    = 0; //!< Zero disable attribute constant.
static const pwr_tVolumeId pwr_cNVolumeId
    = 0; //!< Zero volume identity constant.
static const pwr_tNodeId pwr_cNNodeId = 0; //!< Zero node identity constant.
static const pwr_tCid pwr_cNCid = 0; //!< Zero class identity constant.
static const pwr_tTid pwr_cNTid = 0; //!< Zero type identity constant.
static const pwr_tVid pwr_cNVid = 0; //!< Zero volume identity constant.
static const pwr_tNid pwr_cNNid = 0; //!< Zero node identity constant.
static const pwr_tStatus pwr_cNStatus = 0; //!< Zero status constant.
static const pwr_tTime pwr_cNTime = { 0, 0 }; //!< Zero time constant.
static const pwr_tDeltaTime pwr_cNDeltaTime
    = { 0, 0 }; //!< Zero deltatime constant.
static const pwr_tDataRef pwr_cNDataRef = { 0, pwr_cNAttrRef };
static const pwr_tTime pwr_cNotATime = { 0, 1000000000 }; //!< Illegal time.
static const pwr_tDeltaTime pwr_cNotADeltaTime
    = { 0, 1000000000 }; //!< Illegal delta time.
static const pwr_tTime pwr_cAtMax = PWR_ATTIME_MAX;
static const pwr_tTime pwr_cAtMin = PWR_ATTIME_MIN;
static const pwr_tDeltaTime pwr_cDtMax = PWR_DTTIME_MAX;
static const pwr_tDeltaTime pwr_cDtMin = PWR_DTTIME_MIN;
/* Gereral macro definitions  */
#ifndef ODD
//! Check if value is odd
#define ODD(a) (((int)(a)&1) != 0)
#endif
#ifndef EVEN
//! Check if value is even
#define EVEN(a) (((int)(a)&1) == 0)
#endif
/* General definitions  */
#ifndef EQUAL
#define EQUAL 0
#endif
#ifndef ON
#define ON 1
#endif
#ifndef OFF
#define OFF 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef YES
#define YES 1
#endif
#ifndef NO
#define NO 0
#endif
#ifndef pwr_Offset
#define pwr_Offset(base, field)                                                \
  ((unsigned long)&((base)->field) - (unsigned long)(base))
#endif
#define pwr_Field(a, n) a n;
#define pwr_Bits(a, n) pwr_tBit a : n;
#if pwr_dHost_byteOrder == pwr_dLittleEndian
#define pwr_32Bits(a00, a01, a02, a03, a04, a05, a06, a07, a08, a09, a10, a11, \
                   a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, \
                   a24, a25, a26, a27, a28, a29, a30, a31)                     \
  struct {                                                                     \
    a00 a01 a02 a03 a04 a05 a06 a07 a08 a09 a10 a11 a12 a13 a14 a15 a16 a17    \
        a18 a19 a20 a21 a22 a23 a24 a25 a26 a27 a28 a29 a30 a31                \
  }
#define pwr_Endian_32(a00, a01, a02, a03, a04, a05, a06, a07, a08, a09, a10,   \
                      a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21,   \
                      a22, a23, a24, a25, a26, a27, a28, a29, a30, a31)        \
                                                                               \
  a00 a01 a02 a03 a04 a05 a06 a07 a08 a09 a10 a11 a12 a13 a14 a15 a16 a17 a18  \
      a19 a20 a21 a22 a23 a24 a25 a26 a27 a28 a29 a30 a31
#define pwr_Endian_16(a00, a01, a02, a03, a04, a05, a06, a07, a08, a09, a10,   \
                      a11, a12, a13, a14, a15)                                 \
                                                                               \
  a00 a01 a02 a03 a04 a05 a06 a07 a08 a09 a10 a11 a12 a13 a14 a15
#define pwr_Endian_8(a00, a01, a02, a03, a04, a05, a06, a07)                   \
  a00 a01 a02 a03 a04 a05 a06 a07
#define pwr_Endian_4(a00, a01, a02, a03) a00 a01 a02 a03
#elif pwr_dHost_byteOrder == pwr_dBigEndian
#define pwr_32Bits(a00, a01, a02, a03, a04, a05, a06, a07, a08, a09, a10, a11, \
                   a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, \
                   a24, a25, a26, a27, a28, a29, a30, a31)                     \
  struct {                                                                     \
    a31 a30 a29 a28 a27 a26 a25 a24 a23 a22 a21 a20 a19 a18 a17 a16 a15 a14    \
        a13 a12 a11 a10 a09 a08 a07 a06 a05 a04 a03 a02 a01 a00                \
  }
#define pwr_Endian_32(a00, a01, a02, a03, a04, a05, a06, a07, a08, a09, a10,   \
                      a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21,   \
                      a22, a23, a24, a25, a26, a27, a28, a29, a30, a31)        \
                                                                               \
  a31 a30 a29 a28 a27 a26 a25 a24 a23 a22 a21 a20 a19 a18 a17 a16 a15 a14 a13  \
      a12 a11 a10 a09 a08 a07 a06 a05 a04 a03 a02 a01 a00
#define pwr_Endian_16(a00, a01, a02, a03, a04, a05, a06, a07, a08, a09, a10,   \
                      a11, a12, a13, a14, a15)                                 \
                                                                               \
  a15 a14 a13 a12 a11 a10 a09 a08 a07 a06 a05 a04 a03 a02 a01 a00
#define pwr_Endian_8(a00, a01, a02, a03, a04, a05, a06, a07)                   \
  a07 a06 a05 a04 a03 a02 a01 a00
#define pwr_Endian_4(a00, a01, a02, a03) a03 a02 a01 a00
#endif
#ifndef pwr_dStatus
#define pwr_dStatus(sts, status, ists)                                         \
  pwr_tStatus pwr__sts_;                                                       \
  pwr_tStatus* sts = (status == NULL) ? &pwr__sts_ : status;                   \
  *sts = ists
#endif
#ifndef pwr_Status
#define pwr_Status(sts, lsts) ((void*)(sts) ? ((*sts) = (lsts)) : (lsts))
#endif
#ifndef pwr_StatusBreak
#define pwr_StatusBreak(a, b)                                                  \
  {                                                                            \
    a = b;                                                                     \
    break;                                                                     \
  }
#endif
#ifndef pwr_Return
#define pwr_Return(a, sts, lsts)                                               \
  return (((void*)(sts) ? (*sts) = (lsts) : lsts), a)
#endif
#ifndef pwr_ReturnVoid
#define pwr_ReturnVoid(sts, lsts)                                              \
  {                                                                            \
    ((void*)(sts) ? (*sts) = (lsts) : lsts);                                   \
    return;                                                                    \
  }
#endif
#ifdef PWR_NDEBUG
#define pwr_Assert(a) ((void)0)
#else
#define pwr_Assert(a)                                                          \
  ((a) ? (void)0 : (void)(printf("pwr assertion (%s) failed,\n    in file "    \
                                 "%s, at line %d\n",                           \
                              #a, __FILE__, __LINE__),                         \
                       exit(EXIT_FAILURE)))
#endif
#if defined HW_X86_64
#define pwr_dFormatUInt64 "%lu"
#define pwr_dFormatInt64 "%ld"
#define pwr_dFormatHexInt64 "%lx"
#define pwr_dFormatOctInt64 "%lo"
#else
#define pwr_dFormatUInt64 "%llu"
#define pwr_dFormatInt64 "%lld"
#define pwr_dFormatHexInt64 "%llx"
#define pwr_dFormatOctInt64 "%llo"
#endif
/*@}*/
#if defined __cplusplus
}
#endif
#endif