Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

erl_error(3erl) [linux man page]

erl_error(3erl) 						C Library Functions						   erl_error(3erl)

NAME
erl_error - Error Print Routines DESCRIPTION
This module contains some error printing routines taken from Advanced Programming in the UNIX Environment by W. Richard Stevens. These functions are all called in the same manner as printf() , i.e. with a string containing format specifiers followed by a list of cor- responding arguments. All output from these functions is to stderr . EXPORTS
void erl_err_msg(FormatStr, ... ) Types const char *FormatStr; The message provided by the caller is printed. This function is simply a wrapper for fprintf() . void erl_err_quit(FormatStr, ... ) Types const char *FormatStr; Use this function when a fatal error has occurred that is not due to a system call. The message provided by the caller is printed and the process terminates with an exit value of 1. The function does not return. void erl_err_ret(FormatStr, ... ) Types const char *FormatStr; Use this function after a failed system call. The message provided by the caller is printed followed by a string describing the rea- son for failure. void erl_err_sys(FormatStr, ... ) Types const char *FormatStr; Use this function after a failed system call. The message provided by the caller is printed followed by a string describing the rea- son for failure, and the process terminates with an exit value of 1. The function does not return. ERROR REPORTING
Most functions in erl_interface report failures to the caller by returning some otherwise meaningless value (typically NULL or a negative number). As this only tells you that things did not go well, you will have to examine the error code in erl_errno if you want to find out more about the failure. EXPORTS
volatile int erl_errno erl_errno is initially (at program startup) zero and is then set by many erl_interface functions on failure to a non-zero error code to indicate what kind of error it encountered. A successful function call might change erl_errno (by calling some other function that fails), but no function will ever set it to zero. This means that you cannot use erl_errno to see if a function call failed. Instead, each function reports failure in its own way (usually by returning a negative number or NULL ), in which case you can exam- ine erl_errno for details. erl_errno uses the error codes defined in your system's <errno.h> . Note: Actually, erl_errno is a "modifiable lvalue" (just like ISO C defines errno to be) rather than a variable. This means it might be imple- mented as a macro (expanding to, e.g., *_erl_errno() ). For reasons of thread- (or task-)safety, this is exactly what we do on most plat- forms. Ericsson AB erl_interface 3.7.3 erl_error(3erl)

Check Out this Related Man Page

erl_format(3erl)						C Library Functions						  erl_format(3erl)

NAME
erl_format - Create and Match Erlang Terms DESCRIPTION
This module contains two routines - one general function for creating Erlang terms and one for pattern matching Erlang terms. EXPORTS
ETERM * erl_format(FormatStr, ... ) Types char *FormatStr; This is a general function for creating Erlang terms using a format specifier and a corresponding set of arguments, much in the way printf() works. FormatStr is a format specification string. The set of valid format specifiers is as follows: * ~i - Integer * ~f - Floating point * ~a - Atom * ~s - String * ~w - Arbitrary Erlang term For each format specifier that appears in FormatStr , there must be a corresponding argument following FormatStr . An Erlang term is built according to the FormatStr with values and Erlang terms substituted from the corresponding arguments and according to the individual format specifiers. For example: erl_format("[{name,~a},{age,~i},{data,~w}]", "madonna", 21, erl_format("[{adr,~s,~i}]","E-street",42)); This will create an (ETERM *) structure corresponding to the Erlang term: [{name,madonna},{age,21},{data,[{adr,"E-street",42}]}] The function returns an Erlang term, or NULL if FormatStr does not describe a valid Erlang term. int erl_match(Pattern, Term) Types ETERM *Pattern,*Term; This function is used to perform pattern matching similar to that done in Erlang. Refer to an Erlang manual for matching rules and more examples. Pattern is an Erlang term, possibly containing unbound variables. Term is an Erlang term that we wish to match against Pattern . Term and Pattern are compared, and any unbound variables in Pattern are bound to corresponding values in Term . If Term and Pattern can be matched, the function returns a non-zero value and binds any unbound variables in Pattern . If Term Pat- tern do not match, the function returns 0. For example: ETERM *term, *pattern, *pattern2; term1 = erl_format("{14,21}"); term2 = erl_format("{19,19}"); pattern1 = erl_format("{A,B}"); pattern2 = erl_format("{F,F}"); if (erl_match(pattern1, term1)) { /* match succeeds: * A gets bound to 14, * B gets bound to 21 */ ... } if (erl_match(pattern2, term1)) { /* match fails because F cannot be * bound to two separate values, 14 and 21 */ ... } if (erl_match(pattern2, term2)) { /* match succeeds and F gets bound to 19 */ ... } erl_var_content() can be used to retrieve the content of any variables bound as a result of a call to erl_match() . Ericsson AB erl_interface 3.7.3 erl_format(3erl)
Man Page