aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin
diff options
context:
space:
mode:
authorcvs2svn <>2003-05-09 21:27:41 +0000
committercvs2svn <>2003-05-09 21:27:41 +0000
commit787b2ec525939a189219e2f2baf5a5ffd35ed1ba (patch)
tree3c0b527b5dea27b08d1902ddc8bf6ecbbcb43e09 /winsup/cygwin
parent80e499142eadc8f872b1e3c191622a697976e600 (diff)
downloadnewlib-787b2ec525939a189219e2f2baf5a5ffd35ed1ba.zip
newlib-787b2ec525939a189219e2f2baf5a5ffd35ed1ba.tar.gz
newlib-787b2ec525939a189219e2f2baf5a5ffd35ed1ba.tar.bz2
This commit was manufactured by cvs2svn to create branch 'cgf-dev-branch'.
Cherrypick from master 2003-05-09 21:27:40 UTC Corinna Vinschen <corinna@vinschen.de> ' * include/cygwin/config.h: New file.': winsup/cygwin/cpuid.h winsup/cygwin/include/cygwin/config.h winsup/cygwin/include/inttypes.h winsup/cygwin/include/stdint.h
Diffstat (limited to 'winsup/cygwin')
-rw-r--r--winsup/cygwin/cpuid.h35
-rw-r--r--winsup/cygwin/include/cygwin/config.h39
-rw-r--r--winsup/cygwin/include/inttypes.h246
-rw-r--r--winsup/cygwin/include/stdint.h182
4 files changed, 502 insertions, 0 deletions
diff --git a/winsup/cygwin/cpuid.h b/winsup/cygwin/cpuid.h
new file mode 100644
index 0000000..1f0cc50
--- /dev/null
+++ b/winsup/cygwin/cpuid.h
@@ -0,0 +1,35 @@
+#ifndef CPUID_H
+#define CPUID_H
+
+extern inline void
+cpuid (unsigned *a, unsigned *b, unsigned *c, unsigned *d, unsigned in)
+{
+ asm ("cpuid"
+ : "=a" (*a),
+ "=b" (*b),
+ "=c" (*c),
+ "=d" (*d)
+ : "a" (in));
+}
+
+extern inline bool
+can_set_flag (unsigned flag)
+{
+ unsigned r1, r2;
+ asm("pushfl\n"
+ "popl %0\n"
+ "movl %0, %1\n"
+ "xorl %2, %0\n"
+ "pushl %0\n"
+ "popfl\n"
+ "pushfl\n"
+ "popl %0\n"
+ "pushl %1\n"
+ "popfl\n"
+ : "=&r" (r1), "=&r" (r2)
+ : "ir" (flag)
+ );
+ return ((r1 ^ r2) & flag) != 0;
+}
+
+#endif // !CPUID_H
diff --git a/winsup/cygwin/include/cygwin/config.h b/winsup/cygwin/include/cygwin/config.h
new file mode 100644
index 0000000..4bafa3c
--- /dev/null
+++ b/winsup/cygwin/include/cygwin/config.h
@@ -0,0 +1,39 @@
+/* cygwin/config.h header file for Cygwin.
+
+ This wraps Cygwin configuration setting which were in newlib's
+ sys/config.h before. THis way we can manaage our configuration
+ setting without bothering newlib.
+
+ Copyright 2003 Red Hat, Inc.
+ Written by C. Vinschen.
+
+This file is part of Cygwin.
+
+This software is a copyrighted work licensed under the terms of the
+Cygwin license. Please consult the file "CYGWIN_LICENSE" for
+details. */
+
+#ifndef _CYGWIN_CONFIG_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+#define _CYGWIN_CONFIG_H
+
+#define __FILENAME_MAX__ (260 - 1 /* NUL */)
+#define _READ_WRITE_RETURN_TYPE _ssize_t
+#define __LARGE64_FILES 1
+#define __CYGWIN_USE_BIG_TYPES__ 1
+#if defined(__INSIDE_CYGWIN__) || defined(_COMPILING_NEWLIB)
+#define __IMPORT
+#else
+#define __IMPORT __declspec(dllimport)
+#endif
+
+#ifndef __WCHAR_MAX__
+#define __WCHAR_MAX__ 0xffffu
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _CYGWIN_CONFIG_H */
diff --git a/winsup/cygwin/include/inttypes.h b/winsup/cygwin/include/inttypes.h
new file mode 100644
index 0000000..1d0410a
--- /dev/null
+++ b/winsup/cygwin/include/inttypes.h
@@ -0,0 +1,246 @@
+/* inttypes.h - fixed size integer types
+
+ Copyright 2003 Red Hat, Inc.
+
+This file is part of Cygwin.
+
+This software is a copyrighted work licensed under the terms of the
+Cygwin license. Please consult the file "CYGWIN_LICENSE" for
+details. */
+
+#ifndef _INTTYPES_H
+#define _INTTYPES_H
+
+#include <stdint.h>
+
+/* fprintf() macros for signed integers */
+
+#define PRId8 "d"
+#define PRId16 "d"
+#define PRId32 "ld"
+#define PRId64 "lld"
+
+#define PRIdLEAST8 "d"
+#define PRIdLEAST16 "d"
+#define PRIdLEAST32 "ld"
+#define PRIdLEAST64 "lld"
+
+#define PRIdFAST8 "d"
+#define PRIdFAST16 "ld"
+#define PRIdFAST32 "ld"
+#define PRIdFAST64 "lld"
+
+#define PRIdMAX "lld"
+#define PRIdPTR "ld"
+
+#define PRIi8 "i"
+#define PRIi16 "i"
+#define PRIi32 "li"
+#define PRIi64 "lli"
+
+#define PRIiLEAST8 "i"
+#define PRIiLEAST16 "i"
+#define PRIiLEAST32 "li"
+#define PRIiLEAST64 "lli"
+
+#define PRIiFAST8 "i"
+#define PRIiFAST16 "li"
+#define PRIiFAST32 "li"
+#define PRIiFAST64 "lli"
+
+#define PRIiMAX "lli"
+#define PRIiPTR "li"
+
+/* fprintf() macros for unsigned integers */
+
+#define PRIo8 "o"
+#define PRIo16 "o"
+#define PRIo32 "lo"
+#define PRIo64 "llo"
+
+#define PRIoLEAST8 "o"
+#define PRIoLEAST16 "o"
+#define PRIoLEAST32 "lo"
+#define PRIoLEAST64 "llo"
+
+#define PRIoFAST8 "o"
+#define PRIoFAST16 "lo"
+#define PRIoFAST32 "lo"
+#define PRIoFAST64 "llo"
+
+#define PRIoMAX "llo"
+#define PRIoPTR "lo"
+
+#define PRIu8 "u"
+#define PRIu16 "u"
+#define PRIu32 "lu"
+#define PRIu64 "llu"
+
+#define PRIuLEAST8 "u"
+#define PRIuLEAST16 "u"
+#define PRIuLEAST32 "lu"
+#define PRIuLEAST64 "llu"
+
+#define PRIuFAST8 "u"
+#define PRIuFAST16 "lu"
+#define PRIuFAST32 "lu"
+#define PRIuFAST64 "llu"
+
+#define PRIuMAX "llu"
+#define PRIuPTR "lu"
+
+#define PRIx8 "x"
+#define PRIx16 "x"
+#define PRIx32 "lx"
+#define PRIx64 "llx"
+
+#define PRIxLEAST8 "x"
+#define PRIxLEAST16 "x"
+#define PRIxLEAST32 "lx"
+#define PRIxLEAST64 "llx"
+
+#define PRIxFAST8 "x"
+#define PRIxFAST16 "lx"
+#define PRIxFAST32 "lx"
+#define PRIxFAST64 "llx"
+
+#define PRIxMAX "llx"
+#define PRIxPTR "lx"
+
+#define PRIX8 "X"
+#define PRIX16 "X"
+#define PRIX32 "lX"
+#define PRIX64 "llX"
+
+#define PRIXLEAST8 "X"
+#define PRIXLEAST16 "X"
+#define PRIXLEAST32 "lX"
+#define PRIXLEAST64 "llX"
+
+#define PRIXFAST8 "X"
+#define PRIXFAST16 "lX"
+#define PRIXFAST32 "lX"
+#define PRIXFAST64 "llX"
+
+#define PRIXMAX "llX"
+#define PRIXPTR "lX"
+
+/* fscanf() macros for signed integers */
+
+#define SCNd8 "hhd"
+#define SCNd16 "hd"
+#define SCNd32 "ld"
+#define SCNd64 "lld"
+
+#define SCNdLEAST8 "hhd"
+#define SCNdLEAST16 "hd"
+#define SCNdLEAST32 "ld"
+#define SCNdLEAST64 "lld"
+
+#define SCNdFAST8 "hhd"
+#define SCNdFAST16 "ld"
+#define SCNdFAST32 "ld"
+#define SCNdFAST64 "lld"
+
+#define SCNdMAX "lld"
+#define SCNdPTR "ld"
+
+#define SCNi8 "hhi"
+#define SCNi16 "hi"
+#define SCNi32 "li"
+#define SCNi64 "lli"
+
+#define SCNiLEAST8 "hhi"
+#define SCNiLEAST16 "hi"
+#define SCNiLEAST32 "li"
+#define SCNiLEAST64 "lli"
+
+#define SCNiFAST8 "hhi"
+#define SCNiFAST16 "li"
+#define SCNiFAST32 "li"
+#define SCNiFAST64 "lli"
+
+#define SCNiMAX "lli"
+#define SCNiPTR "li"
+
+/* fscanf() macros for unsigned integers */
+
+#define SCNo8 "hho"
+#define SCNo16 "ho"
+#define SCNo32 "lo"
+#define SCNo64 "llo"
+
+#define SCNoLEAST8 "hho"
+#define SCNoLEAST16 "ho"
+#define SCNoLEAST32 "lo"
+#define SCNoLEAST64 "llo"
+
+#define SCNoFAST8 "hho"
+#define SCNoFAST16 "lo"
+#define SCNoFAST32 "lo"
+#define SCNoFAST64 "llo"
+
+#define SCNoMAX "llo"
+#define SCNoPTR "lo"
+
+#define SCNu8 "hhu"
+#define SCNu16 "hu"
+#define SCNu32 "lu"
+#define SCNu64 "llu"
+
+#define SCNuLEAST8 "hhu"
+#define SCNuLEAST16 "hu"
+#define SCNuLEAST32 "lu"
+#define SCNuLEAST64 "llu"
+
+#define SCNuFAST8 "hhu"
+#define SCNuFAST16 "lu"
+#define SCNuFAST32 "lu"
+#define SCNuFAST64 "llu"
+
+#define SCNuMAX "llu"
+#define SCNuPTR "lu"
+
+#define SCNx8 "hhx"
+#define SCNx16 "hx"
+#define SCNx32 "lx"
+#define SCNx64 "llx"
+
+#define SCNxLEAST8 "hhx"
+#define SCNxLEAST16 "hx"
+#define SCNxLEAST32 "lx"
+#define SCNxLEAST64 "llx"
+
+#define SCNxFAST8 "hhx"
+#define SCNxFAST16 "lx"
+#define SCNxFAST32 "lx"
+#define SCNxFAST64 "llx"
+
+#define SCNxMAX "llx"
+#define SCNxPTR "lx"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <_ansi.h>
+
+typedef struct {
+ intmax_t quot;
+ intmax_t rem;
+} imaxdiv_t;
+
+#if 0 /* Not yet defined */
+intmax_t _EXFUN(imaxabs, (intmax_t));
+imaxdiv_t _EXFUN(imaxdiv, (intmax_t, intmax_t));
+intmax_t _EXFUN(strtoimax, (const char *, char **, int));
+uintmax_t _EXFUN(strtoumax, (const char *, char **, int));
+intmax_t _EXFUN(wcstoimax, (const wchar_t *, wchar_t **, int));
+uintmax_t _EXFUN(wcstoumax, (const wchar_t *, wchar_t **, int));
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _INTTYPES_H */
diff --git a/winsup/cygwin/include/stdint.h b/winsup/cygwin/include/stdint.h
new file mode 100644
index 0000000..66fd49d
--- /dev/null
+++ b/winsup/cygwin/include/stdint.h
@@ -0,0 +1,182 @@
+/* stdint.h - integer types
+
+ Copyright 2003 Red Hat, Inc.
+
+This file is part of Cygwin.
+
+This software is a copyrighted work licensed under the terms of the
+Cygwin license. Please consult the file "CYGWIN_LICENSE" for
+details. */
+
+#ifndef _STDINT_H
+#define _STDINT_H
+
+/* Exact-width integer types */
+
+#ifndef __int8_t_defined
+#define __int8_t_defined
+typedef signed char int8_t;
+typedef short int16_t;
+typedef long int32_t;
+typedef long long int64_t;
+#endif
+
+typedef unsigned char uint8_t;
+typedef unsigned short uint16_t;
+#ifndef __uint32_t_defined
+#define __uint32_t_defined
+typedef unsigned long uint32_t;
+#endif
+typedef unsigned long long uint64_t;
+
+/* Minimum-width integer types */
+
+typedef signed char int_least8_t;
+typedef short int_least16_t;
+typedef long int_least32_t;
+typedef long long int_least64_t;
+
+typedef unsigned char uint_least8_t;
+typedef unsigned short uint_least16_t;
+typedef unsigned long uint_least32_t;
+typedef unsigned long long uint_least64_t;
+
+/* Fastest minimum-width integer types */
+
+typedef signed char int_fast8_t;
+typedef long int_fast16_t;
+typedef long int_fast32_t;
+typedef long long int_fast64_t;
+
+typedef unsigned char uint_fast8_t;
+typedef unsigned long uint_fast16_t;
+typedef unsigned long uint_fast32_t;
+typedef unsigned long long uint_fast64_t;
+
+/* Integer types capable of holding object pointers */
+
+#ifndef __intptr_t_defined
+#define __intptr_t_defined
+typedef long intptr_t;
+#endif
+typedef unsigned long uintptr_t;
+
+/* Greatest-width integer types */
+
+typedef long long intmax_t;
+typedef unsigned long long uintmax_t;
+
+/* Limits of exact-width integer types */
+
+#define INT8_MIN (-128)
+#define INT16_MIN (-32768)
+#define INT32_MIN (-2147483648)
+#define INT64_MIN (-9223372036854775808)
+
+#define INT8_MAX (127)
+#define INT16_MAX (32767)
+#define INT32_MAX (2147483647)
+#define INT64_MAX (9223372036854775807)
+
+#define UINT8_MAX (255)
+#define UINT16_MAX (65535)
+#define UINT32_MAX (4294967295UL)
+#define UINT64_MAX (18446744073709551615ULL)
+
+/* Limits of minimum-width integer types */
+
+#define INT_LEAST8_MIN (-128)
+#define INT_LEAST16_MIN (-32768)
+#define INT_LEAST32_MIN (-2147483648)
+#define INT_LEAST64_MIN (-9223372036854775808)
+
+#define INT_LEAST8_MAX (127)
+#define INT_LEAST16_MAX (32767)
+#define INT_LEAST32_MAX (2147483647)
+#define INT_LEAST64_MAX (9223372036854775807)
+
+#define UINT_LEAST8_MAX (255)
+#define UINT_LEAST16_MAX (65535)
+#define UINT_LEAST32_MAX (4294967295UL)
+#define UINT_LEAST64_MAX (18446744073709551615ULL)
+
+/* Limits of fastest minimum-width integer types */
+
+#define INT_FAST8_MIN (-128)
+#define INT_FAST16_MIN (-2147483648)
+#define INT_FAST32_MIN (-2147483648)
+#define INT_FAST64_MIN (-9223372036854775808)
+
+#define INT_FAST8_MAX (127)
+#define INT_FAST16_MAX (2147483647)
+#define INT_FAST32_MAX (2147483647)
+#define INT_FAST64_MAX (9223372036854775807)
+
+#define UINT_FAST8_MAX (255)
+#define UINT_FAST16_MAX (4294967295UL)
+#define UINT_FAST32_MAX (4294967295UL)
+#define UINT_FAST64_MAX (18446744073709551615ULL)
+
+/* Limits of integer types capable of holding object pointers */
+
+#define INTPTR_MIN (-2147483648)
+#define INTPTR_MAX (2147483647)
+#define UINTPTR_MAX (4294967295UL)
+
+/* Limits of greatest-width integer types */
+
+#define INTMAX_MIN (-9223372036854775808)
+#define INTMAX_MAX (9223372036854775807)
+#define UINTMAX_MAX (18446744073709551615ULL)
+
+/* Limits of other integer types */
+
+#ifndef PTRDIFF_MIN
+#define PTRDIFF_MIN (-2147483648)
+#define PTRDIFF_MAX (2147483647)
+#endif
+
+#ifndef SIG_ATOMIC_MIN
+#define SIG_ATOMIC_MIN (-2147483648)
+#endif
+#ifndef SIG_ATOMIC_MAX
+#define SIG_ATOMIC_MAX (2147483647)
+#endif
+
+#ifndef SIZE_MAX
+#define SIZE_MAX (4294967295UL)
+#endif
+
+#ifndef WCHAR_MIN
+#ifdef __WCHAR_MIN__
+#define WCHAR_MIN __WCHAR_MIN__
+#define WCHAR_MAX __WCHAR_MAX__
+#else
+#define WCHAR_MIN (0)
+#define WCHAR_MAX (65535)
+#endif
+#endif
+
+#ifndef WINT_MIN
+#define WINT_MIN (-2147483648)
+#define WINT_MAX (2147483647)
+#endif
+
+/* Macros for minimum-width integer constant expressions */
+
+#define INT8_C(x) x
+#define INT16_C(x) x
+#define INT32_C(x) x ## L
+#define INT64_C(x) x ## LL
+
+#define UINT8_C(x) x ## U
+#define UINT16_C(x) x ## U
+#define UINT32_C(x) x ## UL
+#define UINT64_C(x) x ## ULL
+
+/* Macros for greatest-width integer constant expressions */
+
+#define INTMAX_C(x) x ## L
+#define UINTMAX_C(x) x ## UL
+
+#endif /* _STDINT_H */