/*
* For non-Unicode compilers, so we can say
* L("asdf") and get a Rune string. Assumes strings
* are identified by their pointers, so no mutable strings!
*/
typedef struct Lhash Lhash;
struct Lhash
{
char *s;
Lhash *next;
Rune r[1];
};
static Lhash *hash[1127];
Rune*
L(char *s)
{
Rune *p;
Lhash *l;
uint h;
h = (uintptr)s%nelem(hash);
for(l=hash[h]; l; l=l->next)
if(l->s == s)
return l->r;
l = emalloc(sizeof *l+(utflen(s)+1)*sizeof(Rune));
p = l->r;
l->s = s;
while(*s)
s += chartorune(p++, s);
*p = 0;
l->next = hash[h];
hash[h] = l;
return l->r;
}