1 // ROFF for Multics 2 // 3 // Last modified on 06/23/74 at 19:31:29 by R F Mabee. 4 // 5 // This file contains the routines peculiar to the processing of footnotes: 6 // 7 // Foot_begin Start processing a footnote. 8 // Foot_end Finish processing a footnote. 9 // PrintFootnotes Print out the saved footnotes at the bottom of a page. 10 // All are declared external. 11 12 // Copyright (c) 1974 by Massachusetts Institute of Technology and Honeywell Information Systems, Inc. 13 14 // General permission is granted to copy and use this program, but not to sell it, provided that the above 15 // copyright statement is given. Contact Information Processing Services, MIT, for further information. 16 // Please contact R F Mabee at MIT for information on this program and versions for other machines. 17 18 get "runoff_head" 19 20 // Foot_begin starts processing footnotes. 21 22 let Foot_begin () be 23 { NeedSS (NoFtNo -> 3, 4) // Make sure room enough for some part of footnote. 24 unless NoFtNo do // Insert numbers into text and footnote unless requested not to. 25 $( let B = false 26 Nc := Nc - 1 // Remove trailing blanks from previous line. 27 if Char!Nc = '*s' do 28 $( B := true // B indicates that line ended with . so extra space goes after number. 29 Nc := Nc - 1 30 $) 31 32 let v = vec Maxline // Expand user-settable footnote number reference. 33 Unpackstring (TextRef, v) 34 Nr := Use_ref (v, Rawchar, v!0) 35 if B do 36 $( Nr := Nr + 1 37 Rawchar!Nr := '*s' 38 $) 39 for i = 1 to Nr do Char!(Nc + i) := Rawchar!i 40 Nc := Nc + Nr 41 42 Unpackstring (FootRef, v) 43 Nr := Use_ref (v, Rawchar, v!0) 44 Again := Nr > 0 45 $) 46 47 Fd, Findent, Fundent := Ms, In, Un // Remember parameters re-used by footnotes. 48 Ms, In, Un := 1, 0, 0 49 PadLeft := false 50 Ft := true // Say we are now processing a footnote 51 if Fl = 0 do Fl := 1 // Count footnote demarcation line. 52 Newline (1) // Blank line to begin footnote. 53 for i = 1 to Nc do Temp[i] := Char[i] // Save unprinted stuff in Char 54 Tempc := Nc 55 Nc := 0 56 } 57 58 59 // Foot_end finishes processing footnotes 60 61 and Foot_end () be 62 { Break() // Finishes last line of footnote 63 Ft := false // No longer processing footnote 64 Ms, In, Un := Fd, Findent, Fundent // Restore text parameters. 65 for i = 1 to Tempc do Char[i] := Temp[i] //Restore Char 66 Nc := Tempc 67 Flp := not NoFtNo // Print the next text line regardless of room. 68 // It contains the reference to a footnote to be 69 // printed on this page. 70 NoFtNo := false 71 Foot := Foot + 1 72 } 73 74 // PrintFootnotes puts out as much footnote text as will fit. 75 76 and PrintFootnotes () be 77 { if Nl = 0 do Spacing () 78 let Lleft = LinesLeft + Fl // Number of lines available for footnotes on this page. 79 let Ftp = MinI (Fl, Lleft) // Number to print this page. 80 if Ftp = Fl - 1 > 3 do Ftp := Fl - 2 // Never leave just one line unprinted. 81 if Ftp le 1 return 82 Newline (NoPaging -> 1, Lleft - Ftp) 83 84 test Fth = 0 85 then $( PrinterIndent () 86 for i = 1 to Ll do WriteChar ('_') // Default separator. 87 Newline (1) 88 $) 89 or Title (Fth) 90 91 for i = 2 to Ftp unless FootListBase = 0 do 92 $( for j = 1 to FootListBase!1 do WriteChar (FootListBase!(j + 1)) 93 Newline (1) 94 let t = FootListBase 95 FootListBase := FootListBase!0 96 Freevec (t) 97 Fl := Fl - 1 98 $) 99 if Fl le 1 | FootListBase = 0 | FootList = 0 do Fl, FootListBase, FootList := 0, 0, 0 100 }