Skip to content
Browse files

Fixes for CFFI 0.11.0

  • Loading branch information...
1 parent 4416c9e commit 9cd1049f66c595ac0bdfd97d744305fa2ee76f49 @sionescu sionescu committed
Showing with 52 additions and 28 deletions.
  1. +7 −7 src/cffi-regex/cffi-regex-grovel.lisp
  2. +43 −19 src/cffi-regex/cffi-regex.lisp
  3. +2 −2 src/cffi-regex/regex.lisp
View
14 src/cffi-regex/cffi-regex-grovel.lisp
@@ -29,11 +29,11 @@
(include "string.h")
;; c typdefs
-(ctype :size-t "size_t")
-(ctype :s-reg "s_reg_t")
-(ctype :active-reg "active_reg_t")
-(ctype :reg-syntax "reg_syntax_t")
-(ctype :regoff "regoff_t")
+(ctype size-t "size_t")
+(ctype s-reg "s_reg_t")
+(ctype active-reg "active_reg_t")
+(ctype reg-syntax "reg_syntax_t")
+(ctype regoff "regoff_t")
;; option constants
(constant (+backslash-escape-in-lists+ "RE_BACKSLASH_ESCAPE_IN_LISTS"))
@@ -122,7 +122,7 @@
(buffer "buffer" :type :string)
(allocated "allocated" :type :long)
(used "used" :type :long)
- (syntax "syntax" :type :reg-syntax)
+ (syntax "syntax" :type reg-syntax)
(fastmap "fastmap" :type :pointer)
(translate "translate" :type :pointer)
- (nsub "re_nsub" :type :size-t))
+ (nsub "re_nsub" :type size-t))
View
62 src/cffi-regex/cffi-regex.lisp
@@ -30,37 +30,61 @@
(start :pointer)
(end :pointer))
-(defcfun ("re_set_syntax" set-syntax) :reg-syntax (syntax :reg-syntax))
+(defctype registers (:struct registers))
+
+(defctype pattern-buffer (:struct pattern-buffer))
+
+(defcfun ("re_set_syntax" set-syntax) reg-syntax
+ (syntax reg-syntax))
(defcfun ("re_compile_pattern" compile-pattern) :string
- (pattern :string) (length :size-t) (buffer pattern-buffer))
+ (pattern :string)
+ (length size-t)
+ (buffer (:pointer pattern-buffer)))
-(defcfun ("re_compile_fastmap" compile-fastmap) :int (buffer pattern-buffer))
+(defcfun ("re_compile_fastmap" compile-fastmap) :int
+ (buffer (:pointer pattern-buffer)))
(defcfun ("re_search" %regex-search) :int
- (buffer pattern-buffer) (string :string) (length :int) (start :int)
- (range :int) (registers registers))
+ (buffer (:pointer pattern-buffer))
+ (string :string)
+ (length :int)
+ (start :int)
+ (range :int)
+ (registers (:pointer registers)))
(defcfun ("re_search_2" %regex-search-2) :int
- (buffer pattern-buffer)
- (string1 :string) (length1 :int)
- (string2 :string) (length2 :int)
- (start :int) (range :int)
- (registers registers)
+ (buffer (:pointer pattern-buffer))
+ (string1 :string)
+ (length1 :int)
+ (string2 :string)
+ (length2 :int)
+ (start :int)
+ (range :int)
+ (registers (:pointer registers))
(stop :int))
(defcfun ("re_match" %regex-match) :int
- (buffer pattern-buffer) (string :string) (length :int) (start :int)
- (registers registers))
+ (buffer (:pointer pattern-buffer))
+ (string :string)
+ (length :int)
+ (start :int)
+ (registers (:pointer registers)))
(defcfun ("re_match_2" %regex-match-2) :int
- (buffer pattern-buffer)
- (string1 :string) (length1 :int)
- (string2 :string) (length2 :int)
- (start :int) (range :int)
- (registers registers)
+ (buffer (:pointer pattern-buffer))
+ (string1 :string)
+ (length1 :int)
+ (string2 :string)
+ (length2 :int)
+ (start :int)
+ (range :int)
+ (registers (:pointer registers))
(stop :int))
(defcfun ("re_set_registers" %regex-set-registers) :void
- (buffer pattern-buffer) (registers registers)
- (num-regs :unsigned-int) (starts :regoff) (ends :regoff))
+ (buffer (:pointer pattern-buffer))
+ (registers (:pointer registers))
+ (num-regs :unsigned-int)
+ (starts regoff)
+ (ends regoff))
View
4 src/cffi-regex/regex.lisp
@@ -55,10 +55,10 @@ Return START and END of register match # INDEX in libc regex REGISTERS
(values
(mem-aref
(mem-aref (foreign-slot-pointer registers 'registers 'start) :pointer)
- :regoff index)
+ 'regoff index)
(mem-aref
(mem-aref (foreign-slot-pointer registers 'registers 'end) :pointer)
- :regoff index)))
+ 'regoff index)))
(flet ((%search (buffer registers target-string start end)
(let ((startpos (%regex-search buffer target-string (length target-string)

0 comments on commit 9cd1049

Please sign in to comment.
Something went wrong with that request. Please try again.