From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id C944B7EC6E for ; Tue, 17 Dec 2013 08:02:22 +0100 (CET) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of anthony.tavener@gmail.com) identity=pra; client-ip=74.125.83.53; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="anthony.tavener@gmail.com"; x-sender="anthony.tavener@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of anthony.tavener@gmail.com designates 74.125.83.53 as permitted sender) identity=mailfrom; client-ip=74.125.83.53; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="anthony.tavener@gmail.com"; x-sender="anthony.tavener@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-ee0-f53.google.com) identity=helo; client-ip=74.125.83.53; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="anthony.tavener@gmail.com"; x-sender="postmaster@mail-ee0-f53.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiYCAOv1r1JKfVM1m2dsb2JhbABYg0JVpWoyiXKIV4EVCBYOAQEBAQEGCwsJFCiCJQEBAQMBAQI9ARsSCwEDAQsGBQsaISIBBQwBBQEKEgYTCAqHXQEDCQgNpCSMWoMJjQ4KGScDCmSFbxEBBQyNDIEYEQFMBAeENgEDiUOMBIJPgTCOdxgphHYcgTU X-IPAS-Result: AiYCAOv1r1JKfVM1m2dsb2JhbABYg0JVpWoyiXKIV4EVCBYOAQEBAQEGCwsJFCiCJQEBAQMBAQI9ARsSCwEDAQsGBQsaISIBBQwBBQEKEgYTCAqHXQEDCQgNpCSMWoMJjQ4KGScDCmSFbxEBBQyNDIEYEQFMBAeENgEDiUOMBIJPgTCOdxgphHYcgTU X-IronPort-AV: E=Sophos;i="4.95,500,1384297200"; d="scan'208";a="41370950" Received: from mail-ee0-f53.google.com ([74.125.83.53]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 17 Dec 2013 08:02:21 +0100 Received: by mail-ee0-f53.google.com with SMTP id b57so2659836eek.12 for ; Mon, 16 Dec 2013 23:02:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=OSMzx+jqEzRaU+0saPHaHPPKPWUG6S2KKhZX5CGh5kE=; b=yUjHhytHrEIa2W+R2cMF6oahwd8eXYZRpqVj8Gogv4zqAPe1wHhJiBoV5wiJ49ReAD rrDLbD7kYUAvLUyoFFFbzlTQkRIqaOkUtA3F2LiWNLwpBI+DDl9l+UenDVWh1/u/cBIE 9Y/5HG2kruNxum+Omfi5mc+0fu/nrEwNg2o9oqW8PHFZ8jsl8ghKII8rxBb/gaYMDrS1 jMKdBnKakxg0ZTZO01mpayzC1JmVFxnVizecaEj6Fr8DdBXO6iG917ypmfubFu8eeU/Y pafXFccgK5l6y2DBbF44jV2kvy7Ly8bsG5KYbl635IN0JEsLHuWZZ+LwgDxw9jtxJzzc 0rlg== MIME-Version: 1.0 X-Received: by 10.14.119.136 with SMTP id n8mr20834858eeh.82.1387263741318; Mon, 16 Dec 2013 23:02:21 -0800 (PST) Received: by 10.15.90.202 with HTTP; Mon, 16 Dec 2013 23:02:21 -0800 (PST) In-Reply-To: <4DDEBB7487B641C0834F09D522EA9918@erratique.ch> References: <4DDEBB7487B641C0834F09D522EA9918@erratique.ch> Date: Tue, 17 Dec 2013 00:02:21 -0700 Message-ID: From: Anthony Tavener To: =?ISO-8859-1?Q?Daniel_B=FCnzli?= Cc: caml list Content-Type: multipart/alternative; boundary=001a1132f80082dbeb04edb5826e Subject: Re: [Caml-list] SDL2 bindings, testers and feedback welcome --001a1132f80082dbeb04edb5826e Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Sounds great! This is an item in my TODO list, also as "thin" bindings via ctypes. I agree with leaving the nice abstraction to a higher level layer -- that generally happens anyway in a nontrivial project. I have a controller and joystick, but no force. And some apps to port to SDL2 to test with. Most of my use is the event system. Aside from that I just set up a window for OpenGL. Setting things up and installing once I send this email... :) On Mon, Dec 16, 2013 at 11:11 PM, Daniel B=FCnzli wrote: > Hello, > > I have written thin bindings to SDL 2 using ocaml-ctypes. The binding > is finished but should be considered unstable: it was not thoroughly > tested and may still change as it has not been *used* yet. The purpose > of this unstable release is to: > > 1) Iron out the install procedure and test on a variety of platforms. > 2) Get feedback about the design of the binding (see below). > > More precisely, apart from the eventual bugs, I'm interested in > getting feedback in the following areas: > > * I used an 'a result =3D [ `Error | `Ok of 'a ] rather than an exception > for functions that return error codes/null is error. I tend to lean > on exceptionless designs but I'm still unsure whether it is a good > idea that case. One of the problems is that SDL doesn't make a clear > distinction (at the signature level *and* in the documentation) > between programming errors (invalid_arg), exceptional errors > (e.g. out of memory) and non-exceptional errors (e.g. could not > access/setup a resource). > > * The signature/approach of certain binding functions may be disputable > or may need change to achieve reasonable performance. > > * Testing the binding to the joystick/game controller/force feedback api, > I have none of these things in my hands. > > I welcome discussions/ideas about these points and the general design > of the binding on github's issue tracker (http://github.com/dbuenzli/tsdl) > > Note that the philosophy of the binding is to be "thin", that is a > mostly type-safe(r), minimal, hopefully efficient, one-to-one > binding. This means that I'm not interested in prettyfing the C API > like OCamlSDL does. I expect tsdl code to look like C SDL code > (including the inconsistent naming schemes) and the binding to be used > by programmers to build higher-level, more OCaml friendly, abstractions. > > To install (only tested on osx and linux so far) you'll need at least SDL > 2.0.1 > installed on your system. Then: > > opam repo add erratique-u http://erratique.ch/software/opam/unreleased > opam update && opam install tsdl > > On osx 10.8.5 with OCaml 4.01.0 there's a heisenbug I couldn't track so f= ar > (see [1] for more info). Use 4.00.1 instead for now but note that the > binding > takes a long time to compile (~8 min on my machine) with that. > > If you want to hack the sources: > > git clone http://github.com/dbuenzli/tsdl > cd tsdl && ./build test.native && ./test.native > > The documentation of the binding is here: > > http://erratique.ch/software/tsdl/doc/Tsdl > > Best, > > Daniel > > [1] http://lists.ocaml.org/pipermail/ctypes/2013-December/000027.html > > P.S. If anyone wonders, the existing OCamlSDL is a very good binding > to SDL 1.X, but SDL 2.0 is an entirely new, incompatible, API. Besides > SDL 2.0 changed to a zlib license, tsdl is under BSD3, OCamlSDL is > LGPL. > > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > --001a1132f80082dbeb04edb5826e Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Sounds great! This is an item in my TODO list, also a= s "thin" bindings via
ctypes. I agree with leaving the = nice abstraction to a higher level layer --
that generally happen= s anyway in a nontrivial project.

I have a controller and joystick, but no force. And som= e apps to port to SDL2
to test with. Most of my use is the event = system. Aside from that I just set
up a window for OpenGL.

Setting things up and installing once I send this email= ... :)



On Mon, Dec 16, 2013 at 11:11 PM, Daniel B=FCnzli <daniel.buenzli@erratique.ch> wrote:
Hello,

I have written thin bindings to SDL 2 using ocaml-ctypes. The binding
is finished but should be considered unstable: it was not thoroughly
tested and may still change as it has not been *used* yet. The purpose
of this unstable release is to:

1) Iron out the install procedure and test on a variety of platforms.
2) Get feedback about the design of the binding (see below).

More precisely, apart from the eventual bugs, I'm interested in
getting feedback in the following areas:

* I used an 'a result =3D [ `Error | `Ok of 'a ] rather than an exc= eption
for functions that return error codes/null is error. I tend to lean
on exceptionless designs but I'm still unsure whether it is a good
idea that case. One of the problems is that SDL doesn't make a clear
distinction (at the signature level *and* in the documentation)
between programming errors (invalid_arg), exceptional errors
(e.g. out of memory) and non-exceptional errors (e.g. could not
access/setup a resource).

* The signature/approach of certain binding functions may be disputable
or may need change to achieve reasonable performance.

* Testing the binding to the joystick/game controller/force feedback api, I have none of these things in my hands.

I welcome discussions/ideas about these points and the general design
of the binding on github's issue tracker (http://github.com/dbuenzli/tsdl)

Note that the philosophy of the binding is to be "thin", that is = a
mostly type-safe(r), minimal, hopefully efficient, one-to-one
binding. This means that I'm not interested in prettyfing the C API
like OCamlSDL does. I expect tsdl code to look like C SDL code
(including the inconsistent naming schemes) and the binding to be used
by programmers to build higher-level, more OCaml friendly, abstractions.

To install (only tested on osx and linux so far) you'll need at least S= DL 2.0.1
installed on your system. Then:

opam repo add erratique-u http://erratique.ch/software/opam/unreleased<= br> opam update && opam install tsdl

On osx 10.8.5 with OCaml 4.01.0 there's a heisenbug I couldn't trac= k so far
(see [1] for more info). Use 4.00.1 instead for now but note that the bindi= ng
takes a long time to compile (~8 min on my machine) with that.

If you want to hack the sources:

=A0 git clone http://github.com/dbuenzli/tsdl
=A0 cd tsdl && ./build test.native && ./test.native

The documentation of the binding is here:

=A0 http://erratique.ch/software/tsdl/doc/Tsdl

Best,

Daniel

[1] http://lists.ocaml.org/pipermail/ctypes/2013-Decem= ber/000027.html

P.S. If anyone wonders, the existing OCamlSDL is a very good binding
to SDL 1.X, but SDL 2.0 is an entirely new, incompatible, API. Besides
SDL 2.0 changed to a zlib license, tsdl is under BSD3, OCamlSDL is
LGPL.


--
Caml-list mailing list. =A0Subscription management and archives:
ht= tps://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

--001a1132f80082dbeb04edb5826e--