home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / CODE4-1.ZIP / SOURCE.ZIP / X4LIST.C < prev   
Encoding:
C/C++ Source or Header  |  1989-10-14  |  1.7 KB  |  82 lines

  1.  
  2. /* x4list.c  (c)Copyright Sequiter Software Inc., 1987, 1988, 1989.  All rights reserved. */
  3.  
  4. #include "d4base.h"
  5. #include "w4.h"
  6.  
  7. extern  CB_WINDOW  *v4window_ptr ;
  8.  
  9. x4list()
  10. {
  11.    int   rc, j, hand, len, row ;
  12.    long  field_ref ;
  13.  
  14.    if ( (rc =  d4top()) < 0)  return -1 ;
  15.  
  16.    hand =  w4handle( -2 ) ;
  17.    if ( hand < 0 )   w4clear(0) ;
  18.  
  19.    while ( rc == 0 )
  20.    {
  21.       if ( (rc = x4filter_do()) < 0 )  return -1 ;
  22.       if ( rc )
  23.       {
  24.      #ifndef UNIX
  25.      if ( kbhit() )
  26.         if ( g4char() == 27 )  return 0 ;
  27.      #endif
  28.      if ( (rc = d4skip(1L)) < 0 )  return -1 ;
  29.      continue ;
  30.       }
  31.  
  32.       row =  w4row()+1 ;
  33.       if ( w4col() == 0 )  row-- ;
  34.  
  35.       if ( hand < 0 )
  36.       {
  37.      if ( row >= v4window_ptr->height-1 )
  38.      {
  39.         w4(v4window_ptr->height-1,0, "Press any key to continue ... " ) ;
  40.         w4cursor( w4row(), w4col() ) ;
  41.         if ( g4char() == 27 )  return 0 ;
  42.         row =  0 ;
  43.         w4clear(0) ;
  44.      }
  45.      else
  46.         w4position( row, 0 ) ;
  47.       }
  48.       else
  49.      w4position( row, 0 ) ;
  50.  
  51.       for ( j=1; j <= f4num_fields(); j++ )
  52.       {
  53.      field_ref =  f4j_ref(j) ;
  54.      if ( f4type(field_ref) == 'M' )  continue ;
  55.  
  56.      len =  f4width( field_ref ) ;
  57.      if ( w4col()+len+2 > w4width(-1) )
  58.      {
  59.         len =  w4width(-1) - w4col() ;
  60.         if ( len > f4width(field_ref) )  len =  f4width(field_ref) ;
  61.  
  62.         w4num( row,w4col(), f4ptr(field_ref), len ) ;
  63.         break ;
  64.      }
  65.  
  66.      w4num( row,w4col(), f4ptr(field_ref), len ) ;
  67.      w4position( row, w4col()+2 ) ;
  68.       }
  69.  
  70.       if ( (rc = d4skip(1L)) < 0 )  return -1 ;
  71.       #ifndef UNIX
  72.       if ( kbhit() )
  73.      if ( g4char() == 27 )  return 0 ;
  74.       #endif
  75.    }
  76.  
  77.    if ( hand <= 0 )
  78.       w4cursor( v4window_ptr->height-2, 0 ) ;
  79.  
  80.    return 0 ;
  81. }
  82.