Skip to content
Snippets Groups Projects
Commit fe236d00 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

Str() + doc getdp compatibility syntax

parent 5ad0a02e
No related branches found
No related tags found
No related merge requests found
Source diff could not be displayed: it is too large. Options to address this: view the blob.
......@@ -5069,6 +5069,23 @@ StringExpr :
Free($5);
Free($7);
}
| tStr '(' RecursiveListOfStringExprVar ')'
{
int size = 0;
for(int i = 0; i < List_Nbr($3); i++)
size += strlen(*(char**)List_Pointer($3, i)) + 1;
$$ = (char*)Malloc(size * sizeof(char));
$$[0] = '\0';
for(int i = 0; i < List_Nbr($3); i++){
char *s;
List_Read($3, i, &s);
strcat($$, s);
Free(s);
if(i != List_Nbr($3) - 1) strcat($$, "\n");
}
List_Delete($3);
}
// for compatibility with GetDP
| tStr '[' RecursiveListOfStringExprVar ']'
{
int size = 0;
......
......@@ -1080,7 +1080,7 @@ Character expressions are defined as:
StrPrefix ( @var{char-expression} ) |
StrRelative ( @var{char-expression} ) |
StrCat ( @var{char-expression} , @var{char-expression} ) |
Str [ @var{char-expression} , @dots{} ] |
Str ( @var{char-expression} , @dots{} ) |
Sprintf ( @var{char-expression} , @var{expression-list} ) |
Sprintf ( @var{char-expression} ) |
Sprintf ( @var{char-option} ) |
......@@ -1100,7 +1100,9 @@ etc.) The various @w{@var{char-option}s} are listed in
@ref{Options}. @code{GetEnvThe} gets the value of an environment
variable from the operating system. @code{GetString} allows to ask the
user for a value interactively. @code{StrReplace}'s arguments are: input
string, old substring, new substring.
string, old substring, new substring.@footnote{For compatibility with GetDP
(@uref{http://geuz.org/getdp/}), parentheses can be replaced by brackets
@code{[]} in @code{Str} and @code{Sprintf}.}
Character expressions are mostly used to specify non-numeric options and
input/output file names. See @ref{t8.geo}, for an interesting usage of
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment