home *** CD-ROM | disk | FTP | other *** search
- !DataToAOF
-
- By Paul Fidler
-
- version 1.00 (11th Feb 1993)
-
-
- About The Program
- ~~~~~~~~~~~~~~~~~
-
- This program is designed primarily for C or ARM code programmers, who wish
- to store data of some sort or other within their programs. I wrote it so
- that I could store sprites files within !Runimage files, to stop people
- editing them.
-
- The program allows you to encapsulate any file within an AOF file that can
- then be linked into your program. This will allow you to include data,
- sprites, templates, drawfiles etc. inside the !RunImage file of your
- application, where they're safe from prying eyes.
-
- I have written a replacement to the Risc_OSLib resspr functions to allow
- sprites files to be hidden. You will have to write functions to deal with
- any other sort of files yourself (although I hope to have replacement
- template functions ready soon).
-
- Examples are provided to show you how to use text files and sprites files.
-
-
-
- Installation:
- ~~~~~~~~~~~~~
-
- Included with this file should be:
-
- !DataToAOF Frontend application
- Library Directory containing the command-line application
- Examples Directory containing two example programs
- HiddenLib Directory containing replacement resspr functions
- tool Six line textfile to update !Make
- Guide This file
-
- 1) The '!DataToAOF' application should be placed in DDE$Path
-
- 2) The 'Library.datatoaof' file should be placed in your library.
-
- 3) The 'tool' textfile should be appended to the end of !Make.choices.tools
- Note that there are exactly six lines per tool with no blank lines in
- between tools (although some of the six lines may be blank).
-
-
- !DataToAOF Application
- ~~~~~~~~~~~~~~~~~~~~~~
-
- This is a Frontend application. You need to Frontend Module (supplied with
- the Desktop Development Environment) to run it. When run, the program
- installs itself on the icon bar. Clicking on the bar icon opens the main
- window. This contains the following icons.
-
- Icon Action/Meaning Default
- ---- -------------- -------
- File Name of file to be stored nil
- (typed or dragged)
-
- Read Only This sets the READONLY bit of the area off
- attributes. You should set this if your
- data will not be written to by your
- program. At present, it makes little
- difference, whether or not it is set
- correctly, but future operating systems
- may insist on it.
-
- Store length This stores the length of the data file on
- in the AOF file. Note that it is not
- sufficient to type something into the
- 'Length's symbol' field (see below).
- If your program needs to know how long
- your original data file was, then you
- must set this icon.
-
- Store Data as This makes the data's symbol a pointer. on
- pointer Set it if you wish to use the data as a
- C array. If the data is to be accessed
- from Assembler, it is probably better not
- to use this option. See the Technical
- Details section for more information.
-
- Data's symbol This sets part of the name by which your ""
- data is referenced from within your program
- It may be prefixed or appended by the
- leafname of your data file if you desire
- (see below).
-
- Length's symbol This sets part of the name of the variable "_length"
- used to store the length of the data file
- in your program. It may be prefixed or
- appended by the leafname of your data file
- if you desire (see below).
-
- Prefix leafname This prefixes the leafname of the data file on
- to both 'Data's symbol' and 'Length's symbol'
- This is the default option if you use !Make.
-
- Append leafname This is as for 'Prefix leafname' except that off
- the leafname is appended.
-
- Omit leafname This ensures that neither symbol is altered off
- by the leafname.
-
-
- N.B. If neither 'Prefix leafname', 'Append Leafname' nor 'Omit leafname'
- are set, then 'Prefix leafname' is assumed by default.
-
-
-
-
- The datatoaof Command Line Tool
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- If you are writing your own MakeFiles, or if you prefer to enter commands from the command line, then you will need the information below:
-
-
- Command format: datatoaof -f <source_file> -o <output_file> [options]
-
- Command options:
-
- -D <symbol> Data's Symbol
- -L <symbol> Length's Symbol
- -DP Makes Data's symbol a pointer. ie. (void *)
-
- -R Puts the data and symbol(s) in a Read only area.
- -S Stores Length information.
-
- -P Prefixes the symbol(s) with the source's leafname.
- -A Appends the symbol(s) with the sources leafname.
- -N Omit's the the leafname.
-
- The above is identical to the output of 'datatoaof -help'
-
- In addition, if you do write your own MakeFiles, you should also include:
-
- -depend !Depend
-
- to the list, and this will sort out the dynamic dependencies section of your
- makefile automatically
-
-
-
- HiddenLib
- ~~~~~~~~~
-
- This section will only be of interest to C programmers. HiddenLib replaces
- the Risc_OSLib resspr_* functions. I hope it will eventually replace
- template_* as well.
-
- To use the new version of resspr_* you must 'compile' your Sprites file with
- the 'Store length' option and without the 'Read Only' option.
-
- A typical program would look like this:
-
-
-
- /* Example /*
-
- #include "resspr+.h"
- #include "baricon.h"
-
- /* and so on */
-
- /* declare the external references */
- extern int sprites_length;
- extern spritearea *sprites;
-
-
- /* Put your program here */
-
- void init_proc(void)
- {
-
- /* Do all your initialising */
-
- resspr_init(sprites, sprites_length);
-
- /* Do some more initialising */
- }
-
-
-
- Look at Examples.Example2.!HideTest.c.HideTest for a complete example.
-
-
-
- Technical Details
- ~~~~~~~~~~~~~~~~~
-
- This section will mainly interest ARM code programmers.
-
- The AOF files that datatoaof produces come in one of four varieties,
- depending upon whether the length is stored or not, and whether the data is
- stored as a pointer or not.
-
-
- The code fragments below show what is actually compiled.
-
-
-
- 1) Length stored, Data is pointer
-
- EXPORT |data_length|
- EXPORT |data_pointer|
-
- AREA |DataToAOF$$Data|, DATA ; Possibly with ,READONLY as well
-
- |data_length|
- DCD 12345678 ; The length of your file.
- |data_pointer|
- DCD startofdata ; The data pointer
- DCD 00000000 ; Blank word
-
- startofdata
- DCB "The file goes here"
- ; The file data
- ALIGN
- END
-
-
-
- 2) Length Ommited, Data is pointer
-
- EXPORT |data_pointer|
-
- AREA |DataToAOF$$Data|, DATA ; Possibly with ,READONLY as well
-
- |data_pointer|
- DCD startofdata ; The data pointer
- DCD 00000000 ; Blank word
-
- startofdata
- DCB "The file goes here"
- ; The file data
- ALIGN
- END
-
-
-
-
- 3) Length stored, Data is first item
-
- EXPORT |data_length|
- EXPORT |data|
-
- AREA |DataToAOF$$Data|, DATA ; Possibly with ,READONLY as well
-
- |data_length|
- DCD 12345678 ; The length of your file.
- DCD 00000000 ; Blank word
-
- |data|
- DCB "The file goes here"
- ; The file data
- ALIGN
- END
-
-
-
- 4) Length ommited, Data is first item
-
- EXPORT |data|
-
- AREA |DataToAOF$$Data|, DATA ; Possibly with ,READONLY as well
-
-
- DCD 00000000 ; Blank word
- |data|
- DCB "The file goes here"
- ; The file data
- ALIGN
- END
-
-
-
- You can use DecAOF to see exactly what is produced.
-
-
-
- Bug Reports / Comments
- ~~~~~~~~~~~~~~~~~~~~~~
-
- I would welcome any bug reports. I will do my best to fix them and release a
- new version as soon as possible.
-
-
- I can be contacted at:
-
- email: praf1@uk.ac.cam.phx
-
- term-time: Paul Fidler
- Churchill College
- Cambridge
- CB3 0DS
-
- vacations: Paul Fidler
- 17 Kenerne Drive
- Barnet
- Herts
- EN5 2NW
-
-
-