home *** CD-ROM | disk | FTP | other *** search
/ Vectronix 2 / VECTRONIX2.iso / FILES_01 / PC_V11_B.LZH / DEMO_PD / PCFRAME.C < prev    next >
C/C++ Source or Header  |  1991-08-02  |  6KB  |  149 lines

  1. /************************************************************************/
  2. /*                                                                      */
  3. /*       PCFRAME.C                                                      */
  4. /*                                                                      */
  5. /*       Programmsequenz zum Starten eines GEM-Programms.               */
  6. /*                                                                      */
  7. /*       Dieses oder ein ähnliches Programmgerüst leitet jedes GEM-     */
  8. /*       Programm ein.                                                  */
  9. /*       (In den weiteren GEM-Beispielen wird dieser Programmteil als   */
  10. /*       gegeben vorausgesetzt).                                        */
  11. /*                                                                      */
  12. /*       Copyright (c) 1989 Borland International.                      */
  13. /*       All rights reserved.                                           */
  14. /*                                                                      */
  15. /************************************************************************/
  16.  
  17. /* -------------------------------------------------------------------- */
  18. /*       include - Files einbinden.                                     */
  19. /* -------------------------------------------------------------------- */
  20.  
  21. #include <vdi.h>
  22. #include <aes.h>
  23. #include <stdio.h>
  24. #include <stdlib.h>
  25.  
  26. /* -------------------------------------------------------------------- */
  27. /*       Typendefinition.                                               */
  28. /* -------------------------------------------------------------------- */
  29.  
  30. typedef enum
  31.    {
  32.       FALSE,
  33.       TRUE
  34.    }
  35.       boolean;
  36.  
  37. /* -------------------------------------------------------------------- */
  38. /*       Globale Variablen.                                             */
  39. /* -------------------------------------------------------------------- */
  40.  
  41. int work_in[12],
  42.     work_out[57];
  43.  
  44. int handle,
  45.     phys_handle;
  46.  
  47. int gl_hchar,
  48.     gl_wchar,
  49.     gl_hbox,
  50.     gl_wbox;
  51.  
  52. int gl_apid;
  53.  
  54. /* ------------------------------------------------------------------- */
  55. /*    Funktionsprototypen.                                             */
  56. /* ------------------------------------------------------------------- */
  57.  
  58. boolean open_vwork( void );
  59. void    close_vwork( void );
  60. void    gem_prg( void );
  61.  
  62. /* -------------------------------------------------------------------- */
  63. /*       boolean open_vwork( void );                                    */
  64. /*                                                                      */
  65. /*       Workstation öffnen ...                                         */
  66. /*                                                                      */
  67. /*       ->                      Nichts.                                */
  68. /*                                                                      */
  69. /*       <-                      TRUE   falls das VDI initialisiert     */
  70. /*                                      werden konnte,                  */
  71. /*                               FALSE  sonst.                          */
  72. /* -------------------------------------------------------------------- */
  73.  
  74. boolean open_vwork( void )
  75. {
  76.    register int i;
  77.  
  78.    if (( gl_apid = appl_init() ) != -1 )
  79.    {
  80.       for ( i = 1; i < 10; work_in[i++] = 1 );
  81.       work_in[10] = 2;
  82.       phys_handle = graf_handle( &gl_wchar, &gl_hchar, &gl_wbox, &gl_hbox );
  83.       work_in[0]  = handle = phys_handle;
  84.  
  85.       v_opnvwk( work_in, &handle, work_out );
  86.  
  87.       return ( TRUE );
  88.    }
  89.    else
  90.       return ( FALSE );
  91. }
  92.  
  93. /* -------------------------------------------------------------------- */
  94. /*       void close_vwork( void );                                      */
  95. /*                                                                      */
  96. /*       ... und wieder schlie₧en.                                      */
  97. /*                                                                      */
  98. /*       ->                      Nichts.                                */
  99. /*                                                                      */
  100. /*       <-                      Nichts.                                */
  101. /* -------------------------------------------------------------------- */
  102.  
  103. void close_vwork( void )
  104. {
  105.    v_clsvwk( handle );
  106.  
  107.    appl_exit( );
  108. }
  109.  
  110. /* -------------------------------------------------------------------- */
  111. /*       void main( void )                                              */
  112. /*                                                                      */
  113. /*       Hier steht Ihr C-Programm!                                     */
  114. /*                                                                      */
  115. /*       ->                      Nichts.                                */
  116. /*                                                                      */
  117. /*       <-                      Programmendecode:                      */
  118. /*                                         0 fehlerfreier Ablauf        */
  119. /*                                        -1 Fehler in der Programm-    */
  120. /*                                           initialisierung            */
  121. /* -------------------------------------------------------------------- */
  122.  
  123. void main( void )
  124. {
  125.    if ( open_vwork( ) == TRUE )
  126.    {
  127.  
  128.       /* ================================ */
  129.       /* Fügen Sie Ihr Programm hier ein: */
  130.       /* -------------------------------- */
  131.  
  132.       gem_prg( );
  133.  
  134.       /* ================================ */
  135.  
  136.       close_vwork( );
  137.       exit ( 0 );
  138.    }
  139.    else
  140.    {
  141.       fprintf( stderr, "Fehler bei der Programminitialisierung!" );
  142.       exit ( -1 );
  143.    }
  144. }
  145.  
  146. /* -------------------------------------------------------------------- */
  147. /*       Ende des GEM-Programmgerüsts.                                  */
  148. /* -------------------------------------------------------------------- */
  149.