wcslib (8.2.2)

(root)/
share/
doc/
wcslib-8.2.2/
html/
wcsprintf_8h.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>WCSLIB: wcsprintf.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">WCSLIB<span id="projectnumber">&#160;8.2.2</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.8 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_af99bb3c152a306abd27951285ad1127.html">C</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#define-members">Macros</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle"><div class="title">wcsprintf.h File Reference</div></div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &lt;inttypes.h&gt;</code><br />
<code>#include &lt;stdio.h&gt;</code><br />
</div>
<p><a href="wcsprintf_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="define-members" name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a7af03fe3aabc25673cc012adc1e3f8cc" id="r_a7af03fe3aabc25673cc012adc1e3f8cc"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wcsprintf_8h.html#a7af03fe3aabc25673cc012adc1e3f8cc">WCSPRINTF_PTR</a>(str1,  ptr,  str2)</td></tr>
<tr class="memdesc:a7af03fe3aabc25673cc012adc1e3f8cc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Print addresses in a consistent way.  <br /></td></tr>
<tr class="separator:a7af03fe3aabc25673cc012adc1e3f8cc"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a5c6f91916a0b8f8c2d85274c0ba130f6" id="r_a5c6f91916a0b8f8c2d85274c0ba130f6"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wcsprintf_8h.html#a5c6f91916a0b8f8c2d85274c0ba130f6">wcsprintf_set</a> (FILE *wcsout)</td></tr>
<tr class="memdesc:a5c6f91916a0b8f8c2d85274c0ba130f6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set output disposition for <a class="el" href="wcsprintf_8h.html#a46950abaf5a27347da8160741f98f973" title="Print function used by WCSLIB diagnostic routines.">wcsprintf()</a> and <a class="el" href="wcsprintf_8h.html#aa210b2b1b6f802804265e3bff399300a" title="Print function used by WCSLIB diagnostic routines.">wcsfprintf()</a>.  <br /></td></tr>
<tr class="separator:a5c6f91916a0b8f8c2d85274c0ba130f6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a46950abaf5a27347da8160741f98f973" id="r_a46950abaf5a27347da8160741f98f973"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wcsprintf_8h.html#a46950abaf5a27347da8160741f98f973">wcsprintf</a> (const char *format,...)</td></tr>
<tr class="memdesc:a46950abaf5a27347da8160741f98f973"><td class="mdescLeft">&#160;</td><td class="mdescRight">Print function used by WCSLIB diagnostic routines.  <br /></td></tr>
<tr class="separator:a46950abaf5a27347da8160741f98f973"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa210b2b1b6f802804265e3bff399300a" id="r_aa210b2b1b6f802804265e3bff399300a"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wcsprintf_8h.html#aa210b2b1b6f802804265e3bff399300a">wcsfprintf</a> (FILE *stream, const char *format,...)</td></tr>
<tr class="memdesc:aa210b2b1b6f802804265e3bff399300a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Print function used by WCSLIB diagnostic routines.  <br /></td></tr>
<tr class="separator:aa210b2b1b6f802804265e3bff399300a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab8a869f35385b17a26cb5070ab63e5d5" id="r_ab8a869f35385b17a26cb5070ab63e5d5"><td class="memItemLeft" align="right" valign="top">const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="wcsprintf_8h.html#ab8a869f35385b17a26cb5070ab63e5d5">wcsprintf_buf</a> (void)</td></tr>
<tr class="memdesc:ab8a869f35385b17a26cb5070ab63e5d5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the address of the internal string buffer.  <br /></td></tr>
<tr class="separator:ab8a869f35385b17a26cb5070ab63e5d5"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Routines in this suite allow diagnostic output from <a class="el" href="cel_8h.html#adb2e4565f61a9de5fe278d9035850dc3" title="Print routine for the celprm struct.">celprt()</a>, <a class="el" href="lin_8h.html#a946005b038f5c584691630b5d39369e3" title="Print routine for the linprm struct.">linprt()</a>, <a class="el" href="prj_8h.html#a8785bdf33bdaa3d9d52fd51b621ec8d5" title="Print routine for the prjprm struct.">prjprt()</a>, <a class="el" href="spc_8h.html#a7304d0d00bcf9d2bad1f56ba6d8322ea" title="Print routine for the spcprm struct.">spcprt()</a>, <a class="el" href="tab_8h.html#a6b3768349e9a5e925aab24effddc584f" title="Print routine for the tabprm struct.">tabprt()</a>, <a class="el" href="wcs_8h.html#ab9aeb8cf1afb1bfb22e989580d90fca8" title="Print routine for the wcsprm struct.">wcsprt()</a>, and <a class="el" href="wcserr_8h.html#a6585b9fc3a59b369e3336f3133dd1ca9" title="Print a wcserr struct.">wcserr_prt()</a> to be redirected to a file or captured in a string buffer. Those routines all use <a class="el" href="wcsprintf_8h.html#a46950abaf5a27347da8160741f98f973" title="Print function used by WCSLIB diagnostic routines.">wcsprintf()</a> for output. Likewise <a class="el" href="wcsprintf_8h.html#aa210b2b1b6f802804265e3bff399300a" title="Print function used by WCSLIB diagnostic routines.">wcsfprintf()</a> is used by <a class="el" href="wcshdr_8h.html#adc053d80a9c4da454a52eed34e123633" title="FITS WCS parser routine for binary table and image headers.">wcsbth()</a> and <a class="el" href="wcshdr_8h.html#ac75623ee805ab7d43b0bba684c719a60" title="FITS WCS parser routine for image headers.">wcspih()</a>. Both functions may be used by application programmers to have other output go to the same place. </p>
</div><h2 class="groupheader">Macro Definition Documentation</h2>
<a id="a7af03fe3aabc25673cc012adc1e3f8cc" name="a7af03fe3aabc25673cc012adc1e3f8cc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7af03fe3aabc25673cc012adc1e3f8cc">&#9670;&#160;</a></span>WCSPRINTF_PTR</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define WCSPRINTF_PTR</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">str1, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">ptr, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">str2&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line">  <span class="keywordflow">if</span> (ptr) { \</div>
<div class="line">    wcsprintf(<span class="stringliteral">&quot;%s%#&quot;</span> PRIxPTR <span class="stringliteral">&quot;%s&quot;</span>, (str1), (uintptr_t)(ptr), (str2)); \</div>
<div class="line">  } <span class="keywordflow">else</span> { \</div>
<div class="line">    wcsprintf(<span class="stringliteral">&quot;%s0x0%s&quot;</span>, (str1), (str2)); \</div>
<div class="line">  }</div>
</div><!-- fragment -->
<p>Print addresses in a consistent way. </p>
<p><b>WCSPRINTF_PTR</b>() is a preprocessor macro used to print addresses in a consistent way.</p>
<p>On some systems the &quot;p&quot; format descriptor renders a NULL pointer as the string &quot;0x0&quot;. On others, however, it produces &quot;0&quot; or even &quot;(nil)&quot;. On some systems a non-zero address is prefixed with &quot;0x&quot;, on others, not.</p>
<p>The <b>WCSPRINTF_PTR</b>() macro ensures that a NULL pointer is always rendered as &quot;0x0&quot; and that non-zero addresses are prefixed with &quot;0x&quot; thus providing consistency, for example, for comparing the output of test programs. </p>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="a5c6f91916a0b8f8c2d85274c0ba130f6" name="a5c6f91916a0b8f8c2d85274c0ba130f6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5c6f91916a0b8f8c2d85274c0ba130f6">&#9670;&#160;</a></span>wcsprintf_set()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int wcsprintf_set </td>
          <td>(</td>
          <td class="paramtype">FILE *&#160;</td>
          <td class="paramname"><em>wcsout</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set output disposition for <a class="el" href="wcsprintf_8h.html#a46950abaf5a27347da8160741f98f973" title="Print function used by WCSLIB diagnostic routines.">wcsprintf()</a> and <a class="el" href="wcsprintf_8h.html#aa210b2b1b6f802804265e3bff399300a" title="Print function used by WCSLIB diagnostic routines.">wcsfprintf()</a>. </p>
<p><b>wcsprintf_set</b>() sets the output disposition for <a class="el" href="wcsprintf_8h.html#a46950abaf5a27347da8160741f98f973" title="Print function used by WCSLIB diagnostic routines.">wcsprintf()</a> which is used by the <a class="el" href="cel_8h.html#adb2e4565f61a9de5fe278d9035850dc3" title="Print routine for the celprm struct.">celprt()</a>, <a class="el" href="lin_8h.html#a946005b038f5c584691630b5d39369e3" title="Print routine for the linprm struct.">linprt()</a>, <a class="el" href="prj_8h.html#a8785bdf33bdaa3d9d52fd51b621ec8d5" title="Print routine for the prjprm struct.">prjprt()</a>, <a class="el" href="spc_8h.html#a7304d0d00bcf9d2bad1f56ba6d8322ea" title="Print routine for the spcprm struct.">spcprt()</a>, <a class="el" href="tab_8h.html#a6b3768349e9a5e925aab24effddc584f" title="Print routine for the tabprm struct.">tabprt()</a>, <a class="el" href="wcs_8h.html#ab9aeb8cf1afb1bfb22e989580d90fca8" title="Print routine for the wcsprm struct.">wcsprt()</a>, and <a class="el" href="wcserr_8h.html#a6585b9fc3a59b369e3336f3133dd1ca9" title="Print a wcserr struct.">wcserr_prt()</a> routines, and for <a class="el" href="wcsprintf_8h.html#aa210b2b1b6f802804265e3bff399300a" title="Print function used by WCSLIB diagnostic routines.">wcsfprintf()</a> which is used by <a class="el" href="wcshdr_8h.html#adc053d80a9c4da454a52eed34e123633" title="FITS WCS parser routine for binary table and image headers.">wcsbth()</a> and <a class="el" href="wcshdr_8h.html#ac75623ee805ab7d43b0bba684c719a60" title="FITS WCS parser routine for image headers.">wcspih()</a>.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">wcsout</td><td>Pointer to an output stream that has been opened for writing, e.g. by the fopen() stdio library function, or one of the predefined stdio output streams - stdout and stderr. If zero (NULL), output is written to an internally-allocated string buffer, the address of which may be obtained by <a class="el" href="wcsprintf_8h.html#ab8a869f35385b17a26cb5070ab63e5d5" title="Get the address of the internal string buffer.">wcsprintf_buf()</a>.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Status return value:<ul>
<li>0: Success. </li>
</ul>
</dd></dl>

</div>
</div>
<a id="a46950abaf5a27347da8160741f98f973" name="a46950abaf5a27347da8160741f98f973"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a46950abaf5a27347da8160741f98f973">&#9670;&#160;</a></span>wcsprintf()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int wcsprintf </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>format</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>...</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Print function used by WCSLIB diagnostic routines. </p>
<p><b>wcsprintf</b>() is used by <a class="el" href="cel_8h.html#adb2e4565f61a9de5fe278d9035850dc3" title="Print routine for the celprm struct.">celprt()</a>, <a class="el" href="lin_8h.html#a946005b038f5c584691630b5d39369e3" title="Print routine for the linprm struct.">linprt()</a>, <a class="el" href="prj_8h.html#a8785bdf33bdaa3d9d52fd51b621ec8d5" title="Print routine for the prjprm struct.">prjprt()</a>, <a class="el" href="spc_8h.html#a7304d0d00bcf9d2bad1f56ba6d8322ea" title="Print routine for the spcprm struct.">spcprt()</a>, <a class="el" href="tab_8h.html#a6b3768349e9a5e925aab24effddc584f" title="Print routine for the tabprm struct.">tabprt()</a>, <a class="el" href="wcs_8h.html#ab9aeb8cf1afb1bfb22e989580d90fca8" title="Print routine for the wcsprm struct.">wcsprt()</a>, and <a class="el" href="wcserr_8h.html#a6585b9fc3a59b369e3336f3133dd1ca9" title="Print a wcserr struct.">wcserr_prt()</a> for diagnostic output which by default goes to stdout. However, it may be redirected to a file or string buffer via <b>wcsprintf_set</b>().</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">format</td><td>Format string, passed to one of the printf(3) family of stdio library functions. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">...</td><td>Argument list matching format, as per printf(3).</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Number of bytes written. </dd></dl>

</div>
</div>
<a id="aa210b2b1b6f802804265e3bff399300a" name="aa210b2b1b6f802804265e3bff399300a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa210b2b1b6f802804265e3bff399300a">&#9670;&#160;</a></span>wcsfprintf()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int wcsfprintf </td>
          <td>(</td>
          <td class="paramtype">FILE *&#160;</td>
          <td class="paramname"><em>stream</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>format</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>...</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Print function used by WCSLIB diagnostic routines. </p>
<p><b>wcsfprintf</b>() is used by <a class="el" href="wcshdr_8h.html#adc053d80a9c4da454a52eed34e123633" title="FITS WCS parser routine for binary table and image headers.">wcsbth()</a>, and <a class="el" href="wcshdr_8h.html#ac75623ee805ab7d43b0bba684c719a60" title="FITS WCS parser routine for image headers.">wcspih()</a> for diagnostic output which they send to stderr. However, it may be redirected to a file or string buffer via <a class="el" href="wcsprintf_8h.html#a5c6f91916a0b8f8c2d85274c0ba130f6" title="Set output disposition for wcsprintf() and wcsfprintf().">wcsprintf_set()</a>.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">stream</td><td>The output stream if not overridden by a call to <a class="el" href="wcsprintf_8h.html#a5c6f91916a0b8f8c2d85274c0ba130f6" title="Set output disposition for wcsprintf() and wcsfprintf().">wcsprintf_set()</a>. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">format</td><td>Format string, passed to one of the printf(3) family of stdio library functions. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">...</td><td>Argument list matching format, as per printf(3).</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Number of bytes written. </dd></dl>

</div>
</div>
<a id="ab8a869f35385b17a26cb5070ab63e5d5" name="ab8a869f35385b17a26cb5070ab63e5d5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab8a869f35385b17a26cb5070ab63e5d5">&#9670;&#160;</a></span>wcsprintf_buf()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">wcsprintf_buf </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get the address of the internal string buffer. </p>
<p><b>wcsprintf_buf</b>() returns the address of the internal string buffer created when <a class="el" href="wcsprintf_8h.html#a5c6f91916a0b8f8c2d85274c0ba130f6" title="Set output disposition for wcsprintf() and wcsfprintf().">wcsprintf_set()</a> is invoked with its FILE* argument set to zero.</p>
<dl class="section return"><dt>Returns</dt><dd>Address of the internal string buffer. The user may free this buffer by calling <a class="el" href="wcsprintf_8h.html#a5c6f91916a0b8f8c2d85274c0ba130f6" title="Set output disposition for wcsprintf() and wcsfprintf().">wcsprintf_set()</a> with a valid FILE*, e.g. stdout. The free() stdlib library function must NOT be invoked on this const pointer. </dd></dl>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Wed Nov 29 2023 19:09:57 for WCSLIB by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.8
</small></address>
</body>
</html>