Pop a string from the stack
int SLpop_string (char **strptr);
The SLpop_string
function pops a string from the stack and
returns it as a malloced pointer. It is up to the calling routine
to free this string via a call to free
or SLfree
. If
successful, SLpop_string
returns zero. However, if the top
stack item is not of type SLANG_STRING_TYPE
, or the stack is
empty, the function will return -1
and set
SLang_Error
accordingly.
define print_string (void)
{
char *s;
if (-1 == SLpop_string (&s))
return;
fputs (s, stdout);
SLfree (s);
}
This function should not be confused with SLang_pop_slstring
,
which pops a hashed string from the stack.
SLang_pop_slstring. SLfree