Package list libmawk / scrub-obsolete/main doc / libmawk_get_var.3libmawk.html
scrub-obsolete/main

Tree @scrub-obsolete/main (Download .tar.gz)

libmawk_get_var.3libmawk.html @scrub-obsolete/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"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<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 }
</style>
<title>LIBMAWK_GET_VAR</title>

</head>
<body>

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

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

<hr>


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



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

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


<p style="margin-left:11%; margin-top: 1em"><b>#include
&lt;libmawk.h&gt;</b></p>

<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>

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


<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>

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



<p style="margin-left:11%; margin-top: 1em"><b>libmawk_initialize_stage</b>(3libmawk),
<b>libmawk_initialize</b>(3libmawk),
<b>libmawk_call_function</b>(3libmawk),
<b>libmawk_print_cell</b>(3libmawk).</p>
<hr>
</body>
</html>