diff --git a/xenomorph/xenomorph/array.rkt b/xenomorph/xenomorph/array.rkt index 2d534016..9304fe43 100644 --- a/xenomorph/xenomorph/array.rkt +++ b/xenomorph/xenomorph/array.rkt @@ -14,7 +14,7 @@ https://github.com/mbutterick/restructure/blob/master/src/Array.coffee |# (define x:array% - (class x:enobase% + (class xenobase% (super-new) (init-field [(@type type)] [(@len len)] [(@length-type length-type)]) @@ -32,7 +32,7 @@ https://github.com/mbutterick/restructure/blob/master/src/Array.coffee '_currentOffset 0 '_length @len) parent)) - (define len (resolve-length @len port #:parent parent)) + (define len (resolve-length @len port parent)) (cond [(or (not len) (eq? @length-type 'bytes)) (define end-pos (cond @@ -84,7 +84,7 @@ https://github.com/mbutterick/restructure/blob/master/src/Array.coffee (define items-size (for/sum ([item val]) (send @type x:size item new-parent))) (+ items-size len-size)] - [else (define count (resolve-length @len #f #:parent parent)) + [else (define count (resolve-length @len #f parent)) (define size (send @type x:size #f parent)) (* size count)])))) diff --git a/xenomorph/xenomorph/bitfield.rkt b/xenomorph/xenomorph/bitfield.rkt index b2ea5ee0..d863e1d5 100644 --- a/xenomorph/xenomorph/bitfield.rkt +++ b/xenomorph/xenomorph/bitfield.rkt @@ -8,7 +8,7 @@ https://github.com/mbutterick/restructure/blob/master/src/Bitfield.coffee |# (define x:bitfield% - (class x:enobase% + (class xenobase% (super-new) (init-field [(@type type)][(@flagsĀ flags)]) (unless (andmap (Ī» (f) (or (symbol? f) (not f))) @flags) diff --git a/xenomorph/xenomorph/buffer.rkt b/xenomorph/xenomorph/buffer.rkt index 4c339f8d..f6c29ea0 100644 --- a/xenomorph/xenomorph/buffer.rkt +++ b/xenomorph/xenomorph/buffer.rkt @@ -8,14 +8,14 @@ https://github.com/mbutterick/restructure/blob/master/src/Buffer.coffee |# (define x:buffer% - (class x:enobase% + (class xenobase% (super-new) (init-field [(@len len)]) (unless (length-resolvable? @len) (raise-argument-error '+xbuffer "resolvable length" @len)) (define/augment (x:decode port parent) - (define len (resolve-length @len port #:parent parent)) + (define len (resolve-length @len port parent)) (read-bytes len)) (define/augment (x:encode buf port [parent #f]) @@ -30,7 +30,7 @@ https://github.com/mbutterick/restructure/blob/master/src/Buffer.coffee (raise-argument-error 'xbuffer-size "bytes" val))) (if (bytes? val) (bytes-length val) - (resolve-length @len val #:parent parent))))) + (resolve-length @len val parent))))) (define (x:buffer [len-arg #f] #:length [len-kwarg #f] diff --git a/xenomorph/xenomorph/enum.rkt b/xenomorph/xenomorph/enum.rkt index 6a3f945b..909e8dfb 100644 --- a/xenomorph/xenomorph/enum.rkt +++ b/xenomorph/xenomorph/enum.rkt @@ -8,7 +8,7 @@ https://github.com/mbutterick/restructure/blob/master/src/Enum.coffee |# (define x:enum% - (class x:enobase% + (class xenobase% (super-new) (init-field [(@type type)] [(@values values)]) diff --git a/xenomorph/xenomorph/helper.rkt b/xenomorph/xenomorph/helper.rkt index b9f0b145..8e54f951 100644 --- a/xenomorph/xenomorph/helper.rkt +++ b/xenomorph/xenomorph/helper.rkt @@ -38,7 +38,7 @@ (define (size xo [val #f] #:parent [parent #f]) (send xo x:size val parent)))]))) -(define (xenomorphic-type? x) (is-a? x x:enobase%)) +(define (xenomorphic-type? x) (is-a? x xenobase%)) (define-syntax-rule (generate-subclass CLASS PRE-ENCODE-PROC POST-DECODE-PROC) (cond @@ -57,7 +57,7 @@ (define/override (post-decode x) (POST-DECODE-PROC (super post-decode x))))] [else CLASS])) -(define x:enobase% +(define xenobase% (class* object% (x:enomorphic<%>) (super-new) diff --git a/xenomorph/xenomorph/lazy-array.rkt b/xenomorph/xenomorph/lazy-array.rkt index 97a18b0b..3e843384 100644 --- a/xenomorph/xenomorph/lazy-array.rkt +++ b/xenomorph/xenomorph/lazy-array.rkt @@ -15,7 +15,7 @@ https://github.com/mbutterick/restructure/blob/master/src/LazyArray.coffee (define/override (x:decode port parent) (define starting-pos (pos port)) ; ! placement matters. `resolve-length` will change `pos` - (define len (resolve-length @len port #:parent parent)) + (define len (resolve-length @len port parent)) (define new-parent (if (x:int? @len) (mhasheq 'parent parent '_startOffset starting-pos diff --git a/xenomorph/xenomorph/number.rkt b/xenomorph/xenomorph/number.rkt index 5efb9b0b..b099bab6 100644 --- a/xenomorph/xenomorph/number.rkt +++ b/xenomorph/xenomorph/number.rkt @@ -24,7 +24,7 @@ https://github.com/mbutterick/restructure/blob/master/src/Number.coffee (define system-endian (if (system-big-endian?) 'be 'le)) (define x:number% - (class x:enobase% + (class xenobase% (super-new) (init-field [(@size size)] [(@endian endian)]) diff --git a/xenomorph/xenomorph/optional.rkt b/xenomorph/xenomorph/optional.rkt index 8db1a58f..78ef7bbf 100644 --- a/xenomorph/xenomorph/optional.rkt +++ b/xenomorph/xenomorph/optional.rkt @@ -8,7 +8,7 @@ https://github.com/mbutterick/restructure/blob/master/src/Optional.coffee |# (define x:optional% - (class x:enobase% + (class xenobase% (super-new) (init-field [(@type type)] [(@condition condition)]) diff --git a/xenomorph/xenomorph/pointer.rkt b/xenomorph/xenomorph/pointer.rkt index f9854eaf..b603bdd4 100644 --- a/xenomorph/xenomorph/pointer.rkt +++ b/xenomorph/xenomorph/pointer.rkt @@ -24,7 +24,7 @@ https://github.com/mbutterick/restructure/blob/master/src/Pointer.coffee [else (raise-argument-error 'Pointer:size "VoidPointer" val)])) (define x:pointer% - (class x:enobase% + (class xenobase% (super-new) (init-field [(@offset-type offset-type)] [(@type type)] @@ -112,7 +112,7 @@ https://github.com/mbutterick/restructure/blob/master/src/Pointer.coffee [null-value null-value])) ;; A pointer whose type is determined at decode time -(define x:void-pointer% (class x:enobase% +(define x:void-pointer% (class xenobase% (super-new) (init-field type value))) (define (x:void-pointer . args) (apply make-object x:void-pointer% args)) diff --git a/xenomorph/xenomorph/reserved.rkt b/xenomorph/xenomorph/reserved.rkt index 0668ab71..772e898d 100644 --- a/xenomorph/xenomorph/reserved.rkt +++ b/xenomorph/xenomorph/reserved.rkt @@ -8,12 +8,12 @@ https://github.com/mbutterick/restructure/blob/master/src/Reserved.coffee |# (define x:reserved% - (class x:enobase% + (class xenobase% (super-new) (init-field [(@type type)] [(@count count)]) (unless (xenomorphic-type? @type) - (raise-argument-error '+xoptional"xenomorphic type" @type)) + (raise-argument-error '+xoptional "xenomorphic type" @type)) (define/augment (x:decode port parent) (pos port (+ (pos port) (x:size #f parent))) @@ -23,7 +23,7 @@ https://github.com/mbutterick/restructure/blob/master/src/Reserved.coffee (make-bytes (x:size val parent) 0)) (define/augment (x:size [val #f] [parent #f]) - (* (send @type x:size) (resolve-length @count #f #:parent parent))))) + (* (send @type x:size) (resolve-length @count #f parent))))) (define (x:reserved [type-arg #f] [count-arg #f] #:type [type-kwarg #f] diff --git a/xenomorph/xenomorph/string.rkt b/xenomorph/xenomorph/string.rkt index a12c4b73..6bcd96bf 100644 --- a/xenomorph/xenomorph/string.rkt +++ b/xenomorph/xenomorph/string.rkt @@ -29,7 +29,7 @@ https://github.com/mbutterick/restructure/blob/master/src/String.coffee (not (eof-object? (peek-byte port)))) (define x:string% - (class x:enobase% + (class xenobase% (super-new) (init-field [(@len len)] [(@encoding encoding)]) @@ -39,7 +39,7 @@ https://github.com/mbutterick/restructure/blob/master/src/String.coffee (raise-argument-error 'xstring (format "procedure or member of ~v" supported-encodings) @encoding)) (define/augment (x:decode port parent) - (define len (or (resolve-length @len port #:parent parent) (count-nonzero-chars port))) + (define len (or (resolve-length @len port parent) (count-nonzero-chars port))) (define encoding (if (procedure? @encoding) (or (@encoding parent) 'ascii) @encoding)) @@ -77,7 +77,7 @@ https://github.com/mbutterick/restructure/blob/master/src/String.coffee [(x:int? @len) (send @len x:size)] [else 0])) (+ string-size strlen-size)] - [else (resolve-length @len #f #:parent parent)])))) + [else (resolve-length @len #f parent)])))) (define supported-encodings '(ascii utf8)) (define (x:string [len-arg #f] [enc-arg #f] diff --git a/xenomorph/xenomorph/struct.rkt b/xenomorph/xenomorph/struct.rkt index 70045d24..1b982fab 100644 --- a/xenomorph/xenomorph/struct.rkt +++ b/xenomorph/xenomorph/struct.rkt @@ -46,7 +46,7 @@ https://github.com/mbutterick/restructure/blob/master/src/Struct.coffee h) (define x:struct% - (class x:enobase% + (class xenobase% (super-new) (init-field [(@fields fields)]) diff --git a/xenomorph/xenomorph/util.rkt b/xenomorph/xenomorph/util.rkt index 044b9c80..e4e2ef72 100644 --- a/xenomorph/xenomorph/util.rkt +++ b/xenomorph/xenomorph/util.rkt @@ -5,7 +5,7 @@ (define (length-resolvable? x) (or (not x) (symbol? x) (xenomorphic? x) (procedure? x) (exact-nonnegative-integer? x))) -(define (resolve-length x port #:parent [parent #f]) +(define (resolve-length x port [parent #f]) (cond [(not x) #f] [(exact-nonnegative-integer? x) x]