PACKET convert DEFINES real to int, 
                       int to real,
                       text to int, 
                       int to text, 
                       int to text 2, 
                       real to text, 
                       real to text 2, 
                       code int, 
                       code text : 
 
 
(***************************************************************************)
(*                                                                         *)
(*  Autor: A. Steinmann                        Copyright (C): HRZ - Unibi  *)
(*                                                                         *)
(***************************************************************************)


INT VAR index, 
        first int,
        i ;


REAL VAR begin,
         end,
         act result,
         first real ;


TEXT VAR single text :: "*",
         free text ; 




PROC real to int (INT CONST frequency) :

  first real := 1.0 ;
  begin := clock (0) ;
  FOR index FROM 1 UPTO frequency
      REP
          i := int (first real) 
      END REP ;
  end := clock (0) ;

  act result := end - begin ;

  real to int s (frequency)

END PROC real to int ;



 
PROC real to int s (INT CONST frequency) :

  first real := 1.0 ;
  begin := clock (0) ;
  FOR index FROM 1 UPTO frequency
      REP
          i := int (first real) 
      END REP ;
  end := clock (0) ;

  IF act result > end - begin
     THEN act result := end - begin
  FI ;

  notice result ("int (REAL)", act result * msec factor (frequency) - for corr)

END PROC real to int s ;




PROC int to real (INT CONST frequency) :

  first int := 1 ;
  begin := clock (0) ;
  FOR index FROM 1 UPTO frequency 
      REP
          first real := real (first int)
      END REP ;
  end := clock (0) ;

  act result := end - begin ;

  int to real s (frequency)

END PROC int to real ;



 
PROC int to real s (INT CONST frequency) :

  first int := 1 ;
  begin := clock (0) ;
  FOR index FROM 1 UPTO frequency 
      REP
          first real := real (first int)
      END REP ;
  end := clock (0) ;

  IF act result > end - begin
     THEN act result := end - begin
  FI ;

  notice result ("real (INT)", act result * msec factor (frequency) - for corr)

END PROC int to real s ;




PROC text to int (INT CONST frequency) :

  free text := "1111" ;
  begin := clock (0) ;
  FOR index FROM 1 UPTO frequency 
      REP 
          first int := int (free text) 
      END REP ;
  end := clock (0) ;

  act result := end - begin ;

  text to int s (frequency)

END PROC text to int ;



 
PROC text to int s (INT CONST frequency) :

  free text := "1111" ;
  begin := clock (0) ;
  FOR index FROM 1 UPTO frequency 
      REP 
          first int := int (free text) 
      END REP ;
  end := clock (0) ;

  IF act result > end - begin
     THEN act result := end - begin
  FI ;

  notice result ("int (TEXT)", act result * msec factor (frequency) - for corr)

END PROC text to int s ;




PROC int to text (INT CONST frequency) :

  first int := 1 ;
  begin := clock (0) ;
  FOR index FROM 1 UPTO frequency
      REP 
          free text := text (first int) ;
      END REP ;
  end := clock (0) ;

  act result := end - begin ;

  int to text s (frequency)

END PROC int to text ;



 
PROC int to text s (INT CONST frequency) :

  first int := 1 ;
  begin := clock (0) ;
  FOR index FROM 1 UPTO frequency
      REP 
          free text := text (first int) ;
      END REP ;
  end := clock (0) ;

  IF act result > end - begin
     THEN act result := end - begin
  FI ;

  notice result ("text (INT)", act result * msec factor (frequency) - for corr)

END PROC int to text s ;




PROC int to text 2 (INT CONST frequency) :

   first int := 1 ;
   i := 3 ;
   begin := clock (0) ;
   FOR index FROM 1 UPTO frequency
       REP
           free text := text (first int, i)
       END REP ;
   end := clock (0) ;

  act result := end - begin ;

  int to text 2 s (frequency)

END PROC int to text 2 ;



 
PROC int to text 2 s (INT CONST frequency) :

   first int := 1 ;
   i := 3 ;
   begin := clock (0) ;
   FOR index FROM 1 UPTO frequency
       REP
           free text := text (first int, i)
       END REP ;
   end := clock (0) ;

  IF act result > end - begin
     THEN act result := end - begin
  FI ;

  notice result ("text (INT, INT)", act result * msec factor (frequency) - for corr)

END PROC int to text 2 s ;




PROC real to text (INT CONST frequency) :

  first real := 1.0 ;
  begin := clock (0) ;
  FOR index FROM 1 UPTO frequency
      REP
          free text := text (first real) 
      END REP ;
  end := clock (0) ;

  act result := end - begin ;

  real to text s (frequency)

END PROC real to text ;



 
PROC real to text s (INT CONST frequency) :

  first real := 1.0 ;
  begin := clock (0) ;
  FOR index FROM 1 UPTO frequency
      REP
          free text := text (first real) 
      END REP ;
  end := clock (0) ;

  IF act result > end - begin
     THEN act result := end - begin
  FI ;

  notice result ("text (REAL)", act result * msec factor (frequency) - for corr)

END PROC real to text s ;




PROC real to text 2 (INT CONST frequency) :

  first real := 1.0 ;
  i := 1 ;
  begin := clock (0) ;
  FOR index FROM 1 UPTO frequency
      REP
          free text := text (first real, i, i)
      END REP ;
  end := clock (0) ;

  act result := end - begin ;

  real to text 2 s (frequency)

END PROC real to text 2 ;



 
PROC real to text 2 s (INT CONST frequency) :

  first real := 1.0 ;
  i := 1 ;
  begin := clock (0) ;
  FOR index FROM 1 UPTO frequency
      REP
          free text := text (first real, i, i)
      END REP ;
  end := clock (0) ;

  IF act result > end - begin
     THEN act result := end - begin
  FI ;

  notice result ("text (REAL, INT, INT)", act result * msec factor (frequency) - for corr)

END PROC real to text 2 s ;




PROC code int (INT CONST frequency) : 

  i := 65 ;
  begin := clock (0) ;
  FOR index FROM 1 UPTO frequency
      REP
          free text := code (i) 
      END REP ;
  end := clock (0) ;

  act result := end - begin ;

  code int s (frequency)

END PROC code int ;



 
PROC code int s (INT CONST frequency) : 

  i := 65 ;
  begin := clock (0) ;
  FOR index FROM 1 UPTO frequency
      REP
          free text := code (i) 
      END REP ;
  end := clock (0) ;

  IF act result > end - begin
     THEN act result := end - begin
  FI ;

  notice result ("code (INT)", act result * msec factor (frequency) - for corr)

END PROC code int s ;




PROC code text (INT CONST frequency) :

  begin := clock (0) ;
  FOR index FROM 1 UPTO frequency
      REP
          first int := code (single text)
      END REP ;
  end := clock (0) ;

  act result := end - begin ;

  code text s (frequency)

END PROC code text ;




PROC code text s (INT CONST frequency) :

  begin := clock (0) ; 
  FOR index FROM 1 UPTO frequency
      REP
          first int := code (single text)
      END REP ;
  end := clock (0) ;

  IF act result > end - begin
     THEN act result := end - begin
  FI ;

  notice result ("code (TEXT)", act result * msec factor (frequency) - for corr)

END PROC code text s ;


END PACKET convert ;