<?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>Jigcode &#187; Jigs</title>
	<atom:link href="http://www.jigcode.com/category/jigs/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jigcode.com</link>
	<description>jig. n. a device that holds a piece of machine work and guides the tools operating on it</description>
	<lastBuildDate>Mon, 17 May 2010 11:42:43 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Ruby: Remove instances of a method</title>
		<link>http://www.jigcode.com/2009/09/03/ruby-remove-instances-of-a-method/</link>
		<comments>http://www.jigcode.com/2009/09/03/ruby-remove-instances-of-a-method/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 14:24:29 +0000</pubDate>
		<dc:creator>Jason Felice</dc:creator>
				<category><![CDATA[Jigs]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[regexp]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.jigcode.com/?p=143</guid>
		<description><![CDATA[Here&#8217;s an &#8220;old school&#8221; style jig. I first attempted this in Haskell, but I needed Perl-compatible regular expressions (Posix can&#8217;t handle the negative lookahead needed for correctly identifying C-style comments), and installing the PCRE library for Haskell on Windows is painful, though I&#8217;ll get around to it one of these days.

&#160;
require 'find'
&#160;
Find.find &#34;Components\\CommComponents&#34; do &#124;p&#124;
 [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s an &#8220;old school&#8221; style jig. I first attempted this in Haskell, but I needed Perl-compatible regular expressions (Posix can&#8217;t handle the negative lookahead needed for correctly identifying C-style comments), and installing the PCRE library for Haskell on Windows is painful, though I&#8217;ll get around to it one of these days.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">&nbsp;
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'find'</span>
&nbsp;
<span style="color:#CC00FF; font-weight:bold;">Find</span>.<span style="color:#9900CC;">find</span> <span style="color:#996600;">&quot;Components<span style="color:#000099;">\\</span>CommComponents&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>p<span style="color:#006600; font-weight:bold;">|</span>
  <span style="color:#CC00FF; font-weight:bold;">Find</span>.<span style="color:#9900CC;">prune</span> <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#CC0066; font-weight:bold;">p</span> =~ <span style="color:#006600; font-weight:bold;">/</span>\.<span style="color:#9900CC;">svn</span>$<span style="color:#006600; font-weight:bold;">/</span>i
  <span style="color:#9966CC; font-weight:bold;">next</span> <span style="color:#9966CC; font-weight:bold;">unless</span> <span style="color:#CC0066; font-weight:bold;">p</span> =~ <span style="color:#006600; font-weight:bold;">/</span>\.<span style="color:#006600; font-weight:bold;">&#40;</span>cpp<span style="color:#006600; font-weight:bold;">|</span>cxx<span style="color:#006600; font-weight:bold;">|</span>h<span style="color:#006600; font-weight:bold;">&#41;</span>$<span style="color:#006600; font-weight:bold;">/</span>i
&nbsp;
  data = <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#CC0066; font-weight:bold;">open</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0066; font-weight:bold;">p</span>,<span style="color:#996600;">&quot;rb&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">|</span>f<span style="color:#006600; font-weight:bold;">|</span> f.<span style="color:#9900CC;">read</span><span style="color:#006600; font-weight:bold;">&#125;</span>
  orig_data = data.<span style="color:#9900CC;">clone</span>
  <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#CC0066; font-weight:bold;">p</span> =~ <span style="color:#006600; font-weight:bold;">/</span>\.<span style="color:#9900CC;">h</span>$<span style="color:#006600; font-weight:bold;">/</span>
    data.<span style="color:#CC0066; font-weight:bold;">gsub!</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">/</span>
      \s<span style="color:#006600; font-weight:bold;">*</span>
      <span style="color:#006600; font-weight:bold;">&#40;</span>?:^<span style="color:#006600; font-weight:bold;">&#91;</span>\ \t<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">*</span>\<span style="color:#006600; font-weight:bold;">/</span>\<span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#91;</span>^\n<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">*</span>\n<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">*</span>
      ^<span style="color:#006600; font-weight:bold;">&#91;</span>\ \t<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">*</span><span style="color:#006600; font-weight:bold;">&#40;</span>?:virtual\s<span style="color:#006600; font-weight:bold;">+</span><span style="color:#006600; font-weight:bold;">&#41;</span>?HRESULT\s<span style="color:#006600; font-weight:bold;">+</span><span style="color:#006600; font-weight:bold;">&#40;</span>?:<span style="color:#006600; font-weight:bold;">&#91;</span>A<span style="color:#006600; font-weight:bold;">-</span>Za<span style="color:#006600; font-weight:bold;">-</span>z0<span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">9</span>_<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">*</span>::<span style="color:#006600; font-weight:bold;">&#41;</span>?GetAttributes\s\<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#91;</span>^\<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">*</span>\<span style="color:#006600; font-weight:bold;">&#41;</span>\s<span style="color:#006600; font-weight:bold;">*</span>;<span style="color:#006600; font-weight:bold;">&#91;</span>\ \t<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">*</span>
      <span style="color:#006600; font-weight:bold;">/</span>mx, <span style="color:#996600;">&quot;&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">elsif</span> <span style="color:#CC0066; font-weight:bold;">p</span> =~ <span style="color:#006600; font-weight:bold;">/</span>\.<span style="color:#006600; font-weight:bold;">&#40;</span>cpp<span style="color:#006600; font-weight:bold;">|</span>cxx<span style="color:#006600; font-weight:bold;">&#41;</span>$<span style="color:#006600; font-weight:bold;">/</span>
    data.<span style="color:#CC0066; font-weight:bold;">gsub!</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">/</span>
      \s<span style="color:#006600; font-weight:bold;">*</span>
      <span style="color:#006600; font-weight:bold;">&#40;</span>?:\<span style="color:#006600; font-weight:bold;">/</span>\<span style="color:#006600; font-weight:bold;">*</span><span style="color:#006600; font-weight:bold;">&#40;</span>?:<span style="color:#006600; font-weight:bold;">&#91;</span>^\<span style="color:#006600; font-weight:bold;">*</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">|</span>\<span style="color:#006600; font-weight:bold;">*</span><span style="color:#006600; font-weight:bold;">&#40;</span>?!\<span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">*</span>\<span style="color:#006600; font-weight:bold;">*</span>\<span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#41;</span>?\s<span style="color:#006600; font-weight:bold;">*</span>
      HRESULT\s<span style="color:#006600; font-weight:bold;">+</span><span style="color:#006600; font-weight:bold;">&#91;</span>A<span style="color:#006600; font-weight:bold;">-</span>Za<span style="color:#006600; font-weight:bold;">-</span>z_<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span>A<span style="color:#006600; font-weight:bold;">-</span>Za<span style="color:#006600; font-weight:bold;">-</span>z0<span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">9</span>_<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">*</span>::GetAttributes\s<span style="color:#006600; font-weight:bold;">*</span>\<span style="color:#006600; font-weight:bold;">&#40;</span>\s<span style="color:#006600; font-weight:bold;">*</span>
        ATTRIBUTES\s<span style="color:#006600; font-weight:bold;">*</span>\<span style="color:#006600; font-weight:bold;">*</span><span style="color:#006600; font-weight:bold;">&#91;</span>^,<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">*</span>,\s<span style="color:#006600; font-weight:bold;">*</span>int\s<span style="color:#006600; font-weight:bold;">*</span>\<span style="color:#006600; font-weight:bold;">*</span><span style="color:#006600; font-weight:bold;">&#91;</span>^,<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">*</span>\<span style="color:#006600; font-weight:bold;">&#41;</span>\s<span style="color:#006600; font-weight:bold;">*</span>
        \<span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">&#91;</span>^\<span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">*</span>\<span style="color:#006600; font-weight:bold;">&#125;</span>
      <span style="color:#006600; font-weight:bold;">/</span>mx, <span style="color:#996600;">&quot;&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">if</span> data != orig_data
    <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#CC0066; font-weight:bold;">open</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0066; font-weight:bold;">p</span>,<span style="color:#996600;">&quot;wb&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">|</span>f<span style="color:#006600; font-weight:bold;">|</span> f.<span style="color:#9900CC;">write</span><span style="color:#006600; font-weight:bold;">&#40;</span>data<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.jigcode.com/2009/09/03/ruby-remove-instances-of-a-method/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Haskell: Filter C++ Classes</title>
		<link>http://www.jigcode.com/2009/08/18/haskell-filter-c-classes/</link>
		<comments>http://www.jigcode.com/2009/08/18/haskell-filter-c-classes/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 02:59:53 +0000</pubDate>
		<dc:creator>Jason Felice</dc:creator>
				<category><![CDATA[Jigs]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[haskell]]></category>

		<guid isPermaLink="false">http://www.jigcode.com/?p=132</guid>
		<description><![CDATA[I&#8217;ve needed a jig to separate a C++ class&#8217;s declaration and implementation for quite some time. Compile with &#8220;ghc -O2 &#8211;make classfilt.hs&#8221; and invoke with &#8220;classfilt &#8211;impl&#8221; or &#8220;classfilt &#8211;decl&#8221;, piping in the class source with inline methods.  It certainly doesn&#8217;t handle all the corners of the C++ language, but it does most of [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve needed a jig to separate a C++ class&#8217;s declaration and implementation for quite some time. Compile with &#8220;ghc -O2 &#8211;make classfilt.hs&#8221; and invoke with &#8220;classfilt &#8211;impl&#8221; or &#8220;classfilt &#8211;decl&#8221;, piping in the class source with inline methods.  It certainly doesn&#8217;t handle all the corners of the C++ language, but it does most of the job.</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;"><span style="color: #06c; font-weight: bold;">import</span> <span style="color: #cccc00; font-weight: bold;">Char</span> <span style="color: green;">&#40;</span>isAlpha<span style="color: #339933; font-weight: bold;">,</span> isDigit<span style="color: #339933; font-weight: bold;">,</span> isSpace<span style="color: green;">&#41;</span>
<span style="color: #06c; font-weight: bold;">import</span> Data<span style="color: #339933; font-weight: bold;">.</span><span style="color: #cccc00; font-weight: bold;">Maybe</span>
<span style="color: #06c; font-weight: bold;">import</span> System<span style="color: #339933; font-weight: bold;">.</span>Environment <span style="color: green;">&#40;</span>getArgs<span style="color: green;">&#41;</span>
&nbsp;
isCSymF c <span style="color: #339933; font-weight: bold;">=</span> isAlpha c <span style="color: #339933; font-weight: bold;">||</span> c <span style="color: #339933; font-weight: bold;">==</span> '<span style="color: #339933; font-weight: bold;">_</span>'
isCSym c  <span style="color: #339933; font-weight: bold;">=</span> isCSymF c <span style="color: #339933; font-weight: bold;">||</span> isDigit c
&nbsp;
spanEscapedQuote q <span style="color: green;">&#40;</span>c:cs<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">|</span> c <span style="color: #339933; font-weight: bold;">==</span> q <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#40;</span><span style="color: green;">&#91;</span>c<span style="color: green;">&#93;</span><span style="color: #339933; font-weight: bold;">,</span> cs<span style="color: green;">&#41;</span>
spanEscapedQuote q <span style="color: green;">&#40;</span>'\\':c:cs<span style="color: green;">&#41;</span>     <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">case</span> spanEscapedQuote q cs <span style="color: #06c; font-weight: bold;">of</span>
                                       <span style="color: green;">&#40;</span>t<span style="color: #339933; font-weight: bold;">,</span>r<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="color: green;">&#40;</span>'\\':c:t<span style="color: #339933; font-weight: bold;">,</span> r<span style="color: green;">&#41;</span>
spanEscapedQuote q <span style="color: green;">&#40;</span>c:cs<span style="color: green;">&#41;</span>          <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">case</span> spanEscapedQuote q cs <span style="color: #06c; font-weight: bold;">of</span>
                                       <span style="color: green;">&#40;</span>t<span style="color: #339933; font-weight: bold;">,</span>r<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="color: green;">&#40;</span>c:t<span style="color: #339933; font-weight: bold;">,</span> r<span style="color: green;">&#41;</span>
&nbsp;
isNonNLSpace c <span style="color: #339933; font-weight: bold;">=</span> isSpace c <span style="color: #339933; font-weight: bold;">&amp;&amp;</span> c <span style="color: #339933; font-weight: bold;">/=</span> '\n'
&nbsp;
maybeLBrace <span style="color: green;">&#91;</span><span style="color: green;">&#93;</span>       <span style="color: #339933; font-weight: bold;">=</span> Nothing
maybeLBrace <span style="color: green;">&#40;</span>'<span style="color: green;">&#123;</span>':cs<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">=</span> Just <span style="color: green;">&#40;</span><span style="background-color: #3cb371;">&quot;{&quot;</span><span style="color: #339933; font-weight: bold;">,</span> cs<span style="color: green;">&#41;</span>
maybeLBrace <span style="color: green;">&#40;</span>c:cs<span style="color: green;">&#41;</span>
    <span style="color: #339933; font-weight: bold;">|</span> isSpace c         <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">case</span> maybeLBrace cs <span style="color: #06c; font-weight: bold;">of</span>
                            Just <span style="color: green;">&#40;</span>t<span style="color: #339933; font-weight: bold;">,</span>r<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">-&gt;</span> Just <span style="color: green;">&#40;</span>c:t<span style="color: #339933; font-weight: bold;">,</span>r<span style="color: green;">&#41;</span>
                            Nothing    <span style="color: #339933; font-weight: bold;">-&gt;</span> Nothing
    <span style="color: #339933; font-weight: bold;">|</span> True              <span style="color: #339933; font-weight: bold;">=</span> Nothing
&nbsp;
hasLBrace s <span style="color: #339933; font-weight: bold;">=</span> isJust <span style="color: #339933; font-weight: bold;">$</span> maybeLBrace s
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- Primitive C++ lexical scanner.  It knows enough not to get confused by</span>
<span style="color: #5d478b; font-style: italic;">-- things in comments and quotation marks, and things on preprocessor directive</span>
<span style="color: #5d478b; font-style: italic;">-- lines.  It returns a list of pairs, and one invariant is that collecting and</span>
<span style="color: #5d478b; font-style: italic;">-- concatenating all of the 'snd' elements of the pair will return the original</span>
<span style="color: #5d478b; font-style: italic;">-- file.</span>
&nbsp;
<span style="color: #06c; font-weight: bold;">data</span> Token <span style="color: #339933; font-weight: bold;">=</span> Comment
             <span style="color: #339933; font-weight: bold;">|</span> Identifier
             <span style="color: #339933; font-weight: bold;">|</span> LBrace
             <span style="color: #339933; font-weight: bold;">|</span> RBrace
             <span style="color: #339933; font-weight: bold;">|</span> LParen
             <span style="color: #339933; font-weight: bold;">|</span> Semi
             <span style="color: #339933; font-weight: bold;">|</span> OtherStuff
             <span style="color: #06c; font-weight: bold;">deriving</span> <span style="color: green;">&#40;</span><span style="color: #cccc00; font-weight: bold;">Show</span><span style="color: #339933; font-weight: bold;">,</span> <span style="color: #cccc00; font-weight: bold;">Eq</span><span style="color: green;">&#41;</span>
&nbsp;
tokens <span style="color: #339933; font-weight: bold;">_</span> <span style="color: green;">&#91;</span><span style="color: green;">&#93;</span>           <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#91;</span><span style="color: green;">&#93;</span>
tokens <span style="color: #339933; font-weight: bold;">_</span> <span style="color: green;">&#40;</span>'<span style="color: #339933; font-weight: bold;">/</span>':'<span style="color: #339933; font-weight: bold;">*</span>':cs<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">case</span> finishCStyleComment cs <span style="color: #06c; font-weight: bold;">of</span>
                          <span style="color: green;">&#40;</span>t<span style="color: #339933; font-weight: bold;">,</span>r<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="color: green;">&#40;</span>Comment<span style="color: #339933; font-weight: bold;">,</span> <span style="background-color: #3cb371;">&quot;/*&quot;</span> <span style="color: #339933; font-weight: bold;">++</span> t<span style="color: green;">&#41;</span> : tokens False r
                        <span style="color: #06c; font-weight: bold;">where</span>
                          finishCStyleComment <span style="color: green;">&#40;</span>'<span style="color: #339933; font-weight: bold;">*</span>':'<span style="color: #339933; font-weight: bold;">/</span>':cs<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#40;</span><span style="background-color: #3cb371;">&quot;*/&quot;</span><span style="color: #339933; font-weight: bold;">,</span> cs<span style="color: green;">&#41;</span>
                          finishCStyleComment <span style="color: green;">&#40;</span>c:cs<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">case</span> finishCStyleComment cs <span style="color: #06c; font-weight: bold;">of</span>
                                                         <span style="color: green;">&#40;</span>s<span style="color: #339933; font-weight: bold;">,</span>r<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="color: green;">&#40;</span>c:s<span style="color: #339933; font-weight: bold;">,</span>r<span style="color: green;">&#41;</span>
tokens <span style="color: #339933; font-weight: bold;">_</span> <span style="color: green;">&#40;</span>'<span style="color: #339933; font-weight: bold;">/</span>':'<span style="color: #339933; font-weight: bold;">/</span>':cs<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">case</span> <span style="font-weight: bold;">span</span> <span style="color: green;">&#40;</span><span style="color: #339933; font-weight: bold;">/=</span> '\n'<span style="color: green;">&#41;</span> cs <span style="color: #06c; font-weight: bold;">of</span>
                          <span style="color: green;">&#40;</span>t<span style="color: #339933; font-weight: bold;">,</span>'\n':r<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="color: green;">&#40;</span>Comment<span style="color: #339933; font-weight: bold;">,</span> <span style="background-color: #3cb371;">&quot;//&quot;</span> <span style="color: #339933; font-weight: bold;">++</span> t <span style="color: #339933; font-weight: bold;">++</span> <span style="background-color: #3cb371;">&quot;<span style="background-color: #3cb371; font-weight: bold;">\n</span>&quot;</span><span style="color: green;">&#41;</span> : tokens True r
                          <span style="color: green;">&#40;</span>t<span style="color: #339933; font-weight: bold;">,</span>r<span style="color: green;">&#41;</span>      <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="color: green;">&#40;</span>Comment<span style="color: #339933; font-weight: bold;">,</span> <span style="background-color: #3cb371;">&quot;//&quot;</span> <span style="color: #339933; font-weight: bold;">++</span> t<span style="color: green;">&#41;</span> : tokens False r
tokens <span style="color: #339933; font-weight: bold;">_</span> <span style="color: green;">&#40;</span>'<span style="background-color: #3cb371;">&quot;':cs)     = case spanEscapedQuote '&quot;</span>' cs <span style="color: #06c; font-weight: bold;">of</span>
                          <span style="color: green;">&#40;</span>t<span style="color: #339933; font-weight: bold;">,</span>r<span style="color: green;">&#41;</span>      <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="color: green;">&#40;</span>OtherStuff<span style="color: #339933; font-weight: bold;">,</span> '<span style="background-color: #3cb371;">&quot;' : t) : tokens False r -- &quot;</span>
tokens <span style="color: #339933; font-weight: bold;">_</span> <span style="color: green;">&#40;</span>'\'':cs<span style="color: green;">&#41;</span>    <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">case</span> spanEscapedQuote '\'' cs <span style="color: #06c; font-weight: bold;">of</span>
                          <span style="color: green;">&#40;</span>t<span style="color: #339933; font-weight: bold;">,</span>r<span style="color: green;">&#41;</span>      <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="color: green;">&#40;</span>OtherStuff<span style="color: #339933; font-weight: bold;">,</span> '\'' : t<span style="color: green;">&#41;</span> : tokens False r
tokens <span style="color: #339933; font-weight: bold;">_</span> <span style="color: green;">&#40;</span>'<span style="color: green;">&#123;</span>':cs<span style="color: green;">&#41;</span>     <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#40;</span>LBrace<span style="color: #339933; font-weight: bold;">,</span> <span style="background-color: #3cb371;">&quot;{&quot;</span><span style="color: green;">&#41;</span> : tokens False cs
tokens <span style="color: #339933; font-weight: bold;">_</span> s
    <span style="color: #339933; font-weight: bold;">|</span> hasLBrace s     <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">case</span> maybeLBrace s <span style="color: #06c; font-weight: bold;">of</span>
                          Just <span style="color: green;">&#40;</span>t<span style="color: #339933; font-weight: bold;">,</span>r<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="color: green;">&#40;</span>LBrace<span style="color: #339933; font-weight: bold;">,</span>t<span style="color: green;">&#41;</span> : tokens False r
&nbsp;
tokens <span style="color: #339933; font-weight: bold;">_</span> <span style="color: green;">&#40;</span>'<span style="color: green;">&#125;</span>':cs<span style="color: green;">&#41;</span>     <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#40;</span>RBrace<span style="color: #339933; font-weight: bold;">,</span> <span style="background-color: #3cb371;">&quot;}&quot;</span><span style="color: green;">&#41;</span> : tokens False cs
tokens <span style="color: #339933; font-weight: bold;">_</span> <span style="color: green;">&#40;</span>';':cs<span style="color: green;">&#41;</span>     <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#40;</span>Semi<span style="color: #339933; font-weight: bold;">,</span> <span style="background-color: #3cb371;">&quot;;&quot;</span><span style="color: green;">&#41;</span> : tokens False cs
tokens <span style="color: #339933; font-weight: bold;">_</span> <span style="color: green;">&#40;</span>'<span style="color: green;">&#40;</span>':cs<span style="color: green;">&#41;</span>     <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#40;</span>LParen<span style="color: #339933; font-weight: bold;">,</span> <span style="background-color: #3cb371;">&quot;(&quot;</span><span style="color: green;">&#41;</span> : tokens False cs
&nbsp;
tokens <span style="color: #339933; font-weight: bold;">_</span> <span style="color: green;">&#40;</span>'\n':cs<span style="color: green;">&#41;</span>    <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#40;</span>OtherStuff<span style="color: #339933; font-weight: bold;">,</span> <span style="background-color: #3cb371;">&quot;<span style="background-color: #3cb371; font-weight: bold;">\n</span>&quot;</span><span style="color: green;">&#41;</span> : tokens True cs
tokens True <span style="color: green;">&#40;</span>'#':cs<span style="color: green;">&#41;</span>  <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">case</span> <span style="font-weight: bold;">span</span> <span style="color: green;">&#40;</span><span style="color: #339933; font-weight: bold;">/=</span> '\n'<span style="color: green;">&#41;</span> cs <span style="color: #06c; font-weight: bold;">of</span>
                          <span style="color: green;">&#40;</span>t<span style="color: #339933; font-weight: bold;">,</span>'\n':r<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="color: green;">&#40;</span>OtherStuff<span style="color: #339933; font-weight: bold;">,</span> <span style="background-color: #3cb371;">&quot;#&quot;</span> <span style="color: #339933; font-weight: bold;">++</span> t <span style="color: #339933; font-weight: bold;">++</span> <span style="background-color: #3cb371;">&quot;<span style="background-color: #3cb371; font-weight: bold;">\n</span>&quot;</span><span style="color: green;">&#41;</span> : tokens True r
                          <span style="color: green;">&#40;</span>t<span style="color: #339933; font-weight: bold;">,</span>r<span style="color: green;">&#41;</span>      <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="color: green;">&#40;</span>OtherStuff<span style="color: #339933; font-weight: bold;">,</span> <span style="background-color: #3cb371;">&quot;#&quot;</span> <span style="color: #339933; font-weight: bold;">++</span> t<span style="color: green;">&#41;</span> : tokens False r
tokens <span style="color: #339933; font-weight: bold;">_</span> <span style="color: green;">&#40;</span>c:cs<span style="color: green;">&#41;</span>
    <span style="color: #339933; font-weight: bold;">|</span> isCSymF c       <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">case</span> <span style="font-weight: bold;">span</span> isCSym cs <span style="color: #06c; font-weight: bold;">of</span>
                          <span style="color: green;">&#40;</span>t<span style="color: #339933; font-weight: bold;">,</span>r<span style="color: green;">&#41;</span>      <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="color: green;">&#40;</span>Identifier<span style="color: #339933; font-weight: bold;">,</span> c:t<span style="color: green;">&#41;</span> : tokens False r
    <span style="color: #339933; font-weight: bold;">|</span> isNonNLSpace c  <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">case</span> <span style="font-weight: bold;">span</span> isNonNLSpace cs <span style="color: #06c; font-weight: bold;">of</span>
                          <span style="color: green;">&#40;</span>t<span style="color: #339933; font-weight: bold;">,</span>r<span style="color: green;">&#41;</span>      <span style="color: #339933; font-weight: bold;">-&gt;</span> <span style="color: green;">&#40;</span>OtherStuff<span style="color: #339933; font-weight: bold;">,</span> c:t<span style="color: green;">&#41;</span> : tokens False r
tokens s <span style="color: green;">&#40;</span>c:cs<span style="color: green;">&#41;</span>       <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#40;</span>OtherStuff<span style="color: #339933; font-weight: bold;">,</span> <span style="color: green;">&#91;</span>c<span style="color: green;">&#93;</span><span style="color: green;">&#41;</span> : tokens s cs
&nbsp;
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- filter method bodies from class declarations and replace with ';'</span>
rewriteAsClassDeclaration s <span style="color: #339933; font-weight: bold;">=</span>
        rTopLevel <span style="color: #339933; font-weight: bold;">$</span> tokens True s
    <span style="color: #06c; font-weight: bold;">where</span>
        rTopLevel <span style="color: green;">&#91;</span><span style="color: green;">&#93;</span>                         <span style="color: #339933; font-weight: bold;">=</span> <span style="background-color: #3cb371;">&quot;&quot;</span>
        rTopLevel <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>Identifier<span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;class&quot;</span><span style="color: green;">&#41;</span>:ts<span style="color: green;">&#41;</span>  <span style="color: #339933; font-weight: bold;">=</span> <span style="background-color: #3cb371;">&quot;class&quot;</span> <span style="color: #339933; font-weight: bold;">++</span> rClassDecl ts
        rTopLevel <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span><span style="color: #339933; font-weight: bold;">_,</span>s<span style="color: green;">&#41;</span>:ts<span style="color: green;">&#41;</span>                 <span style="color: #339933; font-weight: bold;">=</span> s <span style="color: #339933; font-weight: bold;">++</span> rTopLevel ts
&nbsp;
        rClassDecl <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>Semi<span style="color: #339933; font-weight: bold;">,</span>s<span style="color: green;">&#41;</span>:ts<span style="color: green;">&#41;</span>             <span style="color: #339933; font-weight: bold;">=</span> s <span style="color: #339933; font-weight: bold;">++</span> rTopLevel ts
        rClassDecl <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>LBrace<span style="color: #339933; font-weight: bold;">,</span>s<span style="color: green;">&#41;</span>:ts<span style="color: green;">&#41;</span>           <span style="color: #339933; font-weight: bold;">=</span> s <span style="color: #339933; font-weight: bold;">++</span> rClassBody ts
        rClassDecl <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span><span style="color: #339933; font-weight: bold;">_,</span>s<span style="color: green;">&#41;</span>:ts<span style="color: green;">&#41;</span>                <span style="color: #339933; font-weight: bold;">=</span> s <span style="color: #339933; font-weight: bold;">++</span> rClassDecl ts
&nbsp;
        rClassBody <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>RBrace<span style="color: #339933; font-weight: bold;">,</span>s<span style="color: green;">&#41;</span>:ts<span style="color: green;">&#41;</span>           <span style="color: #339933; font-weight: bold;">=</span> s <span style="color: #339933; font-weight: bold;">++</span> rTopLevel ts
        rClassBody <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>LBrace<span style="color: #339933; font-weight: bold;">,_</span><span style="color: green;">&#41;</span>:ts<span style="color: green;">&#41;</span>           <span style="color: #339933; font-weight: bold;">=</span> <span style="background-color: #3cb371;">&quot;;&quot;</span> <span style="color: #339933; font-weight: bold;">++</span> rMethodImpl <span style="color: red;">0</span> ts
        rClassBody <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span><span style="color: #339933; font-weight: bold;">_,</span>s<span style="color: green;">&#41;</span>:ts<span style="color: green;">&#41;</span>                <span style="color: #339933; font-weight: bold;">=</span> s <span style="color: #339933; font-weight: bold;">++</span> rClassBody ts
&nbsp;
        rMethodImpl <span style="color: red;">0</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>RBrace<span style="color: #339933; font-weight: bold;">,</span>s<span style="color: green;">&#41;</span>:ts<span style="color: green;">&#41;</span>        <span style="color: #339933; font-weight: bold;">=</span> rClassBody ts
        rMethodImpl n <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>RBrace<span style="color: #339933; font-weight: bold;">,_</span><span style="color: green;">&#41;</span>:ts<span style="color: green;">&#41;</span>        <span style="color: #339933; font-weight: bold;">=</span> rMethodImpl <span style="color: green;">&#40;</span>n<span style="color: #339933; font-weight: bold;">+</span><span style="color: red;">1</span><span style="color: green;">&#41;</span> ts
        rMethodImpl n <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>LBrace<span style="color: #339933; font-weight: bold;">,_</span><span style="color: green;">&#41;</span>:ts<span style="color: green;">&#41;</span>        <span style="color: #339933; font-weight: bold;">=</span> rMethodImpl <span style="color: green;">&#40;</span>n<span style="color: #339933; font-weight: bold;">-</span><span style="color: red;">1</span><span style="color: green;">&#41;</span> ts
        rMethodImpl n <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span><span style="color: #339933; font-weight: bold;">_,_</span><span style="color: green;">&#41;</span>:ts<span style="color: green;">&#41;</span>             <span style="color: #339933; font-weight: bold;">=</span> rMethodImpl n ts
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- filter everything except method implementations and add class</span>
<span style="color: #5d478b; font-style: italic;">-- name prefix.</span>
&nbsp;
minimumIndentation s <span style="color: #339933; font-weight: bold;">=</span>
        <span style="font-weight: bold;">minimum</span> <span style="color: #339933; font-weight: bold;">$</span> <span style="font-weight: bold;">filter</span> <span style="color: green;">&#40;</span><span style="color: #339933; font-weight: bold;">/=</span> <span style="color: red;">0</span><span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">$</span> <span style="font-weight: bold;">map</span> findIndent <span style="color: #339933; font-weight: bold;">$</span> <span style="font-weight: bold;">lines</span> s
    <span style="color: #06c; font-weight: bold;">where</span>
        findIndent <span style="color: green;">&#40;</span>' ':cs<span style="color: green;">&#41;</span>  <span style="color: #339933; font-weight: bold;">=</span> <span style="color: red;">1</span> <span style="color: #339933; font-weight: bold;">+</span> findIndent cs
        findIndent <span style="color: green;">&#40;</span>'\t':cs<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">=</span> <span style="color: red;">4</span> <span style="color: #339933; font-weight: bold;">+</span> findIndent cs
        findIndent <span style="color: #339933; font-weight: bold;">_</span>         <span style="color: #339933; font-weight: bold;">=</span> <span style="color: red;">0</span>
&nbsp;
unindent n s <span style="color: #339933; font-weight: bold;">=</span>
        <span style="font-weight: bold;">init</span> <span style="color: #339933; font-weight: bold;">$</span> <span style="font-weight: bold;">unlines</span> <span style="color: #339933; font-weight: bold;">$</span> <span style="font-weight: bold;">map</span> <span style="color: green;">&#40;</span>unindentLine n<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">$</span> <span style="font-weight: bold;">lines</span> s
    <span style="color: #06c; font-weight: bold;">where</span>
        unindentLine n s <span style="color: #339933; font-weight: bold;">|</span> n <span style="color: #339933; font-weight: bold;">&lt;=</span> <span style="color: red;">0</span> <span style="color: #339933; font-weight: bold;">=</span> s
        unindentLine n <span style="color: green;">&#40;</span>' ':cs<span style="color: green;">&#41;</span>   <span style="color: #339933; font-weight: bold;">=</span> unindentLine <span style="color: green;">&#40;</span>n<span style="color: #339933; font-weight: bold;">-</span><span style="color: red;">1</span><span style="color: green;">&#41;</span> cs
        unindentLine n <span style="color: green;">&#40;</span>'\t':cs<span style="color: green;">&#41;</span>  <span style="color: #339933; font-weight: bold;">=</span> unindentLine <span style="color: green;">&#40;</span>n<span style="color: #339933; font-weight: bold;">-</span><span style="color: red;">4</span><span style="color: green;">&#41;</span> cs
        unindentLine n s          <span style="color: #339933; font-weight: bold;">=</span> s
&nbsp;
reformatMethod name s <span style="color: #339933; font-weight: bold;">=</span> unindent <span style="color: green;">&#40;</span>minimumIndentation s<span style="color: green;">&#41;</span> s
&nbsp;
qualifyMethodName cname s <span style="color: #339933; font-weight: bold;">=</span>
        leader <span style="color: #339933; font-weight: bold;">++</span> cname <span style="color: #339933; font-weight: bold;">++</span> <span style="background-color: #3cb371;">&quot;::&quot;</span> <span style="color: #339933; font-weight: bold;">++</span> methodName
    <span style="color: #06c; font-weight: bold;">where</span>
        methodName <span style="color: #339933; font-weight: bold;">=</span> <span style="font-weight: bold;">reverse</span> <span style="color: #339933; font-weight: bold;">$</span> takeWhile isCSym <span style="color: #339933; font-weight: bold;">$</span> <span style="font-weight: bold;">dropWhile</span> isSpace <span style="color: #339933; font-weight: bold;">$</span> <span style="font-weight: bold;">reverse</span> s
        leader <span style="color: #339933; font-weight: bold;">=</span> <span style="font-weight: bold;">reverse</span> <span style="color: #339933; font-weight: bold;">$</span> <span style="font-weight: bold;">dropWhile</span> isCSym <span style="color: #339933; font-weight: bold;">$</span> <span style="font-weight: bold;">dropWhile</span> isSpace <span style="color: #339933; font-weight: bold;">$</span> <span style="font-weight: bold;">reverse</span> s
&nbsp;
rewriteAsClassImplementation s <span style="color: #339933; font-weight: bold;">=</span>
        rTopLevel <span style="color: #339933; font-weight: bold;">$</span> tokens True s
    <span style="color: #06c; font-weight: bold;">where</span>
        rTopLevel <span style="color: green;">&#91;</span><span style="color: green;">&#93;</span>                                  <span style="color: #339933; font-weight: bold;">=</span> <span style="background-color: #3cb371;">&quot;&quot;</span>
        rTopLevel <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>Identifier<span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;class&quot;</span><span style="color: green;">&#41;</span>:ts<span style="color: green;">&#41;</span>           <span style="color: #339933; font-weight: bold;">=</span> rClassDecl <span style="background-color: #3cb371;">&quot;class&quot;</span> Nothing ts
        rTopLevel <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span><span style="color: #339933; font-weight: bold;">_,</span>s<span style="color: green;">&#41;</span>:ts<span style="color: green;">&#41;</span>                          <span style="color: #339933; font-weight: bold;">=</span> s <span style="color: #339933; font-weight: bold;">++</span> rTopLevel ts
&nbsp;
        rClassDecl s <span style="color: #339933; font-weight: bold;">_</span> <span style="color: green;">&#91;</span><span style="color: green;">&#93;</span>                             <span style="color: #339933; font-weight: bold;">=</span> s
        rClassDecl s <span style="color: #339933; font-weight: bold;">_</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>Semi<span style="color: #339933; font-weight: bold;">,</span>rs<span style="color: green;">&#41;</span>:ts<span style="color: green;">&#41;</span>                 <span style="color: #339933; font-weight: bold;">=</span> s <span style="color: #339933; font-weight: bold;">++</span> rs <span style="color: #339933; font-weight: bold;">++</span> rTopLevel ts
        rClassDecl s <span style="color: green;">&#40;</span>Nothing<span style="color: green;">&#41;</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>Identifier<span style="color: #339933; font-weight: bold;">,</span>name<span style="color: green;">&#41;</span>:ts<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">=</span> rClassDecl <span style="color: green;">&#40;</span>s <span style="color: #339933; font-weight: bold;">++</span> name<span style="color: green;">&#41;</span> <span style="color: green;">&#40;</span>Just name<span style="color: green;">&#41;</span> ts
        rClassDecl s <span style="color: green;">&#40;</span>Just name<span style="color: green;">&#41;</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>LBrace<span style="color: #339933; font-weight: bold;">,_</span><span style="color: green;">&#41;</span>:ts<span style="color: green;">&#41;</span>      <span style="color: #339933; font-weight: bold;">=</span> rClassBodyStmt name False <span style="background-color: #3cb371;">&quot;&quot;</span> ts
        rClassDecl s maybeName <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span><span style="color: #339933; font-weight: bold;">_,</span>rs<span style="color: green;">&#41;</span>:ts<span style="color: green;">&#41;</span>            <span style="color: #339933; font-weight: bold;">=</span> rClassDecl <span style="color: green;">&#40;</span>s <span style="color: #339933; font-weight: bold;">++</span> rs<span style="color: green;">&#41;</span> maybeName ts
&nbsp;
        rClassBodyStmt cname <span style="color: #339933; font-weight: bold;">_</span> <span style="color: #339933; font-weight: bold;">_</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>Semi<span style="color: #339933; font-weight: bold;">,_</span><span style="color: green;">&#41;</span>:ts<span style="color: green;">&#41;</span>        <span style="color: #339933; font-weight: bold;">=</span> rClassBodyStmt cname False <span style="background-color: #3cb371;">&quot;&quot;</span> ts
        rClassBodyStmt cname <span style="color: #339933; font-weight: bold;">_</span> <span style="color: #339933; font-weight: bold;">_</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>RBrace<span style="color: #339933; font-weight: bold;">,_</span><span style="color: green;">&#41;</span>:ts<span style="color: green;">&#41;</span>      <span style="color: #339933; font-weight: bold;">=</span> rClassBodySemi ts
        rClassBodyStmt cname <span style="color: #339933; font-weight: bold;">_</span> s <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>LBrace<span style="color: #339933; font-weight: bold;">,</span>rs<span style="color: green;">&#41;</span>:ts<span style="color: green;">&#41;</span>     <span style="color: #339933; font-weight: bold;">=</span> rMethodBody cname <span style="color: green;">&#40;</span>s <span style="color: #339933; font-weight: bold;">++</span> rs<span style="color: green;">&#41;</span> <span style="color: red;">0</span> ts
        rClassBodyStmt cname False s <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>LParen<span style="color: #339933; font-weight: bold;">,</span>rs<span style="color: green;">&#41;</span>:ts<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">=</span> rClassBodyStmt cname True <span style="color: green;">&#40;</span>qualifyMethodName cname s <span style="color: #339933; font-weight: bold;">++</span> rs<span style="color: green;">&#41;</span> ts
        rClassBodyStmt cname m s <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>Identifier<span style="color: #339933; font-weight: bold;">,</span><span style="background-color: #3cb371;">&quot;virtual&quot;</span><span style="color: green;">&#41;</span>:ts<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">=</span> rClassBodyStmt cname m s ts
        rClassBodyStmt cname m s <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span><span style="color: #339933; font-weight: bold;">_,</span>rs<span style="color: green;">&#41;</span>:ts<span style="color: green;">&#41;</span>          <span style="color: #339933; font-weight: bold;">=</span> rClassBodyStmt cname m <span style="color: green;">&#40;</span>s <span style="color: #339933; font-weight: bold;">++</span> rs<span style="color: green;">&#41;</span> ts
&nbsp;
        rMethodBody name s <span style="color: red;">0</span> <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>RBrace<span style="color: #339933; font-weight: bold;">,</span>rs<span style="color: green;">&#41;</span>:ts<span style="color: green;">&#41;</span>         <span style="color: #339933; font-weight: bold;">=</span> <span style="color: green;">&#40;</span>reformatMethod name <span style="color: #339933; font-weight: bold;">$</span> s <span style="color: #339933; font-weight: bold;">++</span> rs<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">++</span> rClassBodyStmt name False <span style="background-color: #3cb371;">&quot;&quot;</span> ts
        rMethodBody name s n <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>RBrace<span style="color: #339933; font-weight: bold;">,</span>rs<span style="color: green;">&#41;</span>:ts<span style="color: green;">&#41;</span>         <span style="color: #339933; font-weight: bold;">=</span> rMethodBody name <span style="color: green;">&#40;</span>s <span style="color: #339933; font-weight: bold;">++</span> rs<span style="color: green;">&#41;</span> <span style="color: green;">&#40;</span>n<span style="color: #339933; font-weight: bold;">-</span><span style="color: red;">1</span><span style="color: green;">&#41;</span> ts
        rMethodBody name s n <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>LBrace<span style="color: #339933; font-weight: bold;">,</span>rs<span style="color: green;">&#41;</span>:ts<span style="color: green;">&#41;</span>         <span style="color: #339933; font-weight: bold;">=</span> rMethodBody name <span style="color: green;">&#40;</span>s <span style="color: #339933; font-weight: bold;">++</span> rs<span style="color: green;">&#41;</span> <span style="color: green;">&#40;</span>n<span style="color: #339933; font-weight: bold;">+</span><span style="color: red;">1</span><span style="color: green;">&#41;</span> ts
        rMethodBody name s n <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span><span style="color: #339933; font-weight: bold;">_,</span>rs<span style="color: green;">&#41;</span>:ts<span style="color: green;">&#41;</span>              <span style="color: #339933; font-weight: bold;">=</span> rMethodBody name <span style="color: green;">&#40;</span>s <span style="color: #339933; font-weight: bold;">++</span> rs<span style="color: green;">&#41;</span> n ts
&nbsp;
        rClassBodySemi <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span>Semi<span style="color: #339933; font-weight: bold;">,_</span><span style="color: green;">&#41;</span>:ts<span style="color: green;">&#41;</span>                  <span style="color: #339933; font-weight: bold;">=</span> rTopLevel ts
        rClassBodySemi <span style="color: green;">&#40;</span><span style="color: green;">&#40;</span><span style="color: #339933; font-weight: bold;">_,_</span><span style="color: green;">&#41;</span>:ts<span style="color: green;">&#41;</span>                     <span style="color: #339933; font-weight: bold;">=</span> rClassBodySemi ts
&nbsp;
classfilt <span style="color: green;">&#91;</span><span style="background-color: #3cb371;">&quot;--decl&quot;</span><span style="color: green;">&#93;</span> s <span style="color: #339933; font-weight: bold;">=</span> rewriteAsClassDeclaration s
classfilt <span style="color: green;">&#91;</span><span style="background-color: #3cb371;">&quot;--impl&quot;</span><span style="color: green;">&#93;</span> s <span style="color: #339933; font-weight: bold;">=</span> rewriteAsClassImplementation s
&nbsp;
main <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">do</span> args <span style="color: #339933; font-weight: bold;">&lt;-</span> getArgs
          <span style="font-weight: bold;">interact</span> <span style="color: green;">&#40;</span>classfilt args<span style="color: green;">&#41;</span>
&nbsp;
<span style="color: #5d478b; font-style: italic;">-- vi:set sts=4 sw=4 ai et:</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.jigcode.com/2009/08/18/haskell-filter-c-classes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Erlang: Remove #include directives from all cpp files</title>
		<link>http://www.jigcode.com/2009/08/03/erlang-remove-include-directives-from-all-cpp-files/</link>
		<comments>http://www.jigcode.com/2009/08/03/erlang-remove-include-directives-from-all-cpp-files/#comments</comments>
		<pubDate>Mon, 03 Aug 2009 20:54:19 +0000</pubDate>
		<dc:creator>Jason Felice</dc:creator>
				<category><![CDATA[Jigs]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[erlang]]></category>

		<guid isPermaLink="false">http://www.jigcode.com/?p=128</guid>
		<description><![CDATA[I'm certain this can be done better and with fewer lines of code, but it's my first Erlang jig.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m certain this can be done better and with fewer lines of code, but it&#8217;s my first Erlang jig.</p>

<div class="wp_syntax"><div class="code"><pre class="erlang" style="font-family:monospace;"><span style="color: #014ea4;">-</span><span style="color: #5400b3;">module</span><span style="color: #109ab8;">&#40;</span>cppdev<span style="color: #109ab8;">&#41;</span><span style="color: #6bb810;">.</span>
<span style="color: #014ea4;">-</span><span style="color: #5400b3;">compile</span><span style="color: #109ab8;">&#40;</span>export_all<span style="color: #109ab8;">&#41;</span><span style="color: #6bb810;">.</span>
&nbsp;
<span style="color: #ff3c00;">quote_re</span><span style="color: #109ab8;">&#40;</span><span style="color: #109ab8;">&#91;</span><span style="color: #109ab8;">&#93;</span><span style="color: #109ab8;">&#41;</span> <span style="color: #6bb810;">-&gt;</span>
    <span style="color: #109ab8;">&#91;</span><span style="color: #109ab8;">&#93;</span><span style="color: #6bb810;">;</span>
<span style="color: #ff3c00;">quote_re</span><span style="color: #109ab8;">&#40;</span><span style="color: #109ab8;">&#91;</span>$<span style="color: #6bb810;">.</span>|Rest<span style="color: #109ab8;">&#93;</span><span style="color: #109ab8;">&#41;</span> <span style="color: #6bb810;">-&gt;</span>
    <span style="color: #ff7800;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>.&quot;</span> <span style="color: #014ea4;">++</span> <span style="color: #ff3c00;">quote_re</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">Rest</span><span style="color: #109ab8;">&#41;</span><span style="color: #6bb810;">;</span>
<span style="color: #ff3c00;">quote_re</span><span style="color: #109ab8;">&#40;</span><span style="color: #109ab8;">&#91;</span><span style="color: #45b3e6;">C</span>|Rest<span style="color: #109ab8;">&#93;</span><span style="color: #109ab8;">&#41;</span> <span style="color: #6bb810;">-&gt;</span>
    <span style="color: #109ab8;">&#91;</span><span style="color: #45b3e6;">C</span>|<span style="color: #ff3c00;">quote_re</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">Rest</span><span style="color: #109ab8;">&#41;</span><span style="color: #109ab8;">&#93;</span><span style="color: #6bb810;">.</span>
&nbsp;
<span style="color: #ff3c00;">filter_include</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">Data</span><span style="color: #6bb810;">,</span> <span style="color: #45b3e6;">Include</span><span style="color: #109ab8;">&#41;</span> <span style="color: #6bb810;">-&gt;</span>
    <span style="color: #109ab8;">&#123;</span>ok<span style="color: #6bb810;">,</span> <span style="color: #45b3e6;">Pattern</span><span style="color: #109ab8;">&#125;</span> <span style="color: #014ea4;">=</span> <span style="color: #ff4e18;">re</span>:<span style="color: #ff3c00;">compile</span><span style="color: #109ab8;">&#40;</span><span style="color: #ff7800;">&quot;^<span style="color: #000099; font-weight: bold;">\\</span>s*#<span style="color: #000099; font-weight: bold;">\\</span>s*include<span style="color: #000099; font-weight: bold;">\\</span>s*[&lt;<span style="color: #000099; font-weight: bold;">\&quot;</span>](?:(?i)&quot;</span> <span style="color: #014ea4;">++</span> <span style="color: #ff3c00;">quote_re</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">Include</span><span style="color: #109ab8;">&#41;</span> <span style="color: #014ea4;">++</span> <span style="color: #ff7800;">&quot;)[&gt;<span style="color: #000099; font-weight: bold;">\&quot;</span>]<span style="color: #000099; font-weight: bold;">\\</span>s*$&quot;</span><span style="color: #109ab8;">&#41;</span><span style="color: #6bb810;">,</span>
    <span style="color: #ff3c00;">grep_v</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">Data</span><span style="color: #6bb810;">,</span> <span style="color: #45b3e6;">Pattern</span><span style="color: #109ab8;">&#41;</span><span style="color: #6bb810;">.</span>
&nbsp;
<span style="color: #ff3c00;">extract_line</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">Text</span><span style="color: #109ab8;">&#41;</span> <span style="color: #6bb810;">-&gt;</span>
    <span style="color: #186895;">case</span> <span style="color: #ff4e18;">lists</span>:<span style="color: #ff3c00;">splitwith</span><span style="color: #109ab8;">&#40;</span><span style="color: #ff3c00;">fun</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">C</span><span style="color: #109ab8;">&#41;</span> <span style="color: #6bb810;">-&gt;</span> <span style="color: #45b3e6;">C</span> <span style="color: #014ea4;">=/=</span> $\n <span style="color: #186895;">end</span><span style="color: #6bb810;">,</span> <span style="color: #45b3e6;">Text</span><span style="color: #109ab8;">&#41;</span> <span style="color: #186895;">of</span>
        <span style="color: #109ab8;">&#123;</span><span style="color: #45b3e6;">Line</span><span style="color: #6bb810;">,</span> <span style="color: #109ab8;">&#91;</span><span style="color: #45b3e6;">C</span>|Rest<span style="color: #109ab8;">&#93;</span><span style="color: #109ab8;">&#125;</span> <span style="color: #6bb810;">-&gt;</span> <span style="color: #109ab8;">&#123;</span><span style="color: #45b3e6;">Line</span> <span style="color: #014ea4;">++</span> <span style="color: #109ab8;">&#91;</span><span style="color: #45b3e6;">C</span><span style="color: #109ab8;">&#93;</span><span style="color: #6bb810;">,</span><span style="color: #45b3e6;">Rest</span><span style="color: #109ab8;">&#125;</span><span style="color: #6bb810;">;</span>
        <span style="color: #109ab8;">&#123;</span><span style="color: #45b3e6;">Line</span><span style="color: #6bb810;">,</span> <span style="color: #45b3e6;">Rest</span><span style="color: #109ab8;">&#125;</span>     <span style="color: #6bb810;">-&gt;</span> <span style="color: #109ab8;">&#123;</span><span style="color: #45b3e6;">Line</span><span style="color: #6bb810;">,</span> <span style="color: #45b3e6;">Rest</span><span style="color: #109ab8;">&#125;</span>
    <span style="color: #186895;">end</span><span style="color: #6bb810;">.</span>
&nbsp;
<span style="color: #ff3c00;">grep_v</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">Data</span><span style="color: #6bb810;">,</span> <span style="color: #45b3e6;">Pattern</span><span style="color: #109ab8;">&#41;</span> <span style="color: #6bb810;">-&gt;</span>
    <span style="color: #ff3c00;">grep_v</span><span style="color: #109ab8;">&#40;</span><span style="color: #109ab8;">&#91;</span><span style="color: #109ab8;">&#93;</span><span style="color: #6bb810;">,</span> <span style="color: #45b3e6;">Data</span><span style="color: #6bb810;">,</span> <span style="color: #45b3e6;">Pattern</span><span style="color: #109ab8;">&#41;</span><span style="color: #6bb810;">.</span>
&nbsp;
<span style="color: #ff3c00;">grep_v</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">Accum</span><span style="color: #6bb810;">,</span> <span style="color: #109ab8;">&#91;</span><span style="color: #109ab8;">&#93;</span><span style="color: #6bb810;">,</span> <span style="color: #45b3e6;">_</span><span style="color: #109ab8;">&#41;</span> <span style="color: #6bb810;">-&gt;</span>
    <span style="color: #ff4e18;">lists</span>:<span style="color: #ff3c00;">flatten</span><span style="color: #109ab8;">&#40;</span><span style="color: #ff4e18;">lists</span>:<span style="color: #ff3c00;">reverse</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">Accum</span><span style="color: #109ab8;">&#41;</span><span style="color: #109ab8;">&#41;</span><span style="color: #6bb810;">;</span>
<span style="color: #ff3c00;">grep_v</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">Accum</span><span style="color: #6bb810;">,</span> <span style="color: #45b3e6;">Data</span><span style="color: #6bb810;">,</span> <span style="color: #45b3e6;">Pattern</span><span style="color: #109ab8;">&#41;</span> <span style="color: #6bb810;">-&gt;</span>
    <span style="color: #109ab8;">&#123;</span><span style="color: #45b3e6;">Line</span><span style="color: #6bb810;">,</span><span style="color: #45b3e6;">Rest</span><span style="color: #109ab8;">&#125;</span> <span style="color: #014ea4;">=</span> <span style="color: #ff3c00;">extract_line</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">Data</span><span style="color: #109ab8;">&#41;</span><span style="color: #6bb810;">,</span>
    <span style="color: #186895;">case</span> <span style="color: #ff4e18;">re</span>:<span style="color: #ff3c00;">run</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">Line</span><span style="color: #6bb810;">,</span> <span style="color: #45b3e6;">Pattern</span><span style="color: #109ab8;">&#41;</span> <span style="color: #186895;">of</span>
        <span style="color: #109ab8;">&#123;</span>match<span style="color: #6bb810;">,</span><span style="color: #45b3e6;">_</span><span style="color: #109ab8;">&#125;</span> <span style="color: #6bb810;">-&gt;</span> <span style="color: #ff3c00;">grep_v</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">Accum</span><span style="color: #6bb810;">,</span> <span style="color: #45b3e6;">Rest</span><span style="color: #6bb810;">,</span> <span style="color: #45b3e6;">Pattern</span><span style="color: #109ab8;">&#41;</span><span style="color: #6bb810;">;</span>
        <span style="color: #45b3e6;">_</span>         <span style="color: #6bb810;">-&gt;</span> <span style="color: #ff3c00;">grep_v</span><span style="color: #109ab8;">&#40;</span><span style="color: #109ab8;">&#91;</span><span style="color: #45b3e6;">Line</span>|Accum<span style="color: #109ab8;">&#93;</span><span style="color: #6bb810;">,</span> <span style="color: #45b3e6;">Rest</span><span style="color: #6bb810;">,</span> <span style="color: #45b3e6;">Pattern</span><span style="color: #109ab8;">&#41;</span>
    <span style="color: #186895;">end</span><span style="color: #6bb810;">.</span>
&nbsp;
<span style="color: #ff3c00;">transform_file</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">Fun</span><span style="color: #6bb810;">,</span> <span style="color: #45b3e6;">Filename</span><span style="color: #109ab8;">&#41;</span> <span style="color: #6bb810;">-&gt;</span>
	<span style="color: #109ab8;">&#123;</span>ok<span style="color: #6bb810;">,</span> <span style="color: #45b3e6;">Data</span><span style="color: #109ab8;">&#125;</span> <span style="color: #014ea4;">=</span> <span style="color: #ff4e18;">file</span>:<span style="color: #ff3c00;">read_file</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">Filename</span><span style="color: #109ab8;">&#41;</span><span style="color: #6bb810;">,</span>
	<span style="color: #45b3e6;">NewData</span> <span style="color: #014ea4;">=</span> <span style="color: #ff3c00;">list_to_binary</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">F</span><span style="color: #ff3c00;">un</span><span style="color: #109ab8;">&#40;</span><span style="color: #ff3c00;">binary_to_list</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">Data</span><span style="color: #109ab8;">&#41;</span><span style="color: #109ab8;">&#41;</span><span style="color: #109ab8;">&#41;</span><span style="color: #6bb810;">,</span>
	<span style="color: #186895;">if</span>
	  <span style="color: #45b3e6;">Data</span> <span style="color: #014ea4;">=:=</span> <span style="color: #45b3e6;">NewData</span> <span style="color: #6bb810;">-&gt;</span>
        <span style="color: #006600;">nochange</span><span style="color: #6bb810;">;</span>
	  true <span style="color: #6bb810;">-&gt;</span>
        <span style="color: #006600;">ok</span> <span style="color: #014ea4;">=</span> <span style="color: #ff4e18;">file</span>:<span style="color: #ff3c00;">write_file</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">Filename</span> <span style="color: #014ea4;">++</span> <span style="color: #ff7800;">&quot;-&quot;</span><span style="color: #6bb810;">,</span> <span style="color: #45b3e6;">Data</span><span style="color: #109ab8;">&#41;</span><span style="color: #6bb810;">,</span>
        ok <span style="color: #014ea4;">=</span> <span style="color: #ff4e18;">file</span>:<span style="color: #ff3c00;">write_file</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">Filename</span><span style="color: #6bb810;">,</span> <span style="color: #45b3e6;">NewData</span><span style="color: #109ab8;">&#41;</span>
	<span style="color: #186895;">end</span><span style="color: #6bb810;">.</span>
&nbsp;
<span style="color: #ff3c00;">find_files</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">Fun</span><span style="color: #6bb810;">,</span> <span style="color: #45b3e6;">Root</span><span style="color: #109ab8;">&#41;</span> <span style="color: #6bb810;">-&gt;</span>
    <span style="color: #ff3c00;">find_files</span><span style="color: #109ab8;">&#40;</span><span style="color: #109ab8;">&#91;</span><span style="color: #109ab8;">&#93;</span><span style="color: #6bb810;">,</span> <span style="color: #45b3e6;">Fun</span><span style="color: #6bb810;">,</span> <span style="color: #109ab8;">&#91;</span><span style="color: #45b3e6;">Root</span><span style="color: #109ab8;">&#93;</span><span style="color: #109ab8;">&#41;</span><span style="color: #6bb810;">.</span>
&nbsp;
<span style="color: #ff3c00;">find_files</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">Accum</span><span style="color: #6bb810;">,</span> <span style="color: #45b3e6;">_</span><span style="color: #6bb810;">,</span> <span style="color: #109ab8;">&#91;</span><span style="color: #109ab8;">&#93;</span><span style="color: #109ab8;">&#41;</span> <span style="color: #6bb810;">-&gt;</span>
    <span style="color: #45b3e6;">Accum</span><span style="color: #6bb810;">;</span>
<span style="color: #ff3c00;">find_files</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">Accum</span><span style="color: #6bb810;">,</span> <span style="color: #45b3e6;">Fun</span><span style="color: #6bb810;">,</span> <span style="color: #109ab8;">&#91;</span><span style="color: #45b3e6;">Root</span>|RestOfRoots<span style="color: #109ab8;">&#93;</span><span style="color: #109ab8;">&#41;</span> <span style="color: #6bb810;">-&gt;</span>
    <span style="color: #109ab8;">&#123;</span>ok<span style="color: #6bb810;">,</span><span style="color: #45b3e6;">Files</span><span style="color: #109ab8;">&#125;</span> <span style="color: #014ea4;">=</span> <span style="color: #ff4e18;">file</span>:<span style="color: #ff3c00;">list_dir</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">Root</span><span style="color: #109ab8;">&#41;</span><span style="color: #6bb810;">,</span>
    <span style="color: #45b3e6;">Files2</span> <span style="color: #014ea4;">=</span> <span style="color: #ff4e18;">lists</span>:<span style="color: #ff3c00;">filter</span><span style="color: #109ab8;">&#40;</span><span style="color: #ff3c00;">fun</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">FN</span><span style="color: #109ab8;">&#41;</span> <span style="color: #6bb810;">-&gt;</span> <span style="color: #ff4e18;">string</span>:<span style="color: #ff3c00;">to_lower</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">FN</span><span style="color: #109ab8;">&#41;</span> <span style="color: #014ea4;">=/=</span> <span style="color: #ff7800;">&quot;.svn&quot;</span> <span style="color: #186895;">end</span><span style="color: #6bb810;">,</span> <span style="color: #45b3e6;">Files</span><span style="color: #109ab8;">&#41;</span><span style="color: #6bb810;">,</span>
    <span style="color: #45b3e6;">PathedFiles</span> <span style="color: #014ea4;">=</span> <span style="color: #ff4e18;">lists</span>:<span style="color: #ff3c00;">map</span><span style="color: #109ab8;">&#40;</span><span style="color: #ff3c00;">fun</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">FN</span><span style="color: #109ab8;">&#41;</span> <span style="color: #6bb810;">-&gt;</span> <span style="color: #45b3e6;">Root</span> <span style="color: #014ea4;">++</span> <span style="color: #ff7800;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>&quot;</span> <span style="color: #014ea4;">++</span> <span style="color: #45b3e6;">FN</span> <span style="color: #186895;">end</span><span style="color: #6bb810;">,</span> <span style="color: #45b3e6;">Files2</span><span style="color: #109ab8;">&#41;</span><span style="color: #6bb810;">,</span>
    <span style="color: #45b3e6;">Dirs</span> <span style="color: #014ea4;">=</span> <span style="color: #ff4e18;">lists</span>:<span style="color: #ff3c00;">filter</span><span style="color: #109ab8;">&#40;</span><span style="color: #ff3c00;">fun</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">P</span><span style="color: #109ab8;">&#41;</span> <span style="color: #6bb810;">-&gt;</span> <span style="color: #ff4e18;">filelib</span>:<span style="color: #ff3c00;">is_dir</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">P</span><span style="color: #109ab8;">&#41;</span> <span style="color: #186895;">end</span><span style="color: #6bb810;">,</span> <span style="color: #45b3e6;">PathedFiles</span><span style="color: #109ab8;">&#41;</span><span style="color: #6bb810;">,</span>
    <span style="color: #45b3e6;">FilteredFiles</span> <span style="color: #014ea4;">=</span> <span style="color: #ff4e18;">lists</span>:<span style="color: #ff3c00;">filter</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">Fun</span><span style="color: #6bb810;">,</span> <span style="color: #45b3e6;">PathedFiles</span><span style="color: #109ab8;">&#41;</span><span style="color: #6bb810;">,</span>
    <span style="color: #ff3c00;">find_files</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">Accum</span> <span style="color: #014ea4;">++</span> <span style="color: #45b3e6;">FilteredFiles</span><span style="color: #6bb810;">,</span> <span style="color: #45b3e6;">Fun</span><span style="color: #6bb810;">,</span> <span style="color: #45b3e6;">RestOfRoots</span> <span style="color: #014ea4;">++</span> <span style="color: #45b3e6;">Dirs</span><span style="color: #109ab8;">&#41;</span><span style="color: #6bb810;">.</span>
&nbsp;
&nbsp;
<span style="color: #ff3c00;">fix</span><span style="color: #109ab8;">&#40;</span><span style="color: #109ab8;">&#41;</span> <span style="color: #6bb810;">-&gt;</span>
    <span style="color: #45b3e6;">StripHeaderF</span> <span style="color: #014ea4;">=</span> <span style="color: #ff3c00;">fun</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">D</span><span style="color: #109ab8;">&#41;</span> <span style="color: #6bb810;">-&gt;</span> <span style="color: #ff3c00;">filter_include</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">D</span><span style="color: #6bb810;">,</span> <span style="color: #ff7800;">&quot;ISOMsgEx.h&quot;</span><span style="color: #109ab8;">&#41;</span> <span style="color: #186895;">end</span><span style="color: #6bb810;">,</span>
    <span style="color: #45b3e6;">TransformF</span> <span style="color: #014ea4;">=</span> <span style="color: #ff3c00;">fun</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">FN</span><span style="color: #109ab8;">&#41;</span> <span style="color: #6bb810;">-&gt;</span> <span style="color: #ff3c00;">transform_file</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">StripHeaderF</span><span style="color: #6bb810;">,</span> <span style="color: #45b3e6;">FN</span><span style="color: #109ab8;">&#41;</span> <span style="color: #186895;">end</span><span style="color: #6bb810;">,</span>
    <span style="color: #45b3e6;">FilenameTestF</span> <span style="color: #014ea4;">=</span> <span style="color: #ff3c00;">fun</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">FN</span><span style="color: #109ab8;">&#41;</span> <span style="color: #6bb810;">-&gt;</span> <span style="color: #ff4e18;">string</span>:<span style="color: #ff3c00;">to_lower</span><span style="color: #109ab8;">&#40;</span><span style="color: #ff4e18;">string</span>:<span style="color: #ff3c00;">right</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">FN</span><span style="color: #6bb810;">,</span> <span style="color: #ff9600;">4</span><span style="color: #109ab8;">&#41;</span><span style="color: #109ab8;">&#41;</span> <span style="color: #014ea4;">=:=</span> <span style="color: #ff7800;">&quot;.cpp&quot;</span> <span style="color: #186895;">end</span><span style="color: #6bb810;">,</span>
    <span style="color: #ff4e18;">lists</span>:<span style="color: #ff3c00;">map</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">TransformF</span><span style="color: #6bb810;">,</span> <span style="color: #ff3c00;">find_files</span><span style="color: #109ab8;">&#40;</span><span style="color: #45b3e6;">FilenameTestF</span><span style="color: #6bb810;">,</span> <span style="color: #ff7800;">&quot;Components&quot;</span><span style="color: #109ab8;">&#41;</span><span style="color: #109ab8;">&#41;</span><span style="color: #6bb810;">.</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.jigcode.com/2009/08/03/erlang-remove-include-directives-from-all-cpp-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python: Generate Test Case Stubs For All Classes In A Module</title>
		<link>http://www.jigcode.com/2009/07/09/python-generate-test-case-stubs-for-all-classes-in-a-module/</link>
		<comments>http://www.jigcode.com/2009/07/09/python-generate-test-case-stubs-for-all-classes-in-a-module/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 00:39:28 +0000</pubDate>
		<dc:creator>David Andrzejewski</dc:creator>
				<category><![CDATA[Jigs]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.jigcode.com/?p=111</guid>
		<description><![CDATA[I had a module full of classes.  I wanted to generate a unittest.TestCase stub for every class, such as this:

# TODO: Finish this
class Test_className&#40;unittest.TestCase&#41;:
    def setUp&#40;self&#41;:
        pass

So, I wrote the following Python script:

if __name__==&#34;__main__&#34;:
    file = &#34;c:/dev/sourceFile.py&#34;
    f [...]]]></description>
			<content:encoded><![CDATA[<p>I had a module full of classes.  I wanted to generate a <a href="http://docs.python.org/library/unittest.html#unittest.TestCase">unittest.TestCase</a> stub for every class, such as this:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># TODO: Finish this</span>
<span style="color: #ff7700;font-weight:bold;">class</span> Test_className<span style="color: black;">&#40;</span><span style="color: #dc143c;">unittest</span>.<span style="color: black;">TestCase</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">def</span> setUp<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">pass</span></pre></div></div>

<p>So, I wrote the following Python script:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">if</span> __name__==<span style="color: #483d8b;">&quot;__main__&quot;</span>:
    <span style="color: #008000;">file</span> = <span style="color: #483d8b;">&quot;c:/dev/sourceFile.py&quot;</span>
    f = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #008000;">file</span>, <span style="color: #483d8b;">&quot;r&quot;</span><span style="color: black;">&#41;</span>
    line = f.<span style="color: #dc143c;">readline</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    count = <span style="color: #ff4500;">0</span>
    thing = <span style="color: black;">&#91;</span> <span style="color: black;">&#93;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">while</span> line:
        <span style="color: #ff7700;font-weight:bold;">if</span> line<span style="color: black;">&#91;</span>:<span style="color: #ff4500;">5</span><span style="color: black;">&#93;</span> == <span style="color: #483d8b;">&quot;class&quot;</span>:
            count += <span style="color: #ff4500;">1</span>
            parenpos = line.<span style="color: black;">find</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;(&quot;</span><span style="color: black;">&#41;</span>
            classname = line<span style="color: black;">&#91;</span><span style="color: #ff4500;">6</span>:parenpos<span style="color: black;">&#93;</span>
            thing.<span style="color: black;">append</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'# TODO: Finish this'</span><span style="color: black;">&#41;</span>
            thing.<span style="color: black;">append</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'class Test_%s(unittest.TestCase):'</span> <span style="color: #66cc66;">%</span> classname<span style="color: black;">&#41;</span>
            thing.<span style="color: black;">append</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'    def setUp(self):'</span><span style="color: black;">&#41;</span>
            thing.<span style="color: black;">append</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'        pass'</span><span style="color: black;">&#41;</span>
            thing.<span style="color: black;">append</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">''</span><span style="color: black;">&#41;</span>
&nbsp;
&nbsp;
        line = f.<span style="color: #dc143c;">readline</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
    f.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">for</span> item <span style="color: #ff7700;font-weight:bold;">in</span> thing:
        <span style="color: #ff7700;font-weight:bold;">print</span> item</pre></div></div>

<p>Just a quick way to save myself some mundane typing.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jigcode.com/2009/07/09/python-generate-test-case-stubs-for-all-classes-in-a-module/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Scheme: Translate static data from C++ to XML</title>
		<link>http://www.jigcode.com/2009/06/23/scheme-translate-static-data-from-c-to-xml/</link>
		<comments>http://www.jigcode.com/2009/06/23/scheme-translate-static-data-from-c-to-xml/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 14:13:04 +0000</pubDate>
		<dc:creator>Jason Felice</dc:creator>
				<category><![CDATA[Jigs]]></category>
		<category><![CDATA[bigloo]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[scheme]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://www.jigcode.com/?p=105</guid>
		<description><![CDATA[<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
The C++ was extracted and munged with vim to make nice Scheme syntax elements before running this script.

&#34;das.cpp&#34;&#34;&#60;isofield id=\&#34;~a\&#34; length=\&#34;~a\&#34; name=\&#34;~a\&#34; pad=\&#34;true\&#34; class=\&#34;org.jpos.iso.~a\&#34;/&#62;~n&#34;

]]></description>
			<content:encoded><![CDATA[<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<p>The C++ was extracted and munged with vim to make nice Scheme syntax elements before running this script.</p>

<div class="wp_syntax"><div class="code"><pre class="scheme" style="font-family:monospace;"><span style="color: #ff0000;">&quot;das.cpp&quot;</span><span style="color: #ff0000;">&quot;&lt;isofield id=<span style="color: #000099; font-weight: bold;">\&quot;</span>~a<span style="color: #000099; font-weight: bold;">\&quot;</span> length=<span style="color: #000099; font-weight: bold;">\&quot;</span>~a<span style="color: #000099; font-weight: bold;">\&quot;</span> name=<span style="color: #000099; font-weight: bold;">\&quot;</span>~a<span style="color: #000099; font-weight: bold;">\&quot;</span> pad=<span style="color: #000099; font-weight: bold;">\&quot;</span>true<span style="color: #000099; font-weight: bold;">\&quot;</span> class=<span style="color: #000099; font-weight: bold;">\&quot;</span>org.jpos.iso.~a<span style="color: #000099; font-weight: bold;">\&quot;</span>/&gt;~n&quot;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.jigcode.com/2009/06/23/scheme-translate-static-data-from-c-to-xml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick and Dirty Wordpress Backup Script (*NIX Shell)</title>
		<link>http://www.jigcode.com/2009/06/11/quick-and-dirty-wordpress-backup-script-nix-shell/</link>
		<comments>http://www.jigcode.com/2009/06/11/quick-and-dirty-wordpress-backup-script-nix-shell/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 03:50:56 +0000</pubDate>
		<dc:creator>David Andrzejewski</dc:creator>
				<category><![CDATA[Jigs]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.jigcode.com/?p=81</guid>
		<description><![CDATA[Here&#8217;s a quick and dirty script to back up a wordpress blog.  In fact, it&#8217;s the backup script we use to back up Jigcode.  Of course, all of the hostnames, usernames and passwords have been removed.
This runs from a crontab which gets e-mailed to me, so I do an &#8216;ls&#8217; at the end so I [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a quick and dirty script to back up a wordpress blog.  In fact, it&#8217;s the backup script we use to back up Jigcode.  Of course, all of the hostnames, usernames and passwords have been removed.</p>
<p>This runs from a crontab which gets e-mailed to me, so I do an &#8216;ls&#8217; at the end so I can see the fruits of my labor.</p>
<p>A prerequisite is that you set up SSH keys to connect to the host, so you don&#8217;t need to store a plaintext password.</p>
<p>This script runs on <a href="http://www.freebsd.org/">FreeBSD</a>.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>tank<span style="color: #000000; font-weight: bold;">/</span>backup<span style="color: #000000; font-weight: bold;">/</span>jigcode
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-f</span> wordpress_blog.sql.gz.003
<span style="color: #c20cb9; font-weight: bold;">mv</span> wordpress_blog.sql.gz.002 wordpress_blog.sql.gz.003
<span style="color: #c20cb9; font-weight: bold;">mv</span> wordpress_blog.sql.gz.001 wordpress_blog.sql.gz.002
<span style="color: #c20cb9; font-weight: bold;">mv</span> wordpress_blog.sql.gz wordpress_blog.sql.gz.001
&nbsp;
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>mysqldump <span style="color: #660033;">-h</span> HOSTNAME <span style="color: #660033;">-uUSERNAME</span> <span style="color: #660033;">-pPASSWORD</span> DATABASENAME <span style="color: #660033;">--complete-insert</span> <span style="color: #660033;">--create-options</span> <span style="color: #000000; font-weight: bold;">&gt;</span> wordpress_blog.sql
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$?</span> <span style="color: #660033;">-ne</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Error returned from MYSQLDUMP!&quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>rsync <span style="color: #660033;">--del</span> <span style="color: #660033;">-r</span> <span style="color: #660033;">--verbose</span> USERNAME<span style="color: #000000; font-weight: bold;">@</span>HOSTNAME:jigcode <span style="color: #000000; font-weight: bold;">/</span>tank<span style="color: #000000; font-weight: bold;">/</span>backup<span style="color: #000000; font-weight: bold;">/</span>jigcode<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$?</span> <span style="color: #660033;">-ne</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Error returned from rsync!&quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">gzip</span> <span style="color: #660033;">-9</span> wordpress_blog.sql
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$?</span> <span style="color: #660033;">-ne</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Error returned from gzip!&quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-alth</span> <span style="color: #000000; font-weight: bold;">/</span>tank<span style="color: #000000; font-weight: bold;">/</span>backup<span style="color: #000000; font-weight: bold;">/</span>jigcode</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.jigcode.com/2009/06/11/quick-and-dirty-wordpress-backup-script-nix-shell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scheme: Graph lines of code in Subversion</title>
		<link>http://www.jigcode.com/2009/06/11/scheme-graph-lines-of-code-in-subversion/</link>
		<comments>http://www.jigcode.com/2009/06/11/scheme-graph-lines-of-code-in-subversion/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 13:38:42 +0000</pubDate>
		<dc:creator>Jason Felice</dc:creator>
				<category><![CDATA[Jigs]]></category>
		<category><![CDATA[bigloo]]></category>
		<category><![CDATA[gnuplot]]></category>
		<category><![CDATA[graph]]></category>
		<category><![CDATA[scheme]]></category>
		<category><![CDATA[subversion]]></category>

		<guid isPermaLink="false">http://www.jigcode.com/?p=70</guid>
		<description><![CDATA[<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
This checks out every tenth version from SVN and produces a data file which can easily be used as input to gnuplot.  You can see the final graph.

&#34;^[ \t][ \t]*void\\s+test[A-Za-z_0-9]*\\s*\\(\\s*\\)&#34;&#34;h&#34;&#34;Test_&#34;&#34;cpp&#34;&#34;h&#34;&#34;hpp&#34;&#34;cxx&#34;&#34;hxx&#34;&#34;report.txt&#34;&#34;svn up -r ~a&#34;&#34;.&#34;&#34;.svn&#34;&#34;boost&#34;&#34;WindowsSDK&#34;&#34;XML&#34;&#34;OPENSSL&#34;&#34;Release&#34;&#34;cxxtest&#34;&#34;\\&#34;&#34;\\&#34;&#34;\\&#34;&#34;\\&#34;&#34;\\&#34;&#34;\\&#34;&#34;~a ~a ~a ~a&#34;

]]></description>
			<content:encoded><![CDATA[<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<p>This checks out every tenth version from SVN and produces a data file which can easily be used as input to gnuplot.  You can see the <a href="http://www.jigcode.com/wp-content/uploads/2009/06/das_lines_of_code.png">final graph</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="scheme" style="font-family:monospace;"><span style="color: #ff0000;">&quot;^[ <span style="color: #000099; font-weight: bold;">\t</span>][ <span style="color: #000099; font-weight: bold;">\t</span>]*void<span style="color: #000099; font-weight: bold;">\\</span>s+test[A-Za-z_0-9]*<span style="color: #000099; font-weight: bold;">\\</span>s*<span style="color: #000099; font-weight: bold;">\\</span>(<span style="color: #000099; font-weight: bold;">\\</span>s*<span style="color: #000099; font-weight: bold;">\\</span>)&quot;</span><span style="color: #ff0000;">&quot;h&quot;</span><span style="color: #ff0000;">&quot;Test_&quot;</span><span style="color: #ff0000;">&quot;cpp&quot;</span><span style="color: #ff0000;">&quot;h&quot;</span><span style="color: #ff0000;">&quot;hpp&quot;</span><span style="color: #ff0000;">&quot;cxx&quot;</span><span style="color: #ff0000;">&quot;hxx&quot;</span><span style="color: #ff0000;">&quot;report.txt&quot;</span><span style="color: #ff0000;">&quot;svn up -r ~a&quot;</span><span style="color: #ff0000;">&quot;.&quot;</span><span style="color: #ff0000;">&quot;.svn&quot;</span><span style="color: #ff0000;">&quot;boost&quot;</span><span style="color: #ff0000;">&quot;WindowsSDK&quot;</span><span style="color: #ff0000;">&quot;XML&quot;</span><span style="color: #ff0000;">&quot;OPENSSL&quot;</span><span style="color: #ff0000;">&quot;Release&quot;</span><span style="color: #ff0000;">&quot;cxxtest&quot;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>&quot;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>&quot;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>&quot;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>&quot;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>&quot;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>&quot;</span><span style="color: #ff0000;">&quot;~a ~a ~a ~a&quot;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.jigcode.com/2009/06/11/scheme-graph-lines-of-code-in-subversion/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Scheme: Save preprocessor output for all compiled files</title>
		<link>http://www.jigcode.com/2009/06/07/scheme-save-preprocessor-output-for-all-compiled-files/</link>
		<comments>http://www.jigcode.com/2009/06/07/scheme-save-preprocessor-output-for-all-compiled-files/#comments</comments>
		<pubDate>Sun, 07 Jun 2009 15:11:26 +0000</pubDate>
		<dc:creator>Jason Felice</dc:creator>
				<category><![CDATA[Jigs]]></category>
		<category><![CDATA[bigloo]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[msvc]]></category>
		<category><![CDATA[scheme]]></category>

		<guid isPermaLink="false">http://www.jigcode.com/?p=30</guid>
		<description><![CDATA[<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
This is a wrapper for the MSVC compiler (cl.exe) to generate a .i file as well as a .obj.  Compiled with Bigloo.

&#34;&#34;&#34; \&#34;&#34;&#34;\&#34;&#34;; Run cl.exe to compile
&#34;cl&#34;; Run cl.exe to produce preprocessed .i
&#34;cl /P&#34;; /P puts the file in the current directory, so we need to move it to the
; same directory the object [...]]]></description>
			<content:encoded><![CDATA[<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<br />
<b>Warning</b>:  preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unknown modifier 'c' in <b>/usr/local/www/sites/jigcode.com/wp-content/plugins/wp-syntax/geshi/geshi.php</b> on line <b>3324</b><br />
<p>This is a wrapper for the MSVC compiler (cl.exe) to generate a .i file as well as a .obj.  Compiled with <a href="http://www-sop.inria.fr/mimosa/fp/Bigloo/">Bigloo</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="scheme" style="font-family:monospace;"><span style="color: #ff0000;">&quot;&quot;</span><span style="color: #ff0000;">&quot; <span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #808080; font-style: italic;">; Run cl.exe to compile</span>
<span style="color: #ff0000;">&quot;cl&quot;</span><span style="color: #808080; font-style: italic;">; Run cl.exe to produce preprocessed .i</span>
<span style="color: #ff0000;">&quot;cl /P&quot;</span><span style="color: #808080; font-style: italic;">; /P puts the file in the current directory, so we need to move it to the</span>
<span style="color: #808080; font-style: italic;">; same directory the object would have been in.  Get the target directory from</span>
<span style="color: #808080; font-style: italic;">; the /Fo option and the source name from the .(c|cpp).</span>
<span style="color: #ff0000;">&quot;/Fo&quot;</span><span style="color: #ff0000;">&quot;cpp&quot;</span><span style="color: #ff0000;">&quot;c&quot;</span><span style="color: #ff0000;">&quot;cxx&quot;</span><span style="color: #ff0000;">&quot;.i&quot;</span><span style="color: #ff0000;">&quot;.i&quot;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.jigcode.com/2009/06/07/scheme-save-preprocessor-output-for-all-compiled-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python: List files older than or newer than a specific date and time</title>
		<link>http://www.jigcode.com/2009/06/07/python-list-files-older-than-or-newer-than-a-specific-date-and-time/</link>
		<comments>http://www.jigcode.com/2009/06/07/python-list-files-older-than-or-newer-than-a-specific-date-and-time/#comments</comments>
		<pubDate>Sun, 07 Jun 2009 15:03:00 +0000</pubDate>
		<dc:creator>David Andrzejewski</dc:creator>
				<category><![CDATA[Jigs]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[filesystem]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[time]]></category>

		<guid isPermaLink="false">http://www.jigcode.com/?p=7</guid>
		<description><![CDATA[
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import os, sys
from datetime import date, timedelta, datetime
from time import localtime
import re
&#160;
files = os.listdir&#40;'c:/windows/system32/'&#41;
&#160;
files = &#91; f for f in files if re.search&#40;'.dll$', f, re.I&#41;&#93;
&#160;
files.sort&#40;&#41;
&#160;
d = datetime.now&#40;&#41; - timedelta&#40;days=30&#41;
d = d.timetuple&#40;&#41;
&#160;
oldfiles = 0
newfiles = 0
for file in files:
    filetimesecs = os.path.getmtime&#40;'c:/windows/system32/' + file&#41;
    filetime = localtime&#40;filetimesecs&#41;
&#160;
#       print &#34;*******************************&#34;
#       print [...]]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>, <span style="color: #dc143c;">sys</span>
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">datetime</span> <span style="color: #ff7700;font-weight:bold;">import</span> date, timedelta, <span style="color: #dc143c;">datetime</span>
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">time</span> <span style="color: #ff7700;font-weight:bold;">import</span> localtime
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">re</span>
&nbsp;
files = <span style="color: #dc143c;">os</span>.<span style="color: black;">listdir</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'c:/windows/system32/'</span><span style="color: black;">&#41;</span>
&nbsp;
files = <span style="color: black;">&#91;</span> f <span style="color: #ff7700;font-weight:bold;">for</span> f <span style="color: #ff7700;font-weight:bold;">in</span> files <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #dc143c;">re</span>.<span style="color: black;">search</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'.dll$'</span>, f, <span style="color: #dc143c;">re</span>.<span style="color: black;">I</span><span style="color: black;">&#41;</span><span style="color: black;">&#93;</span>
&nbsp;
files.<span style="color: black;">sort</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
d = <span style="color: #dc143c;">datetime</span>.<span style="color: black;">now</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> - timedelta<span style="color: black;">&#40;</span>days=<span style="color: #ff4500;">30</span><span style="color: black;">&#41;</span>
d = d.<span style="color: black;">timetuple</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
oldfiles = <span style="color: #ff4500;">0</span>
newfiles = <span style="color: #ff4500;">0</span>
<span style="color: #ff7700;font-weight:bold;">for</span> <span style="color: #008000;">file</span> <span style="color: #ff7700;font-weight:bold;">in</span> files:
    filetimesecs = <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">getmtime</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'c:/windows/system32/'</span> + <span style="color: #008000;">file</span><span style="color: black;">&#41;</span>
    filetime = localtime<span style="color: black;">&#40;</span>filetimesecs<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">#       print &quot;*******************************&quot;</span>
<span style="color: #808080; font-style: italic;">#       print file</span>
<span style="color: #808080; font-style: italic;">#       print filetime</span>
<span style="color: #808080; font-style: italic;">#       print &quot;*******************************&quot;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> filetime <span style="color: #66cc66;">&lt;</span> d:
    oldfiles += <span style="color: #ff4500;">1</span>
<span style="color: #ff7700;font-weight:bold;">if</span> filetime <span style="color: #66cc66;">&gt;</span> d:
    newfiles += <span style="color: #ff4500;">1</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Old Files: %s&quot;</span> <span style="color: #66cc66;">%</span> oldfiles
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;New Files: %s&quot;</span> <span style="color: #66cc66;">%</span> newfiles</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.jigcode.com/2009/06/07/python-list-files-older-than-or-newer-than-a-specific-date-and-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
