Solaris Common Desktop Environment: Programmer's Guide

Data Criteria and Data Attributes

Data typing consists of two parts:

The attributes of data criteria, in alphabetical order, are:

Table 9-1 describes the data criteria in the order in which you are most likely to use them.

Table 9-1 Data Criteria in Order of Most Likely Use

Criteria 

Description 

Typical Usage 

DATA_ATTRIBUTES_NAME

The name of this type of data. This value is a record_name in the data attributes table.

POSTSCRIPT 

NAME_PATTERN

A shell pattern-matching expression describing the file names that could match this data. The default is an empty string, which means to ignore file patterns in matching. 

*.ps

CONTENT

Three values that are interpreted as the start, type, and value fields of the magic file used by the file utility. See the file(1) man page for more information. The default is an empty field, which means to ignore contents in matching. The following types are examples of what can be matched: string, byte, short, long, and file name.

0 string !%

MODE

A string of zero to four characters that match the mode field of a stat structure. See the stat(2) man page for more information. The first character indicates:

 

d matches a directory

s matches a socket

l matches a symbolic link

f matches a regular file

b matches a block file

c matches a character special file

f&!x

 

 

 

The characters listed below can be either the first or subsequent characters: 

 

r matches any file with any of its user, group, or other read permission bits set.

w matches any file with any of its user, group, or other write permission bits set.

x matches any file with any of its user, group, or other execute or directory-search permission bits set.

 

 

 

For example, the MODE field of frw matches any regular file that is readable or writable; x matches any file with any of its executable or search bits set.

The default is an empty field, which means to ignore the mode in matching. 

 

PATH_PATTERN

A shell pattern-matching expression describing the absolute path names that could match this data. The default is an empty string, which means to ignore path patterns in matching. 

*/mysubdir/*

LINK_NAME

See dtdtsfile(4) man page.

LINK_PATH

See dtdtsfile(4) man page.

Some of the more common attributes of data types, in alphabetical order, are:

Table 9-2 describes the data attributes in the order in which you are most likely to use them.

Table 9-2 Data Attributes in Order of Most Likely Use

Criteria 

Description 

Typical Usage 

DESCRIPTION

A human-readable description of this data. If this field is NULL or is not included in the data attribute record, the name of the data attribute should be used.

This is a PostScript page description. 

ICON

The name of the icon to be used for this data. If this field is NULL or is not included in the data attribute record, the standard icon should be used. See dtdtsfile(4) for more details on icon naming.

Dtps

PROPERTIES

Keywords to indicate properties for this data. Valid values are invisible and visible. If this field is NULL or is not included in the data attribute record, the visible property should be assumed. Use this if you want to completely hide files from the user.

invisible

ACTIONS

A list of actions that can be performed on this data. This list refers to names in the action table for actions that are to be presented to the user for objects of this type. If this field is NULL or is not included in the data attribute record, no action is available.

Open,Print

NAME_TEMPLATE Field

 

A string used to create a new file for data of this type. The string is passed to sprintf(3) with the file name as the single argument. The default is empty. Contrast this field with the NAME_PATTERN field of the data criteria table in that the template is used to create a specific file, such as %s.c, whereas the pattern is used to find files, such as *.c.

%s.ps

IS_EXECUTABLE Field

A string-Boolean value that tells users of this data type that it can be executed as an application. If IS_EXECUTABLE is set to true (see DtDtsIsTrue()) the data is executable. If this field is NULL, is not included in the data attribute record, or is not set to true, then the data is considered not executable.

true

MOVE_TO_ACTION

The name of an action to be invoked when an object is moved to the current object. 

FILESYSTEM_MOVE

COPY_TO_ACTION

The name of an action to be invoked when an object is copied to the current object. 

FILESYSTEM_COPY

LINK_TO_ACTION

The name of an action to be invoked when an object is linked to the current object. 

FILESYSTEM_LINK

IS_TEXT 

A string-Boolean value that tells users of this data type that it is suitable for manipulation (viewing or editing) in a text editor or text widget. The IS_TEXT field is set to true (see DtDtsIsTrue()) if the data is textual in nature and if it should be presented to the user in text form. Criteria for making this determination include whether data consists of human language, is generated and maintained manually, is usefully viewable and editable in a text editor, or contains no (or only minimal) structuring and formatting information.

See Table 9-3 for more examples.

 

If the IS_TEXT field is true, the data is eligible to be displayed directly by an application. That is, the application can load the data directly into a text editing widget, such as XmText.

 

MEDIA Field 

The names in the MEDIA name space describe the form of the data itself. MEDIA names are used as ICCCM selection targets, named in the MEDIA field of the data-type records, and used in the type parameter of ToolTalk Media Exchange messages.

 

The MEDIA name space is a subset of the name space of selection target atoms as defined by the ICCCM. All selection targets that specify a data format are valid MEDIA names, and all valid MEDIA names can be used directly as selection targets. Some selection targets specify an attribute of the selection (for example, LIST_LENGTH) or a side effect to occur (for example, DELETE), rather than a data format. These attribute selection targets are not part of the MEDIA name space.

POSTSCRIPT

MIME_TYPE

MEDIA is the desktop internal, unique name for data types. However, other external naming authorities have also established name spaces. Multipurpose Internet Message Extensions (MIME), as described in the referenced MIME RFC, is one of those external registries, and is the standard-type name space for the desktop mailer.

application/postscript

X400_TYPE

X.400 types are similar in structure to the MEDIA type, but are formatted using different rules and have different naming authorities.

1 2 840 113556 3 2 850

INSTANCE_ICON Field

The name of the icon to be used for this instance of data, typically a value such as %name%.icon [Bug in dtdtsfile(4) man page, too.] If INSTANCE_ICON is set, the application should use it instead of ICON. If this field is NULL or is not included in the data attribute record, the ICON field should be used.

/myicondir/%name%.bm

DATA_HOST

The DATA_HOST attribute is not a field that can be added to the data attributes table in the *.dt file, but it may be returned to an application reading attributes from the table. The data-typing service adds this attribute automatically to indicate the host system from which the data type was loaded. If this field is NULL or is not included in the data attribute record, the data type was loaded from the local system.

 

The IS_TEXT field differs from the text attribute of the MIME_TYPE field, which is the MIME content type, as described in the referenced MIME_ RFC. The MIME content type determines whether the data consists of textual characters or byte values. If the data consists of textual characters, and the data is labeled as text/*, the IS_TEXT field determines whether it is appropriate for the data to be presented to users in textual form.

Table 9-3 shows some examples of IS_TEXT usage with different MIME_TYPE attributes.

Table 9-3 IS_TEXT Attribute Examples

Description and MIME_TYPE Attribute 

IS_TEXT Value 

Human language encoded in ASCII with MIME_TYPE text/plain

IS_TEXT true

Human language encoded in E*UC, JIS, Unicode, or an ISO Latin charset with MIME_TYPE text/plain; charset=XXX

IS_TEXT true

CalendarAppointmentAttrs with a MIME_TYPE text/plain

IS_TEXT false

HyperText Markup Language (HTML) with a MIME_TYPE text/html

IS_TEXT true

PostScript with MIME_TYPE application/postscript

IS_TEXT false

C program source (C_SRC) with MIME_TYPE text/plain

IS_TEXT true

Bitmaps and pixmaps (XBM and XPM) with MIME_TYPE text/plain

IS_TEXT false

Project or module files for the desktop application building service with MIME_TYPE text/plain

IS_TEXT false

Shell scripts with MIME_TYPE text/plain

IS_TEXT false

Encoded text produced by uuencode(1) with MIME_TYPE text/plain

IS_TEXT false

*MIME_TYPE text/plain

IS_TEXT false

See the dtdtsfile(4) man page for more information about data-type attributes.