⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ss_pack.c

📁 中国石油二期加油站IC系统后台通讯软件
💻 C
📖 第 1 页 / 共 2 页
字号:
        SSLOGERROR(ERRCLS_ADD_RES, ESS373, (ErrVal)ret, "SAddPreMsgMult() failed");
#endif
    RETVALUE(ret);
} /* end of SPkU32 */

  
/*
*
*       Fun:   SUnpkS8
*
*       Desc:  This function unpacks a signed 8 bit value from a message.
*
*       Ret:   ROK      - ok
*
*       Notes: None
*
*       File:  ss_pack.c
*
*/

#ifdef ANSI
PUBLIC S16 SUnpkS8
(
S8 *val,                    /* pointer to value */
Buffer *mBuf                /* message buffer */
)
#else
PUBLIC S16 SUnpkS8(val, mBuf)
S8 *val;                    /* pointer to value */
Buffer *mBuf;               /* message buffer */
#endif
{
    Data tmp;                /* temporary value */
    S16 ret;                 /* return code */
    TRC1(SUnpkS8)
    ret = SRemPreMsg(&tmp, mBuf);
#if (ERRCLASS & ERRCLS_DEBUG)
    if (ret != ROK)
        SSLOGERROR(ERRCLS_DEBUG, ESS374, (ErrVal)ret, "SRemPreMsg() failed");
#endif
    *val = (S8) tmp;
    RETVALUE(ret);
} /* end of SUnpkS8 */

  
/*
*
*       Fun:   SUnpkU8
*
*       Desc:  This function unpacks an unsigned 8 bit value from a message.
*
*       Ret:   ROK      - ok
*
*       Notes: None
*
*       File:  ss_pack.c
*
*/

#ifdef ANSI
PUBLIC S16 SUnpkU8
(
U8 *val,                    /* pointer to value */
Buffer *mBuf                /* message buffer */
)
#else
PUBLIC S16 SUnpkU8(val, mBuf)
U8 *val;                    /* pointer to value */
Buffer *mBuf;               /* message buffer */
#endif
{
    Data tmp;                /* temporary value */
    S16 ret;                 /* return code */
    TRC1(SUnpkU8)
    ret = SRemPreMsg(&tmp, mBuf);
#if (ERRCLASS & ERRCLS_DEBUG)
    if (ret != ROK)
        SSLOGERROR(ERRCLS_DEBUG, ESS375, (ErrVal)ret, "SRemPreMsg() failed");
#endif
    *val = (U8) tmp;
    RETVALUE(ret);
} /* end of SUnpkU8 */
  
/*
*
*       Fun:   SUnpkS16
*
*       Desc:  This function unpacks a signed 16 bit value from a message.
*
*       Ret:   ROK      - ok
*
*       Notes: None
*
*       File:  ss_pack.c
*
*/

#ifdef ANSI
PUBLIC S16 SUnpkS16
(
S16 *val,                   /* pointer to value */
Buffer *mBuf                /* message buffer */
)
#else
PUBLIC S16 SUnpkS16(val, mBuf)
S16 *val;                   /* pointer to value */
Buffer *mBuf;               /* message buffer */
#endif
{
    U16 tmp16;               /* temporary value */
    Data unpkArray[2];       /* unpacking array */
    S16 ret;                 /* return code */
    TRC1(SUnpkS16)
    ret = SRemPreMsgMult(unpkArray, (MsgLen) 2, mBuf);
#if (ERRCLASS & ERRCLS_DEBUG)
    if (ret != ROK)
        SSLOGERROR(ERRCLS_DEBUG, ESS376, (ErrVal)ret, "SRemPreMsgMult() failed");
#endif
    tmp16 = 0; 
#ifndef FCSPKINT            /* backward compatibility, packing order */
    tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[1]);
    tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[0]);
#else                       /* forward compatibility, packing order */
    tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[0]);
    tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[1]);
#endif
    *val = (S16) tmp16;
    RETVALUE(ret);
} /* end of SUnpkS16 */

  
/*
*
*       Fun:   SUnpkU16
*
*       Desc:  This function unpacks an unsigned 16 bit value from a message.
*
*       Ret:   ROK      - ok
*
*       Notes: None
*
*       File:  ss_pack.c
*
*/

#ifdef ANSI
PUBLIC S16 SUnpkU16
(
U16 *val,                   /* pointer to value */
Buffer *mBuf                /* message buffer */
)
#else
PUBLIC S16 SUnpkU16(val, mBuf)
U16 *val;                   /* pointer to value */
Buffer *mBuf;               /* message buffer */
#endif
{
    U16 tmp16;               /* temporary value */
    Data unpkArray[2];       /* unpacking array */
    S16 ret;                 /* return code */
    TRC1(SUnpkU16)
    ret = SRemPreMsgMult(unpkArray, (MsgLen) 2, mBuf);
#if (ERRCLASS & ERRCLS_DEBUG)
    if (ret != ROK)
        SSLOGERROR(ERRCLS_DEBUG, ESS377, (ErrVal)ret, "SRemPreMsgMult failed");
#endif
    tmp16 = 0; 
#ifndef FCSPKINT            /* backward compatibility, packing order */
    tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[1]);
    tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[0]);
#else                       /* forward compatibility, packing order */
    tmp16 = (U16) PutHiByte(tmp16, (U8) unpkArray[0]);
    tmp16 = (U16) PutLoByte(tmp16, (U8) unpkArray[1]);
#endif
    *val = tmp16;
    RETVALUE(ret);
} /* end of SUnpkU16 */

  
/*
*
*       Fun:   SUnpkS32
*
*       Desc:  This function unpacks a signed 32 bit value from a message.
*
*       Ret:   ROK      - ok
*
*       Notes: None
*
*       File:  ss_pack.c
*
*/

#ifdef ANSI
PUBLIC S16 SUnpkS32
(
S32 *val,                   /* pointer to value */
Buffer *mBuf                /* message buffer */
)
#else
PUBLIC S16 SUnpkS32(val, mBuf)
S32 *val;                   /* pointer to value */
Buffer *mBuf;               /* message buffer */
#endif
{
    U16 tmp16;               /* temporary value */
    U32 tmp32;               /* temporary value */
    Data unpkArray[4];       /* unpacking array */
    S16 ret;                 /* return code */
    TRC1(SUnpkS32)
    ret = SRemPreMsgMult(unpkArray, (MsgLen) 4, mBuf);
#if (ERRCLASS & ERRCLS_DEBUG)
    if (ret != ROK)
        SSLOGERROR(ERRCLS_DEBUG, ESS378, (ErrVal)ret, "SRemPreMsgMult() failed");
#endif
    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);
#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);
#endif
    *val = (S32) tmp32;
    RETVALUE(ret);
} /* end of SUnpkS32 */

  
/*
*
*       Fun:   SUnpkU32
*
*       Desc:  This function unpacks an unsigned 32 bit value from a message.
*
*       Ret:   ROK      - ok
*
*       Notes: None
*
*       File:  ss_pack.c
*
*/

#ifdef ANSI
PUBLIC S16 SUnpkU32
(
U32 *val,                   /* pointer to value */
Buffer *mBuf                /* message buffer */
)
#else
PUBLIC S16 SUnpkU32(val, mBuf)
U32 *val;                   /* pointer to value */
Buffer *mBuf;               /* message buffer */
#endif
{
    U16 tmp16;               /* temporary value */
    U32 tmp32;               /* temporary value */
    Data unpkArray[4];       /* unpacking array */
#ifdef ERRCLASS
    S16 ret;                 /* return code */
#endif /* ERRCLASS */
    TRC1(SUnpkU32)

    ret = SRemPreMsgMult(unpkArray, (MsgLen) 4, mBuf);
#if (ERRCLASS & ERRCLS_DEBUG)
    if (ret != ROK)
        SSLOGERROR(ERRCLS_DEBUG, ESS379, (ErrVal)ret, "SRemPreMsgMult() failed");
#endif

    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);
#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);
#endif
    *val = tmp32;
    RETVALUE(ret);
} /* end of SUnpkU32 */



/********************************************************************30**
  
         End of file: ss_pack.c 1.2  -  08/10/98 18:43:22
  
*********************************************************************31*/

  
/********************************************************************40**
  
        Notes: 
  
*********************************************************************41*/

/********************************************************************50**

*********************************************************************51*/

   
/********************************************************************60**
  
        Revision history:
  
*********************************************************************61*/

/********************************************************************90**
 
     ver       pat    init                  description
------------ -------- ---- ----------------------------------------------
1.1          ---      kp   1. initial release

1.2          ---      bsr  1. Regenerated the error codes

*********************************************************************91*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -