home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 125.img / PRO-C4.ZIP / BENCH1.ZIP / GENSUP / DIRECTE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-05-28  |  1.2 KB  |  67 lines

  1. # include <stdio.h>
  2. # include <bench.h>
  3. # include <proc.io>
  4. # include "iodef.h"
  5. # include "field.h"
  6. # include "sup.h"
  7. # include "screen.h"
  8.  
  9. /*
  10. * find field above the current one
  11. */
  12.  
  13. void up_field(cur, table, screen, ip, ip_fld)
  14. int *cur;
  15. int table;
  16. int screen;
  17. struct ipf *ip;
  18. FIELD *ip_fld;
  19. {
  20.     int i,save = 0;
  21.     int row = ip_fld[*cur].frow;
  22.     int col = ip_fld[*cur].fcol;
  23.  
  24.     for (i = 0; ip[i].screen != -1; i++)
  25.         if (ip[i].table == table && ip[i].screen == screen)
  26.             if (ip_fld[i].fcol == col)
  27.                 if (ip_fld[i].frow < row) 
  28.                     if (ip_fld[i].frow > ip_fld[save].frow || save == 0 )
  29.                         save = i;
  30.     if (save)
  31.     {     
  32.         *cur = save;
  33.         return;
  34.     }
  35.     prev_field(cur, table, ip);
  36. }
  37.  
  38. /*
  39. * find field below the current one
  40. */
  41.  
  42. void down_field(cur, table, screen, ip, ip_fld)
  43. int *cur;
  44. int table;
  45. int screen;
  46. struct ipf *ip;
  47. FIELD *ip_fld;
  48. {
  49.     int i,save = 0;
  50.     int row = ip_fld[*cur].frow;
  51.     int col = ip_fld[*cur].fcol;
  52.  
  53.     for (i = 0; ip[i].screen != -1; i++)
  54.         if (ip[i].table == table && ip[i].screen == screen)
  55.             if (ip_fld[i].fcol == col)
  56.                 if (ip_fld[i].frow > row) 
  57.                     if (ip_fld[i].frow < ip_fld[save].frow || save == 0 )
  58.                         save = i;
  59.     if (save)
  60.     {
  61.         *cur = save;
  62.         return;
  63.     }
  64.     next_field(cur, table, ip);
  65. }
  66.  
  67.