Source

opycaml /

Filename Size Date modified Message
examples
js_of_ocaml
js_of_ocaml2
oowrap
python
tests
496 B
ignore
240 B
Added tag v1.1.0 for changeset e38a0be0ce90
993 B
macro => wrap
595 B
merge
159 B
name space improvement
2.6 KB
cleanup after a long sleep
81 B
auto update of OMyMakefile
23.6 KB
cleanup after a long sleep
741 B
name space improvement
2.7 KB
readme
11.5 KB
cleanup after a long sleep
8.7 KB
added hist2d_demo.ml and changed the type of Xapi.call_obj*
546 B
initial commit
636 B
macro => wrap
736 B
cleanup after a long sleep
100 B
error detail
1.9 KB
module rec hack
552 B
much better!
337 B
much better!
720 B
much better!
6.2 KB
module rec hack
14.6 KB
error detail
256 B
cleanup after a long sleep
336 B
from_python_c.c added
11.1 KB
added an example from Nicolas
409 B
module rec hack
9.6 KB
much better!
3.7 KB
much better!
2.5 KB
much better!
574 B
much better!
2.8 KB
much better!
3.8 KB
cleanup after a long sleep
11.7 KB
module rec hack
15.0 KB
dependency + call/callObject type improvement
5.8 KB
module rec hack
30.9 KB
much better!
9.3 KB
much better!
3.2 KB
module rec hack
1.9 KB
macro => wrap
1.7 KB
fix
332 B
fixed memory leak around ocaml closure wrapper
680 B
added hist2d_demo.ml and changed the type of Xapi.call_obj*
939 B
added hist2d_demo.ml and changed the type of Xapi.call_obj*
( ゚∀゚)o彡°O'PyCaml

  If you do not see a For-all sign at the first line, install unicode capable fonts.

What currently you can do:

  You can call some of Python/C API functions from OCaml.

How to install:

  Read INSTALL.txt

How to use:

  test.ml is for an example.

  - api.ml provides the main Python/OCaml interface. 
    Use "open Opycaml.Api" in your OCaml programs. 
    Once opened, Python/ML API functions are available by
    Py.<Class>.<function> names. For example,

       Py.Object.repr    for   PyObject_Repr
       Py.String.check   for   PyStrnig_Check 

    You can omit Py. prefix for the module names which do not collide
    with OCaml standard library name space:

       Object.repr       for   PyObject_Repr
       (String is in OCaml standard library, so no short cut is available.)

  - Do not forget calling Base.initialize for initialization.

  - autoapi.ml is auto-created by CamlIDL. It provides almost of 
    all the available API functions in OPyCaml. Their comments are
    from Python/C API reference, which are useful to understand them.

  - api.ml extends autoapi.ml, providing things not easily done by
    CamlIDL's code generator.

  - A C function Py<Hoo>_<Bar> is mapped into an ML function Hoo.bar, 
    where the first letter of "Bar" is lowercased.

    For example:
      PyObject_Repr =>  Object.repr
      PyString_Check => String.check   
               ( Note that String module is available by Py.String )

    There is one exception: If a C function has all-capital-or-underscore
    postfix name, such as PyTuple_GET_ITEM, its ML function name is not
    first letter lowercased but is prefixed by '_':

      PyTuple_GET_ITEM => Tuple._GET_ITEM

OO Interface

    OO style interface, OOApi.ml is now also provided. This module is automatically generated from api.ml.
    See examples/testoo.ml for how to use.

    - open Opycaml.OOApi at the beginning of your module

    - The Api function calls like [Api.M.func m args] are in OO style in OOApi, [m#func args], if [m]'s an object of [M].

    - If an Api function call [Api.M.func m args] has no trivial OO style translation, i.e. if [m] is not an object of [M], [OOApi.M.func] is available.
    
    - For example,

        open Opycaml.Api

        let _ = Base.initialize ()
        ... Dict.getItemString dict "foobar" ...

      becomes as follows in OO style:

        open Opycaml.OOApi

        let _ = Base.initialize ()           (* It has no trivial OO translation. *)
        ... dict#getItemString "foobar" ...  

Js_of_ocaml Interface

    If you have js_of_ocaml installed, there is a small tool to use the syntax sugar of js_of_ocaml for Python dictionary access in OPyCaml. See js_of_ocaml directory.