next up previous contents index
Next: C. Credits: The People Up: Plucker for PalmOS Previous: A.5 In Swedish   Contents   Index

B. The Database Format

Introduction

This document is the official description of the database format used by Plucker.

Overview

The Plucker database consists (like all PalmOS databases) of a number of records. All databases have an index record and also a series of document records.

The Index Record

This record includes info about the compression type used for the database and also what IDs the reserved records use. The viewer will use this record to know where to look for the reserved records and whether it must have support for ZLib compression. This record should always be the first record in the database (i.e. at index 0).

Field Bytes Type Notes
uid 2 Numeric unique ID for record, always 0x0001
version 2 Numeric 0x0002 if data is ZLib compressed, 0x0001 if DOC compressed
records 2 Numeric number of reserved records
reserved 4*records Numeric reserved ID array

The reserved ID array consists of a series of name/ID pairs, where the ID is the unique ID (2 bytes) for the record and the name is a value (2 bytes) from the following list.

The Document Records

There are several different types of document records.

Text documents start with a document header, followed by a series of paragraph headers before the compressed/uncompressed data, while all the other types only have a document header and data.

NOTE: No text document should include data larger than 32k. If the original document is larger than 32k, then the parser have to split it into several records.

Field Bytes Type Notes
uid 2 Numeric unique ID for record
paragraphs 2 Numeric number of paragraphs
size 2 Numeric total length of text before compression
type 2 Numeric document type (only the first byte of the type is used, the second byte should be set to 0x0)

Document type Value
DOCTYPE_PHTML 0
DOCTYPE_PHTML_COMPRESSED 1
DOCTYPE_TBMP 2
DOCTYPE_TBMP_COMPRESSED 3
DOCTYPE_MAILTO 4
DOCTYPE_LINK_INDEX 5
DOCTYPE_LINKS 6
DOCTYPE_LINKS_COMPRESSED 7
DOCTYPE_BOOKMARKS 8

For text documents the header is followed by a series of paragraph headers, each one represents a paragraph block in the text data.

Field Bytes Type Notes
size 2 Numeric total length of paragraph before compression
attributes 2 Numeric paragraph info

The first 5 bits in the attributes are unused, the 3 LSB indicates the amount of extra paragraph spacing (2*value pixels).

Text data
The (uncompressed) text data contains either characters or 'functions'. A function is introduced by a NULL (\0), followed by a function code and up to 7 bytes of data. The 3 LSB of a function code represent the remaining function code length; the 5 MSB represent the actual function code.

Code Description Bytes Arguments
0x0A Anchor begins 2 document ID
0x0C Named anchor begins 4 document ID, paragraph offset
0x08 Anchor ends 0 no data
0x11 Set style 1 font style
0x1A Embedded image 2 document ID
0x22 Set margin 2 left margin, right margin
0x29 Alignment of text 1 alignment
0x33 Horizontal rule 3 height, width (pixels), width (%)
0x38 New line 0 no data
0x40 Italic text begins 0 no data
0x48 Italic text ends 0 no data
0x5C Image anchor begins 4 document ID, image ID
0x60 Underline text begins 0 no data
0x68 Underline text ends 0 no data

Argument Bytes Notes
document ID 2 reference to record in database
image ID 2 reference to image in database
paragraph offset 2 paragraph number (starting from 0) to jump to
font style 1
PalmOS 2.x PalmOS 3.x
stdFont = 0 stdFont = 0
boldFont = 1 largeBoldFont = 1
boldFont = 2 largeBoldFont = 2
boldFont = 3 largeFont = 3
boldFont = 4 largeFont = 4
stdFont = 5 boldFont = 5
stdFont = 6 boldFont = 6
stdFont = 7 boldFont = 7
left margin 1 left margin in pixels
right margin 1 right margin in pixels
alignment 1 alignment code (left = 0, right = 1, center = 2)
height 1 height of horizontal rule in pixels, if not given a default value of 2 pixels will be used
width (pixels) 1 width in pixels, should be 0 if percentage value should be used
width (%) 1 width as the percentage between the current left and right margins. The default is 100%

Image data
The image data is the compressed/uncompressed Tbmp.

Mailto data
The mailto data contains info about e-mail addresses that are referenced by the mailto anchors. All the offsets are counting from the end of the document header.

Field Bytes Type Notes
to_offset 2 Numeric offset to TO string
cc_offset 2 Numeric offset to CC string
subject_offset 2 Numeric offset to SUBJECT string
body_offset 2 Numeric offset to BODY string
strings 0+ NULL-terminated strings a list of To, Cc, Subject and Body strings (if any)

URL handling data
The URL handling data is used to find the correct URL document. It contains a series of 2 byte number pairs.

Field Bytes Type Notes
last_url 2 Numeric the document ID of the last URL in the group
id 2 Numeric record ID for the URL document containing the group

URL data
The URL data contains a list of the URLs. Additional documents are created if needed and contain up to 200 URLs.

Field Bytes Type Notes
URLs 1+ NULL-terminated strings a list of up to 200 URLs (only text and image documents are included, other records are represented only by the presence of a NULL)

These documents may or may not be compressed. This is indicated by the type in the header. These records are used by the Details form to display the URL of the current document and by the External Reference form to display the URL of not collected documents. From either form you can copy the URL to a Memo to remind you to pluck it at a later date.

External bookmarks data
The external bookmarks data contains a list of bookmarks added by the parser. It will work just as for named anchors.

Field Bytes Type Notes
bookmarks 2 Numeric number of bookmarks
offset 2 Numeric offset to the start of the bookmark data (counting from the beginning of the record)
names < 21*bookmarks NULL-terminated strings a list of bookmark names (each name is max 20 chars)
bookmark_data 4*bookmarks Bookmark Data block of data for the location of the external bookmarks (see below)

The bookmark data is a series of uid/offset pairs.

Field Bytes Type Notes
uid 2 Numeric unique ID for document
offset 2 Numeric paragraph offset

© Copyright 2000 Michael Nordström <micke@sslug.dk> $Id: PluckerDB.tex,v 1.8 2000/10/23 18:11:36 nordstrom Exp $


The Plucker Team