Revision d1baac41
Added by Xavier Thirioux over 10 years ago
Makefile | ||
---|---|---|
1 | 1 |
# OASIS_START |
2 |
# DO NOT EDIT (digest: a3c674b4239234cbbe53afe090018954)
|
|
2 |
# DO NOT EDIT (digest: bc1e05bfc8b39b664f29dae8dbd3ebbb)
|
|
3 | 3 |
|
4 | 4 |
SETUP = ocaml setup.ml |
5 | 5 |
|
... | ... | |
12 | 12 |
test: setup.data build |
13 | 13 |
$(SETUP) -test $(TESTFLAGS) |
14 | 14 |
|
15 |
all: |
|
15 |
all:
|
|
16 | 16 |
$(SETUP) -all $(ALLFLAGS) |
17 | 17 |
|
18 | 18 |
install: setup.data |
... | ... | |
24 | 24 |
reinstall: setup.data |
25 | 25 |
$(SETUP) -reinstall $(REINSTALLFLAGS) |
26 | 26 |
|
27 |
clean: |
|
27 |
clean:
|
|
28 | 28 |
$(SETUP) -clean $(CLEANFLAGS) |
29 | 29 |
|
30 |
distclean: |
|
30 |
distclean:
|
|
31 | 31 |
$(SETUP) -distclean $(DISTCLEANFLAGS) |
32 | 32 |
|
33 | 33 |
setup.data: |
34 | 34 |
$(SETUP) -configure $(CONFIGUREFLAGS) |
35 | 35 |
|
36 |
configure: |
|
37 |
$(SETUP) -configure $(CONFIGUREFLAGS) |
|
38 |
|
|
39 | 36 |
.PHONY: build doc test all install uninstall reinstall clean distclean configure |
40 | 37 |
|
41 | 38 |
# OASIS_STOP |
_tags | ||
---|---|---|
2 | 2 |
"src/backends/C": include |
3 | 3 |
"src/backends/Horn": include |
4 | 4 |
# OASIS_START |
5 |
# DO NOT EDIT (digest: df9189c6c6943133cb99a2bb11ba7f05)
|
|
6 |
# Ignore VCS directories, you can use the same kind of rule outside |
|
7 |
# OASIS_START/STOP if you want to exclude directories that contains |
|
5 |
# DO NOT EDIT (digest: 98bcbc21d29d2f6266238c1025fff223)
|
|
6 |
# Ignore VCS directories, you can use the same kind of rule outside
|
|
7 |
# OASIS_START/STOP if you want to exclude directories that contains
|
|
8 | 8 |
# useless stuff for the build process |
9 | 9 |
<**/.svn>: -traverse |
10 | 10 |
<**/.svn>: not_hygienic |
configure | ||
---|---|---|
1 | 1 |
#!/bin/sh |
2 | 2 |
|
3 | 3 |
# OASIS_START |
4 |
# DO NOT EDIT (digest: dc86c2ad450f91ca10c931b6045d0499)
|
|
4 |
# DO NOT EDIT (digest: 425187ed8bfdbdd207fd76392dd243a7)
|
|
5 | 5 |
set -e |
6 | 6 |
|
7 | 7 |
FST=true |
8 |
for i in "$@"; do |
|
8 |
for i in "$@"; do
|
|
9 | 9 |
if $FST; then |
10 | 10 |
set -- |
11 | 11 |
FST=false |
myocamlbuild.ml | ||
---|---|---|
1 | 1 |
(* OASIS_START *) |
2 |
(* DO NOT EDIT (digest: 5a9a2168dcb86db37476d58b8c0e25b3) *)
|
|
2 |
(* DO NOT EDIT (digest: 72be793de58c2829edbc48dbc71bb938) *)
|
|
3 | 3 |
module OASISGettext = struct |
4 |
(* # 22 "src/oasis/OASISGettext.ml" *) |
|
5 |
|
|
4 |
(* # 21 "src/oasis/OASISGettext.ml" *) |
|
6 | 5 |
|
7 | 6 |
let ns_ str = |
8 | 7 |
str |
9 | 8 |
|
10 |
|
|
11 | 9 |
let s_ str = |
12 | 10 |
str |
13 | 11 |
|
14 |
|
|
15 |
let f_ (str: ('a, 'b, 'c, 'd) format4) = |
|
12 |
let f_ (str : ('a, 'b, 'c, 'd) format4) = |
|
16 | 13 |
str |
17 | 14 |
|
18 |
|
|
19 | 15 |
let fn_ fmt1 fmt2 n = |
20 | 16 |
if n = 1 then |
21 | 17 |
fmt1^^"" |
22 | 18 |
else |
23 | 19 |
fmt2^^"" |
24 | 20 |
|
25 |
|
|
26 | 21 |
let init = |
27 | 22 |
[] |
28 | 23 |
|
29 |
|
|
30 | 24 |
end |
31 | 25 |
|
32 | 26 |
module OASISExpr = struct |
33 |
(* # 22 "src/oasis/OASISExpr.ml" *) |
|
34 |
|
|
35 |
|
|
27 |
(* # 21 "src/oasis/OASISExpr.ml" *) |
|
36 | 28 |
|
37 | 29 |
|
38 | 30 |
|
39 | 31 |
open OASISGettext |
40 | 32 |
|
33 |
type test = string |
|
41 | 34 |
|
42 |
type test = string |
|
43 |
|
|
44 |
|
|
45 |
type flag = string |
|
46 |
|
|
35 |
type flag = string |
|
47 | 36 |
|
48 | 37 |
type t = |
49 | 38 |
| EBool of bool |
... | ... | |
52 | 41 |
| EOr of t * t |
53 | 42 |
| EFlag of flag |
54 | 43 |
| ETest of test * string |
44 |
|
|
55 | 45 |
|
56 |
|
|
57 |
|
|
58 |
type 'a choices = (t * 'a) list |
|
59 |
|
|
46 |
type 'a choices = (t * 'a) list |
|
60 | 47 |
|
61 | 48 |
let eval var_get t = |
62 | 49 |
let rec eval' = |
... | ... | |
88 | 75 |
in |
89 | 76 |
eval' t |
90 | 77 |
|
91 |
|
|
92 | 78 |
let choose ?printer ?name var_get lst = |
93 | 79 |
let rec choose_aux = |
94 | 80 |
function |
... | ... | |
125 | 111 |
in |
126 | 112 |
choose_aux (List.rev lst) |
127 | 113 |
|
128 |
|
|
129 | 114 |
end |
130 | 115 |
|
131 | 116 |
|
132 |
# 132 "myocamlbuild.ml"
|
|
117 |
# 117 "myocamlbuild.ml"
|
|
133 | 118 |
module BaseEnvLight = struct |
134 |
(* # 22 "src/base/BaseEnvLight.ml" *) |
|
135 |
|
|
119 |
(* # 21 "src/base/BaseEnvLight.ml" *) |
|
136 | 120 |
|
137 | 121 |
module MapString = Map.Make(String) |
138 | 122 |
|
139 |
|
|
140 | 123 |
type t = string MapString.t |
141 | 124 |
|
142 |
|
|
143 | 125 |
let default_filename = |
144 | 126 |
Filename.concat |
145 | 127 |
(Sys.getcwd ()) |
146 | 128 |
"setup.data" |
147 | 129 |
|
148 |
|
|
149 | 130 |
let load ?(allow_empty=false) ?(filename=default_filename) () = |
150 | 131 |
if Sys.file_exists filename then |
151 | 132 |
begin |
... | ... | |
203 | 184 |
filename) |
204 | 185 |
end |
205 | 186 |
|
206 |
|
|
207 |
let rec var_expand str env = |
|
208 |
let buff = |
|
209 |
Buffer.create ((String.length str) * 2) |
|
210 |
in |
|
211 |
Buffer.add_substitute |
|
212 |
buff |
|
213 |
(fun var -> |
|
214 |
try |
|
215 |
var_expand (MapString.find var env) env |
|
216 |
with Not_found -> |
|
217 |
failwith |
|
218 |
(Printf.sprintf |
|
219 |
"No variable %s defined when trying to expand %S." |
|
220 |
var |
|
221 |
str)) |
|
222 |
str; |
|
223 |
Buffer.contents buff |
|
224 |
|
|
225 |
|
|
226 | 187 |
let var_get name env = |
227 |
var_expand (MapString.find name env) env |
|
228 |
|
|
188 |
let rec var_expand str = |
|
189 |
let buff = |
|
190 |
Buffer.create ((String.length str) * 2) |
|
191 |
in |
|
192 |
Buffer.add_substitute |
|
193 |
buff |
|
194 |
(fun var -> |
|
195 |
try |
|
196 |
var_expand (MapString.find var env) |
|
197 |
with Not_found -> |
|
198 |
failwith |
|
199 |
(Printf.sprintf |
|
200 |
"No variable %s defined when trying to expand %S." |
|
201 |
var |
|
202 |
str)) |
|
203 |
str; |
|
204 |
Buffer.contents buff |
|
205 |
in |
|
206 |
var_expand (MapString.find name env) |
|
229 | 207 |
|
230 | 208 |
let var_choose lst env = |
231 | 209 |
OASISExpr.choose |
... | ... | |
234 | 212 |
end |
235 | 213 |
|
236 | 214 |
|
237 |
# 237 "myocamlbuild.ml"
|
|
215 |
# 215 "myocamlbuild.ml"
|
|
238 | 216 |
module MyOCamlbuildFindlib = struct |
239 |
(* # 22 "src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml" *) |
|
240 |
|
|
217 |
(* # 21 "src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml" *) |
|
241 | 218 |
|
242 |
(** OCamlbuild extension, copied from |
|
219 |
(** OCamlbuild extension, copied from
|
|
243 | 220 |
* http://brion.inria.fr/gallium/index.php/Using_ocamlfind_with_ocamlbuild |
244 | 221 |
* by N. Pouillard and others |
245 | 222 |
* |
246 | 223 |
* Updated on 2009/02/28 |
247 | 224 |
* |
248 |
* Modified by Sylvain Le Gall |
|
225 |
* Modified by Sylvain Le Gall
|
|
249 | 226 |
*) |
250 | 227 |
open Ocamlbuild_plugin |
251 | 228 |
|
252 |
|
|
253 | 229 |
(* these functions are not really officially exported *) |
254 |
let run_and_read = |
|
230 |
let run_and_read =
|
|
255 | 231 |
Ocamlbuild_pack.My_unix.run_and_read |
256 | 232 |
|
257 |
|
|
258 |
let blank_sep_strings = |
|
233 |
let blank_sep_strings = |
|
259 | 234 |
Ocamlbuild_pack.Lexers.blank_sep_strings |
260 | 235 |
|
261 |
|
|
262 |
let exec_from_conf exec = |
|
263 |
let exec = |
|
264 |
let env_filename = Pathname.basename BaseEnvLight.default_filename in |
|
265 |
let env = BaseEnvLight.load ~filename:env_filename ~allow_empty:true () in |
|
266 |
try |
|
267 |
BaseEnvLight.var_get exec env |
|
268 |
with Not_found -> |
|
269 |
Printf.eprintf "W: Cannot get variable %s\n" exec; |
|
270 |
exec |
|
271 |
in |
|
272 |
let fix_win32 str = |
|
273 |
if Sys.os_type = "Win32" then begin |
|
274 |
let buff = Buffer.create (String.length str) in |
|
275 |
(* Adapt for windowsi, ocamlbuild + win32 has a hard time to handle '\\'. |
|
276 |
*) |
|
277 |
String.iter |
|
278 |
(fun c -> Buffer.add_char buff (if c = '\\' then '/' else c)) |
|
279 |
str; |
|
280 |
Buffer.contents buff |
|
281 |
end else begin |
|
282 |
str |
|
283 |
end |
|
284 |
in |
|
285 |
fix_win32 exec |
|
286 |
|
|
287 | 236 |
let split s ch = |
288 |
let buf = Buffer.create 13 in |
|
289 |
let x = ref [] in |
|
290 |
let flush () = |
|
291 |
x := (Buffer.contents buf) :: !x; |
|
292 |
Buffer.clear buf |
|
237 |
let x = |
|
238 |
ref [] |
|
293 | 239 |
in |
294 |
String.iter
|
|
295 |
(fun c ->
|
|
296 |
if c = ch then
|
|
297 |
flush ()
|
|
298 |
else
|
|
299 |
Buffer.add_char buf c)
|
|
300 |
s;
|
|
301 |
flush ();
|
|
302 |
List.rev !x
|
|
303 |
|
|
240 |
let rec go s =
|
|
241 |
let pos =
|
|
242 |
String.index s ch
|
|
243 |
in
|
|
244 |
x := (String.before s pos)::!x;
|
|
245 |
go (String.after s (pos + 1))
|
|
246 |
in
|
|
247 |
try
|
|
248 |
go s
|
|
249 |
with Not_found -> !x |
|
304 | 250 |
|
305 | 251 |
let split_nl s = split s '\n' |
306 | 252 |
|
307 |
|
|
308 | 253 |
let before_space s = |
309 | 254 |
try |
310 | 255 |
String.before s (String.index s ' ') |
311 | 256 |
with Not_found -> s |
312 | 257 |
|
313 |
(* ocamlfind command *) |
|
314 |
let ocamlfind x = S[Sh (exec_from_conf "ocamlfind"); x] |
|
315 |
|
|
316 |
(* This lists all supported packages. *) |
|
258 |
(* this lists all supported packages *) |
|
317 | 259 |
let find_packages () = |
318 | 260 |
List.map before_space (split_nl & run_and_read "ocamlfind list") |
319 | 261 |
|
320 |
|
|
321 |
(* Mock to list available syntaxes. *) |
|
262 |
(* this is supposed to list available syntaxes, but I don't know how to do it. *) |
|
322 | 263 |
let find_syntaxes () = ["camlp4o"; "camlp4r"] |
323 | 264 |
|
324 |
|
|
325 |
let well_known_syntax = [ |
|
326 |
"camlp4.quotations.o"; |
|
327 |
"camlp4.quotations.r"; |
|
328 |
"camlp4.exceptiontracer"; |
|
329 |
"camlp4.extend"; |
|
330 |
"camlp4.foldgenerator"; |
|
331 |
"camlp4.listcomprehension"; |
|
332 |
"camlp4.locationstripper"; |
|
333 |
"camlp4.macro"; |
|
334 |
"camlp4.mapgenerator"; |
|
335 |
"camlp4.metagenerator"; |
|
336 |
"camlp4.profiler"; |
|
337 |
"camlp4.tracer" |
|
338 |
] |
|
339 |
|
|
265 |
(* ocamlfind command *) |
|
266 |
let ocamlfind x = S[A"ocamlfind"; x] |
|
340 | 267 |
|
341 | 268 |
let dispatch = |
342 | 269 |
function |
343 |
| After_options ->
|
|
344 |
(* By using Before_options one let command line options have an higher
|
|
345 |
* priority on the contrary using After_options will guarantee to have
|
|
346 |
* the higher priority override default commands by ocamlfind ones *)
|
|
270 |
| Before_options ->
|
|
271 |
(* by using Before_options one let command line options have an higher priority *)
|
|
272 |
(* on the contrary using After_options will guarantee to have the higher priority *)
|
|
273 |
(* override default commands by ocamlfind ones *)
|
|
347 | 274 |
Options.ocamlc := ocamlfind & A"ocamlc"; |
348 | 275 |
Options.ocamlopt := ocamlfind & A"ocamlopt"; |
349 | 276 |
Options.ocamldep := ocamlfind & A"ocamldep"; |
350 | 277 |
Options.ocamldoc := ocamlfind & A"ocamldoc"; |
351 |
Options.ocamlmktop := ocamlfind & A"ocamlmktop"; |
|
352 |
Options.ocamlmklib := ocamlfind & A"ocamlmklib" |
|
353 |
|
|
278 |
Options.ocamlmktop := ocamlfind & A"ocamlmktop" |
|
279 |
|
|
354 | 280 |
| After_rules -> |
355 |
|
|
356 |
(* When one link an OCaml library/binary/package, one should use |
|
357 |
* -linkpkg *) |
|
281 |
|
|
282 |
(* When one link an OCaml library/binary/package, one should use -linkpkg *) |
|
358 | 283 |
flag ["ocaml"; "link"; "program"] & A"-linkpkg"; |
359 |
|
|
284 |
|
|
360 | 285 |
(* For each ocamlfind package one inject the -package option when |
361 | 286 |
* compiling, computing dependencies, generating documentation and |
362 | 287 |
* linking. *) |
363 |
List.iter |
|
288 |
List.iter
|
|
364 | 289 |
begin fun pkg -> |
365 |
let base_args = [A"-package"; A pkg] in |
|
366 |
(* TODO: consider how to really choose camlp4o or camlp4r. *) |
|
367 |
let syn_args = [A"-syntax"; A "camlp4o"] in |
|
368 |
let args = |
|
369 |
(* Heuristic to identify syntax extensions: whether they end in |
|
370 |
".syntax"; some might not. |
|
371 |
*) |
|
372 |
if Filename.check_suffix pkg "syntax" || |
|
373 |
List.mem pkg well_known_syntax then |
|
374 |
syn_args @ base_args |
|
375 |
else |
|
376 |
base_args |
|
377 |
in |
|
378 |
flag ["ocaml"; "compile"; "pkg_"^pkg] & S args; |
|
379 |
flag ["ocaml"; "ocamldep"; "pkg_"^pkg] & S args; |
|
380 |
flag ["ocaml"; "doc"; "pkg_"^pkg] & S args; |
|
381 |
flag ["ocaml"; "link"; "pkg_"^pkg] & S base_args; |
|
382 |
flag ["ocaml"; "infer_interface"; "pkg_"^pkg] & S args; |
|
383 |
end |
|
290 |
flag ["ocaml"; "compile"; "pkg_"^pkg] & S[A"-package"; A pkg]; |
|
291 |
flag ["ocaml"; "ocamldep"; "pkg_"^pkg] & S[A"-package"; A pkg]; |
|
292 |
flag ["ocaml"; "doc"; "pkg_"^pkg] & S[A"-package"; A pkg]; |
|
293 |
flag ["ocaml"; "link"; "pkg_"^pkg] & S[A"-package"; A pkg]; |
|
294 |
flag ["ocaml"; "infer_interface"; "pkg_"^pkg] & S[A"-package"; A pkg]; |
|
295 |
end |
|
384 | 296 |
(find_packages ()); |
385 | 297 |
|
386 | 298 |
(* Like -package but for extensions syntax. Morover -syntax is useless |
... | ... | |
389 | 301 |
flag ["ocaml"; "compile"; "syntax_"^syntax] & S[A"-syntax"; A syntax]; |
390 | 302 |
flag ["ocaml"; "ocamldep"; "syntax_"^syntax] & S[A"-syntax"; A syntax]; |
391 | 303 |
flag ["ocaml"; "doc"; "syntax_"^syntax] & S[A"-syntax"; A syntax]; |
392 |
flag ["ocaml"; "infer_interface"; "syntax_"^syntax] & |
|
393 |
S[A"-syntax"; A syntax]; |
|
304 |
flag ["ocaml"; "infer_interface"; "syntax_"^syntax] & S[A"-syntax"; A syntax]; |
|
394 | 305 |
end (find_syntaxes ()); |
395 | 306 |
|
396 | 307 |
(* The default "thread" tag is not compatible with ocamlfind. |
397 | 308 |
* Indeed, the default rules add the "threads.cma" or "threads.cmxa" |
398 | 309 |
* options when using this tag. When using the "-linkpkg" option with |
399 | 310 |
* ocamlfind, this module will then be added twice on the command line. |
400 |
* |
|
311 |
*
|
|
401 | 312 |
* To solve this, one approach is to add the "-thread" option when using |
402 | 313 |
* the "threads" package using the previous plugin. |
403 | 314 |
*) |
404 | 315 |
flag ["ocaml"; "pkg_threads"; "compile"] (S[A "-thread"]); |
405 | 316 |
flag ["ocaml"; "pkg_threads"; "doc"] (S[A "-I"; A "+threads"]); |
406 | 317 |
flag ["ocaml"; "pkg_threads"; "link"] (S[A "-thread"]); |
407 |
flag ["ocaml"; "pkg_threads"; "infer_interface"] (S[A "-thread"]); |
|
408 |
flag ["ocaml"; "package(threads)"; "compile"] (S[A "-thread"]); |
|
409 |
flag ["ocaml"; "package(threads)"; "doc"] (S[A "-I"; A "+threads"]); |
|
410 |
flag ["ocaml"; "package(threads)"; "link"] (S[A "-thread"]); |
|
411 |
flag ["ocaml"; "package(threads)"; "infer_interface"] (S[A "-thread"]); |
|
318 |
flag ["ocaml"; "pkg_threads"; "infer_interface"] (S[A "-thread"]) |
|
412 | 319 |
|
413 |
| _ -> |
|
320 |
| _ ->
|
|
414 | 321 |
() |
322 |
|
|
415 | 323 |
end |
416 | 324 |
|
417 | 325 |
module MyOCamlbuildBase = struct |
418 |
(* # 22 "src/plugins/ocamlbuild/MyOCamlbuildBase.ml" *) |
|
419 |
|
|
326 |
(* # 21 "src/plugins/ocamlbuild/MyOCamlbuildBase.ml" *) |
|
420 | 327 |
|
421 | 328 |
(** Base functions for writing myocamlbuild.ml |
422 | 329 |
@author Sylvain Le Gall |
... | ... | |
424 | 331 |
|
425 | 332 |
|
426 | 333 |
|
427 |
|
|
428 |
|
|
429 | 334 |
open Ocamlbuild_plugin |
430 | 335 |
module OC = Ocamlbuild_pack.Ocaml_compiler |
431 | 336 |
|
337 |
type dir = string |
|
338 |
type file = string |
|
339 |
type name = string |
|
340 |
type tag = string |
|
432 | 341 |
|
433 |
type dir = string |
|
434 |
type file = string |
|
435 |
type name = string |
|
436 |
type tag = string |
|
437 |
|
|
438 |
|
|
439 |
(* # 62 "src/plugins/ocamlbuild/MyOCamlbuildBase.ml" *) |
|
440 |
|
|
342 |
(* # 56 "src/plugins/ocamlbuild/MyOCamlbuildBase.ml" *) |
|
441 | 343 |
|
442 | 344 |
type t = |
443 | 345 |
{ |
444 |
lib_ocaml: (name * dir list * string list) list;
|
|
445 |
lib_c: (name * dir * file list) list; |
|
346 |
lib_ocaml: (name * dir list) list; |
|
347 |
lib_c: (name * dir * file list) list;
|
|
446 | 348 |
flags: (tag list * (spec OASISExpr.choices)) list; |
447 | 349 |
(* Replace the 'dir: include' from _tags by a precise interdepends in |
448 | 350 |
* directory. |
449 | 351 |
*) |
450 |
includes: (dir * dir list) list; |
|
451 |
} |
|
452 |
|
|
352 |
includes: (dir * dir list) list; |
|
353 |
} |
|
453 | 354 |
|
454 | 355 |
let env_filename = |
455 |
Pathname.basename |
|
356 |
Pathname.basename
|
|
456 | 357 |
BaseEnvLight.default_filename |
457 | 358 |
|
458 |
|
|
459 | 359 |
let dispatch_combine lst = |
460 | 360 |
fun e -> |
461 |
List.iter |
|
361 |
List.iter
|
|
462 | 362 |
(fun dispatch -> dispatch e) |
463 |
lst |
|
464 |
|
|
363 |
lst |
|
465 | 364 |
|
466 | 365 |
let tag_libstubs nm = |
467 | 366 |
"use_lib"^nm^"_stubs" |
468 | 367 |
|
469 |
|
|
470 | 368 |
let nm_libstubs nm = |
471 | 369 |
nm^"_stubs" |
472 | 370 |
|
473 |
|
|
474 |
let dispatch t e = |
|
475 |
let env = |
|
476 |
BaseEnvLight.load |
|
477 |
~filename:env_filename |
|
371 |
let dispatch t e = |
|
372 |
let env = |
|
373 |
BaseEnvLight.load |
|
374 |
~filename:env_filename |
|
478 | 375 |
~allow_empty:true |
479 | 376 |
() |
480 | 377 |
in |
481 |
match e with |
|
378 |
match e with
|
|
482 | 379 |
| Before_options -> |
483 | 380 |
let no_trailing_dot s = |
484 | 381 |
if String.length s >= 1 && s.[0] = '.' then |
... | ... | |
488 | 385 |
in |
489 | 386 |
List.iter |
490 | 387 |
(fun (opt, var) -> |
491 |
try |
|
388 |
try
|
|
492 | 389 |
opt := no_trailing_dot (BaseEnvLight.var_get var env) |
493 | 390 |
with Not_found -> |
494 |
Printf.eprintf "W: Cannot get variable %s\n" var)
|
|
391 |
Printf.eprintf "W: Cannot get variable %s" var) |
|
495 | 392 |
[ |
496 | 393 |
Options.ext_obj, "ext_obj"; |
497 | 394 |
Options.ext_lib, "ext_lib"; |
498 | 395 |
Options.ext_dll, "ext_dll"; |
499 | 396 |
] |
500 | 397 |
|
501 |
| After_rules -> |
|
398 |
| After_rules ->
|
|
502 | 399 |
(* Declare OCaml libraries *) |
503 |
List.iter |
|
400 |
List.iter
|
|
504 | 401 |
(function |
505 |
| nm, [], intf_modules -> |
|
506 |
ocaml_lib nm; |
|
507 |
let cmis = |
|
508 |
List.map (fun m -> (String.uncapitalize m) ^ ".cmi") |
|
509 |
intf_modules in |
|
510 |
dep ["ocaml"; "link"; "library"; "file:"^nm^".cma"] cmis |
|
511 |
| nm, dir :: tl, intf_modules -> |
|
402 |
| nm, [] -> |
|
403 |
ocaml_lib nm |
|
404 |
| nm, dir :: tl -> |
|
512 | 405 |
ocaml_lib ~dir:dir (dir^"/"^nm); |
513 |
List.iter |
|
514 |
(fun dir -> |
|
406 |
List.iter
|
|
407 |
(fun dir ->
|
|
515 | 408 |
List.iter |
516 | 409 |
(fun str -> |
517 | 410 |
flag ["ocaml"; "use_"^nm; str] (S[A"-I"; P dir])) |
518 | 411 |
["compile"; "infer_interface"; "doc"]) |
519 |
tl; |
|
520 |
let cmis = |
|
521 |
List.map (fun m -> dir^"/"^(String.uncapitalize m)^".cmi") |
|
522 |
intf_modules in |
|
523 |
dep ["ocaml"; "link"; "library"; "file:"^dir^"/"^nm^".cma"] |
|
524 |
cmis) |
|
412 |
tl) |
|
525 | 413 |
t.lib_ocaml; |
526 | 414 |
|
527 | 415 |
(* Declare directories dependencies, replace "include" in _tags. *) |
528 |
List.iter |
|
416 |
List.iter
|
|
529 | 417 |
(fun (dir, include_dirs) -> |
530 | 418 |
Pathname.define_context dir include_dirs) |
531 | 419 |
t.includes; |
... | ... | |
540 | 428 |
|
541 | 429 |
flag ["link"; "library"; "ocaml"; "native"; tag_libstubs lib] |
542 | 430 |
(S[A"-cclib"; A("-l"^(nm_libstubs lib))]); |
543 |
|
|
431 |
|
|
544 | 432 |
flag ["link"; "program"; "ocaml"; "byte"; tag_libstubs lib] |
545 | 433 |
(S[A"-dllib"; A("dll"^(nm_libstubs lib))]); |
546 | 434 |
|
... | ... | |
555 | 443 |
|
556 | 444 |
(* TODO: be more specific about what depends on headers *) |
557 | 445 |
(* Depends on .h files *) |
558 |
dep ["compile"; "c"] |
|
446 |
dep ["compile"; "c"]
|
|
559 | 447 |
headers; |
560 | 448 |
|
561 | 449 |
(* Setup search path for lib *) |
562 |
flag ["link"; "ocaml"; "use_"^lib] |
|
450 |
flag ["link"; "ocaml"; "use_"^lib]
|
|
563 | 451 |
(S[A"-I"; P(dir)]); |
564 | 452 |
) |
565 | 453 |
t.lib_c; |
... | ... | |
567 | 455 |
(* Add flags *) |
568 | 456 |
List.iter |
569 | 457 |
(fun (tags, cond_specs) -> |
570 |
let spec = BaseEnvLight.var_choose cond_specs env in |
|
571 |
let rec eval_specs = |
|
572 |
function |
|
573 |
| S lst -> S (List.map eval_specs lst) |
|
574 |
| A str -> A (BaseEnvLight.var_expand str env) |
|
575 |
| spec -> spec |
|
458 |
let spec = |
|
459 |
BaseEnvLight.var_choose cond_specs env |
|
576 | 460 |
in |
577 |
flag tags & (eval_specs spec))
|
|
461 |
flag tags & spec)
|
|
578 | 462 |
t.flags |
579 |
| _ -> |
|
463 |
| _ ->
|
|
580 | 464 |
() |
581 | 465 |
|
582 |
|
|
583 | 466 |
let dispatch_default t = |
584 |
dispatch_combine |
|
467 |
dispatch_combine
|
|
585 | 468 |
[ |
586 | 469 |
dispatch t; |
587 | 470 |
MyOCamlbuildFindlib.dispatch; |
588 | 471 |
] |
589 | 472 |
|
590 |
|
|
591 | 473 |
end |
592 | 474 |
|
593 | 475 |
|
594 |
# 594 "myocamlbuild.ml"
|
|
476 |
# 476 "myocamlbuild.ml"
|
|
595 | 477 |
open Ocamlbuild_plugin;; |
596 | 478 |
let package_default = |
597 | 479 |
{MyOCamlbuildBase.lib_ocaml = []; lib_c = []; flags = []; includes = []} |
... | ... | |
599 | 481 |
|
600 | 482 |
let dispatch_default = MyOCamlbuildBase.dispatch_default package_default;; |
601 | 483 |
|
602 |
# 603 "myocamlbuild.ml"
|
|
484 |
# 485 "myocamlbuild.ml"
|
|
603 | 485 |
(* OASIS_STOP *) |
604 | 486 |
Ocamlbuild_plugin.dispatch dispatch_default;; |
setup.ml | ||
---|---|---|
1 | 1 |
(* setup.ml generated for the first time by OASIS v0.2.0 *) |
2 | 2 |
|
3 | 3 |
(* OASIS_START *) |
4 |
(* DO NOT EDIT (digest: d0957d7fdd9eb6ce163190fb18a724b8) *)
|
|
4 |
(* DO NOT EDIT (digest: cbef9780a942e499729218b6c22c21f0) *)
|
|
5 | 5 |
(* |
6 |
Regenerated by OASIS v0.4.4
|
|
6 |
Regenerated by OASIS v0.3.0
|
|
7 | 7 |
Visit http://oasis.forge.ocamlcore.org for more information and |
8 | 8 |
documentation about functions used in this file. |
9 | 9 |
*) |
10 | 10 |
module OASISGettext = struct |
11 |
(* # 22 "src/oasis/OASISGettext.ml" *) |
|
12 |
|
|
11 |
(* # 21 "src/oasis/OASISGettext.ml" *) |
|
13 | 12 |
|
14 | 13 |
let ns_ str = |
15 | 14 |
str |
16 | 15 |
|
17 |
|
|
18 | 16 |
let s_ str = |
19 | 17 |
str |
20 | 18 |
|
21 |
|
|
22 |
let f_ (str: ('a, 'b, 'c, 'd) format4) = |
|
19 |
let f_ (str : ('a, 'b, 'c, 'd) format4) = |
|
23 | 20 |
str |
24 | 21 |
|
25 |
|
|
26 | 22 |
let fn_ fmt1 fmt2 n = |
27 | 23 |
if n = 1 then |
28 | 24 |
fmt1^^"" |
29 | 25 |
else |
30 | 26 |
fmt2^^"" |
31 | 27 |
|
32 |
|
|
33 | 28 |
let init = |
34 | 29 |
[] |
35 | 30 |
|
36 |
|
|
37 | 31 |
end |
38 | 32 |
|
39 | 33 |
module OASISContext = struct |
40 |
(* # 22 "src/oasis/OASISContext.ml" *) |
|
41 |
|
|
34 |
(* # 21 "src/oasis/OASISContext.ml" *) |
|
42 | 35 |
|
43 | 36 |
open OASISGettext |
44 | 37 |
|
45 |
|
|
46 | 38 |
type level = |
47 | 39 |
[ `Debug |
48 | 40 |
| `Info |
49 | 41 |
| `Warning |
50 | 42 |
| `Error] |
51 | 43 |
|
52 |
|
|
53 | 44 |
type t = |
54 | 45 |
{ |
55 |
(* TODO: replace this by a proplist. *) |
|
56 | 46 |
quiet: bool; |
57 | 47 |
info: bool; |
58 | 48 |
debug: bool; |
... | ... | |
61 | 51 |
printf: level -> string -> unit; |
62 | 52 |
} |
63 | 53 |
|
64 |
|
|
65 | 54 |
let printf lvl str = |
66 | 55 |
let beg = |
67 | 56 |
match lvl with |
... | ... | |
72 | 61 |
in |
73 | 62 |
prerr_endline (beg^str) |
74 | 63 |
|
75 |
|
|
76 | 64 |
let default = |
77 | 65 |
ref |
78 | 66 |
{ |
... | ... | |
84 | 72 |
printf = printf; |
85 | 73 |
} |
86 | 74 |
|
87 |
|
|
88 | 75 |
let quiet = |
89 | 76 |
{!default with quiet = true} |
90 | 77 |
|
91 | 78 |
|
92 |
let fspecs () = |
|
93 |
(* TODO: don't act on default. *) |
|
94 |
let ignore_plugins = ref false in |
|
79 |
let args () = |
|
95 | 80 |
["-quiet", |
96 | 81 |
Arg.Unit (fun () -> default := {!default with quiet = true}), |
97 |
s_ " Run quietly";
|
|
82 |
(s_ " Run quietly");
|
|
98 | 83 |
|
99 | 84 |
"-info", |
100 | 85 |
Arg.Unit (fun () -> default := {!default with info = true}), |
101 |
s_ " Display information message";
|
|
86 |
(s_ " Display information message");
|
|
102 | 87 |
|
103 | 88 |
|
104 | 89 |
"-debug", |
105 | 90 |
Arg.Unit (fun () -> default := {!default with debug = true}), |
106 |
s_ " Output debug message"; |
|
107 |
|
|
108 |
"-ignore-plugins", |
|
109 |
Arg.Set ignore_plugins, |
|
110 |
s_ " Ignore plugin's field."; |
|
111 |
|
|
112 |
"-C", |
|
113 |
(* TODO: remove this chdir. *) |
|
114 |
Arg.String (fun str -> Sys.chdir str), |
|
115 |
s_ "dir Change directory before running."], |
|
116 |
fun () -> {!default with ignore_plugins = !ignore_plugins} |
|
91 |
(s_ " Output debug message")] |
|
117 | 92 |
end |
118 | 93 |
|
119 | 94 |
module OASISString = struct |
120 |
(* # 22 "src/oasis/OASISString.ml" *)
|
|
95 |
(* # 1 "src/oasis/OASISString.ml" *)
|
|
121 | 96 |
|
122 | 97 |
|
123 |
(** Various string utilities. |
|
124 | 98 |
|
99 |
(** Various string utilities. |
|
100 |
|
|
125 | 101 |
Mostly inspired by extlib and batteries ExtString and BatString libraries. |
126 | 102 |
|
127 | 103 |
@author Sylvain Le Gall |
128 | 104 |
*) |
129 | 105 |
|
130 |
|
|
131 | 106 |
let nsplitf str f = |
132 | 107 |
if str = "" then |
133 | 108 |
[] |
... | ... | |
148 | 123 |
push (); |
149 | 124 |
List.rev !lst |
150 | 125 |
|
151 |
|
|
152 | 126 |
(** [nsplit c s] Split the string [s] at char [c]. It doesn't include the |
153 | 127 |
separator. |
154 | 128 |
*) |
155 | 129 |
let nsplit str c = |
156 | 130 |
nsplitf str ((=) c) |
157 | 131 |
|
158 |
|
|
159 | 132 |
let find ~what ?(offset=0) str = |
160 | 133 |
let what_idx = ref 0 in |
161 |
let str_idx = ref offset in |
|
162 |
while !str_idx < String.length str && |
|
134 |
let str_idx = ref offset in
|
|
135 |
while !str_idx < String.length str &&
|
|
163 | 136 |
!what_idx < String.length what do |
164 | 137 |
if str.[!str_idx] = what.[!what_idx] then |
165 | 138 |
incr what_idx |
... | ... | |
169 | 142 |
done; |
170 | 143 |
if !what_idx <> String.length what then |
171 | 144 |
raise Not_found |
172 |
else |
|
145 |
else
|
|
173 | 146 |
!str_idx - !what_idx |
174 | 147 |
|
175 |
|
|
176 |
let sub_start str len = |
|
148 |
let sub_start str len = |
|
177 | 149 |
let str_len = String.length str in |
178 | 150 |
if len >= str_len then |
179 | 151 |
"" |
180 | 152 |
else |
181 | 153 |
String.sub str len (str_len - len) |
182 | 154 |
|
183 |
|
|
184 | 155 |
let sub_end ?(offset=0) str len = |
185 | 156 |
let str_len = String.length str in |
186 | 157 |
if len >= str_len then |
... | ... | |
188 | 159 |
else |
189 | 160 |
String.sub str 0 (str_len - len) |
190 | 161 |
|
191 |
|
|
192 | 162 |
let starts_with ~what ?(offset=0) str = |
193 | 163 |
let what_idx = ref 0 in |
194 | 164 |
let str_idx = ref offset in |
195 | 165 |
let ok = ref true in |
196 | 166 |
while !ok && |
197 |
!str_idx < String.length str && |
|
167 |
!str_idx < String.length str &&
|
|
198 | 168 |
!what_idx < String.length what do |
199 | 169 |
if str.[!str_idx] = what.[!what_idx] then |
200 | 170 |
incr what_idx |
... | ... | |
204 | 174 |
done; |
205 | 175 |
if !what_idx = String.length what then |
206 | 176 |
true |
207 |
else |
|
177 |
else
|
|
208 | 178 |
false |
209 | 179 |
|
210 |
|
|
211 | 180 |
let strip_starts_with ~what str = |
212 | 181 |
if starts_with ~what str then |
213 | 182 |
sub_start str (String.length what) |
214 | 183 |
else |
215 | 184 |
raise Not_found |
216 | 185 |
|
217 |
|
|
218 | 186 |
let ends_with ~what ?(offset=0) str = |
219 | 187 |
let what_idx = ref ((String.length what) - 1) in |
220 | 188 |
let str_idx = ref ((String.length str) - 1) in |
221 | 189 |
let ok = ref true in |
222 | 190 |
while !ok && |
223 |
offset <= !str_idx && |
|
191 |
offset <= !str_idx &&
|
|
224 | 192 |
0 <= !what_idx do |
225 | 193 |
if str.[!str_idx] = what.[!what_idx] then |
226 | 194 |
decr what_idx |
... | ... | |
230 | 198 |
done; |
231 | 199 |
if !what_idx = -1 then |
232 | 200 |
true |
233 |
else |
|
201 |
else
|
|
234 | 202 |
false |
235 | 203 |
|
236 |
|
|
237 | 204 |
let strip_ends_with ~what str = |
238 | 205 |
if ends_with ~what str then |
239 | 206 |
sub_end str (String.length what) |
240 | 207 |
else |
241 | 208 |
raise Not_found |
242 | 209 |
|
243 |
|
|
244 | 210 |
let replace_chars f s = |
245 | 211 |
let buf = String.make (String.length s) 'X' in |
246 | 212 |
for i = 0 to String.length s - 1 do |
... | ... | |
248 | 214 |
done; |
249 | 215 |
buf |
250 | 216 |
|
251 |
|
|
252 | 217 |
end |
253 | 218 |
|
254 | 219 |
module OASISUtils = struct |
255 |
(* # 22 "src/oasis/OASISUtils.ml" *) |
|
256 |
|
|
220 |
(* # 21 "src/oasis/OASISUtils.ml" *) |
|
257 | 221 |
|
258 | 222 |
open OASISGettext |
259 | 223 |
|
224 |
module MapString = Map.Make(String) |
|
260 | 225 |
|
261 |
module MapExt = |
|
262 |
struct |
|
263 |
module type S = |
|
264 |
sig |
|
265 |
include Map.S |
|
266 |
val add_list: 'a t -> (key * 'a) list -> 'a t |
|
267 |
val of_list: (key * 'a) list -> 'a t |
|
268 |
val to_list: 'a t -> (key * 'a) list |
|
269 |
end |
|
270 |
|
|
271 |
module Make (Ord: Map.OrderedType) = |
|
272 |
struct |
|
273 |
include Map.Make(Ord) |
|
274 |
|
|
275 |
let rec add_list t = |
|
276 |
function |
|
277 |
| (k, v) :: tl -> add_list (add k v t) tl |
|
278 |
| [] -> t |
|
279 |
|
|
280 |
let of_list lst = add_list empty lst |
|
281 |
|
|
282 |
let to_list t = fold (fun k v acc -> (k, v) :: acc) t [] |
|
283 |
end |
|
284 |
end |
|
285 |
|
|
286 |
|
|
287 |
module MapString = MapExt.Make(String) |
|
288 |
|
|
289 |
|
|
290 |
module SetExt = |
|
291 |
struct |
|
292 |
module type S = |
|
293 |
sig |
|
294 |
include Set.S |
|
295 |
val add_list: t -> elt list -> t |
|
296 |
val of_list: elt list -> t |
|
297 |
val to_list: t -> elt list |
|
298 |
end |
|
299 |
|
|
300 |
module Make (Ord: Set.OrderedType) = |
|
301 |
struct |
|
302 |
include Set.Make(Ord) |
|
303 |
|
|
304 |
let rec add_list t = |
|
305 |
function |
|
306 |
| e :: tl -> add_list (add e t) tl |
|
307 |
| [] -> t |
|
308 |
|
|
309 |
let of_list lst = add_list empty lst |
|
226 |
let map_string_of_assoc assoc = |
|
227 |
List.fold_left |
|
228 |
(fun acc (k, v) -> MapString.add k v acc) |
|
229 |
MapString.empty |
|
230 |
assoc |
|
310 | 231 |
|
311 |
let to_list = elements |
|
312 |
end |
|
313 |
end |
|
232 |
module SetString = Set.Make(String) |
|
314 | 233 |
|
234 |
let set_string_add_list st lst = |
|
235 |
List.fold_left |
|
236 |
(fun acc e -> SetString.add e acc) |
|
237 |
st |
|
238 |
lst |
|
315 | 239 |
|
316 |
module SetString = SetExt.Make(String) |
|
240 |
let set_string_of_list = |
|
241 |
set_string_add_list |
|
242 |
SetString.empty |
|
317 | 243 |
|
318 | 244 |
|
319 | 245 |
let compare_csl s1 s2 = |
320 | 246 |
String.compare (String.lowercase s1) (String.lowercase s2) |
321 | 247 |
|
322 |
|
|
323 | 248 |
module HashStringCsl = |
324 | 249 |
Hashtbl.Make |
325 | 250 |
(struct |
... | ... | |
332 | 257 |
Hashtbl.hash (String.lowercase s) |
333 | 258 |
end) |
334 | 259 |
|
335 |
module SetStringCsl = |
|
336 |
SetExt.Make |
|
337 |
(struct |
|
338 |
type t = string |
|
339 |
let compare = compare_csl |
|
340 |
end) |
|
341 |
|
|
342 |
|
|
343 | 260 |
let varname_of_string ?(hyphen='_') s = |
344 | 261 |
if String.length s = 0 then |
345 | 262 |
begin |
... | ... | |
370 | 287 |
String.lowercase buf |
371 | 288 |
end |
372 | 289 |
|
373 |
|
|
374 | 290 |
let varname_concat ?(hyphen='_') p s = |
375 | 291 |
let what = String.make 1 hyphen in |
376 | 292 |
let p = |
... | ... | |
391 | 307 |
let is_varname str = |
392 | 308 |
str = varname_of_string str |
393 | 309 |
|
394 |
|
|
395 | 310 |
let failwithf fmt = Printf.ksprintf failwith fmt |
396 | 311 |
|
397 |
|
|
398 | 312 |
end |
399 | 313 |
|
400 | 314 |
module PropList = struct |
401 |
(* # 22 "src/oasis/PropList.ml" *) |
|
402 |
|
|
315 |
(* # 21 "src/oasis/PropList.ml" *) |
|
403 | 316 |
|
404 | 317 |
open OASISGettext |
405 | 318 |
|
406 |
|
|
407 | 319 |
type name = string |
408 | 320 |
|
409 |
|
|
410 | 321 |
exception Not_set of name * string option |
411 | 322 |
exception No_printer of name |
412 | 323 |
exception Unknown_field of name * name |
413 | 324 |
|
414 |
|
|
415 | 325 |
let () = |
416 | 326 |
Printexc.register_printer |
417 | 327 |
(function |
418 | 328 |
| Not_set (nm, Some rsn) -> |
419 |
Some |
|
329 |
Some
|
|
420 | 330 |
(Printf.sprintf (f_ "Field '%s' is not set: %s") nm rsn) |
421 | 331 |
| Not_set (nm, None) -> |
422 |
Some |
|
332 |
Some
|
|
423 | 333 |
(Printf.sprintf (f_ "Field '%s' is not set") nm) |
424 | 334 |
| No_printer nm -> |
425 | 335 |
Some |
426 | 336 |
(Printf.sprintf (f_ "No default printer for value %s") nm) |
427 | 337 |
| Unknown_field (nm, schm) -> |
428 |
Some |
|
429 |
(Printf.sprintf |
|
430 |
(f_ "Field %s is not defined in schema %s") nm schm) |
|
338 |
Some |
|
339 |
(Printf.sprintf (f_ "Field %s is not defined in schema %s") nm schm) |
|
431 | 340 |
| _ -> |
432 | 341 |
None) |
433 | 342 |
|
434 |
|
|
435 | 343 |
module Data = |
436 | 344 |
struct |
345 |
|
|
437 | 346 |
type t = |
438 | 347 |
(name, unit -> unit) Hashtbl.t |
439 | 348 |
|
... | ... | |
443 | 352 |
let clear t = |
444 | 353 |
Hashtbl.clear t |
445 | 354 |
|
446 |
|
|
447 |
(* # 78 "src/oasis/PropList.ml" *) |
|
355 |
(* # 71 "src/oasis/PropList.ml" *) |
|
448 | 356 |
end |
449 | 357 |
|
450 |
|
|
451 | 358 |
module Schema = |
452 | 359 |
struct |
360 |
|
|
453 | 361 |
type ('ctxt, 'extra) value = |
454 | 362 |
{ |
455 | 363 |
get: Data.t -> string; |
... | ... | |
537 | 445 |
t.name |
538 | 446 |
end |
539 | 447 |
|
540 |
|
|
541 | 448 |
module Field = |
542 | 449 |
struct |
450 |
|
|
543 | 451 |
type ('ctxt, 'value, 'extra) t = |
544 | 452 |
{ |
545 | 453 |
set: Data.t -> ?context:'ctxt -> 'value -> unit; |
... | ... | |
669 | 577 |
|
670 | 578 |
let fgets data t = |
671 | 579 |
t.gets data |
672 |
end |
|
673 | 580 |
|
581 |
end |
|
674 | 582 |
|
675 | 583 |
module FieldRO = |
676 | 584 |
struct |
585 |
|
|
677 | 586 |
let create ?schema ?name ?parse ?print ?default ?update ?help extra = |
678 | 587 |
let fld = |
679 | 588 |
Field.create ?schema ?name ?parse ?print ?default ?update ?help extra |
680 | 589 |
in |
681 | 590 |
fun data -> Field.fget data fld |
591 |
|
|
682 | 592 |
end |
683 | 593 |
end |
684 | 594 |
|
685 | 595 |
module OASISMessage = struct |
686 |
(* # 22 "src/oasis/OASISMessage.ml" *)
|
|
596 |
(* # 21 "src/oasis/OASISMessage.ml" *)
|
|
687 | 597 |
|
688 | 598 |
|
689 | 599 |
open OASISGettext |
690 | 600 |
open OASISContext |
691 | 601 |
|
692 |
|
|
693 | 602 |
let generic_message ~ctxt lvl fmt = |
694 | 603 |
let cond = |
695 | 604 |
if ctxt.quiet then |
... | ... | |
708 | 617 |
end) |
709 | 618 |
fmt |
710 | 619 |
|
711 |
|
|
712 | 620 |
let debug ~ctxt fmt = |
713 | 621 |
generic_message ~ctxt `Debug fmt |
714 | 622 |
|
715 |
|
|
716 | 623 |
let info ~ctxt fmt = |
717 | 624 |
generic_message ~ctxt `Info fmt |
718 | 625 |
|
719 |
|
|
720 | 626 |
let warning ~ctxt fmt = |
721 | 627 |
generic_message ~ctxt `Warning fmt |
722 | 628 |
|
723 |
|
|
724 | 629 |
let error ~ctxt fmt = |
725 | 630 |
generic_message ~ctxt `Error fmt |
726 | 631 |
|
727 | 632 |
end |
728 | 633 |
|
729 | 634 |
module OASISVersion = struct |
730 |
(* # 22 "src/oasis/OASISVersion.ml" *) |
|
731 |
|
|
635 |
(* # 21 "src/oasis/OASISVersion.ml" *) |
|
732 | 636 |
|
733 | 637 |
open OASISGettext |
734 | 638 |
|
735 | 639 |
|
736 | 640 |
|
737 |
|
|
738 |
|
|
739 | 641 |
type s = string |
740 | 642 |
|
741 |
|
|
742 |
type t = string |
|
743 |
|
|
643 |
type t = string |
|
744 | 644 |
|
745 | 645 |
type comparator = |
746 | 646 |
| VGreater of t |
... | ... | |
750 | 650 |
| VLesserEqual of t |
751 | 651 |
| VOr of comparator * comparator |
752 | 652 |
| VAnd of comparator * comparator |
753 |
|
|
754 |
|
|
653 |
|
|
755 | 654 |
|
756 | 655 |
(* Range of allowed characters *) |
757 | 656 |
let is_digit c = |
758 | 657 |
'0' <= c && c <= '9' |
759 | 658 |
|
760 |
|
|
761 | 659 |
let is_alpha c = |
762 | 660 |
('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') |
763 | 661 |
|
764 |
|
|
765 | 662 |
let is_special = |
766 | 663 |
function |
767 | 664 |
| '.' | '+' | '-' | '~' -> true |
768 | 665 |
| _ -> false |
769 | 666 |
|
770 |
|
|
771 | 667 |
let rec version_compare v1 v2 = |
772 | 668 |
if v1 <> "" || v2 <> "" then |
773 | 669 |
begin |
... | ... | |
811 | 707 |
while !p < String.length v && is_digit v.[!p] do |
812 | 708 |
incr p |
813 | 709 |
done; |
814 |
let substr = |
|
710 |
let substr =
|
|
815 | 711 |
String.sub v !p ((String.length v) - !p) |
816 |
in |
|
817 |
let res = |
|
818 |
match String.sub v start_p (!p - start_p) with |
|
712 |
in
|
|
713 |
let res =
|
|
714 |
match String.sub v start_p (!p - start_p) with
|
|
819 | 715 |
| "" -> 0 |
820 | 716 |
| s -> int_of_string s |
821 | 717 |
in |
... | ... | |
851 | 747 |
|
852 | 748 |
let version_of_string str = str |
853 | 749 |
|
854 |
|
|
855 | 750 |
let string_of_version t = t |
856 | 751 |
|
857 |
|
|
858 |
let version_compare_string s1 s2 = |
|
859 |
version_compare (version_of_string s1) (version_of_string s2) |
|
860 |
|
|
861 |
|
|
862 | 752 |
let chop t = |
863 | 753 |
try |
864 | 754 |
let pos = |
... | ... | |
868 | 758 |
with Not_found -> |
869 | 759 |
t |
870 | 760 |
|
871 |
|
|
872 | 761 |
let rec comparator_apply v op = |
873 | 762 |
match op with |
874 | 763 |
| VGreater cv -> |
... | ... | |
886 | 775 |
| VAnd (op1, op2) -> |
887 | 776 |
(comparator_apply v op1) && (comparator_apply v op2) |
888 | 777 |
|
889 |
|
|
890 | 778 |
let rec string_of_comparator = |
891 | 779 |
function |
892 | 780 |
| VGreater v -> "> "^(string_of_version v) |
... | ... | |
899 | 787 |
| VAnd (c1, c2) -> |
900 | 788 |
(string_of_comparator c1)^" && "^(string_of_comparator c2) |
901 | 789 |
|
902 |
|
|
903 | 790 |
let rec varname_of_comparator = |
904 | 791 |
let concat p v = |
905 | 792 |
OASISUtils.varname_concat |
... | ... | |
918 | 805 |
| VAnd (c1, c2) -> |
919 | 806 |
(varname_of_comparator c1)^"_and_"^(varname_of_comparator c2) |
920 | 807 |
|
921 |
|
|
922 |
let rec comparator_ge v' = |
|
923 |
let cmp v = version_compare v v' >= 0 in |
|
924 |
function |
|
925 |
| VEqual v |
|
926 |
| VGreaterEqual v |
|
927 |
| VGreater v -> cmp v |
|
928 |
| VLesserEqual _ |
|
929 |
| VLesser _ -> false |
|
930 |
| VOr (c1, c2) -> comparator_ge v' c1 || comparator_ge v' c2 |
|
931 |
| VAnd (c1, c2) -> comparator_ge v' c1 && comparator_ge v' c2 |
|
932 |
|
|
808 |
let version_0_3_or_after t = |
|
809 |
comparator_apply t (VGreaterEqual (string_of_version "0.3")) |
|
933 | 810 |
|
934 | 811 |
end |
935 | 812 |
|
936 | 813 |
module OASISLicense = struct |
937 |
(* # 22 "src/oasis/OASISLicense.ml" *) |
|
938 |
|
|
814 |
(* # 21 "src/oasis/OASISLicense.ml" *) |
|
939 | 815 |
|
940 | 816 |
(** License for _oasis fields |
941 | 817 |
@author Sylvain Le Gall |
... | ... | |
943 | 819 |
|
944 | 820 |
|
945 | 821 |
|
822 |
type license = string |
|
946 | 823 |
|
947 |
|
|
948 |
type license = string |
|
949 |
|
|
950 |
|
|
951 |
type license_exception = string |
|
952 |
|
|
824 |
type license_exception = string |
|
953 | 825 |
|
954 | 826 |
type license_version = |
955 | 827 |
| Version of OASISVersion.t |
956 | 828 |
| VersionOrLater of OASISVersion.t |
957 | 829 |
| NoVersion |
958 |
|
|
959 |
|
|
830 |
|
|
960 | 831 |
|
961 | 832 |
type license_dep_5_unit = |
962 | 833 |
{ |
... | ... | |
964 | 835 |
excption: license_exception option; |
965 | 836 |
version: license_version; |
966 | 837 |
} |
967 |
|
|
968 |
|
|
838 |
|
|
969 | 839 |
|
970 | 840 |
type license_dep_5 = |
971 | 841 |
| DEP5Unit of license_dep_5_unit |
972 | 842 |
| DEP5Or of license_dep_5 list |
973 | 843 |
| DEP5And of license_dep_5 list |
974 |
|
|
844 |
|
|
975 | 845 |
|
976 | 846 |
type t = |
977 | 847 |
| DEP5License of license_dep_5 |
978 | 848 |
| OtherLicense of string (* URL *) |
979 |
|
|
980 |
|
|
849 |
|
|
981 | 850 |
|
982 | 851 |
end |
983 | 852 |
|
984 | 853 |
module OASISExpr = struct |
985 |
(* # 22 "src/oasis/OASISExpr.ml" *) |
|
986 |
|
|
987 |
|
|
854 |
(* # 21 "src/oasis/OASISExpr.ml" *) |
|
988 | 855 |
|
989 | 856 |
|
990 | 857 |
|
991 | 858 |
open OASISGettext |
992 | 859 |
|
860 |
type test = string |
|
993 | 861 |
|
994 |
type test = string |
|
995 |
|
|
996 |
|
|
997 |
type flag = string |
|
998 |
|
|
862 |
type flag = string |
|
999 | 863 |
|
1000 | 864 |
type t = |
1001 | 865 |
| EBool of bool |
... | ... | |
1004 | 868 |
| EOr of t * t |
1005 | 869 |
| EFlag of flag |
1006 | 870 |
| ETest of test * string |
871 |
|
|
1007 | 872 |
|
1008 |
|
|
1009 |
|
|
1010 |
type 'a choices = (t * 'a) list |
|
1011 |
|
|
873 |
type 'a choices = (t * 'a) list |
|
1012 | 874 |
|
1013 | 875 |
let eval var_get t = |
1014 | 876 |
let rec eval' = |
... | ... | |
1040 | 902 |
in |
1041 | 903 |
eval' t |
1042 | 904 |
|
1043 |
|
|
1044 | 905 |
let choose ?printer ?name var_get lst = |
1045 | 906 |
let rec choose_aux = |
1046 | 907 |
function |
... | ... | |
1077 | 938 |
in |
1078 | 939 |
choose_aux (List.rev lst) |
1079 | 940 |
|
1080 |
|
|
1081 |
end |
|
1082 |
|
|
1083 |
module OASISText = struct |
|
1084 |
(* # 22 "src/oasis/OASISText.ml" *) |
|
1085 |
|
|
1086 |
|
|
1087 |
|
|
1088 |
type elt = |
|
1089 |
| Para of string |
|
1090 |
| Verbatim of string |
|
1091 |
| BlankLine |
|
1092 |
|
|
1093 |
|
|
1094 |
type t = elt list |
|
1095 |
|
|
1096 | 941 |
end |
1097 | 942 |
|
1098 | 943 |
module OASISTypes = struct |
1099 |
(* # 22 "src/oasis/OASISTypes.ml" *) |
|
1100 |
|
|
1101 |
|
|
944 |
(* # 21 "src/oasis/OASISTypes.ml" *) |
|
1102 | 945 |
|
1103 | 946 |
|
1104 | 947 |
|
1105 |
type name = string |
|
1106 |
type package_name = string |
|
1107 |
type url = string |
|
1108 |
type unix_dirname = string |
|
1109 |
type unix_filename = string |
|
1110 |
type host_dirname = string |
|
1111 |
type host_filename = string |
|
1112 |
type prog = string |
|
1113 |
type arg = string |
|
1114 |
type args = string list |
|
1115 |
type command_line = (prog * arg list) |
|
1116 | 948 |
|
949 |
type name = string |
|
950 |
type package_name = string |
|
951 |
type url = string |
|
952 |
type unix_dirname = string |
|
953 |
type unix_filename = string |
|
954 |
type host_dirname = string |
|
955 |
type host_filename = string |
|
956 |
type prog = string |
|
957 |
type arg = string |
|
958 |
type args = string list |
|
959 |
type command_line = (prog * arg list) |
|
1117 | 960 |
|
1118 |
type findlib_name = string |
|
1119 |
type findlib_full = string |
|
1120 |
|
|
961 |
type findlib_name = string |
|
962 |
type findlib_full = string |
|
1121 | 963 |
|
1122 | 964 |
type compiled_object = |
1123 | 965 |
| Byte |
1124 | 966 |
| Native |
1125 | 967 |
| Best |
1126 |
|
|
1127 |
|
|
968 |
|
|
1128 | 969 |
|
1129 | 970 |
type dependency = |
1130 | 971 |
| FindlibPackage of findlib_full * OASISVersion.comparator option |
1131 | 972 |
| InternalLibrary of name |
1132 |
|
|
1133 |
|
|
973 |
|
|
1134 | 974 |
|
1135 | 975 |
type tool = |
1136 | 976 |
| ExternalTool of name |
1137 | 977 |
| InternalExecutable of name |
1138 |
|
|
1139 |
|
|
978 |
|
|
1140 | 979 |
|
1141 | 980 |
type vcs = |
1142 | 981 |
| Darcs |
... | ... | |
1148 | 987 |
| Arch |
1149 | 988 |
| Monotone |
1150 | 989 |
| OtherVCS of url |
1151 |
|
|
1152 |
|
|
990 |
|
|
1153 | 991 |
|
1154 | 992 |
type plugin_kind = |
1155 | 993 |
[ `Configure |
... | ... | |
1160 | 998 |
| `Extra |
1161 | 999 |
] |
1162 | 1000 |
|
Also available in: Unified diff
corrected a bug that made an error silent, confusing users...
git-svn-id: https://cavale.enseeiht.fr/svn/lustrec/lustre_compiler/trunk@370 041b043f-8d7c-46b2-b46e-ef0dd855326e