<!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"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.4"/> <title>WCSLIB 4.18: 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="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 style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">WCSLIB 4.18 </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.4 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="annotated.html"><span>Data 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 List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </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> | <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 <stdio.h></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 name="define-members"></a> Macros</h2></td></tr> <tr class="memitem:a7af03fe3aabc25673cc012adc1e3f8cc"><td class="memItemLeft" align="right" valign="top">#define </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"> </td><td class="mdescRight">Print addresses in a consistent way. <a href="#a7af03fe3aabc25673cc012adc1e3f8cc">More...</a><br/></td></tr> <tr class="separator:a7af03fe3aabc25673cc012adc1e3f8cc"><td class="memSeparator" colspan="2"> </td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> Functions</h2></td></tr> <tr class="memitem:a5c6f91916a0b8f8c2d85274c0ba130f6"><td class="memItemLeft" align="right" valign="top">int </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"> </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>. <a href="#a5c6f91916a0b8f8c2d85274c0ba130f6">More...</a><br/></td></tr> <tr class="separator:a5c6f91916a0b8f8c2d85274c0ba130f6"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a46950abaf5a27347da8160741f98f973"><td class="memItemLeft" align="right" valign="top">int </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"> </td><td class="mdescRight">Print function used by WCSLIB diagnostic routines. <a href="#a46950abaf5a27347da8160741f98f973">More...</a><br/></td></tr> <tr class="separator:a46950abaf5a27347da8160741f98f973"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:aa210b2b1b6f802804265e3bff399300a"><td class="memItemLeft" align="right" valign="top">int </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"> </td><td class="mdescRight">Print function used by WCSLIB diagnostic routines. <a href="#aa210b2b1b6f802804265e3bff399300a">More...</a><br/></td></tr> <tr class="separator:aa210b2b1b6f802804265e3bff399300a"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:ab8a869f35385b17a26cb5070ab63e5d5"><td class="memItemLeft" align="right" valign="top">const char * </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"> </td><td class="mdescRight">Get the address of the internal string buffer. <a href="#ab8a869f35385b17a26cb5070ab63e5d5">More...</a><br/></td></tr> <tr class="separator:ab8a869f35385b17a26cb5070ab63e5d5"><td class="memSeparator" colspan="2"> </td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <div class="textblock"><p>These routines 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 class="anchor" id="a7af03fe3aabc25673cc012adc1e3f8cc"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define WCSPRINTF_PTR</td> <td>(</td> <td class="paramtype"> </td> <td class="paramname">str1, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"> </td> <td class="paramname">ptr, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"> </td> <td class="paramname">str2 </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">"%s%#lx%s"</span>, (str1), (<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>)(ptr), (str2)); \</div> <div class="line"> } <span class="keywordflow">else</span> { \</div> <div class="line"> wcsprintf(<span class="stringliteral">"%s0x0%s"</span>, (str1), (str2)); \</div> <div class="line"> }</div> </div><!-- fragment --><p><b>WCSPRINTF_PTR</b>() is a preprocessor macro used to print addresses in a consistent way.</p> <p>On some systems the "p" format descriptor renders a NULL pointer as the string "0x0". On others, however, it produces "0" or even "(nil)". On some systems a non-zero address is prefixed with "0x", on others, not.</p> <p>The <b>WCSPRINTF_PTR</b>() macro ensures that a NULL pointer is always rendered as "0x0" and that non-zero addresses are prefixed with "0x" thus providing consistency, for example, for comparing the output of test programs. </p> </div> </div> <h2 class="groupheader">Function Documentation</h2> <a class="anchor" id="a5c6f91916a0b8f8c2d85274c0ba130f6"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int wcsprintf_set </td> <td>(</td> <td class="paramtype">FILE * </td> <td class="paramname"><em>wcsout</em>)</td><td></td> <td></td> </tr> </table> </div><div class="memdoc"> <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 class="anchor" id="a46950abaf5a27347da8160741f98f973"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int wcsprintf </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"><em>format</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"> </td> <td class="paramname"><em>...</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <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 class="anchor" id="aa210b2b1b6f802804265e3bff399300a"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int wcsfprintf </td> <td>(</td> <td class="paramtype">FILE * </td> <td class="paramname"><em>stream</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char * </td> <td class="paramname"><em>format</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"> </td> <td class="paramname"><em>...</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <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 class="anchor" id="ab8a869f35385b17a26cb5070ab63e5d5"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">wcsprintf_buf </td> <td>(</td> <td class="paramtype">void </td> <td class="paramname">)</td><td></td> <td></td> </tr> </table> </div><div class="memdoc"> <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 Sat Jul 13 2013 20:00:27 for WCSLIB 4.18 by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.4 </small></address> </body> </html>