
















ptemb
9
   Purpose: Character classification

/*  The predicates to_lower, to_upper, is_
m, is_alpha, is_cntrl,
    is_digit, is_graph, is_lower, is_upper, is_print,
punct, and
    is_space are taken directly from the April 84 draft of th
    standard.  The remaining ones are of my own invention, but are
 
easonably useful.  If you want to make your programs portable
  
tween different operating systems, use is_endl














nd 26 or 10 and -1.
*/
:- p
c
	is_alnum/1,
	is_alph

	is_cntrl/1,
	is_d
/1,
	is_endfile
	is_graph/1
s_lower
	is










































































































		














126, C).


is_lower(C) :-
	be
n(0'a, 0'z, C).


is_newl
31).			% may be 10 or
(O/S-depe
t)



e
















































































C).


is_punct(C) :-		
etween space and d
s
	between(33,
 C).
is_punct(C) :-			% between digits and 
rs
	between(58, 64, C).
is_punct(C) :-	
between uppers and lowers
	between(
96, C), C \== 0'_.
is_punct(C) :-			% between lowers and delete
	between(123, 126, C).

_quote(0'').
is_quote(0'").
is_quote(0'`).


is_space(32).			% ` `
is_space(31).			
n` in Dec-10 Prolog
is_space( 9).			% `\t`
is_space








			% `\
s_s







			% `\r`
s_upp
)

























ompile
es


























, U),
	'_ul_hack'(U, 0'A, 0'Z, 32, L).


to_upper(L, U) :-
	between(0, 127, L),
	'_ul_hack'(L, 0'a, 0'z, -32, U).


'_ul_ha
X, A, Z, D, Y) :-
	A =< X, X =< Z, !,
	Y is X+D.
'_ul_ha






