Parcourir la source

Merge branch 'dev' into basic-cli

Leo il y a 10 ans
Parent
commit
5f0975d7f0
21 fichiers modifiés avec 7573 ajouts et 23 suppressions
  1. 0 4
      .gitignore
  2. 12 0
      AUTHORS.txt
  3. 42 0
      INSTALL.txt
  4. 0 0
      LICENCE
  5. 0 0
      LICENSE
  6. 41 0
      Makefile
  7. 28 5
      Readme.md
  8. 0 0
      TODO.md
  9. 0 0
      VERSION
  10. 6 3
      _oasis
  11. 27 0
      configure
  12. 618 0
      myocamlbuild.ml
  13. 6791 0
      setup.ml
  14. 5 0
      src/.merlin
  15. 0 0
      src/const.ml
  16. 0 0
      src/default.ml
  17. 0 0
      src/exec_cmd.ml
  18. 1 9
      src/file_com.ml
  19. 0 0
      src/oclaunch.ml
  20. 0 0
      src/settings.atd
  21. 2 2
      src/tmp_file.ml

+ 0 - 4
.gitignore

@@ -9,10 +9,6 @@ _tags
 *.native
 *.native
 *.byte
 *.byte
 *.docdir
 *.docdir
-setup.ml
-Makefile
-configure
-myocamlbuild.ml
 setup.data
 setup.data
 setup.log
 setup.log
 # Misc
 # Misc

+ 12 - 0
AUTHORS.txt

@@ -0,0 +1,12 @@
+(* OASIS_START *)
+(* DO NOT EDIT (digest: 8b50d3b615117789414f2ad56e4f9d35) *)
+
+Authors of OcLaunch:
+
+* Joly Clément <leowzukw@vmail.me>
+
+Current maintainers of OcLaunch:
+
+* Joly Clément <leowzukw@vmail.me>
+
+(* OASIS_STOP *)

+ 42 - 0
INSTALL.txt

@@ -0,0 +1,42 @@
+(* OASIS_START *)
+(* DO NOT EDIT (digest: e7b8287f66afa5461baa99be98a80d6d) *)
+
+This is the INSTALL file for the OcLaunch distribution.
+
+This package uses OASIS to generate its build system. See section OASIS for
+full information.
+
+Dependencies
+============
+
+In order to compile this package, you will need:
+
+* ocaml
+* findlib
+* core
+* yojson
+* atdgen
+* core_extended
+
+Installing
+==========
+
+1. Uncompress the source archive and go to the root of the package
+2. Run 'ocaml setup.ml -configure'
+3. Run 'ocaml setup.ml -build'
+4. Run 'ocaml setup.ml -install'
+
+Uninstalling
+============
+
+1. Go to the root of the package
+2. Run 'ocaml setup.ml -uninstall'
+
+OASIS
+=====
+
+OASIS is a program that generates a setup.ml file using a simple '_oasis'
+configuration file. The generated setup only depends on the standard OCaml
+installation: no additional library is required.
+
+(* OASIS_STOP *)

+ 0 - 0
LICENCE


+ 0 - 0
LICENSE


+ 41 - 0
Makefile

@@ -0,0 +1,41 @@
+# OASIS_START
+# DO NOT EDIT (digest: a3c674b4239234cbbe53afe090018954)
+
+SETUP = ocaml setup.ml
+
+build: setup.data
+	$(SETUP) -build $(BUILDFLAGS)
+
+doc: setup.data build
+	$(SETUP) -doc $(DOCFLAGS)
+
+test: setup.data build
+	$(SETUP) -test $(TESTFLAGS)
+
+all:
+	$(SETUP) -all $(ALLFLAGS)
+
+install: setup.data
+	$(SETUP) -install $(INSTALLFLAGS)
+
+uninstall: setup.data
+	$(SETUP) -uninstall $(UNINSTALLFLAGS)
+
+reinstall: setup.data
+	$(SETUP) -reinstall $(REINSTALLFLAGS)
+
+clean:
+	$(SETUP) -clean $(CLEANFLAGS)
+
+distclean:
+	$(SETUP) -distclean $(DISTCLEANFLAGS)
+
+setup.data:
+	$(SETUP) -configure $(CONFIGUREFLAGS)
+
+configure:
+	$(SETUP) -configure $(CONFIGUREFLAGS)
+
+.PHONY: build doc test all install uninstall reinstall clean distclean configure
+
+# OASIS_STOP

+ 28 - 5
Readme.md

@@ -1,11 +1,34 @@
-# OcLaunch
-
-## Licence
+# Licence
 
 
 This software is governed by the CeCILL license under French law and
 This software is governed by the CeCILL license under French law and
-abiding by the rules of distribution of free software.  You can  use, 
+abiding by the rules of distribution of free software.  You can  use,
 modify and/ or redistribute the software under the terms of the CeCILL
 modify and/ or redistribute the software under the terms of the CeCILL
 license as circulated by CEA, CNRS and INRIA at the following URL
 license as circulated by CEA, CNRS and INRIA at the following URL
 "http://www.cecill.info".
 "http://www.cecill.info".
 
 
-OcLaunch is a command-line tool.
+# Descrition
+
+**OcLaunch** is a command-line tool to launch successively (each
+time the program is called) commands.    
+It is designed to be used with any program, interactive or
+not.
+
+
+# Installation
+
+See the file [INSTALL.txt](INSTALL.txt) for building and installation
+instructions.
+
+You can launch OcLaunch from both ./oclaunch.byte and
+./oclaunch.native
+
+## Usage
+
+Place each command to launch in the `progs` entry of your rc
+file, which is created in your $HOME at the first launch of
+the program.
+
+### Ideas of program to use with
+
+ + [Taskwarrior](http://taskwarrior.org/ “Taskwarrior”)
+ + [Irssi](http://irssi.org/ “Irssi”)

+ 0 - 0
TODO.md


+ 0 - 0
VERSION


+ 6 - 3
_oasis

@@ -9,8 +9,11 @@ LicenseFile: LICENSE
 Copyrights: (C) 2014 Joly Clément
 Copyrights: (C) 2014 Joly Clément
 Homepage: https://gitlab.com/WzukW/oclaunch"
 Homepage: https://gitlab.com/WzukW/oclaunch"
 BuildTools: ocamlbuild, camlp4o
 BuildTools: ocamlbuild, camlp4o
-Plugins: META (0.4), DevFiles (0.4)
-Description: This program is designed to launch automatically commands when executed.
+Plugins: StdFiles (0.4), DevFiles (0.4)
+XStdFilesREADME: false
+XStdFilesINSTALL: true
+XStdFilesAUTHORS: true
+Description: OcLaunch is a command-line tool to launch successively (each time the program is called) commands. It is designed to be used with any program, interactive or not.
 
 
 PreBuildCommand: atdgen -t ./src/settings.atd
 PreBuildCommand: atdgen -t ./src/settings.atd
 PreBuildCommand: atdgen -j ./src/settings.atd
 PreBuildCommand: atdgen -j ./src/settings.atd
@@ -18,6 +21,6 @@ PreBuildCommand: atdgen -v ./src/settings.atd
 
 
 Executable oclaunch
 Executable oclaunch
   Path:       src
   Path:       src
-  BuildTools: ocamlbuild
   MainIs:     oclaunch.ml
   MainIs:     oclaunch.ml
   BuildDepends: core, yojson, atdgen, threads, core_extended
   BuildDepends: core, yojson, atdgen, threads, core_extended
+  CompiledObject: best

+ 27 - 0
configure

@@ -0,0 +1,27 @@
+#!/bin/sh
+
+# OASIS_START
+# DO NOT EDIT (digest: dc86c2ad450f91ca10c931b6045d0499)
+set -e
+
+FST=true
+for i in "$@"; do
+  if $FST; then
+    set --
+    FST=false
+  fi
+
+  case $i in
+    --*=*)
+      ARG=${i%%=*}
+      VAL=${i##*=}
+      set -- "$@" "$ARG" "$VAL"
+      ;;
+    *)
+      set -- "$@" "$i"
+      ;;
+  esac
+done
+
+ocaml setup.ml -configure "$@"
+# OASIS_STOP

+ 618 - 0
myocamlbuild.ml

@@ -0,0 +1,618 @@
+(* OASIS_START *)
+(* DO NOT EDIT (digest: 2b686a81cec9fb16d1640bda36a68fbd) *)
+module OASISGettext = struct
+(* # 22 "src/oasis/OASISGettext.ml" *)
+
+
+  let ns_ str =
+    str
+
+
+  let s_ str =
+    str
+
+
+  let f_ (str: ('a, 'b, 'c, 'd) format4) =
+    str
+
+
+  let fn_ fmt1 fmt2 n =
+    if n = 1 then
+      fmt1^^""
+    else
+      fmt2^^""
+
+
+  let init =
+    []
+
+
+end
+
+module OASISExpr = struct
+(* # 22 "src/oasis/OASISExpr.ml" *)
+
+
+
+
+
+  open OASISGettext
+
+
+  type test = string
+
+
+  type flag = string
+
+
+  type t =
+    | EBool of bool
+    | ENot of t
+    | EAnd of t * t
+    | EOr of t * t
+    | EFlag of flag
+    | ETest of test * string
+
+
+
+  type 'a choices = (t * 'a) list
+
+
+  let eval var_get t =
+    let rec eval' =
+      function
+        | EBool b ->
+            b
+
+        | ENot e ->
+            not (eval' e)
+
+        | EAnd (e1, e2) ->
+            (eval' e1) && (eval' e2)
+
+        | EOr (e1, e2) ->
+            (eval' e1) || (eval' e2)
+
+        | EFlag nm ->
+            let v =
+              var_get nm
+            in
+              assert(v = "true" || v = "false");
+              (v = "true")
+
+        | ETest (nm, vl) ->
+            let v =
+              var_get nm
+            in
+              (v = vl)
+    in
+      eval' t
+
+
+  let choose ?printer ?name var_get lst =
+    let rec choose_aux =
+      function
+        | (cond, vl) :: tl ->
+            if eval var_get cond then
+              vl
+            else
+              choose_aux tl
+        | [] ->
+            let str_lst =
+              if lst = [] then
+                s_ "<empty>"
+              else
+                String.concat
+                  (s_ ", ")
+                  (List.map
+                     (fun (cond, vl) ->
+                        match printer with
+                          | Some p -> p vl
+                          | None -> s_ "<no printer>")
+                     lst)
+            in
+              match name with
+                | Some nm ->
+                    failwith
+                      (Printf.sprintf
+                         (f_ "No result for the choice list '%s': %s")
+                         nm str_lst)
+                | None ->
+                    failwith
+                      (Printf.sprintf
+                         (f_ "No result for a choice list: %s")
+                         str_lst)
+    in
+      choose_aux (List.rev lst)
+
+
+end
+
+
+# 132 "myocamlbuild.ml"
+module BaseEnvLight = struct
+(* # 22 "src/base/BaseEnvLight.ml" *)
+
+
+  module MapString = Map.Make(String)
+
+
+  type t = string MapString.t
+
+
+  let default_filename =
+    Filename.concat
+      (Sys.getcwd ())
+      "setup.data"
+
+
+  let load ?(allow_empty=false) ?(filename=default_filename) () =
+    if Sys.file_exists filename then
+      begin
+        let chn =
+          open_in_bin filename
+        in
+        let st =
+          Stream.of_channel chn
+        in
+        let line =
+          ref 1
+        in
+        let st_line =
+          Stream.from
+            (fun _ ->
+               try
+                 match Stream.next st with
+                   | '\n' -> incr line; Some '\n'
+                   | c -> Some c
+               with Stream.Failure -> None)
+        in
+        let lexer =
+          Genlex.make_lexer ["="] st_line
+        in
+        let rec read_file mp =
+          match Stream.npeek 3 lexer with
+            | [Genlex.Ident nm; Genlex.Kwd "="; Genlex.String value] ->
+                Stream.junk lexer;
+                Stream.junk lexer;
+                Stream.junk lexer;
+                read_file (MapString.add nm value mp)
+            | [] ->
+                mp
+            | _ ->
+                failwith
+                  (Printf.sprintf
+                     "Malformed data file '%s' line %d"
+                     filename !line)
+        in
+        let mp =
+          read_file MapString.empty
+        in
+          close_in chn;
+          mp
+      end
+    else if allow_empty then
+      begin
+        MapString.empty
+      end
+    else
+      begin
+        failwith
+          (Printf.sprintf
+             "Unable to load environment, the file '%s' doesn't exist."
+             filename)
+      end
+
+
+  let rec var_expand str env =
+    let buff =
+      Buffer.create ((String.length str) * 2)
+    in
+      Buffer.add_substitute
+        buff
+        (fun var ->
+           try
+             var_expand (MapString.find var env) env
+           with Not_found ->
+             failwith
+               (Printf.sprintf
+                  "No variable %s defined when trying to expand %S."
+                  var
+                  str))
+        str;
+      Buffer.contents buff
+
+
+  let var_get name env =
+    var_expand (MapString.find name env) env
+
+
+  let var_choose lst env =
+    OASISExpr.choose
+      (fun nm -> var_get nm env)
+      lst
+end
+
+
+# 237 "myocamlbuild.ml"
+module MyOCamlbuildFindlib = struct
+(* # 22 "src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml" *)
+
+
+  (** OCamlbuild extension, copied from
+    * http://brion.inria.fr/gallium/index.php/Using_ocamlfind_with_ocamlbuild
+    * by N. Pouillard and others
+    *
+    * Updated on 2009/02/28
+    *
+    * Modified by Sylvain Le Gall
+    *)
+  open Ocamlbuild_plugin
+
+  type conf =
+    { no_automatic_syntax: bool;
+    }
+
+  (* these functions are not really officially exported *)
+  let run_and_read =
+    Ocamlbuild_pack.My_unix.run_and_read
+
+
+  let blank_sep_strings =
+    Ocamlbuild_pack.Lexers.blank_sep_strings
+
+
+  let exec_from_conf exec =
+    let exec =
+      let env_filename = Pathname.basename BaseEnvLight.default_filename in
+      let env = BaseEnvLight.load ~filename:env_filename ~allow_empty:true () in
+      try
+        BaseEnvLight.var_get exec env
+      with Not_found ->
+        Printf.eprintf "W: Cannot get variable %s\n" exec;
+        exec
+    in
+    let fix_win32 str =
+      if Sys.os_type = "Win32" then begin
+        let buff = Buffer.create (String.length str) in
+        (* Adapt for windowsi, ocamlbuild + win32 has a hard time to handle '\\'.
+         *)
+        String.iter
+          (fun c -> Buffer.add_char buff (if c = '\\' then '/' else c))
+          str;
+        Buffer.contents buff
+      end else begin
+        str
+      end
+    in
+      fix_win32 exec
+
+  let split s ch =
+    let buf = Buffer.create 13 in
+    let x = ref [] in
+    let flush () =
+      x := (Buffer.contents buf) :: !x;
+      Buffer.clear buf
+    in
+      String.iter
+        (fun c ->
+           if c = ch then
+             flush ()
+           else
+             Buffer.add_char buf c)
+        s;
+      flush ();
+      List.rev !x
+
+
+  let split_nl s = split s '\n'
+
+
+  let before_space s =
+    try
+      String.before s (String.index s ' ')
+    with Not_found -> s
+
+  (* ocamlfind command *)
+  let ocamlfind x = S[Sh (exec_from_conf "ocamlfind"); x]
+
+  (* This lists all supported packages. *)
+  let find_packages () =
+    List.map before_space (split_nl & run_and_read (exec_from_conf "ocamlfind" ^ " list"))
+
+
+  (* Mock to list available syntaxes. *)
+  let find_syntaxes () = ["camlp4o"; "camlp4r"]
+
+
+  let well_known_syntax = [
+    "camlp4.quotations.o";
+    "camlp4.quotations.r";
+    "camlp4.exceptiontracer";
+    "camlp4.extend";
+    "camlp4.foldgenerator";
+    "camlp4.listcomprehension";
+    "camlp4.locationstripper";
+    "camlp4.macro";
+    "camlp4.mapgenerator";
+    "camlp4.metagenerator";
+    "camlp4.profiler";
+    "camlp4.tracer"
+  ]
+
+
+  let dispatch conf =
+    function
+      | After_options ->
+          (* By using Before_options one let command line options have an higher
+           * priority on the contrary using After_options will guarantee to have
+           * the higher priority override default commands by ocamlfind ones *)
+          Options.ocamlc     := ocamlfind & A"ocamlc";
+          Options.ocamlopt   := ocamlfind & A"ocamlopt";
+          Options.ocamldep   := ocamlfind & A"ocamldep";
+          Options.ocamldoc   := ocamlfind & A"ocamldoc";
+          Options.ocamlmktop := ocamlfind & A"ocamlmktop";
+          Options.ocamlmklib := ocamlfind & A"ocamlmklib"
+
+      | After_rules ->
+
+          (* When one link an OCaml library/binary/package, one should use
+           * -linkpkg *)
+          flag ["ocaml"; "link"; "program"] & A"-linkpkg";
+
+          if not (conf.no_automatic_syntax) then begin
+            (* For each ocamlfind package one inject the -package option when
+             * compiling, computing dependencies, generating documentation and
+             * linking. *)
+            List.iter
+              begin fun pkg ->
+                let base_args = [A"-package"; A pkg] in
+                (* TODO: consider how to really choose camlp4o or camlp4r. *)
+                let syn_args = [A"-syntax"; A "camlp4o"] in
+                let (args, pargs) =
+                  (* Heuristic to identify syntax extensions: whether they end in
+                     ".syntax"; some might not.
+                  *)
+                  if Filename.check_suffix pkg "syntax" ||
+                     List.mem pkg well_known_syntax then
+                    (syn_args @ base_args, syn_args)
+                  else
+                    (base_args, [])
+                in
+                flag ["ocaml"; "compile";  "pkg_"^pkg] & S args;
+                flag ["ocaml"; "ocamldep"; "pkg_"^pkg] & S args;
+                flag ["ocaml"; "doc";      "pkg_"^pkg] & S args;
+                flag ["ocaml"; "link";     "pkg_"^pkg] & S base_args;
+                flag ["ocaml"; "infer_interface"; "pkg_"^pkg] & S args;
+
+                (* TODO: Check if this is allowed for OCaml < 3.12.1 *)
+                flag ["ocaml"; "compile";  "package("^pkg^")"] & S pargs;
+                flag ["ocaml"; "ocamldep"; "package("^pkg^")"] & S pargs;
+                flag ["ocaml"; "doc";      "package("^pkg^")"] & S pargs;
+                flag ["ocaml"; "infer_interface"; "package("^pkg^")"] & S pargs;
+              end
+              (find_packages ());
+          end;
+
+          (* Like -package but for extensions syntax. Morover -syntax is useless
+           * when linking. *)
+          List.iter begin fun syntax ->
+          flag ["ocaml"; "compile";  "syntax_"^syntax] & S[A"-syntax"; A syntax];
+          flag ["ocaml"; "ocamldep"; "syntax_"^syntax] & S[A"-syntax"; A syntax];
+          flag ["ocaml"; "doc";      "syntax_"^syntax] & S[A"-syntax"; A syntax];
+          flag ["ocaml"; "infer_interface"; "syntax_"^syntax] &
+                S[A"-syntax"; A syntax];
+          end (find_syntaxes ());
+
+          (* The default "thread" tag is not compatible with ocamlfind.
+           * Indeed, the default rules add the "threads.cma" or "threads.cmxa"
+           * options when using this tag. When using the "-linkpkg" option with
+           * ocamlfind, this module will then be added twice on the command line.
+           *
+           * To solve this, one approach is to add the "-thread" option when using
+           * the "threads" package using the previous plugin.
+           *)
+          flag ["ocaml"; "pkg_threads"; "compile"] (S[A "-thread"]);
+          flag ["ocaml"; "pkg_threads"; "doc"] (S[A "-I"; A "+threads"]);
+          flag ["ocaml"; "pkg_threads"; "link"] (S[A "-thread"]);
+          flag ["ocaml"; "pkg_threads"; "infer_interface"] (S[A "-thread"]);
+          flag ["ocaml"; "package(threads)"; "compile"] (S[A "-thread"]);
+          flag ["ocaml"; "package(threads)"; "doc"] (S[A "-I"; A "+threads"]);
+          flag ["ocaml"; "package(threads)"; "link"] (S[A "-thread"]);
+          flag ["ocaml"; "package(threads)"; "infer_interface"] (S[A "-thread"]);
+
+      | _ ->
+          ()
+end
+
+module MyOCamlbuildBase = struct
+(* # 22 "src/plugins/ocamlbuild/MyOCamlbuildBase.ml" *)
+
+
+  (** Base functions for writing myocamlbuild.ml
+      @author Sylvain Le Gall
+    *)
+
+
+
+
+
+  open Ocamlbuild_plugin
+  module OC = Ocamlbuild_pack.Ocaml_compiler
+
+
+  type dir = string
+  type file = string
+  type name = string
+  type tag = string
+
+
+(* # 62 "src/plugins/ocamlbuild/MyOCamlbuildBase.ml" *)
+
+
+  type t =
+      {
+        lib_ocaml: (name * dir list * string list) list;
+        lib_c:     (name * dir * file list) list;
+        flags:     (tag list * (spec OASISExpr.choices)) list;
+        (* Replace the 'dir: include' from _tags by a precise interdepends in
+         * directory.
+         *)
+        includes:  (dir * dir list) list;
+      }
+
+
+  let env_filename =
+    Pathname.basename
+      BaseEnvLight.default_filename
+
+
+  let dispatch_combine lst =
+    fun e ->
+      List.iter
+        (fun dispatch -> dispatch e)
+        lst
+
+
+  let tag_libstubs nm =
+    "use_lib"^nm^"_stubs"
+
+
+  let nm_libstubs nm =
+    nm^"_stubs"
+
+
+  let dispatch t e =
+    let env =
+      BaseEnvLight.load
+        ~filename:env_filename
+        ~allow_empty:true
+        ()
+    in
+      match e with
+        | Before_options ->
+            let no_trailing_dot s =
+              if String.length s >= 1 && s.[0] = '.' then
+                String.sub s 1 ((String.length s) - 1)
+              else
+                s
+            in
+              List.iter
+                (fun (opt, var) ->
+                   try
+                     opt := no_trailing_dot (BaseEnvLight.var_get var env)
+                   with Not_found ->
+                     Printf.eprintf "W: Cannot get variable %s\n" var)
+                [
+                  Options.ext_obj, "ext_obj";
+                  Options.ext_lib, "ext_lib";
+                  Options.ext_dll, "ext_dll";
+                ]
+
+        | After_rules ->
+            (* Declare OCaml libraries *)
+            List.iter
+              (function
+                 | nm, [], intf_modules ->
+                     ocaml_lib nm;
+                     let cmis =
+                       List.map (fun m -> (String.uncapitalize m) ^ ".cmi")
+                                intf_modules in
+                     dep ["ocaml"; "link"; "library"; "file:"^nm^".cma"] cmis
+                 | nm, dir :: tl, intf_modules ->
+                     ocaml_lib ~dir:dir (dir^"/"^nm);
+                     List.iter
+                       (fun dir ->
+                          List.iter
+                            (fun str ->
+                               flag ["ocaml"; "use_"^nm; str] (S[A"-I"; P dir]))
+                            ["compile"; "infer_interface"; "doc"])
+                       tl;
+                     let cmis =
+                       List.map (fun m -> dir^"/"^(String.uncapitalize m)^".cmi")
+                                intf_modules in
+                     dep ["ocaml"; "link"; "library"; "file:"^dir^"/"^nm^".cma"]
+                         cmis)
+              t.lib_ocaml;
+
+            (* Declare directories dependencies, replace "include" in _tags. *)
+            List.iter
+              (fun (dir, include_dirs) ->
+                 Pathname.define_context dir include_dirs)
+              t.includes;
+
+            (* Declare C libraries *)
+            List.iter
+              (fun (lib, dir, headers) ->
+                   (* Handle C part of library *)
+                   flag ["link"; "library"; "ocaml"; "byte"; tag_libstubs lib]
+                     (S[A"-dllib"; A("-l"^(nm_libstubs lib)); A"-cclib";
+                        A("-l"^(nm_libstubs lib))]);
+
+                   flag ["link"; "library"; "ocaml"; "native"; tag_libstubs lib]
+                     (S[A"-cclib"; A("-l"^(nm_libstubs lib))]);
+
+                   flag ["link"; "program"; "ocaml"; "byte"; tag_libstubs lib]
+                     (S[A"-dllib"; A("dll"^(nm_libstubs lib))]);
+
+                   (* When ocaml link something that use the C library, then one
+                      need that file to be up to date.
+                      This holds both for programs and for libraries.
+                    *)
+  		 dep ["link"; "ocaml"; tag_libstubs lib]
+  		     [dir/"lib"^(nm_libstubs lib)^"."^(!Options.ext_lib)];
+
+  		 dep  ["compile"; "ocaml"; tag_libstubs lib]
+  		      [dir/"lib"^(nm_libstubs lib)^"."^(!Options.ext_lib)];
+
+                   (* TODO: be more specific about what depends on headers *)
+                   (* Depends on .h files *)
+                   dep ["compile"; "c"]
+                     headers;
+
+                   (* Setup search path for lib *)
+                   flag ["link"; "ocaml"; "use_"^lib]
+                     (S[A"-I"; P(dir)]);
+              )
+              t.lib_c;
+
+              (* Add flags *)
+              List.iter
+              (fun (tags, cond_specs) ->
+                 let spec = BaseEnvLight.var_choose cond_specs env in
+                 let rec eval_specs =
+                   function
+                     | S lst -> S (List.map eval_specs lst)
+                     | A str -> A (BaseEnvLight.var_expand str env)
+                     | spec -> spec
+                 in
+                   flag tags & (eval_specs spec))
+              t.flags
+        | _ ->
+            ()
+
+
+  let dispatch_default conf t =
+    dispatch_combine
+      [
+        dispatch t;
+        MyOCamlbuildFindlib.dispatch conf;
+      ]
+
+
+end
+
+
+# 606 "myocamlbuild.ml"
+open Ocamlbuild_plugin;;
+let package_default =
+  {MyOCamlbuildBase.lib_ocaml = []; lib_c = []; flags = []; includes = []}
+  ;;
+
+let conf = {MyOCamlbuildFindlib.no_automatic_syntax = false}
+
+let dispatch_default = MyOCamlbuildBase.dispatch_default conf package_default;;
+
+# 617 "myocamlbuild.ml"
+(* OASIS_STOP *)
+Ocamlbuild_plugin.dispatch dispatch_default;;

Fichier diff supprimé car celui-ci est trop grand
+ 6791 - 0
setup.ml


+ 5 - 0
src/.merlin

@@ -0,0 +1,5 @@
+PKG core yojson atdgen
+
+S *
+
+B ../_build/src/

+ 0 - 0
src/const.ml


+ 0 - 0
src/default.ml


+ 0 - 0
src/exec_cmd.ml


+ 1 - 9
src/file_com.ml

@@ -38,14 +38,6 @@ open Core.Std;;
 
 
 (* Read settings and programs to launch from rc file *)
 (* Read settings and programs to launch from rc file *)
 
 
-(* Get string from file *)
-let string_f_file file =
-    let tmp_buffer = In_channel.create file in
-let content = In_channel.input_all tmp_buffer in
-(* Now, close file and return value *)
-In_channel.close tmp_buffer; content
-;;
-
 (* Return the configuration file template *)
 (* Return the configuration file template *)
 let rc_template () =
 let rc_template () =
   Settings_v.create_rc_file ~progs:[] ~settings:[]
   Settings_v.create_rc_file ~progs:[] ~settings:[]
@@ -69,5 +61,5 @@ let rec init_rc ~rc:rc_file =
   match (Sys.file_exists rc_file) with
   match (Sys.file_exists rc_file) with
     | `No -> create_rc_file ~name:rc_file; init_rc ~rc:rc_file;
     | `No -> create_rc_file ~name:rc_file; init_rc ~rc:rc_file;
     | `Unknown -> failwith "Error reading configuration file";
     | `Unknown -> failwith "Error reading configuration file";
-    | `Yes -> string_f_file rc_file |> Settings_j.rc_file_of_string
+    | `Yes -> In_channel.read_all rc_file |> Settings_j.rc_file_of_string
 ;;
 ;;

+ 0 - 0
src/oclaunch.ml


+ 0 - 0
src/settings.atd


+ 2 - 2
src/tmp_file.ml

@@ -38,7 +38,7 @@ open Core.Std;;
 
 
 (* Function to create the tmp file *)
 (* Function to create the tmp file *)
 let create_tmp_file ~name =
 let create_tmp_file ~name =
-  Yojson.Basic.pretty_to_channel (Out_channel.create name) Const.tmp_file_template (* TODO create file in /tmp *)
+  Yojson.Basic.pretty_to_channel (Out_channel.create name) Const.tmp_file_template
 ;;
 ;;
 
 
 (* Function to open tmp file *)
 (* Function to open tmp file *)
@@ -64,7 +64,7 @@ let verify_key_exist ~key entry =
 ;;
 ;;
 
 
 (* Return true if a program is in the rc file *)
 (* Return true if a program is in the rc file *)
-let rec is_prog_in_rc list_from_rc_file program = (* TODO restaure ?(list_from_rc_file=rc_content.progs) *)
+let rec is_prog_in_rc list_from_rc_file program =
     match list_from_rc_file with
     match list_from_rc_file with
     (* | None -> is_prog_in_rc program ~liste_from_rc_file:rc_content.progs *)
     (* | None -> is_prog_in_rc program ~liste_from_rc_file:rc_content.progs *)
     | [] -> false
     | [] -> false