Permalink
Browse files

Tidy

  • Loading branch information...
1 parent 5eaa047 commit 5cba00e9e6e2352cc79c1d2e6011b2d8daff9ac7 Anastasia Gornostaeva committed Jan 15, 2010
View
@@ -1,4 +1,4 @@
-Copyright (c) 2004-2009, by Anastasia Gornostaeva
+Copyright (c) 2004-2010, by Anastasia Gornostaeva
All rights reserved.
Redistribution and use in source and binary forms, with or without
View
1 _tags
@@ -8,7 +8,6 @@
<sqlgg_sqlite3.ml>: use_sqlite3
"find_url.ml": camlp4o, use_ulex.syntax, use_ulex, -warn_A, -warn_error_A
"http_suck.ml": thread, use_equeue, use_netclient, use_netstring
-<sqlite_util.ml>: use_sqlite3
<*_ulex.ml>: camlp4o, use_ulex.syntax, use_ulex, -warn_A, -warn_error_A
"conv_xml.ml": use_conversion
View
2 acl.ml
@@ -1,5 +1,5 @@
(*
- * (c) 2004-2009 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
+ * (c) 2004-2010 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
*)
open JID
View
@@ -1,5 +1,5 @@
(*
- * (c) 2004-2009 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
+ * (c) 2004-2010 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
*)
let string_after s n =
View
@@ -1,5 +1,5 @@
(*
- * (c) 2004-2009 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
+ * (c) 2004-2010 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
*)
open Arg
@@ -202,7 +202,7 @@ let read_config = function
let version () =
Printf.printf
- "%s %s (c) 2004-2009, Anastasia Gornostaeva <ermine@ermine.pp.ru>\n"
+ "%s %s (c) 2004-2010, Anastasia Gornostaeva <ermine@ermine.pp.ru>\n"
Version.name
Version.version;
Pervasives.exit 0
View
@@ -1,5 +1,5 @@
(*
- * (c) 2004-2009 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
+ * (c) 2004-2010 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
*)
open Conversion
View
@@ -1,5 +1,5 @@
(*
- * (c) 2005-2009 Anastasia Gornostaeva <ermine@ermine.pp.ru>
+ * (c) 2005-2010 Anastasia Gornostaeva <ermine@ermine.pp.ru>
*
* Searches potentional url in text and replace it into hyperlink
*
View
@@ -1,5 +1,5 @@
(*
- * (c) 2004-2009 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
+ * (c) 2004-2010 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
*)
open XMPP
View
@@ -1,6 +1,6 @@
%{
(*
- * (c) 2004-2009 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
+ * (c) 2004-2010 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
*)
open Printf
View
@@ -1,5 +1,5 @@
(*
- * (c) 2004-2009 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
+ * (c) 2004-2010 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
*)
open Icalc
View
2 iq.ml
@@ -1,5 +1,5 @@
(*
- * (c) 2004-2009 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
+ * (c) 2004-2010 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
*)
open XMPP
View
@@ -1,5 +1,5 @@
(*
- * (c) 2004-2009 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
+ * (c) 2004-2010 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
*)
open Common
View
@@ -1,5 +1,5 @@
(*
- * (c) 2004-2009 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
+ * (c) 2004-2010 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
*)
exception MathNumberTooBig
View
4 muc.ml
@@ -1,5 +1,5 @@
(*
- * (c) 2004-2009 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
+ * (c) 2004-2010 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
*)
open Xml
@@ -673,7 +673,7 @@ let get_int ?exn opts name1 name2 default =
let plugin opts =
let max_public_message_length = get_int
- ~exn:(Plugin.PluginError "'max_public_message_length' must be an integer")
+ ~exn:(Plugin.Error "'max_public_message_length' must be an integer")
opts "value" "max_public_message_length" 400 in
let file = get_value opts "db" "file" "sulci_muc.db" in
let default_mynick =
View
@@ -1,5 +1,5 @@
(*
- * (c) 2004-2009 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
+ * (c) 2004-2010 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
*)
open Unix
@@ -224,7 +224,7 @@ let process_message ctx muc_context xmpp env stanza hooks =
let plugin opts =
let basedir = get_value opts "dir" "chatlogs" "chatlogs" in
if not (Sys.file_exists basedir) then
- raise (Plugin.PluginError "%d does not exist");
+ raise (Plugin.Error (Printf.sprintf "%s does not exist" basedir));
Muc.add_for_muc_context
(fun muc_context xmpp ->
let ctx = {
View
@@ -1,8 +1,6 @@
open Ocamlbuild_plugin
open Myocamlbuild_config
-let install_dir = "/tmp/sulci20"
-
let _ =
let f = Unix.open_process_in "git describe --always" in
let answer = input_line f in
@@ -138,34 +136,31 @@ let _ = dispatch begin function
A src; Sh">"; A dst])
);
- rule "install sulci"
- ~prod:"install"
- ~deps:["sulci.native";
- "sulci.conf.example";
- "decoders";
- "conversion/data/aliases.ini";
- "lang_msgs";
- "tlds/tlds.db"]
- (fun _ _ ->
- Seq [Cmd (S[A"cp"; Px "sulci.native";
- P(install_dir / "sulci")]);
- Cmd (S[A"cp"; P"sulci.conf.example";
- P install_dir]);
- Cmd (S[A"mkdir"; A"-p"; P (install_dir / "lang")]);
- Cmd (S[A"cp"; Sh"lang/*.htbl";
- P (install_dir / "lang")]);
-(*
- Cmd (S[A"mkdir"; A"-p"; P conversion_decoder_dir]);
- Cmd (S[A"cp"; Sh"conversion/data/decoders/*.dec";
- P conversion_decoder_dir]);
- Cmd (S[A"cp"; P"conversion/data/aliases.ini";
- P conversion_aliases_ini]);
- Cmd (S[A"mkdir"; A"-p"; P (install_dir / "tlds")]);
- Cmd (S[A"cp"; P"tlds/tlds.db";
- P (install_dir / "tlds")])
-*)
- ]
- )
+ let sulci_exe =
+ List.fold_left (fun acc (file, flag) ->
+ if flag then file :: acc else acc
+ ) [] ["sulci.byte", bytecode;
+ "sulci.native", nativecode] in
+
+ rule "install sulci"
+ ~prod:"install"
+ ~deps:(sulci_exe @ ["sulci.conf.example";
+ "lang_msgs";
+ "tlds/tlds.db"])
+ (fun _ _ ->
+ let install_dir = get_install_dir () in
+ Seq [Cmd (S[A"cp"; S(List.map (fun f -> Px f) sulci_exe);
+ P(install_dir)]);
+ Cmd (S[A"cp"; P"sulci.conf.example";
+ P install_dir]);
+ Cmd (S[A"mkdir"; A"-p"; P (install_dir / "lang")]);
+ Cmd (S[A"cp"; Sh"lang/*.htbl";
+ P (install_dir / "lang")]);
+ Cmd (S[A"mkdir"; A"-p"; P (install_dir / "tlds")]);
+ Cmd (S[A"cp"; P"tlds/tlds.db";
+ P (install_dir / "tlds")])
+ ]
+ )
| _ ->
View
@@ -2,16 +2,34 @@ open Ocamlbuild_plugin
open Ocamlbuild_pack.Ocamlbuild_where
open Command
+(*
+ * myocamlbuild.config example:
+ * # comment
+ * install_dir=../../site-lib
+ * bytecode=true
+ * nativecode=false
+ * xml=../../site-lib/xml
+ *)
let config =
- let split line =
- let sp = String.index line '=' in
- ((String.sub line 0 sp),
- (String.sub line (sp+1) (String.length line - sp - 1)))
- in
- if Pathname.exists "myocamlbuild.config" then
- List.map split (string_list_of_file "myocamlbuild.config")
- else
- []
+ if not (Pathname.exists "myocamlbuild.config") then
+ []
+ else
+ List.fold_left (fun acc line ->
+ if line.[0] = '#' then
+ acc
+ else
+ let sp = String.index line '=' in
+ let pair = ((String.sub line 0 sp),
+ (String.sub line (sp+1)
+ (String.length line - sp - 1))) in
+ pair :: acc
+ ) [] (string_list_of_file "myocamlbuild.config")
+
+let get_install_dir () =
+ try List.assoc "install_dir" config
+ with Not_found ->
+ Printf.printf "Please specify install_dir parameter in myocamlbuild.config";
+ exit 1
let ocamlfind_query pkg =
let cmd = Printf.sprintf
@@ -80,13 +98,10 @@ let make_binding ?include_dir ?lib_dir ~lib ?headers name =
);
(match include_dir with
- | None ->
- flag ["c"; "compile"; ("include_" ^ name ^ "_clib")] &
- S[A"-ccopt"; A"-ggdb"]
-
+ | None -> ()
| Some dir ->
flag ["c"; "compile"; ("include_" ^ name ^ "_clib")] &
- S[A"-ccopt"; A"-ggdb"; A"-ccopt"; A dir]
+ S[A"-ccopt"; A dir]
);
flag ["link"; "ocaml"; "library"; ("use_" ^ name ^ "_clib")] &
@@ -116,9 +131,10 @@ let make_binding ?include_dir ?lib_dir ~lib ?headers name =
| Some h ->
dep ["compile"; "c"] h
-let install_dir = "../../site-lib"
-let bytecode = true
-let nativecode = true
+let bytecode =
+ try bool_of_string (List.assoc "bytecode" config) with Not_found -> true
+let nativecode =
+ try bool_of_string (List.assoc "nativecode" config) with Not_found -> true
let make_deps name =
if bytecode then
@@ -133,21 +149,31 @@ let install_lib name ?cma modules =
| Some v -> v
in
let deps = make_deps cma in
- rule "Install"
+ rule "Install Library"
~prod:"install"
~deps
(fun env _build ->
+ let install_dir = get_install_dir () in
let deps = List.map (fun file -> A file) deps in
let mllib =
let mllib = cma -.- "mllib" in
if Pathname.exists mllib then
- let l =
- List.map String.uncapitalize (string_list_of_file mllib) in
+ let l = string_list_of_file mllib in
+ let add_cmi file acc =
+ if Pathname.exists (file -.- "mli") then
+ A (file -.- "mli") :: A (file -.- "cmi") :: acc
+ else
+ A (file -.- "cmi") :: acc
+ in
List.fold_left (fun acc f ->
- if Pathname.exists (f -.- "mli") then
- A (f -.- "mli") :: A (f -.- "cmi") :: acc
+ if Pathname.exists (f -.- "cmi") then
+ add_cmi f acc
else
- A (f -.- "cmi") :: acc
+ let f = String.uncapitalize f in
+ if Pathname.exists (f -.- "cmi") then
+ add_cmi f acc
+ else
+ acc
) [A (cma -.- "a")] l
else if Pathname.exists (cma -.- "mli") then
[A (cma -.- "mli") ; A (cma -.- "cmi")]
View
@@ -1,6 +1,6 @@
%{
(*
- * (c) 2004-2009 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
+ * (c) 2004-2010 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
*)
open Printf
View
@@ -1,6 +1,6 @@
{
(*
- * (c) 2004-2009 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
+ * (c) 2004-2010 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
*)
open Pcalc
View
@@ -1,10 +1,10 @@
(*
- * (c) 2004-2009 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
+ * (c) 2004-2010 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
*)
open Hooks
-exception PluginError of string
+exception Error of string
let pluginlist :
((string * ((string * (string * string) list) list -> unit)) list) ref
View
@@ -1,5 +1,5 @@
(*
- * (c) 2008-2009 Anastasia Gornostaeva <ermine@ermine.pp.ru>
+ * (c) 2008-2010 Anastasia Gornostaeva <ermine@ermine.pp.ru>
*)
open XMPP
View
@@ -1,5 +1,5 @@
(*
- * (c) 2004-2009 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
+ * (c) 2004-2010 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
*)
open XMPP
View
@@ -1,5 +1,5 @@
(*
- * (c) 2004-2009 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
+ * (c) 2004-2010 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
*)
open XMPP
View
@@ -1,5 +1,5 @@
(*
- * (c) 2009 Anastasia Gornostaeva <ermine@ermine.pp.ru>
+ * (c) 2010 Anastasia Gornostaeva <ermine@ermine.pp.ru>
*)
open Hooks
View
@@ -1,5 +1,5 @@
(*
- * (c) 2004-2009 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
+ * (c) 2004-2010 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
*)
open Common
View
@@ -1,5 +1,5 @@
(*
- * (c) 2004-2009 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
+ * (c) 2004-2010 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
*)
open XMPP
View
@@ -1,5 +1,5 @@
(*
- * (c) 2004-2009 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
+ * (c) 2004-2010 Anastasia Gornostaeva. <ermine@ermine.pp.ru>
*)
open XMPP
Oops, something went wrong.

0 comments on commit 5cba00e

Please sign in to comment.