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

  1. /* $XConsortium: bifconfig.c,v 5.1 91/02/16 10:06:56 rws Exp $ */
  2. /***********************************************************
  3. Copyright (c) 1989,1990, 1991 by Sun Microsystems, Inc. and the X Consortium at M.I.T.
  4.  
  5.                         All Rights Reserved
  6.  
  7. Permission to use, copy, modify, and distribute this software and its
  8. documentation for any purpose and without fee is hereby granted,
  9. provided that the above copyright notice appear in all copies and that
  10. both that copyright notice and this permission notice appear in
  11. supporting documentation, and that the names of Sun Microsystems,
  12. the X Consortium, and MIT not be used in advertising or publicity
  13. pertaining to distribution of the software without specific, written
  14. prior permission.
  15.  
  16. SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  17. INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
  18. SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
  19. DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  20. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  21. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  22. SOFTWARE.
  23.  
  24. ******************************************************************/
  25.  
  26. /*--------------------------------------------------------------------*\
  27. |  Copyright (C) 1989,1990, 1991, National Computer Graphics Association
  28. |
  29. |  Permission is granted to any individual or institution to use, copy, or
  30. |  redistribute this software so long as it is not sold for profit, provided
  31. |  this copyright notice is retained.
  32. |
  33. |                         Developed for the
  34. |                National Computer Graphics Association
  35. |                         2722 Merrilee Drive
  36. |                         Fairfax, VA  22031
  37. |                           (703) 698-9600
  38. |
  39. |                                by
  40. |                 SimGraphics Engineering Corporation
  41. |                    1137 Huntington Drive  Unit A
  42. |                      South Pasadena, CA  91030
  43. |                           (213) 255-0900
  44. |---------------------------------------------------------------------
  45. |
  46. | Author        :    John M. Zulauf / SimGraphics Engineering Corp.
  47. |
  48. | File          :    bifconfig.c
  49. | Date          :    Sat Jun 24 15:10:09 PDT 1989
  50. | Project       :    PLB
  51. | Description   :    System Configuration and Initialization Calls
  52. | Status        :    Version 1.0
  53. |
  54. | Revisions     :    
  55. |    2/89        MFR SimGEC: Added full configuration capabilities
  56. |
  57. |       5/90            MFC Tektronix, Inc.: PEX-SI API Binding change.
  58. |
  59. |      12/90            MFC Tektronix, Inc.: PEX-SI PEX5R1 Release.
  60. |
  61. \*--------------------------------------------------------------------*/
  62.  
  63. /*--------------------------------------------------------------------*\
  64. |    Table of Contents
  65. |
  66. |    int bif_defaultconfig()
  67. |        :    set the BIF defaultconfig configuration value
  68. |    int bif_colormodel(BIF_INT)
  69. |        :    set the BIF color_model configuration value
  70. |    int bif_colormode(BIF_INT)
  71. |        :    set the BIF color_mode configuration value
  72. |    int bif_buffermode(BIF_INT)
  73. |        :    set the BIF buffer_mode configuration value
  74. |
  75. \*--------------------------------------------------------------------*/
  76.  
  77. /*---------------------------------------------------------------------*\
  78. |    Include files 
  79. \*--------------------------------------------------------------------- */
  80. #include <stdio.h>
  81. #include "biftypes.h"
  82. #include "bifparse.h"
  83. #include "bifmacro.h"
  84. #include "globals.h"
  85. #include "ph_map.h"
  86. #include "brfexption.h"
  87. #define EXCEPTION_HANDLER 1
  88.  
  89. /*----------------------------------------------------------------------*\
  90. | Procedure    :    int bif_defaultconfig()
  91. |------------------------------------------------------------------------|
  92. | Description    :     set the BIF defaultconfig configuration value
  93. |
  94. |        This call is a configuration parameter setting routine.
  95. |        The system dependant calls are made in bif_openwk();
  96. |------------------------------------------------------------------------|
  97. | Return    :    Error Code
  98. \*----------------------------------------------------------------------*/
  99. int bif_defaultconfig()
  100. {
  101.  
  102. #ifdef TEST_PRINT
  103.     printf("DEFAULT CONFIGURATION : \n");
  104. #endif /* TEST_PRINT */
  105.     bif_colormodel(RGB);
  106.     bif_colormode(TRUE_COLOR);
  107.     bif_buffermode(DOUBLE_BUFFER);
  108.  
  109. } /* End procedure bif_defaultconfig */
  110.  
  111. /*----------------------------------------------------------------------*\
  112. | Procedure    :    int bif_colormodel(BIF_INT)
  113. |------------------------------------------------------------------------|
  114. | Description    :    set the BIF color_model configuration value
  115. |        color_model is one of: < RGB | CIE | HSV | HLS >
  116. |
  117. |        This call is a configuration parameter setting routine.
  118. |        The system dependant calls are made in bif_openwk();
  119. |------------------------------------------------------------------------|
  120. | Return    :    Error Code
  121. \*----------------------------------------------------------------------*/
  122. int bif_colormodel(color_model)
  123. BIF_INT color_model;
  124. {
  125.  
  126. #ifdef TEST_PRINT
  127.     printf("COLOR_MODEL : Set to %d\n",color_model);
  128. #endif /* TEST_PRINT */
  129.  
  130.     wk_info.color_model = REMAP_CMODEL(color_model);
  131. #ifdef USING_PHIGS
  132.     /* this should work correctly, but on our box does not seem to
  133.     work. */
  134. /* PEX Note:
  135.         This does work, the only problem exists when the first default
  136.         configuration is defined, PHIGS is not open. The correct thing
  137.         to do is test if the system is initialized before makeing calls
  138.         to PHIGS functions.
  139. #ifdef EXCEPTION_HANDLER
  140.     PLB_EXCEPTION(BIF_EX_NOCOLORMODL);
  141. #endif
  142. */
  143.  
  144.     if (wk_info.phigs_open) 
  145.         pset_colr_model((Pint)bench_setup.workid,
  146.                 (Pint)wk_info.color_model );
  147. #endif
  148. } /* End procedure bif_colormodel */
  149.  
  150. /*----------------------------------------------------------------------*\
  151. | Procedure    :    int bif_colormode(BIF_INT)
  152. |------------------------------------------------------------------------|
  153. | Description    :    set the BIF color_mode configuration value
  154. |        color_mode is one of: < PSEUDO_COLOR | TRUE_COLOR >
  155. |
  156. |        This call is a configuration parameter setting routine.
  157. |        The system dependant calls are made in bif_openwk();
  158. |------------------------------------------------------------------------|
  159. | Return    :    Error Code
  160. \*----------------------------------------------------------------------*/
  161. int bif_colormode(color_mode)
  162. BIF_INT color_mode;
  163. {
  164.  
  165. #ifdef TEST_PRINT
  166.     printf("COLOR_MODE : Set to %d\n",color_mode);
  167. #endif /* TEST_PRINT */
  168.     wk_info.color_mode = color_mode;
  169. } /* End procedure bif_colormode */
  170.  
  171. /*----------------------------------------------------------------------*\
  172. | Procedure    :    int bif_buffermode(BIF_INT)
  173. |------------------------------------------------------------------------|
  174. | Description    :    set the BIF buffer_mode configuration value
  175. |        buffer_mode is one of: < SINGLE_BUFFER | DOUBLE_BUFFER >
  176. |
  177. |        This call is a configuration parameter setting routine.
  178. |        The system dependant calls are made in bif_openwk();
  179. |------------------------------------------------------------------------|
  180. | Return    :    Error Code
  181. \*----------------------------------------------------------------------*/
  182. int bif_buffermode(buffer_mode)
  183. BIF_INT buffer_mode;
  184. {
  185.  
  186. #ifdef TEST_PRINT
  187.     printf("BUFFER_MODE : Set to %d\n",buffer_mode);
  188. #endif /* TEST_PRINT */
  189.     wk_info.buffer_mode = buffer_mode;
  190. } /* End procedure bif_buffermode */
  191.  
  192. int bif_window(x, y)
  193. BIF_INT x, y;
  194. {
  195. #ifdef TEST_PRINT
  196.     printf("WINDOW_SIZE : Set to %d %d\n",x,y);
  197. #endif /* TEST_PRINT */
  198.         wk_info.x = x;
  199.         wk_info.y = y;
  200. }
  201.