개발메모(형식에 매이지 않는 짤막한 개발 낙서)

글 수 174

errChk 매크로

조회 수 2832 추천 수 0 2007.05.24 12:59:39
허창원 *.97.72.17
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
List of Articles
번호 제목 글쓴이 날짜 조회 수
114 [Doc] Accessing Parallel Ports with VISA 허창원 2007-06-15 3398
113 [Doc] LabVIEW에서 공유라이브러리(DLL) 호출 허창원 2007-06-12 6101
112 ATTR_SIZE_TO_TEXT 허창원 2007-05-24 3992
» errChk 매크로 허창원 2007-05-24 2832
110 [Source] Panel Size가 바뀔때 Table의 크기도 연동되도록 허창원 2007-05-24 2901
109 [Doc] Serial Communication Overview 허창원 2007-05-23 2948
108 [Doc] Networking Two PCs for Remote Data Acquisition 허창원 2007-05-23 2861
107 [Doc] 10 Things to Consider When Choosing Vision Software 허창원 2007-05-23 2894
106 이동 가능한 컨트롤로 지정하기 허창원 2007-04-20 2780
105 [링크] Introduction to the LabWindows/CVI TDM Streaming Library 허창원 2007-03-22 3078
104 [링크] Customizing Create Distribution Kit Installers in LabWindows/CVI 허창원 2007-03-13 3744
103 파일 찾아보기 버튼의 콜백함수 예 허창원 2007-02-24 2834
102 DAQmx 장치의 Device Serial Number 얻어오기 허창원 2006-12-18 3496
101 Canvas에 라인 긋는 절차 메모 허창원 2006-12-02 2976
100 sample source인 canvsbmk.c의 Draw() 함수의 일부 허창원 2006-12-02 5890
99 Easy Tab 사용하기 메모 허창원 2006-08-18 3541
98 Panel 활성화와 상관없이 Virtual Key 상태 알아내기 허창원 2006-08-16 3745
97 파워포인트의 특정 페이지로 이동하는 예 허창원 2006-08-08 3059
96 테이블(Table) 내의 셀(Cell) 속성을 변경하는 예 허창원 2006-06-30 3556
95 리스트박스(listbox)의 콜백예 file 허창원 2006-06-19 3079