home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1992 September / Simtel20_Sept92.cdr / msdos / printer / isigns50.arc / SIGNS.PAS < prev    next >
Pascal/Delphi Source File  |  1989-10-02  |  30KB  |  623 lines

  1. {$N-}    {80287 not present}
  2. {$R+}    {Range checking on}
  3. {$S+}    {Stack checking on}
  4. {$I+}    {I/O checking on}
  5.  
  6. PROGRAM Signs;
  7. {******************************************************************************
  8. **
  9. **  Robert W. Bloom
  10. **
  11. **  Function:  This program reads input from the terminal and creates signs
  12. **          (horizontal) or banners (vertical) in a number of formats.  Output
  13. **          character fonts are read from a HP LaserJet-compatible 'soft' font file.
  14. **
  15. **  Notes:  Font files must be indexed with FontIndx.Pas before use.
  16. **          See Signs.DOC for more information
  17. **
  18. ******************************************************************************}
  19.  
  20. Uses
  21.   Crt, {Unit found in TURBO.TPL}
  22.   Printer2; {special unit}
  23.  
  24. {$i const}
  25. VAR
  26.          font_file : FILE OF CHAR;     {the soft font file}
  27.      font_ndx_file : FILE OF CHAR_INDEX_RECORD;  {index to above}
  28.          ndx_array : ARRAY [0..255] OF CHAR_INDEX_RECORD;
  29.   in_file,out_file : TEXT;             {files for input and output}
  30.        avail_width : INTEGER;          {width of output device}
  31.           out_line : OUT_LINE_REC;     {to build output lines}
  32.      gout_1,gout_2 : OUT_GRAPHIC_REC;  {output graphics lines}
  33.           gout_len : INTEGER;          {to build output graphic lines}
  34.           ptr_maps : POINTER;          {pointer to character maps}
  35.           map_size : INTEGER;          {size of the maps}
  36.       space_needed : INTEGER;          {approx width of output?}
  37.        page_offset : INTEGER;          {actual indent}
  38.            bit_cnt : INTEGER;          {counter for graphics output}
  39.  
  40. {************************* Procedures called *********************************}
  41.  
  42. PROCEDURE main;                                                   FORWARD;
  43.     PROCEDURE out_sign         (VAR inp_line : S255);             FORWARD;
  44.     PROCEDURE out_banner       (VAR inp_line : S255);             FORWARD;
  45.  
  46. PROCEDURE parm_menu;                                              FORWARD;
  47.     {PROCEDURE disp_?}
  48. PROCEDURE ask_parm;                                               FORWARD;
  49.     {PROCEDURE ask_?}
  50. PROCEDURE input_menu;                                             FORWARD;
  51.  
  52. {utilities:}
  53.     PROCEDURE gotorc(R,C : INTEGER);                              FORWARD;
  54.     PROCEDURE sak;                                                FORWARD;
  55.     PROCEDURE alt_inp(VAR alt_str : S14);                         FORWARD;
  56.     PROCEDURE putchr (chrs : S14);                                FORWARD;
  57.     PROCEDURE disp_fs;                                            FORWARD;
  58.     PROCEDURE init_ff (VAR ff,ffi : S14;VAR ok : BOOLEAN);        FORWARD;
  59.     PROCEDURE set_up_maps (VAR inp_line : S255);                  FORWARD;
  60.     PROCEDURE reset_maps (VAR ptr : POINTER);                     FORWARD;
  61.  
  62. {printer stuff:}
  63.     PROCEDURE avail_space;                                        FORWARD;
  64.     PROCEDURE set_up_prt  (reset_prt : BOOLEAN);                  FORWARD;
  65.     PROCEDURE out_char          (ochar,ichar,action : CHAR);      FORWARD;
  66.        PROCEDURE out_nline;                                       FORWARD;
  67.        PROCEDURE add_gline;                                       FORWARD;
  68.            PROCEDURE out_gl_ids;                                  FORWARD;
  69.            PROCEDURE out_gl_hp;                                   FORWARD;
  70.            PROCEDURE out_gl_ep;                                   FORWARD;
  71.  
  72.  
  73. {**************************** Program Start **********************************}
  74.  
  75. PROCEDURE main;
  76. LABEL finis,restrt;
  77. VAR ans2,ans : CHAR;        {entered char}
  78.   text_input : S255;        {to build line into}
  79.   alt_inp_strng : S14;         {return from alt-char builder}
  80.         done : BOOLEAN;     {flag}
  81.            i : INTEGER;     {loop control}
  82.   output_err : BOOLEAN;     {if can't output correctly}
  83. BEGIN
  84.     done := FALSE;
  85.     text_input := '';
  86.     space_needed := 0;
  87.     parm_menu;
  88.     ask_parm;
  89.     input_menu;
  90.     WHILE NOT done DO BEGIN
  91. restrt:
  92.         ans := READKEY;
  93.         CLREOL;
  94.         CASE ans OF
  95.             ^P : BEGIN            {change parameters}
  96.                      ask_parm;
  97.                      GOTORC(17,41); CLREOL;
  98.                      input_menu;
  99.                      IF sign_type = sign THEN BEGIN    {recalc cause font may}
  100.                          space_needed := given_offset; {have been changed}
  101.                          FOR i := 1 TO LENGTH(text_input) DO
  102.                              space_needed := space_needed +
  103.                                  (ndx_array[ORD(text_input[i])].delta_x * mult_w)
  104.                      END ELSE
  105.                          space_needed := (font_height * mult_h) + given_offset;
  106.                      {end}
  107.                      GOTORC(17,25); CLREOL; highvideo; WRITE(space_needed);
  108.                      GOTORC(19,25); CLREOL; highvideo; WRITE(text_input)
  109.                  END;
  110.          ^D,^C : done := TRUE;    {done program}
  111.             ^A : BEGIN
  112.                      alt_inp(alt_inp_strng);
  113.                      text_input := text_input + alt_inp_strng;
  114.                      GOTORC(19,25); CLREOL; highvideo; WRITE(text_input)
  115.                  END;
  116.          ^L,^F : BEGIN            {formfeed to printer}
  117.                      GOTORC(24,1);
  118.                      IF output_device = printr THEN BEGIN
  119.                          WRITE(lst,^L);
  120.                          WRITE('Formfeed sent to printer.')
  121.                      END ELSE
  122.                          WRITE('Output is not directed to printer!'^G);
  123.                      {end}
  124.                      sak;
  125.                      GOTORC(24,1); CLREOL;
  126.                      GOTORC(19,25); CLREOL; highvideo; WRITE(text_input)
  127.                  END;
  128.          ^R,^T : BEGIN            {move back to TOF (reverse formfeed)}
  129.                      GOTORC(24,1);
  130.                      IF output_device = printr THEN BEGIN
  131.                          WRITE('Moving print-head back to TOF.');
  132.                          CASE prt_type OF
  133.                              ids : WRITE(lst,CHR(27),'G0$',CHR(27),'H0$');
  134.                            epson : {not available?} ;
  135.                               hp : WRITE(lst,CHR(27),'&a0c0R')
  136.                          END {case}
  137.                      END ELSE
  138.                          WRITE('Output is not directed to printer!'^G);
  139.                      {end}
  140.                      sak;
  141.                      GOTORC(24,1); CLREOL;
  142.                      GOTORC(19,25); CLREOL; highvideo; WRITE(text_input)
  143.                  END;
  144.        ^H,#127 : BEGIN            {backspace once}
  145.                      IF LENGTH(text_input) > 0 THEN BEGIN
  146.                          ans2 := text_input[LENGTH(text_input)];
  147.                          DELETE(text_input,LENGTH(text_input),1);
  148.                          IF sign_type = sign THEN space_needed :=
  149.                              space_needed - (ndx_array[ORD(ans2)].delta_x * mult_w);
  150.                          GOTORC(17,25); CLREOL; highvideo; WRITE(space_needed);
  151.                          GOTORC(19,25); CLREOL; highvideo; WRITE(text_input)
  152.                      END
  153.                  END;
  154.             ^X : BEGIN            {cancel line, start over}
  155.                      text_input := '';
  156.                      IF sign_type = sign THEN
  157.                          space_needed := given_offset
  158.                      ELSE
  159.                          space_needed := (font_height * mult_h) + given_offset;
  160.                      {end}
  161.                      GOTORC(17,25); CLREOL; highvideo; WRITE(space_needed);
  162.                      GOTORC(19,25); CLREOL; highvideo
  163.                  END;
  164.             ^M : BEGIN            {go ahead, process input line}
  165.                      output_err := FALSE;
  166.                      IF (LENGTH(text_input) = 0) AND
  167.                          (input_device <> text_file) THEN BEGIN
  168.                          GOTORC(24,1); CLREOL;
  169.                          WRITE('Do you want to quit? (Y/N) -> '^G);
  170.                          ans2 := READKEY;
  171.                          GOTORC(24,1); CLREOL;
  172.                          IF ans2 IN ['y','Y'] THEN
  173.                              GOTO finis
  174.                          ELSE BEGIN
  175.                              GOTORC(19,25); CLREOL;
  176.                              highvideo; WRITE(text_input);
  177.                              GOTO restrt
  178.                          END
  179.                      END;
  180.                      GOTORC(1,65); WRITE('Processing');
  181.                      IF output_device = printr THEN set_up_prt(FALSE);
  182.  
  183.                      IF input_device = text_file THEN BEGIN
  184.                          FOR i := 1 TO num_copies DO BEGIN
  185.                              WHILE NOT EOF(in_file) DO BEGIN
  186.                                  READLN(in_file,text_input);
  187.                                  IF output_device <> screen THEN BEGIN
  188.                                      GOTORC(19,4); CLREOL; lowvideo;
  189.                                      WRITE('Reading from file -> ');
  190.                                      highvideo; WRITE(text_input)
  191.                                  END;
  192.                                  IF sign_type = sign THEN BEGIN
  193.                                      space_needed := given_offset;
  194.                                      FOR i := 1 TO LENGTH(text_input) DO
  195.                                          space_needed := space_needed +
  196.                                          (ndx_array[ORD(text_input[i])].delta_x * mult_w);
  197.                                      {end}
  198.                                      out_sign(text_input)
  199.                                  END ELSE
  200.                                      out_banner(text_input);
  201.                                  {end if sign}
  202.                              END; {while not eof}
  203.                              IF output_device = printr THEN WRITE(lst,^L);
  204.                              RESET(in_file)
  205.                          END {for each copy wanted}
  206.                      END ELSE
  207.                          IF sign_type = sign THEN
  208.                              out_sign(text_input)
  209.                          ELSE
  210.                              out_banner(text_input);
  211.                          {end if sign}
  212.                      {end if input from file}
  213.                      IF (output_device=screen) THEN BEGIN
  214.                          sak;
  215.                          parm_menu
  216.                      END;
  217.                      text_input := '';
  218.                      IF sign_type = sign THEN
  219.                          space_needed := given_offset
  220.                      ELSE
  221.                          space_needed := (font_height * mult_h) + given_offset;
  222.                      {end}
  223.                      GOTORC(17,25); CLREOL; highvideo; WRITE(space_needed);
  224.                      input_menu
  225.                  END {process line}
  226.             ELSE BEGIN              {otherwise put entry into input line}
  227.                  text_input := text_input + ans;
  228.                  IF sign_type = sign THEN space_needed :=
  229.                      space_needed + (ndx_array[ORD(ans)].delta_x * mult_w);
  230.                  GOTORC(17,25); CLREOL; highvideo; WRITE(space_needed);
  231.                  GOTORC(19,25); WRITE(text_input)
  232.             END
  233.         END {case}
  234.     END; {while not done}
  235. finis:   {all done, close appropriate files}
  236.     IF output_device = printr THEN set_up_prt(TRUE);
  237.     IF output_device = recd_file THEN CLOSE(out_file);
  238.     IF input_device = text_file THEN CLOSE(in_file);
  239.     CLOSE(font_file)
  240. END; {PROCEDURE main}
  241.  
  242.  
  243. PROCEDURE out_banner; {(VAR inp_line : S255)}
  244. VAR chr_num,chr_pos,width_lcv,height_lcv,added,end_line_pos,top_os,bott_os,
  245.     mult_w_lcv,mult_h_lcv,out_cnt,out_cnto : INTEGER;
  246.       i,j : INTEGER;  {for small for loops}
  247.      ptr8 : PTR_CHAR_MAP_8;
  248.     ptr12 : PTR_CHAR_MAP_12;
  249.     ptr18 : PTR_CHAR_MAP_18;
  250.     ptr24 : PTR_CHAR_MAP_24;
  251.     ptr30 : PTR_CHAR_MAP_30;
  252.    chr_byte,chr_bit,test_byte,test_bit : BYTE;
  253. BEGIN
  254.     set_up_maps(inp_line);
  255.     bit_cnt := 0;  {reset for graphic bits}
  256.     IF (output_device <> screen) OR (input_device = keyboard) THEN BEGIN
  257.         GOTORC(1,65); WRITE('Outputting  ')
  258.     END;
  259.     GOTORC(25,1);
  260.     IF output_device <> screen THEN BEGIN
  261.         lowvideo; WRITE('Now outputting character -> '); highvideo
  262.     END;
  263.     CASE map_size OF
  264.          8 : ptr8 := ptr_maps;
  265.         12 : ptr12 := ptr_maps;
  266.         18 : ptr18 := ptr_maps;
  267.         24 : ptr24 := ptr_maps;
  268.         30 : ptr30 := ptr_maps
  269.     END; {case}
  270.     out_char(' ',' ','S'); {start w/blank line}
  271.     out_char(' ',' ','E'); {and output it}
  272.     IF inv_video THEN BEGIN  {if inv_video, add one 'blank' line}
  273.         FOR i := 1 TO ((2+font_height) * mult_h) DO
  274.             out_char(' ',block_char,'A');
  275.         out_char(' ',' ','E'); {and output it}
  276.         out_char(' ',' ','C')  {and clear it}
  277.     END;
  278.     out_cnt := 0;
  279.     FOR chr_pos := 1 TO LENGTH(inp_line) DO BEGIN
  280.         chr_num := ORD(inp_line[chr_pos]);
  281.         IF output_device <> screen THEN WRITE(CHR(chr_num));
  282.         out_cnto := out_cnt;            {where char started for delta_x}
  283.         FOR j := 1 TO (ndx_array[chr_num].left_offset * mult_w) DO BEGIN
  284.             IF inv_video THEN    {if inv_video, add a starting block}
  285.                 FOR i := 1 TO mult_h DO out_char(' ',block_char,'A');
  286.             FOR i := 1 TO (font_height * mult_h) DO
  287.                 out_char(' ',CHR(chr_num),'A');
  288.             IF inv_video THEN    {if inv_video, add a ending block}
  289.                 FOR i := 1 TO mult_h DO out_char(' ',block_char,'A');
  290.             out_char(' ',' ','E'); {add (blank) lines for left_offset}
  291.             out_char(' ',' ','C'); {clear output line}
  292.             out_cnt := out_cnt + 1 {keep track of it}
  293.         END;
  294.         FOR width_lcv := 1 TO ndx_array[chr_num].width DO BEGIN
  295.             IF inv_video THEN    {if inv_video, add a starting block}
  296.                 FOR i := 1 TO mult_h DO out_char(' ',block_char,'A');
  297.             bott_os := ((font_height - ndx_array[0].top_offset) -
  298.                 (ndx_array[chr_num].height - ndx_array[chr_num].top_offset)) * mult_h;
  299.             FOR i := 1 TO bott_os DO out_char(' ',CHR(chr_num),'A');
  300.             FOR height_lcv := ndx_array[chr_num].height DOWNTO 1 DO BEGIN
  301.                 chr_byte := TRUNC(0.99+width_lcv/8);
  302.                 CASE map_size OF
  303.                        8 : test_byte := ptr8^.map[height_lcv,chr_byte];
  304.                       12 : test_byte := ptr12^.map[height_lcv,chr_byte];
  305.                       18 : test_byte := ptr18^.map[height_lcv,chr_byte];
  306.                       24 : test_byte := ptr24^.map[height_lcv,chr_byte];
  307.                       30 : test_byte := ptr30^.map[height_lcv,chr_byte]
  308.                 END; {case}
  309.                 chr_bit := width_lcv MOD 8;
  310.                 CASE chr_bit OF
  311.                       1 : test_bit := test_byte AND 128;
  312.                       2 : test_bit := test_byte AND 64;
  313.                       3 : test_bit := test_byte AND 32;
  314.                       4 : test_bit := test_byte AND 16;
  315.                       5 : test_bit := test_byte AND 8;
  316.                       6 : test_bit := test_byte AND 4;
  317.                       7 : test_bit := test_byte AND 2;
  318.                       0 : test_bit := test_byte AND 1
  319.                 END; {case}
  320.                 FOR mult_h_lcv := 1 TO mult_h DO
  321.                     IF (test_bit = 0) THEN
  322.                         out_char(' ',CHR(chr_num),'A')
  323.                     ELSE
  324.                         out_char(CHR(chr_num),' ','A')
  325.                     {end}
  326.                 {for height multiplier}
  327.             END; {for height of char}
  328.             top_os := font_height - ndx_array[chr_num].height - bott_os;
  329.             FOR i := 1 TO top_os * mult_h DO
  330.                 out_char(' ',CHR(chr_num),'A'); {fill out char}
  331.             IF inv_video THEN    {if inv_video, add a ending block}
  332.                 FOR i := 1 TO mult_h DO out_char(' ',block_char,'A');
  333.             FOR mult_w_lcv := 1 TO mult_w DO
  334.                 out_char(' ',' ','E');  {finished building line - output 'em}
  335.             {end for mult_w_lcv}
  336.             out_cnt := out_cnt + mult_w;  {count output lines}
  337.             out_char(' ',' ','C') {clear output line}
  338.         END; {across width of char}
  339.         end_line_pos := out_cnto + (ndx_array[chr_num].delta_x * mult_w);
  340.                                                 {calculate end of char}
  341.         IF (chr_pos < LENGTH(inp_line)) AND
  342.           (ndx_array[ORD(inp_line[chr_pos+1])].left_offset < 0) THEN
  343.             end_line_pos := end_line_pos +
  344.               (ndx_array[ORD(inp_line[chr_pos+1])].left_offset * mult_w);
  345.                         {back up if leff_offset < 0 and not eol of inp_line}
  346.         added := end_line_pos - out_cnt; {how much to add}
  347.         FOR j := 1 TO added DO BEGIN
  348.             FOR i := 1 TO (font_height * mult_h) DO
  349.                 out_char(' ',block_char,'A');
  350.             IF inv_video THEN    {if inv_video, the border chars}
  351.                 FOR i := 1 TO 2*mult_h DO out_char(' ',block_char,'A');
  352.             out_char(' ',' ','E'); {add (blank) lines for delta_x}
  353.             out_char(' ',' ','C'); {clear output line}
  354.             out_cnt := out_cnt + 1
  355.         END;
  356.         CASE map_size OF                   {point to next char map}
  357.              8 : ptr8 := ptr8^.next;
  358.             12 : ptr12 := ptr12^.next;
  359.             18 : ptr18 := ptr18^.next;
  360.             24 : ptr24 := ptr24^.next;
  361.             30 : ptr30 := ptr30^.next
  362.         END {case}
  363.     END; {for each character}
  364.     IF inv_video THEN BEGIN  {if inv_video, add one 'blank' line}
  365.         FOR i := 1 TO ((2+font_height) * mult_h) DO
  366.             out_char(' ',block_char,'A');
  367.         out_char(' ',' ','E'); {and output it}
  368.         out_char(' ',' ','C')  {and clear it}
  369.     END;
  370.     out_char(' ',' ','D'); {end w/blank line}
  371.     reset_maps(ptr_maps) {dispose of maps}
  372. END; {PROCEDURE out_banner}
  373.  
  374.  
  375. PROCEDURE out_sign; {(VAR inp_line : S255)}
  376. VAR chr_num,chr_pos,width_lcv,height_lcv,added,end_char_pos,
  377.     mult_w_lcv,mult_h_lcv,out_cnto : INTEGER;
  378.     act_dot_pos : INTEGER; {position within char map}
  379.       i,j : INTEGER;  {for small for loops}
  380.   left_os : INTEGER; {dist from left edge of max cell size to edge of char}
  381.      ptr8 : PTR_CHAR_MAP_8;
  382.     ptr12 : PTR_CHAR_MAP_12;
  383.     ptr18 : PTR_CHAR_MAP_18;
  384.     ptr24 : PTR_CHAR_MAP_24;
  385.     ptr30 : PTR_CHAR_MAP_30;
  386.    chr_byte,chr_bit,test_byte,test_bit : BYTE;
  387. BEGIN
  388.     set_up_maps(inp_line);
  389.     bit_cnt := 0;  {reset for graphic bits}
  390.     IF (output_device <> screen) OR (input_device = keyboard) THEN BEGIN
  391.         GOTORC(1,65); WRITE('Outputting  ')
  392.     END;
  393.     GOTORC(25,1);
  394.     out_char(' ',' ','S'); {start w/blank line}
  395.     out_char(' ',' ','E'); {and output it}
  396.     IF inv_video THEN BEGIN  {if inv_video, start with a solid line}
  397.         FOR i := 1 TO space_needed + mult_w - given_offset DO       {space_needed is only an}
  398.             out_char(' ',block_char,'A');   {approx line length!}
  399.         out_char(' ',' ','E'); {and output it}
  400.         out_char(' ',' ','C')  {and clear it}
  401.     END;
  402.     FOR height_lcv := 1 TO font_height DO BEGIN
  403.         IF output_device <> screen THEN WRITE('Outputting line ',height_lcv:3,chr(13));
  404.         IF inv_video THEN    {if inv_video, add a starting block}
  405.             FOR i := 1 TO mult_w DO out_char(' ',block_char,'A');
  406.         CASE map_size OF
  407.              8 : ptr8 := ptr_maps;
  408.             12 : ptr12 := ptr_maps;
  409.             18 : ptr18 := ptr_maps;
  410.             24 : ptr24 := ptr_maps;
  411.             30 : ptr30 := ptr_maps
  412.         END; {case}
  413.         FOR chr_pos := 1 TO LENGTH(inp_line) DO BEGIN
  414.             chr_num := ORD(inp_line[chr_pos]);
  415.             out_cnto := out_line.len; {where char started for delta_x}
  416.             IF (ndx_array[chr_num].left_offset < 0) AND  {back-up cursor if ok}
  417.               (out_line.len > -1 * ndx_array[chr_num].left_offset * mult_w) THEN
  418.                 out_line.len := out_line.len + (ndx_array[chr_num].left_offset * mult_w)
  419.             ELSE
  420.                 FOR i := 1 TO (ndx_array[chr_num].left_offset * mult_w) DO
  421.                     out_char(' ',CHR(chr_num),'A');  {left offset}
  422.             {end - add or subtract to out_line for left offset}
  423.             act_dot_pos := height_lcv - (ndx_array[0].top_offset -
  424.               ndx_array[chr_num].top_offset);  {baseline minus char top offset}
  425.             FOR width_lcv := 1 TO ndx_array[chr_num].width DO BEGIN
  426.                 IF (act_dot_pos <= 0) OR (act_dot_pos > ndx_array[chr_num].height) THEN
  427.                    FOR i := 1 TO mult_w DO
  428.                        out_char(' ',CHR(chr_num),'A') {space above char}
  429.                 ELSE BEGIN
  430.                    chr_byte := TRUNC(0.99+width_lcv/8);
  431.                    CASE map_size OF
  432.                        8 : test_byte := ptr8^.map[act_dot_pos,chr_byte];
  433.                       12 : test_byte := ptr12^.map[act_dot_pos,chr_byte];
  434.                       18 : test_byte := ptr18^.map[act_dot_pos,chr_byte];
  435.                       24 : test_byte := ptr24^.map[act_dot_pos,chr_byte];
  436.                       30 : test_byte := ptr30^.map[act_dot_pos,chr_byte]
  437.                    END; {case}
  438.                    chr_bit := width_lcv MOD 8;
  439.                    CASE chr_bit OF
  440.                       1 : test_bit := test_byte AND 128;
  441.                       2 : test_bit := test_byte AND 64;
  442.                       3 : test_bit := test_byte AND 32;
  443.                       4 : test_bit := test_byte AND 16;
  444.                       5 : test_bit := test_byte AND 8;
  445.                       6 : test_bit := test_byte AND 4;
  446.                       7 : test_bit := test_byte AND 2;
  447.                       0 : test_bit := test_byte AND 1
  448.                    END; {case}
  449.                    FOR mult_w_lcv := 1 TO mult_w DO
  450.                        IF test_bit = 0 THEN
  451.                            out_char(' ',CHR(chr_num),'A')
  452.                        ELSE
  453.                            out_char(CHR(chr_num),' ','A')
  454.                        {end}
  455.                    {end for height multiplier}
  456.                 END
  457.             END; {for width of each character}
  458.             end_char_pos := out_cnto + (ndx_array[chr_num].delta_x * mult_w);
  459.             IF (end_char_pos < out_line.len) AND (chr_pos < LENGTH(inp_line))  THEN
  460.                 out_line.len := end_char_pos
  461.             ELSE BEGIN
  462.                 added := end_char_pos - out_line.len;
  463.                 FOR i := 1 TO added DO
  464.                     out_char(' ',block_char,'A');
  465.             END; {subtract or add spaces for delta_x - but not on last char}
  466.             CASE map_size OF                   {point to next char map}
  467.                  8 : ptr8 := ptr8^.next;
  468.                 12 : ptr12 := ptr12^.next;
  469.                 18 : ptr18 := ptr18^.next;
  470.                 24 : ptr24 := ptr24^.next;
  471.                 30 : ptr30 := ptr30^.next
  472.             END {case}
  473.         END; {for each character}
  474.         IF inv_video AND ((out_line.chr[out_line.len] <> ' ') OR
  475.           (out_line.ichr[out_line.len] <> block_char)) THEN
  476.             FOR i := 1 TO mult_w DO out_char(' ',block_char,'A');
  477.             {if inv_video and delta_x did not add a space, add a ending block}
  478.         FOR mult_h_lcv := 1 TO mult_h DO
  479.             out_char(' ',' ','E'); {output line(s) }
  480.         out_char(' ',' ','C') {clear output line}
  481.     END; {for height of characters}
  482.     IF inv_video THEN BEGIN {if inv_video, end with a solid line}
  483.         FOR i := 1 TO space_needed + mult_w - given_offset DO       {space_needed is only an}
  484.             out_char(' ',block_char,'A');   {approx line length!}
  485.         out_char(' ',' ','E'); {and output it}
  486.         out_char(' ',' ','C')  {and clear it}
  487.     END;
  488.     out_char(' ',' ','D'); {end w/blank line}
  489.     reset_maps(ptr_maps) {dispose of maps}
  490. END; {PROCEDURE out_sign}
  491.  
  492. {$i disp}    {display parameters}
  493. {$i ask}     {ask for parameters}
  494. {$i prt}     {printer specific routines}
  495.  
  496. PROCEDURE parm_menu; {font_f_open : BOOLEAN}
  497. BEGIN
  498.     CLRSCR; highvideo;
  499.     WRITE('Signs'); lowvideo; WRITE(' Version: ',Date);
  500.     GOTORC(1,59); WRITE('Mode:');
  501.     GOTORC(3,1);
  502.     WRITE('------------------------- ');
  503.     highvideo; WRITE('Options and I/O Parameters');
  504.     lowvideo; WRITE(' --------------------------');
  505.     disp_t; disp_b; disp_f; disp_w; disp_h; disp_v;
  506.     disp_a; disp_m; disp_g; disp_q; disp_x; disp_i;
  507.     disp_r; disp_n; disp_o; disp_s; disp_y; disp_p;
  508.     disp_l; disp_c; disp_d; disp_e; disp_fs;
  509.     GOTORC(15,1); lowvideo;
  510.     WRITE('-------------------------------------------------------------------------------');
  511.     avail_space;
  512.     GOTORC(17,41); highvideo;
  513.     TextAttr := TextAttr + Blink;
  514.     WRITE('Enter option letter');
  515.     TextAttr := TextAttr - Blink;
  516.     GOTORC(18,1); lowvideo;
  517.     WRITE('-------------------------------------------------------------------------------');
  518. END; {Procedure parm_menu}
  519.  
  520.  
  521. PROCEDURE ask_parm; { (VAR font_f_open : BOOLEAN) }
  522. VAR            ans : CHAR;       {used for single char inut}
  523.    done,out_f_open : BOOLEAN;    {flags}
  524.      old_ff,old_of : STRING[14]; {old filenames upon input or procedure}
  525. BEGIN
  526.     GOTORC(1,65); highvideo; WRITE('Change Parms');
  527.     GOTORC(17,41); CLREOL; WRITE('Enter option letter');
  528.     GOTORC(20,1); CLREOL; GOTORC(21,1); CLREOL;
  529.     GOTORC(22,1); CLREOL; GOTORC(23,1); CLREOL;
  530.     disp_t; disp_b; disp_f; disp_w; disp_h; disp_v;
  531.     disp_a; disp_m; disp_g; disp_q; disp_x; disp_i;
  532.     disp_r; disp_n; disp_o; disp_s; disp_y; disp_p;
  533.     disp_l; disp_c; disp_d; disp_e; disp_fs;
  534.     IF output_device = recd_file THEN
  535.         out_f_open := TRUE
  536.     ELSE
  537.         out_f_open := FALSE;
  538.     old_of := out_fn;
  539.     old_ff := font_fn;
  540.     done := FALSE;
  541.     WHILE NOT done DO BEGIN
  542.         GOTORC(17,41); highvideo;
  543.         TextAttr := TextAttr + Blink;
  544.         WRITE('Enter option letter');
  545.         TextAttr := TextAttr - Blink;
  546.         ans := READKEY;
  547.         GOTORC(17,41); CLREOL;
  548.         GOTORC(20,1); lowvideo;
  549.         CASE ans OF
  550.         'T','t' : ask_t; {change sign type}
  551.         'B','b' : ask_b; {change block/letter type}
  552.         'F','f' : ask_f; {change font filename}
  553.         'W','w' : ask_w; {change width of output graphic characters}
  554.         'H','h' : ask_h; {change height of output graphic characters}
  555.         'V','v' : ask_v; {change inverse video on/off}
  556.         'A','a' : ask_a; {change auto-centering on/off}
  557.         'M','m' : ask_m; {enter a given left margin to use}
  558.         'G','g' : ask_g; {change the maximum width of output line in characters}
  559.         'Q','q' : ask_q; {abort exit}
  560.      ^M,'x','X' : ask_x(done,ff_open,out_f_open,old_ff,old_of);
  561.                          {check if done and if so, return to input}
  562.         'I','i' : ask_i; {change input device}
  563.         'R','r' : ask_r; {change read from input filename}
  564.         'N','n' : ask_n; {change number of copyies desired}
  565.         'O','o' : ask_o; {change output device}
  566.         'S','s' : ask_s; {change output device size}
  567.         'Y','y' : ask_y; {change printer type}
  568.         'P','p' : ask_p; {change printer characters/inch}
  569.         'L','l' : ask_l; {change printer lines/inch}
  570.         'C','c' : ask_c; {change printer color}
  571.         'D','d' : ask_d; {change printer graphic density}
  572.         'E','e' : ask_e  {change output record filename}
  573.         ELSE      BEGIN {not a menu option}
  574.                       GOTORC(24,1); WRITE('Unrecognized code entered ->',ans,'<-'^G);
  575.                       sak
  576.                   END
  577.         END; {case}
  578.         GOTORC(20,1); CLREOL; GOTORC(21,1); CLREOL; GOTORC(22,1); CLREOL;
  579.         GOTORC(23,1); CLREOL; GOTORC(24,1); CLREOL;
  580.         GOTORC(17,41); lowvideo;
  581.         TextAttr := TextAttr + Blink;
  582.         WRITE('Enter option letter');
  583.         TextAttr := TextAttr - Blink
  584.     END; {while not done}
  585.     highvideo
  586. END; {procedure ask_parm}
  587.  
  588.  
  589. PROCEDURE input_menu;
  590. BEGIN
  591.     GOTORC(1,65); highvideo; WRITE('Input Text  ');
  592.     GOTORC( 4,1); WRITE(' '); GOTORC( 5,1); WRITE(' '); GOTORC( 6,1); WRITE(' ');
  593.     GOTORC( 7,1); WRITE(' '); GOTORC( 8,1); WRITE(' '); GOTORC( 9,1); WRITE(' ');
  594.     GOTORC(10,1); WRITE(' '); GOTORC(11,1); WRITE(' '); GOTORC(12,1); WRITE(' ');
  595.     GOTORC(13,1); WRITE(' '); GOTORC(14,1); WRITE('      ');
  596.     GOTORC( 4,41); WRITE(' '); GOTORC( 5,41); WRITE(' '); GOTORC( 6,41); WRITE(' ');
  597.     GOTORC( 7,41); WRITE(' '); GOTORC( 8,41); WRITE(' '); GOTORC( 9,41); WRITE(' ');
  598.     GOTORC(10,41); WRITE(' '); GOTORC(11,41); WRITE(' '); GOTORC(12,41); WRITE(' ');
  599.     GOTORC(13,41); WRITE(' '); GOTORC(14,41); WRITE(' ');
  600.  
  601.     GOTORC(17,1); CLREOL; lowvideo; WRITE(' Output width needed -> ');
  602.     highvideo; WRITE(space_needed);
  603.     GOTORC(19,1); CLREOL;           WRITE('          Input Text -> ');
  604.     GOTORC(20,1); CLREOL;
  605.     GOTORC(21,1); CLREOL;
  606.     WRITE('   ^P'); lowvideo; WRITE(': Change parameters     '); highvideo;
  607.     WRITE('^F,^L'); lowvideo; WRITE(': Send Formfeed to LST    '); highvideo;
  608.     WRITE('^X'); lowvideo; WRITELN(': Restart Input'); highvideo;
  609.     WRITE('^C,^D'); lowvideo; WRITE(': Done, quit to OS      '); highvideo;
  610.     WRITE('^R,^T'); lowvideo; WRITE(': Send Reverse Formfeed   '); highvideo;
  611.     WRITE('^H'); lowvideo; WRITELN(': Backspace'); highvideo;
  612.     WRITE('<ret>'); lowvideo; WRITE(': Process Input         '); highvideo;
  613.     WRITE('   ^A'); lowvideo; WRITE(': Alternate Input         ');
  614.     GOTORC(25,1); CLREOL; GOTORC(19,25);
  615. END;
  616.  
  617. {$i util}
  618.  
  619. BEGIN
  620.     main;
  621.     GOTORC(25,1); WRITE('<<< Signs completed >>>')
  622. END.
  623.