Single-Element Functions : Calling Single-Element Functions

Calling Single-Element Functions

As shown in the diagram, extracting information from your database is at least a two-stage process.

Stage 1Pass the element name or synonym as a function argument to get the element ID. The function calling sequence is as follows:

stm_r_xx (name, status)

In this syntax:

stm_r_—Designates the function as a Statemate database retrieval function.
xx—The two-character element type abbreviation.
name—The name of the element for which information is requested. The input argument name contains the name (path name) or synonym that uniquely identifies the element of interest. The name can be a variable or a literal string (enclosed by single apostrophe marks).
status—The return function status code.

For example:

stm_r_st(’S1’,status)

This function call returns the ID for state S1. The value returned by the function is a Statemate element of the type specified by xx. In this example, the value returned by the function is of type STATE.

Stage 2—Pass the element ID as a function argument to get the information requested. The function calling sequence is as follows:

stm_r_xx_info (inarg, ..., status)

or

stm_r_info (inarg, ..., status)

In this syntax:

stm_r_—Designates the function as a Statemate database retrieval function.
xx—The two-character element type abbreviation. Note that in some functions, these two characters are omitted.
info—The type of information to be extracted from the database.
inarg—The required input arguments.
status—The return function status code.

For example:

stm_r_ac_description (a, status)

or

stm_r_description (a, status)

This function call retrieves the contents of the Description field for the activity whose ID is contained in the variable a.

There is one function whose calling sequence differs from that shown above. This function, stm_r_element_type, receives an element ID as input and returns the element type. The function returns an enumerated type value of the form “stm_state”, “stm_activity”, and so on.