Changeset 25937 in project


Ignore:
Timestamp:
02/21/12 01:30:24 (9 years ago)
Author:
ecloud
Message:

value-signature just needed to support array type, duh

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/4/dbus/trunk/dbus.scm

    r25936 r25937  
    195195                        (string->symbol arg)
    196196                        arg))
     197
     198        (define (ascii->string a) (string (integer->char a)))
    197199
    198200        ;; If the assq-list has the given key, replace its value.
     
    328330                        "C_return (dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT64, &v));"))
    329331
    330         (define (ascii->string a) (string (integer->char a)))
    331 
    332332        (define (value-signature val)
    333333; (printf "value-signature ~s~%" val)
     
    338338                        [(boolean? val) (ascii->string type-boolean)]
    339339                        [(variant? val) (ascii->string type-variant)]
     340                        [(vector? val) (format "~a~a" (ascii->string type-array) (value-signature (vector-ref val 0)))]
    340341                        ; [(variant? val) (value-signature (variant-data val))]
    341342                        [(pair? val)
    342343                                (if (list? val)
    343344                                        "unsupported" ;; todo
    344                                         (format "~a~a~a~a" (integer->char type-dict-begin) (value-signature (car val)) (value-signature (cdr val))(integer->char type-dict-end) )
     345                                        (format "~a~a~a~a" (integer->char type-dict-begin)
     346                                                (value-signature (car val)) (value-signature (cdr val))(integer->char type-dict-end))
    345347                                )]
    346348                ))
    347349
    348350        (define (iter-append-basic-variant iter val)
     351; (printf "iter-append-basic-variant ~s~%" val)
    349352                (let ([signature (value-signature val)])
     353; (printf "iter-append-basic-variant: sig ~s~%" signature)
    350354                        (let ([container ((foreign-lambda* message-iter-ptr ((message-iter-ptr iter) (c-string signature))
    351355                                        "DBusMessageIter* container = malloc(sizeof(DBusMessageIter));
     
    357361
    358362        (define (iter-append-dict-entry iter pair)
    359 ;(printf "iter-append-dict-entry ~s : ~s~%" (car pair)(cdr pair))
     363; (printf "iter-append-dict-entry ~s : ~s~%" (car pair)(cdr pair))
    360364                (let ([signature (value-signature pair)])
    361365                        (let ([container ((foreign-lambda* message-iter-ptr ((message-iter-ptr iter) (c-string signature))
     
    393397
    394398        ;; TODO: iter-append-basic-T for each possible type:
    395         ;; especially variant, array and struct might still be possible
     399        ;; especially struct might still be possible
    396400
    397401        ;; val would usually be a single value, but
     
    504508                                        (begin
    505509                                                (free-iter iter)
    506                                                 iterm)
    507                                 ))))
     510                                                iterm) ))))
    508511
    509512        ;; todo maybe: rewrite to avoid the reverse
Note: See TracChangeset for help on using the changeset viewer.