1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
#! /usr/bin/clisp -C -q -q
; Should be called from root account once to generate binaries for libraries
(load #p"/usr/share/common-lisp/source/asdf/asdf.lisp")
(push #p"/usr/share/common-lisp/systems/" asdf:*central-registry*)
(asdf:oos 'asdf:load-op :s-xml)
;(in-package :s-xml)
(defvar dom NIL)
(defun parse_xml (xml)
(s-xml::start-parse-xml
xml
(make-instance 's-xml::xml-parser-state
:new-element-hook #'(lambda (name attributes seed) ())
:finish-element-hook #'(lambda (name attributes parent-seed seed) ())
:text-hook #'(lambda (string seed) ())
; :text-hook #'(lambda (string seed) (princ string))
)))
; (princ string out)))))
(defun parse_file (fn)
(setf dom
(with-open-file
(xml fn)
(parse_xml xml))))
(defun parse_iteration (fn i)
(if fn
(parse_file fn)
(parse_file (concatenate 'string "../xml.tmp/" (write-to-string i) ".xml"))))
(defvar iterations NIL)
(defvar xmlfn NIL)
(if (> (length *ARGS*) 0)
(setf iterations (parse-integer (first *ARGS*)))
(setf iterations 0))
(if (> (length *ARGS*) 1)
(setf xmlfn (second *ARGS*))
(setf xmlfn NIL))
(parse_iteration xmlfn 0)
;(pprint (list "Number of Iterations" iterations))
(if (> iterations 0)
(time
(dotimes (i iterations)
(parse_iteration xmlfn (+ i 1))))
(dotimes (i iterations)
(parse_iteration xmlfn (+ i 1))))
|