<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://techbase.kde.org/skins/common/feed.css?0.2"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://techbase.kde.org/index.php?title=Development/Languages/Smoke/API_Documentation&amp;feed=atom&amp;action=history</id>
		<title>Development/Languages/Smoke/API Documentation - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://techbase.kde.org/index.php?title=Development/Languages/Smoke/API_Documentation&amp;feed=atom&amp;action=history"/>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Languages/Smoke/API_Documentation&amp;action=history"/>
		<updated>2013-05-18T22:03:26Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.20.2</generator>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Development/Languages/Smoke/API_Documentation&amp;diff=50655&amp;oldid=prev</id>
		<title>Burel: moved User:Burel/smoke api documentation to Development/Languages/Smoke/API Documentation</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Languages/Smoke/API_Documentation&amp;diff=50655&amp;oldid=prev"/>
				<updated>2010-04-09T05:31:43Z</updated>
		
		<summary type="html">&lt;p&gt;moved &lt;a href=&quot;/User:Burel/smoke_api_documentation&quot; class=&quot;mw-redirect&quot; title=&quot;User:Burel/smoke api documentation&quot;&gt;User:Burel/smoke api documentation&lt;/a&gt; to &lt;a href=&quot;/Development/Languages/Smoke/API_Documentation&quot; title=&quot;Development/Languages/Smoke/API Documentation&quot;&gt;Development/Languages/Smoke/API Documentation&lt;/a&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='1' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='1' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 05:31, 9 April 2010&lt;/td&gt;
			&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Burel</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Development/Languages/Smoke/API_Documentation&amp;diff=50654&amp;oldid=prev</id>
		<title>Burel: Add more detail to clarify some sections.</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Languages/Smoke/API_Documentation&amp;diff=50654&amp;oldid=prev"/>
				<updated>2010-04-09T05:28:41Z</updated>
		
		<summary type="html">&lt;p&gt;Add more detail to clarify some sections.&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 05:28, 9 April 2010&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 22:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 22:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;inline ModuleIndex findMethod(const char *c, const char *name)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;inline ModuleIndex findMethod(const char *c, const char *name)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;where &amp;quot;c&amp;quot; is the name of the class that owns the method, and &amp;quot;name&amp;quot; is the name of the method you want to find.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Note that this returns a Smoke::ModuleIndex, not just a Smoke::Index.&amp;#160; The ModuleIndex is defined as:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Note that this returns a Smoke::ModuleIndex, not just a Smoke::Index.&amp;#160; The ModuleIndex is defined as:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 30:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 31:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;};&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;};&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;This struct pairs a given smoke object with a specific index.&amp;#160; If you have multiple Smoke objects, a specific Smoke::Index only has meaning within the context of the Smoke object to which it belongs.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;However, you can't just give &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;it &lt;/del&gt;the &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;class name and &lt;/del&gt;the method name.&amp;#160; That's not enough information for Smoke to find the correct method.&amp;#160; You also have to supply Smoke with some information about the number and types of arguments.&amp;#160; This information gets tacked onto the end of the method name, using the following mapping:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;However, you can't just give &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;findMethod() &lt;/ins&gt;the &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;raw &lt;/ins&gt;the method name.&amp;#160; That's not enough information for Smoke to find the correct method.&amp;#160; You also have to supply Smoke with some information about the number and types of arguments &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;that the method accepts&lt;/ins&gt;.&amp;#160; This information gets tacked onto the end of the method name, using the following mapping:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{|&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{|&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;|Scalar variable&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;|Scalar variable&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 77:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 79:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;This gives &lt;/del&gt;the index into Smoke's array of methods.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;methodIdx is now &lt;/ins&gt;the index into Smoke's array of methods.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;==Building the argument stack==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;==Building the argument stack==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 143:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 145:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;The reason &lt;/del&gt;we pass 0 &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;for &lt;/del&gt;the &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;2nd &lt;/del&gt;argument in this &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;example is that &lt;/del&gt;we're calling a constructor, so we're not operating on an object.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;In this example, &lt;/ins&gt;we pass 0 &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;as &lt;/ins&gt;the &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;second &lt;/ins&gt;argument&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;.&amp;#160; This argument is for the object being operated on.&amp;#160; We pass 0 &lt;/ins&gt;in this &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;instance because &lt;/ins&gt;we're calling a constructor, so we're not operating on an object. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt; If we were going to call a method like &amp;quot;label-&amp;gt;show()&amp;quot;, then we would instead write&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;pre&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;fn(m-&amp;gt;method, (void*)label, stack);&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/pre&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;==Getting the return value==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;==Getting the return value==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Burel</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Development/Languages/Smoke/API_Documentation&amp;diff=48837&amp;oldid=prev</id>
		<title>Burel: Translate things from Google's wiki syntax</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Languages/Smoke/API_Documentation&amp;diff=48837&amp;oldid=prev"/>
				<updated>2010-01-22T03:35:50Z</updated>
		
		<summary type="html">&lt;p&gt;Translate things from Google&amp;#039;s wiki syntax&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 03:35, 22 January 2010&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;#summary Outlines the basic usage of the Smoke API.&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=Introduction=&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=Introduction=&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 145:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 143:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The reason we pass &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;pre&amp;gt;&lt;/del&gt;0&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/pre&amp;gt; &lt;/del&gt;for the 2nd argument in this example is that we're calling a constructor, so we're not operating on an object.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The reason we pass 0 for the 2nd argument in this example is that we're calling a constructor, so we're not operating on an object.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;==Getting the return value==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;==Getting the return value==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wwwdeveloper:diff:version:1.11a:oldid:48836:newid:48837 --&gt;
&lt;/table&gt;</summary>
		<author><name>Burel</name></author>	</entry>

	<entry>
		<id>http://techbase.kde.org/index.php?title=Development/Languages/Smoke/API_Documentation&amp;diff=48836&amp;oldid=prev</id>
		<title>Burel: Copy wiki page from PerlQt project's wiki: http://code.google.com/p/perlqt4/wiki/Smoke_API_documentation</title>
		<link rel="alternate" type="text/html" href="http://techbase.kde.org/index.php?title=Development/Languages/Smoke/API_Documentation&amp;diff=48836&amp;oldid=prev"/>
				<updated>2010-01-22T02:57:23Z</updated>
		
		<summary type="html">&lt;p&gt;Copy wiki page from PerlQt project&amp;#039;s wiki: http://code.google.com/p/perlqt4/wiki/Smoke_API_documentation&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;#summary Outlines the basic usage of the Smoke API.&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This page aims to document how the Smoke API works outside of the bounds of any target language specific (Ruby, Perl, etc) details.&lt;br /&gt;
&lt;br /&gt;
=What is Smoke?=&lt;br /&gt;
&lt;br /&gt;
Smoke was designed to make writing bindings to a given library have a common interface.  It parses a library's header files, and indexes a complete list of methods, classes, and types that are defined by the library.  It also includes a other meta info, like if a method  call is declared static or const, if the method is a constructor or destructor, etc.&lt;br /&gt;
&lt;br /&gt;
Smoke is not Qt specific.  However, it is commonly used to write bindings to the Qt library.&lt;br /&gt;
&lt;br /&gt;
Since Smoke just provides a common interface to a library, it means that multiple language bindings can use the same Smoke object to interface with that library.&lt;br /&gt;
&lt;br /&gt;
= Getting started with Smoke =&lt;br /&gt;
&lt;br /&gt;
When making a method call, regardless of language specific syntax, you're always going to have a method name, an object to operate on, and some arguments.  You pass the object straight to Smoke as a void pointer, but we'll discuss the other two parts next.&lt;br /&gt;
&lt;br /&gt;
==Finding the method index==&lt;br /&gt;
&lt;br /&gt;
Smoke stores a giant array of methods.  In order to make a method call, you give Smoke the index into this array that corresponds to the method you want to call.  Each index is of type Smoke::Index, which is just typedef'd to a short.  Obviously, most of the time you're just going to know the name of the method, not whatever Smoke's internal index is.  So, Smoke provides the findMethod method:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
inline ModuleIndex findMethod(const char *c, const char *name)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this returns a Smoke::ModuleIndex, not just a Smoke::Index.  The ModuleIndex is defined as:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
struct ModuleIndex {&lt;br /&gt;
    Smoke* smoke;&lt;br /&gt;
    Index index;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, you can't just give it the class name and the method name.  That's not enough information for Smoke to find the correct method.  You also have to supply Smoke with some information about the number and types of arguments.  This information gets tacked onto the end of the method name, using the following mapping:&lt;br /&gt;
{|&lt;br /&gt;
|Scalar variable&lt;br /&gt;
|&amp;lt;pre&amp;gt;$&amp;lt;/pre&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|Array or hash variable&lt;br /&gt;
|&amp;lt;pre&amp;gt;@&amp;lt;/pre&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|Object&lt;br /&gt;
|&amp;lt;pre&amp;gt;#&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
For instance, if we wanted to instantiate a QLabel with Smoke, we'd first get the Smoke::Index for the &amp;quot;QLabel::QLabel&amp;quot; method.  If we look at the Qt documentation, we can see we can construct a QLabel like so:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
QLabel ( const QString &amp;amp; text, QWidget * parent = 0, Qt::WindowFlags f = 0 )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We already know the class name (&amp;quot;QLabel&amp;quot;), but how do we determine what to pass for the method name/argument info combo?  Well, it starts with the method name, and then there's 3 arguments, a QString (scalar), a QWidget* (object), and an enum Qt::WindowFlags (scalar).  So that's scalar,object,scalar, which corresponds to $#$.  So the method name we pass to findMethod() is &amp;quot;QLabel$#$&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Smoke::ModuleIndex mi = smoke-&amp;gt;findMethod( &amp;quot;QLabel&amp;quot;, &amp;quot;QLabel$#$&amp;quot; );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This however does not give us the Smoke::Index we need in order to call a method.  For some methods, the &amp;quot;munged&amp;quot; method name, aka &amp;quot;QLabel$#$&amp;quot; in our example, is not unique enough to resolve to a single method.  These methods require further processing to determine the correct method to call, which is beyond the scope of this intro document.  Just remember for now that the return value can be interpreted as follows:&lt;br /&gt;
{|&lt;br /&gt;
|Positive number&lt;br /&gt;
|Single match&lt;br /&gt;
|-&lt;br /&gt;
|Zero&lt;br /&gt;
|No match&lt;br /&gt;
|-&lt;br /&gt;
|Negative number&lt;br /&gt;
|Multiple match&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
For our purposes, we can continue:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Smoke::Index methodIdx;&lt;br /&gt;
if ( mi.index &amp;gt; 0 ) {&lt;br /&gt;
    methodIdx = smoke-&amp;gt;methodMaps[mi.index].method;&lt;br /&gt;
}&lt;br /&gt;
else {&lt;br /&gt;
    // Resolve ambiguous method call&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This gives the index into Smoke's array of methods.&lt;br /&gt;
&lt;br /&gt;
==Building the argument stack==&lt;br /&gt;
To provide arguments to a method, Smoke defines a Smoke::Stack.  A Smoke::Stack is an array of Smoke::StackItem's.  A Smoke::StackItem is defined as a union:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
union StackItem {&lt;br /&gt;
    void* s_voidp;&lt;br /&gt;
    bool s_bool;&lt;br /&gt;
    signed char s_char;&lt;br /&gt;
    unsigned char s_uchar;&lt;br /&gt;
    short s_short;&lt;br /&gt;
    unsigned short s_ushort;&lt;br /&gt;
    int s_int;&lt;br /&gt;
    unsigned int s_uint;&lt;br /&gt;
    long s_long;&lt;br /&gt;
    unsigned long s_ulong;&lt;br /&gt;
    float s_float;&lt;br /&gt;
    double s_double;&lt;br /&gt;
    long s_enum;&lt;br /&gt;
    void* s_class;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One important thing to note is that Smoke uses the Smoke::Stack's 0'th element for the method call's return value.  So, when declaring your Smoke::Stack, you have to give it a size of &amp;lt;number of arguments&amp;gt;+1.&lt;br /&gt;
&lt;br /&gt;
Continuing with our QLabel example, we can construct the Smoke::StackItem like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Smoke::StackItem stack[4];&lt;br /&gt;
stack[1].s_voidp = (void*)&amp;quot;Hello, World!&amp;quot;;&lt;br /&gt;
// A null value for the parent will construct a top-level widget&lt;br /&gt;
stack[2].s_voidp = 0;&lt;br /&gt;
// Qt::Dialog is declared in the Qt::WindowType enum and WindowFlags type is a typedef for QFlags&amp;lt;WindowType&amp;gt;. &lt;br /&gt;
stack[3].s_enum = Qt::Dialog;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Making a method call==&lt;br /&gt;
Now we have all the information we need to make a method call.  There's 2 new structs that Smoke defines to keep track of info about methods and classes, and one new typedef we're interested in:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
struct Method {&lt;br /&gt;
    Index classId;         // Index into classes&lt;br /&gt;
    Index name;            // Index into methodNames; real name&lt;br /&gt;
    Index args;            // Index into argumentList&lt;br /&gt;
    unsigned char numArgs; // Number of arguments&lt;br /&gt;
    unsigned char flags;   // MethodFlags (const/static/etc...)&lt;br /&gt;
    Index ret;             // Index into types for the return type&lt;br /&gt;
    Index method;          // Passed to Class.classFn, to call method&lt;br /&gt;
};&lt;br /&gt;
struct Class {&lt;br /&gt;
    const char *className; // Name of the class&lt;br /&gt;
    bool external;         // Whether the class is in another module&lt;br /&gt;
    Index parents;         // Index into inheritanceList&lt;br /&gt;
    ClassFn classFn;       // Calls any method in the class&lt;br /&gt;
    EnumFn enumFn;         // Handles enum pointers&lt;br /&gt;
    unsigned short flags;  // ClassFlags&lt;br /&gt;
};&lt;br /&gt;
typedef void (*ClassFn)(Index method, void* obj, Stack args);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Class::classFn element gives a function pointer that actually dispatches the method call for us.  We get that by looking up what class this method call belongs to.  We can then pass our data to that method call.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Smoke::Method* m = qt_Smoke-&amp;gt;methods + methodIdx;&lt;br /&gt;
Smoke::ClassFn fn = qt_Smoke-&amp;gt;classes[m-&amp;gt;classId].classFn;&lt;br /&gt;
fn(m-&amp;gt;method, 0, stack);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The reason we pass &amp;lt;pre&amp;gt;0&amp;lt;/pre&amp;gt; for the 2nd argument in this example is that we're calling a constructor, so we're not operating on an object.&lt;br /&gt;
&lt;br /&gt;
==Getting the return value==&lt;br /&gt;
As mentioned previously, callMethod() will put the return value of the method call on the 0'th element of the Smoke::Stack provided to it.  So to get our QLabel back, we can do this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
QLabel* label = (QLabel*)stack[0];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Basic example==&lt;br /&gt;
The full code to construct a QLabel:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Find the method's index&lt;br /&gt;
Smoke::ModuleIndex mi = smoke-&amp;gt;findMethod( &amp;quot;QLabel&amp;quot;, &amp;quot;QLabel$#$&amp;quot; );&lt;br /&gt;
Smoke::Index methodIdx;&lt;br /&gt;
if ( mi.index &amp;gt; 0 ) {&lt;br /&gt;
    methodIdx = smoke-&amp;gt;methodMaps[mi.index].method;&lt;br /&gt;
}&lt;br /&gt;
else {&lt;br /&gt;
    // Resolve ambiguous method call&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Construct the argument array&lt;br /&gt;
Smoke::StackItem stack[4];&lt;br /&gt;
stack[1].s_voidp = (void*)(&amp;quot;Hello, World!&amp;quot;);&lt;br /&gt;
// A null value for the parent will construct a top-level widget&lt;br /&gt;
stack[2].s_voidp = 0;&lt;br /&gt;
// Qt::Dialog is declared in the Qt::WindowType enum and WindowFlags type is a typedef for QFlags&amp;lt;WindowType&amp;gt;. &lt;br /&gt;
stack[3].s_enum = Qt::Dialog;&lt;br /&gt;
&lt;br /&gt;
// Call the method&lt;br /&gt;
Smoke::Method* m = qt_Smoke-&amp;gt;methods + methodIdx;&lt;br /&gt;
Smoke::ClassFn fn = qt_Smoke-&amp;gt;classes[m-&amp;gt;classId].classFn;&lt;br /&gt;
fn(m-&amp;gt;method, 0, stack);&lt;br /&gt;
&lt;br /&gt;
// Get the return value&lt;br /&gt;
QLabel* label = (QLabel*)stack[0];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Burel</name></author>	</entry>

	</feed>