clucumber 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. data/LICENSE +1 -1
  2. data/README.md +4 -9
  3. data/lib/clucumber/clucumber-bootstrap.lisp +32 -0
  4. data/lib/clucumber/vendor/cl-interpol/alias.lisp +55 -0
  5. data/lib/clucumber/vendor/cl-interpol/cl-interpol.asd +56 -0
  6. data/lib/clucumber/vendor/cl-interpol/load.lisp +53 -0
  7. data/lib/clucumber/vendor/cl-interpol/packages.lisp +40 -0
  8. data/lib/clucumber/vendor/cl-interpol/read.lisp +716 -0
  9. data/lib/clucumber/vendor/cl-interpol/specials.lisp +113 -0
  10. data/lib/clucumber/vendor/cl-interpol/test/packages.lisp +34 -0
  11. data/lib/clucumber/vendor/cl-interpol/test/tests.lisp +128 -0
  12. data/lib/clucumber/vendor/cl-interpol/test.lisp +177 -0
  13. data/lib/clucumber/vendor/cl-interpol/test2.lisp +6254 -0
  14. data/lib/clucumber/vendor/cl-interpol/unicode.lisp +13912 -0
  15. data/lib/clucumber/vendor/cl-interpol/util.lisp +122 -0
  16. data/lib/clucumber/vendor/cl-ppcre/api.lisp +1262 -0
  17. data/lib/clucumber/vendor/cl-ppcre/charmap.lisp +152 -0
  18. data/lib/clucumber/vendor/cl-ppcre/charset.lisp +242 -0
  19. data/lib/clucumber/vendor/cl-ppcre/chartest.lisp +98 -0
  20. data/lib/clucumber/vendor/cl-ppcre/cl-ppcre-test.asd +34 -0
  21. data/lib/clucumber/vendor/cl-ppcre/cl-ppcre-unicode/packages.lisp +38 -0
  22. data/lib/clucumber/vendor/cl-ppcre/cl-ppcre-unicode/resolver.lisp +61 -0
  23. data/lib/clucumber/vendor/cl-ppcre/cl-ppcre-unicode.asd +58 -0
  24. data/lib/clucumber/vendor/cl-ppcre/cl-ppcre.asd +79 -0
  25. data/lib/clucumber/vendor/cl-ppcre/closures.lisp +471 -0
  26. data/lib/clucumber/vendor/cl-ppcre/convert.lisp +875 -0
  27. data/lib/clucumber/vendor/cl-ppcre/errors.lisp +84 -0
  28. data/lib/clucumber/vendor/cl-ppcre/lexer.lisp +737 -0
  29. data/lib/clucumber/vendor/cl-ppcre/lispworks-defsystem.lisp +57 -0
  30. data/lib/clucumber/vendor/cl-ppcre/load.lisp +67 -0
  31. data/lib/clucumber/vendor/cl-ppcre/optimize.lisp +578 -0
  32. data/lib/clucumber/vendor/cl-ppcre/packages.lisp +68 -0
  33. data/lib/clucumber/vendor/cl-ppcre/parser.lisp +319 -0
  34. data/lib/clucumber/vendor/cl-ppcre/ppcre-tests.lisp +269 -0
  35. data/lib/clucumber/vendor/cl-ppcre/regex-class-util.lisp +555 -0
  36. data/lib/clucumber/vendor/cl-ppcre/regex-class.lisp +259 -0
  37. data/lib/clucumber/vendor/cl-ppcre/repetition-closures.lisp +833 -0
  38. data/lib/clucumber/vendor/cl-ppcre/scanner.lisp +506 -0
  39. data/lib/clucumber/vendor/cl-ppcre/specials.lisp +172 -0
  40. data/lib/clucumber/vendor/cl-ppcre/test/packages.lisp +37 -0
  41. data/lib/clucumber/vendor/cl-ppcre/test/perl-tests.lisp +150 -0
  42. data/lib/clucumber/vendor/cl-ppcre/test/tests.lisp +159 -0
  43. data/lib/clucumber/vendor/cl-ppcre/test/unicode-tests.lisp +80 -0
  44. data/lib/clucumber/vendor/cl-ppcre/util.lisp +201 -0
  45. data/lib/clucumber/vendor/cl-unicode/alias.lisp +135 -0
  46. data/lib/clucumber/vendor/cl-unicode/api.lisp +412 -0
  47. data/lib/clucumber/vendor/cl-unicode/build/char-info.lisp +133 -0
  48. data/lib/clucumber/vendor/cl-unicode/build/dump.lisp +239 -0
  49. data/lib/clucumber/vendor/cl-unicode/build/read.lisp +280 -0
  50. data/lib/clucumber/vendor/cl-unicode/build/util.lisp +182 -0
  51. data/lib/clucumber/vendor/cl-unicode/cl-unicode.asd +90 -0
  52. data/lib/clucumber/vendor/cl-unicode/conditions.lisp +54 -0
  53. data/lib/clucumber/vendor/cl-unicode/derived.lisp +120 -0
  54. data/lib/clucumber/vendor/cl-unicode/hash-tables.lisp +20 -0
  55. data/lib/clucumber/vendor/cl-unicode/lists.lisp +10 -0
  56. data/lib/clucumber/vendor/cl-unicode/methods.lisp +15 -0
  57. data/lib/clucumber/vendor/cl-unicode/packages.lisp +76 -0
  58. data/lib/clucumber/vendor/cl-unicode/specials.lisp +135 -0
  59. data/lib/clucumber/vendor/cl-unicode/test/packages.lisp +34 -0
  60. data/lib/clucumber/vendor/cl-unicode/test/tests.lisp +150 -0
  61. data/lib/clucumber/vendor/cl-unicode/test-functions.lisp +94 -0
  62. data/lib/clucumber/vendor/cl-unicode/util.lisp +274 -0
  63. data/lib/clucumber/vendor/lift/compare/fiveam-tests.lisp +14 -0
  64. data/lib/clucumber/vendor/lift/compare/lift-tests.lisp +13 -0
  65. data/lib/clucumber/vendor/lift/compare/rt-tests.lisp +16 -0
  66. data/lib/clucumber/vendor/lift/compare/xlunit-tests.lisp +15 -0
  67. data/lib/clucumber/vendor/lift/dev/changes.lisp +61 -0
  68. data/lib/clucumber/vendor/lift/dev/config.lisp +354 -0
  69. data/lib/clucumber/vendor/lift/dev/copy-file.lisp +117 -0
  70. data/lib/clucumber/vendor/lift/dev/introspection.lisp +232 -0
  71. data/lib/clucumber/vendor/lift/dev/lift-interface.lisp +56 -0
  72. data/lib/clucumber/vendor/lift/dev/lift-notes.lisp +202 -0
  73. data/lib/clucumber/vendor/lift/dev/lift-randomized.lisp +45 -0
  74. data/lib/clucumber/vendor/lift/dev/lift.lisp +2383 -0
  75. data/lib/clucumber/vendor/lift/dev/macros.lisp +229 -0
  76. data/lib/clucumber/vendor/lift/dev/measuring.lisp +156 -0
  77. data/lib/clucumber/vendor/lift/dev/packages.lisp +161 -0
  78. data/lib/clucumber/vendor/lift/dev/port.lisp +151 -0
  79. data/lib/clucumber/vendor/lift/dev/prototypes.lisp +282 -0
  80. data/lib/clucumber/vendor/lift/dev/random-testing.lisp +124 -0
  81. data/lib/clucumber/vendor/lift/dev/report-locations.lisp +13 -0
  82. data/lib/clucumber/vendor/lift/dev/reports.lisp +916 -0
  83. data/lib/clucumber/vendor/lift/dev/utilities.lisp +242 -0
  84. data/lib/clucumber/vendor/lift/docs/package.lisp +6 -0
  85. data/lib/clucumber/vendor/lift/docs/setup.lisp +17 -0
  86. data/lib/clucumber/vendor/lift/examples/basic-examples.lisp +289 -0
  87. data/lib/clucumber/vendor/lift/examples/random-testing.lisp +32 -0
  88. data/lib/clucumber/vendor/lift/lift-documentation.asd +28 -0
  89. data/lib/clucumber/vendor/lift/lift-test.asd +35 -0
  90. data/lib/clucumber/vendor/lift/lift.asd +77 -0
  91. data/lib/clucumber/vendor/lift/test/equality-tests.lisp +40 -0
  92. data/lib/clucumber/vendor/lift/test/finding-tests.lisp +32 -0
  93. data/lib/clucumber/vendor/lift/test/lift-test.lisp +783 -0
  94. data/lib/clucumber/vendor/lift/test/order-of-operations.lisp +54 -0
  95. data/lib/clucumber/vendor/lift/test/packages.lisp +17 -0
  96. data/lib/clucumber/vendor/lift/test/test-config-files.lisp +20 -0
  97. data/lib/clucumber/vendor/lift/test/test-dynamic-variables.lisp +57 -0
  98. data/lib/clucumber/vendor/lift/test/test-maximum-problems.lisp +74 -0
  99. data/lib/clucumber/vendor/lift/test/test-prototypes.lisp +278 -0
  100. data/lib/clucumber/vendor/lift/test/test-timeout.lisp +37 -0
  101. data/lib/clucumber/vendor/lift/test/tests-in-progress.lisp +62 -0
  102. data/lib/clucumber/vendor/lift/test/testsuite-expects.lisp +60 -0
  103. data/lib/clucumber/vendor/lift/timeout/package.lisp +13 -0
  104. data/lib/clucumber/vendor/lift/timeout/with-timeout.lisp +123 -0
  105. data/lib/clucumber/vendor/lift/website/stuff/Temp.lisp +34 -0
  106. data/lib/clucumber/vendor/st-json/st-json.asd +3 -0
  107. data/lib/clucumber/vendor/st-json/st-json.lisp +310 -0
  108. data/lib/clucumber/vendor/trivial-backtrace/dev/backtrace.lisp +127 -0
  109. data/lib/clucumber/vendor/trivial-backtrace/dev/fallback.lisp +10 -0
  110. data/lib/clucumber/vendor/trivial-backtrace/dev/map-backtrace.lisp +103 -0
  111. data/lib/clucumber/vendor/trivial-backtrace/dev/mucking.lisp +75 -0
  112. data/lib/clucumber/vendor/trivial-backtrace/dev/packages.lisp +13 -0
  113. data/lib/clucumber/vendor/trivial-backtrace/dev/utilities.lisp +104 -0
  114. data/lib/clucumber/vendor/trivial-backtrace/test/packages.lisp +5 -0
  115. data/lib/clucumber/vendor/trivial-backtrace/test/test-setup.lisp +4 -0
  116. data/lib/clucumber/vendor/trivial-backtrace/test/tests.lisp +16 -0
  117. data/lib/clucumber/vendor/trivial-backtrace/trivial-backtrace-test.asd +22 -0
  118. data/lib/clucumber/vendor/trivial-backtrace/trivial-backtrace.asd +35 -0
  119. data/lib/clucumber/vendor/usocket/backend/allegro.lisp +199 -0
  120. data/lib/clucumber/vendor/usocket/backend/armedbear.lisp +491 -0
  121. data/lib/clucumber/vendor/usocket/backend/clisp.lisp +260 -0
  122. data/lib/clucumber/vendor/usocket/backend/cmucl.lisp +266 -0
  123. data/lib/clucumber/vendor/usocket/backend/lispworks.lisp +741 -0
  124. data/lib/clucumber/vendor/usocket/backend/mcl.lisp +369 -0
  125. data/lib/clucumber/vendor/usocket/backend/openmcl.lisp +206 -0
  126. data/lib/clucumber/vendor/usocket/backend/sbcl.lisp +424 -0
  127. data/lib/clucumber/vendor/usocket/backend/scl.lisp +261 -0
  128. data/lib/clucumber/vendor/usocket/condition.lisp +227 -0
  129. data/lib/clucumber/vendor/usocket/package.lisp +82 -0
  130. data/lib/clucumber/vendor/usocket/server.lisp +45 -0
  131. data/lib/clucumber/vendor/usocket/test/package.lisp +13 -0
  132. data/lib/clucumber/vendor/usocket/test/test-usocket.lisp +166 -0
  133. data/lib/clucumber/vendor/usocket/usocket-test.asd +26 -0
  134. data/lib/clucumber/vendor/usocket/usocket.asd +37 -0
  135. data/lib/clucumber/vendor/usocket/usocket.lisp +542 -0
  136. data/lib/clucumber/vendor/usocket/vendor/kqueue.lisp +1 -0
  137. data/lib/clucumber/vendor/usocket/vendor/split-sequence.lisp +245 -0
  138. data/lib/clucumber.rb +29 -7
  139. metadata +151 -5
@@ -0,0 +1 @@
1
+ ;;;-*-Mode: LISP; Package: CCL -*-
2
  combining hw.cpu64bit_capable, hw.optional.x86_64 and hw.optional.64bitops
1
3
  ;; FRAMWORK CALL FUNCTIONALITY FROM BSD.LISP
2
4
  ;; (C) 2003 Brendan Burns <bburns@cs.umass.edu>
3
5
  ;; Released under LGPL.
4
6
  (with-cfstrs ((framework framework-name))
5
7
  (let ((err 0)
6
8
  (baseURL nil)
7
9
  (bundleURL nil)
8
10
  (result nil))
9
11
  (rlet ((folder :fsref))
10
12
  ;; Find the folder holding the bundle
11
13
  (setf err (#_FSFindFolder #$kOnAppropriateDisk #$kFrameworksFolderType
12
14
  t folder))
13
15
 
14
16
  ;; if everything's cool, make a URL for it
15
17
  (when (zerop err)
16
18
  (setf baseURL (#_CFURLCreateFromFSRef (%null-ptr) folder))
17
19
  (if (%null-ptr-p baseURL)
18
20
  (setf err #$coreFoundationUnknownErr)))
19
21
 
20
22
  ;; if everything's cool, make a URL for the bundle
21
23
  (when (zerop err)
22
24
  (setf bundleURL (#_CFURLCreateCopyAppendingPathComponent (%null-ptr)
23
25
  baseURL framework nil))
24
26
  (if (%null-ptr-p bundleURL)
25
27
  (setf err #$coreFoundationUnknownErr)))
26
28
 
27
29
  ;; if everything's cool, load it
28
30
  (when (zerop err)
29
31
  (setf result (#_CFBundleCreate (%null-ptr) bundleURL))
30
32
  (if (%null-ptr-p result)
31
33
  (setf err #$coreFoundationUnknownErr)))
32
34
 
33
35
  ;; if everything's cool, and the user wants it loaded, load it
34
36
  (when (and load-executable (zerop err))
35
37
  (if (not (#_CFBundleLoadExecutable result))
36
38
  (setf err #$coreFoundationUnknownErr)))
37
39
 
38
40
  ;; if there's an error, but we've got a pointer, free it and clear result
39
41
  (when (and (not (zerop err)) (not (%null-ptr-p result)))
40
42
  (#_CFRelease result)
41
43
  (setf result nil))
42
44
 
43
45
  ;; free the URLs if there non-null
44
46
  (when (not (%null-ptr-p bundleURL))
45
47
  (#_CFRelease bundleURL))
46
48
  (when (not (%null-ptr-p baseURL))
47
49
  (#_CFRelease baseURL))
48
50
 
49
51
  ;; return pointer + error value
50
52
  (values result err)))))
51
53
  (let* ((addr (#_CFBundleGetFunctionPointerForName bundle name)))
52
54
  (rlet ((buf :long))
53
55
  (setf (%get-ptr buf) addr)
54
56
  (ash (%get-signed-long buf) -2))))
55
57
  (with-cfstrs ((str name))
56
58
  (let* ((addr (#_CFBundleGetFunctionPointerForName bundle str)))
57
59
  (if (%null-ptr-p addr)
58
60
  (unless nil-if-not-found
59
61
  (error "Couldn't resolve address of foreign function ~s" name))
60
62
  (rlet ((buf :long)) ;; mcl 5.2 uses %fixnum-from-macptr here
61
63
  (setf (%get-ptr buf) addr)
62
64
  (ash (%get-signed-long buf) -2))))))
63
65
  #+ccl-5.2 (get-bundle-for-framework-name "System.framework")
64
66
  #-ccl-5.2
65
67
  (let ((bundle (load-framework-bundle "System.framework")))
66
68
  (terminate-when-unreachable bundle (lambda (b)(#_CFRelease b)))
67
69
  bundle))
68
70
  ;; Is there an existing define-trap like macro for this? or could one be modified for use with bundles?
69
71
  `(progn
70
72
  (defloadvar ,fn
71
73
  (let* ((bundle #+ccl-5.2 (get-bundle-for-framework-name "System.framework")
72
74
  #-ccl-5.2
73
75
  (let ((bundle (load-framework-bundle "System.framework")))
74
76
  (terminate-when-unreachable bundle (lambda (b)(#_CFRelease b)))
75
77
  bundle)))
76
78
  (lookup-function-in-bundle ,name-string bundle)))
77
79
  ,(let ((args (do ((arglist arglist (cddr arglist))
78
80
  (result))
79
81
  ((not (cdr arglist)) (nreverse result))
80
82
  (push (second arglist) result))))
81
83
  `(defun ,name ,args
82
84
  (ppc-ff-call ,fn ,@arglist)))))
83
85
  :signed-fullword) ;; returns a file descriptor no!
84
86
  (let ((kq (%system-kqueue)))
85
87
  (if (= kq -1)
86
88
  (ecase (%system-errno)
87
89
  (12 (error "The kernel failed to allocate enough memory for the kernel queue")) ; ENOMEM
88
90
  (24 (error "The per-process descriptor table is full")) ; EMFILE
89
91
  (23 (error "The system file table is full"))) ; ENFILE
90
92
  kq)))
91
93
  :unsigned-fullword kq
92
94
  :address ke
93
95
  :unsigned-fullword nke
94
96
  :address ko
95
97
  :unsigned-fullword nko
96
98
  :address timeout
97
99
  :signed-fullword)
98
100
  :address name
99
101
  :unsigned-fullword mode
100
102
  :unsigned-fullword arg
101
103
  :signed-fullword)
102
104
 
103
105
  :unsigned-fullword fd
104
106
  :signed-fullword)
105
107
  :signed-fullword)
106
108
  :signed-fullword errno
107
109
  :address)
108
110
  (%get-fixnum (%int-to-ptr (%system-errno*))))
109
111
  "Low level open function, as in C, returns an fd number"
110
112
  (with-cstrs ((name posix-namestring))
111
113
  (%system-open name $O-EVTONLY 0)))
112
114
  (%system-close fd))
113
115
  (sec :unsigned-long)
114
116
  (usec :unsigned-long))
115
117
  (setf *kevent-record*
116
118
  (if (ccl::gestalt #$gestaltPowerPCProcessorFeatures
117
119
  #+ccl-5.2 #$gestaltPowerPCHas64BitSupport #-ccl-5.2 6)
118
120
  :kevent32
119
121
  :kevent64)))
120
122
  (ident :unsigned-long) ; uintptr_t
121
123
  (filter :short)
122
124
  (flags :unsigned-short)
123
125
  (fflags :unsigned-long)
124
126
  (data :long) ; intptr_t
125
127
  (udata :pointer))
126
128
  (:variant ; uintptr_t
127
129
  ((ident64 :uint64))
128
130
  ((ident :unsigned-long)))
129
131
  (filter :short)
130
132
  (flags :unsigned-short)
131
133
  (fflags :unsigned-long)
132
134
  (:variant ; intptr_t
133
135
  ((data64 :sint64))
134
136
  ((data :long)))
135
137
  (:variant ; RMCL :pointer is 32bit
136
138
  ((udata64 :uint64))
137
139
  ((udata :pointer))))
138
140
  (ecase *kevent-record*
139
141
  (:kevent64
140
142
  (make-record kevent64
141
143
  :ident ident
142
144
  :filter filter
143
145
  :flags flags
144
146
  :fflags fflags
145
147
  :data data
146
148
  :udata udata))
147
149
  (:kevent32
148
150
  (make-record kevent32
149
151
  :ident ident
150
152
  :filter filter
151
153
  :flags flags
152
154
  :fflags fflags
153
155
  :data data
154
156
  :udata udata))))
155
157
  (ecase *kevent-record*
156
158
  (:kevent32
157
159
  (ecase field
158
160
  (:ident (rref ke :kevent32.ident))
159
161
  (:filter (rref ke :kevent32.filter))
160
162
  (:flags (rref ke :kevent32.flags))
161
163
  (:fflags (rref ke :kevent32.fflags))
162
164
  (:data (rref ke :kevent32.data))
163
165
  (:udata (rref ke :kevent32.udata))))
164
166
  (:kevent64
165
167
  (ecase field
166
168
  (:ident (rref ke :kevent64.ident))
167
169
  (:filter (rref ke :kevent64.filter))
168
170
  (:flags (rref ke :kevent64.flags))
169
171
  (:fflags (rref ke :kevent64.fflags))
170
172
  (:data (rref ke :kevent64.data))
171
173
  (:udata (rref ke :kevent64.udata))))))
172
174
  (kevent-rref ke :filter))
173
175
  (kevent-rref ke :flags))
174
176
  (kevent-rref ke :data))
175
177
  $kevent-file-attrib $kevent-file-link $kevent-file-rename $kevent-file-revoke))
176
178
  ((errno :initform NIL :initarg :errno)
177
179
  (ko :initform nil :type (or null kevent) :initarg :ko)
178
180
  (syserr :initform (%system-errno)))
179
181
  (:report
180
182
  (lambda (c s)
181
183
  (with-slots (errno ko syserr) c
182
184
  (format s "kevent system call error ~A [~A]" errno syserr)
183
185
  (when errno
184
186
  (format s "(~A)" (%get-cstring (%system-strerror errno))))
185
187
  (when ko
186
188
  (format s " for ")
187
189
  (let ((*standard-output* s))
188
190
  (print-record ko *kevent-record*)))))))
189
191
  (check-type kq integer)
190
192
  (rlet ((&timeout :timespec :sec timeout :usec 1))
191
193
  (let ((num (with-timer ;; does not seem to make a difference...
192
194
  (%system-kevent kq (or ke (%null-ptr))(if ke 1 0)(or ko (%null-ptr))(if ko 1 0) &timeout))))
193
195
  ; "If an error occurs while processing an element of the changelist and there
194
196
  ; is enough room in the eventlist, then the event will be placed in the eventlist with
195
197
  ; EV_ERROR set in flags and the system error in data."
196
198
  (when (and ko (plusp (logand $kevent-error (kevent-flags ko))))
197
199
  (error 'kevent-error
198
200
  :errno (kevent-data ko)
199
201
  :ko ko))
200
202
  ; "Otherwise, -1 will be returned, and errno will be set to indicate the error condition."
201
203
  (when (= num -1)
202
204
  ;; hack - opentransport provides the constants for the errors documented for the call
203
205
  (case (%system-errno)
204
206
  (0 (error "kevent system call failed with an unspecified error")) ;; should not happen!
205
207
  (13 (error "The process does not have permission to register a filter"))
206
208
  (14 (error "There was an error reading or writing the kevent structure")) ; EFAULT
207
209
  (9 (error "The specified descriptor is invalid")) ; EBADF
208
210
  (4 (error "A signal was delivered before the timeout expired and before any events were placed on the kqueue for return.")) ; EINTR
209
211
  (22 (error "The specified time limit or filter is invalid")) ; EINVAL
210
212
  (2 (error "The event could not be found to be modified or deleted")) ; ENOENT
211
213
  (12 (error "No memory was available to register the event")) ; ENOMEM
212
214
  (78 (error "The specified process to attach to does not exist"))) ; ESRCH
213
215
  ;; shouldn't get here...
214
216
  (errchk (%system-errno))
215
217
  (error "error ~A" (%system-errno)))
216
218
  (unless (zerop num)
217
219
  (values ko num)))))
218
220
  ((kq :initform (system-kqueue)
219
221
  :documentation "file descriptor referencing the kqueue")
220
222
  (fds :initform NIL)) ;; ## better if kept on top level, perhaps as a hash table...
221
223
  (:documentation "A kernal event notification channel"))
222
224
  (declare (ignore rest))
223
225
  (terminate-when-unreachable q 'kqueue-close))
224
226
  (with-slots (kq fds) q
225
227
  (when (or kq fds) ;; allow repeated close
226
228
  (system-close kq)
227
229
  (setf fds NIL)
228
230
  (setf kq NIL))))
229
231
  "Polls a kqueue for kevents"
230
232
  ;; may not have to be cleared, but just in case:
231
233
  (flet ((kqueue-poll2 (ko)
232
234
  (let ((result (with-slots (kq) q
233
235
  (without-interrupts
234
236
  (%kevent kq NIL ko)))))
235
237
  (when result
236
238
  (let ((type (kevent-filter result)))
237
239
  (ecase type
238
240
  (0 (values))
239
241
  (#.$kevent-read-filter
240
242
  (values
241
243
  :read
242
244
  (kevent-rref result :ident)
243
245
  (kevent-rref result :flags)
244
246
  (kevent-rref result :fflags)
245
247
  (kevent-rref result :data)
246
248
  (kevent-rref result :udata)))
247
249
  (#.$kevent-write-filter :write)
248
250
  (#.$kevent-aio-filter :aio)
249
251
  (#.$kevent-vnode-filter
250
252
  (values
251
253
  :vnode
252
254
  (cdr (assoc (kevent-rref result :ident) (slot-value q 'fds)))
253
255
  (kevent-rref result :flags)
254
256
  (kevent-rref result :fflags)
255
257
  (kevent-rref result :data)
256
258
  (kevent-rref result :udata)))
257
259
  (#.$kevent-filesystem-filter :filesystem)))))))
258
260
  (ecase *kevent-record*
259
261
  (:kevent64
260
262
  (rlet ((ko :kevent64 :ident 0 :filter 0 :flags 0 :fflags 0 :data 0 :udata (%null-ptr)))
261
263
  (kqueue-poll2 ko)))
262
264
  (:kevent32
263
265
  (rlet ((ko :kevent32 :ident 0 :filter 0 :flags 0 :fflags 0 :data 0 :udata (%null-ptr)))
264
266
  (kqueue-poll2 ko))))))
265
267
  (let ((ke (make-kevent :ident ident
266
268
  :filter filter
267
269
  :flags flags
268
270
  :fflags fflags
269
271
  :data data
270
272
  :udata udata)))
271
273
  (with-slots (kq) q
272
274
  (without-interrupts
273
275
  (%kevent kq ke)))))
274
276
  "Makes the queue report an event when there is a change to a directory or file"
275
277
  (let* ((namestring (posix-namestring (full-pathname pathname)))
276
278
  (fd (system-open namestring)))
277
279
  (with-slots (fds) q
278
280
  (push (cons fd pathname) fds))
279
281
  (kqueue-subscribe q
280
282
  :ident fd
281
283
  :filter $kevent-vnode-filter
282
284
  :flags (logior $kevent-add $kevent-clear)
283
285
  :fflags $kevent-file-all)
284
286
  namestring))
285
287
  "Report changes to a file or directory"
286
288
  (loop
287
289
  with kqueue = (make-instance 'kqueue)
288
290
  with sub = (kqueue-vnode-subscribe kqueue pathname)
289
291
  for i from 1 to 60
290
292
  for result = (multiple-value-list (kqueue-poll kqueue))
291
293
  unless (equal result '(NIL))
292
294
  do (progn
293
295
  (format T "~A~%" result)
294
296
  (force-output))
295
297
  ; do (process-allow-schedule)
296
298
  do (sleep 1)
297
299
  finally (write-line "Done")
298
300
  ))
299
301
  (fred))
300
302
  (make-pathname :directory (pathname-directory *loading-file-source-file*))
301
303
  (fred))
@@ -0,0 +1,245 @@
1
+ ;;;; SPLIT-SEQUENCE
2
+ ;;;
3
+ ;;; This code was based on Arthur Lemmens' in
4
+ ;;; <URL:http://groups.google.com/groups?as_umsgid=39F36F1A.B8F19D20%40simplex.nl>;
5
+ ;;;
6
+ ;;; changes include:
7
+ ;;;
8
+ ;;; * altering the behaviour of the :from-end keyword argument to
9
+ ;;; return the subsequences in original order, for consistency with
10
+ ;;; CL:REMOVE, CL:SUBSTITUTE et al. (:from-end being non-NIL only
11
+ ;;; affects the answer if :count is less than the number of
12
+ ;;; subsequences, by analogy with the above-referenced functions).
13
+ ;;;
14
+ ;;; * changing the :maximum keyword argument to :count, by analogy
15
+ ;;; with CL:REMOVE, CL:SUBSTITUTE, and so on.
16
+ ;;;
17
+ ;;; * naming the function SPLIT-SEQUENCE rather than PARTITION rather
18
+ ;;; than SPLIT.
19
+ ;;;
20
+ ;;; * adding SPLIT-SEQUENCE-IF and SPLIT-SEQUENCE-IF-NOT.
21
+ ;;;
22
+ ;;; * The second return value is now an index rather than a copy of a
23
+ ;;; portion of the sequence; this index is the `right' one to feed to
24
+ ;;; CL:SUBSEQ for continued processing.
25
+
26
+ ;;; There's a certain amount of code duplication here, which is kept
27
+ ;;; to illustrate the relationship between the SPLIT-SEQUENCE
28
+ ;;; functions and the CL:POSITION functions.
29
+
30
+ ;;; Examples:
31
+ ;;;
32
+ ;;; * (split-sequence #\; "a;;b;c")
33
+ ;;; -> ("a" "" "b" "c"), 6
34
+ ;;;
35
+ ;;; * (split-sequence #\; "a;;b;c" :from-end t)
36
+ ;;; -> ("a" "" "b" "c"), 0
37
+ ;;;
38
+ ;;; * (split-sequence #\; "a;;b;c" :from-end t :count 1)
39
+ ;;; -> ("c"), 4
40
+ ;;;
41
+ ;;; * (split-sequence #\; "a;;b;c" :remove-empty-subseqs t)
42
+ ;;; -> ("a" "b" "c"), 6
43
+ ;;;
44
+ ;;; * (split-sequence-if (lambda (x) (member x '(#\a #\b))) "abracadabra")
45
+ ;;; -> ("" "" "r" "c" "d" "" "r" ""), 11
46
+ ;;;
47
+ ;;; * (split-sequence-if-not (lambda (x) (member x '(#\a #\b))) "abracadabra")
48
+ ;;; -> ("ab" "a" "a" "ab" "a"), 11
49
+ ;;;
50
+ ;;; * (split-sequence #\; ";oo;bar;ba;" :start 1 :end 9)
51
+ ;;; -> ("oo" "bar" "b"), 9
52
+
53
+ #+ignore ; comment by usocket
54
+ (defpackage "SPLIT-SEQUENCE"
55
+ (:use "CL")
56
+ (:nicknames "PARTITION")
57
+ (:export "SPLIT-SEQUENCE" "SPLIT-SEQUENCE-IF" "SPLIT-SEQUENCE-IF-NOT"
58
+ "PARTITION" "PARTITION-IF" "PARTITION-IF-NOT"))
59
+
60
+ (in-package :usocket #+ignore "SPLIT-SEQUENCE")
61
+
62
+ (defun split-sequence (delimiter seq &key (count nil) (remove-empty-subseqs nil) (from-end nil) (start 0) (end nil) (test nil test-supplied) (test-not nil test-not-supplied) (key nil key-supplied))
63
+ "Return a list of subsequences in seq delimited by delimiter.
64
+
65
+ If :remove-empty-subseqs is NIL, empty subsequences will be included
66
+ in the result; otherwise they will be discarded. All other keywords
67
+ work analogously to those for CL:SUBSTITUTE. In particular, the
68
+ behaviour of :from-end is possibly different from other versions of
69
+ this function; :from-end values of NIL and T are equivalent unless
70
+ :count is supplied. The second return value is an index suitable as an
71
+ argument to CL:SUBSEQ into the sequence indicating where processing
72
+ stopped."
73
+ (let ((len (length seq))
74
+ (other-keys (nconc (when test-supplied
75
+ (list :test test))
76
+ (when test-not-supplied
77
+ (list :test-not test-not))
78
+ (when key-supplied
79
+ (list :key key)))))
80
+ (unless end (setq end len))
81
+ (if from-end
82
+ (loop for right = end then left
83
+ for left = (max (or (apply #'position delimiter seq
84
+ :end right
85
+ :from-end t
86
+ other-keys)
87
+ -1)
88
+ (1- start))
89
+ unless (and (= right (1+ left))
90
+ remove-empty-subseqs) ; empty subseq we don't want
91
+ if (and count (>= nr-elts count))
92
+ ;; We can't take any more. Return now.
93
+ return (values (nreverse subseqs) right)
94
+ else
95
+ collect (subseq seq (1+ left) right) into subseqs
96
+ and sum 1 into nr-elts
97
+ until (< left start)
98
+ finally (return (values (nreverse subseqs) (1+ left))))
99
+ (loop for left = start then (+ right 1)
100
+ for right = (min (or (apply #'position delimiter seq
101
+ :start left
102
+ other-keys)
103
+ len)
104
+ end)
105
+ unless (and (= right left)
106
+ remove-empty-subseqs) ; empty subseq we don't want
107
+ if (and count (>= nr-elts count))
108
+ ;; We can't take any more. Return now.
109
+ return (values subseqs left)
110
+ else
111
+ collect (subseq seq left right) into subseqs
112
+ and sum 1 into nr-elts
113
+ until (>= right end)
114
+ finally (return (values subseqs right))))))
115
+
116
+ (defun split-sequence-if (predicate seq &key (count nil) (remove-empty-subseqs nil) (from-end nil) (start 0) (end nil) (key nil key-supplied))
117
+ "Return a list of subsequences in seq delimited by items satisfying
118
+ predicate.
119
+
120
+ If :remove-empty-subseqs is NIL, empty subsequences will be included
121
+ in the result; otherwise they will be discarded. All other keywords
122
+ work analogously to those for CL:SUBSTITUTE-IF. In particular, the
123
+ behaviour of :from-end is possibly different from other versions of
124
+ this function; :from-end values of NIL and T are equivalent unless
125
+ :count is supplied. The second return value is an index suitable as an
126
+ argument to CL:SUBSEQ into the sequence indicating where processing
127
+ stopped."
128
+ (let ((len (length seq))
129
+ (other-keys (when key-supplied
130
+ (list :key key))))
131
+ (unless end (setq end len))
132
+ (if from-end
133
+ (loop for right = end then left
134
+ for left = (max (or (apply #'position-if predicate seq
135
+ :end right
136
+ :from-end t
137
+ other-keys)
138
+ -1)
139
+ (1- start))
140
+ unless (and (= right (1+ left))
141
+ remove-empty-subseqs) ; empty subseq we don't want
142
+ if (and count (>= nr-elts count))
143
+ ;; We can't take any more. Return now.
144
+ return (values (nreverse subseqs) right)
145
+ else
146
+ collect (subseq seq (1+ left) right) into subseqs
147
+ and sum 1 into nr-elts
148
+ until (< left start)
149
+ finally (return (values (nreverse subseqs) (1+ left))))
150
+ (loop for left = start then (+ right 1)
151
+ for right = (min (or (apply #'position-if predicate seq
152
+ :start left
153
+ other-keys)
154
+ len)
155
+ end)
156
+ unless (and (= right left)
157
+ remove-empty-subseqs) ; empty subseq we don't want
158
+ if (and count (>= nr-elts count))
159
+ ;; We can't take any more. Return now.
160
+ return (values subseqs left)
161
+ else
162
+ collect (subseq seq left right) into subseqs
163
+ and sum 1 into nr-elts
164
+ until (>= right end)
165
+ finally (return (values subseqs right))))))
166
+
167
+ (defun split-sequence-if-not (predicate seq &key (count nil) (remove-empty-subseqs nil) (from-end nil) (start 0) (end nil) (key nil key-supplied))
168
+ "Return a list of subsequences in seq delimited by items satisfying
169
+ (CL:COMPLEMENT predicate).
170
+
171
+ If :remove-empty-subseqs is NIL, empty subsequences will be included
172
+ in the result; otherwise they will be discarded. All other keywords
173
+ work analogously to those for CL:SUBSTITUTE-IF-NOT. In particular,
174
+ the behaviour of :from-end is possibly different from other versions
175
+ of this function; :from-end values of NIL and T are equivalent unless
176
+ :count is supplied. The second return value is an index suitable as an
177
+ argument to CL:SUBSEQ into the sequence indicating where processing
178
+ stopped."
179
+ (let ((len (length seq))
180
+ (other-keys (when key-supplied
181
+ (list :key key))))
182
+ (unless end (setq end len))
183
+ (if from-end
184
+ (loop for right = end then left
185
+ for left = (max (or (apply #'position-if-not predicate seq
186
+ :end right
187
+ :from-end t
188
+ other-keys)
189
+ -1)
190
+ (1- start))
191
+ unless (and (= right (1+ left))
192
+ remove-empty-subseqs) ; empty subseq we don't want
193
+ if (and count (>= nr-elts count))
194
+ ;; We can't take any more. Return now.
195
+ return (values (nreverse subseqs) right)
196
+ else
197
+ collect (subseq seq (1+ left) right) into subseqs
198
+ and sum 1 into nr-elts
199
+ until (< left start)
200
+ finally (return (values (nreverse subseqs) (1+ left))))
201
+ (loop for left = start then (+ right 1)
202
+ for right = (min (or (apply #'position-if-not predicate seq
203
+ :start left
204
+ other-keys)
205
+ len)
206
+ end)
207
+ unless (and (= right left)
208
+ remove-empty-subseqs) ; empty subseq we don't want
209
+ if (and count (>= nr-elts count))
210
+ ;; We can't take any more. Return now.
211
+ return (values subseqs left)
212
+ else
213
+ collect (subseq seq left right) into subseqs
214
+ and sum 1 into nr-elts
215
+ until (>= right end)
216
+ finally (return (values subseqs right))))))
217
+
218
+ ;;; clean deprecation
219
+
220
+ (defun partition (&rest args)
221
+ (apply #'split-sequence args))
222
+
223
+ (defun partition-if (&rest args)
224
+ (apply #'split-sequence-if args))
225
+
226
+ (defun partition-if-not (&rest args)
227
+ (apply #'split-sequence-if-not args))
228
+
229
+ (define-compiler-macro partition (&whole form &rest args)
230
+ (declare (ignore args))
231
+ (warn "PARTITION is deprecated; use SPLIT-SEQUENCE instead.")
232
+ form)
233
+
234
+ (define-compiler-macro partition-if (&whole form &rest args)
235
+ (declare (ignore args))
236
+ (warn "PARTITION-IF is deprecated; use SPLIT-SEQUENCE-IF instead.")
237
+ form)
238
+
239
+ (define-compiler-macro partition-if-not (&whole form &rest args)
240
+ (declare (ignore args))
241
+ (warn "PARTITION-IF-NOT is deprecated; use SPLIT-SEQUENCE-IF-NOT instead")
242
+ form)
243
+
244
+ #+ignore ; comment by usocket
245
+ (pushnew :split-sequence *features*)
data/lib/clucumber.rb CHANGED
@@ -6,25 +6,39 @@ class ClucumberSubprocess
6
6
 
7
7
  attr_reader :output
8
8
 
9
+ def self.launch(dir, options={})
10
+ proc = ClucumberSubprocess.new(dir, options)
11
+ at_exit do
12
+ proc.kill
13
+ end
14
+ proc.run
15
+ proc
16
+ end
17
+
9
18
  def initialize(dir, options={})
10
19
  @dir = dir
11
- lisp = options[:lisp] || ENV['LISP'] || 'sbcl --disable-debugger'
20
+ @lisp = options[:lisp] || ENV['LISP'] || 'sbcl --disable-debugger'
12
21
  @port = options[:port] || raise("Need a port to run clucumber on.")
13
22
  @output = ""
14
-
23
+ end
24
+
25
+ def run
15
26
  Dir.chdir(@dir) do
16
- @out, @in, @pid = PTY.spawn(lisp)
27
+ @out, @in, @pid = PTY.spawn(@lisp)
17
28
  end
18
29
  @reader = Thread.start {
19
30
  record_output
20
- }
31
+ }
32
+ cluke_dir = File.expand_path("clucumber/", File.dirname(__FILE__))
33
+ Dir[cluke_dir + '/**/*.fasl'].each do |fasl|
34
+ FileUtils.rm(fasl)
35
+ end
21
36
  @in.puts(<<-LISP)
22
- (require :asdf)
23
- (load #p"#{File.expand_path("clucumber/clucumber.asd", File.dirname(__FILE__))}")
37
+ (load #p"#{File.expand_path("clucumber/clucumber-bootstrap.lisp", File.dirname(__FILE__))}")
24
38
  LISP
25
39
  end
26
40
 
27
- def start(additional_forms="")
41
+ def listen(additional_forms="")
28
42
  @in.puts <<-LISP
29
43
  #{additional_forms}
30
44
  (asdf:oos 'asdf:load-op :clucumber)
@@ -68,4 +82,12 @@ class ClucumberSubprocess
68
82
  (Process.kill("CONT", @pid) && true) rescue false
69
83
  end
70
84
  end
85
+
86
+ def vendor_path
87
+ File.expand_path("../clucumber/vendor/", __FILE__)
88
+ end
89
+
90
+ def vendor_libs
91
+ Dir[vendor_path + '/*'].map {|dir| File.basename(dir)}
92
+ end
71
93
  end