home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / demos / gpc / macfunct.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-02-15  |  6.2 KB  |  154 lines

  1. /* $XConsortium: macfunct.h,v 5.2 91/02/16 10:07:41 rws Exp $ */
  2.  
  3. /*
  4.  */
  5. /***********************************************************
  6. Copyright 1989, 1990, 1991 by Sun Microsystems, Inc. and the X Consortium.
  7.  
  8.                         All Rights Reserved
  9.  
  10. Permission to use, copy, modify, and distribute this software and its
  11. documentation for any purpose and without fee is hereby granted,
  12. provided that the above copyright notice appear in all copies and that
  13. both that copyright notice and this permission notice appear in
  14. supporting documentation, and that the names of Sun Microsystems,
  15. the X Consortium, and MIT not be used in advertising or publicity
  16. pertaining to distribution of the software without specific, written
  17. prior permission.
  18.  
  19. SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  20. INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
  21. SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
  22. DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  23. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  24. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  25. SOFTWARE.
  26.  
  27. ******************************************************************/
  28.  
  29. /*
  30.  * Copyright (c) 1989, 1990, 1991 by M.I.T. and Sun Microsystems, Inc.
  31.  */
  32.  
  33. /*--------------------------------------------------------------------*\
  34. |  Copyright (C) 1989, 1990, 1991, National Computer Graphics Association
  35. |
  36. |  Permission is granted to any individual or institution to use, copy, or
  37. |  redistribute this software so long as it is not sold for profit, provided
  38. |  this copyright notice is retained.
  39. |
  40. |                         Developed for the
  41. |                National Computer Graphics Association
  42. |                         2722 Merrilee Drive
  43. |                         Fairfax, VA  22031
  44. |                           (703) 698-9600
  45. |
  46. |                                by
  47. |                 SimGraphics Engineering Corporation
  48. |                    1137 Huntington Drive  Unit A
  49. |                      South Pasadena, CA  91030
  50. |                           (213) 255-0900
  51. |---------------------------------------------------------------------
  52. |
  53. | Author        :    John M. Zulauf
  54. |
  55. | File          :    macfunct.h
  56. | Date          :    Sun Jun 25 22:41:36 PDT 1989
  57. | Project       :    PLB
  58. | Description   :    Macro-Functions... macros the generate
  59. |            functions.  For those who don't like to
  60. |            type, or yank-put (ad infinitum).
  61. | Status        :    Version 1.0
  62. |
  63. | Revisions     :
  64. |
  65. |       2/90            MFC Tektronix, Inc.: PEX-SI API implementation.
  66. |
  67. \*--------------------------------------------------------------------*/
  68.  
  69. /*--------------------------------------------------------------------*\
  70. |    Table of Contents
  71. |
  72. |    define MF_TRUE_COLOR(MV_routine,MV_token,MV_handle,MV_phigs)
  73. |    define MF_MAP_INDEX(MV_routine,MV_token,MV_handle,MV_phigs)
  74. |    define MF_BIF_SIZE(MV_routine,MV_token,MV_handle,MV_phigs)
  75. \*--------------------------------------------------------------------*/
  76.  
  77. /*--------------------------------------------------------------------*\
  78. |    Use a Macro to define a whole class of function:
  79. |
  80. |    the bif_<prim>color functions.
  81. \*--------------------------------------------------------------------*/
  82. #define MF_TRUE_COLOR(MV_routine,MV_token,MV_handle,MV_phigs) \
  83.     /*----------------------------------------------------------*\
  84.     | Procedure: int MV_routine(c1, c2, c3)                 \
  85.     |----------------------------------------------------------- \
  86.     | Description: Receive a MV_TOKEN entity from the parser     \
  87.     |----------------------------------------------------------- \
  88.     | Return: Error Code (Not Implemented)                 \
  89.     \*---------------------------------------------------------*/\
  90.     int MV_routine(c1, c2,c3)                     \
  91.     BIF_REAL c1, c2,c3;                         \
  92.     {                                 \
  93.         static int entSize        = sizeof(BIF_True_color)   \
  94.                                     + sizeof(Pgcolr);        \
  95.                                      \
  96.         /*--------------------------------------------------*\
  97.         |    Since true color entities have the same         \
  98.         |    structure we can use a common routine.         \
  99.         \*-------------------------------------------------*/\
  100.         bif_truecolor((float)c1,(float)c2,(float)c3,         \
  101.             entSize, (int)MV_token, MV_handle, MV_phigs);\
  102.                                      \
  103.     } /* End MV_routine() */
  104.  
  105.  
  106. /*--------------------------------------------------------------------*\
  107. |    Use a Macro to define a whole class of function:
  108. |
  109. |    the bif_<prim>colorindex functions.
  110. \*--------------------------------------------------------------------*/
  111.  
  112. #define MF_MAP_INDEX(MV_routine,MV_token,MV_handle,MV_phigs)         \
  113.     /*----------------------------------------------------------*\
  114.     | Procedure: int MV_routine(index)                 \
  115.     |----------------------------------------------------------- \
  116.     | Description: Receive a MV_token entity from the parser     \
  117.     |----------------------------------------------------------- \
  118.     | Return: Error Code (Not Implemented)                 \
  119.     \*---------------------------------------------------------*/\
  120.     int MV_routine(index)                         \
  121.     BIF_INT index;                             \
  122.     {                                 \
  123.         static int entSize        = sizeof(BIF_Index);   \
  124.                                      \
  125.         /*--------------------------------------------------*\
  126.         |    Since true color entities have the same         \
  127.         |    structure we can use a common routine.         \
  128.         \*-------------------------------------------------*/\
  129.         bif_colorindex((int)index, entSize,             \
  130.             (int)MV_token, MV_handle, MV_phigs);         \
  131.                                      \
  132.     } /* End MV_routine() */
  133.  
  134.  
  135. #define MF_BIF_SIZE(MV_routine,MV_token,MV_handle,MV_phigs) \
  136.     /*----------------------------------------------------------*\
  137.     | Procedure: int MV_routine(size)                 \
  138.     |----------------------------------------------------------- \
  139.     | Description: Receive a MV_token entity from the parser     \
  140.     |         Many _size and _scalefactor routines         \
  141.     |        use this as a shorthand form.             \
  142.     |----------------------------------------------------------- \
  143.     | Return: Error Code (Not Implemented)                 \
  144.     \*---------------------------------------------------------*/\
  145.     int MV_routine(size)                         \
  146.     BIF_REAL size;                             \
  147.     {                                 \
  148.         static int entSize = sizeof(BIF_Size);             \
  149.         bif_size((float)size,entSize,MV_token,             \
  150.             MV_handle,MV_phigs);                 \
  151.                                      \
  152.     } /* End procedure MV_routine */
  153.  
  154.