[comp.sources.amiga] v91i068: NoCare 1.2.1 - faster windows, Part01/01

amiga-request@ab20.larc.nasa.gov (Amiga Sources/Binaries Moderator) (03/22/91)

Submitted-by: E. van Breemen <breemen@rulcvx.uucp>
Posting-number: Volume 91, Issue 068
Archive-name: utilities/nocare-1.2.1/part01

[ includes uuencoded executable and object modules  ...tad ]

	This utility speeds up your windowing environment.
	The OpenWindow vector is patched. When someone tries
	to open a window, the refreshbits in the nw_Flags field
	are both cleared. This way, only NOCAREREFRESH windows
	will be opened, resulting in faster window movements.
	When active, this path will use 112 bytes of memory.
	This version is basicly the same as nocare V1.5. Only
	this version is using resources instead of a task.
	It was just done to investigate resources.

#!/bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 1 (of 1)."
# Contents:  nocare.c nocare.doc nocare.lnk nocare.o.uu nocare.uu
#   nocaresup.asm nocaresup.o.uu
# Wrapped by tadguy@ab20 on Fri Mar 22 09:52:18 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'nocare.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'nocare.c'\"
else
echo shar: Extracting \"'nocare.c'\" \(1932 characters\)
sed "s/^X//" >'nocare.c' <<'END_OF_FILE'
X/* The main C-source of the nocare patch 
X
X  AUTHOR  Erwin van Breemen & Raymond Hoving,
X	The Orega Programming Group Holland.
X	P.o.box 499, 2280 AL Rijswijk, The Netherlands.
X	Phone 071 - 14 49 71.
X
X  COPYRIGHT NOTES
X	NoCare V1.2 is public domain. However, it is not allowed to
X	use NoCare V1.2 as part of a commercial product without the
X	written permission of the author.
X  
X  COMPILATION
X
XDevPac:
X	GenIm2 nocaresup.asm -Iinclude: -l
X
XCompiler Lattice-C 5.05:
X	lc -Lt+nocaresup.o -crs -v nocare
X
X
X*/
X
X#include <exec/types.h>
X#include <exec/libraries.h>
X#include <exec/memory.h>
X#include <proto/all.h>
X
X#define VERSION 1
X
Xstruct Resource {
X	struct Library ResourceLib;
X	APTR	ServiceCall;
X	APTR	CleanupCode;
X	char	name[30];
X	};
X
Xstruct Resource *resource;
Xint err;
X
Xvoid do_patch(),undo_patch();
X
X
Xvoid install_patch()
X{
Xresource=(struct Resource *)AllocMem(sizeof(struct Resource),MEMF_PUBLIC|MEMF_CLEAR);
Xif (resource==0)
X	{
X	Write(Output(),"Not enough memory!\n",strlen("Not enough memory!\n"));
X	err=1;
X	return;
X	}
Xstrcpy(resource->name,"windowpatch.resource");
Xresource->ResourceLib.lib_Node.ln_Type=NT_RESOURCE;
Xresource->ResourceLib.lib_Node.ln_Name=resource->name;
Xresource->ResourceLib.lib_Version=VERSION;
Xresource->ResourceLib.lib_OpenCnt=0;
X
XAddResource(resource);
Xdo_patch();
X}
X
Xvoid uninstall_patch()
X{
XRemResource(resource);
XFreeMem(resource,sizeof(struct Resource));
Xundo_patch();
X}
X
X
X
Xvoid _main()
X{
Xerr=0;
XWrite(Output(),"Windowpatch V1.2.1\n" ,strlen("Windowpatch V1.2.1\n"));
XWrite(Output(),"By The Orega Programming Group Holland (c)1991\n",strlen("By The Orega Programming Group Holland (c)1991\n"));
X
Xresource=(struct Resource *)OpenResource("windowpatch.resource");
Xif (resource==0)
X	{
X	install_patch();
X	if (err!=1) 
X	Write(Output(),"Window installed!\n",strlen("Window installed!\n"));
X	goto out;
X	}
Xuninstall_patch();
XWrite(Output(),"Window patch removed!\n",strlen("Window patch removed!\n"));
Xout:
X}
X
X
END_OF_FILE
if test 1932 -ne `wc -c <'nocare.c'`; then
    echo shar: \"'nocare.c'\" unpacked with wrong size!
fi
# end of 'nocare.c'
fi
if test -f 'nocare.doc' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'nocare.doc'\"
else
echo shar: Extracting \"'nocare.doc'\" \(1249 characters\)
sed "s/^X//" >'nocare.doc' <<'END_OF_FILE'
XNAME
X	NoCare V1.2.1	-	Faster windows.
X
XDATE
X	Sun 27-1-1990
X
XPURPOSE
X	This utility speeds up your windowing environment.
X	The OpenWindow vector is patched. When someone tries
X	to open a window, the refreshbits in the nw_Flags field
X	are both cleared. This way, only NOCAREREFRESH windows
X	will be opened, resulting in faster window movements.
X	When active, this path will use 112 bytes of memory.
X	This version is basicly the same as nocare V1.5. Only
X	this version is using resources instead of a task.
X	It was just done to investigate resources.
X
XUSAGE
X	Type 'NoCare' from a Shell/CLI to install/remove the patch.
X	NoCare will detach itself from the Shell/CLI, so no 
X	need to	use run(back).
X
XBUGS / LIMITATIONS
X	The price for faster windows is an increased usage
X	of chip memory. In some situations this may be unwanted.
X	Windows that were opened before NoCare was started are
X	not affected, and will still be slow.
X
XAUTHOR  Erwin van Breemen & Raymond Hoving,
X	The Orega Programming Group Holland.
X	P.o.box 499, 2280 AL Rijswijk, The Netherlands.
X	Phone 071 - 14 49 71.
X
XCOPYRIGHT NOTES
X	NoCare V1.2.1 is public domain. However, it is not allowed to
X	use NoCare V1.2 as part of a commercial product without the
X	written permission of the author.
END_OF_FILE
if test 1249 -ne `wc -c <'nocare.doc'`; then
    echo shar: \"'nocare.doc'\" unpacked with wrong size!
fi
# end of 'nocare.doc'
fi
if test -f 'nocare.lnk' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'nocare.lnk'\"
else
echo shar: Extracting \"'nocare.lnk'\" \(110 characters\)
sed "s/^X//" >'nocare.lnk' <<'END_OF_FILE'
XFROM LIB:c.o+"nocare.o"
XTO "nocare"
XLIB nocaresup.o
X    LIB:lc.lib LIB:amiga.lib
XSMALLCODE
XSMALLDATA
XVERBOSE
X
END_OF_FILE
if test 110 -ne `wc -c <'nocare.lnk'`; then
    echo shar: \"'nocare.lnk'\" unpacked with wrong size!
fi
# end of 'nocare.lnk'
fi
if test -f 'nocare.o.uu' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'nocare.o.uu'\"
else
echo shar: Extracting \"'nocare.o.uu'\" \(1389 characters\)
sed "s/^X//" >'nocare.o.uu' <<'END_OF_FILE'
Xbegin 666 nocare.o
XM```#YP````)N;V-A<F4N8P```^D```"/3E7__$CG,`)P2"(\``$``2QX``1.]
XMKO\Z*4```$J`9C(L;```3J[_Q$AZ`'PO0``03KH``%A/(B\`#$'Z`&HD""8`)
XM+&P``$ZN_]!P`2E```1@2B!L``#0_``J2'H`7B\(3KH``"!L```1?``(``@@5
XM;```T/P`*B)L```C2``*,WP``0`4(&P``$)H`"`B;```+'@`!$ZN_AI.N@``1
XM3.U`#/_P3EU.=4YO="!E;F]U9V@@;65M;W)Y(0H`=VEN9&]W<&%T8V@N<F5S]
XM;W5R8V4``%=I;F1O=W!A=&-H(%8Q+C(N,0H`0GD@5&AE($]R96=A(%!R;V=R*
XM86UM:6YG($=R;W5P($AO;&QA;F0@J3$Y.3$*`%=I;F1O=R!I;G-T86QL960AH
XM"@``5VEN9&]W('!A=&-H(')E;6]V960A"@``+PXB;```+'@`!$ZN_A0B;```^
XM<$A.KO\N3KH``"Q?3G5.5?_\2.<P`G``*4``!"QL``!.KO_$2'K_6B]``!!.2
XMN@``(B\`$$'Z_THD""8`+&P``$ZN_]!.KO_$2'K_2B]``!1.N@``4$\B+P`,E
XM0?K_."0()@`L;```3J[_T$/Z_OXL>``$3J[^#BE```!F.&$`_C)P`;"L``1G@
XM6BQL``!.KO_$2'K_,"]``!!.N@``6$\B+P`,0?K_'B0()@`L;```3J[_T&`N(
XM80#_."QL``!.KO_$2'K_%"]``!!.N@``6$\B+P`,0?K_`B0()@`L;```3J[_P
XMT$S?0`Q.74YU``````/X````#0````$```'4```!R````6H```%.```!0@``9
XM`(X```"&````>````'````!F````5````$X````:`````````^^&```"7T1/*
XM4T)A<V4````)```"+````@H```'\```!V@```;0```&.```!;@```$0````B"
XM@P```E]S=')L96X`````!0```AH```'J```!H@```7X````R@P```E]S=')C\
XM<'D``````0```&*#```#7V1O7W!A=&-H`````````0```)J#```#7W5N9&]?(
XM<&%T8V@``````0```5@!```$7VEN<W1A;&Q?<&%T8V@````````!```$7W5N[
XM:6YS=&%L;%]P871C:````3X!```"7U]M86EN``````%>`````````_(```/H*
XM`````E]?34521T5$```#ZP````(```/O`0```U]R97-O=7)C90`````````!B
X3```!7V5R<@````0````````#\@(`D
X``
Xend
Xsize 964
END_OF_FILE
if test 1389 -ne `wc -c <'nocare.o.uu'`; then
    echo shar: \"'nocare.o.uu'\" unpacked with wrong size!
fi
# end of 'nocare.o.uu'
fi
if test -f 'nocare.uu' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'nocare.uu'\"
else
echo shar: Extracting \"'nocare.uu'\" \(2101 characters\)
sed "s/^X//" >'nocare.uu' <<'END_OF_FILE'
Xbegin 666 nocare
XM```#\P`````````"``````````$```%,````'P```^D```%,2.=^_B1()`!)B
XM^0`````L>``$1_D````8<@`@/````!E@`B;!4<C__"E/`%@I3@!00JP`5'``&
XM(CP``#``3J[^SD/Z`5IP`$ZN_=@I0`!L9@9P9&```/PF;@$4*6L`F`!,2JL`V
XMK&=H(`^0KP`X!H````"`*4``'"!K`*S1R-'((F@`$-/)T\D@`G(`$ADI20!@X
XMT(%2@$)G4H`"0/_^G\!5@$)W"``@`E.`U($?L@``(`!3@E'(__8?O``@(`!3>
XM@A^Q(``@`%'*__@B3R\)8'(I:P`Z`!QP?U*`T:P`'$'K`%Q.KOZ`0>L`7$ZNI
XM_HPI0`!4+P`D0"`J`"1G$BQL`&P@0"(H```I00!,3J[_@B(J`"!G&B0\```#R
XM[4ZN_^(I0`!<9PKEB"!`)V@`"`"D(&P`5"\(2&P`&"!H`"0I:``$`&!.N@.6M
XM3KH!P'``8`0@+P`$+P`@+`!$9P0@0$Z03KH#DBQX``0B;`!L3J[^8DZZ`VQ*T
XMK`!49QHB+`!<9P1.KO_<+'@`!$ZN_WPB;`!43J[^AB`?+FP`6$S??WY.=61O=
XM<RYL:6)R87)Y`$Y5__Q(YS`"<$@B/``!``$L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]_3G4,:``!`"YF#"`H``X(@``&(4``#B)ZC
XM``1.T0``````````2$%(04YU3G4@;P`$(`A*&&;\4TB1P"`(3G4``$CG`#(F8
XM;`!P(`MG%"13(DL@*P`(+'@`!$ZN_RXF2F#HD<@I2`!T*4@`<$S?3`!.=2)OL
XM``@@;P`$(`@0V6;\3G4```/L````!@````````0H```$+@``!%````1:```$:
XM?@``!)H````&`````0```^8```/X```$!@``!$8````4````"@````````/RN
XD```#Z@````9I;G1U:71I;VXN;&EB<F%R>0````````````/RN
X``
Xend
Xsize 1476
END_OF_FILE
if test 2101 -ne `wc -c <'nocare.uu'`; then
    echo shar: \"'nocare.uu'\" unpacked with wrong size!
fi
# end of 'nocare.uu'
fi
if test -f 'nocaresup.asm' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'nocaresup.asm'\"
else
echo shar: Extracting \"'nocaresup.asm'\" \(2148 characters\)
sed "s/^X//" >'nocaresup.asm' <<'END_OF_FILE'
X; Support routines for nocare V1.2.1
X
X
XREFRESHBIT0	equ	$06
XREFRESHBIT1	equ	$07
X
XWBENCHSCREEN	EQU	$0001
X
Xnw_Flags	EQU	$E	
Xnw_Type	EQU	$2E
X
X	xref 	_LVOOpenLibrary	
X	xref 	_LVOCloseLibrary	 
X	xref 	_LVOOpenWindow
X	xref 	_LVOSetFunction
X	xref 	_LVOAllocMem
X	xref	_LVOEnable
X	xref	_LVODisable
X	xref	_LVOFreeMem
X
XPUSH	macro
X	movem.l	a0-a6/d0-d6,-(sp)
X	endm
X
XPULL	macro
X	movem.l	(sp)+,a0-a6/d0-d6
X	endm
X
X	xdef	_do_patch
X	xdef	_undo_patch
X
X	data
Xintuitionname	dc.b	'intuition.library',0
X	even
Xintuitionbase	dc.l	0
X
X	code
Xopenint:
X	lea.l	intuitionname,a1
X	clr.l	d0
X	move.l	$4,a6
X	jsr	_LVOOpenLibrary(a6)
X	move.l	d0,intuitionbase
X	rts
X
Xcloseint
X	move.l	$4,a6
X	move.l	intuitionbase,a1
X	jsr	_LVOCloseLibrary(a6)
X	rts
X
X_do_patch:
X	PUSH
X	bsr.s	openint
X	move.l	#(codeend-newopenwindow),d0
X	move.l	#0,d1
X	jsr	_LVOAllocMem(a6)
X
X	move.l	d0,base
X	lea.l	newopenwindow,a0
X	move.l	#(codeend-newopenwindow-1),d1
X	move.l	d0,a1
X1$	move.b	(a0)+,(a1)+
X	dbf	d1,1$	
X
X; Then patch the OpenWindow() function:
X
X	jsr	_LVODisable(a6)
X	move.l	intuitionbase,a1
X	move.w	#_LVOOpenWindow,a0
X	move.l	base,d0
X	jsr	_LVOSetFunction(a6)
X	move.l	base,a2
X	move.l	d0,offset(a2)
X	jsr	_LVOEnable(a6)
X	bsr.s	closeint
X	PULL
X	rts
X
X
X_undo_patch:
X	PUSH
X	bsr	openint
X	move.l	d0,a1
X	move.l	_LVOOpenWindow+2(a1),a2
X	move.l	a2,base
X	cmp.l	#'HAHA',matchoffset(a2)
X	bne.s	out
X	move.w	#_LVOOpenWindow,a0
X	move.l	offset(a2),d0
X	jsr	_LVOSetFunction(a6)
X	move.l	base,a1
X	move.l	#(codeend-newopenwindow),d0	
X	jsr	_LVOFreeMem(a6)
X
Xout	bsr	 closeint
X	PULL
X	rts
X	
X
X;-----------------------------------------------------------------------------
X; As OpenWindow() is called, then a0 points to a NewWindow structure.
X; We patch some bits in the nw_Flags field and than jump to the
X; original OpenWindow() code.
X;
Xnewopenwindow
X	cmp.w	#WBENCHSCREEN,nw_Type(a0)
X	bne.s	dontchange
X	move.l	nw_Flags(a0),d0
X	bclr	#REFRESHBIT0,d0		; We don't want SIMPLE_REFRESH ones.
X	move.l	d0,nw_Flags(a0)
Xdontchange
X	move.l	oldopenwindow(PC),a1
X	jmp	(a1)			; Jump to original code.
X
X
X
X	even
Xoldopenwindow	dc.l	0
Xbase		dc.l	0
Xmatch		dc.l	'HAHA'
Xcodeend
X
Xoffset equ (oldopenwindow-newopenwindow)
Xmatchoffset equ (match-newopenwindow)
X
X	end
END_OF_FILE
if test 2148 -ne `wc -c <'nocaresup.asm'`; then
    echo shar: \"'nocaresup.asm'\" unpacked with wrong size!
fi
# end of 'nocaresup.asm'
fi
if test -f 'nocaresup.o.uu' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'nocaresup.o.uu'\"
else
echo shar: Extracting \"'nocaresup.o.uu'\" \(990 characters\)
sed "s/^X//" >'nocaresup.o.uu' <<'END_OF_FILE'
Xbegin 666 nocaresup.o
XM```#YP````-!3D].7TU/1%5,10````/H`````41!5$$```/J````!FEN='5I@
XM=&EO;BYL:6)R87)Y`````````````^\````````#\@```^@````!0T]$10``+
XM`^D````]0_D`````0H`L>0````1.K@``(\`````23G4L>0````0B>0```!).H
XMK@``3G5(Y_[^8<X@/````"8B/`````!.K@``(\````#L0?D```#.(CP````E!
XM(D`2V%')__Q.K@``(GD````2,'P``"`Y````[$ZN```D>0```.PE0``:3JX`[
XM`&&63-]_?TYU2.?^_F$`_W`B0"1I``(CR@```.P,JDA!2$$`(F8<,'P``"`J*
XM`!I.K@``(GD```#L(#P````F3JX``&$`_U1,WW]_3G4,:``!`"YF#"`H``X(N
XM@``&(4``#B)Z``1.T0``````````2$%(00```^P````$``````````(````4/
XM````(@```&(````&`````0```$0```!*````;````'8```":````M@``````+
XM``/O@P```U],5D]%;F%B;&4```````$```"`@P```U],5D]$:7-A8FQE````:
XM``$```!>@P```U],5D]&<F5E365M``````$```#"@P```U],5D]!;&QO8TUE,
XM;0````$```!`@P``!%],5D]/<&5N5VEN9&]W```````#````:````)8```"JZ
XM@P``!%],5D]/<&5N3&EB<F%R>0`````!````$(,```1?3%9/4V5T1G5N8W1I[
XM;VX``````@```'(```"R@P``!%],5D]#;&]S94QI8G)A<GD````!````*`$`/
XM``-?9&]?<&%T8V@````````L`0```U]U;F1O7W!A=&-H`````(H````````#E
X!\@-?4
X``
Xend
Xsize 676
END_OF_FILE
if test 990 -ne `wc -c <'nocaresup.o.uu'`; then
    echo shar: \"'nocaresup.o.uu'\" unpacked with wrong size!
fi
# end of 'nocaresup.o.uu'
fi
echo shar: End of archive 1 \(of 1\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have the archive.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0
-- 
Mail submissions (sources or binaries) to <amiga@uunet.uu.net>.
Mail comments to the moderator at <amiga-request@uunet.uu.net>.
Post requests for sources, and general discussion to comp.sys.amiga.misc.