;;********************************************
;;********************************************
;;////////////////////////////////////////////
;;PMX SCORE
Parser
;;////////////////////////////////////////////
;;Mauricio
Rodriguez - 2008
;;////////////////////////////////////////////
;;marod@ccrma.stanford.edu
;;////////////////////////////////////////////
;;********************************************
;;********************************************
#|
******************************
******************************
Use and
copying of this software and preparation of derivative works
based upon
this software are prohibited unless permission of the author.
Suggestions,
comments and bug reports are welcome. Please address email to:
marod@ccrma.stanford.edu
******************************
******************************
|#
;;Main:
;;load-pmx-file
[]
;;(load-pmx-file)
Code:
#|
(defun
divide-string-in-lists* (string)
(do* ((current-string string (subseq
current-string (+ current-position 1)))
(current-position -1 (position
#\Newline current-string))
(output
nil (cons current-position output)))
((equal
current-position 'nil) (butlast (reverse output)))))
|#
#|
(defun
divide-string-in-lists (string)
(let ((string-portions
(divide-string-in-lists* string)))
(do ((current-index-subseq
(mapcar #'1+
string-portions)
(rest
current-index-subseq))
(current-delta-index
(append
string-portions '(nil))
(rest
current-delta-index))
(current-string
string
(if (endp
current-index-subseq)
current-string
(subseq current-string (first current-index-subseq))))
(output
nil
(cons
(read-from-string
(concatenate 'string
"(" (subseq current-string 0 (first current-delta-index))
")"))
output)))
((endp current-delta-index)
(reverse output)))))
|#
#|
(divide-string-in-lists
"8.0
1.0 0.0 0.0 0.0 180.0
3.0 1.0
1.0 1.0
20.0 1.0 12.0 0.0 1.0
1.0 1.0
21.0 8.0 29.0 0.0 0.5
1.0 1.0
21.5 8.0 29.0 0.0 0.5
1.0 1.0
22.0 8.0 29.0 0.0 1.0
1.0 1.0
23.0 10.0 27.0 0.0 0.2
1.0 1.0
23.2 9.0 21.0 0.0 0.2
1.0 1.0
23.4 8.0 28.0 0.0 0.2
1.0 1.0
23.6 8.0 28.0 0.0 0.2
1.0 1.0
23.8 8.0 28.0 0.0 0.2
1.0 1.0
24.0 8.0 28.0 0.0 1.0")
|#
(defvar
*string-sequence* nil)
(defun
load-pmx-file* ()
(setf *string-sequence* nil)
(setf *string-sequence*
(with-open-file (input (choose-file-dialog)
:direction :input)
(read-from
input))))
(defun
read-from (stream)
(let ((current-line (read-line stream
nil)))
(unless (not current-line)
(cons
current-line
(read-from stream)))))
;;(load-pmx-file*)
(defun
load-pmx-file ()
(load-pmx-file*)
(loop for x in *string-sequence*
collect (read-from-string (concatenate 'string "(" x
")"))))
;;(load-pmx-file)