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