21#include "parser_local_proto.h"
26static char *str_json_escape(
const char *str);
27static char *str_replace_free_buffer(
char *buffer,
const char old_char,
198 char *file_name =
NULL;
213 fp =
fopen(file_name,
"w+");
215 fprintf(
stderr,
"Unable to open temporary file <%s>\n", file_name);
235 if (
opt->gisprompt) {
279 fprintf(fp,
" \"inputs\":[\n");
281 if (
opt->gisprompt) {
296 else if (
opt->answer) {
298 fprintf(fp,
" {\"param\": \"%s\", ",
opt->key);
321 fprintf(fp,
" \"outputs\":[\n");
323 if (
opt->gisprompt) {
346 fp =
fopen(file_name,
"r");
348 fprintf(
stderr,
"Unable to open temporary file <%s>\n", file_name);
375 G_debug(2,
"tokenize opt string: <%s> with '@'",
opt->answer);
383 _(
"Input string not understood: <%s>. Multiple '@' chars?"),
397 G_debug(2,
"name@mapset found");
406 "\"import_descr\": {\"source\":\"%s\", "
407 "\"type\":\"raster\"},\n ",
413 "\"import_descr\": {\"source\":\"%s\", "
414 "\"type\":\"file\"},\n ",
420 "\"import_descr\": {\"source\":\"%s\", "
421 "\"type\":\"vector\"},\n ",
476 "\"export\": {\"format\":\"%s\", \"type\":\"raster\"},\n ",
482 "\"export\": {\"format\":\"%s\", \"type\":\"file\"},\n ",
489 "\"export\": {\"format\":\"%s\", \"type\":\"vector\"},\n ",
560static char *str_replace_free_buffer(
char *buffer,
const char old_char,
581static char *str_json_escape(
const char *str)
589 out = str_replace_free_buffer(
out,
'\\',
"\\\\");
590 out = str_replace_free_buffer(
out,
'\r',
"\\r");
591 out = str_replace_free_buffer(
out,
'\n',
"\\n");
592 out = str_replace_free_buffer(
out,
'\t',
"\\t");
593 out = str_replace_free_buffer(
out,
'\"',
"\\\"");
594 out = str_replace_free_buffer(
out,
'\f',
"\\f");
595 out = str_replace_free_buffer(
out,
'\b',
"\\b");
const char * G_program_name(void)
Return module name.
void G_free(void *)
Free allocated memory.
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
char ** G_tokenize(const char *, const char *)
Tokenize string.
char * G_tempfile(void)
Returns a temporary file name.
void G_free_tokens(char **)
Free memory allocated to tokens.
int int G_strcasecmp(const char *, const char *)
String compare ignoring case (upper or lower)
char * G_chop(char *)
Chop leading and trailing white spaces.
char * G_store(const char *)
Copy string to allocated memory.
int G_strncasecmp(const char *, const char *, int)
String compare ignoring case (upper or lower) - limited number of characters.
char * G_str_replace(const char *, const char *, const char *)
Replace all occurrences of old_str in buffer with new_str.
int G_debug(int, const char *,...) __attribute__((format(printf
const char * G_mapset(void)
Get current mapset name.
void G__split_gisprompt(const char *gisprompt, char *age, char *element, char *desc)
void check_create_import_opts(struct Option *, char *, FILE *)
void check_create_export_opts(struct Option *, char *, FILE *)
char * check_mapset_in_layer_name(char *, int)
char * G__json(void)
This function generates actinia JSON process chain building blocks from the command line arguments th...
Structure that stores flag info.
Structure that stores option information.