2017-10-01 00:42:02 +00:00
|
|
|
#ifndef TEST_H
|
|
|
|
#define TEST_H
|
|
|
|
|
|
|
|
#include <Files.h>
|
|
|
|
#include <Devices.h>
|
2017-10-01 21:36:50 +00:00
|
|
|
#include <string.h>
|
2017-10-01 00:42:02 +00:00
|
|
|
|
|
|
|
#define TEST_LOG_SIZED(str, size) \
|
|
|
|
do { \
|
|
|
|
HParamBlockRec _hpb; \
|
2017-10-01 21:36:50 +00:00
|
|
|
memset(&_hpb,0,sizeof(_hpb)); \
|
2017-10-01 00:42:02 +00:00
|
|
|
\
|
|
|
|
unsigned char _fileName[4]; \
|
2017-10-01 21:36:50 +00:00
|
|
|
short _ref;\
|
2017-10-01 00:42:02 +00:00
|
|
|
_fileName[0] = 3; \
|
|
|
|
_fileName[1] = 'o'; \
|
|
|
|
_fileName[2] = 'u'; \
|
|
|
|
_fileName[3] = 't'; \
|
|
|
|
\
|
|
|
|
_hpb.ioParam.ioCompletion = NULL; \
|
|
|
|
_hpb.ioParam.ioNamePtr = (StringPtr)_fileName; \
|
|
|
|
_hpb.ioParam.ioVRefNum = 0; \
|
|
|
|
_hpb.fileParam.ioDirID = 0; \
|
|
|
|
_hpb.ioParam.ioPermssn = fsRdWrPerm; \
|
|
|
|
PBHOpenSync(&_hpb); \
|
2017-10-01 21:36:50 +00:00
|
|
|
_ref = _hpb.ioParam.ioRefNum; \
|
|
|
|
\
|
|
|
|
memset(&_hpb,0,sizeof(_hpb)); \
|
2017-10-03 09:57:56 +00:00
|
|
|
_hpb.ioParam.ioBuffer = (Ptr)str; \
|
2017-10-01 00:42:02 +00:00
|
|
|
_hpb.ioParam.ioReqCount = size; \
|
|
|
|
_hpb.ioParam.ioPosMode = fsFromLEOF; \
|
|
|
|
_hpb.ioParam.ioPosOffset = 0; \
|
2017-10-01 21:36:50 +00:00
|
|
|
_hpb.ioParam.ioRefNum = _ref; \
|
2017-10-01 00:42:02 +00:00
|
|
|
PBWriteSync((void*)&_hpb); \
|
2017-10-01 21:36:50 +00:00
|
|
|
memset(&_hpb,0,sizeof(_hpb)); \
|
2017-10-01 00:42:02 +00:00
|
|
|
char _newline = '\n'; \
|
|
|
|
_hpb.ioParam.ioBuffer = &_newline; \
|
|
|
|
_hpb.ioParam.ioReqCount = 1; \
|
|
|
|
_hpb.ioParam.ioPosMode = fsFromLEOF; \
|
|
|
|
_hpb.ioParam.ioPosOffset = 0; \
|
2017-10-01 21:36:50 +00:00
|
|
|
_hpb.ioParam.ioRefNum = _ref; \
|
2017-10-01 00:42:02 +00:00
|
|
|
PBWriteSync((void*)&_hpb); \
|
2017-10-01 21:36:50 +00:00
|
|
|
memset(&_hpb,0,sizeof(_hpb)); \
|
|
|
|
_hpb.ioParam.ioRefNum = _ref; \
|
2017-10-01 00:42:02 +00:00
|
|
|
PBCloseSync((void*)&_hpb); \
|
2017-10-01 21:36:50 +00:00
|
|
|
FlushVol(NULL,0); \
|
2017-10-01 00:42:02 +00:00
|
|
|
} while(0);
|
|
|
|
|
2017-10-03 09:57:56 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C"
|
|
|
|
#endif
|
2017-10-01 00:42:02 +00:00
|
|
|
void TestLog(const char *str);
|
|
|
|
|
|
|
|
#endif // TEST_H
|