Changeset 27178 in project


Ignore:
Timestamp:
08/03/12 22:25:10 (9 years ago)
Author:
sjamaan
Message:

sxpath: Refactor library structure by putting low-level xpath parser into its own module. This will allow ddo-sxpath and sxml-modifications to re-use it

Location:
release/4/sxpath/trunk
Files:
1 added
5 edited

Legend:

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

    r18830 r27178  
    55;;;
    66
    7 (import (only srfi-13 string-prefix? string-index-right
    8               string-concatenate string-concatenate/shared))
     7(require-library srfi-1 srfi-13 data-structures)
     8(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:))
    912
     13;; Defined in xpath-parser, but used elsewhere...  Maybe export it from txpath-parser?
     14(define sxml:whitespace '(#\space #\return #\newline #\tab))
     15
     16(define (substring? pattern str) (string-contains str pattern))
    1017(define string-rindex string-index-right)
    1118
     
    2633              (if (procedure? x) (x (current-error-port)) (display x (current-error-port))))
    2734            args))
     35
     36;; This is a simplified version of the "string-split" procedure provided
     37;; by SSAX/lib/util.scm (which is 57 lines long!); this one is enough for
     38;; txpath and xpath-context
     39(define (string-split str separators . rest)
     40  (if (not (null? rest))
     41      (error (string-append "String-split called with more arguments. "
     42                            "This shouldn't happen and is a bug in the "
     43                            "chicken-specific code of the sxpath egg."))
     44      (chicken:string-split str (list->string separators))))
  • release/4/sxpath/trunk/chicken/sxpath-lolevel.scm

    r13360 r27178  
    121121        (only ports call-with-input-string))
    122122
    123 (require-library srfi-13 srfi-1)
    124 
    125 (import (only srfi-1 filter))
    126 
    127123;; There's no real danger of hygiene breakage because the macros here
    128124;; are only used locally
  • release/4/sxpath/trunk/chicken/sxpath.scm

    r24873 r27178  
    1 (provide 'sxpath)
    2 
    31(module sxpath
    42  (sxpath if-sxpath car-sxpath if-car-sxpath sxml:id-alist)
    53
    6 (import chicken scheme (only srfi-1 filter)
    7         (only srfi-13 string-prefix-ci? string-contains))
    8 
    9 (require-extension sxpath-lolevel)
    10 (require-extension txpath)
    11 
    12 (define (substring? pattern str) (string-contains str pattern))
     4(import chicken scheme)
     5(use sxpath-lolevel txpath)
    136
    147(include "chicken/common.scm")
    15 
    168(include "sxml-tools/sxpath.scm")
    179)
  • release/4/sxpath/trunk/chicken/txpath.scm

    r24873 r27178  
    1 (provide 'txpath)
    2 
    31(module txpath
    42  (sxml:core-last
     
    4038   txpath)
    4139
    42 (import chicken scheme (only srfi-1 filter)
    43         (only srfi-13 string-prefix-ci? string-contains)
    44         (prefix (only data-structures string-split) chicken:))
    45 
    46 (require-extension sxpath-lolevel)
    47 
    48 (define (substring? pattern str) (string-contains str pattern))
    49 ;; This is a simplified version of the "string-split" procedure provided
    50 ;; by SSAX/lib/util.scm (which is 57 lines long!); this one is enough for txpath
    51 (define (string-split str separators . rest)
    52   (if (not (null? rest))
    53       (error (string-append "String-split called with more arguments. "
    54                             "This shouldn't happen and is a bug in the "
    55                             "chicken-specific code of the sxpath egg."))
    56       (chicken:string-split str (list->string separators))))
     40(import chicken scheme)
     41(use sxpath-lolevel txpath-parser)
    5742
    5843(include "chicken/common.scm")
    59 
    60 (include "sxml-tools/xpath-parser.scm")
    6144(include "sxml-tools/txpath.scm")
    6245)
  • release/4/sxpath/trunk/sxpath.setup

    r24874 r27178  
     1;; -*- Scheme -*-
     2
    13(compile -s -O2 -o "sxpath-lolevel.so" chicken/sxpath-lolevel.scm -j sxpath-lolevel)
    24(compile -s -O2 sxpath-lolevel.import.scm)
     5
     6(compile -s -O2 -o "txpath-parser.so" chicken/txpath-parser.scm -j txpath-parser)
     7(compile -s -O2 txpath-parser.import.scm)
    38
    49(compile -s -O2 -o "txpath.so" chicken/txpath.scm -j txpath)
     
    1015(install-extension 'sxpath
    1116  `("sxpath-lolevel.so" "sxpath-lolevel.import.so"
     17    "txpath-parser.so" "txpath-parser.import.so"
    1218    "txpath.so" "txpath.import.so"
    1319    "sxpath.so" "sxpath.import.so")
Note: See TracChangeset for help on using the changeset viewer.