GRASS GIS 7 Programmer's Manual
7.9.dev(2021)-e5379bbd7
htmldriver/text.c
Go to the documentation of this file.
1
2
/* Text.c - save text string into last_text buffer */
3
4
#include <stdlib.h>
5
#include <string.h>
6
#include <
grass/gis.h
>
7
#include "
driverlib.h
"
8
#include "
htmlmap.h
"
9
10
void
HTML_Text
(
const
char
*text)
11
{
12
int
len = strlen(text);
13
const
char
*s;
14
char
*d;
15
16
if
(len >
html
.
last_text_len
) {
17
G_free
(
html
.
last_text
);
18
html
.
last_text
= (
char
*)
G_malloc
(len + 1);
19
html
.
last_text_len
= len;
20
}
21
22
/* copy string to last_text area, make sure we don't copy \n */
23
for
(d =
html
.
last_text
, s = text; *s !=
'\0'
; s++) {
24
if
(*s !=
'\n'
) {
25
*d = *s;
26
d++;
27
}
28
}
29
*d =
'\0'
;
30
}
G_malloc
#define G_malloc(n)
Definition:
defs/gis.h:112
htmlmap.h
html_state::last_text_len
int last_text_len
Definition:
htmlmap.h:30
html_state::last_text
char * last_text
Definition:
htmlmap.h:29
G_free
void G_free(void *)
Free allocated memory.
Definition:
gis/alloc.c:149
gis.h
HTML_Text
void HTML_Text(const char *text)
Definition:
htmldriver/text.c:10
html
struct html_state html
Definition:
htmldriver/graph_set.c:24
driverlib.h
lib
htmldriver
text.c
Generated on Mon May 31 2021 05:21:32 for GRASS GIS 7 Programmer's Manual by
1.8.13