File: ppm_error.c

package info (click to toggle)
gnuift 0.1.14%2Bds-1
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 5,632 kB
  • ctags: 2,973
  • sloc: cpp: 15,867; sh: 8,281; ansic: 1,812; perl: 1,007; php: 651; makefile: 483; lisp: 344
file content (46 lines) | stat: -rw-r--r-- 1,116 bytes parent folder | download
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
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <math.h>
#include <string.h>
#include <unistd.h>

#include "ppm.h"

/* PPM and PGM utilities */

/* David Squire 980924 */

void ppm_handle_error(enum ppm_error the_error) {
	switch(the_error) {
		case UNKNOWN_TYPE:
			fprintf(stderr, "This is not a PPM/PGM file.\n");
			break;
		case EARLY_EOF:
			fprintf(stderr, "Unexpected end of file.\n");
			break;
		case READ_ERROR:
			fprintf(stderr, "Error reading file.\n");
			break;
		case COL_TOO_LARGE:
			fprintf(stderr, "Maximum colour value too large for raw format.\n");
			break;
		case ONE_PLANE_IN:
			fprintf(stderr, "Cannot save a plane of a greyscale image.\n");
			break;
		case ONE_PLANE_OUT:
			fprintf(stderr, "Cannot save a plane as a colour image.\n");
			break;
		case THREE_PLANES_NEEDED:
			fprintf(stderr, "Input image must have three planes.\n");
			break;
		case ONE_PLANE_NEEDED:
			fprintf(stderr, "Input image must have one plane.\n");
			break;
		case TOO_MANY_BINS:
			fprintf(stderr, "Quantisation can result in at most 256 bins.\n");
			break;
		default:
			break;
	}
}