Difference between revisions of "V4 DB Record Instance Syntax"

From EPICSWIKI
 
Line 3: Line 3:
= Record Instances =
= Record Instances =


A record instance loaded from a DB file has the following syntax:
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
  # comment
  recordType recordName = {
  recordType recordName = {
     fieldName = fieldValue;
     fieldName = fieldValue;
    structFieldName = { fieldValue, fieldValue, .. }
     structFieldName = { fieldName = fieldValue; .. }
     structFieldName = { fieldName = fieldValue; .. }
     structFieldName = { fieldValue, fieldValue, .. }
     structFieldName = { fieldName = fieldValue, fieldValue, .. }
     structFieldName = { structFieldName = { .. } }
     structFieldName = { structFieldName = { .. } .. }
     arrayFieldName = { arrayValue, arrayValue, .. }
     arrayFieldName = { arrayValue, arrayValue, .. }
     arrayFieldName = type { arrayValue, arrayValue, .. }
     arrayFieldName = type { arrayValue, arrayValue, .. }
Line 30: Line 31:
: The name of the record type
: The name of the record type
; <tt>recordName</tt>
; <tt>recordName</tt>
: The name of the record instance.
: 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?'''
: '''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?'''
; <tt>info name</tt>
:: ''Currently record names may contain <tt>A-Z a-z _ - ; : < > [ ]</tt>. We should probably extend that to include non-ASCII Unicode/UTF-8 characters, but no new ASCII characters''
: provide info for field
; <tt>info infoName</tt>
: Sets additional configuration information stored with the record.
; <tt>fieldName</tt>
; <tt>fieldName</tt>
: The field name.
: The field name.
; <tt>type</tt>
; <tt>type</tt>
: One of the types <tt>bool</tt>,...,<tt>string</tt>. This is only specified if the record definition did not specify a type.
: One of the types <tt>bool</tt>,...,<tt>string</tt>. This is only specified if the record definition did not specify a type.
; <tt>capacities</tt>
; <tt>size, ..</tt>
: The capacities for an array. This can only be specified if the record definition did not define the number of dimensions or the capacities. It has the format:
: 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.
:        capacity,...
:The number of dimensions must agree with what record defined. For example if the record defined that array as array(<type>[]) then only one capacity can be specified. If a record defined array(<type>) than the record instance determines the number of dimensions and the capacities.
; <tt>choiceName</tt>
; <tt>choiceName</tt>
: This is  for <tt>struct</tt>, <tt>link</tt>, and <tt>device</tt> fields. <tt>choiceName</tt> is a choice defined in a <tt>struct</tt>, <tt>link</tt>, or <tt>device</tt> definition.
: This is  for <tt>struct</tt>, <tt>link</tt>, and <tt>device</tt> fields. <tt>choiceName</tt> is a choice defined in a <tt>struct</tt>, <tt>link</tt>, or <tt>device</tt> definition.
; <tt>fieldValue</tt>
; <tt>fieldValue</tt>
: The syntax depends on the field type. The details are described next..
: The syntax depends on the field type. The details are described next..

Revision as of 15:33, 17 May 2005

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..