Module Simula

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.
    • PASS_NO

      private static int PASS_NO
      The S-port FEC pass number.
  • 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:

           <simid>!!!<siteid>!!!<OS>!!!<CPU>!!!<user>!!!<job>!!!<acc>!!!<prog>
       
               <simid>:   Identification of the SIMULA system (name, version etc.)
               <siteid>:  Identification of the installation (e.g. organisation name)
               <OS>:      Operating system identification (name, version, etc.)
               <CPU>:     Host system identification (manufacturer, name, number, etc.)
               <user>:    User identification
               <job>:     Job identification (session number)
               <acc>:     Account identification
               <prog>:    Identification of the executing task or program
       
      Returns:
      Simula identification String.
    • _IS

      public static boolean _IS(Object obj, Class<?> cls)
      Object relation: IS.
             simple-object-expression is class-identifier
       
      Parameters:
      obj - object reference
      cls - class reference
      Returns:
      true: relation holds
    • 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.
       <type of e> procedure abs(e); <type> 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.
       integer procedure sign(e);    e;
           sign := if e > 0 then  1
              else if e < 0 then -1 else 0;
       
      The result is zero if the parameter is zero, one if the parameter is positive, and minus one otherwise.
      Parameters:
      e - the argument e
      Returns:
      resulting sign code
    • entier

      public static int entier(double d)
      Standard Procedure entier.
       integer procedure entier(r); <real-type> 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
    • _IPOW

      public static int _IPOW(int b, int x)
      Integer Power: b ** x
      Parameters:
      b - argument b
      x - argument x
      Returns:
      b ** x
    • addepsilon

      public static float addepsilon(float x)
      Standard Procedure addepsilon.
       <type of e> procedure addepsilon(e);   <real-type> 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.
       <type of e> procedure subepsilon(e);   <real-type> 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
    • 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.
        <type> procedure max(i1,i2); <type> i1; <type> 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 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 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 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.
       <type> procedure min(i1,i2); <type> i1;  <type> 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 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 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 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);
                <type> 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);
                <type> 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_RTObject.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_RTObject.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_RTObject.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_RTObject.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_RTObject.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_RTObject.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_RTObject.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)) ) / (a*b)

      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_RTObject.RTS_REALTYPE_ARRAY A, RTS_RTObject.RTS_NAME<Integer> U)
      Random drawing: discrete distribution.
        integer procedure discrete (A,U);
                         name U; <real-type> 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

      Random drawing: linear distribution.
        long real procedure linear (A,B,U);
             name U; <real-type> 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.

      2. determine the lowest value of i, for which

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

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

      4. 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

      Utility: Procedure histd.
       integer procedure histd (A,U);
                name U; <real-type> 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_RTObject.RTS_REAL_ARRAY A, RTS_RTObject.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
    • 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(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
    • 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 hash.

      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)
      S-PORT 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)
      S-PORT 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
    • getTextInfo

      public static RTS_TXT getTextInfo(int index)
      S-PORT Extension Procedure getTextInfo.
       The routine getTextInfo is defined to get all information from the
       environment to the front-end that must be given as a text.
       
       The parameter index is an integer that specifies what information we request.
       The result will be a string which is filled into result. The export parameter
       filled gives the number of characters in the string.
       
       Index: Interpretation:
       
       1 What is the name of the source input file? Result will give the name.
       
       2 What is the name of the listing file? Result will give the file name. If no
       such output is to be produced, then the string will be empty.
       
       3 What is the name of the file for separate output of diagnostics messages?
       Result will give the file name. If no such output is to be produced, then the
       string will be empty.
       
       4 What is the name of the file for storing the normal (byte packed) S-code?
       Result will give the file name. If no such output is to be produced, then the
       string will be empty.
       
       5 What is the name of the file for storing decimally coded S-code? Result
       will give the file name. If no such output is to be produced, then the string
       will be empty.
       
       6 What is the name of the file for storing textually coded S-code? Result
       will give the file name. If no such output is to be produced, then the string
       will be empty.
       
       7 What is the name of the scratch file to be used for storing the
       intermediate code between the passes in the front-end? Result will give the
       name of the file.
       
       8 What is the name of the scratch file to be used for storing the declaration
       structures between the passes in the front-end? Result will give the name of
       the file.
       
       9 Reserved for further scratch file requests. Result will give the name of
       the file.
       
       10 Reserved for further scratch file requests. Result will give the name of
       the file.
       
       11 What is the name of the attribute file for the current compilation? This
       will only be necessary for a separate compilation. This file will be used as
       the front-end's attribute file. (Cf. section 4.6) Result will give the name
       of the file.
       
       12 What is the name of the attribute file for an external declaration? Before
       this request is issued, the environment will have received the identifier and
       the external identifier for the external declaration through the routine
       give_textinfo described below. (Cf. section 4.6) Result will give the name of
       the file.
       
       13 What is the environment part of the program head? (See below) Result will
       give the text string.
       
       14 What is the module identifier to be used for the current compilation? (Cf.
       section 4.6) This call will only be made for a separate compilation. Result
       will give the text string.
       
       15 What is the check code to be used for the current compilation? (Cf.
       section 4.6) This call will only be made for a separate compilation. Result
       will give the text string. If the empty string is delivered then the
       date_and_time string identifying this compilation will be used.
       
       16 What is the system debugging option string? The default answer here should
       be the empty string.
       
       17 Not used.
       
       18 Not used.
       
       19 What is the file name of the attribute file for the predefined classes and
       procedures (the class PREDEF)?
       
       20 What is the file name for the attribute file for the class SIMSET?
       
       21 What is the file name for the attribute file for the class SIMULATION?
       
       22 What is the file name of a file containing seldom used information for the
       front end compiler, such as extended error messages.
       
       23 What is the file name of a file containing seldom used information for the
       run time system, such as extended error messages.
       
       24 What is the identification string of the current execution? The answer
       should be as defined for procedure "simulaid" in the SIMULA Standard, section
       9.6. If the answer is the empty string, RTS will fill out the first field
       (SIMULA system name) with an identification of the current S-port release,
       and leave the remainding fields empty (i.e. the release info will be
       terminated by 21 exclamation marks).
       
       A short comment is necessary on the program head string.
       According to the definition an S-program should start with the
       keyword program followed by a string. This string is used to identify the compilation.
       The string will be given according to the following syntax:
       "< a >'< b >'< c >"
       The three parts of the string are:
       < a > This is the date and time of compilation given through the result from a call on
       the routine date_and_time.
       < b > This is an identifiaction of the front-end compiler chosen by itself to identify
       the version of the compiler.
       < c > This is an identification of the S-code compiler supplied to the front-end
       compiler when get_textinfo is called with index 13 (see page 15).
      
       
      Parameters:
      index - case index
      Returns:
      requested text info
    • getIntInfo

      public static int getIntInfo(int index)
      S-PORT Extension Procedure getIntInfo.
       The routine get_intinfo is defined to get all information from the environment that
       can be coded as an integer.
       
       The parameter index is an integer specifying what information is requested. The
       result will be an integer whose interpretation gives the specified information. The
       result is given for each value of index as follows:
       Index: Interpretation:
       1 NOT USED
       
       2 Is a source listing wanted?
       Result: 0 - No.
       >0 - Yes. The listing will be a copy of the source text, where each line is prefixed by
       its number.
       
       3 *) Should begin/end counters be included in the source listing?
       Result=0 means no, otherwise yes.
       
       4 What is the maximum number of error messages to be given?
       Result will be the number of messages.
       
       5 Should warning messages be suppressed?
       Result=0 means no, otherwise yes.
       
       6 Should a cross-reference listing be produced?
       Result=0 means no, otherwise yes.
       
       7 *) What is the image length for the listing file?
       Result will be the number of characters in the image.
       
       *) These calls are only made after get_textinfo(2) (asking for name of the listing file)
       is called, and only if listing is wanted.
       
       
       8 What is the line length of the source file?
       Result will be the number of characters in the image. 
       
       9 Should test for none be ommitted at remote access?
       Result=0 means no, otherwise yes.
       
       10 Should checking of indices be ommitted at array access?
       Result: 0 - Complete checking of array indices
       1 - Partial checking of indices
       2 - No checking will be done.
       
       11 What is the level of information wanted from the symbolic dump routine?
       Result: 0 - The symbolic dump module is not to be included
       1 - The symbolic dump routine is included
       2 - Individual instances of an object shall carry a count for identification
       3 - Objects shall carry information of all identifier names.
       
       12 Should inclusion be made for production of a dynamic profile of the program
       execution?
       Result=0 means no inclusion, otherwise assignment counts are to be included
       
       13 Should inclusion be made for full tracing of control flow at run-time?
       Result=0 means no inclusion, otherwise full inclusion.
       
       14 Should inclusion be made for interactive debugging of the program?
       Result=0 means no inclusion, otherwise full inclusion.
       
       15 What is the level of debug information wanted in case of a run time error?
       Result: 0 - no debugging information is wanted
       1 - a diagnostic message and the source program line number where the error
       occurred are wanted
       2 - in addition to the above the static link and the dynamic link at the point of error
       are wanted
       3 - in addition to the above the sequencing sets of all SIMULATION blocks and the
       local sequence controls of all scheduled processes are wanted
       4 - in addition to the above the local sequence controls of all non-terminated objects
       are wanted
       5 - in addition to the above all referable datastructures are wanted.
       
       16 Is tracing of control flow wanted?
       Result: 0 - no tracing is wanted
       >0 - the number of messages wanted is given
       <0 - tracing messages are printed to a buffer of size -(result), and only listed in case
       of a run-time error
       
       17 Is tracing of data flow wanted?
       Result: 0 - no tracing is wanted
       >0 - the number of messages wanted is given
       <0 - tracing messages are printed to a buffer of size -(result), and only listed in case
       of a run-time error
       Comment: If both control and data flow tracing are specified, they will go to the same
       destination.
       
       18 What is the maximum amount of time (cpu-time) to be used for the execution?
       Result will give the time, specified in 1/100 sec.
       
       19 Should the symbolic debugger SIMOB be entered prior to the execution of the
       program, and at program termination? An answer greater than zero will give this
       effect.
       
       20 What is the significant linelength of the source file image?
       
       21 What is the maximum index to setobj, getobj, and access instructions allowed in
       this implementation. A response of 0 will give the limit 255.
       
       22 Mode of separate compilation ?
       0: normal separate compilation
       1: recompilation.
       
       23 Amount of pass information from FEC on listing or message file ?
       0: No information.
       1: Minimum.
       2: Medium.
       3: Maximum.
       
       24 How many work areas may be requested (see chapter 5)?
       
       30 What is the level of data information which must be produced at compile-time, in
       order to observe the execution at run-time?
       Result: 0 - minimal information for error reporting.
       1 - information at the module and block level, but no information about the attributes.
       2 - complete information generated, including information about all attributes.
       SIMOB can always be used for observation, but the available information will
       depend on this response.
       
       31 Should inclusion be made at compile-time for statement execution counts?
       Result: 0 - no, statement execution counts not wanted
       1 - yes, statement execution counts wanted
       
       32 Should inclusion be made at compile-time for processor usage measurements?
       Result: 0 - no, measuring of processor usage not wanted
       1 - yes, measuring of processor usage wanted
       
       33 Is interaction with the user possible in the current execution?
       Result: 0 - no, this is not an interactive execution
       1 - yes, this is an interactive execution
       Note that SIMOB uses this.
       
       34 Should inclusion for the possibility of statement start exceptions be made at
       compile-time by the S-Code Compiler?
       Result: 0 - no, no start of statement exceptions will ever occur
       1 - yes, start of statement exceptions may occur
       
       35 Should inclusion be made at compile-time for storage usage measurements?
       Result: 0 - no, measuring of storage usage not wanted
       1 - yes, measuring of storage usage wanted
       
       36 What is the maximum number of identifiers allowed in this program compilation.
       Result will be the number allowed.
       
       37 What is the maximum number of constants allowed for this compilation. Result
       will define the number.
       
       38 What is the maximum number of textual blocks allowed for this compilation.
       Result will define the number.
       
       39 What is the maximum number of block levels allowed for this compilation. Result
       will define the number.
       
       40 What is the maximum source depth allowed for this compilation. Result will
       define the maximum.
       
       41 What is the maximum dynamic depth in this program compilation. Result will
       define the maximum.
       
       42 What is the maximum number of parameters in a procedure call for this
       compilation. Result will define the maximum.
       
       43-127 As defined in the current Release Description.
       If the environment returns a value of zero for any of these indices, some default value
       will be chosen by the system.
       
       
      Parameters:
      index - case index
      Returns:
      requested integer info
    • giveIntInfo

      public static void giveIntInfo(int index, int info)
      S-PORT Extension Procedure giveIntInfo.
       The routine give intinfo is defined to submit information from the front-end compiler
       or the run-time system to the environment. This information is gathered from the
       source input under compilation.
      
       The parameter index is an integer that specifies what information follows. Info will
       be an integer carrying the following interpretation:
      
       Index: Interpretation:
         1   A call with this index is done immediately before the termination of each pass, and
             the value of info signals the situation after this pass, by the following coding:
                0 - No user errors found. Go on with next pass.
                1 - User errors are found, but go on with next pass.
                2 - Reserved for fututre use, continuation is possible.
                3 - No user errors found, but because of options etc. (e.g. that S-code should not be
                    produced), the next pass should not be started.
                4 - User errors found, therefore do not start next pass.
                5 - Too many or too difficult user errors encountered. Therefore the current pass is
                    terminated, and the next pass should not be started.
                6 - An internal error in the compiler has occurred. Therefore the current pass is
                    terminated, and the next pass should not be started.
                  
         2   Info is the highest tag used in the S-code for this program.
         3   Info is the number of source lines in the Simula program being compiled.
         4   Info is the number of errors for this compilation.
         5   Info is the number of warnings for this compilation.
         6   Garbage collection information. Info=0 signals the start of a garbage collection, ENDOF hash:
             Info=1 signals termination of g.c. (see 5.2).
       
      Parameters:
      index - case index
      info - the integer info
    • giveTextInfo

      public static void giveTextInfo(int index, RTS_TXT info)
      S-PORT Extension Procedure giveTextInfo.
       The routine give_textinfo is defined to submit information from the front-end
       compiler or the run-time system to the environment. This information is gathered
       from the source input under compilation.
       
       The parameter index is an integer that specifies what information follows. Info will
       be the string reference with the specific information as follows:
       
       Index: Interpretation:
         1  The string info is the identifier of a class or procedure being separately compiled.
         2  The string info is the identifier given in an external declaration that is being processed.
         3  The string info is the external identification given in an external declaration that is being processed.
       
       E.g: When compiling:
       
       class SubSep; begin external class MainSeparat="some file"; ... end;
       
       Index: Interpretation:
         1            currentModuleID: SubSep
         2            extIdent: MainSeparate
         3            extFile: "some file"
       
       
      Parameters:
      index - case index
      info - text info
    • rts_utility

      public static void rts_utility(int index, int level)
      S-PORT Extension Procedure rts_utility.

      Register Error or Warning given

      Parameters:
      index - case index
      level - not used
    • NOT_IMPLEMENTED

      private static void NOT_IMPLEMENTED(String s)
      Internal error NOT IMPLEMENTED
      Parameters:
      s - explanation