/*
	Amiga Filterium 2001 configuration file

	by Andy Silva + some kreative inspirations of LEA

	write to: silva@psi5.com
	homepage: http://www.psi5.com/~silva/afilter/
*/

; optional custom PlugIns directory
;
;PLUGINSDIRECTORY	= "path here"


; open own console window x/y/w/h

;WINDOW			70/11/535/188
;WINDOW			0/0/605/199
;USEWINDOW		0/0/605/199


; global filehandling

FILEOPTIONS	ALLWAYSREQUESTER
{
;	IFEXISTS	ADDNUMBER
	REQUESTER	ASL
	{
		PATTERN	OFF
		LEFT	330
		TOP	5
		WIDTH	207
		HEIGHT	210
	}
	;ALLFIXBEHIND
	PATH		{ SAVE ram: TEMP ram: }
	COMMENT		"%type from %loadname - %afilter"
	EXCLUDE	"(#?.(inf#?+htm#?+fnf+guide+asm+c+s+a+doc+i+h+dok+dox+txt+text+lst+log)+#?(readme+liesmich+displayme)#?)"
}


; configurable color of bitplane in memview

SETPLUGIN	memview	{ CFG { PLANECOLOR $044 } }


; default macro to use

DEFAULTCALL	ffa


; other global options

;NOMOUSESTOP
;NOUSER
;REPORTDEBUG



; simple macro to save the Kickstart ROM into a file

MACRO	kickromtofile
{
	DESC	"save Kickstart ROM image file"
	CALL	selectkickrom
	{
		CALL	savefile
	}
}

; annother simple one to find music in chipmem

MACRO	findchipsound
{
	DESC	"run unirip on the chipmem"
	CALL	selectchipmem
	{
		CALL	scanloop		; step it through
		{
			CALL	unirip.find
			{
				CALL	savefile
			}
		}
	}
}


; next is to find all on a non AmigaDOS Amiga disk (games)

MACRO	fda
{
	DESC	"find all on a directoryless game disk"
	CALL	disk.readimage { CALL ma_everythingrecursively }
}


; the following macro was specified at the DEFAULTCALL keyword above,
; thus it will be used as default
;
;	it is optimized to find averagely everything
;	Amiga Filterium now _can_ find,
;	so, all plugins are used somehow

MACRO	ffa	; after the keyword 'MACRO' follows the name
		; of the macro define here
		; 'ffa' I choosed for means 'find in file all'

{	; open subsection for macro contents

	; description for 'afilter MACROS' list of macros

	DESC	"find in file all and choose save or other"

	; now the operation steps which this macro will do follow

	CALL	xvs.cleansys	; survey memory from viruses

	; first: use a builtin filter for first input,
	; 'loadfile' will load a file or open a requester
	; (other source-input-filters can be used here, too)

	CALL	loadfile

	{	; open subsection for parameters to 'loadfile'
		; and to define what to do whit that file

		; give a path where to start in the filerequester
		; if no filename is given in the commandline or
		; in some other ways per icon, opus, etc

		;ARG	ram:

		; lets use the macro named 'ma_everything' for
		; our input file (continue there, see below)

		; change the following line to 'ma_simple'
		; or whatever you want to do with the file(s)

		CALL	ma_everythingrecursively
	}
}



; now the macro 'ma_simple' follows
;
; As you can see it is not neccessary to put every keyword or
; subkeyword in a new line. As far as you know what you do...
; And again this macro calls other macros (see below)

MICRO	ma_simple
{
	; input datas to this macro (the file) will be checked
	; for beeing xfd-compatible packed via the filter 'xfd.check'
	; from the plugin 'xfd', what to do if the _are_ follows in
	; a subsection to its call

	; in the _same_  section as the call of 'xfd.check' follows
	; what to do if the input datas were _not_ xfd-compatible

	CALL xfd.check {CALL xfd.decrunch {CALL scanloop {CALL ma_whatis}}}

	; if none of the above both filters matched,
	; the macro 'ma_whatis' (see below) is called to run the
	; other filters from other plugins on the input datas

	CALL scanloop {CALL ma_whatis}

	; if none of the above filters matched, scan with xfd
	;    the call of the 'ma_whatis' macro in a subsection to
	;    'xfd.decrunch' works with the outputs from the decrunch

	CALL xfd.scan {CALL xfd.decrunch {CALL scanloop {CALL ma_whatis}}}
}



; The following does the same and even much more recursively!
; Why? Yeah ... don't ask me why someone put an lha-file in
; a powerpackerfile and that in some krzkrlcruncha or paranoimia uhhh...

MICRO	ma_everythingrecursively
{
	CALL	xvs.checkrepair { CALL ma_everythingrecursively }
	CALL	disk.unflash { CALL ma_choice }
	CALL	xad.unarc { CALL ma_everythingrecursively }
	CALL	xfd.check { CALL xfd.decrunch { CALL ma_everythingrecursively } }
	CALL	scanloop { CALL ma_whatis }
	CALL	xfd.scan { CALL xfd.decrunch { CALL ma_everythingrecursively } }
	CALL	ma_choice

;	; gag
;	PRINT	"Hello world!"
;
;	; aufwändig, flexibel
;	CALL	filterselect { CALL filterselect }
;	CALL	macroselect
;
;	; flexibel
;	IFCLASS	Protracker { CALL to_delitracker }
;
;	; abwegig
;	INPUT	...

}



; the followings are called from multiple places above

MICRO	ma_whatis
{
	CALL	findtext { 

		; remove ';' below for other opts combination
		CFG	{
			;UPPERCASEONLY
			 MINLENGTH 30		; default is 20
			;NOGAP			; no 2 byte gaps of not-text
			}
		CALL textformat { CALL ma_choice } }

	CALL	iff.find { CALL ma_choice }
	CALL	unirip.find { CALL ma_choice }
	CALL	prowiz.find { CALL choice {

		; do what

		ARG	"'s'ave, convert to 't'racker, 'm'emview"
		CFG	{DEFAULT m}

		CALL	savefile
		CALL	prowiz.tomod { CALL savefile }
		CALL	memview.view { CALL savefile } }}

	CALL	hunk.find { CALL ma_choice }
}

MICRO	ma_choice
{
	CALL	choice
	{
		ARG	"'s'ave, sc'a'n, 'm'emview, m'u'ltiview, cygnus 'e'd"
		CFG	{DEFAULT m}

		CALL	savefile
		CALL	ma_everythingrecursively
		CALL	memview.view { CALL savefile }
		CALL	to_multiview
		CALL	to_ced
	}
}


MICRO	ma_sfxsave
{
	CALL	choice	{

		ARG	"'s'ave, 'm'ake it Soundtracker15"
		CFG	{DEFAULT s}

		CALL	savefile
		CALL	unirip.sfxtomod { CALL	savefile } }
}



MACRO   mvf
{
	DESC	"memview file, select and save range"
	CALL	loadfile { CALL	memview.view { CALL savefile } }
}

MACRO	uni
{
	DESC	"use unirip only"
	CALL	loadfile {CALL scanloop {CALL unirip.find {CALL savefile}}}
}

MACRO	eorfile
{
	DESC "make exclusive or on a file with a byte value"
	CALL loadfile {CALL eor { CFG{BYTE=$FF} CALL ma_choice }}
}

MACRO	unlink
{
	DESC	"separate linked files with xfd.unlink"
	CALL	loadfile {CALL xfd.unlink {CALL savefile} }
}

MACRO	clipboot
{
	DESC	"save the bootblock from a diskimage as file"
	CALL	loadfile { CALL	selectrange {
		CFG	{ OFFSET 0 LENGTH $400 }
		CALL	savefile } }
}

MACRO	saveboot
{
	DESC	"view or save a disk bootblock to a file"
	CALL	disk.readboot { CALL ma_choice }
}

MACRO	makeadf
{
	DESC	"save a complete 880k Amiga disk to a file"
	CALL	disk.readimage { CALL savefile }
}

MACRO	unarc
{
	DESC	"unarchive anything, use XAD/XVS only"
	CALL	loadfile { CALL xad.unarc {
			CFG {MAKEDIRS, ALLFILES}

			CALL xvs.checkrepair { CALL savefile }

			CALL savefile } }
}



; paths and calls of external programs, batchfiles, arexx
;
;	- this macros are used from other macros
;	  to have the paths to the programs only once
;	- they do not work as stand alone but from other macros


MICRO	to_multiview	{ CALL execute {ARG "sys:tool/multiview %"}}
MICRO	to_ced		{ CALL execute {ARG "sys:tool/ed %"}}



; give global names to bundle settings for sounddatas

CLASS	Sound
{
	CLASS	Tracker
	{
		CLASS	Protracker
		CLASS	Soundtracker15
		CLASS	Startrekker
		CLASS	StartrekkerAM

		; save all tracker things to this path

		PATH	mod:

		COMMENT	"%loadname"
	}


	CLASS	Exotic
	{
		CLASS	SoundFX13
		{
			; call macro automatically if SoundFX13 encountered

			AUTO	ma_sfxsave
		}

		; automatically invoke some patchers
		; if data of their type found

		CLASS	SidMon1		{AUTO unirip.patchsid}
		CLASS	Gremlin		{AUTO unirip.patchgremlin}
		CLASS	Whittacker	{AUTO unirip.patchdw}

		; save these types to own path

		PATH	mus:
	}
}


; following class definition will call the macro 'to_ced' (see above,
; which sends to cygnus ed) everytime immediately
; when formated text is produced

;CLASS	fText	{ AUTO to_ced }


; Note: 'Text', 'Protracker', 'Soundtracker15' and 'SoundFX13' here are
; the names of the types of data as you can list them with afilter
; (shell command 'afilter ?' will bring you some infos on howto).
;
; But: 'Sound' and 'Tracker' actually are not an existing special
; type of data.
; Here they just hold the place and combine more specific types with
; the same reactions as you can see if you follow the hierarchy.



; misc debug and test purpose macros

MACRO	disktest
{
	DESC "just for debug purposes"
	call loadfile { call disk.unflash { call memview.view } }
}

MACRO	testxvs
{
	DESC	"just for debugging"
	CALL loadfile { call xvs.checkrepair { call memview.view } }
}


/* ----------------------------------------------------------------------

	ps: Zak McKracken for president

*/
