Previous week   Up   Next week
Hello,

Here is the latest Caml Weekly News, for the week of 07 to 14 October, 2003.

1) syslog interface?
2) mod_caml 0.9.3 released
3) line numbers in exceptions
4) lablGL, LablGTK1, LablGTK2 combined release
5) schoca-0.1.0
6) perl4caml (Call Perl code and functions from Objective Caml)
7) XmlLight 2.1 release
8) OCaml 3.07 patch 2

==============================================================================
1) syslog interface?
------------------------------------------------------------------------------
** Benjamin Geer asked and Shawn Wagner answered:

> Does anyone know of an ocaml interface to the Unix syslog daemon (e.g.
> via the C syslog function)?  If not, does anyone think it would be a
> useful/useless thing to have?

Yup. My extlib library (Not to be confused with someone else's library of
the same name) has one. http://raevnos.pennmush.org/code/ocaml.html#extlib

I think there's at least one other implementation too.

** Basile Starynkevitch added:

In my previous job, I coded such an interface. It is in the POESIA monitor
(Poesia is a content filter - see www.poesia-filter.org for details, and its
monitor is coded in Ocaml) which is opensource, under GPL license.

The relevant files are util.ml, util.mli, util_ml.c available under
http://cvs.sourceforge.net/viewcvs.py/poesia/PoesiaSoft/PoesiaMonIcap/ (to
compile the whole util.ml file, you also need the pa_trace.ml camlp4
preprocessor; but if you look for syslog only, you can copy&paste the
relevant functions and use util_ml.c).

The code was coded for ocaml 3.06; in practical terms, you'll better write
ignore (esyslogprintf ...). Using the format4 type of ocaml 3.06 for kprintf
would make it easier in ocaml 3.07. However the code does compile and run
correctly under 3.07

==============================================================================
2) mod_caml 0.9.3 released
------------------------------------------------------------------------------
** Richard Jones announced:

I'm pleased to announce the release of mod_caml 0.9.3.

mod_caml is a set of Objective CAML (OCaml) bindings for the Apache
API. It allows you to run "CGI scripts" written in OCaml directly inside
the Apache webserver. However, it is much much more than just that:

 * Bind to any part of the Apache request cycle.
 * Read and modify internal Apache structures.
 * Share modules of code between handlers and scripts.
 * CGI library and templating system (allows separation of code and
   presentation).
 * DBI library for simple database access.

The website has downloads and a manual:

http://www.merjis.com/developers/mod_caml/
https://savannah.nongnu.org/files/?group=modcaml

Changes:

* I've checked this version works with OCaml 3.07.
* Some integration with Ben Geer's CamlTemplate.
* Further enhancements to the comments example.
* DBI layer (can also be used separately).

==============================================================================
3) line numbers in exceptions
------------------------------------------------------------------------------
** Lex Stein asked and Basile Starynkevitch answered:

> Hi, Is there a general strategy for getting the line number information
> into exceptions. [...] Is there something like cpp's
> __LINE__ and __FILE__ macros in OCaml?

For macros, use camlp4. Exceptions don't carry more luggage than what they
claim, so if you want your exception SomeFault to carry the line & file
information, you obviously need to explicit   

   exception SomeFault of string * int (* filename linenumber *)   

Then you want to have a macro which e.g. expands a single (your new) keyword
   raise_Fault
into
   raise SomeFault(__FILE__,__LINE__)

where of course __FILE__ is a string (you want your preprocessor to put the
filename here) and __LINE__ is a number (you want your preprocessor to put
the current line number here).

As an example of macros which magically expands into something containing
the current source filename and line (& column) number, you can look at the
trace macro in the file pa_trace.ml (see also README.trace) inside

http://cvs.sourceforge.net/viewcvs.py/poesia/PoesiaSoft/PoesiaMonIcap/

I hope this will help you. Feel free to ask for more details if so needed.

==============================================================================
4) lablGL, LablGTK1, LablGTK2 combined release
------------------------------------------------------------------------------
** Jacques Garrigue announced:

I am glad to announce the release of

     lablGL version 1.00
     LablGTK version 1.2.6
     LablGTK version 2.2.0

All these libraries are available in both source and win32 binary
versions from
     http://wwwfun.kurims.kyoto-u.ac.jp/soft/olabl/lablgl.html
     http://wwwfun.kurims.kyoto-u.ac.jp/soft/olabl/lablgtk.html    

(Binary versions support bytecode only, and work with both MSVC and
mingw versions of Objective Caml 3.07)

lablGL 1.00:
  * Merged Isaac Trotts LablGlut library
    This is particularly nice as glut is available by defaults on all
    major platforms (except windows, but you just have to copy one dll)   
    In particular this allows using lablGL on MacOSX without X11.
  * GlArray support by Christophe Raffali
  * Erick Trizelaar contributed some extensions
  N.B. the 1.00 version number has no special meaning, the previous
  version just happened to be 0.99...

LablGTK 1.2.6:
  This is just a maintenance release. LablGTK1 seems stable enough now.
  Includes support for openGL and glade (GUI designer).

LablGTK 2.2.0:
  This is the first release of LablGTK2.
  * subsumes LablGTK1 (but not quite compatible)
  * support for exotic charsets
  * improved text and tree widgets
  * many new libraries are supported: gnome canvas, librsvg, gnomepanel
  * lots of other changes and improvements
  It is now stable enough that we invite people to try it.

Authors:
* lablGL: Jacques Garrigue, Isaac Trotts, Christophe Raffali, Erick Trizelaar
* LablGTK: Jacques Garrigue, Jun Furuse, Benjamin Monate, Olivier Andrieu

==============================================================================
5) schoca-0.1.0
------------------------------------------------------------------------------
** Christoph Bauer announced:

Hi,

here is an update for Schoca - the Scheme for Ocaml:

http://sourceforge.net/project/showfiles.php?group_id=2598

Changes:
    o unused package `xstrp4' is removed from Makefile (reported by Issac Trotts)
    o META file is added
    o `make install' works now
    o simple example for the embedded API is in examples/
    o fix wrong handling of EOF
    o all module names got a `Scm'-prefix
    o ScmTypes.of_bool is added
    o `display' flushes ouput-port
    o fix `(define (fun arg) (long body))'
    o new functions:
        char-alphabetic?, char-numeric?, char-whitespace?
        char-upper-case?, char-lower-case?, getenv,
        list->string, string->list, vector-length, gcd
        lcm, numerator, denominator, input-port?, output-port?
        call-with-input-file, call-with-output-file, current-input-port
        current-output-port, with-input-from-file, with-output-to-file,
        open-input-port, open-output-port, close-input-port, close-output-port
        read-char, peek-char, eof-object?, char-ready?, write-char, newline,
        load
    o fix for `read', `write' and `display'
    o continuations for call-with-current-continuation

==============================================================================
6) perl4caml (Call Perl code and functions from Objective Caml)
------------------------------------------------------------------------------
** Richard Jones announced:

Perhaps controversially I've written a prototype, pre-alpha interface
for calling Perl code from OCaml. You can download it here:

http://www.annexia.org/tmp/perl4caml-0.1.tar.gz

The long term aim here is to be able to utilise the huge resource that
is CPAN (http://www.cpan.org/) from within OCaml. It wouldn't be
completely automatic because of course you would still need to write
interface specifications (similar in concept to .mli files) to make
things type-safe.

A wrapped Perl library would never be as fast or efficient as a native
OCaml implementation, but at least the option would be there.

Rich.

Here is an example:

----- test.pl

sub return1
  {
    print "this is the 'return1' function!n";
    1;
  }

sub adder   
  {
    $_[0] + $_[1]
  }

----- test.ml

open Printf

let () =
  (* Arguments passed to the Perl "command line". Loads [test.pl] *)
  let args = [| ""; "-wT"; "test.pl" |] in

  (* Create the Perl interpreter. *)
  let pl = Perl.create ~args () in

  (* Call some subroutines in [test.pl]. *)
  let sv = Perl.call_scalar "return1" [] in
  printf "return1 = %dn" (Perl.int_of_sv sv);

(*
  let sv = Perl.call_scalar "adder" [`Int 3; `Int 4] in
  printf "adder (3, 4) = %dn" (Perl.int_of_sv sv);
*)

(*
  (* Evaluate a simple expression. *)
  Perl.eval "$a = 3";
  printf "$a contains %dn" (Perl.int_of_sv (Perl.get_sv "a"));
*)

  (* Destroy the interpreter. *)
  Perl.destroy pl

-----

** He then added:

New, much more complete version here:

http://www.annexia.org/tmp/perl4caml-0.2.0.tar.gz

==============================================================================
7) XmlLight 2.1 release
------------------------------------------------------------------------------
** Nicolas Cannasse announced:

I'm please to announce the release of the version 2.1 of Xml-Light :
Xml Light is a small parser/printer for Xml documents, entirely written in
OCaml. It supports a subset of the Xml specification, which should be enough
for most of the usages, including DTD proving and PCDATA nodes. You can
download the distribution or watch the Ocamldoc HTML documentation on the
web page : http://tech.motion-twin.com/xmllight .

Version 2 have been updated several times since the first release and fixed
a lot of small bugs or incompabilites (thanks to every people that reported
them).
Version 2.1 is including all theses fixes and is also correcting some recent
case sensitiveness issues.

==============================================================================
8) OCaml 3.07 patch 2
------------------------------------------------------------------------------
** Xavier Leroy announced:

The second (and hopefully last) bug-fix patch against the OCaml 3.07
distribution is now available at
   http://caml.inria.fr/distrib/ocaml-3.07/ocaml-3.07-patch2.diffs  

This patch fixes the following issues:
- Camlp4: parsing of labeled function arguments.
- Emacs interface: portability issues between versions of GnuEmacs and XEmacs.
- Incorrect code generated for certain recursive module definitions.
- Name pollution issue on Mac OS X 10.3.

(The last item is what makes the initial build go wrong under Mac OS X
10.3.)

Feel free to send me feedback on this patch.  Both negative ("it still
doesn't work") and positive ("it fixed my problems") feedback are
useful in deciding when to consider 3.07 as finished and to rebuild
the binary distributions.

==============================================================================
Using folding to read the cwn in vim 6+
------------------------------------------------------------------------------
Here is a quick trick to help you read this CWN if you are viewing it using
vim (version 6 or greater).

:set foldmethod=expr
:set foldexpr=getline(v:lnum)=~'^=\\{78}$'?'<1':1
zM

If you know of a better way, please let me know.

==============================================================================
Old cwn
------------------------------------------------------------------------------

If you happen to miss a CWN, you can send me a message
(alan.schmitt@inria.fr) and I'll mail it to you, or go take a look at
the archive (http://pauillac.inria.fr/~aschmitt/cwn/) or the RSS feed of the 
archives (http://pauillac.inria.fr/~aschmitt/cwn/cwn.rss). If you also wish to 
receive it every week by mail, just tell me so.

==============================================================================

Alan Schmitt