From: Andre P. <at...@us...> - 2004-05-16 08:42:24
|
Update of /cvsroot/hoc/www In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1857 Modified Files: hoc.css index.html support.html Added Files: .htaccess bg-stripes-verydark.png examples.html screenshots.html Log Message: Switched webpages to use Apache server-side includes (SSI) rather than duplicating header/footer information in every HTML file Added Screenshots page Added Examples page Index: index.html =================================================================== RCS file: /cvsroot/hoc/www/index.html,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- index.html 14 May 2004 07:41:41 -0000 1.2 +++ index.html 16 May 2004 08:42:15 -0000 1.3 @@ -1,87 +1,8 @@ -<html> - - <head> - <title>HOC: A Haskell to Objective-C binding</title> - </head> - - <style type="text/css" media="screen">@import "hoc.css";</style> - - <body> - - <div id="mainBox" class="main-box"> - <div class="content-box"> - <div class="logo-box"> - <table width="100%" cellpadding="4" cellspacing="4"> - <tr> - <td border="0" rowspan="2"> - <img src="HOC-Logo.png"> - </td> - <td align="center"> - <font size="+4"><strong>HOC:</strong></font> - </td> - </tr> - <th align="center"> - <font size="+3">A Haskell to Objective-C Binding</a> - </th> - </table> - </div> - <div class="tab-box"> - - <table align="center" cellpadding="0" cellspacing="0" - border="0"> - <tr valign="top"> - <td><img src="tab-start-selected.png" alt="" border="0"></td> - - <td border="0"> - <img src="tab-home-selected.png" alt="Home" border="0"> - </td> - - <td><img src="tab-divisor-selected.png" alt=" | " border="0"></td> - - <td border="0"> - <a href="download.html" class="plain"> - <img src="tab-download.png" alt="Download" border="0"> - </a> - </td> - - <td><img src="tab-divisor.png" alt=" | " border="0"></td> - - <td border="0"> - <a href="examples.html" class="plain"> - <img src="tab-examples.png" alt="Examples" border="0"> - </a> - </td> - - <td><img src="tab-divisor.png" alt=" | " border="0"></td> - - <td border="0"> - <a href="screenshots.html" class="plain"> - <img src="tab-screenshots.png" alt="Screenshots" border="0"> - </a> - </td> - - <td><img src="tab-divisor.png" alt=" | " border="0"></td> - - <td border="0"> - <a href="documentation.html" class="plain"> - <img src="tab-documentation.png" alt="Documentation" border="0"> - </a> - </td> - - <td><img src="tab-divisor.png" alt=" | " border="0"></td> - - <td border="0"> - <a href="support.html" class="plain"> - <img src="tab-support.png" alt="Support" border="0"> - </a> - </td> - - <td border="0"><img src="tab-end.png" alt="" border="0"></td> - - </tr> - </table> +<!--#set var="title" value="- A Haskell to Objective-C Binding" --> +<!--#set var="active-tab" value="Home" --> +<!--#set var="big-logo" value="yes" --> - <div class="firstpage"> +<!--#include virtual="/templates.hoc/header.shtml" --> <h1>About</h1> @@ -141,7 +62,7 @@ </div> - <p align="right"><a href="http://sourceforge.net/"> <img + <p align="right"><a href="http://sourceforge.net/" class="plain"> <img src="http://sourceforge.net/sflogo.php?group_id=93369&type=5" width="210" height="62" border="0" alt="SourceForge.net Logo" /> </a></p> Index: hoc.css =================================================================== RCS file: /cvsroot/hoc/www/hoc.css,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- hoc.css 14 May 2004 07:34:14 -0000 1.1.1.1 +++ hoc.css 16 May 2004 08:42:15 -0000 1.2 @@ -19,7 +19,14 @@ p { font-size:100%; margin: 12px 0; - align: justify; + text-align: justify; +} + +p.center { + font-size:100%; + margin: 12px 0; + text-align: center; + align: center; } li { @@ -36,9 +43,9 @@ h2 { font-family: Verdana, sans-serif; - font-size:130%; - line-height: 130%; - color: #000066; + font-size:120%; + line-height: 120%; + /* color: #000066; */ text-align: center; } @@ -64,6 +71,13 @@ border: none; } +img.bordered { + border: 1px solid #BDBDBD; + padding: 12px 12px; + background-image: url("bg-stripes-verydark.png"); + background-repeat: repeat; +} + /* :: header graphics :: */ img.site-header { @@ -82,6 +96,9 @@ border: none; } +img.screenshot { +} + /* :: outer boxes :: */ body { --- NEW FILE: .htaccess --- # Turn on Server-Side Includes (SSI) and indexes Options Indexes +Includes # SSI support for .shtml files AddType text/html .shtml AddHandler server-parsed .shtml # SSI support for +x'ed .html files: # See http://httpd.apache.org/docs/howto/ssi.html XBitHack Full --- NEW FILE: bg-stripes-verydark.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: screenshots.html --- <!--#set var="title" value="Screenshots" --> <!--#set var="active-tab" value="Screenshots" --> <!--#include virtual="/templates.hoc/header.shtml" --> <h1>Screenshots</h1> <h2>A Text Editor</h2> <p>Here's the canonical GUI text editor application, implemented in about 50 lines of Haskell code. The code for this is distributed in HOC's <code>Samples/</code> source distribution.</p> <p class="center"> <a href="screenshots/Editor.png" class="plain"> <img src="screenshots/Editor.png" width="90%"> </a> </p> <p class="center" align="center"> <a href="screenshots/Editor.png"> (Click to enlarge.) </a> <p> <h2>Class Browser</h2> <p>This is a small program that comes with HOC which shows you the list of all known Objective-C <em>selectors</em> (method names). It shows you the selector in both Objective-C and Haskell syntax, the type of the Haskell function produced, and what class (and thus the Haskell module) the selector is defined in. This program's approximately 200 lines of code.</p> <p class="center" align="center"> <a href="screenshots/Browser.png" class="plain"> <img src="screenshots/Browser.png" width="90%"> </a> </p> <p class="center" align="center"> <a href="screenshots/Browser.png"> (Click to enlarge.) </a> <p> <h2>A Calculator</h2> <p>Here's a small application which allows you to enter in arithmetic expressions (e.g. <code>2+5</code> or <code>69*33/3+15</code>) and will calculate the final result. The full program is about 75 lines long: about 25 lines for the expression parsing code, and ~50 lines for the GUI.</p> <p> <table align="center" border="0"> <tr> <td> <img src="screenshots/ExpressionParser.png" class="bordered"> </td> <td> <img src="screenshots/ExpressionParser_error.png" class="bordered"> </td> </tr> </table> </p> <!--#include virtual="/templates.hoc/footer.shtml" --> Index: support.html =================================================================== RCS file: /cvsroot/hoc/www/support.html,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- support.html 14 May 2004 07:41:41 -0000 1.2 +++ support.html 16 May 2004 08:42:15 -0000 1.3 @@ -1,140 +1,46 @@ -<html> - - <head> - <title>HOC: A Haskell to Objective-C binding</title> - </head> - - <style type="text/css" media="screen">@import "hoc.css";</style> - - <body> - - <div id="mainBox" class="main-box"> - <div class="content-box"> - <div class="logo-box"> - - <table align="center" width="100%" cellpadding="4" cellspacing="4"> - <tr> - <td border="0" align="right"> - <img src="HOC-Small-Logo.png"> - </td> - <td align="center"> - <font size="+3">HOC: A Haskell to Objective-C Binding</font> - </td> - </tr> - </table> - - </div> - <div class="tab-box"> - - <table align="center" cellpadding="0" cellspacing="0" - border="0"> - <tr valign="top"> - <td><img src="tab-start.png" alt="" border="0"></td> - - <td border="0"> - <a href="index.html" class="plain"> - <img src="tab-home.png" alt="Home" border="0"> - </a> - </td> - - <td><img src="tab-divisor.png" alt=" | " border="0"></td> - - <td border="0"> - <a href="download.html" class="plain"> - <img src="tab-download.png" alt="Download" border="0"> - </a> - </td> - - <td><img src="tab-divisor.png" alt=" | " border="0"></td> - - <td border="0"> - <a href="examples.html" class="plain"> - <img src="tab-examples.png" alt="Examples" border="0"> - </a> - </td> - - <td><img src="tab-divisor.png" alt=" | " border="0"></td> - - <td border="0"> - <a href="screenshots.html" class="plain"> - <img src="tab-screenshots.png" alt="Screenshots" border="0"> - </a> - </td> - - <td><img src="tab-divisor.png" alt=" | " border="0"></td> - - <td border="0"> - <a href="documentation.html" class="plain"> - <img src="tab-documentation.png" alt="Documentation" border="0"> - </a> - </td> - - <td><img src="tab-divisor-selected.png" alt=" | " border="0"></td> - - <td border="0"> - <img src="tab-support-selected.png" alt="Support" border="0"> - </td> - - <td border="0"><img src="tab-end-selected.png" alt="" border="0"></td> - - </tr> - </table> - - <div class="firstpage"> - - <h1>Mailing Lists</h1> - - <p>There are four mailing lists where you can contact the HOC - developers and other users:</p> - - <div class="inner-box"> - - <table align="center" width="100%"> - <tr> - <td nowrap> - <code><a href="http://lists.sourceforge.net/lists/listinfo/hoc-announce">hoc...@li...</a> </code> - <td>Announcements of HOC releases and related tools (low-traffic)</td> - </tr> +<!--#set var="title" value="Support" --> +<!--#set var="active-tab" value="Support" --> - <tr> - <td nowrap> - <code><a href="http://lists.sourceforge.net/lists/listinfo/hoc-users">hoc...@li...</a></code> - </td> - <td>General HOC discussions</td> - </tr> +<!--#include virtual="/templates.hoc/header.shtml" --> - <tr> - <td nowrap> - <code><a href="http://lists.sourceforge.net/lists/listinfo/hoc-devel">hoc...@li...</a></code> - </td> - <td>HOC developer & implementation discussions</td> +<h1>Mailing Lists</h1> - </tr> +<p>There are four mailing lists where you can contact the HOC +developers and other users:</p> - <tr> - <td nowrap> - <code><a href="http://lists.sourceforge.net/lists/listinfo/hoc-cvs">ho...@li...</a></code> - </td> - <td>CVS commit log messages</td> - </tr> +<div class="inner-box"> - </table> + <table align="center" width="100%"> + <tr> + <td nowrap> + <code><a href="http://lists.sourceforge.net/lists/listinfo/hoc-announce">hoc-announce</a> </code></td> + <td>Announcements of HOC releases and related tools (low-traffic)</td> + </tr> - </div> + <tr> + <td nowrap> + <code><a href="http://lists.sourceforge.net/lists/listinfo/hoc-users">hoc-users</a></code> + </td> + <td>General HOC discussions</td> + </tr> - </div> - </div> - <!-- <a class="plain" href="/"><img - src="HOC-Small-Logo.png"></a> --> - </div> + <tr> + <td nowrap> + <code><a href="http://lists.sourceforge.net/lists/listinfo/hoc-devel">hoc-devel</a></code> + </td> + <td>HOC developer & implementation discussions</td> + </tr> - <p align="right"><a href="http://sourceforge.net/"> <img - src="http://sourceforge.net/sflogo.php?group_id=93369&type=5" - width="210" height="62" border="0" alt="SourceForge.net Logo" /> </a></p> + <tr> + <td nowrap> + <code><a href="http://lists.sourceforge.net/lists/listinfo/hoc-cvs">hoc-cvs</a></code> + </td> + <td>CVS commit log messages</td> + </tr> - </div> + </table> - </body> +</div> - </html> +<!--#include virtual="/templates.hoc/footer.shtml" --> --- NEW FILE: examples.html --- <!--#set var="title" value="Examples" --> <!--#set var="active-tab" value="Examples" --> <!--#include virtual="/templates.hoc/header.shtml" --> <h1>Cocoa Examples</h1> <h2>Adding a GUI to an Expression Parser</h2> <p>You've probably seen many examples of Haskell GUI libraries which show you how to create a simple graphical application with menus, and a cute little button that prints "Hello, world!" when you click on it:</p> TODO: Insert picture <p>Well, we'd show you that, but the truth is it's so easy to do with Cocoa that it'd just be boring. (Really!) So, let's do something a bit more practical with our first example: put a simple GUI around a basic Haskell program, which is something you're more likely to be interested in.</p> <p>Let's assume that you've written a useful Haskell module: say a simple calculator (or <em>expression parser</em>). To do this, we could use Daan Leijen's most excellent <a href="http://www.cs.uu.nl/~daan/parsec.html">Parsec</a> parser combinator library. In fact, Parsec comes with such excellent documentation that it even gives <a href="http://www.cs.uu.nl/~daan/download/parsec/parsec.html#Expressions">example code</a> which shows how to do this. So, imagine the following code is in an <code>ExpressionParser.hs</code> Haskell module:</a> <div class="inner-box"> <pre>module ExpressionParser where import Text.ParserCombinators.Parsec import Text.ParserCombinators.Parsec.Expr expr :: Parser Integer expr = buildExpressionParser table factor <?> "expression" table = [ [op "*" (*) AssocLeft, op "/" div AssocLeft] , [op "+" (+) AssocLeft, op "-" (-) AssocLeft] ] where op s f assoc = Infix (do { string s; return f }) assoc factor = do { char '('; x <- expr; char ')'; return x } <|> number <?> "simple expression" number :: Parser Integer number = do { ds <- many1 digit; return (read ds) } <?> "number" </pre> </div> <p>There's probably around 10 lines of code there, but if you run the code in GHCi, it seems to work quite well:</p> <div class="inner-box"> <pre>*ExpressionParser> parseTest expr "2+5*2" 12 *ExpressionParser> parseTest expr "69/3+1" 24 </pre> </div> <p>So, you have a working expression parser. Unfortunately, you have to to run this from GHCI. Wouldn't it be nicer if you could run it from a Haskell GUI instead?</p> <!--#include virtual="/templates.hoc/footer.shtml" --> |