global.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. #ifndef GLOBAL
  2. # define GLOBAL extern
  3. # define INIT(x)
  4. #else
  5. # define INIT(x) = x
  6. #endif
  7. #include <grass/raster.h>
  8. #define SORT_DEFAULT 0
  9. #define SORT_ASC 1
  10. #define SORT_DESC 2
  11. extern struct Cell_head window;
  12. struct _layer_
  13. {
  14. const char *name;
  15. const char *mapset;
  16. struct Categories labels;
  17. int nlen; /* num chars of largest cat when printed */
  18. int clen; /* num chars for cat label when printed */
  19. };
  20. #define LAYER struct _layer_
  21. extern LAYER *layers;
  22. extern int nlayers;
  23. struct _gstats_
  24. {
  25. CELL *cats;
  26. double area;
  27. long count;
  28. };
  29. #define GSTATS struct _gstats_
  30. extern GSTATS *Gstats;
  31. extern int nstats;
  32. #define MAX_UNITS 10
  33. struct _units_
  34. {
  35. double factor;
  36. int type;
  37. int len;
  38. int dp;
  39. int eformat;
  40. char *label[2];
  41. };
  42. #define UNITS struct _units_
  43. extern UNITS unit[MAX_UNITS];
  44. extern int nunits;
  45. #define DEFAULT_PAGE_LENGTH 0
  46. #define DEFAULT_PAGE_WIDTH 79
  47. extern int page_width;
  48. extern int page_length;
  49. extern int masking;
  50. extern int use_formfeed;
  51. extern int nlines;
  52. extern int with_headers;
  53. extern int e_format;
  54. extern int no_nulls;
  55. extern int no_nulls_all;
  56. extern int do_sort;
  57. extern char *stats_file;
  58. extern char *no_data_str;
  59. extern int stats_flag;
  60. extern int nsteps, cat_ranges, as_int;
  61. extern int *is_fp;
  62. extern DCELL *DMAX, *DMIN;
  63. extern int maskfd;
  64. extern CELL *mask;
  65. extern CELL NULL_CELL;
  66. extern int (*get_row)();
  67. extern char fs[2];
  68. extern struct Categories *labels;
  69. /* format.c */
  70. int format_parms(double, int *, int *, int *, int);
  71. int scient_format(double, char *, int, int);
  72. int format_double(double, char *, int, int);
  73. /* header.c */
  74. int header(int, int);
  75. int divider(char *);
  76. int trailer(void);
  77. int newline(void);
  78. int lcr(const char *, const char *, const char *, char *, int);
  79. /* label.c */
  80. char *print_label(char *, int, int, int, int);
  81. /* main.c */
  82. int main(int, char *[]);
  83. /* maskinfo.c */
  84. char *maskinfo(void);
  85. /* parse.c */
  86. int parse_command_line(int, char *[]);
  87. int parse_units(char *);
  88. int parse_layer(char *);
  89. int match(char *, char *, int);
  90. /* prt_report.c */
  91. int print_report(int, int);
  92. int construct_val_str(int, CELL *, char *);
  93. char *construct_cat_label(int, CELL);
  94. /* prt_unit.c */
  95. int print_unit(int, int, int);
  96. /* report.c */
  97. int report(void);
  98. /* stats.c */
  99. int get_stats(void);
  100. /* sums.c */
  101. double area_sum(int *, int);
  102. long count_sum(int *, int);
  103. int same_cats(int, int, int);
  104. #define EVERYTHING 0
  105. #define REPORT_ONLY 1
  106. #define STATS_ONLY 2
  107. #define ACRES 1
  108. #define HECTARES 2
  109. #define SQ_MILES 3
  110. #define PERCENT_COVER 4
  111. #define CELL_COUNTS 5
  112. #define SQ_METERS 6
  113. #define SQ_KILOMETERS 7