common.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /****************************************************************************
  2. *
  3. * MODULE: r.terraflow
  4. *
  5. * COPYRIGHT (C) 2007 Laura Toma
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. *****************************************************************************/
  18. #ifndef COMMON_H
  19. #define COMMON_H
  20. #include <sys/types.h>
  21. #include <iostream>
  22. #include <grass/iostream/ami.h>
  23. #include "stats.h"
  24. #include "option.h"
  25. #include "types.h" /* for dimension_type */
  26. extern "C" {
  27. #include <grass/gis.h>
  28. #include <grass/glocale.h>
  29. }
  30. extern statsRecorder *stats; /* stats file */
  31. extern userOptions *opt; /* command-line options */
  32. extern struct Cell_head *region; /* header of the region */
  33. extern dimension_type nrows, ncols;
  34. #define MARKER(s) (stats->comment(__FILE__ ":" s))
  35. #define STRACE(s) MARKER(s)
  36. size_t parse_number(const char *s);
  37. #define LM_HIST 22
  38. #ifdef USE_LARGEMEM
  39. class LargeMemory {
  40. static void *ptr[LM_HIST];
  41. static size_t len[LM_HIST];
  42. static int next;
  43. public:
  44. static void *alloc(size_t);
  45. static void free(void *);
  46. };
  47. #endif /* USE_LARGEMEM */
  48. #endif