Codebase list libmawk / 70499808-c2b9-4be2-ae11-0ab4b3a1a115/main doc / libmawk_get_var.3libmawk.html

Tree @70499808-c2b9-4be2-ae11-0ab4b3a1a115/main (Download .tar.gz)

libmawk_get_var.3libmawk.html @70499808-c2b9-4be2-ae11-0ab4b3a1a115/mainraw · history · blame

<!-- Creator     : groff version 1.22.2 -->
<!-- CreationDate: Sat Jun 14 14:27:31 2014 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<meta name="generator" content="groff -Thtml, see">
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta name="Content-Style" content="text/css">
<style type="text/css">
       p       { margin-top: 0; margin-bottom: 0; vertical-align: top }
       pre     { margin-top: 0; margin-bottom: 0; vertical-align: top }
       table   { margin-top: 0; margin-bottom: 0; vertical-align: top }
       h1      { text-align: center }


<h1 align="center">LIBMAWK_GET_VAR</h1>

<a href="#NAME">NAME</a><br>
<a href="#SYNOPSIS">SYNOPSIS</a><br>
<a href="#SEE ALSO">SEE ALSO</a><br>


<a name="NAME"></a>

<p style="margin-left:11%; margin-top: 1em">libmawk_get_var
&minus; returns a pointer to a mawk variable</p>

<a name="SYNOPSIS"></a>

<p style="margin-left:11%; margin-top: 1em"><b>#include

<p style="margin-left:11%; margin-top: 1em"><b>CELL
*libmawk_get_var(mawk_state_t *</b><i>m</i><b>, const char
*</b><i>vname</i><b>); <br>
int libmawk_get_array_at(mawk_state_t *</b><i>m</i><b>,
const char *</b><i>arr_name</i><b>, <br>
const char *</b><i>idx</i><b>, const char
*</b><i>res</i><b>, int</b> <i>alloc</i><b>);</b></p>

<a name="DESCRIPTION"></a>

<p style="margin-left:11%; margin-top: 1em">The
<b>libmawk_get_var</b>() function returns a pointer to a
mawk cell that represents the global variable with name
passed in <i>vname</i> in the given context. The returned
CELL should never be free&rsquo;d or destroyed. Function
libmawk_print_cell may be used for converting the cell to
string. The caller should not change the type of cell but is
free to change the value.</p>

<p style="margin-left:11%; margin-top: 1em">Function
<b>libmawk_get_array_at</b>() performs the same operation
for an element of an array. -1 is returned if
<i>arr_name</i> is not an array or upon an error. If
<i>idx</i> is not an existing index in the array it is
allocated if <i>alloc</i> is non-zero. If <i>res</i> is not
NULL, it is destroyed (regardless of the return value) and
if the index exists (or is created by the call), is loaded
with the value. The caller needs to destroy <i>res</i> after
use. Since <i>res</i> is destroyed when non-NULL, it must be
a valid cell with valid type.</p>

<p style="margin-left:11%; margin-top: 1em">Argument m is a
libmawk context previously returned by libmawk_initialize()
or libmawk_initialize_stage3().</p>

<a name="SEE ALSO"></a>

<p style="margin-left:11%; margin-top: 1em"><b>libmawk_initialize_stage</b>(3libmawk),