File tree Expand file tree Collapse file tree 3 files changed +25
-10
lines changed Expand file tree Collapse file tree 3 files changed +25
-10
lines changed Original file line number Diff line number Diff line change 22
22
(defmacro make-converter (type s)
23
23
(cast type (read-ascii-word s)))
24
24
25
- (defun atoi (s) (make-converter int s))
26
- (defun atol (s) (make-converter long s))
27
- (defun atoll (s) (make-converter long-long s))
25
+ (defun atoi (s)
26
+ (declare (external " atoi" ))
27
+ (make-converter int s))
28
+
29
+ (defun atol (s)
30
+ (declare (external " atol" ))
31
+ (make-converter long s))
32
+
33
+ (defun atoll (s)
34
+ (declare (external " atoll" ))
35
+ (make-converter long-long s))
Original file line number Diff line number Diff line change 2
2
(require stdio)
3
3
(require string )
4
4
(require errno)
5
+ (require ascii)
Original file line number Diff line number Diff line change 1
1
(require types)
2
2
(require pointers)
3
3
(require memory)
4
+ (require ascii)
4
5
5
6
(defun strlen (p)
6
7
(declare (external " strlen" ))
140
141
(memcmp s1 s2 (min (strlen/with-null s1)
141
142
(strlen/with-null s2))))
142
143
143
- (defun strncasecmp (p1 p2 n)
144
- (declare (external " strncasecmp" ))
144
+ (defun memcasecmp (p1 p2 n)
145
145
(let ((res 0 ) (i 0 ))
146
146
(while (and (< i n) (not res))
147
147
(set res (compare
148
- (tolower ( memory-read p1))
149
- (tolower ( memory-read p2))))
148
+ (ascii-to-lower (cast int ( memory-read p1) ))
149
+ (ascii-to-lower (cast int ( memory-read p2) ))))
150
150
(incr p1 p2 i))
151
151
res))
152
152
153
- (defun strcasecmp (p1 p2)
153
+ (defun strncasecmp (p1 p2 n )
154
154
(declare (external " strncasecmp" ))
155
- (strncasecmp p1 p2 (min (strlen p1)
156
- (strlen p2))))
155
+ (memcasecmp p1 p2 (min n
156
+ (strlen/with-null p1)
157
+ (strlen/with-null p2))))
158
+
159
+ (defun strcasecmp (p1 p2)
160
+ (declare (external " strcasecmp" ))
161
+ (strncasecmp p1 p2 (min (strlen/with-null p1)
162
+ (strlen/with-null p2))))
157
163
158
164
159
165
(defmacro find-substring (compare hay needle)
You can’t perform that action at this time.
0 commit comments