Subversion Repositories pentevo

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1186 savelij 1
		ifndef   ctypeinc       ; avoid multiple inclusion
2
ctypeinc        equ      1
3
;****************************************************************************
4
;*                                                                          *
5
;*   AS 1.42 - File CTYPE.INC                                               *
6
;*                                                                          *
7
;*   Contains Functions to Classify Characters                              *
8
;*                                                                          *
9
;* CAUTION!  isalpha() does not regard country-specific special characters! *
10
;*                                                                          *
11
;****************************************************************************
12
 
13
		save
14
		listing off   ; no listing over this file
15
 
16
		if	 mompass=1
17
		 message "Standard Character Funkcions (C) 1993 Alfred Arnold"
18
		endif
19
 
20
;----------------------------------------------------------------------------
21
; returns TRUE if the argument is a number:
22
 
23
isdigit         function ch,(ch>='0')&&(ch<='9')
24
 
25
;----------------------------------------------------------------------------
26
; returns TRUE if the argument is hexadecimal number:
27
 
28
isxdigit	function ch,(isdigit(ch))||((toupper(ch)>='A')&&(toupper(ch)<='F'))
29
 
30
;----------------------------------------------------------------------------
31
; returns TRUE if the argument is in the range of ASCII characters:
32
 
33
isascii         function ch,(ch>=0)&&(ch<128)
34
 
35
;----------------------------------------------------------------------------
36
; returns TRUE if the argument is an uppercase letter:
37
 
38
isupper		function ch,(ch>='A')&&(ch<='Z')
39
 
40
;----------------------------------------------------------------------------
41
; returns TRUE if the argument is a lowercase letter:
42
 
43
islower		function ch,(ch>='a')&&(ch<='z')
44
 
45
;----------------------------------------------------------------------------
46
; returns TRUE if the argument is a letter:
47
 
48
isalpha         function ch,(toupper(ch)>='A')&&(toupper(ch)<='Z')
49
 
50
;----------------------------------------------------------------------------
51
; returns TRUE if the argument is a number or letter:
52
 
53
isalnum         function ch,isdigit(ch)||isalpha(ch)
54
 
55
;----------------------------------------------------------------------------
56
; returns TRUE if the argument is some sor tof space:
57
; Hint: 11 = vertical tabulator
58
 
59
isspace		function ch,(ch=' ')||(ch=12)||(ch='\n')||(ch='\r')||(ch='\t')||(ch=11)
60
 
61
;----------------------------------------------------------------------------
62
; returns TRUE if the argument is a printable character:
63
; strictly spoken, DEL(127) should be excluded, but it is printable on a PC
64
 
65
isprint		function ch,(ch>31)&&(ch<255)
66
 
67
;----------------------------------------------------------------------------
68
; returns TRUE if the argument is a control character:
69
 
70
iscntrl		function ch,~~isprint(ch)
71
 
72
;----------------------------------------------------------------------------
73
; returns TRUE if the argument is ein printable and visible character:
74
 
75
isgraph		function ch,isprint(ch)&&(~~isspace(ch))
76
 
77
;----------------------------------------------------------------------------
78
; returns TRUE if the argument is a special character:
79
 
80
ispunct		function ch,isprint(ch)&&(~~isspace(ch))&&(~~isalnum(ch))
81
 
82
		restore                 ; re-enable listing
83
 
84
		endif			; ctypeinc