18.10.2014 Views

SIMSCRIPT II.5 Programming Language

SIMSCRIPT II.5 Programming Language

SIMSCRIPT II.5 Programming Language

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.

<strong>Programming</strong> <strong>Language</strong> Concepts<br />

names defined by the <strong>SIMSCRIPT</strong> <strong>II.5</strong> software are generally of the form letter-period-name or<br />

name-period-letter. Examples of the way these functions may be used are:<br />

if abs.f(X-Y) > 1<br />

let Z = log.e.f(Y)<br />

let D = sqrt.f(A**2 + B**2)<br />

for I = 1 to min.f(max.f(A,B), max.f(X,Y,Z))<br />

Following from the earlier discussion of routine arguments, it might be expected that each library<br />

function would have a defined number of given arguments. This is true with the exception of two<br />

functions, max.f and min.f, which return the maximum or minimum value, respectively, from<br />

any number of given arguments. For uniformity, the function notation is used as described. However,<br />

not all of the library functions are implemented as routines. Depending on the implementation,<br />

they may be directly evaluated within the program statements.<br />

Many of the library functions are implementations of widely used mathematical functions. Some<br />

others, however, have meanings specific to <strong>SIMSCRIPT</strong> <strong>II.5</strong>. These will be described further as<br />

the context requires.<br />

The library functions can be used freely in all computations. Function arguments can be arithmetic<br />

expressions of any complexity (including function names) as long as they are of the correct mode<br />

and their values conform with the restrictions listed with the function descriptions.<br />

2.16 Using Non-<strong>SIMSCRIPT</strong> Routines<br />

With some restrictions, routines written in programming languages other than <strong>SIMSCRIPT</strong> <strong>II.5</strong><br />

may be used in a <strong>SIMSCRIPT</strong> <strong>II.5</strong> routine. To do so, the routine must be specially defined within<br />

the program preamble as:<br />

as a nonsimscript routine<br />

as a fortran routine<br />

By default, agruments to a non-simscript routine are passed by value, while arguments to a<br />

fortran routine are passed by reference. The appropriate <strong>SIMSCRIPT</strong> <strong>II.5</strong> user manual should<br />

be consulted. Yielded arguments may not be specified for any non-<strong>SIMSCRIPT</strong> routine.<br />

Function values may be returned providing the function mode is correctly defined. In general, the<br />

interpretation of error conditions is not well defined when these occur within non-<strong>SIMSCRIPT</strong><br />

routines called from <strong>SIMSCRIPT</strong> <strong>II.5</strong>.<br />

2.17 Returning Reserved Arrays To Free Storage<br />

When a reserve statement is executed, an amount of storage space determined from the<br />

dimensions is allocated to the array pointers named in the statement. If at any time the space<br />

associated with an array is no longer required, it may be returned to the free memory pool by<br />

executing a release statement naming the array. The total space requirement of a program may<br />

65

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

Saved successfully!

Ooh no, something went wrong!