V4 DB Record Instance Syntax

From EPICSWIKI

The syntax used for record instances has to change in EPICS V4, since we now have to support structured data. While it would have been possible to modify the V3 syntax to allow for this, a complete redesign of the syntax has been done to help improve parsing, and to provide commonality between the syntax of a DB file and the string representation of structured data values passed through Channel Access.

Record Instances

A record instance loaded from a DB file has the syntax shown below, which was derived from the syntax for C99 initializers. Spaces are significant when used as word separators or within quoted strings, not otherwise.

# comment
recordType recordName = {
    fieldName = fieldValue;
    structFieldName = { fieldValue, fieldValue, .. }
    structFieldName = { fieldName = fieldValue; .. }
    structFieldName = { fieldName = fieldValue, fieldValue, .. }
    structFieldName = { structFieldName = { .. } .. }
    arrayFieldName = { arrayValue, arrayValue, .. }
    arrayFieldName = type { arrayValue, arrayValue, .. }
    arrayFieldName = [size, ..] { { arrayValue, arrayValue, .. }, { .. } .. }
    arrayFieldName = type [size, ..] { arrayValue, arrayValue, .. }
    linkFieldName = linkName { linkValue }
    deviceFieldName = deviceName { deviceValue }
    info infoName = "infoString";
    add varFieldName = {
                 {fieldName,interfaceName,choiceName,{dataStructValue}},
                 ...
    }
    ...
}

where

recordType
The name of the record type
recordName
The name of the record instance
Q: What restrictions will we place on record instance name? Can this contain non-ascii characters? That is will UTF-8 instance names be supported?
Currently record names may contain A-Z a-z _ - ; : < > [ ]. We should probably extend that to include non-ASCII Unicode/UTF-8 characters, but no new ASCII characters
info infoName
Sets additional configuration information stored with the record.
fieldName
The field name.
type
One of the types bool,...,string. This is only specified if the record definition did not specify a type.
size, ..
The size of an array in each of its dimensions. This can only be specified if the record type definition does not specify the number of dimensions or their sizes. It takes the format of a comma-separated list of integers, one for each dimension in turn. The number of dimensions must agree with what the record type defines. For example if the record defines a field as array(type[]) then only one dimension can be specified. If a field is defined as just array(<type>) than the record instance determines both the number of dimensions and their sizes.
choiceName
This is for struct, link, and device fields. choiceName is a choice defined in a struct, link, or device definition.
fieldValue
The syntax depends on the field type. The details are described next..