]> pd.if.org Git - pdclib/commitdiff
Initial pass at a port to win32
authorOwen Shepherd <owen.shepherd@e43.eu>
Mon, 13 Aug 2012 20:14:14 +0000 (21:14 +0100)
committerOwen Shepherd <owen.shepherd@e43.eu>
Mon, 13 Aug 2012 20:14:14 +0000 (21:14 +0100)
24 files changed:
platform/win32/Config.jam [new file with mode: 0644]
platform/win32/Jamfile [new file with mode: 0644]
platform/win32/Readme.txt [new file with mode: 0644]
platform/win32/crt0.c [new file with mode: 0644]
platform/win32/functions/_PDCLIB/_PDCLIB_Exit.c [new file with mode: 0644]
platform/win32/functions/_PDCLIB/_PDCLIB_allocpages.c [new file with mode: 0644]
platform/win32/functions/_PDCLIB/_PDCLIB_close.c [new file with mode: 0644]
platform/win32/functions/_PDCLIB/_PDCLIB_fillbuffer.c [new file with mode: 0644]
platform/win32/functions/_PDCLIB/_PDCLIB_flushbuffer.c [new file with mode: 0644]
platform/win32/functions/_PDCLIB/_PDCLIB_freepages.c [new file with mode: 0644]
platform/win32/functions/_PDCLIB/_PDCLIB_open.c [new file with mode: 0644]
platform/win32/functions/_PDCLIB/_PDCLIB_rename.c [new file with mode: 0644]
platform/win32/functions/_PDCLIB/_PDCLIB_seek.c [new file with mode: 0644]
platform/win32/functions/_PDCLIB/_PDCLIB_stdinit.c [new file with mode: 0644]
platform/win32/functions/_PDCLIB/_PDCLIB_w32errno.c [new file with mode: 0644]
platform/win32/functions/signal/raise.c [new file with mode: 0644]
platform/win32/functions/signal/signal.c [new file with mode: 0644]
platform/win32/functions/stdio/remove.c [new file with mode: 0644]
platform/win32/functions/stdio/tmpfile.c [new file with mode: 0644]
platform/win32/functions/stdlib/getenv.c [new file with mode: 0644]
platform/win32/functions/stdlib/system.c [new file with mode: 0644]
platform/win32/includes/float.h [new file with mode: 0644]
platform/win32/includes/signal.h [new file with mode: 0644]
platform/win32/internals/_PDCLIB_config.h [new file with mode: 0644]

diff --git a/platform/win32/Config.jam b/platform/win32/Config.jam
new file mode 100644 (file)
index 0000000..c02174f
--- /dev/null
@@ -0,0 +1,12 @@
+rule PDCLibTargetConfig { }\r
+rule PDCLibTargetHeaders {\r
+    SubDirHdrs $(PDCLIB_TOP) platform win32 includes ;\r
+    SubDirHdrs $(PDCLIB_TOP) platform win32 internals ;\r
+}\r
+\r
+PDCLIB_TEST_LINKFLAGS += -nostdlib ;\r
+PDCLIB_TEST_LINKLIBS += -lgcc -lkernel32 -lshell32 ;\r
+\r
+PDCLIB_OPTIONS = nothread notime dlmalloc ;\r
+\r
+CRT0 = [ FDirName platform win32 crt0$(SUFOBJ) ] ;
\ No newline at end of file
diff --git a/platform/win32/Jamfile b/platform/win32/Jamfile
new file mode 100644 (file)
index 0000000..35b8dea
--- /dev/null
@@ -0,0 +1,6 @@
+SubDir PDCLIB_TOP platform win32 ;\r
+PDCLibConfig ;\r
+\r
+Object $(CRT0) : $(CRT0:S=.c) ;\r
+\r
+DEPENDS all : $(CRT0) ;
\ No newline at end of file
diff --git a/platform/win32/Readme.txt b/platform/win32/Readme.txt
new file mode 100644 (file)
index 0000000..5ec24bd
--- /dev/null
@@ -0,0 +1,24 @@
+$Id$
+
+"Example" Platform Overlay
+==========================
+
+This is an example platform overlay, as described in the main Readme.txt of
+this archive. For ease of development, it applies (and tests) correctly on the
+machine of the author; no other guarantees can be given.
+It should give you a good idea of what is REQUIRED to make a copy of PDCLib
+work. There is a lot more you could do, and even some things you SHOULD do, in
+order to experience anything but abysmal performance:
+
+- Read / write operations on binary streams, and even on text streams for
+  machines that do not do any text conversion, can be made much more efficient
+  by using some sort of page buffer instead of the linear buffer implemented
+  here. It requires some special and platform-dependent manipulations, though,
+  which is why it is not done by default.
+
+- Anything relating to floating point logic is written in generic C. While
+  this is (hopefully) highly portable and should get you started on your
+  platform of choice, it is also highly inefficient and should be replaced by
+  inline assembly. Just make sure that your assembly keeps all the promises
+  the C library makes.
+
diff --git a/platform/win32/crt0.c b/platform/win32/crt0.c
new file mode 100644 (file)
index 0000000..fcdee08
--- /dev/null
@@ -0,0 +1,57 @@
+#include <windows.h>\r
+#include <string.h>\r
+#include <stdlib.h>\r
+#include <stdio.h>\r
+\r
+static char ** argvToAnsi( wchar_t ** wargv, int argc )\r
+{\r
+    char ** argv = malloc( sizeof( *argv ) * argc );\r
+    for ( int i = 0; i != argc; ++i ) {\r
+        int sz = WideCharToMultiByte( CP_ACP, WC_COMPOSITECHECK | WC_SEPCHARS,\r
+                                      wargv[i], -1, NULL, 0, NULL, NULL );\r
+        if(!(argv[i] = malloc(sz))) {\r
+            fputs("Error in C runtime initialization: "\r
+                  "unable to allocate buffer for argument", stderr);\r
+            abort();\r
+        }\r
+\r
+        int rv = WideCharToMultiByte( CP_ACP, WC_COMPOSITECHECK | WC_SEPCHARS,\r
+                                      wargv[i], -1, argv[i], sz, NULL, NULL );\r
+\r
+        if(rv != sz) {\r
+            fputs("Error in C runtime initialization: "\r
+                  "size mismatch during character set conversion", stderr);\r
+        }\r
+    }\r
+    return argv;\r
+}\r
+\r
+static int        argc;\r
+static wchar_t *  cl;\r
+static wchar_t ** wargv;\r
+static char    ** argv;\r
+\r
+static void freeArgs( void )\r
+{\r
+    for(int i = 0; i != argc; i++) {\r
+        free( argv[i] );\r
+    }\r
+    free( argv );\r
+    LocalFree( wargv );\r
+}\r
+\r
+extern int main( int argc, char ** argv, char ** envp );\r
+_PDCLIB_noreturn void mainCRTStartup( void ) \r
+{\r
+    stdin->handle  = GetStdHandle(STD_INPUT_HANDLE);\r
+    stdout->handle = GetStdHandle(STD_OUTPUT_HANDLE);\r
+    stderr->handle = GetStdHandle(STD_ERROR_HANDLE);\r
+\r
+    cl    = GetCommandLineW();\r
+    wargv = CommandLineToArgvW(cl, &argc);\r
+    argv  = argvToAnsi(wargv, argc);\r
+    atexit(freeArgs);\r
+\r
+    int exitStatus = main(argc, argv, NULL);\r
+    exit(exitStatus);\r
+}\r
diff --git a/platform/win32/functions/_PDCLIB/_PDCLIB_Exit.c b/platform/win32/functions/_PDCLIB/_PDCLIB_Exit.c
new file mode 100644 (file)
index 0000000..fa50a41
--- /dev/null
@@ -0,0 +1,39 @@
+/* $Id$ */
+
+/* _PDCLIB_exit( int )
+
+   This file is part of the Public Domain C Library (PDCLib).
+   Permission is granted to use, modify, and / or redistribute at will.
+*/
+
+/* This is a stub implementation of _PDCLIB_Exit
+*/
+
+#include <stdlib.h>
+
+#ifndef REGTEST
+#include <_PDCLIB_glue.h>
+#include <errno.h>
+#include <windows.h>
+
+void _PDCLIB_Exit( int status )
+{
+    ExitProcess( status );
+}
+
+#endif
+
+#ifdef TEST
+#include <_PDCLIB_test.h>
+
+int main( void )
+{
+#ifndef REGTEST
+    int UNEXPECTED_RETURN = 0;
+    _PDCLIB_Exit( 0 );
+    TESTCASE( UNEXPECTED_RETURN );
+#endif
+    return TEST_RESULTS;
+}
+
+#endif
diff --git a/platform/win32/functions/_PDCLIB/_PDCLIB_allocpages.c b/platform/win32/functions/_PDCLIB/_PDCLIB_allocpages.c
new file mode 100644 (file)
index 0000000..48e4bab
--- /dev/null
@@ -0,0 +1,40 @@
+/* $Id$ */
+
+/* _PDCLIB_allocpages( int const )
+
+   This file is part of the Public Domain C Library (PDCLib).
+   Permission is granted to use, modify, and / or redistribute at will.
+*/
+
+/* This is a stub implementation of _PDCLIB_allocpages
+*/
+
+#ifndef REGTEST
+#include <stdint.h>
+#include <stddef.h>
+#include <_PDCLIB_glue.h>
+#include <errno.h>
+#include <windows.h>
+
+void _PDCLIB_w32errno(void);
+
+void * _PDCLIB_allocpages( size_t n )
+{
+    void * rv = VirtualAlloc(NULL, n * _PDCLIB_MALLOC_PAGESIZE, MEM_COMMIT,
+        PAGE_READWRITE);
+    if(!rv) {
+        _PDCLIB_w32errno();
+    }
+    return rv;
+}
+#endif
+
+#ifdef TEST
+#include <_PDCLIB_test.h>
+
+int main( void )
+{
+    return TEST_RESULTS;
+}
+
+#endif
diff --git a/platform/win32/functions/_PDCLIB/_PDCLIB_close.c b/platform/win32/functions/_PDCLIB/_PDCLIB_close.c
new file mode 100644 (file)
index 0000000..7fc10a3
--- /dev/null
@@ -0,0 +1,39 @@
+/* $Id$ */
+
+/* _PDCLIB_close( _PDCLIB_fd_t fd )
+
+   This file is part of the Public Domain C Library (PDCLib).
+   Permission is granted to use, modify, and / or redistribute at will.
+*/
+
+/* This is a stub example implementation of _PDCLIB_close()
+*/
+
+#include <stdio.h>
+
+#ifndef REGTEST
+#include <_PDCLIB_glue.h>
+#include <errno.h>
+#include <windows.h>
+
+void _PDCLIB_w32errno(void);
+int _PDCLIB_close( HANDLE fd )
+{
+    if(CloseHandle((HANDLE) fd))
+        return 0;
+    _PDCLIB_w32errno();
+    return 1;
+}
+
+#endif
+
+#ifdef TEST
+#include <_PDCLIB_test.h>
+
+int main( void )
+{
+    /* No testdriver; tested in driver for _PDCLIB_open(). */
+    return TEST_RESULTS;
+}
+
+#endif
diff --git a/platform/win32/functions/_PDCLIB/_PDCLIB_fillbuffer.c b/platform/win32/functions/_PDCLIB/_PDCLIB_fillbuffer.c
new file mode 100644 (file)
index 0000000..c6a2b6b
--- /dev/null
@@ -0,0 +1,54 @@
+/* $Id$ */
+
+/* _PDCLIB_fillbuffer( struct _PDCLIB_file_t * stream )
+
+   This file is part of the Public Domain C Library (PDCLib).
+   Permission is granted to use, modify, and / or redistribute at will.
+*/
+
+/* This is a stub version of _PDCLIB_fillbuffer
+*/
+
+#include <stdio.h>
+
+#ifndef REGTEST
+#include <_PDCLIB_glue.h>
+#include <errno.h>
+#include <windows.h>
+
+void _PDCLIB_w32errno(void);
+int _PDCLIB_fillbuffer( struct _PDCLIB_file_t * stream )
+{
+    DWORD nBytesRead;
+    BOOL ok = ReadFile( stream->handle, stream->buffer, stream->bufsize,
+                        &nBytesRead, NULL );
+
+    if( ok ) {
+        if( nBytesRead == 0 ) {
+            stream->status |= _PDCLIB_EOFFLAG;
+            return EOF;
+        }
+        stream->pos.offset += nBytesRead;
+        stream->bufend = nBytesRead;
+        stream->bufidx = 0;
+        return 0;
+    } else {
+        _PDCLIB_w32errno();
+        stream->status |= _PDCLIB_ERRORFLAG;
+        return EOF;
+    }
+}
+
+#endif
+
+#ifdef TEST
+#include <_PDCLIB_test.h>
+
+int main( void )
+{
+    /* Testing covered by ftell.c */
+    return TEST_RESULTS;
+}
+
+#endif
+
diff --git a/platform/win32/functions/_PDCLIB/_PDCLIB_flushbuffer.c b/platform/win32/functions/_PDCLIB/_PDCLIB_flushbuffer.c
new file mode 100644 (file)
index 0000000..82e36a0
--- /dev/null
@@ -0,0 +1,63 @@
+/* $Id$ */
+
+/* _PDCLIB_flushbuffer( struct _PDCLIB_file_t * )
+
+   This file is part of the Public Domain C Library (PDCLib).
+   Permission is granted to use, modify, and / or redistribute at will.
+*/
+
+/* This is a stub implementation of _PDCLIB_flushbuffer
+*/
+
+#include <stdio.h>
+#include <string.h>
+
+#ifndef REGTEST
+#include <_PDCLIB_glue.h>
+#include <errno.h>
+#include <windows.h>
+
+int _PDCLIB_flushbuffer( struct _PDCLIB_file_t * stream )
+{
+    if ( ! ( stream->status & _PDCLIB_FBIN ) )
+    {
+        /* TODO: Text stream conversion here */
+    }
+
+    DWORD written = 0;
+
+
+    while(written != stream->bufidx) {
+        DWORD justWrote;
+        DWORD toWrite = stream->bufidx - written;
+        BOOL res = WriteFile( stream->handle, stream->buffer + written, 
+                              toWrite, &justWrote, NULL);
+        written += justWrote;
+
+        if(!res) {
+            stream->status |=_PDCLIB_ERRORFLAG;
+            stream->bufidx -= written;
+            memmove( stream->buffer, stream->buffer + written, stream->bufidx );
+            _PDCLIB_w32errno();
+            return EOF;
+        }
+    }
+
+    stream->bufidx = 0;
+    return 0;
+}
+
+#endif
+
+
+#ifdef TEST
+#include <_PDCLIB_test.h>
+
+int main( void )
+{
+    /* Testing covered by ftell.c */
+    return TEST_RESULTS;
+}
+
+#endif
+
diff --git a/platform/win32/functions/_PDCLIB/_PDCLIB_freepages.c b/platform/win32/functions/_PDCLIB/_PDCLIB_freepages.c
new file mode 100644 (file)
index 0000000..3d8a254
--- /dev/null
@@ -0,0 +1,32 @@
+/* $Id$ */\r
+\r
+/* _PDCLIB_allocpages( int const )\r
+\r
+   This file is part of the Public Domain C Library (PDCLib).\r
+   Permission is granted to use, modify, and / or redistribute at will.\r
+*/\r
+\r
+/* This is a stub implementation of _PDCLIB_allocpages\r
+*/\r
+\r
+#include <stdint.h>\r
+#include <stddef.h>\r
+#include <errno.h>\r
+#ifndef REGTEST\r
+#include <_PDCLIB_glue.h>\r
+\r
+void _PDCLIB_freepages( void * p, size_t n )\r
+{\r
+    return;\r
+}\r
+#endif\r
+\r
+#ifdef TEST\r
+#include <_PDCLIB_test.h>\r
+\r
+int main( void )\r
+{\r
+    return TEST_RESULTS;\r
+}\r
+\r
+#endif\r
diff --git a/platform/win32/functions/_PDCLIB/_PDCLIB_open.c b/platform/win32/functions/_PDCLIB/_PDCLIB_open.c
new file mode 100644 (file)
index 0000000..bfdb897
--- /dev/null
@@ -0,0 +1,94 @@
+/* $Id$ */
+
+/* _PDCLIB_open( char const * const, int )
+
+   This file is part of the Public Domain C Library (PDCLib).
+   Permission is granted to use, modify, and / or redistribute at will.
+*/
+
+/* This is a stub implementation of open.
+*/
+
+#include <stdio.h>
+#include <errno.h>
+
+#ifndef REGTEST
+#include <_PDCLIB_glue.h>
+#include <windows.h>
+
+void _PDCLIB_w32errno(void);
+HANDLE _PDCLIB_open( char const * const filename, unsigned int mode )
+{
+    DWORD desiredAccess;
+    DWORD creationDisposition;
+
+    switch(mode & ( _PDCLIB_FREAD | _PDCLIB_FWRITE | _PDCLIB_FAPPEND 
+                    | _PDCLIB_FRW ))
+    {
+    case _PDCLIB_FREAD: /* "r" */
+        desiredAccess = GENERIC_READ;
+        creationDisposition = OPEN_EXISTING;
+        break;
+    case _PDCLIB_FWRITE: /* "w" */
+        desiredAccess = GENERIC_WRITE;
+        creationDisposition = CREATE_ALWAYS;
+        break;
+    case _PDCLIB_FAPPEND: /* "a" */
+        desiredAccess = GENERIC_WRITE;
+        creationDisposition = OPEN_ALWAYS;
+        break;
+    case _PDCLIB_FREAD | _PDCLIB_FRW: /* "r+" */
+        desiredAccess = GENERIC_READ | GENERIC_WRITE;
+        creationDisposition = OPEN_EXISTING;
+        break;
+    case _PDCLIB_FWRITE | _PDCLIB_FRW: /* "w+" */
+        desiredAccess = GENERIC_WRITE | GENERIC_READ;
+        creationDisposition = CREATE_ALWAYS;
+        break;
+    case _PDCLIB_FAPPEND | _PDCLIB_FRW: /* "a+" */
+        desiredAccess = GENERIC_WRITE | GENERIC_READ;
+        creationDisposition = OPEN_ALWAYS;
+        break;
+    default: /* Invalid mode */
+        errno = EINVAL;
+        return NULL;
+    }
+
+    HANDLE fd = CreateFileA(filename, desiredAccess, 
+        FILE_SHARE_READ | FILE_SHARE_DELETE,
+        NULL, creationDisposition, FILE_ATTRIBUTE_NORMAL, NULL);
+
+    if(fd == INVALID_HANDLE_VALUE) {
+        _PDCLIB_w32errno();
+        return NULL;
+    }
+
+    if(mode & _PDCLIB_FAPPEND) {
+        LARGE_INTEGER offs;
+        offs.QuadPart = 0;
+        BOOL ok = SetFilePointerEx(fd, offs, NULL, FILE_END);
+        if(!ok) {
+            _PDCLIB_w32errno();
+            CloseHandle(fd);
+            return NULL;
+        }
+    }
+
+    return fd;
+}
+
+#endif
+
+#ifdef TEST
+#include <_PDCLIB_test.h>
+
+#include <stdlib.h>
+#include <string.h>
+
+int main( void )
+{
+    return TEST_RESULTS;
+}
+
+#endif
+
diff --git a/platform/win32/functions/_PDCLIB/_PDCLIB_rename.c b/platform/win32/functions/_PDCLIB/_PDCLIB_rename.c
new file mode 100644 (file)
index 0000000..a65715d
--- /dev/null
@@ -0,0 +1,32 @@
+/* $Id$ */
+
+/* _PDCLIB_rename( const char *, const char * )
+
+   This file is part of the Public Domain C Library (PDCLib).
+   Permission is granted to use, modify, and / or redistribute at will.
+*/
+
+#include <stdio.h>
+
+#ifndef REGTEST
+#include <_PDCLIB_glue.h>
+#include <errno.h>
+
+int _PDCLIB_rename( const char * old, const char * new )
+{
+    errno = ENOTSUP;
+}
+
+#endif
+
+#ifdef TEST
+#include <_PDCLIB_test.h>
+
+#include <stdlib.h>
+
+int main( void )
+{
+    return TEST_RESULTS;
+}
+
+#endif
diff --git a/platform/win32/functions/_PDCLIB/_PDCLIB_seek.c b/platform/win32/functions/_PDCLIB/_PDCLIB_seek.c
new file mode 100644 (file)
index 0000000..c4c25f8
--- /dev/null
@@ -0,0 +1,32 @@
+/* $Id$ */
+
+/* int64_t _PDCLIB_seek( FILE *, int64_t, int )
+
+   This file is part of the Public Domain C Library (PDCLib).
+   Permission is granted to use, modify, and / or redistribute at will.
+*/
+
+#include <stdio.h>
+#include <errno.h>
+#ifndef REGTEST
+#include <_PDCLIB_glue.h>
+
+_PDCLIB_int64_t _PDCLIB_seek( struct _PDCLIB_file_t * stream, _PDCLIB_int64_t offset, int whence )
+{
+    errno = ENOTSUP;
+    return EOF;
+}
+
+#endif
+
+#ifdef TEST
+#include <_PDCLIB_test.h>
+
+int main( void )
+{
+    /* Testing covered by ftell.c */
+    return TEST_RESULTS;
+}
+
+#endif
+
diff --git a/platform/win32/functions/_PDCLIB/_PDCLIB_stdinit.c b/platform/win32/functions/_PDCLIB/_PDCLIB_stdinit.c
new file mode 100644 (file)
index 0000000..bc40470
--- /dev/null
@@ -0,0 +1,355 @@
+/* $Id$ */
+
+/* _PDCLIB_stdinit
+
+   This file is part of the Public Domain C Library (PDCLib).
+   Permission is granted to use, modify, and / or redistribute at will.
+*/
+
+/* This is an example initialization of stdin, stdout and stderr to the integer
+   file descriptors 0, 1, and 2, respectively. This applies for a great variety
+   of operating systems, including POSIX compliant ones.
+*/
+
+#include <stdio.h>
+#include <locale.h>
+#include <limits.h>
+
+#ifndef REGTEST
+
+/* In a POSIX system, stdin / stdout / stderr are equivalent to the (int) file
+   descriptors 0, 1, and 2 respectively.
+*/
+/* TODO: This is proof-of-concept, requires finetuning. */
+static char _PDCLIB_sin_buffer[BUFSIZ];
+static char _PDCLIB_sout_buffer[BUFSIZ];
+static char _PDCLIB_serr_buffer[BUFSIZ];
+
+static unsigned char _PDCLIB_sin_ungetbuf[_PDCLIB_UNGETCBUFSIZE];
+static unsigned char _PDCLIB_sout_ungetbuf[_PDCLIB_UNGETCBUFSIZE];
+static unsigned char _PDCLIB_serr_ungetbuf[_PDCLIB_UNGETCBUFSIZE];
+
+static struct _PDCLIB_file_t _PDCLIB_serr = { NULL, _PDCLIB_serr_buffer, BUFSIZ, 0, 0, { 0, 0 }, 0, _PDCLIB_serr_ungetbuf, _IONBF | _PDCLIB_FWRITE | _PDCLIB_STATIC, NULL, NULL };
+static struct _PDCLIB_file_t _PDCLIB_sout = { NULL, _PDCLIB_sout_buffer, BUFSIZ, 0, 0, { 0, 0 }, 0, _PDCLIB_sout_ungetbuf, _IOLBF | _PDCLIB_FWRITE | _PDCLIB_STATIC, NULL, &_PDCLIB_serr };
+static struct _PDCLIB_file_t _PDCLIB_sin  = { NULL, _PDCLIB_sin_buffer, BUFSIZ, 0, 0, { 0, 0 }, 0, _PDCLIB_sin_ungetbuf, _IOLBF | _PDCLIB_FREAD | _PDCLIB_STATIC, NULL, &_PDCLIB_sout };
+
+struct _PDCLIB_file_t * stdin  = &_PDCLIB_sin;
+struct _PDCLIB_file_t * stdout = &_PDCLIB_sout;
+struct _PDCLIB_file_t * stderr = &_PDCLIB_serr;
+
+/* FIXME: This approach is a possible attack vector. */
+struct _PDCLIB_file_t * _PDCLIB_filelist = &_PDCLIB_sin;
+
+/* "C" locale - defaulting to ASCII-7.
+   1 kByte (+ 4 byte) of <ctype.h> data.
+   Each line: flags, lowercase, uppercase, collation.
+*/
+static struct _PDCLIB_ctype_t _ctype[] = {
+    { /* EOF */    0,    0,    0,    0 },
+    { /* NUL */ _PDCLIB_CTYPE_CNTRL,                                             0x00, 0x00, 0x00 },
+    { /* SOH */ _PDCLIB_CTYPE_CNTRL,                                             0x01, 0x01, 0x01 },
+    { /* STX */ _PDCLIB_CTYPE_CNTRL,                                             0x02, 0x02, 0x02 },
+    { /* ETX */ _PDCLIB_CTYPE_CNTRL,                                             0x03, 0x03, 0x03 },
+    { /* EOT */ _PDCLIB_CTYPE_CNTRL,                                             0x04, 0x04, 0x04 },
+    { /* ENQ */ _PDCLIB_CTYPE_CNTRL,                                             0x05, 0x05, 0x05 },
+    { /* ACK */ _PDCLIB_CTYPE_CNTRL,                                             0x06, 0x06, 0x06 },
+    { /* BEL */ _PDCLIB_CTYPE_CNTRL,                                             0x07, 0x07, 0x07 },
+    { /*  BS */ _PDCLIB_CTYPE_CNTRL,                                             0x08, 0x08, 0x08 },
+    { /*  HT */ _PDCLIB_CTYPE_CNTRL | _PDCLIB_CTYPE_BLANK | _PDCLIB_CTYPE_SPACE, 0x09, 0x09, 0x09 },
+    { /*  LF */ _PDCLIB_CTYPE_CNTRL | _PDCLIB_CTYPE_SPACE,                       0x0A, 0x0A, 0x0A },
+    { /*  VT */ _PDCLIB_CTYPE_CNTRL | _PDCLIB_CTYPE_SPACE,                       0x0B, 0x0B, 0x0B },
+    { /*  FF */ _PDCLIB_CTYPE_CNTRL | _PDCLIB_CTYPE_SPACE,                       0x0C, 0x0C, 0x0C },
+    { /*  CR */ _PDCLIB_CTYPE_CNTRL | _PDCLIB_CTYPE_SPACE,                       0x0D, 0x0D, 0x0D },
+    { /*  SO */ _PDCLIB_CTYPE_CNTRL,                                             0x0E, 0x0E, 0x0E },
+    { /*  SI */ _PDCLIB_CTYPE_CNTRL,                                             0x0F, 0x0F, 0x0F },
+    { /* DLE */ _PDCLIB_CTYPE_CNTRL,                                             0x10, 0x10, 0x10 },
+    { /* DC1 */ _PDCLIB_CTYPE_CNTRL,                                             0x11, 0x11, 0x11 },
+    { /* DC2 */ _PDCLIB_CTYPE_CNTRL,                                             0x12, 0x12, 0x12 },
+    { /* DC3 */ _PDCLIB_CTYPE_CNTRL,                                             0x13, 0x13, 0x13 },
+    { /* DC4 */ _PDCLIB_CTYPE_CNTRL,                                             0x14, 0x14, 0x14 },
+    { /* NAK */ _PDCLIB_CTYPE_CNTRL,                                             0x15, 0x15, 0x15 },
+    { /* SYN */ _PDCLIB_CTYPE_CNTRL,                                             0x16, 0x16, 0x16 },
+    { /* ETB */ _PDCLIB_CTYPE_CNTRL,                                             0x17, 0x17, 0x17 },
+    { /* CAN */ _PDCLIB_CTYPE_CNTRL,                                             0x18, 0x18, 0x18 },
+    { /*  EM */ _PDCLIB_CTYPE_CNTRL,                                             0x19, 0x19, 0x19 },
+    { /* SUB */ _PDCLIB_CTYPE_CNTRL,                                             0x1A, 0x1A, 0x1A },
+    { /* ESC */ _PDCLIB_CTYPE_CNTRL,                                             0x1B, 0x1B, 0x1B },
+    { /*  FS */ _PDCLIB_CTYPE_CNTRL,                                             0x1C, 0x1C, 0x1C },
+    { /*  GS */ _PDCLIB_CTYPE_CNTRL,                                             0x1D, 0x1D, 0x1D },
+    { /*  RS */ _PDCLIB_CTYPE_CNTRL,                                             0x1E, 0x1E, 0x1E },
+    { /*  US */ _PDCLIB_CTYPE_CNTRL,                                             0x1F, 0x1F, 0x1F },
+    { /*  SP */ _PDCLIB_CTYPE_BLANK | _PDCLIB_CTYPE_SPACE,                       0x20, 0x20, 0x20 },
+    { /* '!' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x21, 0x21, 0x21 },
+    { /* '"' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x22, 0x22, 0x22 },
+    { /* '#' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x23, 0x23, 0x23 },
+    { /* '$' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x24, 0x24, 0x24 },
+    { /* '%' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x25, 0x25, 0x25 },
+    { /* '&' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x26, 0x26, 0x26 },
+    { /* ''' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x27, 0x27, 0x27 },
+    { /* '(' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x28, 0x28, 0x28 },
+    { /* ')' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x29, 0x29, 0x29 },
+    { /* '*' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x2A, 0x2A, 0x2A },
+    { /* '+' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x2B, 0x2B, 0x2B },
+    { /* ',' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x2C, 0x2C, 0x2C },
+    { /* '-' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x2D, 0x2D, 0x2D },
+    { /* '.' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x2E, 0x2E, 0x2E },
+    { /* '/' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x2F, 0x2F, 0x2F },
+    { /* '0' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_DIGIT | _PDCLIB_CTYPE_XDIGT, 0x30, 0x30, 0x30 },
+    { /* '1' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_DIGIT | _PDCLIB_CTYPE_XDIGT, 0x31, 0x31, 0x31 },
+    { /* '2' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_DIGIT | _PDCLIB_CTYPE_XDIGT, 0x32, 0x32, 0x32 },
+    { /* '3' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_DIGIT | _PDCLIB_CTYPE_XDIGT, 0x33, 0x33, 0x33 },
+    { /* '4' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_DIGIT | _PDCLIB_CTYPE_XDIGT, 0x34, 0x34, 0x34 },
+    { /* '5' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_DIGIT | _PDCLIB_CTYPE_XDIGT, 0x35, 0x35, 0x35 },
+    { /* '6' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_DIGIT | _PDCLIB_CTYPE_XDIGT, 0x36, 0x36, 0x36 },
+    { /* '7' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_DIGIT | _PDCLIB_CTYPE_XDIGT, 0x37, 0x37, 0x37 },
+    { /* '8' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_DIGIT | _PDCLIB_CTYPE_XDIGT, 0x38, 0x38, 0x38 },
+    { /* '9' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_DIGIT | _PDCLIB_CTYPE_XDIGT, 0x39, 0x39, 0x39 },
+    { /* ':' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x3A, 0x3A, 0x3A },
+    { /* ';' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x3B, 0x3B, 0x3B },
+    { /* '<' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x3C, 0x3C, 0x3C },
+    { /* '=' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x3D, 0x3D, 0x3D },
+    { /* '>' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x3E, 0x3E, 0x3E },
+    { /* '?' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x3F, 0x3F, 0x3F },
+    { /* '@' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x40, 0x40, 0x40 },
+    { /* 'A' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER | _PDCLIB_CTYPE_XDIGT, 0x41, 0x61, 0x41 },
+    { /* 'B' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER | _PDCLIB_CTYPE_XDIGT, 0x42, 0x62, 0x42 },
+    { /* 'C' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER | _PDCLIB_CTYPE_XDIGT, 0x43, 0x63, 0x43 },
+    { /* 'D' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER | _PDCLIB_CTYPE_XDIGT, 0x44, 0x64, 0x44 },
+    { /* 'E' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER | _PDCLIB_CTYPE_XDIGT, 0x45, 0x65, 0x45 },
+    { /* 'F' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER | _PDCLIB_CTYPE_XDIGT, 0x46, 0x66, 0x46 },
+    { /* 'G' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x47, 0x67, 0x47 },
+    { /* 'H' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x48, 0x68, 0x48 },
+    { /* 'I' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x49, 0x69, 0x49 },
+    { /* 'J' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x4A, 0x6A, 0x4A },
+    { /* 'K' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x4B, 0x6B, 0x4B },
+    { /* 'L' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x4C, 0x6C, 0x4C },
+    { /* 'M' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x4D, 0x6D, 0x4D },
+    { /* 'N' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x4E, 0x6E, 0x4E },
+    { /* 'O' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x4F, 0x6F, 0x4F },
+    { /* 'P' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x50, 0x70, 0x50 },
+    { /* 'Q' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x51, 0x71, 0x51 },
+    { /* 'R' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x52, 0x72, 0x52 },
+    { /* 'S' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x53, 0x73, 0x53 },
+    { /* 'T' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x54, 0x74, 0x54 },
+    { /* 'U' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x55, 0x75, 0x55 },
+    { /* 'V' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x56, 0x76, 0x56 },
+    { /* 'W' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x57, 0x77, 0x57 },
+    { /* 'X' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x58, 0x78, 0x58 },
+    { /* 'Y' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x59, 0x79, 0x59 },
+    { /* 'Z' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_UPPER, 0x5A, 0x7A, 0x5A },
+    { /* '[' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x5B, 0x5B, 0x5B },
+    { /* '\' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x5C, 0x5C, 0x5C },
+    { /* ']' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x5D, 0x5D, 0x5D },
+    { /* '^' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x5E, 0x5E, 0x5E },
+    { /* '_' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x5F, 0x5F, 0x5F },
+    { /* '`' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x60, 0x60, 0x60 },
+    { /* 'a' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER | _PDCLIB_CTYPE_XDIGT, 0x41, 0x61, 0x61 },
+    { /* 'b' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER | _PDCLIB_CTYPE_XDIGT, 0x42, 0x62, 0x62 },
+    { /* 'c' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER | _PDCLIB_CTYPE_XDIGT, 0x43, 0x63, 0x63 },
+    { /* 'd' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER | _PDCLIB_CTYPE_XDIGT, 0x44, 0x64, 0x64 },
+    { /* 'e' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER | _PDCLIB_CTYPE_XDIGT, 0x45, 0x65, 0x65 },
+    { /* 'f' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER | _PDCLIB_CTYPE_XDIGT, 0x46, 0x66, 0x66 },
+    { /* 'g' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x47, 0x67, 0x67 },
+    { /* 'h' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x48, 0x68, 0x68 },
+    { /* 'i' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x49, 0x69, 0x69 },
+    { /* 'j' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x4A, 0x6A, 0x6A },
+    { /* 'k' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x4B, 0x6B, 0x6B },
+    { /* 'l' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x4C, 0x6C, 0x6C },
+    { /* 'm' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x4D, 0x6D, 0x6D },
+    { /* 'n' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x4E, 0x6E, 0x6E },
+    { /* 'o' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x4F, 0x6F, 0x6F },
+    { /* 'p' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x50, 0x70, 0x70 },
+    { /* 'q' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x51, 0x71, 0x71 },
+    { /* 'r' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x52, 0x72, 0x72 },
+    { /* 's' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x53, 0x73, 0x73 },
+    { /* 't' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x54, 0x74, 0x74 },
+    { /* 'u' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x55, 0x75, 0x75 },
+    { /* 'v' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x56, 0x76, 0x76 },
+    { /* 'w' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x57, 0x77, 0x77 },
+    { /* 'x' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x58, 0x78, 0x78 },
+    { /* 'y' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x59, 0x79, 0x79 },
+    { /* 'z' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_LOWER, 0x5A, 0x7A, 0x7A },
+    { /* '{' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x7B, 0x7B, 0x7B },
+    { /* '|' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x7C, 0x7C, 0x7C },
+    { /* '}' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x7D, 0x7D, 0x7D },
+    { /* '~' */ _PDCLIB_CTYPE_GRAPH | _PDCLIB_CTYPE_PUNCT,                       0x7E, 0x7E, 0x7E },
+    { /* DEL */ _PDCLIB_CTYPE_CNTRL,                                             0x7F, 0x7F, 0x7F },
+    { 0x00, 0x80, 0x80, 0x80 },
+    { 0x00, 0x81, 0x81, 0x81 },
+    { 0x00, 0x82, 0x82, 0x82 },
+    { 0x00, 0x83, 0x83, 0x83 },
+    { 0x00, 0x84, 0x84, 0x84 },
+    { 0x00, 0x85, 0x85, 0x85 },
+    { 0x00, 0x86, 0x86, 0x86 },
+    { 0x00, 0x87, 0x87, 0x87 },
+    { 0x00, 0x88, 0x88, 0x88 },
+    { 0x00, 0x89, 0x89, 0x89 },
+    { 0x00, 0x8A, 0x8A, 0x8A },
+    { 0x00, 0x8B, 0x8B, 0x8B },
+    { 0x00, 0x8C, 0x8C, 0x8C },
+    { 0x00, 0x8D, 0x8D, 0x8D },
+    { 0x00, 0x8E, 0x8E, 0x8E },
+    { 0x00, 0x8F, 0x8F, 0x8F },
+    { 0x00, 0x90, 0x90, 0x90 },
+    { 0x00, 0x91, 0x91, 0x91 },
+    { 0x00, 0x92, 0x92, 0x92 },
+    { 0x00, 0x93, 0x93, 0x93 },
+    { 0x00, 0x94, 0x94, 0x94 },
+    { 0x00, 0x95, 0x95, 0x95 },
+    { 0x00, 0x96, 0x96, 0x96 },
+    { 0x00, 0x97, 0x97, 0x97 },
+    { 0x00, 0x98, 0x98, 0x98 },
+    { 0x00, 0x99, 0x99, 0x99 },
+    { 0x00, 0x9A, 0x9A, 0x9A },
+    { 0x00, 0x9B, 0x9B, 0x9B },
+    { 0x00, 0x9C, 0x9C, 0x9C },
+    { 0x00, 0x9D, 0x9D, 0x9D },
+    { 0x00, 0x9E, 0x9E, 0x9E },
+    { 0x00, 0x9F, 0x9F, 0x9F },
+    { 0x00, 0xA0, 0xA0, 0xA0 },
+    { 0x00, 0xA1, 0xA1, 0xA1 },
+    { 0x00, 0xA2, 0xA2, 0xA2 },
+    { 0x00, 0xA3, 0xA3, 0xA3 },
+    { 0x00, 0xA4, 0xA4, 0xA4 },
+    { 0x00, 0xA5, 0xA5, 0xA5 },
+    { 0x00, 0xA6, 0xA6, 0xA6 },
+    { 0x00, 0xA7, 0xA7, 0xA7 },
+    { 0x00, 0xA8, 0xA8, 0xA8 },
+    { 0x00, 0xA9, 0xA9, 0xA9 },
+    { 0x00, 0xAA, 0xAA, 0xAA },
+    { 0x00, 0xAB, 0xAB, 0xAB },
+    { 0x00, 0xAC, 0xAC, 0xAC },
+    { 0x00, 0xAD, 0xAD, 0xAD },
+    { 0x00, 0xAE, 0xAE, 0xAE },
+    { 0x00, 0xAF, 0xAF, 0xAF },
+    { 0x00, 0xB0, 0xB0, 0xB0 },
+    { 0x00, 0xB1, 0xB1, 0xB1 },
+    { 0x00, 0xB2, 0xB2, 0xB2 },
+    { 0x00, 0xB3, 0xB3, 0xB3 },
+    { 0x00, 0xB4, 0xB4, 0xB4 },
+    { 0x00, 0xB5, 0xB5, 0xB5 },
+    { 0x00, 0xB6, 0xB6, 0xB6 },
+    { 0x00, 0xB7, 0xB7, 0xB7 },
+    { 0x00, 0xB8, 0xB8, 0xB8 },
+    { 0x00, 0xB9, 0xB9, 0xB9 },
+    { 0x00, 0xBA, 0xBA, 0xBA },
+    { 0x00, 0xBB, 0xBB, 0xBB },
+    { 0x00, 0xBC, 0xBC, 0xBC },
+    { 0x00, 0xBD, 0xBD, 0xBD },
+    { 0x00, 0xBE, 0xBE, 0xBE },
+    { 0x00, 0xBF, 0xBF, 0xBF },
+    { 0x00, 0xC0, 0xC0, 0xC0 },
+    { 0x00, 0xC1, 0xC1, 0xC1 },
+    { 0x00, 0xC2, 0xC2, 0xC2 },
+    { 0x00, 0xC3, 0xC3, 0xC3 },
+    { 0x00, 0xC4, 0xC4, 0xC4 },
+    { 0x00, 0xC5, 0xC5, 0xC5 },
+    { 0x00, 0xC6, 0xC6, 0xC6 },
+    { 0x00, 0xC7, 0xC7, 0xC7 },
+    { 0x00, 0xC8, 0xC8, 0xC8 },
+    { 0x00, 0xC9, 0xC9, 0xC9 },
+    { 0x00, 0xCA, 0xCA, 0xCA },
+    { 0x00, 0xCB, 0xCB, 0xCB },
+    { 0x00, 0xCC, 0xCC, 0xCC },
+    { 0x00, 0xCD, 0xCD, 0xCD },
+    { 0x00, 0xCE, 0xCE, 0xCE },
+    { 0x00, 0xCF, 0xCF, 0xCF },
+    { 0x00, 0xD0, 0xD0, 0xD0 },
+    { 0x00, 0xD1, 0xD1, 0xD1 },
+    { 0x00, 0xD2, 0xD2, 0xD2 },
+    { 0x00, 0xD3, 0xD3, 0xD3 },
+    { 0x00, 0xD4, 0xD4, 0xD4 },
+    { 0x00, 0xD5, 0xD5, 0xD5 },
+    { 0x00, 0xD6, 0xD6, 0xD6 },
+    { 0x00, 0xD7, 0xD7, 0xD7 },
+    { 0x00, 0xD8, 0xD8, 0xD8 },
+    { 0x00, 0xD9, 0xD9, 0xD9 },
+    { 0x00, 0xDA, 0xDA, 0xDA },
+    { 0x00, 0xDB, 0xDB, 0xDB },
+    { 0x00, 0xDC, 0xDC, 0xDC },
+    { 0x00, 0xDD, 0xDD, 0xDD },
+    { 0x00, 0xDE, 0xDE, 0xDE },
+    { 0x00, 0xDF, 0xDF, 0xDF },
+    { 0x00, 0xE0, 0xE0, 0xE0 },
+    { 0x00, 0xE1, 0xE1, 0xE1 },
+    { 0x00, 0xE2, 0xE2, 0xE2 },
+    { 0x00, 0xE3, 0xE3, 0xE3 },
+    { 0x00, 0xE4, 0xE4, 0xE4 },
+    { 0x00, 0xE5, 0xE5, 0xE5 },
+    { 0x00, 0xE6, 0xE6, 0xE6 },
+    { 0x00, 0xE7, 0xE7, 0xE7 },
+    { 0x00, 0xE8, 0xE8, 0xE8 },
+    { 0x00, 0xE9, 0xE9, 0xE9 },
+    { 0x00, 0xEA, 0xEA, 0xEA },
+    { 0x00, 0xEB, 0xEB, 0xEB },
+    { 0x00, 0xEC, 0xEC, 0xEC },
+    { 0x00, 0xED, 0xED, 0xED },
+    { 0x00, 0xEE, 0xEE, 0xEE },
+    { 0x00, 0xEF, 0xEF, 0xEF },
+    { 0x00, 0xF0, 0xF0, 0xF0 },
+    { 0x00, 0xF1, 0xF1, 0xF1 },
+    { 0x00, 0xF2, 0xF2, 0xF2 },
+    { 0x00, 0xF3, 0xF3, 0xF3 },
+    { 0x00, 0xF4, 0xF4, 0xF4 },
+    { 0x00, 0xF5, 0xF5, 0xF5 },
+    { 0x00, 0xF6, 0xF6, 0xF6 },
+    { 0x00, 0xF7, 0xF7, 0xF7 },
+    { 0x00, 0xF8, 0xF8, 0xF8 },
+    { 0x00, 0xF9, 0xF9, 0xF9 },
+    { 0x00, 0xFA, 0xFA, 0xFA },
+    { 0x00, 0xFB, 0xFB, 0xFB },
+    { 0x00, 0xFC, 0xFC, 0xFC },
+    { 0x00, 0xFD, 0xFD, 0xFD },
+    { 0x00, 0xFE, 0xFE, 0xFE },
+    { 0x00, 0xFF, 0xFF, 0xFF }
+};
+
+struct lconv _PDCLIB_lconv = { 
+    /* _PDCLIB_ctype      */ _ctype + 1,
+    /* _PDCLIB_errno_texts */
+    {
+        /* no error */ (char *)"",
+        /* ERANGE   */ (char *)"ERANGE (Range error)",
+        /* EDOM     */ (char *)"EDOM (Domain error)",
+        /* EILSEQ   */ (char *)"EILSEQ (Illegal sequence)"
+    },
+    /* decimal_point      */ (char *)".",
+    /* thousands_sep      */ (char *)"",
+    /* grouping           */ (char *)"",
+    /* mon_decimal_point  */ (char *)"",
+    /* mon_thousands_sep  */ (char *)"",
+    /* mon_grouping       */ (char *)"",
+    /* positive_sign      */ (char *)"",
+    /* negative_sign      */ (char *)"",
+    /* currency_symbol    */ (char *)"",
+    /* int_curr_symbol    */ (char *)"",
+    /* frac_digits        */ CHAR_MAX,
+    /* p_cs_precedes      */ CHAR_MAX,
+    /* n_cs_precedes      */ CHAR_MAX,
+    /* p_sep_by_space     */ CHAR_MAX,
+    /* n_sep_by_space     */ CHAR_MAX,
+    /* p_sign_posn        */ CHAR_MAX,
+    /* n_sign_posn        */ CHAR_MAX,
+    /* int_frac_digits    */ CHAR_MAX,
+    /* int_p_cs_precedes  */ CHAR_MAX,
+    /* int_n_cs_precedes  */ CHAR_MAX,
+    /* int_p_sep_by_space */ CHAR_MAX,
+    /* int_n_sep_by_space */ CHAR_MAX,
+    /* int_p_sign_posn    */ CHAR_MAX,
+    /* int_n_sign_posn    */ CHAR_MAX,
+};
+
+#endif
+
+#ifdef TEST
+#include <_PDCLIB_test.h>
+
+int main( void )
+{
+    /* Testing covered by several other testdrivers using stdin / stdout / 
+       stderr.
+    */
+    return TEST_RESULTS;
+}
+
+#endif
diff --git a/platform/win32/functions/_PDCLIB/_PDCLIB_w32errno.c b/platform/win32/functions/_PDCLIB/_PDCLIB_w32errno.c
new file mode 100644 (file)
index 0000000..5e03ef5
--- /dev/null
@@ -0,0 +1,56 @@
+/* $Id$ */\r
+\r
+/* _PDCLIB_allocpages( int const )\r
+\r
+   This file is part of the Public Domain C Library (PDCLib).\r
+   Permission is granted to use, modify, and / or redistribute at will.\r
+*/\r
+\r
+/* This is a stub implementation of _PDCLIB_allocpages\r
+*/\r
+\r
+#ifndef REGTEST\r
+#include <errno.h>\r
+#include <windows.h>\r
+\r
+void _PDCLIB_w32errno(void)\r
+{\r
+    // Not exhaustive\r
+    switch(GetLastError()) {\r
+        case ERROR_SUCCESS:\r
+            return;\r
+        case ERROR_FILE_NOT_FOUND:\r
+        case ERROR_PATH_NOT_FOUND:\r
+        case ERROR_INVALID_DRIVE:\r
+            errno = ENOENT; break;\r
+        case ERROR_TOO_MANY_OPEN_FILES:\r
+            errno = EMFILE; break;\r
+        case ERROR_ACCESS_DENIED:\r
+        case ERROR_WRITE_PROTECT:\r
+            errno = EPERM; break;\r
+        case ERROR_INVALID_HANDLE:\r
+            errno = EBADF; break;\r
+        case ERROR_NOT_ENOUGH_MEMORY:\r
+        case ERROR_OUTOFMEMORY:\r
+            errno = ENOMEM; break;\r
+        case ERROR_NOT_READY:\r
+            errno = EAGAIN; break;\r
+        case ERROR_BAD_LENGTH:\r
+            errno = EINVAL; break;\r
+        default:\r
+            // TODO: reconsider what to use here?\r
+            errno = ENOSYS; break;\r
+    }\r
+}\r
+\r
+#endif\r
+\r
+#ifdef TEST\r
+#include <_PDCLIB_test.h>\r
+\r
+int main( void )\r
+{\r
+    return TEST_RESULTS;\r
+}\r
+\r
+#endif
\ No newline at end of file
diff --git a/platform/win32/functions/signal/raise.c b/platform/win32/functions/signal/raise.c
new file mode 100644 (file)
index 0000000..8d7080b
--- /dev/null
@@ -0,0 +1,114 @@
+/* $Id$ */
+
+/* raise( int )
+
+   This file is part of the Public Domain C Library (PDCLib).
+   Permission is granted to use, modify, and / or redistribute at will.
+*/
+
+#include <signal.h>
+
+#ifndef REGTEST
+
+#include <stdio.h>
+#include <stdlib.h>
+
+extern void (*_PDCLIB_sigabrt)( int );
+extern void (*_PDCLIB_sigfpe)( int );
+extern void (*_PDCLIB_sigill)( int );
+extern void (*_PDCLIB_sigint)( int );
+extern void (*_PDCLIB_sigsegv)( int );
+extern void (*_PDCLIB_sigterm)( int );
+
+int raise( int sig )
+{
+    void (*sighandler)( int );
+    char const * message;
+    switch ( sig )
+    {
+        case SIGABRT:
+            sighandler = _PDCLIB_sigabrt;
+            message = "Abnormal termination (SIGABRT)";
+            break;
+        case SIGFPE:
+            sighandler = _PDCLIB_sigfpe;
+            message = "Arithmetic exception (SIGFPE)";
+            break;
+        case SIGILL:
+            sighandler = _PDCLIB_sigill;
+            message = "Illegal instruction (SIGILL)";
+            break;
+        case SIGINT:
+            sighandler = _PDCLIB_sigint;
+            message = "Interactive attention signal (SIGINT)";
+            break;
+        case SIGSEGV:
+            sighandler = _PDCLIB_sigsegv;
+            message = "Invalid memory access (SIGSEGV)";
+            break;
+        case SIGTERM:
+            sighandler = _PDCLIB_sigterm;
+            message = "Termination request (SIGTERM)";
+            break;
+        default:
+            fprintf( stderr, "Unknown signal #%d\n", sig );
+            _Exit( EXIT_FAILURE );
+    }
+    if ( sighandler == SIG_DFL )
+    {
+        fputs( message, stderr );
+        _Exit( EXIT_FAILURE );
+    }
+    else if ( sighandler != SIG_IGN )
+    {
+        sighandler = signal( sig, SIG_DFL );
+        sighandler( sig );
+    }
+    return 0;
+}
+
+#endif
+
+#ifdef TEST
+#include <_PDCLIB_test.h>
+
+#include <stdlib.h>
+
+static volatile sig_atomic_t flag = 0;
+
+static int expected_signal = 0;
+
+static void test_handler( int sig )
+{
+    TESTCASE( sig == expected_signal );
+    flag = 1;
+}
+
+int main( void )
+{
+    /* Could be other than SIG_DFL if you changed the implementation. */
+    TESTCASE( signal( SIGABRT, SIG_IGN ) == SIG_DFL );
+    /* Should be ignored. */
+    TESTCASE( raise( SIGABRT ) == 0 );
+    /* Installing test handler, old handler should be returned */
+    TESTCASE( signal( SIGABRT, test_handler ) == SIG_IGN );
+    /* Raising and checking SIGABRT */
+    expected_signal = SIGABRT;
+    TESTCASE( raise( SIGABRT ) == 0 );
+    TESTCASE( flag == 1 );
+    /* Re-installing test handler, should have been reset to default */
+    /* Could be other than SIG_DFL if you changed the implementation. */
+    TESTCASE( signal( SIGABRT, test_handler ) == SIG_DFL );
+    /* Raising and checking SIGABRT */
+    flag = 0;
+    TESTCASE( raise( SIGABRT ) == 0 );
+    TESTCASE( flag == 1 );
+    /* Installing test handler for different signal... */
+    TESTCASE( signal( SIGTERM, test_handler ) == SIG_DFL );
+    /* Raising and checking SIGTERM */
+    expected_signal = SIGTERM;
+    TESTCASE( raise( SIGTERM ) == 0 );
+    TESTCASE( flag == 1 );
+    return TEST_RESULTS;
+}
+#endif
diff --git a/platform/win32/functions/signal/signal.c b/platform/win32/functions/signal/signal.c
new file mode 100644 (file)
index 0000000..e07877d
--- /dev/null
@@ -0,0 +1,75 @@
+/* $Id$ */
+
+/* signal( int sig, void (*func)( int ) )
+
+   This file is part of the Public Domain C Library (PDCLib).
+   Permission is granted to use, modify, and / or redistribute at will.
+*/
+
+#include <signal.h>
+
+#ifndef REGTEST
+
+#include <stdlib.h>
+
+void (*_PDCLIB_sigabrt)( int ) = SIG_DFL;
+void (*_PDCLIB_sigfpe)( int )  = SIG_DFL;
+void (*_PDCLIB_sigill)( int )  = SIG_DFL;
+void (*_PDCLIB_sigint)( int )  = SIG_DFL;
+void (*_PDCLIB_sigsegv)( int ) = SIG_DFL;
+void (*_PDCLIB_sigterm)( int ) = SIG_DFL;
+
+void (*signal( int sig, void (*func)( int ) ) )( int )
+{
+    void (*oldhandler)( int );
+    if ( sig <= 0 || func == SIG_ERR )
+    {
+        return SIG_ERR;
+    }
+    switch ( sig )
+    {
+        case SIGABRT:
+            oldhandler = _PDCLIB_sigabrt;
+            _PDCLIB_sigabrt = func;
+            break;
+        case SIGFPE:
+            oldhandler = _PDCLIB_sigfpe;
+            _PDCLIB_sigfpe = func;
+            break;
+        case SIGILL:
+            oldhandler = _PDCLIB_sigill;
+            _PDCLIB_sigill = func;
+            break;
+        case SIGINT:
+            oldhandler = _PDCLIB_sigint;
+            _PDCLIB_sigint = func;
+            break;
+        case SIGSEGV:
+            oldhandler = _PDCLIB_sigsegv;
+            _PDCLIB_sigsegv = func;
+            break;
+        case SIGTERM:
+            oldhandler = _PDCLIB_sigterm;
+            _PDCLIB_sigterm = func;
+            break;
+        default:
+            /* The standard calls for an unspecified "positive value". You
+               will probably want to define a specific value for this.
+            */
+            _PDCLIB_errno = 1;
+            return SIG_ERR;
+    }
+    return oldhandler;
+}
+
+#endif
+
+#ifdef TEST
+#include <_PDCLIB_test.h>
+
+int main( void )
+{
+    /* Testing covered by raise.c */
+    return TEST_RESULTS;
+}
+#endif
diff --git a/platform/win32/functions/stdio/remove.c b/platform/win32/functions/stdio/remove.c
new file mode 100644 (file)
index 0000000..913bdf3
--- /dev/null
@@ -0,0 +1,44 @@
+/* $Id$ */
+
+/* remove( const char * )
+
+   This file is part of the Public Domain C Library (PDCLib).
+   Permission is granted to use, modify, and / or redistribute at will.
+*/
+
+/* This is an example implementation of remove() fit for use with POSIX kernels.
+*/
+
+#include <stdio.h>
+
+#ifndef REGTEST
+
+#include <string.h>
+#include <errno.h>
+#include <windows.h>
+
+extern struct _PDCLIB_file_t * _PDCLIB_filelist;
+
+extern void _PDCLIB_w32errno( void );
+int remove( const char * pathname )
+{
+    BOOL ok = DeleteFileA( pathname );
+    if(!ok) {
+        _PDCLIB_w32errno();
+        return -1;
+    } else return 0;
+}
+
+#endif
+
+#ifdef TEST
+#include <_PDCLIB_test.h>
+
+int main( void )
+{
+    /* Testing covered by ftell.c (and several others) */
+    return TEST_RESULTS;
+}
+
+#endif
+
diff --git a/platform/win32/functions/stdio/tmpfile.c b/platform/win32/functions/stdio/tmpfile.c
new file mode 100644 (file)
index 0000000..f329234
--- /dev/null
@@ -0,0 +1,89 @@
+/* $Id$ */
+
+/* tmpfile( void )
+
+   This file is part of the Public Domain C Library (PDCLib).
+   Permission is granted to use, modify, and / or redistribute at will.
+*/
+
+#include <stdio.h>
+
+#ifndef REGTEST
+#include <errno.h>
+#include <_PDCLIB_glue.h>
+#include <windows.h>
+#include <string.h>
+
+static char tmpname_prefix[4] = {0, 0, 0, 0};
+
+extern void _PDCLIB_w32errno( void );
+struct _PDCLIB_file_t * tmpfile( void )
+{
+    if(!tmpname_prefix[0]) {
+        char namebuf[MAX_PATH+1];
+        DWORD res = GetModuleFileNameA(NULL, namebuf, MAX_PATH+1);
+        if(res) {
+            char * basename = strrchr(namebuf, '\\');
+            if(basename) {
+                basename += 1;
+            } else basename = namebuf;
+
+            char* dot = strchr(basename, '.');
+            if(dot) *dot = 0;
+
+            strncpy(tmpname_prefix, basename, 3);
+        } else {
+            // Error getting file name
+            strcpy(tmpname_prefix, "PDU");
+        }
+    }
+
+    char tmpdir[MAX_PATH + 1];
+    DWORD rv = GetTempPathA(MAX_PATH + 1, tmpdir);
+    if(rv == 0) {
+        _PDCLIB_w32errno();
+        return NULL;
+    }
+
+    char name[MAX_PATH + 1];
+    rv = GetTempFileNameA(tmpdir, tmpname_prefix, 0, name);
+    if(rv == 0) {
+        _PDCLIB_w32errno();
+        return NULL;
+    }
+
+    /* OPEN_EXISTING as CreateTempFileName creates the file then closes the
+       handle to it (to avoid race conditions as associated with e.g. tmpnam)
+     */
+    HANDLE fd = CreateFileA(name, GENERIC_READ | GENERIC_WRITE, 
+        FILE_SHARE_DELETE, NULL, OPEN_EXISTING, 
+        FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_TEMPORARY, NULL);
+
+    if(fd == INVALID_HANDLE_VALUE) {
+        _PDCLIB_w32errno();
+        return NULL;
+    }
+
+    /* Set the file to delete on close */
+    DeleteFile(name);
+
+    FILE* fs = _PDCLIB_fdopen(fd, _PDCLIB_FWRITE | _PDCLIB_FRW, name);
+    if(!fs) {
+        CloseHandle(fd);
+    }
+    return fs;
+}
+
+#endif
+
+#ifdef TEST
+#include <_PDCLIB_test.h>
+#include <string.h>
+
+int main( void )
+{
+    return TEST_RESULTS;
+}
+
+#endif
+
diff --git a/platform/win32/functions/stdlib/getenv.c b/platform/win32/functions/stdlib/getenv.c
new file mode 100644 (file)
index 0000000..a95171d
--- /dev/null
@@ -0,0 +1,32 @@
+/* $Id$ */
+
+/* getenv( const char * )
+
+   This file is part of the Public Domain C Library (PDCLib).
+   Permission is granted to use, modify, and / or redistribute at will.
+*/
+
+/* This is a stub implementation of getenv
+*/
+
+#include <string.h>
+#include <stdlib.h>
+
+#ifndef REGTEST
+
+char * getenv( const char * name )
+{
+    return NULL;
+}
+
+#endif
+
+#ifdef TEST
+#include <_PDCLIB_test.h>
+
+int main( void )
+{
+    return TEST_RESULTS;
+}
+
+#endif
diff --git a/platform/win32/functions/stdlib/system.c b/platform/win32/functions/stdlib/system.c
new file mode 100644 (file)
index 0000000..2cf7534
--- /dev/null
@@ -0,0 +1,27 @@
+/* $Id$ */
+
+/* system( const char * )
+
+   This file is part of the Public Domain C Library (PDCLib).
+   Permission is granted to use, modify, and / or redistribute at will.
+*/
+
+#include <stdlib.h>
+
+/* This is a stub implementation of getenv
+*/
+
+int system( const char * string )
+{
+    return -1;
+}
+
+#ifdef TEST
+#include <_PDCLIB_test.h>
+
+int main( void )
+{
+    return TEST_RESULTS;
+}
+
+#endif
diff --git a/platform/win32/includes/float.h b/platform/win32/includes/float.h
new file mode 100644 (file)
index 0000000..6590539
--- /dev/null
@@ -0,0 +1,76 @@
+/* $Id$ */
+
+/* 7.7 Characteristics of floating types <float.h>
+
+   This file is part of the Public Domain C Library (PDCLib).
+   Permission is granted to use, modify, and / or redistribute at will.
+*/
+
+#ifndef _PDCLIB_FLOAT_H
+#define _PDCLIB_FLOAT_H _PDCLIB_FLOAT_H
+#include <_PDCLIB_config.h>
+
+#define FLT_ROUNDS      _PDCLIB_FLT_ROUNDS
+#define FLT_EVAL_METHOD _PDCLIB_FLT_EVAL_METHOD
+#define DECIMAL_DIG     _PDCLIB_DECIMAL_DIG
+
+   /* Radix of exponent representation */
+#define FLT_RADIX      __FLT_RADIX__
+   /* Number of base-FLT_RADIX digits in the significand of a float */
+#define FLT_MANT_DIG   __FLT_MANT_DIG__
+   /* Number of decimal digits of precision in a float */
+#define FLT_DIG        __FLT_DIG__
+   /* Difference between 1.0 and the minimum float greater than 1.0 */
+#define FLT_EPSILON    __FLT_EPSILON__
+   /* Minimum int x such that FLT_RADIX**(x-1) is a normalised float */
+#define FLT_MIN_EXP    __FLT_MIN_EXP__
+   /* Minimum normalised float */
+#define FLT_MIN        __FLT_MIN__
+   /* Minimum int x such that 10**x is a normalised float */
+#define FLT_MIN_10_EXP __FLT_MIN_10_EXP__
+   /* Maximum int x such that FLT_RADIX**(x-1) is a representable float */
+#define FLT_MAX_EXP    __FLT_MAX_EXP__
+   /* Maximum float */
+#define FLT_MAX        __FLT_MAX__
+   /* Maximum int x such that 10**x is a representable float */
+#define FLT_MAX_10_EXP __FLT_MAX_10_EXP__
+
+   /* Number of base-FLT_RADIX digits in the significand of a double */
+#define DBL_MANT_DIG   __DBL_MANT_DIG__
+   /* Number of decimal digits of precision in a double */
+#define DBL_DIG        __DBL_DIG__
+   /* Difference between 1.0 and the minimum double greater than 1.0 */
+#define DBL_EPSILON    __DBL_EPSILON__
+   /* Minimum int x such that FLT_RADIX**(x-1) is a normalised double */
+#define DBL_MIN_EXP    __DBL_MIN_EXP__
+   /* Minimum normalised double */
+#define DBL_MIN        __DBL_MIN__
+   /* Minimum int x such that 10**x is a normalised double */
+#define DBL_MIN_10_EXP __DBL_MIN_10_EXP__
+   /* Maximum int x such that FLT_RADIX**(x-1) is a representable double */
+#define DBL_MAX_EXP    __DBL_MAX_EXP__
+   /* Maximum double */
+#define DBL_MAX        __DBL_MAX__
+   /* Maximum int x such that 10**x is a representable double */
+#define DBL_MAX_10_EXP __DBL_MAX_10_EXP__
+
+   /* Number of base-FLT_RADIX digits in the significand of a long double */
+#define LDBL_MANT_DIG   __LDBL_MANT_DIG__
+   /* Number of decimal digits of precision in a long double */
+#define LDBL_DIG        __LDBL_DIG__
+   /* Difference between 1.0 and the minimum long double greater than 1.0 */
+#define LDBL_EPSILON    __LDBL_EPSILON__
+   /* Minimum int x such that FLT_RADIX**(x-1) is a normalised long double */
+#define LDBL_MIN_EXP    __LDBL_MIN_EXP__
+   /* Minimum normalised long double */
+#define LDBL_MIN        __LDBL_MIN__
+   /* Minimum int x such that 10**x is a normalised long double */
+#define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__
+   /* Maximum int x such that FLT_RADIX**(x-1) is a representable long double */
+#define LDBL_MAX_EXP    __LDBL_MAX_EXP__
+   /* Maximum long double */
+#define LDBL_MAX        __LDBL_MAX__
+   /* Maximum int x such that 10**x is a representable long double */
+#define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__
+
+#endif
diff --git a/platform/win32/includes/signal.h b/platform/win32/includes/signal.h
new file mode 100644 (file)
index 0000000..9f6a1a3
--- /dev/null
@@ -0,0 +1,86 @@
+/* $Id$ */
+
+/* 7.14 Signal handling <string.h>
+
+   This file is part of the Public Domain C Library (PDCLib).
+   Permission is granted to use, modify, and / or redistribute at will.
+*/
+
+#ifndef _PDCLIB_SIGNAL_H
+#define _PDCLIB_SIGNAL_H _PDCLIB_SIGNAL_H
+#include <_PDCLIB_config.h>
+
+/* Signals ------------------------------------------------------------------ */
+
+/* A word on signals, to the people using PDCLib in their OS projects.
+
+   The definitions of the C standard leave about everything that *could* be
+   useful to be "implementation defined". Without additional, non-standard
+   arrangements, it is not possible to turn them into a useful tool.
+
+   This example implementation chose to "not generate any of these signals,
+   except as a result of explicit calls to the raise function", which is
+   allowed by the standard but of course does nothing for the usefulness of
+   <signal.h>.
+
+   A useful signal handling would:
+   1) make signal() a system call that registers the signal handler with the OS
+   2) make raise() a system call triggering an OS signal to the running process
+   3) make provisions that further signals of the same type are blocked until
+      the signal handler returns (optional for SIGILL)
+*/
+
+/* These are the values used by Linux. */
+
+/* Abnormal termination / abort() */
+#define SIGABRT 6
+/* Arithmetic exception / division by zero / overflow */
+#define SIGFPE  8
+/* Illegal instruction */
+#define SIGILL  4
+/* Interactive attention signal */
+#define SIGINT  2
+/* Invalid memory access */
+#define SIGSEGV 11
+/* Termination request */
+#define SIGTERM 15
+
+/* The following should be defined to pointer values that could NEVER point to
+   a valid signal handler function. (They are used as special arguments to
+   signal().) Again, these are the values used by Linux.
+*/
+#define SIG_DFL (void (*)( int ))0
+#define SIG_ERR (void (*)( int ))-1
+#define SIG_IGN (void (*)( int ))1
+
+typedef _PDCLIB_sig_atomic sig_atomic_t;
+
+/* Installs a signal handler "func" for the given signal.
+   A signal handler is a function that takes an integer as argument (the signal
+   number) and returns void.
+
+   Note that a signal handler can do very little else than:
+   1) assign a value to a static object of type "volatile sig_atomic_t",
+   2) call signal() with the value of sig equal to the signal received,
+   3) call _Exit(),
+   4) call abort().
+   Virtually everything else is undefind.
+
+   The signal() function returns the previous installed signal handler, which
+   at program start may be SIG_DFL or SIG_ILL. (This implementation uses
+   SIG_DFL for all handlers.) If the request cannot be honored, SIG_ERR is
+   returned and errno is set to an unspecified positive value.
+*/
+void (*signal( int sig, void (*func)( int ) ) )( int );
+
+/* Raises the given signal (executing the registered signal handler with the
+   given signal number as parameter).
+   This implementation does not prevent further signals of the same time from
+   occuring, but executes signal( sig, SIG_DFL ) before entering the signal
+   handler (i.e., a second signal before the signal handler re-registers itself
+   or SIG_IGN will end the program).
+   Returns zero if successful, nonzero otherwise. */
+int raise( int sig );
+
+#endif
+
diff --git a/platform/win32/internals/_PDCLIB_config.h b/platform/win32/internals/_PDCLIB_config.h
new file mode 100644 (file)
index 0000000..793065d
--- /dev/null
@@ -0,0 +1,467 @@
+#ifndef _PDCLIB_CONFIG_H
+#define _PDCLIB_CONFIG_H
+
+/* Internal PDCLib configuration <_PDCLIB_config.h>
+   (Win32 platform)
+
+   This file is part of the Public Domain C Library (PDCLib).
+   Permission is granted to use, modify, and / or redistribute at will.
+*/
+
+/* -------------------------------------------------------------------------- */
+/* Misc                                                                       */
+/* -------------------------------------------------------------------------- */
+
+/* The character (sequence) your platform uses as newline.                    */
+#define _PDCLIB_endl "\r\n"
+
+/* exit() can signal success to the host environment by the value of zero or  */
+/* the constant EXIT_SUCCESS. Failure is signaled by EXIT_FAILURE. Note that  */
+/* any other return value is "implementation-defined", i.e. your environment  */
+/* is not required to handle it gracefully. Set your definitions here.        */
+#define _PDCLIB_SUCCESS 0
+#define _PDCLIB_FAILURE -1
+
+/* qsort() in <stdlib.h> requires a function that swaps two memory areas.     */
+/* Below is a naive implementation that can be improved significantly for     */
+/* specific platforms, e.g. by swapping int instead of char.                  */
+#define _PDCLIB_memswp( i, j, size ) char tmp; do { tmp = *i; *i++ = *j; *j++ = tmp; } while ( --size );
+
+/* Define this to some compiler directive that can be written after the       */
+/* parameter list of a function declaration to indicate the function does     */
+/* never return. If your compiler does not support such a directive, define   */
+/* to nothing. (This is to avoid warnings with the exit functions under GCC.) */
+#define _PDCLIB_NORETURN __attribute__(( noreturn ))
+
+/* The maximum value that errno can be set to. This is used to set the size   */
+/* of the array in struct lconv (<locale.h>) holding error messages for the   */
+/* strerror() and perror() functions. (If you change this value because you   */
+/* are using additional errno values, you *HAVE* to provide appropriate error */
+/* messages for *ALL* locales.)                                               */
+/* Default is 4 (0, ERANGE, EDOM, EILSEQ).                                    */
+#define _PDCLIB_ERRNO_MAX 4
+
+/* -------------------------------------------------------------------------- */
+/* Integers                                                                   */
+/* -------------------------------------------------------------------------- */
+/* Assuming 8-bit char, two's-complement architecture here. 'short' being     */
+/* 16 bit, 'int' being either 16, 32 or 64 bit, 'long' being either 32 or 64  */
+/* bit (but 64 bit only if 'int' is 32 bit), and 'long long' being 64 bit if  */
+/* 'long' is not, 64 or 128 bit otherwise.                                    */
+/* Author is quite willing to support other systems but would like to hear of */
+/* interest in such support and details on the to-be-supported architecture   */
+/* first, before going to lengths about it.                                   */
+/* -------------------------------------------------------------------------- */
+
+/* Comment out (or delete) the line below if your 'char' type is unsigned.    */
+#define _PDCLIB_CHAR_SIGNED 1
+
+/* Width of the integer types short, int, long, and long long, in bytes.      */
+/* SHRT == 2, INT >= SHRT, LONG >= INT >= 4, LLONG >= LONG - check your       */
+/* compiler manuals.                                                          */
+#define _PDCLIB_SHRT_BYTES  2
+#define _PDCLIB_INT_BYTES   4
+#define _PDCLIB_LONG_BYTES  4
+#define _PDCLIB_LLONG_BYTES 8
+
+/* <stdlib.h> defines the div() function family that allows taking quotient   */
+/* and remainder of an integer division in one operation. Many platforms      */
+/* support this in hardware / opcode, and the standard permits ordering of    */
+/* the return structure in any way to fit the hardware. That is why those     */
+/* structs can be configured here.                                            */
+
+struct _PDCLIB_div_t
+{
+    int quot;
+    int rem;
+};
+
+struct _PDCLIB_ldiv_t
+{
+    long int quot;
+    long int rem;
+};
+
+struct _PDCLIB_lldiv_t
+{
+    long long int quot;
+    long long int rem;
+};
+
+/* -------------------------------------------------------------------------- */
+/* <stdint.h> defines a set of integer types that are of a minimum width, and */
+/* "usually fastest" on the system. (If, for example, accessing a single char */
+/* requires the CPU to access a complete int and then mask out the char, the  */
+/* "usually fastest" type of at least 8 bits would be int, not char.)         */
+/* If you do not have information on the relative performance of the types,   */
+/* the standard allows you to define any type that meets minimum width and    */
+/* signedness requirements.                                                   */
+/* The defines below are just configuration for the real typedefs and limit   */
+/* definitions done in <_PDCLIB_int.h>. The uppercase define shall be either  */
+/* SHRT, INT, LONG, or LLONG (telling which values to use for the *_MIN and   */
+/* *_MAX limits); the lowercase define either short, int, long, or long long  */
+/* (telling the actual type to use).                                          */
+/* The third define is the length modifier used for the type in printf() and  */
+/* scanf() functions (used in <inttypes.h>).                                  */
+/* If you require a non-standard datatype to define the "usually fastest"     */
+/* types, PDCLib as-is doesn't support that. Please contact the author with   */
+/* details on your platform in that case, so support can be added.            */
+/* -------------------------------------------------------------------------- */
+
+#define _PDCLIB_FAST8 INT
+#define _PDCLIB_fast8 int
+#define _PDCLIB_FAST8_CONV
+
+#define _PDCLIB_FAST16 INT
+#define _PDCLIB_fast16 int
+#define _PDCLIB_FAST16_CONV
+
+#define _PDCLIB_FAST32 INT
+#define _PDCLIB_fast32 int
+#define _PDCLIB_FAST32_CONV
+
+#define _PDCLIB_FAST64 LLONG
+#define _PDCLIB_fast64 long long
+#define _PDCLIB_FAST64_CONV ll
+
+/* -------------------------------------------------------------------------- */
+/* What follows are a couple of "special" typedefs and their limits. Again,   */
+/* the actual definition of the limits is done in <_PDCLIB_int.h>, and the    */
+/* defines here are merely "configuration". See above for details.            */
+/* -------------------------------------------------------------------------- */
+
+/* The result type of substracting two pointers */
+#if defined(__amd64__) || defined(_M_AMD64)
+  #define _PDCLIB_ptrdiff long long
+  #define _PDCLIB_PTRDIFF LLONG
+  #define _PDCLIB_PTR_CONV ll
+#else
+  #define _PDCLIB_ptrdiff int
+  #define _PDCLIB_PTRDIFF INT
+  #define _PDCLIB_PTR_CONV
+#endif
+
+/* An integer type that can be accessed as atomic entity (think asynchronous
+   interrupts). The type itself is not defined in a freestanding environment,
+   but its limits are. (Don't ask.)
+*/
+#define _PDCLIB_sig_atomic int
+#define _PDCLIB_SIG_ATOMIC INT
+
+/* Result type of the 'sizeof' operator (must be unsigned) */
+#if defined(__amd64__) || defined(_M_AMD64)
+  #define _PDCLIB_size unsigned long long
+  #define _PDCLIB_SIZE ULLONG
+#else
+  #define _PDCLIB_size unsigned int
+  #define _PDCLIB_SIZE UINT
+#endif
+
+/* Large enough an integer to hold all character codes of the largest supported
+   locale.
+
+   XX: Windows requires wchar_t be an unsigned short, but this is not compliant.
+*/
+#define _PDCLIB_wchar unsigned short 
+#define _PDCLIB_WCHAR USHRT
+
+#if defined(__amd64__) || defined(_M_AMD64)
+  #define _PDCLIB_intptr long long
+  #define _PDCLIB_INTPTR LLONG
+#else
+  #define _PDCLIB_intptr int
+  #define _PDCLIB_INTPTR INT
+#endif
+
+/* Largest supported integer type. Implementation note: see _PDCLIB_atomax(). */
+#define _PDCLIB_intmax long long int
+#define _PDCLIB_INTMAX LLONG
+#define _PDCLIB_MAX_CONV ll
+/* You are also required to state the literal suffix for the intmax type      */
+#define _PDCLIB_INTMAX_LITERAL ll
+
+/* <inttypes.h> defines imaxdiv(), which is equivalent to the div() function  */
+/* family (see further above) with intmax_t as basis.                         */
+
+struct _PDCLIB_imaxdiv_t
+{
+    _PDCLIB_intmax quot;
+    _PDCLIB_intmax rem;
+};
+
+/* <time.h>: time_t 
+ * The C standard doesn't define what representation of time is stored in 
+ * time_t when returned by time() , but POSIX defines it to be seconds since the
+ * UNIX epoch and most appplications expect that. 
+ *
+ * time_t is also used as the tv_sec member of struct timespec, which *is* 
+ * defined as a linear count of seconds.
+ *
+ * time_t is defined as a "real type", so may be a floating point type, but with
+ * the presence of the nanosecond accurate struct timespec, and with the lack of
+ * any functions for manipulating more accurate values of time_t, this is 
+ * probably not useful.
+ */
+#define _PDCLIB_time  unsigned long long
+
+/* <time.h>: clock_t
+ *
+ * A count of "clock ticks", where the length of a clock tick is unspecified by
+ * the standard. The implementation is required to provide a macro, 
+ * CLOCKS_PER_SEC, which is the number of "clock ticks" which corresponds to one
+ * second.
+ *
+ * clock_t may be any real type (i.e. integral or floating), and its type on
+ * various systems differs. 
+ *
+ * On XSI systems, CLOCKS_PER_SEC must be defined to 1000000
+ */
+#define _PDCLIB_clock double
+#define _PDCLIB_CLOCKS_PER_SEC 1000000
+
+/* -------------------------------------------------------------------------- */
+/* Floating Point                                                             */
+/* -------------------------------------------------------------------------- */
+
+/* Whether the implementation rounds toward zero (0), to nearest (1), toward
+   positive infinity (2), or toward negative infinity (3). (-1) signifies
+   indeterminable rounding, any other value implementation-specific rounding.
+*/
+#define _PDCLIB_FLT_ROUNDS -1
+
+/* Whether the implementation uses exact-width precision (0), promotes float
+   to double (1), or promotes float and double to long double (2). (-1)
+   signifies indeterminable behaviour, any other value implementation-specific
+   behaviour.
+*/
+#define _PDCLIB_FLT_EVAL_METHOD -1
+
+/* "Number of the decimal digits (n), such that any floating-point number in the
+   widest supported floating type with p(max) radix (b) digits can be rounded to
+   a floating-point number with (n) decimal digits and back again without change
+   to the value p(max) log(10)b if (b) is a power of 10, [1 + p(max) log(10)b]
+   otherwise."
+   64bit IEC 60559 double format (53bit mantissa) is DECIMAL_DIG 17.
+   80bit IEC 60559 double-extended format (64bit mantissa) is DECIMAL_DIG 21.
+*/
+#define _PDCLIB_DECIMAL_DIG 17
+
+/* -------------------------------------------------------------------------- */
+/* Platform-dependent macros defined by the standard headers.                 */
+/* -------------------------------------------------------------------------- */
+
+/* The offsetof macro
+   Contract: Expand to an integer constant expression of type size_t, which
+   represents the offset in bytes to the structure member from the beginning
+   of the structure. If the specified member is a bitfield, behaviour is
+   undefined.
+   There is no standard-compliant way to do this.
+   This implementation casts an integer zero to 'pointer to type', and then
+   takes the address of member. This is undefined behaviour but should work on
+   most compilers.
+*/
+#ifdef __GNUC__
+  #define _PDCLIB_offsetof( type, member ) __builtin_offsetof( type, member )
+#else
+  #define _PDCLIB_offsetof( type, member ) ( (size_t) &( ( (type *) 0 )->member ) )
+#endif
+
+/* Variable Length Parameter List Handling (<stdarg.h>)
+   The macros defined by <stdarg.h> are highly dependent on the calling
+   conventions used, and you probably have to replace them with builtins of
+   your compiler.
+*/
+
+#ifdef __GNUC__
+  typedef char * _PDCLIB_va_list;
+  #define _PDCLIB_va_arg( ap, type ) __builtin_va_arg( ap, type )
+  #define _PDCLIB_va_copy( dest, src ) __builtin_va_copy( dest, src)
+  #define _PDCLIB_va_end( ap ) __builtin_va_end( ap ) 
+  #define _PDCLIB_va_start( ap, parmN ) __builtin_va_start( ap, parmN )
+#else
+  #error Compiler support please
+#endif
+
+/* -------------------------------------------------------------------------- */
+/* OS "glue", part 1                                                          */
+/* These are values and data type definitions that you would have to adapt to */
+/* the capabilities and requirements of your OS.                              */
+/* The actual *functions* of the OS interface are declared in _PDCLIB_glue.h. */
+/* -------------------------------------------------------------------------- */
+
+/* Memory management -------------------------------------------------------- */
+
+/* Set this to the page size of your OS. If your OS does not support paging, set
+   to an appropriate value. (Too small, and malloc() will call the kernel too
+   often. Too large, and you will waste memory.)
+*/
+#define _PDCLIB_MALLOC_PAGESIZE 4096
+#define _PDCLIB_MALLOC_ALIGN 16
+#define _PDCLIB_MALLOC_GRANULARITY 64*1024
+#define _PDCLIB_MALLOC_TRIM_THRESHOLD 2*1024*1024
+#define _PDCLIB_MALLOC_MMAP_THRESHOLD 256*1024
+#define _PDCLIB_MALLOC_RELEASE_CHECK_RATE 4095
+
+/* TODO: Better document these */
+
+/* I/O ---------------------------------------------------------------------- */
+
+/* The type of the file descriptor returned by _PDCLIB_open(). */
+typedef void * _PDCLIB_fd_t;
+
+/* The value (of type _PDCLIB_fd_t) returned by _PDCLIB_open() if the operation
+   failed.
+*/
+#define _PDCLIB_NOHANDLE NULL
+
+/* The default size for file buffers. Must be at least 256. */
+#define _PDCLIB_BUFSIZ 1024
+
+/* The minimum number of files the implementation can open simultaneously. Must
+   be at least 8. Depends largely on how the bookkeeping is done by fopen() /
+   freopen() / fclose(). The example implementation limits the number of open
+   files only by available memory.
+*/
+#define _PDCLIB_FOPEN_MAX 8
+
+/* Length of the longest filename the implementation guarantees to support. */
+#define _PDCLIB_FILENAME_MAX 128
+
+/* Maximum length of filenames generated by tmpnam(). (See tmpfile.c.) */
+#define _PDCLIB_L_tmpnam 46
+
+/* Number of distinct file names that can be generated by tmpnam(). */
+#define _PDCLIB_TMP_MAX 50
+
+/* The values of SEEK_SET, SEEK_CUR and SEEK_END, used by fseek().
+   Since at least one platform (POSIX) uses the same symbols for its own "seek"
+   function, we use whatever the host defines (if it does define them).
+*/
+#define _PDCLIB_SEEK_SET 0
+#define _PDCLIB_SEEK_CUR 1
+#define _PDCLIB_SEEK_END 2
+
+/* The number of characters that can be buffered with ungetc(). The standard
+   guarantees only one (1); anything larger would make applications relying on
+   this capability dependent on implementation-defined behaviour (not good).
+*/
+#define _PDCLIB_UNGETCBUFSIZE 1
+
+/* errno -------------------------------------------------------------------- */
+
+/* These are the values that _PDCLIB_errno can be set to by the library.
+
+   By keeping PDCLib's errno in the _PDCLIB_* namespace, the library is capable
+   to "translate" between errno values used by the hosting operating system and
+   those used and passed out by the library.
+
+   Example: In the example platform, the remove() function uses the unlink()
+   system call as backend. Linux sets its errno to EISDIR if you try to unlink()
+   a directory, but POSIX demands EPERM. Within the remove() function, you can
+   catch the 'errno == EISDIR', and set '_PDCLIB_errno = _PDCLIB_EPERM'. Anyone
+   using PDCLib's <errno.h> will "see" EPERM instead of EISDIR (the _PDCLIB_*
+   prefix removed by <errno.h> mechanics).
+
+   If you do not want that kind of translation, you might want to "match" the
+   values used by PDCLib with those used by the host OS, as to avoid confusion.
+
+   The C standard only defines three distinct errno values: ERANGE, EDOM, and
+   EILSEQ. The standard leaves it up to "the implementation" whether there are
+   any more beyond those three. There is some controversy as to whether errno is
+   such a good idea at all, so you might want to come up with a different error
+   reporting facility for your platform. 
+
+   Things used to say "Since errno values beyond the three defined by the 
+   standard are not portable anyway (unless you look at POSIX), having your own
+   error reporting facility would not hurt anybody either." at this point. 
+   However, then somebody birthed C++11 into the world, which copied POSIX's 
+   errno values into C++. Yes, even EINTR. Therefore, this library defines 
+   them. That said, thats nothing stopping you from using your own error 
+   reporting facility for things outside the C library.
+
+   Sometimes the standard says to set errno to indicate an error, but does not 
+   prescribe a value. We will use a value from the following list. If POSIX 
+   defines a value, we use that; otherwise, we use as seems suitable.
+
+   If porting to a system which uses an errno-like reporting system (e.g. a 
+   UNIX), you'll probably want to define them to match what the OS uses
+*/
+/* C errno values */
+#define _PDCLIB_ERANGE 1
+#define _PDCLIB_EDOM   2
+#define _PDCLIB_EILSEQ 3
+
+/* C++11/POSIX errno values */
+#define _PDCLIB_E2BIG 4
+#define _PDCLIB_ECONNRESET 5
+#define _PDCLIB_EISCONN 6
+#define _PDCLIB_ENOENT 7
+#define _PDCLIB_ENOTRECOVERABLE 8
+#define _PDCLIB_EROFS 9
+#define _PDCLIB_EACCES 10
+#define _PDCLIB_EDEADLK 11
+#define _PDCLIB_EISDIR 12
+#define _PDCLIB_ENOEXEC 13
+#define _PDCLIB_ENOTSOCK 14
+#define _PDCLIB_ESPIPE 15
+#define _PDCLIB_EADDRINUSE 16
+#define _PDCLIB_EDESTADDRREQ 17
+#define _PDCLIB_ELOOP 18
+#define _PDCLIB_ENOLCK 19
+#define _PDCLIB_ENOTSUPP 20
+#define _PDCLIB_ESRCH 21
+#define _PDCLIB_EADDRNOTAVAIL 22
+#define _PDCLIB_EMFILE 23
+#define _PDCLIB_ENOLINK 24
+#define _PDCLIB_ENOTTY 25
+#define _PDCLIB_ETIME 26
+#define _PDCLIB_EAFNOSUPPORT 27
+#define _PDCLIB_EEXIST 28
+#define _PDCLIB_EMLINK 29
+#define _PDCLIB_ENOMEM 30
+#define _PDCLIB_ENXIO 31
+#define _PDCLIB_ETIMEDOUT 32
+#define _PDCLIB_EAGAIN 33
+#define _PDCLIB_EFAULT 34
+#define _PDCLIB_EMSGSIZE 35
+#define _PDCLIB_ENOMSG 36
+#define _PDCLIB_EOPNOTSUPP 37
+#define _PDCLIB_ETXTBSY 38
+#define _PDCLIB_EALREADY 39
+#define _PDCLIB_EFBIG 40
+#define _PDCLIB_ENAMETOOLONG 41
+#define _PDCLIB_ENOPROTOOPT 42
+#define _PDCLIB_EOVERFLOW 43
+#define _PDCLIB_EWOULDBLOCK _PDCLIB_EAGAIN
+#define _PDCLIB_EBADF 44
+#define _PDCLIB_EHOSTUNREACH 45
+#define _PDCLIB_ENETDOWN 46
+#define _PDCLIB_ENOSPC 47
+#define _PDCLIB_EOWNERDEAD 48
+#define _PDCLIB_EXDEV 49
+#define _PDCLIB_EBADMSG 50
+#define _PDCLIB_EIDRM 51
+#define _PDCLIB_ENETRESET 52
+#define _PDCLIB_ENOSR 53
+#define _PDCLIB_EPERM 54
+#define _PDCLIB_EBUSY 55
+#define _PDCLIB_ENETUNREACH 56
+#define _PDCLIB_ENOSTR 57
+#define _PDCLIB_EPIPE 58
+#define _PDCLIB_ECANCELED 59
+#define _PDCLIB_EINPROGRESS 60
+#define _PDCLIB_ENFILE 61
+#define _PDCLIB_ENOSYS 62
+#define _PDCLIB_EPROTO 63
+#define _PDCLIB_ECHILD 64
+#define _PDCLIB_EINTR 65
+#define _PDCLIB_ENOBUFS 66
+#define _PDCLIB_ENOTCONN 67
+#define _PDCLIB_EPROTONOSUPPORT 68
+#define _PDCLIB_ECONNABORTED 69
+#define _PDCLIB_EINVAL 70
+#define _PDCLIB_ENODATA 71
+#define _PDCLIB_ENOTDIR 72
+#define _PDCLIB_EPROTOTYPE 73
+
+#endif