Next: Controlled Variables, Up: Using Probability Variables [Contents][Index]

The “data” section of an assembler program can contain the definitions of probability variables.
Every definition of a probability variable must be on a separate line.
The line begins with a data label followed by at least one whitespace character, the ‘`prob`’ keyword, at least one whitespace character, and the initial value of a probability variable in the range 0 to 1 inclusive.
The data label is the name of this probability variable.
The assembler supports fixed-point and exponential notations for specifying the initial values of probability variables.
The “data” section followed by the “code” section may look like this:

.datavar_name_1probval1var_name_2probval2...var_name_NprobvalN.code

An assembler program can contain multiple ‘`.data`’ and ‘`.code`’ blocks, for example, within macros later expanded by the assembler preprocessor.
The parser of an assembler program merges those blocks into a single “data” section and a single “code” section.

You can replace numeric probability values in `jprob`

and `case`

instructions with the names of probability variables previously defined in the “data” section:

jprobvar_name,loc_label

casevar_name,loc_label

A `choice`

instruction block might look like this:

choice case var1, L1 case var2, L2 case 0.25, L3 case var1, L4 end choice

After parsing an assembler program, you can obtain the number of probability variables defined in the assembler program by the following function.

- Function:
*int***qsmm_get_prg_nvar***(qsmm_prg_t*`prg`) This function returns the number of probability variables defined in a program

`prg`using ‘`prob`’ keywords. A returned value is always non-negative.

Use the following function to get the name of a probability variable by its index.

- Function:
*const char ****qsmm_get_prg_var_name***(qsmm_prg_t*`prg`, int`var_idx`) This function returns the name of a probability variable with index

`var_idx`in a program`prg`. If`var_idx`is negative or greater than or equal to the number of probability variables defined in the program using ‘`prob`’ keywords, the function returns`NULL`

.

See Output Arrays, for how to define output probabilities arrays in an assembler program.

Next: Controlled Variables, Up: Using Probability Variables [Contents][Index]