ports/116817: New port: devel/libreadline-java a JNI-wrapper around Readline

Martin Kammerhofer dada at pluto.tugraz.at
Tue Oct 2 09:40:03 UTC 2007


>Number:         116817
>Category:       ports
>Synopsis:       New port: devel/libreadline-java a JNI-wrapper around Readline
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct 02 09:40:02 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Martin Kammerhofer
>Release:        FreeBSD 6.2-STABLE i386
>Organization:
>Environment:
System: FreeBSD Martin.liebt.Susi 6.2-STABLE FreeBSD 6.2-STABLE #0: Sun Aug 19 14:22:22 CEST 2007 toor at Martin.liebt.Susi:/usr/obj/usr/src/sys/P2B-S i386
>Description:
Java-Readline is a JNI wrapper around GNU Readline, libedit and
libgetline.

One might prefer libedit over GNU readline because of licensing
issues.  You need at least libedit-2.6.10_1, older versions do not
work.
>How-To-Repeat:
>Fix:
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	devel/libreadline-java
#	devel/libreadline-java/Makefile
#	devel/libreadline-java/distinfo
#	devel/libreadline-java/pkg-descr
#	devel/libreadline-java/pkg-message
#	devel/libreadline-java/files
#	devel/libreadline-java/files/JReadlineCompleter.py
#	devel/libreadline-java/files/jython.sh
#	devel/libreadline-java/files/patch-Makefile
#	devel/libreadline-java/files/patch-src-Makefile
#	devel/libreadline-java/files/patch-src-native-Makefile
#	devel/libreadline-java/files/patch-src-native-getline.c
#	devel/libreadline-java/files/patch-src-native-org_gnu_readline_Readline.c
#	devel/libreadline-java/files/patch-src-org-gnu-readline-Readline.java
#
echo c - devel/libreadline-java
mkdir -p devel/libreadline-java > /dev/null 2>&1
echo x - devel/libreadline-java/Makefile
sed 's/^X//' >devel/libreadline-java/Makefile << 'END-of-devel/libreadline-java/Makefile'
X# New ports collection makefile for:   libreadline-java
X# Date created:                20 September 2007
X# Whom:                        Martin Kammerhofer <mkamm at gmx.net>
X#
X# $FreeBSD$
X#
X
XPORTNAME=		libreadline-java
XPORTVERSION=		0.8.0
XDISTVERSIONSUFFIX=	-src
XCATEGORIES=		devel java
XMASTER_SITES=		${MASTER_SITE_SOURCEFORGE}
XMASTER_SITE_SUBDIR=	java-readline
X
XMAINTAINER=	mkamm at gmx.net
XCOMMENT=	JNI wrapper around GNU Readline / libedit / libgetline
X
XBUILD_DEPENDS=	${LOCALBASE}/include/editline/readline.h:${PORTSDIR}/devel/libedit
XRUN_DEPENDS=	${LOCALBASE}/include/editline/readline.h:${PORTSDIR}/devel/libedit
X
XALL_TARGET=	# empty
XMAKE_ENV=	JAVA_HOME="${JAVA_HOME}" JAVA="${JAVA}" JAVAC="${JAVAC}" \
X		JAVAH="${JAVAH}" JAR_="${JAR}"
XPKGMESSAGE=	${WRKDIR}/pkg-message
XPLIST_FILES=	%%JAVAJARDIR%%/libreadline-java.jar lib/libJavaReadline.so \
X		lib/libJavaEditline.so lib/libJavaGetline.so
X.if !defined(NOPORTDOCS)
XPLIST_FILES+=	%%DOCSDIR%%/README.1st %%DOCSDIR%%/README \
X		%%DOCSDIR%%/jython.sh %%DOCSDIR%%/JReadlineCompleter.py \
X		@dirrm\ %%DOCSDIR%%
X.endif
XUSE_GMAKE=	yes
XUSE_JAVA=	yes
XUSE_LDCONFIG=	yes
XWRKSRC=		${WRKDIR}/${PORTNAME}-${PORTVERSION}
X
Xdo-install:
X	${INSTALL_DATA} ${WRKSRC}/libreadline-java.jar ${JAVAJARDIR}
X	${INSTALL_DATA} ${WRKSRC}/libJavaReadline.so ${PREFIX}/lib
X	${INSTALL_DATA} ${WRKSRC}/libJavaEditline.so ${PREFIX}/lib
X	${INSTALL_DATA} ${WRKSRC}/libJavaGetline.so ${PREFIX}/lib
X.if !defined(NOPORTDOCS)
X	${MKDIR} ${DOCSDIR}
X	${INSTALL_DATA} ${WRKSRC}/README.1st ${DOCSDIR}
X	${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR}
X	${INSTALL_DATA} ${FILESDIR}/jython.sh ${DOCSDIR}
X	${INSTALL_DATA} ${FILESDIR}/JReadlineCompleter.py ${DOCSDIR}
X.endif
X
Xpost-install:
X	@${SED} -e 's|%%JAVAJARDIR%%|${JAVAJARDIR}|g' -- \
X		${.CURDIR}/pkg-message >${PKGMESSAGE}
X	@${CAT} ${PKGMESSAGE}
X
X.if !defined(BATCH)
Xtest:
X	cd ${WRKSRC} && ${MAKE_ENV} ${GMAKE} test  # Now type something!
X.endif
X
X.include <bsd.port.mk>
END-of-devel/libreadline-java/Makefile
echo x - devel/libreadline-java/distinfo
sed 's/^X//' >devel/libreadline-java/distinfo << 'END-of-devel/libreadline-java/distinfo'
XMD5 (libreadline-java-0.8.0-src.tar.gz) = 501720ddded45eaedf429b7cc356107c
XSHA256 (libreadline-java-0.8.0-src.tar.gz) = cdcfd9910bfe2dca4cd08b2462ec05efee7395e9b9c3efcb51e85fa70548c890
XSIZE (libreadline-java-0.8.0-src.tar.gz) = 77122
END-of-devel/libreadline-java/distinfo
echo x - devel/libreadline-java/pkg-descr
sed 's/^X//' >devel/libreadline-java/pkg-descr << 'END-of-devel/libreadline-java/pkg-descr'
XJava-Readline is a port of GNU Readline for Java. Or, to be more
Xprecise, it is a JNI-wrapper to Readline. It is distributed under the
XLGPL.
X
XYou must call Readline.load(ReadlineLibrary lib); before using any
Xother methods.  If you omit the call to the load()-method, the pure
XJava fallback solution is used.  Possible values for lib are:
X
XReadlineLibrary.PureJava
XReadlineLibrary.GnuReadline
XReadlineLibrary.Editline
XReadlineLibrary.Getline
X
XNote that all programs using GnuReadline will fall under the GPL,
Xsince Gnu-Readline is GPL software!
X
XWWW: http://sourceforge.net/projects/java-readline/
END-of-devel/libreadline-java/pkg-descr
echo x - devel/libreadline-java/pkg-message
sed 's/^X//' >devel/libreadline-java/pkg-message << 'END-of-devel/libreadline-java/pkg-message'
X--------------------------------------------------
XTo use readline-java add the file
X%%JAVAJARDIR%%/libreadline-java.jar
Xto your classpath!
X--------------------------------------------------
END-of-devel/libreadline-java/pkg-message
echo c - devel/libreadline-java/files
mkdir -p devel/libreadline-java/files > /dev/null 2>&1
echo x - devel/libreadline-java/files/JReadlineCompleter.py
sed 's/^X//' >devel/libreadline-java/files/JReadlineCompleter.py << 'END-of-devel/libreadline-java/files/JReadlineCompleter.py'
X# (X)Emacs: -*- mode: python; coding: latin-1; -*-
X# TAB-Completion for Jython with org.python.util.ReadlineConsole.
X# JReadlineCompleter.py,v 1.1 2007/09/28 08:18:43 martin Exp
X#
X# This is rlcompleter.py from CPython 2.5.1 adapted for Jython
X# and libreadline-java.
X
X"""TAB-completion for Jython + libreadline-java
X
XThe completer completes keywords, built-ins and globals in a
Xselectable namespace (which defaults to __main__); when completing
XNAME.NAME..., it evaluates (!) the expression up to the last dot and
Xcompletes its attributes.
X
XIt's very cool to do "import sys" type "sys.", hit the
Xcompletion key (twice), and see the list of names defined by the
Xsys module!
X
XNotes:
X
X- Exceptions raised by the completer function are *ignored* (and
Xgenerally cause the completion to fail).  This is a feature -- since
Xreadline sets the tty device in raw (or cbreak) mode, printing a
Xtraceback wouldn't work well without some complicated hoopla to save,
Xreset and restore the tty state.
X
X- The evaluation of the NAME.NAME... form may cause arbitrary
Xapplication defined code to be executed if an object with a
X__getattr__ hook is found.  Since it is the responsibility of the
Xapplication (or the user) to enable this feature, I consider this an
Xacceptable risk.  More complicated expressions (e.g. function calls or
Xindexing operations) are *not* evaluated.
X
XThis module is a hacked version of the CPython 2.5 module rlcompleter.
XIt is under the PSF (Python Software Foundation) license.
X"""
X
X# CAUTION: Licensing issues may arise when changing the backend
X# library to "GnuReadline" which is under the GPL.
XDEFAULTLIB = "Editline"
X
X# Try to give useful hints for any import failure here:
Ximport sys
Xif not sys.platform.startswith("java"):
X    raise EnvironmentError("Module %s is to be used with Jython only!" %
X                           (__name__ == "__main__" and __file__ or __name__))
Xif sys.registry["python.console"] != "org.python.util.ReadlineConsole":
X    raise EnvironmentError("You need to set python.console=org.python.util.ReadlineConsole in your ~/.jython file!")
Xtry:
X    from org.gnu.readline import Readline, ReadlineLibrary, ReadlineCompleter
Xexcept ImportError:
X    raise ImportError("Make sure you have libreadline-java.jar in classpath!")
Ximport __builtin__
Ximport atexit
Ximport keyword
Ximport os
Ximport re
X
X__all__ = ["PyCompleter", "JvCompleter"]
X
XReadline.load(
X    getattr(ReadlineLibrary, sys.registry["python.console.readlinelib"], "")
X    or DEFAULTLIB)
Xhistfile = os.path.join(os.environ["HOME"], ".jyhist")
Xtry:
X    Readline.readHistoryFile(histfile)
Xexcept:
X    print >> sys.stderr, histfile, "not available!"
Xatexit.register(Readline.writeHistoryFile, histfile)
X
Xclass PyCompleter:
X    def __init__(self, namespace = None):
X        """Create a new completer for the command line.
X
X        PyCompleter([namespace]) -> completer instance.
X
X        If unspecified, the default namespace where completions are performed
X        is __main__ (technically, __main__.__dict__). Namespaces should be
X        given as dictionaries.
X        """
X
X        if namespace and not isinstance(namespace, dict):
X            raise TypeError,'namespace must be a dictionary'
X
X        # Don't bind to namespace quite yet, but flag whether the user wants a
X        # specific namespace or to use __main__.__dict__. This will allow us
X        # to bind to __main__.__dict__ at completion time, not now.
X        if namespace is None:
X            self.use_main_ns = 1
X        else:
X            self.use_main_ns = 0
X            self.namespace = namespace
X
X    def complete(self, text, state):
X        """Return the next possible completion for 'text'.
X
X        This is called successively with state == 0, 1, 2, ... until it
X        returns None.  The completion should begin with 'text'.
X
X        """
X        if self.use_main_ns:
X            import __main__
X            self.namespace = __main__.__dict__
X
X        try:
X            if state == 0:
X                if "." in text:
X                    self.matches = self.attr_matches(text)
X                else:
X                    self.matches = self.global_matches(text)
X            return self.matches[state]
X        except (AttributeError, IndexError, NameError):
X            return None
X
X    def global_matches(self, text):
X        """Compute matches when text is a simple name.
X
X        Return a list of all keywords, built-in functions and names currently
X        defined in self.namespace that match.
X
X        """
X        matches = []
X        n = len(text)
X        for list in [keyword.kwlist,
X                     __builtin__.__dict__,
X                     self.namespace]:
X            for word in list:
X                if word[:n] == text and word != "__builtins__":
X                    matches.append(word)
X        return matches
X
X    def attr_matches(self, text):
X        """Compute matches when text contains a dot.
X
X        Assuming the text is of the form NAME.NAME....[NAME], and is
X        evaluatable in self.namespace, it will be evaluated and its attributes
X        (as revealed by dir()) are used as possible completions.  (For class
X        instances, class members are also considered.)
X
X        WARNING: this can still invoke arbitrary C code, if an object
X        with a __getattr__ hook is evaluated.
X
X        """
X        m = re.match(r"(\w+(\.\w+)*)\.(\w*)", text)
X        if not m:
X            return
X        expr, attr = m.group(1, 3)
X        object = eval(expr, self.namespace)
X        words = dir(object)
X        if hasattr(object,'__class__'):
X            words.append('__class__')
X            words = words + get_class_members(object.__class__)
X        matches = []
X        n = len(attr)
X        for word in words:
X            if word[:n] == attr and word != "__builtins__":
X                matches.append("%s.%s" % (expr, word))
X        return matches
X
Xdef get_class_members(klass):
X    ret = dir(klass)
X    if hasattr(klass,'__bases__'):
X        for base in klass.__bases__:
X            ret = ret + get_class_members(base)
X    return ret
X
X
Xclass JvCompleter(ReadlineCompleter):
X    """Create a new completer for the command line.
X
X    JvCompleter([completion_callable]) -> completer instance.
X
X    JvCompleter instances should be used as the completion mechanism
X    of Readline via the setCompleter() call.
X    """
X    def __init__(self, realcompleter):
X        self.realcompleter = realcompleter
X    def completer(self, text, state):
X        return self.realcompleter(text, state)
X
X
Xpycompleter = PyCompleter()
Xjvcompleter = JvCompleter(pycompleter.complete)
XReadline.setCompleter(jvcompleter)
XReadline.parseAndBind("tab: complete")
Xtry:
X    Readline.setCompletionAppendCharacter('\0')
Xexcept:
X    pass  # Method only available from my java-readline patch.
X
Xif __name__ == '__main__':
X    print "Sorry, no unit tests yet!"
X
X#EOF#
END-of-devel/libreadline-java/files/JReadlineCompleter.py
echo x - devel/libreadline-java/files/jython.sh
sed 's/^X//' >devel/libreadline-java/files/jython.sh << 'END-of-devel/libreadline-java/files/jython.sh'
X#!/bin/sh
X# Invoke Jython.
X# jython.sh,v 1.5 2007/09/28 09:13:55 martin Exp
X#
X# The path names below are for Jython 2.2 on FreeBSD.
X#
X
XCP="/usr/local/lib/jython22/jython.jar"
Xdefs=
Xwrapper=
X
Xcase "${JYTHON_CONSOLE:-Editline}" in
X    *[Ee]dit[Ll]ine)
X	CP="$CP:/usr/local/share/java/classes/libreadline-java.jar"
X	defs="-Dpython.console=org.python.util.ReadlineConsole"
X	defs="$defs -Dpython.console.readlinelib=Editline"
X	;;
X    *[Gg]et[Ll]ine)
X	CP="$CP:/usr/local/share/java/classes/libreadline-java.jar"
X	defs="-Dpython.console=org.python.util.ReadlineConsole"
X	defs="$defs -Dpython.console.readlinelib=Getline"
X	;;
X    *[Jj][Ll]ine)
X	CP="$CP:/usr/local/share/java/classes/jline.jar"
X	defs="-Dpython.console="
X	wrapper=jline.ConsoleRunner
X	;;
X    *[Rr]ead[Ll]ine)
X	CP="$CP:/usr/local/share/java/classes/libreadline-java.jar"
X	defs="-Dpython.console=org.python.util.ReadlineConsole"
X	defs="$defs -Dpython.console.readlinelib=GnuReadline"
X	;;
X    *)
X	echo >&2 "$0: illegal value of JYTHON_CONSOLE: $JYTHON_CONSOLE"
X	exit 64
X	;;
Xesac
X
X
Xif [ -n "$CLASSPATH" ]; then
X  CP="$CP:$CLASSPATH"
Xfi
X
Xexec java -Dpython.home="/usr/local/lib/jython22"	\
X    -Dpython.cachedir="${HOME}/.jython-cachedir"	\
X    -classpath "$CP" $wrapper org.python.util.jython $defs "$@"
X
X#EOF#
END-of-devel/libreadline-java/files/jython.sh
echo x - devel/libreadline-java/files/patch-Makefile
sed 's/^X//' >devel/libreadline-java/files/patch-Makefile << 'END-of-devel/libreadline-java/files/patch-Makefile'
X--- Makefile	2003-01-07 11:14:35.000000000 +0100
X+++ /tmp/libreadline-java-0.8.0/Makefile	2007-09-22 22:11:13.000000000 +0200
X@@ -54,11 +54,11 @@
X JAVALIBDIR= $(PREFIX)/share/java
X 
X # libraries to build
X-T_LIBS    = JavaReadline
X+T_LIBS    = JavaReadline JavaEditline JavaGetline
X 
X # Operating system dependent
X JAVAINCLUDE       = $(JAVA_HOME)/include
X-JAVANATINC        = $(JAVA_HOME)/include/linux
X+JAVANATINC        = $(JAVA_HOME)/include/freebsd
X 
X ifeq (MSC,$(WIN32))
X JAVA_HOME := c:/j2sdk1.4.0
X@@ -69,9 +69,14 @@
X endif
X 
X ## normal javac
X-JAVAC = javac
X+JAVAC ?= javac
X JC_FLAGS = 
X 
X+## other tools
X+JAVA ?= java
X+JAVAH ?= javah
X+JAR_ ?= jar
X+
X ## with jikes
X #JAVAC = jikes
X #JC_FLAGS = -O +E
X@@ -86,7 +91,7 @@
X world : jar build-native
X 
X jar: build-java
X-	cd $(BUILDDIR) ; jar -cvmf ../$(MF_STUB) ../$(JAR) *
X+	cd $(BUILDDIR) ; $(JAR_) -cvmf ../$(MF_STUB) ../$(JAR) *
X 
X $(JAR):
X 	cd $(BUILDDIR) ; jar -cvmf ../$(MF_STUB) ../$(JAR) *
X@@ -96,7 +101,7 @@
X 
X build-native: 
X 	cd src; $(MAKE) T_LIBS="$(T_LIBS)" JAVAINCLUDE="$(JAVAINCLUDE)" \
X-		        JAVANATINC="$(JAVANATINC)" native
X+		        JAVANATINC="$(JAVANATINC)" JAVAH="$(JAVAH)" native
X 
X apidoc: $(APIDIR)
X 	javadoc -sourcepath src -d $(APIDIR) -windowtitle $(WTITLE) \
X@@ -140,7 +145,7 @@
X 	rpm --define _topdir$(RPM_BASE) -ba $(RPM_BASE)/SPECS/libreadline-java.spec
X 
X test: $(JAR) build-native
X-	LD_LIBRARY_PATH=. java -jar $(JAR) src/test/tinputrc $(ARGS)
X+	LD_LIBRARY_PATH=. $(JAVA) -jar $(JAR) src/test/tinputrc $(ARGS)
X 
X clean:
X 	$(MAKE) -C src/native clean
END-of-devel/libreadline-java/files/patch-Makefile
echo x - devel/libreadline-java/files/patch-src-Makefile
sed 's/^X//' >devel/libreadline-java/files/patch-src-Makefile << 'END-of-devel/libreadline-java/files/patch-src-Makefile'
X--- src/Makefile	2003-01-07 11:14:35.000000000 +0100
X+++ /tmp/libreadline-java-0.8.0/src/Makefile	2007-09-21 07:45:38.000000000 +0200
X@@ -10,7 +10,7 @@
X 
X native: always
X 	cd native ; $(MAKE) T_LIBS="$(T_LIBS)" JAVAINCLUDE="$(JAVAINCLUDE)" \
X-                            JAVANATINC="$(JAVANATINC)" all
X+                            JAVANATINC="$(JAVANATINC)" JAVAH="$(JAVAH)" all
X 
X $(BUILD):
X 	mkdir $@
END-of-devel/libreadline-java/files/patch-src-Makefile
echo x - devel/libreadline-java/files/patch-src-native-Makefile
sed 's/^X//' >devel/libreadline-java/files/patch-src-native-Makefile << 'END-of-devel/libreadline-java/files/patch-src-native-Makefile'
X--- src/native/Makefile.orig	2003-01-07 11:14:35.000000000 +0100
X+++ src/native/Makefile	2007-09-28 08:40:49.000000000 +0200
X@@ -44,10 +44,12 @@
X LIB_EXT := dll
X CFLAGS=-DWIN32=$(WIN32) -D__IBMC__
X else
X-INCLUDES          = -I $(JAVAINCLUDE) -I $(JAVANATINC)
X-LIBPATH           = -L/usr/lib/termcap 
X+INCLUDES          = -I $(JAVAINCLUDE) -I $(JAVANATINC) -I $(LOCALBASE)/include
X+ifeq (JavaEditline,$(TG))
X+LIBPATH           = -L$(LOCALBASE)/lib -rpath $(LOCALBASE)/lib
X+endif
X JavaReadline_LIBS = -lreadline -ltermcap -lhistory
X-JavaEditline_LIBS = -ledit -ltermcap
X+JavaEditline_LIBS = $(LOCALBASE)/lib/libedit.so -ltermcap
X ifeq (cygwin,$(WIN32))
X JavaGetline_LIBS = -lcygwin
X endif
X@@ -55,8 +57,9 @@
X OBJ_EXT := o
X LIB_PRE := lib
X LIB_EXT := so
X-CFLAGS=-fPIC -DPOSIX
X+CFLAGS+=-fPIC -DPOSIX
X endif
X+JAVAH ?= javah
X 
X 
X OBJECTS := org_gnu_readline_Readline.$(OBJ_EXT)
X@@ -110,7 +113,7 @@
X 	                                   -c org_gnu_readline_Readline.c
X 
X org_gnu_readline_Readline.h: $(BUILDDIR)/org/gnu/readline/Readline.class
X-	javah -classpath $(BUILDDIR) -jni org.gnu.readline.Readline
X+	$(JAVAH) -classpath $(BUILDDIR) -jni org.gnu.readline.Readline
X 	touch org_gnu_readline_Readline.h
X 
X clean:
END-of-devel/libreadline-java/files/patch-src-native-Makefile
echo x - devel/libreadline-java/files/patch-src-native-getline.c
sed 's/^X//' >devel/libreadline-java/files/patch-src-native-getline.c << 'END-of-devel/libreadline-java/files/patch-src-native-getline.c'
X--- src/native/getline.c	2003-01-07 11:14:35.000000000 +0100
X+++ /tmp/libreadline-java-0.8.0/src/native/getline.c	2007-09-22 22:20:06.000000000 +0200
X@@ -136,7 +136,6 @@
X #ifndef __convexc__
X extern int      read();
X extern int      kill();
X-extern int      ioctl();
X #endif /* not __convexc__ */
X #ifdef POSIX		/* use POSIX interface */
X #include <termios.h>
END-of-devel/libreadline-java/files/patch-src-native-getline.c
echo x - devel/libreadline-java/files/patch-src-native-org_gnu_readline_Readline.c
sed 's/^X//' >devel/libreadline-java/files/patch-src-native-org_gnu_readline_Readline.c << 'END-of-devel/libreadline-java/files/patch-src-native-org_gnu_readline_Readline.c'
X--- src/native/org_gnu_readline_Readline.c.orig	2003-01-07 11:14:35.000000000 +0100
X+++ src/native/org_gnu_readline_Readline.c	2007-09-27 09:21:14.000000000 +0200
X@@ -560,6 +560,21 @@
X #endif
X 
X /* -------------------------------------------------------------------------- */
X+/* Sets/gets rl_completion_append_character                                   */
X+/* -------------------------------------------------------------------------- */
X+
X+#ifndef JavaGetline
X+JNIEXPORT jchar JNICALL
X+Java_org_gnu_readline_Readline_setCompletionAppendCharacterImpl
X+(JNIEnv * env, jclass class, jchar appendCharacter) {
X+	int previous_setting = rl_completion_append_character;
X+
X+	rl_completion_append_character = (int)appendCharacter;
X+	return (jchar)previous_setting;
X+}
X+#endif
X+
X+/* -------------------------------------------------------------------------- */
X /* Convert utf8-string to ucs1-string                   .                     */
X /* -------------------------------------------------------------------------- */
X 
END-of-devel/libreadline-java/files/patch-src-native-org_gnu_readline_Readline.c
echo x - devel/libreadline-java/files/patch-src-org-gnu-readline-Readline.java
sed 's/^X//' >devel/libreadline-java/files/patch-src-org-gnu-readline-Readline.java << 'END-of-devel/libreadline-java/files/patch-src-org-gnu-readline-Readline.java'
X--- src/org/gnu/readline/Readline.java.orig	2003-01-07 11:14:35.000000000 +0100
X+++ src/org/gnu/readline/Readline.java	2007-09-27 08:52:01.000000000 +0200
X@@ -568,6 +568,31 @@
X   /////////////////////////////////////////////////////////////////////////////
X 
X   /**
X+     Query and set the completion append character. You might need
X+     this in a {@link ReadlineCompleter} implementation. The argument
X+     appendCharacter should be in the ASCII range.
X+
X+     <p>Supporting implementations:
X+        <ul>
X+	  <li>GNU-Readline</li>
X+	  <li>Editline</li>
X+        </ul>
X+     </p>
X+
X+  */
X+    
X+  public static char setCompletionAppendCharacter(char appendCharacter) {
X+    if (iLib == ReadlineLibrary.GnuReadline || iLib == ReadlineLibrary.Editline)
X+      return setCompletionAppendCharacterImpl(appendCharacter);
X+    else if (iThrowException)
X+      throw new UnsupportedOperationException();
X+    else
X+      return '\uFFFF';
X+  }
X+
X+  /////////////////////////////////////////////////////////////////////////////
X+
X+  /**
X      Query the current line buffer. This returns the current content of
X      the internal line buffer. You might need this in a 
X      {@link ReadlineCompleter} implementation to access the full text
X@@ -838,4 +863,17 @@
X   private native static void 
X     setWordBreakCharactersImpl(String wordBreakCharacters)
X                               throws UnsupportedEncodingException;
X+
X+  /////////////////////////////////////////////////////////////////////////////
X+
X+  /**
X+     Native implementation of setCompletionAppendCharacter()
X+
X+     @see 
X+   org.gnu.readline.Readline#setCompletionAppendCharacter(char appendCharacter)
X+  */
X+
X+  private native static char 
X+    setCompletionAppendCharacterImpl(char appendCharacter);
X+
X }
END-of-devel/libreadline-java/files/patch-src-org-gnu-readline-Readline.java
exit

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list