Associating names with characters for named Unicode characters

Robert Dodier <[email protected]> Wed, 3 Jan 2024 11:51:18 -0800
Newsgroups gmane.editors.j.devel
Message-ID <CAAsY_sS8FoBqkwgsX5eLSSpQ+yyoAt82_70UMMGwD6p+LeZ3vg__38893.5275886738$1704311540$gmane$org@mail.gmail.com>
Hi, I wonder if there is a way to associate a name with a character at
run time in ABCL.

I am interested in working with Unicode characters which have names,
e.g. BOX DRAWINGS LIGHT HORIZONTAL and others listed in the document
at: https://www.unicode.org/charts/PDF/U2500.pdf

I am thinking it would be great if I could refer to such characters by
name, e.g.: #\BOX_DRAWINGS_LIGHT_HORIZONTAL. It appears that such
names are not defined in ABCL; I'm looking for a way to define them at
run time.

>From looking at the source code, maybe it's possible via the
setCharName static method in org.armedbear.lisp.LispCharacter.
However, when I try to get a reference to setCharName, I get an error:

CL-USER(10): (java:jstatic "setCharName" "org.armedbear.lisp.LispCharacter")
#<THREAD "interpreter" native {48616CA1}>: Debugger invoked on
condition of type ERROR
  No such static method: org.armedbear.lisp.LispCharacter.setCharName()

I thought maybe the problem there is that setCharName isn't declared
public, but I tried the same operation with a declared public static
method and I get the same error:

CL-USER(12): (java:jstatic "getInstance" "org.armedbear.lisp.LispCharacter")
#<THREAD "interpreter" native {48616CA1}>: Debugger invoked on
condition of type ERROR
  No such static method: org.armedbear.lisp.LispCharacter.getInstance()

so maybe I am not going about that correctly.

setCharName modifies the lookup table
org.armedbear.lisp.LispCharacter.lispChars -- I'm sure it's not
recommended, but maybe I can put new entries into it directly; can
someone give me a hint as to the appropriate incantation in Lisp?
lispChars is declared public static so it seems like it should be
possible, if I can craft the appropriate method call to
org.armedbear.lisp.CharHashMap.put.

Thanks for any info,

Robert