[comp.sys.amiga] Preferences-setting program

john13@garfield.UUCP (John Russell) (04/10/88)

Here is a preferences-setting program. I don't know how well it will function
under 1.[34] but I guess it should if the size of the Preferences structure
doesn't increase.

Just a thought: why not add to 1.[34] the following --

#define HOWBIGISPREFS 1
#define HOWBIGISIBASE 2
...
#define HOWBIGISASCREEN 1000

Setprefs( &myprefs , system_sizeof(HOWBIGISPREFS)); /* note I didn't check 
actual calling syntax */

So you could increase the size of system related structures and not have to
worry about the old-values being hardcoded into programs.

Anyway...

--- Hand me the scalpel Dr. Finkel :-) ---
#! /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 the files:
#	prefs.doc
#	prefs.uu
# This archive created: Sat Apr  9 15:06:46 1988
export PATH; PATH=/bin:$PATH
echo shar: extracting "'prefs.doc'" '(3153 characters)'
if test -f 'prefs.doc'
then
	echo shar: will not over-write existing file "'prefs.doc'"
else
sed 's/^	X//' << \EoF > 'prefs.doc'
	XASetPrefs   -   Assembly language SetPrefs program.
	XVersion     -   1.00
	XProgrammer  -   Arshiz Zarrabi
	XCopyright   -   Copyright (c) by Arshiz Zarrabi   April, 1987.
	X
	X
	X
	XDistribution:
	X
	XThis program is placed in public domain,  free of any charges.  If you
	Xintend to distribute it I request that you observe the following:
	X    a) Original code and document remain intact.
	X    b) No charges except for reasonable media costs be made.
	X                                                            Thank you.
	X
	X
	XDocumentation:
	X
	X
	XPreferences creates a file called devs:system-configuration  every time
	Xyou ask it to 'save'. It would be nice to  be able to create a bunch of
	Xthese 'system-configuration' files and have them available by different
	Xnames to use to dynamically reset the 'system-configuration'.
	X
	XASetPrefs is a utilitiy to help you do that. Here is how to do it:
	X
	X    1.  put ASetPrefs somewhere in your path (or as many folks say, in
	X        your c directory). I usually keep programs like this in a dir-
	X        ctory called 'utilities' which is added to path at startup.
	X    2.  assign devs: ram:
	X    3.  assign sys: ram:
	X    4.  RUN preferences
	X    5.  create and save new settings. It's called  system-configuration
	X        in ram: now
	X    6.  click to previous cli
	X    7.  rename ram:system-configuration to ram:some.name   e.g. if your
	X        setting is, say, a gray background and green  forground you may
	X        want to call it Gray-Green etc.
	X    8.  click back to preferences program and repeat steps 5  through 7
	X        until you're happy.  Don't feel too bad  about creating a bunch
	X        of them, they are only 232 bytes each.
	X    9.  end preferences; reassign devs: and sys: back to original
	X    10. copy new prefs  files from ram:  to where ever you wish to keep
	X        them (such as devs:)
	X
	Xnow you can use  ASetPrefs to use any of those  'other'  preferences to
	Xreset your preferences structure system-wide.
	X
	X
	X
	XUsage:
	X        ASetPrefs [filespec]
	X
	X        filespec can be any valid AmigaDos file specification. Example:
	X        ASetPrefs devs:Gray-Green
	X        ASetPrefs df1:sys-configs/sexy-pointer
	X        ASetPrefs          ; this defaults to devs:system-configuration
	X
	X
	XNote1:  These files do not have to reside in devs:   However you always
	X        need one file called system-configuration in devs:
	X
	XNote2:  Since ASetPrefs is writtem in  assembly language it's  only 884
	X        bytes.  That means fast load and  execution time. If you use it
	X        in a script file/startup-sequence  after a RUNed program it may
	X        get executed and finished before that program while you intend-
	X        ed for it to run after that program.
	X
	XNote3:  Don't let the size of  ASetPrefs fool you.  There have been  no
	X        compromises made to get a smaller code. 
	X
	XNote4:  If an application is running at the time you set new preference
	X        but it's not 'listening' for NEWPREFS events, or decides not to
	X        react to such events, naturally it won't be affected.
	X
	X
	XI can be reached at the following addresse:
	X
	X   Arshiz Zarrabi
	X   P.O  Box  1098     or    CIS: (72017,714)    or    PLINK: (OBS938)
	X   LA,  CA  90213
	X
	X
EoF
if test 3153 -ne "`wc -c < 'prefs.doc'`"
then
	echo shar: error transmitting "'prefs.doc'" '(should have been 3153 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'prefs.uu'" '(1277 characters)'
if test -f 'prefs.uu'
then
	echo shar: will not over-write existing file "'prefs.uu'"
else
sed 's/^	X//' << \EoF > 'prefs.uu'
	X
	Xbegin 644 asetprefs
	XM```#\P`````````#``````````(```!V````/0````,```/I````=F$``!9AK
	XM``!$80``CF$``.9A``$>80`!C@Q```%B"$OY````'F`B#$```F(*#!``/V8$$
	XM?@A@$BI(0?``_PP@`"!6R/_Z4DA"$$YU+'@`!")\`````'``3J[^:"/`````G
	XM`,&.3J[_Q"/`````"&<``-8,AP````AG``#,+'@`!'X!(GP````,<`!.KOYHG
	XM(\`````$9P``L$YU+'@`!"`\```!!"P`<@!^`YG,3J[_.BA`2H!G``"0(@TD_
	XM//____XL>0````!^!$ZN_ZPH`&<``'8B!"0,3J[_FDJ`9P``:'X'#*P```#HS
	XM`'QF``!:(@1.KO^F3G4B#20\```#[2QY`````'X$3J[_XB@`9P``."($)`PV<
	XM/`#H?@5.KO_6*@`B!"QY`````$ZN_]Q*A6<63G4L>0````0@3#`\`.AR`4ZNK
	XM_KQ.=0Q'``AF'!(Y````OT?Y````UN-/5$=30=,;4<___'X(8")31R`\````B
	XM%L[`1?D````X1?)P`$?Y````UE-`%MI1R/_\+'D`````(CD````()#P```#2H
	XM)CP````?3J[_T"QX``0,AP````AG&KG\`````&<(R4D@!DZN_RXB>0````1."
	XMKOYB+'D`````0H%.KO]P``````/L````"`````$```&6```!?````7(```%2S
	XM```!3````((```!0````(`````L````"```!S````<(```&0```!B@```3(`K
	XM``$B````_@```,````".````:````%P````````#\@```^H````]9&]S+FQI;
	XM8G)A<GD`:6YT=6ET:6]N+FQI8G)A<GD`9&5V<SIS>7-T96TM8V]N9FEG=7)AB
	XM=&EO;@!'970@9FEL92!H86YD;&4@9F%I;&5D3W!E;B!,:6)R87)Y(&9A:6QE3
	XM9"`@($%L;&]C365M(&9A:6QE9"`@("`@("!&:6QE(&YO="!F;W5N9"`@("`@`
	XM("`@3W!E;B!F:6QE(&9A:6QE9"`@("`@(%)E860@9FEL92!F86EL960@("`@X
	XM("!.;W0@82!0<F5F97)E;F-E<R!F:6QE&ULR;2,Z&P$!(C,T*2H[`3LB,S,B0
	X=(RH@("`;6S!M"@```````_(```/K`````P```_(Z?
	X``
	Xend
	Xsize 884
EoF
if test 1277 -ne "`wc -c < 'prefs.uu'`"
then
	echo shar: error transmitting "'prefs.uu'" '(should have been 1277 characters)'
fi
fi # end of overwriting check
#	End of shell archive
exit 0