The DATA_CRITERIA
definition defines the criteria used to assign an object type to
a file or directory.
You can use the following criteria for object typing:
You can use more than one criteria for a data type. However,
you should not use the NAME_PATTERN
and PATH_PATTERN criteria
in the same data type.
Name-Based Data Types |
 |
Use the NAME_PATTERN
field to specify the naming requirement. The field value can include
the following wildcards:
The following data
type definition creates a data type based on the file name. The
file name must begin with QS
and end with .doc.
DATA_ATTRIBUTES QS_Doc { DESCRIPTION This file contains a document for the QS project. ICON Word_Doc ACTIONS Open } DATA_CRITERIA QS_Doc_Criteria { NAME_PATTERN QS*.doc DATA_ATTRIBUTES_NAME QS_Doc } |
The following definition creates a data type for
directories named Demo_n
where n is 0
through 9.
DATA_ATTRIBUTES Demo_directory { DESCRIPTION This is a directory. Double-click to open it. ICON Demo ACTIONS OpenInPlace,OpenNewView } DATA_CRITERIA Demo_directory_criteria { NAME_PATTERN Demo_[0-9] MODE d DATA_ATTRIBUTES_NAME Demo_directory } |
Location-Based Data Types |
 |
Use the PATH_PATTERN
field to specify the path. You can use the same wildcard characters
as with NAME_PATTERN.
For example, the following data type uses a criteria based
on path.
DATA_ATTRIBUTES Project_Graphics { DESCRIPTION Graphics file for the QS project. Double-click the \ icon to see the graphic. ICON QSgraphics } DATA_CRITERIA Project_Graphics_Criteria { DATA_ATTRIBUTES_NAME Project_Graphics PATH_PATTERN */projects/QS/graphics/* } |
Data Types Based on Name and
Location |
 |
To create a data type based on both file name and location,
include the name in the PATH_PATTERN
value. You cannot use both NAME_PATTERN
and PATH_PATTERN in the same
criteria definition.
The QS_Source_Files
data type defined below applies to all files named appn.c,
where n= 1 through
9, located in subdirectories of */projects/QS.
DATA_ATTRIBUTES QS_Source_Files { ... } DATA_CRITERIA QS_Source_Files_Criteria { PATH_PATTERN */projects/QS/*/app[1-9].c DATA_ATTRIBUTES_NAME QS_Source_Files } |
The following data type applies to all files in
the directory /doc/project1
named chnn.xxx
where n is 0
through 9, and xxx
is any three-character file- name suffix.
DATA_ATTRIBUTES ChapterFiles { DESCRIPTION Chapter file for the project document. ICON chapter ACTIONS Edit,Print } DATA_CRITERIA Chapter_Criteria { PATH_PATTERN /doc/project1/ch[0-9][0-9].??? DATA_ATTRIBUTES_NAME ChapterFiles } |
Using
File Modes as a Typing Criteria |
 |
Use the MODE
field to specify the required permissions.
Mode criteria are usually used in combination with name-based,
location- based, or content-based data typing. They allow you to
limit a data type to a file or directory, or to specify the required
read, write, and execute permissions.
The MODE field can include
the following logical operators and characters:
The default for a particular criterion is that the mode does
not matter.
The following mode
fields restrict the data type as described:
The following data type definition creates a data
type for read-only, non- executable files whose file names follow
the naming convention *.doc.
It assumes that a View action has been defined for the data type.
DATA_ATTRIBUTES ReadOnlyDocument { ICON read_only DESCRIPTION This document is not writable. Double-clicking \ runs your editor with a read-only copy of the \ file. ACTIONS View } DATA_CRITERIA ReadOnlyDocument_Criteria { NAME_PATTERN *.doc MODE !d&!x&!w DATA_ATTRIBUTES_NAME ReadOnlyDocument } |
Content-Based Data Typing |
 |
Use the CONTENT
field to specify data typing based on the content of the file. Content-based
data typing can be used in combination with name- or location- based
data typing.
The typing can be based on either string or numeric content
for files. The first byte in the file is numbered 0.
For string content
of a file, use the syntax:
CONTENT starting_byte string string |
For number content of a file, use the syntax:
CONTENT starting_byte byte number CONTENT starting_byte short number CONTENT starting_byte long number |
For the contents of a directory, use the syntax:
CONTENT 0 filename "file_name" |
Use standard C notation for octal (leading 0) and hexidecimal (leading 0X) numbers.
 |
 |  |
 |
 | NOTE: Use of content-based data typing will result in slower
system performance. Wherever possible, use name- and location-based
typing instead. |
 |
 |  |
 |
For example, the following data type, Writable_Wingz, applies
to all files with write permission containing the string WNGZ
at the beginning of the file.
DATA_ATTRIBUTES Writable_Wingz { ... } DATA_CRITERIA Writable_Wingz_Criteria { CONTENT 0 string WNGZ MODE w&!d DATA_ATTRIBUTES_NAME Writable_Wingz } |
To Create a Data Type with Several Independent
Criteria |
 |
You can create a data type with several independent criteria—that
is, the file is assigned to the data type if it meets either
(or both) of the criteria.
Create the DATA_ATTRIBUTES
definition for the data type.
Create a DATA_CRITERIA
definition for each criteria.
Use the DATA_ATTRIBUTES_NAME
field to connect each criteria to the same DATA_ATTRIBUTES
definition.
For example, the following definitions create the Mif data
type. Typing is based on name or content.
DATA_ATTRIBUTES Mif { ICON Frame ACTION_LIST Open,Print } DATA_CRITERIA Mif_Name_Criteria { DATA_ATTRIBUTES_NAME Mif NAME_PATTERN *.mif } DATA_CRITERIA Mif_Content_Criteria { DATA_ATTRIBUTES_NAME Mif CONTENT 1 string MIFFile } |