From 7f149ab501ab6121bddb82788e4156d21a1828c9 Mon Sep 17 00:00:00 2001 From: Ebus-at-dockstar Date: Thu, 7 Mar 2013 14:18:37 +0100 Subject: racket update to http database server. --- ebus-racket/ebus/layer7.rkt | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'ebus-racket/ebus/layer7.rkt') diff --git a/ebus-racket/ebus/layer7.rkt b/ebus-racket/ebus/layer7.rkt index 3bcad01..cb9da0b 100644 --- a/ebus-racket/ebus/layer7.rkt +++ b/ebus-racket/ebus/layer7.rkt @@ -1,7 +1,5 @@ #lang racket/base -(require racket/list - (planet lizorkin/sxml:2:1/sxml) - (planet lizorkin/ssax:2:0/ssax) +(require (planet clements/sxml2:1:=3) "layer2.rkt") (define logger (make-logger 'ebus-layer7 (current-logger))) @@ -24,8 +22,7 @@ ;; returns device-name in a list or empty-list (define (device-name address) - (first ((sxpath "@name/text()") (device address)))) - + (car ((sxpath "@name/text()") (device address)))) (define (paket-fields ebus-paket) (define paket-definition (paket ebus-paket)) @@ -34,7 +31,7 @@ ([paket-name (string-append (device-name (layer2-ebus-paket-source ebus-paket)) "." - (first ((sxpath "@name/text()") paket-definition)))] + (car ((sxpath "@name/text()") paket-definition)))] [fields ((sxpath "fields/*") paket-definition)] [values (for/list ([field fields]) (paket-fields-dispatch-decoder ebus-paket field paket-name))]) @@ -45,8 +42,8 @@ (define (paket-fields-dispatch-decoder ebus-paket field paket-name) (define datatype ((sxpath "name()") field)) - (define name (string-append paket-name "." (first ((sxpath "@name/text()") field)))) - (define offset (string->number (first ((sxpath "@offset/text()") field)))) + (define name (string-append paket-name "." (car ((sxpath "@name/text()") field)))) + (define offset (string->number (car ((sxpath "@offset/text()") field)))) (define payload (layer2-ebus-paket-payload ebus-paket)) (cond ((string=? "bit" datatype) (list name datatype offset @@ -132,11 +129,11 @@ (define (pred l) (= value (list-ref l 0))) (define all-options (for/list ([option ((sxpath "option") field-definition)]) - (list (string->number (first ((sxpath "@value/text()") option))) ;; value, name - (first ((sxpath "@name/text()") option))))) + (list (string->number (car ((sxpath "@value/text()") option))) ;; value, name + (car ((sxpath "@name/text()") option))))) (define options (filter pred all-options)) (cond ((= (length options) 1) - (list-ref (first options) 1)) + (list-ref (car options) 1)) (else ""))) ;; type word -- cgit v1.2.1