-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathglobal.h
86 lines (69 loc) · 1.67 KB
/
global.h
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
82
83
84
85
86
#ifndef _GLOBAL_H_
#define _GLOBAL_H_
#include <stdint.h>
#ifdef _MSC_VER
#include <winsock2.h>
/* gettimeofday.c */
int gettimeofday(struct timeval *, struct timezone *);
#else
#include <sys/time.h>
#endif
#include "raster.h"
#define REALLOC_INCREMENT 1024
#define NE 128
#define N 64
#define NW 32
#define W 16
#define SW 8
#define S 4
#define SE 2
#define E 1
#define SUBWATERSHED_NULL INT32_MIN
#define HIERARCHY_NULL -1
struct outlet_list
{
int nalloc, n;
int *row, *col;
int *id;
unsigned char *dir;
};
struct hierarchy
{
int n;
int *self, *up, *down;
};
#ifdef _MAIN_C_
#define GLOBAL
#else
#define GLOBAL extern
#endif
GLOBAL int dir_checks[3][3]
#ifdef _MAIN_C_
= {
{SE, S, SW},
{E, 0, W},
{NE, N, NW}
}
#endif
;
/* timeval_diff.c */
long long timeval_diff(struct timeval *, struct timeval *, struct timeval *);
/* outlet_list.c */
void init_outlet_list(struct outlet_list *);
void reset_outlet_list(struct outlet_list *);
void free_outlet_list(struct outlet_list *);
void add_outlet(struct outlet_list *, int, int, int, unsigned char);
/* outlets.c */
struct outlet_list *read_outlets(char *, char *, struct raster_map *);
int write_outlets(const char *, struct outlet_list *);
/* delineate.c */
void delineate(struct raster_map *, struct outlet_list *, int);
/* delineate_lessmem.c */
void delineate_lessmem(struct raster_map *, struct outlet_list *);
/* delineate_moremem.c */
void delineate_moremem(struct raster_map *, struct outlet_list *);
/* hierarchy.c */
struct hierarchy *analyze_hierarchy(struct raster_map *,
struct outlet_list *);
int write_hierarchy(const char *, struct hierarchy *);
#endif