home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / progm / flash-c1.zip / PRTDEMO.C < prev    next >
Text File  |  1990-02-11  |  3KB  |  128 lines

  1. #include <fpclib.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <string.h>
  5. #include <conio.h>
  6.  
  7. char * DecToBin( int );
  8. void TestBiosPrtChar( void );
  9. void TestBiosPrtInit( void );
  10. void TestBiosPrtStat( void );
  11. void TestDosPrtChar( void );
  12. int GetMenuSelection( void );
  13.  
  14. char St[9];
  15.  
  16. char *DecToBin( Num )
  17. int  Num;
  18. {
  19.    int   i;
  20.  
  21.    for ( i = 7; i >= 0; i-- ) {
  22.       St[i] = ( Num % 2 ) + 48;
  23.       Num >>= 2;
  24.    }
  25.    St[8] = '\0';
  26.    return( St );
  27. }
  28.  
  29.  
  30. void TestBiosPrtChar( void )
  31. {
  32.    int   i,j,k;
  33.  
  34.    for ( j = 1; j < 11; j++ ) {
  35.       for ( i = 1; i < 27; i++ ) {
  36.          k = BiosPrtChar( i+64, 0 );
  37.          if ( k & 0x10 )
  38.             printf( "printer selected... Status = %s \n", DecToBin( k ) );
  39.          else
  40.             printf( "printer not selected... Status = %s \n", DecToBin( k ) );
  41.       }
  42.  
  43.       k = BiosPrtChar( 10, 0 );
  44.       if ( k & 0x10 )
  45.          printf( "printer selected...  Status = %s \n", DecToBin( k ) );
  46.       else
  47.          printf( "printer not selected... Status = %s \n", DecToBin( k ) );
  48.  
  49.       k = BiosPrtChar( 13, 0 );
  50.       if ( k & 0x10 )
  51.          printf( "printer selected...  Status = %s \n", DecToBin( k ) );
  52.       else
  53.          printf( "printer not selected... Status = %s \n", DecToBin( k ) );
  54.    }
  55. }
  56.  
  57. void TestBiosPrtInit( void )
  58. {
  59.    int k;
  60.  
  61.    k = BiosPrtInit( 0 );
  62.    printf( "print status returned = %u \n", k );
  63. }
  64.  
  65.  
  66. void TestBiosPrtStat( void )
  67. {
  68.    int  i;
  69.  
  70.    for ( i = 0; i < 500; i++ )
  71.       printf( "printer status = %s \n", DecToBin( BiosPrtStat( 0 ) ) );
  72. }
  73.  
  74.  
  75. void TestDosPrtChar( void )
  76. {
  77.    int   i,j;
  78.  
  79.    for ( j = 1; j < 11; j++ ) {
  80.       for ( i = 1; i < 27; i++ )
  81.          DosPrtChar( i+64 );
  82.       DosPrtChar( 10 );
  83.       DosPrtChar( 13 );
  84.    }
  85. }
  86.  
  87. int GetMenuSelection( void )
  88. {
  89.    int  Item = 0;
  90.  
  91.    ClrWin( 1, 1, 80, 25, 7 );
  92.    WindowFP( 1, 1, 80, 25 );
  93.    GotoxyAbs( 1, 1 );
  94.  
  95.    printf( "\n 1. BiosPrtChar     " );
  96.    printf( "\n 2. BiosPrtInit     " );
  97.    printf( "\n 3. BiosPrtStat     " );
  98.    printf( "\n 4. DosPrtChar      " );
  99.    printf( "\n ");
  100.    printf( "\n 5. Quit" );
  101.    printf( "\n " );
  102.    printf( "\nEnter selection to test ==> " );
  103.  
  104.    while ( Item < 1 || Item > 5 )
  105.       Item = ReadKey() - 48;
  106.  
  107.    return( Item );
  108. }
  109.  
  110. void main( void )
  111. {
  112.    int done = 0;
  113.  
  114.    VioInit();
  115.    ClrWin( 1, 1, 80, 25, 7 );
  116.    GotoxyAbs( 1, 1 );
  117.  
  118.    while ( !done ) {
  119.       switch ( GetMenuSelection() ) {
  120.           case 1 : TestBiosPrtChar();  break;
  121.           case 2 : TestBiosPrtInit();  break;
  122.           case 3 : TestBiosPrtStat();  break;
  123.           case 4 : TestDosPrtChar();   break;
  124.           case 5 : done++;             break;
  125.       }
  126.    }
  127. }
  128.