dillon@CORY.BERKELEY.EDU.UUCP (03/15/87)
Freely distributable. This little program must be run from a CLI/shell/etc... it allows you to run programs which normally open windows on the workbench screen to use a custom screen instead. The resident portion is only 5K (not including any custom screens openned). The resident portion should be in the current directory or in C: when you install it with 'MWB i' The shar below contains source, an executable, and the resident code binary (which should not be executed directly). the source works with Manx v3.4 (carefully read the compilation directions.. the resident portion must be compiled with +BCDL). Every attempt has been made to make the program bullet proof. Example: 1> mwb i -install MWB 1> mwb n -next application is placed on a custom screen 1> newcli -boom! custom screen is created and CLI placed on it. 1> mwb d1 n -next application is placed on a 1-deep custom screen 1> Boxes -boom! run boxes demo. There are many other options available.. read MWB.C for more information. Due to the nature of this program, LoadWb will only work on the default workbench screen. You *can*, however, open workbench windows on other screens. Unfortunetly, you can't move icons in workbench windows on custom screens without confusing the workbench. Fool around with it! suggestions are welcome. Be careful when specifying non-standard screen sizes/depths. -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.h # mwb.uue # mwb_resident.c # mwb_resident.uue # This archive created: Sat Mar 14 14:42:33 1987 export PATH; PATH=/bin:/usr/bin:$PATH echo shar: "extracting 'mwb.c'" '(8381 characters)' if test -f 'mwb.c' then echo shar: "will not over-write existing file 'mwb.c'" else cat << \!Funky!Stuff! > 'mwb.c' /* * Multi-WorkBench-Screens program. * * MANX only, must compile with LARGE CODE AND DATA AND LONG INTS * Conversion to Lattice should be too difficult. * * NOTE: Do not attempt to LoadWb on anything other than the standard * default workbench screen. Once done, however, you may have windows * open in other screens. Also, Moving icons in workbench windows which * are on custom screens confuses the workbench (but you can still * double click them). FINALLY, many applications (rightly) assume the * workbench screen is of a certain minimum size (at least 640/200). Other * applications may open a 'workbench screen' to get the size of the * workbench. Therefore, you should be careful if you intend to specify * different sizes/bit depths for your custom workbench screens. * * When initializing, MWB attempts to LoadSeg() it's resident portion from * disk. The resident portion must thus reside in the current directory * or in C: and be named "mwb_resident". * * I have found that depth=1 screens seem to work well with most * applications even if they assume the depth is 2. * * MWB intercepts the OpenWindow() and CloseWindow() library vectors and * allows open requests to the workbench screen to automatically be * rerouted to a custom screen. * * mwb [#][i][u][[b#][w#][h#]n] * * i -install MWB. If you previously uninstalled MWB with * custom screens still in use, this relinks those screens * to MWB. * * u -uninstall MWB. Any custom screens still in use are NOT * deleted, but no further openwindows will be routed to them. * * n -newscreen. Next OpenWindow() gets it's own custom screen. * Normally, the current active MWB screen gets the new window. * * # -use screen # (0=default workbench, 1=first MWB custom screen, * etc...). The next open will be placed on this screen. * * d# -for newscreen, sets depth else uses default wb depth * w# -for newscreen, sets width else uses default wb width * h# -for newscreen, sets height else uses default wb height * * NOTE!!! d#/w#/h# must come BEFORE n * * mwb i -initialize MWB * mwb u -uninitialize MWB * mwb d1 n -cause next open to create new custom screen of depth 1. * mwb c -close all screens with no windows attached. * mwb 0 -cause next open to use workbench screen * mwb 1 -cause next open to use some already existing custom MWB * screen. * * MWB does not allow you to open arbitrary windows in other process's * custom screens. Why? What happens when you exit vt100? It closes * it's custom screen and causes a fireworks display if there are other * applications using that screen. */ #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; if (xport = (XPORT *)FindPort(PORT_NAME)) { xit.screen = 0; xit.width = xport->xit[0].width; xit.height = xport->xit[0].height; xit.depth = xport->xit[0].depth; xit.flags = 0; } for (i = 1; 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.width = xport->xit[0].width; xit.height= xport->xit[0].height; xit.depth = xport->xit[0].depth; 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; else puts ("bad width"); break; case 'h': if (val > 32) xit.height = val; else puts ("bad height"); break; default: if (*ptr < '0' || *ptr > '9') { puts ("MWB [#][i][u][[[d#][w#][h#]n]"); puts ("(c)1987 Matthew Dillon, All rights reserved"); exit(1); } operation(getport(), OP_SETSCREEN, atoi(ptr), &xit); break; } } } /* * 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); xport->xit[0].screen = wscr = OpenWorkBench(); 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("MWB_RESIDENT", 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); } !Funky!Stuff! fi # end of overwriting check echo shar: "extracting 'mwb.h'" '(836 characters)' if test -f 'mwb.h' then echo shar: "will not over-write existing file 'mwb.h'" else cat << \!Funky!Stuff! > '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 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 typedef struct { long screen; 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 */ XIT xit[MAXSCREENS]; } XPORT; extern PORT *FindPort(), *CreatePort(); !Funky!Stuff! fi # end of overwriting check echo shar: "extracting 'mwb.uue'" '(11090 characters)' if test -f 'mwb.uue' then echo shar: "will not over-write existing file 'mwb.uue'" else cat << \!Funky!Stuff! > 'mwb.uue' begin 600 mwb M```#\P`````````#``````````(```9%````JP````$```/I```&14[Z!UA/ M=&AE<B!7;W)K8F5N8V@@4V-R965N``!.5?_P2.<(,$AZ`?).NA>R6$\F0$J` M9QI"K?_T.VL`0O_X.VL`1/_Z.VL`1O_\0FW__G@!8``!MB`$Y8`@;0`,)'`( M`$H29Q`@2E*(+PA.N@9N6$\K0/_P$!)(@$C`8``!7$AZ`:%.NA=86$\F0$J` M9Q1*JP`B9PY(>@&43KH+%%A/8``!9DZZ`J8F0#MK`$+_^#MK`$3_^CMK`$;_ M_&```4I(>@&"3KH7&%A/)D!*@&<&2JL`(F8.2'H!=4ZZ"M183V```28O"TZZ M!+983V```1I(;?_T0J=(>``"3KH%A"\`3KH!S$_O`!!@``#^2&W_]$*G2'@` M!$ZZ!6@O`$ZZ`;!/[P`08```XDJM__!O"#MM__+__&`*2'H!+$ZZ"G183V`` M`,9R$"`M__!.N@N<9A(,K0```"#_\&\(.VW_\O_X8`I(>@$*3KH*2%A/8``` MF@RM````(/_P;P@[;?_R__I@"DAZ`/1.N@HH6$]@>@P2`#!M!@P2`#EO'DAZ M`.=.N@H06$](>@#[3KH*!EA/2'@``4ZZ$7Y83TAM__0O"DZZ!1Q83R\`2'@` M`TZZ!+0O`$ZZ`/Q/[P`08"Z0O````&-G`/\J4X!G`/]`68!G@E.`9P#^CEN` M9P#^^%^`9P#^PE6`9P#_0&"&4H2XK0`(;0#^1DS?#!!.74YU35="7U!/4E0` M35="7U!/4E0`35="(&%L<F5A9'D@:6YI=&EA;&EZ960`35="7U!/4E0`35=" M(&1O97,@8W5R<F5N="!E>&ES=`!B860@9&5P=&@`8F%D('=I9'1H`&)A9"!H M96EG:'0`35="(%LC75MI75MU75M;6V0C75MW(UU;:"-=;ET`*&,I,3DX-R!- M871T:&5W($1I;&QO;BP@06QL(')I9VAT<R!R97-E<G9E9```3E7_T$*G0J=. MNA+P4$\K0/_4&WP`!?_@0BW_X4*M_^(K;?_4_^8[?``H_^HK;0`,_^PK;0`0 M__!![?_T(FT`%"#9(-D@V4AM_]@O+0`(3KH54%!/+RW_U$ZZ%:)83R\M_]1. MNA3^6$\K0/_0+RW_U$ZZ$R!83R`M_^Q.74YU3E7_]DCG"#!"+?_W2'H!ADZZ M$?983RM`__Q*K?_\9BA(>@%_3KH1XEA/*T#__$JM__QF%$AZ`7I.N@@J6$]( M>``!3KH/HEA/0J=(>@%_3KH4NE!/*4""IDJL@J9F'DAZ`7U.N@@`6$\O+?_\ M3KH1PEA/2'@``4ZZ#VY83TAZ`7A.NA006$\D0"`*9PY(>@%Q3KH'TEA/8``` MDAM\``'_]TAX``%(>@%D3KH)<EA/4H`O`$ZZ$LQ03RM`__A(>0`!``%(>`&^ M3KH2N%!/)$!(>@%#+RW_^$ZZ!WQ03TAZ`3Y(:@`F3KH';E!/3KH4TB9`)4`` M/C5K``P`0C5K``X`1'``$"L`O35``$8U?``#`$A(:@`43KH3XEA/%7P`!``( M0BH`"25M__@`"B5M__P`(DAX$``@+?_\Y8!8@"\`0J=(>@#Q3KH24$_O`!`H M`"5$`!`5?``!``]"*@`.2BW_]V<(+PI.NA'^6$](>``!+P1.NA/Z4$\O+(*F M3KH0[%A/2'H`ODZZ!MY83R`*3-\,$$Y=3G5M=V)?<F5S:61E;G0`8SIM=V)? M<F5S:61E;G0`0V%N;F]T(&9I;F0@)VUW8E]R97-I9&5N="<`:6YT=6ET:6]N M+FQI8G)A<GD`56YA8FQE('1O(&]P96X@:6YT=6ET:6]N`$U70E]03U)4`%)E M+4QI;FMI;F<`35="7U!/4E0`35="7U!/4E0`3W1H97(@5V]R:V)E;F-H(%-C M<F5E;@!-5T)?4D53241%3E0`35="(&YO=R!R97-I9&5N=```3E7_["!M``@K M:``B__P@;0`(*V@`$/_X2&W_[$*G2'@``2\M``A.NOT(3^\`$$J`;!Q(>@!T M3KH%VEA/(&T`"$*H`"(@;0`(0J@`$&`X+RT`"$ZZ$HQ83R!M``@O*``*3KH' M:%A/4H`O`"!M``@O*``*3KH1^%!/2'@!OB\M``A.NA'J4$\O+?_X3KH18%A/ M+RW__$ZZ#TA83TAZ`#5.N@5R6$].74YU5V%R;FEN9SH@;F]T(&%L;"!S8W)E M96YS(&-O=6QD(&)E(&-L;W-E9`!-5T(@;F]W('5N;&]A9&5D`$Y5__Q(>@`X M3KH15%A/*T#__$JM__QG"B!M__Q*J``B9A1(>@`C3KH%"%A/2'@``4ZZ#(!8 M3R`M__Q.74YU35="7U!/4E0`35="(&YO="!I;FET:6%L:7IE9```3E4``$CG M/"`D;0`(#!(`(&<&#!(`"68$4HI@\'H`#!(`+68&>@%2BF`(#!(`*V8"4HIX M`&`B($I2BA`02(!(P'(*+P`@!$ZY```4XB0?U(`H`IB\````,!`22(!(P$'Y M`````0@P``((`&;*2H5G!B`$1(!@`B`$3-\$/$Y=3G5A?$/Y```"7$7Y```" M7+7)9@XR/``3:PAT`"+"4<G__"//```"8"QX``0CS@```F1(YX"`""X`!`$I M9Q!+^@`(3J[_XF`&0J?S7TYS0_H`)$ZN_F@CP````FAF#"X\``.`!TZN_Y1@ M!DZY```'X%!/3G5D;W,N;&EB<F%R>0!)^0``?_Y.=4Y5``!(YS`@2'D``0`` M,#D```(ZP?P`!B\`3KD``!;04$\CP````FQF&$*G2'D``0``3KD``!684$\N M>0```F!.=2!Y```";$)H``0@>0```FPQ?``!`!`B>0```FPS?``!``H@>0`` M`F`@.0```F"0J``$4(`CP````G`@>0```G`@O$U!3EA"ITZY```7\%A/)$!* MJ@"L9S@O+0`,+RT`""\*3KD```EL3^\`#"/\`````0```G0@>0```FP`:(`` M``0@>0```FP`:(````I@6$AJ`%Q.N0``&,Y83TAJ`%Q.N0``·R/````" M>"!Y```">$JH`"1G%"!Y```">")H`"0O$4ZY```5%%A/+SD```)X+PI.N0`` M"_103R/Y```">````GQ.N0``%3`@>0```FP@@$ZY```5<"!Y```";"%```9G M&DAX`^U(>@`Z3KD``!5@4$\@>0```FPA0``,+SD```)\+SD```*`3KD````< M4$]"ITZY```3,%A/3-\$#$Y=3G4J`$Y5``!(YSPP)&T`$"!M``@@*`"LY8`H M`"!$("@`$.6`)D`0$TB`2,#0K0`,5(`CP````H1"IR\Y```"A$ZY```6T%!/ M(\````*(9@A,WPP\3EU.=1`32(!(P"\`($M2B"\(+SD```*(3KD```M23^\` M#$AZ`7`0$TB`2,#0N0```H@O`$ZY```+GE!/+RT`#"\*+SD```*(3KD```MZ M3^\`#$*Y```"@"9Y```"B"1+$!-(@$C`*@"PO````"!G(+J\````"6<8NKP` M```,9Q"ZO`````UG"+J\````"F8$4HM@S`P3`"!M``".#!,`(F8R4HL@2U*+ M$!!(@$C`*@!G("!*4HH0A;J\````(F80#!,`(F8$4HM@!D(J__]@`F#28$0@ M2U*+$!!(@$C`*@!G,+J\````(&<HNKP````)9R"ZO`````QG&+J\````#6<0 MNKP````*9P@@2E**$(5@PB!*4HI"$$J%9@)3BU*Y```"@&``_SI"$D*G(#D` M``*`4H#E@"\`3KD``!;04$\CP````GQF"D*Y```"@&``_JQZ`"9Y```"B&`> M(`7E@"!Y```"?"&+"``O"TZY```-9EA/4H#7P%*%NKD```*`;=H@!>6`('D` M``)\0K`(`&``_FH@`$SO`P``!"`((B\`#&`"$-E7R?_\9P9206`"0AA1R?_\ M3G4P/'__8`0P+P`.(&\`!$H89OQ32")O``A30!#95\C__&<"0A`@+P`$3G4@ M;P`$(`@B;P`($-EF_$YU3E4``$CG,"`D;0`(2A)G*"!*4HH0$$B`2,`O`$ZY M```->%A/L+S_____9@IP_TS?!`Q.74YU8-1(>``*3KD```UX6$]@Z$Y5``!( MYSXP)&T`"$*G2'H`I$ZY```86E!/(\````*H9@A,WPQ\3EU.=2!M``PB:``D M+RD`!$ZY```8^EA/*`!G6DAZ`'T@1"\H`#9.N0``&-Q03R9`2H!G.$AX`^TO M"TZY```58%!/+`!G)B`&Y8`J`"!%)6@`"`"D)48`G$AX`^U(>@!$3KD``!5@ M4$\E0`"@+P1.N0``&.Q83R\Y```"J$ZY```5LEA/0KD```*H8`#_<&EC;VXN M;&EB<F%R>0!724Y$3U<`*@!(YT@`0H1*@&H$1(!21$J!:@9$@0I$``%A/DI$ M9P)$@$S?`!)*@$YU2.=(`$*$2H!J!$2`4D1*@6H"1(%A&B`!8-@O`6$2(`$B M'TJ`3G4O`6$&(A]*@$YU2.<P`$A!2D%F($A!-@$T`$)`2$"`PR(`2$`R`H+# M,`%"04A!3-\`#$YU2$$F`2(`0D%(04A`0D!T#]"`TX&V@6($DH-20%'*__), MWP`,3G4@;P`$(`A*&&;\D<`@"%.`3G5.50``2.<P`$AY````F"\M``A.N0`` M#9I03TS?``Q.74YU3E4``$CG.``H+0`(+RT`#"\$3KD```WH4$^XO`````IF M*B!M``P0*``,2(!(P`@```=G&$AX__\O+0`,3KD```[N4$],WP`<3EU.=6#V M3E4``$CG,"`D;0`,(%*QZ@`$91P@+0`(P+P```#_+P`O"DZZ`.)03TS?!`Q. M74YU(%)2DA`M``L0@$B`2,#`O````/]@XDY5``!(YS`@0?D```"")$@@2M7\ M````%B\(81183T'Y```".K7(9>A,WP0,3EU.=4Y5``!(YS@@)&T`"'@`(`IF M"G#_3-\$'$Y=3G5**@`,9UP(*@`"``QG#$AX__\O"F%>4$\H`!`J``U(@$C` M+P!.N0``%()83XB`""H``0`,9PPO*@`(3KD``!$J6$\(*@`%``QG&"\J`!). MN0``$?!83R\J`!).N0``$2I83T*20JH`!$*J``A"*@`,(`1@A$Y5__Y(YS@@ M)&T`"$'Z_S(CR````HP(*@`$``QG"G#_3-\$'$Y=3G4(*@`"``QG-"@2F*H` M""\$+RH`"!`J``U(@$C`+P!.N0``$B)/[P`,L(1G$`CJ``0`#$*20JH`!'#_ M8+P,K?____\`#&80"*H``@`,0I)"J@`$<`!@HDJJ``AF"B\*3KD``!`F6$\, M:@`!`!!F,AMM``___TAX``%(;?__$"H`#4B`2,`O`$ZY```2(D_O``RPO``` M``%FE"`M``Q@`/]:)*H`"#`J`!!(P-"J``@E0``$".H``@`,(%)2DA`M``\0 M@$B`2,#`O````/]@`/\J3E4``$CG,"!!^0```((D2$HJ``QG'-7\````%D'Y M```".K7(90IP`$S?!`Q.74YU8-Y"DD*J``1"J@`((`I@Z$Y5__Q(YS`@)&T` M"$AX!`!.N0``$1)83RM`__QF&C5\``$`$"`*T+P````.)4``"$S?!`Q.74YU M-7P$```0".H``0`,)6W__``($"H`#4B`2,`O`$ZY```1?%A/2H!G!@`J`(`` M#&#(3E4``$CG,#`D>0```EQ@%B92("H`!%"`+P`O"DZY```8#E!/)$L@"F;F M0KD```)<3-\,#$Y=3G5.50``2.<P($'Z_[XCR````I!"IR`M``A0@"\`3KD` M`!;04$\D0$J`9@IP`$S?!`Q.74YU)+D```)<)6T`"``$(\H```)<(`I0@&#@ M3E4``$CG,``O+0`(8:983TS?``Q.74YU3E4``$CG,#"7RR1Y```"7&`.(&T` M"%&(L<IG$B9*)%(@"F;N</],WPP,3EU.=2`+9P0FDF`&(](```)<("H`!%"` M+P`O"DZY```8#E!/<`!@U$Y5``!(YS`@<@8@+0`(3KD``!3B)$#5^0```FQ* MK0`(;10P.0```CI(P"(M``BR@&P$2I)F%"/\`````@```I1P_TS?!`Q.74YU M<@8@+0`(3KD``!3B('D```)L+S`(`$ZY```51%A/2H!G!'`!8`)P`&#.3E4` M`$CG,``O+0`(3KD``!4B6$]*@&863KD``!4Z(\````*4</],WP`,3EU.=7`` M8/1.50``2.<\("@M``A.N0``$KAR!B`$3KD``!3B)$#5^0```FQ*A&T0,#D` M``(Z2,"X@&P$2I)F%"/\`````@```I1P_TS?!#Q.74YU,"H`!,!\``-F#B/\ M````!0```I1P_V#@+RT`$"\M``PO$DZY```5B$_O``PJ`+"\_____V803KD` M`!4Z(\````*4</]@LB`%8*Y.5?_\2.<P`$AX$`!"ITZY```8IE!/*T#__`@` M``QG&DJY```"=&8,("W__$S?``Q.74YU3KD``!+V<`!@[DY5``!(YS``2'@` M!$AZ`"A.N0``%7`O`$ZY```5B$_O``Q(>``!3KD``!,P6$],WP`,3EU.=5Y# M"@!.50``2.<P`$JY```"C&<(('D```*,3I`O+0`(3KD``!-<6$],WP`,3EU. M=4Y5__Q(YS@`*VT`"/_\2KD```)L9S9X`&`,+P1.N0``%()83U*$,#D```(Z M2,"X@&WH,#D```(ZP?P`!B\`+SD```)L3KD``!@.4$]*N0```I!G""!Y```" MD$Z02KD```*89PXO.0```IA.N0``%;A83TJY```"G&<.+SD```*<3KD``!6X M6$]*N0```J!G#B\Y```"H$ZY```5N%A/+'@`!`@N``0!*6<4+PU+^@`*3J[_ MXBI?8`9"I_-?3G-*N0```GAF.$JY```"B&<N+SD```*$+SD```*(3KD``!@. M4$\@.0```H!2@.6`+P`O.0```GQ.N0``&`Y03V`43KD``!?^+SD```)X3KD` M`!B86$\@+?_\+GD```)@3G5,WP`<3EU.=4Y5``!(YSX@*"T`"'(&(`1.N0`` M%.(D0-7Y```";$J$;1`P.0```CI(P+B`;`1*DF84(_P````"```"E'#_3-\$ M?$Y=3G4P*@`$P'R``&8*+Q).N0``%0983T*2<`!@WDCG<``T`<3`)@%(0\;` M2$-"0]2#2$#`P4A`0D#0@DS?``Y.=2(O``0L>0```FA.[O_<(B\`!"QY```" M:$[N_X(B+P`$+'D```)H3N[_N"QY```":$[N_\HL>0```FA.[O]\(B\`!"QY M```":$[N_R@B+P`$+'D```)H3N[_:DSO``8`!"QY```":$[N_^(L>0```FA. M[O_$(B\`!"QY```":$[N_V1,[P`.``0L>0```FA.[O_02.<!!$SO((``#"QY M```"9$ZN_Y1,WR"`3G5.^0``%;@B;P`$+'D```)D3N[^8DY5``!(YS@@2'C_ M_TZY```6O%A/*`"PO/____]F"G``3-\$'$Y=3G5(>0`!``%(>``B3KD``!;* M4$\D0$J`9@XO!$ZY```8(%A/<`!@TB5M``@`"A5M``\`"15\``0`"$(J``X5 M1``/0J=.N0``%^I83R5``!!*K0`(9PPO"DZY```6KEA/8`Q(:@`43KD``!A" M6$\@"F"(3E4``$CG,"`D;0`(2JH`"F<*+PI.N0``&'Q83Q5\`/\`""5\____ M_P`4<``0*@`/+P!.N0``&"!83TAX`"(O"DZY```8"%!/3-\$#$Y=3G4B;P`$ M+'D```)D3N[^GB`O``0L>0```F1.[OZV3OD``!;03.\``P`$+'D```)D3N[_ M.DY5_^!(YS`P("T`%%:`P+S____\*T``%$'M_^!#^0```CQP!R#94<C__"MM M`!3__$AM_^!.N0``%\Y83R9`2H!F"G``3-\,#$Y=3G4D:P`0)6L`&``Z("H` M.M"M`!0E0``^)4``-A5\``$`"!5M``\`"25M``@`"DAJ`$I.N0``&$)83R\+ M2&H`2DZY```7I%!/0J<O+0`0+PI.N0``%[1/[P`,(`I@G$Y5``!(YS``+RT` M"$ZY```8BEA/3-\`#$Y=3G5,[P,```0L>0```F1.[O\02.<`,$SO#@``#"QY M```"9$ZN_N9,WPP`3G4@;P`$+'D```)D3N[_(B)O``0L>0```F1.[OYZ3OD` M`!?P(F\`!"QY```"9$[N_MHL>0```F1.[O]\3OD``!@.(F\`!"`O``@L>0`` M`F1.[O\N("\`!"QY```"9$[N_K!.^0``�@;P`$+'D```)D3N[^C"!O``0@ MB%B00J@`!"%(``A.=4[Y```86BQY```"9")O``0@+P`(3N[]V$SO`P``!"QY M```"9$[N_I(B;P`$+'D```)D3N[^F")O``0L>0```F1.[O[@(F\`!"QY```" M9$[N_H9,[P`#``0L>0```F1.[O[.(F\`!"`O``@L>0```F1.[OZ\3OD``!C. M(&\`!"QY```"9$[N_H!,[P,```0L>0```JA.[O^@(&\`!"QY```"J$[N_Z8@ M;P`$+'D```*H3N[_LBQY```"I$[N_RX``````^P```!<````````!R(```?$ M```'_```"!0```AL```(A@``"+@```C$```(Z@``"/H```D,```)&@``"30` M``E2```)7```":H```G6```)\@``"@8```KV```+*@``"\P```OL```,"``` M#"P```Q"```,5@``#'P```R*```,F```#8P```VN```-V```#J````ZV```. MR@``#M8```\V```/=@``#YX``!`X```0?```$*P``!#D```1<@``$8P``!'. M```1W@``$?X``!(*```2,```$CH``!*2```2I@``$L@``!+N```3"```$Q`` M`!,>```33@``$WH``!.B```3R```$]X``!/T```4.```%%(``!1<```4:``` M%)0``!36```5M```%=0``!7Z```6"@``%C(``!9&```65```%G0``!:2```6 MH```%LP``!<6```77@``%VP``!=\```7E@``%^P``!@*```8,```&%8``!C* M````B0````$```<Z```'7@``!V0```=\```'A@``![````?:```'\```"`0` M``@<```()```""X```@Z```(1@``"$P```A8```(7@``")0```B:```(I@`` M",P```C2```(W@``"/(```D"```)!@``"1(```D@```)/```"48```E,```) MG```":0```FR```)T```">H```H````*$```"A8```K<```*Z@``"OX```L& M```+$@``"QX```LX```+1```#!````R2```,H```#8(```XX```.3@``#P`` M``_P```0!```$)@``!"Z```0U```$/P``!$(```1-@``$6(``!&4```1H``` M$;@``!'4```2$```$D(``!),```28```$GX``!*L```2V@``$SH``!-"```3 M;```$X0``!.0```3G```$ZH``!.R```3N@``$\(``!/0```3V```$^8``!/N M```4'```%"0``!0L```4,@``%$```!1,```48@``%'0``!2<```4I@``%+H` M`!4,```5&@``%2@``!4R```5/```%4H``!58```5:```%7(``!6````5D``` M%:0``!6^```6M```%L(``!;8```6_@``%ZP``!?````7U```%^(``!?V```8 M````&!@``!@F```8.@``&%P``!AT```8@@``&)```!B>```8K@``&,```!C4 M```8Y```&/(``!D````9"@````````/R```#Z@```)<`("`@("`@("`@,#`P M,#`@("`@("`@("`@("`@("`@(""00$!`0$!`0$!`0$!`0$!`#`P,#`P,#`P, M#$!`0$!`0$`)"0D)"0D!`0$!`0$!`0$!`0$!`0$!`0$!`4!`0$!`0`H*"@H* M"@("`@("`@("`@("`@("`@("`@("0$!`0"```````````````````0`````! M``````````````````````$!`````0`````````````````````!`@````$` M```````````````````````````````````````````````````````````` M```````````````````````````````````````````````````````````` M```````````````````````````````````````````````````````````` M```````````````````````````````````````````````````````````` M```````````````````````````````````````````````````````````` M```````````````````````````````````````````````````````````` M```````````````````````````````````````````````````````````` M```````````````````````````````````````````````````````````` M````````````````````````%`````````````````````(``0`!````7``! 6```````````#\@```^L````!```#\@`` ` end !Funky!Stuff! fi # end of overwriting check echo shar: "extracting 'mwb_resident.c'" '(5827 characters)' if test -f 'mwb_resident.c' then echo shar: "will not over-write existing file 'mwb_resident.c'" else cat << \!Funky!Stuff! > '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 */ xport->xit[3].depth = 4; 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; } 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 = HIRES|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 !Funky!Stuff! fi # end of overwriting check echo shar: "extracting 'mwb_resident.uue'" '(2391 characters)' if test -f 'mwb_resident.uue' then echo shar: "will not over-write existing file 'mwb_resident.uue'" else cat << \!Funky!Stuff! > 'mwb_resident.uue' begin 600 mwb_resident M```#\P`````````#``````````(```%*`````@````8```/I```!2DY5``!A M,D*G3KD```3J6$].74YU3W1H97(@5V]R:V)E;F-H(%-C<F5E;@``=&]P87HN M9F]N=```3E4``$CG`#`C^``$````!$)Y`````#/\``$````"2'@``4ZY```$ MZEA/2'H!SDZY```$AEA/)$`CP````!0U?``$`&H@"F<``:I"ITAZ`;5.N0`` M!*A03R/`````"$AZ`W)(>?___S0O.0````A.N0``!-1/[P`,(\`````,2'H# M?DAY____N"\Y````"$ZY```$U$_O``PCP````!`O"DZY```$^%A/+PI.N0`` M!)183R9`("L`%&```+)@``#23KH!5#/\``$````"8```L$)Y`````&!8,#D` M````P?P`#"!`T<I*J``^9CXP.0````#!_``,($#1RM'\````/B)+T_P````< M(-D@V2#9,#D`````P?P`#"!`T<H(Z``!`$E">0````)@$%)Y``````QY`"`` M````;9Y@0B`K`!AR#$ZY```$3B!`T<I*J``^9PXSZP`:`````$)Y`````F`< M``+_0/]4_\#_1+"\````!60*XX`P.P#J3OL``$*K`!0O"TZY```$P%A/8`#_ M$$ZZ`(0G0``4+SD````,2'G___\T+SD````(3KD```343^\`#"\Y````$$AY M____N"\Y````"$ZY```$U$_O``PO.0````A.N0``!')83R\+3KD```3`6$]" MITZY```$ZEA/3-\,`$Y=3G5-5T)?4$]25`!I;G1U:71I;VXN;&EB<F%R>0`` M3E7__DCG"#`D>0```!1";?_^>`%@2#`$P?P`#"!`T<HF:``^(`MG-$JK``1G M"#M\_____F`F+PM.N0``!0Q83S`$P?P`#"!`T<I"J``^,`3!_``,($#1RD)H M`$A21+A\`"!MLC`M__Y(P$S?#!!.74YU3E7_VDCG"#`D>0```!0@;0`(<``P M*``NP+P````/L+P````!9@`!#$IY`````F<^('D````(*V@`./_\0FW_^F`D M,"W_^L'\``P@0-'*(F@`/K/M__QF"C/M__H`````8`Q2;?_Z#&T`(/_Z;=0P M.0````#!_``,T(HF0-?\````/B@+($1*D&9P($0(*``!``MF""9*U_P````^ M0FW_W$)M_]H[:P`$_]X[:P`&_^`[:P`(_^)"+?_D&WP``?_E.WS``/_F.WP` M#__H0?D`````*TC_ZB`*T+P````F*T#_[D*M__)"K?_V2&W_VDZY```%&EA/ M($0@@"!$2I!G*B!M``PB;0`(<`L@V5'(__PK;0`,``@@;0`(,7P`#P`N($0B M;0`((U``'C/\``$````"("T`"$S?#!!.74YU3E4``"`M``A.74YUG_P```!` M(D](YS`*+PDO"$ZZ_J10CR!`(GD````,3-]0#$Z1W_P```!`3G5(YS`*+PAA MP%B/($`B>0```!!,WU`,3M%(YW``-`'$P"8!2$/&P$A#0D/4@TA`P,%(0$)` MT(),WP`.3G5.^0``!'@B;P`$+'D````$3N[^8B)O``0L>0````1.[OYZ3OD` M``2:(&\`!"QY````!$[N_HQ.^0``!*XL>0````0B;P`$("\`"$[N_=A.^0`` M!,8B;P`$+'D````$3N[^AB)O``0@;P`(("\`#"QY````!$[N_EP@+P`$+'D` M```$3N[^PD[Y```$_B!O``0L>0````1.[OZ`(&\`!"QY````"$[N_[X@;P`$ M+'D````(3N[_.@```^P````!`````0```XX````6``````````H```!<```` M:````(H```"H````R````-H```#D```!?````;X```'D```"`````A````(: M```")````H@```.P```$=```!)8```2J```$P@``!/H````K`````@```$0` M``!*````4@```'(```"2````H@```+(```#"````T@```0````$*```!$@`` M`28```%(```!7````60```%L```!C@```90```'2```!W@```>X```'Z```" M"@```E@```+*```"Z@```O(```,<```#,````^X```0D```$1```!'X```2, M```$H```!+````3,```$X@``!/````4$```%$@``!2`````````#\@```^H` M```"````+``(``````/L`````0```````````````````_(```/K````!@`` "`_(" ` end !Funky!Stuff! fi # end of overwriting check exit 0 # End of shell archive