Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > updates > by-pkgid > 0b420d0fce195cf4115dc6a3be5c2da2 > files > 337

sphinxbase-devel-0.7-1.fc14.i686.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>SphinxBase: include/sphinxbase/strfuncs.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.3 -->
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">SphinxBase&#160;<span id="projectnumber">0.6</span></div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('strfuncs_8h.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#enum-members">Enumerations</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<h1>include/sphinxbase/strfuncs.h File Reference</h1>  </div>
</div>
<div class="contents">

<p>Miscellaneous useful string functions.  
<a href="#_details">More...</a></p>
<div class="textblock"><code>#include &lt;stdarg.h&gt;</code><br/>
<code>#include &lt;sphinxbase/sphinxbase_export.h&gt;</code><br/>
<code>#include &lt;sphinxbase/prim_type.h&gt;</code><br/>
</div>
<p><a href="strfuncs_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="enum-members"></a>
Enumerations</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="strfuncs_8h.html#ab5c9ca15770a4bd3047705762b815df9">string_edge_e</a> { <a class="el" href="strfuncs_8h.html#ab5c9ca15770a4bd3047705762b815df9a5e4d73e6ca445be10fa48351b9571125">STRING_START</a>, 
<a class="el" href="strfuncs_8h.html#ab5c9ca15770a4bd3047705762b815df9a11f31598e50bf3cf1d0aa97d967bb9b9">STRING_END</a>, 
<a class="el" href="strfuncs_8h.html#ab5c9ca15770a4bd3047705762b815df9a4fcbb0fe16fa4aa48723ba3ba10c26dd">STRING_BOTH</a>
 }</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight"><p>Which end of a string to operate on for <a class="el" href="strfuncs_8h.html#ac36a095632a4f16cf4e0fbcdb01de5ad" title="Remove whitespace from a string, modifying it in-place.">string_trim()</a>. </p>
 <a href="strfuncs_8h.html#ab5c9ca15770a4bd3047705762b815df9">More...</a><br/></td></tr>
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a317522f23d291311e366de34ef86b777"></a><!-- doxytag: member="strfuncs.h::string_join" ref="a317522f23d291311e366de34ef86b777" args="(const char *base,...)" -->
SPHINXBASE_EXPORT char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="strfuncs_8h.html#a317522f23d291311e366de34ef86b777">string_join</a> (const char *base,...)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Concatenate a NULL-terminated argument list of strings, returning a newly allocated string. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">SPHINXBASE_EXPORT char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="strfuncs_8h.html#ac36a095632a4f16cf4e0fbcdb01de5ad">string_trim</a> (char *string, enum <a class="el" href="strfuncs_8h.html#ab5c9ca15770a4bd3047705762b815df9">string_edge_e</a> which)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Remove whitespace from a string, modifying it in-place.  <a href="#ac36a095632a4f16cf4e0fbcdb01de5ad"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">SPHINXBASE_EXPORT double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="strfuncs_8h.html#ab708351fe7308551632a782bfad75a1e">atof_c</a> (char const *str)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Locale independent version of atof().  <a href="#ab708351fe7308551632a782bfad75a1e"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aab1bdad6b50285de4b7cd042f67314dd"></a><!-- doxytag: member="strfuncs.h::utf8_decode" ref="aab1bdad6b50285de4b7cd042f67314dd" args="(uint32 *state, uint32 *codep, uint32 *byte)" -->
SPHINXBASE_EXPORT uint32&#160;</td><td class="memItemRight" valign="bottom"><b>utf8_decode</b> (uint32 *state, uint32 *codep, uint32 *byte)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">SPHINXBASE_EXPORT int32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="strfuncs_8h.html#a5b520fdebcca599db86faaf75a82173f">str2words</a> (char *line, char **wptr, int32 n_wptr)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Convert a line to an array of "words", based on whitespace separators.  <a href="#a5b520fdebcca599db86faaf75a82173f"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">SPHINXBASE_EXPORT int32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="strfuncs_8h.html#a41d9a59e4326b545bf1282401319f553">nextword</a> (char *line, const char *delim, char **word, char *delimfound)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Yet another attempt at a clean "next-word-in-string" function.  <a href="#a41d9a59e4326b545bf1282401319f553"></a><br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Miscellaneous useful string functions. </p>

<p>Definition in file <a class="el" href="strfuncs_8h_source.html">strfuncs.h</a>.</p>
</div><hr/><h2>Enumeration Type Documentation</h2>
<a class="anchor" id="ab5c9ca15770a4bd3047705762b815df9"></a><!-- doxytag: member="strfuncs.h::string_edge_e" ref="ab5c9ca15770a4bd3047705762b815df9" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="strfuncs_8h.html#ab5c9ca15770a4bd3047705762b815df9">string_edge_e</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Which end of a string to operate on for <a class="el" href="strfuncs_8h.html#ac36a095632a4f16cf4e0fbcdb01de5ad" title="Remove whitespace from a string, modifying it in-place.">string_trim()</a>. </p>
<dl><dt><b>Enumerator: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><em><a class="anchor" id="ab5c9ca15770a4bd3047705762b815df9a5e4d73e6ca445be10fa48351b9571125"></a><!-- doxytag: member="STRING_START" ref="ab5c9ca15770a4bd3047705762b815df9a5e4d73e6ca445be10fa48351b9571125" args="" -->STRING_START</em>&nbsp;</td><td>
<p>Beginning of string. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="ab5c9ca15770a4bd3047705762b815df9a11f31598e50bf3cf1d0aa97d967bb9b9"></a><!-- doxytag: member="STRING_END" ref="ab5c9ca15770a4bd3047705762b815df9a11f31598e50bf3cf1d0aa97d967bb9b9" args="" -->STRING_END</em>&nbsp;</td><td>
<p>End of string. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="ab5c9ca15770a4bd3047705762b815df9a4fcbb0fe16fa4aa48723ba3ba10c26dd"></a><!-- doxytag: member="STRING_BOTH" ref="ab5c9ca15770a4bd3047705762b815df9a4fcbb0fe16fa4aa48723ba3ba10c26dd" args="" -->STRING_BOTH</em>&nbsp;</td><td>
<p>Both ends of string. </p>
</td></tr>
</table>
</dd>
</dl>

<p>Definition at line <a class="el" href="strfuncs_8h_source.html#l00070">70</a> of file <a class="el" href="strfuncs_8h_source.html">strfuncs.h</a>.</p>

</div>
</div>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="ab708351fe7308551632a782bfad75a1e"></a><!-- doxytag: member="strfuncs.h::atof_c" ref="ab708351fe7308551632a782bfad75a1e" args="(char const *str)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">SPHINXBASE_EXPORT double atof_c </td>
          <td>(</td>
          <td class="paramtype">char const *&#160;</td>
          <td class="paramname"><em>str</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Locale independent version of atof(). </p>
<p>This function behaves like atof() in the "C" locale. Switching locale in a threaded program is extremely uncool, therefore we need this since we pass floats as strings in 1000 different places. </p>

<p>Definition at line <a class="el" href="strfuncs_8c_source.html#l00056">56</a> of file <a class="el" href="strfuncs_8c_source.html">strfuncs.c</a>.</p>

<p>References <a class="el" href="strfuncs_8c_source.html#l00056">atof_c()</a>.</p>

<p>Referenced by <a class="el" href="strfuncs_8c_source.html#l00056">atof_c()</a>, and <a class="el" href="logmath_8c_source.html#l00164">logmath_read()</a>.</p>

</div>
</div>
<a class="anchor" id="a41d9a59e4326b545bf1282401319f553"></a><!-- doxytag: member="strfuncs.h::nextword" ref="a41d9a59e4326b545bf1282401319f553" args="(char *line, const char *delim, char **word, char *delimfound)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">SPHINXBASE_EXPORT int32 nextword </td>
          <td>(</td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>line</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>delim</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char **&#160;</td>
          <td class="paramname"><em>word</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>delimfound</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Yet another attempt at a clean "next-word-in-string" function. </p>
<p>See arguments below. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>Length of word returned, or -1 if nothing found. This allows you to scan through a line:</dd></dl>
<pre>
 while ((n = nextword(line, delim, &amp;word, &amp;delimfound)) &gt;= 0) {
     ... do something with word ..
     word[n] = delimfound;
     line = word + n;
 }
 </pre> <dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">line</td><td>Input: String being searched for next word. Will be modified by this function (NUL characters inserted) </td></tr>
    <tr><td class="paramname">delim</td><td>Input: A word, if found, must be delimited at either end by a character from this string (or at the end by the NULL char) </td></tr>
    <tr><td class="paramname">word</td><td>Output: *word = ptr within line to beginning of first word, if found. Delimiter at the end of word replaced with the NULL char. </td></tr>
    <tr><td class="paramname">delimfound</td><td>Output: *delimfound = original delimiter found at the end of the word. (This way, the caller can restore the delimiter, preserving the original string.) </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="strfuncs_8c_source.html#l00158">158</a> of file <a class="el" href="strfuncs_8c_source.html">strfuncs.c</a>.</p>

<p>References <a class="el" href="strfuncs_8c_source.html#l00158">nextword()</a>.</p>

<p>Referenced by <a class="el" href="strfuncs_8c_source.html#l00158">nextword()</a>.</p>

</div>
</div>
<a class="anchor" id="a5b520fdebcca599db86faaf75a82173f"></a><!-- doxytag: member="strfuncs.h::str2words" ref="a5b520fdebcca599db86faaf75a82173f" args="(char *line, char **wptr, int32 n_wptr)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">SPHINXBASE_EXPORT int32 str2words </td>
          <td>(</td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>line</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char **&#160;</td>
          <td class="paramname"><em>wptr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32&#160;</td>
          <td class="paramname"><em>n_wptr</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Convert a line to an array of "words", based on whitespace separators. </p>
<p>A word is a string with no whitespace chars in it. Note that the string line is modified as a result: NULL chars are placed after every word in the line. Return value: No. of words found; -1 if no. of words in line exceeds n_wptr. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">line</td><td>In/Out: line to be parsed. This string will be modified! (NUL characters inserted at word boundaries) </td></tr>
    <tr><td class="paramname">wptr</td><td>In/Out: Array of pointers to words found in line. The array must be allocated by the caller. It may be NULL in which case the number of words will be counted. This allows you to allcate it to the proper size, e.g.:</td></tr>
  </table>
  </dd>
</dl>
<p>n = str2words(line, NULL, 0); wptr = ckd_calloc(n, sizeof(*wptr)); str2words(line, wptr, n); </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">n_wptr</td><td>In: Size of wptr array, ignored if wptr == NULL </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="strfuncs_8c_source.html#l00115">115</a> of file <a class="el" href="strfuncs_8c_source.html">strfuncs.c</a>.</p>

<p>References <a class="el" href="strfuncs_8c_source.html#l00115">str2words()</a>.</p>

<p>Referenced by <a class="el" href="strfuncs_8c_source.html#l00115">str2words()</a>.</p>

</div>
</div>
<a class="anchor" id="ac36a095632a4f16cf4e0fbcdb01de5ad"></a><!-- doxytag: member="strfuncs.h::string_trim" ref="ac36a095632a4f16cf4e0fbcdb01de5ad" args="(char *string, enum string_edge_e which)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">SPHINXBASE_EXPORT char* string_trim </td>
          <td>(</td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>string</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">enum <a class="el" href="strfuncs_8h.html#ab5c9ca15770a4bd3047705762b815df9">string_edge_e</a>&#160;</td>
          <td class="paramname"><em>which</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Remove whitespace from a string, modifying it in-place. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">string</td><td>string to trim, contents will be modified. </td></tr>
    <tr><td class="paramname">which</td><td>one of STRING_START, STRING_END, or STRING_BOTH. </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="strfuncs_8c_source.html#l00089">89</a> of file <a class="el" href="strfuncs_8c_source.html">strfuncs.c</a>.</p>

<p>References <a class="el" href="strfuncs_8h_source.html#l00073">STRING_BOTH</a>, <a class="el" href="strfuncs_8h_source.html#l00072">STRING_END</a>, <a class="el" href="strfuncs_8h_source.html#l00071">STRING_START</a>, and <a class="el" href="strfuncs_8c_source.html#l00089">string_trim()</a>.</p>

<p>Referenced by <a class="el" href="strfuncs_8c_source.html#l00089">string_trim()</a>.</p>

</div>
</div>
</div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="strfuncs_8h.html">strfuncs.h</a>      </li>
      <li class="footer">Generated on Tue Apr 19 2011 for SphinxBase by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </li>
    </ul>
  </div>

</body>
</html>