File: mperror.c

package info (click to toggle)
gdal 2.1.2+dfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 88,596 kB
  • ctags: 83,118
  • sloc: cpp: 905,174; ansic: 184,486; python: 19,037; cs: 13,347; sh: 11,615; perl: 7,012; java: 5,382; php: 3,187; xml: 2,401; yacc: 1,154; makefile: 517; sql: 112
file content (81 lines) | stat: -rw-r--r-- 2,049 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#include "csf.h"
#include "csfimpl.h"


static const char * const errolist[ERRORNO]={
"No error",
"File could not be opened or does not exist",
"File is not a PCRaster file",
"Wrong C.S.F.-version",
"Wrong byte order",
"Not enough memory",
"Illegal cell representation constant",
"Access denied",
"Row number to big",
"Column number to big",
"Map is not a raster file",
"Illegal conversion",
"No space on device to write",
"A write error occurred",
"Illegal handle",
"A read error occurred",
"Illegal access mode constant",
"Attribute not found",
"Attribute already in file",
"Cell size <= 0",
"Conflict between cell representation and value scale",
"Illegal value scale",
"XXXXXXXXXXXXXXXXXXXX",
"Angle < -0.5 pi or > 0.5 pi",
"Can't read as a boolean map",
"Can't write as a boolean map",
"Can't write as a ldd map",
"Can't use as a ldd map",
"Can't write to version 1 cell representation",
"Usetype is not version 2 cell representation, VS_LDD or VS_BOOLEAN"
};

/* write error message to stderr
 * Mperror writes the error message belonging to the current Merrno
 * value to stderr, prefixed by a userString, separated by a semicolon.
 *
 * example
 * .so examples/csfdump1.tr
 */
void Mperror(
	const char *userString) /* prefix string */
{
	(void)fprintf(stderr,"%s : %s\n", userString, errolist[Merrno]);
}

/* write error message to stderr and exits
 * Mperror first writes the error message belonging to the current Merrno
 * value to stderr, prefixed by userString, separated by a semicolon.
 * Then Mperror exits by calling exit() with the given exit code.
 *
 * returns
 * NEVER RETURNS!
 *
 * example
 * .so examples/csfdump2.tr
 */
void MperrorExit(
	const char *userString, /* prefix string */
	int exitCode) /* exit code */
{
	Mperror(userString);
	exit(exitCode);
}

/* error message 
 * MstrError returns the error message belonging to the current Merrno
 * value.
 * returns the error message belonging to the current Merrno
 *
 * example
 * .so examples/testcsf.tr
 */
const char *MstrError(void)
{	
	return(errolist[Merrno]);
}