Norman version 2
User's Guide

Previous page

Email the author

Index

Reference list

Next page


Appendix 2: Preparing standard NORMAN modules: a programming guide

The aim of this section is to give the information necessary to develop new standard (BASIC) modules. The following figure shows an example of a very simple one designed for calculation of the multicationic parameters after De la Roche et al. (1980).

 

The input data enter the module in an array (here r() with millications*1000 but it can be also raw major-element data stored in q(); see Tab. 7). Typically a cycle is run for all the samples (from 1 to pocet), some calculation performed and the results transferred into the output array (w()).

For the standard modules, all the variable names can be used apart from those listed in Tab. 7, as these are reserved by the system. The explanation of the most important ones follows (Tab. 8).

 

Table 7: Global variables reserved by NORMAN (as defined in the include file NORDEF.BI)

Integer

cipwsum, custom, cyklus, desetiny, erro, esc, fce, feopt, ink, jaky, kde, konstanty, kteryprogram, ladim, level, majors, normfce, pap, parametry, pmenu, pocet, polozky, programme, push, sil, sirka, sumovat, starous, sx, sy, ukazatel, ukazatel2, userfce, userid, userlevel, uzfce, vratitse, zacyklen

String

adapt$, aritm$, datadir$, dirdef$, in$, name$, normandir$, program$, sufix$, wild$; konst$(), m$(), norman$(), sample$(), user$()

Single precision real

d(),molwt(), poct(),q(),silik(),vysl(),vysledek(),r(),w()

 

Table 8: Explanation of the most important global variables

cipwsum

sum CIPW to 100%?(0: no, 1: yes); if CO2 is to be used, increase cipwsum by 2, by 4 if cancrinite is present, by 8 if spinel is to be calculated (only for samples with SiO2<45%)

majors

no. of oxides in the system

pap

default colour of the background (white)

ink

default colour of foreground (dark blue)

pocet

number of samples in the current data set

sumovat

sum up the calculated parameters?

sx, sy

the size of a character (in pixels) for the current video mode

adapt$

video adapter ("EGA", "VGA" or "Hercules")

datadir$

default data directory

dirdef$

default directory with the *.DEF files

normandir$

default NORMAN directory

sample$(pocet,3)

sample ID (1), Locality (2) and RockType (3)

molwt()

molecular weights (taken from QNORMAN.MSG)

d(pocet)

is sample selected? (0: yes, 1: no)

q(majors+1,pocet)

raw major/element data and their calculated sum

r()

millications

w()

calculated results

 

The next figure shows a more complicated case of a standard module, designed for computing the CIPW norm. This time, a local variable s() is defined to hold the analyses of individual major elements divided by their respective molecular weights. Again, the main cycle for all samples is entered. The algorithm itself is complex, branching often, but again, the calculated parameters are eventually passed to the output array w(). As there is a danger of an attempt on an illegal arithmetic operation, such as division by zero for incomplete data sets, the module contains a simple error handler, which returns the error code (erro=6, corresponding to the "Calculation error") and the sample number to the calculation module.

 

 

As soon as the new module is finished, it can be attached to the NORMAN system by running the INSTALL module and specifying the names of the parameters. Alternatively, these can be, with some caution, entered manually into the configuration file QNORMAN.DAT. Simply append a line with the information analogous to that given below, keeping in mind that the parameters' names should not be longer than 15 characters. These starting with "@" will be not displayed at all and each ">" equals one space of indentation while displayed by the "Show results|Individually" option (see e.g. the CIPW module to see this effect).

 

Apart from that, the following line in the menu configuration file QNORMAN.MNU is to be altered:

 

 

 


Previous page

Email the author

Index

Reference list

Next page