  IMPORTANT  Changes in RIGAL 2.18
  ============  RIG218.DOK ===========
 CHANGES
 ADDITIONALS
 ERRORS CORRECTED
1. on ERRORS
  a. COPY for lists bow works correctly.
  b. LAST to inactive rule still can work incorrectly
     (error is not corrected)
2. SCANNER
  a. For symbolic strings which have not ending delimiter
     #_KEYWORD atom is produced
  b. Lexical Error coordinates now will appear correctly on screen
3. FATAL ERRORS
  a. Possible fatal errors are
     - Disk overflow during SAVE
     - Structured memory overflow (8 M, more is impossible)
     - Current disk overflow (DOS mode only)
  b. In Windows mode a MESSAGEBOX about fatal error appear
4. TURBO PASCAL FOR WINDOWS AS A SECOND PHASE
  a. Now we try to guarantee safety of call to MYTPW.EXE
     - .CFG files are generated in 1st phase every time
     - They are generated with correct disk and directory name
     - MYTPW can't save its Desktop or Configuration file
     - Filename.PAR is used as intermediate file instead of
       Filename.PAS  for compilation of Filename.RIG in 2 phases.
5. STACK problems
   Stack limitations are set by $M directive :
   in Interpreter/Windows   38 K (it is maximum)
      Interpreter/DOS       60 K (it is maximum)
   in Compilation/Windows   22 K 
      (it is maximum for GENPD.EXE, 
       you can change it to 30-35 K for other tasks,
       use RIGWSRC.CFG or Options/Compiler/Memory in TPW environment)
      Compilation/DOS       32 K
      (see XCR0.BAT)

   Stack can not be more than 64-datasize-statics
   (datasize is summ of all string constants + something;
    it is reported at the end of Turbo Pascal command line compilation)
   (static is 5-10 Kb)
   When Stack overflows, Pascal runtime error 202 is reported

6. INTERPETER STACK
   Stack of INTERPETER variables is set to 1000 variables
   When it overflows, Rigal runtime error 1 is reported

7. HOME DIRECTORY
   For EXE files - directory where EXE is located.
   For interpreter - directory where File.RSC is located.
   Directory is given with ending slash (\).
   Call #CALL_PAS(105) to get it
8. APPEND
   Use
     OPEN XXX 'A.LST+' 
   to append if file exists;
   to rewrite if file does not exist.
9. ACCESS TO DLL LIBRARIES
   Use 
   #CALL_PAS(76) --to initialize buffers
   $HANDLE:=#CALL_PAS(101 'Lib.DLL') --to access library
   $PARAMETERS_or_ERRORCODE:=
      #CALL_PAS(102 $HANDLE $FUNCTION_NAME $PARAMETERS)
   -- to call function
   #CALL_PAS(103 $HANDLE) -- to free library

   IMPORTANT:
   101======
   a. Library file name must be with full path.
      Otherwise Windows looks for DLL in PATH directories,
      then in disk "A:"
      You must use #CALL_PAS(105) or any PATH directory for compatibility
      $HANDLE>=32 is retured if OK
   102====== 
   a. Function name must be exported by library.
      See GRAD.PAS to see correct parameter passing from/to DLL.
      Input and output $PARAMTERS are list of atoms (strings or numeric).
      For large strings (more than 80 bytes) special format
      (list of atoms) can be used.
    b. If error occur, not list, but number in 1000 .. 1020 is
       returned.

10. LIBRARY GRAD.DLL
    The following functions are allowed now to use with GRAD.DLL


    Function         Parameters                    Returns
    -----------------------------------------------------------
    -- Monitor box functions (recommended for long execution)
    SB_CREATE        (. 'title' .)                    -
    SB_NUM           (. $num    .)                    -
    SB_END            -                               -

    -- Message Boxes with user's answer and without it
    R_MESSA          (. 'Message' .)                  -
    R_MESSA          (. 'Message' 'Title' .)          -
    R_MESSA         (. 'Message' 'Title' $nstyle .)   (. $nAnswer .)
    -- here $nAnswer depends of $nstyle ans User's answer ----

     -- call DOS or Windows application
    R_WINEXEC        (. 'c:\nc\nc.exe' .)             (. $n .)
    -- here $n is >=32 if successful

    -- List box
    LB_INIT             -
    LB_ADD            (. $num_or_string .)            (. $nFilled .)
    LB_ADD            (. $n_or_s $n_or_s .)           (. $nFilled .) 
    -- $nFilled  - how many lines are filled already
    -- Two paramters appear on screen separated by TAB in its line
    LB_GO              -                               (. $nChosen .)
    -- Chosen line (starting from 1)
    LB_END

============  DLL.RIG ======================

#S
-- Test of work with DLL

 $E:=#CALL_PAS(76);  -- Initialize all DLL access
 $FN:=#IMPLODE( #CALL_PAS(105) 'grad.DLL' );
 PRINT (. 'library is =' $FN .); 
 $HA:=#CALL_PAS(101 $FN);  -- Access to concrete DLL
 PRINT (. 'Library handle=' $HA .);
 IF $HA<32 -> PRINT (. No handle .) FI;

 -- Message Box function 
 $VS:=#CALL_PAS(102 $HA 'ch' (. (.af ri ka.) 3 7 .) );

-- Every function returns list of parameters or such answer as
--  a number:
-- 1000   #CALL_PAS(76) was not called
-- 1001   1st paramter is not number
-- 1002   2nd paramter is not atom
-- 1003   3 handle is less than 32, Library was not opened for access
-- 1004   no memory 80 bytes
-- 1005   parameters are not formed in list,
--       possible atom instead of list
-- 1006   function not found in library
--        (function must be declared as FAR and EXPORT)
-- 1008   descriptor too small  (see P_max_size in RIF.PAS )
-- 1009   too many parameters   (see P_max_cnt  in RIF.PAS )
-- 1010   wrong atoms in list of atoms which must represent
--        super long string (only  non numeric atoms allowed)
-- 1011   wromg element (tree) in parameters

 -- Create Monitor box
$VS:=#CALL_PAS(102 $HA 'SB_CREATE' (. 'Compiling CD Lagerverwaltung' .) );
PRINT (. 'VS=' $VS .);

LOOP
 $I+:=1;
 IF $I MOD 100=0 ->
    -- Modify monitor box with new number
    $VS:=#CALL_PAS(102 $HA 'SB_NUM' (. $I .) );
 FI;
 IF $I=1000 -> BREAK FI;
END; 
   -- remove monitor box 
$VS:=#CALL_PAS(102 $HA 'SB_END' );

-- Call any Windows or DOS executable file 
 IF #CALL_PAS(102 $HA 'R_MESSA' (.'Do you want NORTON ?' 'QQQ' 36.))=(.6.) -> 
    #CALL_PAS(102   $HA 'R_MESSA' (. 'norton'  .));
   $S:= #CALL_PAS(102 $HA R_WINEXEC (. 'C:\nc\nc' .) );
   PRINT (. 'S===' $S .);
 FI;
--
 PRINT (. 'MB='
   #CALL_PAS(102 $HA 'R_MESSA' 
               (. 
                (. This ' ' is #CHR(13) big #CHR(13) Message ' ' box .) 
                (. am er ika .)
               .) )
   .);
 
-- Remove library from memory
 $FR:=#CALL_PAS(103 $HA);
 #CALL_PAS(1);
##

=================== LBX.RIG ========================
#LBX
  #CALL_PAS(76);
  $H:=#CALL_PAS(101 'G:\grad.dll');
PRINT $H; 

  $V:=#CALL_PAS(102 $H 'INPUT' (. afrika amerika .) );
  PRINT $V; 
 $M:=#CALL_PAS(102 $H 'LB_INIT');
PRINT $M;
  $M:=#CALL_PAS(102 $H 'LB_ADD' (. 5 YYY .) );
PRINT $M;
  $M:=#CALL_PAS(102 $H 'LB_ADD' (. MTTT 789 .) );
PRINT $M;
  $M:=#CALL_PAS(102 $H 'LB_ADD' (. 
 M012345678901234567890123456789012345678901234567890
 K012345678901234567890123456789012345678901234567890
     .) );

PRINT $M;
  $M:=#CALL_PAS(102 $H 'LB_GO' (. KOL .)  );
 PRINT $M;
  #CALL_PAS(1);
##

 
