Changeset 25883 in project for release/4/dbus/trunk/dbus.scm
- Timestamp:
- 02/09/12 23:55:44 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
release/4/dbus/trunk/dbus.scm
r25880 r25883 12 12 dbus:discover-api-xml 13 13 dbus:dbus-service 14 dbus:type-uint3215 14 dbus:session-bus 16 15 dbus:system-bus 17 16 dbus:starter-bus 18 17 dbus:known-bus-count 19 dbus:register-path) 20 (import scheme chicken 18 dbus:register-path 19 unsupported-type? 20 unsupported-type-signature 21 variant? 22 variant-data 23 make-variant 24 auto-unbox-variants) 25 (import scheme chicken extras 21 26 (except foreign foreign-declare) 22 27 foreigners … … 35 40 static DBusError err; 36 41 <# 42 43 ;; A disjoint type to represent any kind of dbus data type 44 ;; which this egg so far does not support. The signature 45 ;; is the ASCII string to represent that type on-the-wire. 46 (define-record-type unsupported-type 47 (make-unsupported-type signature) 48 unsupported-type? 49 (signature unsupported-type-signature)) 50 (define-record-printer (unsupported-type d out) 51 (fprintf out "#<unsupported-type ~a>" (unsupported-type-signature d))) 52 53 ;; Scheme is a dynamically typed language, so fundamentally we don't 54 ;; have a use for the "variant" concept; but since dbus has a variant type, 55 ;; we need a way of representing one when preparing a message for marshalling. 56 ;; So, it might as well be symmetric, putting any variant returned from 57 ;; a dbus call into this type as well. 58 (define-record-type variant 59 (make-variant data) 60 variant? 61 (data variant-data)) 62 (define-record-printer (variant v out) 63 (fprintf out "#,(variant ~S)" (variant-data v))) 64 ;; If unboxing is turned on, when a "call"ed dbus service method 65 ;; returns a variant, it will look as if it was not packaged in a variant at all. 66 ;; By default this feature is turned off, in the interest of having a 67 ;; representation that is the same as you will need to build when 68 ;; you want to send (marshall) a dbus message. 69 (define auto-unbox-variants (make-parameter #f)) 37 70 38 71 ; Would want to do this: … … 392 425 (iter->pair (make-sub-iter iter))] 393 426 [(eq? type dbus:type-variant) 394 ((make-sub-iter iter))] 427 (if (auto-unbox-variants) 428 ((make-sub-iter iter)) 429 (make-variant ((make-sub-iter iter))))] 395 430 ;; unsupported so far (not understood well enough): 396 431 ;; dbus:type-object-path and dbus:type-signature 397 432 ;; dbus:type-invalid is returned as #f (could be (void) but that 398 433 ;; would be the termination condition for the iterator) 399 ;[else (format "unsupported-~c" (integer->char type))] ))) 400 [else #f] ))) 434 [else (make-unsupported-type (integer->char type))] ))) 401 435 402 436 (define (make-sub-iter iter)
Note: See TracChangeset
for help on using the changeset viewer.