home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 3
/
PDCD_3.iso
/
pocketbk
/
developmen
/
agformat
/
AGNFILE.TXT
Wrap
Text File
|
1993-09-15
|
43KB
|
1,205 lines
SERIES 3A AGENDA FILE FORMAT
Introduction
Series 3a Agenda files are binary files containing typed
variable length records. They use the same basic file and
record structure as DBF files, but the file signature and
internal record structure are NOT the same.
Basic structure of Agenda files
The basic file structure for Agenda files is as follows:
<standard header> Used to identify the file type and the
version of the file structure.
<extended header> For future use, currently omitted.
<data records> The main body of the file, containing
entries and preferences.
The standard header
The standard header is present at the start of all Agenda
files and is always 32 bytes long.
AGD_SIG_SIZE 16
AGD_SPARE_SIZE 12
typedef struct
{
UBYTE sig[AGD_SIG_SIZE];
UWORD version;
UWORD hSize;
UBYTE spare[AGD_SPARE_SIZE];
} AGD_FILE_HEADER;
The first 16 bytes of the file are always the zero
terminated string AgendaFileType*. This is used to identify
the file as an Agenda file.
The two byte parameter version at file offset 0x100f should
be interpreted as a hexadecimal word that gives the version
of the file format. This is currently always 0x100F. The
most significant nibble (the version number is in the format
described in the General System Services chapter of the Plib
Reference manual) is the major version number and any change
in this indicates that the file format may not be backwards
compatible.
The two byte parameter hSize gives the combined size of the
standard and extended header. This effectively gives the
file offset of the first data record within the file.
Currently this is always 0x0020.
The array spare should not be used and is reserved for
future use.
The extended header
At present this is never used and is reserved for future
expansion.
The data records
As in DBF files all data is stored as variable length, typed
records, with the type and length combined into a single
word (two bytes). The most significant nibble of the word
gives the record type. The type determines how the contents
of the record are to be interpreted. The remainder of the
word gives the length of the data that follows. This file
structure is designed to be flash friendly in that deleted
records are not normally removed from the file but are
marked with record type 0 which can be done in place.
This structure allows 16 record types 0x0 to 0xf, each of
which are allowed to be up to 0xffe (4094) bytes long.
Although a record length of 0xfff is not explicitly illegal
it is not used.
Record Types
There are sixteen record types as follows.
Type Record
0 Deleted
1 Appointments (timed day entries)
2 Day notes (un-timed day entries)
3 Anniversaries
4 To-do entries
5 Repeat records
6 Anonymous data
7 Reserved
8 Reserved
9 To-do list information
10 Descriptive records 1
11 Descriptive records 2
12 Descriptive records 3
13 Descriptive records 4
14 Descriptive records 5
15 Illegal (used to mark write failure)
Currently record types 6, 7 & 8 are never generated by the
Series 3a Agenda.
A number of the records contain day numbers and times.
Unless stated otherwise all dates are given as a daynum. A
daynum is the number of days from 1 Jan. 1970. For technical
reasons dates before 1 Jan. 1980 (daynum 3652) or after 31
Dec. 2049 (daynum 29219) are ignored by the Agenda and where
appropriate will be 'clipped' to one or other of these dates
(for example a repeating entry that starts on 10 June 1970
will have its start date 'clipped' to 1 Jan. 1980).
Type 0: deleted record.
As for DBF files, deleted records are not normally removed
from the file but have their record type changed to type 0.
As any of the above record types may be converted to a type
0 record, there is nothing that can usefully be said about
the contents of such a record (indeed the record may not
even have been a valid Agenda record before it was deleted).
Records of this type should be ignored except to calculate
the amount of space that would be freed by compressing the
file.
There may be any number of such records in the file.
Types 1 to 4: entry records.
Records of type 1 to 4 contain details of individual Agenda
entries. Each has the same conceptual structure as follows:
<Entry details This is dependent on the entry type.
field>
<Title field> Obligatory, variable length field
containing the text of the entry.
<Alarm field> Optional, fixed length field
containing alarm time and sound.
<Memo field> Optional variable length field
containing any memo for the entry.
The record type is used to determine the length and meaning
of the first field. Although these have some similarities
all four are individually described in details below.
Entry details field
This field contains most of the non-textual information
describing when an entry occurs, what other fields it has
and various bits of type specific information, such as the
duration for timed appointments.
Type 1 (timed day entry/appointment)
A type 1 record stores details of entries that occur at a
specific time on a specific day. In the Series 3a Agenda
these are called timed day entries.
The details field for a timed day entry consists of eight
bytes structured as follows:
UWORD day;
UWORD time;
UBYTE attr;
UBYTE code;
UWORD dur;
day is the daynum of the day on which the entry
appears.
time is the time of the start of the appointment
in minutes from midnight.
attr is a byte containing flags for attributes the
entry may or may not have (see below).
code is the ASCII character code for the symbol
that is to be associated with the entry when
it is visible in the Year view. Values less
than 32 are ignored and treated as if the
entry should not appear in the Year view.
dur is the duration of the appointment measured
in minutes. It is constrained such that the
appointment cannot end after 11:59 PM. i.e.
this field is between 0 and 1439 - time
(inclusive).
Type 2 (untimed day entry/note)
A type 2 record stores details of entries that appear on a
specific day but do not have a time associated with them. In
the Series 3a Agenda these are called untimed day entries.
The details field for an untimed day entry consists of six
bytes structured as follows:
UWORD day;
UWORD slot;
UBYTE attr;
UBYTE code;
day is the daynum of the day on which the entry
appears.
slot is the time slot (in minutes from midnight)
in which the entry will appear in the Day and
Week views. For example a slot value of 780
would show the entry at the start of the 1pm
slot. If this is 0xffff then the anniversary
will appear in the default slot.
attr is the attributes byte (see below).
code is the ASCII character code for the symbol
that is to be associated with the entry when
it is visible in the Year view. Values less
than 32 are ignored and treated as if the
entry should not appear in the Year view.
Type 3 details (anniversaries)
A type 3 record stores details of anniversaries (entries
which appear in the Anniversary view). Although these are
usually repeated there are cases where a single anniversary
entry will exist. For details of repeated