GRASS Programmer's Manual
6.4.3(2013)-r
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Macros
Pages
com_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
19
struct
transport
loc_trans
= {
20
LOC_open_driver
,
21
LOC__open_quiet
,
22
LOC_stabilize
,
23
LOC_kill_driver
,
24
LOC_close_driver
,
25
LOC_release_driver
,
26
LOC_screen_left
,
27
LOC_screen_rite
,
28
LOC_screen_bot
,
29
LOC_screen_top
,
30
LOC_get_num_colors
,
31
LOC_standard_color
,
32
LOC_RGB_color
,
33
LOC_line_width
,
34
LOC_erase
,
35
LOC_move_abs
,
36
LOC_move_rel
,
37
LOC_cont_abs
,
38
LOC_cont_rel
,
39
LOC_polydots_abs
,
40
LOC_polydots_rel
,
41
LOC_polyline_abs
,
42
LOC_polyline_rel
,
43
LOC_polygon_abs
,
44
LOC_polygon_rel
,
45
LOC_box_abs
,
46
LOC_box_rel
,
47
LOC_text_size
,
48
LOC_text_rotation
,
49
LOC_set_window
,
50
LOC_text
,
51
LOC_get_text_box
,
52
LOC_font
,
53
LOC_charset
,
54
LOC_font_list
,
55
LOC_font_info
,
56
LOC_panel_save
,
57
LOC_panel_restore
,
58
LOC_panel_delete
,
59
LOC_begin_scaled_raster
,
60
LOC_scaled_raster
,
61
LOC_end_scaled_raster
,
62
LOC_bitmap
,
63
LOC_get_location_with_box
,
64
LOC_get_location_with_line
,
65
LOC_get_location_with_pointer
,
66
LOC_pad_create
,
67
LOC_pad_current
,
68
LOC_pad_delete
,
69
LOC_pad_invent
,
70
LOC_pad_list
,
71
LOC_pad_select
,
72
LOC_pad_append_item
,
73
LOC_pad_delete_item
,
74
LOC_pad_get_item
,
75
LOC_pad_list_items
,
76
LOC_pad_set_item
77
};
78
79
#ifdef HAVE_SOCKET
80
81
struct
transport
rem_trans = {
82
REM_open_driver
,
83
REM__open_quiet
,
84
REM_stabilize
,
85
REM_kill_driver
,
86
REM_close_driver
,
87
REM_release_driver
,
88
REM_screen_left
,
89
REM_screen_rite
,
90
REM_screen_bot
,
91
REM_screen_top
,
92
REM_get_num_colors
,
93
REM_standard_color
,
94
REM_RGB_color
,
95
REM_line_width
,
96
REM_erase
,
97
REM_move_abs
,
98
REM_move_rel
,
99
REM_cont_abs
,
100
REM_cont_rel
,
101
REM_polydots_abs
,
102
REM_polydots_rel
,
103
REM_polyline_abs
,
104
REM_polyline_rel
,
105
REM_polygon_abs
,
106
REM_polygon_rel
,
107
REM_box_abs
,
108
REM_box_rel
,
109
REM_text_size
,
110
REM_text_rotation
,
111
REM_set_window
,
112
REM_text
,
113
REM_get_text_box
,
114
REM_font
,
115
REM_charset
,
116
REM_font_list
,
117
REM_font_info
,
118
REM_panel_save
,
119
REM_panel_restore
,
120
REM_panel_delete
,
121
REM_begin_scaled_raster
,
122
REM_scaled_raster
,
123
REM_end_scaled_raster
,
124
REM_bitmap
,
125
REM_get_location_with_box
,
126
REM_get_location_with_line
,
127
REM_get_location_with_pointer
,
128
REM_pad_create
,
129
REM_pad_current
,
130
REM_pad_delete
,
131
REM_pad_invent
,
132
REM_pad_list
,
133
REM_pad_select
,
134
REM_pad_append_item
,
135
REM_pad_delete_item
,
136
REM_pad_get_item
,
137
REM_pad_list_items
,
138
REM_pad_set_item
139
};
140
141
#endif
142
143
const
struct
transport
*
trans
;
144
145
static
const
struct
transport
*get_trans(
void
)
146
{
147
#ifndef HAVE_SOCKET
148
return
&
loc_trans
;
149
#else
150
const
char
*p =
getenv
(
"GRASS_RENDER_IMMEDIATE"
);
151
152
if
(!p)
153
return
&rem_trans;
154
155
if
(
G_strcasecmp
(p,
"TRUE"
) == 0)
156
return
&
loc_trans
;
157
158
if
(
G_strcasecmp
(p,
"FALSE"
) == 0)
159
return
&rem_trans;
160
161
if
(
G_strcasecmp
(p,
"PNG"
) == 0)
162
return
&
loc_trans
;
163
164
if
(
G_strcasecmp
(p,
"PS"
) == 0)
165
return
&
loc_trans
;
166
167
G_warning
(
"Unrecognised GRASS_RENDER_IMMEDIATE setting: %s"
, p);
168
169
return
&rem_trans;
170
#endif
171
}
172
173
static
void
init_transport(
void
)
174
{
175
if
(trans)
176
return
;
177
178
trans = get_trans();
179
}
180
181
int
R_open_driver
(
void
)
182
{
183
init_transport();
184
return
trans->
open_driver
();
185
}
186
187
void
R__open_quiet
(
void
)
188
{
189
init_transport();
190
trans->
open_quiet
();
191
}
192
193
void
R_stabilize
(
void
)
194
{
195
trans->
stabilize
();
196
}
197
198
void
R_kill_driver
(
void
)
199
{
200
trans->
kill_driver
();
201
}
202
203
void
R_close_driver
(
void
)
204
{
205
trans->
close_driver
();
206
}
207
208
void
R_release_driver
(
void
)
209
{
210
trans->
release_driver
();
211
}
lib
raster
com_io.c
Generated on Thu Sep 26 2013 09:47:59 for GRASS Programmer's Manual by
1.8.4