U8, U16, U32 data type changes
[o-du/l2.git] / src / mt / ss_pack.c
index 283e984..b998e5d 100644 (file)
 */
 
 #ifdef ANSI
-PUBLIC S16 SPkS8
+S16 SPkS8
 (
 S8 val,                     /* value */
 Buffer *mBuf                /* message buffer */
 )
 #else
-PUBLIC S16 SPkS8(val, mBuf)
+S16 SPkS8(val, mBuf)
 S8 val;                     /* value */
 Buffer *mBuf;               /* message buffer */
 #endif
 {
    S16 ret;                 /* return code */
-   TRC1(SPkS8)
    ret = SAddPreMsg((Data) val, mBuf);
 #if (ERRCLASS & ERRCLS_ADD_RES)
    if (ret != ROK)
@@ -129,19 +128,18 @@ Buffer *mBuf;               /* message buffer */
 */
   
 #ifdef ANSI
-PUBLIC S16 oduUnpackUInt8
+S16 oduUnpackUInt8
 (
-U8 val,                     /* value */
+uint8_t val,                     /* value */
 Buffer *mBuf                /* message buffer */
 )
 #else
-PUBLIC S16 oduUnpackUInt8(val, mBuf)
-U8 val;                     /* value */
+S16 oduUnpackUInt8(val, mBuf)
+uint8_t val;                     /* value */
 Buffer *mBuf;               /* message buffer */
 #endif
 {
    S16 ret;                 /* return code */
-   TRC1(oduUnpackUInt8)
    ret = SAddPreMsg((Data) val, mBuf);
 #if (ERRCLASS & ERRCLS_ADD_RES)
    if (ret != ROK)
@@ -167,13 +165,13 @@ Buffer *mBuf;               /* message buffer */
 */
   
 #ifdef ANSI
-PUBLIC S16 SPkS16
+S16 SPkS16
 (
 S16 val,                    /* value */
 Buffer *mBuf                /* message buffer */
 )
 #else
-PUBLIC S16 SPkS16(val, mBuf)
+S16 SPkS16(val, mBuf)
 S16 val;                    /* value */
 Buffer *mBuf;               /* message buffer */
 #endif
@@ -181,7 +179,6 @@ Buffer *mBuf;               /* message buffer */
    Data pkArray[2];         /* array for packing */
    S16 ret;                 /* return code */
 
-   TRC1(SPkS16)
 #ifndef FCSPKINT            /* backward compatibility, packing order */
    pkArray[0] = (Data) GetHiByte(val);
    pkArray[1] = (Data) GetLoByte(val);
@@ -215,21 +212,20 @@ Buffer *mBuf;               /* message buffer */
 */
   
 #ifdef ANSI
-PUBLIC S16 oduUnpackUInt16
+S16 oduUnpackUInt16
 (
-U16 val,                    /* value */
+uint16_t val,                    /* value */
 Buffer *mBuf                /* message buffer */
 )
 #else
-PUBLIC S16 oduUnpackUInt16(val, mBuf)
-U16 val;                    /* value */
+S16 oduUnpackUInt16(val, mBuf)
+uint16_t val;                    /* value */
 Buffer *mBuf;               /* message buffer */
 #endif
 {
    Data pkArray[2];         /* array for packing */
    S16 ret;                 /* return code */
 
-   TRC1(oduUnpackUInt16)
 #ifndef FCSPKINT            /* backward compatibility, packing order */
    pkArray[0] = (Data) GetHiByte(val);
    pkArray[1] = (Data) GetLoByte(val);
@@ -263,34 +259,33 @@ Buffer *mBuf;               /* message buffer */
 */
   
 #ifdef ANSI
-PUBLIC S16 SPkS32
+S16 SPkS32
 (
 S32 val,                    /* value */
 Buffer *mBuf                /* message buffer */
 )
 #else
-PUBLIC S16 SPkS32(val, mBuf)
+S16 SPkS32(val, mBuf)
 S32 val;                    /* value */
 Buffer *mBuf;               /* message buffer */
 #endif
 {
-   U16 tmp;                 /* temporary value */
+   uint16_t tmp;                 /* temporary value */
    Data pkArray[4];         /* packing array */
    S16 ret;                 /* return code */
   
-   TRC1(SPkS32)
 #ifndef FCSPKINT        /* backward compatibility, packing order */
-   tmp = (U16) GetHiWord(val);
+   tmp = (uint16_t) GetHiWord(val);
    pkArray[0] = (Data) GetHiByte(tmp);
    pkArray[1] = (Data) GetLoByte(tmp);
-   tmp = (U16) GetLoWord(val);
+   tmp = (uint16_t) GetLoWord(val);
    pkArray[2] = (Data) GetHiByte(tmp);
    pkArray[3] = (Data) GetLoByte(tmp);
 #else                   /* forward compatibility, packing order */
-   tmp = (U16) GetHiWord(val);
+   tmp = (uint16_t) GetHiWord(val);
    pkArray[3] = (Data) GetHiByte(tmp);
    pkArray[2] = (Data) GetLoByte(tmp);
-   tmp = (U16) GetLoWord(val);
+   tmp = (uint16_t) GetLoWord(val);
    pkArray[1] = (Data) GetHiByte(tmp);
    pkArray[0] = (Data) GetLoByte(tmp);
 #endif
@@ -320,34 +315,33 @@ Buffer *mBuf;               /* message buffer */
 */
   
 #ifdef ANSI
-PUBLIC S16 oduUnpackUInt32
+S16 oduUnpackUInt32
 (
-U32 val,                    /* value */
+uint32_t val,                    /* value */
 Buffer *mBuf                /* message buffer */
 )
 #else
-PUBLIC S16 oduUnpackUInt32(val, mBuf)
-U32 val;                    /* value */
+S16 oduUnpackUInt32(val, mBuf)
+uint32_t val;                    /* value */
 Buffer *mBuf;               /* message buffer */
 #endif
 {
-   U16 tmp;                 /* temporary value */
+   uint16_t tmp;                 /* temporary value */
    Data pkArray[4];         /* packing array */
    S16 ret;                 /* return code */
   
-   TRC1(oduUnpackUInt32)
 #ifndef FCSPKINT        /* backward compatibility, packing order */
-   tmp = (U16) GetHiWord(val);
+   tmp = (uint16_t) GetHiWord(val);
    pkArray[0] = (Data) GetHiByte(tmp);
    pkArray[1] = (Data) GetLoByte(tmp);
-   tmp = (U16) GetLoWord(val);
+   tmp = (uint16_t) GetLoWord(val);
    pkArray[2] = (Data) GetHiByte(tmp);
    pkArray[3] = (Data) GetLoByte(tmp);
 #else                   /* forward compatibility, packing order */
-   tmp = (U16) GetHiWord(val);
+   tmp = (uint16_t) GetHiWord(val);
    pkArray[3] = (Data) GetHiByte(tmp);
    pkArray[2] = (Data) GetLoByte(tmp);
-   tmp = (U16) GetLoWord(val);
+   tmp = (uint16_t) GetLoWord(val);
    pkArray[1] = (Data) GetHiByte(tmp);
    pkArray[0] = (Data) GetLoByte(tmp);
 #endif
@@ -378,13 +372,13 @@ Buffer *mBuf;               /* message buffer */
 */
   
 #ifdef ANSI
-PUBLIC S16 SPkF32
+S16 SPkF32
 (
 F32 val,                    /* value */
 Buffer *mBuf                /* message buffer */
 )
 #else
-PUBLIC S16 SPkF32(val, mBuf)
+S16 SPkF32(val, mBuf)
 F32 val;                    /* value */
 Buffer *mBuf;               /* message buffer */
 #endif
@@ -397,8 +391,6 @@ Buffer *mBuf;               /* message buffer */
    S8   pkArray[15];        /* packing array */
 #endif /*FCSPKINT*/
   
-   TRC1(SPkF32)
-
    sprintf(tmpArray, "%.7e", val);
 
 #ifndef FCSPKINT            /* backward compatibility, packing order */
@@ -437,13 +429,13 @@ Buffer *mBuf;               /* message buffer */
 */
   
 #ifdef ANSI
-PUBLIC S16 SPkF64
+S16 SPkF64
 (
 F64 val,                    /* value */
 Buffer *mBuf                /* message buffer */
 )
 #else
-PUBLIC S16 SPkF64(val, mBuf)
+S16 SPkF64(val, mBuf)
 F64 val;                    /* value */
 Buffer *mBuf;               /* message buffer */
 #endif
@@ -457,8 +449,6 @@ Buffer *mBuf;               /* message buffer */
    S8   pkArray[25];        /* packing array */
 #endif /*FCSPKINT*/
   
-   TRC1(SPkF64)
-
    sprintf(tmpArray, "%.16le", val);
 
 #ifndef FCSPKINT            /* backward compatibility, packing order */
@@ -497,20 +487,19 @@ Buffer *mBuf;               /* message buffer */
 */
   
 #ifdef ANSI
-PUBLIC S16 SUnpkS8
+S16 SUnpkS8
 (
 S8 *val,                    /* pointer to value */
 Buffer *mBuf                /* message buffer */
 )
 #else
-PUBLIC S16 SUnpkS8(val, mBuf)
+S16 SUnpkS8(val, mBuf)
 S8 *val;                    /* pointer to value */
 Buffer *mBuf;               /* message buffer */
 #endif
 {
    Data tmp;                /* temporary value */
    S16 ret;                 /* return code */
-   TRC1(SUnpkS8)
 
 /* ss021.103 - Addition of data pointer check */
 #if (ERRCLASS & ERRCLS_INT_PAR)
@@ -547,20 +536,19 @@ Buffer *mBuf;               /* message buffer */
 */
   
 #ifdef ANSI
-PUBLIC S16 oduPackUInt8
+S16 oduPackUInt8
 (
-U8 *val,                    /* pointer to value */
+uint8_t *val,                    /* pointer to value */
 Buffer *mBuf                /* message buffer */
 )
 #else
-PUBLIC S16 oduPackUInt8(val, mBuf)
-U8 *val;                    /* pointer to value */
+S16 oduPackUInt8(val, mBuf)
+uint8_t *val;                    /* pointer to value */
 Buffer *mBuf;               /* message buffer */
 #endif
 {
    Data tmp;                /* temporary value */
    S16 ret;                 /* return code */
-   TRC1(oduPackUInt8)
 
 /* ss021.103 - Addition of data pointer check */
 #if (ERRCLASS & ERRCLS_INT_PAR)
@@ -577,7 +565,7 @@ Buffer *mBuf;               /* message buffer */
    if (ret != ROK)
       SSLOGERROR(ERRCLS_DEBUG, ESS253, (ErrVal)ret, "SRemPreMsg() failed");
 #endif
-   *val = (U8) tmp;
+   *val = (uint8_t) tmp;
    return (ret);
 } /* end of oduPackUInt8 */
 \f  
@@ -596,21 +584,20 @@ Buffer *mBuf;               /* message buffer */
 */
   
 #ifdef ANSI
-PUBLIC S16 SUnpkS16
+S16 SUnpkS16
 (
 S16 *val,                   /* pointer to value */
 Buffer *mBuf                /* message buffer */
 )
 #else
-PUBLIC S16 SUnpkS16(val, mBuf)
+S16 SUnpkS16(val, mBuf)
 S16 *val;                   /* pointer to value */
 Buffer *mBuf;               /* message buffer */
 #endif
 {
-   U16 tmp16;               /* temporary value */
+   uint16_t tmp16;               /* temporary value */
    Data unpkArray[2];       /* unpacking array */
    S16 ret;                 /* return code */
-   TRC1(SUnpkS16)
 
 /* ss021.103 - Addition of data pointer check */
 #if (ERRCLASS & ERRCLS_INT_PAR)
@@ -629,11 +616,11 @@ Buffer *mBuf;               /* message buffer */
 #endif
    tmp16 = 0; 
 #ifndef FCSPKINT            /* backward compatibility, packing order */
-   tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[1]);
-   tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[0]);
+   tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[1]);
+   tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[0]);
 #else                       /* forward compatibility, packing order */
-   tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[0]);
-   tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[1]);
+   tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[0]);
+   tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[1]);
 #endif
    *val = (S16) tmp16;
    return (ret);
@@ -655,21 +642,20 @@ Buffer *mBuf;               /* message buffer */
 */
   
 #ifdef ANSI
-PUBLIC S16 oduPackUInt16
+S16 oduPackUInt16
 (
-U16 *val,                   /* pointer to value */
+uint16_t *val,                   /* pointer to value */
 Buffer *mBuf                /* message buffer */
 )
 #else
-PUBLIC S16 oduPackUInt16(val, mBuf)
-U16 *val;                   /* pointer to value */
+S16 oduPackUInt16(val, mBuf)
+uint16_t *val;                   /* pointer to value */
 Buffer *mBuf;               /* message buffer */
 #endif
 {
-   U16 tmp16;               /* temporary value */
+   uint16_t tmp16;               /* temporary value */
    Data unpkArray[2];       /* unpacking array */
    S16 ret;                 /* return code */
-   TRC1(oduPackUInt16)
 
 /* ss021.103 - Addition of data pointer check */
 #if (ERRCLASS & ERRCLS_INT_PAR)
@@ -688,11 +674,11 @@ Buffer *mBuf;               /* message buffer */
 #endif
    tmp16 = 0; 
 #ifndef FCSPKINT            /* backward compatibility, packing order */
-   tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[1]);
-   tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[0]);
+   tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[1]);
+   tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[0]);
 #else                       /* forward compatibility, packing order */
-   tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[0]);
-   tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[1]);
+   tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[0]);
+   tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[1]);
 #endif
    *val = tmp16;
    return (ret);
@@ -714,22 +700,21 @@ Buffer *mBuf;               /* message buffer */
 */
   
 #ifdef ANSI
-PUBLIC S16 SUnpkS32
+S16 SUnpkS32
 (
 S32 *val,                   /* pointer to value */
 Buffer *mBuf                /* message buffer */
 )
 #else
-PUBLIC S16 SUnpkS32(val, mBuf)
+S16 SUnpkS32(val, mBuf)
 S32 *val;                   /* pointer to value */
 Buffer *mBuf;               /* message buffer */
 #endif
 {
-   U16 tmp16;               /* temporary value */
-   U32 tmp32;               /* temporary value */
+   uint16_t tmp16;               /* temporary value */
+   uint32_t tmp32;               /* temporary value */
    Data unpkArray[4];       /* unpacking array */
    S16 ret;                 /* return code */
-   TRC1(SUnpkS32)
 
 /* ss021.103 - Addition of data pointer check */
 #if (ERRCLASS & ERRCLS_INT_PAR)
@@ -749,19 +734,19 @@ Buffer *mBuf;               /* message buffer */
    tmp16 = 0;
    tmp32 = 0; 
 #ifndef FCSPKINT            /* backward compatibility, packing order */
-   tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[3]);
-   tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[2]);
-   tmp32 = (U32) PutHiWord(tmp32, (U16) tmp16);
-   tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[1]);
-   tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[0]);
-   tmp32 = (U32) PutLoWord(tmp32, (U16) tmp16);
+   tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[3]);
+   tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[2]);
+   tmp32 = (uint32_t) PutHiWord(tmp32, (uint16_t) tmp16);
+   tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[1]);
+   tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[0]);
+   tmp32 = (uint32_t) PutLoWord(tmp32, (uint16_t) tmp16);
 #else                       /* forward compatibility, packing order */
-   tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[0]);
-   tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[1]);
-   tmp32 = (U32) PutHiWord(tmp32, (U16) tmp16);
-   tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[2]);
-   tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[3]);
-   tmp32 = (U32) PutLoWord(tmp32, (U16) tmp16);
+   tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[0]);
+   tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[1]);
+   tmp32 = (uint32_t) PutHiWord(tmp32, (uint16_t) tmp16);
+   tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[2]);
+   tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[3]);
+   tmp32 = (uint32_t) PutLoWord(tmp32, (uint16_t) tmp16);
 #endif
    *val = (S32) tmp32;
    return (ret);
@@ -783,24 +768,23 @@ Buffer *mBuf;               /* message buffer */
 */
   
 #ifdef ANSI
-PUBLIC S16 oduPackUInt32
+S16 oduPackUInt32
 (
-U32 *val,                   /* pointer to value */
+uint32_t *val,                   /* pointer to value */
 Buffer *mBuf                /* message buffer */
 )
 #else
-PUBLIC S16 oduPackUInt32(val, mBuf)
-U32 *val;                   /* pointer to value */
+S16 oduPackUInt32(val, mBuf)
+uint32_t *val;                   /* pointer to value */
 Buffer *mBuf;               /* message buffer */
 #endif
 {
-   U16 tmp16;               /* temporary value */
-   U32 tmp32;               /* temporary value */
+   uint16_t tmp16;               /* temporary value */
+   uint32_t tmp32;               /* temporary value */
    Data unpkArray[4];       /* unpacking array */
 #ifdef ERRCLASS
    S16 ret;                 /* return code */
 #endif /* ERRCLASS */
-   TRC1(oduPackUInt32)
 
 /* ss021.103 - Addition of data pointer check */
 #if (ERRCLASS & ERRCLS_INT_PAR)
@@ -821,19 +805,19 @@ Buffer *mBuf;               /* message buffer */
    tmp16 = 0;
    tmp32 = 0; 
 #ifndef FCSPKINT            /* backward compatibility, packing order */
-   tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[3]);
-   tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[2]);
-   tmp32 = (U32) PutHiWord(tmp32, (U16) tmp16);
-   tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[1]);
-   tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[0]);
-   tmp32 = (U32) PutLoWord(tmp32, (U16) tmp16);
+   tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[3]);
+   tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[2]);
+   tmp32 = (uint32_t) PutHiWord(tmp32, (uint16_t) tmp16);
+   tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[1]);
+   tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[0]);
+   tmp32 = (uint32_t) PutLoWord(tmp32, (uint16_t) tmp16);
 #else                       /* forward compatibility, packing order */
-   tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[0]);
-   tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[1]);
-   tmp32 = (U32) PutHiWord(tmp32, (U16) tmp16);
-   tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[2]);
-   tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[3]);
-   tmp32 = (U32) PutLoWord(tmp32, (U16) tmp16);
+   tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[0]);
+   tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[1]);
+   tmp32 = (uint32_t) PutHiWord(tmp32, (uint16_t) tmp16);
+   tmp16 = (uint16_t) PutHiByte(tmp16, (uint8_t) unpkArray[2]);
+   tmp16 = (uint16_t) PutLoByte(tmp16, (uint8_t) unpkArray[3]);
+   tmp32 = (uint32_t) PutLoWord(tmp32, (uint16_t) tmp16);
 #endif
    *val = tmp32;
    return (ret);
@@ -856,13 +840,13 @@ Buffer *mBuf;               /* message buffer */
 */
   
 #ifdef ANSI
-PUBLIC S16 SUnpkF32
+S16 SUnpkF32
 (
 F32 *val,                   /* pointer to value */
 Buffer *mBuf                /* message buffer */
 )
 #else
-PUBLIC S16 SUnpkF32(val, mBuf)
+S16 SUnpkF32(val, mBuf)
 F32 *val;                   /* pointer to value */
 Buffer *mBuf;               /* message buffer */
 #endif
@@ -875,8 +859,6 @@ Buffer *mBuf;               /* message buffer */
    S8 unpkArray[15];        /* unpacking array */
 #endif /* FCSPKINT */
 
-   TRC1(SUnpkF32)
-
 #if (ERRCLASS & ERRCLS_INT_PAR)
    /* check data pointer */
    if (!val)
@@ -922,13 +904,13 @@ Buffer *mBuf;               /* message buffer */
 */
   
 #ifdef ANSI
-PUBLIC S16 SUnpkF64
+S16 SUnpkF64
 (
 F64 *val,                   /* pointer to value */
 Buffer *mBuf                /* message buffer */
 )
 #else
-PUBLIC S16 SUnpkF64(val, mBuf)
+S16 SUnpkF64(val, mBuf)
 F64 *val;                   /* pointer to value */
 Buffer *mBuf;               /* message buffer */
 #endif
@@ -942,8 +924,6 @@ Buffer *mBuf;               /* message buffer */
    S8 unpkArray[25];        /* unpacking array */
 #endif /* FCSPKINT */
 
-   TRC1(SUnpkF64)
-
 #if (ERRCLASS & ERRCLS_INT_PAR)
    /* check data pointer */
    if (!val)