Fixed obvious typos.
[reactos.git] / freeldr / freeldr / rtl.h
1 /*
2 * FreeLoader
3 * Copyright (C) 1999, 2000, 2001 Brian Palmer <brianp@sginet.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20 #ifndef __STDLIB_H
21 #define __STDLIB_H
22
23 #include <freeldr.h>
24
25 ///////////////////////////////////////////////////////////////////////////////////////
26 //
27 // String Functions
28 //
29 ///////////////////////////////////////////////////////////////////////////////////////
30 int strlen(char *str);
31 char * strcpy(char *dest, char *src);
32 char * strncpy(char *dest, char *src, size_t count);
33 char * strcat(char *dest, char *src);
34 char * strchr(const char *s, int c);
35 char * strrchr(const char *s, int c);
36 int strcmp(const char *string1, const char *string2);
37 int stricmp(const char *string1, const char *string2);
38 int strncmp(const char *string1, const char *string2, size_t length);
39 int _strnicmp(const char *string1, const char *string2, size_t length);
40
41 ///////////////////////////////////////////////////////////////////////////////////////
42 //
43 // Memory Functions
44 //
45 ///////////////////////////////////////////////////////////////////////////////////////
46 int RtlCompareMemory(const PVOID Source1, const PVOID Source2, ULONG Length);
47 VOID RtlCopyMemory(PVOID Destination, const PVOID Source, ULONG Length);
48 VOID RtlFillMemory(PVOID Destination, ULONG Length, UCHAR Fill);
49 VOID RtlZeroMemory(PVOID Destination, ULONG Length);
50
51 #define memcmp(buf1, buf2, count) RtlCompareMemory(buf1, buf2, count)
52 #define memcpy(dest, src, count) RtlCopyMemory(dest, src,count)
53 #define memset(dest, c, count) RtlFillMemory(dest,count, c)
54
55 ///////////////////////////////////////////////////////////////////////////////////////
56 //
57 // Standard Library Functions
58 //
59 ///////////////////////////////////////////////////////////////////////////////////////
60 int atoi(char *string);
61 char * itoa(int value, char *string, int radix);
62 int toupper(int c);
63 int tolower(int c);
64
65 int isspace(int c);
66 int isdigit(int c);
67 int isxdigit(int c);
68
69 char * convert_to_ascii(char *buf, int c, ...);
70
71 void putchar(int ch); // Implemented in asmcode.S
72 void clrscr(void); // Implemented in asmcode.S
73 int kbhit(void); // Implemented in asmcode.S
74 int getch(void); // Implemented in asmcode.S
75 void gotoxy(int x, int y); // Implemented in asmcode.S
76 int getyear(void); // Implemented in asmcode.S
77 int getday(void); // Implemented in asmcode.S
78 int getmonth(void); // Implemented in asmcode.S
79 int gethour(void); // Implemented in asmcode.S
80 int getminute(void); // Implemented in asmcode.S
81 int getsecond(void); // Implemented in asmcode.S
82 void hidecursor(void); // Implemented in asmcode.S
83 void showcursor(void); // Implemented in asmcode.S
84 int wherex(void); // Implemented in asmcode.S
85 int wherey(void); // Implemented in asmcode.S
86
87 #ifndef max
88 #define max(a, b) (((a) > (b)) ? (a) : (b))
89 #endif
90
91 #ifndef min
92 #define min(a, b) (((a) < (b)) ? (a) : (b))
93 #endif
94
95 ///////////////////////////////////////////////////////////////////////////////////////
96 //
97 // Screen Output Functions
98 //
99 ///////////////////////////////////////////////////////////////////////////////////////
100 void print(char *str);
101 void printf(char *fmt, ...);
102 void sprintf(char *buffer, char *format, ...);
103
104 ///////////////////////////////////////////////////////////////////////////////////////
105 //
106 // List Functions
107 //
108 ///////////////////////////////////////////////////////////////////////////////////////
109
110 typedef struct _LIST_ITEM
111 {
112 struct _LIST_ITEM* ListPrev;
113 struct _LIST_ITEM* ListNext;
114
115 } LIST_ITEM, *PLIST_ITEM;
116
117 VOID RtlListInitializeHead(PLIST_ITEM ListHead); // Initializes a doubly linked list
118 VOID RtlListInsertHead(PLIST_ITEM ListHead, PLIST_ITEM Entry); // Inserts an entry at the head of the list
119 VOID RtlListInsertTail(PLIST_ITEM ListHead, PLIST_ITEM Entry); // Inserts an entry at the tail of the list
120 PLIST_ITEM RtlListRemoveHead(PLIST_ITEM ListHead); // Removes the entry at the head of the list
121 PLIST_ITEM RtlListRemoveTail(PLIST_ITEM ListHead); // Removes the entry at the tail of the list
122 PLIST_ITEM RtlListGetHead(PLIST_ITEM ListHead); // Returns the entry at the head of the list
123 PLIST_ITEM RtlListGetTail(PLIST_ITEM ListHead); // Returns the entry at the tail of the list
124 BOOL RtlListIsEmpty(PLIST_ITEM ListHead); // Indicates whether a doubly linked list is empty
125 ULONG RtlListCountEntries(PLIST_ITEM ListHead); // Counts the entries in a doubly linked list
126 PLIST_ITEM RtlListGetPrevious(PLIST_ITEM ListEntry); // Returns the previous item in the list
127 PLIST_ITEM RtlListGetNext(PLIST_ITEM ListEntry); // Returns the next item in the list
128 PLIST_ITEM RtlListRemoveEntry(PLIST_ITEM ListEntry); // Removes the entry from the list
129 VOID RtlListInsertEntry(PLIST_ITEM InsertAfter, PLIST_ITEM ListEntry); // Inserts a new list entry right after the specified one
130 VOID RtlListMoveEntryPrevious(PLIST_ITEM ListEntry); // Moves the list entry to before the previous entry
131 VOID RtlListMoveEntryNext(PLIST_ITEM ListEntry); // Moves the list entry to after the next entry
132
133
134 #endif // defined __STDLIB_H