# Synopsis

(macro) void pdx_ET(func)

# Purpose

Invoke a PDElib function with error test.

# Description

This macro invokes function and tests the return code. If the return code is not equal to PDX_NOERR, the error name is written to stderr (along with the source line when compiled under ANSI-C) and an "exit (EXIT_FAILURE)" is executed. This macro is mainly intended for use in PDElib test drivers where an error should result in immediate termination of the program.

The following example shows how pdx_ET can be used to simplify error handling. Note that no semi-colon is placed after the pdx_ET statement (pdx_ET must enclose the check in curly braces to prevent problems with dangling else statements).

.nf pdx_ET( mda_LockEntity (MDA_NOOPT, db_ptr, &ent) ) .fi Under ANSI-C, this equivalent to: .nf { if ((rc = mda_LockEntity (MDA_NOOPT, db_ptr, &ent)) != PDX_NOERR) { fprintf (stderr, ">>> Error code %s at %s(%d),", mpm_GetMsgName(rc), __FILE__, __LINE__); fprintf (stderr, "source statement:nn%snn", "mda_LockEntity (MDA_NOOPT, db_ptr, &ent)"); fprintf (stderr, "*** Exiting ***n"); exit (EXIT_FAILURE); } } .fi

Under non-ANSI-C, the source statment, line, and file information is not printed.

# Input

## func

PDElib function to be invoked, assumed to return a type of PDX_MSGT