[cl-ppcre-devel] Error loading cl-unicode

30 views
Skip to first unread message

Noldus Reijnders

unread,
Nov 24, 2011, 7:47:46 AM11/24/11
to cl-ppcr...@common-lisp.net
Hello everyone!

I'm a student from the netherlands working on a parser (using cl-yacc) and I use dso-lex as the lexer-generator, which depends on cl-ppcre (as you might know). Since I want to parse RIF files that require unicode encoded characters, I wanted to extend cl-ppcre with unicode, using cl-unicode. Unfortunately I receive an error when I try to install cl-unicode. When it tries to compute the Hangul syllable names (this happens when loading hash-tables.fasl) I get the following:
 
Error: `("Unbound Value")' is not of the expected type `number'
  [condition type: type-error]

 
Some extra info:
- I tried to install cl-unicode with, and without installing flexi-streams and trivial-gray-streams, but both give me the error.
- I use Allegro CL
 
Could you perhaps help me?
 
Regards,
 
Noldus Reijnders
 
PS I also get an error when it tries to load util.lisp saying that +t-count+ is unknown. However, I fixed that by replacing that with the number in the assignment of TCount. Same thing for VCount btw. Maybe that has something to do with Allegro CL?

Edi Weitz

unread,
Nov 25, 2011, 4:32:28 AM11/25/11
to General interest list about cl-ppcre and cl-unicode
Hi,

I don't have AllegroCL at hand and I don't have the time to check, but
here are three things you should probably try:

1. Can you try to install "from scratch" with ALL existing FASL files,
no matter where they are, deleted?

2. Can you try with a different Lisp compiler and see if that works for you?

3. Did you try to install with Quicklisp to make sure that it's not a
problem of libraries not working together?

Please let us know if that helps.

Cheers,
Edi.

> _______________________________________________
> cl-ppcre-devel site list
> cl-ppcr...@common-lisp.net
> http://common-lisp.net/mailman/listinfo/cl-ppcre-devel
>

_______________________________________________
cl-ppcre-devel site list
cl-ppcr...@common-lisp.net
http://common-lisp.net/mailman/listinfo/cl-ppcre-devel

Noldus Reijnders

unread,
Nov 25, 2011, 6:51:01 AM11/25/11
to cl-ppcr...@common-lisp.net
Hey Edi,
 
Thanks for the quick response!
 
I tried it with CLISP together with quicklisp and that works fine (didn't know of quicklips before but it is awesome!). However when using AllegroCL, quicklips even causes additional errors:
When loading lists.lisp:
Error: Package "COMMON-LISP" not found. [file position = 160]
  [condition type: reader-error]

 
I also tried to install cl-unicode again without all the fasl files that were created by cl-unicode and that didn't work. Or did you really mean all fasl-files used by my AllegroCL implementation? If so, is there an easy way to do that, or do I need to remove them by hand?
 
Regards,
Noldus

Edi Weitz

unread,
Nov 25, 2011, 7:07:53 AM11/25/11
to General interest list about cl-ppcre and cl-unicode
As for the FASL files, I was mainly concerned with the FASL files for
CL-PPCRE and other libs. If all your Lisp libs are in one directory,
then something like `find . -name '*.fasl' -delete' or somesuch should
do it, shouldn't it?

Regarding the AllegroCL problems - are you maybe working in "modern"
mode? That could definitely be a problem.

On Fri, Nov 25, 2011 at 12:51 PM, Noldus Reijnders

Noldus Reijnders

unread,
Nov 25, 2011, 7:42:32 AM11/25/11
to cl-ppcr...@common-lisp.net
Yes that would do it. :) Unfortunately that does not solve the problem.

And yes, I'm working in modern mode (as in; the mode I use is case-sensitive, right?). Does that mean that mean I cannot use cl-unicode?

Edi Weitz

unread,
Nov 25, 2011, 8:26:55 AM11/25/11
to General interest list about cl-ppcre and cl-unicode
On Fri, Nov 25, 2011 at 1:42 PM, Noldus Reijnders
<n_rei...@hotmail.com> wrote:

> And yes, I'm working in modern mode (as in; the mode I use is
> case-sensitive, right?).

Well, the usual answer to this question is that Common Lisp is always
case-sensitive and that AllegroCL's "modern" mode is a strange
abomination most CL hackers frown upon... :)

> Does that mean that mean I cannot use cl-unicode?

I am unfortunately too busy with other things for the time being to
check compatibility with AllegroCL, but I think it's very likely that
CL-UNICODE won't work with modern mode out of the box. How much
you'll have to change I cannot say. Maybe you'll just have to change
a few lines, maybe it's something more complicated. Sorry, but I
can't be more helpful with this.

Should this be the problem and should you be able to come up with
patches, I'd be happy to incorporate them into a new release, though.

Noldus Reijnders

unread,
Nov 25, 2011, 8:49:45 AM11/25/11
to cl-ppcr...@common-lisp.net
Haha, ok, that's too bad.
 
Thanks for your time and if I do come up with a solution I'll be happy to inform you of it!
 
Regards
Noldus
 
> From: e...@weitz.de
> Date: Fri, 25 Nov 2011 14:26:55 +0100
> To: cl-ppcr...@common-lisp.net
> Subject: Re: [cl-ppcre-devel] Error loading cl-unicode
>

Gary King

unread,
Nov 25, 2011, 11:22:13 AM11/25/11
to General interest list about cl-ppcre and cl-unicode, sup...@franz.com
Hi Noldus and Edi,

The following patch gets you most of the way there:

Common subdirectories: cl-unicode-0.1.2/build and cl-unicode-0.1.2a/build
Common subdirectories: cl-unicode-0.1.2/doc and cl-unicode-0.1.2a/doc
Only in cl-unicode-0.1.2a: hash-tables.lisp
Only in cl-unicode-0.1.2a: lists.lisp
Only in cl-unicode-0.1.2a: methods.lisp
Common subdirectories: cl-unicode-0.1.2/test and cl-unicode-0.1.2a/test
diff cl-unicode-0.1.2/util.lisp cl-unicode-0.1.2a/util.lisp
186c186
< (define-hangul-constant "NCount" (* +v-count+ +t-count+))
---
> (define-hangul-constant "NCount" (* +V-COUNT+ +T-COUNT+))
195,198c195,198
< (let* ((s-index (- code-point +s-base+))
< (l-value (+ +l-base+ (floor s-index +n-count+)))
< (v-value (+ +v-base+ (floor (mod s-index +n-count+) +t-count+)))
< (t-value (+ +t-base+ (mod s-index +t-count+))))
---
> (let* ((s-index (- code-point +S-BASE+))
> (l-value (+ +L-BASE+ (floor s-index +N-COUNT+)))
> (v-value (+ +V-BASE+ (floor (mod s-index +N-COUNT+) +T-COUNT+)))
> (t-value (+ +T-BASE+ (mod s-index +T-COUNT+))))
203c203
< (and (/= t-value +t-base+)
---
> (and (/= t-value +T-BASE+)


All tests pass except for

279:
(string= (unicode-name 13327) "CJK UNIFIED IDEOGRAPH-340F") returned NIL

but this would work if the test used string-equal rather than string=

HTH,

Noldus Reijnders

unread,
Nov 25, 2011, 12:34:05 PM11/25/11
to cl-ppcr...@common-lisp.net, sup...@franz.com
Hey Gary,
 
Thank you for the patch! Although I understand that the patch changes the lines stated below; is this something that can be applied automatically?
As was most likely clear, I'm not the most experienced CL coder at the moment, so I was wondering if your text was runnable code for a program or not. Not that it isn't doable by hand but I'd like to learn the tricks of the trade! :)
 
Regards
 
> From: gwk...@metabang.com
> Date: Fri, 25 Nov 2011 11:22:13 -0500
> To: cl-ppcr...@common-lisp.net
> CC: sup...@franz.com
> Subject: Re: [cl-ppcre-devel] Error loading cl-unicode
>

Noldus Reijnders

unread,
Nov 25, 2011, 12:46:35 PM11/25/11
to cl-ppcr...@common-lisp.net, sup...@franz.com
I mentioned the extra error when using quicklisp > it is thrown when compiling "lists.lisp", so I just opened lists.lisp in the quicklisp dist folder and the one I downloaded from your site, Edi. I found the following differences:
 
Quicklisp:
(|COMMON-LISP|::|IN-PACKAGE| :|CL-UNICODE|)
(|COMMON-LISP|::|SETQ| |CL-UNICODE|::|*GENERAL-CATEGORIES*| '(|CL-UNICODE-NAMES|::|CO| etc...
 
Edi's site:
(in-package :cl-unicode)
(setq *general-categories* (quote (cl-unicode-names::CO etc...
 
Both are version 0.1.2 so I don't understand why this is, but it is clear that my CL implementation has trouble with that. I actually use "GDL" btw, which is build on top of AllegroCL and for some reason it doesn't recognise COMMON-LISP.
 

From: n_rei...@hotmail.com
To: cl-ppcr...@common-lisp.net
Date: Fri, 25 Nov 2011 18:34:05 +0100

Noldus Reijnders

unread,
Nov 28, 2011, 10:56:05 AM11/28/11
to gwk...@franz.com, cl-ppcr...@common-lisp.net
Hi Gary,
 
Ah ok, thanks for explaining both my questions. I circumvented the issue by using the smaller case version-files. Weird that the quicklisp version is different though.
 
Thank you both for the help!
 
Noldus
 
> Date: Mon, 28 Nov 2011 10:50:41 -0500
> From: gwk...@franz.com
> To: n_rei...@hotmail.com
> CC: cl-ppcr...@common-lisp.net; sup...@franz.com

> Subject: Re: [cl-ppcre-devel] Error loading cl-unicode
>
> Hi Noldus,

>
> On 11/25/11 12:46 PM, Noldus Reijnders wrote:
> >
> > I mentioned the extra error when using quicklisp > it is thrown when compiling "lists.lisp", so I just opened lists.lisp in the quicklisp dist folder and the one I downloaded from your site, Edi. I found the following differences: Quicklisp:(|COMMON-LISP|::|IN-PACKAGE| :|CL-UNICODE|)
> > (|COMMON-LISP|::|SETQ| |CL-UNICODE|::|*GENERAL-CATEGORIES*| '(|CL-UNICODE-NAMES|::|CO| etc... Edi's site:(in-package :cl-unicode)
> > (setq *general-categories* (quote (cl-unicode-names::CO etc... Both are version 0.1.2 so I don't understand why this is, but it is clear that my CL implementation has trouble with that. I actually use "GDL" btw, which is build on top of AllegroCL and for some reason it doesn't recognise COMMON-LISP. From: n_rei...@hotmail.com
> > To: cl-ppcr...@common-lisp.net
>
>
> This is caused by the same case issue as the first issue you found. In
> Allegro mlisp, COMMON-LISP and common-lisp are not the same symbols. In
> an ANSI-Lisp, they are. It may be that an additional patch is needed to
> make quicklisp happy too. I'll try to look into that this coming weekend.
>
> HTH,
> --
> Gary Warren King, gwk...@franz.com, http://www.franz.com/
> Franz Inc., 2201 Broadway, Suite 715, Oakland CA 94612
> Cell: (413) 559-8738 * FAX: (206) 338-4052

Edi Weitz

unread,
Nov 28, 2011, 2:52:53 PM11/28/11
to General interest list about cl-ppcre and cl-unicode
Gary,

Thanks for the patch. I'm a bit busy with my new job these days, but
I'll eventually roll this into a new release.

Thanks again,
Edi.

Gary King

unread,
Nov 28, 2011, 3:28:44 PM11/28/11
to General interest list about cl-ppcre and cl-unicode
Hi Edi,

> Thanks for the patch. I'm a bit busy with my new job these days, but
> I'll eventually roll this into a new release.
>
> Thanks again,

Cool. FWIW, I'm going to submit something to the "edi-ware" code on github too.

Noldus Reijnders

unread,
Nov 29, 2011, 10:51:37 AM11/29/11
to cl-ppcr...@common-lisp.net
Hey again!
 
I came across something of which I don't understand why it happens.. When I do this:

(scan "[a-z]*" "<test>") 

 

I get:
0
0
#()
#()

 
while I expect:
1
4
...
... (I don't get the registers.. Although it isn't necessary for me right now, could you maybe explain this as well if you have the time? I think it has something to do with back referencing, but I'm not sure.)
 
 
Also, when I do this:

(scan "[\xD8-\xF6]*" "<test>")
0
6
#()
#() 


while I expect to get nil.
 
It seems as if the scanner doesn't do anything if the first character is part of the regex in the first example (because if I add a angular bracket to the front it does find it) and in the second it matches everything while the hexcode range is far outside the strings range so it shouldn't find anything. Am I doing something wrong?

 
Greatings,
Noldus

Hans Hübner

unread,
Nov 29, 2011, 11:01:27 AM11/29/11
to General interest list about cl-ppcre and cl-unicode
Hi Noldus,

"*" matches zero or more occurences of the expression. Try "+" if you
want to match one or more occurences.

-Hans

Edi Weitz

unread,
Nov 30, 2011, 7:08:35 AM11/30/11
to General interest list about cl-ppcre and cl-unicode
Hi Noldus,

What Hans says. The regex engine usually stops at the first match, so
you have to be careful, because you'll get what you asked for.
General questions about regular expressions are best answered by one
of the numerous online articles or for example by the good O'Reilly
book. I might also shamelessly recommend my "Regex Coach"
application.

As for the other question: You should enter the regex string into your
Lisp listener and see what you'll get back. This has something to do
with how CL treats backslashes in strings - there's also a section
about this in the CL-PPCRE documentation.

Cheers,
Edi.

Noldus Reijnders

unread,
Nov 30, 2011, 9:01:06 AM11/30/11
to cl-ppcr...@common-lisp.net
Hi Edi and Hans,
 
Thanks for answering my questions. I actually already noticed the mistake with the backslashes myself, however I received a delivery failure when trying to send a mail to the mailing list about this.
 
Thanks again for the quick help!

Noldus
> From: e...@weitz.de
> Date: Wed, 30 Nov 2011 13:08:35 +0100
> To: cl-ppcr...@common-lisp.net
> Subject: Re: [cl-ppcre-devel] strange scan results
Reply all
Reply to author
Forward
0 new messages