OCaml Programming

Here is the stuff I wrote in or for OCaml (wrappers for C libraries mainly).

OCamlplot

An interface to the GNU libplot library. The project is hosted on Sourceforge : http://ocamlplot.sourceforge.net/

Gz

An interface for zlib and bzip2 compression libraries. On sourceforge too.

Odoc_texi

A Texinfo generator for OCamldoc : odoc_texi.ml. It produces .texi files that can be converted to Info files using makeinfo. It is now part of OCamldoc, which is now included in the OCaml distribution.

There is some helper Emacs-lisp code that automatically search the Info files for a requested identifier : caml-info-look. It even works with opened modules or modules aliases !
You can also use caml-help.el from the OCaml distribution.

The OCaml 3.07 documentation in ocamldoc-generated Info files : ocaml-3.07.info.tar
The LablGTK2 documentation in ocamldoc-generated Info files : lablgtk2.info.tar.

Gsl

I wrote a binding for GSL, the GNU scientific library.
Get it here and see the documentation.

The latest version is 0.5.1 and requires GSL 1.8. Version 0.4.1 requires GSL 1.6, builds with GSL 1.7 but does not build with GSL 1.8.

OCamlSDL

I participate in OCamlSDL, an OCaml binding for the SDL library.

Libart

Libart is a 2D, vector-based drawing library. It is used by GNOME in the GNOME Canvas and in Nautilus. These are bindings that interface Libart with CamlImages, LablGTK and OCamlSDL.
Here is some reference documentation, the author's site.

LablGTK

I'm one of the developers of LablGTK, a GTK+ bindings for OCaml.
Here's the ocamldoc-generated documentation, with links to the GTK+ reference manual.

Cairo

I contributed bindings for the Cairo vector graphics library. The code is hosted on freedesktop.org.
There are no tarballs yet but the code is in the CVS. Here is the OCamldoc-generated documentation.

CORBA and OCaml

I am writing bindings for ORBit2, the CORBA ORB of the GNOME project. There is a IDL compiler that maps CORBA types to OCaml types, and a runtime library that does the necessary conversions. It requires a fairly recent version of ORBit2 (>= 2.7.2).

See the README and the embryonic manual.

First version (not complete, alpha quality, etc.):

pa_records

A syntax extension for camlp4 that defines a somehow lighter syntax for pattern-matching on records :

Instead of writing :

  let t = Unix.localtime (Unix.time ()) in
  let { Unix.tm_hour = tm_hour; Unix.tm_min = tm_min } = t in 
    Printf.printf "%02d:%02d" tm_hour tm_min
one can write :
  let t = Unix.localtime (Unix.time ()) in
  let Unix.{ tm_hour; tm_min } = t in 
    Printf.printf "%02d:%02d" tm_hour tm_min

UPDATE: it now works with record expressions too.

Get it here and compile it like this : ocamlc -pp camlp4o -c -I +camlp4 pa_records.ml
To use it: ocamlc -pp "camlp4o ./pa_records.cmo" -c my_file.ml

pa_compr

A small list comprehension syntax extension with camlp4.

list_compr_expr ::= [+ expr | list_compr_item {| list_compr_item} ]
list_compr_item ::= patt <- expr_list
                  | let let-binding
                  | when expr

The expr_list is evaluated (it must be of a list type), then for each element that matches the pattern patt, expr is evaluated to build a new list. You can have multiple list_compr_item. It all expands to some combination of List.fold_right.

For instance:

list comprehension expression ...... expands to:
# [+ succ x | x <- [0; 1; 2] ] ;;
- : int list = [1; 2; 3]
# List.fold_right 
    (fun x __acc__ -> succ x :: __acc__) 
    [0; 1; 2;] [] ;;
- : int list = [1; 2; 3]
# [+ succ x | x <- [0; 1; 2; 3] | when x mod 2 == 0 ] ;;
-: int list = [1; 3]
# List.fold_right 
    (fun x __acc__ -> if x mod 2 == 0 
       then succ x :: __acc__ 
       else __acc__ )
    [0; 1; 2; 3] [] ;;
- : int list = [1; 3]
# [+ (x, y) | x <- [1; 2] | y <- [0; x] ] ;;

- : (int * int) list = [(1, 0); (1, 1); (2, 0); (2, 2)]
# List.fold_right
    (fun x __acc__ ->
       List.fold_right (fun y __acc__ -> (x, y) :: __acc__) 
         [0; x] __acc__)
    [1; 2] [] ;;
- : (int * int) list = [(1, 0); (1, 1); (2, 0); (2, 2)]

Get it here and compile it like this : ocamlc -pp camlp4o -c -I +camlp4 pa_compr.ml
To use it: ocamlc -pp "camlp4o ./pa_compr.cmo" -c my_file.ml

IPv6 for OCaml

A patch for the Unix module of the caml distribution providing support for IPv6 networking.
It is only tested on GNU/Linux !

New things:


Valid HTML 4.01!

<oliv__a@users.sourceforge.net>

Thu 05 Oct 2006 02:19:56 PM CEST