About Formal Specs
From OHRRPGCE-Wiki
The Formal Specs are a method of describing the structure of any given lump. It describes the data using a sort of "map".
The map is a table which describes the format. It is 2 by x, where x can be any number. The first column is the "Data" column, which describes the type of data at any given point in the lump. The second column is the "Meaning" column, which is a short description of the data.
[edit] Data Types
For the purposes of the Formal Specs, the following data types will be used:
- BYTE: A single byte, combined to make other datatypes (0 to 255)
- INT: Two bytes, 16 bit signed integer (-32,768 - 32,767)
- LONG: Four bytes, 32 bit signed integer (-2,147,483,648 - 2,147,483,647)
- ZSTR: A series of bytes terminated with a byte of value 0. No fixed length.
- VSTR: A composite type, consists of a value with the length of the string, and a series of bytes equal in length to the value. No fixed length. Datatype of values is specified by either (b) or (i) -- see below.
- FVSTR: A fixed length composite where the first value contains the length of the string, and the lowest byte of each value thereafter contains a character. It is padded with un-initialized bytes so that the whole field is a certain length, indicated by (hU+cU = lU) in the "Data" column (Note: size indicated includes the length value). Read with readbinstring$() if unit is b, or readbadbinstring$ if unit is 'i'.
- Records Start: Most lumps consist of 0 or more headers, plus a variable number of records after. This indicates the begining of the records.
The datatype of each element in a string is specified by a suffix. This suffix can be b (BYTE, 8bits) or i (INT, 16bits).
[edit] Example of the Formal Specs
[[About Formal Specs]]
{| border="1" cellpadding="1" style="font-family:Courier New"
! Offset || Data || Meaning
|-
| colspan="3" | Records start (40 bytes)
|-
|0 || INT|| ID of plotscript
|-
|1 || VSTR (1i+b..)||Name of plotscript
|}
About Formal Specs
| Offset | Data | Meaning |
|---|---|---|
| Records start (40 bytes) | ||
| 0 | INT | ID of plotscript |
| 1 | VSTR (1i+b..) | Name of plotscript |
