home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / plbin.zip / pl / PORTING < prev    next >
Text File  |  1993-02-08  |  3KB  |  90 lines

  1.             Installation Problems
  2.  
  3.  
  4. Below  are some  notes meant for  those who decide  to modify  or port
  5. SWI-Prolog.  It is by no means complete.
  6.  
  7. DEBUGGING SWI-Prolog ON A NEW MACHINE
  8. =====================================
  9.  
  10. 1. Machine Description file.
  11.  
  12. Create a md- file for the new architecture.  You can use a similar one
  13. as starting point and look at md-gener.h for a full description of the
  14. options.  For the first port,  I advice to  set the following flags to
  15. 0:
  16.  
  17.     - O_FOREIGN
  18.     - O_SAVE
  19.     - O_STORE_PROGRAM
  20.     - O_PCE
  21.     - O_SHARED_MEMORY
  22.     - O_CAN_MAP
  23.  
  24. During debugging, make   sure to give  -g   and  -DO_DEBUG  to  the  C
  25. compiler, so you can debug  the resulting prolog system  using  the -d
  26. level option.  -DO_DEBUG  also includes some consistency checks.   For
  27. final installation use  -O and drop  -DO_DEBUG (which makes the system
  28. about 20% slower).
  29.  
  30. Various options define the memory layout of your machine.  The program
  31. m-model.c may be used to determine the  right  settings.  Compile this
  32. file with any C-compiler and run it.
  33.  
  34. MEMORY ERRORS (BUS ERROR; SEGMENTATION FAULT)
  35. =============================================
  36.  
  37. It is very likely that the system crashes during  the boot compilation
  38. called from  make (./pl   -O  -o  ...  -b ...  -c  ...).  Below  is  a
  39. description of various such problems:
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47. WORKING ON A SMALL PROGRAM
  48. ==========================
  49.  
  50. If  you are   very lucky  the   system will  compile and perform   the
  51. bootstrap compilation in one go.  Normally you are not.  On how to get
  52. it through the C compiler, you  are on your  own.  If  the system does
  53. not want to do the bootstrap compilation, write a small prolog program
  54. that  can   be handled by the   bootstrap  compiler and work  on that.
  55. Normally, I use
  56.  
  57. :- write('Hello World!').
  58. :- nl.
  59.  
  60. You can  compile this using `pl -d   level -b file'.  If  this finally
  61. writes `Hello  World' on  your terminal you  are  getting close.  Next
  62. test program can be:
  63.  
  64. test :-
  65.     write('Hello World'),
  66.     nl.
  67.  
  68. $init :-
  69.     test,
  70.     halt.
  71.  
  72. If you can compile this and you  can run the  result by typing `a.out'
  73. or `pl   -x  a.out -d level' you   can  try to  do   the   entire boot
  74. compilation.  If you decide to write  more elaborate test programs you
  75. should realise  many things are not yet   defined.  Initially  you can
  76. only call  the foreign language   predicates, defined   in   pl-ext.c.
  77. Constructs handles by the compiler  (,/2, !, ->/2,  ;/2, etc.)  cannot
  78. be called   via metacall or   directives (but can be used   in program
  79. text).
  80.  
  81.  
  82. CODE USED ATOMS OR FUNCTORS
  83. ===========================
  84.  
  85. Atoms needed by the C  sources are addressed using  macros of the form
  86. ATOM_<name>.  Functors have  the form FUNCTOR_<name><arity>.   See the
  87. file ATOMS.  The awk script defatoms is invoked by make  to create the
  88. necessary C source and header files.  These files are named *.i[ch].
  89.  
  90.