<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: JS-CTYPES Status</title>
	<atom:link href="http://starkravingfinkle.org/blog/2008/04/js-ctypes-status/feed/" rel="self" type="application/rss+xml" />
	<link>http://starkravingfinkle.org/blog/2008/04/js-ctypes-status/</link>
	<description></description>
	<pubDate>Wed, 20 Aug 2008 09:28:09 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
		<item>
		<title>By: Bridging the gap between native functions and Active Scripting with a COM-based FFI wrapper &#171; KK&#8217;s Blog</title>
		<link>http://starkravingfinkle.org/blog/2008/04/js-ctypes-status/#comment-6189</link>
		<dc:creator>Bridging the gap between native functions and Active Scripting with a COM-based FFI wrapper &#171; KK&#8217;s Blog</dc:creator>
		<pubDate>Fri, 09 May 2008 19:18:47 +0000</pubDate>
		<guid isPermaLink="false">http://starkravingfinkle.org/blog/2008/04/js-ctypes-status/#comment-6189</guid>
		<description>[...] in April I stumbled upon this post in Planet Mozilla. It discussed recent improvements to JSctypes. It was the first time I had heard [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] in April I stumbled upon this post in Planet Mozilla. It discussed recent improvements to JSctypes. It was the first time I had heard [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christopher Blizzard &#187; Blog Archive &#187; mozilla embedding overview &#38; meetup notes</title>
		<link>http://starkravingfinkle.org/blog/2008/04/js-ctypes-status/#comment-6081</link>
		<dc:creator>Christopher Blizzard &#187; Blog Archive &#187; mozilla embedding overview &#38; meetup notes</dc:creator>
		<pubDate>Tue, 29 Apr 2008 16:45:15 +0000</pubDate>
		<guid isPermaLink="false">http://starkravingfinkle.org/blog/2008/04/js-ctypes-status/#comment-6081</guid>
		<description>[...] embedding apps that want to interact with the web in a different way or Dashboard-style widgets. (JS-ctypes, [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] embedding apps that want to interact with the web in a different way or Dashboard-style widgets. (JS-ctypes, [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Finkle</title>
		<link>http://starkravingfinkle.org/blog/2008/04/js-ctypes-status/#comment-5936</link>
		<dc:creator>Mark Finkle</dc:creator>
		<pubDate>Thu, 17 Apr 2008 18:42:10 +0000</pubDate>
		<guid isPermaLink="false">http://starkravingfinkle.org/blog/2008/04/js-ctypes-status/#comment-5936</guid>
		<description>sky - well, I was originally thinking it would work that way, but just like in Python, JavaScript object properties are stored in a hash and when iterating over the properties, order is not guaranteed (in SpiderMonkey). So, we use an array, just like Python ctypes, to define the struct.

However, when actually using an object (pt1 for example) it is more "normal" for a JavaScript developer to use an object, not an array. Since the struct is defined in an indexed manner (using array), we can allow the use of objects for passing data.

We could merge the concepts of defining the struct and using the struct as well.
&lt;code&gt;
function POINT(x, y) {
  this.x = x; this.y = y;
}

POINT.prototype = {
  _fields_ : [{"x": INT32}, {"y": INT32}]
}

// _fields_ will be used internally to get the primitives
var pointsEqual = library.declare("PointsEqual", STDCALL, BOOLEAN, POINT, POINT);

var pt1 = new POINT(10, 20);
var pt2 = new POINT(20, 20);
var result = pointsEqual(pt1, pt2);
&lt;/code&gt;
Then the POINT object could be used for both defining and using POINTs</description>
		<content:encoded><![CDATA[<p>sky - well, I was originally thinking it would work that way, but just like in Python, JavaScript object properties are stored in a hash and when iterating over the properties, order is not guaranteed (in SpiderMonkey). So, we use an array, just like Python ctypes, to define the struct.</p>
<p>However, when actually using an object (pt1 for example) it is more &#8220;normal&#8221; for a JavaScript developer to use an object, not an array. Since the struct is defined in an indexed manner (using array), we can allow the use of objects for passing data.</p>
<p>We could merge the concepts of defining the struct and using the struct as well.<br />
<pre><code>
function POINT(x, y) {
  this.x = x; this.y = y;
}

POINT.prototype = {
  _fields_ : [{"x": INT32}, {"y": INT32}]
}

// _fields_ will be used internally to get the primitives
var pointsEqual = library.declare("PointsEqual", STDCALL, BOOLEAN, POINT, POINT);

var pt1 = new POINT(10, 20);
var pt2 = new POINT(20, 20);
var result = pointsEqual(pt1, pt2);
</code></pre><br />
Then the POINT object could be used for both defining and using POINTs</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sky</title>
		<link>http://starkravingfinkle.org/blog/2008/04/js-ctypes-status/#comment-5933</link>
		<dc:creator>sky</dc:creator>
		<pubDate>Thu, 17 Apr 2008 13:29:45 +0000</pubDate>
		<guid isPermaLink="false">http://starkravingfinkle.org/blog/2008/04/js-ctypes-status/#comment-5933</guid>
		<description>From the example I'm confused, should the first line be:
var POINT = {"x": INT32, "y": INT32};
XOR the pt1 line be like:
var pt1 = [{"x": 10}, {"y": 20}];
?</description>
		<content:encoded><![CDATA[<p>From the example I&#8217;m confused, should the first line be:<br />
var POINT = {&#8221;x&#8221;: INT32, &#8220;y&#8221;: INT32};<br />
XOR the pt1 line be like:<br />
var pt1 = [{&#8221;x&#8221;: 10}, {&#8221;y&#8221;: 20}];<br />
?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
