Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | pj | 1 | /* Project: OSLib |
2 | * Description: The OS Construction Kit |
||
3 | * Date: 1.6.2000 |
||
4 | * Idea by: Luca Abeni & Gerardo Lamastra |
||
5 | * |
||
6 | * OSLib is an SO project aimed at developing a common, easy-to-use |
||
7 | * low-level infrastructure for developing OS kernels and Embedded |
||
8 | * Applications; it partially derives from the HARTIK project but it |
||
9 | * currently is independently developed. |
||
10 | * |
||
11 | * OSLib is distributed under GPL License, and some of its code has |
||
12 | * been derived from the Linux kernel source; also some important |
||
13 | * ideas come from studying the DJGPP go32 extender. |
||
14 | * |
||
15 | * We acknowledge the Linux Community, Free Software Foundation, |
||
16 | * D.J. Delorie and all the other developers who believe in the |
||
17 | * freedom of software and ideas. |
||
18 | * |
||
19 | * For legalese, check out the included GPL license. |
||
20 | */ |
||
21 | |||
22 | #include <ll/ctype.h> |
||
23 | #include <ll/i386/string.h> |
||
24 | |||
25 | FILE(strnum); |
||
26 | |||
27 | int isnumber(char c,int base) |
||
28 | { |
||
29 | static char *digits = "0123456789ABCDEF"; |
||
30 | if ((c >= '0' && c <= digits[base-1])) |
||
31 | return(1); |
||
32 | else return(0); |
||
33 | } |
||
34 | |||
35 | int tonumber(char c) |
||
36 | { |
||
37 | if (c >= '0' && c <= '9') return(c - '0'); |
||
38 | else if (c >= 'A' && c <= 'F') return(c - 'A' + 10); |
||
39 | else if (c >= 'a' && c <= 'f') return(c - 'a' + 10); |
||
40 | else return(c); |
||
41 | } |
||
42 | |||
43 | char todigit(int c) |
||
44 | { |
||
45 | if (c >= 0 && c <= 9) return(c+'0'); |
||
46 | else if (c >= 10 && c <= 15) return(c + 'A' - 10); |
||
47 | else return(c); |
||
48 | } |
||
49 | |||
50 | int isxdigit(char c) |
||
51 | { |
||
52 | if ((c >= '0' && c <= 'F') || (c >= 'a' && c <= 'f')) |
||
53 | return(1); |
||
54 | else return(0); |
||
55 | } |
||
56 | |||
57 | int isdigit(char c) |
||
58 | { |
||
59 | if ((c >= '0' && c <= '9')) |
||
60 | return(1); |
||
61 | else return(0); |
||
62 | } |