- CVI 정보나눔(www.cvi.kr)
- 스터디
- 개발메모
개발메모(형식에 매이지 않는 짤막한 개발 낙서)
글 수 174
toolbox.h --------------------------------------------------------------------------
/* The errChk and nullChk macros are useful for implementing a consistent error
handling system. These can macros can be place around function calls to
force an automatic jump to a function's error handling code when an error
occurs. This is analogous to exception handling, and is even easier to use.
These macros make the following assumptions:
1) The following local declaration of an error code variable is
made in every function in which they are used:
int error = 0;
2) Every function in which they are used contains a goto label
named Error which precedes the error handling code for the function.
3) Every function call or error code enclosed in a errChk() macro
is assumed to return an integer which, if negative, is the code for
the error which occured. If the value is zero or positive then the
error checking macros have no effect.
Every function call or value enclosed in a nullChk() macro is
assummed to return a non-zero value if no error occurred, or a
zero value if an "Out Of Memory" error occurred (nullChk() is
useful for malloc, calloc, and similar resource allocation functions).
*/
#ifndef errChk
#define errChk(fCall) if (error = (fCall), error < 0) \
{goto Error;} else
#endif
#ifndef nullChk
#define nullChk(fCall) if ((fCall) == 0) \
{error = UIEOutOfMemory; goto Error;} else
#endif
DAQmxErrChk 매크로 --------------------------------------------------------------------------
#define DAQmxErrChk(functionCall) if( DAQmxFailed(error=(functionCall)) ) goto Error; else
/* The errChk and nullChk macros are useful for implementing a consistent error
handling system. These can macros can be place around function calls to
force an automatic jump to a function's error handling code when an error
occurs. This is analogous to exception handling, and is even easier to use.
These macros make the following assumptions:
1) The following local declaration of an error code variable is
made in every function in which they are used:
int error = 0;
2) Every function in which they are used contains a goto label
named Error which precedes the error handling code for the function.
3) Every function call or error code enclosed in a errChk() macro
is assumed to return an integer which, if negative, is the code for
the error which occured. If the value is zero or positive then the
error checking macros have no effect.
Every function call or value enclosed in a nullChk() macro is
assummed to return a non-zero value if no error occurred, or a
zero value if an "Out Of Memory" error occurred (nullChk() is
useful for malloc, calloc, and similar resource allocation functions).
*/
#ifndef errChk
#define errChk(fCall) if (error = (fCall), error < 0) \
{goto Error;} else
#endif
#ifndef nullChk
#define nullChk(fCall) if ((fCall) == 0) \
{error = UIEOutOfMemory; goto Error;} else
#endif
DAQmxErrChk 매크로 --------------------------------------------------------------------------
#define DAQmxErrChk(functionCall) if( DAQmxFailed(error=(functionCall)) ) goto Error; else