📄 ospbfr.h
字号:
/**########################################################################*########################################################################*########################################################################* * COPYRIGHT (c) 1998, 1999 by TransNexus, LLC * * This software contains proprietary and confidential information * of TransNexus, LLC. Except as may be set forth in the license * agreement under which this software is supplied, use, disclosure, * or reproduction is prohibited without the prior, express, written* consent of TransNexus, LLC. * *******#########################################################################*#########################################################################*#########################################################################*//* * ospbfr.h - Structures and prototypes for TransNexus message buffers. * These should replaced by native buffer management routines, * and, therefore, are optimized for readability rather than * performance. Suggested optimizations are noted, though, * in case native buffer management is not available. * * See ospbfr.c for multi-threaded implications. */#ifndef _OSPBFR_H#define _OSPBFR_H#include "ospossys.h"typedef struct{ unsigned char *ospmBfrGuard; /* to detect invalid pointers */ unsigned char *ospmBfrEnd; /* end of message buffer */ unsigned char *ospmBfrRead; /* current read position */ unsigned char *ospmBfrWrite; /* current write position */ /* be sure structure ends on aligned byte boundary */}OSPTBFR;/**//*-----------------------------------------------------------------------*//* macros that emulate functions *//*-----------------------------------------------------------------------*//* * Note: all macros are also implemented as functions in ospbfr.c. For * implementation details, see the comments in that file. To replace a * macro with a true function, simply comment out the macro definition * below. */#ifndef OSPC_DEBUG#define OSPPBfrLinearPtr(ospvBfr) ((ospvBfr)->ospmBfrRead)#define OSPPBfrSize(ospvBfr) \ ((ospvBfr)->ospmBfrWrite - (ospvBfr)->ospmBfrRead)#define OSPPBfrReadByte(ospvBfr) \ (OSPPBfrSize(ospvBfr) > 0 ? *((ospvBfr)->ospmBfrRead)++ : (-1) )#define OSPPBfrPeekByte(ospvBfr) \ (OSPPBfrSize(ospvBfr) > 0 ? *((ospvBfr)->ospmBfrRead) : (-1) )#define OSPPBfrPeekByteN(ospvBfr, ospvCnt) \ ((unsigned)OSPPBfrSize(ospvBfr) > (ospvCnt) ? \ *(OSPPBfrLinearPtr(ospvBfr)+(ospvCnt)) : (-1) )#define OSPPBfrDelete(ospvBfr) OSPM_FREE(*ospvBfr); *ospvBfr = OSPC_OSNULL;#endif#ifdef __cplusplusextern "C" {#endif /**/ /*-----------------------------------------------------------------------*/ /* function prototypes */ /*-----------------------------------------------------------------------*/ OSPTBFR *OSPPBfrNew(unsigned); unsigned OSPPBfrWriteByte(OSPTBFR **, unsigned char ); unsigned OSPPBfrWriteBlock(OSPTBFR **, const void *, unsigned ); unsigned OSPPBfrReadBlock(OSPTBFR **, void *, unsigned ); void OSPPBfrClear(OSPTBFR *);#ifdef OSPC_DEBUG void *OSPPBfrLinearPtr(OSPTBFR *); unsigned OSPPBfrSize(OSPTBFR *); int OSPPBfrReadByte(OSPTBFR *); int OSPPBfrPeekByte(OSPTBFR *); int OSPPBfrPeekByteN(OSPTBFR *, unsigned); void OSPPBfrDelete(OSPTBFR **);#endif /* OSPC_DEBUG */#ifdef __cplusplus}#endif#endif /* _OSPBFR_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -