PageRenderTime 9ms CodeModel.GetById 1ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/Proj4/pj_strerrno.c

http://github.com/route-me/route-me
C | 85 lines | 82 code | 2 blank | 1 comment | 4 complexity | 77412f71264ebca9558b226f0a05f762 MD5 | raw file
 1/* list of projection system pj_errno values */
 2#ifndef lint
 3static const char SCCSID[]="@(#)pj_strerrno.c	4.12   94/05/25 GIE REL";
 4#endif
 5#include "projects.h"
 6#include <stdio.h>
 7#include <errno.h>
 8#include <string.h>
 9
10	static char *
11pj_err_list[] = {
12	"no arguments in initialization list",	/*  -1 */
13	"no options found in 'init' file",		/*  -2 */
14	"no colon in init= string",			/*  -3 */
15	"projection not named",				/*  -4 */
16	"unknown projection id",			/*  -5 */
17	"effective eccentricity = 1.",			/*  -6 */
18	"unknown unit conversion id",			/*  -7 */
19	"invalid boolean param argument",		/*  -8 */
20	"unknown elliptical parameter name",	        /*  -9 */
21	"reciprocal flattening (1/f) = 0",		/* -10 */
22	"|radius reference latitude| > 90",		/* -11 */
23	"squared eccentricity < 0",			/* -12 */
24	"major axis or radius = 0 or not given",	/* -13 */
25	"latitude or longitude exceeded limits",	/* -14 */
26	"invalid x or y",				/* -15 */
27	"improperly formed DMS value",			/* -16 */
28	"non-convergent inverse meridinal dist",	/* -17 */
29	"non-convergent inverse phi2",			/* -18 */
30	"acos/asin: |arg| >1.+1e-14",			/* -19 */
31	"tolerance condition error",			/* -20 */
32	"conic lat_1 = -lat_2",				/* -21 */
33	"lat_1 >= 90",					/* -22 */
34	"lat_1 = 0",					/* -23 */
35	"lat_ts >= 90",					/* -24 */
36	"no distance between control points",		/* -25 */
37	"projection not selected to be rotated",	/* -26 */
38	"W <= 0 or M <= 0",				/* -27 */
39	"lsat not in 1-5 range",			/* -28 */
40	"path not in range",				/* -29 */
41	"h <= 0",					/* -30 */
42	"k <= 0",					/* -31 */
43	"lat_0 = 0 or 90 or alpha = 90",		/* -32 */
44	"lat_1=lat_2 or lat_1=0 or lat_2=90",		/* -33 */
45	"elliptical usage required",			/* -34 */
46	"invalid UTM zone number",			/* -35 */
47	"arg(s) out of range for Tcheby eval",		/* -36 */
48	"failed to find projection to be rotated",	/* -37 */
49	"failed to load NAD27-83 correction file",  	/* -38 */
50	"both n & m must be spec'd and > 0",		/* -39 */
51	"n <= 0, n > 1 or not specified",		/* -40 */
52	"lat_1 or lat_2 not specified",			/* -41 */
53	"|lat_1| == |lat_2|",				/* -42 */
54	"lat_0 is pi/2 from mean lat",			/* -43 */
55	"unparseable coordinate system definition",	/* -44 */
56	"geocentric transformation missing z or ellps",	/* -45 */
57	"unknown prime meridian conversion id",		/* -46 */
58};
59	char *
60pj_strerrno(int err) 
61{
62    static char note[50];
63
64    if (err > 0)
65#ifdef HAVE_STRERROR
66        return strerror(err);
67#else
68    {   
69        sprintf(note,"no system list, errno: %d\n", err);
70        return note;
71    }
72#endif
73    else if (err < 0) {
74        int adjusted_err = - err - 1;
75        if (adjusted_err < (sizeof(pj_err_list) / sizeof(char *)))
76            return(pj_err_list[adjusted_err]);
77        else
78        {
79            sprintf( note, "invalid projection system error (%d)",
80                     err );
81            return note;
82        }
83    } else
84        return NULL;
85}