merge ROS Shell without integrated explorer part into trunk
[reactos.git] / reactos / boot / freeldr / freeldr / include / rtl.h
1 /*
2 * FreeLoader
3 * Copyright (C) 1998-2003 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 // Memory Functions
28 //
29 ///////////////////////////////////////////////////////////////////////////////////////
30 int memcmp(const void *buf1, const void *buf2, size_t count);
31 void * memcpy(void *to, const void *from, size_t count);
32 void * memmove(void *dest, const void *src, size_t count);
33 void * memset(void *src, int val, size_t count);
34
35 #define RtlCompareMemory(Source1, Source2, Length) memcmp(Source1, Source2, Length)
36 #define RtlCopyMemory(Destination, Source, Length) memcpy(Destination, Source, Length)
37 #define RtlFillMemory(Destination, Length, Fill) memset(Destination, Fill, Length)
38 #define RtlZeroMemory(Destination, Length) memset(Destination, 0, Length)
39
40 ///////////////////////////////////////////////////////////////////////////////////////
41 //
42 // Standard Library Functions
43 //
44 ///////////////////////////////////////////////////////////////////////////////////////
45 int atoi(char *string);
46 char * itoa(int value, char *string, int radix);
47 int toupper(int c);
48 int tolower(int c);
49
50 int isspace(int c);
51 int isdigit(int c);
52 int isxdigit(int c);
53
54 char * convert_to_ascii(char *buf, int c, ...);
55 char * convert_i64_to_ascii(char *buf, int c, ...);
56
57 void beep(void);
58 void delay(unsigned msec);
59 void sound(int freq);
60
61 #ifndef max
62 #define max(a, b) (((a) > (b)) ? (a) : (b))
63 #endif
64
65 #ifndef min
66 #define min(a, b) (((a) < (b)) ? (a) : (b))
67 #endif
68
69 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
70 #define UINT64_C(val) val##ULL
71
72 ///////////////////////////////////////////////////////////////////////////////////////
73 //
74 // Screen Output Functions
75 //
76 ///////////////////////////////////////////////////////////////////////////////////////
77 void print(char *str);
78 void printf(char *fmt, ...);
79 void sprintf(char *buffer, char *format, ...);
80
81 ///////////////////////////////////////////////////////////////////////////////////////
82 //
83 // List Functions
84 //
85 ///////////////////////////////////////////////////////////////////////////////////////
86
87 typedef struct _LIST_ITEM
88 {
89 struct _LIST_ITEM* ListPrev;
90 struct _LIST_ITEM* ListNext;
91
92 } LIST_ITEM, *PLIST_ITEM;
93
94 VOID RtlListInitializeHead(PLIST_ITEM ListHead); // Initializes a doubly linked list
95 VOID RtlListInsertHead(PLIST_ITEM ListHead, PLIST_ITEM Entry); // Inserts an entry at the head of the list
96 VOID RtlListInsertTail(PLIST_ITEM ListHead, PLIST_ITEM Entry); // Inserts an entry at the tail of the list
97 PLIST_ITEM RtlListRemoveHead(PLIST_ITEM ListHead); // Removes the entry at the head of the list
98 PLIST_ITEM RtlListRemoveTail(PLIST_ITEM ListHead); // Removes the entry at the tail of the list
99 PLIST_ITEM RtlListGetHead(PLIST_ITEM ListHead); // Returns the entry at the head of the list
100 PLIST_ITEM RtlListGetTail(PLIST_ITEM ListHead); // Returns the entry at the tail of the list
101 BOOL RtlListIsEmpty(PLIST_ITEM ListHead); // Indicates whether a doubly linked list is empty
102 ULONG RtlListCountEntries(PLIST_ITEM ListHead); // Counts the entries in a doubly linked list
103 PLIST_ITEM RtlListGetPrevious(PLIST_ITEM ListEntry); // Returns the previous item in the list
104 PLIST_ITEM RtlListGetNext(PLIST_ITEM ListEntry); // Returns the next item in the list
105 PLIST_ITEM RtlListRemoveEntry(PLIST_ITEM ListEntry); // Removes the entry from the list
106 VOID RtlListInsertEntry(PLIST_ITEM InsertAfter, PLIST_ITEM ListEntry); // Inserts a new list entry right after the specified one
107 VOID RtlListMoveEntryPrevious(PLIST_ITEM ListEntry); // Moves the list entry to before the previous entry
108 VOID RtlListMoveEntryNext(PLIST_ITEM ListEntry); // Moves the list entry to after the next entry
109
110
111 #endif // defined __STDLIB_H