////////////////////////////////////////////////////////////////////////////////
//                                Lisaac                                      //
//                                                                            //
//                  LSIIT - ULP - CNRS - INRIA - FRANCE                       //
//                                                                            //
//    This program is free software; you can redistribute it and/or modify    //
//    it under the terms of the CeCILL v2 License as published by the         //
//    CEA - CNRS - INRIA.                                                     //
//                                                                            //
//    This program is distributed in the hope that it will be useful,         //
//    but WITHOUT ANY WARRANTY; without even the implied warranty of          //
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the            //
//    CeCILL v2 License for more details.                                     //
//                                                                            //
//    You should have received a copy of the CeCILL v2 license along with     //
//    this program.                                                           //
//    If not, see <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>  //
//                                                                            //
//                    http://isaacproject.u-strasbg.fr/                       //
////////////////////////////////////////////////////////////////////////////////

  //
  // LIsaac Path (.LIP)
  //
  // Note:
  // =====
  // 
  // lisaac <input_file> { -<slot> { <param> } }
  //
  // * <slot>  : Public slot access only.
  // * <param> : TRUE/FALSE, INTEGER, STRING only.
  //
  
Section PATH
  
  //
  // System variable.
  //
  
  - lisaac:STRING      := `0`; // Lisaac path directory.
  
  - input_file:STRING  := `1`; // Input file name.
  
  - output_file:STRING := `2`; // Ouput file name.  
  
  - statistic_level:INTEGER;
  
  - debug_level:INTEGER;
  
  - debug_source:BOOLEAN;
  
  - warning_level:INTEGER;
  
  - optimzation_level:INTEGER;
  
  - path:STRING; // Directory path for search prototype.
  
  - execute cmd:STRING <- `3`; // Execute command shell.
  
  // Independent variable.
    
  - option_c:STRING;
    
  - finalize:BOOLEAN;
  
  // Updated by INSTALL_LISAAC :

  - default_system <- unix; 
  
  - path_lib_x11:STRING := "/usr/lib";
  
Section Public  
  
  //
  // Command base.
  //
  
  - o new_output_file:STRING <-
  (
    output_file := new_output_file;
  );
  
  - i <-
  (
    statistic_level := 1;
  );
  
  - c option:STRING <-
  (
    option_c := option;
  );
  
  // Warning option.
  
  - w_stop <-
  (
    warning_level := warning_level + 01b;
  );
  
  - w_all <-
  (
    warning_level := warning_level + 10b;
  );
  
  // Optimization option.
  
  - o_all <-
  (
    optimzation_level := 1;
  );
  
  // Debug option.
  
  - dl level:INTEGER <-
  (
    debug_level  := level;
    debug_source := TRUE;
  );
  
  - d_min <-
  (
    dl 5;
  );
  
  - d <-
  (
    dl 10;
  );
  
  - d_max <-
  (
    dl 15;
  );
  
  - no_src <-
  (
    debug_source := FALSE;
  );
  
Section PATH
  
  - lib_std <-
  (
    path := path +
    lisaac + "lib/base/\n" +
    lisaac + "lib/base/low_level/\n" +
    lisaac + "lib/collection/\n" +
    lisaac + "lib/collection/low_level/\n" +
    lisaac + "lib/file_system/\n" +
    lisaac + "lib/format/\n" +
    lisaac + "lib/format/ai/\n" +
    lisaac + "lib/format/bmp/\n" +
    lisaac + "lib/graphics/\n" +
    lisaac + "lib/graphics/low_level/\n" +
    lisaac + "lib/gui/\n" +
    lisaac + "lib/gui/clipping/\n" +
    lisaac + "lib/gui/event/\n" +
    lisaac + "lib/gui/input/\n" +
    lisaac + "lib/gui/low_level/\n" +
    lisaac + "lib/io/\n" +  
    lisaac + "lib/kernel/\n" +
    lisaac + "lib/memory/\n" +
    lisaac + "lib/number/\n" +    
    lisaac + "lib/string/\n" +
    lisaac + "lib/system/\n" +
    lisaac + "lib/time/\n";
  );
  
  - lib_unix <-
  (
    path := path +
    lisaac + "lib_os/unix/system/\n" +
    lisaac + "lib_os/unix/file_system/\n" +
    lisaac + "lib_os/unix/video/\n";
  );
  
  - lib_dos <-
  (
    path := path +
    lisaac + "lib_os/unix/system/\n" +
    lisaac + "lib_os/dos/file_system/\n" +
    lisaac + "lib_os/dos/video/\n";
  );

  - lib_windows <-
  (
    path := path +
    lisaac + "lib_os/unix/system/\n" +
    lisaac + "lib_os/windows/file_system/\n" +
    lisaac + "lib_os/unix/file_system/\n" +
    lisaac + "lib_os/windows/video/\n";
  );
  
Section Public
  
  - unix <-
  ( + exec:STRING;
    
    lib_std;
    lib_unix;
    
    exec := "gcc " + input_file + " -o " + output_file + 
    " -L" + path_lib_x11 + " -lX11 -lm " + option_gcc;
    
    (debug_level = 0).if {
      execute (exec + " -O2 ");
    } else {
      execute exec;
    };
    finalize := TRUE;
  );
  
  - windows <-
  ( + exec:STRING;
    
    lib_std;
    lib_windows;
    
    exec := "gcc " + input_file + " -o " + output_file + 
    ".exe -lgdi32 " + option_gcc;
    
    (debug_level = 0).if {
      execute (exec + " -O2 ");
    } else {
      execute exec;
    };
    finalize := TRUE;
  );
  
  - dos <-
  ( + exec:STRING;
    
    lib_std;
    lib_dos;
    
    exec := "gcc " + input_file + " -o " + output_file + 
    ".exe " + option_gcc;
    
    (debug_level = 0).if {
      execute (exec + " -O2 ");
    } else {
      execute exec;
    };
    finalize := TRUE;
  );
  
  - default <-
  // Is always execute.
  (
    (finalize = FALSE).if {
      default_system;
    };
  );
  
