home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c160 / 1.ddi / SOURCE / G4FIELD.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-06-22  |  1.5 KB  |  70 lines

  1.  
  2. /*  g4field.c
  3.  
  4.     (c)Copyright Sequiter Software Inc., 1987-1990.  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( int row, int col, long field_ref )
  18. {
  19.    GET *get_ptr ;
  20.    char field_type ;
  21.    int  width ;
  22.  
  23.    field_type =  f4type(field_ref) ;
  24.    if ( field_type == 'M' )  return ;
  25.    if ( field_type == 'F' )  field_type =  'N' ;
  26.  
  27.    if ( field_type == 'L' )
  28.    {
  29.       get_ptr =  g4alloc( row, col, f4ptr(field_ref), 'C') ;
  30.       g4picture( "L" ) ;
  31.    }
  32.    else
  33.       get_ptr =  g4alloc( row, col, f4ptr(field_ref), field_type) ;
  34.    if ( field_type != 'D' )
  35.    {
  36.       if ( (width = f4width(field_ref)) >= MAX_GET_WIDTH-1 )
  37.          width =  MAX_GET_WIDTH-2 ;
  38.       get_ptr->width_data =  get_ptr->width_scr =  width ;
  39.       get_ptr->num_decimals =  f4decimals(field_ref) ;
  40.    }
  41. }
  42.  
  43.  
  44. void  w4field( int row, int col, long field_ref )
  45. {
  46.    int  width ;
  47.    char *ptr ;
  48.  
  49.    ptr =  f4ptr( field_ref ) ;
  50.    if ( ptr == (char *) 0 )  return ;
  51.  
  52.    width = f4width( field_ref ) ;
  53.  
  54.    switch( f4type(field_ref) )
  55.    {
  56.       case 'D':
  57.      w4( row, col, c4dt_format( ptr, v4default_date )) ;
  58.      break ;
  59.  
  60.       case 'N':
  61.       case 'F':
  62.       case 'L':
  63.       case 'C':
  64.      w4num( row, col, ptr, width ) ;
  65.      break ;
  66.    }
  67. }
  68.  
  69.  
  70.