! sqrsh (sqr shell) ! Copyright (C) 1997 Ray Ontko & Company ! ! This program is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 2 of the License, or ! (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! !++ ! ! autodoc ! ! autodoc myprog.sqr myprog.hlp ! ! autodoc reads through an SQR program (or include file) and writes ! comments appearing between between !++ and !-- to a text help file. ! !-- ! ! Modification History ! ! Name Date Comments ! ---------------- ---------- ---------------------------------------- ! Ray Ontko 1996.10.16 Created ! Ray Ontko 1996.10.27 Added delete if file is empty ! !---------------------------------------------------------------- autodoc begin-procedure autodoc local move 'autodoc.tmp' to $tname move 'autodoc.bak' to $bname if isnull( $_p1 ) input $iname '.sqr file' else move $_p1 to $iname end-if if isnull( $_p1 ) input $oname '.hlp file' else move $_p2 to $oname end-if do autodoc_file( $iname , $tname ) do fixup_files( $tname , $oname , $bname ) end-procedure ! autodoc !----------------------------------------------------------- autodoc_file begin-procedure autodoc_file( $sqr_fn , $hlp_fn ) open $sqr_fn as 1 for-reading record={SQRSH_LINE_MAX}:vary status=#status if #status = 0 open $hlp_fn as 2 for-writing record={SQRSH_LINE_MAX}:vary status=#status move 0 to #count if #status = 0 read 1 into $line:{SQRSH_LINE_MAX} move 0 to #copying while not #_end-file let $line = ltrim( $line , ' ' ) if #copying if substr($line,1,3) = '!!--' move 0 to #copying else if substr($line,1,1) = '!!' let $line = substr($line,2,length($line)-1) write 2 from $line add 1 to #count end-if end-if else if substr($line,1,3) = '!!++' move 1 to #copying end-if end-if read 1 into $line:{SQRSH_LINE_MAX} end-while close 2 if #count = 0 let #dummy = delete( $hlp_fn ) end-if end-if close 1 end-if end-procedure ! autodoc_file