Changeset 549
- Timestamp:
- 06/17/08 11:52:48 (7 months ago)
- Location:
- trunk/pcc/runtime
- Files:
-
- 2 modified
-
ext/standard/php-variable.scm (modified) (5 diffs)
-
php-hash.scm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pcc/runtime/ext/standard/php-variable.scm
r430 r549 163 163 (let ((refhash (make-grasstable)) 164 164 (varcount 0)) 165 (letrec ((fork-it (lambda (v ref?key?)165 (letrec ((fork-it (lambda (v key?) 166 166 ; handle refs 167 (let ((ref-loc (grasstable-get refhash v))) 168 (if (and ref-loc ref?) 167 (let* ((c? (container? v)) 168 (ubv (if c? (container-value v) v)) 169 (ref-loc (grasstable-get refhash v))) 170 (if ref-loc 169 171 (format "R:~a;" ref-loc) 170 172 (begin … … 172 174 (unless key? 173 175 (set! varcount (+ varcount 1))) 174 ( if ref?176 (when (and c? (container-reference? v)) 175 177 (grasstable-put! refhash v varcount)) 176 178 (cond 177 ((is_bool v) (do-boolv))178 ((is_int v) (do-intv))179 ((is_float v) (do-floatv))180 ((is_string v) (do-stringv))181 ((is_array v) (do-arrayv))182 ((is_object v) (do-objectv))183 ((is_null v) (do-nullv))179 ((is_bool ubv) (do-bool ubv)) 180 ((is_int ubv) (do-int ubv)) 181 ((is_float ubv) (do-float ubv)) 182 ((is_string ubv) (do-string ubv)) 183 ((is_array ubv) (do-array ubv)) 184 ((is_object ubv) (do-object ubv)) 185 ((is_null ubv) (do-null ubv)) 184 186 (else 185 187 ;(php-warning "serialize: unknown type for " v) … … 196 198 (lambda () 197 199 (display (format "a:~a:{" (php-hash-size v))) 198 (php-hash-for-each- with-ref-statusv199 (lambda (ak av r?)200 ;(fprint (current-error-port) "doing " ak " => " av)201 (display (fork-it ak #f#t))202 (display (fork-it av r?#f))))200 (php-hash-for-each-location v 201 (lambda (ak av) 202 ;(fprint (current-error-port) "doing " ak " => " av) 203 (display (fork-it ak #t)) 204 (display (fork-it av #f)))) 203 205 (display "}"))))) 204 206 (do-object (lambda (v) … … 218 220 (php-hash-size propshash) 219 221 (php-hash-size ser-vars)))) 220 (php-hash-for-each- with-ref-status222 (php-hash-for-each-location 221 223 propshash 222 (lambda (ak av r?)224 (lambda (ak av) 223 225 (when (or (eqv? ser-vars 'all) 224 226 (php-hash-in-array? ser-vars ak #f)) 225 (display (fork-it ak # f #t))226 (display (fork-it av r?#f)))))227 (display (fork-it ak #t)) 228 (display (fork-it av #f))))) 227 229 (display "}"))) 228 230 ))))) … … 236 238 ;(fprint (current-error-port) "i'm a bool") 237 239 (if v "b:1;" "b:0;")))) 238 (fork-it var #f #f))))240 (fork-it var #f)))) 239 241 240 242 ; unserialize -- Creates a PHP value from a stored representation -
trunk/pcc/runtime/php-hash.scm
r426 r549 48 48 (php-hash-remove! hash key) 49 49 (php-hash-for-each hash thunk::procedure) 50 (php-hash-for-each-with-ref-status hash thunk::procedure) 50 (php-hash-for-each-with-ref-status hash thunk::procedure) 51 (php-hash-for-each-location hash thunk::procedure) 51 52 (php-hash-reverse-for-each hash thunk::procedure) 52 53 (php-hash-for-each-ref hash thunk::procedure) … … 809 810 810 811 (define (php-hash-for-each-with-ref-status hash thunk::procedure) 811 "Thunk will be called once on each key/value set. ref status is available to thunk"812 "Thunk will be called once on each key/value set. the value will be the location container" 812 813 (when (custom? hash) (set! hash (custom-read-entire hash))) 813 814 (let loop ((entry (%php-hash-head hash))) … … 815 816 (thunk (get-key-php-type-friendly entry) 816 817 (container-value (%entry-value entry)) 817 (container-reference? (%entry-value entry))) 818 (container-reference? (%entry-value entry))) 819 ; (%entry-ref? entry)) 820 (loop (%entry-next entry))))) 821 822 (define (php-hash-for-each-location hash thunk::procedure) 823 "Thunk will be called once on each key/value set. the value will be the location container" 824 (when (custom? hash) (set! hash (custom-read-entire hash))) 825 (let loop ((entry (%php-hash-head hash))) 826 (unless (sentinel? entry) 827 (thunk (get-key-php-type-friendly entry) 828 (%entry-value entry)) 818 829 ; (%entry-ref? entry)) 819 830 (loop (%entry-next entry)))))
