Class RTS_ENVIRONMENT

java.lang.Object
simula.runtime.RTS_RTObject
simula.runtime.RTS_ENVIRONMENT
Direct Known Subclasses:
RTS_BASICIO

public class RTS_ENVIRONMENT extends RTS_RTObject

System class ENVIRONMENT.

The purpose of the environmental class is to encapsulate all constants, procedures and classes which are accessible to all source modules. It contains procedures for mathematical functions, text generation, random drawing, etc.

Link to GitHub: Source File.

Author:
SIMULA Standards Group, Øystein Myhre Andersen
  • Field Details

    • simulaReleaseID

      static final String simulaReleaseID

      The Simula release identification.

      NOTE: When updating release id, change version in setup.SimulaExtractor and simula.Global

      See Also:
    • _STARTTIME

      static long _STARTTIME
      The start time from System.currentTimeMillis
    • CURRENTLOWTEN

      static char CURRENTLOWTEN
      The current lowten character.
    • CURRENTDECIMALMARK

      static char CURRENTDECIMALMARK
      The current decimal mark character.
    • maxlongreal

      public static final double maxlongreal
      A constant holding the maximum value a long real can have.
      See Also:
    • minlongreal

      public static final double minlongreal
      A constant holding the minimum value a long real can have.
      See Also:
    • maxreal

      public static final float maxreal
      A constant holding the maximum value a real can have.
      See Also:
    • minreal

      public static final float minreal
      A constant holding the minimum value a real can have.
      See Also:
    • maxint

      public static final int maxint
      A constant holding the maximum value an integer can have.
      See Also:
    • minint

      public static final int minint
      A constant holding the minimum value an integer can have.
      See Also:
    • EXCEPTION_HANDLER

      public static RTS_PRCQNT EXCEPTION_HANDLER
      The registered EXCEPTION_HANDLER or null.
  • Constructor Details

    • RTS_ENVIRONMENT

      public RTS_ENVIRONMENT(RTS_RTObject staticLink)
      Normal Constructor
      Parameters:
      staticLink - static link
  • Method Details

    • simulaid

      public static RTS_TXT simulaid()

      Simula identification String.

      The value of "simulaid" is an implementation defined string of the following general format:

          !!!!!!!!!!!!!!!!!!!!!
      
              :   Identification of the SIMULA system (name, version etc.)
              :  Identification of the installation (e.g. organisation name)
              :      Operating system identification (name, version, etc.)
              :     Host system identification (manufacturer, name, number, etc.)
              :    User identification
              :     Job identification (session number)
              :     Account identification
              :    Identification of the executing task or program
      
      Returns:
      Simula identification String.
    • mod

      public static int mod(int i, int j)

      Standard Procedure mod.

      integer procedure mod(i,j);   integer i,j;
      begin integer res;
         res := i - (i//j)*j;
         mod := if res = 0 then 0
           else if sign(res) ne sign(j) then res+j
           else res
      end mod;
      

      The result is the mathematical modulo value of the parameters.

      Parameters:
      i - argument i
      j - argument j
      Returns:
      the resulting mod
    • rem

      public static int rem(int i, int j)

      Standard Procedure rem.

      integer procedure rem(i,j); integer i,j;
                        rem := i - (i//j)*j;
      

      The result is the remainder of an integer division.

      Parameters:
      i - argument i
      j - argument j
      Returns:
      the resulting rem
    • abs

      public static int abs(int e)

      Standard Procedure abs.

       procedure abs(e);  e;
            abs := if e >= 0 then e else -e;
      

      The result is the absolute value of the parameter.

      Parameters:
      e - the argument
      Returns:
      the resulting abs value
    • abs

      public static float abs(float e)
      Standard Procedure abs. See abs(int)
      Parameters:
      e - the argument
      Returns:
      the resulting abs value
    • abs

      public static double abs(double e)
      Standard Procedure abs. See abs(int)
      Parameters:
      e - the argument
      Returns:
      the resulting abs value
    • sign

      public static int sign(double e)
      Standard Procedure sign.
      Parameters:
      e - the argument e
      Returns:
      resulting sign code
    • entier

      public static int entier(double d)

      Standard Procedure entier.

      integer procedure entier(r);  r;
      begin integer j;
            j := r;             ! implied conversion of "r" to integer ;
            entier:= if j > r   ! implied conversion of "j" to real ;
                     then j-1 else j
      end entier;
      

      The result is the integer "floor" of a real type item, the value always being less than or equal to the parameter. Thus, entier(1.8) returns the value 1, while entier(-1.8) returns -2.

      Parameters:
      d - argument d
      Returns:
      the resulting entier
    • addepsilon

      public static float addepsilon(float x)

      Standard Procedure addepsilon.

       procedure addepsilon(e);    e;
          addepsilon := e + ... ; ! see below;
      

      The result type is that of the parameter. The result is the value of the parameter incremented by the smallest positive value, such that the result is not equal to the parameter within the precision of the implementation.

      Thus, for all positive values of "eps",

            E - eps <= subepsilon(E) < E < addepsilon(E) <= E + eps
      
      Parameters:
      x - float argument
      Returns:
      the argument incremented by the smallest possible value
    • addepsilon

      public static double addepsilon(double x)
      Standard Procedure addepsilon. See addepsilon(float)
      Parameters:
      x - double argument
      Returns:
      the argument incremented by the smallest possible value
    • subepsilon

      public static float subepsilon(float x)

      Standard Procedure subepsilon.

       procedure subepsilon(e);    e;
          subepsilon := e - ... ; ! see below;
      

      The result type is that of the parameter. The result is the value of the parameter decremented by the smallest positive value, such that the result is not equal to the parameter within the precision of the implementation.

      Thus, for all positive values of "eps",

            E - eps <= subepsilon(E) < E < addepsilon(E) <= E + eps
      
      Parameters:
      x - float argument
      Returns:
      the argument decremented by the smallest possible value
    • subepsilon

      public static double subepsilon(double x)
      Standard Procedure subepsilon. See subepsilon(float)
      Parameters:
      x - double argument
      Returns:
      the argument decremented by the smallest possible value
    • Char

      public static char Char(int i)

      Standard Procedure char.

      character procedure char(i);  integer i;
         char := ... ;
      

      The result is the character obtained by converting the parameter according to the implementation-defined coding of characters. The parameter must be in the range 0..maxrank.

      Parameters:
      i - an integer agrgument
      Returns:
      the casted value: (char) i
    • _char

      public static char _char(int i)
      Standard Procedure char. See Char(int)
      Parameters:
      i - an integer agrgument
      Returns:
      the casted value: (char) i
    • isochar

      public static char isochar(int i)

      Standard Procedure isochar.

      character procedure isochar(i);  integer i;
         isochar := ... ;
      

      The result is the character obtained by converting the parameter according to the ISO 2022 standard character code. The parameter must be in the range 0..255.

      Parameters:
      i - an integer agrgument
      Returns:
      the casted value: (char) i
    • rank

      public static int rank(char c)

      Standard Procedure rank.

      integer procedure rank(c);  character c;
         rank := ... ;
      

      The result is the integer obtained by converting the parameter according to the implementation-defined character code.

      Parameters:
      c - the argument
      Returns:
      resulting rank
    • isorank

      public static int isorank(char c)

      Standard Procedure isorank.

      integer procedure isorank(c);  character c;
         isorank := ... ;
      

      The result is the integer obtained by converting the parameter according to the ISO 2022 standard character code.

      Parameters:
      c - the argument
      Returns:
      resulting isorank
    • digit

      public static boolean digit(char c)

      Standard Procedure digit.

      Boolean procedure digit(c);  character c;
         digit := ... ;
      

      The result is true if the parameter is a decimal digit.

      Parameters:
      c - the argument
      Returns:
      true: c is a digit
    • letter

      public static boolean letter(char c)

      Standard Procedure letter.

      Boolean procedure letter(c);  character c;
         letter := ... ;
      

      The result is true if the parameter is a letter of the English alphabet ('a' ... 'z', 'A' ... 'Z').

      Parameters:
      c - the argument
      Returns:
      true: c is a letter
    • lowten

      public static char lowten(char c)

      Standard Procedure lowten.

      character procedure lowten(c);  character c;
                        if ... ! c is illegal as lowten;
                        then  error("..." ! Lowten error ;)
                        else begin
                           lowten:= CURRENTLOWTEN; CURRENTLOWTEN:= c
                         end lowten;
      

      Changes the value of the current lowten character to that of the parameter. The previous value is returned. Illegal parameters are

      digits, plus ("+"), minus ("-"), dot ("."), comma (","), control characters (i.e. ISO code<32), DEL (ISO code 127), and all characters with ISO code greater than 127.

      Parameters:
      c - the new lowten character
      Returns:
      the previous lowten character
    • illegalLowten

      private static boolean illegalLowten(char c)
      Check if the given character is illegal as lowten.
      Parameters:
      c - the given character
      Returns:
      true if the given character is illegal as lowten.
    • decimalmark

      public static char decimalmark(char c)

      Standard Procedure decimalmark.

      character procedure decimalmark(c);   character c;
         if c ne '.' and then c ne ','
         then error("..." ! Decimalmark error ;)
         else begin
                 decimalmark:= CURRENTDECIMALMARK;
                 CURRENTDECIMALMARK:= c
      end decimalmark;
      

      Changes the value of the decimal point character used by the text (de)editing procedures (cf. 8.7 and 8.8). See the _TXT methods: getreal, getfrac, putfix, putreal and putfrac. The previous value is returned. The only legal parameter values are dot and comma.

      Parameters:
      c - the new decimalmark character
      Returns:
      the previous decimalmark character
    • copy

      public static RTS_TXT copy(RTS_TXT T)

      Standard Procedure copy.

      text procedure copy(T); text T;
                 if T =/= notext
                 then begin text U;
                    U.OBJ    :- new TEXTOBJ(T.LENGTH,false);
                    U.START  := 1;
                    U.LENGTH := T.LENGTH;
                    U.POS    := 1;
                    U        := T;
                    copy     :- U
                 end copy;
      

      "copy(T)", with T =/= notext, references a new alterable main frame which contains a text value identical to that of T.

      Parameters:
      T - the text object to be copied
      Returns:
      a copy of T
    • blanks

      public static RTS_TXT blanks(int n)

      Standard Procedure blanks.

      text procedure blanks(n); integer n;
                 if        n < 0 then error("..." ! Parm. to blanks < 0;)
                 else if   n > 0
                 then begin text T;
                    T.OBJ    :- new TEXTOBJ(n,false);
                    T.START  := 1;
                    T.LENGTH := n;
                    T.POS    := 1;
                    T        := notext;    ! blank-fill, see 4.1.2;
                    blanks   :- T
                 end blanks;
      

      "blanks(n)", with n > 0, references a new alterable main frame of length n, containing only blank characters. "blanks(0)" references notext.

      Parameters:
      n - the number of space characters
      Returns:
      a text object conraining n space characters
    • upcase

      public static RTS_TXT upcase(RTS_TXT t)

      Standard Procedure uppercase.

      text procedure upcase(t);   text t;
         begin  t.setpos(1); upcase:- t;  ... end;
      

      Convert the letters in the text parameter to their upper case representation. Only letters of the English alphabet are converted.

      The result is a reference to the parameter.

      Parameters:
      t - the argument text
      Returns:
      same text with upper case letters
    • lowcase

      public static RTS_TXT lowcase(RTS_TXT t)

      Standard Procedure lowcase.

      text procedure lowcase(t); text t;
                     begin  t.setpos(1); lowcase:- t; ... end;
      

      Convert the letters in the text parameter to their lower case representation. Only letters of the English alphabet are converted.

      The result is a reference to the parameter.

      Parameters:
      t - the argument text
      Returns:
      same text with lower case letters
    • sqrt

      public static double sqrt(double r)
      Standard Procedure sqrt.
      Parameters:
      r - the parameter r
      Returns:
      Math.sqrt(r)
    • sin

      public static double sin(double r)
      Standard Procedure sin.
      Parameters:
      r - the parameter r
      Returns:
      Math.sin(r)
    • cos

      public static double cos(double r)
      Standard Procedure cos.
      Parameters:
      r - the parameter r
      Returns:
      Math.cos(r)
    • tan

      public static double tan(double r)
      Standard Procedure tan.
      Parameters:
      r - the parameter r
      Returns:
      Math.tan(r)
    • cotan

      public static double cotan(double r)
      Standard Procedure cotan.
      Parameters:
      r - the parameter r
      Returns:
      1.0 / Math.tan(r)
    • arcsin

      public static double arcsin(double r)
      Standard Procedure arcsin.
      Parameters:
      r - the parameter r
      Returns:
      Math.asin(r)
    • arccos

      public static double arccos(double r)
      Standard Procedure arccos.
      Parameters:
      r - the parameter r
      Returns:
      Math.acos(r)
    • arctan

      public static double arctan(double r)
      Standard Procedure arctan.
      Parameters:
      r - the parameter r
      Returns:
      Math.atan(r)
    • arctan2

      public static double arctan2(double y, double x)
      Standard Procedure arctan2.
      Parameters:
      y - the parameter y
      x - the parameter x
      Returns:
      Math.atan2(x,y)
    • sinh

      public static double sinh(double r)
      Standard Procedure sinh.
      Parameters:
      r - the parameter r
      Returns:
      Math.sinh(r)
    • cosh

      public static double cosh(double r)
      Standard Procedure cosh.
      Parameters:
      r - the parameter r
      Returns:
      Math.cosh(r)
    • tanh

      public static double tanh(double r)
      Standard Procedure tanh.
      Parameters:
      r - the parameter r
      Returns:
      Math.tanh(r)
    • ln

      public static double ln(double r)
      Standard Procedure ln.
      Parameters:
      r - the parameter r
      Returns:
      Math.log(r)
    • log10

      public static double log10(double r)
      Standard Procedure log10.
      Parameters:
      r - the parameter r
      Returns:
      Math.log10(r)
    • exp

      public static double exp(double r)
      Standard Procedure exp.
      Parameters:
      r - the parameter r
      Returns:
      Math.exp(r)
    • max

      public static double max(double x, double y)

      Standard Procedure max.

        procedure max(i1,i2);  i1;  i2;
      

      The value is the greater of the two parameter values. Legal parameter types are text, character, real type and integer type.

      The type of the result conforms to the rules of 3.3.1. in Simula Standard.

      Parameters:
      x - the parameter x
      y - the parameter y
      Returns:
      the greater of the two parameter values
    • max

      public static double max(double x, float y)
      Standard Procedure max. See max(double,double)
      Parameters:
      x - the parameter x
      y - the parameter y
      Returns:
      the greater of the two parameter values
    • max

      public static double max(double x, int y)
      Standard Procedure max. See max(double,double)
      Parameters:
      x - the parameter x
      y - the parameter y
      Returns:
      the greater of the two parameter values
    • max

      public static float max(float x, float y)
      Standard Procedure max. See max(double,double)
      Parameters:
      x - the parameter x
      y - the parameter y
      Returns:
      the greater of the two parameter values
    • max

      public static float max(float x, int y)
      Standard Procedure max. See max(double,double)
      Parameters:
      x - the parameter x
      y - the parameter y
      Returns:
      the greater of the two parameter values
    • max

      public static double max(float x, double y)
      Standard Procedure max. See max(double,double)
      Parameters:
      x - the parameter x
      y - the parameter y
      Returns:
      the greater of the two parameter values
    • max

      public static int max(int x, int y)
      Standard Procedure max. See max(double,double)
      Parameters:
      x - the parameter x
      y - the parameter y
      Returns:
      the greater of the two parameter values
    • max

      public static float max(int x, float y)
      Standard Procedure max. See max(double,double)
      Parameters:
      x - the parameter x
      y - the parameter y
      Returns:
      the greater of the two parameter values
    • max

      public static double max(int x, double y)
      Standard Procedure max. See max(double,double)
      Parameters:
      x - the parameter x
      y - the parameter y
      Returns:
      the greater of the two parameter values
    • max

      public static char max(char x, char y)
      Standard Procedure max. See max(double,double)
      Parameters:
      x - the parameter x
      y - the parameter y
      Returns:
      the greater of the two parameter values
    • max

      public static RTS_TXT max(RTS_TXT x, RTS_TXT y)
      Standard Procedure max. See max(double,double)
      Parameters:
      x - the parameter x
      y - the parameter y
      Returns:
      the greater of the two parameter values
    • min

      public static double min(double x, double y)

      Standard Procedure min.

       procedure min(i1,i2);  i1;   i2;
      

      The value is the lesser of the two parameter values. Legal parameter types are text, character, real type and integer type.

      The type of the result conforms to the rules of 3.3.1. in Simula Standard.

      Parameters:
      x - the parameter x
      y - the parameter y
      Returns:
      the lesser of the two parameter values
    • min

      public static double min(double x, float y)
      Standard Procedure min. See min(double,double)
      Parameters:
      x - the parameter x
      y - the parameter y
      Returns:
      the lesser of the two parameter values
    • min

      public static double min(double x, int y)
      Standard Procedure min. See min(double,double)
      Parameters:
      x - the parameter x
      y - the parameter y
      Returns:
      the lesser of the two parameter values
    • min

      public static float min(float x, float y)
      Standard Procedure min. See min(double,double)
      Parameters:
      x - the parameter x
      y - the parameter y
      Returns:
      the lesser of the two parameter values
    • min

      public static double min(float x, double y)
      Standard Procedure min. See min(double,double)
      Parameters:
      x - the parameter x
      y - the parameter y
      Returns:
      the lesser of the two parameter values
    • min

      public static float min(float x, int y)
      Standard Procedure min. See min(double,double)
      Parameters:
      x - the parameter x
      y - the parameter y
      Returns:
      the lesser of the two parameter values
    • min

      public static int min(int x, int y)
      Standard Procedure min. See min(double,double)
      Parameters:
      x - the parameter x
      y - the parameter y
      Returns:
      the lesser of the two parameter values
    • min

      public static float min(int x, float y)
      Standard Procedure min. See min(double,double)
      Parameters:
      x - the parameter x
      y - the parameter y
      Returns:
      the lesser of the two parameter values
    • min

      public static double min(int x, double y)
      Standard Procedure min. See min(double,double)
      Parameters:
      x - the parameter x
      y - the parameter y
      Returns:
      the lesser of the two parameter values
    • min

      public static char min(char x, char y)
      Standard Procedure min. See min(double,double)
      Parameters:
      x - the parameter x
      y - the parameter y
      Returns:
      the lesser of the two parameter values
    • min

      public static RTS_TXT min(RTS_TXT x, RTS_TXT y)
      Standard Procedure min. See min(double,double)
      Parameters:
      x - the parameter x
      y - the parameter y
      Returns:
      the lesser of the two parameter values
    • error

      public static void error(RTS_TXT msg)

      Standard Procedure error.

      procedure error(t);   text t;
         begin ... display text "t" and stop program...
         end error;
      

      The procedure "error" stops the execution of the program as if a runtime error has occurred and presents the contents of the text parameter on the diagnostic channel (normally the controlling terminal).

      Parameters:
      msg - error message text
    • lowerbound

      public static int lowerbound(RTS_ARRAY a, int i)

      Standard Procedure lowerbound.

       integer procedure lowerbound(a,i);
                array a; integer i;
      

      The procedure "lowerbound" returns the lower bound of the dimension of the given array corresponding to the given index. The first dimension has index one, the next two, etc. An index less than one or greater than the number of dimensions of the given array constitutes a run time error.

      Parameters:
      a - _ARRAY reference
      i - bounds index
      Returns:
      the lower bound
    • upperbound

      public static int upperbound(RTS_ARRAY a, int i)

      Standard Procedure upperbound.

       integer procedure upperbound(a,i);
                array a; integer i;
      

      The procedure "upperbound" returns the upper bound of the dimension of the given array corresponding to the given index. The first dimension has index one, the next two, etc. An index less than one or greater than the number of dimensions of the given array constitutes a run time error.

      Parameters:
      a - _ARRAY reference
      i - bounds index
      Returns:
      the upper bound
    • draw

      public static boolean draw(double a, RTS_NAME<Integer> U)

      Random drawing: Procedure draw.

       Boolean procedure draw (a,U);
                     name U; long real a; integer U;
      
      The value is true with the probability a, false with the probability 1 - a.
      It is always true if a >= 1 and always false if a <= 0.
      
      Parameters:
      a - The long real parameter a
      U - The pseudo random number (seed) by name.
      Returns:
      Returns the next pseudorandom with the probability a
    • randint

      public static int randint(int a, int b, RTS_NAME<Integer> U)

      Random drawing: randint distribution.

       integer procedure randint (a,b,U);
      		          name U; integer a,b,U;
      

      The value is one of the integers a, a+1, ..., b-1, b with equal probability. If b < a, the call constitutes an error.

      Parameters:
      a - The integer parameter a
      b - The integer parameter b
      U - The pseudo random number (seed) by name.
      Returns:
      Returns the next pseudorandom, according to the randint distribution
    • uniform

      public static double uniform(double a, double b, RTS_NAME<Integer> U)

      Random drawing: uniform distribution.

      long real procedure uniform (a,b,U);
               name U; long real a,b; integer U;
      

      The value is uniformly distributed in the interval a <= u < b. If b < a, the call constitutes an error.

      Parameters:
      a - The long real parameter a
      b - The long real parameter b
      U - The pseudo random number (seed) by name.
      Returns:
      Returns the next pseudorandom, according to the uniform distribution
    • normal

      public static double normal(double a, double b, RTS_NAME<Integer> U)

      Random drawing: normal distribution.

      long real procedure normal (a,b,U);
              name U; long real a,b; integer U;
      

      The value is normally distributed with mean a and standard deviation b. An approximation formula may be used for the normal distribution function.

      Parameters:
      a - The long real parameter a
      b - The long real parameter b
      U - The pseudo random number (seed) by name.
      Returns:
      Returns the next pseudorandom, according to the negexp distribution
    • negexp

      public static double negexp(double a, RTS_NAME<Integer> U)

      Random drawing: negexp distribution.

      long real procedure negexp (a,U);
               name U; long real a; integer U;
      

      The value is a drawing from the negative exponential distribution with mean 1/a, defined by -ln(u)/a, where u is a basic drawing. This is the same as a random "waiting time" in a Poisson distributed arrival pattern with expected number of arrivals per time unit equal to a.

      If a is non-positive, a runtime error occurs.

      Parameters:
      a - The long real parameter a
      U - The pseudo random number (seed) by name.
      Returns:
      Returns the next pseudorandom, according to the negexp distribution
    • Poisson

      public static int Poisson(double a, RTS_NAME<Integer> U)

      Random drawing: Poisson distribution.

      integer procedure Poisson (a,U);
               name U; long real a; integer U;
      

      The value is a drawing from the Poisson distribution with parameter a. It is obtained by n+1 basic drawings, u(i), where n is the function value. n is defined as the smallest non-negative integer for which

      u(0)/// u(1)/// .../// u(n) < e**(-a)

      The validity of the formula follows from the equivalent condition

      -ln(u(0)) - ln(u(1)) - ... - ln(u(n)) > 1

      where the left hand side is seen to be a sum of "waiting times" drawn from the corresponding negative exponential distribution.

      When the parameter a is greater than some implementation-defined value, for instance 20.0, the value may be approximated by entier(normal(a,sqrt(a),U) + 0.5) or, when this is negative, by zero.

      Parameters:
      a - The long real parameter a
      U - The pseudo random number (seed) by name.
      Returns:
      Returns the next pseudorandom, according to the Poisson distribution
    • Erlang

      public static double Erlang(double a, double b, RTS_NAME<Integer> U)

      Random drawing: Erlang distribution.

      long real procedure Erlang (a,b,U);
               name U; long real a,b; integer U;
      

      The value is a drawing from the Erlang distribution with mean 1/a and standard deviation 1/(a*sqrt(b)). It is defined by b basic drawings u(i), if b is an integer value,

      • ( ln(u(1)) + ln(u(2)) + ... + ln(u(b)) ) / (a*b)

      and by c+1 basic drawings u(i) otherwise, where c is equal to entier(b),

      • ( ln(u(1)) + ... + ln(u(c)) + (b-c)ln(u(c+1)) ) / (ab)

      Both a and b must be greater than zero.

      The last formula represents an approximation.

      Parameters:
      a - The long real parameter a
      b - The long real parameter b
      U - The pseudo random number (seed) by name.
      Returns:
      Returns the next pseudorandom, according to the Erlang distribution
    • discrete

      public static int discrete(RTS_REALTYPE_ARRAY A, RTS_NAME<Integer> U)

      Random drawing: discrete distribution.

       integer procedure discrete (A,U);
                name U;  array A; integer U;
      

      The one-dimensional array A, augmented by the element 1 to the right, is interpreted as a step function of the subscript, defining a discrete (cumulative) distribution function.

      The function value satisfies

      lowerbound(A,1) <= discrete(A,U) <= upperbound(A,1)+1.

      It is defined as the smallest i such that A(i) > u, where u is a basic drawing and A(upperbound(A,1)+1) = 1.

      Parameters:
      A - a real-type array
      U - The pseudo random number (seed) by name.
      Returns:
      Returns the next pseudorandom, discrete distributed according to the array A
    • linear

      public static double linear(RTS_REALTYPE_ARRAY A, RTS_REALTYPE_ARRAY B, RTS_NAME<Integer> U)

      Random drawing: linear distribution.

       long real procedure linear (A,B,U);
            name U;  array A,B; integer U;
      

      The value is a drawing from a (cumulative) distribution function F, which is obtained by linear interpolation in a non-equidistant table defined by A and B, such that A(i) = F(B(i)).

      It is assumed that A and B are one-dimensional arrays of the same length, that the first and last elements of A are equal to 0 and 1 respectively and that A(i) >= A(j) and B(i) > B(j) for i>j. If any of these conditions are not satisfied, the effect is implementation-defined.

      The steps in the function evaluation are:

      l. draw a uniform <0,1> random number, u.

      1. determine the lowest value of i, for which

      A(i-1) <= u <= A(i)

      1. compute D = A(i) - A(i-1)

      2. if D = 0: linear = B(i-1) if D ne 0: linear = B(i-1) + (B(i) - B(i-1))*(u-A(i-1))/D

      Parameters:
      A - a real-type array
      B - a real-type array
      U - The pseudo random number (seed) by name.
      Returns:
      Returns the next pseudorandom, lineary distributed according to the arrays A and B
    • histd

      public static int histd(RTS_REALTYPE_ARRAY A, RTS_NAME<Integer> U)

      Utility: Procedure histd.

      integer procedure histd (A,U);
               name U;  array A; integer U;
      

      The value is an integer in the range (lsb,usb), where lsb and usb are the lower and upper subscript bounds of the one-dimensional array A. The latter is interpreted as a histogram defining the relative frequencies of the values.

      Parameters:
      A - a real-type array
      U - The pseudo random number (seed) by name.
      Returns:
      Returns the next pseudorandom, distributed according to the array A
    • datetime

      public static RTS_TXT datetime()

      Standard Procedure datetime.

      text procedure datetime;   datetime :- Copy("...");
      

      The value is a text frame containing the current date and time in the form YYYY-MM-DD HH:MM:SS.sss.... The number of decimals in the field for seconds is implementation-defined.

      Returns:
      a formated text
    • cputime

      public static double cputime()

      Standard Procedure cputime.

      long real procedure cputime;
      

      The value is the number of processor seconds spent by the calling program.

      Returns:
      seconds since start of program
    • clocktime

      public static double clocktime()

      Standard Procedure clocktime.

      long real procedure clocktime;
      
      Returns:
      The value is the number of seconds since midnight.
    • histo

      public static void histo(RTS_REAL_ARRAY A, RTS_REAL_ARRAY B, float c, float d)

      Standard Procedure histo.

      procedure histo(A,B,c,d);
                real array A,B; real c,d;
      

      Procedure statement "histo(A,B,c,d)" updates a histogram defined by the one-dimensional arrays A and B according to the observation c with the weight d. A(lba+i) is increased by d, where i is the smallest integer such that c <= B(lbb+i) and lba and lbb are the lower bounds of A and B respectively. If the length of A is not one greater than that of B the effect is implementation-defined. The last element of A corresponds to those observations which are greater than all elements of B.

      Parameters:
      A - real array a
      B - real array b
      c - real value c
      d - real value d
    • argv

      public static RTS_TXT argv(int index)
      Extended Standard procedure argv.
      Parameters:
      index - case index
      Returns:
      requested text info
    • exit

      public static void exit(int status)
      Extended Standard procedure exit.
      Parameters:
      status - exit status
    • edit

      public static RTS_TXT edit(boolean n)
      Extended Standard procedure edit.
      Parameters:
      n - the argument
      Returns:
      the edited text
    • edit

      public static RTS_TXT edit(char n)
      Extended Standard procedure edit.
      Parameters:
      n - the argument
      Returns:
      the edited text
    • edit

      public static RTS_TXT edit(long n)
      Extended Standard procedure edit.
      Parameters:
      n - the argument
      Returns:
      the edited text
    • edit

      public static RTS_TXT edit(int n)
      Extended Standard procedure edit.
      Parameters:
      n - the argument
      Returns:
      the edited text
    • edit

      public static RTS_TXT edit(float n)
      Extended Standard procedure edit.
      Parameters:
      n - the argument
      Returns:
      the edited text
    • edit

      public static RTS_TXT edit(double n)
      Extended Standard procedure edit.
      Parameters:
      n - the argument
      Returns:
      the edited text
    • edfix

      public static RTS_TXT edfix(double r, int n)
      Extended Standard procedure edit.
      Parameters:
      r - the real argument
      n - number of digits after decimal sign
      Returns:
      the edited text
    • edfix

      public static RTS_TXT edfix(float r, int n)
      Extended Standard procedure edit.
      Parameters:
      r - the real argument
      n - number of digits after decimal sign
      Returns:
      the edited text
    • edtime

      public static RTS_TXT edtime(float hours)
      Edit simulated time.
      Parameters:
      hours - simulated time
      Returns:
      the edited text
    • edtime

      public static RTS_TXT edtime(double hours)
      Edit simulated time.
      Parameters:
      hours - simulated time
      Returns:
      the edited text
    • waitSomeTime

      public static void waitSomeTime(int millies)
      Extended Standard procedure waitSomeTime.
      Parameters:
      millies - wait time in millisecods
    • printThreadList

      public static void printThreadList(boolean withStackTrace)
      Extended Standard procedure printThreadList.
      Parameters:
      withStackTrace - true: if stacktrace is wanted
    • printStaticChain

      public static void printStaticChain()

      Extended Standard procedure printStaticChain.

      See DEFEXCEPTION(RTS_PRCQNT)

    • DEFEXCEPTION

      public static void DEFEXCEPTION(RTS_PRCQNT EXCEPTION_HANDLER)

      S-PORT Extension Procedure DEFEXCEPTION.

      Register an EXCEPTION_HANDLER to be used by the runtime system when a runtime error occur.

      Parameters:
      EXCEPTION_HANDLER - the argument
    • hash

      public static int hash(RTS_TXT txt)
      S-PORT Extension Procedure hash.
      Parameters:
      txt - the argument
      Returns:
      resulting hash value
    • loadChar

      public static char loadChar(RTS_TXT t, int p)

      Text Extension Procedure loadChar.

      Load a character from a text.

      Parameters:
      t - a text reference
      p - the text position in which the character is stored
      Returns:
      the character at position p
    • storeChar

      public static void storeChar(char c, RTS_TXT t, int p)

      Text Extension Procedure storeChar.

      Store character into a text.

      Parameters:
      c - a character
      t - a text reference
      p - the text position in which the character is stored