         A GUIDE TO CONVERTING ESP PROGRAMS TO CESP PROGRAMS

ESP (Extended Self-contained Prolog) is an object-oriented logic
programming language that was developed by ICOT.  ESP can run only on
a PSI that is an ESP machine.  On the other hand, AI Language Research
Institute, Ltd. (AIR) extended ESP, and developed CESP (Common ESP) so
that it can be used on UNIX machines.  This document shows several
general points to be noted when converting ESP programs to CESP
programs.  This document is written with the aid of AIR.


1.  CESP

 CESP is not part of the ICOT Free Software, instead being available 
from MITSUBISHI ELECTRIC COMPUTER SYSTEMS(TOKYO) CORP. (MTC).

 CESP Ver.3.3 assumes the following environment.

    Computer         : SUN4 (SPARC)
    Operating System : Sun OS R4.0.3, R4.1, R4.1.1 or R4.1.2
    Main Memory      : 16MB or more (Swap size is 64MB)
    Disk Storage     : 90MB or more for SUN4 (SPARC)
    Editor           : Interactive debugging environment installed 
                       on GNU Emacs (preferred)
    Window           : Available X11R4 interface / Japanese characters
                       with Xmw (for X11R5) and Wnn (R4.0.2)

For further details, apply to MTC by Fax or Postal mail.

    MITSUBISHI ELECTRIC COMPUTER SYSTEMS CORP.
    2-nd Application Systems Develpment Dept.
    Software Products Promotion Group

    87-1, Kawakamicho, Totsukaku, Yokohama,
    Kanagawa 244, Japan

    TEL:  +81-45-825-5679(Japanese Only)
    FAX:  +81-45-825-5822


2.  Conversion to CESP

Many ESP programs need a PSI machine and SIMPOS (the OS of PSI).  When
you convert such programs to CESP programs, one task is to rewrite the
incompatible segments such as I/O part.  Some fundamental data forms
of CESP are different from those of ESP.  Read the CESP Language
Manual [1] first.  Some general points of conversion are as follows:

(1) Built-in predicates
  (a) Built-in predicates for PSI
      You must rewrite the part of the program (e.g., built-in 
      predicates such as "word", "set_system_register" or "address") 
      that depends on the PSI hardware (e.g., register, 40bits/word).
  (b) Differences in built-in predicates of CESP and ESP
      The predicates of ESP, "heap_vector" and "stack_vector",
      correspond to "impure_vector" and "pure_vector" in CESP.  Read
      [1] to learn the differences in CESP and ESP built-in predicates.
  (c) Standard operators of CESP
      Some special symbols such as "&" and "**" are used as standard 
      operators in CESP but not in ESP.  Before you can declare 
      "add_op" of such operators in CESP, you must declare "remove_op" 
      of them.

(2) Data form
  (a) Data form of string
      Although 1 bit string data and 32 bit string data are available
      in ESP, they are not available in CESP.  Use "impure_vector"
      instead in CESP.
  (b) Range of integer
      While the range of the integer in ESP is from -2^31 to 2^31-1,
      that in CESP is from -2^28 to 2^28-1.
  (c) Character code
      While the character code in ESP is JIS (Japanese Industrial
      Standard; JIS X 0208-1983), that in CESP is EUC.
  (d) Comparison of different data type
      Data types are compared differently in CESP and ESP.

(3) Interface
  (a) Window methods
      The window in CESP is different from that in ESP.  In
      particular, the emacs_window in CESP is different from the
      pmacs_window in ESP.  (You can use the "scrollbar" instead of 
      the pmacs_window.)  The macros for the mouse in ESP (e.g., mouse#r)
      must be changed to the atoms in CESP (e.g., 'mouse#r').  You can
      not use the extra PSI font on UNIX machines.
  (b) File I/O methods
      The file I/O methods in CESP are a little different from those in
      ESP.  For example, the order of arguments in the ":create" method
      is different.
  (c) Method for library and directory etc.
      Some methods for the library and directory etc. in ESP are not
      in CESP.  You need to program the difference.

(4) Others
  (a) Capacities of PSI and UNIX machine
      The UNIX machine and the ESP machine differ as follows:
      the execution speed of CESP on the UNIX machine is slower than 
      ESP on PSI, and the UNIX machine does not have as much memory 
      as PSI.  If a class has many clauses, you should divide the class.
  (b) Exception manipulation
      - set_mode exception_fail/exception_handler
          You can set these in CESPshell.  You can choose for the CESP
          system to manipulate exception as failure, or for the system
          to show a manipulation menu when an exception occurs.
      - set_exception_object/2
          You can designate any class to be called when an exception
          occurs.  The method in CESP is different from that in ESP.
  (c) Inheritance of "as_program"
      Any class cannot inherit "as_program".  It does not exist in
      CESP.


Reference

[1] CESP Language Guide Version 3, AI Language Research Institute, Ltd.
    (1992).
