<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>code for loading test message data</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.2.15 --> <center> <a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="modules.html">Modules</a> <a class="qindex" href="annotated.html">Data Structures</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Data Fields</a> <a class="qindex" href="pages.html">Related Pages</a> </center> <hr><h1>code for loading test message data<br> <small> [<a class="el" href="group__DBusInternals.html">D-BUS internal implementation details</a>]</small> </h1>code for loading up test data for unit tests. <a href="#_details">More...</a><table border=0 cellpadding=0 cellspacing=0> <tr><td colspan=2><br><h2>Data Structures</h2></td></tr> <tr><td nowrap align=right valign=top>struct </td><td valign=bottom><a class="el" href="structSavedLength.html">SavedLength</a></td></tr> <tr><td> </td><td><font size=-1><em>Saved length.</em> <a href="structSavedLength.html#_details">More...</a><em></em></font><br><br></td></tr> <tr><td colspan=2><br><h2>Defines</h2></td></tr> <tr><td nowrap align=right valign=top>#define </td><td valign=bottom><a class="el" href="group__DBusMessageBuilder.html#a13">SAVE_FOR_UNALIGN</a>(str, boundary)</td></tr> <tr><td> </td><td><font size=-1><em>Saves the segment to delete in order to unalign the next item.</em> <a href="#a13">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>#define </td><td valign=bottom><a class="el" href="group__DBusMessageBuilder.html#a14">PERFORM_UNALIGN</a>(str)</td></tr> <tr><td> </td><td><font size=-1><em>Deletes the alignment padding.</em> <a href="#a14">More...</a><em></em></font><br><br></td></tr> <tr><td colspan=2><br><h2>Functions</h2></td></tr> <tr><td nowrap align=right valign=top><a class="el" href="group__DBusTypes.html#a2">dbus_bool_t</a> </td><td valign=bottom><a class="el" href="group__DBusMessageBuilder.html#a12">_dbus_message_data_load</a> (<a class="el" href="structDBusString.html">DBusString</a> *dest, const <a class="el" href="structDBusString.html">DBusString</a> *filename)</td></tr> <tr><td> </td><td><font size=-1><em>Reads the given filename, which should be in "message description language" (look at some examples), and builds up the message data from it.</em> <a href="#a12">More...</a><em></em></font><br><br></td></tr> </table> <hr><a name="_details"></a><h2>Detailed Description</h2> code for loading up test data for unit tests. <p> <p> The code in here is used for unit testing, it loads up message data from a description in a file. <hr><h2>Define Documentation</h2> <a name="a14" doxytag="dbus-message-builder.c::PERFORM_UNALIGN"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> #define PERFORM_UNALIGN</td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">str </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top">) </td> <td class="md" nowrap> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> <b>Value:</b><div class="fragment"><pre><font class="keywordflow">if</font> (unalign) \ { \ _dbus_string_delete ((str), align_pad_start, \ align_pad_end - align_pad_start); \ unalign = FALSE; \ }</pre></div>Deletes the alignment padding. <p> <p> Definition at line <a class="el" href="dbus-message-builder_8c-source.html#l00184">184</a> of file <a class="el" href="dbus-message-builder_8c-source.html">dbus-message-builder.c</a>. </td> </tr> </table> <a name="a13" doxytag="dbus-message-builder.c::SAVE_FOR_UNALIGN"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> #define SAVE_FOR_UNALIGN</td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">str, <tr> <td></td> <td></td> <td class="md" nowrap>boundary </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top">) </td> <td class="md" nowrap> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> <b>Value:</b><div class="fragment"><pre><font class="keywordtype">int</font> align_pad_start = _dbus_string_get_length (str); \ <font class="keywordtype">int</font> align_pad_end = _DBUS_ALIGN_VALUE (align_pad_start, (boundary))</pre></div>Saves the segment to delete in order to unalign the next item. <p> <p> Definition at line <a class="el" href="dbus-message-builder_8c-source.html#l00179">179</a> of file <a class="el" href="dbus-message-builder_8c-source.html">dbus-message-builder.c</a>. </td> </tr> </table> <hr><h2>Function Documentation</h2> <a name="a12" doxytag="dbus-message-builder.c::_dbus_message_data_load"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> <a class="el" href="group__DBusTypes.html#a2">dbus_bool_t</a> _dbus_message_data_load </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="structDBusString.html">DBusString</a> * </td> <td class="mdname" nowrap> <em>dest</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>const <a class="el" href="structDBusString.html">DBusString</a> * </td> <td class="mdname" nowrap> <em>filename</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Reads the given filename, which should be in "message description language" (look at some examples), and builds up the message data from it. <p> The message data may be invalid, or valid. <p> The parser isn't very strict, it's just a hack for test programs. <p> The file format is: <div class="fragment"><pre> VALID_HEADER <type> normal header; byte order, type, padding, header len, body len, serial REQUIRED_FIELDS add required fields with placeholder values BIG_ENDIAN <font class="keywordflow">switch</font> to big endian LITTLE_ENDIAN <font class="keywordflow">switch</font> to little endian OPPOSITE_ENDIAN <font class="keywordflow">switch</font> to opposite endian ALIGN <N> aligns to the given value UNALIGN skips alignment <font class="keywordflow">for</font> the next marshal BYTE <N> inserts the given integer in [0,255] or <font class="keywordtype">char</font> in <font class="charliteral">'a'</font> format START_LENGTH <name> marks the start of a length to measure END_LENGTH <name> records the length since START_LENGTH under the given name (or <font class="keywordflow">if</font> no START_LENGTH, absolute length) LENGTH <name> inserts the saved length of the same name CHOP <N> chops last N bytes off the data HEADER_FIELD <fieldname> inserts a header field name byte TYPE <typename> inserts a typecode byte </pre></div> <p> Following commands insert aligned data unless preceded by "UNALIGN": <div class="fragment"><pre> INT32 <N> marshals an INT32 UINT32 <N> marshals a UINT32 INT64 <N> marshals an INT64 UINT64 <N> marshals a UINT64 DOUBLE <N> marshals a <font class="keywordtype">double</font> STRING 'Foo' marshals a string OBJECT_PATH '/foo/bar' marshals an object path BYTE_ARRAY { <font class="charliteral">'a'</font>, 3, 4, 5, 6} marshals a BYTE array BOOLEAN_ARRAY { <font class="keyword">false</font>, <font class="keyword">true</font>, <font class="keyword">false</font>} marshals a BOOLEAN array INT32_ARRAY { 3, 4, 5, 6} marshals an INT32 array UINT32_ARRAY { 3, 4, 5, 6} marshals an UINT32 array DOUBLE_ARRAY { 1.0, 2.0, 3.0, 4.0} marshals a DOUBLE array STRING_ARRAY { <font class="stringliteral">"foo"</font>, <font class="stringliteral">"bar"</font>, <font class="stringliteral">"gazonk"</font>} marshals a STRING array </pre></div> <p> <p> <dl compact><dt><b> <a class="el" href="todo.html#_todo000030">Todo: </a></b><dd> add support for array types INT32_ARRAY { 3, 4, 5, 6 } and so forth.</dl><dl compact><dt><b> Parameters: </b><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em>dest</em> </td><td> the string to append the message data to </td></tr> <tr><td valign=top><em>filename</em> </td><td> the filename to load </td></tr> </table> </dl><dl compact><dt><b> Returns: </b><dd> <a class="el" href="group__DBusMacros.html#a2">TRUE</a> on success </dl> <p> Definition at line <a class="el" href="dbus-message-builder_8c-source.html#l00577">577</a> of file <a class="el" href="dbus-message-builder_8c-source.html">dbus-message-builder.c</a>. <p> References <a class="el" href="dbus-message-builder_8c-source.html#l00052">SavedLength::endian</a>, <a class="el" href="dbus-message-builder_8c-source.html#l00050">SavedLength::length</a>, <a class="el" href="dbus-errors_8h-source.html#l00044">DBusError::message</a>, <a class="el" href="dbus-message-builder_8c-source.html#l00048">SavedLength::name</a>, <a class="el" href="dbus-message-builder_8c-source.html#l00051">SavedLength::offset</a>, and <a class="el" href="dbus-message-builder_8c-source.html#l00049">SavedLength::start</a>. </td> </tr> </table> <hr><address align="right"><small>Generated on Wed Jun 9 05:01:28 2004 for D-BUS by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.15 </small></address> </body> </html>