<?xml version='1.0' encoding='UTF-8' ?>
<rss version="2.0" xml:base="http://www.cincomsmalltalk.com/userblogs/bobw/" xmlns:admin="http://webns.net/mvcb/" xmlns:blogChannel="http://backend.userland.com/blogChannelModule" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:icbm="http://postneo.com/icbm" xmlns:includedComments="http://www.laudably.com/rss2-comments" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:media="http://search.yahoo.com/mrss/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/">
	<channel>
		<title>Bob Westergaard - Blog</title>
		<link>http://www.cincomsmalltalk.com/userblogs/bobw/blogView</link>
		<description>Smalltalk Engineer</description>
		<webMaster>bwestergaard@cincom.com</webMaster>
		<lastBuildDate>Sun, 11 Jan 2009 12:26:35 EST</lastBuildDate>
		<image>
			<url>/images/why-small.png</url>
			<title>Bob Westergaard - Blog</title>
			<link>http://www.cincomsmalltalk.com/userblogs/bobw/blogView</link>
			<height>50</height>
			<width>81</width>
		</image>
		<admin:generatorAgent rdf:resource="/CincomSmalltalkWiki/Silt"></admin:generatorAgent>
		<admin:errorReportsTo rdf:resource="mailto:bwestergaard@cincom.com"></admin:errorReportsTo>
		<dc:language>en-us</dc:language>
		<dc:creator>Bob Westergaard</dc:creator>
		<dc:rights>Copyright 2005 Bob Westergaard</dc:rights>
		<dc:date>2009-01-11T12:26:35-05:00</dc:date>
		<icbm:latitude>32.366667</icbm:latitude>
		<icbm:longitude>-121.933333</icbm:longitude>
		<item>
			<title>Interactive Compiler Settings</title>
			<link>http://www.cincomsmalltalk.com/userblogs/bobw/blogView?showComments=true&amp;printTitle=Interactive_Compiler_Settings&amp;entry=3371999512</link>
			<category>Enhancements, Extensions or Effluents?</category>
			<pubDate>Thu, 08 Nov 2007 18:31:52 EST</pubDate>
			<description><![CDATA[<div xmlns="http://www.w3.org/1999/xhtml">
<p>When compiling Smalltalk methods in the system interactively, i.e. accepting in a browser or doing a do-it in a Workspace, the compiler will use the InteractiveCompilerErrorHandler to warn you about any problems.  There are a number of useful warnings that the InteractiveCompilerErrorHandler can tell you about.  For example, a temporary variable that is declared and not referenced or a message is being sent that does not exist yet.</p>

<p>Sometimes, all of these helpful warnings simply get in the way.</p>

<p>I've published a package, InteractiveCompilerSettings, to the public repository that overrides the InteractiveCompilerErrorHandler in such a way that allows you to turn these warnings on and off.   The settings will appear in the VisualWorks settings tool.   The warnings that can be turned on and off are:</p>

<UL>

<LI>Never Read - A variable has been defined, assigned a value and that value is never used.

<LI>Never Used - A variable has been defined and is never used

<LI> Read before written -A variable has been defined, and before it is assigned a value a message is sent to it.

<LI> New Message - A message is being sent that does not exist in the system

<LI> Unknown Pragma - The method being compiled has a pragma that is not defined by the class

</UL>
</div>]]></description>
			<guid isPermaLink="false">3371999512</guid>
			<pingback:server>http://www.cincomsmalltalk.com/userblogs/bobw/servlet/CommentAPIPBServlet?guid=3371999512</pingback:server>
			<pingback:target>http://www.cincomsmalltalk.com/userblogs/bobw/blogView?guid=3371999512</pingback:target>
			<includedComments:comment-collection></includedComments:comment-collection>
			<wfw:comment>http://www.cincomsmalltalk.com/userblogs/bobw/servlet/CommentAPIServlet?guid=3371999512</wfw:comment>
		</item>
		<item>
			<title>Two Steps Forward</title>
			<link>http://www.cincomsmalltalk.com/userblogs/bobw/blogView?showComments=true&amp;printTitle=Two_Steps_Forward&amp;entry=3366043381</link>
			<category>Porting Fun</category>
			<pubDate>Fri, 31 Aug 2007 20:03:01 EDT</pubDate>
			<description><![CDATA[<div xmlns="http://www.w3.org/1999/xhtml">
<p>

A couple of days ago, I received an email that got me thinking about popular music back from the late 80s and early 90s.  I remembered watching a video for the song, <a href="http://en.wikipedia.org/wiki/Opposites_Attract">Opposites Attract</a>, on MTV.  That is the video where Paula Abdul is dancing with <a href="http://www.paula-abdul.net/html/mc_skat_kat.html">MC Skat Kat</a> while singing about taking two steps forward and two steps back.  I'll use that song lyric as inspiration for this blog entry, and show you another step forward with the Doom port before I start blogging about the translation and implementation effort (the steps back).

</p>

<p>

I've done a few tweaks to get the rendering to be a little faster than the last screencast.  One of the things slowing down the last screencast was the conversion of a Depth8Image (Doom has a small palette) to a Depth32Image for displaying.  Dave Wallen made some suggestions that improved this specific conversion from one palette to another one.  Another fairly big slowdown can only be blamed on me being dope, which I will explain at a later time, because frankly it is embarassing.  

</p>

<p>

I still have the same fixed lighting (it does not get darker as you look into the distance) issue.  However, I've added the message displaying ("Picked up a clip") and added the part where the palette shifts when you pick something up or are attacked.   Because this is the second screencast of the port, I've decided to show the second demo (demo2) in the ultimate doom.wad file.  This screencast is on a window rendering the 320x200 bitmap.  It is a little long (nearly two minutes and half minutes) and a little violent.  If you don't like seeing <a href="http://doom.wikia.com/wiki/Imp">imps</a> being <a href="http://doom.wikia.com/wiki/Berserk_pack">berserked</a> <a href="http://doom.wikia.com/wiki/Fists">punched</a>, then you might want to skip this one.

</p>

<p align=center><a href="http://www.cincomsmalltalk.com/files/bobw/screencasts/Doom_Demo2/"><IMG SRC="http://www.cincomsmalltalk.com/files/bobw/images/demo2.jpg" ALIGN="middle" ALT="Doom2 Demo Picture"></a>

</p>

<p>

Click through the DOOM title picture above to see a screencast of the port as it plays the second demo in the <a href="http://www.idsoftware.com/games/doom/doom-ultimate/">Ultimate Doom</a> <a href="http://en.wikipedia.org/wiki/Doom_WAD">WAD file</a>.

</p>
</div>]]></description>
			<guid isPermaLink="false">3366043381</guid>
			<pingback:server>http://www.cincomsmalltalk.com/userblogs/bobw/servlet/CommentAPIPBServlet?guid=3366043381</pingback:server>
			<pingback:target>http://www.cincomsmalltalk.com/userblogs/bobw/blogView?guid=3366043381</pingback:target>
			<includedComments:comment-collection>
				<includedComments:comment>
					<includedComments:guid>blogView?showComments=true&amp;printTitle=Two_Steps_Forward&amp;entry=3366043381</includedComments:guid>
					<includedComments:puid>blogView?showComments=true&amp;printTitle=Two_Steps_Forward&amp;entry=3366043381</includedComments:puid>
					<includedComments:author>
Michael Lucas-Smith</includedComments:author>
					<includedComments:pubDate>2007-08-31T22:21:50-04:00</includedComments:pubDate>
					<includedComments:content>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;p&gt;Comment by 
Michael Lucas-Smith&lt;/p&gt;

&lt;p&gt;


&lt;p&gt;Is it that slow a frame rate or is that just the screencast?&lt;/p&gt;
&lt;/p&gt;
&lt;/div&gt;</includedComments:content>
					<includedComments:title>
Re: Two Steps Forward</includedComments:title>
				</includedComments:comment>
				<includedComments:comment>
					<includedComments:guid>blogView?showComments=true&amp;printTitle=Two_Steps_Forward&amp;entry=3366043381</includedComments:guid>
					<includedComments:puid>blogView?showComments=true&amp;printTitle=Two_Steps_Forward&amp;entry=3366043381</includedComments:puid>
					<includedComments:author>Andres</includedComments:author>
					<includedComments:pubDate>2007-09-01T00:43:50-04:00</includedComments:pubDate>
					<includedComments:content>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;p&gt;Bob,&lt;/p&gt;&lt;p&gt;That&amp;#39;s nice!&amp;nbsp; I used to like Duke Nukem 3D.&amp;nbsp; One thing I learned that it was possible in DN3D as opposed to DOOM was to modify the behavior of the game.&amp;nbsp; There were 3 files in pseudo C lying around in the game&amp;#39;s directory, and inspection would reveal the script for the monsters, the environment, etc.&amp;nbsp; I had a lot of fun rewriting them, and would have done even more if I had had a proper browser to allow better refactoring.&amp;nbsp; The code was copy/pasted all over the place!&lt;/p&gt;&lt;p&gt;Fun times...&lt;/p&gt;&lt;p&gt;Andres.&amp;nbsp;&lt;/p&gt;
&lt;/div&gt;</includedComments:content>
					<includedComments:title>Heh!</includedComments:title>
				</includedComments:comment>
				<includedComments:comment>
					<includedComments:guid>blogView?showComments=true&amp;printTitle=Two_Steps_Forward&amp;entry=3366043381</includedComments:guid>
					<includedComments:puid>blogView?showComments=true&amp;printTitle=Two_Steps_Forward&amp;entry=3366043381</includedComments:puid>
					<includedComments:author></includedComments:author>
					<includedComments:pubDate>2007-09-05T17:12:52-04:00</includedComments:pubDate>
					<includedComments:content>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;p&gt;First, sorry for the late replies.&amp;nbsp;&lt;/p&gt;&lt;p&gt;The screencast looks to me to be fairly representive of what I&amp;#39;m seeing.&lt;/p&gt;&lt;p&gt;&amp;nbsp;As far as&amp;nbsp; Duke Nukem 3d, that game had such effect on me that to this day when I&amp;#39;m looking for something I can&amp;#39;t help but think of Duke saying &amp;quot;where is it?&amp;quot; in my head.&lt;br /&gt;&lt;/p&gt;
&lt;/div&gt;</includedComments:content>
					<includedComments:title>Re: Framerate &amp; Heh!</includedComments:title>
				</includedComments:comment>
				<includedComments:comment>
					<includedComments:guid>blogView?showComments=true&amp;printTitle=Two_Steps_Forward&amp;entry=3366043381</includedComments:guid>
					<includedComments:puid>blogView?showComments=true&amp;printTitle=Two_Steps_Forward&amp;entry=3366043381</includedComments:puid>
					<includedComments:author></includedComments:author>
					<includedComments:pubDate>2007-10-20T03:18:45-04:00</includedComments:pubDate>
					<includedComments:content>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;p&gt;bob....what the hell are you talking about?&amp;nbsp; how do i connect my phone to my computer? :) 
&lt;/p&gt;&lt;/div&gt;</includedComments:content>
					<includedComments:title></includedComments:title>
				</includedComments:comment>
			</includedComments:comment-collection>
			<wfw:comment>http://www.cincomsmalltalk.com/userblogs/bobw/servlet/CommentAPIServlet?guid=3366043381</wfw:comment>
		</item>
		<item>
			<title>VisualWorks is DOOMed</title>
			<link>http://www.cincomsmalltalk.com/userblogs/bobw/blogView?showComments=true&amp;printTitle=VisualWorks_is_DOOMed&amp;entry=3363467171</link>
			<category>Porting Fun</category>
			<pubDate>Thu, 02 Aug 2007 00:26:11 EDT</pubDate>
			<description><![CDATA[<div xmlns="http://www.w3.org/1999/xhtml">
<p>

Last weekend my brother was giving me some grief about not blogging enough.  Hopefully this one will keep me on his <a href="http://www.google.com/ig">iGoogle</a> front page a little while longer.  After all, if I can't keep my family readership numbers up then what is the point of blogging?

</p>

<p>

To pick up where I left off, I was put into a position where I felt I could not publish the Elite code because of what looked like copyright issues.  So, a little more than a year ago, I was forced to find something else to port.  It did not take me very long to decide it had to be <a href="http://en.wikipedia.org/wiki/Doom">DOOM</a>.  After all, <a href="http://en.wikipedia.org/wiki/Versions_and_ports_of_Doom">DOOM has been ported to all sorts of things</a>, including the <a href="http://www.ipodhacks.com/article.php?sid=741">iPod</a>.  I'm sure it will be on the iPhone soon.  However, I don't believe anyone has ported it to VisualWorks (or Smalltalk).  Perhaps I'm wrong.

</p>

<p>

I think instead of writing some rambling blog entries about what I did to get the port going, which eventually lead to the lamest screencast you've ever seen.  I will <a href="http://en.wikipedia.org/wiki/The_Betrayal">start at the end and end at the start</a> and show you my current work in progress.

</p>

<p align=center><a href="http://www.cincomsmalltalk.com/files/bobw/screencasts/Doom_Demo1/"><IMG SRC="http://www.cincomsmalltalk.com/files/bobw/images/doom_title.jpg" ALIGN="middle" ALT="DOOM Title Picture"></a>

</p>

<p>

Click through the DOOM title picture above to see a screencast of the port as it plays the first demo in the <a href="http://www.idsoftware.com/games/doom/doom-ultimate/">Ultimate Doom</a> <a href="http://en.wikipedia.org/wiki/Doom_WAD">WAD file</a>.

</p>
</div>]]></description>
			<guid isPermaLink="false">3363467171</guid>
			<pingback:server>http://www.cincomsmalltalk.com/userblogs/bobw/servlet/CommentAPIPBServlet?guid=3363467171</pingback:server>
			<pingback:target>http://www.cincomsmalltalk.com/userblogs/bobw/blogView?guid=3363467171</pingback:target>
			<includedComments:comment-collection>
				<includedComments:comment>
					<includedComments:guid>blogView?showComments=true&amp;printTitle=VisualWorks_is_DOOMed&amp;entry=3363467171</includedComments:guid>
					<includedComments:puid>blogView?showComments=true&amp;printTitle=VisualWorks_is_DOOMed&amp;entry=3363467171</includedComments:puid>
					<includedComments:author>Jason</includedComments:author>
					<includedComments:pubDate>2007-08-02T20:33:09-04:00</includedComments:pubDate>
					<includedComments:content>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;p&gt;Terrible performance, I&amp;#39;m assuming thats because its running within the environment while you have some inspectors operating on it or something, or is it a case of the screen cast showing only limited FPS, and in actual fact the game performance is actually playable? 
&lt;/p&gt;&lt;/div&gt;</includedComments:content>
					<includedComments:title>Framerate</includedComments:title>
				</includedComments:comment>
				<includedComments:comment>
					<includedComments:guid>blogView?showComments=true&amp;printTitle=VisualWorks_is_DOOMed&amp;entry=3363467171</includedComments:guid>
					<includedComments:puid>blogView?showComments=true&amp;printTitle=VisualWorks_is_DOOMed&amp;entry=3363467171</includedComments:puid>
					<includedComments:author>Mark Miller</includedComments:author>
					<includedComments:pubDate>2007-08-03T03:26:29-04:00</includedComments:pubDate>
					<includedComments:content>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;p&gt;Pretty neat! I agree, the framerate is not too good. Reminds me of when I used to play Doom on a 386.&lt;/p&gt;&lt;p&gt;I remember a couple years ago a&amp;nbsp;Microsoft partner&amp;nbsp;ported&amp;nbsp;Quake II, which had become open sourced,&amp;nbsp;to .Net using Managed C++. They had to edit the code some, as&amp;nbsp;some of the syntax conventions were different. They got the port working in about a week, if I remember correctly.&amp;nbsp;It actually performed okay. They even added a dynamic mapping feature that was not part of the original game, I guess to show they had really done it.&lt;/p&gt;
&lt;/div&gt;</includedComments:content>
					<includedComments:title>Agree</includedComments:title>
				</includedComments:comment>
				<includedComments:comment>
					<includedComments:guid>blogView?showComments=true&amp;printTitle=VisualWorks_is_DOOMed&amp;entry=3363467171</includedComments:guid>
					<includedComments:puid>blogView?showComments=true&amp;printTitle=VisualWorks_is_DOOMed&amp;entry=3363467171</includedComments:puid>
					<includedComments:author>Mark Miller</includedComments:author>
					<includedComments:pubDate>2007-08-03T08:57:43-04:00</includedComments:pubDate>
					<includedComments:content>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;p&gt;I realized what I said earlier was a bit misleading. I jogged my memory a little more. What I remember is the partner ported Quake II to unmanaged C++, which I believe means it still got compiled to bytecode, which was run through the .Net runtime, but it used system memory (non-garbage-collected), with hard pointers. This made the porting easier, since none of the pointer semantics had to be changed. This put the code in a configuration so that managed code using garbage-collected memory could be added to it. The mapping add-on they did was done in managed code w/ garbage-collected memory, to demonstrate that you could do both.
&lt;/p&gt;&lt;/div&gt;</includedComments:content>
					<includedComments:title>Correction</includedComments:title>
				</includedComments:comment>
				<includedComments:comment>
					<includedComments:guid>blogView?showComments=true&amp;printTitle=VisualWorks_is_DOOMed&amp;entry=3363467171</includedComments:guid>
					<includedComments:puid>blogView?showComments=true&amp;printTitle=VisualWorks_is_DOOMed&amp;entry=3363467171</includedComments:puid>
					<includedComments:author>Bob Westergaard</includedComments:author>
					<includedComments:pubDate>2007-08-03T13:25:34-04:00</includedComments:pubDate>
					<includedComments:content>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;p&gt;First, thanks for the comments!&lt;br /&gt;&lt;br /&gt;As far as performance and framerate, you are right it is pretty poor. However, I&amp;#39;m not overly concerned about that because I haven&amp;#39;t done any optimization of the port for VisualWorks. Well, that is not quite true. I&amp;#39;ve done a tiny bit of optimization, just enough &amp;quot;behind the scenes&amp;quot; so that it runs fast enough to work on. I have been more focused on finishing the port first. I&amp;#39;ve found that when I start refactoring or optimizing before these ports are done, it makes it very difficult to debug against the original.&lt;br /&gt;&lt;br /&gt;I hope I wasn&amp;#39;t misleading anyone with expectations that the port was done and running fast. The amazing thing to me (as with the Elite and Java Asteroids port) is that just doing some simple translation of Java or C to Smalltalk eventually results in something that runs, even if it is slow.&lt;br /&gt;&lt;br /&gt;I&amp;#39;ll be blogging more on how I do the port, which should help shed some light on why things aren&amp;#39;t very fast.&lt;br /&gt;&lt;br /&gt;I&amp;#39;m sure other discriminating eyes have noticed that the lighting is fixed (it should get darker as the distance increases), it doesn&amp;#39;t display messages (picked up the shotgun) and the demo doesn&amp;#39;t quite run the same way as you&amp;#39;d see it in the original (near the end the secret door does not open up).&amp;nbsp; So clearly, I&amp;#39;ve still got a ways to go. Once I&amp;#39;ve got it to the point where it will run the four demos in the ultimate doom WAD to completion and the demo in the shareware WAD, I&amp;#39;ll probably publish it to the public repository.
&lt;/p&gt;&lt;/div&gt;</includedComments:content>
					<includedComments:title>Re: Performance &amp; Framerate</includedComments:title>
				</includedComments:comment>
			</includedComments:comment-collection>
			<wfw:comment>http://www.cincomsmalltalk.com/userblogs/bobw/servlet/CommentAPIServlet?guid=3363467171</wfw:comment>
		</item>
		<item>
			<title>CompareDifferentMethods</title>
			<link>http://www.cincomsmalltalk.com/userblogs/bobw/blogView?showComments=true&amp;printTitle=CompareDifferentMethods&amp;entry=3363276724</link>
			<category>Enhancements, Extensions or Effluents?</category>
			<pubDate>Mon, 30 Jul 2007 19:32:04 EDT</pubDate>
			<description><![CDATA[<div xmlns="http://www.w3.org/1999/xhtml">
<p>I find myself often needing to compare two different methods in two different class hierarchies.  I mostly have the desire to do this when using the ChangeList and am viewing changes.  For a while, I've had a little hack in my private database that gives me this feature in the ChangeList.  Back in May I cleaned it up a bit and published it to the public repository.  I'll have to thank <a href="http://wiki.cs.uiuc.edu/VisualWorks/Eliot+Miranda">Eliot</a> for the suggestion of enumerating the system with #allBehaviorsDo:, instead of using #allInstances on CompiliedMethod.  Also, thanks to <a href="http://blog.3plus4.org/">Vassili</a> for writing the Tool-Modules framework which makes it easier to add these sorts of things.  You have no idea how delighted I was when I found the #extent: method to change the opening size of the window.

</p>

<p>

This package, <a href="http://www.cincomsmalltalk.com/publicRepository/CompareDifferentMethods.html">CompareDifferentMethods</a>, extends the ChangeList, the Browser and the Store comparison browser so that you can compare a selected method with any other method in the system (a new menu item called "Differator this with...").   Admittedly, this is a little limited and painful to use.   However, it can sometimes be useful when methods that exist in different hierarchies.

</p>

<p>

The package extends the IncrementalSearchDialog and IncrementalSearchDialog to allow for incremental searching on all methods in the system.  For example the following do-it will open up a method browser on a selected method (if any):

</p>

<link rel="stylesheet" type="text/css" href="http://www.cincomsmalltalk.com/files/bobw/color_syntax.css"/><pre><span class="code_parenthesis">(</span><span class="code_classReference">IncrementalSearchDialog</span>

	<span class="code_messageSend">requestSpecificSelector:</span> <span class="code_string">'Specify specific selector:'</span>

	<span class="code_messageSend">initialEntry:</span> <span class="code_string">'send*th'</span><span class="code_parenthesis">)</span> <span class="code_messageSend">ifNotNil:</span>

	<span class="bold">[</span><span class="code_blockArgument">:md</span> | 

	<span class="code_classReference">MethodCollector</span> <span class="code_messageSend">new</span>

		<span class="code_messageSend">openListBrowserOn:</span> <span class="code_parenthesis">(</span><span class="code_classReference">Array</span> <span class="code_messageSend">with:</span> <span class="code_temporaryVariable">md</span><span class="code_parenthesis">)</span>

		<span class="code_messageSend">label:</span> <span class="code_string">'Method Browser'</span><span class="bold">]</span></pre>
</div>]]></description>
			<guid isPermaLink="false">3363276724</guid>
			<pingback:server>http://www.cincomsmalltalk.com/userblogs/bobw/servlet/CommentAPIPBServlet?guid=3363276724</pingback:server>
			<pingback:target>http://www.cincomsmalltalk.com/userblogs/bobw/blogView?guid=3363276724</pingback:target>
			<includedComments:comment-collection>
				<includedComments:comment>
					<includedComments:guid>blogView?showComments=true&amp;printTitle=CompareDifferentMethods&amp;entry=3363276724</includedComments:guid>
					<includedComments:puid>blogView?showComments=true&amp;printTitle=CompareDifferentMethods&amp;entry=3363276724</includedComments:puid>
					<includedComments:author>James Thompson</includedComments:author>
					<includedComments:pubDate>2009-01-11T12:26:35-05:00</includedComments:pubDate>
					<includedComments:content>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;p&gt;Please contact me at jim at lsfdev.com&amp;nbsp; Thanks&lt;/p&gt;
&lt;/div&gt;</includedComments:content>
					<includedComments:title>How do you download this</includedComments:title>
				</includedComments:comment>
			</includedComments:comment-collection>
			<wfw:comment>http://www.cincomsmalltalk.com/userblogs/bobw/servlet/CommentAPIServlet?guid=3363276724</wfw:comment>
		</item>
		<item>
			<title>ExternalWebBrowser-ToolOverrides</title>
			<link>http://www.cincomsmalltalk.com/userblogs/bobw/blogView?showComments=true&amp;printTitle=ExternalWebBrowser-ToolOverrides&amp;entry=3360488223</link>
			<category>Enhancements, Extensions or Effluents?</category>
			<pubDate>Thu, 28 Jun 2007 12:57:03 EDT</pubDate>
			<description><![CDATA[<div xmlns="http://www.w3.org/1999/xhtml">
<p><a href="http://www.cincomsmalltalk.com/blog/View.ssp">James Robertson</a> recently did a <a href="http://www.cincomsmalltalk.com/blog/blogView?showComments=true&printTitle=Smalltalk_Daily_6/19/07:_Launching_a_Web_Browser_from_CST&entry=3359708842">screencast where he demonstrates starting a external web browser from Cincom Smalltalk VisualWorks</a>.  This uses the <a href="http://www.cincomsmalltalk.com/userblogs/travis/blogView?showComments=true&entry=3352501957">ExternalWebBrowser package which Travis blogged about back in March</a>.</p>



<p>There is a <a href="http://www.cincomsmalltalk.com/userblogs/travis/blogView?showComments=true&printTitle=Browser_Dev_Stream&entry=3352506418">development stream for the Tools-RefactoringBrowser bundle</a>, which <a href="http://www.cincomsmalltalk.com/userblogs/travis/">Travis</a> has blogged about.

One of the things he did was use the functionality from the <a href="http://www.cincomsmalltalk.com/publicRepository/ExternalWebBrowser.html">External-WebBrowser</a> in the development browser so you can click on URLs and spawn a web browser.  With Travis' permission, I pulled out the extensions that added the Text emphasis for URLs into its own package, <a href="http://www.cincomsmalltalk.com/publicRepository/ExternalWebBrowser-Text.html">ExternalWebBrowser-Text</a>.</p>



<p>It dawned on me the other day, I'd like the behavior of clicking in URLs in the browser without having to load the development stream of the Tools-RefactoringBrowser bundle.  It would also be nice to have the feature on the published items tool and Workspace.  So, I've published the <a href="http://www.cincomsmalltalk.com/publicRepository/ExternalWebBrowser-ToolOverrides.html">ExternalWebBrowser-ToolOverrides</a> package to the <a href="http://www.cincomsmalltalk.com/CincomSmalltalkWiki/PostgreSQL+Access+Page">Cincom public repository </a> which by overriding three methods adds this functionality.</p>
</div>]]></description>
			<guid isPermaLink="false">3360488223</guid>
			<pingback:server>http://www.cincomsmalltalk.com/userblogs/bobw/servlet/CommentAPIPBServlet?guid=3360488223</pingback:server>
			<pingback:target>http://www.cincomsmalltalk.com/userblogs/bobw/blogView?guid=3360488223</pingback:target>
			<includedComments:comment-collection></includedComments:comment-collection>
			<wfw:comment>http://www.cincomsmalltalk.com/userblogs/bobw/servlet/CommentAPIServlet?guid=3360488223</wfw:comment>
		</item>
		<item>
			<title>Docking Computers On</title>
			<link>http://www.cincomsmalltalk.com/userblogs/bobw/blogView?showComments=true&amp;printTitle=Docking_Computers_On&amp;entry=3358093705</link>
			<category>Porting Fun</category>
			<pubDate>Thu, 31 May 2007 19:48:25 EDT</pubDate>
			<description><![CDATA[<div xmlns="http://www.w3.org/1999/xhtml">
<p>Back in November of 2005, I was chatting with <a href="http://blog.3plus4.org/">Vassili</a> and the topic of games (as usual) came up.  I mentioned to him that <a href="http://www.cincomsmalltalk.com/userblogs/bobw/blogView?showComments=true&entry=3356639621">I had starting porting Elite the New Kind to VisualWorks</a>, but it was broken because of a broken laptop.  He seemed interested, so I decided to dig up the work around and show him.  

</p>



<p>Quite some time had passed since I last looked at the code.  One thing became immediately clear, I could not easily tell which functions I had finished porting.  It was obvious if a function was not ported at all, because there was no corresponding method.  However, for methods that had code that looked like the C function, it was not clear if the translation bugs were fixed yet.  I found myself wanting a way to compare the method source with the corresponding source in the C source file.</p>



<p>

Finally, it occurred to me that if could annotate a method with a pragma that described the location of the original C function (which C file and where in the file),  I could then use the Differator to compare the Smalltalk with the original C source.  Using a pragma was a huge leap for me.  I had been aware for pragmas as long as they had been in VisualWorks.  However, for some reason (probably one reason: I'm a dope), I never found the need to create my own.

</p>



<p>I re-parented all my Elite classes under a new superclass, which I called CFileThing. On the class side, I created the following method:<link rel="stylesheet" type="text/css" href="http://www.cincomsmalltalk.com/files/bobw/color_syntax.css"/><pre><span class="code_unaryMethodName">filePragma</span>



	<span class="code_primitive">&lt;pragmas: </span><span class="code_symbol">#class</span><span class="code_primitive">></span>

	<span class="code_primitive">&lt;pragmas: </span><span class="code_symbol">#instance</span><span class="code_primitive">></span>

	<span class="code_return">^</span><span class="code_array">#(</span>file:start:stop:<span class="code_array">)</span></pre>



<p>Then it is a trivial exercise to use the Differator to compare the two implementations side by side.  Here's how one method comparison looks in the differator:

</p><a href="http://www.cincomsmalltalk.com/files/bobw/images/differator_large.jpg">

<p><img alt="Differator comparing a C function with corresponding Smalltalk function" src="http://www.cincomsmalltalk.com/files/bobw/images/differator_small.jpg"></img></a>

</p>



<p>

With a little more work, it was not too hard to integrate this behavior into a new subclass of the CodeCompareTool:

</p>

<p><a href="http://www.cincomsmalltalk.com/files/bobw/images/browsediff_large.jpg">

<img alt="CodeCompareTool comparing a C function with corresponding Smalltalk function" src="http://www.cincomsmalltalk.com/files/bobw/images/browsediff_small.jpg"></img></a>

</p>



<p>Before I knew it, I was in position where I could publish a work in progress to the <a href="http://www.cincomsmalltalk.com/CincomSmalltalkWiki/PostgreSQL+Access+Page">public repository</a>.  However, it was also the same time I noticed the <a href="http://groups.google.com/group/alt.fan.elite/browse_frm/thread/ac0b0e4fc947025c/"> copyright problems</a> <a href="http://www.newkind.co.uk/about.php">Christian Pinder</a> was having with having released Elite the new Kind.   The <a href="http://en.wikipedia.org/wiki/Elite_(computer_game)">wikipedia entry on Elite</a> claims: "The dispute has since been settled and Elite: The New Kind can be downloaded once more".  However, I can't find a reference confirming this.  So, I'm reluctant to publish to the public repository. 

</p>



<p>In the meantime, I have a <a href="http://www.cincomsmalltalk.com/files/bobw/screencasts/EliteDemo/">screencast showing the port in VisualWorks</a>.  Here you'll see me leave the space station, show the different views, turn around and dock back in the station.  The docking was courtesy of the docking computer which I added so I would not have to buy it first. 

</p>



<p>

For the screencast, I again used <a href="http://www.techsmith.com/camtasia.asp">Camtasia studio</a> again (like I did with the last <a href="http://www.cincomsmalltalk.com/userblogs/bobw/blogView?showComments=true&printTitle=Refactoring_Steroids&entry=3355515270">screencast for refactoring Steroids</a>).

</p>
</div>]]></description>
			<guid isPermaLink="false">3358093705</guid>
			<pingback:server>http://www.cincomsmalltalk.com/userblogs/bobw/servlet/CommentAPIPBServlet?guid=3358093705</pingback:server>
			<pingback:target>http://www.cincomsmalltalk.com/userblogs/bobw/blogView?guid=3358093705</pingback:target>
			<includedComments:comment-collection></includedComments:comment-collection>
			<wfw:comment>http://www.cincomsmalltalk.com/userblogs/bobw/servlet/CommentAPIServlet?guid=3358093705</wfw:comment>
		</item>
		<item>
			<title>I am not l33t</title>
			<link>http://www.cincomsmalltalk.com/userblogs/bobw/blogView?showComments=true&amp;printTitle=I_am_not_l33t&amp;entry=3356639621</link>
			<category>Porting Fun</category>
			<pubDate>Mon, 14 May 2007 23:53:41 EDT</pubDate>
			<description><![CDATA[<div xmlns="http://www.w3.org/1999/xhtml">
<p>

After the Java Asteroids experience, I was eager to try to port something else.  Around this time I had stumbled across <a href="http://www.newkind.co.uk/games/">Elite the New Kind</a>, by <a href="http://www.newkind.co.uk/about.php">Christan Pinder</a>.  This was a reverse engineering of the classic space trading game <a href="http://en.wikipedia.org/wiki/Elite_(computer_game)">Elite</a>, by <a href="http://www.iancgbell.clara.net/">Ian Bell</a> and <a href="http://www.frontier.co.uk/">David Braben</a>.  I used to play this game for hours on my <a href="http://www.c64.com/">Commodore 64</a> and I still remember being amazed at the real-time 3D wireframe display.  Converting Elite the New Kind had to be experiment number two.  I already had a plan for the first change I would make to the game: give myself the auto docking computer.

</p>



<p>

Elite the New Kind was written in <a href="http://en.wikipedia.org/wiki/C_(programming_language)">C</a>.  For this blog entry, I ran <a href="http://www.dwheeler.com/sloccount">SLOCCount</a> over the source and it told me that it had 11,051 lines of code all contained in 21 .c files and 25 .h files.  The game was using the <a href="http://www.talula.demon.co.uk/allegro/">Allegro</a> game programming library for graphics and sound.

</p>



<p>I decided to take a similar approach I took with Java Asteroids.  I'd create a class for each C source file and a class for each structure used in the C Source.  Classes that came from C Structures would simply have instance variables for each member in the structure, and all these instance variables had getters and setters.   Functions would end up as similar named methods, with an initial body being the C source code in a Smalltalk comment.  My plan was to do the same manual translation along with copy, paste, search and replace.

</p>



<p>As an example, here is the original C source for finishing rendering the polylines that have been queued up in C:<pre>



	if (total_polys == 0)

		return;

		

	for (i = start_poly; i != -1; i = poly_chain[i].next)

	{

		num_points = poly_chain[i].no_points;

		pl = poly_chain[i].point_list;

		col = poly_chain[i].face_colour;



		if (num_points == 2)

		{

			gfx_draw_colour_line (pl[0], pl[1], pl[2], pl[3], col);

			continue;

		}

		

		gfx_polygon (num_points, pl, col); 

	};

</pre>

</p>



<p>

The Smalltalk code looks similar:<link rel="stylesheet" type="text/css" href="http://www.cincomsmalltalk.com/files/bobw/color_syntax.css"/><pre>



	| <span class="code_temporaryVariableDefinition">i</span> |

	<span class="code_instanceVariable">totalPolys</span> <span class="code_messageSend">=</span> <span class="code_number">0</span> <span class="code_messageSend">ifTrue:</span> <span class="code_bracket">[</span><span class="code_return">^</span><span class="code_self">self</span><span class="code_bracket">]</span>.

	<span class="code_temporaryVariable">i</span> <span class="code_assignment">:=</span> <span class="code_instanceVariable">startPoly</span>.

	<span class="code_bracket">[</span><span class="code_temporaryVariable">i</span> <span class="code_messageSend">~=</span> <span class="code_number">-1</span><span class="code_bracket">]</span> <span class="code_messageSend">whileTrue:</span>

		<span class="code_bracket">[</span>| <span class="code_temporaryVariableDefinition">numPoints</span> <span class="code_temporaryVariableDefinition">pl</span> <span class="code_temporaryVariableDefinition">col</span> |

		<span class="code_temporaryVariable">numPoints</span> <span class="code_assignment">:=</span> <span class="code_parenthesis">(</span><span class="code_instanceVariable">polyChain</span> <span class="code_messageSend">at:</span> <span class="code_temporaryVariable">i</span> <span class="code_messageSend">+</span> <span class="code_number">1</span><span class="code_parenthesis">)</span> <span class="code_messageSend">noPoints</span>.

		<span class="code_temporaryVariable">pl</span> <span class="code_assignment">:=</span> <span class="code_parenthesis">(</span><span class="code_instanceVariable">polyChain</span> <span class="code_messageSend">at:</span> <span class="code_temporaryVariable">i</span> <span class="code_messageSend">+</span> <span class="code_number">1</span><span class="code_parenthesis">)</span> <span class="code_messageSend">pointList</span>.

		<span class="code_temporaryVariable">col</span> <span class="code_assignment">:=</span> <span class="code_parenthesis">(</span><span class="code_instanceVariable">polyChain</span> <span class="code_messageSend">at:</span> <span class="code_temporaryVariable">i</span> <span class="code_messageSend">+</span> <span class="code_number">1</span><span class="code_parenthesis">)</span> <span class="code_messageSend">faceColor</span>.

		<span class="code_temporaryVariable">numPoints</span> <span class="code_messageSend">=</span> <span class="code_number">2</span>

			<span class="code_messageSend">ifTrue:</span>

				<span class="code_bracket">[</span><span class="code_self">self</span>

					<span class="code_messageSend">gfxDrawColorLine_x1:</span> <span class="code_parenthesis">(</span><span class="code_temporaryVariable">pl</span> <span class="code_messageSend">at:</span> <span class="code_number">1</span><span class="code_parenthesis">)</span>

					<span class="code_messageSend">y1:</span> <span class="code_parenthesis">(</span><span class="code_temporaryVariable">pl</span> <span class="code_messageSend">at:</span> <span class="code_number">2</span><span class="code_parenthesis">)</span>

					<span class="code_messageSend">x2:</span> <span class="code_parenthesis">(</span><span class="code_temporaryVariable">pl</span> <span class="code_messageSend">at:</span> <span class="code_number">3</span><span class="code_parenthesis">)</span>

					<span class="code_messageSend">y2:</span> <span class="code_parenthesis">(</span><span class="code_temporaryVariable">pl</span> <span class="code_messageSend">at:</span> <span class="code_number">4</span><span class="code_parenthesis">)</span>

					<span class="code_messageSend">color:</span> <span class="code_temporaryVariable">col</span><span class="code_bracket">]</span>

			<span class="code_messageSend">ifFalse:</span>

				<span class="code_bracket">[</span><span class="code_self">self</span>

					<span class="code_messageSend">gfxPolygon:</span> <span class="code_temporaryVariable">numPoints</span>

					<span class="code_messageSend">points:</span> <span class="code_temporaryVariable">pl</span>

					<span class="code_messageSend">color:</span> <span class="code_temporaryVariable">col</span><span class="code_bracket">]</span>.

		<span class="code_temporaryVariable">i</span> <span class="code_assignment">:=</span> <span class="code_parenthesis">(</span><span class="code_instanceVariable">polyChain</span> <span class="code_messageSend">at:</span> <span class="code_temporaryVariable">i</span> <span class="code_messageSend">+</span> <span class="code_number">1</span><span class="code_parenthesis">)</span> <span class="code_messageSend">next</span><span class="code_bracket">]</span></pre>

</p>



<p>Remarkably, for being such tedious way to convert the C code to <a href="http://en.wikipedia.org/wiki/Smalltalk">Smalltalk</a>, I felt I made pretty good progress.  At some point, I managed get the <a href="http://elite.acornarcade.com/ships/cobra3.htm">Cobra MK III</a> to display at the beginning of the game just like the <a href="http://www.mobygames.com/game/c64/elite/screenshots/gameShotId,131048/" title="Link to screenshot on C64 at MobyGames.com">original</a>.  Once I reached this point, I felt the urge to refactor.   

</p>



<p>

A few days later, I had a small failure lap-top failure.  Nothing too serious, I didn't loose everything.  Just enough to not show you the results.  I hadn't published to my local database for quite some time and the changes file was truncated in a poor place.  Fortunately, the story with this conversion doesn't end there.  However, I'll save that for the next blog entry.

</p>

 
</div>]]></description>
			<guid isPermaLink="false">3356639621</guid>
			<pingback:server>http://www.cincomsmalltalk.com/userblogs/bobw/servlet/CommentAPIPBServlet?guid=3356639621</pingback:server>
			<pingback:target>http://www.cincomsmalltalk.com/userblogs/bobw/blogView?guid=3356639621</pingback:target>
			<includedComments:comment-collection></includedComments:comment-collection>
			<wfw:comment>http://www.cincomsmalltalk.com/userblogs/bobw/servlet/CommentAPIServlet?guid=3356639621</wfw:comment>
		</item>
		<item>
			<title>Refactoring Steroids</title>
			<link>http://www.cincomsmalltalk.com/userblogs/bobw/blogView?showComments=true&amp;printTitle=Refactoring_Steroids&amp;entry=3355515270</link>
			<category>Porting Fun</category>
			<pubDate>Tue, 01 May 2007 23:34:30 EDT</pubDate>
			<description><![CDATA[<div xmlns="http://www.w3.org/1999/xhtml">
<p><b>Update:</b> I was playing around with Camtasia Studio and used that to create a embedded flash animation to replace the compressed AVI file <a href="#demo_links">below</a>.  

</p>

<p>

<a href="http://www.cincomsmalltalk.com/userblogs/mls/blogView">Micheal Lucas-Smith</a> commented in a previous blog post that now would a good time to refactor.  I agree with him.  Once the game was completely ported and running it is a great time to refactor.  So, if anyone wants to refactor it, you can find it in your contributed directory in your VisualWorks installation.  

</p>

<p>

I have never done any refactoring on it, mostly because a few other things caught my interest after the port to VisualWorks.  I've always thought that the goody would make a good example of live-refactoring with the game running.  As an example of that here are a sequence of steps that you can follow that will refactor out the bit in Asteroids>>#paint: that paints the asteroid into the Asteroid class as its own paint method.  </p>

<p>



<OL>

<LI> Start up VisualWorks and Load Steroids.  You can find it in the parcel manager.

<LI> Once it is loaded you can open it by clicking on one of the Play Throtted Asteroids toolbar button on the launcher or do: <pre>

	Steroids.ThrottledAsteroidsAppModel open

</pre>

in a workspace.

<LI>  Play the game for a while! Once you are done, leave Steroids running so that you can see the asteroids moving around

<LI> Open up a browser on the class Steroids.Asteroids and select the method #paint:

<LI> Scroll down to where the asteroids are drawn, here is the code:

<link rel="stylesheet" type="text/css" href="http://www.cincomsmalltalk.com/files/bobw/color_syntax.css"/><pre>

    <span class="code_comment">"Draw the asteroids."</span>

    <span class="code_number">1</span> <span class="code_messageSend">to:</span> <span class="code_sharedVariableReference">MAX_ROCKS</span> <span class="code_messageSend">do:</span>

        <span class="code_bracket">[</span><span class="code_blockArgument">:i</span>| | <span class="code_temporaryVariableDefinition">asteroid</span> |

        <span class="code_parenthesis">(</span><span class="code_temporaryVariable">asteroid</span> <span class="code_assignment">:=</span> <span class="code_instanceVariable">asteroids</span> <span class="code_messageSend">at:</span> <span class="code_temporaryVariable">i</span><span class="code_parenthesis">)</span> <span class="code_messageSend">active</span> <span class="code_messageSend">ifTrue:</span> 

            <span class="code_bracket">[</span><span class="code_instanceVariable">detail</span> <span class="code_messageSend">ifTrue:</span> 

                <span class="code_bracket">[</span><span class="code_temporaryVariable">gc</span> <span class="code_messageSend">paint:</span> <span class="code_classReference">ColorValue</span> <span class="code_messageSend">black</span>.

                 <span class="code_temporaryVariable">gc</span> <span class="code_messageSend">displayPolygon:</span> <span class="code_temporaryVariable">asteroid</span> <span class="code_messageSend">sprite</span> <span class="code_messageSend">points</span><span class="code_bracket">]</span>.

            <span class="code_temporaryVariable">gc</span> <span class="code_messageSend">paint:</span> <span class="code_classReference">ColorValue</span> <span class="code_messageSend">white</span>.

            <span class="code_temporaryVariable">gc</span> <span class="code_messageSend">displayPolyline:</span> <span class="code_parenthesis">(</span><span class="code_temporaryVariable">asteroid</span> <span class="code_assignment">:=</span> <span class="code_instanceVariable">asteroids</span> <span class="code_messageSend">at:</span> <span class="code_temporaryVariable">i</span><span class="code_parenthesis">)</span> <span class="code_messageSend">sprite</span> <span class="code_messageSend">points</span><span class="code_bracket">]</span><span class="code_bracket">]</span>.</pre>

<LI> Edit the method to change  the last line in the #ifTrue: block argument to be:

<link rel="stylesheet" type="text/css" href="http://www.cincomsmalltalk.com/files/bobw/color_syntax.css"/><pre>

	<span class="code_temporaryVariable">gc</span> <span class="code_messageSend">displayPolyline:</span> <span class="code_temporaryVariable">asteroid</span> <span class="code_messageSend">sprite</span> <span class="code_messageSend">points]].</span></pre>

<LI> Now select the whole block being sent to ifTrue:

<LI> Pop up your operate menu and select: Refactor->Extract to component.  <a href="http://www.cincomsmalltalk.com/userblogs/buck">David Buck</a> provides a <a href="http://www.cincomsmalltalk.com/userblogs/buck/blogView?showComments=true&entry=3303669891">great explanation and example of extracting to a component</a>.

<LI> Select asteroid as the variable to move the method into

<LI> Select Steroids.AsteroidsSprite in the next dialog

<LI> For the next dialog, supply a name to replace self, I use game

<LI> You'll be asked to create getters and setters for direct variable references, answer yes to the dialog

<LI> You'll be told that the method contains references to variables which are inaccessible in the namespace of the destination.  Answer yes

<LI> You'll be asked how to handle references to ColorValue, select "Specific Import"

<LI> You'll be asked to supply a the new method name (a default is provided), type something like: #displayOn:game: then click OK

<LI> You're watching the game right? If you missed it, then just undo the changes by clicking on "undo the last action" in the tool bar twice (once for the method to component refactoring, the other for the first change we did above).  Then click redo the last action toolbar button and watch the method and game change.

</OL>

</p>



<p>

There are two interesting things being shown here.  First, the only bit of actually typing of Smalltalk code was replacing <b>(asteroids at: i)</b> with <b>asteroid</b>.  Writing the new method with what was selected from step seven above, putting it into a different class and fixing up the original method was all taken care of by the refactoring engine that the browser uses.  The second interesting thing is the game was <b>still running</b> while the changes were being made.  

</p>

<p><a name="demo_links"></a>

As a bonus, I've put a <a href="http://www.cincomsmalltalk.com/files/bobw/clip0024.avi.gz">compressed avi file (17 MB)</a> up that shows me making the above changes in VisualWorks 7.5.  I've also included a <a href="http://www.cincomsmalltalk.com/files/bobw/screencasts/Refactoring_Steroids/">screencast of the refactoring</a>.

</p>
</div>]]></description>
			<guid isPermaLink="false">3355515270</guid>
			<pingback:server>http://www.cincomsmalltalk.com/userblogs/bobw/servlet/CommentAPIPBServlet?guid=3355515270</pingback:server>
			<pingback:target>http://www.cincomsmalltalk.com/userblogs/bobw/blogView?guid=3355515270</pingback:target>
			<includedComments:comment-collection></includedComments:comment-collection>
			<wfw:comment>http://www.cincomsmalltalk.com/userblogs/bobw/servlet/CommentAPIServlet?guid=3355515270</wfw:comment>
		</item>
	</channel>
</rss>
