home *** CD-ROM | disk | FTP | other *** search
/ Kyūkyoku!! X68000 Emulator / X68000Book.dat / mac / OLS / X68000 / Ko-Window / kow142s.lzh / wsrv / wsrv.c < prev    next >
C/C++ Source or Header  |  1996-09-07  |  15KB  |  629 lines

  1. #include    <stdio.h>
  2. #include    <iocslib.h>
  3. #include    <microfio.h>
  4. #include    <microstr.h>
  5.  
  6. #include    "clip.h"
  7. #include    "slider.h"
  8. #include    "window.h"
  9. #include    "simple.h"
  10. #include    "title.h"
  11. #include    "scroll.h"
  12. #include    "manager.h"
  13. #include    "stack.h"
  14. #include    "error.h"
  15. #include    "screen.h"
  16. #include    "readrc.h"
  17. #include    "exec.h"
  18. #include    "kanji.h"
  19. #include    "resource.h"
  20. #include    "corfunc.h"
  21. #include    "process.h"
  22.  
  23. #include    "id.h"
  24.  
  25. /* âTü[âoü[é╠è╓Éöé≡ègÆúé╡é╜éΦüAâtâ@âôâNâVâçâôâRü[âïé≡Æ╟ë┴é╡é╜éΦüAâVâXâeâÇé╔
  26. ÄΦé≡ôⁿéΩéΘÉlé¬âfâoâbâOé╖éΘÅΩìçé╔òKùvé╚âTü[âoü[é≡ì∞éΘÄ₧1é╔é╖éΘ 1995 11/20 COR.*/
  27. #define        SYSTEM_DEBUG        0
  28. /* é▒éΩ鬠0 é╛é╞üAâVâXâeâÇé╠âfâoâbâOé≡é╖éΘé╜é▀é╠âïü[â`âôé≡ĵéΦÅ£é¡üBâAâvâè
  29. âPü[âVâçâôé╠âfâoâbâOÄ₧é╔é═òsùp */
  30.  
  31. #define        LIBRARY_OLD_ID        20
  32. #define        LIBRARY_NEW_ID        26
  33. #define        PROCESS_NOMAL        0
  34. #define        PROCESS_INIT        1
  35. #define        PROCESS_QUIT        2
  36.  
  37. typedef    enum {
  38.         SignalOpen,
  39.         SignalKill,
  40.         SignalChildKill,
  41.     }
  42.         SignalCode;
  43.  
  44. typedef    struct    {
  45.         unsigned char    *Entry;
  46.         int                Status;
  47.         int                Parent;
  48.         unsigned char    *PSP;
  49.         int                Level;
  50.         int                HeapSize;
  51.         unsigned char    *Heap;
  52.         unsigned char    *SignalEntry;
  53.     }
  54.         ProcessInfo;
  55.  
  56. int        StackTop;
  57. int        WindowLines= 64    /*32*/;        /*âfâtâHâïâgé≡ëµû╩âTâCâYì┼æσé╔ COR.*/
  58. int        WindowColumns= 128    /*96*/;
  59. int        KeepLevel= 1;
  60. int        InChildFlag= FALSE;
  61. int        DebugMode= 0;
  62. int        BGmode= FALSE;
  63. int        GraphicLock= FALSE;
  64. int        BreakMode;
  65.  
  66. extern unsigned    int    _PSP;
  67.                         /* 1993,94,95 COR. */
  68. static unsigned char    *Version= "2.24+14.2"
  69. #if X30
  70.                         " 030ÉΩùp"
  71. #endif
  72.                         ;
  73.  
  74. static    int            DefaultVector;
  75.         int            DefaultErrorEntry;    /* 1993 Taka2 */
  76.         int            DefaultAbortEntry;    /* 1995 COR. */
  77. static    int            NewProcess ;
  78. static    ProcessInfo    Process[MAXPROCESS];
  79.  
  80. static    unsigned char    *EventName[]= {
  81.                     "EventOpen",
  82.                     "EventRedraw",
  83.                     "EventClose",
  84.                     "EventPop",
  85.                     "EventPush",
  86.                     "EventMove",
  87.                     "EventResize",
  88.                     "EventIconify",
  89.                     "EventZoom",
  90.                     "EventScroll",
  91.  
  92.                     "EventMouseSwitch",
  93.                     "EventMouseMove",
  94.                     "EventMouseEnter",
  95.                     "EventMouseOut",
  96.                     "EventKey",
  97.                     "EventInterval",
  98.                     "EventNon",
  99.                     "EventUser",
  100.                     "EventGraphic",
  101.                 };
  102.  
  103. static unsigned char    *SignalName[]= {
  104.                     "Open",
  105.                     "Kill",
  106.                     "ChildKill",
  107.                 };
  108.  
  109. extern    Sheet        *BackPattern;
  110. extern    int            _SSTA, _SEND, _HEND;
  111.  
  112. #if SUP
  113. int        _HeapSizeX= 1024*64,
  114.         _StackSizeX= 1024*64;
  115. #endif
  116.  
  117. #define    DEBUG    0
  118. #if DEBUG
  119. DEBUGPUT(a,b,c,d,e,f,g)
  120. {
  121.     char    buf[96];
  122.     s_format( buf, a, b, c, d, e, f, g );
  123.     B_PUTMES( 3, 0, 30, 80, buf );
  124. }
  125. #else
  126. # define    DEBUGPUT
  127. #endif
  128.  
  129. /*
  130.     proto wsrv.c > temp
  131. */
  132. int        main( int, unsigned char*[] );
  133. void    CommandExec( unsigned char* );
  134. int        CallClient( int, int(*)(), WindowClass*, EventInfo* );
  135. int        GetRequest( int, int, int* );
  136. void    TopLevelExec( void );
  137. unsigned char    *WindowGetVersion( void );
  138. void    WindowSetSingal( int, int );
  139. int        WindowSendSignal( int, int, void* );
  140. ProcessInfo    *WindowGetProcessInfo( int );
  141. static    int        SignalExec( int, unsigned char* );
  142. void    ServerQuit( void );
  143.  
  144. /*    wsrvasm.c    */
  145. extern    void    ServerFree();
  146. extern    void    IntEntry(void), IntEntry000(void), IntEntry030(void);
  147. extern    int        _CallClient( unsigned char*, int(*)(), WindowClass*, EventInfo* );
  148. extern    void    EventWaitLoop( void );
  149. /*externint        CallFunction( int, int(*)(), int, int, int* );*/
  150. extern    int        CallFunction( int, int*, int(*)(), int );
  151.  
  152. /*    open.c    */
  153. extern    WindowClass    *WindowOpen( int, int, int, int, int, WindowClass*, int(*)() );
  154. extern    SimpleClass    *SimpleOpen( int, int, int, int, int, WindowClass*, int(*)() );
  155. extern    TitleClass    *TitleOpen( int, int, int, int, int, WindowClass*, unsigned char*, int, int(*)() );
  156. extern    ScrollClass    *ScrollOpen( int, int, int, int, int, WindowClass*, int, int, int, int, int, int(*)() );
  157. extern    void    SelectResize( WindowClass*, int, int, int, int );
  158. extern    void    SelectScroll( WindowClass*, int, int );
  159. extern    void    *WindowSetManagerExec( int, int, void* );
  160.  
  161.  
  162. extern HfontCheck();
  163.  
  164. #include "func.h"
  165.  
  166.  
  167. int
  168. main( argc, argv )
  169. int                argc;
  170. unsigned char    **argv;
  171. {
  172.     extern int    ScreenMode;
  173.     extern char    initNameX[];
  174.     int        i;
  175.     int        gvclr= FALSE;
  176.  
  177. #if 0    /* é▒éΩé╞ô»é╢éαé╠é≡ gcc é¬ûäé▀ì₧é±é┼é¡éΩéΘ */
  178. # if X30
  179.     if( !B_BPEEK( 0xcbc ) ){
  180.         errput( "68000 é┼é═ïNô«é┼é½é▄é╣é±\n" );
  181.         EXIT2( 1 );
  182.     }
  183. # endif
  184. #endif
  185.  
  186.     *initNameX= '\0';
  187.     BGmode= B_LPEEK( (void*)0x1c50 );
  188.  
  189.     /*  âIâvâVâçâôé╠Åêù¥  */
  190.     for( i= 1 ; i < argc ; i++ ){
  191.         if( argv[i][0] == '-' ){
  192.             switch( argv[i][1]|0x20 ){
  193.                 case 'd':
  194.                     DebugMode= argv[i][2]&7;
  195.                     break;
  196.                 case 'f':    /* force optiron by COR.*/
  197.                     TGUSEMD( 1, 0 );
  198.                     TGUSEMD( 0, 0 );
  199.                     break;
  200.                 case 'c':
  201.                     gvclr= TRUE;
  202.                     break;
  203.                 case 'g':
  204.                     GraphicLock= TRUE;
  205.                     break;
  206.                 case 's':
  207.                     ScreenMode= argv[i][2]&7;
  208.                     break;
  209.                 case 'b':
  210.                     if( argv[i][2] == '0' )
  211.                         BGmode= FALSE;
  212.                     break;
  213.                 case 'i':
  214.                     s_strcpy( initNameX, argv[i]+2 );
  215.                     break;
  216.                 case 'e':    /* è┬ï½é╠ì∞ɼ */
  217.                     {
  218.                         int        *olde= *((int**)_PSP), *newe;
  219.                         int        envsize= _atoiX( argv[i]+2 );
  220.                         if( (int)olde > 0 && envsize < *olde )
  221.                             envsize= *olde+1024;
  222.                         newe= WindowMemoryAlloc( envsize );
  223.                     /* é╜é╛é╠mallocé╚é╠é┼â}âlü[âWââü[Åëè·ë╗æOé╔î─é±é┼éαéµéó */
  224.                         if( newe ){
  225.                             *((int**)_PSP)= newe;
  226.                             if( (int)olde > 0 ){
  227.                                 s_memcpy_simple( envsize, newe, olde );
  228.                             }else{
  229.                                 newe[1]= 0;
  230.                             }
  231.                             *newe= envsize;
  232.                         }
  233.                     }
  234.                     break;
  235.                 default:
  236.                     errput("X68k Window Server Version " );
  237.                     errput( Version );
  238.                     errput( "\nusage: wsrv [<switch>] [<prog>..]\n"
  239.                             " -d<n>\tDebug Mode(1:stack,3:debug,7:trace)\n"
  240.                             " -s<n>\tScreen Mode\n"
  241.                             " -b0\tBG-modeï¡ÉºOFFÄwÆΦ\n"
  242.                             " -c\tGRAPHICëµû╩é≡Å┴ïÄé╡é─é⌐éτïNô«\n"
  243.                             " -g\tGRAPHICëµû╩é≡ÄgùpÆåé╞é╡é─âìâbâNé╡é─ïNô«\n"
  244.                             " -f\tGRAPHIC/TEXTÄgùpÆåé┼éαï¡ÉºïNô«\n"
  245.                             " -i<fn>\tâTü[âoü[É▌ÆΦâtâ@âCâïû╝é≡ù^éªéΘ\n"
  246.                             " -e<n>\tENVé≡ô╞Ä⌐é╔ì∞ɼé╖éΘ\n"
  247.                             " --h<n>\tHEAPâTâCâYé≡ÄwÆΦ(KbyteÆPê╩)\n"
  248.                             );
  249.                     return    1;
  250.             }
  251.         }
  252.     }
  253.  
  254.     {
  255.         int    i;
  256.         if( TGUSEMD( 1, -1 ) == 2 ){    /* 1991 COR. */
  257.             errput( "TEXT" );
  258.             goto    err_exit;
  259.         }else if( (i= TGUSEMD( 0, -1 )) == 1 || i == 2 ){
  260.             errput( "GRAPHIC" );
  261.         err_exit:
  262.             errput( "ëµû╩ÄgùpÆåé┼é╖\n" );
  263.             return    1;
  264.         }
  265.     }
  266.     if( gvclr )
  267.         G_CLR_ON();
  268.  
  269. #if 0
  270.     if( !HfontCheck( _PSP-16 ) ){
  271.         int    i= ONTIME()+20;
  272.         errput( "hfont é¬ÅφÆôé╡é─éóé▄é╣é±\n" );
  273.         for(; ONTIME() < i ;);
  274.     }
  275. #endif
  276.  
  277. #if SYSTEM_DEBUG
  278.     /*  func.h é╠â`âFâbâN  */
  279.     for( i= 0 ; i <= FunctionEnd ; i++ ){
  280. #if 0
  281. sprintf( buf, "%x %s %d, %d\n", &FunctionList[i],
  282.             FunctionList[i].name, FunctionList[i].funcid, i );
  283. #endif
  284.         if( FunctionList[i].funcid != i ){
  285.             errput( "è╓ÉöâèâXâgé╠ÆΦï`é╔îδéΦé¬éáéΦé▄é╖\n" );
  286.             return( 1 );
  287.         }
  288.     }
  289. #endif
  290.  
  291.     /*  ÆΦÉöé╠Åëè·ë╗  */
  292.     WindowError= ServerError;
  293.     SendEventExec= CallClient;
  294.     StackTop= _SSTA;
  295. #if !X30
  296.     if( !B_BPEEK( (void*)0xcbc ) ){    /* 68000 é╠ÅΩìçâpâbâ`éáé─ */
  297.         _SetSuper();
  298.         DefaultVector= INTVCS( 0x20, (char*)IntEntry000 );
  299.     }else
  300. #endif
  301.         DefaultVector= INTVCS( 0x20, (char*)IntEntry030 );
  302.     DefaultErrorEntry= INTVCS( 0x2E, (char*)ErrorEntry );
  303.     Process[0].PSP= (unsigned char*)_PSP;
  304.  
  305.     /* BREAK check KILL */
  306.     BreakMode= BREAKCK( -1 );
  307.     BREAKCK( 2 );
  308.     if( (VERNUM() & 0xffff) >= 0x0300 )
  309.         BREAKCK( 0x300 );        /* kill ^p!  -- Human v3 only */
  310.  
  311.     /*  ÆΦÉöé╠Åëè·ë╗üi WSRV.RC éµéΦ üj  */
  312.     ReadRC();
  313.     ReadInit();
  314.  
  315.     /*  âèâ\ü[âXé╠ô╟é▌ì₧é▌  */
  316.     ReadResource();
  317.  
  318.     /*  âEâCâôâhâEâ}âlü[âWââé╠Åëè·ë╗  */
  319.     ManagerInit( WindowLines, WindowColumns );
  320.  
  321.     {    /* 1991 COR. */
  322.         extern    GotoTopLevel();
  323. /*        extern    KeyCtrlVect;*/
  324.         DefaultAbortEntry= INTVCS( 0xfff2, GotoTopLevel );
  325. /*        KeyCtrlVect= INTVCS( 0xff60, INTVCG( 0xff24 ) );    KeyCtrl*/
  326.     }/* é▒éΩé═âEâBâôâhâEûêé╠BGâXâîâbâhÉ╪éΦæ╓éªé┼âLü[ôⁿù═é≡âTâ|ü[âgé╡éµéñé╞é╡
  327.     é╜Ä₧é╠û╝ÄcüBè╓ÿAâRü[âhé═ getevent.s é╔éáéΘ COR. */
  328.  
  329.     if( DebugMode & DebugWindowOn )
  330.         EventStackOpen( 768-320, 512-180, 300, 160 );
  331.  
  332.     /*  WSRV.RC é╠ô╟é▌ì₧é▌üiïñùLù╠êµé╓üj  */
  333. /*    ReadRC();    */
  334.  
  335.     /*  ïNô«Ä₧âAâvâèâPü[âVâçâôé╠Ä└ìs  */
  336.     ReadExec();
  337.     for( i= 1 ; i < argc ; i++ ){
  338.         if( argv[i][0] != '-' )    /* 1991 COR. */
  339.             CommandExec( argv[i] );
  340.     }
  341.  
  342.     /*  ïNô«âAâvâèâPü[âVâçâôé╠â`âFâbâN  */
  343.     for( i= 0 ; i < MAXPROCESS ; i++ ){
  344.         if( Process[i].Entry && Process[i].Level <= KeepLevel ){
  345.                 break;
  346.         }
  347.     }
  348.     if( i == MAXPROCESS )
  349.         SignalExec( SignalKill, NULL );
  350.     else
  351.         EventWaitLoop();
  352.  
  353. /*    return    1;        é▒é▒é╔é═é▒é╚éó COR. */
  354. }
  355.  
  356. void
  357. CommandExec( ptr )    /* 1991,1995 COR. */
  358. unsigned char    *ptr;
  359. {
  360.     unsigned char    file[256], *s= file;
  361.     int                dot= 0;
  362.     for(; *ptr > ' ' ;)
  363.         if( (*s++= *ptr++) == '.' )
  364.             dot= 1;
  365.     *s= '\0';
  366.     if( !dot )
  367.         s_strcpy( s, ".win" );
  368.     WindowLoadExec( file, ptr, NULL, NULL );
  369. }
  370.  
  371. int
  372. CallClient( id, exec, wp, info )
  373. int            id;
  374. int            (*exec)();
  375. WindowClass    *wp;
  376. EventInfo    *info;
  377. {
  378.     int        ret;
  379.  
  380.     if( Process[id].Entry && exec ){
  381.         EventStackPush( TypeEvent, id, EventName[info->option], wp );
  382.         ret= _CallClient( Process[id].Entry, exec, wp, info );
  383.         EventStackPop();
  384.         return    ret;
  385.     }
  386.     return    FALSE;
  387. }
  388.  
  389. int    /* 1995 COR.*/
  390. GetRequest( id, func, para )
  391. int        id, func;
  392. int        *para;
  393. {
  394.     FunctionAttr    *fap;
  395.  
  396.     if( func < 0 || FunctionEnd <= func )
  397.         ServerError( "è╓ÉöIDé¬òsÉ│é┼é╖" );
  398.  
  399.     fap= FunctionList+ func;
  400.     EventStackPush( TypeRequest, id, fap->name, NULL );
  401.  
  402.     if( fap->function ){    /* âIü[âoü[âwâbâhé╠îyî╕ */
  403.         int    ret;
  404.         if( id <= 0 || MAXPROCESS <= id || Process[id].Entry == NULL ){
  405.             char    buf[30];
  406. /*s_strnum( id, buf );
  407.             ServerError( buf );*/
  408.             ServerError( "ProcessIDé¬òsÉ│é┼é╖" );
  409.         }
  410. #if SYSTEM_DEBUG
  411.         if( (fap->args>>8) != para[0] )
  412.             ServerError( "è╓Éöé╠âpâëâüü[â^é¬òsÉ│é┼é╖" );
  413. #endif
  414. /*        ret= CallFunction( fap->processflag, fap->function,
  415.                                     id, para[0], para+1 );*/
  416.         ret= CallFunction( fap->args, para, fap->function, id );
  417.         EventStackPop();
  418.         return    ret;
  419.     }else{
  420.         if( func == WindowConnectionOpenID ){
  421.             int    i;
  422.             if( para[1] < LIBRARY_OLD_ID || LIBRARY_NEW_ID < para[1] ){
  423.                 errput( "WindowServeré╠Versioné¬êßéóé▄é╖\n" );
  424.                 EXIT2( 1 );
  425.             }
  426.             for( i= 1 ; i < MAXPROCESS ; i++ ){
  427.                 if( Process[i].Entry == NULL )
  428.                     break;
  429.             }
  430.             if( i == MAXPROCESS ){
  431.                 errput( "âvâìâZâXé¬æ╜é╖é¼é▄é╖\n" );    /* 1991 COR. */
  432.                 EXIT2( 1 );
  433.             }
  434.             Process[i].Entry = (unsigned char*)para[0];
  435.             Process[i].Status= PROCESS_INIT;
  436.             Process[i].Parent= 0;
  437.             Process[i].PSP= (unsigned char*)para[2];
  438.             Process[i].Level= para[3];
  439.             Process[i].HeapSize= para[4];
  440.             Process[i].Heap= (unsigned char*)para[5];
  441.             NewProcess= i;
  442.             para[2]= (int)( &RootWindow );
  443.             para[3]= (int)GetBackPattern();
  444.             EventStackPop();
  445.             return    i;
  446.         }
  447.  
  448.         if( id <= 0 || MAXPROCESS <= id || Process[id].Entry == NULL )
  449.             ServerError( "ProcessIDé¬òsÉ│é┼é╖" );
  450.  
  451.         {
  452.             WindowClass        *wp;
  453.             EventInfo        info;
  454.             int            ret= TRUE;
  455.  
  456.             switch( func ){
  457.             case WindowConnectionCloseID:
  458.                 info.option= EventClose;
  459.                 WindowSendEventAll( id, &info );
  460.                 Process[id].Status= PROCESS_QUIT;
  461.                 RootEventExec[id]= NULL;
  462.                 break;
  463.             case WindowCloseID:
  464.                 wp= (WindowClass*)( para[1] );
  465.                 WindowClose( wp );
  466.                 break;
  467.             case WindowLoadExecID:
  468.                 NewProcess= 0;
  469.                 EventStackPush( TypeExec, 0, (unsigned char*)para[1], NULL );
  470.                 InChildFlag= TRUE;
  471.                 BREAKCK( BreakMode );
  472.                 ret= WindowLoadExec( (unsigned char*)para[1],
  473.                                 (unsigned char*)para[2],
  474.                                 (unsigned char*)para[3], (void(*)())para[4] );
  475.                 BREAKCK( 2 );    /* BREAK KILL */
  476.                 InChildFlag= FALSE;
  477.                 EventStackPop();
  478.                 if( NewProcess > 0 )
  479.                     Process[NewProcess].Parent= id;
  480.                 break;
  481.             }
  482.             EventStackPop();
  483.             return    ret;
  484.         }
  485.     }
  486. }
  487.  
  488. void
  489. TopLevelExec()
  490. {
  491.     int        i;
  492.     for( i= 0 ; i < MAXPROCESS ; i++ ){
  493.         switch( Process[i].Status ){
  494.             case PROCESS_INIT:
  495.                 Process[i].Status= PROCESS_NOMAL;
  496.                 WindowSendSignal( i, SignalOpen, NULL );
  497.                 break;
  498.             case PROCESS_QUIT:
  499.                 if( Process[i].Parent != 0 )
  500.                     WindowSendSignal( Process[i].Parent, SignalChildKill,NULL);
  501.                 if( Process[i].HeapSize )
  502.                     MFREE( (void*)Process[i].Heap );
  503.                 MFREE( (void*)Process[i].PSP );
  504.                 Process[i].Entry= NULL;
  505.                 Process[i].Parent= (int)NULL;
  506.                 Process[i].PSP= NULL;
  507.                 Process[i].SignalEntry= NULL;
  508.                 {
  509.                     int    j;
  510.                     for( j= 0 ; j < MAXPROCESS ; j++ ){
  511.                         if( Process[j].Entry != NULL ){
  512.                             if( Process[j].Level <= KeepLevel )
  513.                                 break;
  514.                         }
  515.                     }
  516.                     if( j == MAXPROCESS )
  517.                         SignalExec( SignalKill, NULL );
  518.                 }
  519.                 Process[i].Status= PROCESS_NOMAL;
  520.                 break;
  521.         }
  522.     }
  523. }
  524.  
  525. unsigned char *
  526. WindowGetVersion()
  527. {
  528.     return    Version;
  529. }
  530.  
  531. void
  532. WindowSetSingal( id, entry )
  533. int        id;
  534. int        entry;
  535. {
  536.     Process[id].SignalEntry= (unsigned char*)entry;
  537. }
  538.  
  539. int
  540. WindowSendSignal( id, code, buf )
  541. int        id;
  542. int        code;
  543. void    *buf;
  544. {
  545.     int        ret;
  546.  
  547.     if( id < 0 || MAXPROCESS <= id )
  548.         return    FALSE;
  549.  
  550.     EventStackPush( TypeSignal, id, SignalName[code], buf );
  551.  
  552.     if( id == 0 ){
  553.         ret= SignalExec( code, buf );
  554.     }else if( Process[id].Entry && Process[id].SignalEntry ){
  555.         ret = _CallClient( Process[id].Entry,
  556.                             (int(*)())Process[id].SignalEntry,
  557.                             (WindowClass*)code, buf );
  558.     }else
  559.         ret= FALSE;
  560.  
  561.     EventStackPop();
  562.     return    ret;
  563. }
  564.  
  565. ProcessInfo    *
  566. WindowGetProcessInfo( id )
  567. int        id ;
  568. {
  569.     if( 0 <= id && id < MAXPROCESS )
  570.         return    Process + id;
  571.     return    NULL;
  572. }
  573.  
  574. static int
  575. SignalExec( code, buf )
  576. int                code;
  577. unsigned char    *buf;
  578. {
  579.     int        i;
  580.  
  581.     if( code == SignalKill ){
  582.         for( i= 1 ; i < MAXPROCESS ; i++ ){
  583.             if( Process[i].Entry != NULL )
  584.                 WindowSendSignal( i, SignalKill, NULL );
  585.         }
  586.         ManagerQuit();
  587.         ServerQuit();
  588.     }
  589.     return    FALSE;
  590. }
  591.  
  592. void
  593. ServerQuit()
  594. {
  595.     int        i;
  596.  
  597.     KanjiQuit();
  598.     for( i= 1 ; i < MAXPROCESS ; i++ ){
  599.         if( Process[i].PSP != NULL ){
  600.             if( Process[i].HeapSize )
  601.                 MFREE( (void*)Process[i].Heap );
  602.             MFREE( (void*)Process[i].PSP );
  603.         }
  604.     }
  605.     ScreenQuit();
  606.  
  607.     INTVCS( 0x20, (char*)DefaultVector );
  608.     INTVCS( 0x2E, (char*)DefaultErrorEntry );
  609.     BREAKCK( BreakMode );
  610.  
  611.     errput( "X68k Window Server Version " );
  612.     errput( Version );
  613.     errput( "\nCopyright (C) T.Kobayashi 1990, 1991.  All rights reserved.\n"
  614.              " Modified 1991-1996 by H.Ogasawara\n" );
  615.     EXIT2( 0 );
  616. }
  617.  
  618. void
  619. errput(str)
  620. unsigned char    *str;
  621. {
  622.     for(; *str ; str++ ){
  623.         if( *str == '\n' )
  624.             FPUTC( '\r', 2 );
  625.         FPUTC( *str, 2 );
  626.     }
  627. }
  628. /* :vi:se ts=4 sw=4: */
  629.