From cd481a01174468188d23b9d544cb738471c7fb52 Mon Sep 17 00:00:00 2001 From: cos Date: Sun, 19 May 2013 16:11:32 +0200 Subject: Obsoleted branch. Please look at cr/implement_gnumber_hack instead. --- contrib/genrpbindings | 207 -------------------------------------------------- 1 file changed, 207 deletions(-) delete mode 100755 contrib/genrpbindings (limited to 'contrib/genrpbindings') diff --git a/contrib/genrpbindings b/contrib/genrpbindings deleted file mode 100755 index 0f924d3..0000000 --- a/contrib/genrpbindings +++ /dev/null @@ -1,207 +0,0 @@ -#!/usr/bin/env perl -# genrpbindings -- generate ratpoison bindings for various languages -# -# Copyright (C) 2003, 2004 Ryan Yeske, Doug Kearns, Shawn Betts -# -# currently generates bindings for: -# * Perl (Ratpoison.pm) Ryan Yeske -# * Emacs Lisp (ratpoison-cmd.el) Ryan Yeske -# * Ruby (ratpoison.rb) Doug Kearns -# * Common Lisp (ratpoison.lisp) Shawn Betts -# * Python (ratpoison.py) Mike O'Connor -# add more languages! -# -# Bindings are just very thin wrappers, no argument checking is done. -# All of the functions return a string. -# -# Example: ratpoison --command='echo hello world' -# -# #!perl -# use Ratpoison; -# Ratpoison::echo ("hello world") -# -# ;;; elisp -# (require 'ratpoison-cmd) -# (ratpoison-echo "hello world") -# -# #!ruby -# require "ratpoison" -# Ratpoison.echo ("hello world") -# -# ;;; Common Lisp -# (load "ratpoison.lisp") -# (ratpoison:rp-echo "hello world") -# -# #!python -# import ratpoison -# ratpoison.echo( "hello world" ) - -use warnings; - -$\="\n"; - -# set this to your rp binary -$RATPOISON=$ENV{RATPOISON} || "ratpoison"; - -# open source file -$ACTIONS_C="../src/actions.c"; -open ACTIONS_C or die "Can't open $ACTIONS_C"; - -# open target files -$PERL_FILE="./Ratpoison.pm"; -$ELISP_FILE="./ratpoison-cmd.el"; -$RUBY_FILE="./ratpoison.rb"; -$COMMONLISP_FILE="./ratpoison.lisp"; -$PYTHON_FILE="./ratpoison.py"; -open PERL, ">$PERL_FILE" or die "Can't create $PERL_FILE"; -open ELISP, ">$ELISP_FILE" or die "Can't create $ELISP_FILE"; -open RUBY, ">$RUBY_FILE" or die "Can't create $RUBY_FILE"; -open COMMONLISP, ">$COMMONLISP_FILE" or die "Can't create $COMMONLISP_FILE"; -open PYTHON, ">$PYTHON_FILE" or die "Can't create $PYTHON_FILE"; - -# PERL preamble -print PERL 'package Ratpoison;'; -print PERL '$RATPOISON="',$RATPOISON,'";'; -print PERL 'sub command { my $a = "@_"; $a =~ s/(\')/\'\\\\\'\'/g; return `$RATPOISON -c \'$a\'`; }'; - -# ELISP preamble -print ELISP '(defvar ratpoison-program "',$RATPOISON,'")'; -print ELISP < (point-max) 1) - (- (point-max) 1) - (point-max))))) -PREAMBLE - -# RUBY preamble -print RUBY <) { - if (m!/\*\@begin !) { - while () - { - last if (m!/\*\@end !); - if (/\s*add_command\s*\(\"([^\"]+)\",\s*[^\"]+,\s*([0-9]+),\s*[0-9]+,\s*([0-9]+)/) { - my $name = $1; - my $numargs = $2; - my $optargs = $3; - - # Skip the arguments - for (my $i=0; $i<$numargs; $i++) { - ; - } - - $nbindings++; - print PERL "sub $name { return command (\"$name\", \@_); }"; - print ELISP "(defun-ratpoison $name)"; - print COMMONLISP "(defun-ratpoison $name)"; - print RUBY " def $name(*args)"; - print RUBY " return command(\"$name\", args)"; - print RUBY " end"; - print RUBY " module_function :$name\n"; - print PYTHON "def rp_$name( *args ): return rp_command ( '$name ' + ' '.join( args ) )"; - } - } - } -} -print "$nbindings bindings."; - -# PERL postamble -# nothing - -# ELISP postamble -print ELISP '(provide \'ratpoison-cmd)'; - -# RUBY postamble -print RUBY "end"; - -# PYTHON postamble -# nothing - -close PERL; -print "Created $PERL_FILE"; -close ELISP; -print "Created $ELISP_FILE"; -close RUBY; -print "Created $RUBY_FILE"; -close COMMONLISP; -print "Created $COMMONLISP_FILE"; -close PYTHON; -print "Created $PYTHON_FILE"; -- cgit v1.2.3