source: sasview/src/sas/models/c_extension/cephes/mtherr.c @ cd06a5f

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since cd06a5f was 79492222, checked in by krzywon, 10 years ago

Changed the file and folder names to remove all SANS references.

  • Property mode set to 100644
File size: 2.3 KB
Line 
1/*                                                      mtherr.c
2 *
3 *      Library common error handling routine
4 *
5 *
6 *
7 * SYNOPSIS:
8 *
9 * char *fctnam;
10 * int code;
11 * int mtherr();
12 *
13 * mtherr( fctnam, code );
14 *
15 *
16 *
17 * DESCRIPTION:
18 *
19 * This routine may be called to report one of the following
20 * error conditions (in the include file mconf.h).
21 * 
22 *   Mnemonic        Value          Significance
23 *
24 *    DOMAIN            1       argument domain error
25 *    SING              2       function singularity
26 *    OVERFLOW          3       overflow range error
27 *    UNDERFLOW         4       underflow range error
28 *    TLOSS             5       total loss of precision
29 *    PLOSS             6       partial loss of precision
30 *    EDOM             33       Unix domain error code
31 *    ERANGE           34       Unix range error code
32 *
33 * The default version of the file prints the function name,
34 * passed to it by the pointer fctnam, followed by the
35 * error condition.  The display is directed to the standard
36 * output device.  The routine then returns to the calling
37 * program.  Users may wish to modify the program to abort by
38 * calling exit() under severe error conditions such as domain
39 * errors.
40 *
41 * Since all error conditions pass control to this function,
42 * the display may be easily changed, eliminated, or directed
43 * to an error logging device.
44 *
45 * SEE ALSO:
46 *
47 * mconf.h
48 *
49 */
50
51/*
52Cephes Math Library Release 2.0:  April, 1987
53Copyright 1984, 1987 by Stephen L. Moshier
54Direct inquiries to 30 Frost Street, Cambridge, MA 02140
55*/
56
57#include <stdio.h>
58#include "mconf.h"
59
60int merror = 0;
61
62/* Notice: the order of appearance of the following
63 * messages is bound to the error codes defined
64 * in mconf.h.
65 */
66static char *ermsg[7] = {
67"unknown",      /* error code 0 */
68"domain",       /* error code 1 */
69"singularity",  /* et seq.      */
70"overflow",
71"underflow",
72"total loss of precision",
73"partial loss of precision"
74};
75
76
77int mtherr( name, code )
78char *name;
79int code;
80{
81
82/* Display string passed by calling program,
83 * which is supposed to be the name of the
84 * function in which the error occurred:
85 */
86printf( "\n%s ", name );
87
88/* Set global error message word */
89merror = code;
90
91/* Display error message defined
92 * by the code argument.
93 */
94if( (code <= 0) || (code >= 7) )
95        code = 0;
96printf( "%s error\n", ermsg[code] );
97
98/* Return to calling
99 * program
100 */
101return( 0 );
102}
Note: See TracBrowser for help on using the repository browser.