forked from ocaml/opam-repository
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make `create` zero out the new buffer. The new `create_unsafe` function can be used if you want to trade safety for speed.
- Loading branch information
Showing
3 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
access C structures via a camlp4 extension | ||
|
||
Cstruct is a library and syntax extension to make it easier to access C-like | ||
structures directly from OCaml. It supports both reading and writing to these | ||
structures, and they are accessed via the Bigarray module. | ||
|
||
An example pcap description using PPX extension points is: | ||
|
||
``` | ||
[%%cstruct | ||
type pcap_header = { | ||
magic_number: uint32_t; (* magic number *) | ||
version_major: uint16_t; (* major version number *) | ||
version_minor: uint16_t; (* minor version number *) | ||
thiszone: uint32_t; (* GMT to local correction *) | ||
sigfigs: uint32_t; (* accuracy of timestamps *) | ||
snaplen: uint32_t; (* max length of captured packets, in octets *) | ||
network: uint32_t; (* data link type *) | ||
} [@@little_endian]] | ||
``` | ||
|
||
For Camlp4 support, please use a version of Cstruct that is `<=1.9.0` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
opam-version: "1.2" | ||
maintainer: "anil@recoil.org" | ||
authors: ["Anil Madhavapeddy" "Richard Mortier" "Thomas Gazagnaire" | ||
"Pierre Chambart" "David Kaloper" "Jeremy Yallop" ] | ||
homepage: "https://github.com/mirage/ocaml-cstruct" | ||
license: "ISC" | ||
dev-repo: "https://github.com/mirage/ocaml-cstruct.git" | ||
bug-reports: "https://github.com/mirage/ocaml-cstruct/issues" | ||
tags: [ | ||
"org:mirage" | ||
"org:xapi-project" | ||
] | ||
build: [ | ||
["./configure" | ||
"--prefix" prefix | ||
"--%{lwt:enable}%-lwt" | ||
"--%{ppx_tools:enable}%-ppx" | ||
"--%{async:enable}%-async" | ||
"--%{base-unix:enable}%-unix"] | ||
[make] | ||
] | ||
build-test: [ | ||
["./configure" | ||
"--prefix" prefix | ||
"--%{lwt:enable}%-lwt" | ||
"--%{ppx_tools:enable}%-ppx" | ||
"--%{async:enable}%-async" | ||
"--%{base-unix:enable}%-unix" | ||
"--enable-tests"] | ||
[make] | ||
[make "test"] | ||
] | ||
install: [ | ||
[make "install"] | ||
[make "js-install"] | ||
] | ||
remove: [ | ||
[make "js-uninstall"] | ||
["ocamlfind" "remove" "cstruct"] | ||
] | ||
depends: [ | ||
"ocamlfind" {build} | ||
"ounit" {test} | ||
"ocplib-endian" | ||
"sexplib" | ||
"base-bytes" | ||
] | ||
depopts: [ | ||
"ppx_tools" | ||
"async" | ||
"lwt" | ||
] | ||
available: [ocaml-version >= "4.02.3"] | ||
depexts: [ | ||
[ ["debian"] ["time"] ] | ||
[ ["ubuntu"] ["time"] ] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
http: "https://github.com/mirage/ocaml-cstruct/archive/v2.2.0.tar.gz" | ||
checksum: "49f2fa14c95ecf3e55f76831e2548ab8" |