Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SFML Bindings creation mode for Emacs  (Read 2980 times)

0 Members and 1 Guest are viewing this topic.

Flash

  • Newbie
  • *
  • Posts: 22
    • View Profile
SFML Bindings creation mode for Emacs
« on: January 15, 2015, 09:47:55 pm »
Some of you will possibly remember that I was working on a Common Lisp Binding. No, I haven't given up, I just switched my focus to the Clasp compiler for Common Lisp, which allows direct integration of C++ libraries (no detour via C Bindings).
Anyway, as Clasp is still in early alpha, I don't think my bindings are of interest yet (SFML is practically the first library to run on it).

But I realized that something I created on the side may be of interest to other people who write or maintain bindings. My bindings creator mode for Emacs.
It does not automatically create the complete bindings, but it very much simplifies the process. I have two side-by-side windows and just put the cursor somewhere over a function or its comment, hit a key combination, and the binding for the function is automatically created in the file displayed in the other window. The same goes for classes, enums, etc., and includes differentiation between overloaded functions, a transposal of the documentation, etc..
Thus, the writer still has to go over every file, look at every function and think about it a little (which I think is good), but the repetitive task of copy&pasting and rewriting things is done away with.

My mode was written for the clbind syntax, but it can easily be adapted for any other bindings - all the necessary parsing is in there, so you just have to replace the clbind output with whatever format you need. It doesn't rely on any external parser, it simply uses regular expressions and relies on the strict adherence of the SFML files to the styleguide, which made my work much easier.

Anyway, here is the link:
https://github.com/HeyFlash/clasp-stuff/blob/master/cpp-to-clbind.el

And to give you an idea of what a result might look like (practically everything in there is generated:
https://github.com/HeyFlash/SFML/blob/master/src/SFML/Window/ClaspBindingWindow.cpp
« Last Edit: January 16, 2015, 06:44:23 pm by Flash »