diff --git a/pitfall/xenomorph/private/base.rkt b/pitfall/xenomorph/private/base.rkt index f1d2bb25..d74c2d16 100644 --- a/pitfall/xenomorph/private/base.rkt +++ b/pitfall/xenomorph/private/base.rkt @@ -63,16 +63,16 @@ (field [_hash (make-hash)] [_list null]) - (define/pubment (decode port [parent #f]) + (define/pubment (decode port [parent #f] . args) (when parent (unless (indexable? parent) (raise-argument-error (symbol-append (get-class-name) ':decode) "indexable" parent))) (define ip (cond [(bytes? port) (open-input-bytes port)] [(input-port? port) port] [else (raise-argument-error (symbol-append (get-class-name) ':decode) "bytes or input port" port)])) - (post-decode (inner (void) decode ip parent) port parent)) + (post-decode (inner (void) decode ip parent) port parent . args)) - (define/pubment (encode port val-in [parent #f]) + (define/pubment (encode port val-in [parent #f] . args) #;(report* port val-in parent) (define val (pre-encode val-in port)) (when parent (unless (indexable? parent) @@ -81,15 +81,15 @@ [(output-port? port) port] [(not port) (open-output-bytes)] [else (raise-argument-error 'Xenomorph "output port or #f" port)])) - (define encode-result (inner #"" encode op val parent)) + (define encode-result (inner #"" encode op val parent . args)) (when (bytes? encode-result) (write-bytes encode-result op)) (when (not port) (get-output-bytes op))) - (define/pubment (size [val #f] [parent #f] . _) + (define/pubment (size [val #f] [parent #f] . args) (when parent (unless (indexable? parent) (raise-argument-error (symbol-append (get-class-name) ':size) "indexable" parent))) - (define result (inner (void) size val parent)) + (define result (inner (void) size val parent . args)) (cond [(void? result) 0] [(and (integer? result) (not (negative? result))) result] diff --git a/pitfall/xenomorph/private/pointer.rkt b/pitfall/xenomorph/private/pointer.rkt index 47c80368..ba6d258a 100644 --- a/pitfall/xenomorph/private/pointer.rkt +++ b/pitfall/xenomorph/private/pointer.rkt @@ -79,13 +79,12 @@ https://github.com/mbutterick/restructure/blob/master/src/Pointer.coffee [(parent) (· ctx parent)] [(global) (find-top-ctx ctx)] [else (error 'unknown-pointer-style)])] - [relative (+ (caseq (report pointer-style) + [relative (+ (caseq pointer-style [(local parent) (· ctx startOffset)] [(immediate) (+ (pos port) (send offset-type size val parent))] [(global) 0]) (relative-getter-or-0 (· parent val)))]) - (report* 'step-1 ctx relative) (send offset-type encode port (- (· ctx pointerOffset) relative)) (let-values ([(type val) (resolve-void-pointer type val)])