home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_07_02 / v7n2106a.txt < prev   
Text File  |  1988-12-18  |  3KB  |  80 lines

  1. #include "ciao.h"        /* screen & keyboard i/o, supporting fns & macros */
  2. #include "fafnir.h"      /* magic forms macros, etc. */
  3. #include <stdarg.h>
  4.  
  5. static char title[] = "Fafnir ver. 2.0 - elysian fields and forms nirvana by d.c.oshel";
  6.  
  7. /* functions to construct data -- defined elsewhere   */
  8. static int difference( char *p, int x, int y, int len );
  9. static int concatname( char *p, int x, int y, int len );
  10.  
  11. /* Name the fields -- with a fafnir macro   */
  12.  
  13. FIELDS last, first, conam, addr1, addr2, city, state, zip, homef, workf,
  14.        today, name, dues, paid, blnc, saltn, rem;
  15.     
  16. /* Set the attributes -- again using fafnir macros */
  17. /* This display uses two pages or screens          */
  18.  
  19. DEFINE_FIELDS( fafnir )
  20.  
  21.     TODAY(      today,                              17, 15     )   /* 0 */
  22.     TEXT_SET(   last,   "Oshel",                    17,  3, 30 )   /* 1 */
  23.     TEXT_SET(   first,  "David C.",                 17,  4, 30 )   /* 2 */
  24.     TEXT_SET(   conam,  "MicroConsulting Services", 17,  5, 30 )   /* 3 */
  25.     TEXT_SET(   addr1,  "1219 Harding Avenue",      17,  6, 30 )   /* 4 */
  26.     TEXT(       addr2,                              17,  7, 30 )   /* 5 */
  27.     TEXT_SET(   city,   "Ames",                     17,  8, 30 )   /* 6 */ 
  28.     STATE_SET(  state,  "IA",                       17,  9     )   /* 7 */
  29.     TENZIP_SET( zip,    "50010",                    17, 10     )   /* 8 */
  30.     PHONE_SET( workf, "(515) 292-    ",             17, 11     )   /* 9 */
  31.     TEXT_SET(     rem,   title,   17, 17, SLIDE(15)            )   /* 10 */
  32.  
  33. END_FIELDS; /* a macro to close the specification */
  34.  
  35. #define ALL 10
  36.  
  37. main()
  38. {
  39.  
  40.     static char *dialogue[] = {
  41.         "Continue demonstration",
  42.         "Exit program"
  43.     };
  44.  
  45.     vid_init(0);  /* *** MUST *** */
  46.  
  47.     AllocateFields( fafnir, ALL );  /* *** MUST *** */
  48.  
  49.     /* a real application would move the data record 
  50.        into form fields at this point       */
  51.  
  52.     do
  53.     {
  54.         zoo:
  55.         switch ( OnePageForm( "FAF1.S", fafnir, ALL, UPDATE ))
  56.         {
  57.         case SAVE_FORM:
  58.             /* would normally move the form fields 
  59.                back into the data record at this point */
  60.             boxmsg( "Pretending to save this form!" );
  61.             break;
  62.         case DELETE_FORM: 
  63.             boxmsg( "You can't delete a demonstration form!");
  64.         case SKIP_FORM:
  65.             nboxmsg( "Searching..." );  /* fake search */
  66.             goto zoo;
  67.             break;
  68.         case STOP_SEARCH: 
  69.             boxmsg( "What, just like that?!" );
  70.             break;
  71.         }
  72.     }
  73.     while ( (blopbloop(),select( 25,1,dialogue,2 )) == 0 );
  74.  
  75.     vid_exit();  /* restore sign-on screen */
  76.     ReleaseFields( fafnir, ALL );
  77.     exit (0);
  78. }
  79.  
  80.