首页| JavaScript| HTML/CSS| Matlab| PHP| Python| Java| C/C++/VC++| C#| ASP| 其他|
购买积分 购买会员 激活码充值

您现在的位置是:虫虫源码 > 其他 > 位串与位串匹配的OCaml

位串与位串匹配的OCaml

资 源 简 介

The ocaml-bitstring project adds Erlang-style bitstrings and matching over bitstrings as a syntax extension and library for OCaml. (This project was formerly known as "bitmatch"). You can use this module to both parse and generate binary formats, files and protocols. Bitstring handling is added as primitives to the language, making it exceptionally simple to use and very powerful. Here is how to parse the header from a GIF image: let bits = Bitstring.bitstring_of_file "image.gif" in bitmatch bits with | { ("GIF87a"|"GIF89a") : 6*8 : string; (* GIF magic. *) width : 16 : littleendian; height : 16 : littleendian } -> printf "%s: GIF image is %d x %d pixels" filename width height | { _ } -> eprintf "%s: Not a GIF image " filename This example shows how to parse the first few fields in a Linux ELF binary (see ):

文 件 列 表

ocaml-bitstring-2.0.4
MANIFEST
config.h.in
bitmatch.ml
byteswap.in.h
bitstring.mli
create_test_pattern.ml
examples
bitstring_persistent.mli
benchmarks
configure
CHANGES
bitstring.ml
COPYING
pa_bitstring.ml
tests
README
configure.ac
COPYING.LIB
aclocal.m4
cil-tools
bitstring_types.ml
bitstring_objinfo.ml
bootstrap
.depend
Makefile.in
coverage-report
TODO
install-sh
bitstring_c.c
META.in
bitstring_config.ml.in
bitstring_persistent.ml
VIP VIP
0.183540s