GRASS Programmer's Manual  6.4.3(2013)-r
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages
loc_io.c
Go to the documentation of this file.
1 
2 #include <grass/config.h>
3 
4 #include <errno.h>
5 #include <signal.h>
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <string.h>
9 #include <unistd.h>
10 
11 #include <grass/gis.h>
12 #include <grass/glocale.h>
13 #include <grass/raster.h>
14 #include <grass/graphics.h>
15 
16 #include "driver.h"
17 #include "transport.h"
18 #include "open.h"
19 #include "pad.h"
20 
21 extern const struct driver *PNG_Driver(void);
22 extern const struct driver *PS_Driver(void);
23 
24 static void LOC_init(void)
25 {
26  const char *name = "full_screen";
27  const char *fenc = getenv("GRASS_ENCODING");
28  const char *font = getenv("GRASS_FONT");
29  int t = R_screen_top();
30  int b = R_screen_bot();
31  int l = R_screen_left();
32  int r = R_screen_rite();
33  char buff[256];
34 
35  R_font(font ? font : "romans");
36 
37  if (fenc)
38  R_charset(fenc);
39 
40  R_pad_select("");
41  R_pad_set_item("time", "1");
42  R_pad_set_item("cur_w", name);
43 
44  R_pad_create(name);
45  R_pad_select(name);
46  R_pad_set_item("time", "1");
47 
48  sprintf(buff, "%d %d %d %d", t, b, l, r);
49  R_pad_set_item("d_win", buff);
50 
51  R_set_window(t, b, l, r);
52 }
53 
54 int LOC_open_driver(void)
55 {
56  const char *p = getenv("GRASS_RENDER_IMMEDIATE");
57  const struct driver *drv = (p && G_strcasecmp(p, "PS") == 0)
58  ? PS_Driver()
59  : PNG_Driver();
60 
61  LIB_init(drv, 0, NULL);
62 
63  LOC_init();
64 
66 
67  return OK;
68 }
69 
70 int LOC__open_quiet(void)
71 {
72  return 0;
73 }
74 
75 void LOC_stabilize(void)
76 {
77  COM_Respond();
78 }
79 
80 void LOC_kill_driver(void)
81 {
83 }
84 
85 void LOC_close_driver(void)
86 {
87  LOC_stabilize();
90 }
91 
93 {
94  LOC_stabilize();
96 }