home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / DCFVBA.ZIP / DCFOUTP.C < prev    next >
Text File  |  1990-05-07  |  2KB  |  87 lines

  1. /**
  2. ***  This is a part of the PCL2VBA project.   This set of functions handle
  3. ***  the output of the converted datastreams.
  4. **/
  5.  
  6. #include <stdio.h>
  7. #include <stdlib.h>
  8. #include <string.h>
  9. #include "dcfvba.h"
  10.  
  11. /* -------------------------------------------------------------------------- */
  12.  
  13. void new_page(void)
  14.    {
  15.    new_line();
  16.    fputs(".pa",vba_file);
  17.    logical_vpos = 1;
  18.    actual_vpos = 1;
  19.    return;
  20.    }
  21.  
  22. /* -------------------------------------------------------------------------- */
  23.  
  24. void clear_line(void)
  25.    {
  26.    *line = '\0';
  27.  
  28.    /* Pad the new output string to the length of the left margin */
  29.  
  30.    strpad(lmargin);
  31.    return;
  32.    }
  33.  
  34. /* -------------------------------------------------------------------------- */
  35.  
  36. void put_line(void)
  37.    {
  38.    char *pchar;
  39.  
  40.    /* If the only thing on the line is the concatination (.ct) command, then */
  41.    /* don't bother to print it out.                                          */
  42.  
  43.    if (!strcmp(line,".ct "))
  44.       return;
  45.  
  46.    /* Point to the end of the line and replace all trailing blanks w/ '!'. */
  47.  
  48.    pchar = strchr(line,'\0');
  49.    pchar--;
  50.  
  51.    while(*pchar == ' ')
  52.       *pchar-- = '!';
  53.  
  54.    fputs(line,vba_file);
  55.    fputc('\n',vba_file);
  56.    return;
  57.    }
  58.  
  59. /* -------------------------------------------------------------------------- */
  60.  
  61.  
  62. void new_line(void)
  63.    {
  64.    char *last_char;
  65.  
  66.  
  67.    put_line();
  68.  
  69.    /* If there are trailing blanks in the line just printed out, then       */
  70.    /* concatinate the subsequent line.                                      */
  71.  
  72.    last_char = strchr(line,'\0');
  73.    last_char--;
  74.    if (*last_char == '!')
  75.       strcpy(line,".ct ");
  76.    else
  77.       clear_line();
  78.  
  79.    /* Reset row and column indicators */
  80.  
  81.    row++;
  82.    column = 0;
  83.    logical_vpos++;
  84.    actual_vpos++;
  85.    return;
  86.    }
  87.