home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Elysian Archive
/
AmigaElysianArchive.iso
/
emulate
/
resgrep0.lha
/
ResGrep03b
/
doc
/
ResGrep.doc
< prev
next >
Wrap
Text File
|
1992-06-16
|
16KB
|
513 lines
ResGrep
Version 0.3 beta
Idea and Written: Andre Florath
copyright 1992 by Andre Florath
Introduction
ResGrep is a program to convert Apple Macintosch resource forks
to IFF. In the program 'ResGrep' there are two functional units:
you can decide which resource will be converted, and you can
determine how to convert the data.
I wrote this program, because there are a lot *good* icons,
sounds, pictures on a Mac, and because I want to learn C++.
(It's my first program written in C++.)
To select the resources you only have to click (only once; no
doubleclick is needed) at the type and id of the resource
(similar to ResEdit). But in ResGrep there are no editors or
viewers as there are in ResEdit. Your "normal" programs, i.e. a
texteditor, a graphic- or a soundeditor, undertake the task of
viewing or editing the data. The interface between ResGrep and
the application is ARexx. The selected resource is converted to
IFF and written to a file or the clipboard. After that, a ARexx
script or a external (shell-)command is executed.
Hard- and Software Requirements
You only need a Amiga with 512KB RAM, AmigaOS 2.0, ixemulib
and some Mac Resource Files. If you want to convert Mac PICTs,
you also need 'picttoppm' and 'ppmtoilbm'. (They are freeware
and can be found on many boards in the pbm-plus package.)
Life is easier if you have a little bit more memory, a harddisk,
a lot of Mac Resource Files and some programs that support
ARexx, e.g. a graphic program, a sound program, a binary file
editor...
Recomanded is a >50Mhz chip set if you want to open more than
ten windows. (Try an see! That's no program bug! It's the
7.19MHz chip set. Why it's *SO SLOW*? Como please change!)
Install
The simple way
Doubleclick the Install icon. A window opens and you had to
answer to some questions about the names of the directories
where to install ResGrep.
The hard way
Copy the ResGrep executable and the utility programs (i.e.
compress, unsit and mac2ami; they can be found in the 'c' -
directory) to somewhere in your path. Copy the other files to
a place where they will life (e.g. 'copy df1:ResGrep
Work:Progs all'). You may want to delete the sources placed in
the 'source' directory. Assign ResGrep: to the directory.
(e.g. 'assign ResGrep: Work:Progs/ResGrep'). Be sure to have
'ixemulib.library' in your LIBS: directory. Assign (if you
haven't already) BIN: to the directory where the editors, i.e.
graphics- or soundeditor, are placed. Maybe you want to use
the 'add' option from 'assign'.
The 'BIN:' assign
The 'BIN:' assign is never used internally from ResGrep. It's
only used in the macros and conversions rules. If you don't
want to use the 'BIN:' assign, you can edit the rules and the
macros and change the 'BIN:progname' to the program's full
path (e.g. 'work:usr/bin/progname').
Nota Bene
ResGrep needs some stack, i.e. 4096 bytes is not enough. Use
at least 25000 byte! I don't know how much ResGrep uses, but
with this value it never gurus. (WARNING: Do NOT use 'srun'
from SKsh-Shell without the '-s' parameter! Use: 'srun -s
25000 ResGrep'.)
Mac Files
Mac files consists of three parts, called forks: the data fork,
the info fork and the resource fork.
The info fork contains system data for the MacOS and the Finder.
The data fork contains the data, i.e. the program's code, the
ASCII characters of a text.
The resource fork contains all the other data, i.e. sound,
pictures, icons, menus, menubars, requester, alerts, dialogs,
texts, version numbers, code, window definitions, palettes...
(You see, thats the most interested fork. :-) )
How to get Mac Files to your Amiga
There are a lot of ways to get Mac files to the Amiga. Two of
them -- those I have used -- are described here.
Use StuffIt archives
The simplest way is to stuff the files on a Mac with StuffIt
(the most common packer on a Mac), transfer them via modem or
M*-DOS disks from Mac to Ami and unstuff them. Every Mac file
falls into the three pieces described above. The unstuff
program, called 'unsit' is included in this distribution. The
manual page is placed in the 'doc' directory.
Use M*-DOS disks
Save the files on the Mac to a M*-DOS disk. Put the disk in
the Amiga and list the contents. There will be a (hidden)
directory named 'RESOURCE.FRK' or 'RESOURC&'. Change to this
directory. There will be the resource forks of the Mac files.
How to use
Start ResGrep
Doubleclick the icon from Workbench or type 'ResGrep' in a
shell. The main window opens with the title: 'ResGrep -
FileList' and a file requestor appears.
Convert Resources to Amiga files
At first open a resource file. You can choose the name with the
file requester. Later on, to do this, select 'Open...' from the
Project Menu. The filename with a unique number appears in the
main window. In every window titel that belongs to this file,
these number will appear. - To display the resource types of a
file, click at the resource's type. A window with resource types
will open.
To display the resources IDs of a specific resource type click
at the resource type. To export the data click on the resource
id.
If you want to open a window that is already open, the window is
activated and poped to front.
Hide and Reveal windows
If you work with some resource files there may be a lot of open
windows. With the menuitem 'Hide >>' you can hide one (the
active) window, some (all windows that were opened with clicks
in the active window) or all windows. These windows disapears
but the contents, size and positions is saved. With 'Reveal >>'
the hidden windows appear with their old contents and at the old
position.
Edit the conversion rules
Choose 'Edit Conversions...' from the Settings Menu. A requester
opens. For every resource type you can now specify the data
format to convert to, the filename the data is written to,
whether the data is written to a file or the clipboard and the
command to be executed after the data is written.
To add a rule, select 'Add...', to remove select 'Remove'. ;-)
(Builtin rules cannot be removed.)
How to use - an example
There is an example file called "Helmut.sit" in the directory
"MacProgs". Here is the description how to convert the
resources of this file to an Amiga usable form:
Unpack the archive
Unpacking is only possible from the CLI or a shell. Type:
'cd ResGrep:MacProgs'
to change to the 'MacProgs' directory, then type
'unsit Helmut.sit'
The computer works for about 30 seconds (a 7.19Mhz 68000,
A3000 may be faster) and it has unpacked three files: (type
'list' to see that all files exsists and have the same length)
-> Helmut.info 128 ----rwed Today
-> Helmut.rsrc 76015 ----rwed Today
-> Helmut.data empty ----rwed Today
The resources can be found in the file "Helmut.rsrc". You may
want to delete the "Helmut.info" and "Helmut.data" files.
Note: the "Helmut.info" file isn't a Amiga "*.info" file with
Workbench and icon information. It's the info fork from the
Mac file.
Starting ResGrep
To start ResGrep, doubleclick the icon or type 'ResGrep' in
the CLI or a shell. (Be sure to have about 25000 byte stack;
see 'Instalation' for further information.)
Loading the resource file
There will open a window and a file requester. Open the file
"Helmut.rsrc" with the file requester. The requester will
disappear and the name of the file with a leading unique number
is displayed in the window. (This number appears in every
window title concerning this file.)
Opening the resource types window
Click (once) a the name of the file, i.e.
"1 MacProgs/Helmut.rsrc". A window with all resources types
will open. There are six different resources in this file:
ICN#, PICT, STR#, ics#, snd , vers.
The ICN# resource
Click (once) the ICN#. Another window will open with the IDs
and names of the ICN# resorces. In this example there is only
one ICN# resource, with the ID -16455 and without a name. Click
(once) the ID. Now the programm converts the Mac icon to
IFF-ILBM and writes it to the clipboard. To use the icon,
start a painting programm or the IconEdit and paste the
picture from the clipboard (Edit-Menu: Paste; shortcut:
right-Amiga V) into the programm. Now you can edit and save
the picture.
You can close the window where the ID is display by
clicking at the 'close window' gadget or by pressing
rigth-Amiga K.
The PICT resource
To convert the PICT resource you must have the 'picttoppm' and
the 'ppmtoilbm' programm from the pbm-plus package and these
programms must be in BIN:.
Click the PICT line in the resource type window. A window will
open with one ID (128) an no name. Click on the ID. The skript
is started that converts the PICT to IFF-ILBM. About 45
seconds later the picture is displayd and there is a file
'T:picture.ilbm' thats obtains the picture.
The STR# resource
Click the STR# line in the resource type window. A window with
two resource IDs and names will open:
1000 Koan
1001 Fahrenheit
If you click one of the IDs, the resource is written to the
clipboard. In your editor you can now paste the text. (e.g.
start 'emacs' and press rigth-Amiga V)
Note: no mapping is done yet! (Mac uses CR instead of LF to
end a line.)
The ics# resource
It's a small icon. See 'The ICN# resource' how to use.
The snd resource
Click the snd line and an window will open. Click the ID line
and after some moments the sound will be played (if you have
'play8svx' in BIN:) and is written to 'T:SoundOut'.
The vers resource
Click (once) on the vers line in the resource type window. A
window with four lines will be open. Click on the IDs. A
window will open where the version information is displayed.
Conversion Rules
At the moment, there are only a few conversions: (B = builtin,
M = Macro, E = Extern command)
from to type description
<all> raw data B You can ever save the resource 'as
it is' to a file. Be carefull:
*never ever* write non IFF data to
the clipboard!
ICN# IFF-ILBM B B&W icon, 32 * 32 pixel
PICT IFF-ILBM ME Use the 'pbmplus' commands to convert a
PICT to ILBM. (There are to macros: one
uses files and the picture is displayed,
and one that uses pipes (it needs less
memory than the first, but the pic
isn't displayed, because I don't know
a program, that displays a pic from
stdin). (pict.rexx / pictpipe.rexx)
STR# IFF-FTXT B
M A macro for GnuEmacs is included.
Start GnuEmacs before exporting some
STR#. (emacs.rexx)
STR# plain ascii B I have implemented this, because
a lot of editors do not understand FTXT.
icl4 IFF-ILBM B 16 colour icon , 32 * 32 pixel
icl8 IFF-ILBM B 256 colour icon , 32 * 32 pixel
ics# IFF-ILBM B B&W icon, 16 * 16 pixel
ics4 IFF-ILBM B 16 colour icon, 16 * 16 pixel
ics8 IFF-ILBM B 256 colour icon, 16 * 16 pixel
snd IFF-8SVX B Only a very small subset of sound
commands is implemeted: one. It
searches the first sampled sound area
and converts it to 8SVX.
vers <display> ME A nice demo. Here you can see how to
write your own extern commands.
A ARexx skript is called, whitch
displays the version resource. (vers.rexx)
Some usefull hints
Look through the conversions list in the 'Edit conversions'.
There are examples for all actually implemented functions.
In the 'Command' field specify the full path name of the
command.
I use 'play8svx' to play IFF-8SVX files and 'zap' to dispaly raw
data. If you'll use other programs, change the 'Command' field.
Bugs, bugs, bugs...
The documentation - I'm not good in English. Is there somebody
out, who'll write a new (maybe good) documentation? (Although I
hope all of you can use this program with this bad docs.)
Compressed resources can't be unpacked, because I haven't
found documentation about the compression method. Is it
possible that there is no information about compressed
resources in the 'Inside Macintosch'? (MANY 'PICT's are
compressed!) There are two ways to get the uncompressed
resource:
- Use 'ResEdit'. Cut a compressed resource with Command-X and
paste it with Command-V. After this the resource is uncompressed.
- Send me documentation about the compression algorithm.
Masks of ICN# and ics# icons are ignored.
Write more and more conversions. (Feel free to send me your
viewers, conversion routines or ARexx skripts - they will be
included in the distribution.)
Fix some minor bugs in the menu selection. (Close for the main
window do not work; print isn't implemented; the checkmark
before 'Autosave settings?' do not switch; 'Save icons?' isn't
implemented; only one settings file is supported yet, though you
can't choose a filename after selected 'Load Settings...' or
'Save settings as...'.)
If the 'Edit conversions' or 'Add conversion' window is active,
all other windows are disabled, but no clock (or other wait)
pointer is shown.
A direct ARexx Port isn't implemended yet. (Never select the
'ARexx' in the 'Edit conversions' window.) If you want to use
ARexx use the 'rx' command.
The 'Find...' buttons hasn't any function yet.
You can't 'Cancel' the modifications in the 'Edit conversion'
window.
If the command do not exsists, no warning or error message is
displayed. The return code of the command is ignored.
It's impossible to close a project.
Trademarks
Amiga is a registered trademark of Commodore-Amiga, Inc.
GCC by GNU. (all to say) ported by Markus Wild.
ResGrep is no trademark of Andreas Florath.
AmigaDOS is a trademark of Commodore-Amiga, Inc.
GUI the Commodore HIG (greetings from LISA).
ARexx is a trademark of Wishfull Thinking Development Corp.
Mac build by Apple Computer.
ResGrep by Apple Computer.
M*-DOS is no operating system running not on HALs.
Thanx
Jan van den Berg for GadToolsBox. A great program.
Markus Wild for GCC20.
Allan G. Weber for his permission to include 'unsit' in this
distribution.
The Mac users Armin and Joannes.
Ute for mental support.
Bibliograpy
"Inside Macintosch"; Addison-Wesely; Reading, Massachusetts;
all volumes.
"AMIGA - User Interface Style Guide"; Addison-Wesely; Reading,
Massachusetts; 1991
Copyright
ResGrep IS COPYRIGHTED BY ANDREAS FLORATH.
THIS IS THE WRITTEN PERMISSON TO OWN IT, USE IT, COPY IT AND
GIVE IT TO EVERYBODY.
But there are some restrictions:
- it's strictly forbidden to use ResGrep for any military
program or programs that discriminate against somebody or
against a group
- it's forbidden to use ResGrep for any comercial program (if
want to use, please contact the author)
- it's forbidden to sell a disk whitch contains ResGrep for
more than 6,- DM (value at 04.1992)
- it's forbidden to modify the executable module
- only Fred Fish may distribut this program on a PD-Disk serie
No warranty is given to any part of this porgram.
USE IT ON YOUR OWN DISK! :-) (Oh, I mean RISK!)
Why ResGrep? Why Version 0.3 beta?
I released it in this early state, because the program is
stable, (never called the Guru to meditation) and I don't know
*who* will use it and *what* (s)he will need. (I will not invest
more time and work in this project if nobody will use it.) I
write it because I love the nice pings, pongs and ticks shipped
with the MacOS.
Now, ResGrep can convert PICTs and icons, I often use it to get
Mac pictures and icons working on my Amiga.
The big request
*Please*, if you use the program, (e)mail! If you need some
other conversion *please* contact me (or write one, see file
'export.cc')! If you have written a ARexx skipt for an external
program or a conversion function *please* send! If you find a
bug *please* let me know!
The address
Andreas Florath
Boxgraben 12
D-5100 Aachen
Germany
Email: florath@pool.informatik.rwth-aachen.de
Comming soon
At the moment I'm writing a external program to convert the MENU
resources. (Maybe I had to specify an IFF-MENU type -- that
will be a hard (and long) work...)
Resizable windows are nice.
The End
Have Fun!