Hello community,

here is the log from the commit of package go-go-readline for openSUSE:Factory 
checked in at 2012-01-19 09:42:02
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/go-go-readline (Old)
 and      /work/SRC/openSUSE:Factory/.go-go-readline.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "go-go-readline", Maintainer is ""

Changes:
--------
--- /work/SRC/openSUSE:Factory/go-go-readline/go-go-readline.changes    
2011-10-27 12:16:24.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.go-go-readline.new/go-go-readline.changes       
2012-01-19 09:42:04.000000000 +0100
@@ -1,0 +2,6 @@
+Tue Jan 10 08:46:28 UTC 2012 - [email protected]
+
+- Update to 10/01/2012 mercurial version:
+  * Adjust to recent Go changes
+
+-------------------------------------------------------------------

Old:
----
  go-readline-0.0.0+hg20110702.tar.bz2

New:
----
  go-readline-0.0.0+hg20120110.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ go-go-readline.spec ++++++
--- /var/tmp/diff_new_pack.eMLGoB/_old  2012-01-19 09:42:05.000000000 +0100
+++ /var/tmp/diff_new_pack.eMLGoB/_new  2012-01-19 09:42:05.000000000 +0100
@@ -1,5 +1,8 @@
 #
-# Copyright (c), 2011, Sascha Peilicke <[email protected]>
+# spec file for package go-go-readline
+#
+# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2011 Sascha Peilicke <[email protected]>
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -10,18 +13,22 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
+# Please submit bugfixes or comments via http://bugs.opensuse.org/
+#
+
 Name:           go-go-readline
-Version:        0.0.0+hg20110702
+Version:        0.0.0+hg20120110
 Release:        0
 Summary:        Readline support for Go
-Group:          Development/Languages/Other
 License:        BSD-2-Clause
-URL:            https://bitbucket.org/binet/go-readline/
+Group:          Development/Languages/Other
+Url:            https://bitbucket.org/binet/go-readline/
 Source0:        go-readline-%{version}.tar.bz2
+# PATCH-FIX-OPENSUSE -- Need different import statements for local build
 Patch0:         go-readline-fix-local-imports.patch
-BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 BuildRequires:  go-devel
 BuildRequires:  readline-devel
+BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 %{go_provides}
 %{go_requires}
 %{go_disable_brp_strip_static_archive}
@@ -40,9 +47,6 @@
 %check
 %{go_make_test}
 
-%clean
-rm -rf %{buildroot}
-
 %files
 %defattr(-,root,root,-)
 %doc README

++++++ go-readline-0.0.0+hg20110702.tar.bz2 -> 
go-readline-0.0.0+hg20120110.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/go-readline/readline.go new/go-readline/readline.go
--- old/go-readline/readline.go 2011-07-02 11:50:35.000000000 +0200
+++ new/go-readline/readline.go 2012-01-10 09:42:15.000000000 +0100
@@ -12,32 +12,52 @@
  #include <string.h>
  #include <readline/readline.h>
  #include <readline/history.h>
- */
+
+ char* _go_readline_strarray_at(char **strarray, int idx) 
+ {
+   return strarray[idx];
+ }
+
+ int _go_readline_strarray_len(char **strarray)
+ {
+   int sz = 0;
+   while (strarray[sz] != NULL) {
+     sz += 1;
+   }
+   return sz;
+ }
+*/
 import "C"
 import "unsafe"
-import "os"
+import "syscall"
 
 func ReadLine(prompt *string) *string {
-       var p *C.char;
+       var p *C.char
 
        //readline allows an empty prompt(NULL)
-       if prompt != nil { p = C.CString(*prompt) }
+       if prompt != nil {
+               p = C.CString(*prompt)
+       }
 
-       ret := C.readline(p);
+       ret := C.readline(p)
 
-       if p != nil { C.free(unsafe.Pointer(p)) }
+       if p != nil {
+               C.free(unsafe.Pointer(p))
+       }
 
-       if ret == nil { return nil } //EOF
+       if ret == nil {
+               return nil
+       } //EOF
 
-       s := C.GoString(ret);
-       C.free(unsafe.Pointer(ret));
+       s := C.GoString(ret)
+       C.free(unsafe.Pointer(ret))
        return &s
 }
 
 func AddHistory(s string) {
-       p := C.CString(s);
+       p := C.CString(s)
        defer C.free(unsafe.Pointer(p))
-       C.add_history(p);       
+       C.add_history(p)
 }
 
 // Parse and execute single line of a readline init file.
@@ -49,20 +69,26 @@
 
 // Parse a readline initialization file.
 // The default filename is the last filename used.
-func ReadInitFile(s string) os.Errno {
+func ReadInitFile(s string) error {
        p := C.CString(s)
        defer C.free(unsafe.Pointer(p))
        errno := C.rl_read_init_file(p)
-       return os.Errno(errno)
+       if errno == 0 {
+               return nil
+       }
+       return syscall.Errno(errno)
 }
 
 // Load a readline history file.
 // The default filename is ~/.history.
-func ReadHistoryFile(s string) os.Errno {
+func ReadHistoryFile(s string) error {
        p := C.CString(s)
        defer C.free(unsafe.Pointer(p))
        errno := C.read_history(p)
-       return os.Errno(errno)
+       if errno == 0 {
+               return nil
+       }
+       return syscall.Errno(errno)
 }
 
 var (
@@ -71,14 +97,17 @@
 
 // Save a readline history file.
 // The default filename is ~/.history.
-func WriteHistoryFile(s string) os.Errno {
+func WriteHistoryFile(s string) error {
        p := C.CString(s)
        defer C.free(unsafe.Pointer(p))
        errno := C.write_history(p)
-       if errno==0 && HistoryLength >= 0 {
+       if errno == 0 && HistoryLength >= 0 {
                errno = C.history_truncate_file(p, C.int(HistoryLength))
        }
-       return os.Errno(errno)
+       if errno == 0 {
+               return nil
+       }
+       return syscall.Errno(errno)
 }
 
 // Set the readline word delimiters for tab-completion
@@ -95,4 +124,24 @@
        delims := C.GoString(cstr)
        return delims
 }
+
+// 
+func CompletionMatches(text string, cbk func(text string, state int) string) 
[]string {
+       c_text := C.CString(text)
+       defer C.free(unsafe.Pointer(c_text))
+       c_cbk := (*C.rl_compentry_func_t)(unsafe.Pointer(&cbk))
+       c_matches := C.rl_completion_matches(c_text, c_cbk)
+       n_matches := int(C._go_readline_strarray_len(c_matches))
+       matches := make([]string, n_matches)
+       for i := 0; i < n_matches; i++ {
+               matches[i] = C.GoString(C._go_readline_strarray_at(c_matches, 
C.int(i)))
+       }
+       return matches
+}
+
+//
+func SetAttemptedCompletionFunction(cbk func(text string, start, end int) 
[]string) {
+       c_cbk := (*C.rl_completion_func_t)(unsafe.Pointer(&cbk))
+       C.rl_attempted_completion_function = c_cbk
+}
 /* EOF */

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to