Chris@42: ## POST output Chris@42: # Copyright (C) 1993-1995 Ian Jackson. Chris@42: Chris@42: # This file is free software; you can redistribute it and/or modify Chris@42: # it under the terms of the GNU General Public License as published by Chris@42: # the Free Software Foundation; either version 2, or (at your option) Chris@42: # any later version. Chris@42: Chris@42: # It is distributed in the hope that it will be useful, Chris@42: # but WITHOUT ANY WARRANTY; without even the implied warranty of Chris@42: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Chris@42: # GNU General Public License for more details. Chris@42: Chris@42: # You should have received a copy of the GNU General Public License Chris@42: # along with GNU Emacs; see the file COPYING. If not, write to Chris@42: # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Chris@42: # Boston, MA 02111-1307, USA. Chris@42: Chris@42: # (Note: I do not consider works produced using these BFNN processing Chris@42: # tools to be derivative works of the tools, so they are NOT covered Chris@42: # by the GPL. However, I would appreciate it if you credited me if Chris@42: # appropriate in any documents you format using BFNN.) Chris@42: Chris@42: sub post_init { Chris@42: open(POST,">$prefix.post"); Chris@42: } Chris@42: Chris@42: sub post_startmajorheading { Chris@42: print POST '='x79,"\n\n"; Chris@42: $post_status= 'h'; Chris@42: &post_text($_[0] ? "Section $_[0]. " : ''); Chris@42: } Chris@42: Chris@42: sub post_startminorheading { Chris@42: print POST '-'x77,"\n\n"; Chris@42: $post_status= 'h'; Chris@42: } Chris@42: Chris@42: sub post_italic { &post_text('*'); } Chris@42: sub post_enditalic { $post_para .= '*'; } Chris@42: Chris@42: sub post_email { &post_text('<'); } sub post_endemail { &post_text('>'); } Chris@42: Chris@42: sub post_ftpon { } sub post_endftpon { } Chris@42: sub post_ftpin { } sub post_endftpin { } Chris@42: sub post_docref { } sub post_enddocref { } Chris@42: sub post_courier { } sub post_endcourier { } Chris@42: sub post_newsgroup { } sub post_endnewsgroup { } Chris@42: sub post_ftpsilent { $post_ignore++; } Chris@42: sub post_endftpsilent { $post_ignore--; } Chris@42: Chris@42: sub post_text { Chris@42: return if $post_ignore; Chris@42: if ($post_status eq '') { Chris@42: $post_status= 'p'; Chris@42: } Chris@42: $post_para .= $_[0]; Chris@42: } Chris@42: Chris@42: sub post_tab { Chris@42: local ($n) = $_[0]-length($post_para); Chris@42: $post_para .= ' 'x$n if $n>0; Chris@42: } Chris@42: Chris@42: sub post_newline { Chris@42: return unless $post_status eq 'p'; Chris@42: &post_writepara; Chris@42: } Chris@42: Chris@42: sub post_writepara { Chris@42: local ($thisline, $thisword, $rest); Chris@42: for (;;) { Chris@42: last unless $post_para =~ m/\S/; Chris@42: $thisline= $post_indentstring; Chris@42: for (;;) { Chris@42: last unless $post_para =~ m/^(\s*\S+)/; Chris@42: unless (length($1) + length($thisline) < 75 || Chris@42: length($thisline) == length($post_indentstring)) { Chris@42: last; Chris@42: } Chris@42: $thisline .= $1; Chris@42: $post_para= $'; Chris@42: } Chris@42: $post_para =~ s/^\s*//; Chris@42: print POST $thisline,"\n"; Chris@42: $post_indentstring= $post_nextindent; Chris@42: last unless length($post_para); Chris@42: } Chris@42: $post_status= ''; $post_para= ''; Chris@42: } Chris@42: Chris@42: sub post_endpara { Chris@42: return unless $post_status eq 'p'; Chris@42: &post_writepara; Chris@42: print POST "\n"; Chris@42: } Chris@42: Chris@42: sub post_endheading { Chris@42: $post_para =~ s/\s*$//; Chris@42: print POST "$post_para\n\n"; Chris@42: $post_status= ''; Chris@42: $post_para= ''; Chris@42: } Chris@42: Chris@42: sub post_endmajorheading { &post_endheading(@_); } Chris@42: sub post_endminorheading { &post_endheading(@_); } Chris@42: Chris@42: sub post_startverbatim { Chris@42: $post_vstatus= $post_status; Chris@42: &post_writepara; Chris@42: } Chris@42: Chris@42: sub post_verbatim { Chris@42: print POST $_[0],"\n"; Chris@42: } Chris@42: Chris@42: sub post_endverbatim { Chris@42: $post_status= $post_vstatus; Chris@42: } Chris@42: Chris@42: sub post_finish { Chris@42: close(POST); Chris@42: } Chris@42: Chris@42: sub post_startindex { $post_status= ''; } Chris@42: sub post_endindex { $post_status= 'p'; } Chris@42: Chris@42: sub post_endindexitem { Chris@42: printf POST " %-11s %-.66s\n",$post_left,$post_para; Chris@42: $post_status= 'p'; Chris@42: $post_para= ''; Chris@42: } Chris@42: Chris@42: sub post_startindexitem { Chris@42: $post_left= $_[1]; Chris@42: } Chris@42: Chris@42: sub post_startindexmainitem { Chris@42: $post_left= $_[1]; Chris@42: print POST "\n" if $post_status eq 'p'; Chris@42: } Chris@42: Chris@42: sub post_startindent { Chris@42: $post_istatus= $post_status; Chris@42: &post_writepara; Chris@42: $post_indentstring= " $post_indentstring"; Chris@42: $post_nextindent= " $post_nextindent"; Chris@42: } Chris@42: Chris@42: sub post_endindent { Chris@42: $post_indentstring =~ s/^ //; Chris@42: $post_nextindent =~ s/^ //; Chris@42: $post_status= $post_istatus; Chris@42: } Chris@42: Chris@42: sub post_startpackedlist { $post_plc=0; } Chris@42: sub post_endpackedlist { &post_newline if !$post_plc; } Chris@42: sub post_packeditem { Chris@42: &post_newline if !$post_plc; Chris@42: &post_tab($post_plc*40+5); Chris@42: $post_plc= !$post_plc; Chris@42: } Chris@42: Chris@42: sub post_startlist { Chris@42: &post_endpara; Chris@42: $post_indentstring= " $post_indentstring"; Chris@42: $post_nextindent= " $post_nextindent"; Chris@42: } Chris@42: Chris@42: sub post_endlist { Chris@42: &post_endpara; Chris@42: $post_indentstring =~ s/^ //; Chris@42: $post_nextindent =~ s/^ //; Chris@42: } Chris@42: Chris@42: sub post_item { Chris@42: &post_newline; Chris@42: $post_indentstring =~ s/ $/* /; Chris@42: } Chris@42: Chris@42: sub post_pageref { Chris@42: &post_text("Q$_[1] \`"); Chris@42: } Chris@42: Chris@42: sub post_endpageref { Chris@42: &post_text("'"); Chris@42: } Chris@42: Chris@42: 1;