Lisp HUG Maillist Archive

output-pane input models on the Mac

Hi,

I'm hoping someone can explain the relationship between :character, :key
and :gesture-spec
input models in Lispworks 5.0 on the mac.

In 4.4 on the PC, I was able to use :character and got back character
objects with modifier bits
for every possible key on the keyboard.  This worked well for our
application since the primary
interface is basically a (hyper) text editor.

On the mac, :character doesn't include any modifier bits.  (:key :press)
doesn't either.
More disturbingly, for command shifted key input (and sometimes, even
unshifted keys), nothing is returned, and the window just beeps.

So I then switched to using :gesture-spec to capture keyboard input. 
This seems to capture the
greatest amount of info although command shifted keys still beep.  I'm
guessing that the input
is being intercepted at some lower level so the question then become how
to turn that off.

Also the Alt key generates extended characters for the alphanumeric keys
despite interface-keys-style
returning :emacs.  The exception being the function keys where the META
modifier bit do appear.

Playing with the input-model.lisp file in the examples has only managed
to highlight my 
confusion.

thanks for any assistance


ed


(string= pat str) but not (find-regexp-in-string pat str)

I have a conventional ASCII character string (str) which I'd like to match 
with a regexp pattern (pat).  The pattern is the same as the string.

(string= pat str) returns t.
(find-regexp-in-string pat str) returns NIL NIL

And also:
(find-regexp-in-string str str) returns NIL NIL

It doesn't seem like this should be possible.  Should it?  Thanks for any 
help.

Mitch 


Re: (string= pat str) but not (find-regexp-in-string pat str)


"Mitch Berkson" <mitch@bermita.com> writes:
> I have a conventional ASCII character string (str) which I'd like to
> match with a regexp pattern (pat).  The pattern is the same as the
> string.

If by "conventional" you mean an ASCII string that has regex meta
characters in it, then yes that is very possible:

  (lw:find-regexp-in-string "ca?r" "ca?r") => NIL

If the string in question has no meta chars, then it does seem like it
should always match.

http://www.lispworks.com/documentation/lw445/EDUG-W/html/eduser-w-68.htm

Cheers,
Chris Dean


Re: (string= pat str) but not (find-regexp-in-string pat str)

On Wed, 6 Sep 2006 16:34:05 -0400, "Mitch Berkson" <mitch@bermita.com> wrote:

> I have a conventional ASCII character string (str) which I'd like to
> match with a regexp pattern (pat).  The pattern is the same as the
> string.
>
> (string= pat str) returns t.
> (find-regexp-in-string pat str) returns NIL NIL
>
> And also:
> (find-regexp-in-string str str) returns NIL NIL
>
> It doesn't seem like this should be possible.  Should it?  Thanks
> for any help.

Perhaps the string contains characters which have a special meaning in
regular expressions?


Re: (string= pat str) but not (find-regexp-in-string pat str)


"Mitch Berkson" <mitch@bermita.com> writes:
> Chris Dean wrote:
>> If by "conventional" you mean an ASCII string that has regex meta
>> characters in it, then yes that is very possible:
>
> The string is "dailySchedule".

That is certainly a puzzle.  For me,

  (lw:find-regexp-in-string "dailySchedule" "dailySchedule") => 0 13

That's running LispWorks 4.4.6 on a Mac.  If you type the above sexp
into a repl, what do you get?

Cheers,
Chris Dean


Re: (string= pat str) but not (find-regexp-in-string pat str)


I think I've run out of ideas.  Using a very simple xmls call in my
repl still works:

  (asdf-install:install 'xmls)
  ;; ... xmls-1.2 ...
  (setf xx (xmls:parse "<a> dailySchedule </a>")) => ("a" NIL "dailySchedule")
  (setf yy (xmls:parse "<a> dailySchedule </a>")) => ("a" NIL "dailySchedule")
  (lw:find-regexp-in-string (third xx) (third yy)) => 0 13

Cheers,
Chris Dean


Re: (string= pat str) but not (find-regexp-in-string pat str)


"Mitch Berkson" <mitch@bermita.com> writes:
> (setf xx (xmls:parse "<rml:Regatta>
>   <dailySchedule defaultTimeSlotDuration=>
>    </dailySchedule>
> </rml:Regatta>")) 
> ...

That fails.  Good!

(lw:find-regexp-in-string "dailySchedule" (car (third xx))) => NIL NIL
(type-of (car (third xx))) => (ARRAY CHARACTER (26))
(type-of "dailySchedule") => SIMPLE-BASE-STRING

You could coerce from one type to another:

(coerce (car (third xx)) 'simple-base-string) => "dailySchedule"
(lw:find-regexp-in-string "dailySchedule" 
                          (coerce (car (third xx)) 'simple-base-string))
  => 0 13

Cheers,
Chris Dean


Updated at: 2020-12-10 08:47 UTC