home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 13 / 13.iso / s / s001 / 1.ddi / PFC / SRC / WNDSTART.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-02-19  |  2.5 KB  |  141 lines

  1. /* (c) 1985, Phoenix Computer Products Corp. and Novum Organum, Inc. */
  2. /***
  3. *        Name: wndstart -- start up the window system
  4. *
  5. *    Synopsis: int rc, wndstart();
  6. *              rc = wndstart();
  7. *
  8. * Description: Starts up the window system.
  9. *
  10. *     Returns: RC_SUCCESS or RC_FAIL.
  11. *
  12. * (C) Novum Organum, Inc. 1985
  13. *
  14. ***/
  15.  
  16. #define char8    unsigned char            /* unsigned char       */
  17.  
  18. #include "pdefs.h"
  19. #include "psys.h"
  20. #include "pcterm0.h"
  21.  
  22. static  HDL _base, _h_isr;
  23. static  int _been_here=NO;
  24.  
  25. #define MAXNROWS    25
  26. #define MAXNCOLS    80
  27.  
  28. int wndstart(void)
  29. {
  30.     HDL     wndist(), wndsetactv(), syisrist();
  31.     int     _wdsp();
  32.     int     rc, wndstop(), wint();
  33.  
  34.     rc = RC_FAIL;
  35.  
  36.     if  ( _been_here == NO )
  37.         {
  38.         wupdinit();
  39.         wminit(MAXNROWS, MAXNCOLS);
  40.         wintinit();
  41.         _been_here = YES;
  42.         _sywndjmpset ( wndstop );
  43.  
  44.         _base = wndist(0,0,MAXNROWS,MAXNCOLS,vstgetcur());
  45.         if  ( _base )
  46.             {
  47.             wndsetactv(_base);
  48.             _h_isr = syisrist( V_VID_INTRPT, wint );
  49.             wndreset();
  50.             _vdspsetdsp( _wdsp );
  51.             rc = RC_SUCCESS;
  52.             }
  53.         else
  54.             wndstop();
  55.         wndsetupd( YES );
  56.         }
  57.     return  ( rc );
  58. }
  59.  
  60. _wndstarted()
  61. {
  62.    return(_been_here);
  63. }
  64.  
  65. /***
  66. * Name:         wndstop -- shut down window system
  67. *
  68. * Synopsis:     void    wndstop();
  69. *               wndstop();
  70. *
  71. * Description:  closes up window system
  72. *
  73. * Returns:      nothing
  74. *
  75. * (C) Novum Organum, Inc. 1985
  76. *
  77. ***/
  78.  
  79. /*VOID*/wndstop()
  80. {
  81.     int     _vdsp();
  82.     HDL     h_top, _wndtop();
  83.  
  84.     if  (_been_here)
  85.     {
  86.         _been_here = NO;
  87.         syisrrls( _h_isr );
  88.         _sywndjmpset ( NULLPFI );
  89.         wndsetupd( NO );
  90.  
  91.         wndtobot(_base);
  92.  
  93.         while   ((h_top = _wndtop()))
  94.             wndrls(h_top);
  95.  
  96.         wmdone();
  97.  
  98.         _vdspsetdsp( _vdsp );
  99.         vidsetloc( 23, 0 );
  100.     }
  101. }
  102.  
  103. HDL wndhbase()
  104. {
  105.     return  ( _base );
  106. }
  107.  
  108.  
  109. static int WND_stat = 0;
  110.  
  111.  
  112.  
  113. WND_ON(struct pc_term *PTERM)
  114. {
  115.   int wint(), _wdsp();
  116.  
  117.   if (_been_here == YES)
  118.   {
  119.     PTERM->WINDOW    = WND_stat;
  120.     PTERM->TLINIT    = 1;
  121.     _h_isr = syisrist( V_VID_INTRPT, wint );
  122.     _vdspsetdsp( _wdsp );
  123.   }
  124. }
  125.  
  126.  
  127.  
  128. WND_STP(struct pc_term *PTERM)
  129. {
  130.    int _vdsp();
  131.  
  132.   if (_been_here == YES && PTERM->TLINIT)
  133.   {
  134.     WND_stat         = PTERM->WINDOW;
  135.     PTERM->WINDOW    = 0;
  136.     PTERM->TLINIT    = 0;
  137.     syisrrls( _h_isr );
  138.     _vdspsetdsp( _vdsp );
  139.   }
  140. }
  141.