ADDED user/crc/rancid/Makefile
Index: user/crc/rancid/Makefile
===================================================================
--- user/crc/rancid/Makefile
+++ user/crc/rancid/Makefile
@@ -0,0 +1,18 @@
+# Set this to the retro root directory
+#
+# You should have at least a 'retro' binary, the 'retroImage', and
+# 'library' directory there
+#
+# Note that while you can run Rancid under the Python VM, we need
+# the C VM for building (at present)
+
+RX = ~/code/rx
+
+default:
+ @cp $(RX)/retroImage .
+ @ln -s $(RX)/library .
+ $(RX)/retro --with rancid.rx --with casket.rx --shrink
+ @rm library
+
+clean:
+ @rm -f retroImage
ADDED user/crc/rancid/casket.rx
Index: user/crc/rancid/casket.rx
===================================================================
--- user/crc/rancid/casket.rx
+++ user/crc/rancid/casket.rx
@@ -0,0 +1,94 @@
+( casket ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ )
+chain: casket'
+{{
+ variable :options
+---reveal---
+ : KiB ( n-n ) 1024 * ;
+ : casket:path ( -$ ) @memory 8 KiB - ;
+ : casket:options ( -$ ) @:options ;
+ : casket:buffer ( -$ ) @memory 16 KiB - ;
+ : casket:root ( -$ ) "./" ;
+ : casket:url ( -$ ) "http://domain.com/path/to/cgi" ;
+ : getRequest ( -$ )
+ casket:path dup "PATH_INFO" getEnv
+ dup 1+ '/ ^strings'findChar 1+ !:options ;
+}}
+ ( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ )
+ : Content-type: ( "- )
+ "Content-type: " getToken ^strings'append "\n\n" ^strings'append
+ keepString .data ` puts ; immediate
+ ( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ )
+ {{
+ : withBase ( n$q-$ ) [ swap ] dip base &do preserve ;
+ : char ( $-$ )
+ @+ [ 'n = ] [ drop cr ] when
+ [ '' = ] [ drop '" putc ] when
+ [ '[ = ] [ 27 putc putc ] when
+ putc ;
+ : obj ( $-$ )
+ @+ [ 'd = ] [ drop [ decimal putn ] withBase ] when
+ [ 'o = ] [ drop [ octal putn ] withBase ] when
+ [ 'x = ] [ drop [ hex putn ] withBase ] when
+ [ 'c = ] [ drop swap putc ] when
+ [ 's = ] [ drop &puts dip ] when
+ [ 'q = ] [ drop &do dip ] when
+ [ 'u = ] [ drop casket:url puts ] when
+ putc ;
+ : complex ( $-n )
+ repeat
+ @+ 0;
+ dup '\ = [ drop char 0 ] ifTrue
+ dup '% = [ drop obj 0 ] ifTrue
+ putc
+ again ;
+ ---reveal---
+ : tputs complex drop ;
+ }}
+ ( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ )
+ {{
+ create buffer ( -a )
+ 16 1024 * allot
+ : casket:templates ( -$ ) casket:root "templates/" ^strings'append ;
+ ---reveal---
+ : withTemplate ( $- )
+ buffer 0 16 1024 * fill
+ casket:templates ^strings'prepend buffer swap ^files'slurp drop
+ buffer tputs ;
+ }}
+
+: /404
+ Content-type: text/html
+ "
404
" tputs cr bye ;
+: /
+ Content-type: text/html
+ "casket
" tputs cr bye ;
+
+: doBeforeDispatch ;
+
+: dispatch
+ doBeforeDispatch
+ getRequest 1+
+ [ @+ [ 0 <> ] [ '/ <> ] bi and ] while 1- 0 swap !
+ casket:path find [ @d->xt do ] [ drop /404 ] if bye ;
+
+{{
+ create bit 5 allot
+ : extract ( $c-$a ) drop @+ bit ! @+ bit 1+ ! bit ;
+ : render ( $c-$n )
+ dup '+ = [ drop 32 ] ifTrue
+ dup 13 = [ drop 32 ] ifTrue
+ dup 10 = [ drop 32 ] ifTrue
+ dup '% = [ extract hex toNumber decimal ] ifTrue ;
+ : ( $-$ ) repeat @+ 0; render ^buffer'add again ;
+---reveal---
+ : decode ( $- ) casket:buffer ^buffer'set drop ;
+}}
+
+: serve: ( """- )
+ getToken dup
+ "/" ^strings'prepend header
+ compiler on
+ keepString .data getToken drop
+ ` Content-type: ` puts ` ; &.word reclass ;
+
+;chain
ADDED user/crc/rancid/rancid.rx
Index: user/crc/rancid/rancid.rx
===================================================================
--- user/crc/rancid/rancid.rx
+++ user/crc/rancid/rancid.rx
@@ -0,0 +1,80 @@
+( rancid, an irc log browser ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ )
+with casket'
+
+( support code ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ )
+: LOGS ( -$ ) casket:root "logs/" ^strings'append ;
+
+: commonHeader ( - )
+ Content-type: text/html
+ "header.html" withTemplate ;
+
+: commonFooter ( - )
+ "footer.html" withTemplate ;
+
+: navbar
+ casket:options tempString
+ dup ', swap 2 + !
+ dup ', swap 5 + !
+ "20" ^strings'prepend "script.erx" withTemplate ;
+
+( paths ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ )
+{{
+ 2 elements content lines
+
+ : clean ( $- )
+ withLength
+ [ dup @ 10 13 within [ 999 swap &! sip ] ifTrue 1+ ] times drop ;
+
+ : getLine ( $-$ )
+ 999 ^strings'splitAtChar drop lines ++ ;
+
+ : loadSourceData ( $- )
+ here swap ^files'slurp here !content heap +! 32 , 0 ,
+ @content clean ;
+
+ : countLines ( $- )
+ [ getLine dup 1 <> ] while drop ;
+
+ : prepare ( $- )
+ 0 !lines heap [ loadSourceData @content countLines ] preserve lines -- ;
+
+ : display ( $- )
+ "" puts
+ 32 ^strings'splitAtChar "| %s | " puts
+ 32 ^strings'splitAtChar 1+ ^strings'chop ^strings'chop "%s | %s | " puts
+ "
\n" puts ;
+
+ : dumpLines ( - )
+ @lines [ @content ^files'readLine display ] times ;
+---reveal---
+ : /log ( - )
+ commonHeader
+ navbar
+ LOGS casket:options ^strings'append
+ heap [
+ dup keepString [ prepare ] dip
+ ^files':R ^files'open !content
+ "\n" puts
+ dumpLines
+ "\n
\n" puts
+ @content ^files'close drop
+ ] preserve
+ commonFooter ;
+}}
+
+: /css
+ Content-type: text/css
+ "rancid.css" withTemplate ;
+
+: /index
+ commonHeader
+ "default.erx" withTemplate
+ commonFooter ;
+
+( Casket Configuration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ )
+[ /index ] is /
+[ ( -$ ) "/path/to/rancid/" ] is casket:root
+[ ( -$ ) "http://url/to/rancid" ] is casket:url
+&dispatch is boot
+
+.s save bye
ADDED user/crc/rancid/templates/default.erx
Index: user/crc/rancid/templates/default.erx
===================================================================
--- user/crc/rancid/templates/default.erx
+++ user/crc/rancid/templates/default.erx
@@ -0,0 +1,90 @@
+The Retro project has logs of conversation in the #retro irc channel on irc.freenode.net going
+ back to 2006. This is a small web app to allow viewing them in a nicer fashion.
+
+To get started, select a date from the calendar below. These logs are updated hourly. For direct
+ linking, use this URL, replacing the yy.mm.dd with the date you wish to link to:
+
%u/log/yy.mm.dd
+
+
ADDED user/crc/rancid/templates/footer.html
Index: user/crc/rancid/templates/footer.html
===================================================================
--- user/crc/rancid/templates/footer.html
+++ user/crc/rancid/templates/footer.html
@@ -0,0 +1,4 @@
+
+Rancid is © 2011 by Charles Childers
+