home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 2 / ctrom_ii_b.zip / ctrom_ii_b / PROGRAM / FOXPRO / LP_11 / LP.PRG < prev   
Text File  |  1993-05-28  |  3KB  |  137 lines

  1. *******************************************************************************
  2. *
  3. *  LP - LinePrint
  4. *
  5. *******************************************************************************
  6. *  Release 1.01 / 20.05.93
  7.  
  8.  
  9. #include screen.hdr        && FCO 2.4
  10.  
  11. #include fileio.hdr
  12. #include string.hdr
  13. #include io.hdr
  14. #include date.hdr
  15. #include system.hdr
  16.  
  17.  
  18. VARDEF
  19.    FILE PrintFile
  20.    CHAR(128) Datei
  21.    CHAR(255) Line
  22.    UINT Seite, Zeile, Pzeile
  23.    LOGICAL ZeigeKopf    
  24.    CHAR(25)    pinit, feein, feaus, cpi10, cpi12, cpi16, nlq, nlaus, ;
  25.            undl, unaus, dw, dwaus, ital, itaus
  26. ENDDEF
  27.  
  28. PROCEDURE Kopf
  29.   PARAMETERS VALUE CHAR CL
  30.   IF ZeigeKopf
  31.      ?? feein
  32.      ?  "Datei: "
  33.      ?? ltrim( CL )
  34.      ?? space( 10 )
  35.      ?? "Datum: "
  36.      ?? dtoc( today() )
  37.      ?? space( 10 )
  38.      ?? "Seite: "
  39.      ?? ltrim( i_str( Seite ))
  40.      ?? feaus
  41.      ?
  42.      ?
  43.   ENDIF    
  44. ENDPRO
  45.     
  46.  
  47. PROCEDURE fco_main
  48.   PARAMETERS CONST CHAR CommandLine
  49.     
  50.   SET DATE GERMAN
  51.   SET MARGIN TO 5
  52.   
  53.   DO key_dos
  54.   DO scrn_dos
  55.  
  56.   Seite = 1
  57.   Zeile = 1
  58.  
  59.   *--- IBM Grafik
  60.   pinit = chr(27)+chr(54)        && Esc 6 = Zeichensatz 2
  61.   feein = chr(27)+chr(69)        && Esc E
  62.   feaus = chr(27)+chr(70)        && Esc F
  63.   cpi10 = chr(18)
  64.   cpi12 = chr(0)
  65.   cpi16 = chr(15)
  66.   nlq   = chr(0)
  67.   nlaus = chr(0)     
  68.   undl  = chr(27)+chr(15)
  69.   unaus = chr(0)     
  70.   dw    = chr(27)+"-1"
  71.   dwaus = chr(27)+"-0"
  72.   ital  = chr(0)
  73.   itaus = chr(0)     
  74.  
  75.   Datei = AllTrim( lower( CommandLine ))
  76.  
  77.   IF "/p" $ lower( CommandLine )
  78.      Pzeile = i_val( substr( Datei, 2 + at( "/p", Datei), 2 ))
  79.      Datei = stuff( Datei, at( "/p", Datei ), 4, "" )
  80.      ELSE
  81.           Pzeile = 57
  82.   ENDIF
  83.  
  84.   IF "/n" $ lower( CommandLine )
  85.      ZeigeKopf = .F.
  86.      Datei = stuff( Datei, at( "/n", Datei ), 2, "" )
  87.      ELSE
  88.           ZeigeKopf = .T.
  89.   ENDIF
  90.  
  91.   IF .not. f_open( PrintFile, Datei, &F_READ, &F_TEXT )
  92.      ? "LinePrint v1.1 (c) 1993 by Alfred Klich"
  93.      ? "  Syntax: LP <name>.<ext> [/Pnn] [/N]"
  94.      QUIT
  95.   ENDIF
  96.   
  97.   SET CONSOLE OFF
  98.   SET PRINT ON
  99.  
  100.   ?? pinit 
  101.   ?? cpi16  
  102.   
  103.   DO Kopf with ltrim( Datei )
  104.  
  105.   DO WHILE .NOT. f_eof( PrintFile )
  106.      IF f_getln( PrintFile, Line )
  107.         Zeile = Zeile +1
  108.         IF Zeile >= Pzeile
  109.            ?? chr( 12 )            && FormFeed 
  110.            Zeile = 1
  111.            Seite = Seite +1
  112.            DO Kopf with Datei
  113.         ENDIF
  114.         *--- <tabs> durch <space> ersetzen
  115.         DO WHILE .T.
  116.            IF at( chr( 9 ), line ) > 0
  117.               line = stuff( line, at( chr( 9 ), line ), 1,;
  118.                             space( 9 - at( chr( 9 ), line ) % 8 ))
  119.               ELSE
  120.                    exit
  121.            ENDIF
  122.         ENDDO
  123.         ? line
  124.      ENDIF
  125.   ENDDO
  126.  
  127.   ?? cpi10
  128.   ?? chr( 12 )            && FormFeed 
  129.  
  130.   SET PRINT OFF
  131.   SET CONSOLE ON
  132.   SET MARGIN TO 0
  133.  
  134.   f_close( PrintFile )
  135.  
  136. ENDPRO
  137.