JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
ToolTalk User's Guide
search filter icon
search icon

Document Information

Preface

1.  Introducing the ToolTalk Service

2.  An Overview of the ToolTalk Service

3.  Message Patterns

4.  Setting Up and Maintaining the ToolTalk Processes

5.  Maintaining Application Information

6.  Maintaining Files and Objects Referenced in ToolTalk Messages

7.  Participating in ToolTalk Sessions

8.  Sending Messages

9.  Dynamic Message Patterns

10.  Static Message Patterns

11.  Receiving Messages

12.  Objects

13.  Managing Information Storage

Information Provided to the ToolTalk Service

Information Provided by the ToolTalk Service

Calls Provided to Manage the Storage of Information

Marking and Releasing Information

Marking Information for Storage

Releasing Information No Longer Needed

Example of Marking and Releasing Information

Allocating and Freeing Storage Space

Allocating Storage Space

Freeing Allocated Storage Space

Special Case: Callback and Filter Routines

Callback Routines

Filter Routines

14.  Handling Errors

A.  Migrating from the Classing Engine to the ToolTalk Types Database

B.  A Simple Demonstration of How the ToolTalk Service Works

C.  The ToolTalk Standard Message Sets

D.  Frequently Asked Questions

Glossary

Index

Calls Provided to Manage the Storage of Information

The ToolTalk service provides the calls listed in to manage the storage of information in the ToolTalk API allocation stack:

Table 13-1 Managing ToolTalk Storage

Return Type
ToolTalk Function
Description
int
tt_mark(void)
Marks information returned by a series of functions.
void
tt_release(int mark)
Frees information returned by a series of functions.
caddr_t
tt_malloc(size_t s)
Reserves a specified amount of storage in the allocation stack for your use.
void
tt_free(caddr_t p)
Frees storage set aside by tt_malloc. This function takes an address returned by the ToolTalk API and frees the associated storage.

Marking and Releasing Information

The tt_mark() and tt_release() functions are a general mechanism to help you easily manage information storage. The tt_mark() and tt_release() functions are typically used at the beginning and end of a routine where the information returned by the ToolTalk service is no longer necessary once the routine has ended.

Marking Information for Storage

To ask the ToolTalk service to mark the beginning of your storage space, use tt_mark. The ToolTalk service returns a mark, an integer that represents a location on the API stack. All the information that the ToolTalk service subsequently returns to you will be stored in locations that come after the mark.

Releasing Information No Longer Needed

When you no longer need the information contained in your storage space, use tt_release() and specify the mark that signifies the beginning of the information you no longer need.

Example of Marking and Releasing Information

calls tt_mark() at the beginning of a routine that examines the information in a message. When the information examined in the routine is no longer needed and the message has been destroyed, tt_release() is called with the mark to free storage on the stack.

Example 13-1 Getting a Storage Mark

    /*
     * Get a storage mark so we can easily free all the data
     * ToolTalk returns to us.
     */

    mark = tt_mark();

    if (0==strcmp(“ttsample1_value”, tt_message_op(msg_in))) {
            tt_message_arg_ival(msg_in, 0, &val_in);
            xv_set(gauge, PANEL_VALUE, val_in, NULL);
    }

    tt_message_destroy(msg_in);
    tt_release(mark);
    return;

Allocating and Freeing Storage Space

The tt_malloc() and tt_free() functions are a general mechanism to help you easily manage allotted storage allocation.

Allocating Storage Space

tt_malloc() reserves a specified amount of storage in the allocation stack for your use. For example, you can use tt_malloc() to create a storage location and copy the sessid of the default session into that location.

Freeing Allocated Storage Space

To free storage of individual objects that the ToolTalk service provides you pointers to, use tt_free(). For example, you can free up the space in the API allocation stack that stores the sessid after you have examined the sessid. tt_free() takes an address in the allocation stack (a char * pointer or an address returned from tt_malloc()) as an argument.