[alt.sources.amiga] Close workbench program for lazy other programs

new@ee.udel.edu (Darren New) (10/13/90)

/*
 * CloseWB.c
 * This file is Public Domain.
 * Created by Darren New <new@udel.edu>
 */


/*****************************************************************

This is a program for those annoying times when you want to run a
program that wants most of the CHIP ram but does not close the WB.
One such example is Turbo Silver. This program, which can run from
the workbench, waits for twenty seconds and then attempts to close
the workbench.	If you have 512K of chip ram, you can start up
Silver, then start this up (after closing CLIs and clocks and such),
and you will have enough chip to display enough HAM images that each
frame of a movie will only be drawn once instead of twice while
generating a scene.  This really speeds up the scene generation
process.   I imagine there are other uses also, but probably not
too many.  Included in the comments are the uuencoded icon, the
uuencoded executable, and the command lines needed to compile this
under LC5.04.	 Happy hacking!    -- Darren New



First, the cute little icon:

begin 644 CloseWB.info
MXQ```0``````V0!E`#4`%@`%``,``0`C">@`````````````````````````:
M`````R,``````````````-4```!:```````````````````````U`!8``@`"D
MB3`#````````````````````/__@``````?P`'\`````/@``\>````#@``'@@
M&````X```\`.```&!A@'_P,```P&&`\Q@(``&`88'C&`P``8!M@\/P#``!@'8
M^'@Q@,``&`<X\#&`P``8!AG@?P#```P``\```(``!@`'@``#```#@`\```X`N
M``#@'@``.````#Q\``#@````!_@`'P``````/__@````````````````````*
M````````?__P``````?___\`````/_``_^````#^``'Y^````^```_`>```/S
M@``'X`^``!X```_``\``/```'X``X`!X```_``#P`'@``'X``/``>```_```B
M\`!X``'X``#P`'@``_```/``/``'X```X``>``_```/```^`'X``#X```^`_^
M```^````_#X``/@````__``?X`````?___\``````'__\```````````````<
``
end
size 450


Next, the executable:

begin 644 CloseWB
M```#\P`````````#``````````(```#-````,P```"H```/I````S4CG?OY+4
M[P`T)$@D`$GY`````"QX``0I3@!:*4\`8D*L`%Y'^0```)AR`"`\````!&`"@
M)L%1R/_\)FX!%'``(CP``#``3J[^SBEK`)@`5DJK`*QG``%080`"J"(L`%8L@
M;`"83J[_H"E``%8@:P"LT<C1R")H`!#3R=/)(`)R`!(9*`DF`=*!T(%:@.6(;
MT*P`%"E``!1![```+'@`!$ZN_R(B0"\`(FD`$$?I`/(@1"`#8`(6V%'(__P6.
M_``@($H@`F`"%MA1R/_\0ALI2P!V($0@`V`"%MA1R/_\0A-%Z0!P*4H`&D7Z]
M_Q8B_````#PF">2+(M)"DD7Z`38@/````.D2VE'(__Q*K`"49P``&D'L`(8BP
M""0\```#[2QL`)A.KO_B*4``<BQX``1.KO]\(BP`C"0L`)`H+`"(+&P`F$ZNA
M_W8F3DJ`9@``("1?(FH`$"(L`%9.KO^F($HL>``$3J[_''!H8```)B1`(E]%.
MZO^D0>H`2D'H``0@*``$(4D`!"*((T``!"!`((EP`"QX``1.KO]V(DLL>``$A
M3J[^8DS??WY.=2EK`#H`)@:L````@``F80`!3$7Z`.PI2@`:80`!6"E``%XOI
M`"1`("H`)&<2+&P`F"!`(B@``"E!`%9.KO^"(BH`(&<:)#P```/M3J[_XBE`E
M`&YG"N6(($`G:``(`*0@;`!>+PA(;``B(&@`)"EH``0`=DZZ`11.N0```)!PY
M`&```(`````\`````"`/2.=^_BI`+'@`!$GY`````"E/`&)A``"ZD\F3R4ZNS
M_MHF0"EK`#H`)@:L````@``F(&L`@-'(T<@B:``,T\G3R2E1`!XA40`,(BP`Y
M5BQL`)A.KO^"2'H`DDZY````A$ZY````D%A/+&P`F"(L`%9.KO^F<``@+`!.?
M9P0@0$Z03KD```"(3KD```"&2JP`7F<>(BP`;F<(+&P`F$ZN_]PL>``$3J[_S
M?")L`%Y.KOZ&)FP`8B(L`!XL;`"83J[_9").+'@`!$ZN_F(N2TS??WY.=4/L>
M`'IP`$ZN_=@I0`"89P``!$YU<&1@C$'K`%Q.KOZ`0>L`7$ZN_HQ.=0``3OD`$
M``"$<&$```/L````!@````$```*V```"L````I````(<```"B@```RX````#E
M`````@```"0```(\````#@````````/R```#Z0```#-.5?_X0_H`8'``+'@`1
M!$ZN_=@O0```0_H`6G``3J[]V"]```0B/````^@L;P``3J[_.BQO``1.KO^RT
M(&\``")(+'@`!$ZN_F(@;P`$(DA.KOYB<`!.74YU0VQO<V570BUT87-K``!D'
M;W,N;&EB<F%R>0!I;G1U:71I;VXN;&EB<F%R>0!.=4YU8```$DYQ```@;P`$5
M8`#_:DYQ``!(YP`R)FP`G"`+9Q0D4R)+("L`""QX``1.KO\N)DI@Z)'(*4@`'
MH"E(`)Q,WTP`3G4```/R```#Z@```"8````````````````````!`````0``Q
M`/).^0``````````````````````````````````````````````````````Y
M`````````````````````````````````````````````````````````````
M`````````````&1O<RYL:6)R87)Y`"H````/H````%@``````````````^P`)
3```!`````0```(P````````#\G)YN
``
end
size 1324


Execute the following two lines to compile this:

LC -iINCLUDE: -v -b1 -mat -rr1 -cafkrsu -O CloseWB.c
BLink FROM LIB:CBACK.o+CloseWB.o TO CloseWB LIB LIB:lcr.lib+LIB:amiga.lib SMALLCODE SMALLDATA NODEBUG


*/

/******************************************************************/

#define PROGNAME    "CloseWB"

#include "exec/types.h"
#include "proto/exec.h"
#include "proto/intuition.h"
#include "proto/dos.h"

/*
 * Here are the globals used by Lattice's CBack.o
 *
 */

long _stack = 4000;	    /* stack space */
char *_procname = "CloseWB-task";    /* process name */
long _priority = 0;	    /* default priority */
long _BackGroundIO = 0;     /* I want to output some messages */
extern long _Backstdout;    /* FileHandle to output to */


/*
 * Our main routine
 *
 */

long _main(void);
long _main()
{

    long DOSBase = OpenLibrary("dos.library", 0);
    long IntuitionBase = OpenLibrary("intuition.library", 0);

    Delay(1000);
    (void) CloseWorkBench();

    CloseLibrary(DOSBase);
    CloseLibrary(IntuitionBase);

    return 0L;

    }

-- 
--- Darren New --- Grad Student --- CIS --- Univ. of Delaware ---
----- Network Protocols, Graphics, Programming Languages, 
      Formal Description Techniques (esp. Estelle), Coffee -----