File: type.c

package info (click to toggle)
grass 6.0.0-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 38,764 kB
  • ctags: 31,167
  • sloc: ansic: 320,650; tcl: 25,669; cpp: 10,098; sh: 9,695; makefile: 4,714; fortran: 1,846; yacc: 493; lex: 462; perl: 133; sed: 1
file content (57 lines) | stat: -rw-r--r-- 1,077 bytes parent folder | download | duplicates (2)
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
#include "Vect.h"
#include "conv.h"
#include "glocale.h"

/* conversion of old file format elment type codes to new 
*
*  returns: new type
*           0 - dead element
*          -1 - error
*/ 
char dig_old_to_new_type (char type)
{
    switch (type) {
	case FILE_LINE:
	    type = GV_LINE;
	    break;
	case FILE_AREA:
	    type = GV_BOUNDARY;
	    break;
	case FILE_DOT:
	    type = GV_POINT;
	    break;
	case FILE_DEAD_LINE:
	case FILE_DEAD_AREA:
	case FILE_DEAD_DOT:
	    type = 0;
	    break;
	default:
	    G_warning ( _("SYSTEM_ERROR: OLD_T_NEW Got a bad type code %x"), type);
	    type = -1;
	    break;
    }
    return (type);
}

/* conversion of new element types to old file format elment type codes */ 
char dig_new_to_old_type ( char  type)
{
    switch (type) {
	case GV_LINE:
	    type = FILE_LINE;
	    break;
	case GV_BOUNDARY:
	    type = FILE_AREA;
	    break;
	case GV_POINT:
	    type = FILE_DOT;
	    break;
	default:
	    G_warning ( _("SYSTEM_ERROR: NEW_T_OLD Got a bad type code %x"), type);
	    type = 0;
	    break;
    }
    return (type);
}