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