~ubuntu-branches/ubuntu/lucid/cameleon/lucid

« back to all changes in this revision

Viewing changes to omom/omom_actions.ml

  • Committer: Bazaar Package Importer
  • Author(s): Samuel Mimram
  • Date: 2006-09-11 12:24:24 UTC
  • mfrom: (3.1.5 edgy)
  • Revision ID: james.westby@ubuntu.com-20060911122424-2i0y2od8gp8iuig6
Tags: 1.9.13-2
* Added checkocaml.dpatch in order to be able to build on architectures
  without ocamlopt, closes: #373830.
* Removed control.in as per new ocaml policy.
* Added myself to uploaders.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
(**************************************************************************)
2
 
(*                   Cameleon                                             *)
3
 
(*                                                                        *)
4
 
(*      Copyright (C) 2002 Institut National de Recherche en Informatique et   *)
5
 
(*      en Automatique. All rights reserved.                              *)
6
 
(*                                                                        *)
7
 
(*      This program is free software; you can redistribute it and/or modify  *)
8
 
(*      it under the terms of the GNU General Public License as published by  *)
9
 
(*      the Free Software Foundation; either version 2 of the License, or  *)
10
 
(*      any later version.                                                *)
11
 
(*                                                                        *)
12
 
(*      This program is distributed in the hope that it will be useful,   *)
13
 
(*      but WITHOUT ANY WARRANTY; without even the implied warranty of    *)
14
 
(*      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     *)
15
 
(*      GNU General Public License for more details.                      *)
16
 
(*                                                                        *)
17
 
(*      You should have received a copy of the GNU General Public License  *)
18
 
(*      along with this program; if not, write to the Free Software       *)
19
 
(*      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA          *)
20
 
(*      02111-1307  USA                                                   *)
21
 
(*                                                                        *)
22
 
(*      Contact: Maxence.Guesdon@inria.fr                                *)
23
 
(**************************************************************************)
24
 
 
25
 
module O = Options 
26
 
module V = Omom_variables 
27
 
 
28
 
let id x =
29
 
  let rec id_list = function
30
 
    | (x, _)::t ->
31
 
        " " ^ x ^ " " ^ (id_list t)
32
 
    | [] -> "" in
33
 
    match x with
34
 
      | V.V_String (x, _) -> x
35
 
      | V.V_List x -> id_list x 
36
 
 
37
 
let includes x =    
38
 
  let rec includes_list = function
39
 
    | (x, _)::t ->
40
 
        "-I " ^ x ^ " " ^ (includes_list t)
41
 
    | [] -> "" in
42
 
    match x with
43
 
      | V.V_String (x, _) -> "-I " ^ x
44
 
      | V.V_List x -> includes_list x 
45
 
          
46
 
let actions = Hashtbl.create 8 
47
 
 
48
 
let action_of_string str =
49
 
  try
50
 
    Hashtbl.find actions str
51
 
  with 
52
 
      Not_found -> id 
53
 
 
54
 
let actions_list = [
55
 
  "", id; 
56
 
  "includes", includes ;
57
 
58
 
 
59
 
let default_action = "" (* id *)
60
 
 
61
 
let _ = List.iter (fun (s,f) -> Hashtbl.add actions s f) actions_list
62
 
 
63
 
let actions_names = List.map fst actions_list