##### Appendix
# Tag Types

[Related Topics] |

### Conventions

| Tag region of files have always lengths divisible by 8 In files, tags start always on positions divisible by 8. Tag_Id is case sensitive. File type is given by preamble 1 (except for settings files).

### File Preamble 1: File Magic

###

| The following table gives the file type identifying "magics" as to be found in preamble 1. This preample is filled up to its full length of 8 characters by chr(0) bytes.
File Type | File Extension | Preamble 1
`Comment Files` | PCO | PQCOMNT
`Factory Settings` | PFS | PQDEFLT
`Histogram Files` | PHU | PQHISTO
`Result Files` | PQRES | PQRESLT
`TTTR Files` | PTU | PQTTTR
`User Settings` | PUS | PQDEFLT

### File Preamble 2: Format Version

###

| This preamble is an 8 byte string including the terminating and filling chr(0) byte(s). It identifies the tag format version. The current version is `"1.0.00"`, the predecessor version `"00.0.1"` is valid, too.

### Tag Format Definition

###

| The following table illustrates the format of valid tags. It is described as a record (struct) with named fields:
Field Name | Length [Byte] | Field Type | Remarks
`Tag_Id` | 32 | `ASCII-String` | case sensitive; terminated by at least one & filled up to full length with chr(0)
`Tag_Idx` | 4 | `Int32` |
if tagField is array-element: | `<Idx>` (counting from 0),
else: | -1 (i. e. `0xFFFFFFFF`)
`Tag_TypeCode` | 4 | `UInt32` | see table below
`Tag_Value` | 8 | depends on `<TypeCode>` |
if `<TypeCode>` is array/string type: | gross size [byte] (must be a multiple of 8)
else: | Tag_Value is `<Value>`
`Tag_Enhancement` | see below | String of type according to `<TypeCode>` |
if `<TypeCode>` is array/string: | Enhancement contains values/string
else: | Enhancement doesn't exist

### Tag Type Definition

###

| The following table defines the types of valid tags with their domain and additional lenght if enhanced:
Type Name | Type Code | Range (From) | Range (To) | Length = 48+x | Remarks
`Empty8` | `0xFFFF0008` | `−` | `−` | `0` | carrying no meaningful data, just to group tags
`Bool8` | `0x00000008` | false (i.e.`== 0`) | true (i.e. `<>0`) | `0` |
`Int8` | `0x10000008` | `−10,000,000,000,000,000` | `10,000,000,000,000,000` | `0` | Subset of Int64
`BitSet64` | `0x11000008` | `[0000000000000000]` | `[FFFFFFFFFFFFFFFF]` | `0` | Bit-coded; MSB is 64, LSB is 1
`Color8` | `0x12000008` | `[0000000000000000]` `[00000000FF000000]` | `[0000000000FFFFFF]` `[00000000FF00001E]` | `0` |
either RGB-24 | (with R as LSB)
or Byte 4 is 0xFF | (windows color code)
`Float8` | `0x20000008` | `−5.0E+324` | `1.7E+308` | `0` | Double; 15 significant digits
`TDateTime` | `0x21000008` | `30.12.1899; 0:00` | `…` | `0` | Float8; integral part: number of days since 30.12.1899
`Float8Array` | `0x2001FFFF` |  |  | `<TagValue>` | enhanced with gross size descriptor [byte] in <TagValue> (1st quad word)
`ASCII−String` | `0x4001FFFF` |  |  | `<TagValue>` | enhanced with gross size descriptor [byte] in <TagValue> (1st quad word); incl. chr(0) as terminator
`Wide−String` | `0x4002FFFF` |  |  | `<TagValue>` | enhanced with gross size descriptor [byte] in <TagValue> (1st quad word); incl. wchr(0) as terminator
`BinaryBlob` | `0xFFFFFFFF` |  |  | `<TagValue>` | enhanced with gross size descriptor [byte] in <TagValue> (1st quad word)

Related Topics: |

[Tag Dictionary]
[Support]