GRASS Programmer's Manual  6.4.3(2013)-r
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages
common.c
Go to the documentation of this file.
1 
2 #include <grass/gis.h>
3 #include <grass/raster.h>
4 #include <grass/graphics.h>
5 
17 void R_flush(void)
18 {
19  R_stabilize();
20 }
21 
22 void R_pad_perror(const char *msg, int code)
23 {
24  const char *err;
25 
26  switch (code) {
27  case OK:
28  err = "";
29  break;
30  case NO_CUR_PAD:
31  err = "no current pad";
32  break;
33  case NO_PAD:
34  err = "pad not found";
35  break;
36  case NO_MEMORY:
37  err = "out of memory";
38  break;
39  case NO_ITEM:
40  err = "item not found";
41  break;
42  case ILLEGAL:
43  err = "illegal request";
44  break;
45  case DUPLICATE:
46  err = "duplicate name";
47  break;
48  default:
49  err = "unknown error";
50  break;
51  }
52 
53  fprintf(stderr, "%s%s%s\n", msg, *msg ? " : " : "", err);
54 }
55 
56 void R_pad_freelist(char **list, int count)
57 {
58  int i;
59 
60  if (count <= 0)
61  return;
62 
63  for (i = 0; i < count; i++)
64  G_free(list[i]);
65 
66  G_free(list);
67 }