susu #7702(2008/09/24 14:59 GMT) [ OCaml ] Rating0/0=0.00
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
(* lv -Oej xx.ml > xx-ej.ml euc-jpでない場合の変換 xterm -en euc-jp & ocaml -I +extlib extLib.cma xx-ej.ml *)(* スクリプト用途時 #!/usr/bin/env ocaml #directory "+extlib";; #load "extLib.cma";; *) let get = OptParse.Opt.get let opt = OptParse.Opt.opt let switch t = if t then "ON" else "OFF" let debug = function | Some (0 | 1 | 2 as n) -> string_of_int n | _ -> "-";; let t = OptParse.OptParser.make ~usage: "cmdopt -o [-q] [-d{0|1|2}] 文字列 [文字列 ...]" () and o = OptParse.StdOpt.store_true () and q = OptParse.StdOpt.store_true () and d = OptParse.StdOpt.int_option ();; OptParse.OptParser.add ~short_name:'o' t o; OptParse.OptParser.add ~short_name:'q' t q; OptParse.OptParser.add ~short_name:'d' t d;; let opts_form = format_of_string "\ [オプション情報] \n\ o(output) : %s \n\ q(quote) : %s \n\ d(debug) : %2s \n\n" let opts_info () = if not (get o) then (print_string "-o オプションがありません。\n"; exit 0) else Printf.printf opts_form (switch (get o)) (switch (get q)) (debug (opt d)) let params_info l = Printf.printf "[パラメータ情報]\n指定数 : %d \n" (List.length l); ExtList.List.iteri (fun i s -> Printf.printf "%d : %s \n" (i+1) s) l;; let _ = if !Sys.interactive then () else let rest = OptParse.OptParser.parse_argv t in (opts_info (); params_info rest);;
Rating0/0=0.00-0+
[ reply ]
susu
#7702()
[
OCaml
]
Rating0/0=0.00
それと、実行結果が文字化けしたらコンソールをeucで起動してください。
Rating0/0=0.00-0+
[ reply ]