Appendix A.4

Library predicates


 

Important Note:

libraries described here have to be included in your C project in order to make related library predicates working. For instance, if you want to use the ProgressBar library predicate, you should include ProgBarLib.c in your C project, or your declaration will have no effect.

Libraries ProgBarLib.c, GraphLib.c, ArrayLib.c, ListLib.c are available in Leonardo Folder:C Libraries.

 

ProgBarLib.c

ProgressBar(Out X,Out Y,Out L,Out H,Out A,Out B,Out C,Out BC,V)

Declare progress bars by enumeration

Description:

the visualization system repeatedly calls this predicate for each view V to gather information (enclosing frame, minimum, current and maximum value, and color) about progress bars to be drawn inside it.

By default, the string "Progress bar" is drawn above the bar.

Note progress bars have no ID, since all attributes must be specified in the same declaration.

Usage:

parameter B must be assigned a value that changes from A to C. The bar will automatically reflect any change of the value assigned to the parameter B.

Note if B<=A the bar is empty; if B>=C the bar is full.

Predicate type:

enumerative

Parameters:

X, Y left-top corner of progress bar's enclosing frame
L, H length and height of progress bar's enclosing frame
A minimun bar value
B current bar value
C maximum bar value
BC bar color
V view that will contain the progress bar

Example:

int i;

/**

View(Out 1);

ProgressBar(Out 20,Out 40,Out 120,Out 12,Out 1,Out B,Out 10,Out LightGreen,1) Assign B=i;

**/

void main(){

for (i=1;i<=10;i++) {

// Do something ...

}

}

"A C variable i is first declared, then a view and a progress bar inside it are declared. The progress bar automatically grows as i grows up from 1 to 10 in the for loop"

This is a snapshot of loop's execution when i=7:

 

[SORRY ... UNDER CONSTRUCTION]

GraphLib.c

 

ArrayLib.c

 

ListLib.c