Changeset 36099 in project


Ignore:
Timestamp:
08/10/18 23:12:15 (13 months ago)
Author:
sjamaan
Message:

Port sxpath to CHICKEN 5

Location:
release/5/sxpath
Files:
1 added
3 deleted
14 edited
2 copied

Legend:

Unmodified
Added
Removed
  • release/5/sxpath/trunk/chicken/common.scm

    r27182 r36099  
    55;;;
    66
    7 (require-library srfi-1 srfi-13 data-structures)
    87(import (only srfi-13 string-prefix? string-prefix-ci? string-index-right
    9               string-contains string-concatenate string-concatenate/shared)
    10         (only srfi-1 filter)
    11         (prefix (only data-structures string-split) chicken:))
     8              string-concatenate string-concatenate/shared)
     9        (prefix (only (chicken string) string-split) chicken:)
     10        (only (chicken string) substring-index)
     11        (only (chicken base) foldr add1 sub1 current-error-port error))
    1212
    1313;; Defined in xpath-parser, but used elsewhere...  Maybe export it from xpath-parser?
    1414(define sxml:whitespace '(#\space #\return #\newline #\tab))
    1515
    16 (define (substring? pattern str) (string-contains str pattern))
     16(define (substring? pattern str) (substring-index pattern str))
    1717(define string-rindex string-index-right)
     18
     19(define (filter pred? lst)
     20  (foldr (lambda (x acc) (if (pred? x) (cons x acc) acc)) '() lst))
    1821
    1922(define nl (string #\newline))
  • release/5/sxpath/trunk/chicken/context-sxpath-lolevel.scm

    r27184 r36099  
    4949   draft:xpointer draft:xpath draft:xpath-expr draft:sxpath)
    5050
    51 (import chicken scheme)
    52 
    53 (use sxpath-lolevel xpath-parser)
     51(import scheme sxpath-lolevel xpath-parser
     52        (only (chicken base) include error and-let*))
    5453
    5554;; These are overrides to reduce the dependency insanity - modif eventually
  • release/5/sxpath/trunk/chicken/context-sxpath.scm

    r27182 r36099  
    44  (sxpath-with-context txpath-with-context)
    55
    6 (import chicken scheme)
    7 
    8 (use context-sxpath-lolevel)
     6(import scheme context-sxpath-lolevel)
    97
    108(define txpath-with-context draft:xpath)
  • release/5/sxpath/trunk/chicken/ddo-sxpath-lolevel.scm

    r27184 r36099  
    7474   ddo:xpath-expr ddo:sxpath ddo:txpath)
    7575
    76 (import chicken scheme)
    77 
    78 (use sxpath-lolevel xpath-parser context-sxpath-lolevel)
     76(import scheme (only (chicken base)
     77                     error include gensym delay-force and-let*)
     78        sxpath-lolevel xpath-parser context-sxpath-lolevel)
    7979
    8080(define (sxml:xpointer-runtime-error . text)
  • release/5/sxpath/trunk/chicken/ddo-sxpath.scm

    r27182 r36099  
    22  (sxpath-with-ddo txpath-with-ddo)
    33
    4 (import chicken scheme)
    5 
    6 (use ddo-sxpath-lolevel)
     4(import scheme ddo-sxpath-lolevel)
    75
    86(define sxpath-with-ddo ddo:sxpath)
  • release/5/sxpath/trunk/chicken/sxpath-lolevel.scm

    r35454 r36099  
    115115   )
    116116
    117 (import chicken scheme (only extras pp)
    118         (only ports call-with-input-string))
     117(import scheme (only (chicken base) include assert exit)
     118        (only (chicken syntax) er-macro-transformer)
     119        (only (chicken pretty-print) pp)
     120        (only (chicken port) call-with-input-string))
    119121
    120122;; There's no real danger of hygiene breakage because the macros here
     
    124126    ((define-macro (macro-name . args)
    125127       body ...)
    126      (define-syntax (macro-name exp rename compare)
    127        (apply (lambda args body ...) (cdr exp))))))
     128     (define-syntax macro-name
     129       (er-macro-transformer
     130        (lambda (exp rename compare)
     131          (apply (lambda args body ...) (cdr exp))))))))
    128132
    129133
  • release/5/sxpath/trunk/chicken/sxpath.scm

    r27178 r36099  
    22  (sxpath if-sxpath car-sxpath if-car-sxpath sxml:id-alist)
    33
    4 (import chicken scheme)
    5 (use sxpath-lolevel txpath)
     4(import scheme (only (chicken base) include and-let*)
     5        sxpath-lolevel txpath)
    66
    77(include "chicken/common.scm")
  • release/5/sxpath/trunk/chicken/txpath.scm

    r27182 r36099  
    3838   txpath)
    3939
    40 (import chicken scheme)
    41 (use sxpath-lolevel xpath-parser)
     40(import scheme (only (chicken base) include exit)
     41        sxpath-lolevel xpath-parser)
    4242
    4343(include "chicken/common.scm")
  • release/5/sxpath/trunk/chicken/xpath-parser.scm

    r27183 r36099  
    1414   txp:parameterize-parser txp:error? txp:signal-semantic-error)
    1515
    16 (import chicken scheme)
     16(import scheme (chicken base))
    1717
    1818(include "chicken/common.scm")
  • release/5/sxpath/trunk/sxml-tools/sxml-tools.scm

    r18830 r36099  
    237237      ((null? (cdr tnodes))
    238238       (car tnodes))
    239       (else (string-concatenate tnodes)))))
     239      (else (apply string-append tnodes)))))
    240240
    241241;------------------------------------------------------------------------------
     
    876876         (if (equal? "" (cadr attr))
    877877             (list " " (sxml:ncname attr))
    878              (list " " (sxml:ncname attr) "=\"" (sxml:string->html (cadr attr)) "\"")))
     878             (list " " (sxml:ncname attr) "='" (cadr attr) "'")))
    879879
    880880
  • release/5/sxpath/trunk/sxml-tools/sxpath-ext.scm

    r18830 r36099  
    6969     "")
    7070    (else
    71      (string-concatenate/shared  ; a list of arguments is always non-null
     71     (apply string-append  ; a list of arguments is always non-null
    7272            (map
    7373             (lambda (node)
  • release/5/sxpath/trunk/sxml-tools/tests/vsxpathlib.scm

    r13275 r36099  
    413413)
    414414
     415; Node-pos for a negative index that is not present in a list
     416; Test suggested by Peter Bex
     417(sxp:run-test
     418 (node-pos -6)
     419 '((div "hi") (span "hello") (em "is this thing on?"))
     420 '())
     421
    415422; Location path, full form: child::para[position()=last()]
    416423; Location path, abbreviated form: para[last()]
  • release/5/sxpath/trunk/sxml-tools/txpath.scm

    r18830 r36099  
    350350          (cond
    351351            ((null? src)
    352              (string-concatenate (reverse res)))
     352             (apply string-append (reverse res)))
    353353            ((= (string-length (car src)) 0)  ; empty string
    354354             (rpt (cdr src) res))
     
    366366            (cond
    367367              ((null? src)
    368                (string-concatenate (reverse res)))
     368               (apply string-append (reverse res)))
    369369              ((= (string-length (car src)) 0)  ; empty string
    370370               (rpt (cdr src) res))
  • release/5/sxpath/trunk/sxpath.egg

    r36090 r36099  
    1 ;;; sxml-tools.meta -*- Hen -*-
     1;;; sxml-tools.meta -*- Scheme -*-
    22
    3 ((synopsis
    4    "The sxpath bits of sxml-tools from the SSAX project at Sourceforge")
     3((synopsis "The sxpath bits of sxml-tools from the SSAX project at Sourceforge")
    54 (author "Oleg Kiselyov, Kirill Lisovsky, Dmitry Lizorkin")
    6  (egg "sxpath.egg")
    75 (license "Public Domain")
    8  (test-depends test)
    9  (doc-from-wiki)
     6 (dependencies srfi-13)
     7 (test-dependencies test)
    108 (category xml)
    11  (files "README.txt" "sxpath.meta" "sxpath.setup" "sxml-tools/xpath-context.scm" "sxml-tools/ddo-txpath.scm" "sxml-tools/benchmarks/join.scm" "sxml-tools/benchmarks/many-vars.scm" "sxml-tools/benchmarks/gottlob.scm" "sxml-tools/benchmarks/time-apply.scm" "sxml-tools/benchmarks/lpaths.scm" "sxml-tools/benchmarks/perf-tests.scm" "sxml-tools/lazy-xpath.scm" "sxml-tools/sxpathlib.scm" "sxml-tools/sxpath.scm" "sxml-tools/xpath-ast.scm" "sxml-tools/guides.scm" "sxml-tools/ddo-axes.scm" "sxml-tools/modif.scm" "sxml-tools/sxpath-ext.scm" "sxml-tools/sxpath-plus.scm" "sxml-tools/txpath.scm" "sxml-tools/serializer.scm" "sxml-tools/stx-engine.scm" "sxml-tools/xlink-parser.scm" "sxml-tools/fragments.scm" "sxml-tools/sxml-tools.scm" "sxml-tools/tests/vddo.scm" "sxml-tools/tests/vtxpath.scm" "sxml-tools/tests/vcontext.scm" "sxml-tools/tests/vmodif.scm" "sxml-tools/tests/xtest-maker.scm" "sxml-tools/tests/vsxpath-ext.scm" "sxml-tools/tests/xtest-lib.scm" "sxml-tools/tests/xtest-harness.scm" "sxml-tools/tests/vsxpathlib.scm" "sxml-tools/xlink.scm" "sxml-tools/xpath-parser.scm" "sxpath.release-info" "chicken/sxpath.scm" "chicken/sxpath-lolevel.scm" "chicken/txpath.scm" "chicken/patch-0001-string-concatenate.diff" "chicken/common.scm"))
     9 (components
     10  (extension sxpath-lolevel
     11             (source "chicken/sxpath-lolevel.scm")
     12             (source-dependencies "chicken/common.scm"
     13                                  "sxml-tools/sxml-tools.scm"
     14                                  "sxml-tools/sxpathlib.scm"
     15                                  "sxml-tools/sxpath-ext.scm"))
     16  (extension xpath-parser
     17             (source "chicken/xpath-parser.scm")
     18             (source-dependencies "chicken/common.scm"
     19                                  "sxml-tools/xpath-parser.scm"
     20                                  "sxml-tools/xpath-ast.scm"))
     21  (extension txpath
     22             (source "chicken/txpath.scm")
     23             (source-dependencies "chicken/common.scm"
     24                                  "sxml-tools/txpath.scm")
     25             (component-dependencies sxpath-lolevel xpath-parser))
     26  (extension sxpath
     27             (source "chicken/sxpath.scm")
     28             (source-dependencies "chicken/common.scm"
     29                                  "sxml-tools/txpath.scm")
     30             (component-dependencies sxpath-lolevel txpath))
     31  (extension context-sxpath-lolevel
     32             (source "chicken/context-sxpath-lolevel.scm")
     33             (source-dependencies "chicken/common.scm"
     34                                  "sxml-tools/xpath-context.scm")
     35             (component-dependencies sxpath-lolevel xpath-parser))
     36  (extension context-sxpath
     37             (source "chicken/context-sxpath.scm")
     38             (component-dependencies context-sxpath-lolevel))
     39  (extension ddo-sxpath-lolevel
     40             (source "chicken/ddo-sxpath-lolevel.scm")
     41             (source-dependencies "chicken/common.scm"
     42                                  "sxml-tools/ddo-axes.scm"
     43                                  "sxml-tools/ddo-txpath.scm")
     44             (component-dependencies xpath-parser context-sxpath-lolevel))
     45  (extension ddo-sxpath
     46             (source "chicken/ddo-sxpath.scm")
     47             (component-dependencies ddo-sxpath-lolevel))))
  • release/5/sxpath/trunk/tests/run.scm

    r27184 r36099  
    1 (use test)
     1(import test)
    22
    33(define-syntax xtest-assert
     
    2828     (test ?expected-result (?selector ?node)))))
    2929
    30 (use txpath sxpath-lolevel sxpath context-sxpath-lolevel ddo-sxpath-lolevel)
     30(import txpath sxpath-lolevel sxpath context-sxpath-lolevel ddo-sxpath-lolevel)
    3131
    3232(test-group "all sxpath flavors and subsystems"
Note: See TracChangeset for help on using the changeset viewer.