Commits

Dmitry Grebeniuk  committed d73ef9c

documentation corrections (thanks to Dmitry Astapov)

  • Participants
  • Parent commits 910ee66

Comments (0)

Files changed (1)

 
 (* OASIS_STOP *)
 
-  There already exists similar library "ocaml-cstruct"
-( https://github.com/avsm/ocaml-cstruct ).  Here are differences between them:
+  There already exists a library called "ocaml-cstruct"
+( https://github.com/avsm/ocaml-cstruct ) that serves similar purpose.
+However, author of this library didn't want to "dive into Camlp4" to
+add new features to ocaml-cstruct, and decided to write his own
+implementation instead.
 
-  Cons:
-- ocaml-cstruct is easier to add in a project (compare with section
-  "How to use" below)
-- ocaml-cstruct uses Camlp4, so it allows one to write cstruct-definitions
-  directly in the code
-- ocaml-cstruct-codegen is written in a too simple way, sometimes cynical
+  Here is how they compare:
 
   Pros:
 - ocaml-cstruct-codegen doesn't use Camlp4, it uses code generation
 - guarantees of full initialization of structures (when it's needed)
 - can dump structures to human-readable strings
 
-  Of course this can be implemented in ocaml-cstruct, but author of this
-library didn't want to "dive into Camlp4" just to add features to
-ocaml-cstruct.
+  Cons:
+- ocaml-cstruct is easier to add in a project (compare ocaml-cstruct docs
+  with section "How to use" below)
+- ocaml-cstruct uses Camlp4, so it allows one to write cstruct-definitions
+  directly in the code
+- ocaml-cstruct-codegen is written in a very direct, one might even say
+  cynical, way
 
-  For each structure "mystruct" with field "a" this library generates
-module Mystruct with abstract type t and values:
-- val sizeof : int -- size of structure in octets
-- val get_a : t -> <typeof a> -- gets field "a"
+
+  What would this library give you:
+
+  For the structure called "mystruct" with a signle field called "a" 
+ this library would generates module Mystruct with abstract type t and
+  values:
+
+- val sizeof : int -- get size of structure in octets
+- val get_a : t -> <typeof a> -- get field "a"
 - val set_a : t -> <typeof a> -> unit -- set field "a"
 - val of_bigarray : bigarray -> t -- create Mystruct.t on top of bigarray
 - val bigarray_of : t -> bigarray -- get bigarray of Mystruct.t
 - val make : a:<typeof a> -> t -- create Mystruct.t passing initial field
   values as labelled arguments (so user has guarentees that all fields are
   initialized)
-- val dump : t -> string -- creates human-readable string like "{ a=123 }"
+- val dump : t -> string -- convert t to human-readable string like "{ a=123 }"
+
+  This, of course, scales up for multiple fields.
 
 
   How to use:
 
     open Cstruct_codegen
     [.. your structure definitions ..]
-    let () = codegen "src/cstructs.ml" [struc1; struct2; ...]
+    let () = codegen "src/cstructs.ml" [struct1; struct2; ...]
 
 Then use "src/cstructs.ml".  Something like:
 
     open Cstructs
     let my1 = Mystruct.make ~a:12 in print_string (Mystruct.dump my1)
+
+
+  People:
+
+- Dmitry Grebeniuk <gdsfh1@gmail.com> -- code
+- Dmitry Astapov <dastapov@gmail.com> -- documentation corrections
+
+
+  License:
+
+LGPL-2.1 with OCaml linking exception