04.04.2013 Views

Prism User's Guide - CSAIL People - MIT

Prism User's Guide - CSAIL People - MIT

Prism User's Guide - CSAIL People - MIT

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

:)<br />

)<br />

)<br />

Chptr. isaizngDta9<br />

Chapter 5. Wisualizing Data 97<br />

The function should end with<br />

return prism_struct_return();<br />

* void prismadd array (char *fieldname,<br />

int nelements)<br />

Call this for each pointer field in the structure that is really a dynamic<br />

array. fieldname is the name of the pointer field of the structure, and<br />

nelements is the current length of the array pointed to by fieldname.<br />

* void prism addunion (char *unionname,<br />

char *union_element)<br />

Call this for each field of a structure that is of type union. union_name<br />

is the name of the member that is a union. union element is the name<br />

of the field in the union that is currently valid.<br />

An Example<br />

This sample program shows the use of these functions.<br />

struct Graph {<br />

int nlines;<br />

float *lines;<br />

int nvertices;<br />

float *vertices;<br />

};<br />

struct Value {<br />

int type;<br />

};<br />

union {,<br />

int ival;<br />

float fval;<br />

double dval;<br />

} val;<br />

#define INTEGER 0<br />

#define FLOAT 1<br />

#define DOUBLE 2<br />

prism_define_Graph(g)<br />

struct Graph *g;<br />

Version 1.2, March 1993<br />

Copyright ) 1993 Thinking Machines Corporation<br />

/* length of lines array */<br />

/* length of vertices array */<br />

/* gives type of currently valid<br />

union member */

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!