From 041d1ea37802bf7178a31a53f96c26efa6b8fb7b Mon Sep 17 00:00:00 2001 From: James Date: Fri, 16 Nov 2012 10:41:01 +0000 Subject: fish --- grub-core/lib/posix_wrap/assert.h | 33 ++++++++++ grub-core/lib/posix_wrap/ctype.h | 103 ++++++++++++++++++++++++++++++++ grub-core/lib/posix_wrap/errno.h | 28 +++++++++ grub-core/lib/posix_wrap/inttypes.h | 1 + grub-core/lib/posix_wrap/langinfo.h | 38 ++++++++++++ grub-core/lib/posix_wrap/limits.h | 0 grub-core/lib/posix_wrap/localcharset.h | 28 +++++++++ grub-core/lib/posix_wrap/locale.h | 0 grub-core/lib/posix_wrap/stdint.h | 1 + grub-core/lib/posix_wrap/stdio.h | 29 +++++++++ grub-core/lib/posix_wrap/stdlib.h | 57 ++++++++++++++++++ grub-core/lib/posix_wrap/string.h | 42 +++++++++++++ grub-core/lib/posix_wrap/sys/types.h | 46 ++++++++++++++ grub-core/lib/posix_wrap/unistd.h | 0 grub-core/lib/posix_wrap/wchar.h | 25 ++++++++ grub-core/lib/posix_wrap/wctype.h | 0 16 files changed, 431 insertions(+) create mode 100644 grub-core/lib/posix_wrap/assert.h create mode 100644 grub-core/lib/posix_wrap/ctype.h create mode 100644 grub-core/lib/posix_wrap/errno.h create mode 100644 grub-core/lib/posix_wrap/inttypes.h create mode 100644 grub-core/lib/posix_wrap/langinfo.h create mode 100644 grub-core/lib/posix_wrap/limits.h create mode 100644 grub-core/lib/posix_wrap/localcharset.h create mode 100644 grub-core/lib/posix_wrap/locale.h create mode 100644 grub-core/lib/posix_wrap/stdint.h create mode 100644 grub-core/lib/posix_wrap/stdio.h create mode 100644 grub-core/lib/posix_wrap/stdlib.h create mode 100644 grub-core/lib/posix_wrap/string.h create mode 100644 grub-core/lib/posix_wrap/sys/types.h create mode 100644 grub-core/lib/posix_wrap/unistd.h create mode 100644 grub-core/lib/posix_wrap/wchar.h create mode 100644 grub-core/lib/posix_wrap/wctype.h (limited to 'grub-core/lib/posix_wrap') diff --git a/grub-core/lib/posix_wrap/assert.h b/grub-core/lib/posix_wrap/assert.h new file mode 100644 index 0000000..94cfdd5 --- /dev/null +++ b/grub-core/lib/posix_wrap/assert.h @@ -0,0 +1,33 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2009, 2010 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +#ifndef GRUB_POSIX_ASSERT_H +#define GRUB_POSIX_ASSERT_H 1 + +#include + +#define assert(x) assert_real(__FILE__, __LINE__, x) + +static inline void +assert_real (const char *file, int line, int cond) +{ + if (!cond) + grub_fatal ("Assertion failed at %s:%d\n", file, line); +} + +#endif diff --git a/grub-core/lib/posix_wrap/ctype.h b/grub-core/lib/posix_wrap/ctype.h new file mode 100644 index 0000000..2dc3e53 --- /dev/null +++ b/grub-core/lib/posix_wrap/ctype.h @@ -0,0 +1,103 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2009, 2010 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +#ifndef GRUB_POSIX_CTYPE_H +#define GRUB_POSIX_CTYPE_H 1 + +#include + +static inline int +toupper (int c) +{ + return grub_toupper (c); +} + +static inline int +isspace (int c) +{ + return grub_isspace (c); +} + +static inline int +isdigit (int c) +{ + return grub_isdigit (c); +} + +static inline int +islower (int c) +{ + return (c >= 'a' && c <= 'z'); +} + +static inline int +isupper (int c) +{ + return (c >= 'A' && c <= 'Z'); +} + +static inline int +isxdigit (int c) +{ + return (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F') + || (c >= '0' && c <= '9'); +} + +static inline int +isprint (int c) +{ + return grub_isprint (c); +} + +static inline int +iscntrl (int c) +{ + return !grub_isprint (c); +} + +static inline int +isgraph (int c) +{ + return grub_isprint (c) && !grub_isspace (c); +} + +static inline int +isalnum (int c) +{ + return grub_isalpha (c) || grub_isdigit (c); +} + +static inline int +ispunct (int c) +{ + return grub_isprint (c) && !grub_isspace (c) && !isalnum (c); +} + +static inline int +isalpha (int c) +{ + return grub_isalpha (c); +} + +static inline int +tolower (int c) +{ + return grub_tolower (c); +} + +#endif diff --git a/grub-core/lib/posix_wrap/errno.h b/grub-core/lib/posix_wrap/errno.h new file mode 100644 index 0000000..9031722 --- /dev/null +++ b/grub-core/lib/posix_wrap/errno.h @@ -0,0 +1,28 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2009, 2010 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +#ifndef GRUB_POSIX_ERRNO_H +#define GRUB_POSIX_ERRNO_H 1 + +#include + +#define errno grub_errno +#define EINVAL GRUB_ERR_BAD_NUMBER +#define ENOMEM GRUB_ERR_OUT_OF_MEMORY + +#endif diff --git a/grub-core/lib/posix_wrap/inttypes.h b/grub-core/lib/posix_wrap/inttypes.h new file mode 100644 index 0000000..a12c43b --- /dev/null +++ b/grub-core/lib/posix_wrap/inttypes.h @@ -0,0 +1 @@ +#include diff --git a/grub-core/lib/posix_wrap/langinfo.h b/grub-core/lib/posix_wrap/langinfo.h new file mode 100644 index 0000000..72b5b96 --- /dev/null +++ b/grub-core/lib/posix_wrap/langinfo.h @@ -0,0 +1,38 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2009, 2010 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +#ifndef GRUB_POSIX_LANGINFO_H +#define GRUB_POSIX_LANGINFO_H 1 + +#include + +typedef enum { CODESET } nl_item; + +static inline char * +nl_langinfo (nl_item item) +{ + switch (item) + { + case CODESET: + return "UTF-8"; + default: + return ""; + } +} + +#endif diff --git a/grub-core/lib/posix_wrap/limits.h b/grub-core/lib/posix_wrap/limits.h new file mode 100644 index 0000000..e69de29 diff --git a/grub-core/lib/posix_wrap/localcharset.h b/grub-core/lib/posix_wrap/localcharset.h new file mode 100644 index 0000000..502d860 --- /dev/null +++ b/grub-core/lib/posix_wrap/localcharset.h @@ -0,0 +1,28 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2009, 2010 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +#ifndef GRUB_POSIX_LOCALCHARSET_H +#define GRUB_POSIX_LOCALCHARSET_H 1 + +static inline const char * +locale_charset (void) +{ + return "UTF-8"; +} + +#endif diff --git a/grub-core/lib/posix_wrap/locale.h b/grub-core/lib/posix_wrap/locale.h new file mode 100644 index 0000000..e69de29 diff --git a/grub-core/lib/posix_wrap/stdint.h b/grub-core/lib/posix_wrap/stdint.h new file mode 100644 index 0000000..a12c43b --- /dev/null +++ b/grub-core/lib/posix_wrap/stdint.h @@ -0,0 +1 @@ +#include diff --git a/grub-core/lib/posix_wrap/stdio.h b/grub-core/lib/posix_wrap/stdio.h new file mode 100644 index 0000000..701fcea --- /dev/null +++ b/grub-core/lib/posix_wrap/stdio.h @@ -0,0 +1,29 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2009, 2010 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +#ifndef GRUB_POSIX_STDIO_H +#define GRUB_POSIX_STDIO_H 1 + +#include +#include + +typedef struct grub_file FILE; + +#define EOF -1 + +#endif diff --git a/grub-core/lib/posix_wrap/stdlib.h b/grub-core/lib/posix_wrap/stdlib.h new file mode 100644 index 0000000..4c725f6 --- /dev/null +++ b/grub-core/lib/posix_wrap/stdlib.h @@ -0,0 +1,57 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2009, 2010 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +#ifndef GRUB_POSIX_STDLIB_H +#define GRUB_POSIX_STDLIB_H 1 + +#include +#include + +static inline void +free (void *ptr) +{ + grub_free (ptr); +} + +static inline void * +malloc (grub_size_t size) +{ + return grub_malloc (size); +} + +static inline void * +calloc (grub_size_t size, grub_size_t nelem) +{ + return grub_zalloc (size * nelem); +} + +static inline void * +realloc (void *ptr, grub_size_t size) +{ + return grub_realloc (ptr, size); +} + +static inline void +abort (void) +{ + grub_abort (); +} + +#define MB_CUR_MAX 6 + +#endif diff --git a/grub-core/lib/posix_wrap/string.h b/grub-core/lib/posix_wrap/string.h new file mode 100644 index 0000000..4224836 --- /dev/null +++ b/grub-core/lib/posix_wrap/string.h @@ -0,0 +1,42 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2009, 2010 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +#ifndef GRUB_POSIX_STRING_H +#define GRUB_POSIX_STRING_H 1 + +#include + +static inline grub_size_t +strlen (const char *s) +{ + return grub_strlen (s); +} + +static inline int +strcmp (const char *s1, const char *s2) +{ + return grub_strcmp (s1, s2); +} + +static inline int +strcasecmp (const char *s1, const char *s2) +{ + return grub_strcasecmp (s1, s2); +} + +#endif diff --git a/grub-core/lib/posix_wrap/sys/types.h b/grub-core/lib/posix_wrap/sys/types.h new file mode 100644 index 0000000..69e4950 --- /dev/null +++ b/grub-core/lib/posix_wrap/sys/types.h @@ -0,0 +1,46 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2009, 2010 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +#ifndef GRUB_POSIX_SYS_TYPES_H +#define GRUB_POSIX_SYS_TYPES_H 1 + +#include + +typedef grub_size_t size_t; +typedef enum { false = 0, true = 1 } bool; + +#define ULONG_MAX GRUB_ULONG_MAX +#define UCHAR_MAX 0xff + +typedef grub_uint8_t uint8_t; +typedef grub_uint16_t uint16_t; +typedef grub_uint32_t uint32_t; +typedef grub_uint64_t uint64_t; + +typedef grub_int8_t int8_t; +typedef grub_int16_t int16_t; +typedef grub_int32_t int32_t; +typedef grub_int64_t int64_t; + +#ifdef GRUB_CPU_WORDS_BIGENDIAN +#define WORDS_BIGENDIAN +#else +#undef WORDS_BIGENDIAN +#endif + +#endif diff --git a/grub-core/lib/posix_wrap/unistd.h b/grub-core/lib/posix_wrap/unistd.h new file mode 100644 index 0000000..e69de29 diff --git a/grub-core/lib/posix_wrap/wchar.h b/grub-core/lib/posix_wrap/wchar.h new file mode 100644 index 0000000..fd56fd3 --- /dev/null +++ b/grub-core/lib/posix_wrap/wchar.h @@ -0,0 +1,25 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2009, 2010 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +#ifndef GRUB_POSIX_WCHAR_H +#define GRUB_POSIX_WCHAR_H 1 + +/* UCS-4. */ +typedef grub_uint32_t wchar_t; + +#endif diff --git a/grub-core/lib/posix_wrap/wctype.h b/grub-core/lib/posix_wrap/wctype.h new file mode 100644 index 0000000..e69de29 -- cgit v1.2.3