dillon@CORY.BERKELEY.EDU (Matt Dillon) (03/15/87)
The first MWB I posted doesn't support interlace screens. Since many of you use interlace screens, I figured it might be a good idea to support them. You can now completely control the characteristics of your secondary workbench screen... even make it Lo-Res if you want. E.G. if you normally use a non-interlace display, you can make the secondary screen an interlace one... I also cleaned up the documentation a bit -Matt #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create: # mwb.c # mwb.doc # mwb.h # mwb.uue # mwb_resident.c # mwb_resident.uue # This archive created: Sun Mar 15 12:17:01 1987 export PATH; PATH=/bin:/usr/bin:$PATH if test -f 'mwb.c' then echo shar: "will not over-write existing file 'mwb.c'" else cat << \SHAR_EOF > 'mwb.c' /* * Multi-WorkBench-Screens program. * * (c) 1987 Matthew Dillon, All rights reserved * Freely Distributable. * * AZTEC only, must compile with +L option. MWB_RESIDENT must be compiled * with +BCDL options. * * See MWB.DOC for more information. */ #include "mwb.h" #include <intuition/intuition.h> typedef struct Screen SCR; typedef struct Task TASK; extern XPORT *getport(); extern XPORT *init_mwb(); long IntuitionBase; main(ac, av) char *av[]; { register int i; register char *ptr; register XPORT *xport; XIT xit; int val; char hset, wset; char err = (ac == 1); if (xport = (XPORT *)FindPort(PORT_NAME)) { xit.screen = 0; xit.scrmodes= xport->xit[0].scrmodes; xit.width = xport->xit[0].width; xit.height = xport->xit[0].height; xit.depth = xport->xit[0].depth; xit.flags = 0; } hset = wset = 0; for (i = 1; !err && i < ac; ++i) { ptr = av[i]; if (*ptr) val = atoi(ptr+1); switch(*ptr) { case 'i': if ((xport = (XPORT *)FindPort(PORT_NAME)) && xport->segment) { puts ("MWB already initialized"); break; } xport = (XPORT *)init_mwb(); xit.scrmodes= xport->xit[0].scrmodes; xit.width = xport->xit[0].width; xit.height= xport->xit[0].height; xit.depth = xport->xit[0].depth; operation(getport(), OP_STARTUP, 0, &xit); break; case 'u': if ((xport = FindPort(PORT_NAME)) == NULL || xport->segment == 0) { puts ("MWB does current exist"); break; } uninit_mwb(xport); break; case 'n': operation(getport(), OP_NEWSCREEN, 0, &xit); break; case 'c': operation(getport(), OP_CLOSEUNUSED, 0, &xit); break; case 'd': if (val > 0) xit.depth = val; else puts ("bad depth"); break; case 'w': if ((val % 16) == 0 && val > 32) { xit.width = val; wset = 1; } else { puts ("bad width"); } break; case 'h': if (val > 32) { xit.height = val; hset = 1; } else { puts ("bad height"); } break; case 'I': if (!(xit.scrmodes & LACE)) { xit.scrmodes |= LACE; if (!hset) xit.height <<= 1; } break; case 'N': if (xit.scrmodes & LACE) { xit.scrmodes &= ~LACE; if (!hset) xit.height >>= 1; } break; case 'L': if (xit.scrmodes & HIRES) { xit.scrmodes &= ~HIRES; if (!wset) xit.width >>= 1; } break; default: if (*ptr < '0' || *ptr > '9') { err = 1; break; } operation(getport(), OP_SETSCREEN, atoi(ptr), &xit); break; } } if (err) { puts ("MWB [i/u/c]"); puts ("MWB #"); puts ("MWB [L] [N] [I] [h#] [w#] [d#] n"); puts ("MWB V1.01 (c) 1987 Matthew Dillon, All Rights Reserved"); puts ("MWB is freely redistributable"); } } /* * Send the operation message to the task. */ operation(taskport, com, screen, xit) PORT *taskport; XIT *xit; { XMSG xmsg; PORT *port = CreatePort(NULL, 0); long scr; xmsg.msg.mn_Node.ln_Type = NT_MESSAGE; xmsg.msg.mn_Node.ln_Pri = 0; xmsg.msg.mn_Node.ln_Name = NULL; xmsg.msg.mn_ReplyPort = port; xmsg.msg.mn_Length = sizeof(XMSG); xmsg.com = com; xmsg.screeno = screen; xmsg.xit = *xit; PutMsg(taskport, &xmsg); WaitPort(port); scr = GetMsg(port); DeletePort(port); return(xmsg.com); } /* * Initialize MWB by LoadSeg'ing "mwb_resident" and CreateTask()ing the * code. mwb_resident will then create the global port. * */ XPORT * init_mwb() { long segment; char *ptr; register XPORT *xport; register SCR *wscr; register TASK *task; char addit = 0; segment = LoadSeg("mwb_resident"); if (!segment) { segment = LoadSeg("c:mwb_resident"); if (!segment) { puts ("Cannot find 'mwb_resident'"); exit(1); } } IntuitionBase = OpenLibrary("intuition.library", 0); if (IntuitionBase == 0) { puts ("Unable to open intuition"); UnLoadSeg(segment); exit(1); } xport = FindPort(PORT_NAME); if (xport) { puts ("Re-Linking"); } else { addit = 1; ptr = (char *)AllocMem(strlen(PORT_NAME)+1, MEMF_PUBLIC); xport = (XPORT *)AllocMem(sizeof(XPORT), MEMF_PUBLIC|MEMF_CLEAR); strcpy(ptr, PORT_NAME); strcpy(xport->scrname, SCREEN_NAME); strcpy(xport->taskname,TASK_NAME); xport->xit[0].screen = wscr = OpenWorkBench(); xport->xit[0].scrmodes = wscr->ViewPort.Modes; xport->xit[0].width = wscr->Width; xport->xit[0].height = wscr->Height; xport->xit[0].depth = wscr->BitMap.Depth; xport->xit[0].flags = FL_NOREMOVE|FL_DEFINED; NewList(&xport->port.mp_MsgList); xport->port.mp_Node.ln_Type = NT_MSGPORT; xport->port.mp_Node.ln_Pri = 0; xport->port.mp_Node.ln_Name = ptr; } xport->segment = segment; task = CreateTask(xport->taskname, 0, (segment<<2)+4, 4096); xport->port.mp_SigTask = task; xport->port.mp_SigBit = 1; /* 0x00000002 */ xport->port.mp_Flags = PA_SIGNAL; if (addit) AddPort(xport); /* add port to system lists */ Signal(task, 1); /* start the task 0x00000001 */ CloseLibrary(IntuitionBase); puts ("MWB now resident"); return(xport); } uninit_mwb(xport) XPORT *xport; { long segment; TASK *task; XIT xit; segment = xport->segment; task = xport->port.mp_SigTask; if (operation(xport, OP_QUIT, 0, &xit) < 0) { puts ("Warning: not all screens could be closed"); xport->segment = 0; xport->port.mp_SigTask = NULL; } else { RemPort(xport); FreeMem(xport->port.mp_Node.ln_Name, strlen(xport->port.mp_Node.ln_Name)+1); FreeMem(xport, sizeof(XPORT)); } DeleteTask(task); UnLoadSeg(segment); puts ("MWB now unloaded"); } XPORT * getport() { XPORT *xport = (XPORT *)FindPort(PORT_NAME); if (!xport || xport->segment == 0) { puts ("MWB not initialized"); exit(1); } return(xport); } SHAR_EOF fi if test -f 'mwb.doc' then echo shar: "will not over-write existing file 'mwb.doc'" else cat << \SHAR_EOF > 'mwb.doc' MWB.DOC (Alternate Workbench Screen) (C) 1987 Matthew Dillon, All Rights Reserved. Freely Distributable. This document must accompany all distributions. Re-Distributing the source is optional. WBM is a program which will create new 'workbench' screens and route by request OpenWindow() calls meant for the workbench to these new screens. MWB_RESIDENT is the resident portion of MWB and should NOT be executed directly. When you issue an initialize command (MWB i), MWB_RESIDENT will be LoadSeg()d into memory and run as a task. MWB_RESIDENT then intercepts and interprets all OpenWindow() requests, allowing OpenWindow()'s to CUSTOMSCREEN's to go through, and possibly modifying OpenWindows() to the workbench screen to go to a custom screen. Applications usually don't know they are running on a custom screen. The Application's NewWindow structure is not modified (MWB modifies a copy of NW and calls OpenWindow() with the copy). When using more advanced commands with MWB, it *is* possible to crash the machine. Apart from that, it's pretty bulletproof... you can't screw things up by running 'MWB i' multiple times, or 'MWB u' multiple times. Additionaly, if you uninitialize MWB with 'MWB u' and there are still MWB screens hanging around which can't be closed because they have active windows, the MWB state information is NOT deallocated and becomes available when you initialize again (MWB i). MWB i initialize MWB MWB u remove MWB MWB c clear all MWB custom screens which have NO open windows MWB [L] [N] [I] [h#] [w#] [d#] n next open to new custom screen MWB # next open to specified screen# (0=wb, 1=first cust scr, etc...) I -force interlace mode N -force non-interlace mode L -force LOW-RESOLUTION mode h# -set screen height w# -set screen width d# -set screen depth NOTE: Anything left unspecified uses the default Workbench parameters. If Height and Width are left unspecified, MWB will automatically compensate the width and height for any mode changes (LORES/INTERLACE). The 'n' command for 'new custom screen' causes the next OpenWindow() to go to a custom screen. NOTE: Normally, any OpenWindow() calls to the WorkBench will get routed to the current custom screen, so you should be careful when specifying screens of different dimensions than the workbench. Most applications expect at least 640x200 and open their windows accordingly. EXAMPLES: % mwb i % mwb n % newcli put newcli window on a new custom screen % mwb i % mwb I d1 n % newcli put newcli window on a new interlace custom screen of depth 1. % mwb 0 next OpenWindow() goes to workbench screen % mwb 1 next OpenWindow() goes to first curstom screen % mwb L h100 d1 n next OpenWindow() goes to new LO-RES custom screen of height 100 and depth 1. PROBLEMS: Problems with the workbench (LoadWb). Do NOT LoadWb to a custom screen. You must LoadWb to the real workbench screen. Once running, you can use MWB to cause workbench windows to come up in a custom screen, but the workbench will get confused if you attempt to MOVE icons from those windows. NOTE that some applications expect the workbench to be a specific size; they may even check the workbench screen parameters. If such application's OpenWindow() is re-routed to a custom screen, you should be careful that this custom screen is of the same type as the default workbench screen. This can be accomplished by specifying "MWB n" without any qualifier options. MWB does NOT allow you to open arbitrary windows in other application's custom screens. Why? You may ask the question: What would happen if that application CloseScreen()'d it's screen with other, illegal windows still active? FireWorks. COMPILING: You must compile with Aztec with the +L option for MWB.C, and with the +BCDL options for MWB_RESIDENT.C. Link with the CL32.LIB. The reason for all of this is because the small code/data model cannot be used for MWB_RESIDENT since it is run directly from MWB without any standard startup support (the +B option disables the inclusion of the startup code for Aztec). SHAR_EOF fi if test -f 'mwb.h' then echo shar: "will not over-write existing file 'mwb.h'" else cat << \SHAR_EOF > 'mwb.h' /* * MWB.H * * (c)1987 Matthew Dillon. All Rights Reserved. */ #include <exec/types.h> #include <exec/ports.h> #include <exec/memory.h> typedef struct MsgPort PORT; #define PORT_NAME "MWB_PORT" #define SCREEN_NAME "Other Workbench Screen" #define TASK_NAME "MWB_RESIDENT" #define MAXSCREENS 32 #define FL_NOREMOVE 0x01 #define FL_DEFINED 0x02 #define OP_QUIT 1 #define OP_NEWSCREEN 2 #define OP_SETSCREEN 3 #define OP_CLOSEUNUSED 4 #define OP_STARTUP 5 /* garbage message for startup handshaking */ typedef struct { long screen; long scrmodes; short width; short height; short depth; short flags; } XIT; typedef struct { struct Message msg; long com; long screeno; XIT xit; } XMSG; typedef struct { PORT port; long segment; char scrname[sizeof(SCREEN_NAME)+1]; /* +1 for good measure */ char taskname[sizeof(TASK_NAME)+1]; /* +1 for good measure */ XIT xit[MAXSCREENS]; } XPORT; extern PORT *FindPort(), *CreatePort(); SHAR_EOF fi if test -f 'mwb.uue' then echo shar: "will not over-write existing file 'mwb.uue'" else cat << \SHAR_EOF > 'mwb.uue' begin 600 mwb M```#\P`````````#``````````(```:5````JP````$```/I```&E4[Z")A/ M=&AE<B!7;W)K8F5N8V@@4V-R965N`$U70E]215-)1$5.5`!.5?_H2.<(,`RM M`````0`(9@1P`6`"<``;0/_I2'H"NDZZ&-)83R9`2H!G($*M__`K:P!0__0[ M:P!4__@[:P!6__H[:P!8__Q";?_^0BW_ZD(M_^MX`6```C(@!.6`(&T`#"1P M"`!*$F<0($I2B"\(3KH'@%A/*T#_[!`22(!(P&```<1(>@);3KH8:EA/)D!* M@&<42JL`(F<.2'H"3DZZ#"983V```>).N@.@)D`K:P!0__0[:P!4__@[:P!6 M__H[:P!8__Q(;?_P0J=(>``%3KH&Q"\`3KH"\D_O`!!@``&H2'H"'DZZ&`Q8 M3R9`2H!G!DJK`")F#DAZ`A%.N@O(6$]@``&$+PM.N@6J6$]@``%X2&W_\$*G M2'@``DZZ!G@O`$ZZ`J9/[P`08``!7$AM__!"ITAX``1.N@9<+P!.N@**3^\` M$&```4!*K?_L;P@[;?_N__Q@"DAZ`<A.N@MH6$]@``$D<A`@+?_L3KH,D&88 M#*T````@_^QO#CMM_^[_^!M\``'_ZF`*2'H!H$ZZ"S983V```/(,K0```"#_ M[&\..VW_[O_Z&WP``?_K8`I(>@&$3KH+$%A/8```S`@M``+_]V80".T``O_W M2BW_ZV8$X>W_^F```+`(+0`"__=G$`BM``+_]THM_^MF!.#M__I@``"4""T` M!__V9Q`(K0`'__9*+?_J9@3@[?_X8'@,$@`P;08,$@`Y;P@;?``!_^E@9$AM M__`O"DZZ!<983R\`2'@``TZZ!5XO`$ZZ`8Q/[P`08$*0O````$EG`/]P5X!G MHE6`9X*0O````!5G`/[.4X!G`/[D68!G`/\L4X!G`/X26X!G`/Z:7X!G`/YD M58!G`/[B8(A2A$HM_^EF"+BM``AM`/W$2B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E&`&3KD```D@4$].=61O<RYL:6)R87)Y`$GY``!__DYU3E4``$CG,"!( M>0`!```P.0```CK!_``&+P!.N0``&!!03R/````";&880J=(>0`!``!.N0`` M%MA03RYY```"8$YU('D```)L0F@`!"!Y```";#%\``$`$")Y```";#-\``$` M"B!Y```"8"`Y```"8)"H``10@"/````"<"!Y```"<""\34%.6$*G3KD``!DP M6$\D0$JJ`*QG."\M``PO+0`(+PI.N0``"JQ/[P`,(_P````!```"="!Y```" M;`!H@```!"!Y```";`!H@```"F!82&H`7$ZY```:#EA/2&H`7$ZY```9=%A/ M(\````)X('D```)X2J@`)&<4('D```)X(F@`)"\13KD``!946$\O.0```G@O M"DZY```--%!/(_D```)X```"?$ZY```6<"!Y```";""`3KD``!:P('D```)L M(4``!F<:2'@#[4AZ`#I.N0``%J!03R!Y```";"%```PO.0```GPO.0```H!. MN0```"A03T*G3KD``!1P6$],WP0,3EU.=2H`3E4``$CG/#`D;0`0(&T`""`H M`*SE@"@`($0@*``0Y8`F0!`32(!(P-"M``Q4@"/````"A$*G+SD```*$3KD` M`!@04$\CP````HAF"$S?##Q.74YU$!-(@$C`+P`@2U*(+P@O.0```HA.N0`` M#))/[P`,2'H!<!`32(!(P-"Y```"B"\`3KD```S>4$\O+0`,+PHO.0```HA. MN0``#+I/[P`,0KD```*`)GD```*()$L0$TB`2,`J`+"\````(&<@NKP````) M9QBZO`````QG$+J\````#6<(NKP````*9@12BV#,#!,`(&T``(X,$P`B9C)2 MBR!+4HL0$$B`2,`J`&<@($I2BA"%NKP````B9A`,$P`B9@12BV`&0BK__V`" M8-)@1"!+4HL0$$B`2,`J`&<PNKP````@9RBZO`````EG(+J\````#&<8NKP` M```-9Q"ZO`````IG""!*4HH0A6#"($I2BD(02H5F`E.+4KD```*`8`#_.D(2 M0J<@.0```H!2@.6`+P!.N0``&!!03R/````"?&8*0KD```*`8`#^K'H`)GD` M``*(8!X@!>6`('D```)\(8L(`"\+3KD```ZF6$]2@-?`4H6ZN0```H!MVB`% MY8`@>0```GQ"L`@`8`#^:B``3.\#```$(`@B+P`,8`(0V5?)__QG!E)!8`)" M&%')__Q.=3`\?_]@!#`O``X@;P`$2AAF_%-((F\`"%-`$-E7R/_\9P)"$"`O M``1.=2!O``0@"")O``@0V6;\3G5.50``2.<P("1M``A*$F<H($I2BA`02(!( MP"\`3KD```ZX6$^PO/____]F"G#_3-\$#$Y=3G5@U$AX``I.N0``#KA83V#H M3E4``$CG/C`D;0`(0J=(>@"D3KD``!F:4$\CP````JAF"$S?#'Q.74YU(&T` M#")H`"0O*0`$3KD``!HZ6$\H`&=:2'H`?2!$+R@`-DZY```:'%!/)D!*@&<X M2'@#[2\+3KD``!:@4$\L`&<F(`;E@"H`($4E:``(`*0E1@"<2'@#[4AZ`$1. MN0``%J!03R5``*`O!$ZY```:+%A/+SD```*H3KD``!;R6$]"N0```JA@`/]P M:6-O;BYL:6)R87)Y`%=)3D1/5P`J`$CG2`!"A$J`:@1$@%)$2H%J!D2!"D0` M`6$^2D1G`D2`3-\`$DJ`3G5(YT@`0H1*@&H$1(!21$J!:@)$@6$:(`%@V"\! M81(@`2(?2H!.=2\!808B'TJ`3G5(YS``2$%*068@2$$V`30`0D!(0(##(@!( M0#("@L,P`4)!2$%,WP`,3G5(028!(@!"04A!2$!"0'0/T(#3@;:!8@22@U)` M4<K_\DS?``Q.=2!O``0@"$H89OR1P"`(4X!.=4Y5``!(YS``2'D```"8+RT` M"$ZY```.VE!/3-\`#$Y=3G5.50``2.<X`"@M``@O+0`,+P1.N0``#RA03[B\ M````"F8J(&T`#!`H``Q(@$C`"```!V<82'C__R\M``Q.N0``$"Y03TS?`!Q. M74YU8/9.50``2.<P("1M``P@4K'J``1E'"`M``C`O````/\O`"\*3KH`XE!/ M3-\$#$Y=3G4@4E*2$"T`"Q"`2(!(P,"\````_V#B3E4``$CG,"!!^0```((D M2"!*U?P````6+PAA%%A/0?D```(ZM<AEZ$S?!`Q.74YU3E4``$CG."`D;0`( M>``@"F8*</],WP0<3EU.=4HJ``QG7`@J``(`#&<,2'C__R\*85Y03R@`$"H` M#4B`2,`O`$ZY```5PEA/B(`(*@`!``QG#"\J``A.N0``$FI83P@J``4`#&<8 M+RH`$DZY```3,%A/+RH`$DZY```2:EA/0I)"J@`$0JH`"$(J``P@!&"$3E7_ M_DCG."`D;0`(0?K_,B/(```"C`@J``0`#&<*</],WP0<3EU.=0@J``(`#&<T M*!*8J@`(+P0O*@`($"H`#4B`2,`O`$ZY```38D_O``RPA&<0".H`!``,0I)" MJ@`$</]@O`RM_____P`,9A`(J@`"``Q"DD*J``1P`&"B2JH`"&8*+PI.N0`` M$6983PQJ``$`$&8R&VT`#___2'@``4AM__\0*@`-2(!(P"\`3KD``!-B3^\` M#+"\`````6:4("T`#&``_UHDJ@`(,"H`$$C`T*H`""5```0(Z@`"``P@4E*2 M$"T`#Q"`2(!(P,"\````_V``_RI.50``2.<P($'Y````@B1(2BH`#&<<U?P` M```60?D```(ZM<AE"G``3-\$#$Y=3G5@WD*20JH`!$*J``@@"F#H3E7__$CG M,"`D;0`(2'@$`$ZY```24EA/*T#__&8:-7P``0`0(`K0O`````XE0``(3-\$ M#$Y=3G4U?`0``!`(Z@`!``PE;?_\``@0*@`-2(!(P"\`3KD``!*\6$]*@&<& M`"H`@``,8,A.50``2.<P,"1Y```"7&`6)E(@*@`$4(`O`"\*3KD``!E.4$\D M2R`*9N9"N0```EQ,WPP,3EU.=4Y5``!(YS`@0?K_OB/(```"D$*G("T`"%"` M+P!.N0``&!!03R1`2H!F"G``3-\$#$Y=3G4DN0```EPE;0`(``0CR@```EP@ M"E"`8.!.50``2.<P`"\M``AAIEA/3-\`#$Y=3G5.50``2.<P,)?+)'D```)< M8`X@;0`(48BQRF<2)DHD4B`*9NYP_TS?#`Q.74YU(`MG!":28`8CT@```EP@ M*@`$4(`O`"\*3KD``!E.4$]P`+E4``$CG,"!R!B`M``A.N0``%B(D0-7Y M```";$JM``AM%#`Y```".DC`(BT`"+*`;`1*DF84(_P````"```"E'#_3-\$ M#$Y=3G5R!B`M``A.N0``%B(@>0```FPO,`@`3KD``!:$6$]*@&<$<`%@`G`` M8,Y.50``2.<P`"\M``A.N0``%F)83TJ`9A9.N0``%GHCP````I1P_TS?``Q. M74YU<`!@]$Y5``!(YSP@*"T`"$ZY```3^'(&(`1.N0``%B(D0-7Y```";$J$ M;1`P.0```CI(P+B`;`1*DF84(_P````"```"E'#_3-\$/$Y=3G4P*@`$P'P` M`V8.(_P````%```"E'#_8.`O+0`0+RT`#"\23KD``!;(3^\`#"H`L+S_____ M9A!.N0``%GHCP````I1P_V"R(`5@KDY5__Q(YS``2'@0`$*G3KD``!GF4$\K M0/_\"```#&<:2KD```)T9@P@+?_\3-\`#$Y=3G5.N0``%#9P`&#N3E4``$CG M,`!(>``$2'H`*$ZY```6L"\`3KD``!;(3^\`#$AX``%.N0``%'!83TS?``Q. M74YU7D,*`$Y5``!(YS``2KD```*,9P@@>0```HQ.D"\M``A.N0``%)Q83TS? M``Q.74YU3E7__$CG.``K;0`(__Q*N0```FQG-G@`8`PO!$ZY```5PEA/4H0P M.0```CI(P+B`;>@P.0```CK!_``&+P`O.0```FQ.N0``&4Y03TJY```"D&<( M('D```*03I!*N0```IAG#B\Y```"F$ZY```6^%A/2KD```*<9PXO.0```IQ. MN0``%OA83TJY```"H&<.+SD```*@3KD``!;X6$\L>``$""X`!`$I9Q0O#4OZ M``I.KO_B*E]@!D*G\U].<TJY```">&8X2KD```*(9RXO.0```H0O.0```HA. MN0``&4Y03R`Y```"@%*`Y8`O`"\Y```"?$ZY```93E!/8!1.N0``&3XO.0`` M`GA.N0``&=A83R`M__PN>0```F!.=4S?`!Q.74YU3E4``$CG/B`H+0`(<@8@ M!$ZY```6(B1`U?D```)L2H1M$#`Y```".DC`N(!L!$J29A0C_`````(```*4 M</],WP1\3EU.=3`J``3`?(``9@HO$DZY```61EA/0I)P`&#>2.=P`#0!Q,`F M`4A#QL!(0T)#U(-(0,#!2$!"0-""3-\`#DYU(B\`!"QY```":$[N_]PB+P`$ M+'D```)H3N[_@B(O``0L>0```FA.[O^X+'D```)H3N[_RBQY```":$[N_WPB M+P`$+'D```)H3N[_*"(O``0L>0```FA.[O]J3.\`!@`$+'D```)H3N[_XBQY M```":$[N_\0B+P`$+'D```)H3N[_9$SO``X`!"QY```":$[N_]!(YP$$3.\@ M@``,+'D```)D3J[_E$S?((!.=4[Y```6^")O``0L>0```F1.[OYB3E4``$CG M."!(>/__3KD``!?\6$\H`+"\_____V8*<`!,WP0<3EU.=4AY``$``4AX`"). MN0``&`I03R1`2H!F#B\$3KD``!E@6$]P`)6T`"``*%6T`#P`)%7P`!``( M0BH`#A5$``]"ITZY```9*EA/)4``$$JM``AG#"\*3KD``!?N6$]@#$AJ`!1. MN0``&8)83R`*8(A.50``2.<P("1M``A*J@`*9PHO"DZY```9O%A/%7P`_P`( M)7S_____`!1P`!`J``\O`$ZY```98%A/2'@`(B\*3KD``!E(4$],WP0,3EU. M=2)O``0L>0```F1.[OZ>("\`!"QY```"9$[N_K9.^0``&!!,[P`#``0L>0`` M`F1.[O\Z3E7_X$CG,#`@+0`45H#`O/____PK0``40>W_X$/Y```"/'`'(-E1 MR/_\*VT`%/_\2&W_X$ZY```9#EA/)D!*@&8*<`!,WPP,3EU.=21K`!`E:P`8 M`#H@*@`ZT*T`%"5``#XE0``V%7P``0`(%6T`#P`))6T`"``*2&H`2DZY```9 M@EA/+PM(:@!*3KD``!CD4$]"IR\M`!`O"DZY```8]$_O``P@"F"<3E4``$CG M,``O+0`(3KD``!G*6$],WP`,3EU.=4SO`P``!"QY```"9$[N_Q!(YP`P3.\. M```,+'D```)D3J[^YDS?#`!.=2!O``0L>0```F1.[O\B(F\`!"QY```"9$[N M_GI.^0``&3`B;P`$+'D```)D3N[^VBQY```"9$[N_WQ.^0``&4XB;P`$("\` M""QY```"9$[N_RX@+P`$+'D```)D3N[^L$[Y```9="!O``0L>0```F1.[OZ, M(&\`!""(6)!"J``$(4@`"$YU3OD``!F:+'D```)D(F\`!"`O``A.[OW83.\# M```$+'D```)D3N[^DB)O``0L>0```F1.[OZ8(F\`!"QY```"9$[N_N`B;P`$ M+'D```)D3N[^ADSO``,`!"QY```"9$[N_LXB;P`$("\`""QY```"9$[N_KQ. M^0``&@X@;P`$+'D```)D3N[^@$SO`P``!"QY```"J$[N_Z`@;P`$+'D```*H M3N[_IB!O``0L>0```JA.[O^R+'D```*D3N[_+@`````#[````%P````````( M8@``"00```D\```)5```":P```G&```)^```"@0```HJ```*.@``"DP```I: M```*=```"I(```J<```*Z@``"Q8```LR```+1@``##8```QJ```-#```#2P` M``U(```-;```#8(```V6```-O```#<H```W8```.S```#NX```\8```/X``` M#_8``!`*```0%@``$'8``!"V```0W@``$7@``!&\```1[```$B0``!*R```2 MS```$PX``!,>```3/@``$TH``!-P```3>@``$](``!/F```4"```%"X``!1( M```44```%%X``!2.```4N@``%.(``!4(```5'@``%30``!5X```5D@``%9P` M`!6H```5U```%A8``!;T```7%```%SH``!=*```7<@``%X8``!>4```7M``` M%](``!?@```8#```&%8``!B>```8K```&+P``!C6```9+```&4H``!EP```9 ME@``&@H```")`````0``"'H```B>```(I```"+P```C&```(\```"1H```DP M```)1```"5P```ED```);@``"7H```F&```)C```"9@```F>```)U```"=H` M``GF```*#```"A(```H>```*,@``"D(```I&```*4@``"F````I\```*A@`` M"HP```K<```*Y```"O(```L0```+*@``"T````M0```+5@``#!P```PJ```, M/@``#$8```Q2```,7@``#'@```R$```-4```#=(```W@```.P@``#W@```^. M```00```$3```!%$```1V```$?H``!(4```2/```$D@``!)V```2H@``$M0` M`!+@```2^```$Q0``!-0```3@@``$XP``!.@```3O@``$^P``!0:```4>@`` M%((``!2L```4Q```%-```!3<```4Z@``%/(``!3Z```5`@``%1```!48```5 M)@``%2X``!5<```59```%6P``!5R```5@```%8P``!6B```5M```%=P``!7F M```5^@``%DP``!9:```6:```%G(``!9\```6B@``%I@``!:H```6L@``%L`` M`!;0```6Y```%OX``!?T```8`@``&!@``!@^```8[```&0```!D4```9(@`` M&38``!E````96```&68``!EZ```9G```&;0``!G"```9T```&=X``!GN```: M````&A0``!HD```:,@``&D```!I*`````````_(```/J````EP`@("`@("`@ M("`P,#`P,"`@("`@("`@("`@("`@("`@()!`0$!`0$!`0$!`0$!`0$`,#`P, M#`P,#`P,0$!`0$!`0`D)"0D)"0$!`0$!`0$!`0$!`0$!`0$!`0$!0$!`0$!` M"@H*"@H*`@("`@("`@("`@("`@("`@("`@)`0$!`(``````````````````! M``````$``````````````````````0$````!``````````````````````$" M`````0`````````````````````````````````````````````````````` M```````````````````````````````````````````````````````````` M```````````````````````````````````````````````````````````` M```````````````````````````````````````````````````````````` M```````````````````````````````````````````````````````````` M```````````````````````````````````````````````````````````` M```````````````````````````````````````````````````````````` M```````````````````````````````````````````````````````````` M```````````````````````````````4`````````````````````@`!``$` ;``!<``$```````````/R```#ZP````$```/R ` end SHAR_EOF fi if test -f 'mwb_resident.c' then echo shar: "will not over-write existing file 'mwb_resident.c'" else cat << \SHAR_EOF > 'mwb_resident.c' /* * MWB_RESIDENT.C * * *** Must be compiled with LARGE code and data for manx since this code * will be executed directly from a LoadSeg(). Also must compile with * +B (no .begin statement): cc +BCDL * * *** Make no assumptions as to the initial condition of global data. * * signal 0 initial GO signal * signal 1 port signal * */ go() { mwb_resident(); Wait(0); } #include "mwb.h" #include <intuition/intuition.h> #include <intuition/intuitionbase.h> typedef struct NewScreen NS; typedef struct Screen SCR; typedef struct NewWindow NW; typedef struct Window WIN; typedef struct IntuitionBase IB; struct TextAttr Ta = { "topaz.font", 8 }; extern char LVOOpenWindow; extern char LVOCloseWindow; long SysBase; IB *IntuitionBase; long oldopenvec; long oldclosevec; short sno; short uca; XPORT *Xport; extern long newopenwindow(), newclosewindow(); mwb_resident() { register XPORT *xport; register XMSG *xmsg; SysBase = *(long *)4; /* Get ExecBase */ sno = 0; uca = 1; Wait(1); /* Wait for 'GO' signal from MWB.C */ Xport = xport = FindPort(PORT_NAME);/* had better exist */ if (xport) { IntuitionBase = (IB *)OpenLibrary("intuition.library", 0); oldopenvec = SetFunction(IntuitionBase, &LVOOpenWindow, newopenwindow); oldclosevec= SetFunction(IntuitionBase, &LVOCloseWindow,newclosewindow); for (;;) { WaitPort(xport); /* wait for message */ xmsg = GetMsg(xport); switch(xmsg->com) { case OP_QUIT: goto done; case OP_CLOSEUNUSED: remscreens(); uca = 1; break; case OP_NEWSCREEN: for (sno = 0; sno < MAXSCREENS; ++sno) { if (xport->xit[sno].screen == 0) { xport->xit[sno] = xmsg->xit; xport->xit[sno].flags |= FL_DEFINED; uca = 0; break; } } break; case OP_SETSCREEN: if (xport->xit[xmsg->screeno].screen) { sno = xmsg->screeno; uca = 0; } break; case OP_STARTUP: break; } xmsg->com = 0; ReplyMsg(xmsg); } done: xmsg->com = remscreens(); SetFunction(IntuitionBase, &LVOOpenWindow, oldopenvec); SetFunction(IntuitionBase, &LVOCloseWindow,oldclosevec); CloseLibrary(IntuitionBase); ReplyMsg(xmsg); Wait(0); } } remscreens() { register XPORT *xport = Xport; register short i; register SCR *scr; short allnotclosed = 0; for (i = 1; i < MAXSCREENS; ++i) { scr = xport->xit[i].screen; if (scr) { if (scr->FirstWindow) { allnotclosed = -1; } else { CloseScreen(scr); xport->xit[i].screen = NULL; xport->xit[i].flags = 0; } } } return(allnotclosed); } /* * LIBRARY INTERCEPT ROUTINES. NOTE!! Called in context of some other * task. NOTE!! re-entrant. */ myopenwindow(nw, cnw) NW *nw, *cnw; { register XPORT *xport = Xport; register XIT *xuse, *xi; SCR *scr; short i; NS Ns; if ((nw->Type & SCREENTYPE) == WBENCHSCREEN) { if (uca) { scr = IntuitionBase->ActiveScreen; for (i = 0; i < MAXSCREENS; ++i) { if (xport->xit[i].screen == scr) { sno = i; break; } } } xi = xuse = &xport->xit[sno]; if (xi->screen == NULL) { if (!(xi->flags & FL_DEFINED)) xuse = &xport->xit[0]; Ns.LeftEdge = Ns.TopEdge = 0; Ns.Width = xuse->width; Ns.Height= xuse->height; Ns.Depth = xuse->depth; Ns.DetailPen = 0; Ns.BlockPen = 1; Ns.ViewModes = xuse->scrmodes|SPRITES; Ns.Type = CUSTOMSCREEN; Ns.Font = &Ta; Ns.DefaultTitle = xport->scrname; Ns.Gadgets = NULL; Ns.CustomBitMap = NULL; xi->screen = OpenScreen(&Ns); } if (xi->screen) { *cnw = *nw; nw = cnw; nw->Type = CUSTOMSCREEN; nw->Screen = xi->screen; } uca = 1; } return(nw); } myclosewindow(win) WIN *win; { return(win); } #asm _newopenwindow: sub.l #64,sp move.l sp,A1 ;pointer to some allocated memory movem.l D2/D3/A4/A6,-(sp) ;save some registers move.l A1,-(sp) ;push ptr to alloc. memory move.l A0,-(sp) ;push passed NW argument jsr _myopenwindow ;call C routine addq.l #8,sp ;pop move.l D0,A0 ;Place return argument into A0 move.l _oldopenvec,A1 ;actual OpenWindow() call movem.l (sp)+,D2/D3/A4/A6 ;restore some registers jsr (A1) ;make call add.l #64,sp ;deallocate allocated stack rts _newclosewindow: movem.l D2/D3/A4/A6,-(sp) move.l A0,-(sp) jsr _myclosewindow ;call with window argument. addq.l #4,sp move.l D0,A0 move.l _oldclosevec,A1 movem.l (sp)+,D2/D3/A4/A6 jmp (A1) #endasm SHAR_EOF fi if test -f 'mwb_resident.uue' then echo shar: "will not over-write existing file 'mwb_resident.uue'" else cat << \SHAR_EOF > 'mwb_resident.uue' begin 600 mwb_resident M```#\P`````````#``````````(```%$`````@````8```/I```!1$Y5``!A M/D*G3KD```326$].74YU3W1H97(@5V]R:V)E;F-H(%-C<F5E;@!-5T)?4D53 M241%3E0`=&]P87HN9F]N=```3E4``$CG`#`C^``$````!$)Y`````#/\``$` M```"2'@``4ZY```$TEA/2'H!R$ZY```$;EA/)$`CP````!0@"F<``:I"ITAZ M`;5.N0``!)!03R/`````"$AZ`WA(>?___S0O.0````A.N0``!+Q/[P`,(\`` M```,2'H#A$AY____N"\Y````"$ZY```$O$_O``PCP````!`O"DZY```$X%A/ M+PI.N0``!'Q83R9`("L`%&```+)@``#23KH!5#/\``$````"8```L$)Y```` M`&!:,#D`````2,#I@"!`T<I*J`!,9D`P.0````!(P.F`($#1RM'\````3")+ MT_P````<(-D@V2#9(-DP.0````!(P.F`($#1R@CH``$`6T)Y`````F`04GD` M````#'D`(`````!MG&!`("L`&.F`($#1RDJH`$QG#C/K`!H`````0GD````" M8"!@'@`"_T#_5/_"_T3_XK"\````!F0*XX`P.P#H3OL``$*K`!0O"TZY```$ MJ%A/8`#_$$ZZ`(0G0``4+SD````,2'G___\T+SD````(3KD```2\3^\`#"\Y M````$$AY____N"\Y````"$ZY```$O$_O``PO.0````A.N0``!%I83R\+3KD` M``2H6$]"ITZY```$TEA/3-\,`$Y=3G5-5T)?4$]25`!I;G1U:71I;VXN;&EB M<F%R>0``3E7__DCG"#`D>0```!1";?_^>`%@2#`$2,#I@"!`T<HF:`!,(`MG M-$JK``1G"#M\_____F`F+PM.N0``!/183S`$2,#I@"!`T<I"J`!,,`1(P.F` M($#1RD)H`%I21+A\`"!MLC`M__Y(P$S?#!!.74YU3E7_VDCG"#`D>0```!0@ M;0`(<``P*``NP+P````/L+P````!9@`!$DIY`````F<^('D````(*V@`./_\ M0FW_^F`D,"W_^DC`Z8`@0-'*(F@`3+/M__QF"C/M__H`````8`Q2;?_Z#&T` M(/_Z;=0P.0````!(P.F`T(HF0-?\````3"@+($1*D&9V($0(*``!``]F""9* MU_P```!,0FW_W$)M_]H[:P`(_]X[:P`*_^`[:P`,_^)"+?_D&WP``?_E("L` M!`C```X[0/_F.WP`#__H0?D`````*TC_ZB`*T+P````F*T#_[D*M__)"K?_V M2&W_VDZY```%`EA/($0@@"!$2I!G*B!M``PB;0`(<`L@V5'(__PK;0`,``@@ M;0`(,7P`#P`N($0B;0`((U``'C/\``$````"("T`"$S?#!!.74YU3E4``"`M M``A.74YUG_P```!`(D](YS`*+PDO"$ZZ_IY0CR!`(GD````,3-]0#$Z1W_P` M``!`3G5(YS`*+PAAP%B/($`B>0```!!,WU`,3M%.^0``!&`B;P`$+'D````$ M3N[^8B)O``0L>0````1.[OYZ3OD```2"(&\`!"QY````!$[N_HQ.^0``!)8L M>0````0B;P`$("\`"$[N_=A.^0``!*XB;P`$+'D````$3N[^AB)O``0@;P`( M("\`#"QY````!$[N_EP@+P`$+'D````$3N[^PD[Y```$YB!O``0L>0````1. M[OZ`(&\`!"QY````"$[N_[X@;P`$+'D````(3N[_.@```^P````!`````0`` M`YH````5``````````H```!H````=````)````"N````S@```.````#J```! MQ````>H```(&```"%@```B````(J```"C@```[P```1<```$?@``!)(```2J M```$X@```"L````"````4````%8```!>````?@```)@```"H````N````,@` M``#8```!!@```1````$8```!+````5````%D```!;````70```&0```!E@`` M`=@```'D```!]````@````(0```"7@```M````+P```"^````R(```,V```# M^@``!#````10```$9@``!'0```2(```$F```!+0```3*```$V```!.P```3Z M```%"`````````/R```#Z@````(````X``@``````^P````!```````````` 3```````#\@```^L````&```#\@(` ` end SHAR_EOF fi exit 0 # End of shell archive