Restructure into separate modules.
[grub-extras.git] / grub_lua.h
blob78e6546c72227f8512a9b3509eeceda779bef482
1 /*
2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2009 Free Software Foundation, Inc.
5 * GRUB 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 3 of the License, or
8 * (at your option) any later version.
10 * GRUB 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.
15 * You should have received a copy of the GNU General Public License
16 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef GRUB_LUA_HEADER
20 #define GRUB_LUA_HEADER 1
22 #include <grub/types.h>
23 #include <grub/mm.h>
24 #include <grub/err.h>
25 #include <grub/misc.h>
26 #include <grub/setjmp.h>
28 #define INT_MAX GRUB_LONG_MAX
29 #define UCHAR_MAX 255
30 #define SHRT_MAX 32767
32 #undef UNUSED
33 #define UNUSED (void)
35 #define memcpy grub_memcpy
36 #define memcmp grub_memcmp
37 #define strcpy grub_strcpy
38 #define strstr grub_strstr
39 #define strchr grub_strchr
40 #define strlen grub_strlen
41 #define strtoul grub_strtoul
42 #define strtod(s,e) grub_strtoul(s,e,0)
43 #define sprintf grub_sprintf
44 #define strncpy grub_strncpy
45 #define strcat grub_strcat
46 #define strncat grub_strncat
47 #define strcoll grub_strcmp
48 #define strcmp grub_strcmp
49 #define tolower grub_tolower
50 #define toupper grub_toupper
52 #define malloc grub_malloc
53 #define realloc grub_realloc
54 #define free grub_free
56 #define exit(a) grub_exit()
57 #define jmp_buf grub_jmp_buf
58 #define setjmp grub_setjmp
59 #define longjmp grub_longjmp
61 #define fputs(s,f) grub_printf("%s", s)
63 #define isdigit grub_isdigit
64 #define isalpha grub_isalpha
65 #define isspace grub_isspace
67 static inline int
68 isalnum (int c)
70 return (isalpha (c) || isdigit (c));
73 static inline int
74 iscntrl (int c)
76 return ((c <= 0x1f) || (c == 0x7f));
79 static inline int
80 isupper (int c)
82 return ((c >= 'A') && (c <= 'Z'));
85 static inline int
86 islower (int c)
88 return ((c >= 'a') && (c <= 'z'));
91 static inline int
92 ispunct (int c)
94 return ((! isspace (c)) && (! isalnum (c)));
97 static inline int
98 isxdigit (int c)
100 return (isdigit (c) || ((c >= 'a') && (c <= 'f')) ||
101 ((c >= 'A') && (c <= 'F')));
104 static inline int
105 abs (int c)
107 return (c >= 0) ? : -c;
110 int strcspn (const char *s1, const char *s2);
111 char *strpbrk (const char *s1, const char *s2);
112 void *memchr (const void *s, int c, size_t n);
114 #endif