diff --git a/tools/capone/lib/common.ss b/tools/capone/lib/common.ss index 76a91d9..edde865 100644 --- a/tools/capone/lib/common.ss +++ b/tools/capone/lib/common.ss @@ -18,6 +18,10 @@ (define-macro (dec! n) `(set! ,n (- ,n 1))) +(define-macro (if-not . body) + `(if (not ,(car body)) + ,@(cdr body))) + ;; ;; Allow defining functions like: ;; (def name (param1 param2) diff --git a/tools/capone/src/capone-doc b/tools/capone/src/capone-doc new file mode 100755 index 0000000..453c337 --- /dev/null +++ b/tools/capone/src/capone-doc @@ -0,0 +1,119 @@ +#!/usr/bin/env perl +# A tool to generate some html-ized documentation +# based on capone source... see it as doxygen for capone. + +sub write_prolog { + print < + + + +$_[0] + + + +EOL +} + +sub write_epilog { + print <generated with capone-doc + + +EOL +} + +sub main { + if(@ARGV eq 0) { + print "Usage: capone-doc [FILE]\n"; + print "Generate html-ized documentation by extracting documentation\n"; + print "specific tags on the specific manner from capone source file\n"; + return; + } + + $in_block = 0; + $filename = $ARGV[0]; + + open(INFILE, $filename) or die "Can't open $filename: $!"; + + &write_prolog($filename); + + while() { + # find markers + if(/^;;=/) { + if($in_block eq 0) { + print "
\n"; + $in_block = 1; + } else { + print "
\n"; + print "
\n"; + print "
-- ∂ --
\n"; + $in_block = 0; + } + + # strip them + s/;;=(.*)$//; + } + + if($in_block eq 1) { + # strip comments + s/;;\s*\n$/
\n/; + #s/;;\s*//; + s/;;//; + + # \code and \endcode + s/\\code/
Example:<\/h5>\n
/;
+			s/\\endcode/ <\/pre>/;
+
+			# \func
+			s/\\func (.*)/ 
$1<\/h5>/; + + # \param + s/\\param (.*)/ parameter:<\/b> $1
/; + + # \return + s/\\return (.*)/ returns:<\/b> $1
/; + + # \br + s/\\br/
/g; + + # \center + s/\\center (.*)$/
$1<\/center>/; + + # grok everything out + print $_; + } + } + + &write_epilog; +} + +&main;