Lynx Exploration Archivist Online Help

The Lynx Exploration Archive Object

Version: 3.1

LEA Object Wizard version 2.3

Back to:


Introduction

Lynx Exploration Archivist applications are able to access, catalogue and manipulate many different types of data file via the concept of a Lynx Exploration Archive Object. Lynx Exploration Archive Objects are designed as a framework to classify and access data by useage rather than by file format. For an end-user, the physical file format of exploration data should not be relevant: the information contained is important. LEA Objects enable applications to access the varous file-types encountered in exploration data archives (including seismic, well, location, raster, document and other spcialised formats) in a consistent and uniform manner.

The framework is designed to be customisable by users, so that additional formats and attributes can be added to existing LEA Object types, and new user-defined LEA Object types added which extend the functionality of Lynx Exploration Archivist applications.
The LEA Object Wizard can be used to edit existing LEA Object types, and add new types, with user-defined formats and attributes.

A file format is a definition of the layout of the binary information in a file. A proper file format is independent of the computer system on which the file is stored. In other words, the format definition should specify the byte order of integer and floating point types, the delimiters used in text files etc - in fact a complete definition at the bit level.
The LEA Object framework is designed to allow users to redefine the method used to recognise a particular file format used by an LEA Object type, or to add new formats to an LEA Object type, using local COM servers, script files or dynamic link libraries (see LEA Object Implementation below).

Every LEA Object type has a set of attributes. An attribute is one of the items of data present in the conceptual definition of a particular LEA Object type. For example the attribute "number of traces" is an attribute shared by all seismic files. This does not mean, of course that an actual seismic format implementation will necessarily define a place to put this attribute.
As with formats, the mechanisms used to read attribute values can be redefined, and extra attributes can be added to existing LEA Object types by defining their characteristics and access methods in script files or DLLs (see LEA Object Implementation below).



LEA Object Implementation

All LEA Objects are accessed through the same interface, which is provided by the ILEAObject interface in the LEA system file LEAOBCOM.DLL. This provides for

Each LEA Object type is defined in its own INI file. This INI file describes the file formats which each LEA object can recognise, and the attributes to read, display, and (in some cases) edit. The format-recognition and attribute access for these types is implemented in one of two ways:


The LEA Object Wizard

LEA Object Wizard main window COM Server library Default viewer for object Name of LEA Object Object version control number Optional help file name Object class name (for internal use) Description of LEA Object Attribute Access tab page Attribute Definitions tab page Format Definitions tab page Object Descriptions tab page Context help Test LEA Object Edit whole column (all formats for current attribute) Edit whole row (all attributes for current format) Move current item down (towards the bottom of the list) Move current item up (towards the top of the list) Delete current item Edit current item Add item to list Save LEA Object Open LEA Object Create new LEA Object Test menu Entry menu Page menu File menu

The LEA Object Wizard can be used to edit existing and create new LEA Object types.

On startup, the wizard reads the LEAOBJ.INI file, and loads a list of the current LEA Object types from the [COM_CLASSES] section of this file.

The wizard has the following menu commands:

Wizard Object Description tab page

This page (displayed above) allows you to edit the general properties of the LEA Object.

Object Name

This name is used in LEA catalogues for reconciling objects and their locations, and when selecting LEA Object types (for example in Dougal). The name should be short but descriptive. If no name is supplied, the name of the LEA Object's INI file is used by default.
This field is stored as the value of the name key in the [OBJECT_DESCRIPTION] section of the LEA Object INI file.

Object Description

This description is used when selecting LEA Object types (for example in Dougal), and also in the LEA Object Attribute Display dialogue and the LEA Object Attribute Editor.
This field is stored as the value of the description key in the [OBJECT_DESCRIPTION] section of the LEA Object INI file.

DLL File

The name of the DLL file that contains the COM server which implements the LEA Object. If the LEA Object is implemented by script definitions, the entry here will be the LEA Object system library LEAOBCOM.DLL. Click the Browse button to display a file selection dialogue. If the file name specified does not include a directory path, then the file will be searched for in the following directories:

  1. The user's CUSTOM directory
  2. The directory containing the wizard's executable
  3. The LYNXSYS directory
  4. The Windows SYSTEM32 and SYSTEM directories
  5. The WINDOWS directory
  6. Directories listed in the PATH environment variable
This field is stored as the value of the dll key in the [OBJECT_DESCRIPTION] section of the LEA Object INI file.

Class Name

The class name is used internally by the LEA application to create an instance of the LEA Object. This value is stored in the Windows registry, and is used to look up information about the object required by Windows in order to create it. The class name is referred to as the progid in Windows documentation. Select the correct value from the drop-down list, which is read from the DLL file specified above. If the LEA Object is implemented by script definitions, the entry here will be the base LEA Object LEAObCom.FileObject. See LEA Object Implementation above for more details.
This field is stored as the value of the com_class key in the [OBJECT_DESCRIPTION] section of the LEA Object INI file.

Default Viewer

This edit field can contain the default program to use to view objects of this type. Click the Browse button to display a file selection dialogue. If the file name specified does not include a directory path, then the file will be searched for in the standard system search path. You can also specify different viewers to be used for specific formats in the Format Definition below.
This field is stored as the value of the default viewer key in the [FORMAT_VIEWERS] section of the LEA Object INI file.

Help File

This edit field contains an optional name of a help file for the LEA Object. Click the Browse button to display a file selection dialogue. If the file name specified does not include a directory path, then the file will be searched for in the standard LEA help directory (usually a subdirectory of the LYNXSYS directory).
This field is stored as the value of the helpfile key in the [HELP] section of the LEA Object INI file.

Version Number

This is used to check compatibility at runtime between the LEA Object described in the INI file, and the version of the base LEA Object compiled into the executable file. You should not normally edit this field.
This field is stored as the value of the version key in the [LYNX] section of the LEA Object INI file.



LEA Object File Formats

Each LEA Object type can recognise a number of distinct file formats. A method of format recognition recognition must be defined, a (language-dependent) format name, and a list of common file extensions for this format.

Wizard Format Definitions tab page

Format Definitions tab page

This page displays all the formats defined for the current LEA Object.
Format definitions can be edited by double-clicking on the entry in the list (or selecting the Entry-Edit  Toolbar button  menu option) and new format definitions can also be added (Entry-Add Toolbar button  menu option) - see format defintion parameters and options below.
Format defintions can also be removed from the list (Entry-Delete Toolbar button  menu option).
The order in which formats are checked can be changed by dragging items in the list, or by using the Entry-Move up Toolbar button  and Entry-Move down Toolbar button  menu options.

The order in which formats appear in the list is reflected in the order in which the LEA Object will check each format when attempting to recognise the format of a data file.
For instance, if you have two formats, where format 1 is recognised by the string lynx at the start of the file, and format 2 is recognised by the string lynx information systems at the start of the file, format 2 must appear in the list before format 1, otherwise format 2 will never be detected.


Format Definition Parameters

The following parameters are displayed in a PrmEdit wizard when you edit an existing format definition or add a new format defintion.

Code

Each format defined for an LEA Object must have a unique numeric code which is used internally by the LEA Object as the format identifier. For formats which use the INTERNAL Format Recognition (see below), this code should match the integer argument passed to the format recognition function of the ILEAFileRecognition interface (see Implementing LEA Objects as COM Servers (below)). When you add a new format, a unique code is determined automatically. There should be no need to alter this value unless you wish this value to match the value returned from a pre-defined DLL format recognition function.
The value -999 is reserved for use by the base LEA Object, and should not be used.

Name

This should be a short descriptive name for the format. Each format defined in an LEA Object should have a unique name.

Extensions

A list of common file extensions for the format, separated by commas. Extensions may include wildcards such as ? and *.
Matching the file extension is one of the methods that can be used for format recognition (see below), and in some cases can be used to override the specified format recognition method when attempting to open a data file.
A list of file extensions is optional, but must be present if the format recognition method is EXTENSION.

Format Recognition

This defines the mechanism by which files of this format will be detected.
Select one of the following options:

Attribute Access

This defines the mechanism by which the attribute values are read for files of this format. Standard LEA Object types with pre-defined formats have a number of built-in attributes. Reading (and writing) these attributes is dealt with by COM libraries. For user-defined LEA Objects, or additional user-defined formats and attributes, a script defines the mechanism used to read attribute values.

Format Viewer

Specify a program that will be used to view LEA Objects of this format. This is used in preference to the default viewer specified on the Object Description tab page (see above).

Script Format Recognition Parameters

This parameter page is activated if the Format Recognition on the Format Definition page is set to SCRIPT.

Script file name

Enter a name for the script file. You can use the same file to store all the script entries for different format recognition methods and attribute access methods within an LEA Object, but you should not use the same script file for two different LEA Objects.
If the file name entered contains no directory path, then the script file will be searched for at run-time in the standard LEA directories:
ie
  1. LEA user's CUSTOM directory
  2. The directory containing the application's EXE file
  3. The LEA System directory (specified by the syspath key in LEASTART.INI and usually called LYNXSYS)

Script section

Enter a name for the section within the script file.
Script files are formatted similar to INI files, and the information they contain is divided into sections.
The default name for this section is FORMATS.
All formats can have an entry within the same section, as the entry for each format is keyed by the format code (see above), which is unique for each format defined by the LEA Object.

Recognition Method

This parameter defines the mechanism by which a format will be detected when using a script file (see also the Format Definition - Format Recognition parameter.
Select one of the following options:

Script Format Recognition via DLL

This parameter page defines the DLL function used for format recognition, and is activated when the Recognition Method parameter on the Script Format Recognition page is set to DLL.
For more details of using a DLL for format recognition, see Using Dynamic Link Libraries - Format Recognition (below).

File Name

Enter the name of the dynamic link library to use. If the file name entered contains no directory path, then the DLL will be searched for at run-time in the standard directories searched by Windows (see DLL Search Sequence below).

Function Name

The name of the function within the DLL. This is matched case-sensitively. If you are unsure of the exact function name, use the Quick View utility to examine the exported function names.

Return Format Code

Select one of the following options:

Return Value

This parameter is enabled if the Return Format Code parameter (above) is NO.
The format recognition function will return this value to indicate that the data file currently being tested is of this format.

Format Recognition via Script

This parameter page defines the DLL function used for format recognition, and is activated when the Recognition Method parameter on the Script Format Recognition page is set to SCRIPT.
Many file formats can be identified by distinctive byte-sequences or values at specified byte-offsets within the data file. This parameter page allows you to specify the byte-offset, the type of variable to read and a range of possible values to accept for this variable.
You can specify up to four such searches (use the Mutiple Page toolbar displayed at the base of the page), which will be combined using the Condition parameter below to create a flexible format defintion.

Condition

This parameter is used to combine the results of each offset-value search.
Select one of the following options:

Offset

The number of bytes from the start of the file at which to search.

Value Type

This option specifies the generic type of the value to read.
Select from: The option chosen here determine which of the parameters below are enabled.

The following 2 parameters are enabled if the Value Type is BYTESEQ

Byte conversion

Select either of the following options:

Match byte sequence(s)

This field should contain the byte sequence that you wish to match in the data file. Each byte value in the sequence should be spearated by spaces. You can specify a number of alternative byte sequences to check for at the same byte offset by separating multiple byte sequences with commas.
For example

AA AA, BB BB

will check for the either of the hexadecimal byte sequences AA AA or BB BB.
The longest byte-sequence in the list specifies the number of bytes read from the data file.

The following 2 parameters are enabled if the Value Type is STRING

String conversion

This option determines how the characters read from the data file are translated before comparing them to the string(s) below:

Match string(s)

This field specifies alternative strings to match. Strings containing spaces must be quoted using the double-quote ( " ) character. Separate each string from the next with a comma. The longest string in the list specifies the number of bytes to be read from the file.

The following 2 parameters are enabled if the Value Type is INTEGER

Integer conversion

This option determines how an integer value should be read from the data file.

Min,Max or list of distinct alternatives

This field should specify a number of integer values, separated by commas.
If the list contains two fields, these are taken as the minimum and maximum values accepted.
If the list does not contain two fields, then each field is taken as a distinct alternative value for the integer value read from the data file.

The following 2 parameters are enabled if the Value Type is TRUE/FALSE

True/false conversion

This option determines how a logical value should be read from the data file.
A value of zero is interpreted as false and a non-zero value is interpreted as true.

Value

This field contains the logical value which must be read from the data file - either TRUE or FALSE.

The following 3 parameters are enabled if the Value Type is FLOAT

Float conversion

This option determines how a floating-point value should be read from the data file.
Because of the rounding errors inherent in floating point formats, direct comparisons of the equality of floating point values are unreliable. You can therefore check the value read from from the data file against a range of values:

Min - the minimum acceptable value.

Max - the maximum acceptable value.

The following 3 parameters are enabled if the Value Type is DATE/TIME

Date/time conversion

Date/time values can be stored in files in a variety of ways. At present there is only one type of date/time value that can be interpreted by LEA Objects:

Min - the minimum acceptable date/time value

Max - the maximum acceptable date/time value.

See LEA Date/Time string representation (below) for details of how to specify the date/time values.

Attribute Access Script for Format

This page is activated when the Attribute Access parameter on the Format Defintion page is SCRIPT.

Script file name

Enter a name for the script file. You can use the same file to store all the script entries for different format recognition methods and attribute access methods within an LEA Object, but you should not use the same script file for two different LEA Objects.
If the file name entered contains no directory path, then the script file will be searched for at run-time in the standard LEA directories:
ie
  1. The user's CUSTOM directory (specified by the networkpath or localpath key in LEASTART.INI)
  2. The directory containing the application's EXE file
  3. The LEA System directory (specified by the syspath key in LEASTART.INI and usually called LYNXSYS)

Script Section

Enter a name for the section within the script file.

Script files are formatted similar to INI files, and the information they contain is divided into sections.
Usually, each format should have its own attribute access section, as the attribute access method may be different for each format. However, if two different formats use the same method to read attributes (such as calling the same DLL function with the same arguments, then they can share the same script section, but bear in mind that the attribute access methods for all attributes must be identical.
If the Wizard detects that the script section name you have entered matches one already in use for the attribute access methods of another format, you will be warned of this, and asked whether you wish to edit this script section name.

The method used to read the value of each attribute can be edited in the Attribute Access tab page.



LEA Object Attributes

LEA Objects have a number of attributes defined. An attribute is one of the items of data present in the conceptual definition of a particular LEA Object type. For example the attribute "number of traces" is an attribute shared by all seismic files. This does not mean, of course that an actual seismic format implementation will necessarily define a place to put this attribute.

Attributes are read from a data file after the format of the file has been determined (using the format recognition method detailed above). If the attribute is present in the recognised format, then it is read from the file.
The built-in LEA Object types have a number of pre-defined attributes. These can be added to by users with the LEA Object Wizard.

Wizard Attribute Definitions tab page

Attribute Definitions tab page

This page displays all the attributes defined for the current LEA Object. Attribute definitions can be edited by double-clicking on the entry in the list (or selecting the Entry-Edit menu option). New attribute definitions can also be added (Entry-Add). The order in which attributes are displayed can be changed by dragging items in the list, or by using the Entry-Move up and Entry-Move down menu options.

This page displays all the attributes defined for the current LEA Object.
Attribute definitions can be edited by double-clicking on the entry in the list (or selecting the Entry-Edit Toolbar button  menu option) and new attributes can also be added (Entry-Add Toolbar button  menu option) - see attribute defintion parameters below.
Attributes can also be removed from the list (Entry-Delete Toolbar button  menu option).
The order in which attributes are displayed in the LEA Object Attribute Display dialogue and the Attribute Editor can be changed by dragging items in the list, or by using the Entry-Move up Toolbar button  and Entry-Move down Toolbar button  menu options.


Attribute Definition parameters

The following parameters are displayed in a PrmEdit wizard when you edit an existing attribute defintion or add a new attribute defintion.

Code

Each attribute has a unique numeric code, which is used internally by the LEA Object to identify the attribute. For attributes read by the INTERNAL mechanism (see Format Definition above), this code is used as the attribute identifier within the COM class. For a new attribute this number will be determined automatically, so there should be no need to edit this field, unless you wish this value to match the identifier used in a DLL attribute access function.

Name

Each attribute must have a name. The name is language-dependent, and should be unique within the LEA Object.
The attribute name is used by the LEA Cataloguing Utilities in database tables. To maintain compatibility across the widest range of database formats, it is advised that the name should be no more than 10 characters long, contain no spaces, and contain only upper case characters A-Z and digits 0-9. For more details see Database Table Field Name Restrictions (in Database Utilities).

Description

As well as a name, each attribute can also have a description. This is a more verbose explanation of the attribute, which is used in the LEA Object Attribute dialogue and the LEA Object Attribute Editor.

Type

This specifies the data-type of the attribute. Select one of the following options:
TYPE Keyword  Description Range
STRING standard text 255 characters
INTEGER whole numbers (32-bit) -2147483648 to 2147483647
FLOAT fractional numbers (64-bit) 5.0 x 10-324 to 1.7 x 10308 with 15-16 significant digits
DATETIME a date and/or time value  
TRUEFALSE a logical true/false or yes/no value  

Width

This parameter must be specified for STRING and FLOAT attribute types; for other types the value is ignored.
For STRING attribute types, this parameter specifies the maximum number of characters in the string.
For FLOAT attribute types, this parameter specifies the number of decimal places to display.

Editable

YES or NO
This flag specifies whether the attribute value can be edited and written back to the LEA Object data file. At present this option only applies to attributes handled by the INTERNAL attribute access method (see Format Definition - Attribute Access method and Attribute Script Method).

Cumulative

YES or NO
This flag specifies whether the attribute value can usefully be totalled across a group of LEA Objects, and is only valid for INTEGER and FLOAT attribute types.

Key Attribute

YES or NO
This flag specifies whether the attribute should be treated as a Key Attribute (see below).


Attribute Access

Once a file has been recognised as having a particular format, the LEA Object will read the values of all attributes using the mechanism defined for that format (see Format Definition - Attribute Access Method).

For standard LEA Objects with pre-defined formats and attributes, reading (and writing) these attributes is dealt with internally. For user-defined LEA Objects, or additional user-defined formats and attributes, you must also define a mechanism to read each attribute.

Wizard Attribute Access tab page

Attribute Access tab page

This page displays the a grid representing the method used to read each attribute for each format defined in the LEA Object. If the attribute access method specified in the format definition is not SCRIPT then the entry will be greyed out and cannot be edited here.

Note that the attributes and the formats are displayed in the grid in the order in which they appear in the defintion lists on the Format Definition tab page and the Attribute Definition tab page.

Edit an access method by double-clicking the entry in the grid (or using the Entry-Edit Toolbar button menu option)
Edit all attributes for a format, or all (available) formats for an attribute by double clicking the row/column header (or using the Entry-Edit All Attributes Toolbar button and Entry-Edit All Formats Toolbar button menu options). These options can be useful if the access methods for all formats or all formats use the same DLL function, for example.
You can only successfully Edit All Formats if at least one of the format definitions has its attribute access method set to SCRIPT.


Attribute Access parameters

The following parameters are displayed in a PrmEdit wizard when you edit an attribute access method.

Method

Select one of the following methods of reading the attribute value:

Attribute Access (FIND method)

This parameter page is activated when the Attribute Access Method parameter is FIND.

Byte Offset

The number of bytes from the start of the file at which to read the attribute value.

Value Type

This specifies the generic type of the value to be read. If this type is different to the attribute type (see Attribute Defintion - Attribute Type), then the value will be converted if possible, according to the table below:
Generic value type read from data file Conversion to attribute type
STRING
A sequence of ANSI characters.
  • INTEGER - value is converted to an integer
  • FLOAT - value is converted to a floating point number
  • TRUEFALSE - string value is converted to an integer. If this suceeds and this integer value is zero then the result is 'false', or if the value is non-zero then the result is 'true',
  • DATETIME - string value is assumed to be in the form specified in the locale-independent LEA date/time string format.
INTEGER
An integer numerical value (whole number) - note, not a string representation of an integer
  • STRING - the value is converted to a string representation
  • FLOAT - the value is converted to a floating point number
  • TRUEFALSE - if the value is zero, the result is 'false', otherwise the result is 'true'
  • DATETIME - an integer value cannot be converted into a date/time value
FLOAT
A floating-point (fractional) numerical value
  • STRING - the value is converted into a string representation.
  • INTEGER - the value is rounded to an integer
  • TRUEFALSE- the value is rounded to an integer. If this value is zero then the result is 'false', otherwise the result is 'true'
  • DATETIME - the value is treated as a MICROSOFT date/time value
TRUEFALSE
A boolean/logical value
  • STRING - the result will be a 'true' or 'false' string. (Boolean string values are read from the [LABELS] section of the LEAOBJ.INI file
  • INTEGER - if the value is 'true' the result will be '1', otherwise the result will be '0'
  • FLOAT - if the value is 'true' the result will be '1.0', otherwise the result will be '0.0'
  • DATETIME - true/false values cannot be converted into date/time values
DATETIME
A date and/or time value
  • STRING - the value is converted into an LEA date/time string
  • INTEGER - date/time values cannot be converted into integers
  • FLOAT - the value is treated as an 8-byte floating point value
  • TRUEFALSE - date/time values cannot be converted to true/false values

The option chosen here determines which of the parameters below are enabled.

The following 2 parameters are enabled if the Value Type is STRING

String conversion

This option determines how the characters read from the data file are translated:

Match string(s)

You can specifies a list of alternative values to accept (strings that contain spaces should be quoted using the double-quote ( " ) character, and separated from each other with commas), or leave this field blank to accept whatever is read from the file (in this case, the number of characters read from the file is determined by the Attribute Width parameter in the Attribute defintion.

The following 2 parameters are enabled if the Value Type is INTEGER

Integer conversion

This option determines how an integer value should be read from the data file.

Min,Max or list of distinct alternatives

If this field is blank, then any integer value read from the specified byte-offset is valid. Otherwise, this field should specify a number of integer values, separated by commas. If the list contains two fields, these are taken as the minimum and maximum values accepted. If the list does not contain two fields, then each field is taken as a distinct alternative value for the integer value read from the data file.

The following parameter is enabled if the Value Type is TRUE/FALSE

True/false conversion

This option determines how a logical value should be read from the data file.
A value of zero is interpreted as false and a non-zero value is interpreted as true.

The following 3 parameters are enabled if the Value Type is FLOAT

Float conversion

This option determines how a floating-point value should be read from the data file.
If both the Min and Max are set to zero, then any float value read from the specified byte-offset is valid, otherwise these parameters specify the acceptable range of values.

The following 3 parameters are enabled if the Value Type is DATE/TIME

Date/time conversion

Date/time values can be stored in files in a variety of ways.
At present there is only one type of date/time value that can be interpreted by LEA Objects:
The Min and Max fields can be left blank to accept any value read from the specified byte-offset, or you can specify the range of acceptable values. Date/time values must be specified in LEA locale-independent format - see LEA Data/Time strings (below).

Attribute Access (DLL method)

This parameter page is activated when the Attribute Access Method parameter is DLL.
For more details on using a DLL to retrieve attribute values, see Using Dynamic Link Libraries - Attribute Access (below).

File Name

Enter the name of the dynamic link library to use. If the file name entered contains no directory path, then the DLL will be searched for at run-time in the standard directories searched by Windows (see DLL Search Sequence below).

Function Name

The name of the function within the DLL. This is matched case-sensitively.
If you are unsure of the exact function name, use the Quick View utility to examine the exported function names.

Pass Attribute Code

Select one of the following options:

Attribute argument

This parameter is enabled if the Pass Attribute Code parameter (above) is NO
The value specified will be used as the argument passsed to the attribute access function. See Using Dynamic Link Libraries - Attribute Access (below) for more details.

Pass format code

Select one of the following options:

Format argument

This parameter is enabled if the Pass Attribute Code parameter (above) is NO
The value specified will be used as the argument passsed to the attribute access function. See Using Dynamic Link Libraries - Attribute Access (below) for more details.

DLL Initialisation

This parameter page is activated when the Attribute Access Method parameter is FIND.
See Using Dynamic Link Libraries - Attribute Access (below) for more details.

Open function

The name of the DLL function used to open the data file.

Close function

The name of the DLL function used to close the data file.

Verify function

The name of the DLL function used to verify that this attribute is supported.



Script files

Script files can be used to add new file formats and attributes to LEA Object types.
See Format Recognition and Attribute Access above.

A script file is a text file in INI format with the entry

TYPE=SCRIPT

in the [LYNX] section, which defines the file as an LEA script file.

An LEA Object INI file may specify a script for format recognition or attribute access instead of using a COM library or DLL function. The named script file will be loaded from the first directory in which it is found from the list below:

  1. User's CUSTOM directory (defined by networkpath or localpath in the LEA System Initialisation file LEASTART.INI - see LEA System Installation - System and data directories)
  2. Application's current working directory
  3. Directory containing application's executable file
  4. LYNXSYS directory (defined as syspath in the LEA System Initialisation file LEASTART.INI - see LEA System Installation - System and data directories)

The script may specify either a value to read from a specified offset within the file, or a DLL function to call. The syntax of both these methods is discussed later.

Script separators

Script files use separator characters to parse script entries (see Script Entries below).

A script file can contain an optional [SEPARATORS] section, which can contain the following keys:

Word Separator=,
Clause Separator=;
Quote Char="
These keys can specify any single character that is part of the ANSI character set. The three keys must all specify different characters. If this section is not present, or if any of the keys are missing, then the default values specified above are used.


Script entries

Script entries are of the form:

n=SEARCHTYPE;INFO

where:

See Format Recognition and Attribute Access for more details on the syntax to use in script files.



Using Dynamic Link Libraries

A dynamic link library is a compiled collection of functions that can be accessed by Windows applications. DLLs can be written in many programming languages, such as Delphi, C and C++. You can specify custom functions for file format recognition and attribute access which match the function prototypes which the LEA Object expects. These are defined below. All the functions used by the LEA Object within the DLL must use the stdcall calling convention (the same calling convention as Windows API functions).

The DLL file name in the script file will not usually include path information. If the path is not specified then the following directories will be searched for the DLL

  1. The directory containing the application's EXE file
  2. The application's current directory
  3. The Windows System directory (usually C:\WINDOWS\SYSTEM on Windows 95/98/ME and C:\WINNT\SYSTEM32 on NT/2000 machines)
  4. The 16-bit System directory (Windows NT/2000 only, usually C:\WINNT\SYSTEM)
  5. The Windows directory (usually C:\WINDOWS on Windows 95/98/ME and C:\WINNT on NT/2000 machines)
  6. The directories specified by the PATH environment variable

Format recognition

The format recognition function should accept a Windows file handle as its single argument and return an integer which equals the value specified in the script file as the return value if the file is of the required format.

The function exported from the DLL should match the description below:

int __stdcall xxxx(HANDLE hFile);   C++ prototype
function xxxx(hFile: THandle): integer; stdcall;   Pascal forward declaration

If the same DLL function is used to recognise multiple file formats in the LEA Object, the function will be called only once for each file, and the result compared with each expected return value in turn.

See Script file format recognition entry layout for details of how to specify a DLL function for format recognition in a script file.


Attribute Access

Attribute values can be read from LEA Object files using a custom DLL function. To use a DLL for LEA Object attribute access, the DLL must export initialisation functions which correspond to the prototypes below.

The function names in the script file are matched case-sensitively with the function names from the DLL.


Script file DLL Initialisation section

Each DLL referenced in an attribute access section of a script file must also have an initialisation section which lists the function names of the open, verify and close functions:

[DLLNAME]
open=OPENFUNCNAME
close=CLOSEFUNCNAME
verify=VERIFYFUNCNAME

where:

DLLNAME is the file name of the DLL, which must match exactly the DLL name specified in the attribute access script entry.

OPENFUNCNAME, CLOSEFUNCNAME, and VERIFYFUNCNAME are the names of the initialisation functions within the DLL, as described above. Note that these function names should match exactly the function names explorted from the DLL. You can examine the exported function names using a utility such as QuickView.



Implementing LEA Objects as COM Servers

The standard LEA Objects are implemented using COM Automation interfaces. This enables each LEA Object to act as a 'plug-in' component.

The standard LEA Objects are each implemented by a single COM class that supports a number of predefined interfaces:

These interfaces are defined in the LEAOBCOM.DLL type library

IDL definition of ILEAFileRecognition interface:

[
 uuid(A65472A0-5323-11D4-B3F3-444553540000),
 version(1.0),
 dual,
 oleautomation
]
interface ILEAFileRecognition: IDispatch
{
 [id(0x00000001)]
 HRESULT _stdcall FileIsFormat([in] BSTR filename, [in] long ifmt, 
    [out, retval] VARIANT_BOOL * Value );
};

This interface contains one method - FileIsFormat - which is called to determine whether the file specified by filename is of the format specified by ifmt - the format code. This method may be called multiple times with the same filename argument for different format codes.
This interface must be implemented if the format recognition method for any of the defined formats is INTERNAL (see Format Defintion above)

IDL definition of ILEAReadAttributes interface:

[
 uuid(48A50CE2-518A-11D4-B3F3-444553540000),
 version(1.0),
 helpstring("Interface to be implemented by derived LEA Objects"),
 dual,
 oleautomation
]
interface ILEAReadAttributes: IDispatch
{
 [id(0x00000003)]
 HRESULT _stdcall OpenFile([in] BSTR filename, [in] long ifmt, 
    [in] VARIANT_BOOL writeable );
 [id(0x00000004)]
 HRESULT _stdcall GetMaxLogicalFiles([in] BSTR filename, [out, retval] long * Value );
 [id(0x00000005)]
 HRESULT _stdcall OpenLogicalFile([in] BSTR filename, [in] long ilogfilenum );
 [id(0x00000006)]
 HRESULT _stdcall GetAttribute([in] BSTR filename, [in] long ilogfilenum, 
    [in] long iattr, [out] TAttrStatus * Status, [out, retval] VARIANT * Value );
 [id(0x00000008)]
 HRESULT _stdcall CloseFile([in] BSTR filename );
 [id(0x00000009)]
 HRESULT _stdcall GetObjName([in] BSTR filename, [in] long ilogfilenum, 
    [out, retval] BSTR * Value );
 [id(0x0000000A)]
 HRESULT _stdcall GetObjShape([in] BSTR filename, [in] long ilogfilenum, 
    [out, retval] TLEAShape * Value );
};

This interface must be implemented if the attribute access method for any of the defined formats is INTERNAL (see Format Defintion above).

When an input file is opened as an LEA Object, the ILEAReadAttributes methods will be called in the following order:

After the format of the file has been verified (via either the ILEAFileRecognition interface, through file extension matching, or a script entry), the OpenFile method is called: ifmt is the format code, and writeable specifies whether the file should be opened read-only (false) or read-write (true). Use this method to allocate resources that will be required when reading the input file.
GetMaxLogicalFiles. This method should return the index number of the last conceptual logical file contained within the input file (ie if there are three logical files, the first logical file is index 0, and the last is index two). If there are no logical files, set Value to zero.
OpenLogicalFile will be called for the logical file index number to open. This function could be used to read the attribute values into internal variables If there are no conceptual logical files, this function can do nothing.
GetObjName is called for the specified logical file number ilogfilenum. The object name is one of the LEA Base Attributes (see below) and is retrieved from the file using this method.
GetObjShape is called for the specified logical file number. The object shape is one of the LEA Base Attributes. This determines the geographical extent of the object referred to by the file. Set Value to one of the TLEAShape constants defined in the LEAOBCOM type library:

[
 uuid(35211F00-519F-11D4-B3F3-444553540000),
 version(1.0)
]
typedef enum tagTLEAShape
{
 shpUNKNOWN = 0, 
 shpPOINT = 1,   
 shpLINE = 2,   
 shpPOLYGON = 3
} TLEAShape;

GetAttribute is called for each of the defined attributes for which the access method for the current file format is INTERNAL. iattr is the Attribute Code (defined above - see Attribute definition). Value should be set to the value of the attribute, bearing in mind that the value must be converted from an VARIANT type into either a STRING, INTEGER, FLOAT, BOOLEAN or DATETIME type.Status should be set to one of the TAttrStatus constants defined in the LEAOBCOM type library:

[
 uuid(8DB6BA2B-4CDE-11D4-B3F3-444553540000),
 version(1.0)
]
typedef enum tagTAttrStatus
{
 asUNDEFINED = 0, /* attribute value is undefined for this format */
 asOK = 1,        /* attribute value is OK */
 asCONV = 2,      /* error converting attribute value into required type */
 asRANGE = 3,     /* attribute value out of range */ 
 asABSENT = 4     /* attribute is absent */
} TAttrStatus;

CloseFile is called once when the input file is closed. This method can be used to free resources allocated in the OpenFile method.

IDL definition of ILEAReadSubObject interface:

[
 uuid(B017372B-D0C0-4315-A6FF-A0BF567C8575),
 version(1.0),
 helpstring("Interface used for multiple objects per logical file"),
 dual,
 oleautomation
]
interface ILEAReadSubObject: IDispatch
{
 [id(0x00000001)]
 HRESULT _stdcall GetSubObjectCount([in] BSTR filename, [in] long ilogfilenum, 
    [out, retval] long * Value );
 [id(0x00000002)]
 HRESULT _stdcall GetSubObjectAttribute([in] BSTR filename, [in] long ilogfilenum, 
    [in] long isubobj, [in] long iattr, [out] TAttrStatus * Status, 
    [out, retval] VARIANT * Value );
};

This interface is optional and should only be implemented if the LEA Object contains conceptual sub objects (see base attributes below)

If this interface is implemented by the object, the GetSubObjectCount method is called after ILEAReadAttributes::OpenFile and ILEAReadAttributes::OpenLogicalFile methods have be called. This method should return the index number of the last conceptual sub-object (the index of the first sub-object is zero).
The GetSubObjectAttribute method replaces the ILEAReadAttributes::GetAttribute method: isubobj is the index of the sub-object.



Base Object Attributes

All LEA Objects have the following attributes:

These attribute names and descriptions are listed in the INI file LEAOBJ.INI which can be found in the LYNXSYS directory. All LEA Objects inherit these attributes. The Base LEA Object (described in BASEOBJ.INI, implemented by COM Object LEAObCom.FileObject accepts all file formats, and will display these attributes for any file-system file.



Key Attributes

LEA Object types all have key attributes which are the essential pieces of information for the particular object type. LEA applications use these key attributes to provide database indices (see Dougal and Florence - the LEA Data Catalogue Designer and Builder).

The default key attributes for the base object are:

  1. File name
  2. Logical file number
  3. Object number



Locale Independence

LEA date/time string representation

There are almost limitless ways to represent date and time values as a string. The default format used on each PC varies according to the locale and the Regional Settings (specified via the Control Panel).
LEA applications present date/time values in the form described below, and expect input strings containing date/time values also to be in this form.


Locale-independent date/time strings

A string representing a date and/or time value will be of the form:

(DD/MM/YYYY) (hh:mm:ss)

where:

Either the date or time section of the string is optional

The date components must be separated by slash (' / ') characters and the time components must be spearated by colon (' : ') characters.

DD is the day number (1-31).

MM is the month number (1-12).

YYYY is the four-digit year number (0000-9999).

hh is the hour number (00-23) - note the use of 24-hour clock.

mm is the minute number (00-59) - note leading zero for single-digit numbers

ss is the seconds number (00-59) - note leading zero for single-digit numbers.

Some examples follow:

12/1/1999
specifies 12th January 1999
15:30:00
specifies half past three in the afternoon
25/6/1999 11:15:00
specifies quarter past eleven in the morning, 25th June 1999


Floating point numbers in INI files

All LEA INI (and parameter) files expect the floating-point numbers they contain to use the dot ( ' . ' ) character as the decimal separator. Floating point values will usually be displayed to you in LEA applications using the local decimal separator specified in the Regional Settings of the Control Panel on each PC. However, when editing INI files directly, it is important to remember to use dot characters to specify floating-point numbers.


Initialisation Errors

Listed below are the error messages that may be generated as the LEA Object's INI file is read. All these errors will cause the initialisation of the LEA Object to fail.
These errors all imply that the INI file format is incorrect or out of sync with the DLL libraries used by applications - the file may have been accidentally edited by hand, the Object Wizard may have failed to save a file correctly due to errors, or a new installation may have failed to upgrade the correct files.

General INI file errors

INI file name missing section section
Error code 502

The named section is missing from the named INI file.

Filename is not an LEA Object INI file
Error code 504

The named file is not recognised as an LEA Object INI file.
LEA Object INI files must have a [LYNX] section with the entry

TYPE=LEAOBJECT

This error may be generated when attempting to create a user-defined LEA Object type.

COM ProgID not found in either [com_classes] section of LEAOBJ.INI or [object_description] section of filename
Error Code 505

In order to create COM objects from a DLL, the progid must be read from the LEA Object INI file. This progid is looked up in the registry to find the identifier of the COM class to create. The progid is usually the name of the DLL containing the COM class, followed by a period and the name of the CoClass to create.
For LEA Objects defined solely by scripts, the progid should be LEAObCom.FileObject.

INI file name does not match version Vx.y
Error Code 506

There is a mismatch between the version range specified in the INI file, and the version number retrieved from the compiled code.

Bad COM ProgID name specified in INI file
Error Code 507

The specified progid does not exist in any registered COM server, or in the DLL specified by the dll key from the [OBJECT_DESCRIPTION] section of the LEA Object INI file.

Error registering COM server name
Error Code 508

Before a COM server can be used, it must be registered on the local PC. This error may occur if you do not have permission to write keys to the registry.

Format definition errors

Name for format code n not found in [FORMAT_NAMES] section of INI file name for current language setting
Error code 301

The format names used by LEA Objects are language-dependent. The actual names of language-dependent sections in the INI file depends on the language prefix used for the current language. The error message text will display the name of the section it is looking for.

Invalid format recognition method keyword for format code n in section [FORMAT_RECOGNITION] of INI file name
Error code 302

The method used to recognise each format must be specified from a list of valid keywords. See Format Recognition above.

Invalid attribute access method for format code n in section [ATTRIB_ACCESS] of INI file name
Error code 303

The method used to read attributes for each format must be specified from a list of valid keywords. See Attribute Access above.

Attribute definition errors

Name for attribute number n not found in [ATTRIB_NAMES] section of INI file name for current language setting
Error code 401

The attribute names used by LEA Objects are language-dependent. The actual names of language-dependent sections in the INI file depends on the language prefix used for the current language. The error message text will display the name of the section it is looking for.

Invalid attribute type keyword for attribute number n in section [ATTRIB_TYPES] of INI file name
Error code 403

The type of each attribute must be specified from a list of valid keywords. See Attribute Definition above.

Script file errors

File name not found
Error code 101

The named script file specified in one of the format recognition or attribute access INI file entries could not be found. See Script Files above for details of the directories searched for script files, and Format Recognition and Attribute Access for details of how to specify the script to use.

File name is not a script file
Error code 109

The named file is not recognised as an LEA Object script file.
The file should be an ASCII file with an INI-style layout (divided into named sections, with the section names delimited by [ and ].
The first section in the script file must be [LYNX] with an entry

TYPE=SCRIPT

denoting that the file is an LEA Object script file.

Section section not found in script file name
Error code 102

The specified section is missing from the script file. See Format Recognition and Attribute Access for details of how to specify the script to use.

Attribute/format key n not found in section section of script file name
Error code 103

There is no entry for the specified attribute/format number in the named section of the script file.
For Format Recognition, the file and section containing the format recognition script are specified for each format.
For Attribute Access, the file and section containing the attribute access scripts are specified on a per format basis, and each attribute must have an entry in the specified script section.

Illegal data conversion keyword for type keyword found in script file name, section section, key n
Error code 104

Each variable type has a list of valid conversion types. See Format Recognition Scripts and Attribute Access Scripts for valid combinations.

Illegal value value in LIMITS for type keyword found in script file name, section section, key n
Error code 105

The LIMITS string is a list of fields which define either a range of alternative acceptable values, or the minimum and maximum acceptable values. The meaning of the fields depends on the variable type. See Format Recognition Scripts and Attribute Access Scripts.

No LIMITS string found for format key n in section section of script file name
Error code 106

For format recognition scripts, a list of alternative or minimum and maximum acceptable values must be supplied.

Invalid search string keyword for key n in section section of script file name
Error code 107

The search string must be specified from a list of valid keywords.
See Format Recognition Scripts and Attribute Access Scripts.

FIND info string invalid for attribute/format key n in section section of script file name
Error code 108

The INFO string associated with the FIND keyword for the specified attribute/format number is invalid. There is probably a field missing from the string. Check that the string matches the definition for Format Recognition scripts or Attribute Access scripts.

DLL errors

DLL file name not found
Error code 201

The DLL specified in a script entry or as a COM server could not be found. If the specified DLL name does not contain a directory path, the following locations are searched for the DLL:

  1. The directory containing the application's EXE file
  2. The application's current directory
  3. The Windows System directory (usually C:\WINDOWS\SYSTEM on Windows 95/98 machines, and C:\WINNT\SYSTEM32 on NT machines)
  4. The 16-bit System directory (Windows NT only, usually C:\WINNT\SYSTEM)
  5. The Windows directory (usually C:\WINDOWS on Windows 95/98 and C:\WINNT on NT machines
  6. The directories specified by the PATH environment variable.

See Format Recognition using a DLL,Attribute Access via DLL and Implementing LEA Objects as COM servers.

Function name not found in DLLname
Error code 202

The specified function is not present in, or is not exported from the specified DLL. The functions exported by a DLL can be listed using the Quick View utility (by right-clicking on the file in an Explorer window).
See Format Recognition using a DLL and Attribute Access via DLL.



File Errors

Listed below are error messages that may occur during the normal use of LEA Objects.

File does not exist

The file specifed for opening does not exist.

Format unknown

The specified file could not be recognised as any of the formats for the current LEA Object type. Formats and the method used to recognise them are listed in the [FORMAT_RECOGNITION] section of the LEA Object's INI file.

File is read-only

An attempt was made to write attribute data back to the LEA Object file, when it was opened in read-only mode, or the file has the read-only flag set


See also:
[Florence - LEA Catalogue Builder]
[Dougal - LEA Catalogue Designer]