Robert Dodier <robert.dodier at gmail.com> writes:
> Um, to the best of my knowledge, the current scheme does work correctly
> with unicode data.
I don't think that this can be correct. On the master branch, the code
that jumps to the right bit of the info file is the following:
(defun read-info-text (dir-name parameters)
(let*
((value (cdr parameters))
(filename (car value))
(byte-offset (cadr value))
(byte-count (caddr value))
(text (make-string byte-count))
(path+filename (make-pathname :directory dir-name :name filename)))
(with-open-file (in path+filename :direction :input)
(file-position in byte-offset)
#+gcl (gcl-read-sequence text in :start 0 :end byte-count)
#-gcl (read-sequence text in :start 0 :end byte-count))
text))
Notice that we open up the file as a character stream. Looking at the
CLHS for byte position, you see that the requirements on the meaning of
the number are quite lax.
Anyway, I've attached a simple test script that I tried, with the
following output:
tmp.txt contains:
? should be skipped (I prefer algebra)
Running the following code:
(with-open-file (s "tmp.txt")
(file-position s 3)
(print (read-line s))
(terpri))
GCL gives:
" should be skipped (I prefer algebra)"
SBCL gives:
" should be skipped (I prefer algebra)"
SCL gives:
Warning: the kernel parameter max_map_count=65530 is less than the 189440+
pages usable by Scieneer Common Lisp. It is recommended that max_map_count be
increased to at least 189440. This can be done with either:
sysctl -w vm.max_map_count=189440
echo 189440 > /proc/sys/vm/max_map_count
Scieneer Common Lisp 1.3.9
Copyright (c) 2000-2008, Scieneer Pty Ltd. All Rights Reserved.
Restricted noncommercial license. Licensed to Rupert Swarbrick.
Loaded subsystems:
Compiler 1.0, target Intel x86
*
"hould be skipped (I prefer algebra)"
NIL
*
ACL gives:
International Allegro CL Free Express Edition
9.0 [Linux (x86)] (Aug 24, 2012 17:36)
Copyright (C) 1985-2012, Franz Inc., Oakland, CA, USA. All Rights Reserved.
This development copy of Allegro CL is licensed to:
Allegro CL 9.0 Express user
;; Optimization settings: safety 1, space 1, speed 1, debug 2.
;; For a complete description of all compiler switches given the
;; current optimization settings evaluate (EXPLAIN-COMPILER-SETTINGS).
CL-USER(1):
" should be skipped (I prefer algebra)"
NIL
CL-USER(2): EOF ; Auto-exit
; Exiting
Looks like SBCL, GCL and ACL use byte offsets and SCL uses character
offsets. I didn't test the other lisps we support.
> Dumping the index would be useful as a debugging feature.
At the Maxima-code level or with lisp? If the latter, they are stored in
a couple of hash tables that aren't exactly obfuscated. I could add a
"info-offset-alists" function if you think it'd be useful?
Rupert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.sh
Type: text/x-sh
Size: 857 bytes
Desc: not available
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20130325/1cb67813/attachment.sh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 315 bytes
Desc: not available
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20130325/1cb67813/attachment.pgp>