home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_11_11 / feeney / myflags.h < prev    next >
Text File  |  1993-05-21  |  2KB  |  63 lines

  1.           LISTING 3
  2.         Program Flags
  3.  
  4. /*
  5. MyFlags.h       Program Codes and/or Errors.
  6.  
  7. The masks should be ORed with the programs' 
  8. status variable to set the flag bit.
  9.  
  10. To clear a flag bit in the program's status 
  11. variable AND with 1's complement of the mask.
  12. */
  13.  
  14. unsigned int flag=0; // Program status flag.
  15.  
  16. #define WRITEFAILED   0x0001 // Write to file failed.
  17. #define WINSIZEICON   0x0002 // Window is minimized.
  18. #define RETAKEDATA    0x0004 // Retry a data reading.
  19. #define SIZEREQUEST   0x0008 // Size of window changed.
  20. #define DEBUGPROGMAN  0x0010 // Info for debugging.
  21. #define DATASTORED    0x0020 // Data loaded in program.
  22. #define GRIDREQUEST   0x0040 // Display grid on graph.
  23. #define AUTOSCALING   0x0080 // Autoscale graph.
  24. #define INITIALIZED   0x1000 // Program variables 
  25. // initialized from parameter file at load time.
  26.  
  27. #define ACQUIRINGDATA 0x4000 // Data acq is running.
  28. #define USERABORT     0x8000 // User aborted last 
  29. // operation, e.g. data acq, dialog box, program, etc.
  30. /*
  31.     Common Statements using the program's 
  32.     status variable: 
  33.     e.g. if ( IsAbort) return(FALSE);
  34. */
  35. #define IsAbort         (flag &   USERABORT)
  36. #define SetAbort        (flag |=  USERABORT)
  37. #define ResetAbort      (flag &= ~USERABORT)
  38.  
  39. #define IsDataAcq       (flag &   ACQURINGDATA)
  40. #define SetDataAcq      (flag |=  ACQURINGDATA)
  41. #define ResetDataAcq    (flag &= ~ACQURINGDATA)
  42.  
  43. #define IsRetry         (flag &   RETAKEDATA)
  44. #define SetRetry        (flag |=  RETAKEDATA)
  45. #define ResetRetry      (flag &= ~RETAKEDATA)
  46.  
  47. #define IsDebug         (flag &   DEBUGPROGMAN)
  48. #define SetDebug        (flag |=  DEBUGPROGMAN)
  49. #define ResetDebug      (flag &= ~DEBUGPROGMAN)
  50.  
  51. #define IsData          (flag &   DATASTORED)
  52. #define SetData         (flag |=  DATASTORED)
  53. #define ResetData       (flag &= ~DATASTORED)
  54.  
  55. etc.
  56. etc.
  57. etc.
  58.  
  59. #define IsResize        (flag &   SIZEREQUEST)
  60. #define SetResize       (flag |=  SIZEREQUEST)
  61. #define ResetResize     (flag &= ~SIZEREQUEST)
  62.  
  63.