diff --git a/pitfall/fontkit/GPOS.rkt b/pitfall/fontkit/GPOS.rkt index 8089059c..df29fcdb 100644 --- a/pitfall/fontkit/GPOS.rkt +++ b/pitfall/fontkit/GPOS.rkt @@ -186,8 +186,8 @@ https://github.com/mbutterick/fontkit/blob/master/src/tables/GPOS.js ;; GPOSLookup.versions[9].extension.type = GPOSLookup; (define gpos-common-dict (dictify 'scriptList (+Pointer uint16be ScriptList) - 'featureList (+Pointer uint16be FeatureList) - 'lookupList (+Pointer uint16be (LookupList GPOSLookup)) + ;'featureList (+Pointer uint16be FeatureList) + ;'lookupList (+Pointer uint16be (LookupList GPOSLookup)) )) (define-subclass VersionedStruct (GPOS-MainVersionedStruct)) diff --git a/pitfall/restructure/array.rkt b/pitfall/restructure/array.rkt index d8aea450..d5befa55 100644 --- a/pitfall/restructure/array.rkt +++ b/pitfall/restructure/array.rkt @@ -8,6 +8,7 @@ https://github.com/mbutterick/restructure/blob/master/src/Array.coffee |# (define-subclass Streamcoder (Array type [length_ #f] [lengthType 'count]) + (inherit-field res) (define/augride (decode stream [parent #f]) (define pos (· stream pos)) @@ -23,10 +24,10 @@ https://github.com/mbutterick/restructure/blob/master/src/Array.coffee (floor (/ (send stream length) (send type size)))])) (when (Number? length_) - (set-field! parent ctx parent) - (set-field! _startOffset ctx pos) - (set-field! _currentOffset ctx 0) - (set-field! _length ctx length_)) + (hash-set! (· ctx res) 'parent parent) + (hash-set! (· ctx res) '_startOffset pos) + (hash-set! (· ctx res) '_currentOffset 0) + (hash-set! (· ctx res) '_length length_)) (define res (caseq lengthType [(bytes) (error 'array-decode-bytes-no!)] diff --git a/pitfall/restructure/base.rkt b/pitfall/restructure/base.rkt index 278dd079..abb5572d 100644 --- a/pitfall/restructure/base.rkt +++ b/pitfall/restructure/base.rkt @@ -4,15 +4,9 @@ (define RestructureBase (class object% - (super-new) - (field [_startOffset #f] - [_currentOffset #f] - [_length #f] - [parent #f]) - (define/public (decode stream . args) - (set! _startOffset (and (object? stream) (send stream pos))) - (set! parent (and (pair? args) (is-a? (car args) RestructureBase) (car args))) - #;(inner (void) decode stream . args)) + (super-new) + (field [res (make-hash)]) + (define/public (decode stream . args) (void)) (define/public (encode . xs) (void)) (define/public (size . xs) (void)) (define/public (process . args) (void)) diff --git a/pitfall/restructure/pointer.rkt b/pitfall/restructure/pointer.rkt index 7a3a325b..25e126f2 100644 --- a/pitfall/restructure/pointer.rkt +++ b/pitfall/restructure/pointer.rkt @@ -17,12 +17,12 @@ https://github.com/mbutterick/restructure/blob/master/src/Pointer.coffee (define offset (send offsetType decode stream ctx)) (report scope 'pointer-scope) (define relative (caseq scope - [(local) (when (and (· ctx res _startOffset) (· ctx _startOffset) + [(local) #;(when (and (· ctx res _startOffset) (· ctx _startOffset) (not (= (· ctx res _startOffset) (· ctx _startOffset)))) (report* ctx (· ctx res _startOffset) (· ctx _startOffset)) (error 'bazongas)) - (· ctx _startOffset)] - [(parent) (· ctx parent _startOffset)] + (· ctx res _startOffset)] + [(parent) (· ctx res parent res _startOffset)] [(immediate) (- (· stream pos) (send offsetType size))] [(global) (let loop ([c ctx]) @@ -32,9 +32,9 @@ https://github.com/mbutterick/restructure/blob/master/src/Pointer.coffee [else 0]))])) (report* this (· this _startOffset) (and (· this res) (· this res _startOffset)) - ctx (and ctx (· ctx _startOffset)) + ctx (and (· ctx res) (· ctx res _startOffset))) - (when (and ctx (· ctx _startOffset) (= (· ctx _startOffset) 1012)) (error 'stop)) + #;(when (and ctx (· ctx res _startOffset) (= (· ctx res _startOffset) 1012)) (error 'stop)) (report* offset relative) (define ptr (+ offset relative)) (report* ptr) diff --git a/pitfall/restructure/struct.rkt b/pitfall/restructure/struct.rkt index 15a46b38..b8ee16b5 100644 --- a/pitfall/restructure/struct.rkt +++ b/pitfall/restructure/struct.rkt @@ -8,7 +8,7 @@ https://github.com/mbutterick/restructure/blob/master/src/Struct.coffee |# (define-subclass Streamcoder (Struct [fields (dictify)]) - (field [res #f]) + (inherit-field res) (unless ((disjoin assocs? VersionedStruct?) fields) (raise-argument-error 'Struct "assocs or Versioned Struct" fields)) diff --git a/pitfall/sugar/js.rkt b/pitfall/sugar/js.rkt index 34b8aa76..777127a9 100644 --- a/pitfall/sugar/js.rkt +++ b/pitfall/sugar/js.rkt @@ -54,16 +54,16 @@ #'(let loop ([x X]) (cond [(and (object? x) (or (get-or-false x REF) (send-or-false x REF)))] - [(and (object? x) (get-or-false x res)) => loop] - [(and (object? x) (send-or-false x res)) => loop] + ;[(and (object? x) (get-or-false x res)) => loop] + ;[(and (object? x) (send-or-false x res)) => loop] [(object? x) #f] - [(and (hash? x) (hash-ref x 'res #f)) => loop] + ;[(and (hash? x) (hash-ref x 'res #f)) => loop] [(and (hash? x) (hash-ref x 'REF #f))] [(hash? x) #f] [else (raise-argument-error '· (format "~a must be object or hash" 'X) x)]))] [(_ X REF0 . REFS) #'(· (· X REF0) . REFS)]) -(module+ test +#;(module+ test (define c (class object% (super-new) (field [a 42])