Sophie

Sophie

distrib > Mandriva > 2010.1 > x86_64 > media > contrib-backports > by-pkgid > 23de0e949a34266d600441ec63375ce7 > files > 8

api-sanity-checker-1.12.9-3mdv2010.2.noarch.rpm


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" dir="ltr">
<head>
<title>Specialized Type - ISP_RAS</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="generator" content="MediaWiki 1.16.0" />
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch_desc.php" title="ISP_RAS (en)" />
<link rel="alternate" type="application/atom+xml" title="ISP_RAS Atom feed" href="/index.php?title=Special:RecentChanges&amp;feed=atom" />
<link rel="stylesheet" href="/skins/common/shared.css?270" media="screen" />
<link rel="stylesheet" href="/skins/common/commonPrint.css?270" media="print" />
<link rel="stylesheet" href="/skins/monobook/main.css?270" media="screen" />
<!--[if lt IE 5.5000]><link rel="stylesheet" href="/skins/monobook/IE50Fixes.css?270" media="screen" /><![endif]-->
<!--[if IE 5.5000]><link rel="stylesheet" href="/skins/monobook/IE55Fixes.css?270" media="screen" /><![endif]-->
<!--[if IE 6]><link rel="stylesheet" href="/skins/monobook/IE60Fixes.css?270" media="screen" /><![endif]-->
<!--[if IE 7]><link rel="stylesheet" href="/skins/monobook/IE70Fixes.css?270" media="screen" /><![endif]-->
<link rel="stylesheet" href="/index.php?title=MediaWiki:Common.css&amp;usemsgcache=yes&amp;ctype=text%2Fcss&amp;smaxage=18000&amp;action=raw&amp;maxage=18000" />
<link rel="stylesheet" href="/index.php?title=MediaWiki:Print.css&amp;usemsgcache=yes&amp;ctype=text%2Fcss&amp;smaxage=18000&amp;action=raw&amp;maxage=18000" media="print" />
<link rel="stylesheet" href="/index.php?title=MediaWiki:Monobook.css&amp;usemsgcache=yes&amp;ctype=text%2Fcss&amp;smaxage=18000&amp;action=raw&amp;maxage=18000" />
<link rel="stylesheet" href="/index.php?title=-&amp;action=raw&amp;maxage=18000&amp;gen=css" />
<script>
var skin="monobook",
stylepath="/skins",
wgUrlProtocols="http\\:\\/\\/|https\\:\\/\\/|ftp\\:\\/\\/|irc\\:\\/\\/|gopher\\:\\/\\/|telnet\\:\\/\\/|nntp\\:\\/\\/|worldwind\\:\\/\\/|mailto\\:|news\\:|svn\\:\\/\\/",
wgArticlePath="/index.php/$1",
wgScriptPath="",
wgScriptExtension=".php",
wgScript="/index.php",
wgVariantArticlePath=false,
wgActionPaths={},
wgServer="http://ispras.linuxfoundation.org",
wgCanonicalNamespace="",
wgCanonicalSpecialPageName=false,
wgNamespaceNumber=0,
wgPageName="Specialized_Type",
wgTitle="Specialized Type",
wgAction="view",
wgArticleId=2414,
wgIsArticle=true,
wgUserName=null,
wgUserGroups=null,
wgUserLanguage="en",
wgContentLanguage="en",
wgBreakFrames=false,
wgCurRevisionId=7133,
wgVersion="1.16.0",
wgEnableAPI=true,
wgEnableWriteAPI=true,
wgSeparatorTransformTable=["", ""],
wgDigitTransformTable=["", ""],
wgMainPageTitle="Main Page",
wgFormattedNamespaces={"-2": "Media", "-1": "Special", "0": "", "1": "Talk", "2": "User", "3": "User talk", "4": "ISP RAS", "5": "ISP RAS talk", "6": "File", "7": "File talk", "8": "MediaWiki", "9": "MediaWiki talk", "10": "Template", "11": "Template talk", "12": "Help", "13": "Help talk", "14": "Category", "15": "Category talk"},
wgNamespaceIds={"media": -2, "special": -1, "": 0, "talk": 1, "user": 2, "user_talk": 3, "isp_ras": 4, "isp_ras_talk": 5, "file": 6, "file_talk": 7, "mediawiki": 8, "mediawiki_talk": 9, "template": 10, "template_talk": 11, "help": 12, "help_talk": 13, "category": 14, "category_talk": 15, "image": 6, "image_talk": 7},
wgSiteName="ISP_RAS",
wgCategories=["API Sanity Autotest"],
wgRestrictionEdit=[],
wgRestrictionMove=[];
</script><script src="/skins/common/wikibits.js?270"></script>
<script src="/skins/common/ajax.js?270"></script>
<script src="/index.php?title=-&amp;action=raw&amp;gen=js&amp;useskin=monobook&amp;270"></script>

</head>
<body class="mediawiki ltr ns-0 ns-subject page-Specialized_Type skin-monobook">
<div id="globalWrapper">
<div id="column-content"><div id="content" >
	<a id="top"></a>
	
	<h1 id="firstHeading" class="firstHeading">Specialized Type</h1>
	<div id="bodyContent">
		
		<div id="contentSub"></div>
		
		<!-- start content -->
<p>The basic idea of <i>specialized types</i> is to provide the test generator (<a href="http://ispras.linuxfoundation.org/index.php/API_Sanity_Autotest" title="API Sanity Autotest">API Sanity Checker</a>) with enough information to generate correct invocation of the target interface in a typical use case and check basic constraints on the return value. The issue is that, for many interfaces, correct invocation requires preparing correct environment and correct parameter values. And this in turn may require calling other interfaces. Specialized type (or "semantic type" of parameter) include information about various initialization means for various environments. Such information can be reused for multiple interfaces each time the same semantic types are used, which greatly speeds up the development. Correct values for simple types are created by generator completely automatically. When an interface has initialization means assigned for all of its parameters (and if necessary for initial environment), the generator can automatically compose a test for this interface.
</p><p>Test development process consists in creating the complete collection of specialized types for the library. Testing of libraries with numerous interfaces by this methodology requires relatively small effort per test and thus is cheap enough. The efficiency is best revealed for interface sets with the number of interfaces starting from hundreds.
</p>
<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
<ul>
<li class="toclevel-1 tocsection-1"><a href="#C.2FC.2B.2B_Language_Extensions"><span class="tocnumber">1</span> <span class="toctext">C/C++ Language Extensions</span></a></li>
<li class="toclevel-1 tocsection-2"><a href="#Attributes_of_Specialized_Type"><span class="tocnumber">2</span> <span class="toctext">Attributes of Specialized Type</span></a></li>
<li class="toclevel-1 tocsection-3"><a href="#Associating_with_Interfaces"><span class="tocnumber">3</span> <span class="toctext">Associating with Interfaces</span></a></li>
<li class="toclevel-1 tocsection-4"><a href="#Writing_Specialized_Types"><span class="tocnumber">4</span> <span class="toctext">Writing Specialized Types</span></a></li>
<li class="toclevel-1 tocsection-5"><a href="#Writing_Collection_of_Specialized_Types"><span class="tocnumber">5</span> <span class="toctext">Writing Collection of Specialized Types</span></a></li>
<li class="toclevel-1 tocsection-6"><a href="#Using_Test_Data"><span class="tocnumber">6</span> <span class="toctext">Using Test Data</span></a></li>
<li class="toclevel-1 tocsection-7"><a href="#Examples"><span class="tocnumber">7</span> <span class="toctext">Examples</span></a></li>
</ul>
</td></tr></table><script>if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
<h2> <span class="mw-headline" id="C.2FC.2B.2B_Language_Extensions"> C/C++ Language Extensions </span></h2>
<p>Attributes of specialized type should be described on C/C++ language extended by the following instructions:
</p>
<ul><li> <b>$(type)</b> - instruction initializing an instance of data type.
</li></ul>
<pre>   void create_QAbstractProxyModel(QAbstractProxyModel* Obj)
   {
       Obj-&gt;setSourceModel(<span style="color:Brown;"><b>$(QAbstractItemModel*)</b></span>);
   }
</pre>
<ul><li> <b>$[interface]</b> - instruction for interface call with properly initialized parameters.
</li></ul>
<pre>   xmlListPtr create_filled_list()
   {
       xmlListPtr l=<span style="color:Brown"><b>$[xmlListCreate]</b></span>;
       int num=100;
       xmlListPushBack(l,&amp;num);
       return l;
   }
</pre>
<ul><li> <b>$0</b> - an instance of the specialized type.
</li></ul>
<pre>   /*initialize "doc" property of the associated parameter*/
   <span style="color:Brown;"><b>$0</b></span>-&gt;doc = xmlParseMemory("&lt;p/&gt;",4);
</pre>
<ul><li> <b>$1</b>, <b>$2</b>, <b>...</b> - references to 1st, 2nd and other interface parameters.
</li></ul>
<pre>   /*initialize "next" field of the first parameter by the second parameter*/
   <span style="color:Brown;"><b>$1</b></span>-&gt;next=<span style="color:Brown;"><b>$2</b></span>;
</pre>
<pre>   /*write first parameter to the second parameter*/
   <span style="color:Brown;"><b>$2</b></span>.write(<span style="color:Brown;"><b>$1</b></span>);
</pre>
<ul><li> <b>$obj</b> - reference to the object that current method calls on (C++ only).
</li></ul>
<pre>   /*call setStyle() method on the object*/
   <span style="color:Brown;"><b>$obj</b></span>.setStyle(Qt::DotLine);
</pre>
<h2> <span class="mw-headline" id="Attributes_of_Specialized_Type"> Attributes of Specialized Type</span></h2>
<p>Specialized type has the following attributes:
</p>
<ul><li> <b>name</b> - Name of the specialized type.
</li><li> <b>data_type</b> - Name of the associated real data type (QObject*, int, xmlChar ...).
</li><li> <b>value</b> - Value for initialization (true, 1.0, "string").
</li><li> <b>pre_condition/post_condition</b> - Pre/Postcondition on associated function return value or parameter.
</li></ul>
<pre>   <span style="color:Brown;"><b>$0</b></span>!=NULL
</pre>
<ul><li> <b>init_code</b>/<b>final_code</b> - Code that should be invoked before/after function call.
</li></ul>
<pre>   /*call the start() method on the associated parameter*/
   <span style="color:Brown;"><b>$0</b></span>-&gt;start();
</pre>
<ul><li> <b>global_code</b> - Declarations of auxiliary functions and global variables, header includes.
</li></ul>
<pre>   <span style="color:Green;">#include &lt;QWidgetAction&gt;</span>
   QWidgetAction* create_QWidgetAction()
   {
       QWidgetAction* Obj = new QWidgetAction(<span style="color:Brown;"><b>$(QWidget*)</b></span>);
       Obj-&gt;setDefaultWidget(<span style="color:Brown;"><b>$(QWidget*)</b></span>);
       return Obj;
   }
</pre>
<ul><li> <b>libs</b> - List of external shared objects used by this type. Corresponding external header files should be included in the <b>global_code</b> section.
</li><li> <b>kind</b> - Kind of the specialized type.
<ul><li> <i><b>normal</b></i> - This specialized type should be manually associated with the parameters or return values of suitable interfaces.
</li><li> <i><b>common_param</b></i> - This specialized type will be automatically associated with the parameters of all suitable interfaces.
</li><li> <i><b>common_retval</b></i> - This specialized type will be automatically associated with the return values of all suitable interfaces.
</li><li> <i><b>env</b></i> - This kind of specialized type was introduced for setting up correct environment for the interfaces. The code of this specialized<br />type will be added once at the beginning or at the end of main() function in the test for manually associated interface.
</li><li> <i><b>common_env</b></i> - This kind of specialized type is the same as <i><b>env</b></i>, but will be automatically associated with all library interfaces.
</li></ul>
</li></ul>
<h2> <span class="mw-headline" id="Associating_with_Interfaces"> Associating with Interfaces </span></h2>
<p>Specialized Types should be associated with the return values or parameters of some library interfaces. Base type of the specialized type should be the same as base type of return value or parameter. For example, specialized type with data_type='int*' can be associated with any parameter that has 'int' as the base type like int, int**, int&amp;* and others (it is a so-called <i>family of data types</i> - collection of types that have same base type).
</p>
<h2> <span class="mw-headline" id="Writing_Specialized_Types"> Writing Specialized Types </span></h2>
<p>Specialized Type has XML-like structure (you can skip any section if it is not needed):
</p>
<pre> <span style="color:Blue;">&lt;spec_type&gt;</span>
     <span style="color:Green;">&lt;kind&gt;</span>
         &lt;!-- Kind of the specialized type.
              Select it from the following list:
                normal
                common_param
                common_retval
                env
                common_env --&gt;
     <span style="color:Green;">&lt;/kind&gt;</span>
 
     <span style="color:Green;">&lt;data_type&gt;</span>
         &lt;!-- Name of the corresponding real data type, one per line.
              You can specify several data types if kind is 'common_param'
              or 'common_retval', one per line.
              This section is not used if kind is 'env' or 'common_env' --&gt;
     <span style="color:Green;">&lt;/data_type&gt;</span>
     
     <span style="color:Green;">&lt;value&gt;</span>
         &lt;!-- Value for initialization (true, 1.0, \"string\", ...) --&gt;
     <span style="color:Green;">&lt;/value&gt;</span>
     
     <span style="color:Green;">&lt;pre_condition&gt;</span>
         &lt;!-- Precondition on associated function parameter.
                Example: $0!=NULL --&gt;
     <span style="color:Green;">&lt;/pre_condition&gt;</span>
     
     <span style="color:Green;">&lt;post_condition&gt;</span>
         &lt;!-- Postcondition on associated function return value or parameter.
                Example: $0!=NULL &amp;&amp; $obj.style()==Qt::DotLine --&gt;
     <span style="color:Green;">&lt;/post_condition&gt;</span>
     
     <span style="color:Green;">&lt;init_code&gt;</span>
         &lt;!-- Code that should be invoked before function call.
                Example: $0-&gt;start(); --&gt;
     <span style="color:Green;">&lt;/init_code&gt;</span>
     
     <span style="color:Green;">&lt;final_code&gt;</span>
         &lt;!-- Code that should be invoked after function call
                Example: $0-&gt;end(); --&gt;
     <span style="color:Green;">&lt;/final_code&gt;</span>
     
     <span style="color:Green;">&lt;global_code&gt;</span>
         &lt;!-- Declarations of auxiliary functions and global variables, header includes --&gt;
     <span style="color:Green;">&lt;/global_code&gt;</span>
     
     <span style="color:Green;">&lt;associating&gt;</span>
         <span style="color:Purple;">&lt;interfaces&gt;</span>
             &lt;!-- List of interfaces (mangled/symbol names in C++)
                  that will be associated with the specialized type, one per line --&gt;
         <span style="color:Purple;">&lt;/interfaces&gt;</span>
         
         <span style="color:Purple;">&lt;except&gt;</span>
             &lt;!-- List of interfaces (mangled/symbol names in C++)
                  that will not be associated with the specialized type, one per line.
                  This section is used if kind is 'common_env', 'common_param' or 'common_return' --&gt;
         <span style="color:Purple;">&lt;/except&gt;</span>
         
         <span style="color:Purple;">&lt;links&gt;</span>
             &lt;!-- Associations with the return value, parameters or/and object, one per line:
                    param1
                    param2
                     ...
                    object
                    retval --&gt;
         <span style="color:Purple;">&lt;/links&gt;</span>
         
         <span style="color:Purple;">&lt;param_names&gt;</span>
             &lt;!-- Associations with the parameters by name, one per line:
                    param_name1
                    param_name2
                    param_name3
                     ...
                         --&gt;
         <span style="color:Purple;">&lt;/param_names&gt;</span>
     <span style="color:Green;">&lt;/associating&gt;</span>
     
     <span style="color:Green;">&lt;associating&gt;</span>
         &lt;!-- Other associations --&gt;
     <span style="color:Green;">&lt;/associating&gt;</span>
     
     <span style="color:Green;">&lt;name&gt;</span>
         &lt;!-- Name of the specialized type --&gt;
     <span style="color:Green;">&lt;/name&gt;</span>
     
     <span style="color:Green;">&lt;libs&gt;</span>
         &lt;!-- External shared objects, one per line.
              If spectype contains call of the functions from
              some external shared objects then these objects
              should be listed here. Corresponding external
              header files should be included in global_code --&gt;
     <span style="color:Green;">&lt;/libs&gt;</span>
     
     <span style="color:Green;">&lt;lib_version&gt;</span>
       &lt;!-- Constraint on the library version
            to which this spectype will be applied.
            Select it from the following list:
              x.y.z
              &gt;=x.y.z
              &lt;=x.y.z --&gt;
     <span style="color:Green;">&lt;/lib_version&gt;</span>
 <span style="color:Blue;">&lt;/spec_type&gt;</span>
</pre>
<h2> <span class="mw-headline" id="Writing_Collection_of_Specialized_Types"> Writing Collection of Specialized Types </span></h2>
<p>You can unite several specialized types into collection(s):
</p>
<pre> <span style="color:Red;">&lt;collection&gt;</span>
     <span style="color:Blue;">&lt;lib_version&gt;</span>
       &lt;!-- Constraint on the library version
            to which this collection will be applied.
            Select it from the following list:
              x.y.z
              &gt;=x.y.z
              &lt;=x.y.z --&gt;
     <span style="color:Blue;">&lt;/lib_version&gt;</span>
 
     <span style="color:Blue;">&lt;spec_type&gt;</span>
         &lt;!-- Specialized Type №1 --&gt;
     <span style="color:Blue;">&lt;/spec_type&gt;</span>
     
     <span style="color:Blue;">&lt;spec_type&gt;</span>
         &lt;!-- Specialized Type №2 --&gt;
     <span style="color:Blue;">&lt;/spec_type&gt;</span>
     
        ...
     
 <span style="color:Red;">&lt;/collection&gt;</span>
 
 <span style="color:Red;">&lt;collection&gt;</span>
     &lt;!-- Other Collection --&gt;
 <span style="color:Red;">&lt;/collection&gt;</span>

</pre>
<p>The file containing collection(s) of specialized types can be provided to the <a href="http://ispras.linuxfoundation.org/index.php/API_Sanity_Autotest" title="API Sanity Autotest">API Sanity Checker</a> by the <a href="http://ispras.linuxfoundation.org/index.php/API_Sanity_Autotest_Options" title="API Sanity Autotest Options">-specialized-types</a> (<a href="http://ispras.linuxfoundation.org/index.php/API_Sanity_Autotest_Options" title="API Sanity Autotest Options">-st</a>) option:<br />
&nbsp;&nbsp;<code style="border: dashed 1px gray; background-color: #f0f0f0;">&nbsp;perl api-sanity-checker.pl -specialized-types <i>&lt;spectypes.xml&gt;</i> -gen -build -run&nbsp;</code>
</p>
<h2> <span class="mw-headline" id="Using_Test_Data"> Using Test Data </span></h2>
<p>Test data (special files needed by tests) should be created in some directory before generating tests. Path to that directory should be provided to <a href="http://ispras.linuxfoundation.org/index.php/API_Sanity_Autotest" title="API Sanity Autotest">API Sanity Checker</a> by the <a href="http://ispras.linuxfoundation.org/index.php/API_Sanity_Autotest_Options" title="API Sanity Autotest Options">-test-data</a> (<a href="http://ispras.linuxfoundation.org/index.php/API_Sanity_Autotest_Options" title="API Sanity Autotest Options">-td</a>) option:<br />
&nbsp;&nbsp;<code style="border: dashed 1px gray; background-color: #f0f0f0;">&nbsp;perl api-sanity-checker.pl -test-data <i>&lt;directory&gt;</i> -specialized-types <i>&lt;spectypes.xml&gt;</i> -gen -build -run&nbsp;</code>
</p><p>For accessing test data files in the attributes of specialized types you should use TEST_DATA_PATH("file") construction. Test generator will copy specified file to the local "testdata/" directory and replace TEST_DATA_PATH("file") with the "testdata/file" in the generated code.
</p>
<pre>   QSound* create_QSound()
   {
       QSound* Obj = new QSound(<span style="color:Brown;"><b>TEST_DATA_PATH</b></span>("SoundFile.wav"), NULL);
       Obj-&gt;setLoops(5);
       return Obj;
   }
</pre>
<h2> <span class="mw-headline" id="Examples"> Examples </span></h2>
<ul><li> Setting up environment for all interfaces from the <a href="http://qt.nokia.com/" class="external text" rel="nofollow">QtCore</a> library:
</li></ul>
<pre> <span style="color:Blue;">&lt;spec_type&gt;</span>
     <span style="color:Green;">&lt;kind&gt;</span>
         common_env
     <span style="color:Green;">&lt;/kind&gt;</span>
 
     <span style="color:Green;">&lt;global_code&gt;</span>
         #include&lt;QApplication&gt;
         #include&lt;QTimer&gt;
     <span style="color:Green;">&lt;/global_code&gt;</span>
 
     <span style="color:Green;">&lt;init_code&gt;</span>
         #ifdef Q_WS_X11
           bool useGUI = getenv( "DISPLAY" )&nbsp;!= 0;
         #else
           bool useGUI = TRUE;
         #endif
         QApplication* app = new QApplication(argc, argv, useGUI);
     <span style="color:Green;">&lt;/init_code&gt;</span>
 
     <span style="color:Green;">&lt;final_code&gt;</span>
         QTimer::singleShot(100, app, SLOT(quit()));
         app-&gt;exec();
     <span style="color:Green;">&lt;/final_code&gt;</span>
 <span style="color:Blue;">&lt;/spec_type&gt;</span>
</pre>
<ul><li> Setting up environment for all interfaces from the <a href="http://www.gtk.org/" class="external text" rel="nofollow">gtk+</a> library:
</li></ul>
<pre> <span style="color:Blue;">&lt;spec_type&gt;</span>
     <span style="color:Green;">&lt;kind&gt;</span>
         common_env
     <span style="color:Green;">&lt;/kind&gt;</span>
 
     <span style="color:Green;">&lt;init_code&gt;</span>
         gtk_init(&amp;argc, &amp;argv);
     <span style="color:Green;">&lt;/init_code&gt;</span>
 
     <span style="color:Green;">&lt;final_code&gt;</span>
        gtk_timeout_add(100, &amp;main_loop_quit, NULL);
        gtk_main();
     <span style="color:Green;">&lt;/final_code&gt;</span>
 
     <span style="color:Green;">&lt;global_code&gt;</span>
         #include &lt;gtk.h&gt;
         gboolean main_loop_quit(gpointer data)
         {
             gtk_main_quit();
             return FALSE;
         }
     <span style="color:Green;">&lt;/global_code&gt;</span>
 
     <span style="color:Green;">&lt;associating&gt;</span>
         <span style="color:Purple;">&lt;except&gt;</span>
             gtk_init
             gtk_init_check
             gtk_parse_args
             gdk_init
             gdk_init_check
             gdk_parse_args
             gtk_test_init
         <span style="color:Purple;">&lt;/except&gt;</span>
     <span style="color:Green;">&lt;/associating&gt;</span>
 <span style="color:Blue;">&lt;/spec_type&gt;</span>
 
</pre>
<ul><li> Setting up environment for all interfaces and correct initialization for parameters of type GObject* in the <a href="http://library.gnome.org/devel/atk/" class="external text" rel="nofollow">atk</a> library:
</li></ul>
<pre> <span style="color:Blue;">&lt;spec_type&gt;</span>
     <span style="color:Green;">&lt;kind&gt;</span>
         common_env
     <span style="color:Green;">&lt;/kind&gt;</span>
 
     <span style="color:Green;">&lt;init_code&gt;</span>
         g_type_init();
     <span style="color:Green;">&lt;/init_code&gt;</span>
 <span style="color:Blue;">&lt;/spec_type&gt;</span>
 
 <span style="color:Blue;">&lt;spec_type&gt;</span>
     <span style="color:Green;">&lt;kind&gt;</span>
         common_param
     <span style="color:Green;">&lt;/kind&gt;</span>
 
     <span style="color:Green;">&lt;data_type&gt;</span>
         GObject*
     <span style="color:Green;">&lt;/data_type&gt;</span>
    
     <span style="color:Green;">&lt;value&gt;</span>
         g_object_new (G_TYPE_OBJECT, NULL)
     <span style="color:Green;">&lt;/value&gt;</span>
    
     <span style="color:Green;">&lt;global_code&gt;</span>
         #include &lt;glib.h&gt;
     <span style="color:Green;">&lt;/global_code&gt;</span>
 <span style="color:Blue;">&lt;/spec_type&gt;</span>
</pre>
<ul><li> Correct initialization for all parameters of type xmlListPtr in the <a href="http://xmlsoft.org/" class="external text" rel="nofollow">libxml2</a> library:
</li></ul>
<pre> <span style="color:Blue;">&lt;spec_type&gt;</span>
     <span style="color:Green;">&lt;kind&gt;</span>
         common_param
     <span style="color:Green;">&lt;/kind&gt;</span>
 
     <span style="color:Green;">&lt;data_type&gt;</span>
         xmlListPtr
     <span style="color:Green;">&lt;/data_type&gt;</span>
    
     <span style="color:Green;">&lt;value&gt;</span>
         create_filled_list()
     <span style="color:Green;">&lt;/value&gt;</span>
    
     <span style="color:Green;">&lt;constraint&gt;</span>
         $0!=NULL
     <span style="color:Green;">&lt;/constraint&gt;</span>
    
     <span style="color:Green;">&lt;global_code&gt;</span>
         xmlListPtr create_filled_list()
         {
             xmlListPtr l = <span style="color:Brown;"><b>$[xmlListCreate]</b></span>;
             int num = 100;
             xmlListPushBack(l, &amp;num);
             return l;
         }
     <span style="color:Green;">&lt;/global_code&gt;</span>
 <span style="color:Blue;">&lt;/spec_type&gt;</span>
</pre>
<ul><li> Correct initialization for the 1st parameter of interface xmlListAppend(xmlListPtr l, void* data) from <a href="http://xmlsoft.org/" class="external text" rel="nofollow">libxml2</a> library:
</li></ul>
<pre> <span style="color:Blue;">&lt;spec_type&gt;</span>
     <span style="color:Green;">&lt;kind&gt;</span>
         normal
     <span style="color:Green;">&lt;/kind&gt;</span>
     
     <span style="color:Green;">&lt;data_type&gt;</span>
         xmlListPtr
     <span style="color:Green;">&lt;/data_type&gt;</span>
     
     <span style="color:Green;">&lt;value&gt;</span>
         create_filled_list()
     <span style="color:Green;">&lt;/value&gt;</span>
 
     <span style="color:Green;">&lt;global_code&gt;</span>
         xmlListPtr create_filled_list()
         {
             xmlListPtr l = <span style="color:Brown;"><b>$[xmlListCreate]</b></span>;
             int num = 100;
             xmlListPushBack(l, &amp;num);
             return l;
         }
     <span style="color:Green;">&lt;/global_code&gt;</span>
     
     <span style="color:Green;">&lt;associating&gt;</span>
         <span style="color:Purple;">&lt;interfaces&gt;</span>
             xmlListAppend
         <span style="color:Purple;">&lt;/interfaces&gt;</span>
       
         <span style="color:Purple;">&lt;links&gt;</span>
             param1
         <span style="color:Purple;">&lt;/links&gt;</span>
     <span style="color:Green;">&lt;/associating&gt;</span>
 <span style="color:Blue;">&lt;/spec_type&gt;</span>
</pre>
<ul><li> Using test data for initializing all parameters of type xmlTextReaderPtr in the <a href="http://xmlsoft.org/" class="external text" rel="nofollow">libxml2</a> library:
</li></ul>
<pre> <span style="color:Blue;">&lt;spec_type&gt;</span>
     <span style="color:Green;">&lt;kind&gt;</span>
         common_param
     <span style="color:Green;">&lt;/kind&gt;</span>
     
     <span style="color:Green;">&lt;data_type&gt;</span>
         xmlTextReaderPtr
     <span style="color:Green;">&lt;/data_type&gt;</span>
     
     <span style="color:Green;">&lt;value&gt;</span>
         create_reader()
     <span style="color:Green;">&lt;/value&gt;</span>
 
     <span style="color:Green;">&lt;global_code&gt;</span>
         xmlTextReaderPtr create_reader(int n)
         {
             xmlTextReaderPtr reader = xmlReaderForFile(<span style="color:Brown;"><b>TEST_DATA_PATH</b></span>("file.xml"), NULL, 0);
             int i;
             for(i=0; i&lt;n; i+=1)
             {
                 xmlTextReaderRead(reader);
             }
             return reader;
         }
     <span style="color:Green;">&lt;/global_code&gt;</span>
 <span style="color:Blue;">&lt;/spec_type&gt;</span>
</pre>
<ul><li> Checking the return value of interface xmlLinkGetData(xmlLinkPtr lk) from the <a href="http://xmlsoft.org/" class="external text" rel="nofollow">libxml2</a> library:
</li></ul>
<pre> <span style="color:Blue;">&lt;spec_type&gt;</span>
     <span style="color:Green;">&lt;kind&gt;</span>
         normal
     <span style="color:Green;">&lt;/kind&gt;</span>
 
     <span style="color:Green;">&lt;data_type&gt;</span>
         void*
     <span style="color:Green;">&lt;/data_type&gt;</span>
 
     <span style="color:Green;">&lt;constraint&gt;</span>
         $0!=NULL
     <span style="color:Green;">&lt;/constraint&gt;</span>
     
     <span style="color:Green;">&lt;associating&gt;</span>
         <span style="color:Purple;">&lt;interfaces&gt;</span>
             xmlLinkGetData
         <span style="color:Purple;">&lt;/interfaces&gt;</span>
       
         <span style="color:Purple;">&lt;links&gt;</span>
             retval
         <span style="color:Purple;">&lt;/links&gt;</span>
     <span style="color:Green;">&lt;/associating&gt;</span>
 <span style="color:Blue;">&lt;/spec_type&gt;</span>
</pre>
<!-- 
NewPP limit report
Preprocessor node count: 184/1000000
Post-expand include size: 0/2097152 bytes
Template argument size: 0/2097152 bytes
Expensive parser function count: 0/100
-->

<!-- Saved in parser cache with key rasispdb:pcache:idhash:2414-0!1!0!!en!2!edit=0 and timestamp 20110603153802 -->
</div></div></div></div></body></html>