Hi Bruno, 

Here are the implementation for both Pil32 and Pil64: 



Pil32: 

// (low? 'any) -> sym | NIL 
any doLowQ(any x) { 
x = cdr(x); 
return isSym(x = EVAL(car(x))) && isLowc(symChar(name(x)))? x : Nil; 
} 

// (upp? 'any) -> sym | NIL 
any doUppQ(any x) { 
x = cdr(x); 
return isSym(x = EVAL(car(x))) && isUppc(symChar(name(x)))? x : Nil; 
} 





Pil64:

# (low? 'any) -> sym | NIL
(code 'doLowQ 2)
ld E ((E CDR))  # Get arg
eval  # Eval it
num E  # Number?
jnz retNil  # Yes
sym E  # Symbol?
jz retNil  # No
call firstCharE_A  # Get first character
cmp A TOP  # Special "top" character?
jeq retNil  # Yes
call caseDataA_AC  # Get case info
and B (hex "1F")  # Character type
cmp B CHAR_LOWERCASE  # Lower case?
ldnz E Nil  # No
ret

# (upp? 'any) -> sym | NIL
(code 'doUppQ 2)
ld E ((E CDR))  # Get arg
eval  # Eval it
num E  # Number?
jnz retNil  # Yes
sym E  # Symbol?
jz retNil  # No
call firstCharE_A  # Get first character
cmp A TOP  # Special "top" character?
jeq retNil  # Yes
call caseDataA_AC  # Get case info
and B (hex "1F")  # Character type
cmp B CHAR_UPPERCASE  # Lower case?
ldnz E Nil  # No
ret



>From what I understand they are both using same mechanism but Pil32 is using C 
>programming while Pil64 is using PilASM.
So to understand better lets just dig with Pil32, here is the ingredients:



static inline int charType(int c) {return Data[Blocks[c>>5]+c & 0xFFFF] & 0x1F;}

static inline bool isLowc(int c) {return charType(c) == CHAR_LOWERCASE;}
static inline bool isUppc(int c) {return charType(c) == CHAR_UPPERCASE;}



So there is an array there so I believe your understanding is correct. And when 
looking deeper with Pil64 it mentions about 
"Case mappings from the GNU Kaffe Project" so I think this is where the case 
info integrated. 

BR,
geo

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to