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