home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / historic / v941.tgz / icon.v941src.tar / icon.v941src / src / runtime / ovalue.r < prev    next >
Text File  |  2000-07-29  |  1KB  |  73 lines

  1. /*
  2.  * File: ovalue.r
  3.  *  Contents: nonnull, null, value, conj
  4.  */
  5.  
  6. "\\x - test x for nonnull value."
  7.  
  8. operator{0,1} \ nonnull(underef x -> dx)
  9.    abstract {
  10.       return type(x)
  11.       }
  12.    /*
  13.     * If the dereferenced value dx is not null, the pre-dereferenced
  14.     *  x is returned, otherwise, the function fails.
  15.     */
  16.    if is:null(dx) then
  17.       inline {
  18.          fail;
  19.          }
  20.    else {
  21.       inline {
  22.          return x;
  23.          }
  24.       }
  25. end
  26.  
  27.  
  28.  
  29. "/x - test x for null value."
  30.  
  31. operator{0,1} / null(underef x -> dx)
  32.    abstract {
  33.       return type(x)
  34.       }
  35.    /*
  36.     * If the dereferenced value dx is null, the pre-derefereneced value
  37.     *  x is returned, otherwise, the function fails.
  38.     */
  39.    if is:null(dx) then {
  40.       inline {
  41.          return x;
  42.          }
  43.       }
  44.    else
  45.       inline {
  46.          fail;
  47.       }
  48. end
  49.  
  50.  
  51. ".x - produce value of x."
  52.  
  53. operator{1} . value(x)
  54.   abstract {
  55.      return type(x)
  56.      }
  57.   inline {
  58.      return x;
  59.      }
  60. end
  61.  
  62.  
  63. "x & y - produce value of y."
  64.  
  65. operator{1} & conj(underef x, underef y)
  66.    abstract {
  67.       return type(y)
  68.       }
  69.    inline {
  70.       return y;
  71.       }
  72. end
  73.