<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>weaselhat &#187; Software</title>
	<atom:link href="http://www.weaselhat.com/category/software/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.weaselhat.com</link>
	<description></description>
	<lastBuildDate>Sat, 29 May 2010 09:17:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>PHPEnkoder 1.7</title>
		<link>http://www.weaselhat.com/2010/05/03/phpenkoder-1-7/</link>
		<comments>http://www.weaselhat.com/2010/05/03/phpenkoder-1-7/#comments</comments>
		<pubDate>Mon, 03 May 2010 18:49:14 +0000</pubDate>
		<dc:creator>Michael Greenberg</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.weaselhat.com/?p=220</guid>
		<description><![CDATA[By Julius Welby&#8217;s request, there is now an option to set a class attribute on the a tags generated for mailto: links. If you leave this option empty (the default), then no class attribute will be set. The latest version is available from the PHPEnkoder website and its home in the plugin directory.]]></description>
			<content:encoded><![CDATA[<p>By Julius Welby&#8217;s request, there is now an option to set a class attribute on the <tt>a</tt> tags generated for <tt>mailto:</tt> links.  If you leave this option empty (the default), then no class attribute will be set.</p>
<p>The latest version is available from the <a href="http://www.weaselhat.com/phpenkoder/">PHPEnkoder website</a> and <a href="http://wordpress.org/extend/plugins/php-enkoder/">its home in the plugin directory</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.weaselhat.com/2010/05/03/phpenkoder-1-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nested functions in GCC</title>
		<link>http://www.weaselhat.com/2010/03/03/nested-functions-in-gcc/</link>
		<comments>http://www.weaselhat.com/2010/03/03/nested-functions-in-gcc/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 16:06:40 +0000</pubDate>
		<dc:creator>Michael Greenberg</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Programming Languages]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.weaselhat.com/?p=208</guid>
		<description><![CDATA[GCC supports &#8220;nested functions&#8221; using the -fnested-functions flag. When I first saw this, I was excited: closures in C! In the famous words of Admiral Ackbar, &#8220;it&#8217;s a trap!&#8221; C [Show Styled Code]: #include typedef int (*fptr)(int); fptr f(int arg) { int nested_function(int nested_arg) { return arg + nested_arg; } return &#038;nested_function; } void smash(int [...]]]></description>
			<content:encoded><![CDATA[<p>GCC supports &#8220;nested functions&#8221; using the <tt>-fnested-functions</tt> flag.  When I first saw this, I was excited: closures in C!  In the famous words of Admiral Ackbar, &#8220;it&#8217;s a trap!&#8221;</p>
<div class="synthi_code" style="display:none;" id ="plain_synthi_4c88eb14d91fc">
<div class="synthi_header" style="font-weight:bold;"> C <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('styled_synthi_4c88eb14d91fc').style.display='block';document.getElementById('plain_synthi_4c88eb14d91fc').style.display='none';return false">Show Styled Code</a>]:</span></div>
<pre style="width:100%;overflow:auto;">
#include <stdio.h>

typedef int (*fptr)(int);

fptr f(int arg) {
  int nested_function(int nested_arg) {
    return arg + nested_arg;
  }

  return &#038;nested_function;
}

void smash(int arg) {
  return;
}

int main(void) {
  fptr g = f(10);
  printf(&#034;%d\n&#034;, (*g)(5));
  smash(12);
  // printf(&#034;%d\n&#034;, (*g)(5));
  fptr h = f(12);
  printf(&#034;%d\n&#034;, (*g)(5));
  printf(&#034;%d\n&#034;, (*h)(5));

  return 0;
}
</pre>
</div>
<div class="synthi_code" style="display:block;" id ="styled_synthi_4c88eb14d91fc">
<div class="synthi_header" style="font-weight:bold;"> C <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('plain_synthi_4c88eb14d91fc').style.display='block';document.getElementById('styled_synthi_4c88eb14d91fc').style.display='none';return false">Show Plain Code</a>]:</span></div>
<div class="c" style="font-family: monospace;">
<ol>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #339933;">#include &lt;stdio.h&gt;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">typedef</span> <span style="color: #993333;">int</span> <span style="color: #66cc66;">&#40;</span>*fptr<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">fptr f<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span> arg<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #993333;">int</span> nested_function<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span> nested_arg<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">return</span> arg + nested_arg;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #b1b100;">return</span> &amp;nested_function;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">void</span> smash<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span> arg<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #b1b100;">return</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333;">int</span> main<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">void</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; fptr g = f<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span style="color: #000066;">printf</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;%d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>, <span style="color: #66cc66;">&#40;</span>*g<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; smash<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">12</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #808080; font-style: italic;">// printf(&quot;%d\n&quot;, (*g)(5));</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; fptr h = f<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">12</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span style="color: #000066;">printf</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;%d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>, <span style="color: #66cc66;">&#40;</span>*g<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span style="color: #000066;">printf</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;%d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>, <span style="color: #66cc66;">&#40;</span>*h<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">0</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
<p>Try compiling (<tt>gcc -fnested-functions</tt>).  What does the second call to <tt>g</tt> produce&#8212;15 or 17?  Try uncommenting line 21.  What happens?  Does commenting out line 20 affect this?  What if line 19 is commented out, but lines 20 and 21 are uncommented?</p>
<p>I&#8217;m not sure this feature is worth it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.weaselhat.com/2010/03/03/nested-functions-in-gcc/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Locally installing LLVM with Ocaml bindings</title>
		<link>http://www.weaselhat.com/2009/09/24/llvm-ocaml-loca/</link>
		<comments>http://www.weaselhat.com/2009/09/24/llvm-ocaml-loca/#comments</comments>
		<pubDate>Thu, 24 Sep 2009 19:44:31 +0000</pubDate>
		<dc:creator>Michael Greenberg</dc:creator>
				<category><![CDATA[Programming Languages]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.weaselhat.com/?p=145</guid>
		<description><![CDATA[We can&#8217;t install software into the /usr tree at my office, so I end up having local installs of lots of software. Some things, like GODI, play well with this. I had some trouble finding the right way to get LLVM&#8216;s Ocaml bindings to work, so I figured I&#8217;d share the wealth. The following instructions [...]]]></description>
			<content:encoded><![CDATA[<p>We can&#8217;t install software into the /usr tree at my office, so I end up having local installs of lots of software.  Some things, like <a href="http://godi.camlcity.org/godi/index.html">GODI</a>, play well with this.  I had some trouble finding the right way to get <a href="http://llvm.org">LLVM</a>&#8216;s Ocaml bindings to work, so I figured I&#8217;d share the wealth.  The following instructions will put an install into the directory <tt>$PREFIX/llvm-install</tt>.</p>
<p>Here are the steps; they&#8217;re followed by a plain English explanation.</p>
<div class="synthi_code" style="display:none;" id ="plain_synthi_4c88eb151a281">
<div class="synthi_header" style="font-weight:bold;"> Bash <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('styled_synthi_4c88eb151a281').style.display='block';document.getElementById('plain_synthi_4c88eb151a281').style.display='none';return false">Show Styled Code</a>]:</span></div>
<pre style="width:100%;overflow:auto;">
cd $PREFIX
svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
wget http://llvm.org/releases/2.5/llvm-gcc4.2-2.5-x86-linux-RHEL4.tar.gz
tar xzf llvm-gcc4.2-2.5-x86-linux-RHEL4.tar.gz
mkdir llvm-objects llvm-install
cd llvm-objects
../llvm/configure --with-llvmgccdir=$PREFIX/llvm-gcc4.2-2.5-x86-linux-RHEL4 --enable-optimized --enable-jit --prefix=$PREFIX/llvm-install --with-ocaml-libdir=$GODI_PATH/lib/ocaml/std-lib
make
make install
</pre>
</div>
<div class="synthi_code" style="display:block;" id ="styled_synthi_4c88eb151a281">
<div class="synthi_header" style="font-weight:bold;"> Bash <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('plain_synthi_4c88eb151a281').style.display='block';document.getElementById('styled_synthi_4c88eb151a281').style.display='none';return false">Show Plain Code</a>]:</span></div>
<div class="bash" style="font-family: monospace;">
<ol>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000066;">cd</span> <span style="color: #0000ff;">$PREFIX</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">wget http://llvm.org/releases/<span style="color: #cc66cc;">2.5</span>/llvm-gcc4<span style="color: #cc66cc;">.2</span><span style="color: #cc66cc;">-2.5</span>-x86-linux-RHEL4.tar.gz</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">tar xzf llvm-gcc4<span style="color: #cc66cc;">.2</span><span style="color: #cc66cc;">-2.5</span>-x86-linux-RHEL4.tar.gz</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mkdir llvm-objects llvm-install</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000066;">cd</span> llvm-objects</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">../llvm/configure &#8211;with-<span style="color: #0000ff;">llvmgccdir=</span><span style="color: #0000ff;">$PREFIX</span>/llvm-gcc4<span style="color: #cc66cc;">.2</span><span style="color: #cc66cc;">-2.5</span>-x86-linux-RHEL4 &#8211;enable-optimized &#8211;enable-jit &#8211;<span style="color: #0000ff;">prefix=</span><span style="color: #0000ff;">$PREFIX</span>/llvm-install &#8211;with-ocaml-<span style="color: #0000ff;">libdir=</span><span style="color: #0000ff;">$GODI_PATH</span>/lib/ocaml/std-lib</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">make</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">make install </div>
</li>
</ol>
</div>
</div>
<p>My <tt>PREFIX</tt> is my home directory, and <tt>GODI_PATH = ~/godi</tt>.  First, we checkout the latest LLVM from SVN (step 2).  Then we download and extract the <a href="http://llvm.org/releases/download.html#2.5">latest release (2.5, as of writing) of LLVM-gcc</a> (steps 3 and 4).  (I couldn&#8217;t get the SVN version of LLVM-gcc to work with the SVN version of LLVM.)  Notably, LLVM does <i>not</i> support in-place builds, so we create the <tt>llvm-objects</tt> directory to actually build LLVM; we&#8217;ll install it into <tt>llvm-install</tt> (step 5).  We configure the software <i>from the <tt>llvm-objects</tt> directory</i> (steps 6 and 7).  The long configure is necessary; the only optional item is <tt>--enable-jit</tt>.  You may have to adjust your <tt>--with-ocaml-libdir</tt> to point to wherever your Ocaml libraries live.  Then make and make install (steps 8 and 9).  Voila!</p>
<p>To test it out, we can use the &#8220;Hello, World!&#8221; program written by <a href="http://lists.cs.uiuc.edu/pipermail/llvmdev/2007-October/010996.html">Gordon Henrikson</a>.  I had to change it a little to bring it up to date with the latest APIs (in particular, the global context had to be added).  You can download it as <a href="downloads/llvm_test.ml"><tt>llvm_test.ml</tt></a>.</p>
<div class="synthi_code" style="display:none;" id ="plain_synthi_4c88eb151e0fe">
<div class="synthi_header" style="font-weight:bold;"> OCaml <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('styled_synthi_4c88eb151e0fe').style.display='block';document.getElementById('plain_synthi_4c88eb151e0fe').style.display='none';return false">Show Styled Code</a>]:</span></div>
<pre style="width:100%;overflow:auto;">
open Printf
open Llvm

let main filename =
   let c = create_context () in

   let i8_t  = i8_type c in
   let i32_t = i32_type c in

   let m = create_module c filename in

   (* @greeting = global [14 x i8] c&#034;Hello, world!\00&#034; *)
   let greeting =
     define_global &#034;greeting&#034; (const_string c &#034;Hello, world!\000&#034;) m in

   (* declare i32 @puts(i8* ) *)
   let puts =
     declare_function &#034;puts&#034;
       (function_type i32_t [|pointer_type i8_t|]) m in

   (* define i32 @main() { entry: *)
   let main = define_function &#034;main&#034; (function_type i32_t [| |]) m in
   let at_entry = builder_at_end c (entry_block main) in

   (* %tmp = getelementptr [14 x i8]* @greeting, i32 0, i32 0 *)
   let zero = const_int i32_t 0 in
   let str = build_gep greeting [| zero; zero |] &#034;tmp&#034; at_entry in

   (* call i32 @puts( i8* %tmp ) *)
   ignore (build_call puts [| str |] &#034;&#034; at_entry);

   (* ret void *)
   ignore (build_ret (const_null i32_t) at_entry);

   (* write the module to a file *)
   if not (Llvm_bitwriter.write_bitcode_file m filename) then exit 1;
   dispose_module m

let () = match Sys.argv with
  | [|_; filename|] -> main filename
  | _ -> main &#034;a.out&#034;
</pre>
</div>
<div class="synthi_code" style="display:block;" id ="styled_synthi_4c88eb151e0fe">
<div class="synthi_header" style="font-weight:bold;"> OCaml <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('plain_synthi_4c88eb151e0fe').style.display='block';document.getElementById('styled_synthi_4c88eb151e0fe').style.display='none';return false">Show Plain Code</a>]:</span></div>
<div class="ocaml" style="font-family: monospace;">
<ol>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #06c; font-weight: bold;">open</span> <a href="http://caml.inria.fr/pub/docs/manual-ocaml/libref/Printf.html"><span style="">Printf</span></a></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #06c; font-weight: bold;">open</span> Llvm</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #06c; font-weight: bold;">let</span> main filename =</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #06c; font-weight: bold;">let</span> c = create_context <span style="color: #6c6;">&#40;</span><span style="color: #6c6;">&#41;</span> <span style="color: #06c; font-weight: bold;">in</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #06c; font-weight: bold;">let</span> i8_t&nbsp; = i8_type c <span style="color: #06c; font-weight: bold;">in</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #06c; font-weight: bold;">let</span> i32_t = i32_type c <span style="color: #06c; font-weight: bold;">in</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #06c; font-weight: bold;">let</span> m = create_module c filename <span style="color: #06c; font-weight: bold;">in</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #5d478b; font-style: italic;">(* @greeting = global [14 x i8] c&quot;Hello, world!\00&quot; *)</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #06c; font-weight: bold;">let</span> greeting =</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;define_global <span style="color: #3cb371;">&quot;greeting&quot;</span> <span style="color: #6c6;">&#40;</span>const_string c <span style="color: #3cb371;">&quot;Hello, world!\000&quot;</span><span style="color: #6c6;">&#41;</span> m <span style="color: #06c; font-weight: bold;">in</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #5d478b; font-style: italic;">(* declare i32 @puts(i8* ) *)</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #06c; font-weight: bold;">let</span> puts =</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;declare_function <span style="color: #3cb371;">&quot;puts&quot;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #6c6;">&#40;</span>function_type i32_t <span style="color: #6c6;">&#91;</span>|pointer_type i8_t|<span style="color: #6c6;">&#93;</span><span style="color: #6c6;">&#41;</span> m <span style="color: #06c; font-weight: bold;">in</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #5d478b; font-style: italic;">(* define i32 @main() { entry: *)</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #06c; font-weight: bold;">let</span> main = define_function <span style="color: #3cb371;">&quot;main&quot;</span> <span style="color: #6c6;">&#40;</span>function_type i32_t <span style="color: #6c6;">&#91;</span>| |<span style="color: #6c6;">&#93;</span><span style="color: #6c6;">&#41;</span> m <span style="color: #06c; font-weight: bold;">in</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #06c; font-weight: bold;">let</span> at_entry = builder_at_end c <span style="color: #6c6;">&#40;</span>entry_block main<span style="color: #6c6;">&#41;</span> <span style="color: #06c; font-weight: bold;">in</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #5d478b; font-style: italic;">(* %tmp = getelementptr [14 x i8]* @greeting, i32 0, i32 0 *)</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #06c; font-weight: bold;">let</span> zero = const_int i32_t <span style="color: #c6c;">0</span> <span style="color: #06c; font-weight: bold;">in</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #06c; font-weight: bold;">let</span> str = build_gep greeting <span style="color: #6c6;">&#91;</span>| zero; zero |<span style="color: #6c6;">&#93;</span> <span style="color: #3cb371;">&quot;tmp&quot;</span> at_entry <span style="color: #06c; font-weight: bold;">in</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #5d478b; font-style: italic;">(* call i32 @puts( i8* %tmp ) *)</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<a href="http://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html#VALignore"><span style="">ignore</span></a> <span style="color: #6c6;">&#40;</span>build_call puts <span style="color: #6c6;">&#91;</span>| str |<span style="color: #6c6;">&#93;</span> <span style="color: #3cb371;">&quot;&quot;</span> at_entry<span style="color: #6c6;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #5d478b; font-style: italic;">(* ret void *)</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<a href="http://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html#VALignore"><span style="">ignore</span></a> <span style="color: #6c6;">&#40;</span>build_ret <span style="color: #6c6;">&#40;</span>const_null i32_t<span style="color: #6c6;">&#41;</span> at_entry<span style="color: #6c6;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #5d478b; font-style: italic;">(* write the module to a file *)</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #06c; font-weight: bold;">if</span> <span style="color: #06c; font-weight: bold;">not</span> <span style="color: #6c6;">&#40;</span>Llvm_bitwriter.<span style="color: #060;">write_bitcode_file</span> m filename<span style="color: #6c6;">&#41;</span> <span style="color: #06c; font-weight: bold;">then</span> <a href="http://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html#VALexit"><span style="">exit</span></a> <span style="color: #c6c;">1</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;dispose_module m</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #06c; font-weight: bold;">let</span> <span style="color: #6c6;">&#40;</span><span style="color: #6c6;">&#41;</span> = <span style="color: #06c; font-weight: bold;">match</span> <a href="http://caml.inria.fr/pub/docs/manual-ocaml/libref/Sys.html"><span style="">Sys</span></a>.<span style="color: #060;">argv</span> <span style="color: #06c; font-weight: bold;">with</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; | <span style="color: #6c6;">&#91;</span>|_; filename|<span style="color: #6c6;">&#93;</span> -&gt; main filename</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; | _ -&gt; main <span style="color: #3cb371;">&quot;a.out&quot;</span> </div>
</li>
</ol>
</div>
</div>
<p>Now we can compile:</p>
<div class="synthi_code" style="display:none;" id ="plain_synthi_4c88eb152bbf3">
<div class="synthi_header" style="font-weight:bold;"> Bash <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('styled_synthi_4c88eb152bbf3').style.display='block';document.getElementById('plain_synthi_4c88eb152bbf3').style.display='none';return false">Show Styled Code</a>]:</span></div>
<pre style="width:100%;overflow:auto;">
ocamlopt -cc g++ llvm.cmxa llvm_bitwriter.cmxa llvm_test.ml -o llvm_test
./llvm_test hello.bc # generates bitcode
$PREFIX/llvm-install/bin/llvm-dis hello.bc # disassembles bitcode into hello.ll
$PREFIX/llvm-install/bin/lli hello.bc # outputs &#034;Hello, world!&#034;
</pre>
</div>
<div class="synthi_code" style="display:block;" id ="styled_synthi_4c88eb152bbf3">
<div class="synthi_header" style="font-weight:bold;"> Bash <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('plain_synthi_4c88eb152bbf3').style.display='block';document.getElementById('styled_synthi_4c88eb152bbf3').style.display='none';return false">Show Plain Code</a>]:</span></div>
<div class="bash" style="font-family: monospace;">
<ol>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ocamlopt -cc g++ llvm.cmxa llvm_bitwriter.cmxa llvm_test.ml -o llvm_test</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">./llvm_test hello.bc <span style="color: #808080; font-style: italic;"># generates bitcode</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$PREFIX</span>/llvm-install/bin/llvm-dis hello.bc <span style="color: #808080; font-style: italic;"># disassembles bitcode into hello.ll</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$PREFIX</span>/llvm-install/bin/lli hello.bc <span style="color: #808080; font-style: italic;"># outputs &quot;Hello, world!&quot; </span></div>
</li>
</ol>
</div>
</div>
<p>If interpretation via <tt>lli</tt> isn&#8217;t your bag, you can also compile to native code:</p>
<div class="synthi_code" style="display:none;" id ="plain_synthi_4c88eb152eaa3">
<div class="synthi_header" style="font-weight:bold;"> Bash <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('styled_synthi_4c88eb152eaa3').style.display='block';document.getElementById('plain_synthi_4c88eb152eaa3').style.display='none';return false">Show Styled Code</a>]:</span></div>
<pre style="width:100%;overflow:auto;">
$PREFIX/llvm-install/bin/llc hello.bc # generates assembly, hello.s
gcc -o hello hello.s
./hello # outputs &#034;Hello, world!&#034;
</pre>
</div>
<div class="synthi_code" style="display:block;" id ="styled_synthi_4c88eb152eaa3">
<div class="synthi_header" style="font-weight:bold;"> Bash <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('plain_synthi_4c88eb152eaa3').style.display='block';document.getElementById('styled_synthi_4c88eb152eaa3').style.display='none';return false">Show Plain Code</a>]:</span></div>
<div class="bash" style="font-family: monospace;">
<ol>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$PREFIX</span>/llvm-install/bin/llc hello.bc <span style="color: #808080; font-style: italic;"># generates assembly, hello.s</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">gcc -o hello hello.s</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">./hello <span style="color: #808080; font-style: italic;"># outputs &quot;Hello, world!&quot; </span></div>
</li>
</ol>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.weaselhat.com/2009/09/24/llvm-ocaml-loca/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHPEnkoder 1.6</title>
		<link>http://www.weaselhat.com/2009/08/18/phpenkoder-1-6/</link>
		<comments>http://www.weaselhat.com/2009/08/18/phpenkoder-1-6/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 21:11:41 +0000</pubDate>
		<dc:creator>Michael Greenberg</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.weaselhat.com/?p=135</guid>
		<description><![CDATA[Martin Rees caught another bug in PHPEnkoder, which was making it difficult to edit posts with comments containing e-mails. This problem has been solved by turning off the enkoder filters when displaying administrative panels. In addition to the bugfix, there are two improvements. First, the internal enkoding system will choose names that are more likely [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.strangelyperfect.tv/">Martin Rees</a> caught another bug in PHPEnkoder, which was making it difficult to edit posts with comments containing e-mails.  This problem has been solved by turning off the enkoder filters when displaying administrative panels.</p>
<p>In addition to the bugfix, there are two improvements.  First, the internal enkoding system will choose names that are more likely to be unique.  Second, I&#8217;ve added a <a href="http://codex.wordpress.org/Shortcode_API">shortcode</a>, <tt>enkode</tt>.  You can use it to manually enkode an arbitrary stretch of text, like so: <tt>&#91;enkode]this will be enkoded&#91;/enkode]</tt>.</p>
<p>The latest version is available from the <a href="http://www.weaselhat.com/phpenkoder/">PHPEnkoder website</a> and <a href="http://wordpress.org/extend/plugins/php-enkoder/">its home in the plugin directory</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.weaselhat.com/2009/08/18/phpenkoder-1-6/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Flapjax: A Programming Language for Ajax Applications</title>
		<link>http://www.weaselhat.com/2009/08/13/flapjax-2/</link>
		<comments>http://www.weaselhat.com/2009/08/13/flapjax-2/#comments</comments>
		<pubDate>Thu, 13 Aug 2009 16:00:29 +0000</pubDate>
		<dc:creator>Michael Greenberg</dc:creator>
				<category><![CDATA[Flapjax]]></category>
		<category><![CDATA[Papers]]></category>
		<category><![CDATA[Programming Languages]]></category>

		<guid isPermaLink="false">http://www.weaselhat.com/?p=122</guid>
		<description><![CDATA[I am immensely pleased to report that our paper on Flapjax was accepted to OOPSLA 2009. This paper presents Flapjax, a language designed for contemporary Web applications. These applications communicate with servers and have rich, interactive interfaces. Flapjax provides two key features that simplify writing these applications. First, it provides event streams, a uniform abstraction [...]]]></description>
			<content:encoded><![CDATA[<p>I am immensely pleased to report that <a href="http://www.cis.upenn.edu/~mgree/papers/oopsla2009_flapjax.pdf">our paper on Flapjax</a> was accepted to <a href="http://www.oopsla.org/oopsla2009/" title="My favorite conference name to say, perhaps my least favorite to type.  OOPSPLA, every time.">OOPSLA 2009</a>.</p>
<blockquote><p>
This paper presents Flapjax, a language designed for contemporary Web applications. These applications communicate with servers and have rich, interactive interfaces. Flapjax provides two key features that simplify writing these applications. First, it provides event streams, a uniform abstraction for communication within a program as well as with external Web services. Second, the language itself is reactive: it automatically tracks data dependencies and propagates updates along those data?ows. This allows developers to write reactive interfaces in a declarative and compositional style.</p>
<p>Flapjax is built on top of JavaScript. It runs on unmodi?ed browsers and readily interoperates with existing JavaScript code. It is usable as either a programming language (that is compiled to JavaScript) or as a JavaScript library, and is designed for both uses. This paper presents the language, its design decisions, and illustrative examples drawn from several working Flapjax applications.
</p></blockquote>
<p>The real heroes of this story are my co-authors.  Leo, Arjun, and Greg were there for the initial, heroic-effort-based implementation.  Jacob and Aleks wrote incredible applications with our dog food.  Shriram, of course, saw the whole thing through.  Very few of my contributions remain: the original compiler is gone (thank goodness); my <a href="http://www.cis.upenn.edu/~mgree/papers/ugrad_thesis.pdf">thesis work</a> is discussed briefly in <i>How many DOMs?</i> on page 15.  Here&#8217;s to a great team and a great experience (and a great language)!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.weaselhat.com/2009/08/13/flapjax-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHPEnkoder 1.5</title>
		<link>http://www.weaselhat.com/2009/05/23/phpenkoder-15/</link>
		<comments>http://www.weaselhat.com/2009/05/23/phpenkoder-15/#comments</comments>
		<pubDate>Sat, 23 May 2009 14:44:31 +0000</pubDate>
		<dc:creator>Michael Greenberg</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.weaselhat.com/?p=104</guid>
		<description><![CDATA[Martin Rees noticed that any user can change PHPEnkoder&#8217;s settings. I&#8217;ve change PHPEnkoder&#8217;s settings panel to require the manage_options capability. Now, by default, only administrators can change PHPEnkoder&#8217;s settings. (If you&#8217;re unfamiliar with the concept, check out the Codex documentation on roles and capabilities.) As usual, the plugin is available from the PHPEnkoder website and [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.strangelyperfect.tv/">Martin Rees</a> noticed that any user can change PHPEnkoder&#8217;s settings.  I&#8217;ve change PHPEnkoder&#8217;s settings panel to require the <tt>manage_options</tt> capability.  Now, by default, only administrators can change PHPEnkoder&#8217;s settings.  (If you&#8217;re unfamiliar with the concept, check out the <a href="http://codex.wordpress.org/Roles_and_Capabilities" title="This time, I'll be the editor and you'll be the registered user.">Codex documentation on roles and capabilities</a>.)</p>
<p>As usual, the plugin is available from the <a href="http://www.weaselhat.com/phpenkoder/">PHPEnkoder website</a> and <a href="http://wordpress.org/extend/plugins/php-enkoder/">its home in the plugin directory</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.weaselhat.com/2009/05/23/phpenkoder-15/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>PHPEnkoder 1.4</title>
		<link>http://www.weaselhat.com/2009/05/18/phpenkoder-14/</link>
		<comments>http://www.weaselhat.com/2009/05/18/phpenkoder-14/#comments</comments>
		<pubDate>Mon, 18 May 2009 17:20:31 +0000</pubDate>
		<dc:creator>Michael Greenberg</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.weaselhat.com/?p=96</guid>
		<description><![CDATA[Gretchen Zimmerman noticed a bug in spacing that occurred in some versions of IE. Removing a newline in the generated HTML fixes the problem. You can download version 1.4 from the PHPEnkoder website or from the WordPress plugin directory.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.webmystery.net/">Gretchen Zimmerman</a> noticed a bug in spacing that occurred in some versions of IE.  Removing a newline in the generated HTML fixes the problem.</p>
<p>You can download version 1.4 from the <a href="http://www.weaselhat.com/phpenkoder/" title="Time and time again, I just love writing the word 'weaselhat'.">PHPEnkoder website</a> or from the <a href="http://wordpress.org/extend/plugins/php-enkoder/" title="You can search for it now!">WordPress plugin directory</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.weaselhat.com/2009/05/18/phpenkoder-14/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flapjax TR</title>
		<link>http://www.weaselhat.com/2009/04/15/flapjax-tr/</link>
		<comments>http://www.weaselhat.com/2009/04/15/flapjax-tr/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 14:44:25 +0000</pubDate>
		<dc:creator>Michael Greenberg</dc:creator>
				<category><![CDATA[Flapjax]]></category>
		<category><![CDATA[Programming Languages]]></category>

		<guid isPermaLink="false">http://www.weaselhat.com/?p=82</guid>
		<description><![CDATA[After much hard work (by more productive people), there is a technical report describing Flapjax. Check it out!]]></description>
			<content:encoded><![CDATA[<p>After much hard work (by <a href="http://www.cs.brown.edu/~arjun/" title="The Guhster, as we used to call him.">more</a> <a href="http://www.eecs.berkeley.edu/~lmeyerov/" title="Still working on browser stuff, it seems.">productive</a> <a href="http://www.cs.brown.edu/~sk/" title="Refers to himself as SKK.">people</a>), there is a <a href="http://www.cs.brown.edu/research/pubs/techreports/reports/CS-09-04.html" title="04?  Slow year, huh?">technical report describing Flapjax</a>.  Check it out!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.weaselhat.com/2009/04/15/flapjax-tr/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debounce and other callback combinators</title>
		<link>http://www.weaselhat.com/2009/03/25/callback-combinators/</link>
		<comments>http://www.weaselhat.com/2009/03/25/callback-combinators/#comments</comments>
		<pubDate>Wed, 25 Mar 2009 15:27:48 +0000</pubDate>
		<dc:creator>Michael Greenberg</dc:creator>
				<category><![CDATA[Flapjax]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Programming Languages]]></category>

		<guid isPermaLink="false">http://www.weaselhat.com/?p=77</guid>
		<description><![CDATA[It is serendipitous that I noticed a blog post about a callback combinator while adding a few drops to the Flapjax bucket. Flapjax is nothing more than a coherent set of callback combinators. The key insight to this set of callback combinators is the &#8220;Event&#8221; abstraction &#8212; a Node in FJ&#8217;s implementation. Once callbacks are [...]]]></description>
			<content:encoded><![CDATA[<p>It is serendipitous that I noticed <a href="http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/" title="Debouncing, trampolining -- why don't people realize how exciting programming is?">a blog post about a callback combinator</a> while adding a few drops to the <a href="http://www.flapjax-lang.org/" title="Oh, the times we've had.">Flapjax bucket</a>.</p>
<p>Flapjax is nothing more than a coherent set of callback combinators.  The key insight to this set of callback combinators is the &#8220;Event&#8221; abstraction &#8212; a <tt>Node</tt> in FJ&#8217;s implementation.  Once callbacks are Nodes, you get two things:</p>
<ol>
<li>a handle that allows you to multiply operate on a single (time-varying) data source, and</li>
<li>a whole host of useful abstractions for manipulating handles: <tt>mergeE</tt>, <tt>calmE</tt>, <tt>switchE</tt>, etc.</li>
</ol>
<p>The last I saw the implementations of <a href="http://resume.cs.brown.edu/" title="This is really hard to search for.">Resume</a> and <a href="http://continue2.cs.brown.edu/" title="Last seen as Continue 1.0, honestly.">Continue</a>, they were built using this idea.  The more I think about it, the more the FJ-language seems like the wrong approach: the FJ-library is an <i>awesome</i> abstraction, in theory and practice.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.weaselhat.com/2009/03/25/callback-combinators/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHPEnkoder 1.3</title>
		<link>http://www.weaselhat.com/2009/02/03/phpenkoder-13/</link>
		<comments>http://www.weaselhat.com/2009/02/03/phpenkoder-13/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 19:07:48 +0000</pubDate>
		<dc:creator>Michael Greenberg</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.weaselhat.com/?p=70</guid>
		<description><![CDATA[Ron Blaisdell pointed out that my use of noscript elements wasn&#8217;t XHTML compliant. Instead of using noscript tags, each enkoded section is preceded by a span containing the &#8220;you don&#8217;t have JavaScript&#8221; message. When the dekoded text is written to the document, this span is deleted. The latest version is up on PHPEnkoder&#8217;s home page [...]]]></description>
			<content:encoded><![CDATA[<p>Ron Blaisdell pointed out that my use of <tt>noscript</tt> elements wasn&#8217;t XHTML compliant.  Instead of using <tt>noscript</tt> tags, each enkoded section is preceded by a <tt>span</tt> containing the &#8220;you don&#8217;t have JavaScript&#8221; message.  When the dekoded text is written to the document, this <tt>span</tt> is deleted.</p>
<p>The latest version is up on <a href="phpenkoder/" title="Its 'crib', if you will.">PHPEnkoder&#8217;s home page</a> and <a href="http://wordpress.org/extend/plugins/php-enkoder/" title="Not that you could find it...">the WordPress plugin directory</a>.  (For some reason, PHPEnkoder doesn&#8217;t come up when you search for it in the directory, but Google can see it.  I&#8217;m not sure what the problem is here&#8230;)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.weaselhat.com/2009/02/03/phpenkoder-13/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
