Cirrus Logic CS485 Dokumentacja Strona 49

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 319
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 48
Error Handling
3-13
3
Error Handling Example
The following example describes the default error handling for a console
application. In the example program,
test.c, assume that the function
libFuncB() represents a library function such as ipl?AddS(), and the
function
libFuncD() represents a function that is called internally to the
library. In this scenario,
main() and appFuncA() represent application
code.
Thevalueoftheerrormodeissetto
IPL_ErrModeParent.The
IPL_ErrModeParent option produces a more detailed account of the error
conditions.
Example 3-1 Error Functions
/* application main function */
main() {
iplSetErrMode(IPL_ErrModeParent);
appFuncA(5, 45, 1.0);
if (IPL_ERRCHK("main","compute something")) exit(1);
return 0;
}
/* application subroutine */
void appFuncA(int order1, int order2, double a) {
libFuncB(a, order1);
if (IPL_ERRCHK("appFuncA","compute using order1")) return;
libFuncB(a, order2);
if (IPL_ERRCHK("appFuncA","compute using order2")) return;
}
/* do some more work */
continued
Przeglądanie stron 48
1 2 ... 44 45 46 47 48 49 50 51 52 53 54 ... 318 319

Komentarze do niniejszej Instrukcji

Brak uwag