Mercurial > projects > ddmd
comparison dmd/Gnuc.d @ 14:2cc604139636
Implemented Linux support for ddmd. Some parts are a bit hacky to just "get it working", that said, druntime and phobos compile, and unittests pass.
author | Robert Clipsham <robert@octarineparrot.com> |
---|---|
date | Sun, 04 Apr 2010 02:06:32 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
11:3356c90e9aac | 14:2cc604139636 |
---|---|
1 module dmd.Gnuc; | |
2 | |
3 int memicmp(const char *s1, const char *s2, int n) | |
4 { | |
5 int result = 0; | |
6 | |
7 for (int i = 0; i < n; i++) | |
8 { char c1 = s1[i]; | |
9 char c2 = s2[i]; | |
10 | |
11 result = c1 - c2; | |
12 if (result) | |
13 { | |
14 if ('A' <= c1 && c1 <= 'Z') | |
15 c1 += 'a' - 'A'; | |
16 if ('A' <= c2 && c2 <= 'Z') | |
17 c2 += 'a' - 'A'; | |
18 result = c1 - c2; | |
19 if (result) | |
20 break; | |
21 } | |
22 } | |
23 return result; | |
24 } | |
25 | |
26 int stricmp(const(char) *s1, const(char) *s2) | |
27 { | |
28 int result = 0; | |
29 | |
30 for (;;) | |
31 { char c1 = *s1; | |
32 char c2 = *s2; | |
33 | |
34 result = c1 - c2; | |
35 if (result) | |
36 { | |
37 if ('A' <= c1 && c1 <= 'Z') | |
38 c1 += 'a' - 'A'; | |
39 if ('A' <= c2 && c2 <= 'Z') | |
40 c2 += 'a' - 'A'; | |
41 result = c1 - c2; | |
42 if (result) | |
43 break; | |
44 } | |
45 if (!c1) | |
46 break; | |
47 s1++; | |
48 s2++; | |
49 } | |
50 return result; | |
51 } |