Typing 'make doc' will generate documentation for the libraries in xen-api-libs. The documentation is integrated in the xen-api documentation (the custom ocamldoc generator in xen-api.hg is used). This only works when xen-api.hg is present in myrepos and 'make doc' has been executed in it.
Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
.PHONY: xapi-libs
xapi-libs: $(OUTPUT_XAPI_PKG) $(MY_SOURCES)/MANIFEST
@ :
+
+.PHONY: doc
+doc:
+ $(MAKE) -C stdext doc
+ $(MAKE) -C sexpr doc
+ $(MAKE) -C uuid doc
+ $(MAKE) -C log doc
+ $(MAKE) -C xb doc
+ $(MAKE) -C xc doc
+ $(MAKE) -C xs doc
+ $(MAKE) -C xml-light2 doc
+ $(MAKE) -C rpc-light doc
+ $(MAKE) -C http-svr doc
+ $(MAKE) -C camldm doc
+ $(MAKE) -C cdrom doc
+ $(MAKE) -C close-and-exec doc
+ $(MAKE) -C eventchn doc
+ $(MAKE) -C pciutil doc
+ $(MAKE) -C rss doc
+ $(MAKE) -C stunnel doc
+ $(MAKE) -C xsrpc doc
+ $(MAKE) -C mmap doc
.PHONY: clean
clean:
make -C http-svr clean
make -C close-and-exec clean
make -C sexpr clean
+ make -C doc clean
rm -f $(OUTPUT_API_PKG)
cleanxen:
INTF = $(foreach obj, $(OBJS),$(obj).cmi)
LIBS = camldm.cma camldm.cmxa
+DOCDIR = /myrepos/xen-api-libs.hg/doc
+
all: $(INTF) $(LIBS) $(PROGRAMS)
bins: $(PROGRAMS)
uninstall:
ocamlfind remove camldm
+.PHONY: doc
+doc: $(INTF)
+ python ../doc/doc.py $(DOCDIR) "camldm" "library" "$(OBJS)" "." "" ""
+
clean:
rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS)
INTF = $(foreach obj, $(OBJS),$(obj).cmi)
LIBS = cdrom.cma cdrom.cmxa
+DOCDIR = /myrepos/xen-api-libs.hg/doc
+
all: $(INTF) $(LIBS) $(PROGRAMS)
bins: $(PROGRAMS)
uninstall:
ocamlfind remove cdrom
+.PHONY: doc
+doc: $(INTF)
+ python ../doc/doc.py $(DOCDIR) "cdrom" "library" "$(OBJS)" "." "" ""
+
clean:
rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS)
PROGRAMS = closeandexec
+DOCDIR = /myrepos/xen-api-libs.hg/doc
+
all: $(INTF) $(LIBS)
bins: $(PROGRAMS)
binuninstall:
rm -f $(DESTDIR)$(LIBEXEC)$(PROGRAMS)
+.PHONY: doc
+doc: $(INTF)
+ python ../doc/doc.py $(DOCDIR) "close-and-exec" "library" "$(OBJS)" "." "stdext" ""
+
clean:
- rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS)
\ No newline at end of file
+ rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS)
docdir = sys.argv[1]
name = sys.argv[2]
-ctype = sys.argv[3]
+if sys.argv[3] == "library": is_library = True
+else: is_library = False
modules = set(sys.argv[4].split())
includes = sys.argv[5].split()
-packs = sys.argv[6].replace(',',' ').split()
-libs = sys.argv[7].split()
-if len(sys.argv) >= 9:
- pp = '-pp ' + sys.argv[8]
-else:
- pp = ''
-
-libs = list(set(libs)) # remove duplicates
-packs = list(set(packs)) # remove duplicates
+packs = sys.argv[6]
+libs = sys.argv[7]
dest = docdir + '/content/' + name
try:
os.makedirs(dest)
except:
pass
+
+packs = packs.replace(',', ' ')
+packs = packs.split()
if len(packs) > 0:
- packages = "-package " + ','.join(packs)
+ packages = "-package " + str(','.join(packs))
else:
packages = ""
-doc_command = 'ocamlfind ocamldoc -v ' + packages + ' -I +threads -sort -g /myrepos/xen-api.hg/ocaml/doc/odoc_json.cma -d ' + dest + ' ' + pp
+doc_command = 'ocamlfind ocamldoc -v ' + packages + ' -I +threads -sort -g /myrepos/xen-api.hg/ocaml/doc/odoc_json.cma -d ' + dest + ' '
files = []
for m in modules:
os.system(doc_command + ' ' + string.join(includesx) + ' ' + string.join(files))
-# add dependencies to index files
+# add library dependencies to index files
f = file(dest + '/index.json', 'a')
-packs_s = map(lambda s: '"' + s.split('/')[-1] + '"', packs)
-libs_s = map(lambda s: '"' + s.split('/')[-1] + '"', libs)
-s = 'deps_' + name.replace("-", "") + ' = {"packs": [' + ', '.join(packs_s) + '], '
-s += '"libs": [' + ', '.join(libs_s) + ']}'
+libs = libs.split()
+libs.extend(packs)
+libs = map(lambda s: '"' + s.split('/')[-1] + '"', libs)
+libs = list(set(libs)) # remove duplicates
+s = 'deps_' + name.replace("-", "") + ' = [' + ', '.join(libs) + '];'
f.write(s)
f.close()
def update_components(compdir):
executables = []
libraries = []
- packages = []
-
+
try:
f = file(compdir + '/components.js', 'r')
exec(f.readline())
exec(f.readline())
- exec(f.readline())
f.close()
except:
pass
- if ctype == "library":
+ if is_library:
libraries.append(name)
libraries = list(set(libraries))
- elif ctype == "package":
- packages.append(name)
- packages = list(set(packages))
else:
executables.append(name)
executables = list(set(executables))
f = file(compdir + '/components.js', 'w')
f.write('executables = ' + str(executables) + '\n')
- f.write('libraries = ' + str(libraries) + '\n')
- f.write('packages = ' + str(packages))
+ f.write('libraries = ' + str(libraries))
f.close()
update_components(docdir)
INTF = $(foreach obj, $(OBJS),$(obj).cmi)
LIBS = eventchn.cma eventchn.cmxa
+DOCDIR = /myrepos/xen-api-libs.hg/doc
+
all: $(INTF) $(LIBS) $(PROGRAMS)
bins: $(PROGRAMS)
uninstall:
ocamlfind remove eventchn
+.PHONY: doc
+doc: $(INTF)
+ python ../doc/doc.py $(DOCDIR) "eventchn" "library" "$(OBJS)" "." "" ""
+
clean:
rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS)
INTF = $(foreach obj, $(OBJS),$(obj).cmi)
LIBS = http_svr.cma http_svr.cmxa
+DOCDIR = /myrepos/xen-api-libs.hg/doc
+
all: $(INTF) $(LIBS)
bins: $(PROGRAMS)
uninstall:
ocamlfind remove http-svr
+.PHONY: doc
+doc: $(INTF)
+ python ../doc/doc.py $(DOCDIR) "http-svr" "library" "$(OBJS)" "." "log,stdext" ""
+
clean:
- rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS)
\ No newline at end of file
+ rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS)
INTF = log.cmi logs.cmi syslog.cmi debug.cmi
LIBS = log.cma log.cmxa
+DOCDIR = /myrepos/xen-api-libs.hg/doc
+
all: $(INTF) $(LIBS) $(PROGRAMS)
bins: $(PROGRAMS)
uninstall:
ocamlfind remove log
+.PHONY: doc
+doc: $(INTF)
+ python ../doc/doc.py $(DOCDIR) "log" "library" "$(OBJS)" "." "stdext" ""
+
clean:
rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS)
INTF = $(foreach obj, $(OBJS),$(obj).cmi)
LIBS = mmap.cma mmap.cmxa
+DOCDIR = /myrepos/xen-api-libs.hg/doc
+
all: $(INTF) $(LIBS) $(PROGRAMS)
bins: $(PROGRAMS)
uninstall:
ocamlfind remove mmap
+.PHONY: doc
+doc: $(INTF)
+ python ../doc/doc.py $(DOCDIR) "mmap" "library" "$(OBJS)" "." "" ""
+
clean:
rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS)
INTF = $(foreach obj, $(OBJS),$(obj).cmi)
LIBS = pciutil.cma pciutil.cmxa
+DOCDIR = /myrepos/xen-api-libs.hg/doc
+
PROGRAMS = pciutil
all: $(INTF) $(LIBS)
binuninstall:
rm -f $(DESTDIR)$(LIBEXEC)$(PROGRAMS)
+.PHONY: doc
+doc: $(INTF)
+ python ../doc/doc.py $(DOCDIR) "pciutil" "library" "$(OBJS)" "." "stdext" ""
+
clean:
- rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS)
\ No newline at end of file
+ rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS)
ICAMLP4=-I $(shell ocamlfind query camlp4) -I $(shell ocamlfind query type-conv)
+DOCDIR = /myrepos/xen-api-libs.hg/doc
+
.PHONY: all clean
all: pa_rpc.cma xmlrpc.cmi xmlrpc.cma xmlrpc.cmxa jsonrpc.cmi jsonrpc.cmxa jsonrpc.cma
ocamlfind remove jsonrpc
ocamlfind remove rpc-light
+.PHONY: doc
+doc: $(INTF)
+ python ../doc/doc.py $(DOCDIR) "rpc-light" "library" "jsonrpc pa_rpc rpc xmlrpc" "." "xmlm" ""
+
clean:
- rm -f *.cmo *.cmx *.cma *.cmxa *.annot *.o *.cmi *.a
\ No newline at end of file
+ rm -f *.cmo *.cmx *.cma *.cmxa *.annot *.o *.cmi *.a
INTF = $(foreach obj, $(OBJS),$(obj).cmi)
LIBS = rss.cma rss.cmxa
+DOCDIR = /myrepos/xen-api-libs.hg/doc
+
all: $(INTF) $(LIBS) $(PROGRAMS)
bins: $(PROGRAMS)
uninstall:
ocamlfind remove rss
+.PHONY: doc
+doc: $(INTF)
+ python ../doc/doc.py $(DOCDIR) "rss" "library" "$(OBJS)" "." "xml-light2" ""
+
clean:
- rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS)
\ No newline at end of file
+ rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS)
PROGRAMS = sexprpp
+DOCDIR = /myrepos/xen-api-libs.hg/doc
+
all: $(INTF) $(LIBS)
bins: $(PROGRAMS)
binuninstall:
rm -f $(DESTDIR)$(LIBEXEC)$(PROGRAMS)
+.PHONY: doc
+doc: $(INTF)
+ python ../doc/doc.py $(DOCDIR) "sexpr" "library" "$(OBJS)" "." "stdext" ""
+
clean:
- rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot sExprLexer.ml{,i} sExprParser.ml{,i} $(LIBS) $(PROGRAMS)
\ No newline at end of file
+ rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot sExprLexer.ml{,i} sExprParser.ml{,i} $(LIBS) $(PROGRAMS)
PROGRAMS = base64pp
+DOCDIR = /myrepos/xen-api-libs.hg/doc
+
all: $(INTF) $(LIBS)
bins: $(PROGRAMS)
binuninstall:
rm -f $(DESTDIR)$(LIBEXEC)$(PROGRAMS)
+.PHONY: doc
+doc: $(INTF)
+ python ../doc/doc.py $(DOCDIR) "stdext" "library" "$(STDEXT_OBJS)" "." "threads,uuid,unix" ""
+
clean:
rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS)
unixext.cmi: filenameext.cmi
gzip.cmi: forkhelpers.cmi
sha1sum.cmi: forkhelpers.cmi
-tar.cmi: bigbuffer.cmi
\ No newline at end of file
+tar.cmi: bigbuffer.cmi
let min_value = 0x000000l
let max_value = 0x1fffffl
- (** Returns true if and only if the given value corresponds to a UCS *)
- (** non-character. Such non-characters are forbidden for use in open *)
- (** interchange of Unicode text data, and include the following: *)
- (** 1. values from 0xFDD0 to 0xFDEF; and *)
- (** 2. values 0xnFFFE and 0xnFFFF, where (0x0 <= n <= 0x10). *)
- (** See the Unicode 5.0 Standard, section 16.7 for further details. *)
let is_non_character value = false
|| (0xfdd0l <= value && value <= 0xfdefl) (* case 1 *)
|| (Int32.logand 0xfffel value = 0xfffel) (* case 2 *)
- (** Returns true if and only if the given value lies outside the *)
- (** entire UCS range. *)
let is_out_of_range value =
value < min_value || value > max_value
- (** Returns true if and only if the given value corresponds to a UCS *)
- (** surrogate code point, only for use in UTF-16 encoded strings. *)
- (** See the Unicode 5.0 Standard, section 16.6 for further details. *)
let is_surrogate value =
(0xd800l <= value && value <= 0xdfffl)
module XML = struct
- (** Returns true if and only if the given value corresponds to *)
- (** a forbidden control character as defined in section 2.2 of *)
- (** the XML specification, version 1.0. *)
let is_forbidden_control_character value = value < 0x20l
&& value <> 0x09l
&& value <> 0x0al
module type UCS_VALIDATOR = sig
- (** Validates UCS character values. *)
val validate : int32 -> unit
end
module UTF8_UCS_validator : UCS_VALIDATOR = struct
- (** Accepts all values within the UCS character value range *)
- (** except those which are invalid for all UTF-8 documents. *)
let validate value =
if UCS.is_out_of_range value then raise UCS_value_out_of_range;
if UCS.is_non_character value then raise UCS_value_prohibited_in_UTF8;
module XML_UTF8_UCS_validator : UCS_VALIDATOR = struct
- (** Accepts all values within the UCS character value range except *)
- (** those which are invalid for all UTF-8-encoded XML documents. *)
let validate value =
UTF8_UCS_validator.validate value;
if XML.is_forbidden_control_character value
(* ==== Character Codecs ==== *)
module type CHARACTER_DECODER = sig
-
- (** Decodes a single character embedded within a string. Given a string *)
- (** and an index into that string, returns a tuple (value, width) where: *)
- (** value = the value of the character at the given index; and *)
- (** width = the width of the character at the given index, in bytes. *)
- (** Raises an appropriate error if the character is invalid. *)
val decode_character : string -> int -> int32 * int
-
end
module type CHARACTER_ENCODER = sig
-
- (** Encodes a single character value, returning a string containing *)
- (** the character. Raises an error if the character value is invalid. *)
val encode_character : int32 -> string
-
end
module UTF8_CODEC (UCS_validator : UCS_VALIDATOR) = struct
-
- (** Given a valid UCS value, returns the canonical *)
- (** number of bytes required to encode the value. *)
let width_required_for_ucs_value value =
if value < 0x000080l (* 1 << 7 *) then 1 else
if value < 0x000800l (* 1 << 11 *) then 2 else
(* === Decoding === *)
- (** Decodes a header byte, returning a tuple (v, w) where: *)
- (** v = the (partial) value contained within the byte; and *)
- (** w = the total width of the encoded character, in bytes. *)
let decode_header_byte byte =
if byte land 0b10000000 = 0b00000000 then (byte , 1) else
if byte land 0b11100000 = 0b11000000 then (byte land 0b0011111, 2) else
if byte land 0b11111000 = 0b11110000 then (byte land 0b0000111, 4) else
raise UTF8_header_byte_invalid
- (** Decodes a continuation byte, returning the *)
- (** 6-bit-wide value contained within the byte. *)
let decode_continuation_byte byte =
if byte land 0b11000000 = 0b10000000 then byte land 0b00111111 else
raise UTF8_continuation_byte_invalid
- (** @see CHARACTER_DECODER.decode_character *)
let decode_character string index =
let value, width = decode_header_byte (Char.code string.[index]) in
let value = if width = 1 then (Int32.of_int value)
(* === Encoding === *)
- (** Encodes a header byte for the given parameters, where: *)
- (** width = the total width of the encoded character, in bytes; *)
- (** value = the most significant bits of the original UCS value. *)
let encode_header_byte width value =
match width with
| 1 -> value
| 4 -> value ||| 0b11110000l
| _ -> raise UCS_value_out_of_range
- (** Encodes a continuation byte from the given UCS *)
- (** remainder value, returning a tuple (b, r), where: *)
- (** b = the continuation byte; *)
- (** r = a new UCS remainder value. *)
let encode_continuation_byte value =
((value &&& 0b00111111l) ||| 0b10000000l, value >>> 6)
- (** @see CHARACTER_ENCODER.encode_character *)
let encode_character value =
UCS_validator.validate value;
let width = width_required_for_ucs_value value in
module String_validator (Decoder : CHARACTER_DECODER) : STRING_VALIDATOR = struct
- (** @see STRING_VALIDATOR.validate *)
let validate string =
let index = ref 0 and length = String.length string in
begin try
| error -> raise (Validation_error (!index, error))
end; assert (!index = length)
- (** @see STRING_VALIDATOR.is_valid *)
let is_valid string =
try validate string; true with _ -> false
- (** @see STRING_VALIDATOR.longest_valid_prefix *)
let longest_valid_prefix string =
try validate string; string
with Validation_error (index, reason) -> String.sub string 0 index
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*)
+(** Encoding helper modules *)
+
+(** {2 Exceptions} *)
+
exception UCS_value_out_of_range
exception UCS_value_prohibited_in_UTF8
exception UCS_value_prohibited_in_XML
exception UTF8_encoding_not_canonical
exception String_incomplete
-(** Provides functionality for validating and processing *)
-(** strings according to a particular character encoding. *)
-module type STRING_VALIDATOR = sig
+(** {2 UCS Validators} *)
- (** Returns true if and only if the given string is validly-encoded. *)
- val is_valid : string -> bool
+(** Validates UCS character values. *)
+module type UCS_VALIDATOR = sig
+ val validate : int32 -> unit
+end
- (** Raises an encoding error if the given string is not validly-encoded. *)
- val validate: string -> unit
+(** Accepts all values within the UCS character value range
+ * except those which are invalid for all UTF-8 documents. *)
+module UTF8_UCS_validator : UCS_VALIDATOR
- (** Returns the longest validly-encoded prefix of the given string. *)
- val longest_valid_prefix : string -> string
+(** Accepts all values within the UCS character value range except
+ * those which are invalid for all UTF-8-encoded XML documents. *)
+module XML_UTF8_UCS_validator : UCS_VALIDATOR
+
+module UCS : sig
+ val min_value : int32
+ val max_value : int32
+
+ (** Returns true if and only if the given value corresponds to a UCS *)
+ (** non-character. Such non-characters are forbidden for use in open *)
+ (** interchange of Unicode text data, and include the following: *)
+ (** 1. values from 0xFDD0 to 0xFDEF; and *)
+ (** 2. values 0xnFFFE and 0xnFFFF, where (0x0 <= n <= 0x10). *)
+ (** See the Unicode 5.0 Standard, section 16.7 for further details. *)
+ val is_non_character : int32 -> bool
+
+ (** Returns true if and only if the given value lies outside the *)
+ (** entire UCS range. *)
+ val is_out_of_range : int32 -> bool
+
+ (** Returns true if and only if the given value corresponds to a UCS *)
+ (** surrogate code point, only for use in UTF-16 encoded strings. *)
+ (** See the Unicode 5.0 Standard, section 16.6 for further details. *)
+ val is_surrogate : int32 -> bool
+end
+
+val (+++) : int32 -> int32 -> int32
+val (---) : int32 -> int32 -> int32
+val (&&&) : int32 -> int32 -> int32
+val (|||) : int32 -> int32 -> int32
+val (<<<) : int32 -> int -> int32
+val (>>>) : int32 -> int -> int32
+module XML : sig
+ (** Returns true if and only if the given value corresponds to *)
+ (** a forbidden control character as defined in section 2.2 of *)
+ (** the XML specification, version 1.0. *)
+ val is_forbidden_control_character : int32 -> bool
end
+(** {2 Character Codecs} *)
+
module type CHARACTER_ENCODER = sig
(** Encodes a single character value, returning a string containing *)
val decode_character : string -> int -> int32 * int
end
-module String_validator (Decoder : CHARACTER_DECODER) : STRING_VALIDATOR
-
-(** Represents a validation error as a tuple (i,e), where: *)
-(** i = the index of the first non-compliant character; *)
-(** e = the reason for non-compliance. *)
-exception Validation_error of int * exn
-
-(** Provides functions for validating and processing *)
-(** strings according to the UTF-8 character encoding. *)
-(** *)
-(** Validly-encoded strings must satisfy RFC 3629. *)
-(** *)
-(** For further information, see: *)
-(** http://www.rfc.net/rfc3629.html *)
-module UTF8 : STRING_VALIDATOR
-
-(** Provides functions for validating and processing *)
-(** strings according to the UTF-8 character encoding, *)
-(** with certain additional restrictions on UCS values *)
-(** imposed by the XML specification. *)
-(** *)
-(** Validly-encoded strings must satisfy both RFC 3629 *)
-(** and section 2.2 of the XML specification. *)
-(** *)
-(** For further information, see: *)
-(** http://www.rfc.net/rfc3629.html *)
-(** http://www.w3.org/TR/REC-xml/#charsets *)
-module UTF8_XML : STRING_VALIDATOR
-
-(** === UCS Validators === *)
-
-module type UCS_VALIDATOR = sig
- (** Validates UCS character values. *)
- val validate : int32 -> unit
-end
-
-module UTF8_UCS_validator : UCS_VALIDATOR
-module XML_UTF8_UCS_validator : UCS_VALIDATOR
-
module UTF8_CODEC (UCS_validator : UCS_VALIDATOR) : sig
(** Given a valid UCS value, returns the canonical *)
(** number of bytes required to encode the value. *)
val width_required_for_ucs_value : int32 -> int
+ (** {3 Decoding} *)
+
(** Decodes a header byte, returning a tuple (v, w) where: *)
(** v = the (partial) value contained within the byte; and *)
(** w = the total width of the encoded character, in bytes. *)
(** Decodes a continuation byte, returning the *)
(** 6-bit-wide value contained within the byte. *)
val decode_continuation_byte : int -> int
-
- (** @see CHARACTER_DECODER.decode_character *)
+
+ (** Decodes a single character embedded within a string. Given a string *)
+ (** and an index into that string, returns a tuple (value, width) where: *)
+ (** value = the value of the character at the given index; and *)
+ (** width = the width of the character at the given index, in bytes. *)
+ (** Raises an appropriate error if the character is invalid. *)
val decode_character : string -> int -> int32 * int
+ (** {3 Encoding} *)
+
(** Encodes a header byte for the given parameters, where: *)
(** width = the total width of the encoded character, in bytes; *)
(** value = the most significant bits of the original UCS value. *)
(** r = a new UCS remainder value. *)
val encode_continuation_byte : int32 -> int32 * int32
- (** @see CHARACTER_ENCODER.encode_character *)
+ (** Encodes a single character value, returning a string containing *)
+ (** the character. Raises an error if the character value is invalid. *)
val encode_character : int32 -> string
end
val encode_character : int32 -> string
end
-module UCS : sig
- val min_value : int32
- val max_value : int32
+(** {2 String Validators} *)
- (** Returns true if and only if the given value corresponds to a UCS *)
- (** non-character. Such non-characters are forbidden for use in open *)
- (** interchange of Unicode text data, and include the following: *)
- (** 1. values from 0xFDD0 to 0xFDEF; and *)
- (** 2. values 0xnFFFE and 0xnFFFF, where (0x0 <= n <= 0x10). *)
- (** See the Unicode 5.0 Standard, section 16.7 for further details. *)
- val is_non_character : int32 -> bool
+(** Provides functionality for validating and processing
+ * strings according to a particular character encoding. *)
+module type STRING_VALIDATOR = sig
+
+ (** Returns true if and only if the given string is validly-encoded. *)
+ val is_valid : string -> bool
+
+ (** Raises an encoding error if the given string is not validly-encoded. *)
+ val validate: string -> unit
+
+ (** Returns the longest validly-encoded prefix of the given string. *)
+ val longest_valid_prefix : string -> string
- (** Returns true if and only if the given value lies outside the *)
- (** entire UCS range. *)
- val is_out_of_range : int32 -> bool
-
- (** Returns true if and only if the given value corresponds to a UCS *)
- (** surrogate code point, only for use in UTF-16 encoded strings. *)
- (** See the Unicode 5.0 Standard, section 16.6 for further details. *)
- val is_surrogate : int32 -> bool
end
-val (+++) : int32 -> int32 -> int32
-val (---) : int32 -> int32 -> int32
-val (&&&) : int32 -> int32 -> int32
-val (|||) : int32 -> int32 -> int32
-val (<<<) : int32 -> int -> int32
-val (>>>) : int32 -> int -> int32
+module String_validator (Decoder : CHARACTER_DECODER) : STRING_VALIDATOR
-module XML : sig val is_forbidden_control_character : int32 -> bool end
+(** Represents a validation error as a tuple [(i,e)], where:
+ * [i] = the index of the first non-compliant character;
+ * [e] = the reason for non-compliance. *)
+exception Validation_error of int * exn
+(** Provides functions for validating and processing
+ * strings according to the UTF-8 character encoding.
+ *
+ * Validly-encoded strings must satisfy RFC 3629.
+ *
+ * For further information, see:
+ * http://www.rfc.net/rfc3629.html *)
+module UTF8 : STRING_VALIDATOR
+(** Provides functions for validating and processing
+ * strings according to the UTF-8 character encoding,
+ * with certain additional restrictions on UCS values
+ * imposed by the XML specification.
+ *
+ * Validly-encoded strings must satisfy both RFC 3629
+ * and section 2.2 of the XML specification.
+ *
+ * For further information, see:
+ * http://www.rfc.net/rfc3629.html
+ * http://www.w3.org/TR/REC-xml/#charsets *)
+module UTF8_XML : STRING_VALIDATOR
type t = { size: int; mutable current: int; data: (float,Bigarray.float32_elt, Bigarray.c_layout) Bigarray.Array1.t ; }
-(** create a ring structure with @size record. records inited to @initval *)
let make size init =
let ring =
{ size = size; current = size - 1; data = Bigarray.Array1.create Bigarray.float32 Bigarray.c_layout size; }
done;
ring
-(** length of the ring *)
let length ring = ring.size
-(** push into the ring one element *)
let push ring e =
ring.current <- ring.current + 1;
if ring.current = ring.size then
ring.current <- 0;
Bigarray.Array1.set ring.data ring.current e
-(** get the @ith old element from the ring *)
let peek ring i =
if i >= ring.size then
raise (Invalid_argument "peek: index");
if offset >= 0 then offset else ring.size + offset in
Bigarray.Array1.get ring.data index
-(** get the top element of the ring *)
let top ring = Bigarray.Array1.get ring.data ring.current
-(** iterate over nb element of the ring, starting from the top *)
let iter_nb ring f nb =
if nb > ring.size then
raise (Invalid_argument "iter_nb: nb");
f (peek ring i)
done
-(** iter directly on all element without using the index *)
+(* iter directly on all element without using the index *)
let iter f a =
for i=0 to Bigarray.Array1.dim a - 1 do
f (Bigarray.Array1.get a i)
let raw_iter ring f =
iter f ring.data
-(** iterate over all element of the ring, starting from the top *)
let iter ring f = iter_nb ring f (ring.size)
-(** get array of latest #nb value *)
let get_nb ring nb =
if nb > ring.size then
raise (Invalid_argument "get_nb: nb");
a
let get ring = get_nb ring (ring.size)
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*)
+(** Ring structures *)
+
type t = {
size : int;
mutable current : int;
data : (float, Bigarray.float32_elt, Bigarray.c_layout) Bigarray.Array1.t;
}
+
+(** create a ring structure with [size] record; records initialised to [init] *)
val make : int -> float -> t
+
+(** length of the ring *)
val length : t -> int
+
+(** push into the ring one element *)
val push : t -> float -> unit
+
+(** get the i{^th} old element from the ring *)
val peek : t -> int -> float
+
+(** get the top element of the ring *)
val top : t -> float
+
+(** iterate over nb element of the ring, starting from the top *)
val iter_nb : t -> (float -> 'a) -> int -> unit
+
val raw_iter : t -> (float -> 'a) -> unit
+
+(** iterate over all elements of the ring, starting from the top *)
val iter : t -> (float -> 'a) -> unit
+
+(** get array of latest [nb] value *)
val get_nb : t -> int -> float array
+
val get : t -> float array
type 'a t = { size: int; mutable current: int; data: 'a array; }
-(** create a ring structure with @size record. records inited to @initval *)
+(** create a ring structure with size record. records inited to initval *)
let make size initval =
{ size = size; current = size - 1; data = Array.create size initval; }
ring.current <- 0;
ring.data.(ring.current) <- e
-(** get the @ith old element from the ring *)
+(** get the ith old element from the ring *)
let peek ring i =
if i >= ring.size then
raise (Invalid_argument "peek: index");
(** iterate over all element of the ring, starting from the top *)
let iter ring f = iter_nb ring f (ring.size)
-(** get array of latest #nb value *)
+(** get array of latest nb value *)
let get_nb ring nb =
if nb > ring.size then
raise (Invalid_argument "get_nb: nb");
module String :
sig
external length : string -> int = "%string_length"
+ (** blabla *)
external get : string -> int -> char = "%string_safe_get"
external set : string -> int -> char -> unit = "%string_safe_set"
external create : int -> string = "caml_create_string"
(** find all occurences of needle in haystack and return all their respective index *)
val find_all : string -> string -> int list
- (** replace all @f substring in @s by @t *)
+ (** replace all [f] substring in [s] by [t] *)
val replace : string -> string -> string -> string
(** filter chars from a string *)
let num64 = Int64.of_int num in
limit := Opt.map (fun x -> Int64.sub x num64) !limit;
- Unix.write ofd buffer 0 num;
+ ignore_int (Unix.write ofd buffer 0 num);
total_bytes := Int64.add !total_bytes num64;
finished := num = 0 || !limit = Some 0L;
done;
INTF = $(foreach obj, $(OBJS),$(obj).cmi)
LIBS = stunnel.cma stunnel.cmxa
+DOCDIR = /myrepos/xen-api-libs.hg/doc
+
all: $(INTF) $(LIBS) $(PROGRAMS)
bins: $(PROGRAMS)
uninstall:
ocamlfind remove stunnel
+.PHONY: doc
+doc: $(INTF)
+ python ../doc/doc.py $(DOCDIR) "stunnel" "library" "$(OBJS)" "." "stdext,log" ""
+
clean:
- rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS)
\ No newline at end of file
+ rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS)
INTF = $(foreach obj, $(OBJS),$(obj).cmi)
LIBS = uuid.cma uuid.cmxa
+DOCDIR = /myrepos/xen-api-libs.hg/doc
+
all: $(INTF) $(LIBS) $(PROGRAMS)
bins: $(PROGRAMS)
uninstall:
ocamlfind remove uuid
+.PHONY: doc
+doc: $(INTF)
+ python ../doc/doc.py $(DOCDIR) "uuid" "library" "$(OBJS)" "." "" ""
+
clean:
rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS)
INTF = op.cmi packet.cmi xb.cmi
LIBS = xb.cma xb.cmxa
+DOCDIR = /myrepos/xen-api-libs.hg/doc
+
all: $(PREINTF) $(PRELIBS) $(INTF) $(LIBS) $(PROGRAMS)
bins: $(PROGRAMS)
uninstall:
ocamlfind remove xb
+.PHONY: doc
+doc: $(INTF)
+ python ../doc/doc.py $(DOCDIR) "xb" "library" "$(OBJS)" "." "mmap" ""
+
clean:
rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS)
INTF = xc.cmi
LIBS = xc.cma xc.cmxa
+DOCDIR = /myrepos/xen-api-libs.hg/doc
+
all: $(INTF) $(LIBS) $(PROGRAMS)
bins: $(PROGRAMS)
uninstall:
ocamlfind remove xc
+.PHONY: doc
+doc: $(INTF)
+ python ../doc/doc.py $(DOCDIR) "xc" "library" "$(OBJS)" "." "mmap,uuid" ""
+
clean:
rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS) $(INTF)
LIBS = xml-light2.cma xml-light2.cmxa
PROGRAMS = xmlpp
+DOCDIR = /myrepos/xen-api-libs.hg/doc
+
all: $(INTF) $(LIBS)
bins: $(PROGRAMS)
binuninstall:
rm -f $(DESTDIR)$(LIBEXEC)$(PROGRAMS)
+.PHONY: doc
+doc: $(INTF)
+ python ../doc/doc.py $(DOCDIR) "xml-light2" "library" "$(OBJS)" "." "stdext,xmlm" ""
+
clean:
rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS)
INTF = xsraw.cmi xst.cmi xs.cmi
LIBS = xs.cma xs.cmxa
+DOCDIR = /myrepos/xen-api-libs.hg/doc
+
all: $(PREINTF) $(PRELIBS) $(INTF) $(LIBS) $(PROGRAMS)
bins: $(PROGRAMS)
uninstall:
ocamlfind remove xs
+.PHONY: doc
+doc: $(INTF)
+ python ../doc/doc.py $(DOCDIR) "xs" "library" "$(OBJS)" "." "xb" ""
+
clean:
rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot $(LIBS) $(PROGRAMS)
INTF = xsrpc.cmi
LIBS = xsrpc.cma xsrpc.cmxa
+DOCDIR = /myrepos/xen-api-libs.hg/doc
+
all: $(INTF) $(LIBS) $(PROGRAMS)
bins: $(PROGRAMS)
.PHONY: uninstall
uninstall:
ocamlfind remove xsrpc
-
+
+.PHONY: doc
+doc: $(INTF)
+ python ../doc/doc.py $(DOCDIR) "xsrpc" "library" "$(OBJS)" "." "xb,xs" ""
+
clean:
rm -f *.o *.so *.a *.cmo *.cmi *.cma *.cmx *.cmxa *.annot META $(LIBS) $(PROGRAMS)