next up previous contents index
Next: Mathematical Formula Handling Up: Using Variables Previous: Definition

Assignment and Examination

SIC variables can be assigned new values, and examined using the following routines.                    

          Argument Data Type      Assignment    Examination Subroutine
          REAL*8                  SIC_LET_DBLE   SIC_GET_DBLE
          REAL*4                  SIC_LET_REAL   SIC_GET_REAL
          INTEGER*4               SIC_LET_INTE   SIC_GET_INTE
          LOGICAL*4               SIC_LET_LOGI   SIC_GET_LOGI
          CHARACTER*(*)           SIC_LET_CHAR   SIC_GET_CHAR

The calling syntax is the following 
          CALL SIC_LET_Name (NAME,VARIABLE,ERROR)
          CALL SIC_GET_Name (NAME,VALUE,ERROR)
except for SIC_GET_CHAR
          CALL SIC_GET_CHAR (NAME,STRING,LENGTH,ERROR)
These a-priori useless routines can be used to modify variables defined in completely independent parts of a program such as the codes supporting two different SIC languages. For example the GRAPHIC $\backslash$ language interacts with GREG1 $\backslash$ and GREG2 $\backslash$ through SIC variables.

For assignment routines, the data type of the VARIABLE argument and of the SIC variable must match exactly. For retrieving routines, the data type to specify is the type of the VALUE argument; implicit conversion from the type of the SIC variable is done if possible, an error is returned otherwise.

Only SCALAR variables can be assigned or examined in this way. For ARRAY variables, you should use the subroutine SIC_DESCRIPTOR.    

          CALL SIC_DESCRIPTOR (VARIABLE,DESC,FOUND)
 
   - VARIABLE is the variable name (general syntax A[i,j] allowed)
   - DESC is the descriptor of the variable, an integer array of
     dimension 9 containing
        DESC(1) Variable type, with READONLY code. The true 
                variable type is VAR_TYPE(DESCR)
                Valid values are
                * 0 < VAR_TYPE(DESC) : Character string of length 
                                       VAR_TYPE(DESC)
                * VAR_TYPE(DESC) < 0 may have the value
                      FMT_R4 for REAL*4 variable
                      FMT_R8 for REAL*8 variable
                      FMT_I4 for INTEGER*4 variable
                      FMT_L  for LOGICAL*4 variable
                      FMT_BY for BYTE variable
                      FMT_C4 for COMPLEX variables
                * If VAR_TYPE(DESC) is not equal to DESC(1), the 
                      variable is READONLY.
        DESC(2) Variable address
        DESC(3) Number of dimensions
        DESC(4) - DESC(7)     Dimensions
        DESC(8) Size of allocation (words)
        DESC(9) Origin of variable
                0       program defined
                < 0     user defined
                > 0     image
    - FOUND is a logical indicating whether the specified variable
      exist or not.
The parameters FMT_R4, FMT_R8, FMT_I4, FMT_L, FMT_BY and FMT_C4 are defined in the file inc:format.inc.

Two other routines may be required for variable handling:    

SIC_INCARNATE is used to create an ``incarnatio'' of a variable under a specified type (REAL, DOUBLE, INTEGER).

        CALL SIC_INCARNATE(FORM,DESC,INCA,ERROR)
where
    - FORM is the format of the desired incarnation (FMT_R4, FMT_I4
      or FMT_R8)
    - DESC is the descriptor of the variable 
    - INCA is the descriptor of the incarnation
    - ERROR is a logical error flag
DESC and INCA are Integer arrays of dimension 9. DESC should have been obtained by a previous call to SIC_DESCRIPTOR.

Once used, the incarnation may be deleted using routine SIC_VOLATILE

    CALL SIC_VOLATILE(INCA)
where
    - INCA is the descriptor of the incarnation.


next up previous contents index
Next: Mathematical Formula Handling Up: Using Variables Previous: Definition
Gildas manager
2002-06-07