Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
Starbase Display List Programmer's Manual: HP 9000 Series 700 Computers > Chapter 10 Miscellaneous Topics

Application Data

» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Glossary

 » Index

For those applications with very little data other than the graphical information in the display list, application data can act as the application's data storage mechanism, thereby removing the need for a supplemental data base.

Application data, which can be placed into and inquired from an open segment, is not interpreted or modified by Starbase in any way. Thus, it can safely be used for any purpose by the application program. For example:

  • It can relate the graphics data storage of the display list to the application models maintained by the application in an application data base.

  • It can store information about the graphics model defined in the display list.

  • It can store information about who made modifications to the display list, and when the modifications were made. This can be done either through an interactive question-answering segment of code, or automatically, by interrogating system variables (e.g., login name, real-time clock, etc.).

Application data is stored and manipulated as raw data (bytes). Any type of information can be stored and retrieved using the application_data, inq_application_data_size and inq_application_data calls. The syntax is:

  • application_data(〈fildes〉, 〈size〉, 〈data〉);

    • and

  • inq_application_data_size(〈fildes〉, 〈size〉);

    • and

  • inq_application_data(〈fildes〉, 〈data〉);

where:

  • size〉 is the number of bytes the application data consumes.

  • data〉 is the byte stream of application data.

Empty application-data elements can be placed into a segment as place-holders by specifying a size of 0 on the application_data call. If the value of the size parameter is negative, an error is generated and the call is ignored.

Your application must ensure that there is sufficient space for the return of the application data from the inq_application_data call; if space is insufficient, data can be overwritten. The inq_application_data_size call will return the number of bytes required to contain the application data in the current element of the open segment.

As an example of this, take the house example that has been used as an example previously. You might want to store, as application data, the builder of the house, the year is was built, the cost, and certain features of the house (for real-estate purposes). These items of information can be easily stored in an application-data element, and subsequently retrieved.

In the example code fragment below, such application data was stored into an element, the original data area was erased, and then the application data was retrieved from the display list element and printed.

#define Bedrooms        6
#define Baths 1.5
struct { /* \ */
char Builder[30]; /* \ */
int YearBuilt; /* \ Various application- */
float Cost; /* / dependent information */
char Features[80]; /* / */
} AppData; /* / */
main() /* program "AppData.c" */
.
.
.
open_segment(fildes, House, AppendOff, DisplayOff);
strcpy(AppData.Builder, "Frank Lloyd Left");
AppData.YearBuilt = 1976;
AppData.Cost = 38721.42;
sprintf(AppData.Features, "%d BR, %3.1f BA, DR, LR, GFA, AC, frplc.",
Bedrooms, Baths);
application_data(fildes, sizeof(AppData), &AppData);
call_segment(fildes, Wall);
call_segment(fildes, Roof);
close_segment(fildes);
.
.
.
strcpy(AppData.Builder, "");
AppData.YearBuilt = 0;
AppData.Cost = 0.0;
strcpy(AppData.Features, "");
open_segment(fildes, House, AppendOff, DisplayOff);
set_ele_ptr(fildes, 1);
inq_application_data(fildes, &AppData);
printf("Builder: %s\nBuilt: %d\nCost: $%.2f\nFeatures: %s\n",
AppData.Builder, AppData.YearBuilt, AppData.Cost, AppData.Features);
gclose(fildes);

The non-graphical output of the program is:

Builder:  Frank Lloyd Left
Built: 1976
Cost: $38721.42
Features: 6 BR, 1.5 BA, DR, LR, GFA, AC, frplc.

Application data elements are ignored during pick and display traversal.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1995 Hewlett-Packard Development Company, L.P.