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 / G4FIELD.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-10-14  |  1.6 KB  |  74 lines

  1.  
  2. /*  g4field.c
  3.  
  4.     (c)Copyright Sequiter Software Inc., 1987, 1988, 1989.  All rights reserved. 
  5.  
  6.     This is the only SAY/GET Screen I/O routine which uses Code Base
  7.     database management routines.  
  8.  
  9.     Consequently, it is in its own file to make the SAY/GET module
  10.     and the other Code Base modules independent of one another.
  11. */
  12.  
  13. #include "w4.h"
  14. #include "d4base.h"
  15.  
  16.  
  17. void  g4field( row, col, field_ref )
  18. int   row, col ;
  19. long  field_ref ;
  20. {
  21.    GET *get_ptr ;
  22.    char field_type ;
  23.    int  width ;
  24.  
  25.    field_type =  f4type(field_ref) ;
  26.    if ( field_type == 'M' )  return ;
  27.    if ( field_type == 'F' )  field_type =  'N' ;
  28.  
  29.    if ( field_type == 'L' )
  30.    {
  31.       get_ptr =  g4alloc( row, col, f4ptr(field_ref), 'C') ;
  32.       g4picture( "L" ) ;
  33.    }
  34.    else
  35.       get_ptr =  g4alloc( row, col, f4ptr(field_ref), field_type) ;
  36.    if ( field_type != 'D' )
  37.    {
  38.       if ( (width = f4width(field_ref)) >= MAX_GET_WIDTH-1 )
  39.          width =  MAX_GET_WIDTH-2 ;
  40.       get_ptr->width_data =  get_ptr->width_scr =  width ;
  41.       get_ptr->num_decimals =  f4decimals(field_ref) ;
  42.    }
  43. }
  44.  
  45.  
  46. void  w4field( row, col, field_ref )
  47. int   row, col ;
  48. long  field_ref ;
  49. {
  50.    int  width ;
  51.    char *ptr ;
  52.  
  53.    ptr =  f4ptr( field_ref ) ;
  54.    if ( ptr == (char *) 0 )  return ;
  55.  
  56.    width = f4width( field_ref ) ;
  57.  
  58.    switch( f4type(field_ref) )
  59.    {
  60.       case 'D':
  61.      w4( row, col, c4dt_format( ptr, DEFAULT_DATE )) ;
  62.      break ;
  63.  
  64.       case 'N':
  65.       case 'F':
  66.       case 'L':
  67.       case 'C':
  68.      w4num( row, col, ptr, width ) ;
  69.      break ;
  70.    }
  71. }
  72.  
  73.  
  74.