diff options
246 files changed, 52542 insertions, 0 deletions
diff --git a/win32/contrib/dirent/dirent.c b/win32/contrib/dirent/dirent.c new file mode 100644 index 000000000..8249b60ce --- /dev/null +++ b/win32/contrib/dirent/dirent.c @@ -0,0 +1,135 @@ +/*
+
+ Implementation of POSIX directory browsing functions and types for Win32.
+
+ Kevlin Henney (mailto:kevlin@acm.org), March 1997.
+
+ Copyright Kevlin Henney, 1997. All rights reserved.
+
+ Permission to use, copy, modify, and distribute this software and its
+ documentation for any purpose is hereby granted without fee, provided
+ that this copyright and permissions notice appear in all copies and
+ derivatives, and that no charge may be made for the software and its
+ documentation except to cover cost of distribution.
+
+ This software is supplied "as is" without express or implied warranty.
+
+ But that said, if there are any problems please get in touch.
+
+*/
+
+#include <dirent.h>
+#include <errno.h>
+#include <io.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef DIR
+
+struct DIR
+{
+ long handle; /* -1 for failed rewind */
+ struct _finddata_t info;
+ struct dirent result; /* d_name null iff first time */
+ char *name; /* NTBS */
+};
+
+#endif
+
+DIR *opendir(const char *name)
+{
+ DIR *dir = 0;
+
+ if(name && name[0])
+ {
+ size_t base_length = strlen(name);
+ const char *all = /* the root directory is a special case... */
+ strchr("/\\", name[base_length - 1]) ? "*" : "/*";
+
+ if((dir = (DIR *) malloc(sizeof *dir)) != 0 &&
+ (dir->name = (char *) malloc(base_length + strlen(all) + 1)) != 0)
+ {
+ strcat(strcpy(dir->name, name), all);
+
+ if((dir->handle = _findfirst(dir->name, &dir->info)) != -1)
+ {
+ dir->result.d_name = 0;
+ }
+ else /* rollback */
+ {
+ free(dir->name);
+ free(dir);
+ dir = 0;
+ }
+ }
+ else /* rollback */
+ {
+ free(dir);
+ dir = 0;
+ errno = ENOMEM;
+ }
+ }
+ else
+ {
+ errno = EINVAL;
+ }
+
+ return dir;
+}
+
+int closedir(DIR *dir)
+{
+ int result = -1;
+
+ if(dir)
+ {
+ if(dir->handle != -1)
+ {
+ result = _findclose(dir->handle);
+ }
+
+ free(dir->name);
+ free(dir);
+ }
+
+ if(result == -1) /* map all errors to EBADF */
+ {
+ errno = EBADF;
+ }
+
+ return result;
+}
+
+struct dirent *readdir(DIR *dir)
+{
+ struct dirent *result = 0;
+
+ if(dir && dir->handle != -1)
+ {
+ if(!dir->result.d_name || _findnext(dir->handle, &dir->info) != -1)
+ {
+ result = &dir->result;
+ result->d_name = dir->info.name;
+ }
+ }
+ else
+ {
+ errno = EBADF;
+ }
+
+ return result;
+}
+
+void rewinddir(DIR *dir)
+{
+ if(dir && dir->handle != -1)
+ {
+ _findclose(dir->handle);
+ dir->handle = _findfirst(dir->name, &dir->info);
+ dir->result.d_name = 0;
+ }
+ else
+ {
+ errno = EBADF;
+ }
+}
diff --git a/win32/contrib/dirent/dirent.h b/win32/contrib/dirent/dirent.h new file mode 100644 index 000000000..588048c67 --- /dev/null +++ b/win32/contrib/dirent/dirent.h @@ -0,0 +1,32 @@ +/*
+
+ Declaration of POSIX directory browsing functions and types for Win32.
+
+ Kevlin Henney (mailto:kevlin@acm.org), March 1997.
+
+ Copyright Kevlin Henney, 1997. All rights reserved.
+
+ Permission to use, copy, modify, and distribute this software and its
+ documentation for any purpose is hereby granted without fee, provided
+ that this copyright and permissions notice appear in all copies and
+ derivatives, and that no charge may be made for the software and its
+ documentation except to cover cost of distribution.
+
+*/
+
+#ifndef DIRENT_INCLUDED
+#define DIRENT_INCLUDED
+
+typedef struct DIR DIR;
+
+struct dirent
+{
+ char *d_name;
+};
+
+DIR *opendir(const char *);
+int closedir(DIR *);
+struct dirent *readdir(DIR *);
+void rewinddir(DIR *);
+
+#endif
diff --git a/win32/contrib/pthreads/ANNOUNCE b/win32/contrib/pthreads/ANNOUNCE new file mode 100644 index 000000000..dc80c680b --- /dev/null +++ b/win32/contrib/pthreads/ANNOUNCE @@ -0,0 +1,525 @@ + PTHREADS-WIN32 SNAPSHOT 2001-07-12
+ ----------------------------------
+ Web Site: http://sources.redhat.com/pthreads-win32/
+ FTP Site: ftp://sources.redhat.com/pub/pthreads-win32
+ Coordinator: Ross Johnson <rpj@ise.canberra.edu.au>
+
+
+We are pleased to announce the availability of a new snapshot of
+Pthreads-win32, an Open Source Software implementation of the
+Threads component of the POSIX 1003.1c 1995 Standard for Microsoft's
+Win32 environment. Some functions from POSIX 1003.1b are also
+supported including semaphores. Other related functions include
+the set of read-write lock functions.
+
+Parts of the implementation also comply with the Open Group's
+Single Unix specification for compatibility with major Unix
+implementations and Linux.
+
+Pthreads-win32 is free software, distributed under the GNU Library
+General Public License (LGPL).
+
+Please see the 'Acknowledgements' section at the end of this
+announcement for the list of contributors.
+
+
+Changes since the last snapshot
+-------------------------------
+
+----------------------------------
+New: Spin locks (beta level code)
+----------------------------------
+These are part of POSIX 1003.1j.
+
+ #define _POSIX_SPIN_LOCKS
+ pthread_spin_init()
+ pthread_spin_destroy()
+ pthread_spin_lock()
+ pthread_spin_unlock()
+ pthread_spin_trylock()
+ PTHREAD_SPINLOCK_INITIALIZER
+
+Spin_lock spins (busy-waits) if more than one processor is available
+to the process, othewise it is equivalent to a POSIX_MUTEX_DEFAULT
+mutex. The spinlock routines do minimal error checking.
+
+--------------------------------
+New: Barriers (beta level code)
+--------------------------------
+These are part of POSIX 1003.1j.
+
+ #define _POSIX_BARRIERS
+ pthread_barrier_init()
+ pthread_barrier_destroy()
+ pthread_barrier_wait()
+ pthread_barrierattr_init()
+ pthread_barrierattr_destroy()
+ pthread_barrierattr_getpshared()
+ pthread_barrierattr_setpshared()
+
+---------
+Bug fixes
+---------
+In pthread_mutex_lock, return the error if an
+auto-initialiser initialisation fails.
+
+_POSIX_READER_WRITER_LOCKS is now defined.
+
+pthread_rwlock_wrlock() was a cancelation point.
+
+---------------------------
+Known bugs in this snapshot
+---------------------------
+
+1. Under MS VC++ (only tested with version 6.0), a term_func
+ set via the standard C++ set_terminate() function is not called
+ for some reason. The code in private.c ptw32_threadStart()
+ retrieves and calls the user supplied terminate routine, which
+ works as expected under MinGW32 g++, but doesn't run under
+ MS VC++ 6.0, presumably because set_terminate() returns NULL.
+
+2. Cancellation problems in optimised code
+ - Milan Gardian
+
+ The cancellation (actually, cleanup-after-cancel) tests fail when using VC
+ (professional) optimisation switches (/O1 or /O2) in pthreads library. I
+ have not investigated which concrete optimisation technique causes this
+ problem (/Og, /Oi, /Ot, /Oy, /Ob1, /Gs, /Gf, /Gy, etc.), but here is a
+ summary of builds and corresponding failures:
+
+ * pthreads VSE (optimised tests): OK
+ * pthreads VCE (optimised tests): Failed "cleanup1" test (runtime)
+
+ * pthreads VSE (DLL in CRT, optimised tests): OK
+ * pthreads VCE (DLL in CRT, optimised tests): Failed "cleanup1" test
+ (runtime)
+
+ Please note that while in VSE version of the pthreads library the
+ optimisation does not really have any impact on the tests (they pass OK), in
+ VCE version addition of optimisation (/O2 in this case) causes the tests to
+ fail uniformly - either in "cleanup0" or "cleanup1" test cases.
+
+ Please note that all the tests above use default pthreads DLL (no
+ optimisations, linked with either static or DLL CRT, based on test type).
+ Therefore the problem lies not within the pthreads DLL but within the
+ compiled client code (the application using pthreads -> involvement of
+ "pthread.h").
+
+ I think the message of this section is that usage of VCE version of pthreads
+ in applications relying on cancellation/cleanup AND using optimisations for
+ creation of production code is highly unreliable for the current version of
+ the pthreads library.
+
+
+Caveats
+-------
+
+1. Due to what is believed to be a C++ compliance error in VC++,
+if your application contains catch(...) blocks in your POSIX threads
+then you will need to replace the "catch(...)" with the macro
+"PtW32Catch", eg.
+
+ #ifdef PtW32Catch
+ PtW32Catch {
+ ...
+ }
+ #else
+ catch(...) {
+ ...
+ }
+ #endif
+
+Otherwise neither pthreads cancelation nor pthread_exit() will work
+reliably.
+
+
+Level of standards conformance
+------------------------------
+
+The following POSIX 1003.1c/1b/1j options are defined:
+
+ _POSIX_THREADS
+ _POSIX_THREAD_SAFE_FUNCTIONS
+ _POSIX_THREAD_ATTR_STACKSIZE
+ _POSIX_THREAD_PRIORITY_SCHEDULING
+ _POSIX_SEMAPHORES
+ _POSIX_READER_WRITER_LOCKS
+ _POSIX_SPIN_LOCKS
+ _POSIX_BARRIERS
+
+
+The following POSIX 1003.1c options are not defined:
+
+ _POSIX_THREAD_ATTR_STACKADDR
+ _POSIX_THREAD_PRIO_INHERIT
+ _POSIX_THREAD_PRIO_PROTECT
+ _POSIX_THREAD_PROCESS_SHARED
+
+
+The following functions are implemented:
+
+ ---------------------------
+ PThreads
+ ---------------------------
+ pthread_attr_init
+ pthread_attr_destroy
+ pthread_attr_getdetachstate
+ pthread_attr_getstackaddr
+ pthread_attr_getstacksize
+ pthread_attr_setdetachstate
+ pthread_attr_setstackaddr
+ pthread_attr_setstacksize
+
+ pthread_create
+ pthread_detach
+ pthread_equal
+ pthread_exit
+ pthread_join
+ pthread_once
+ pthread_self
+
+ pthread_cancel
+ pthread_cleanup_pop
+ pthread_cleanup_push
+ pthread_setcancelstate
+ pthread_setcanceltype
+ pthread_testcancel
+
+ ---------------------------
+ Thread Specific Data
+ ---------------------------
+ pthread_key_create
+ pthread_key_delete
+ pthread_setspecific
+ pthread_getspecific
+
+ ---------------------------
+ Mutexes
+ ---------------------------
+ pthread_mutexattr_init
+ pthread_mutexattr_destroy
+ pthread_mutexattr_getpshared
+ pthread_mutexattr_setpshared
+ pthread_mutexattr_gettype
+ pthread_mutexattr_settype (types: PTHREAD_MUTEX_DEFAULT
+ PTHREAD_MUTEX_NORMAL
+ PTHREAD_MUTEX_ERRORCHECK
+ PTHREAD_MUTEX_RECURSIVE )
+ pthread_mutex_init
+ pthread_mutex_destroy
+ pthread_mutex_lock
+ pthread_mutex_trylock
+ pthread_mutex_unlock
+
+ ---------------------------
+ Condition Variables
+ ---------------------------
+ pthread_condattr_init
+ pthread_condattr_destroy
+ pthread_condattr_getpshared
+ pthread_condattr_setpshared
+
+ pthread_cond_init
+ pthread_cond_destroy
+ pthread_cond_wait
+ pthread_cond_timedwait
+ pthread_cond_signal
+ pthread_cond_broadcast
+
+ ---------------------------
+ Read/Write Locks - POSIX 1j
+ ---------------------------
+ pthread_rwlock_init
+ pthread_rwlock_destroy
+ pthread_rwlock_tryrdlock
+ pthread_rwlock_trywrlock
+ pthread_rwlock_rdlock
+ pthread_rwlock_rwlock
+ pthread_rwlock_unlock
+
+ ---------------------------
+ Spin Locks - POSIX 1j
+ ---------------------------
+ pthread_spin_init
+ pthread_spin_destroy
+ pthread_spin_lock
+ pthread_spin_unlock
+ pthread_spin_trylock
+
+ ---------------------------
+ Barriers - POSIX 1j
+ ---------------------------
+ pthread_barrier_init
+ pthread_barrier_destroy
+ pthread_barrier_wait
+ pthread_barrierattr_init
+ pthread_barrierattr_destroy
+ pthread_barrierattr_getpshared
+ pthread_barrierattr_setpshared
+
+ ---------------------------
+ Semaphores - POSIX 1b
+ ---------------------------
+ sem_init
+ sem_destroy
+ sem_post
+ sem_wait
+ sem_trywait
+ sem_open (returns an error ENOSYS)
+ sem_close (returns an error ENOSYS)
+ sem_unlink (returns an error ENOSYS)
+ sem_getvalue (returns an error ENOSYS)
+
+ ---------------------------
+ RealTime Scheduling
+ ---------------------------
+ pthread_attr_getschedparam
+ pthread_attr_setschedparam
+ pthread_attr_getinheritsched
+ pthread_attr_setinheritsched
+ pthread_attr_getschedpolicy (only supports SCHED_OTHER)
+ pthread_attr_setschedpolicy (only supports SCHED_OTHER)
+ pthread_getschedparam
+ pthread_setschedparam
+ pthread_getconcurrency
+ pthread_setconcurrency
+ pthread_attr_getscope (returns an error ENOSYS)
+ pthread_attr_setscope (returns an error ENOSYS)
+ sched_get_priority_max (POSIX 1b)
+ sched_get_priority_min (POSIX 1b)
+ sched_rr_get_interval (POSIX 1b - returns an error ENOTSUP)
+ sched_setscheduler (POSIX 1b - only supports SCHED_OTHER)
+ sched_getscheduler (POSIX 1b - only supports SCHED_OTHER)
+ sched_yield (POSIX 1b)
+
+ ---------------------------
+ Signals
+ ---------------------------
+ pthread_sigmask
+
+ ---------------------------
+ Non-portable routines (see the README.NONPORTABLE file for usage)
+ ---------------------------
+ pthread_getw32threadhandle_np
+ pthread_delay_np
+ pthread_mutexattr_getkind_np
+ pthread_mutexattr_setkind_np (types: PTHREAD_MUTEX_FAST_NP,
+ PTHREAD_MUTEX_ERRORCHECK_NP,
+ PTHREAD_MUTEX_RECURSIVE_NP)
+ pthread_win32_process_attach_np
+ pthread_win32_process_detach_np
+ pthread_win32_thread_attach_np
+ pthread_win32_thread_detach_np
+
+ ---------------------------
+ Static Initializers
+ ---------------------------
+ PTHREAD_ONCE_INIT
+ PTHREAD_MUTEX_INITIALIZER
+ PTHREAD_COND_INITIALIZER
+ PTHREAD_RWLOCK_INITIALIZER
+ PTHREAD_SPINLOCK_INITIALIZER
+
+ ---------------------------
+ Thread-Safe C Runtime Library (macros)
+ ---------------------------
+ strtok_r
+ asctime_r
+ ctime_r
+ gmtime_r
+ localtime_r
+ rand_r
+
+
+The following functions are not implemented:
+
+ ---------------------------
+ RealTime Scheduling
+ ---------------------------
+ pthread_mutex_getprioceiling
+ pthread_mutex_setprioceiling
+ pthread_mutex_attr_getprioceiling
+ pthread_mutex_attr_getprotocol
+ pthread_mutex_attr_setprioceiling
+ pthread_mutex_attr_setprotocol
+
+ ---------------------------
+ Fork Handlers
+ ---------------------------
+ pthread_atfork
+
+ ---------------------------
+ Stdio
+ ---------------------------
+ flockfile
+ ftrylockfile
+ funlockfile
+ getc_unlocked
+ getchar_unlocked
+ putc_unlocked
+ putchar_unlocked
+
+ ---------------------------
+ Thread-Safe C Runtime Library
+ ---------------------------
+ readdir_r
+ getgrgid_r
+ getgrnam_r
+ getpwuid_r
+ getpwnam_r
+
+ ---------------------------
+ Signals
+ ---------------------------
+ pthread_kill
+ sigtimedwait
+ sigwait
+ sigwaitinfo
+
+
+The library includes two non-API functions for creating cancellation
+points in applications and libraries:
+
+ pthreadCancelableWait
+ pthreadCancelableTimedWait
+
+
+Availability
+------------
+
+The prebuilt DLL, export libs (for both MSVC and Mingw32), and the header
+files (pthread.h, semaphore.h, sched.h) are available along with the
+complete source code.
+
+The source code can be found at:
+
+ ftp://sources.redhat.com/pub/pthreads-win32
+
+and as individual source code files at
+
+ ftp://sources.redhat.com/pub/pthreads-win32/source
+
+The pre-built DLL, export libraries and include files can be found at:
+
+ ftp://sources.redhat.com/pub/pthreads-win32/dll-latest
+
+
+
+Mailing List
+------------
+
+There is a mailing list for discussing pthreads on Win32. To join,
+send email to:
+
+ pthreads-win32-subscribe@sourceware.cygnus.com
+
+
+Application Development Environments
+------------------------------------
+
+See the README file for more information.
+
+MSVC:
+MSVC using SEH works. Distribute pthreadVSE.dll with your application.
+MSVC using C++ EH works. Distribute pthreadVCE.dll with your application.
+MSVC using C setjmp/longjmp works. Distribute pthreadVC.dll with your application.
+
+
+Mingw32:
+You need gcc-2.95.2-1 modified as per pthreads-win32 FAQ answer (6), with
+binutils-19990818-1 and msvcrt runtime-2000-03-27. Mingw32 must use
+the thread-safe MSVCRT library (see the FAQ). You need to distribute
+the gcc.dll DLL from Mingw32 with your application.
+
+Mingw using C++ EH works. Distribute pthreadGCE.dll with your application.
+Mingw using C setjmp/longjmp works. Distribute pthreadGC.dll with your application.
+
+
+Cygwin: (http://sourceware.cygnus.com/cygwin/)
+Cygwin aims to provide a complete POSIX environment on top of Win32, including
+threads. When this is complete, developers using Cygwin will not need
+pthreads-win32. At this time, Cygwin has preliminary support for multithreaded
+development, however, this is not turned on by default. We have not tested
+pthreads-win32 against Cygwin.
+
+
+UWIN:
+UWIN is a complete Unix-like environment for Windows from AT&T. Pthreads-win32
+doesn't currently support UWIN (and vice versa), but that may change in the
+future.
+
+Generally:
+For convenience, the following pre-built files are available on the FTP site
+(see Availability above):
+
+ pthread.h - for POSIX 1c threads
+ semaphore.h - for POSIX 1b semaphores
+ sched.h - for POSIX 1b scheduling
+ pthreadVCE.dll - built with MSVC++ compiler using C++ EH
+ pthreadVCE.lib
+ pthreadVC.dll - built with MSVC compiler using C setjmp/longjmp
+ pthreadVC.lib
+ pthreadVSE.dll - built with MSVC compiler using SEH
+ pthreadVSE.lib
+ pthreadGCE.dll - built with Mingw32 G++ 2.95.2-1
+ pthreadGC.dll - built with Mingw32 GCC 2.95.2-1 using setjmp/longjmp
+ libpthreadGCE.a - derived from pthreadGCE.dll
+ libpthreadGC.a - derived from pthreadGC.dll
+ gcc.dll - needed if distributing applications that use pthreadGCE.dll
+
+These are the only files you need in order to build POSIX threads
+applications for Win32 using either MSVC or Mingw32.
+
+See the FAQ file in the source tree for additional information.
+
+
+Documentation
+-------------
+
+Currently, there is no documentation included in the package apart
+from the copious comments in the source code.
+
+For POSIX Thread API programming, several reference books are
+available:
+
+ Programming with POSIX Threads
+ David R. Butenhof
+ Addison-Wesley (pub)
+
+ Pthreads Programming
+ By Bradford Nichols, Dick Buttlar & Jacqueline Proulx Farrell
+ O'Reilly (pub)
+
+On the web: see the links at the bottom of the pthreads-win32 site:
+
+ http://sources.redhat.com/pthreads-win32/
+
+
+Acknowledgements
+----------------
+
+This library is based substantially on a Win32 pthreads
+implementation contributed by John Bossom <John.Bossom@cognos.com>.
+
+The implementation of Condition Variables uses algorithms developed
+by Alexander Terekhov and Louis Thomas.
+
+The implementation of POSIX mutexes has been improved by Thomas Pfaff.
+
+The implementation of read/write locks was contributed by
+Aurelio Medina and improved by Alexander Terekhov.
+
+Many others have contributed significant time and effort to solve critical
+problems in order to make the library workable, robust and reliable.
+
+There is also a separate CONTRIBUTORS file. This file and others are
+on the web site:
+
+ http://sources.redhat.com/pthreads-win32
+
+As much as possible, the ChangeLog file acknowledges contributions to the
+code base in more detail.
+
+Enjoy!
+
+Ross Johnson
diff --git a/win32/contrib/pthreads/CONTRIBUTORS b/win32/contrib/pthreads/CONTRIBUTORS new file mode 100644 index 000000000..91cdb7373 --- /dev/null +++ b/win32/contrib/pthreads/CONTRIBUTORS @@ -0,0 +1,36 @@ +Contributors (in approximate order of appearance)
+
+[See also the ChangeLog file where individuals are
+attributed in log entries. Likewise in the FAQ file.]
+
+Ben Elliston bje@cygnus.com
+Ross Johnson rpj@ise.canberra.edu.au
+Robert Colquhoun rjc@trump.net.au
+John E. Bossom John.Bossom@cognos.com
+Anders Norlander anorland@hem2.passagen.se
+Tor Lillqvist tml@iki.fi
+Kevin Ruland Kevin.Ruland@anheuser-busch.com
+Mike Russo miker@eai.com
+Mark E. Armstrong avail@pacbell.net
+Lorin Hochstein lmh@xiphos.ca
+Peter Slacik Peter.Slacik@tatramed.sk
+Mumit Khan khan@xraylith.wisc.edu
+Aurelio Medina aureliom@crt.com
+Milan Gardian mg@tatramed.sk
+Graham Dumpleton Graham.Dumpleton@ra.pad.otc.telstra.com.au
+Tristan Savatier tristan@mpegtv.com
+Erik Hensema erik@hensema.xs4all.nl
+Rich Peters rpeters@micro-magic.com
+Todd Owen towen@lucidcalm.dropbear.id.au
+Jason Nye jnye@nbnet.nb.ca
+Fred Forester fforest@eticomm.net
+Kevin D. Clark kclark@cabletron.com
+David Baggett dmb.itasoftware.com
+Paul Redondo paul.matchvision.com
+Scott McCaskill scott.3dfx.om
+Thomas Pfaff tpfaff@gmx.net
+Franco Bez franco.bez@gmx.de
+Alexander Terekhov TEREKHOV@de.ibm.com
+Louis Thomas lthomas@arbitrade.com
+David Korn dgk@research.att.com
+
diff --git a/win32/contrib/pthreads/COPYING.LIB b/win32/contrib/pthreads/COPYING.LIB new file mode 100644 index 000000000..0eaebbf57 --- /dev/null +++ b/win32/contrib/pthreads/COPYING.LIB @@ -0,0 +1,482 @@ + GNU LIBRARY GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1991 Free Software Foundation, Inc.
+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the library GPL. It is
+ numbered 2 because it goes with version 2 of the ordinary GPL.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Library General Public License, applies to some
+specially designated Free Software Foundation software, and to any
+other libraries whose authors decide to use it. You can use it for
+your libraries, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if
+you distribute copies of the library, or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link a program with the library, you must provide
+complete object files to the recipients so that they can relink them
+with the library, after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ Our method of protecting your rights has two steps: (1) copyright
+the library, and (2) offer you this license which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ Also, for each distributor's protection, we want to make certain
+that everyone understands that there is no warranty for this free
+library. If the library is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original
+version, so that any problems introduced by others will not reflect on
+the original authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that companies distributing free
+software will individually obtain patent licenses, thus in effect
+transforming the program into proprietary software. To prevent this,
+we have made it clear that any patent must be licensed for everyone's
+free use or not licensed at all.
+
+ Most GNU software, including some libraries, is covered by the ordinary
+GNU General Public License, which was designed for utility programs. This
+license, the GNU Library General Public License, applies to certain
+designated libraries. This license is quite different from the ordinary
+one; be sure to read it in full, and don't assume that anything in it is
+the same as in the ordinary license.
+
+ The reason we have a separate public license for some libraries is that
+they blur the distinction we usually make between modifying or adding to a
+program and simply using it. Linking a program with a library, without
+changing the library, is in some sense simply using the library, and is
+analogous to running a utility program or application program. However, in
+a textual and legal sense, the linked executable is a combined work, a
+derivative of the original library, and the ordinary General Public License
+treats it as such.
+
+ Because of this blurred distinction, using the ordinary General
+Public License for libraries did not effectively promote software
+sharing, because most developers did not use the libraries. We
+concluded that weaker conditions might promote sharing better.
+
+ However, unrestricted linking of non-free programs would deprive the
+users of those programs of all benefit from the free status of the
+libraries themselves. This Library General Public License is intended to
+permit developers of non-free programs to use free libraries, while
+preserving your freedom as a user of such programs to change the free
+libraries that are incorporated in them. (We have not seen how to achieve
+this as regards changes in header files, but we have achieved it as regards
+changes in the actual functions of the Library.) The hope is that this
+will lead to faster development of free libraries.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, while the latter only
+works together with the library.
+
+ Note that it is possible for a library to be covered by the ordinary
+General Public License rather than by this special one.
+
+ GNU LIBRARY GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library which
+contains a notice placed by the copyright holder or other authorized
+party saying it may be distributed under the terms of this Library
+General Public License (also called "this License"). Each licensee is
+addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also compile or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ c) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ d) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the source code distributed need not include anything that is normally
+distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Library General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ Appendix: How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
diff --git a/win32/contrib/pthreads/ChangeLog b/win32/contrib/pthreads/ChangeLog new file mode 100644 index 000000000..5061a515c --- /dev/null +++ b/win32/contrib/pthreads/ChangeLog @@ -0,0 +1,3304 @@ +2001-07-10 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
+
+ * barrier.c: Still more revamping. The exclusive access
+ mutex isn't really needed so it has been removed and replaced
+ by an InterlockedDecrement(). nSerial has been removed.
+ iStep is now dual-purpose. The process shared attribute
+ is now stored in the barrier struct.
+ * implement.h (pthread_barrier_t_): Lost some/gained one
+ elements.
+ * private.c (ptw32_threadStart): Removed some comments.
+
+2001-07-10 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
+
+ * barrier.c: Revamped to fix the race condition. Two alternating
+ semaphores are used instead of the PulseEvent. Also improved
+ overall throughput by returning PTHREAD_BARRIER_SERIAL_THREAD
+ to the first waking thread.
+ * implement.h (pthread_barrier_t_): Revamped.
+
+2001-07-09 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
+
+ * barrier.c: Fix several bugs in all routines. Now passes
+ tests/barrier5.c which is fairly rigorous. There is still
+ a non-optimal work-around for a race condition between
+ the barrier breeched event signal and event wait. Basically
+ the last (signalling) thread to hit the barrier yields
+ to allow any other threads, which may have lost the race,
+ to complete.
+
+2001-07-07 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
+
+ * barrier.c: Changed synchronisation mechanism to a
+ Win32 manual reset Event and use PulseEvent to signal
+ waiting threads. If the implementation continued to use
+ a semaphore it would require a second semaphore and
+ some management to use them alternately as barriers. A
+ single semaphore allows threads to cascade from one barrier
+ through the next, leaving some threads blocked at the first.
+ * implement.h (pthread_barrier_t_): As per above.
+ * general: Made a number of other routines inlinable.
+
+2001-07-07 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
+
+ * spin.c: Revamped and working; included static initialiser.
+ Now beta level.
+ * barrier.c: Likewise.
+ * condvar.c: Macro constant change; inline auto init routine.
+ * mutex.c: Likewise.
+ * rwlock.c: Likewise.
+ * private.c: Add support for spinlock initialiser.
+ * global.c: Likewise.
+ * implement.h: Likewise.
+ * pthread.h (PTHREAD_SPINLOCK_INITIALIZER): Fix typo.
+
+2001-07-05 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
+
+ * barrier.c: Remove static initialisation - irrelevent
+ for this object.
+ * pthread.h (PTHREAD_BARRIER_INITIALIZER): Removed.
+ * rwlock.c (pthread_rwlock_wrlock): This routine is
+ not a cancelation point - disable deferred
+ cancelation around call to pthread_cond_wait().
+
+2001-07-05 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
+
+ * spin.c: New module implementing spin locks.
+ * barrier.c: New module implementing barriers.
+ * pthread.h (_POSIX_SPIN_LOCKS): defined.
+ (_POSIX_BARRIERS): Defined.
+ (pthread_spin_*): Defined.
+ (pthread_barrier*): Defined.
+ (PTHREAD_BARRIER_SERIAL_THREAD): Defined.
+ * implement.h (pthread_spinlock_t_): Defined.
+ (pthread_barrier_t_): Defined.
+ (pthread_barrierattr_t_): Defined.
+
+ * mutex.c (pthread_mutex_lock): Return with the error
+ if an auto-initialiser initialisation fails.
+
+ * nonportable.c (pthread_getprocessors_np): New; gets the
+ number of available processors for the current process.
+
+2001-07-03 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
+
+ * pthread.h (_POSIX_READER_WRITER_LOCKS): Define it
+ if not already defined.
+
+2001-07-01 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
+
+ Contributed by - Alexander Terekhov.
+
+ * condvar.c: Fixed lost signal bug reported by Timur Aydin
+ (taydin@snet.net).
+ [RPJ (me) didn't translate the original algorithm
+ correctly.]
+ * semaphore.c: Added sem_post_multiple; this is a useful
+ routine, but it doesn't appear to be standard. For now it's
+ not an exported function.
+
+2001-06-25 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
+
+ * create.c (pthread_create): Add priority inheritance
+ attributes.
+ * mutex.c (pthread_mutex_lock): Remove some overhead for
+ PTHREAD_MUTEX_NORMAL mutex types. Specifically, avoid
+ calling pthread_self() and pthread_equal() to check/set
+ the mutex owner. Introduce a new pseudo owner for this
+ type. Test results suggest increases in speed of up to
+ 90% for non-blocking locks.
+ This is the default type of mutex used internally by other
+ synchronising objects, ie. condition variables and
+ read-write locks. The test rwlock7.c shows about a
+ 30-35% speed increase over snapshot 2001-06-06. The
+ price of this is that the application developer
+ must ensure correct behaviour, or explicitly set the
+ mutex to a safer type such as PTHREAD_MUTEX_ERRORCHECK.
+ For example, PTHREAD_MUTEX_NORMAL (or PTHREAD_MUTEX_DEFAULT)
+ type mutexes will not return an error if a thread which is not
+ the owner calls pthread_mutex_unlock. The call will succeed
+ in unlocking the mutex if it is currently locked, but a
+ subsequent unlock by the true owner will then fail with EPERM.
+ This is however consistent with some other implementations.
+ (pthread_mutex_unlock): Likewise.
+ (pthread_mutex_trylock): Likewise.
+ (pthread_mutex_destroy): Likewise.
+ * attr.c (pthread_attr_init): PTHREAD_EXPLICIT_SCHED is the
+ default inheritance attribute; THREAD_PRIORITY_NORMAL is
+ the default priority for new threads.
+ * sched.c (pthread_attr_setschedpolicy): Added routine.
+ (pthread_attr_getschedpolicy): Added routine.
+ (pthread_attr_setinheritsched): Added routine.
+ (pthread_attr_getinheritsched): Added routine.
+ * pthread.h (sched_rr_set_interval): Added as a macro;
+ returns -1 with errno set to ENOSYS.
+
+2001-06-23 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
+
+ *sched.c (pthread_attr_setschedparam): Add priority range
+ check.
+ (sched_setscheduler): New function; checks for a valid
+ pid and policy; checks for permission to set information
+ in the target process; expects pid to be a Win32 process ID,
+ not a process handle; the only scheduler policy allowed is
+ SCHED_OTHER.
+ (sched_getscheduler): Likewise, but checks for permission
+ to query.
+ * pthread.h (SCHED_*): Moved to sched.h as defined in the
+ POSIX standard.
+ * sched.h (SCHED_*): Moved from pthread.h.
+ (pid_t): Defined if necessary.
+ (sched_setscheduler): Defined.
+ (sched_getscheduler): Defined.
+ * pthread.def (sched_setscheduler): Exported.
+ (sched_getscheduler): Likewise.
+
+2001-06-23 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
+
+ Contributed by - Ralf Brese <Ralf.Brese@pdb4.siemens.de>
+
+ * create.c (pthread_create): Set thread priority from
+ thread attributes.
+
+2001-06-18 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
+
+ * Made organisational-only changes to UWIN additions.
+ * dll.c (dllMain): Moved UWIN process attach code
+ to pthread_win32_process_attach_np(); moved
+ instance of pthread_count to global.c.
+ * global.c (pthread_count): Moved from dll.c.
+ * nonportable.c (pthread_win32_process_attach_np):
+ Moved _UWIN code to here from dll.c.
+ * implement.h (pthread_count): Define extern int.
+ * create.c (pthread_count): Remove extern int.
+ * private.c (pthread_count): Likewise.
+ * exit.c (pthread_count): Likewise.
+
+2001-06-18 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
+
+ Contributed by - David Korn <dgk@research.att.com>
+
+ * dll.c: Added changes necessary to work with UWIN.
+ * create.c: Likewise.
+ * pthread.h: Likewise.
+ * misc.c: Likewise.
+ * exit.c: Likewise.
+ * private.c: Likewise.
+ * implement.h: Likewise.
+ There is some room at the start of struct pthread_t_
+ to implement the signal semantics in UWIN's posix.dll
+ although this is not yet complete.
+ * Nmakefile: Compatible with UWIN's Nmake utility.
+ * Nmakefile.tests: Likewise - for running the tests.
+
+2001-06-08 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
+
+ * semaphore.h (sem_t): Fixed for compile and test.
+ * implement.h (sem_t_): Likewise.
+ * semaphore.c: Likewise.
+ * private.c (ptw32_sem_timedwait): Updated to use new
+ opaque sem_t.
+
+2001-06-06 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
+
+ * semaphore.h (sem_t): Is now an opaque pointer;
+ moved actual definition to implement.h.
+ * implement.h (sem_t_): Move here from semaphore.h;
+ was the definition of sem_t.
+ * semaphore.c: Wherever necessary, changed use of sem
+ from that of a pointer to a pointer-pointer; added
+ extra checks for a valid sem_t; NULL sem_t when
+ it is destroyed; added extra checks when creating
+ and destroying sem_t elements in the NEED_SEM
+ code branches; changed from using a pthread_mutex_t
+ ((*sem)->mutex) to CRITICAL_SECTION ((*sem)->sem_lock_cs)
+ in NEED_SEM branches for access serialisation.
+
+2001-06-06 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
+
+ * mutex.c (pthread_mutexattr_init): Remove
+ ptw32_mutex_default_kind.
+
+2001-06-05 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
+
+ * nonportable.c (pthread_mutex_setdefaultkind_np):
+ Remove - should not have been included in the first place.
+ (pthread_mutex_getdefaultkind_np): Likewise.
+ * global.c (ptw32_mutex_default_kind): Likewise.
+ * mutex.c (pthread_mutex_init): Remove use of
+ ptw32_mutex_default_kind.
+ * pthread.h (pthread_mutex_setdefaultkind_np): Likewise.
+ (pthread_mutex_getdefaultkind_np): Likewise.
+ * pthread.def (pthread_mutexattr_setkind_np): Added.
+ (pthread_mutexattr_getkind_np): Likewise.
+
+ * README: Many changes that should have gone in before
+ the last snapshot.
+ * README.NONPORTABLE: New - referred to by ANNOUNCE
+ but never created; documents the non-portable routines
+ included in the library - moved from README with new
+ routines added.
+ * ANNOUNCE (pthread_mutexattr_setkind_np): Added to
+ compliance list.
+ (pthread_mutexattr_getkind_np): Likewise.
+
+2001-06-04 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
+
+ * condvar.c: Add original description of the algorithm as
+ developed by Terekhov and Thomas, plus reference to
+ README.CV.
+
+2001-06-03 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
+
+ Contributed by - Alexander Terekhov <TEREKHOV@de.ibm.com>
+ - Louis Thomas <lthomas@arbitrade.com>
+
+ * condvar.c (pthread_cond_init): Completely revamped.
+ (pthread_cond_destroy): Likewise.
+ (ptw32_cond_wait_cleanup): Likewise.
+ (ptw32_cond_timedwait): Likewise.
+ (ptw32_cond_unblock): New general signaling routine.
+ (pthread_cond_signal): Now calls ptw32_cond_unblock.
+ (pthread_cond_broadcast): Likewise.
+ * implement.h (pthread_cond_t_): Revamped.
+ * README.CV: New; explanation of the above changes.
+
+2001-05-30 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
+
+ * pthread.h (rand_r): Fake using _seed argument to quell
+ compiler warning (compiler should optimise this away later).
+
+ * GNUmakefile (OPT): Leave symbolic information out of the library
+ and increase optimisation level - for smaller faster prebuilt
+ dlls.
+
+2001-05-29 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
+
+ Contributed by - Milan Gardian <Milan.Gardian@LEIBINGER.com>
+
+ * Makefile: fix typo.
+ * pthreads.h: Fix problems with stdcall/cdecl conventions, in particular
+ remove the need for PT_STDCALL everywhere; remove warning supression.
+ * (errno): Fix the longstanding "inconsistent dll linkage" problem
+ with errno; now also works with /MD debugging libs -
+ warnings emerged when compiling pthreads library with /MD (or /MDd)
+ compiler switch, instead of /MT (or /MTd) (i.e. when compiling pthreads
+ using Multithreaded DLL CRT instead of Multithreaded statically linked
+ CRT).
+ * create.c (pthread_create): Likewise; fix typo.
+ * private.c (ptw32_threadStart): Eliminate use of terminate() which doesn't
+ throw exceptions.
+ * Remove unnecessary #includes from a number of modules -
+ [I had to #include malloc.h in implement.h for gcc - rpj].
+
+2001-05-29 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
+
+ Contributed by - Thomas Pfaff <tpfaff@gmx.net>
+
+ * pthread.h (PTHREAD_MUTEX_DEFAULT): New; equivalent to
+ PTHREAD_MUTEX_DEFAULT_NP.
+ * (PTHREAD_MUTEX_NORMAL): Similarly.
+ * (PTHREAD_MUTEX_ERRORCHECK): Similarly.
+ * (PTHREAD_MUTEX_RECURSIVE): Similarly.
+ * (pthread_mutex_setdefaultkind_np): New; Linux compatibility stub
+ for pthread_mutexattr_settype.
+ * (pthread_mutexattr_getkind_np): New; Linux compatibility stub
+ for pthread_mutexattr_gettype.
+ * mutex.c (pthread_mutexattr_settype): New; allow
+ the following types of mutex:
+ PTHREAD_MUTEX_DEFAULT_NP
+ PTHREAD_MUTEX_NORMAL_NP
+ PTHREAD_MUTEX_ERRORCHECK_NP
+ PTHREAD_MUTEX_RECURSIVE_NP
+ * Note that PTHREAD_MUTEX_DEFAULT is equivalent to
+ PTHREAD_MUTEX_NORMAL - ie. mutexes should no longer
+ be recursive by default, and a thread will deadlock if it
+ tries to relock a mutex it already owns. This is inline with
+ other pthreads implementations.
+ * (pthread_mutex_lock): Process the lock request
+ according to the mutex type.
+ * (pthread_mutex_init): Eliminate use of Win32 mutexes as the
+ basis of POSIX mutexes - instead, a combination of one critical section
+ and one semaphore are used in conjunction with Win32 Interlocked* routines.
+ * (pthread_mutex_destroy): Likewise.
+ * (pthread_mutex_lock): Likewise.
+ * (pthread_mutex_trylock): Likewise.
+ * (pthread_mutex_unlock): Likewise.
+ * Use longjmp/setjmp to implement cancelation when building the library
+ using a C compiler which doesn't support exceptions, e.g. gcc -x c (note
+ that gcc -x c++ uses exceptions).
+ * Also fixed some of the same typos and eliminated PT_STDCALL as
+ Milan Gardian's patches above.
+
+2001-02-07 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ Contributed by - Alexander Terekhov <TEREKHOV@de.ibm.com>
+
+ * rwlock.c: Revamped.
+ * implement.h (pthread_rwlock_t_): Redefined.
+ This implementation does not have reader/writer starvation problem.
+ Rwlock attempts to behave more like a normal mutex with
+ races and scheduling policy determining who is more important;
+ It also supports recursive locking,
+ has less synchronization overhead (no broadcasts at all,
+ readers are not blocked on any condition variable) and seem to
+ be faster than the current implementation [W98 appears to be
+ approximately 15 percent faster at least - on top of speed increase
+ from Thomas Pfaff's changes to mutex.c - rpj].
+
+2000-12-29 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * Makefile: Back-out "for" loops which don't work.
+
+ * GNUmakefile: Remove the fake.a target; add the "realclean"
+ target; don't remove built libs under the "clean" target.
+
+ * config.h: Add a guard against multiple inclusion.
+
+ * semaphore.h: Add some defines from config.h to make
+ semaphore.h independent of config.h when building apps.
+
+ * pthread.h (_errno): Back-out previous fix until we know how to
+ fix it properly.
+
+ * implement.h (lockCount): Add missing element to pthread_mutex_t_.
+
+ * sync.c (pthread_join): Spelling fix in comment.
+
+ * private.c (ptw32_threadStart): Reset original termination
+ function (C++).
+ (ptw32_threadStart): Cleanup detached threads early in case
+ the library is statically linked.
+ (ptw32_callUserDestroyRoutines): Remove [SEH] __try block from
+ destructor call so that unhandled exceptions will be passed through
+ to the system; call terminate() from [C++] try block for the same
+ reason.
+
+ * tsd.c (pthread_getspecific): Add comment.
+
+ * mutex.c (pthread_mutex_init): Initialise new elements in
+ pthread_mutex_t.
+ (pthread_mutex_unlock): Invert "pthread_equal()" test.
+
+2000-12-28 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * semaphore.c (mode_t): Use ifndef HAVE_MODE_T to include definition.
+
+ * config.h.in (HAVE_MODE_T): Added.
+ (_UWIN): Start adding defines for the UWIN package.
+
+ * private.c (ptw32_threadStart): Unhandled exceptions are
+ now passed through to the system to deal with. This is consistent
+ with normal Windows behaviour. C++ applications may use
+ set_terminate() to override the default behaviour which is
+ to call ptw32_terminate(). Ptw32_terminate() cleans up some
+ POSIX thread stuff before calling the system default function
+ which calls abort(). The users termination function should conform
+ to standard C++ semantics which is to not return. It should
+ exit the thread (call pthread_exit()) or exit the application.
+ * private.c (ptw32_terminate): Added as the default set_terminate()
+ function. It calls the system default function after cleaning up
+ some POSIX thread stuff.
+
+ * implement.h (ptw32_try_enter_critical_section): Move
+ declaration.
+ * global.c (ptw32_try_enter_critical_section): Moved
+ from dll.c.
+ * dll.c: Move process and thread attach/detach code into
+ functions in nonportable.c.
+ * nonportable.c (pthread_win32_process_attach_np): Process
+ attach code from dll.c is now available to static linked
+ applications.
+ * nonportable.c (pthread_win32_process_detach_np): Likewise.
+ * nonportable.c (pthread_win32_thread_attach_np): Likewise.
+ * nonportable.c (pthread_win32_thread_detach_np): Likewise.
+
+ * pthread.h: Add new non-portable prototypes for static
+ linked applications.
+
+ * GNUmakefile (OPT): Increase optimisation flag and remove
+ debug info flag.
+
+ * pthread.def: Add new non-portable exports for static
+ linked applications.
+
+2000-12-11 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * FAQ: Update Answer 6 re getting a fully working
+ Mingw32 built library.
+
+2000-10-10 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
+
+ * misc.c (pthread_self): Restore Win32 "last error"
+ cleared by TlsGetValue() call in
+ pthread_getspecific()
+ - "Steven Reddie" <smr@essemer.com.au>
+
+2000-09-20 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
+
+ * mutex.c (pthread_mutex_lock): Record the owner
+ of the mutex. This requires also keeping count of
+ recursive locks ourselves rather than leaving it
+ to Win32 since we need to know when to NULL the
+ thread owner when the mutex is unlocked.
+ (pthread_mutex_trylock): Likewise.
+ (pthread_mutex_unlock): Check that the calling
+ thread owns the mutex, decrement the recursive
+ lock count, and NULL the owner if zero. Return
+ EPERM if the mutex is owned by another thread.
+ * implement.h (pthread_mutex_t_): Add ownerThread
+ and lockCount members.
+ - reported by Arthur Kantor <akantor@bexusa.com>
+
+2000-09-13 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
+
+ * mutex.c (pthread_mutex_init): Call
+ TryEnterCriticalSection through the pointer
+ rather than directly so that the dll can load
+ on Windows versions that can't resolve the
+ function, eg. Windows 95
+ - "Jef Gearhart" <jgearhart@tpssys.com>
+
+2000-09-09 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * pthread.h (ctime_r): Fix arg.
+
+2000-09-08 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * GNUmakefile(_WIN32_WINNT=0x400): Define in CFLAGS;
+ doesn't seem to be needed though.
+
+ * cancel.c (pthread_cancel): Must get "self" through
+ calling pthread_self() which will ensure a POSIX thread
+ struct is built for non-POSIX threads; return an error
+ if this fails
+ - Ollie Leahy <ollie@mpt.ie>
+ (pthread_setcancelstate): Likewise.
+ (pthread_setcanceltype): Likewise.
+ * misc.c (ptw32_cancelable_wait): Likewise.
+
+ * private.c (ptw32_tkAssocCreate): Remove unused #if 0
+ wrapped code.
+
+ * pthread.h (ptw32_get_exception_services_code):
+ Needed to be forward declared unconditionally.
+
+2000-09-06 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * cancel.c (pthread_cancel): If called from the main
+ thread "self" would be NULL; get "self" via pthread_self()
+ instead of directly from TLS so that an implicit
+ pthread object is created.
+
+ * misc.c (pthread_equal): Strengthen test for NULLs.
+
+2000-09-02 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * condvar.c (ptw32_cond_wait_cleanup): Ensure that all
+ waking threads check if they are the last, and notify
+ the broadcaster if so - even if an error occurs in the
+ waiter.
+
+ * semaphore.c (_decrease_semaphore): Should be
+ a call to ptw32_decrease_semaphore.
+ (_increase_semaphore): Should be a call to
+ ptw32_increase_semaphore.
+
+ * misc.c (ptw32_cancelable_wait): Renamed from
+ CancelableWait.
+ * rwlock.c (_rwlock_check*): Renamed to
+ ptw32_rwlock_check*.
+ * mutex.c (_mutex_check*): Renamed to ptw32_mutex_check*.
+ * condvar.c (cond_timed*): Renamed to ptw32_cond_timed*.
+ (_cond_check*): Renamed to ptw32_cond_check*.
+ (cond_wait_cleanup*): Rename to ptw32_cond_wait_cleanup*.
+ (ptw32_cond_timedwait): Add comments.
+
+2000-08-22 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
+
+ * private.c (ptw32_throw): Fix exception test;
+ move exceptionInformation declaration.
+
+ * tsd.c (pthread_key_create): newkey wrongly declared.
+
+ * pthread.h: Fix comment block.
+
+2000-08-18 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
+
+ * mutex.c (pthread_mutex_destroy): Check that the mutex isn't
+ held; invalidate the mutex as early as possible to avoid
+ contention; not perfect - FIXME!
+
+ * rwlock.c (pthread_rwlock_init): Remove redundant assignment
+ to "rw".
+ (pthread_rwlock_destroy): Invalidate the rwlock before
+ freeing up any of it's resources - to avoid contention.
+
+ * private.c (ptw32_tkAssocCreate): Change assoc->lock
+ to use a dynamically initialised mutex - only consumes
+ a W32 mutex or critical section when first used,
+ not before.
+
+ * mutex.c (pthread_mutex_init): Remove redundant assignment
+ to "mx".
+ (pthread_mutexattr_destroy): Set attribute to NULL
+ before freeing it's memory - to avoid contention.
+
+ * implement.h (PTW32_EPS_CANCEL/PTW32_EPS_EXIT):
+ Must be defined for all compilers - used as generic
+ exception selectors by ptw32_throw().
+
+ * Several: Fix typos from scripted edit session
+ yesterday.
+
+ * nonportable.c (pthread_mutexattr_setforcecs_np):
+ Moved this function from mutex.c.
+ (pthread_getw32threadhandle_np): New function to
+ return the win32 thread handle that the POSIX
+ thread is using.
+ * mutex.c (pthread_mutexattr_setforcecs_np):
+ Moved to new file "nonportable.c".
+
+ * pthread.h (PTW32_BUILD): Only redefine __except
+ and catch compiler keywords if we aren't building
+ the library (ie. PTW32_BUILD is not defined) -
+ this is safer than defining and then undefining
+ if not building the library.
+ * implement.h: Remove __except and catch undefines.
+ * Makefile (CFLAGS): Define PTW32_BUILD.
+ * GNUmakefile (CFLAGS): Define PTW32_BUILD.
+
+ * All appropriate: Change Pthread_exception* to
+ ptw32_exception* to be consistent with internal
+ identifier naming.
+
+ * private.c (ptw32_throw): New function to provide
+ a generic exception throw for all internal
+ exceptions and EH schemes.
+ (ptw32_threadStart): pthread_exit() value is now
+ returned via the thread structure exitStatus
+ element.
+ * exit.c (pthread_exit): pthread_exit() value is now
+ returned via the thread structure exitStatus
+ element.
+ * cancel.c (ptw32_cancel_self): Now uses ptw32_throw.
+ (pthread_setcancelstate): Ditto.
+ (pthread_setcanceltype): Ditto.
+ (pthread_testcancel): Ditto.
+ (pthread_cancel): Ditto.
+ * misc.c (CancelableWait): Ditto.
+ * exit.c (pthread_exit): Ditto.
+ * All applicable: Change PTW32_ prefix to
+ PTW32_ prefix to remove leading underscores
+ from private library identifiers.
+
+2000-08-17 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * All applicable: Change _pthread_ prefix to
+ ptw32_ prefix to remove leading underscores
+ from private library identifiers (single
+ and double leading underscores are reserved in the
+ ANSI C standard for compiler implementations).
+
+ * tsd.c (pthread_create_key): Initialise temporary
+ key before returning it's address to avoid race
+ conditions.
+
+2000-08-13 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * errno.c: Add _MD precompile condition; thus far
+ had no effect when using /MD compile option but I
+ thnk it should be there.
+
+ * exit.c: Add __cplusplus to various #if lines;
+ was compiling SEH code even when VC++ had
+ C++ compile options.
+
+ * private.c: ditto.
+
+ * create.c (pthread_create): Add PT_STDCALL macro to
+ function pointer arg in _beginthread().
+
+ * pthread.h: PT_STDCALL really does need to be defined
+ in both this and impliment.h; don't set it to __cdecl
+ - this macro is only used to extend function pointer
+ casting for functions that will be passed as parameters.
+ (~PThreadCleanup): add cast and group expression.
+ (_errno): Add _MD compile conditional.
+ (PtW32NoCatchWarn): Change pragma message.
+
+ * implement.h: Move and change PT_STDCALL define.
+
+ * need_errno.h: Add _MD to compilation conditional.
+
+ * GNUmakefile: Substantial rewrite for new naming
+ convention; set for nil optimisation (turn it up
+ when we have a working library build; add target
+ "fake.a" to build a libpthreadw32.a from the VC++
+ built DLL pthreadVCE.dll.
+
+ * pthread.def (LIBRARY): Don't specify in the .def
+ file - it is specified on the linker command line
+ since we now use the same .def file for variously
+ named .dlls.
+
+ * Makefile: Substantial rewrite for new naming
+ convention; default nmake target only issues a
+ help message; run nmake with specific target
+ corresponding to the EH scheme being used.
+
+ * README: Update information; add naming convention
+ explanation.
+
+ * ANNOUNCE: Update information.
+
+2000-08-12 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * pthread.h: Add compile-time message when using
+ MSC_VER compiler and C++ EH to warn application
+ programmers to use PtW32Catch instead of catch(...)
+ if they want cancelation and pthread_exit to work.
+
+ * implement.h: Remove #include <semaphore.h>; we
+ use our own local semaphore.h.
+
+2000-08-10 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * cleanup.c (pthread_pop_cleanup): Remove _pthread
+ prefix from __except and catch keywords; implement.h
+ now simply undefines ptw32__except and
+ ptw32_catch if defined; VC++ was not textually
+ substituting ptw32_catch etc back to catch as
+ it was redefined; the reason for using the prefixed
+ version was to make it clear that it was not using
+ the pthread.h redefined catch keyword.
+
+ * private.c (ptw32_threadStart): Ditto.
+ (ptw32_callUserDestroyRoutines): Ditto.
+
+ * implement.h (ptw32__except): Remove #define.
+ (ptw32_catch): Remove #define.
+
+ * GNUmakefile (pthread.a): New target to build
+ libpthread32.a from pthread.dll using dlltool.
+
+ * buildlib.bat: Duplicate cl commands with args to
+ build C++ EH version of pthread.dll; use of .bat
+ files is redundant now that nmake compatible
+ Makefile is included; used as a kludge only now.
+
+ * Makefile: Localise some macros and fix up the clean:
+ target to extend it and work properly.
+
+ * CONTRIBUTORS: Add contributors.
+
+ * ANNOUNCE: Updated.
+
+ * README: Updated.
+
+2000-08-06 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * pthread.h: Remove #warning - VC++ doesn't accept it.
+
+2000-08-05 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * pthread.h (PtW32CatchAll): Add macro. When compiling
+ applications using VC++ with C++ EH rather than SEH
+ 'PtW32CatchAll' must be used in place of any 'catch( ... )'
+ if the application wants pthread cancelation or
+ pthread_exit() to work.
+
+2000-08-03 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * pthread.h: Add a base class ptw32_exception for
+ library internal exceptions and change the "catch"
+ re-define macro to use it.
+
+2000-08-02 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * GNUmakefile (CFLAGS): Add -mthreads.
+ Add new targets to generate cpp and asm output.
+
+ * sync.c (pthread_join): Remove dead code.
+
+2000-07-25 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * sched.c (sched_get_priority_max): Handle different WinCE and
+ Win32 priority values together.
+ (sched_get_priority_min): Ditto.
+ - Tristan Savatier <tristan@mpegtv.com>
+
+ * create.c (pthread_create): Force new threads to wait until
+ pthread_create has the new thread's handle; we also retain
+ a local copy of the handle for internal use until
+ pthread_create returns.
+
+ * private.c (ptw32_threadStart): Initialise ei[].
+ (ptw32_threadStart): When beginthread is used to start the
+ thread, force waiting until the creator thread had the
+ thread handle.
+
+ * cancel.c (ptw32_cancel_thread): Include context switch
+ code for defined(_X86_) environments in addition to _M_IX86.
+
+ * rwlock.c (pthread_rwlock_destroy): Assignment changed
+ to avoid compiler warning.
+
+ * private.c (ptw32_get_exception_services_code): Cast
+ NULL return value to avoid compiler warning.
+
+ * cleanup.c (pthread_pop_cleanup): Initialise "cleanup" variable
+ to avoid compiler warnings.
+
+ * misc.c (ptw32_new): Change "new" variable to "t" to avoid
+ confusion with the C++ keyword of the same name.
+
+ * condvar.c (cond_wait_cleanup): Initialise lastWaiter variable.
+ (cond_timedwait): Remove unused local variables. to avoid
+ compiler warnings.
+
+ * dll.c (dllMain): Remove 2000-07-21 change - problem
+ appears to be in pthread_create().
+
+2000-07-22 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * tsd.c (pthread_key_create): If a destructor was given
+ and the pthread_mutex_init failed, then would try to
+ reference a NULL pointer (*key); eliminate this section of
+ code by using a dynamically initialised mutex
+ (PTHREAD_MUTEX_INITIALIZER).
+
+ * tsd.c (pthread_setspecific): Return an error if
+ unable to set the value; simplify cryptic conditional.
+
+ * tsd.c (pthread_key_delete): Locking threadsLock relied
+ on mutex_lock returning an error if the key has no destructor.
+ ThreadsLock is only initialised if the key has a destructor.
+ Making this mutex a static could reduce the number of mutexes
+ used by an application since it is actually created only at
+ first use and it's often destroyed soon after.
+
+2000-07-22 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * FAQ: Added Q5 and Q6.
+
+2000-07-21 Ross Johnson <rpj@setup1.ise.canberra.edu.au>
+
+ * create.c (pthread_create): Set threadH to 0 (zero)
+ everywhere. Some assignments were using NULL. Maybe
+ it should be NULL everywhere - need to check. (I know
+ they are nearly always the same thing - but not by
+ definition.)
+
+ * dll.c: Include resource leakage work-around. This is a
+ partial FIXME which doesn't stop all leakage. The real
+ problem needs to be found and fixed.
+ - "David Baggett" <dmb@itasoftware.com>
+
+ * misc.c (pthread_self): Try to catch NULL thread handles
+ at the point where they might be generated, even though
+ they should always be valid at this point.
+
+ * tsd.c (pthread_setspecific): return an error value if
+ pthread_self() returns NULL.
+
+ * sync.c (pthread_join): return an error value if
+ pthread_self() returns NULL.
+
+ * signal.c (pthread_sigmask): return an error value if
+ pthread_self() returns NULL.
+
+2000-03-02 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * attr.c (pthread_attr_init): Set default stacksize to zero (0)
+ rather than PTHREAD_STACK_MIN even though these are now the same.
+
+ * pthread.h (PTHREAD_STACK_MIN): Lowered to 0.
+
+2000-01-28 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * mutex.c (pthread_mutex_init): Free mutex if it has been alloced;
+ if critical sections can be used instead of Win32 mutexes, test
+ that the critical section works and return an error if not.
+
+2000-01-07 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * cleanup.c (pthread_pop_cleanup): Include SEH code only if MSC is not
+ compiling as C++.
+ (pthread_push_cleanup): Include SEH code only if MSC is not
+ compiling as C++.
+
+ * pthread.h: Include SEH code only if MSC is not
+ compiling as C++.
+
+ * implement.h: Include SEH code only if MSC is not
+ compiling as C++.
+
+ * cancel.c (ptw32_cancel_thread): Add _M_IX86 check.
+ (pthread_testcancel): Include SEH code only if MSC is not
+ compiling as C++.
+ (ptw32_cancel_self): Include SEH code only if MSC is not
+ compiling as C++.
+
+2000-01-06 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * Makefile: Remove inconsistencies in 'cl' args
+ - Erik Hensema <erik.hensema@group2000.nl>
+
+2000-01-04 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * private.c (ptw32_get_exception_services_code): New; returns
+ value of EXCEPTION_PTW32_SERVICES.
+ (ptw32_processInitialize): Remove initialisation of
+ ptw32_exception_services which is no longer needed.
+
+ * pthread.h (ptw32_exception_services): Remove extern.
+ (ptw32_get_exception_services_code): Add function prototype;
+ use this to return EXCEPTION_PTW32_SERVICES value instead of
+ using the ptw32_exception_services variable which I had
+ trouble exporting through pthread.def.
+
+ * global.c (ptw32_exception_services): Remove declaration.
+
+1999-11-22 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * implement.h: Forward declare ptw32_new();
+
+ * misc.c (ptw32_new): New; alloc and initialise a new pthread_t.
+ (pthread_self): New thread struct is generated by new routine
+ ptw32_new().
+
+ * create.c (pthread_create): New thread struct is generated
+ by new routine ptw32_new().
+
+1999-11-21 Ross Johnson <rpj@special.ise.canberra.edu.au>
+
+ * global.c (ptw32_exception_services): Declare new variable.
+
+ * private.c (ptw32_threadStart): Destroy thread's
+ cancelLock mutex; make 'catch' and '__except' usageimmune to
+ redfinitions in pthread.h.
+ (ptw32_processInitialize): Init new constant ptw32_exception_services.
+
+ * create.c (pthread_create): Initialise thread's cancelLock
+ mutex.
+
+ * cleanup.c (pthread_pop_cleanup): Make 'catch' and '__except'
+ usage immune to redfinition s in pthread.h.
+
+ * private.c: Ditto.
+
+ * pthread.h (catch): Redefine 'catch' so that C++ applications
+ won't catch our internal exceptions.
+ (__except): ditto for __except.
+
+ * implement.h (ptw32_catch): Define internal version
+ of 'catch' because 'catch' is redefined by pthread.h.
+ (__except): ditto for __except.
+ (struct pthread_t_): Add cancelLock mutex for async cancel
+ safety.
+
+ * cancel.c (ptw32_cancel_self): New; part of the async
+ cancellation implementation.
+ (ptw32_cancel_thread): Ditto; this function is X86
+ processor specific.
+ (pthread_setcancelstate): Add check for pending async
+ cancel request and cancel the calling thread if
+ required; add async-cancel safety lock.
+ (pthread_setcanceltype): Ditto.
+ - Jason Nye <jnye@nbnet.nb.ca>
+ - Erik Hensema <erik.hensema@group2000.nl>
+
+1999-11-13 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * configure.in (AC_OUTPUT): Put generated output into GNUmakefile
+ rather than Makefile. Makefile will become the MSC nmake compatible
+ version
+ - Erik Hensema <erik.hensema@group2000.nl>
+
+ * misc.c (pthread_self): Add a note about GetCurrentThread
+ returning a pseudo-handle
+ - John Bossom (John.Bossom@cognos.com>
+
+1999-11-10 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * dll.c (dllMain): Free kernel32 ASAP.
+ If TryEnterCriticalSection is not being used, then free
+ the kernel32.dll handle now, rather than leaving it until
+ DLL_PROCESS_DETACH.
+
+ Note: this is not a pedantic exercise in freeing unused
+ resources! It is a work-around for a bug in Windows 95
+ (see microsoft knowledge base article, Q187684) which
+ does Bad Things when FreeLibrary is called within
+ the DLL_PROCESS_DETACH code, in certain situations.
+ Since w95 just happens to be a platform which does not
+ provide TryEnterCriticalSection, the bug will be
+ effortlessly avoided.
+ - Todd Owen <towen@lucidcalm.dropbear.id.au>
+
+ * sync.c (pthread_join): Make it a deferred cancelation point.
+
+ * misc.c (pthread_self): Explicitly initialise implicitly
+ created thread state to default values.
+
+1999-11-05 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * pthread.h (winsock.h): Include unconditionally.
+ (ETIMEDOUT): Change fallback value to that defined by winsock.h.
+
+ * general: Patched for portability to WinCE. The details are
+ described in the file WinCE-PORT. Follow the instructions
+ in README.WinCE to make the appropriate changes in config.h.
+ - Tristan Savatier <tristan@mpegtv.com>
+
+1999-10-30 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * create.c (pthread_create): Explicitly initialise thread state to
+ default values.
+
+ * cancel.c (pthread_setcancelstate): Check for NULL 'oldstate'
+ for compatibility with Solaris pthreads;
+ (pthread_setcanceltype): ditto:
+ - Erik Hensema <erik.hensema@group2000.nl>
+
+1999-10-23 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * pthread.h (ctime_r): Fix incorrect argument "_tm"
+ - Erik Hensema <erik.hensema@group2000.nl>
+
+1999-10-21 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * pthread.h (_POSIX_THREADS): Only define it if it isn't
+ already defined. Projects may need to define this on
+ the CC command line under Win32 as it doesn't have unistd.h
+ - Aurelio Medina <aureliom@crt.com>
+
+1999-10-17 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * rwlock.c (pthread_rwlock_destroy): Add cast to remove compile
+ warning.
+
+ * condvar.c (pthread_cond_broadcast): Only release semaphores
+ if there are waiting threads.
+
+1999-10-15 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * condvar.c (cond_wait_cleanup): New static cleanup handler for
+ cond_timedwait;
+ (cond_timedwait): pthread_cleanup_push args changed;
+ canceling a thread while it's in pthread_cond_wait
+ will now decrement the waiters count and cleanup if it's the
+ last waiter.
+ - Lorin Hochstein <lmh@xiphos.ca> and
+ Peter Slacik <Peter.Slacik@tatramed.sk>;
+ the last waiter will now reset the CV's wasBroadcast flag
+ - Graham Dumpleton <Graham.Dumpleton@ra.pad.otc.telstra.com.au>.
+
+Thu Sep 16 1999 Ross Johnson <rpj@swan.canberra.edu.au>
+
+ * rwlock.c (pthread_rwlock_destroy): Add serialisation.
+ (_rwlock_check_need_init): Check for detroyed rwlock.
+ * rwlock.c: Check return codes from _rwlock_check_need_init();
+ modify comments; serialise access to rwlock objects during
+ operations; rename rw_mutex to rw_lock.
+ * implement.h: Rename rw_mutex to rw_lock.
+ * mutex.c (pthread_mutex_destroy): Add serialisation.
+ (_mutex_check_need_init): Check for detroyed mutex.
+ * condvar.c (pthread_cond_destroy): Add serialisation.
+ (_cond_check_need_init): Check for detroyed condvar.
+ * mutex.c: Modify comments.
+ * condvar.c: Modify comments.
+
+Sat Sep 10 12:56:13 1999 Ross Johnson <rpj@swan.canberra.edu.au>
+
+ The following code for POSIX read/write locks was contributed
+ by Aurelio Medina.
+
+ * implement.h (pthread_rwlock_t_): Add.
+ * pthread.h (pthread_rwlock_t): Add.
+ (PTHREAD_RWLOCK_INITIALIZER): Add.
+ Add rwlock function prototypes.
+ * rwlock.c: New module.
+ * pthread.def: Add new rwlock functions.
+ * private.c (ptw32_processInitialize): initialise
+ ptw32_rwlock_test_init_lock critical section.
+ * global.c (ptw32_rwlock_test_init_lock): Add.
+
+ * mutex.c (pthread_mutex_destroy): Don't free mutex memory
+ if mutex is PTHREAD_MUTEX_INITIALIZER and has not been
+ initialised yet.
+
+Wed Sep 8 12:56:13 1999 Ross Johnson <rpj@swan.canberra.edu.au>
+
+ * mutex.c (pthread_mutex_destroy): Free mutex memory.
+ - Milan Gardian <mg@tatramed.sk>
+
+1999-08-22 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * exit.c (pthread_exit): Fix reference to potentially
+ uninitialised pointer.
+
+1999-08-21 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * private.c (ptw32_threadStart): Apply fix of 1999-08-19
+ this time to C++ and non-trapped C versions. Ommitted to
+ do this the first time through.
+
+1999-08-19 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * private.c (ptw32_threadStart): Return exit status from
+ the application thread startup routine.
+ - Milan Gardian <mg@tatramed.sk>
+
+1999-08-18 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * exit.c (pthread_exit): Put status into pthread_t->exitStatus
+ - John Bossom <john.Bossom@cognos.com>
+ * private.c (ptw32_threadStart): Set pthread->exitStatus
+ on exit of try{} block.
+ - John Bossom <john.Bossom@cognos.com>
+ * sync.c (pthread_join): use pthread_exitStatus value if the
+ thread exit doesn't return a value (for Mingw32 CRTDLL
+ which uses endthread instead of _endthreadex).
+ - John Bossom <john.Bossom@cognos.com>
+
+Tue Aug 17 20:17:58 CDT 1999 Mumit Khan <khan@xraylith.wisc.edu>
+
+ * create.c (pthread_create): Add CRTDLL suppport.
+ * exit.c (pthread_exit): Likewise.
+ * private.c (ptw32_threadStart): Likewise.
+ (ptw32_threadDestroy): Likewise.
+ * sync.c (pthread_join): Likewise.
+ * tests/join1.c (main): Warn about partial support for CRTDLL.
+
+Tue Aug 17 20:00:08 1999 Mumit Khan <khan@xraylith.wisc.edu>
+
+ * Makefile.in (LD): Delete entry point.
+ * acconfig.h (STDCALL): Delete unused macro.
+ * configure.in: Remove test for STDCALL.
+ * config.h.in: Regenerate.
+ * errno.c (_errno): Fix self type.
+ * pthread.h (PT_STDCALL): Move from here to
+ * implement.h (PT_STDCALL): here.
+ (ptw32_threadStart): Fix prototype.
+ * private.c (ptw32_threadStart): Likewise.
+
+1999-08-14 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * exit.c (pthread_exit): Don't call pthread_self() but
+ get thread handle directly from TSD for efficiency.
+
+1999-08-12 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * private.c (ptw32_threadStart): ei[] only declared if _MSC_VER.
+
+ * exit.c (pthread_exit): Check for implicitly created threads
+ to avoid raising an unhandled exception.
+
+1999-07-12 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * condvar.c (pthread_cond_destroy): Add critical section.
+ (cond_timedwait): Add critical section; check for timeout
+ waiting on semaphore.
+ (pthread_cond_broadcast): Add critical section.
+ - Peter Slacik <Peter.Slacik@tatramed.sk>
+
+1999-07-09 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ The following changes fix a bug identified by
+ Lorin Hochstein <lmh@xiphos.ca> and solved by
+ John Bossom <John.Bossom@Cognos.COM>.
+
+ The problem was that cleanup handlers were not executed when
+ pthread_exit() was called.
+
+ * implement.h (pthread_t_): Add exceptionInformation element for
+ C++ per-thread exception information.
+ (general): Define and rename exceptions.
+
+
+ * misc.c (CancelableWait): PTW32_EPS_CANCEL (SEH) and
+ ptw32_exception_cancel (C++) used to identify the exception.
+
+ * cancel.c (pthread_testcancel): PTW32_EPS_CANCEL (SEH) and
+ ptw32_exception_cancel (C++) used to identify the exception.
+
+ * exit.c (pthread_exit): throw/raise an exception to return to
+ ptw32_threadStart() to exit the thread. PTW32_EPS_EXIT (SEH)
+ and ptw32_exception_exit (C++) used to identify the exception.
+
+ * private.c (ptw32_threadStart): Add pthread_exit exception trap;
+ clean up and exit the thread directly rather than via pthread_exit().
+
+Sun May 30 00:25:02 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * semaphore.h (mode_t): Conditionally typedef it.
+
+Fri May 28 13:33:05 1999 Ross Johnson <rpj@swan.canberra.edu.au>
+
+ * condvar.c (pthread_cond_broadcast): Fix possible memory fault
+ - Mark E. Armstrong <avail@pacbell.net>
+
+Thu May 27 13:08:46 1999 Ross Johnson <rpj@swan.canberra.edu.au>
+
+ * condvar.c (pthread_cond_broadcast): Fix logic bug
+ - Peter Slacik <Peter.Slacik@tatramed.sk>;
+ optimise sem_post loop
+ - Bossom, John <John.Bossom@Cognos.COM>.
+
+Fri May 14 12:13:18 1999 Ross Johnson <rpj@swan.canberra.edu.au>
+
+ * attr.c (pthread_attr_setdetachstate): Fix logic bug
+ - Mike Russo <miker@eai.com>.
+
+Sat May 8 09:42:30 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * pthread.def (sem_open): Add.
+ (sem_close): Add.
+ (sem_unlink): Add.
+ (sem_getvalue): Add.
+
+ * FAQ (Question 3): Add.
+
+Thu Apr 8 01:16:23 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * semaphore.c (sem_open): New function; returns an error (ENOSYS).
+ (sem_close): ditto.
+ (sem_unlink): ditto.
+ (sem_getvalue): ditto.
+
+ * semaphore.h (_POSIX_SEMAPHORES): define.
+
+Wed Apr 7 14:09:52 1999 Ross Johnson <rpj@swan.canberra.edu.au>
+
+ * errno.c (_REENTRANT || _MT): Invert condition.
+
+ * pthread.h (_errno): Conditionally include prototype.
+
+Wed Apr 7 09:37:00 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * *.c (comments): Remove individual attributions - these are
+ documented sufficiently elsewhere.
+
+ * implement.h (pthread.h): Remove extraneous include.
+
+Sun Apr 4 11:05:57 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * sched.c (sched.h): Include.
+
+ * sched.h: New file for POSIX 1b scheduling.
+
+ * pthread.h: Move opaque structures to implement.h; move sched_*
+ prototypes out and into sched.h.
+
+ * implement.h: Add opaque structures from pthread.h.
+
+ * sched.c (sched_yield): New function.
+
+ * condvar.c (ptw32_sem_*): Rename to sem_*; except for
+ ptw32_sem_timedwait which is an private function.
+
+Sat Apr 3 23:28:00 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * Makefile.in (OBJS): Add errno.o.
+
+Fri Apr 2 11:08:50 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * implement.h (ptw32_sem_*): Remove prototypes now defined in
+ semaphore.h.
+
+ * pthread.h (sempahore.h): Include.
+
+ * semaphore.h: New file for POSIX 1b semaphores.
+
+ * pthread.h (ptw32_sem_t): Change to sem_t.
+
+ * semaphore.c (ptw32_sem_*): Change to sem_*; these functions
+ will be exported from the library; set errno on error.
+ - John Bossom <jebossom@cognos.com>
+ (ptw32_sem_timedwait): Moved to private.c.
+
+ * private.c (ptw32_sem_timedwait): Moved from semaphore.c;
+ set errno on error.
+
+ * errno.c (_errno): New file. New function.
+ - John Bossom
+
+ * pthread.h (pthread_t_): Add per-thread errno element.
+
+Fri Mar 26 14:11:45 1999 Ross Johnson <rpj@swan.canberra.edu.au>
+
+ * semaphore.c (ptw32_sem_timedwait): Check for negative
+ milliseconds.
+ - Tor Lillqvist <tml@iki.fi>
+
+Wed Mar 24 11:32:07 1999 Ross Johnson <rpj@swan.canberra.edu.au>
+
+ * misc.c (CancelableWait): Initialise exceptionInformation[2].
+ (pthread_self): Get a real Win32 thread handle for implicit threads.
+ - John Bossom <jebossom@cognos.com>
+
+ * cancel.c (pthread_testcancel): Initialise exceptionInformation[2].
+ - John Bossom <jebossom@cognos.com>
+
+ * implement.h (SE_INFORMATION): Fix values.
+ - John Bossom <jebossom@cognos.com>
+
+ * private.c (ptw32_threadDestroy): Close the thread handle.
+ - John Bossom <jebossom@cognos.com>
+
+Fri Mar 19 12:57:27 1999 Ross Johnson <rpj@swan.canberra.edu.au>
+
+ * cancel.c (comments): Update and cleanup.
+
+Fri Mar 19 09:12:59 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * private.c (ptw32_threadStart): status returns PTHREAD_CANCELED.
+
+ * pthread.h (PTHREAD_CANCELED): defined.
+
+Tue Mar 16 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * all: Add GNU LGPL and Copyright and Warranty.
+
+Mon Mar 15 00:20:13 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * condvar.c (pthread_cond_init): fix possible uninitialised use
+ of cv.
+
+Sun Mar 14 21:01:59 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * condvar.c (pthread_cond_destroy): don't do full cleanup if
+ static initialised cv has never been used.
+ (cond_timedwait): check result of auto-initialisation.
+
+Thu Mar 11 09:01:48 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * pthread.h (pthread_mutex_t): revert to (pthread_mutex_t *);
+ define a value to serve as PTHREAD_MUTEX_INITIALIZER.
+ (pthread_mutex_t_): remove staticinit and valid elements.
+ (pthread_cond_t): revert to (pthread_cond_t_ *);
+ define a value to serve as PTHREAD_COND_INITIALIZER.
+ (pthread_cond_t_): remove staticinit and valid elements.
+
+ * mutex.c (pthread_mutex_t args): adjust indirection of references.
+ (all functions): check for PTHREAD_MUTEX_INITIALIZER value;
+ check for NULL (invalid).
+
+ * condvar.c (pthread_cond_t args): adjust indirection of references.
+ (all functions): check for PTHREAD_COND_INITIALIZER value;
+ check for NULL (invalid).
+
+Wed Mar 10 17:18:12 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * misc.c (CancelableWait): Undo changes from Mar 8 and 7.
+
+Mon Mar 8 11:18:59 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * misc.c (CancelableWait): Ensure cancelEvent handle is the lowest
+ indexed element in the handles array. Enhance test for abandoned
+ objects.
+
+ * pthread.h (PTHREAD_MUTEX_INITIALIZER): Trailing elements not
+ initialised are set to zero by the compiler. This avoids the
+ problem of initialising the opaque critical section element in it.
+ (PTHREAD_COND_INITIALIZER): Ditto.
+
+ * semaphore.c (ptw32_sem_timedwait): Check sem == NULL earlier.
+
+Sun Mar 7 12:31:14 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * condvar.c (pthread_cond_init): set semaphore initial value
+ to 0, not 1. cond_timedwait was returning signaled immediately.
+
+ * misc.c (CancelableWait): Place the cancel event handle first
+ in the handle table for WaitForMultipleObjects. This ensures that
+ the cancel event is recognised and acted apon if both objects
+ happen to be signaled together.
+
+ * private.c (ptw32_cond_test_init_lock): Initialise and destroy.
+
+ * implement.h (ptw32_cond_test_init_lock): Add extern.
+
+ * global.c (ptw32_cond_test_init_lock): Add declaration.
+
+ * condvar.c (pthread_cond_destroy): check for valid initialised CV;
+ flag destroyed CVs as invalid.
+ (pthread_cond_init): pthread_cond_t is no longer just a pointer.
+ This is because PTHREAD_COND_INITIALIZER needs state info to reside
+ in pthread_cond_t so that it can initialise on first use. Will work on
+ making pthread_cond_t (and other objects like it) opaque again, if
+ possible, later.
+ (cond_timedwait): add check for statically initialisation of
+ CV; initialise on first use.
+ (pthread_cond_signal): check for valid CV.
+ (pthread_cond_broadcast): check for valid CV.
+ (_cond_check_need_init): Add.
+
+ * pthread.h (PTHREAD_COND_INITIALIZER): Fix.
+ (pthread_cond_t): no longer a pointer to pthread_cond_t_.
+ (pthread_cond_t_): add 'staticinit' and 'valid' elements.
+
+Sat Mar 6 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * implement.h: Undate comments.
+
+Sun Feb 21 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * pthread.h (PTHREAD_MUTEX_INITIALIZER): missing braces around
+ cs element initialiser.
+
+1999-02-21 Ben Elliston <bje@cygnus.com>
+
+ * pthread.h (pthread_exit): The return type of this function is
+ void, not int.
+
+ * exit.c (pthread_exit): Do not return 0.
+
+Sat Feb 20 16:03:30 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * dll.c (DLLMain): Expand TryEnterCriticalSection support test.
+
+ * mutex.c (pthread_mutex_trylock): The check for
+ ptw32_try_enter_critical_section == NULL should have been
+ removed long ago.
+
+Fri Feb 19 16:03:30 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * sync.c (pthread_join): Fix pthread_equal() test.
+
+ * mutex.c (pthread_mutex_trylock): Check mutex != NULL before
+ using it.
+
+Thu Feb 18 16:17:30 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * misc.c (pthread_equal): Fix inverted result.
+
+ * Makefile.in: Use libpthread32.a as the name of the DLL export
+ library instead of pthread.lib.
+
+ * condvar.c (pthread_cond_init): cv could have been used unitialised;
+ initialise.
+
+ * create.c (pthread_create): parms could have been used unitialised;
+ initialise.
+
+ * pthread.h (struct pthread_once_t_): Remove redefinition.
+
+Sat Feb 13 03:03:30 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * pthread.h (struct pthread_once_t_): Replaced.
+
+ * misc.c (pthread_once): Replace with John Bossom's version;
+ has lighter weight serialisation; fixes problem of not holding
+ competing threads until after the init_routine completes.
+
+Thu Feb 11 13:34:14 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * misc.c (CancelableWait): Change C++ exception throw.
+
+ * sync.c (pthread_join): Change FIXME comment - issue resolved.
+
+Wed Feb 10 12:49:11 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * configure: Various temporary changes.
+ - Kevin Ruland <Kevin.Ruland@anheuser-busch.com>
+
+ * README: Update.
+
+ * pthread.def (pthread_attr_getstackaddr): uncomment
+ (pthread_attr_setstackaddr): uncomment
+
+Fri Feb 5 13:42:30 1999 Ross Johnson <rpj@swan.canberra.edu.au>
+
+ * semaphore.c: Comment format changes.
+
+Thu Feb 4 10:07:28 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * global.c: Remove ptw32_exception instantiation.
+
+ * cancel.c (pthread_testcancel): Change C++ exception throw.
+
+ * implement.h: Remove extern declaration.
+
+Wed Feb 3 13:04:44 1999 Ross Johnson <rpj@swan.canberra.edu.au>
+
+ * cleanup.c: Rename ptw32_*_cleanup() to pthread_*_cleanup().
+
+ * pthread.def: Ditto.
+
+ * pthread.h: Ditto.
+
+ * pthread.def (pthread_cleanup_push): Remove from export list;
+ the function is defined as a macro under all compilers.
+ (pthread_cleanup_pop): Ditto.
+
+ * pthread.h: Remove #if defined().
+
+Wed Feb 3 10:13:48 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * sync.c (pthread_join): Check for NULL value_ptr arg;
+ check for detached threads.
+
+Tue Feb 2 18:07:43 1999 Ross Johnson <rpj@swan.canberra.edu.au>
+
+ * implement.h: Add #include <pthread.h>.
+ Change sem_t to ptw32_sem_t.
+
+ Various patches by Kevin Ruland <Kevin.Ruland@anheuser-busch.com>
+
+ * signal.c (pthread_sigmask): Add and modify casts.
+ Reverse LHS/RHS bitwise assignments.
+
+ * pthread.h: Remove #include <semaphore.h>.
+ (PTW32_ATTR_VALID): Add cast.
+ (struct pthread_t_): Add sigmask element.
+
+ * dll.c: Add "extern C" for DLLMain.
+ (DllMain): Add cast.
+
+ * create.c (pthread_create): Set sigmask in thread.
+
+ * condvar.c: Remove #include. Change sem_* to ptw32_sem_*.
+
+ * attr.c: Changed #include.
+
+ * Makefile.in: Additional targets and changes to build the library
+ as a DLL.
+
+Fri Jan 29 11:56:28 1999 Ross Johnson <rpj@swan.canberra.edu.au>
+
+ * Makefile.in (OBJS): Add semaphore.o to list.
+
+ * semaphore.c (ptw32_sem_timedwait): Move from private.c.
+ Rename sem_* to ptw32_sem_*.
+
+ * pthread.h (pthread_cond_t): Change type of sem_t.
+ _POSIX_SEMAPHORES no longer defined.
+
+ * semaphore.h: Contents moved to implement.h.
+ Removed from source tree.
+
+ * implement.h: Add semaphore function prototypes and rename all
+ functions to prepend 'ptw32_'. They are
+ now private to the pthreads-win32 implementation.
+
+ * private.c: Change #warning.
+ Move ptw32_sem_timedwait() to semaphore.c.
+
+ * cleanup.c: Change #warning.
+
+ * misc.c: Remove #include <errno.h>
+
+ * pthread.def: Cleanup CVS merge conflicts.
+
+ * global.c: Ditto.
+
+ * ChangeLog: Ditto.
+
+ * cleanup.c: Ditto.
+
+Sun Jan 24 01:34:52 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * semaphore.c (sem_wait): Remove second arg to
+ pthreadCancelableWait() call.
+
+Sat Jan 23 17:36:40 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * pthread.def: Add new functions to export list.
+
+ * pthread.h (PTHREAD_MUTEX_AUTO_CS_NP): New.
+ (PTHREAD_MUTEX_FORCE_CS_NP): New.
+
+ * README: Updated.
+
+Fri Jan 22 14:31:59 1999 Ross Johnson <rpj@swan.canberra.edu.au>
+
+ * Makefile.in (CFLAGS): Remove -fhandle-exceptions. Not needed
+ with egcs. Add -g for debugging.
+
+ * create.c (pthread_create): Replace __stdcall with PT_STDCALL
+ macro. This is a hack and must be fixed.
+
+ * misc.c (CancelableWait): Remove redundant statement.
+
+ * mutex.c (pthread_mutexattr_init): Cast calloc return value.
+
+ * misc.c (CancelableWait): Add cast.
+ (pthread_self): Add cast.
+
+ * exit.c (pthread_exit): Add cast.
+
+ * condvar.c (pthread_condattr_init): Cast calloc return value.
+
+ * cleanup.c: Reorganise conditional compilation.
+
+ * attr.c (pthread_attr_init): Remove unused 'result'.
+ Cast malloc return value.
+
+ * private.c (ptw32_callUserDestroyRoutines): Redo conditional
+ compilation.
+
+ * misc.c (CancelableWait): C++ version uses 'throw'.
+
+ * cancel.c (pthread_testcancel): Ditto.
+
+ * implement.h (class ptw32_exception): Define for C++.
+
+ * pthread.h: Fix C, C++, and Win32 SEH condition compilation
+ mayhem around pthread_cleanup_* defines. C++ version now uses John
+ Bossom's cleanup handlers.
+ (pthread_attr_t): Make 'valid' unsigned.
+ Define '_timeb' as 'timeb' for Ming32.
+ Define PT_STDCALL as nothing for Mingw32. May be temporary.
+
+ * cancel.c (pthread_testcancel): Cast return value.
+
+Wed Jan 20 09:31:28 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * pthread.h (pthread_mutexattr_t): Changed to a pointer.
+
+ * mutex.c (pthread_mutex_init): Conditionally create Win32 mutex
+ - from John Bossom's implementation.
+ (pthread_mutex_destroy): Conditionally close Win32 mutex
+ - from John Bossom's implementation.
+ (pthread_mutexattr_init): Replaced by John Bossom's version.
+ (pthread_mutexattr_destroy): Ditto.
+ (pthread_mutexattr_getpshared): New function from John Bossom's
+ implementation.
+ (pthread_mutexattr_setpshared): New function from John Bossom's
+ implementation.
+
+Tue Jan 19 18:27:42 1999 Ross Johnson <rpj@swan.canberra.edu.au>
+
+ * pthread.h (pthreadCancelableTimedWait): New prototype.
+ (pthreadCancelableWait): Remove second argument.
+
+ * misc.c (CancelableWait): New static function is
+ pthreadCancelableWait() renamed.
+ (pthreadCancelableWait): Now just calls CancelableWait() with
+ INFINITE timeout.
+ (pthreadCancelableTimedWait): Just calls CancelableWait()
+ with passed in timeout.
+
+ * private.c (ptw32_sem_timedwait): 'abstime' arg really is
+ absolute time. Calculate relative time to wait from current
+ time before passing timeout to new routine
+ pthreadCancelableTimedWait().
+ - Scott Lightner <scott@curriculum.com>
+
+Tue Jan 19 10:27:39 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * pthread.h (pthread_mutexattr_setforcecs_np): New prototype.
+
+ * mutex.c (pthread_mutexattr_init): Init 'pshared' and 'forcecs'
+ attributes to 0.
+ (pthread_mutexattr_setforcecs_np): New function (not portable).
+
+ * pthread.h (pthread_mutex_t):
+ Add 'mutex' element. Set to NULL in PTHREAD_MUTEX_INITIALIZER.
+ The pthread_mutex_*() routines will try to optimise performance
+ by choosing either mutexes or critical sections as the basis
+ for pthread mutexes for each indevidual mutex.
+ (pthread_mutexattr_t_): Add 'forcecs' element.
+ Some applications may choose to force use of critical sections
+ if they know that:-
+ the mutex is PROCESS_PRIVATE and,
+ either the OS supports TryEnterCriticalSection() or
+ pthread_mutex_trylock() will never be called on the mutex.
+ This attribute will be setable via a non-portable routine.
+
+ Note: We don't yet support PROCESS_SHARED mutexes, so the
+ implementation as it stands will default to Win32 mutexes only if
+ the OS doesn't support TryEnterCriticalSection. On Win9x, and early
+ versions of NT 'forcecs' will need to be set in order to get
+ critical section based mutexes.
+
+Sun Jan 17 12:01:26 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * pthread.h (PTHREAD_MUTEX_INITIALIZER): Init new 'staticinit'
+ value to '1' and existing 'valid' value to '1'.
+
+ * global.c (ptw32_mutex_test_init_lock): Add.
+
+ * implement.h (ptw32_mutex_test_init_lock.): Add extern.
+
+ * private.c (ptw32_processInitialize): Init critical section for
+ global lock used by _mutex_check_need_init().
+ (ptw32_processTerminate): Ditto (:s/Init/Destroy/).
+
+ * dll.c (dllMain): Move call to FreeLibrary() so that it is only
+ called once when the process detaches.
+
+ * mutex.c (_mutex_check_need_init): New static function to test
+ and init PTHREAD_MUTEX_INITIALIZER mutexes. Provides serialised
+ access to the internal state of the uninitialised static mutex.
+ Called from pthread_mutex_trylock() and pthread_mutex_lock() which
+ do a quick unguarded test to check if _mutex_check_need_init()
+ needs to be called. This is safe as the test is conservative
+ and is repeated inside the guarded section of
+ _mutex_check_need_init(). Thus in all calls except the first
+ calls to lock static mutexes, the additional overhead to lock any
+ mutex is a single memory fetch and test for zero.
+
+ * pthread.h (pthread_mutex_t_): Add 'staticinit' member. Mutexes
+ initialised by PTHREAD_MUTEX_INITIALIZER aren't really initialised
+ until the first attempt to lock it. Using the 'valid'
+ flag (which flags the mutex as destroyed or not) to record this
+ information would be messy. It is possible for a statically
+ initialised mutex such as this to be destroyed before ever being
+ used.
+
+ * mutex.c (pthread_mutex_trylock): Call _mutex_check_need_init()
+ to test/init PTHREAD_MUTEX_INITIALIZER mutexes.
+ (pthread_mutex_lock): Ditto.
+ (pthread_mutex_unlock): Add check to ensure we don't try to unlock
+ an unitialised static mutex.
+ (pthread_mutex_destroy): Add check to ensure we don't try to delete
+ a critical section that we never created. Allows us to destroy
+ a static mutex that has never been locked (and hence initialised).
+ (pthread_mutex_init): Set 'staticinit' flag to 0 for the new mutex.
+
+Sun Jan 17 12:01:26 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * private.c (ptw32_sem_timedwait): Move from semaphore.c.
+
+ * semaphore.c : Remove redundant #includes.
+ (ptw32_sem_timedwait): Move to private.c.
+ (sem_wait): Add missing abstime arg to pthreadCancelableWait() call.
+
+Fri Jan 15 23:38:05 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * condvar.c (cond_timedwait): Remove comment.
+
+Fri Jan 15 15:41:28 1999 Ross Johnson <rpj@swan.canberra.edu.au>
+
+ * pthread.h: Add new 'abstime' arg to pthreadCancelableWait()
+ prototype.
+
+ * condvar.c (cond_timedwait): New generalised function called by
+ both pthread_cond_wait() and pthread_cond_timedwait(). This is
+ essentially pthread_cond_wait() renamed and modified to add the
+ 'abstime' arg and call the new ptw32_sem_timedwait() instead of
+ sem_wait().
+ (pthread_cond_wait): Now just calls the internal static
+ function cond_timedwait() with an INFINITE wait.
+ (pthread_cond_timedwait): Now implemented. Calls the internal
+ static function cond_timedwait().
+
+ * implement.h (ptw32_sem_timedwait): New internal function
+ prototype.
+
+ * misc.c (pthreadCancelableWait): Added new 'abstime' argument
+ to allow shorter than INFINITE wait.
+
+ * semaphore.c (ptw32_sem_timedwait): New function for internal
+ use. This is essentially sem_wait() modified to add the
+ 'abstime' arg and call the modified (see above)
+ pthreadCancelableWait().
+
+Thu Jan 14 14:27:13 1999 Ross Johnson <rpj@swan.canberra.edu.au>
+
+ * cleanup.c: Correct _cplusplus to __cplusplus wherever used.
+
+ * Makefile.in: Add CC=g++ and add -fhandle-exceptions to CFLAGS.
+ The derived Makefile will compile all units of the package as C++
+ so that those which include try/catch exception handling should work
+ properly. The package should compile ok if CC=gcc, however, exception
+ handling will not be included and thus thread cancellation, for
+ example, will not work.
+
+ * cleanup.c (ptw32_pop_cleanup): Add #warning to compile this
+ file as C++ if using a cygwin32 environment. Perhaps the whole package
+ should be compiled using g++ under cygwin.
+
+ * private.c (ptw32_threadStart): Change #error directive
+ into #warning and bracket for __CYGWIN__ and derivative compilers.
+
+Wed Jan 13 09:34:52 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * build.bat: Delete old binaries before compiling/linking.
+
+Tue Jan 12 09:58:38 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * dll.c: The Microsoft compiler pragmas probably are more
+ appropriately protected by _MSC_VER than by _WIN32.
+ - Tor Lillqvist <tml@iki.fi>.
+
+ * condvar.c (pthread_cond_timedwait): Fix function description
+ comments.
+
+ * pthread.h: Define ETIMEDOUT. This should be returned by
+ pthread_cond_timedwait which is not implemented yet as of
+ snapshot-1999-01-04-1305. It was implemented in the older version.
+ The Microsoft compiler pragmas probably are more appropriately
+ protected by _MSC_VER than by _WIN32.
+ - Tor Lillqvist <tml@iki.fi>.
+
+ * pthread.def: pthread_mutex_destroy was missing from the def file
+ - Tor Lillqvist <tml@iki.fi>.
+
+ * condvar.c (pthread_cond_broadcast): Ensure we only wait on threads
+ if there were any waiting on the condition.
+ I think pthread_cond_broadcast should do the WaitForSingleObject
+ only if cv->waiters > 0? Otherwise it seems to hang, at least in the
+ testg thread program from glib.
+ - Tor Lillqvist <tml@iki.fi>.
+
+ * semaphore.c (sem_post): Correct typo in comment.
+
+Mon Jan 11 20:33:19 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * pthread.h: Re-arrange conditional compile of pthread_cleanup-*
+ macros.
+
+ * cleanup.c (ptw32_push_cleanup): Provide conditional
+ compile of cleanup->prev.
+
+1999-01-11 Ben Elliston <bje@cygnus.com>
+
+ * condvar.c (pthread_cond_init): Invert logic when testing the
+ return value from calloc().
+ - Tor Lillqvist <tml@iki.fi>.
+
+Sat Jan 9 14:32:08 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * implement.h: Compile-time switch for CYGWIN derived environments
+ to use CreateThread instead of _beginthreadex. Ditto for ExitThread.
+ Patch provided by Anders Norlander <anorland@hem2.passagen.se>.
+
+Tue Jan 5 16:33:04 1999 Ross Johnson <rpj@swan.canberra.edu.au>
+
+ * cleanup.c (ptw32_pop_cleanup): Add C++ version of __try/__except
+ block. Move trailing "}" out of #ifdef _WIN32 block left there by
+ (rpj's) mistake.
+
+ * private.c: Remove #include <errno.h> which is included by pthread.h.
+
+1998-12-11 Ben Elliston <bje@toilet.to.cygnus.com>
+
+ * README: Update info about subscribing to the mailing list.
+
+Mon Jan 4 11:23:40 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * all: No code changes, just cleanup.
+ - remove #if 0 /* Pre Bossom */ enclosed code.
+ - Remove some redundant #includes.
+ * pthread.h: Update implemented/unimplemented routines list.
+ * Tag the bossom merge branch getting ready to merge back to main
+ trunk.
+
+Tue Dec 29 13:11:16 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * implement.h: Move the following struct definitions to pthread.h:
+ pthread_t_, pthread_attr_t_, pthread_mutex_t_, pthread_mutex_t_,
+ pthread_mutexattr_t_, pthread_key_t_, pthread_cond_t_,
+ pthread_condattr_t_, pthread_once_t_.
+
+ * pthread.h: Add "_" prefix to pthread_push_cleanup and
+ pthread_pop_cleanup internal routines, and associated struct and
+ typedefs.
+
+ * buildlib.bat: Add compile command for semaphore.c
+
+ * pthread.def: Comment out pthread_atfork routine name.
+ Now unimplemented.
+
+ * tsd.c (pthread_setspecific): Rename tkAssocCreate to
+ ptw32_tkAssocCreate.
+ (pthread_key_delete): Rename tkAssocDestroy to
+ ptw32_tkAssocDestroy.
+
+ * sync.c (pthread_join): Rename threadDestroy to ptw32_threadDestroy
+
+ * sched.c (is_attr): attr is now **attr (was *attr), so add extra
+ NULL pointer test.
+ (pthread_attr_setschedparam): Increase redirection for attr which is
+ now a **.
+ (pthread_attr_getschedparam): Ditto.
+ (pthread_setschedparam): Change thread validation and rename "thread"
+ Win32 thread Handle element name to match John Bossom's version.
+ (pthread_getschedparam): Ditto.
+
+ * private.c (ptw32_threadDestroy): Rename call to
+ callUserDestroyRoutines() as ptw32_callUserDestroyRoutines()
+
+ * misc.c: Add #include "implement.h".
+
+ * dll.c: Remove defined(KLUDGE) wrapped code.
+
+ * fork.c: Remove redefinition of ENOMEM.
+ Remove pthread_atfork() and fork() with #if 0/#endif.
+
+ * create.c (pthread_create): Rename threadStart and threadDestroy calls
+ to ptw32_threadStart and ptw32_threadDestroy.
+
+ * implement.h: Rename "detachedstate" to "detachstate".
+
+ * attr.c: Rename "detachedstate" to "detachstate".
+
+Mon Dec 28 09:54:39 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * semaphore.c: Initial version. From John Bossom's implementation.
+ * semaphore.h: Initial version. From John Bossom's implementation.
+
+Mon Dec 28 09:54:39 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * pthread.h (pthread_attr_t_): Change to *pthread_attr_t.
+
+ * attr.c (pthread_attr_setstacksize): Merge with John Bossom's version.
+ (pthread_attr_getstacksize): Merge with John Bossom's version.
+ (pthread_attr_setstackaddr): Merge with John Bossom's version.
+ (pthread_attr_getstackaddr): Merge with John Bossom's version.
+ (pthread_attr_init): Merge with John Bossom's version.
+ (pthread_attr_destroy): Merge with John Bossom's version.
+ (pthread_attr_getdetachstate): Merge with John Bossom's version.
+ (pthread_attr_setdetachstate): Merge with John Bossom's version.
+ (is_attr): attr is now **attr (was *attr), so add extra NULL pointer
+ test.
+
+ * implement.h (pthread_attr_t_): Add and rename elements in JEB's
+ version to correspond to original, so that it can be used with
+ original attr routines.
+
+ * pthread.h: Add #endif at end which was truncated in merging.
+
+Sun Dec 20 14:51:58 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * misc.c (pthreadCancelableWait): New function by John Bossom. Non-standard
+ but provides a hook that can be used to implement cancellation points in
+ applications that use this library.
+
+ * pthread.h (pthread_cleanup_pop): C++ (non-WIN32) version uses
+ try/catch to emulate John Bossom's WIN32 __try/__finally behaviour.
+ In the WIN32 version __finally block, add a test for AbnormalTermination otherwise
+ cleanup is only run if the cleanup_pop execute arg is non-zero. Cancellation
+ should cause the cleanup to run irrespective of the execute arg.
+
+ * condvar.c (pthread_condattr_init): Replaced by John Bossom's version.
+ (pthread_condattr_destroy): Replaced by John Bossom's version.
+ (pthread_condattr_getpshared): Replaced by John Bossom's version.
+ (pthread_condattr_setpshared): Replaced by John Bossom's version.
+ (pthread_cond_init): Replaced by John Bossom's version.
+ Fix comment (refered to mutex rather than condition variable).
+ (pthread_cond_destroy): Replaced by John Bossom's version.
+ (pthread_cond_wait): Replaced by John Bossom's version.
+ (pthread_cond_timedwait): Replaced by John Bossom's version.
+ (pthread_cond_signal): Replaced by John Bossom's version.
+ (pthread_cond_broadcast): Replaced by John Bossom's version.
+
+Thu Dec 17 19:10:46 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * tsd.c (pthread_key_create): Replaced by John Bossom's version.
+ (pthread_key_delete): Replaced by John Bossom's version.
+ (pthread_setspecific): Replaced by John Bossom's version.
+ (pthread_getspecific): Replaced by John Bossom's version.
+
+Mon Dec 7 09:44:40 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * cancel.c (pthread_setcancelstate): Replaced by John Bossom's version.
+ (pthread_setcanceltype): Replaced by John Bossom's version.
+ (pthread_testcancel): Replaced by John Bossom's version.
+ (pthread_cancel): Replaced by John Bossom's version.
+
+ * exit.c (pthread_exit): Replaced by John Bossom's version.
+
+ * misc.c (pthread_self): Replaced by John Bossom's version.
+ (pthread_equal): Replaced by John Bossom's version.
+
+ * sync.c (pthread_detach): Replaced by John Bossom's version.
+ (pthread_join): Replaced by John Bossom's version.
+
+ * create.c (pthread_create): Replaced by John Bossom's version.
+
+ * private.c (ptw32_processInitialize): New by John Bossom.
+ (ptw32_processTerminate): Non-public function by John Bossom.
+ (ptw32_threadStart): Non-public function by John Bossom.
+ (ptw32_threadDestroy): Non-public function by John Bossom.
+ (ptw32_cleanupStack): Non-public function by John Bossom.
+ (ptw32_tkAssocCreate): Non-public function by John Bossom.
+ (ptw32_tkAssocDestroy): Non-public function by John Bossom.
+ (ptw32_callUserDestroyRoutines): Non-public function by John Bossom.
+
+ * implement.h: Added John Bossom's non-API structures and
+ declarations.
+
+ * dll.c (PthreadsEntryPoint): Cast return value of GetProcAddress
+ to resolve compile warning from MSVC.
+
+ * dll.c (DLLmain): Replaced by John Bossom's version.
+ * dll.c (PthreadsEntryPoint):
+ Re-applied Anders Norlander's patch:-
+ Initialize ptw32_try_enter_critical_section at startup
+ and release kernel32 handle when DLL is being unloaded.
+
+Sun Dec 6 21:54:35 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * buildlib.bat: Fix args to CL when building the .DLL
+
+ * cleanup.c (ptw32_destructor_run_all): Fix TSD key management.
+ This is a tidy-up before TSD and Thread management is completely
+ replaced by John Bossom's code.
+
+ * tsd.c (pthread_key_create): Fix TSD key management.
+
+ * global.c (ptw32_key_virgin_next): Initialise.
+
+ * build.bat: New DOS script to compile and link a pthreads app
+ using Microsoft's CL compiler linker.
+ * buildlib.bat: New DOS script to compile all the object files
+ and create pthread.lib and pthread.dll using Microsoft's CL
+ compiler linker.
+
+1998-12-05 Anders Norlander <anorland@hem2.passagen.se>
+
+ * implement.h (ptw32_try_enter_critical_section): New extern
+ * dll.c (ptw32_try_enter_critical_section): New pointer to
+ TryEnterCriticalSection if it exists; otherwise NULL.
+ * dll.c (PthreadsEntryPoint):
+ Initialize ptw32_try_enter_critical_section at startup
+ and release kernel32 handle when DLL is being unloaded.
+ * mutex.c (pthread_mutex_trylock): Replaced check for NT with
+ a check if ptw32_try_enter_critical_section is valid
+ pointer to a function. Call ptw32_try_enter_critical_section
+ instead of TryEnterCriticalSection to avoid errors on Win95.
+
+Thu Dec 3 13:32:00 1998 Ross Johnson <rpj@ise.canberra.edu.au>
+
+ * README: Correct cygwin32 compatibility statement.
+
+Sun Nov 15 21:24:06 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * cleanup.c (ptw32_destructor_run_all): Declare missing void * arg.
+ Fixup CVS merge conflicts.
+
+1998-10-30 Ben Elliston <bje@cygnus.com>
+
+ * condvar.c (cond_wait): Fix semantic error. Test for equality
+ instead of making an assignment.
+
+Fri Oct 30 15:15:50 1998 Ross Johnson <rpj@swan.canberra.edu.au>
+
+ * cleanup.c (ptw32_handler_push): Fixed bug appending new
+ handler to list reported by Peter Slacik
+ <Peter.Slacik@leibinger.freinet.de>.
+ (new_thread): Rename poorly named local variable to
+ "new_handler".
+
+Sat Oct 24 18:34:59 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * global.c: Add TSD key management array and index declarations.
+
+ * implement.h: Ditto for externs.
+
+Fri Oct 23 00:08:09 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * implement.h (PTW32_TSD_KEY_REUSE): Add enum.
+
+ * private.c (ptw32_delete_thread): Add call to
+ ptw32_destructor_run_all() to clean up the threads keys.
+
+ * cleanup.c (ptw32_destructor_run_all): Check for no more dirty
+ keys to run destructors on. Assume that the destructor call always
+ succeeds and set the key value to NULL.
+
+Thu Oct 22 21:44:44 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * tsd.c (pthread_setspecific): Add key management code.
+ (pthread_key_create): Ditto.
+ (pthread_key_delete): Ditto.
+
+ * implement.h (struct ptw32_tsd_key): Add status member.
+
+ * tsd.c: Add description of pthread_key_delete() from the
+ standard as a comment.
+
+Fri Oct 16 17:38:47 1998 Ross Johnson <rpj@swan.canberra.edu.au>
+
+ * cleanup.c (ptw32_destructor_run_all): Fix and improve
+ stepping through the key table.
+
+Thu Oct 15 14:05:01 1998 Ross Johnson <rpj@swan.canberra.edu.au>
+
+ * private.c (ptw32_new_thread): Remove init of destructorstack.
+ No longer an element of pthread_t.
+
+ * tsd.c (pthread_setspecific): Fix type declaration and cast.
+ (pthread_getspecific): Ditto.
+ (pthread_getspecific): Change error return value to NULL if key
+ is not in use.
+
+Thu Oct 15 11:53:21 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * global.c (ptw32_tsd_key_table): Fix declaration.
+
+ * implement.h(ptw32_TSD_keys_TlsIndex): Add missing extern.
+ (ptw32_tsd_mutex): Ditto.
+
+ * create.c (ptw32_start_call): Fix "keys" array declaration.
+ Add comment.
+
+ * tsd.c (pthread_setspecific): Fix type declaration and cast.
+ (pthread_getspecific): Ditto.
+
+ * cleanup.c (ptw32_destructor_run_all): Declare missing loop
+ counter.
+
+Wed Oct 14 21:09:24 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * private.c (ptw32_new_thread): Increment ptw32_threads_count.
+ (ptw32_delete_thread): Decrement ptw32_threads_count.
+ Remove some comments.
+
+ * exit.c (ptw32_exit): : Fix two pthread_mutex_lock() calls that
+ should have been pthread_mutex_unlock() calls.
+ (ptw32_vacuum): Remove call to ptw32_destructor_pop_all().
+
+ * create.c (pthread_create): Fix two pthread_mutex_lock() calls that
+ should have been pthread_mutex_unlock() calls.
+
+ * global.c (ptw32_tsd_mutex): Add mutex for TSD operations.
+
+ * tsd.c (pthread_key_create): Add critical section.
+ (pthread_setspecific): Ditto.
+ (pthread_getspecific): Ditto.
+ (pthread_key_delete): Ditto.
+
+ * sync.c (pthread_join): Fix two pthread_mutex_lock() calls that
+ should have been pthread_mutex_unlock() calls.
+
+Mon Oct 12 00:00:44 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * implement.h (ptw32_tsd_key_table): New.
+
+ * create.c (ptw32_start_call): Initialise per-thread TSD keys
+ to NULL.
+
+ * misc.c (pthread_once): Correct typo in comment.
+
+ * implement.h (ptw32_destructor_push): Remove.
+ (ptw32_destructor_pop): Remove.
+ (ptw32_destructor_run_all): Rename from ptw32_destructor_pop_all.
+ (PTW32_TSD_KEY_DELETED): Add enum.
+ (PTW32_TSD_KEY_INUSE): Add enum.
+
+ * cleanup.c (ptw32_destructor_push): Remove.
+ (ptw32_destructor_pop): Remove.
+ (ptw32_destructor_run_all): Totally revamped TSD.
+
+ * dll.c (ptw32_TSD_keys_TlsIndex): Initialise.
+
+ * tsd.c (pthread_setspecific): Totally revamped TSD.
+ (pthread_getspecific): Ditto.
+ (pthread_create): Ditto.
+ (pthread_delete): Ditto.
+
+Sun Oct 11 22:44:55 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * global.c (ptw32_tsd_key_table): Add new global.
+
+ * implement.h (ptw32_tsd_key_t and struct ptw32_tsd_key):
+ Add.
+ (struct _pthread): Remove destructorstack.
+
+ * cleanup.c (ptw32_destructor_run_all): Rename from
+ ptw32_destructor_pop_all. The key destructor stack was made
+ global rather than per-thread. No longer removes destructor nodes
+ from the stack. Comments updated.
+
+1998-10-06 Ben Elliston <bje@cygnus.com>
+
+ * condvar.c (cond_wait): Use POSIX, not Win32 mutex calls.
+ (pthread_cond_broadcast): Likewise.
+ (pthread_cond_signal): Likewise.
+
+1998-10-05 Ben Elliston <bje@cygnus.com>
+
+ * pthread.def: Update. Some functions aren't available yet, others
+ are macros in <pthread.h>.
+
+ * tests/join.c: Remove; useless.
+
+Mon Oct 5 14:25:08 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * pthread.def: New file for building the DLL.
+
+1998-10-05 Ben Elliston <bje@cygnus.com>
+
+ * misc.c (pthread_equal): Correct inverted logic bug.
+ (pthread_once): Use the POSIX mutex primitives, not Win32. Remove
+ irrelevant FIXME comment.
+
+ * global.c (PTHREAD_MUTEX_INITIALIZER): Move to pthread.h.
+
+ * pthread.h (PTHREAD_MUTEX_INITIALIZER): Define.
+ (pthread_mutex_t): Reimplement as a struct containing a valid
+ flag. If the flag is ever down upon entry to a mutex operation,
+ we call pthread_mutex_create() to initialise the object. This
+ fixes the problem of how to handle statically initialised objects
+ that can't call InitializeCriticalSection() due to their context.
+ (PTHREAD_ONCE_INIT): Define.
+
+ * mutex.c (pthread_mutex_init): Set valid flag.
+ (pthread_mutex_destroy): Clear valid flag.
+ (pthread_mutex_lock): Check and handle the valid flag.
+ (pthread_mutex_unlock): Likewise.
+ (pthread_mutex_trylock): Likewise.
+
+ * tests/mutex3.c: New file; test for the static initialisation
+ macro. Passes.
+
+ * tests/create1.c: New file; test pthread_create(). Passes.
+
+ * tests/equal.c: Poor test; remove.
+
+ * tests/equal1.c New file; test pthread_equal(). Passes.
+
+ * tests/once1.c: New file; test for pthread_once(). Passes.
+
+ * tests/self.c: Remove; rename to self1.c.
+
+ * tests/self1.c: This is the old self.c.
+
+ * tests/self2.c: New file. Test pthread_self() with a single
+ thread. Passes.
+
+ * tests/self3.c: New file. Test pthread_self() with a couple of
+ threads to ensure their thread IDs differ. Passes.
+
+1998-10-04 Ben Elliston <bje@cygnus.com>
+
+ * tests/mutex2.c: Test pthread_mutex_trylock(). Passes.
+
+ * tests/mutex1.c: New basic test for mutex functions (it passes).
+ (main): Eliminate warning.
+
+ * configure.in: Test for __stdcall, not _stdcall. Typo.
+
+ * configure: Regenerate.
+
+ * attr.c (pthread_attr_setstackaddr): Remove FIXME comment. Win32
+ does know about ENOSYS after all.
+ (pthread_attr_setstackaddr): Likewise.
+
+1998-10-03 Ben Elliston <bje@cygnus.com>
+
+ * configure.in: Test for the `_stdcall' keyword. Define `STDCALL'
+ to `_stdcall' if we have it, null otherwise.
+
+ * configure: Regenerate.
+
+ * acconfig.h (STDCALL): New define.
+
+ * config.h.in: Regenerate.
+
+ * create.c (ptw32_start_call): Add STDCALL prefix.
+
+ * mutex.c (pthread_mutex_init): Correct function signature.
+
+ * attr.c (pthread_attr_init): Only zero out the `sigmask' member
+ if we have the sigset_t type.
+
+ * pthread.h: No need to include <unistd.h>. It doesn't even exist
+ on Win32! Again, an artifact of cross-compilation.
+ (pthread_sigmask): Only provide if we have the sigset_t type.
+
+ * process.h: Remove. This was a stand-in before we started doing
+ native compilation under Win32.
+
+ * pthread.h (pthread_mutex_init): Make `attr' argument const.
+
+1998-10-02 Ben Elliston <bje@cygnus.com>
+
+ * COPYING: Remove.
+
+ * COPYING.LIB: Add. This library is under the LGPL.
+
+1998-09-13 Ben Elliston <bje@cygnus.com>
+
+ * configure.in: Test for required system features.
+
+ * configure: Generate.
+
+ * acconfig.h: New file.
+
+ * config.h.in: Generate.
+
+ * Makefile.in: Renamed from Makefile.
+
+ * COPYING: Import from a recent GNU package.
+
+ * config.guess: Likewise.
+
+ * config.sub: Likewise.
+
+ * install-sh: Likewise.
+
+ * config.h: Remove.
+
+ * Makefile: Likewise.
+
+1998-09-12 Ben Elliston <bje@cygnus.com>
+
+ * windows.h: No longer needed; remove.
+
+ * windows.c: Likewise.
+
+Sat Sep 12 20:09:24 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * windows.h: Remove error number definitions. These are in <errno.h>
+
+ * tsd.c: Add comment explaining rationale for not building
+ POSIX TSD on top of Win32 TLS.
+
+1998-09-12 Ben Elliston <bje@cygnus.com>
+
+ * {most}.c: Include <errno.h> to get POSIX error values.
+
+ * signal.c (pthread_sigmask): Only provide if HAVE_SIGSET_T is
+ defined.
+
+ * config.h: #undef features, don't #define them. This will be
+ generated by autoconf very soon.
+
+1998-08-11 Ben Elliston <bje@cygnus.com>
+
+ * Makefile (LIB): Define.
+ (clean): Define target.
+ (all): Build a library not just the object files.
+
+ * pthread.h: Provide a definition for struct timespec if we don't
+ already have one.
+
+ * windows.c (TlsGetValue): Bug fix.
+
+Thu Aug 6 15:19:22 1998 Ross Johnson <rpj@swan.canberra.edu.au>
+
+ * misc.c (pthread_once): Fix arg 1 of EnterCriticalSection()
+ and LeaveCriticalSection() calls to pass address-of lock.
+
+ * fork.c (pthread_atfork): Typecast (void (*)(void *)) funcptr
+ in each ptw32_handler_push() call.
+
+ * exit.c (ptw32_exit): Fix attr arg in
+ pthread_attr_getdetachstate() call.
+
+ * private.c (ptw32_new_thread): Typecast (HANDLE) NULL.
+ (ptw32_delete_thread): Ditto.
+
+ * implement.h: (PTW32_MAX_THREADS): Add define. This keeps
+ changing in an attempt to make thread administration data types
+ opaque and cleanup DLL startup.
+
+ * dll.c (PthreadsEntryPoint):
+ (ptw32_virgins): Remove malloc() and free() calls.
+ (ptw32_reuse): Ditto.
+ (ptw32_win32handle_map): Ditto.
+ (ptw32_threads_mutex_table): Ditto.
+
+ * global.c (_POSIX_THREAD_THREADS_MAX): Initialise with
+ PTW32_MAX_THREADS.
+ (ptw32_virgins): Ditto.
+ (ptw32_reuse): Ditto.
+ (ptw32_win32handle_map): Ditto.
+ (ptw32_threads_mutex_table): Ditto.
+
+ * create.c (pthread_create): Typecast (HANDLE) NULL.
+ Typecast (unsigned (*)(void *)) start_routine.
+
+ * condvar.c (pthread_cond_init): Add address-of operator & to
+ arg 1 of pthread_mutex_init() call.
+ (pthread_cond_destroy): Add address-of operator & to
+ arg 1 of pthread_mutex_destroy() call.
+
+ * cleanup.c (ptw32_destructor_pop_all): Add (int) cast to
+ pthread_getspecific() arg.
+ (ptw32_destructor_pop): Add (void *) cast to "if" conditional.
+ (ptw32_destructor_push): Add (void *) cast to
+ ptw32_handler_push() "key" arg.
+ (malloc.h): Add include.
+
+ * implement.h (ptw32_destructor_pop): Add prototype.
+
+ * tsd.c (implement.h): Add include.
+
+ * sync.c (pthread_join): Remove target_thread_mutex and it's
+ initialisation. Rename getdetachedstate to getdetachstate.
+ Remove unused variable "exitcode".
+ (pthread_detach): Remove target_thread_mutex and it's
+ initialisation. Rename getdetachedstate to getdetachstate.
+ Rename setdetachedstate to setdetachstate.
+
+ * signal.c (pthread_sigmask): Rename SIG_SET to SIG_SETMASK.
+ Cast "set" to (long *) in assignment to passify compiler warning.
+ Add address-of operator & to thread->attr.sigmask in memcpy() call
+ and assignment.
+ (pthread_sigmask): Add address-of operator & to thread->attr.sigmask
+ in memcpy() call and assignment.
+
+ * windows.h (THREAD_PRIORITY_ERROR_RETURN): Add.
+ (THREAD_PRIORITY_LOWEST): Add.
+ (THREAD_PRIORITY_HIGHEST): Add.
+
+ * sched.c (is_attr): Add function.
+ (implement.h): Add include.
+ (pthread_setschedparam): Rename all instances of "sched_policy"
+ to "sched_priority".
+ (pthread_getschedparam): Ditto.
+
+Tue Aug 4 16:57:58 1998 Ross Johnson <rpj@swan.canberra.edu.au>
+
+ * private.c (ptw32_delete_thread): Fix typo. Add missing ';'.
+
+ * global.c (ptw32_virgins): Change types from pointer to
+ array pointer.
+ (ptw32_reuse): Ditto.
+ (ptw32_win32handle_map): Ditto.
+ (ptw32_threads_mutex_table): Ditto.
+
+ * implement.h(ptw32_virgins): Change types from pointer to
+ array pointer.
+ (ptw32_reuse): Ditto.
+ (ptw32_win32handle_map): Ditto.
+ (ptw32_threads_mutex_table): Ditto.
+
+ * private.c (ptw32_delete_thread): Fix "entry" should be "thread".
+
+ * misc.c (pthread_self): Add extern for ptw32_threadID_TlsIndex.
+
+ * global.c: Add comment.
+
+ * misc.c (pthread_once): Fix member -> dereferences.
+ Change ptw32_once_flag to once_control->flag in "if" test.
+
+Tue Aug 4 00:09:30 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * implement.h(ptw32_virgins): Add extern.
+ (ptw32_virgin_next): Ditto.
+ (ptw32_reuse): Ditto.
+ (ptw32_reuse_top): Ditto.
+ (ptw32_win32handle_map): Ditto.
+ (ptw32_threads_mutex_table): Ditto.
+
+ * global.c (ptw32_virgins): Changed from array to pointer.
+ Storage allocation for the array moved into dll.c.
+ (ptw32_reuse): Ditto.
+ (ptw32_win32handle_map): Ditto.
+ (ptw32_threads_mutex_table): Ditto.
+
+ * dll.c (PthreadsEntryPoint): Set up thread admin storage when
+ DLL is loaded.
+
+ * fork.c (pthread_atfork): Fix function pointer arg to all
+ ptw32_handler_push() calls. Change "arg" arg to NULL in child push.
+
+ * exit.c: Add windows.h and process.h includes.
+ (ptw32_exit): Add local detachstate declaration.
+ (ptw32_exit): Fix incorrect name for pthread_attr_getdetachstate().
+
+ * pthread.h (_POSIX_THREAD_ATTR_STACKSIZE): Move from global.c
+ (_POSIX_THREAD_ATTR_STACKADDR): Ditto.
+
+ * create.c (pthread_create): Fix #if should be #ifdef.
+ (ptw32_start_call): Remove usused variables.
+
+ * process.h: Create.
+
+ * windows.h: Move _beginthreadex and _endthreadex into
+ process.h
+
+Mon Aug 3 21:19:57 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * condvar.c (pthread_cond_init): Add NULL attr to
+ pthread_mutex_init() call - default attributes will be used.
+ (cond_wait): Fix typo.
+ (cond_wait): Fix typo - cv was ev.
+ (pthread_cond_broadcast): Fix two identical typos.
+
+ * cleanup.c (ptw32_destructor_pop_all): Remove _ prefix from
+ PTHREAD_DESTRUCTOR_ITERATIONS.
+
+ * pthread.h: Move _POSIX_* values into posix.h
+
+ * pthread.h: Fix typo in pthread_mutex_init() prototype.
+
+ * attr.c (pthread_attr_init): Fix error in priority member init.
+
+ * windows.h (THREAD_PRIORITY_NORMAL): Add.
+
+ * pthread.h (sched_param): Add missing ';' to struct definition.
+
+ * attr.c (pthread_attr_init): Remove obsolete pthread_attr_t
+ member initialisation - cancelstate, canceltype, cancel_pending.
+ (is_attr): Make arg "attr" a const.
+
+ * implement.h (PTW32_HANDLER_POP_LIFO): Remove definition.
+ (PTW32_HANDLER_POP_FIFO): Ditto.
+ (PTW32_VALID): Add missing newline escape (\).
+ (ptw32_handler_node): Make element "next" a pointer.
+
+1998-08-02 Ben Elliston <bje@cygnus.com>
+
+ * windows.h: Remove duplicate TlsSetValue() prototype. Add
+ TlsGetValue() prototype.
+ (FALSE): Define.
+ (TRUE): Likewise.
+ Add forgotten errno values. Guard against multiple #includes.
+
+ * windows.c: New file. Implement stubs for Win32 functions.
+
+ * Makefile (SRCS): Remove. Not explicitly needed.
+ (CFLAGS): Add -Wall for all warnings with GCC.
+
+Sun Aug 2 19:03:42 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * config.h: Create. This is a temporary stand-in for autoconf yet
+ to be done.
+ (HAVE_SIGNAL_H): Add.
+
+ * pthread.h: Minor rearrangement for temporary config.h.
+
+Fri Jul 31 14:00:29 1998 Ross Johnson <rpj@swan.canberra.edu.au>
+
+ * cleanup.c (ptw32_destructor_pop): Implement. Removes
+ destructors associated with a key without executing them.
+ (ptw32_destructor_pop_all): Add FIXME comment.
+
+ * tsd.c (pthread_key_delete): Add call to ptw32_destructor_pop().
+
+Fri Jul 31 00:05:45 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * tsd.c (pthread_key_create): Update to properly associate
+ the destructor routine with the key.
+ (pthread_key_delete): Add FIXME comment.
+
+ * exit.c (ptw32_vacuum): Add call to
+ ptw32_destructor_pop_all().
+
+ * implement.h (ptw32_handler_pop_all): Add prototype.
+ (ptw32_destructor_pop_all): Ditto.
+
+ * cleanup.c (ptw32_destructor_push): Implement. This is just a
+ call to ptw32_handler_push().
+ (ptw32_destructor_pop_all): Implement. This is significantly
+ different to ptw32_handler_pop_all().
+
+ * Makefile (SRCS): Create. Preliminary.
+
+ * windows.h: Create. Contains Win32 definitions for compile
+ testing. This is just a standin for the real one.
+
+ * pthread.h (SIG_UNBLOCK): Fix typo. Was SIG_BLOCK.
+ (windows.h): Add include. Required for CRITICAL_SECTION.
+ (pthread_cond_t): Move enum declaration outside of struct
+ definition.
+ (unistd.h): Add include - may be temporary.
+
+ * condvar.c (windows.h): Add include.
+
+ * implement.h (PTW32_THIS): Remove - no longer required.
+ (PTW32_STACK): Use pthread_self() instead of PTW32_THIS.
+
+Thu Jul 30 23:12:45 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * implement.h: Remove ptw32_find_entry() prototype.
+
+ * private.c: Extend comments.
+ Remove ptw32_find_entry() - no longer needed.
+
+ * create.c (ptw32_start_call): Add call to TlsSetValue() to
+ store the thread ID.
+
+ * dll.c (PthreadsEntryPoint): Implement. This is called
+ whenever a process loads the DLL. Used to initialise thread
+ local storage.
+
+ * implement.h: Add ptw32_threadID_TlsIndex.
+ Add ()s around PTW32_VALID expression.
+
+ * misc.c (pthread_self): Re-implement using Win32 TLS to store
+ the threads own ID.
+
+Wed Jul 29 11:39:03 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * private.c: Corrections in comments.
+ (ptw32_new_thread): Alter "if" flow to be more natural.
+
+ * cleanup.c (ptw32_handler_push): Same as below.
+
+ * create.c (pthread_create): Same as below.
+
+ * private.c (ptw32_new_thread): Rename "new" to "new_thread".
+ Since when has a C programmer been required to know C++?
+
+Tue Jul 28 14:04:29 1998 Ross Johnson <rpj@swan.canberra.edu.au>
+
+ * implement.h: Add PTW32_VALID macro.
+
+ * sync.c (pthread_join): Modify to use the new thread
+ type and ptw32_delete_thread(). Rename "target" to "thread".
+ Remove extra local variable "target".
+ (pthread_detach): Ditto.
+
+ * signal.c (pthread_sigmask): Move init of "us" out of inner block.
+ Fix instance of "this" should have been "us". Rename "us" to "thread".
+
+ * sched.c (pthread_setschedparam): Modify to use the new thread
+ type.
+ (pthread_getschedparam): Ditto.
+
+ * private.c (ptw32_find_thread): Fix return type and arg.
+
+ * implement.h: Remove PTW32_YES and PTW32_NO.
+ (ptw32_new_thread): Add prototype.
+ (ptw32_find_thread): Ditto.
+ (ptw32_delete_thread): Ditto.
+ (ptw32_new_thread_entry): Remove prototype.
+ (ptw32_find_thread_entry): Ditto.
+ (ptw32_delete_thread_entry): Ditto.
+ ( PTW32_NEW, PTW32_INUSE, PTW32_EXITED, PTW32_REUSE):
+ Add.
+
+
+ * create.c (pthread_create): Minor rename "us" to "new" (I need
+ these cues but it doesn't stop me coming out with some major bugs
+ at times).
+ Load start_routine and arg into the thread so the wrapper can
+ call it.
+
+ * exit.c (pthread_exit): Fix pthread_this should be pthread_self.
+
+ * cancel.c (pthread_setcancelstate): Change
+ ptw32_threads_thread_t * to pthread_t and init with
+ pthread_this().
+ (pthread_setcanceltype): Ditto.
+
+ * exit.c (ptw32_exit): Add new pthread_t arg.
+ Rename ptw32_delete_thread_entry to ptw32_delete_thread.
+ Rename "us" to "thread".
+ (pthread_exit): Call ptw32_exit with added thread arg.
+
+ * create.c (ptw32_start_call): Insert missing ")".
+ Add "us" arg to ptw32_exit() call.
+ (pthread_create): Modify to use new thread allocation scheme.
+
+ * private.c: Added detailed explanation of the new thread
+ allocation scheme.
+ (ptw32_new_thread): Totally rewritten to use
+ new thread allocation scheme.
+ (ptw32_delete_thread): Ditto.
+ (ptw32_find_thread): Obsolete.
+
+Mon Jul 27 17:46:37 1998 Ross Johnson <rpj@swan.canberra.edu.au>
+
+ * create.c (pthread_create): Start of rewrite. Not completed yet.
+
+ * private.c (ptw32_new_thread_entry): Start of rewrite. Not
+ complete.
+
+ * implement.h (ptw32_threads_thread): Rename, remove thread
+ member, add win32handle and ptstatus members.
+ (ptw32_t): Add.
+
+ * pthread.h: pthread_t is no longer mapped directly to a Win32
+ HANDLE type. This is so we can let the Win32 thread terminate and
+ reuse the HANDLE while pthreads holds it's own thread ID until
+ the last waiting join exits.
+
+Mon Jul 27 00:20:37 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * private.c (ptw32_delete_thread_entry): Destroy the thread
+ entry attribute object before deleting the thread entry itself.
+
+ * attr.c (pthread_attr_init): Initialise cancel_pending = FALSE.
+ (pthread_attr_setdetachstate): Rename "detached" to "detachedstate".
+ (pthread_attr_getdetachstate): Ditto.
+
+ * exit.c (ptw32_exit): Fix incorrect check for detachedstate.
+
+ * implement.h (ptw32_call_t): Remove env member.
+
+Sun Jul 26 13:06:12 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * implement.h (ptw32_new_thread_entry): Fix prototype.
+ (ptw32_find_thread_entry): Ditto.
+ (ptw32_delete_thread_entry): Ditto.
+ (ptw32_exit): Add prototype.
+
+ * exit.c (ptw32_exit): New function. Called from pthread_exit()
+ and ptw32_start_call() to exit the thread. It allows an extra
+ argument which is the return code passed to _endthreadex().
+ (ptw32_exit): Move thread entry delete call from ptw32_vacuum()
+ into here. Add more explanation of thread entry deletion.
+ (ptw32_exit): Clarify comment.
+
+ * create.c (ptw32_start_call): Change pthread_exit() call to
+ ptw32_exit() call.
+
+ * exit.c (ptw32_vacuum): Add thread entry deletion code
+ moved from ptw32_start_call(). See next item.
+ (pthread_exit): Remove longjmp(). Add mutex lock around thread table
+ manipulation code. This routine now calls _enthreadex().
+
+ * create.c (ptw32_start_call): Remove setjmp() call and move
+ cleanup code out. Call pthread_exit(NULL) to terminate the thread.
+
+1998-07-26 Ben Elliston <bje@cygnus.com>
+
+ * tsd.c (pthread_getspecific): Update comments.
+
+ * mutex.c (pthread_mutexattr_setpshared): Not supported; remove.
+ (pthread_mutexattr_getpshared): Likewise.
+
+ * pthread.h (pthread_mutexattr_setpshared): Remove prototype.
+ (pthread_mutexattr_getpshared): Likewise.
+
+Sun Jul 26 00:09:59 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * sync.c: Rename all instances of ptw32_count_mutex to
+ ptw32_table_mutex.
+
+ * implement.h: Rename ptw32_count_mutex to
+ ptw32_table_mutex.
+
+ * global.c: Rename ptw32_count_mutex to
+ ptw32_table_mutex.
+
+ * create.c (pthread_create): Add critical sections.
+ (ptw32_start_call): Rename ptw32_count_mutex to
+ ptw32_table_mutex.
+
+ * cancel.c (pthread_setcancelstate): Fix indirection bug and rename
+ "this" to "us".
+
+ * signal.c (pthread_sigmask): Rename "this" to "us" and fix some
+ minor syntax errors. Declare "us" and initialise it.
+
+ * sync.c (pthread_detach): Rename "this" to "target".
+
+ * pthread.h: Converting PTHREAD_* defines to alias the (const int)
+ values in global.c.
+
+ * global.c: Started converting PTHREAD_* defines to (const int) as
+ a part of making the eventual pthreads DLL binary compatible
+ through version changes.
+
+ * condvar.c (cond_wait): Add cancelation point. This applies the
+ point to both pthread_cond_wait() and pthread_cond_timedwait().
+
+ * exit.c (pthread_exit): Rename "this" to "us".
+
+ * implement.h: Add comment.
+
+ * sync.c (pthread_join): I've satisfied myself that pthread_detach()
+ does set the detached attribute in the thread entry attributes
+ to PTHREAD_CREATE_DETACHED. "if" conditions were changed to test
+ that attribute instead of a separate flag.
+
+ * create.c (pthread_create): Rename "this" to "us".
+ (pthread_create): cancelstate and canceltype are not attributes
+ so the copy to thread entry attribute storage was removed.
+ Only the thread itself can change it's cancelstate or canceltype,
+ ie. the thread must exist already.
+
+ * private.c (ptw32_delete_thread_entry): Mutex locks removed.
+ Mutexes must be applied at the caller level.
+ (ptw32_new_thread_entry): Ditto.
+ (ptw32_new_thread_entry): Init cancelstate, canceltype, and
+ cancel_pending to default values.
+ (ptw32_new_thread_entry): Rename "this" to "new".
+ (ptw32_find_thread_entry): Rename "this" to "entry".
+ (ptw32_delete_thread_entry): Rename "thread_entry" to "entry".
+
+ * create.c (ptw32_start_call): Mutexes changed to
+ ptw32_count_mutex. All access to the threads table entries is
+ under the one mutex. Otherwise chaos reigns.
+
+Sat Jul 25 23:16:51 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * implement.h (ptw32_threads_thread): Move cancelstate and
+ canceltype members out of pthread_attr_t into here.
+
+ * fork.c (fork): Add comment.
+
+1998-07-25 Ben Elliston <bje@cygnus.com>
+
+ * fork.c (fork): Autoconfiscate.
+
+Sat Jul 25 00:00:13 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * create.c (ptw32_start_call): Set thread priority. Ensure our
+ thread entry is removed from the thread table but only if
+ pthread_detach() was called and there are no waiting joins.
+ (pthread_create): Set detach flag in thread entry if the
+ thread is created PTHREAD_CREATE_DETACHED.
+
+ * pthread.h (pthread_attr_t): Rename member "detachedstate".
+
+ * attr.c (pthread_attr_init): Rename attr members.
+
+ * exit.c (pthread_exit): Fix indirection mistake.
+
+ * implement.h (PTW32_THREADS_TABLE_INDEX): Add.
+
+ * exit.c (ptw32_vacuum): Fix incorrect args to
+ ptw32_handler_pop_all() calls.
+ Make thread entry removal conditional.
+
+ * sync.c (pthread_join): Add multiple join and async detach handling.
+
+ * implement.h (PTW32_THREADS_TABLE_INDEX): Add.
+
+ * global.c (ptw32_threads_mutex_table): Add.
+
+ * implement.h (ptw32_once_flag): Remove.
+ (ptw32_once_lock): Ditto.
+ (ptw32_threads_mutex_table): Add.
+
+ * global.c (ptw32_once_flag): Remove.
+ (ptw32_once_lock): Ditto.
+
+ * sync.c (pthread_join): Fix tests involving new return value
+ from ptw32_find_thread_entry().
+ (pthread_detach): Ditto.
+
+ * private.c (ptw32_find_thread_entry): Failure return code
+ changed from -1 to NULL.
+
+Fri Jul 24 23:09:33 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * create.c (pthread_create): Change . to -> in sigmask memcpy() args.
+
+ * pthread.h: (pthread_cancel): Add function prototype.
+ (pthread_testcancel): Ditto.
+
+1998-07-24 Ben Elliston <bje@cygnus.com>
+
+ * pthread.h (pthread_condattr_t): Rename dummy structure member.
+ (pthread_mutexattr_t): Likewise.
+
+Fri Jul 24 21:13:55 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * cancel.c (pthread_cancel): Implement.
+ (pthread_testcancel): Implement.
+
+ * exit.c (pthread_exit): Add comment explaining the longjmp().
+
+ * implement.h (ptw32_threads_thread_t): New member cancelthread.
+ (PTW32_YES): Define.
+ (PTW32_NO): Define.
+ (RND_SIZEOF): Remove.
+
+ * create.c (pthread_create): Rename cancelability to cancelstate.
+
+ * pthread.h (pthread_attr_t): Rename cancelability to cancelstate.
+ (PTHREAD_CANCELED): Define.
+
+1998-07-24 Ben Elliston <bje@cygnus.com>
+
+ * pthread.h (SIG_BLOCK): Define if not already defined.
+ (SIG_UNBLOCK): Likewise.
+ (SIG_SETMASK): Likewise.
+ (pthread_attr_t): Add signal mask member.
+ (pthread_sigmask): Add function prototype.
+
+ * signal.c (pthread_sigmask): Implement.
+
+ * create.c: #include <string.h> to get a prototype for memcpy().
+ (pthread_create): New threads inherit their creator's signal
+ mask. Copy the signal mask to the new thread structure if we know
+ about signals.
+
+Fri Jul 24 16:33:17 1998 Ross Johnson <rpj@swan.canberra.edu.au>
+
+ * fork.c (pthread_atfork): Add all the necessary push calls.
+ Local implementation semantics:
+ If we get an ENOMEM at any time then ALL handlers
+ (including those from previous pthread_atfork() calls) will be
+ popped off each of the three atfork stacks before we return.
+ (fork): Add all the necessary pop calls. Add the thread cancellation
+ and join calls to the child fork.
+ Add #includes.
+
+ * implement.h: (ptw32_handler_push): Fix return type and stack arg
+ type in prototype.
+ (ptw32_handler_pop): Fix stack arg type in prototype.
+ (ptw32_handler_pop_all): Fix stack arg type in prototype.
+
+ * cleanup.c (ptw32_handler_push): Change return type to int and
+ return ENOMEM if malloc() fails.
+
+ * sync.c (pthread_detach): Use equality test, not assignment.
+
+ * create.c (ptw32_start_call): Add call to Win32 CloseHandle()
+ if thread is detached.
+
+1998-07-24 Ben Elliston <bje@cygnus.com>
+
+ * sync.c (pthread_detach): Close the Win32 thread handle to
+ emulate detached (or daemon) threads.
+
+Fri Jul 24 03:00:25 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * sync.c (pthread_join): Save valueptr arg in joinvalueptr for
+ pthread_exit() to use.
+
+ * private.c (ptw32_new_thread_entry): Initialise joinvalueptr to
+ NULL.
+
+ * create.c (ptw32_start_call): Rewrite to facilitate joins.
+ pthread_exit() will do a longjmp() back to here. Does appropriate
+ cleanup and exit/return from the thread.
+ (pthread_create): _beginthreadex() now passes a pointer to our
+ thread table entry instead of just the call member of that entry.
+
+ * implement.h (ptw32_threads_thread): New member
+ void ** joinvalueptr.
+ (ptw32_call_t): New member jmpbuf env.
+
+ * exit.c (pthread_exit): Major rewrite to handle joins and handing
+ value pointer to joining thread. Uses longjmp() back to
+ ptw32_start_call().
+
+ * create.c (pthread_create): Ensure values of new attribute members
+ are copied to the thread attribute object.
+
+ * attr.c (pthread_attr_destroy): Fix merge conflicts.
+ (pthread_attr_getdetachstate): Fix merge conflicts.
+ (pthread_attr_setdetachstate): Fix merge conflicts.
+
+ * pthread.h: Fix merge conflicts.
+
+ * sync.c (pthread_join): Fix merge conflicts.
+
+Fri Jul 24 00:21:21 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * sync.c (pthread_join): Add check for valid and joinable
+ thread.
+ (pthread_detach): Implement. After checking for a valid and joinable
+ thread, it's still a no-op.
+
+ * private.c (ptw32_find_thread_entry): Bug prevented returning
+ an error value in some cases.
+
+ * attr.c (pthread_attr_setdetachedstate): Implement.
+ (pthread_attr_getdetachedstate): Implement.
+
+ * implement.h: Move more hidden definitions into here from
+ pthread.h.
+
+1998-07-24 Ben Elliston <bje@cygnus.com>
+
+ * pthread.h (PTHREAD_CREATE_JOINABLE): Define.
+ (PTHREAD_CREATE_DETACHED): Likewise.
+ (pthread_attr_t): Add new structure member `detached'.
+ (pthread_attr_getdetachstate): Add function prototype.
+ (pthread_attr_setdetachstate): Likewise.
+
+ * sync.c (pthread_join): Return if the target thread is detached.
+
+ * attr.c (pthread_attr_init): Initialise cancelability and
+ canceltype structure members.
+ (pthread_attr_getdetachstate): Implement.
+ (pthread_attr_setdetachstate): Likewise.
+
+ * implement.h (PTW32_CANCEL_DEFAULTS): Remove. Bit fields
+ proved to be too cumbersome. Set the defaults in attr.c using the
+ public PTHREAD_CANCEL_* constants.
+
+ * cancel.c: New file.
+
+ * pthread.h (sched_param): Define this type.
+ (pthread_attr_getschedparam): Add function prototype.
+ (pthread_attr_setschedparam): Likewise.
+ (pthread_setcancelstate): Likewise.
+ (pthread_setcanceltype): Likewise.
+ (sched_get_priority_min): Likewise.
+ (sched_get_priority_max): Likewise.
+ (pthread_mutexattr_setprotocol): Remove; not supported.
+ (pthread_mutexattr_getprotocol): Likewise.
+ (pthread_mutexattr_setprioceiling): Likewise.
+ (pthread_mutexattr_getprioceiling): Likewise.
+ (pthread_attr_t): Add canceltype member. Update comments.
+ (SCHED_OTHER): Define this scheduling policy constant.
+ (SCHED_FIFO): Likewise.
+ (SCHED_RR): Likewise.
+ (SCHED_MIN): Define the lowest possible value for this constant.
+ (SCHED_MAX): Likewise, the maximum possible value.
+ (PTHREAD_CANCEL_ASYNCHRONOUS): Redefine.
+ (PTHREAD_CANCEL_DEFERRED): Likewise.
+
+ * sched.c: New file.
+ (pthread_setschedparam): Implement.
+ (pthread_getschedparam): Implement.
+ (sched_get_priority_max): Validate policy argument.
+ (sched_get_priority_min): Likewise.
+
+ * mutex.c (pthread_mutexattr_setprotocol): Remove; not supported.
+ (pthread_mutexattr_getprotocol): Likewise.
+ (pthread_mutexattr_setprioceiling): Likewise.
+ (pthread_mutexattr_getprioceiling): Likewise.
+
+Fri Jul 24 00:21:21 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * create.c (pthread_create): Arg to ptw32_new_thread_entry()
+ changed. See next entry. Move mutex locks out. Changes made yesterday
+ and today allow us to start the new thread running rather than
+ temporarily suspended.
+
+ * private.c (ptw32_new_thread_entry): ptw32_thread_table
+ was changed back to a table of thread structures rather than pointers.
+ As such we're trading storage for increaded speed. This routine
+ was modified to work with the new table. Mutex lock put in around
+ global data accesses.
+ (ptw32_find_thread_entry): Ditto
+ (ptw32_delete_thread_entry): Ditto
+
+Thu Jul 23 23:25:30 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * global.c: New. Global data objects declared here. These moved from
+ pthread.h.
+
+ * pthread.h: Move implementation hidden definitions into
+ implement.h.
+
+ * implement.h: Move implementation hidden definitions from
+ pthread.h. Add constants to index into the different handler stacks.
+
+ * cleanup.c (ptw32_handler_push): Simplify args. Restructure.
+ (ptw32_handler_pop): Simplify args. Restructure.
+ (ptw32_handler_pop_all): Simplify args. Restructure.
+
+Wed Jul 22 00:16:22 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * attr.c, implement.h, pthread.h, ChangeLog: Resolve CVS merge
+ conflicts.
+
+ * private.c (ptw32_find_thread_entry): Changes to return type
+ to support leaner ptw32_threads_table[] which now only stores
+ ptw32_thread_thread_t *.
+ (ptw32_new_thread_entry): Internal changes.
+ (ptw32_delete_thread_entry): Internal changes to avoid contention.
+ Calling routines changed accordingly.
+
+ * pthread.h: Modified cleanup macros to use new generic push and pop.
+ Added destructor and atfork stacks to ptw32_threads_thread_t.
+
+ * cleanup.c (ptw32_handler_push, ptw32_handler_pop,
+ ptw32_handler_pop_all): Renamed cleanup push and pop routines
+ and made generic to handle destructors and atfork handlers as
+ well.
+
+ * create.c (ptw32_start_call): New function is a wrapper for
+ all new threads. It allows us to do some cleanup when the thread
+ returns, ie. that is otherwise only done if the thread is cancelled.
+
+ * exit.c (ptw32_vacuum): New function contains code from
+ pthread_exit() that we need in the new ptw32_start_call()
+ as well.
+
+ * implement.h: Various additions and minor changes.
+
+ * pthread.h: Various additions and minor changes.
+ Change cleanup handler macros to use generic handler push and pop
+ functions.
+
+ * attr.c: Minor mods to all functions.
+ (is_attr): Implemented missing function.
+
+ * create.c (pthread_create): More clean up.
+
+ * private.c (ptw32_find_thread_entry): Implement.
+ (ptw32_delete_thread_entry): Implement.
+ (ptw32_new_thread_entry): Implement.
+ These functions manipulate the implementations internal thread
+ table and are part of general code cleanup and modularisation.
+ They replace ptw32_getthreadindex() which was removed.
+
+ * exit.c (pthread_exit): Changed to use the new code above.
+
+ * pthread.h: Add cancelability constants. Update comments.
+
+1998-07-22 Ben Elliston <bje@cygnus.com>
+
+ * attr.c (pthread_setstacksize): Update test of attr argument.
+ (pthread_getstacksize): Likewise.
+ (pthread_setstackaddr): Likewise.
+ (pthread_getstackaddr): Likewise.
+ (pthread_attr_init): No need to allocate any storage.
+ (pthread_attr_destroy): No need to free any storage.
+
+ * mutex.c (is_attr): Not likely to be needed; remove.
+ (remove_attr): Likewise.
+ (insert_attr): Likewise.
+
+ * implement.h (ptw32_mutexattr_t): Moved to a public definition
+ in pthread.h. There was little gain in hiding these details.
+ (ptw32_condattr_t): Likewise.
+ (ptw32_attr_t): Likewise.
+
+ * pthread.h (pthread_atfork): Add function prototype.
+ (pthread_attr_t): Moved here from implement.h.
+
+ * fork.c (pthread_atfork): Preliminary implementation.
+ (ptw32_fork): Likewise.
+
+Wed Jul 22 00:16:22 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * cleanup.c (ptw32_cleanup_push): Implement.
+ (ptw32_cleanup_pop): Implement.
+ (ptw32_do_cancellation): Implement.
+ These are private to the implementation. The real cleanup functions
+ are macros. See below.
+
+ * pthread.h (pthread_cleanup_push): Implement as a macro.
+ (pthread_cleanup_pop): Implement as a macro.
+ Because these are macros which start and end a block, the POSIX scoping
+ requirement is observed. See the comment in the file.
+
+ * exit.c (pthread_exit): Refine the code.
+
+ * create.c (pthread_create): Code cleanup.
+
+ * implement.h (RND_SIZEOF): Add RND_SIZEOF(T) to round sizeof(T)
+ up to multiple of DWORD.
+ Add function prototypes.
+
+ * private.c (ptw32_getthreadindex): "*thread" should have been
+ "thread". Detect empty slot fail condition.
+
+1998-07-20 Ben Elliston <bje@cygnus.com>
+
+ * misc.c (pthread_once): Implement. Don't use a per-application
+ flag and mutex--make `pthread_once_t' contain these elements in
+ their structure. The earlier version had incorrect semantics.
+
+ * pthread.h (ptw32_once_flag): Add new variable. Remove.
+ (ptw32_once_lock): Add new mutex lock to ensure integrity of
+ access to ptw32_once_flag. Remove.
+ (pthread_once): Add function prototype.
+ (pthread_once_t): Define this type.
+
+Mon Jul 20 02:31:05 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * private.c (ptw32_getthreadindex): Implement.
+
+ * pthread.h: Add application static data dependent on
+ _PTHREADS_BUILD_DLL define. This is needed to avoid allocating
+ non-sharable static data within the pthread DLL.
+
+ * implement.h: Add ptw32_cleanup_stack_t, ptw32_cleanup_node_t
+ and PTW32_HASH_INDEX.
+
+ * exit.c (pthread_exit): Begin work on cleanup and de-allocate
+ thread-private storage.
+
+ * create.c (pthread_create): Add thread to thread table.
+ Keep a thread-private copy of the attributes with default values
+ filled in when necessary. Same for the cleanup stack. Make
+ pthread_create C run-time library friendly by using _beginthreadex()
+ instead of CreateThread(). Fix error returns.
+
+Sun Jul 19 16:26:23 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * implement.h: Rename pthreads_thread_count to ptw32_threads_count.
+ Create ptw32_threads_thread_t struct to keep thread specific data.
+
+ * create.c: Rename pthreads_thread_count to ptw32_threads_count.
+ (pthread_create): Handle errors from CreateThread().
+
+1998-07-19 Ben Elliston <bje@cygnus.com>
+
+ * condvar.c (pthread_cond_wait): Generalise. Moved from here ..
+ (cond_wait): To here.
+ (pthread_cond_timedwait): Implement; use generalised cond_wait().
+
+ * pthread.h (pthread_key_t): Define this type.
+ (pthread_key_create): Add function prototype.
+ (pthread_setspecific): Likewise.
+ (pthread_getspecific): Likwise.
+ (pthread_key_delete): Likewise.
+
+ * tsd.c (pthread_key_create): Implement.
+ (pthread_setspecific): Likewise.
+ (pthread_getspecific): Likewise.
+ (pthread_key_delete): Likewise.
+
+ * mutex.c (pthread_mutex_trylock): Return ENOSYS if this function
+ is called on a Win32 platform which is not Windows NT.
+
+1998-07-18 Ben Elliston <bje@cygnus.com>
+
+ * condvar.c (pthread_condattr_init): Do not attempt to malloc any
+ storage; none is needed now that condattr_t is an empty struct.
+ (pthread_condattr_destory): Likewise; do not free storage.
+ (pthread_condattr_setpshared): No longer supported; return ENOSYS.
+ (pthread_condattr_getpshared): Likewise.
+ (pthread_cond_init): Implement with help from Douglas Schmidt.
+ Remember to initialise the cv's internal mutex.
+ (pthread_cond_wait): Likewise.
+ (pthread_cond_signal): Likewise.
+ (pthread_cond_broadcast): Likewise.
+ (pthread_cond_timedwait): Preliminary implementation, but I need
+ to see some API documentation for `WaitForMultipleObject'.
+ (pthread_destory): Implement.
+
+ * pthread.h (pthread_cond_init): Add function protoype.
+ (pthread_cond_broadcast): Likewise.
+ (pthread_cond_signal): Likewise.
+ (pthread_cond_timedwait): Likewise.
+ (pthread_cond_wait): Likewise.
+ (pthread_cond_destroy): Likewise.
+ (pthread_cond_t): Define this type. Fix for u_int. Do not assume
+ that the mutex contained withing the pthread_cond_t structure will
+ be a critical section. Use our new POSIX type!
+
+ * implement.h (ptw32_condattr_t): Remove shared attribute.
+
+1998-07-17 Ben Elliston <bje@cygnus.com>
+
+ * pthread.h (PTHREADS_PROCESS_PRIVATE): Remove.
+ (PTHREAD_PROCESS_SHARED): Likewise. No support for mutexes shared
+ across processes for now.
+ (pthread_mutex_t): Use a Win32 CRITICAL_SECTION type for better
+ performance.
+
+ * implement.h (ptw32_mutexattr_t): Remove shared attribute.
+
+ * mutex.c (pthread_mutexattr_setpshared): This optional function
+ is no longer supported, since we want to implement POSIX mutex
+ variables using the much more efficient Win32 critical section
+ primitives. Critical section objects in Win32 cannot be shared
+ between processes.
+ (pthread_mutexattr_getpshared): Likewise.
+ (pthread_mutexattr_init): No need to malloc any storage; the
+ attributes structure is now empty.
+ (pthread_mutexattr_destroy): This is now a nop.
+ (pthread_mutex_init): Use InitializeCriticalSection().
+ (pthread_mutex_destroy): Use DeleteCriticalSection().
+ (pthread_mutex_lock): Use EnterCriticalSection().
+ (pthread_mutex_trylock): Use TryEnterCriticalSection(). This is
+ not supported by Windows 9x, but trylock is a hack anyway, IMHO.
+ (pthread_mutex_unlock): Use LeaveCriticalSection().
+
+1998-07-14 Ben Elliston <bje@cygnus.com>
+
+ * attr.c (pthread_attr_setstacksize): Implement.
+ (pthread_attr_getstacksize): Likewise.
+ (pthread_attr_setstackaddr): Likewise.
+ (pthread_attr_getstackaddr): Likewise.
+ (pthread_attr_init): Likewise.
+ (pthread_attr_destroy): Likewise.
+
+ * condvar.c (pthread_condattr_init): Add `_cond' to function name.
+
+ * mutex.c (pthread_mutex_lock): Add `_mutex' to function name.
+ (pthread_mutex_trylock): Likewise.
+ (pthread_mutex_unlock): Likewise.
+
+ * pthread.h (pthread_condattr_setpshared): Fix typo.
+ (pthread_attr_init): Add function prototype.
+ (pthread_attr_destroy): Likewise.
+ (pthread_attr_setstacksize): Likewise.
+ (pthread_attr_getstacksize): Likewise.
+ (pthread_attr_setstackaddr): Likewise.
+ (pthread_attr_getstackaddr): Likewise.
+
+Mon Jul 13 01:09:55 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * implement.h: Wrap in #ifndef _IMPLEMENT_H
+
+ * create.c (pthread_create): Map stacksize attr to Win32.
+
+ * mutex.c: Include implement.h
+
+1998-07-13 Ben Elliston <bje@cygnus.com>
+
+ * condvar.c (pthread_condattr_init): Implement.
+ (pthread_condattr_destroy): Likewise.
+ (pthread_condattr_setpshared): Likewise.
+ (pthread_condattr_getpshared): Likewise.
+
+ * implement.h (PTHREAD_THREADS_MAX): Remove trailing semicolon.
+ (PTHREAD_STACK_MIN): Specify; needs confirming.
+ (ptw32_attr_t): Define this type.
+ (ptw32_condattr_t): Likewise.
+
+ * pthread.h (pthread_mutex_t): Define this type.
+ (pthread_condattr_t): Likewise.
+ (pthread_mutex_destroy): Add function prototype.
+ (pthread_lock): Likewise.
+ (pthread_trylock): Likewise.
+ (pthread_unlock): Likewise.
+ (pthread_condattr_init): Likewise.
+ (pthread_condattr_destroy): Likewise.
+ (pthread_condattr_setpshared): Likewise.
+ (pthread_condattr_getpshared): Likewise.
+
+ * mutex.c (pthread_mutex_init): Implement.
+ (pthread_mutex_destroy): Likewise.
+ (pthread_lock): Likewise.
+ (pthread_trylock): Likewise.
+ (pthread_unlock): Likewise.
+
+1998-07-12 Ben Elliston <bje@cygnus.com>
+
+ * implement.h (ptw32_mutexattr_t): Define this implementation
+ internal type. Application programmers only see a mutex attribute
+ object as a void pointer.
+
+ * pthread.h (pthread_mutexattr_t): Define this type.
+ (pthread_mutexattr_init): Add function prototype.
+ (pthread_mutexattr_destroy): Likewise.
+ (pthread_mutexattr_setpshared): Likewise.
+ (pthread_mutexattr_getpshared): Likewise.
+ (pthread_mutexattr_setprotocol): Likewise.
+ (pthread_mutexattr_getprotocol): Likewise.
+ (pthread_mutexattr_setprioceiling): Likewise.
+ (pthread_mutexattr_getprioceiling): Likewise.
+ (PTHREAD_PROCESS_PRIVATE): Define.
+ (PTHREAD_PROCESS_SHARED): Define.
+
+ * mutex.c (pthread_mutexattr_init): Implement.
+ (pthread_mutexattr_destroy): Implement.
+ (pthread_mutexattr_setprotocol): Implement.
+ (pthread_mutexattr_getprotocol): Likewise.
+ (pthread_mutexattr_setprioceiling): Likewise.
+ (pthread_mutexattr_getprioceiling): Likewise.
+ (pthread_mutexattr_setpshared): Likewise.
+ (pthread_mutexattr_getpshared): Likewise.
+ (insert_attr): New function; very preliminary implementation!
+ (is_attr): Likewise.
+ (remove_attr): Likewise.
+
+Sat Jul 11 14:48:54 1998 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
+
+ * implement.h: Preliminary implementation specific defines.
+
+ * create.c (pthread_create): Preliminary implementation.
+
+1998-07-11 Ben Elliston <bje@cygnus.com>
+
+ * sync.c (pthread_join): Implement.
+
+ * misc.c (pthread_equal): Likewise.
+
+ * pthread.h (pthread_join): Add function prototype.
+ (pthread_equal): Likewise.
+
+1998-07-10 Ben Elliston <bje@cygnus.com>
+
+ * misc.c (pthread_self): Implement.
+
+ * exit.c (pthread_exit): Implement.
+
+ * pthread.h (pthread_exit): Add function prototype.
+ (pthread_self): Likewise.
+ (pthread_t): Define this type.
+
+1998-07-09 Ben Elliston <bje@cygnus.com>
+
+ * create.c (pthread_create): A dummy stub right now.
+
+ * pthread.h (pthread_create): Add function prototype.
diff --git a/win32/contrib/pthreads/FAQ b/win32/contrib/pthreads/FAQ new file mode 100644 index 000000000..44ae761fe --- /dev/null +++ b/win32/contrib/pthreads/FAQ @@ -0,0 +1,390 @@ + =========================================
+ PTHREADS-WIN32 Frequently Asked Questions
+ =========================================
+
+INDEX
+-----
+
+Q 1 Should I use Cygwin or Mingw32 as a development environment?
+
+Q 2 Now that pthreads-win32 builds under Mingw32, why do I get
+ memory access violations?
+
+Q 3 How do I use pthread.dll for Win32 (Visual C++ 5.0)
+
+Q 4 Cancelation doesn't work for me, why?
+
+Q 5 Thread won't block after two calls to mutex_lock
+
+Q 6 How do I generate pthreadGCE.dll and libpthreadw32.a for use with Mingw32?
+
+=============================================================================
+
+Q 1 Should I use Cygwin or Mingw32 as a development environment?
+---
+
+A 1
+---
+Important: see Q2 also.
+
+In short, use Mingw32 with the MSVCRT library to build applications that use
+the DLL. Cygwin's own internal support for POSIX threads is growing. Consult
+that project's documentation for more information.
+
+Date: Mon, 07 Dec 1998 15:11:37 +0100
+From: Anders Norlander <anorland@hem2.passagen.se>
+To: Ross Johnson <rpj@ise.canberra.edu.au>
+Cc: pthreads-win32 <pthreads-win32@air.net.au>
+Subject: Re: pthreads-win32: TryEnterCriticalSection patch (fwd)
+
+Ross Johnson wrote:
+>
+> Anders,
+>
+> You said you're using GCC. Is that from cygwin32 or mingw32? What is your
+> environment (so I can perhaps help other people out)? We have problems
+> with cygwin32 et al that have been built on Win95. They're missing
+> _{begin,end}threadex.
+
+Ross,
+
+I use mingw32 when compiling pthreads-win32, but unlike most people I
+use MSVCRT as the C library instead of CRTDLL. For those that don't
+feel like configuring and building the necessary components themselves,
+Mumit Khan has released an add on for mingw32 to make it use MSVCRT40.
+It is available at his ftp site, follow the minw32 links at
+http://www.xraylith.wisc.edu/~khan/software/gnu-win32/
+
+For cygwin it is a completely different matter. I suppose
+pthreads-win32 uses _beginthreadex and _endthreadex because the Win32
+docs say that programs calling functions in the C library should not
+use CreateThread and ExitThread. However, this applies only to
+Microsoft's (and possibly others) multithreaded C libraries that need
+to keep track of per thread data, it does not apply to cygwin.
+This code solves the problem:
+
+/* Check for old and new versions of cygwin */
+#if defined(__CYGWIN32__) || defined(__CYGWIN__)
+/* Macro uses args so we can cast start_proc to LPTHREAD_START_ROUTINE
+ in order to avoid warnings because of return type */
+#define _beginthreadex(security, stack_size, start_proc, arg, flags,
+pid) \
+CreateThread(security, stack_size, (LPTHREAD_START_ROUTINE) start_proc,
+\
+ arg, flags, pid)
+#define _endthreadex ExitThread
+#endif
+
+I would be extremely careful using threads with cygwin, since it is
+not (yet) threadsafe.
+
+Regards,
+Anders
+
+------------------------------------------------------------------------------
+
+Q 2 Now that pthreads-win32 builds under Mingw32, why do I get
+--- memory access violations (segfaults)?
+
+A 2
+---
+Note: issue resolved.
+The latest Mingw32 package has thread-safe exception handling.
+Make sure you also read A 6 below to get a fully working build.
+
+
+The following email exchange describes the problem. Until this issue
+is resolved people without the Microsoft compiler can obtain the current
+MSVC prebuilt DLL (pthread.{dll,lib,h}) at:
+
+ftp://sources.redhat.com/pub/pthreads-win32/dll-latest
+
+Date: Wed, 10 Feb 1999 13:21:01 -0000
+From: "Ruland, Kevin" <Kevin.Ruland@anheuser-busch.com>
+Reply-To: POSIX threads on Win32 <pthreads-win32@air.net.au>
+To: 'POSIX threads on Win32' <pthreads-win32@air.net.au>
+Subject: Mingw32 exceptions not thread safe.
+
+Hello everyone.
+
+I asked Mumit Khan, maintainer of egcs for mingw and assorted guru, about
+the Known Problem listed below.
+
+> Known problems
+> --------------
+>
+> There is an unresolved bug which shows up as a segmentation fault
+> (memory access violation) when the library is built using g++. Build
+> the test program "eyal1.c" and run with an argument of "2" or
+> greater. The argument is the number of threads to run, excluding the
+> main thread, so the bug appears with 2 or more worker threads.
+>
+> Kevin Ruland has traced the exception to the try/catch blocks in
+> ptw32_threadStart().
+>
+
+The official word is:
+
+<Quote Mumit Khan [khan@xraylith.wisc.edu]>
+EGCS-1.1.1 for win32 (either cygwin or crtdll/msvc runtimes) do not have
+thread-safe exception support.
+
+For Cygwin, it'll happen when Cygwin runtime has mature thread safety and
+pthread is fully integrated. Then it's just a matter of rebuilding GCC (or
+just libgcc in this) with thread safe EH support.
+
+For Mingw crtdll/msvc, someone needs to write the thread-wrapper for win32
+threads. Anyone who knows win32 threads should be able to do this without
+much trouble at all. It's low on my priority list, so unless someone else
+volunteers, it'll have to wait.
+<\Quote>
+
+Kevin
+
+------------------------------------------------------------------------------
+
+Q 3 How do I use pthread.dll for Win32 (Visual C++ 5.0)
+---
+
+A 3
+---
+>
+> I'm a "rookie" when it comes to your pthread implementation. I'm currently
+> desperately trying to install the prebuilt .dll file into my MSVC compiler.
+> Could you please provide me with explicit instructions on how to do this (or
+> direct me to a resource(s) where I can acquire such information)?
+>
+> Thank you,
+>
+
+You should have a .dll, .lib, .def, and three .h files.
+
+The .dll can go in any directory listed in your PATH environment
+variable, so putting it into C:\WINDOWS should work.
+
+The .lib file can go in any directory listed in your LIB environment
+variable.
+
+The .h files can go in any directory listed in your INCLUDE
+environment variable.
+
+Or you might prefer to put the .lib and .h files into a new directory
+and add its path to LIB and INCLUDE. You can probably do this easiest
+by editing the file:-
+
+C:\Program Files\DevStudio\vc\bin\vcvars32.bat
+
+The .def file isn't used by anything in the pre-compiled version but
+is included for information.
+
+Cheers.
+Ross
+
+------------------------------------------------------------------------------
+
+Q 4 Cancelation doesn't work for me, why?
+---
+
+A 4
+---
+> I'm investigating a problem regarding thread cancelation. The thread I want
+> to cancel has PTHREAD_CANCEL_ASYNCHRONOUS, however, this piece of code
+> blocks on the join():
+>
+> if ((retv = Pthread_cancel( recvThread )) == 0)
+> {
+> retv = Pthread_join( recvThread, 0 );
+> }
+>
+> Pthread_* are just macro's; they call pthread_*.
+>
+> The thread recvThread seems to block on a select() call. It doesn't get
+> cancelled.
+>
+> Two questions:
+>
+> 1) is this normal behaviour?
+>
+> 2) if not, how does the cancel mechanism work? I'm not very familliar to
+> win32 programming, so I don't really understand how the *Event() family of
+> calls work.
+
+Async cancelation should be in versions post snapshot-1999-11-02
+of pthreads-win32 (currently only for x86 architectures).
+
+The answer to your first question is, normal POSIX behaviour would
+be to asynchronously cancel the thread. However, even that doesn't
+guarantee cancelation as the standard only says it should be
+cancelled as soon as possible.
+
+However ...
+
+Snapshot 99-11-02 or earlier only partially supports asynchronous cancellation.
+Snapshots since then simulate async cancelation by poking the address of
+a cancelation routine into the PC of the threads context. This requires
+the thread to be resumed in some way for the cancelation to actually
+proceed. This is not true async cancelation, but it is as close as we've
+been able to get to it.
+
+If the thread you're trying to cancel is blocked (for instance, it could be
+waiting for data from the network), it will only get cancelled when it unblocks
+(when the data arrives). Unfortunately, there is no way to do so from
+outside the thread.
+
+Using deferred cancelation would normally be the way to go, however,
+even though the POSIX threads standard lists a number of C library
+functions that are defined as deferred cancelation points, there is
+no hookup between those which are provided by Windows and the
+pthreads-win32 library.
+
+Incidently, it's worth noting for code portability that the POSIX
+threads standard list doesn't include "select" because (as I read in
+Butenhof) it isn't part of POSIX.
+
+Effectively, the only cancelation points that pthreads-win32 can
+recognise are those the library implements itself, ie.
+
+ pthread_testcancel
+ pthread_cond_wait
+ pthread_cond_timedwait
+ pthread_join
+ sem_wait
+ pthread_delay_np
+
+Pthreads-win32 also provides two functions that allow you to create
+cancelation points within your application, but only for cases where
+a thread is going to block on a Win32 handle. These are:
+
+ pthreadCancelableWait(HANDLE waitHandle) /* Infinite wait */
+
+ pthreadCancelableTimedWait(HANDLE waitHandle, DWORD timeout)
+
+Regards.
+Ross
+
+------------------------------------------------------------------------------
+
+Q 5 Thread won't block after two calls to mutex_lock
+---
+
+A 5
+---
+> i was testing this pthread for win32 in my prog.
+> when i checked if it was blocking mutex_lock calls, i was surprised when it
+> didnt lock
+>
+> pthread_mutex_t DBlock;
+>
+> pthread_mutex_init( &DBlock, NULL );
+> pthread_mutex_lock( &DBlock );
+> pthread_mutex_lock( &DBlock );
+>
+> ^^ these two calls didnt block
+
+POSIX leaves the result "undefined" for a thread that tries
+to recursively lock the same mutex (one that it owns already).
+That means the actual semantics are left up to the
+implementation, but should not be relied upon for code that
+will be ported to different POSIX threads implementations.
+
+In the pthreads-win32 implementation a thread won't deadlock
+itself by relocking the mutex. Subsequent calls to
+pthread_mutex_lock() as in your example above increment
+the lock count but the thread continues on. Consequently,
+the thread must ensure that it unlocks the mutex once for
+each lock operation. That is, pthreads-win32 mutexes are
+always recursive.
+
+You may want to look at the other synchronisation devices
+available in the library, such as condition variables or
+read-write locks.
+
+Ross
+
+------------------------------------------------------------------------------
+
+Q 6 How do I generate pthreadGCE.dll and libpthreadw32.a for use with Mingw32?
+---
+
+A 6
+---
+Once you've followed Thomas Pfaff's instructions below to fix
+Mingw32, then you can simply run "make" to build the library and dll.
+
+
+From - Sat Dec 9 22:56:10 2000
+From: "Thomas Pfaff" <tpfaff@gmx.net>
+To: <mingw-users@lists.sourceforge.net>, <pthreads-win32@sources.redhat.com>
+Subject: mingw32 DLLs, threads and exceptions HOWTO
+Date: Thu, 7 Dec 2000 11:12:43 +0100
+
+Dear all,
+
+this is a summary that should help users to have thread safe exception
+handling over DLL exported functions.
+If you don't care about c++ exceptions you can stop reading here.
+
+The first time i struggled with c++ exceptions was when i tried to throw an
+exception in a dll exported function where the exception handler resides in
+the program module.
+Instead of catching the exception the program stopped with an abnormal
+termination.
+The reason was that the exception code is in libgcc.a. Since this is a
+static library the code and some static variables are both in the dll and in
+the program module, each module runs in its own context.
+It was Franco Bez that pointed me in the right direction, that is convert
+libgcc.a into a dll.
+
+That done i tried to build the pthreads-win32 library, but some tests failed
+with an access violation. Due to the fact that the dll was not build
+was -mthreads support, eh_context_static instead of eh_context_specific (the
+mthreads version) was used for exception handling.
+I did a rebuild of the gcc dll with -mthreads, now all tests are passed
+(except a nonportable exception test that relies on a MSVC feature).
+
+To build the gcc dll i did the following steps.
+
+1. create a temporary directory libgcc
+2. copy libgcc.a from gcc-2.95.2\lib\gcc-lib\i386-mingw32\gcc-2.95.2 to that
+directory
+3. ar -x libgcc.a
+4. create a directory tmp and move __main.o, _exit.o and __dummy.o in that
+directory
+5. build the dll
+gcc -shared -mthreads -o gcc.dll *.o
+strip gcc.dll
+Move this dll into your gcc\bin directory
+6. Move _chkstk.o and frame.o to the tmp directory, otherwise you break the
+builtin alloca.
+7. Build the import library libgcc.a
+dllwrap --export-all --dllname=gcc.dll --output-def=libgcc.def --output-lib=
+libgcc.a *.o
+ar -q libgcc.a tmp/*.o
+strip --strip-debug libgcc.a
+ranlib libgcc.a
+8. save your old libgcc.a, copy the new libgcc.a into
+gcc-2.95.2\lib\gcc-lib\i386-mingw32\gcc-2.95.2
+
+I am using gcc-2.95.2-1 with Mumits patched binutils-19990818-1and msvcrt
+runtime-2000-03-27.
+I don't know if this is still required with the current binutils and gcc
+since i have seen no sources until now.
+
+I believe that these steps are at least necessary if you are trying to use
+the pthreads-win32 library (which is required if you want to use gtk+ on
+win32).
+They will make mingw32 a real replacement for MSVC (at least for me).
+
+What is left:
+
+1. Include the mingwm10.dll function into the gcc.dll to have only one dll
+left.
+2. make -mthreads and -fnative-struct default compiler options.
+3. convert libstdc++ to a dll by adding the declspec dllexport and dllimport
+to every class definition.
+
+Regards,
+ Thomas
+
+------------------------------------------------------------------------------
+
diff --git a/win32/contrib/pthreads/GNUmakefile b/win32/contrib/pthreads/GNUmakefile new file mode 100644 index 000000000..589d89966 --- /dev/null +++ b/win32/contrib/pthreads/GNUmakefile @@ -0,0 +1,109 @@ +#
+# Pthreads-win32 - POSIX Threads Library for Win32
+# Copyright (C) 1998
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library 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
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with this library; if not, write to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA
+#
+
+#RM = rm
+#MV = mv
+#CP = cp
+
+RM = erase
+MV = rename
+CP = copy
+
+CC = gcc
+CXX = g++
+
+AR = ar
+
+OPT = -O3
+#OPT = -O2 -DNDEBUG -finline-functions
+
+GC_CFLAGS = -D__CLEANUP_C
+GCE_CFLAGS = -D__CLEANUP_CXX -x c++ -mthreads
+
+## Mingw32
+MAKE = make
+CFLAGS = $(OPT) -I. -D_WIN32_WINNT=0x400 -DHAVE_CONFIG_H -DPTW32_BUILD -Wall
+
+## Cygwin G++
+#CFLAGS = $(OPT) -x $(GLANG) -fhandle-exceptions -D_WIN32_WINNT=0x400 -I. -DHAVE_CONFIG_H -DPTW32_BUILD -Wall
+
+OBJS = attr.o barrier.o cancel.o cleanup.o condvar.o create.o dll.o errno.o \
+ exit.o fork.o global.o misc.o mutex.o nonportable.o \
+ private.o rwlock.o sched.o semaphore.o signal.o spin.o sync.o tsd.o
+
+INCL = implement.h semaphore.h pthread.h windows.h
+
+GC_DLL = pthreadGC.dll
+GCE_DLL = pthreadGCE.dll
+
+GC_LIB = libpthreadGC.a
+GCE_LIB = libpthreadGCE.a
+
+
+all:
+ @ echo Run one of the following command lines:
+ @ echo make clean GCE (to build the GNU C dll with C++ exception handling)
+ @ echo make clean GC (to build the GNU C dll with C cleanup code)
+
+auto:
+ @ $(MAKE) clean GCE
+ @ $(MAKE) clean GC
+
+GC:
+ $(MAKE) CLEANUP_FLAGS="$(GC_CFLAGS)" $(GC_DLL)
+
+GCE:
+ $(MAKE) CLEANUP_FLAGS="$(GCE_CFLAGS)" $(GCE_DLL)
+
+tests:
+ @ cd tests
+ @ $(MAKE) auto
+
+%.pre: %.c
+ $(CC) -E -o $@ $(CFLAGS) $^
+
+%.s: %.c
+ $(CC) -c $(CFLAGS) -Wa,-ahl $^ > $@
+
+.SUFFIXES: .dll .c .o
+
+.c.o:; $(CC) -c -o $@ $(CFLAGS) $(CLEANUP_FLAGS) $<
+
+
+$(GC_DLL): $(OBJS)
+ $(CC) $(OPT) -shared -o $@ $^
+ dlltool -k --dllname $@ --output-lib $(GC_LIB) --def pthread.def
+
+$(GCE_DLL): $(OBJS)
+ $(CXX) $(OPT) -mthreads -shared -o $@ $^
+ dlltool -k --dllname $@ --output-lib $(GCE_LIB) --def pthread.def
+
+clean:
+ -$(RM) *~
+ -$(RM) *.o
+ -$(RM) *.exe
+
+realclean: clean
+ -$(RM) $(GC_LIB)
+ -$(RM) $(GCE_LIB)
+ -$(RM) $(GC_DLL)
+ -$(RM) $(GCE_DLL)
+
+
diff --git a/win32/contrib/pthreads/MAINTAINERS b/win32/contrib/pthreads/MAINTAINERS new file mode 100644 index 000000000..5b04e43f8 --- /dev/null +++ b/win32/contrib/pthreads/MAINTAINERS @@ -0,0 +1,4 @@ +CVS Repository maintainers
+
+Ross Johnson rpj@ise.canberra.edu.au
+Ben Elliston bje@cygnus.com
diff --git a/win32/contrib/pthreads/Makefile b/win32/contrib/pthreads/Makefile new file mode 100644 index 000000000..723fa2b0d --- /dev/null +++ b/win32/contrib/pthreads/Makefile @@ -0,0 +1,90 @@ +
+# This makefile is compatible with MS nmake and can be used as a
+# replacement for buildlib.bat. I've changed the target from an ordinary dll
+# (/LD) to a debugging dll (/LDd).
+#
+# The variables $DLLDEST and $LIBDEST hold the destination directories for the
+# dll and the lib, respectively. Probably all that needs to change is $DEVROOT.
+
+DEVROOT=c:\pthreads\dll
+
+DLLDEST=$(DEVROOT)
+LIBDEST=$(DEVROOT)
+
+DLLS = pthreadVCE.dll pthreadVSE.dll pthreadVC.dll
+
+# C++ Exceptions
+VCEFLAGS = /GX /TP /DPtW32NoCatchWarn /D__CLEANUP_CXX
+#Structured Exceptions
+VSEFLAGS = /D__CLEANUP_SEH
+#C cleanup code
+VCFLAGS = /D__CLEANUP_C
+
+CFLAGS = /W3 /MT /nologo /Yd /Zi /I. /D_WIN32_WINNT=0x400 /DPTW32_BUILD
+
+OBJ= attr.obj \
+ barrier.obj \
+ cancel.obj \
+ cleanup.obj \
+ condvar.obj \
+ create.obj \
+ dll.obj \
+ errno.obj \
+ exit.obj \
+ fork.obj \
+ global.obj \
+ misc.obj \
+ mutex.obj \
+ nonportable.obj \
+ private.obj \
+ rwlock.obj \
+ sched.obj \
+ semaphore.obj \
+ signal.obj \
+ spin.obj \
+ sync.obj \
+ tsd.obj
+
+all:
+ @ echo Run one of the following command lines:
+ @ echo nmake clean VCE (to build the MSVC dll with C++ exception handling)
+ @ echo nmake clean VSE (to build the MSVC dll with structured exception handling)
+ @ echo nmake clean VC (to build the MSVC dll with C cleanup code)
+
+auto:
+ @ nmake clean VCE
+ @ nmake clean VSE
+ @ nmake clean VC
+
+VCE:
+ @ nmake /nologo EHFLAGS="$(VCEFLAGS)" pthreadVCE.dll
+
+VSE:
+ @ nmake /nologo EHFLAGS="$(VSEFLAGS)" pthreadVSE.dll
+
+VC:
+ @ nmake /nologo EHFLAGS="$(VCFLAGS)" pthreadVC.dll
+
+realclean: clean
+ if exist *.dll del *.dll
+ if exist *.lib del *.lib
+
+clean:
+ if exist *.obj del *.obj
+ if exist *.ilk del *.ilk
+ if exist *.pdb del *.pdb
+ if exist *.exp del *.exp
+ if exist *.o del *.o
+
+
+install: $(DLLS)
+ copy pthread*.dll $(DLLDEST)
+ copy pthread*.lib $(LIBDEST)
+
+$(DLLS): $(OBJ) pthread.def
+ cl /LD /Zi /nologo $(OBJ) \
+ /link /nodefaultlib:libcmt /implib:$*.lib \
+ msvcrt.lib /def:pthread.def /out:$@
+
+.c.obj:
+ cl $(EHFLAGS) $(CFLAGS) -c $<
diff --git a/win32/contrib/pthreads/Makefile.in b/win32/contrib/pthreads/Makefile.in new file mode 100644 index 000000000..62c720104 --- /dev/null +++ b/win32/contrib/pthreads/Makefile.in @@ -0,0 +1,69 @@ +#
+# Pthreads-win32 - POSIX Threads Library for Win32
+# Copyright (C) 1998
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library 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
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with this library; if not, write to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA
+#
+
+RM = erase
+
+CC = g++
+
+AR = ar
+
+LD = gcc -mdll -mthreads
+
+OPT = -g -O2
+
+## Mingw32
+CFLAGS = $(OPT) -I. -DHAVE_CONFIG_H -Wall -mthreads
+
+## Cygwin G++
+#CFLAGS = $(OPT) -fhandle-exceptions -I. -DHAVE_CONFIG_H -Wall
+
+OBJS = attr.o cancel.o cleanup.o condvar.o create.o dll.o errno.o \
+ exit.o fork.o global.o misc.o mutex.o private.o rwlock.o \
+ sched.o semaphore.o signal.o sync.o tsd.o
+
+INCL = implement.h semaphore.h pthread.h windows.h
+
+DLL = pthread.dll
+
+LIB = libpthread32.a
+
+
+all: $(LIB)
+
+$(LIB): $(DLL)
+ dlltool --def $(DLL:.dll=.def) --output-lib $@ --dllname $(DLL)
+
+.SUFFIXES: .dll
+
+$(DLL): $(OBJS)
+ $(LD) -o $@ $^ -Wl,--base-file,$*.base
+ dlltool --base-file=$*.base --def $*.def --output-exp $*.exp --dllname $@
+ $(LD) -o $@ $^ -Wl,--base-file,$*.base,$*.exp
+ dlltool --base-file=$*.base --def $*.def --output-exp $*.exp --dllname $@
+ $(LD) -o $@ $^ -Wl,$*.exp
+
+clean:
+ -$(RM) *~
+ -$(RM) $(LIB)
+ -$(RM) *.o
+ -$(RM) *.exe
+ -$(RM) $(DLL)
+ -$(RM) $(DLL:.dll=.base)
+ -$(RM) $(DLL:.dll=.exp)
diff --git a/win32/contrib/pthreads/NEWS b/win32/contrib/pthreads/NEWS new file mode 100644 index 000000000..b52c0c602 --- /dev/null +++ b/win32/contrib/pthreads/NEWS @@ -0,0 +1,118 @@ +SNAPSHOT 2000-08-13
+-------------------
+
+New:
+- Renamed DLL and LIB files:
+ pthreadVSE.dll (MS VC++/Structured EH)
+ pthreadVSE.lib
+ pthreadVCE.dll (MS VC++/C++ EH)
+ pthreadVCE.lib
+ pthreadGCE.dll (GNU G++/C++ EH)
+ libpthreadw32.a
+
+ Both your application and the pthread dll should use the
+ same exception handling scheme.
+
+Bugs fixed:
+- MSVC++ C++ exception handling.
+
+Some new tests have been added.
+
+
+SNAPSHOT 2000-08-10
+-------------------
+
+New:
+- asynchronous cancelation on X86 (Jason Nye)
+- Makefile compatible with MS nmake to replace
+ buildlib.bat
+- GNUmakefile for Mingw32
+- tests/Makefile for MS nmake replaces runall.bat
+- tests/GNUmakefile for Mingw32
+
+Bugs fixed:
+- kernel32 load/free problem
+- attempt to hide internel exceptions from application
+ exception handlers (__try/__except and try/catch blocks)
+- Win32 thread handle leakage bug
+ (David Baggett/Paul Redondo/Eyal Lebedinsky)
+
+Some new tests have been added.
+
+
+SNAPSHOT 1999-11-02
+-------------------
+
+Bugs fixed:
+- ctime_r macro had an incorrect argument (Erik Hensema),
+- threads were not being created
+ PTHREAD_CANCEL_DEFERRED. This should have
+ had little effect as deferred is the only
+ supported type. (Ross Johnson).
+
+Some compatibility improvements added, eg.
+- pthread_setcancelstate accepts NULL pointer
+ for the previous value argument. Ditto for
+ pthread_setcanceltype. This is compatible
+ with Solaris but should not affect
+ standard applications (Erik Hensema)
+
+Some new tests have been added.
+
+
+SNAPSHOT 1999-10-17
+-------------------
+
+Bug fix - Cancelation of threads waiting on condition variables
+now works properly (Lorin Hochstein and Peter Slacik)
+
+
+SNAPSHOT 1999-08-12
+-------------------
+
+Fixed exception stack cleanup if calling pthread_exit()
+- (Lorin Hochstein and John Bossom).
+
+Fixed bugs in condition variables - (Peter Slacik):
+ - additional contention checks
+ - properly adjust number of waiting threads after timed
+ condvar timeout.
+
+
+SNAPSHOT 1999-05-30
+-------------------
+
+Some minor bugs have been fixed. See the ChangeLog file for details.
+
+Some more POSIX 1b functions are now included but ony return an
+error (ENOSYS) if called. They are:
+
+ sem_open
+ sem_close
+ sem_unlink
+ sem_getvalue
+
+
+SNAPSHOT 1999-04-07
+-------------------
+
+Some POSIX 1b functions which were internally supported are now
+available as exported functions:
+
+ sem_init
+ sem_destroy
+ sem_wait
+ sem_trywait
+ sem_post
+ sched_yield
+ sched_get_priority_min
+ sched_get_priority_max
+
+Some minor bugs have been fixed. See the ChangeLog file for details.
+
+
+SNAPSHOT 1999-03-16
+-------------------
+
+Initial release.
+
diff --git a/win32/contrib/pthreads/Nmakefile b/win32/contrib/pthreads/Nmakefile new file mode 100644 index 000000000..53b11aae7 --- /dev/null +++ b/win32/contrib/pthreads/Nmakefile @@ -0,0 +1,24 @@ +/*
+ * nmake file for uwin pthread library
+ */
+
+VERSION = -
+CCFLAGS = -V -g $(CC.DLL)
+PTW32_BUILD == 1
+_MT == 1
+_timeb == timeb
+_ftime == ftime
+_errno == _ast_errno
+
+$(INCLUDEDIR) :INSTALLDIR: pthread.h sched.h
+
+pthread $(VERSION) :LIBRARY: pthread.def attr.c cancel.c cleanup.c condvar.c \
+ create.c dll.c exit.c fork.c global.c misc.c mutex.c private.c \
+ rwlock.c sched.c semaphore.c sync.c tsd.c nonportable.c
+
+:: ANNOUNCE CONTRIBUTORS COPYING.LIB ChangeLog FAQ GNUmakefile MAINTAINERS \
+ Makefile Makefile.in Makefile.vc NEWS PROGRESS README README.WinCE \
+ TODO WinCE-PORT install-sh errno.c tests tests.mk acconfig.h \
+ config.guess config.h.in config.sub configure configure.in signal.c \
+ README.CV README.NONPORTABLE pthread.dsp pthread.dsw
+
diff --git a/win32/contrib/pthreads/Nmakefile.tests b/win32/contrib/pthreads/Nmakefile.tests new file mode 100644 index 000000000..109a99563 --- /dev/null +++ b/win32/contrib/pthreads/Nmakefile.tests @@ -0,0 +1,167 @@ +/* for running tests */
+CCFLAGS = -g
+_MT == 1
+_timeb == timeb
+_ftime == ftime
+
+.SOURCE: tests
+/*
+:PACKAGE: pthread
+*/
+
+set keepgoing
+
+":test:" : .MAKE .OPERATOR
+ local I
+ $(<:D:B:S=.pass) : .IMPLICIT $(>:D:B:S=.pass)
+ for I $(<) $(>)
+ $(I:D:B:S=.pass) : .VIRTUAL .FORCE $(I)
+ $(>)
+ end
+loadfree:: loadfree.c
+mutex1:: mutex1.c
+mutex1e:: mutex1e.c
+mutex1n:: mutex1n.c
+mutex1r:: mutex1r.c
+mutex2:: mutex1.2
+exit1:: exit1.c
+condvar1:: condvar1.c
+self1:: self1.c
+condvar2:: condvar2.c
+condvar2_1:: condvar2_1.c
+condvar3_1:: condvar3_1.c
+condvar3_2:: condvar3_2.c
+condvar3_3:: condvar3_3.c
+create1.:: create1.c
+cancel1:: cancel1.c
+cancel2:: cancel2.c
+mutex3:: mutex3.c
+mutex4:: mutex4.c
+mutex5:: mutex5.c
+mutex6:: mutex6.c
+mutex6e:: mutex6e.c
+mutex6n:: mutex6n.c
+mutex6r:: mutex6r.c
+equal1:: equal1.c
+exit2:: exit2.c
+exit3:: exit3.c
+join0:: join0.c
+join1:: join1.c
+join2:: join2.c
+count1:: count1.c
+once1:: once1.c
+tsd1:: tsd1.c
+self2:: self2.c
+eyal1:: eyal1.c
+condvar3:: condvar3.c
+condvar4:: condvar4.c
+condvar5:: condvar5.c
+condvar6:: condvar6.c
+condvar7:: condvar7.c
+condvar8:: condvar8.c
+condvar9:: condvar9.c
+errno1:: errno1.c
+rwlock1:: rwlock1.c
+rwlock2:: rwlock2.c
+rwlock3:: rwlock3.c
+rwlock4:: rwlock4.c
+rwlock5:: rwlock5.c
+rwlock6:: rwlock6.c
+rwlock7:: rwlock7.c
+context1:: context1.c
+cancel3:: cancel3.c
+cancel4:: cancel4.c
+cancel5:: cancel5.c
+cleanup0:: cleanup0.c
+cleanup1:: cleanup1.c
+cleanup2:: cleanup2.c
+cleanup3:: cleanup3.c
+priority1:: priority1.c
+priority2:: priority2.c
+inherit1:: inherit1.c
+spin1:: spin1.c
+spin2:: spin2.c
+spin3:: spin3.c
+spin4:: spin4.c
+barrier1:: barrier1.c
+barrier2:: barrier2.c
+barrier3:: barrier3.c
+barrier4:: barrier4.c
+barrier5:: barrier5.c
+exception1:: exception1.c
+exception2:: exception2.c
+exception3:: exception3.c
+benchtest1:: benchtest1.c
+benchtest2:: benchtest2.c
+benchtest3:: benchtest3.c
+benchtest4:: benchtest4.c
+
+loadfree: :test:
+mutex1 :test: loadfree
+mutex2 :test: loadfree
+exit1 :test: loadfree
+condvar1 :test: loadfree
+self1 :test: loadfree
+condvar2 :test: condvar1
+condvar2_1 :test: condvar2
+create1 :test: mutex2
+cancel1 :test: create1
+cancel2 :test: cancel1
+mutex3 :test: create1
+mutex4 :test: mutex3
+equal1 :test: create1
+exit2 :test: create1
+exit3 :test: create1
+join0 :test: create1
+join1 :test: create1
+join2 :test: create1
+count1 :test: join1
+once1 :test: create1
+tsd1 :test: join1
+self2 :test: create1
+eyal1 :test: tsd1
+condvar3 :test: create1
+condvar3_1 :test: condvar3
+condvar3_2 :test: condvar3_1
+condvar3_3 :test: condvar3_2
+condvar4 :test: create1
+condvar5 :test: condvar4
+condvar6 :test: condvar5
+condvar7 :test: condvar6 cleanup1
+condvar8 :test: condvar7
+condvar9 :test: condvar8
+errno1 :test: mutex3
+rwlock1 :test: condvar6
+rwlock2 :test: rwlock1
+rwlock3 :test: rwlock2
+rwlock4 :test: rwlock3
+rwlock5 :test: rwlock4
+rwlock6 :test: rwlock5
+context1 :test: cancel2
+cancel3 :test: context1
+cancel4 :test: cancel3
+cancel5 :test: cancel3
+cleanup0 :test: cancel5
+cleanup1 :test: cleanup0
+cleanup2 :test: cleanup1
+cleanup3 :test: cleanup2
+priority1 :test: join1
+priority2 :test: priority1
+inherit1 :test: join1
+spin1 :test:
+spin2 :test: spin1.c
+spin3 :test: spin2.c
+spin4 :test: spin3.c
+barrier1 :test:
+barrier2 :test: barrier1.c
+barrier3 :test: barrier2.c
+barrier4 :test: barrier3.c
+barrier5 :test: barrier4.c
+benchtest1 :test: mutex3
+benchtest2 :test: benchtest1
+benchtest3 :test: benchtest2
+benchtest4 :test: benchtest3
+exception1 :test: cancel4
+exception2 :test: exception1
+exception3 :test: exception2
+
diff --git a/win32/contrib/pthreads/PROGRESS b/win32/contrib/pthreads/PROGRESS new file mode 100644 index 000000000..c85f3b185 --- /dev/null +++ b/win32/contrib/pthreads/PROGRESS @@ -0,0 +1,4 @@ +Please see the ANNOUNCE file "Level of Standards Conformance"
+or the web page:
+
+http://sourceware.cygnus.com/pthreads-win32/conformance.html
diff --git a/win32/contrib/pthreads/README b/win32/contrib/pthreads/README new file mode 100644 index 000000000..cce698fc9 --- /dev/null +++ b/win32/contrib/pthreads/README @@ -0,0 +1,269 @@ +PTHREADS-WIN32
+==============
+
+Pthreads-win32 is free software, distributed under the GNU Library
+General Public License (LGPL). See the file 'COPYING.LIB' for terms
+and conditions.
+
+
+What is it?
+-----------
+
+Pthreads-win32 is an Open Source Software implementation of the
+Threads component of the POSIX 1003.1c 1995 Standard for Microsoft's
+Win32 environment. Some functions from POSIX 1003.1b are also
+supported including semaphores. Other related functions include
+the set of read-write lock functions. The library also supports
+some of the functionality of the Open Group's Single Unix
+specification, version 2, namely mutex types.
+
+See the file "ANNOUNCE" for more information including standards
+conformance details and list of supported routines.
+
+
+Library naming
+--------------
+
+Because the library is being built using various exception
+handling schemes and compilers - and because the library
+will not work reliably if these are mixed in an application,
+each different version of the library has it's own name.
+
+In general:
+ pthread[VG]{SE,CE,C}.dll
+ pthread[VG]{SE,CE,C}.lib
+
+where:
+ [VG] indicates the compiler
+ V - MS VC
+ G - GNU C
+
+ {SE,CE,C} indicates the exception handling scheme
+ SE - Structured EH
+ CE - C++ EH
+ C - no exceptions - uses setjmp/longjmp
+
+For example:
+ pthreadVSE.dll (MSVC/SEH)
+ pthreadGCE.dll (GNUC/C++ EH)
+ pthreadGC.dll (GNUC/not dependent on exceptions)
+
+The GNU library archive file names have changed to:
+
+ libpthreadGCE.a
+ libpthreadGC.a
+
+
+Other name changes
+------------------
+
+All snapshots prior to and including snapshot 2000-08-13
+used "_pthread_" as the prefix to library internal
+functions, and "_PTHREAD_" to many library internal
+macros. These have now been changed to "ptw32_" and "PTW32_"
+respectively so as to not conflict with the ANSI standard's
+reservation of identifiers beginning with "_" and "__" for
+use by compiler implementations only.
+
+If you have written any applications and you are linking
+statically with the pthreads-win32 library then you may have
+included a call to _pthread_processInitialize. You will
+now have to change that to ptw32_processInitialize.
+
+
+Building under VC++ using C++ EH, Structured EH, or just C
+----------------------------------------------------------
+
+From the source directory run one of the following:
+
+nmake clean VCE (builds the VC++ C++ EH version pthreadVCE.dll)
+
+or:
+
+nmake clean VSE (builds the VC++ structured EH version pthreadVSE.dll)
+
+or:
+
+nmake clean VC (builds the VC setjmp/longjmp version of pthreadVC.dll)
+
+You can run the testsuite by changing to the "tests" directory and
+running the target corresponding to the DLL version you built:
+
+nmake clean VCE
+
+or:
+
+nmake clean VSE
+
+or:
+
+nmake clean VC
+
+
+Building under Mingw32
+----------------------
+
+The dll can be built with Mingw32 gcc-2.95.2-1 after you've
+made the changes to Mingw32 desribed in Question 6 of the FAQ.
+
+From the source directory, run
+
+make clean GCE
+
+or:
+
+make clean GC
+
+You can run the testsuite by changing to the "tests" directory and
+running
+
+make clean GCE
+
+or:
+
+make clean GC
+
+
+Building the library under Cygwin
+---------------------------------
+
+Not tested by me although I think some people have done this.
+Not sure how successfully though.
+
+Cygwin is implementing it's own POSIX threads routines and these
+will be the ones to use if you develop using Cygwin.
+
+
+Ready to run binaries
+---------------------
+
+For convenience, the following ready-to-run files can be downloaded
+from the FTP site (see under "Availability" below):
+
+ pthread.h
+ semaphore.h
+ sched.h
+ pthread.def
+ pthreadVCE.dll - built with MSVC++ compiler using C++ EH
+ pthreadVCE.lib
+ pthreadVC.dll - built with MSVC compiler using C setjmp/longjmp
+ pthreadVC.lib
+ pthreadVSE.dll - built with MSVC compiler using SEH
+ pthreadVSE.lib
+ pthreadGCE.dll - built with Mingw32 G++
+ pthreadGCE.a - derived from pthreadGCE.dll
+ pthreadGC.dll - built with Mingw32 GCC
+ pthreadGC.a - derived from pthreadGC.dll
+ gcc.dll - needed to build and run applications that use
+ pthreadGCE.dll.
+
+
+Building applications with the library
+--------------------------------------
+
+Use the appropriate DLL and LIB files to match the exception handing
+that you use in your application, or specifically, in your POSIX
+threads. Don't mix them or neither thread cancelation nor
+pthread_exit() will work reliably if at all.
+
+If in doubt use the C (no-exceptions) versions of the library.
+
+
+Building applications with GNU compilers
+----------------------------------------
+
+If you're using pthreadGCE.dll:
+
+Use gcc-2.95.2-1 or later modified as per pthreads-win32 FAQ question 6.
+
+With the three header files, pthreadGCE.dll, gcc.dll and libpthreadGCE.a
+in the same directory as your application myapp.c, you could compile,
+link and run myapp.c under Mingw32 as follows:
+
+ gcc -x c++ -o myapp.exe myapp.c -I. -L. -lpthreadGCE
+ myapp
+
+Or put pthreadGCE.dll and gcc.dll in an appropriate directory in
+your PATH, put libpthreadGCE.a in MINGW_ROOT\i386-mingw32\lib, and
+put the three header files in MINGW_ROOT\i386-mingw32\include,
+then use:
+
+ gcc -x c++ -o myapp.exe myapp.c -lpthreadGCE
+ myapp
+
+If you're using pthreadGC.dll:
+
+With the three header files, pthreadGC.dll and libpthreadGC.a in the
+same directory as your application myapp.c, you could compile, link
+and run myapp.c under Mingw32 as follows:
+
+ gcc -o myapp.exe myapp.c -I. -L. -lpthreadGC
+ myapp
+
+Or put pthreadGC.dll in an appropriate directory in your PATH,
+put libpthreadGC.a in MINGW_ROOT\i386-mingw32\lib, and
+put the three header files in MINGW_ROOT\i386-mingw32\include,
+then use:
+
+ gcc -o myapp.exe myapp.c -lpthreadGC
+ myapp
+
+
+Availability
+------------
+
+The complete source code in either unbundled, self-extracting
+Zip file, or tar/gzipped format can be found at:
+
+ ftp://sources.redhat.com/pub/pthreads-win32
+
+The pre-built DLL, export libraries and matching pthread.h can
+be found at:
+
+ ftp://sources.redhat.com/pub/pthreads-win32/dll-latest
+
+Home page:
+
+ http://sources.redhat.com/pthreads-win32/
+
+
+Mailing list
+------------
+
+There is a mailing list for discussing pthreads on Win32.
+To join, send email to:
+
+ pthreads-win32-subscribe@sources.redhat.com
+
+Unsubscribe by sending mail to:
+
+ pthreads-win32-unsubscribe@sources.redhat.com
+
+
+Acknowledgements
+----------------
+
+Pthreads-win32 is based substantially on a Win32 Pthreads
+implementation contributed by John E. Bossom.
+Many others have contributed important new code,
+improvements and bug fixes. Thanks go to Alexander Terekhov
+and Louis Thomas for their improvements to the implementation
+of condition variables.
+
+See the 'CONTRIBUTORS' file for the list of contributors.
+
+As much as possible, the ChangeLog file also attributes
+contributions and patches that have been incorporated
+in the library.
+
+----
+Ross Johnson
+<rpj@ise.canberra.edu.au>
+
+
+
+
+
+
+
+
diff --git a/win32/contrib/pthreads/README.CV b/win32/contrib/pthreads/README.CV new file mode 100644 index 000000000..522fa602b --- /dev/null +++ b/win32/contrib/pthreads/README.CV @@ -0,0 +1,3036 @@ +README.CV -- Condition Variables
+--------------------------------
+
+The original implementation of condition variables in
+pthreads-win32 was based on a discussion paper:
+
+"Strategies for Implementing POSIX Condition Variables
+on Win32": http://www.cs.wustl.edu/~schmidt/win32-cv-1.html
+
+The changes suggested below were made on Feb 6 2001. This
+file is included in the package for the benefit of anyone
+interested in understanding the pthreads-win32 implementation
+of condition variables and the (sometimes subtle) issues that
+it attempts to resolve.
+
+Thanks go to the individuals whose names appear throughout
+the following text.
+
+Ross Johnson
+
+--------------------------------------------------------------------
+
+fyi.. (more detailed problem description/demos + possible fix/patch)
+
+regards,
+alexander.
+
+
+Alexander Terekhov
+31.01.2001 17:43
+
+To: ace-bugs@cs.wustl.edu
+cc:
+From: Alexander Terekhov/Germany/IBM@IBMDE
+Subject: Implementation of POSIX CVs: spur.wakeups/lost
+ signals/deadlocks/unfairness
+
+
+
+ ACE VERSION:
+
+ 5.1.12 (pthread-win32 snapshot 2000-12-29)
+
+ HOST MACHINE and OPERATING SYSTEM:
+
+ IBM IntelliStation Z Pro, 2 x XEON 1GHz, Win2K
+
+ TARGET MACHINE and OPERATING SYSTEM, if different from HOST:
+ COMPILER NAME AND VERSION (AND PATCHLEVEL):
+
+ Microsoft Visual C++ 6.0
+
+ AREA/CLASS/EXAMPLE AFFECTED:
+
+ Implementation of POSIX condition variables - OS.cpp/.h
+
+ DOES THE PROBLEM AFFECT:
+
+ EXECUTION? YES!
+
+ SYNOPSIS:
+
+ a) spurious wakeups (minor problem)
+ b) lost signals
+ c) broadcast deadlock
+ d) unfairness (minor problem)
+
+ DESCRIPTION:
+
+ Please see attached copy of discussion thread
+ from comp.programming.threads for more details on
+ some reported problems. (i've also posted a "fyi"
+ message to ace-users a week or two ago but
+ unfortunately did not get any response so far).
+
+ It seems that current implementation suffers from
+ two essential problems:
+
+ 1) cond.waiters_count does not accurately reflect
+ number of waiters blocked on semaphore - w/o
+ proper synchronisation that could result (in the
+ time window when counter is not accurate)
+ in spurious wakeups organised by subsequent
+ _signals and _broadcasts.
+
+ 2) Always having (with no e.g. copy_and_clear/..)
+ the same queue in use (semaphore+counter)
+ neither signal nor broadcast provide 'atomic'
+ behaviour with respect to other threads/subsequent
+ calls to signal/broadcast/wait.
+
+ Each problem and combination of both could produce
+ various nasty things:
+
+ a) spurious wakeups (minor problem)
+
+ it is possible that waiter(s) which was already
+ unblocked even so is still counted as blocked
+ waiter. signal and broadcast will release
+ semaphore which will produce a spurious wakeup
+ for a 'real' waiter coming later.
+
+ b) lost signals
+
+ signalling thread ends up consuming its own
+ signal. please see demo/discussion below.
+
+ c) broadcast deadlock
+
+ last_waiter processing code does not correctly
+ handle the case with multiple threads
+ waiting for the end of broadcast.
+ please see demo/discussion below.
+
+ d) unfairness (minor problem)
+
+ without SignalObjectAndWait some waiter(s)
+ may end up consuming broadcasted signals
+ multiple times (spurious wakeups) because waiter
+ thread(s) can be preempted before they call
+ semaphore wait (but after count++ and mtx.unlock).
+
+ REPEAT BY:
+
+ See below... run problem demos programs (tennis.cpp and
+ tennisb.cpp) number of times concurrently (on multiprocessor)
+ and in multiple sessions or just add a couple of "Sleep"s
+ as described in the attached copy of discussion thread
+ from comp.programming.threads
+
+ SAMPLE FIX/WORKAROUND:
+
+ See attached patch to pthread-win32.. well, I can not
+ claim that it is completely bug free but at least my
+ test and tests provided by pthreads-win32 seem to work.
+ Perhaps that will help.
+
+ regards,
+ alexander.
+
+
+>> Forum: comp.programming.threads
+>> Thread: pthread_cond_* implementation questions
+.
+.
+.
+David Schwartz <davids@webmaster.com> wrote:
+
+> terekhov@my-deja.com wrote:
+>
+>> BTW, could you please also share your view on other perceived
+>> "problems" such as nested broadcast deadlock, spurious wakeups
+>> and (the latest one) lost signals??
+>
+>I'm not sure what you mean. The standard allows an implementation
+>to do almost whatever it likes. In fact, you could implement
+>pthread_cond_wait by releasing the mutex, sleeping a random
+>amount of time, and then reacquiring the mutex. Of course,
+>this would be a pretty poor implementation, but any code that
+>didn't work under that implementation wouldn't be strictly
+>compliant.
+
+The implementation you suggested is indeed correct
+one (yes, now I see it :). However it requires from
+signal/broadcast nothing more than to "{ return 0; }"
+That is not the case for pthread-win32 and ACE
+implementations. I do think that these implementations
+(basically the same implementation) have some serious
+problems with wait/signal/broadcast calls. I am looking
+for help to clarify whether these problems are real
+or not. I think that I can demonstrate what I mean
+using one or two small sample programs.
+.
+.
+.
+==========
+tennis.cpp
+==========
+
+#include "ace/Synch.h"
+#include "ace/Thread.h"
+
+enum GAME_STATE {
+
+ START_GAME,
+ PLAYER_A, // Player A playes the ball
+ PLAYER_B, // Player B playes the ball
+ GAME_OVER,
+ ONE_PLAYER_GONE,
+ BOTH_PLAYERS_GONE
+
+};
+
+enum GAME_STATE eGameState;
+ACE_Mutex* pmtxGameStateLock;
+ACE_Condition< ACE_Mutex >* pcndGameStateChange;
+
+void*
+ playerA(
+ void* pParm
+ )
+{
+
+ // For access to game state variable
+ pmtxGameStateLock->acquire();
+
+ // Play loop
+ while ( eGameState < GAME_OVER ) {
+
+ // Play the ball
+ cout << endl << "PLAYER-A" << endl;
+
+ // Now its PLAYER-B's turn
+ eGameState = PLAYER_B;
+
+ // Signal to PLAYER-B that now it is his turn
+ pcndGameStateChange->signal();
+
+ // Wait until PLAYER-B finishes playing the ball
+ do {
+
+ pcndGameStateChange->wait();
+
+ if ( PLAYER_B == eGameState )
+ cout << endl << "----PLAYER-A: SPURIOUS WAKEUP!!!" << endl;
+
+ } while ( PLAYER_B == eGameState );
+
+ }
+
+ // PLAYER-A gone
+ eGameState = (GAME_STATE)(eGameState+1);
+ cout << endl << "PLAYER-A GONE" << endl;
+
+ // No more access to state variable needed
+ pmtxGameStateLock->release();
+
+ // Signal PLAYER-A gone event
+ pcndGameStateChange->broadcast();
+
+ return 0;
+
+}
+
+void*
+ playerB(
+ void* pParm
+ )
+{
+
+ // For access to game state variable
+ pmtxGameStateLock->acquire();
+
+ // Play loop
+ while ( eGameState < GAME_OVER ) {
+
+ // Play the ball
+ cout << endl << "PLAYER-B" << endl;
+
+ // Now its PLAYER-A's turn
+ eGameState = PLAYER_A;
+
+ // Signal to PLAYER-A that now it is his turn
+ pcndGameStateChange->signal();
+
+ // Wait until PLAYER-A finishes playing the ball
+ do {
+
+ pcndGameStateChange->wait();
+
+ if ( PLAYER_A == eGameState )
+ cout << endl << "----PLAYER-B: SPURIOUS WAKEUP!!!" << endl;
+
+ } while ( PLAYER_A == eGameState );
+
+ }
+
+ // PLAYER-B gone
+ eGameState = (GAME_STATE)(eGameState+1);
+ cout << endl << "PLAYER-B GONE" << endl;
+
+ // No more access to state variable needed
+ pmtxGameStateLock->release();
+
+ // Signal PLAYER-B gone event
+ pcndGameStateChange->broadcast();
+
+ return 0;
+
+}
+
+
+int
+main (int, ACE_TCHAR *[])
+{
+
+ pmtxGameStateLock = new ACE_Mutex();
+ pcndGameStateChange = new ACE_Condition< ACE_Mutex >( *pmtxGameStateLock
+);
+
+ // Set initial state
+ eGameState = START_GAME;
+
+ // Create players
+ ACE_Thread::spawn( playerA );
+ ACE_Thread::spawn( playerB );
+
+ // Give them 5 sec. to play
+ Sleep( 5000 );//sleep( 5 );
+
+ // Set game over state
+ pmtxGameStateLock->acquire();
+ eGameState = GAME_OVER;
+
+ // Let them know
+ pcndGameStateChange->broadcast();
+
+ // Wait for players to stop
+ do {
+
+ pcndGameStateChange->wait();
+
+ } while ( eGameState < BOTH_PLAYERS_GONE );
+
+ // Cleanup
+ cout << endl << "GAME OVER" << endl;
+ pmtxGameStateLock->release();
+ delete pcndGameStateChange;
+ delete pmtxGameStateLock;
+
+ return 0;
+
+}
+
+===========
+tennisb.cpp
+===========
+#include "ace/Synch.h"
+#include "ace/Thread.h"
+
+enum GAME_STATE {
+
+ START_GAME,
+ PLAYER_A, // Player A playes the ball
+ PLAYER_B, // Player B playes the ball
+ GAME_OVER,
+ ONE_PLAYER_GONE,
+ BOTH_PLAYERS_GONE
+
+};
+
+enum GAME_STATE eGameState;
+ACE_Mutex* pmtxGameStateLock;
+ACE_Condition< ACE_Mutex >* pcndGameStateChange;
+
+void*
+ playerA(
+ void* pParm
+ )
+{
+
+ // For access to game state variable
+ pmtxGameStateLock->acquire();
+
+ // Play loop
+ while ( eGameState < GAME_OVER ) {
+
+ // Play the ball
+ cout << endl << "PLAYER-A" << endl;
+
+ // Now its PLAYER-B's turn
+ eGameState = PLAYER_B;
+
+ // Signal to PLAYER-B that now it is his turn
+ pcndGameStateChange->broadcast();
+
+ // Wait until PLAYER-B finishes playing the ball
+ do {
+
+ pcndGameStateChange->wait();
+
+ if ( PLAYER_B == eGameState )
+ cout << endl << "----PLAYER-A: SPURIOUS WAKEUP!!!" << endl;
+
+ } while ( PLAYER_B == eGameState );
+
+ }
+
+ // PLAYER-A gone
+ eGameState = (GAME_STATE)(eGameState+1);
+ cout << endl << "PLAYER-A GONE" << endl;
+
+ // No more access to state variable needed
+ pmtxGameStateLock->release();
+
+ // Signal PLAYER-A gone event
+ pcndGameStateChange->broadcast();
+
+ return 0;
+
+}
+
+void*
+ playerB(
+ void* pParm
+ )
+{
+
+ // For access to game state variable
+ pmtxGameStateLock->acquire();
+
+ // Play loop
+ while ( eGameState < GAME_OVER ) {
+
+ // Play the ball
+ cout << endl << "PLAYER-B" << endl;
+
+ // Now its PLAYER-A's turn
+ eGameState = PLAYER_A;
+
+ // Signal to PLAYER-A that now it is his turn
+ pcndGameStateChange->broadcast();
+
+ // Wait until PLAYER-A finishes playing the ball
+ do {
+
+ pcndGameStateChange->wait();
+
+ if ( PLAYER_A == eGameState )
+ cout << endl << "----PLAYER-B: SPURIOUS WAKEUP!!!" << endl;
+
+ } while ( PLAYER_A == eGameState );
+
+ }
+
+ // PLAYER-B gone
+ eGameState = (GAME_STATE)(eGameState+1);
+ cout << endl << "PLAYER-B GONE" << endl;
+
+ // No more access to state variable needed
+ pmtxGameStateLock->release();
+
+ // Signal PLAYER-B gone event
+ pcndGameStateChange->broadcast();
+
+ return 0;
+
+}
+
+
+int
+main (int, ACE_TCHAR *[])
+{
+
+ pmtxGameStateLock = new ACE_Mutex();
+ pcndGameStateChange = new ACE_Condition< ACE_Mutex >( *pmtxGameStateLock
+);
+
+ // Set initial state
+ eGameState = START_GAME;
+
+ // Create players
+ ACE_Thread::spawn( playerA );
+ ACE_Thread::spawn( playerB );
+
+ // Give them 5 sec. to play
+ Sleep( 5000 );//sleep( 5 );
+
+ // Make some noise
+ pmtxGameStateLock->acquire();
+ cout << endl << "---Noise ON..." << endl;
+ pmtxGameStateLock->release();
+ for ( int i = 0; i < 100000; i++ )
+ pcndGameStateChange->broadcast();
+ cout << endl << "---Noise OFF" << endl;
+
+ // Set game over state
+ pmtxGameStateLock->acquire();
+ eGameState = GAME_OVER;
+ cout << endl << "---Stopping the game..." << endl;
+
+ // Let them know
+ pcndGameStateChange->broadcast();
+
+ // Wait for players to stop
+ do {
+
+ pcndGameStateChange->wait();
+
+ } while ( eGameState < BOTH_PLAYERS_GONE );
+
+ // Cleanup
+ cout << endl << "GAME OVER" << endl;
+ pmtxGameStateLock->release();
+ delete pcndGameStateChange;
+ delete pmtxGameStateLock;
+
+ return 0;
+
+}
+.
+.
+.
+David Schwartz <davids@webmaster.com> wrote:
+>> > It's compliant
+>>
+>> That is really good.
+>
+>> Tomorrow (I have to go urgently now) I will try to
+>> demonstrate the lost-signal "problem" of current
+>> pthread-win32 and ACE-(variant w/o SingleObjectAndWait)
+>> implementations: players start suddenly drop their balls :-)
+>> (with no change in source code).
+>
+>Signals aren't lost, they're going to the main thread,
+>which isn't coded correctly to handle them. Try this:
+>
+> // Wait for players to stop
+> do {
+>
+> pthread_cond_wait( &cndGameStateChange,&mtxGameStateLock );
+>printf("Main thread stole a signal\n");
+>
+> } while ( eGameState < BOTH_PLAYERS_GONE );
+>
+>I bet everytime you thing a signal is lost, you'll see that printf.
+>The signal isn't lost, it was stolen by another thread.
+
+well, you can probably loose your bet.. it was indeed stolen
+by "another" thread but not the one you seem to think of.
+
+I think that what actually happens is the following:
+
+H:\SA\UXX\pt\PTHREADS\TESTS>tennis3.exe
+
+PLAYER-A
+
+PLAYER-B
+
+----PLAYER-B: SPURIOUS WAKEUP!!!
+
+PLAYER-A GONE
+
+PLAYER-B GONE
+
+GAME OVER
+
+H:\SA\UXX\pt\PTHREADS\TESTS>
+
+here you can see that PLAYER-B after playing his first
+ball (which came via signal from PLAYER-A) just dropped
+it down. What happened is that his signal to player A
+was consumed as spurious wakeup by himself (player B).
+
+The implementation has a problem:
+
+================
+waiting threads:
+================
+
+{ /** Critical Section
+
+ inc cond.waiters_count
+
+}
+
+ /*
+ /* Atomic only if using Win32 SignalObjectAndWait
+ /*
+ cond.mtx.release
+
+ /*** ^^-- A THREAD WHICH DID SIGNAL MAY ACQUIRE THE MUTEX,
+ /*** GO INTO WAIT ON THE SAME CONDITION AND OVERTAKE
+ /*** ORIGINAL WAITER(S) CONSUMING ITS OWN SIGNAL!
+
+ cond.sem.wait
+
+Player-A after playing game's initial ball went into
+wait (called _wait) but was pre-empted before reaching
+wait semaphore. He was counted as waiter but was not
+actually waiting/blocked yet.
+
+===============
+signal threads:
+===============
+
+{ /** Critical Section
+
+ waiters_count = cond.waiters_count
+
+}
+
+ if ( waiters_count != 0 )
+
+ sem.post 1
+
+ endif
+
+Player-B after he received signal/ball from Player A
+called _signal. The _signal did see that there was
+one waiter blocked on the condition (Player-A) and
+released the semaphore.. (but it did not unblock
+Player-A because he was not actually blocked).
+Player-B thread continued its execution, called _wait,
+was counted as second waiter BUT was allowed to slip
+through opened semaphore gate (which was opened for
+Player-B) and received his own signal. Player B remained
+blocked followed by Player A. Deadlock happened which
+lasted until main thread came in and said game over.
+
+It seems to me that the implementation fails to
+correctly implement the following statement
+from specification:
+
+http://www.opengroup.org/
+onlinepubs/007908799/xsh/pthread_cond_wait.html
+
+"These functions atomically release mutex and cause
+the calling thread to block on the condition variable
+cond; atomically here means "atomically with respect
+to access by another thread to the mutex and then the
+condition variable". That is, if another thread is
+able to acquire the mutex after the about-to-block
+thread has released it, then a subsequent call to
+pthread_cond_signal() or pthread_cond_broadcast()
+in that thread behaves as if it were issued after
+the about-to-block thread has blocked."
+
+Question: Am I right?
+
+(I produced the program output above by simply
+adding ?Sleep( 1 )?:
+
+================
+waiting threads:
+================
+
+{ /** Critical Section
+
+ inc cond.waiters_count
+
+}
+
+ /*
+ /* Atomic only if using Win32 SignalObjectAndWait
+ /*
+ cond.mtx.release
+
+Sleep( 1 ); // Win32
+
+ /*** ^^-- A THREAD WHICH DID SIGNAL MAY ACQUIRE THE MUTEX,
+ /*** GO INTO WAIT ON THE SAME CONDITION AND OVERTAKE
+ /*** ORIGINAL WAITER(S) CONSUMING ITS OWN SIGNAL!
+
+ cond.sem.wait
+
+to the source code of pthread-win32 implementation:
+
+http://sources.redhat.com/cgi-bin/cvsweb.cgi/pthreads/
+condvar.c?rev=1.36&content-type=text/
+x-cvsweb-markup&cvsroot=pthreads-win32
+
+
+ /*
+ * We keep the lock held just long enough to increment the count of
+ * waiters by one (above).
+ * Note that we can't keep it held across the
+ * call to sem_wait since that will deadlock other calls
+ * to pthread_cond_signal
+ */
+ cleanup_args.mutexPtr = mutex;
+ cleanup_args.cv = cv;
+ cleanup_args.resultPtr = &result;
+
+ pthread_cleanup_push (ptw32_cond_wait_cleanup, (void *)
+&cleanup_args);
+
+ if ((result = pthread_mutex_unlock (mutex)) == 0)
+ {((result
+Sleep( 1 ); // @AT
+
+ /*
+ * Wait to be awakened by
+ * pthread_cond_signal, or
+ * pthread_cond_broadcast, or
+ * a timeout
+ *
+ * Note:
+ * ptw32_sem_timedwait is a cancelation point,
+ * hence providing the
+ * mechanism for making pthread_cond_wait a cancelation
+ * point. We use the cleanup mechanism to ensure we
+ * re-lock the mutex and decrement the waiters count
+ * if we are canceled.
+ */
+ if (ptw32_sem_timedwait (&(cv->sema), abstime) == -1) {
+ result = errno;
+ }
+ }
+
+ pthread_cleanup_pop (1); /* Always cleanup */
+
+
+BTW, on my system (2 CPUs) I can manage to get
+signals lost even without any source code modification
+if I run the tennis program many times in different
+shell sessions.
+.
+.
+.
+David Schwartz <davids@webmaster.com> wrote:
+>terekhov@my-deja.com wrote:
+>
+>> well, it might be that the program is in fact buggy.
+>> but you did not show me any bug.
+>
+>You're right. I was close but not dead on. I was correct, however,
+>that the code is buggy because it uses 'pthread_cond_signal' even
+>though not any thread waiting on the condition variable can do the
+>job. I was wrong in which thread could be waiting on the cv but
+>unable to do the job.
+
+Okay, lets change 'pthread_cond_signal' to 'pthread_cond_broadcast'
+but also add some noise from main() right before declaring the game
+to be over (I need it in order to demonstrate another problem of
+pthread-win32/ACE implementations - broadcast deadlock)...
+.
+.
+.
+It is my understanding of POSIX conditions,
+that on correct implementation added noise
+in form of unnecessary broadcasts from main,
+should not break the tennis program. The
+only 'side effect' of added noise on correct
+implementation would be 'spurious wakeups' of
+players (in fact they are not spurious,
+players just see them as spurious) unblocked,
+not by another player but by main before
+another player had a chance to acquire the
+mutex and change the game state variable:
+.
+.
+.
+
+PLAYER-B
+
+PLAYER-A
+
+---Noise ON...
+
+PLAYER-B
+
+PLAYER-A
+
+.
+.
+.
+
+PLAYER-B
+
+PLAYER-A
+
+----PLAYER-A: SPURIOUS WAKEUP!!!
+
+PLAYER-B
+
+PLAYER-A
+
+---Noise OFF
+
+PLAYER-B
+
+---Stopping the game...
+
+PLAYER-A GONE
+
+PLAYER-B GONE
+
+GAME OVER
+
+H:\SA\UXX\pt\PTHREADS\TESTS>
+
+On pthread-win32/ACE implementations the
+program could stall:
+
+.
+.
+.
+
+PLAYER-A
+
+PLAYER-B
+
+PLAYER-A
+
+PLAYER-B
+
+PLAYER-A
+
+PLAYER-B
+
+PLAYER-A
+
+PLAYER-B
+
+---Noise ON...
+
+PLAYER-A
+
+---Noise OFF
+^C
+H:\SA\UXX\pt\PTHREADS\TESTS>
+
+
+The implementation has problems:
+
+================
+waiting threads:
+================
+
+{ /** Critical Section
+
+ inc cond.waiters_count
+
+}
+
+ /*
+ /* Atomic only if using Win32 SignalObjectAndWait
+ /*
+ cond.mtx.release
+ cond.sem.wait
+
+ /*** ^^-- WAITER CAN BE PREEMPTED AFTER BEING UNBLOCKED...
+
+{ /** Critical Section
+
+ dec cond.waiters_count
+
+ /*** ^^- ...AND BEFORE DECREMENTING THE COUNT (1)
+
+ last_waiter = ( cond.was_broadcast &&
+ cond.waiters_count == 0 )
+
+ if ( last_waiter )
+
+ cond.was_broadcast = FALSE
+
+ endif
+
+}
+
+ if ( last_waiter )
+
+ /*
+ /* Atomic only if using Win32 SignalObjectAndWait
+ /*
+ cond.auto_reset_event_or_sem.post /* Event for Win32
+ cond.mtx.acquire
+
+ /*** ^^-- ...AND BEFORE CALL TO mtx.acquire (2)
+
+ /*** ^^-- NESTED BROADCASTS RESULT IN A DEADLOCK
+
+
+ else
+
+ cond.mtx.acquire
+
+ /*** ^^-- ...AND BEFORE CALL TO mtx.acquire (3)
+
+ endif
+
+
+==================
+broadcast threads:
+==================
+
+{ /** Critical Section
+
+ waiters_count = cond.waiters_count
+
+ if ( waiters_count != 0 )
+
+ cond.was_broadcast = TRUE
+
+ endif
+
+}
+
+if ( waiters_count != 0 )
+
+ cond.sem.post waiters_count
+
+ /*** ^^^^^--- SPURIOUS WAKEUPS DUE TO (1)
+
+ cond.auto_reset_event_or_sem.wait /* Event for Win32
+
+ /*** ^^^^^--- DEADLOCK FOR FURTHER BROADCASTS IF THEY
+ HAPPEN TO GO INTO WAIT WHILE PREVIOUS
+ BROADCAST IS STILL IN PROGRESS/WAITING
+
+endif
+
+a) cond.waiters_count does not accurately reflect
+number of waiters blocked on semaphore - that could
+result (in the time window when counter is not accurate)
+in spurios wakeups organised by subsequent _signals
+and _broadcasts. From standard compliance point of view
+that is OK but that could be a real problem from
+performance/efficiency point of view.
+
+b) If subsequent broadcast happen to go into wait on
+cond.auto_reset_event_or_sem before previous
+broadcast was unblocked from cond.auto_reset_event_or_sem
+by its last waiter, one of two blocked threads will
+remain blocked because last_waiter processing code
+fails to unblock both threads.
+
+In the situation with tennisb.c the Player-B was put
+in a deadlock by noise (broadcast) coming from main
+thread. And since Player-B holds the game state
+mutex when it calls broadcast, the whole program
+stalled: Player-A was deadlocked on mutex and
+main thread after finishing with producing the noise
+was deadlocked on mutex too (needed to declare the
+game over)
+
+(I produced the program output above by simply
+adding ?Sleep( 1 )?:
+
+==================
+broadcast threads:
+==================
+
+{ /** Critical Section
+
+ waiters_count = cond.waiters_count
+
+ if ( waiters_count != 0 )
+
+ cond.was_broadcast = TRUE
+
+ endif
+
+}
+
+if ( waiters_count != 0 )
+
+Sleep( 1 ); //Win32
+
+ cond.sem.post waiters_count
+
+ /*** ^^^^^--- SPURIOUS WAKEUPS DUE TO (1)
+
+ cond.auto_reset_event_or_sem.wait /* Event for Win32
+
+ /*** ^^^^^--- DEADLOCK FOR FURTHER BROADCASTS IF THEY
+ HAPPEN TO GO INTO WAIT WHILE PREVIOUS
+ BROADCAST IS STILL IN PROGRESS/WAITING
+
+endif
+
+to the source code of pthread-win32 implementation:
+
+http://sources.redhat.com/cgi-bin/cvsweb.cgi/pthreads/
+condvar.c?rev=1.36&content-type=text/
+x-cvsweb-markup&cvsroot=pthreads-win32
+
+ if (wereWaiters)
+ {(wereWaiters)sroot=pthreads-win32eb.cgi/pthreads/Yem...m
+ /*
+ * Wake up all waiters
+ */
+
+Sleep( 1 ); //@AT
+
+#ifdef NEED_SEM
+
+ result = (ptw32_increase_semaphore( &cv->sema, cv->waiters )
+ ? 0
+ : EINVAL);
+
+#else /* NEED_SEM */
+
+ result = (ReleaseSemaphore( cv->sema, cv->waiters, NULL )
+ ? 0
+ : EINVAL);
+
+#endif /* NEED_SEM */
+
+ }
+
+ (void) pthread_mutex_unlock(&(cv->waitersLock));
+
+ if (wereWaiters && result == 0)
+ {(wereWaiters
+ /*
+ * Wait for all the awakened threads to acquire their part of
+ * the counting semaphore
+ */
+
+ if (WaitForSingleObject (cv->waitersDone, INFINITE)
+ == WAIT_OBJECT_0)
+ {
+ result = 0;
+ }
+ else
+ {
+ result = EINVAL;
+ }
+
+ }
+
+ return (result);
+
+}
+
+BTW, on my system (2 CPUs) I can manage to get
+the program stalled even without any source code
+modification if I run the tennisb program many
+times in different shell sessions.
+
+===================
+pthread-win32 patch
+===================
+struct pthread_cond_t_ {
+ long nWaitersBlocked; /* Number of threads blocked
+*/
+ long nWaitersUnblocked; /* Number of threads unblocked
+*/
+ long nWaitersToUnblock; /* Number of threads to unblock
+*/
+ sem_t semBlockQueue; /* Queue up threads waiting for the
+*/
+ /* condition to become signalled
+*/
+ sem_t semBlockLock; /* Semaphore that guards access to
+*/
+ /* | waiters blocked count/block queue
+*/
+ /* +-> Mandatory Sync.LEVEL-1
+*/
+ pthread_mutex_t mtxUnblockLock; /* Mutex that guards access to
+*/
+ /* | waiters (to)unblock(ed) counts
+*/
+ /* +-> Optional* Sync.LEVEL-2
+*/
+}; /* Opt*) for _timedwait and
+cancellation*/
+
+int
+pthread_cond_init (pthread_cond_t * cond, const pthread_condattr_t * attr)
+ int result = EAGAIN;
+ pthread_cond_t cv = NULL;
+
+ if (cond == NULL)
+ {(cond
+ return EINVAL;
+ }
+
+ if ((attr != NULL && *attr != NULL) &&
+ ((*attr)->pshared == PTHREAD_PROCESS_SHARED))
+ {
+ /*
+ * Creating condition variable that can be shared between
+ * processes.
+ */
+ result = ENOSYS;
+
+ goto FAIL0;
+ }
+
+ cv = (pthread_cond_t) calloc (1, sizeof (*cv));
+
+ if (cv == NULL)
+ {(cv
+ result = ENOMEM;
+ goto FAIL0;
+ }
+
+ cv->nWaitersBlocked = 0;
+ cv->nWaitersUnblocked = 0;
+ cv->nWaitersToUnblock = 0;
+
+ if (sem_init (&(cv->semBlockLock), 0, 1) != 0)
+ {(sem_init
+ goto FAIL0;
+ }
+
+ if (sem_init (&(cv->semBlockQueue), 0, 0) != 0)
+ {(sem_init
+ goto FAIL1;
+ }
+
+ if (pthread_mutex_init (&(cv->mtxUnblockLock), 0) != 0)
+ {(pthread_mutex_init
+ goto FAIL2;
+ }
+
+
+ result = 0;
+
+ goto DONE;
+
+ /*
+ * -------------
+ * Failed...
+ * -------------
+ */
+FAIL2:
+ (void) sem_destroy (&(cv->semBlockQueue));
+
+FAIL1:
+ (void) sem_destroy (&(cv->semBlockLock));
+
+FAIL0:
+DONE:
+ *cond = cv;
+
+ return (result);
+
+} /* pthread_cond_init */
+
+int
+pthread_cond_destroy (pthread_cond_t * cond)
+{
+ int result = 0;
+ pthread_cond_t cv;
+
+ /*
+ * Assuming any race condition here is harmless.
+ */
+ if (cond == NULL
+ || *cond == NULL)
+ {
+ return EINVAL;
+ }
+
+ if (*cond != (pthread_cond_t) PTW32_OBJECT_AUTO_INIT)
+ {(*cond
+ cv = *cond;
+
+ /*
+ * Synchronize access to waiters blocked count (LEVEL-1)
+ */
+ if (sem_wait(&(cv->semBlockLock)) != 0)
+ {(sem_wait(&(cv->semBlockLock))
+ return errno;
+ }
+
+ /*
+ * Synchronize access to waiters (to)unblock(ed) counts (LEVEL-2)
+ */
+ if ((result = pthread_mutex_lock(&(cv->mtxUnblockLock))) != 0)
+ {((result
+ (void) sem_post(&(cv->semBlockLock));
+ return result;
+ }
+
+ /*
+ * Check whether cv is still busy (still has waiters blocked)
+ */
+ if (cv->nWaitersBlocked - cv->nWaitersUnblocked > 0)
+ {(cv->nWaitersBlocked
+ (void) sem_post(&(cv->semBlockLock));
+ (void) pthread_mutex_unlock(&(cv->mtxUnblockLock));
+ return EBUSY;
+ }
+
+ /*
+ * Now it is safe to destroy
+ */
+ (void) sem_destroy (&(cv->semBlockLock));
+ (void) sem_destroy (&(cv->semBlockQueue));
+ (void) pthread_mutex_unlock (&(cv->mtxUnblockLock));
+ (void) pthread_mutex_destroy (&(cv->mtxUnblockLock));
+
+ free(cv);
+ *cond = NULL;
+ }
+ else
+ {
+ /*
+ * See notes in ptw32_cond_check_need_init() above also.
+ */
+ EnterCriticalSection(&ptw32_cond_test_init_lock);
+
+ /*
+ * Check again.
+ */
+ if (*cond == (pthread_cond_t) PTW32_OBJECT_AUTO_INIT)
+ {(*cond
+ /*
+ * This is all we need to do to destroy a statically
+ * initialised cond that has not yet been used (initialised).
+ * If we get to here, another thread
+ * waiting to initialise this cond will get an EINVAL.
+ */
+ *cond = NULL;
+ }
+ else
+ {
+ /*
+ * The cv has been initialised while we were waiting
+ * so assume it's in use.
+ */
+ result = EBUSY;
+ }
+
+ LeaveCriticalSection(&ptw32_cond_test_init_lock);
+ }
+
+ return (result);
+}
+
+/*
+ * Arguments for cond_wait_cleanup, since we can only pass a
+ * single void * to it.
+ */
+typedef struct {
+ pthread_mutex_t * mutexPtr;
+ pthread_cond_t cv;
+ int * resultPtr;
+} ptw32_cond_wait_cleanup_args_t;
+
+static void
+ptw32_cond_wait_cleanup(void * args)
+{
+ ptw32_cond_wait_cleanup_args_t * cleanup_args =
+(ptw32_cond_wait_cleanup_args_t *) args;
+ pthread_cond_t cv = cleanup_args->cv;
+ int * resultPtr = cleanup_args->resultPtr;
+ int eLastSignal; /* enum: 1=yes 0=no -1=cancelled/timedout w/o signal(s)
+*/
+ int result;
+
+ /*
+ * Whether we got here as a result of signal/broadcast or because of
+ * timeout on wait or thread cancellation we indicate that we are no
+ * longer waiting. The waiter is responsible for adjusting waiters
+ * (to)unblock(ed) counts (protected by unblock lock).
+ * Unblock lock/Sync.LEVEL-2 supports _timedwait and cancellation.
+ */
+ if ((result = pthread_mutex_lock(&(cv->mtxUnblockLock))) != 0)
+ {((result
+ *resultPtr = result;
+ return;
+ }
+
+ cv->nWaitersUnblocked++;
+
+ eLastSignal = (cv->nWaitersToUnblock == 0) ?
+ -1 : (--cv->nWaitersToUnblock == 0);
+
+ /*
+ * No more LEVEL-2 access to waiters (to)unblock(ed) counts needed
+ */
+ if ((result = pthread_mutex_unlock(&(cv->mtxUnblockLock))) != 0)
+ {((result
+ *resultPtr = result;
+ return;
+ }
+
+ /*
+ * If last signal...
+ */
+ if (eLastSignal == 1)
+ {(eLastSignal
+ /*
+ * ...it means that we have end of 'atomic' signal/broadcast
+ */
+ if (sem_post(&(cv->semBlockLock)) != 0)
+ {(sem_post(&(cv->semBlockLock))
+ *resultPtr = errno;
+ return;
+ }
+ }
+ /*
+ * If not last signal and not timed out/cancelled wait w/o signal...
+ */
+ else if (eLastSignal == 0)
+ {
+ /*
+ * ...it means that next waiter can go through semaphore
+ */
+ if (sem_post(&(cv->semBlockQueue)) != 0)
+ {(sem_post(&(cv->semBlockQueue))
+ *resultPtr = errno;
+ return;
+ }
+ }
+
+ /*
+ * XSH: Upon successful return, the mutex has been locked and is owned
+ * by the calling thread
+ */
+ if ((result = pthread_mutex_lock(cleanup_args->mutexPtr)) != 0)
+ {((result
+ *resultPtr = result;
+ }
+
+} /* ptw32_cond_wait_cleanup */
+
+static int
+ptw32_cond_timedwait (pthread_cond_t * cond,
+ pthread_mutex_t * mutex,
+ const struct timespec *abstime)
+{
+ int result = 0;
+ pthread_cond_t cv;
+ ptw32_cond_wait_cleanup_args_t cleanup_args;
+
+ if (cond == NULL || *cond == NULL)
+ {(cond
+ return EINVAL;
+ }
+
+ /*
+ * We do a quick check to see if we need to do more work
+ * to initialise a static condition variable. We check
+ * again inside the guarded section of ptw32_cond_check_need_init()
+ * to avoid race conditions.
+ */
+ if (*cond == (pthread_cond_t) PTW32_OBJECT_AUTO_INIT)
+ {(*cond
+ result = ptw32_cond_check_need_init(cond);
+ }
+
+ if (result != 0 && result != EBUSY)
+ {(result
+ return result;
+ }
+
+ cv = *cond;
+
+ /*
+ * Synchronize access to waiters blocked count (LEVEL-1)
+ */
+ if (sem_wait(&(cv->semBlockLock)) != 0)
+ {(sem_wait(&(cv->semBlockLock))
+ return errno;
+ }
+
+ cv->nWaitersBlocked++;
+
+ /*
+ * Thats it. Counted means waiting, no more access needed
+ */
+ if (sem_post(&(cv->semBlockLock)) != 0)
+ {(sem_post(&(cv->semBlockLock))
+ return errno;
+ }
+
+ /*
+ * Setup this waiter cleanup handler
+ */
+ cleanup_args.mutexPtr = mutex;
+ cleanup_args.cv = cv;
+ cleanup_args.resultPtr = &result;
+
+ pthread_cleanup_push (ptw32_cond_wait_cleanup, (void *) &cleanup_args);
+
+ /*
+ * Now we can release 'mutex' and...
+ */
+ if ((result = pthread_mutex_unlock (mutex)) == 0)
+ {((result
+
+ /*
+ * ...wait to be awakened by
+ * pthread_cond_signal, or
+ * pthread_cond_broadcast, or
+ * timeout, or
+ * thread cancellation
+ *
+ * Note:
+ *
+ * ptw32_sem_timedwait is a cancellation point,
+ * hence providing the mechanism for making
+ * pthread_cond_wait a cancellation point.
+ * We use the cleanup mechanism to ensure we
+ * re-lock the mutex and adjust (to)unblock(ed) waiters
+ * counts if we are cancelled, timed out or signalled.
+ */
+ if (ptw32_sem_timedwait (&(cv->semBlockQueue), abstime) != 0)
+ {(ptw32_sem_timedwait
+ result = errno;
+ }
+ }
+
+ /*
+ * Always cleanup
+ */
+ pthread_cleanup_pop (1);
+
+
+ /*
+ * "result" can be modified by the cleanup handler.
+ */
+ return (result);
+
+} /* ptw32_cond_timedwait */
+
+
+static int
+ptw32_cond_unblock (pthread_cond_t * cond,
+ int unblockAll)
+{
+ int result;
+ pthread_cond_t cv;
+
+ if (cond == NULL || *cond == NULL)
+ {(cond
+ return EINVAL;
+ }
+
+ cv = *cond;
+
+ /*
+ * No-op if the CV is static and hasn't been initialised yet.
+ * Assuming that any race condition is harmless.
+ */
+ if (cv == (pthread_cond_t) PTW32_OBJECT_AUTO_INIT)
+ {(cv
+ return 0;
+ }
+
+ /*
+ * Synchronize access to waiters blocked count (LEVEL-1)
+ */
+ if (sem_wait(&(cv->semBlockLock)) != 0)
+ {(sem_wait(&(cv->semBlockLock))
+ return errno;
+ }
+
+ /*
+ * Synchronize access to waiters (to)unblock(ed) counts (LEVEL-2)
+ * This sync.level supports _timedwait and cancellation
+ */
+ if ((result = pthread_mutex_lock(&(cv->mtxUnblockLock))) != 0)
+ {((result
+ return result;
+ }
+
+ /*
+ * Adjust waiters blocked and unblocked counts (collect garbage)
+ */
+ if (cv->nWaitersUnblocked != 0)
+ {(cv->nWaitersUnblocked
+ cv->nWaitersBlocked -= cv->nWaitersUnblocked;
+ cv->nWaitersUnblocked = 0;
+ }
+
+ /*
+ * If (after adjustment) there are still some waiters blocked counted...
+ */
+ if ( cv->nWaitersBlocked > 0)
+ {(
+ /*
+ * We will unblock first waiter and leave semBlockLock/LEVEL-1 locked
+ * LEVEL-1 access is left disabled until last signal/unblock
+completes
+ */
+ cv->nWaitersToUnblock = (unblockAll) ? cv->nWaitersBlocked : 1;
+
+ /*
+ * No more LEVEL-2 access to waiters (to)unblock(ed) counts needed
+ * This sync.level supports _timedwait and cancellation
+ */
+ if ((result = pthread_mutex_unlock(&(cv->mtxUnblockLock))) != 0)
+ {((result
+ return result;
+ }
+
+
+ /*
+ * Now, with LEVEL-2 lock released let first waiter go through
+semaphore
+ */
+ if (sem_post(&(cv->semBlockQueue)) != 0)
+ {(sem_post(&(cv->semBlockQueue))
+ return errno;
+ }
+ }
+ /*
+ * No waiter blocked - no more LEVEL-1 access to blocked count needed...
+ */
+ else if (sem_post(&(cv->semBlockLock)) != 0)
+ {
+ return errno;
+ }
+ /*
+ * ...and no more LEVEL-2 access to waiters (to)unblock(ed) counts needed
+too
+ * This sync.level supports _timedwait and cancellation
+ */
+ else
+ {
+ result = pthread_mutex_unlock(&(cv->mtxUnblockLock));
+ }
+
+ return(result);
+
+} /* ptw32_cond_unblock */
+
+int
+pthread_cond_wait (pthread_cond_t * cond,
+ pthread_mutex_t * mutex)
+{
+ /* The NULL abstime arg means INFINITE waiting. */
+ return(ptw32_cond_timedwait(cond, mutex, NULL));
+} /* pthread_cond_wait */
+
+
+int
+pthread_cond_timedwait (pthread_cond_t * cond,
+ pthread_mutex_t * mutex,
+ const struct timespec *abstime)
+{
+ if (abstime == NULL)
+ {(abstime
+ return EINVAL;
+ }
+
+ return(ptw32_cond_timedwait(cond, mutex, abstime));
+} /* pthread_cond_timedwait */
+
+
+int
+pthread_cond_signal (pthread_cond_t * cond)
+{
+ /* The '0'(FALSE) unblockAll arg means unblock ONE waiter. */
+ return(ptw32_cond_unblock(cond, 0));
+} /* pthread_cond_signal */
+
+int
+pthread_cond_broadcast (pthread_cond_t * cond)
+{
+ /* The '1'(TRUE) unblockAll arg means unblock ALL waiters. */
+ return(ptw32_cond_unblock(cond, 1));
+} /* pthread_cond_broadcast */
+
+
+
+
+TEREKHOV@de.ibm.com on 17.01.2001 01:00:57
+
+Please respond to TEREKHOV@de.ibm.com
+
+To: pthreads-win32@sourceware.cygnus.com
+cc: schmidt@uci.edu
+Subject: win32 conditions: sem+counter+event = broadcast_deadlock +
+ spur.wakeup/unfairness/incorrectness ??
+
+
+
+
+
+
+
+Hi,
+
+Problem 1: broadcast_deadlock
+
+It seems that current implementation does not provide "atomic"
+broadcasts. That may lead to "nested" broadcasts... and it seems
+that nested case is not handled correctly -> producing a broadcast
+DEADLOCK as a result.
+
+Scenario:
+
+N (>1) waiting threads W1..N are blocked (in _wait) on condition's
+semaphore.
+
+Thread B1 calls pthread_cond_broadcast, which results in "releasing" N
+W threads via incrementing semaphore counter by N (stored in
+cv->waiters) BUT cv->waiters counter does not change!! The caller
+thread B1 remains blocked on cv->waitersDone event (auto-reset!!) BUT
+condition is not protected from starting another broadcast (when called
+on another thread) while still waiting for the "old" broadcast to
+complete on thread B1.
+
+M (>=0, <N) W threads are fast enough to go thru their _wait call and
+decrement cv->waiters counter.
+
+L (N-M) "late" waiter W threads are a) still blocked/not returned from
+their semaphore wait call or b) were preempted after sem_wait but before
+lock( &cv->waitersLock ) or c) are blocked on cv->waitersLock.
+
+cv->waiters is still > 0 (= L).
+
+Another thread B2 (or some W thread from M group) calls
+pthread_cond_broadcast and gains access to counter... neither a) nor b)
+prevent thread B2 in pthread_cond_broadcast from gaining access to
+counter and starting another broadcast ( for c) - it depends on
+cv->waitersLock scheduling rules: FIFO=OK, PRTY=PROBLEM,... )
+
+That call to pthread_cond_broadcast (on thread B2) will result in
+incrementing semaphore by cv->waiters (=L) which is INCORRECT (all
+W1..N were in fact already released by thread B1) and waiting on
+_auto-reset_ event cv->waitersDone which is DEADLY WRONG (produces a
+deadlock)...
+
+All late W1..L threads now have a chance to complete their _wait call.
+Last W_L thread sets an auto-reselt event cv->waitersDone which will
+release either B1 or B2 leaving one of B threads in a deadlock.
+
+Problem 2: spur.wakeup/unfairness/incorrectness
+
+It seems that:
+
+a) because of the same problem with counter which does not reflect the
+actual number of NOT RELEASED waiters, the signal call may increment
+a semaphore counter w/o having a waiter blocked on it. That will result
+in (best case) spurious wake ups - performance degradation due to
+unnecessary context switches and predicate re-checks and (in worth case)
+unfairness/incorrectness problem - see b)
+
+b) neither signal nor broadcast prevent other threads - "new waiters"
+(and in the case of signal, the caller thread as well) from going into
+_wait and overtaking "old" waiters (already released but still not returned
+from sem_wait on condition's semaphore). Win semaphore just [API DOC]:
+"Maintains a count between zero and some maximum value, limiting the number
+of threads that are simultaneously accessing a shared resource." Calling
+ReleaseSemaphore does not imply (at least not documented) that on return
+from ReleaseSemaphore all waiters will in fact become released (returned
+from their Wait... call) and/or that new waiters calling Wait... afterwards
+will become less importance. It is NOT documented to be an atomic release
+of
+waiters... And even if it would be there is still a problem with a thread
+being preempted after Wait on semaphore and before Wait on cv->waitersLock
+and scheduling rules for cv->waitersLock itself
+(??WaitForMultipleObjects??)
+That may result in unfairness/incorrectness problem as described
+for SetEvent impl. in "Strategies for Implementing POSIX Condition
+Variables
+on Win32": http://www.cs.wustl.edu/~schmidt/win32-cv-1.html
+
+Unfairness -- The semantics of the POSIX pthread_cond_broadcast function is
+to wake up all threads currently blocked in wait calls on the condition
+variable. The awakened threads then compete for the external_mutex. To
+ensure
+fairness, all of these threads should be released from their
+pthread_cond_wait calls and allowed to recheck their condition expressions
+before other threads can successfully complete a wait on the condition
+variable.
+
+Unfortunately, the SetEvent implementation above does not guarantee that
+all
+threads sleeping on the condition variable when cond_broadcast is called
+will
+acquire the external_mutex and check their condition expressions. Although
+the Pthreads specification does not mandate this degree of fairness, the
+lack of fairness can cause starvation.
+
+To illustrate the unfairness problem, imagine there are 2 threads, C1 and
+C2,
+that are blocked in pthread_cond_wait on condition variable not_empty_ that
+is guarding a thread-safe message queue. Another thread, P1 then places two
+messages onto the queue and calls pthread_cond_broadcast. If C1 returns
+from
+pthread_cond_wait, dequeues and processes the message, and immediately
+waits
+again then it and only it may end up acquiring both messages. Thus, C2 will
+never get a chance to dequeue a message and run.
+
+The following illustrates the sequence of events:
+
+1. Thread C1 attempts to dequeue and waits on CV non_empty_
+2. Thread C2 attempts to dequeue and waits on CV non_empty_
+3. Thread P1 enqueues 2 messages and broadcasts to CV not_empty_
+4. Thread P1 exits
+5. Thread C1 wakes up from CV not_empty_, dequeues a message and runs
+6. Thread C1 waits again on CV not_empty_, immediately dequeues the 2nd
+ message and runs
+7. Thread C1 exits
+8. Thread C2 is the only thread left and blocks forever since
+ not_empty_ will never be signaled
+
+Depending on the algorithm being implemented, this lack of fairness may
+yield
+concurrent programs that have subtle bugs. Of course, application
+developers
+should not rely on the fairness semantics of pthread_cond_broadcast.
+However,
+there are many cases where fair implementations of condition variables can
+simplify application code.
+
+Incorrectness -- A variation on the unfairness problem described above
+occurs
+when a third consumer thread, C3, is allowed to slip through even though it
+was not waiting on condition variable not_empty_ when a broadcast occurred.
+
+To illustrate this, we will use the same scenario as above: 2 threads, C1
+and
+C2, are blocked dequeuing messages from the message queue. Another thread,
+P1
+then places two messages onto the queue and calls pthread_cond_broadcast.
+C1
+returns from pthread_cond_wait, dequeues and processes the message. At this
+time, C3 acquires the external_mutex, calls pthread_cond_wait and waits on
+the events in WaitForMultipleObjects. Since C2 has not had a chance to run
+yet, the BROADCAST event is still signaled. C3 then returns from
+WaitForMultipleObjects, and dequeues and processes the message in the
+queue.
+Thus, C2 will never get a chance to dequeue a message and run.
+
+The following illustrates the sequence of events:
+
+1. Thread C1 attempts to dequeue and waits on CV non_empty_
+2. Thread C2 attempts to dequeue and waits on CV non_empty_
+3. Thread P1 enqueues 2 messages and broadcasts to CV not_empty_
+4. Thread P1 exits
+5. Thread C1 wakes up from CV not_empty_, dequeues a message and runs
+6. Thread C1 exits
+7. Thread C3 waits on CV not_empty_, immediately dequeues the 2nd
+ message and runs
+8. Thread C3 exits
+9. Thread C2 is the only thread left and blocks forever since
+ not_empty_ will never be signaled
+
+In the above case, a thread that was not waiting on the condition variable
+when a broadcast occurred was allowed to proceed. This leads to incorrect
+semantics for a condition variable.
+
+
+COMMENTS???
+
+regards,
+alexander.
+
+-----------------------------------------------------------------------------
+
+Subject: RE: FYI/comp.programming.threads/Re: pthread_cond_*
+ implementation questions
+Date: Wed, 21 Feb 2001 11:54:47 +0100
+From: TEREKHOV@de.ibm.com
+To: lthomas@arbitrade.com
+CC: rpj@ise.canberra.edu.au, Thomas Pfaff <tpfaff@gmx.net>,
+ Nanbor Wang <nanbor@cs.wustl.edu>
+
+Hi Louis,
+
+generation number 8..
+
+had some time to revisit timeouts/spurious wakeup problem..
+found some bugs (in 7.b/c/d) and something to improve
+(7a - using IPC semaphores but it should speedup Win32
+version as well).
+
+regards,
+alexander.
+
+---------- Algorithm 8a / IMPL_SEM,UNBLOCK_STRATEGY == UNBLOCK_ALL ------
+given:
+semBlockLock - bin.semaphore
+semBlockQueue - semaphore
+mtxExternal - mutex or CS
+mtxUnblockLock - mutex or CS
+nWaitersGone - int
+nWaitersBlocked - int
+nWaitersToUnblock - int
+
+wait( timeout ) {
+
+ [auto: register int result ] // error checking omitted
+ [auto: register int nSignalsWasLeft ]
+ [auto: register int nWaitersWasGone ]
+
+ sem_wait( semBlockLock );
+ nWaitersBlocked++;
+ sem_post( semBlockLock );
+
+ unlock( mtxExternal );
+ bTimedOut = sem_wait( semBlockQueue,timeout );
+
+ lock( mtxUnblockLock );
+ if ( 0 != (nSignalsWasLeft = nWaitersToUnblock) ) {
+ if ( bTimeout ) { // timeout (or canceled)
+ if ( 0 != nWaitersBlocked ) {
+ nWaitersBlocked--;
+ }
+ else {
+ nWaitersGone++; // count spurious wakeups
+ }
+ }
+ if ( 0 == --nWaitersToUnblock ) {
+ if ( 0 != nWaitersBlocked ) {
+ sem_post( semBlockLock ); // open the gate
+ nSignalsWasLeft = 0; // do not open the gate below
+again
+ }
+ else if ( 0 != (nWaitersWasGone = nWaitersGone) ) {
+ nWaitersGone = 0;
+ }
+ }
+ }
+ else if ( INT_MAX/2 == ++nWaitersGone ) { // timeout/canceled or spurious
+semaphore :-)
+ sem_wait( semBlockLock );
+ nWaitersBlocked -= nWaitersGone; // something is going on here -
+test of timeouts? :-)
+ sem_post( semBlockLock );
+ nWaitersGone = 0;
+ }
+ unlock( mtxUnblockLock );
+
+ if ( 1 == nSignalsWasLeft ) {
+ if ( 0 != nWaitersWasGone ) {
+ // sem_adjust( -nWaitersWasGone );
+ while ( nWaitersWasGone-- ) {
+ sem_wait( semBlockLock ); // better now than spurious
+later
+ }
+ }
+ sem_post( semBlockLock ); // open the gate
+ }
+
+ lock( mtxExternal );
+
+ return ( bTimedOut ) ? ETIMEOUT : 0;
+}
+
+signal(bAll) {
+
+ [auto: register int result ]
+ [auto: register int nSignalsToIssue]
+
+ lock( mtxUnblockLock );
+
+ if ( 0 != nWaitersToUnblock ) { // the gate is closed!!!
+ if ( 0 == nWaitersBlocked ) { // NO-OP
+ return unlock( mtxUnblockLock );
+ }
+ if (bAll) {
+ nWaitersToUnblock += nSignalsToIssue=nWaitersBlocked;
+ nWaitersBlocked = 0;
+ }
+ else {
+ nSignalsToIssue = 1;
+ nWaitersToUnblock++;
+ nWaitersBlocked--;
+ }
+ }
+ else if ( nWaitersBlocked > nWaitersGone ) { // HARMLESS RACE CONDITION!
+ sem_wait( semBlockLock ); // close the gate
+ if ( 0 != nWaitersGone ) {
+ nWaitersBlocked -= nWaitersGone;
+ nWaitersGone = 0;
+ }
+ if (bAll) {
+ nSignalsToIssue = nWaitersToUnblock = nWaitersBlocked;
+ nWaitersBlocked = 0;
+ }
+ else {
+ nSignalsToIssue = nWaitersToUnblock = 1;
+ nWaitersBlocked--;
+ }
+ }
+ else { // NO-OP
+ return unlock( mtxUnblockLock );
+ }
+
+ unlock( mtxUnblockLock );
+ sem_post( semBlockQueue,nSignalsToIssue );
+ return result;
+}
+
+---------- Algorithm 8b / IMPL_SEM,UNBLOCK_STRATEGY == UNBLOCK_ONEBYONE
+------
+given:
+semBlockLock - bin.semaphore
+semBlockQueue - bin.semaphore
+mtxExternal - mutex or CS
+mtxUnblockLock - mutex or CS
+nWaitersGone - int
+nWaitersBlocked - int
+nWaitersToUnblock - int
+
+wait( timeout ) {
+
+ [auto: register int result ] // error checking omitted
+ [auto: register int nWaitersWasGone ]
+ [auto: register int nSignalsWasLeft ]
+
+ sem_wait( semBlockLock );
+ nWaitersBlocked++;
+ sem_post( semBlockLock );
+
+ unlock( mtxExternal );
+ bTimedOut = sem_wait( semBlockQueue,timeout );
+
+ lock( mtxUnblockLock );
+ if ( 0 != (nSignalsWasLeft = nWaitersToUnblock) ) {
+ if ( bTimeout ) { // timeout (or canceled)
+ if ( 0 != nWaitersBlocked ) {
+ nWaitersBlocked--;
+ nSignalsWasLeft = 0; // do not unblock next waiter
+below (already unblocked)
+ }
+ else {
+ nWaitersGone = 1; // spurious wakeup pending!!
+ }
+ }
+ if ( 0 == --nWaitersToUnblock &&
+ if ( 0 != nWaitersBlocked ) {
+ sem_post( semBlockLock ); // open the gate
+ nSignalsWasLeft = 0; // do not open the gate below
+again
+ }
+ else if ( 0 != (nWaitersWasGone = nWaitersGone) ) {
+ nWaitersGone = 0;
+ }
+ }
+ }
+ else if ( INT_MAX/2 == ++nWaitersGone ) { // timeout/canceled or spurious
+semaphore :-)
+ sem_wait( semBlockLock );
+ nWaitersBlocked -= nWaitersGone; // something is going on here -
+test of timeouts? :-)
+ sem_post( semBlockLock );
+ nWaitersGone = 0;
+ }
+ unlock( mtxUnblockLock );
+
+ if ( 1 == nSignalsWasLeft ) {
+ if ( 0 != nWaitersWasGone ) {
+ // sem_adjust( -1 );
+ sem_wait( semBlockQueue ); // better now than spurious
+later
+ }
+ sem_post( semBlockLock ); // open the gate
+ }
+ else if ( 0 != nSignalsWasLeft ) {
+ sem_post( semBlockQueue ); // unblock next waiter
+ }
+
+ lock( mtxExternal );
+
+ return ( bTimedOut ) ? ETIMEOUT : 0;
+}
+
+signal(bAll) {
+
+ [auto: register int result ]
+
+ lock( mtxUnblockLock );
+
+ if ( 0 != nWaitersToUnblock ) { // the gate is closed!!!
+ if ( 0 == nWaitersBlocked ) { // NO-OP
+ return unlock( mtxUnblockLock );
+ }
+ if (bAll) {
+ nWaitersToUnblock += nWaitersBlocked;
+ nWaitersBlocked = 0;
+ }
+ else {
+ nWaitersToUnblock++;
+ nWaitersBlocked--;
+ }
+ unlock( mtxUnblockLock );
+ }
+ else if ( nWaitersBlocked > nWaitersGone ) { // HARMLESS RACE CONDITION!
+ sem_wait( semBlockLock ); // close the gate
+ if ( 0 != nWaitersGone ) {
+ nWaitersBlocked -= nWaitersGone;
+ nWaitersGone = 0;
+ }
+ if (bAll) {
+ nWaitersToUnblock = nWaitersBlocked;
+ nWaitersBlocked = 0;
+ }
+ else {
+ nWaitersToUnblock = 1;
+ nWaitersBlocked--;
+ }
+ unlock( mtxUnblockLock );
+ sem_post( semBlockQueue );
+ }
+ else { // NO-OP
+ unlock( mtxUnblockLock );
+ }
+
+ return result;
+}
+
+---------- Algorithm 8c / IMPL_EVENT,UNBLOCK_STRATEGY == UNBLOCK_ONEBYONE
+---------
+given:
+hevBlockLock - auto-reset event
+hevBlockQueue - auto-reset event
+mtxExternal - mutex or CS
+mtxUnblockLock - mutex or CS
+nWaitersGone - int
+nWaitersBlocked - int
+nWaitersToUnblock - int
+
+wait( timeout ) {
+
+ [auto: register int result ] // error checking omitted
+ [auto: register int nSignalsWasLeft ]
+ [auto: register int nWaitersWasGone ]
+
+ wait( hevBlockLock,INFINITE );
+ nWaitersBlocked++;
+ set_event( hevBlockLock );
+
+ unlock( mtxExternal );
+ bTimedOut = wait( hevBlockQueue,timeout );
+
+ lock( mtxUnblockLock );
+ if ( 0 != (SignalsWasLeft = nWaitersToUnblock) ) {
+ if ( bTimeout ) { // timeout (or canceled)
+ if ( 0 != nWaitersBlocked ) {
+ nWaitersBlocked--;
+ nSignalsWasLeft = 0; // do not unblock next waiter
+below (already unblocked)
+ }
+ else {
+ nWaitersGone = 1; // spurious wakeup pending!!
+ }
+ }
+ if ( 0 == --nWaitersToUnblock )
+ if ( 0 != nWaitersBlocked ) {
+ set_event( hevBlockLock ); // open the gate
+ nSignalsWasLeft = 0; // do not open the gate below
+again
+ }
+ else if ( 0 != (nWaitersWasGone = nWaitersGone) ) {
+ nWaitersGone = 0;
+ }
+ }
+ }
+ else if ( INT_MAX/2 == ++nWaitersGone ) { // timeout/canceled or spurious
+event :-)
+ wait( hevBlockLock,INFINITE );
+ nWaitersBlocked -= nWaitersGone; // something is going on here -
+test of timeouts? :-)
+ set_event( hevBlockLock );
+ nWaitersGone = 0;
+ }
+ unlock( mtxUnblockLock );
+
+ if ( 1 == nSignalsWasLeft ) {
+ if ( 0 != nWaitersWasGone ) {
+ reset_event( hevBlockQueue ); // better now than spurious
+later
+ }
+ set_event( hevBlockLock ); // open the gate
+ }
+ else if ( 0 != nSignalsWasLeft ) {
+ set_event( hevBlockQueue ); // unblock next waiter
+ }
+
+ lock( mtxExternal );
+
+ return ( bTimedOut ) ? ETIMEOUT : 0;
+}
+
+signal(bAll) {
+
+ [auto: register int result ]
+
+ lock( mtxUnblockLock );
+
+ if ( 0 != nWaitersToUnblock ) { // the gate is closed!!!
+ if ( 0 == nWaitersBlocked ) { // NO-OP
+ return unlock( mtxUnblockLock );
+ }
+ if (bAll) {
+ nWaitersToUnblock += nWaitersBlocked;
+ nWaitersBlocked = 0;
+ }
+ else {
+ nWaitersToUnblock++;
+ nWaitersBlocked--;
+ }
+ unlock( mtxUnblockLock );
+ }
+ else if ( nWaitersBlocked > nWaitersGone ) { // HARMLESS RACE CONDITION!
+ wait( hevBlockLock,INFINITE ); // close the gate
+ if ( 0 != nWaitersGone ) {
+ nWaitersBlocked -= nWaitersGone;
+ nWaitersGone = 0;
+ }
+ if (bAll) {
+ nWaitersToUnblock = nWaitersBlocked;
+ nWaitersBlocked = 0;
+ }
+ else {
+ nWaitersToUnblock = 1;
+ nWaitersBlocked--;
+ }
+ unlock( mtxUnblockLock );
+ set_event( hevBlockQueue );
+ }
+ else { // NO-OP
+ unlock( mtxUnblockLock );
+ }
+
+ return result;
+}
+
+---------- Algorithm 8d / IMPL_EVENT,UNBLOCK_STRATEGY == UNBLOCK_ALL ------
+given:
+hevBlockLock - auto-reset event
+hevBlockQueueS - auto-reset event // for signals
+hevBlockQueueB - manual-reset even // for broadcasts
+mtxExternal - mutex or CS
+mtxUnblockLock - mutex or CS
+eBroadcast - int // 0: no broadcast, 1: broadcast, 2:
+broadcast after signal(s)
+nWaitersGone - int
+nWaitersBlocked - int
+nWaitersToUnblock - int
+
+wait( timeout ) {
+
+ [auto: register int result ] // error checking omitted
+ [auto: register int eWasBroadcast ]
+ [auto: register int nSignalsWasLeft ]
+ [auto: register int nWaitersWasGone ]
+
+ wait( hevBlockLock,INFINITE );
+ nWaitersBlocked++;
+ set_event( hevBlockLock );
+
+ unlock( mtxExternal );
+ bTimedOut = waitformultiple( hevBlockQueueS,hevBlockQueueB,timeout,ONE );
+
+ lock( mtxUnblockLock );
+ if ( 0 != (SignalsWasLeft = nWaitersToUnblock) ) {
+ if ( bTimeout ) { // timeout (or canceled)
+ if ( 0 != nWaitersBlocked ) {
+ nWaitersBlocked--;
+ nSignalsWasLeft = 0; // do not unblock next waiter
+below (already unblocked)
+ }
+ else if ( 1 != eBroadcast ) {
+ nWaitersGone = 1;
+ }
+ }
+ if ( 0 == --nWaitersToUnblock ) {
+ if ( 0 != nWaitersBlocked ) {
+ set_event( hevBlockLock ); // open the gate
+ nSignalsWasLeft = 0; // do not open the gate below
+again
+ }
+ else {
+ if ( 0 != (eWasBroadcast = eBroadcast) ) {
+ eBroadcast = 0;
+ }
+ if ( 0 != (nWaitersWasGone = nWaitersGone ) {
+ nWaitersGone = 0;
+ }
+ }
+ }
+ else if ( 0 != eBroadcast ) {
+ nSignalsWasLeft = 0; // do not unblock next waiter
+below (already unblocked)
+ }
+ }
+ else if ( INT_MAX/2 == ++nWaitersGone ) { // timeout/canceled or spurious
+event :-)
+ wait( hevBlockLock,INFINITE );
+ nWaitersBlocked -= nWaitersGone; // something is going on here -
+test of timeouts? :-)
+ set_event( hevBlockLock );
+ nWaitersGone = 0;
+ }
+ unlock( mtxUnblockLock );
+
+ if ( 1 == nSignalsWasLeft ) {
+ if ( 0 != eWasBroadcast ) {
+ reset_event( hevBlockQueueB );
+ }
+ if ( 0 != nWaitersWasGone ) {
+ reset_event( hevBlockQueueS ); // better now than spurious
+later
+ }
+ set_event( hevBlockLock ); // open the gate
+ }
+ else if ( 0 != nSignalsWasLeft ) {
+ set_event( hevBlockQueueS ); // unblock next waiter
+ }
+
+ lock( mtxExternal );
+
+ return ( bTimedOut ) ? ETIMEOUT : 0;
+}
+
+signal(bAll) {
+
+ [auto: register int result ]
+ [auto: register HANDLE hevBlockQueue ]
+
+ lock( mtxUnblockLock );
+
+ if ( 0 != nWaitersToUnblock ) { // the gate is closed!!!
+ if ( 0 == nWaitersBlocked ) { // NO-OP
+ return unlock( mtxUnblockLock );
+ }
+ if (bAll) {
+ nWaitersToUnblock += nWaitersBlocked;
+ nWaitersBlocked = 0;
+ eBroadcast = 2;
+ hevBlockQueue = hevBlockQueueB;
+ }
+ else {
+ nWaitersToUnblock++;
+ nWaitersBlocked--;
+ return unlock( mtxUnblockLock );
+ }
+ }
+ else if ( nWaitersBlocked > nWaitersGone ) { // HARMLESS RACE CONDITION!
+ wait( hevBlockLock,INFINITE ); // close the gate
+ if ( 0 != nWaitersGone ) {
+ nWaitersBlocked -= nWaitersGone;
+ nWaitersGone = 0;
+ }
+ if (bAll) {
+ nWaitersToUnblock = nWaitersBlocked;
+ nWaitersBlocked = 0;
+ eBroadcast = 1;
+ hevBlockQueue = hevBlockQueueB;
+ }
+ else {
+ nWaitersToUnblock = 1;
+ nWaitersBlocked--;
+ hevBlockQueue = hevBlockQueueS;
+ }
+ }
+ else { // NO-OP
+ return unlock( mtxUnblockLock );
+ }
+
+ unlock( mtxUnblockLock );
+ set_event( hevBlockQueue );
+ return result;
+}
+---------------------- Forwarded by Alexander Terekhov/Germany/IBM on
+02/21/2001 09:13 AM ---------------------------
+
+Alexander Terekhov
+02/20/2001 04:33 PM
+
+To: Louis Thomas <lthomas@arbitrade.com>
+cc:
+
+From: Alexander Terekhov/Germany/IBM@IBMDE
+Subject: RE: FYI/comp.programming.threads/Re: pthread_cond_* implementatio
+ n questions
+Importance: Normal
+
+>Sorry, gotta take a break and work on something else for a while.
+>Real work
+>calls, unfortunately. I'll get back to you in two or three days.
+
+ok. no problem. here is some more stuff for pauses you might have
+in between :)
+
+---------- Algorithm 7d / IMPL_EVENT,UNBLOCK_STRATEGY == UNBLOCK_ALL ------
+given:
+hevBlockLock - auto-reset event
+hevBlockQueueS - auto-reset event // for signals
+hevBlockQueueB - manual-reset even // for broadcasts
+mtxExternal - mutex or CS
+mtxUnblockLock - mutex or CS
+bBroadcast - int
+nWaitersGone - int
+nWaitersBlocked - int
+nWaitersToUnblock - int
+
+wait( timeout ) {
+
+ [auto: register int result ] // error checking omitted
+ [auto: register int bWasBroadcast ]
+ [auto: register int nSignalsWasLeft ]
+
+ wait( hevBlockLock,INFINITE );
+ nWaitersBlocked++;
+ set_event( hevBlockLock );
+
+ unlock( mtxExternal );
+ bTimedOut = waitformultiple( hevBlockQueueS,hevBlockQueueB,timeout,ONE );
+
+ lock( mtxUnblockLock );
+ if ( 0 != (SignalsWasLeft = nWaitersToUnblock) ) {
+ if ( bTimeout ) { // timeout (or canceled)
+ if ( 0 != nWaitersBlocked ) {
+ nWaitersBlocked--;
+ nSignalsWasLeft = 0; // do not unblock next waiter
+below (already unblocked)
+ }
+ else if ( !bBroadcast ) {
+ wait( hevBlockQueueS,INFINITE ); // better now than spurious
+later
+ }
+ }
+ if ( 0 == --nWaitersToUnblock ) {
+ if ( 0 != nWaitersBlocked ) {
+ if ( bBroadcast ) {
+ reset_event( hevBlockQueueB );
+ bBroadcast = false;
+ }
+ set_event( hevBlockLock ); // open the gate
+ nSignalsWasLeft = 0; // do not open the gate below
+again
+ }
+ else if ( false != (bWasBroadcast = bBroadcast) ) {
+ bBroadcast = false;
+ }
+ }
+ else {
+ bWasBroadcast = bBroadcast;
+ }
+ }
+ else if ( INT_MAX/2 == ++nWaitersGone ) { // timeout/canceled or spurious
+event :-)
+ wait( hevBlockLock,INFINITE );
+ nWaitersBlocked -= nWaitersGone; // something is going on here -
+test of timeouts? :-)
+ set_event( hevBlockLock );
+ nWaitersGone = 0;
+ }
+ unlock( mtxUnblockLock );
+
+ if ( 1 == nSignalsWasLeft ) {
+ if ( bWasBroadcast ) {
+ reset_event( hevBlockQueueB );
+ }
+ set_event( hevBlockLock ); // open the gate
+ }
+ else if ( 0 != nSignalsWasLeft && !bWasBroadcast ) {
+ set_event( hevBlockQueueS ); // unblock next waiter
+ }
+
+ lock( mtxExternal );
+
+ return ( bTimedOut ) ? ETIMEOUT : 0;
+}
+
+signal(bAll) {
+
+ [auto: register int result ]
+ [auto: register HANDLE hevBlockQueue ]
+
+ lock( mtxUnblockLock );
+
+ if ( 0 != nWaitersToUnblock ) { // the gate is closed!!!
+ if ( 0 == nWaitersBlocked ) { // NO-OP
+ return unlock( mtxUnblockLock );
+ }
+ if (bAll) {
+ nWaitersToUnblock += nWaitersBlocked;
+ nWaitersBlocked = 0;
+ bBroadcast = true;
+ hevBlockQueue = hevBlockQueueB;
+ }
+ else {
+ nWaitersToUnblock++;
+ nWaitersBlocked--;
+ return unlock( mtxUnblockLock );
+ }
+ }
+ else if ( nWaitersBlocked > nWaitersGone ) { // HARMLESS RACE CONDITION!
+ wait( hevBlockLock,INFINITE ); // close the gate
+ if ( 0 != nWaitersGone ) {
+ nWaitersBlocked -= nWaitersGone;
+ nWaitersGone = 0;
+ }
+ if (bAll) {
+ nWaitersToUnblock = nWaitersBlocked;
+ nWaitersBlocked = 0;
+ bBroadcast = true;
+ hevBlockQueue = hevBlockQueueB;
+ }
+ else {
+ nWaitersToUnblock = 1;
+ nWaitersBlocked--;
+ hevBlockQueue = hevBlockQueueS;
+ }
+ }
+ else { // NO-OP
+ return unlock( mtxUnblockLock );
+ }
+
+ unlock( mtxUnblockLock );
+ set_event( hevBlockQueue );
+ return result;
+}
+
+
+----------------------------------------------------------------------------
+
+Subject: RE: FYI/comp.programming.threads/Re: pthread_cond_* implementatio
+ n questions
+Date: Mon, 26 Feb 2001 22:20:12 -0600
+From: Louis Thomas <lthomas@arbitrade.com>
+To: "'TEREKHOV@de.ibm.com'" <TEREKHOV@de.ibm.com>
+CC: rpj@ise.canberra.edu.au, Thomas Pfaff <tpfaff@gmx.net>,
+ Nanbor Wang
+ <nanbor@cs.wustl.edu>
+
+Sorry all. Busy week.
+
+> this insures the fairness
+> which POSIX does not (e.g. two subsequent broadcasts - the gate does
+insure
+> that first wave waiters will start the race for the mutex before waiters
+> from the second wave - Linux pthreads process/unblock both waves
+> concurrently...)
+
+I'm not sure how we are any more fair about this than Linux. We certainly
+don't guarantee that the threads released by the first broadcast will get
+the external mutex before the threads of the second wave. In fact, it is
+possible that those threads will never get the external mutex if there is
+enough contention for it.
+
+> e.g. i was thinking about implementation with a pool of
+> N semaphores/counters [...]
+
+I considered that too. The problem is as you mentioned in a). You really
+need to assign threads to semaphores once you know how you want to wake them
+up, not when they first begin waiting which is the only time you can assign
+them.
+
+> well, i am not quite sure that i've fully understood your scenario,
+
+Hmm. Well, it think it's an important example, so I'll try again. First, we
+have thread A which we KNOW is waiting on a condition. As soon as it becomes
+unblocked for any reason, we will know because it will set a flag. Since the
+flag is not set, we are 100% confident that thread A is waiting on the
+condition. We have another thread, thread B, which has acquired the mutex
+and is about to wait on the condition. Thus it is pretty clear that at any
+point, either just A is waiting, or A and B are waiting. Now thread C comes
+along. C is about to do a broadcast on the condition. A broadcast is
+guaranteed to unblock all threads currently waiting on a condition, right?
+Again, we said that either just A is waiting, or A and B are both waiting.
+So, when C does its broadcast, depending upon whether B has started waiting
+or not, thread C will unblock A or unblock A and B. Either way, C must
+unblock A, right?
+
+Now, you said anything that happens is correct so long as a) "a signal is
+not lost between unlocking the mutex and waiting on the condition" and b) "a
+thread must not steal a signal it sent", correct? Requirement b) is easy to
+satisfy: in this scenario, thread C will never wait on the condition, so it
+won't steal any signals. Requirement a) is not hard either. The only way we
+could fail to meet requirement a) in this scenario is if thread B was
+started waiting but didn't wake up because a signal was lost. This will not
+happen.
+
+Now, here is what happens. Assume thread C beats thread B. Thread C looks to
+see how many threads are waiting on the condition. Thread C sees just one
+thread, thread A, waiting. It does a broadcast waking up just one thread
+because just one thread is waiting. Next, before A can become unblocked,
+thread B begins waiting. Now there are two threads waiting, but only one
+will be unblocked. Suppose B wins. B will become unblocked. A will not
+become unblocked, because C only unblocked one thread (sema_post cond, 1).
+So at the end, B finishes and A remains blocked.
+
+We have met both of your requirements, so by your rules, this is an
+acceptable outcome. However, I think that the spec says this is an
+unacceptable outcome! We know for certain that A was waiting and that C did
+a broadcast, but A did not become unblocked! Yet, the spec says that a
+broadcast wakes up all waiting threads. This did not happen. Do you agree
+that this shows your rules are not strict enough?
+
+> and what about N2? :) this one does allow almost everything.
+
+Don't get me started about rule #2. I'll NEVER advocate an algorithm that
+uses rule 2 as an excuse to suck!
+
+> but it is done (decrement)under mutex protection - this is not a subject
+> of a race condition.
+
+You are correct. My mistake.
+
+> i would remove "_bTimedOut=false".. after all, it was a real timeout..
+
+I disagree. A thread that can't successfully retract its waiter status can't
+really have timed out. If a thread can't return without executing extra code
+to deal with the fact that someone tried to unblock it, I think it is a poor
+idea to pretend we
+didn't realize someone was trying to signal us. After all, a signal is more
+important than a time out.
+
+> when nSignaled != 0, it is possible to update nWaiters (--) and do not
+> touch nGone
+
+I realize this, but I was thinking that writing it the other ways saves
+another if statement.
+
+> adjust only if nGone != 0 and save one cache memory write - probably much
+slower than 'if'
+
+Hmm. You are probably right.
+
+> well, in a strange (e.g. timeout test) program you may (theoretically)
+> have an overflow of nWaiters/nGone counters (with waiters repeatedly
+timing
+> out and no signals at all).
+
+Also true. Not only that, but you also have the possibility that one could
+overflow the number of waiters as well! However, considering the limit you
+have chosen for nWaitersGone, I suppose it is unlikely that anyone would be
+able to get INT_MAX/2 threads waiting on a single condition. :)
+
+Analysis of 8a:
+
+It looks correct to me.
+
+What are IPC semaphores?
+
+In the line where you state, "else if ( nWaitersBlocked > nWaitersGone ) {
+// HARMLESS RACE CONDITION!" there is no race condition for nWaitersGone
+because nWaitersGone is never modified without holding mtxUnblockLock. You
+are correct that there is a harmless race on nWaitersBlocked, which can
+increase and make the condition become true just after we check it. If this
+happens, we interpret it as the wait starting after the signal.
+
+I like your optimization of this. You could improve Alg. 6 as follows:
+---------- Algorithm 6b ----------
+signal(bAll) {
+ _nSig=0
+ lock counters
+ // this is safe because nWaiting can only be decremented by a thread that
+ // owns counters and nGone can only be changed by a thread that owns
+counters.
+ if (nWaiting>nGone) {
+ if (0==nSignaled) {
+ sema_wait gate // close gate if not already closed
+ }
+ if (nGone>0) {
+ nWaiting-=nGone
+ nGone=0
+ }
+ _nSig=bAll?nWaiting:1
+ nSignaled+=_nSig
+ nWaiting-=_nSig
+ }
+ unlock counters
+ if (0!=_nSig) {
+ sema_post queue, _nSig
+ }
+}
+---------- ---------- ----------
+I guess this wouldn't apply to Alg 8a because nWaitersGone changes meanings
+depending upon whether the gate is open or closed.
+
+In the loop "while ( nWaitersWasGone-- ) {" you do a sema_wait on
+semBlockLock. Perhaps waiting on semBlockQueue would be a better idea.
+
+What have you gained by making the last thread to be signaled do the waits
+for all the timed out threads, besides added complexity? It took me a long
+time to figure out what your objective was with this, to realize you were
+using nWaitersGone to mean two different things, and to verify that you
+hadn't introduced any bug by doing this. Even now I'm not 100% sure.
+
+What has all this playing about with nWaitersGone really gained us besides a
+lot of complexity (it is much harder to verify that this solution is
+correct), execution overhead (we now have a lot more if statements to
+evaluate), and space overhead (more space for the extra code, and another
+integer in our data)? We did manage to save a lock/unlock pair in an
+uncommon case (when a time out occurs) at the above mentioned expenses in
+the common cases.
+
+As for 8b, c, and d, they look ok though I haven't studied them thoroughly.
+What would you use them for?
+
+ Later,
+ -Louis! :)
+
+-----------------------------------------------------------------------------
+
+Subject: RE: FYI/comp.programming.threads/Re: pthread_cond_* implementatio
+ n questions
+Date: Tue, 27 Feb 2001 15:51:28 +0100
+From: TEREKHOV@de.ibm.com
+To: Louis Thomas <lthomas@arbitrade.com>
+CC: rpj@ise.canberra.edu.au, Thomas Pfaff <tpfaff@gmx.net>,
+ Nanbor Wang <nanbor@cs.wustl.edu>
+
+Hi Louis,
+
+>> that first wave waiters will start the race for the mutex before waiters
+>> from the second wave - Linux pthreads process/unblock both waves
+>> concurrently...)
+>
+>I'm not sure how we are any more fair about this than Linux. We certainly
+>don't guarantee that the threads released by the first broadcast will get
+>the external mutex before the threads of the second wave. In fact, it is
+>possible that those threads will never get the external mutex if there is
+>enough contention for it.
+
+correct. but gate is nevertheless more fair than Linux because of the
+barrier it establishes between two races (1st and 2nd wave waiters) for
+the mutex which under 'normal' circumstances (e.g. all threads of equal
+priorities,..) will 'probably' result in fair behaviour with respect to
+mutex ownership.
+
+>> well, i am not quite sure that i've fully understood your scenario,
+>
+>Hmm. Well, it think it's an important example, so I'll try again. ...
+
+ok. now i seem to understand this example. well, now it seems to me
+that the only meaningful rule is just:
+
+a) "a signal is not lost between unlocking the mutex and waiting on the
+condition"
+
+and that the rule
+
+b) "a thread must not steal a signal it sent"
+
+is not needed at all because a thread which violates b) also violates a).
+
+i'll try to explain..
+
+i think that the most important thing is how POSIX defines waiter's
+visibility:
+
+"if another thread is able to acquire the mutex after the about-to-block
+thread
+has released it, then a subsequent call to pthread_cond_signal() or
+pthread_cond_broadcast() in that thread behaves as if it were issued after
+the about-to-block thread has blocked. "
+
+my understanding is the following:
+
+1) there is no guarantees whatsoever with respect to whether
+signal/broadcast
+will actually unblock any 'waiter' if it is done w/o acquiring the mutex
+first
+(note that a thread may release it before signal/broadcast - it does not
+matter).
+
+2) it is guaranteed that waiters become 'visible' - eligible for unblock as
+soon
+as signalling thread acquires the mutex (but not before!!)
+
+so..
+
+>So, when C does its broadcast, depending upon whether B has started
+waiting
+>or not, thread C will unblock A or unblock A and B. Either way, C must
+>unblock A, right?
+
+right. but only if C did acquire the mutex prior to broadcast (it may
+release it before broadcast as well).
+
+implementation will violate waiters visibility rule (signal will become
+lost)
+if C will not unblock A.
+
+>Now, here is what happens. Assume thread C beats thread B. Thread C looks
+to
+>see how many threads are waiting on the condition. Thread C sees just one
+>thread, thread A, waiting. It does a broadcast waking up just one thread
+>because just one thread is waiting. Next, before A can become unblocked,
+>thread B begins waiting. Now there are two threads waiting, but only one
+>will be unblocked. Suppose B wins. B will become unblocked. A will not
+>become unblocked, because C only unblocked one thread (sema_post cond, 1).
+>So at the end, B finishes and A remains blocked.
+
+thread C did acquire the mutex ("Thread C sees just one thread, thread A,
+waiting"). beginning from that moment it is guaranteed that subsequent
+broadcast will unblock A. Otherwise we will have a lost signal with respect
+to A. I do think that it does not matter whether the signal was physically
+(completely) lost or was just stolen by another thread (B) - in both cases
+it was simply lost with respect to A.
+
+>..Do you agree that this shows your rules are not strict enough?
+
+probably the opposite.. :-) i think that it shows that the only meaningful
+rule is
+
+a) "a signal is not lost between unlocking the mutex and waiting on the
+condition"
+
+with clarification of waiters visibility as defined by POSIX above.
+
+>> i would remove "_bTimedOut=false".. after all, it was a real timeout..
+>
+>I disagree. A thread that can't successfully retract its waiter status
+can't
+>really have timed out. If a thread can't return without executing extra
+code
+>to deal with the fact that someone tried to unblock it, I think it is a
+poor
+>idea to pretend we
+>didn't realize someone was trying to signal us. After all, a signal is
+more
+>important than a time out.
+
+a) POSIX does allow timed out thread to consume a signal (cancelled is
+not).
+b) ETIMEDOUT status just says that: "The time specified by abstime to
+pthread_cond_timedwait() has passed."
+c) it seem to me that hiding timeouts would violate "The
+pthread_cond_timedwait()
+function is the same as pthread_cond_wait() except that an error is
+returned if
+the absolute time specified by abstime passes (that is, system time equals
+or
+exceeds abstime) before the condition cond is signaled or broadcasted"
+because
+the abs. time did really pass before cond was signaled (waiter was
+released via semaphore). however, if it really matters, i could imaging
+that we
+can save an abs. time of signal/broadcast and compare it with timeout after
+unblock to find out whether it was a 'real' timeout or not. absent this
+check
+i do think that hiding timeouts would result in technical violation of
+specification.. but i think that this check is not important and we can
+simply
+trust timeout error code provided by wait since we are not trying to make
+'hard' realtime implementation.
+
+>What are IPC semaphores?
+
+<sys/sem.h>
+int semctl(int, int, int, ...);
+int semget(key_t, int, int);
+int semop(int, struct sembuf *, size_t);
+
+they support adjustment of semaphore counter (semvalue)
+in one single call - imaging Win32 ReleaseSemaphore( hsem,-N )
+
+>In the line where you state, "else if ( nWaitersBlocked > nWaitersGone ) {
+>// HARMLESS RACE CONDITION!" there is no race condition for nWaitersGone
+>because nWaitersGone is never modified without holding mtxUnblockLock. You
+>are correct that there is a harmless race on nWaitersBlocked, which can
+>increase and make the condition become true just after we check it. If
+this
+>happens, we interpret it as the wait starting after the signal.
+
+well, the reason why i've asked on comp.programming.threads whether this
+race
+condition is harmless or not is that in order to be harmless it should not
+violate the waiters visibility rule (see above). Fortunately, we increment
+the counter under protection of external mutex.. so that any (signalling)
+thread which will acquire the mutex next, should see the updated counter
+(in signal) according to POSIX memory visibility rules and mutexes
+(memory barriers). But i am not so sure how it actually works on
+Win32/INTEL
+which does not explicitly define any memory visibility rules :(
+
+>I like your optimization of this. You could improve Alg. 6 as follows:
+>---------- Algorithm 6b ----------
+>signal(bAll) {
+> _nSig=0
+> lock counters
+> // this is safe because nWaiting can only be decremented by a thread
+that
+> // owns counters and nGone can only be changed by a thread that owns
+>counters.
+> if (nWaiting>nGone) {
+> if (0==nSignaled) {
+> sema_wait gate // close gate if not already closed
+> }
+> if (nGone>0) {
+> nWaiting-=nGone
+> nGone=0
+> }
+> _nSig=bAll?nWaiting:1
+> nSignaled+=_nSig
+> nWaiting-=_nSig
+> }
+> unlock counters
+> if (0!=_nSig) {
+> sema_post queue, _nSig
+> }
+>}
+>---------- ---------- ----------
+>I guess this wouldn't apply to Alg 8a because nWaitersGone changes
+meanings
+>depending upon whether the gate is open or closed.
+
+agree.
+
+>In the loop "while ( nWaitersWasGone-- ) {" you do a sema_wait on
+>semBlockLock. Perhaps waiting on semBlockQueue would be a better idea.
+
+you are correct. my mistake.
+
+>What have you gained by making the last thread to be signaled do the waits
+>for all the timed out threads, besides added complexity? It took me a long
+>time to figure out what your objective was with this, to realize you were
+>using nWaitersGone to mean two different things, and to verify that you
+>hadn't introduced any bug by doing this. Even now I'm not 100% sure.
+>
+>What has all this playing about with nWaitersGone really gained us besides
+a
+>lot of complexity (it is much harder to verify that this solution is
+>correct), execution overhead (we now have a lot more if statements to
+>evaluate), and space overhead (more space for the extra code, and another
+>integer in our data)? We did manage to save a lock/unlock pair in an
+>uncommon case (when a time out occurs) at the above mentioned expenses in
+>the common cases.
+
+well, please consider the following:
+
+1) with multiple waiters unblocked (but some timed out) the trick with
+counter
+seem to ensure potentially higher level of concurrency by not delaying
+most of unblocked waiters for semaphore cleanup - only the last one
+will be delayed but all others would already contend/acquire/release
+the external mutex - the critical section protected by mtxUnblockLock is
+made smaller (increment + couple of IFs is faster than system/kernel call)
+which i think is good in general. however, you are right, this is done
+at expense of 'normal' waiters..
+
+2) some semaphore APIs (e.g. POSIX IPC sems) do allow to adjust the
+semaphore counter in one call => less system/kernel calls.. imagine:
+
+if ( 1 == nSignalsWasLeft ) {
+ if ( 0 != nWaitersWasGone ) {
+ ReleaseSemaphore( semBlockQueue,-nWaitersWasGone ); // better now
+than spurious later
+ }
+ sem_post( semBlockLock ); // open the gate
+ }
+
+3) even on win32 a single thread doing multiple cleanup calls (to wait)
+will probably result in faster execution (because of processor caching)
+than multiple threads each doing a single call to wait.
+
+>As for 8b, c, and d, they look ok though I haven't studied them
+thoroughly.
+>What would you use them for?
+
+8b) for semaphores which do not allow to unblock multiple waiters
+in a single call to post/release (e.g. POSIX realtime semaphores -
+<semaphore.h>)
+
+8c/8d) for WinCE prior to 3.0 (WinCE 3.0 does have semaphores)
+
+ok. so, which one is the 'final' algorithm(s) which we should use in
+pthreads-win32??
+
+regards,
+alexander.
+
+----------------------------------------------------------------------------
+
+Louis Thomas <lthomas@arbitrade.com> on 02/27/2001 05:20:12 AM
+
+Please respond to Louis Thomas <lthomas@arbitrade.com>
+
+To: Alexander Terekhov/Germany/IBM@IBMDE
+cc: rpj@ise.canberra.edu.au, Thomas Pfaff <tpfaff@gmx.net>, Nanbor Wang
+ <nanbor@cs.wustl.edu>
+Subject: RE: FYI/comp.programming.threads/Re: pthread_cond_* implementatio
+ n questions
+
+Sorry all. Busy week.
+
+> this insures the fairness
+> which POSIX does not (e.g. two subsequent broadcasts - the gate does
+insure
+> that first wave waiters will start the race for the mutex before waiters
+> from the second wave - Linux pthreads process/unblock both waves
+> concurrently...)
+
+I'm not sure how we are any more fair about this than Linux. We certainly
+don't guarantee that the threads released by the first broadcast will get
+the external mutex before the threads of the second wave. In fact, it is
+possible that those threads will never get the external mutex if there is
+enough contention for it.
+
+> e.g. i was thinking about implementation with a pool of
+> N semaphores/counters [...]
+
+I considered that too. The problem is as you mentioned in a). You really
+need to assign threads to semaphores once you know how you want to wake
+them
+up, not when they first begin waiting which is the only time you can assign
+them.
+
+> well, i am not quite sure that i've fully understood your scenario,
+
+Hmm. Well, it think it's an important example, so I'll try again. First, we
+have thread A which we KNOW is waiting on a condition. As soon as it
+becomes
+unblocked for any reason, we will know because it will set a flag. Since
+the
+flag is not set, we are 100% confident that thread A is waiting on the
+condition. We have another thread, thread B, which has acquired the mutex
+and is about to wait on the condition. Thus it is pretty clear that at any
+point, either just A is waiting, or A and B are waiting. Now thread C comes
+along. C is about to do a broadcast on the condition. A broadcast is
+guaranteed to unblock all threads currently waiting on a condition, right?
+Again, we said that either just A is waiting, or A and B are both waiting.
+So, when C does its broadcast, depending upon whether B has started waiting
+or not, thread C will unblock A or unblock A and B. Either way, C must
+unblock A, right?
+
+Now, you said anything that happens is correct so long as a) "a signal is
+not lost between unlocking the mutex and waiting on the condition" and b)
+"a
+thread must not steal a signal it sent", correct? Requirement b) is easy to
+satisfy: in this scenario, thread C will never wait on the condition, so it
+won't steal any signals. Requirement a) is not hard either. The only way
+we
+could fail to meet requirement a) in this scenario is if thread B was
+started waiting but didn't wake up because a signal was lost. This will not
+happen.
+
+Now, here is what happens. Assume thread C beats thread B. Thread C looks
+to
+see how many threads are waiting on the condition. Thread C sees just one
+thread, thread A, waiting. It does a broadcast waking up just one thread
+because just one thread is waiting. Next, before A can become unblocked,
+thread B begins waiting. Now there are two threads waiting, but only one
+will be unblocked. Suppose B wins. B will become unblocked. A will not
+become unblocked, because C only unblocked one thread (sema_post cond, 1).
+So at the end, B finishes and A remains blocked.
+
+We have met both of your requirements, so by your rules, this is an
+acceptable outcome. However, I think that the spec says this is an
+unacceptable outcome! We know for certain that A was waiting and that C did
+a broadcast, but A did not become unblocked! Yet, the spec says that a
+broadcast wakes up all waiting threads. This did not happen. Do you agree
+that this shows your rules are not strict enough?
+
+> and what about N2? :) this one does allow almost everything.
+
+Don't get me started about rule #2. I'll NEVER advocate an algorithm that
+uses rule 2 as an excuse to suck!
+
+> but it is done (decrement)under mutex protection - this is not a subject
+> of a race condition.
+
+You are correct. My mistake.
+
+> i would remove "_bTimedOut=false".. after all, it was a real timeout..
+
+I disagree. A thread that can't successfully retract its waiter status
+can't
+really have timed out. If a thread can't return without executing extra
+code
+to deal with the fact that someone tried to unblock it, I think it is a
+poor
+idea to pretend we
+didn't realize someone was trying to signal us. After all, a signal is more
+important than a time out.
+
+> when nSignaled != 0, it is possible to update nWaiters (--) and do not
+> touch nGone
+
+I realize this, but I was thinking that writing it the other ways saves
+another if statement.
+
+> adjust only if nGone != 0 and save one cache memory write - probably much
+slower than 'if'
+
+Hmm. You are probably right.
+
+> well, in a strange (e.g. timeout test) program you may (theoretically)
+> have an overflow of nWaiters/nGone counters (with waiters repeatedly
+timing
+> out and no signals at all).
+
+Also true. Not only that, but you also have the possibility that one could
+overflow the number of waiters as well! However, considering the limit you
+have chosen for nWaitersGone, I suppose it is unlikely that anyone would be
+able to get INT_MAX/2 threads waiting on a single condition. :)
+
+Analysis of 8a:
+
+It looks correct to me.
+
+What are IPC semaphores?
+
+In the line where you state, "else if ( nWaitersBlocked > nWaitersGone ) {
+// HARMLESS RACE CONDITION!" there is no race condition for nWaitersGone
+because nWaitersGone is never modified without holding mtxUnblockLock. You
+are correct that there is a harmless race on nWaitersBlocked, which can
+increase and make the condition become true just after we check it. If this
+happens, we interpret it as the wait starting after the signal.
+
+I like your optimization of this. You could improve Alg. 6 as follows:
+---------- Algorithm 6b ----------
+signal(bAll) {
+ _nSig=0
+ lock counters
+ // this is safe because nWaiting can only be decremented by a thread that
+ // owns counters and nGone can only be changed by a thread that owns
+counters.
+ if (nWaiting>nGone) {
+ if (0==nSignaled) {
+ sema_wait gate // close gate if not already closed
+ }
+ if (nGone>0) {
+ nWaiting-=nGone
+ nGone=0
+ }
+ _nSig=bAll?nWaiting:1
+ nSignaled+=_nSig
+ nWaiting-=_nSig
+ }
+ unlock counters
+ if (0!=_nSig) {
+ sema_post queue, _nSig
+ }
+}
+---------- ---------- ----------
+I guess this wouldn't apply to Alg 8a because nWaitersGone changes meanings
+depending upon whether the gate is open or closed.
+
+In the loop "while ( nWaitersWasGone-- ) {" you do a sema_wait on
+semBlockLock. Perhaps waiting on semBlockQueue would be a better idea.
+
+What have you gained by making the last thread to be signaled do the waits
+for all the timed out threads, besides added complexity? It took me a long
+time to figure out what your objective was with this, to realize you were
+using nWaitersGone to mean two different things, and to verify that you
+hadn't introduced any bug by doing this. Even now I'm not 100% sure.
+
+What has all this playing about with nWaitersGone really gained us besides
+a
+lot of complexity (it is much harder to verify that this solution is
+correct), execution overhead (we now have a lot more if statements to
+evaluate), and space overhead (more space for the extra code, and another
+integer in our data)? We did manage to save a lock/unlock pair in an
+uncommon case (when a time out occurs) at the above mentioned expenses in
+the common cases.
+
+As for 8b, c, and d, they look ok though I haven't studied them thoroughly.
+What would you use them for?
+
+ Later,
+ -Louis! :)
+
diff --git a/win32/contrib/pthreads/README.NONPORTABLE b/win32/contrib/pthreads/README.NONPORTABLE new file mode 100644 index 000000000..5095d47ce --- /dev/null +++ b/win32/contrib/pthreads/README.NONPORTABLE @@ -0,0 +1,109 @@ +Non-portable functions included in pthreads-win32
+-------------------------------------------------
+
+HANDLE
+pthread_getw32threadhandle_np(pthread_t thread);
+
+ Returns the win32 thread handle that the POSIX
+ thread "thread" is running as.
+
+ Applications can use the win32 handle to set
+ win32 specific attributes of the thread.
+
+
+int
+pthread_mutexattr_setkind_np(pthread_mutexattr_t * attr, int kind)
+
+int
+pthread_mutexattr_getkind_np(pthread_mutexattr_t * attr, int *kind)
+
+ These two routines are included for Linux compatibility
+ and are direct equivalents to the standard routines
+ pthread_mutexattr_settype
+ pthread_mutexattr_gettype
+
+ pthread_mutexattr_setkind_np accepts the following
+ mutex kinds:
+ PTHREAD_MUTEX_FAST_NP
+ PTHREAD_MUTEX_ERRORCHECK_NP
+ PTHREAD_MUTEX_RECURSIVE_NP
+
+ These are really just equivalent to (respectively):
+ PTHREAD_MUTEX_NORMAL
+ PTHREAD_MUTEX_ERRORCHECK
+ PTHREAD_MUTEX_RECURSIVE
+
+int
+pthread_delay_np (const struct timespec *interval);
+
+ This routine causes a thread to delay execution for a specific period of time.
+ This period ends at the current time plus the specified interval. The routine
+ will not return before the end of the period is reached, but may return an
+ arbitrary amount of time after the period has gone by. This can be due to
+ system load, thread priorities, and system timer granularity.
+
+ Specifying an interval of zero (0) seconds and zero (0) nanoseconds is
+ allowed and can be used to force the thread to give up the processor or to
+ deliver a pending cancelation request.
+
+ This routine is a cancelation point.
+
+ The timespec structure contains the following two fields:
+
+ tv_sec is an integer number of seconds.
+ tv_nsec is an integer number of nanoseconds.
+
+ Return Values
+
+ If an error condition occurs, this routine returns an integer value
+ indicating the type of error. Possible return values are as follows:
+
+ 0 Successful completion.
+ [EINVAL] The value specified by interval is invalid.
+
+
+BOOL
+pthread_win32_process_attach_np (void);
+
+BOOL
+pthread_win32_process_detach_np (void);
+
+BOOL
+pthread_win32_thread_attach_np (void);
+
+BOOL
+pthread_win32_thread_detach_np (void);
+
+ These functions contain the code normally run via dllMain
+ when the library is used as a dll but which need to be
+ called explicitly by an application when the library
+ is statically linked.
+
+ You will need to call pthread_win32_process_attach_np() before
+ you can call any pthread routines when statically linking.
+ You should call pthread_win32_process_detach_np() before
+ exiting your application to clean up.
+
+ pthread_win32_thread_attach_np() is currently a no-op, but
+ pthread_win32_thread_detach_np() is needed to clean up
+ after Win32 threads that have called pthreads routines
+ have exited.
+
+ These functions invariably return TRUE except for
+ pthread_win32_process_attach_np() which will return FALSE
+ if pthreads-win32 initialisation fails.
+
+
+int
+pthreadCancelableWait (HANDLE waitHandle);
+
+int
+pthreadCancelableTimedWait (HANDLE waitHandle, DWORD timeout);
+
+ These two functions provide hooks into the pthread_cancel
+ mechanism that will allow you to wait on a Windows handle
+ and make it a cancellation point. Both functions block
+ until either the given w32 handle is signaled, or
+ pthread_cancel has been called. It is implemented using
+ WaitForMultipleObjects on 'waitHandle' and a manually
+ reset w32 event used to implement pthread_cancel.
diff --git a/win32/contrib/pthreads/README.WinCE b/win32/contrib/pthreads/README.WinCE new file mode 100644 index 000000000..1e0642971 --- /dev/null +++ b/win32/contrib/pthreads/README.WinCE @@ -0,0 +1,6 @@ +WinCE port
+----------
+(See the file WinCE-PORT for a detailed explanation.)
+
+Make sure you define "WINCE" amongst your compiler flags (eg. -DWINCE).
+The config.h file will define all the necessary defines for you.
diff --git a/win32/contrib/pthreads/TODO b/win32/contrib/pthreads/TODO new file mode 100644 index 000000000..de6de9238 --- /dev/null +++ b/win32/contrib/pthreads/TODO @@ -0,0 +1,20 @@ +====
+Automate the build/test cycle so that I can
+expand to test both library and applications in different
+environments and cross-environments.
+
+Eg.
+ Applications | SEH | C++ | G++ | C | GCC |
+ Library | | | | | |
+ ----------------+-----+-----+-----+-----+-----+
+ SEH | X | X | X | X | X |
+ ----------------+-----+-----+-----+-----+-----+
+ C++ (MSC) | X | X | X | X | X |
+ ----------------+-----+-----+-----+-----+-----+
+ G++ (GNU) | ? | ? | X | ? | X |
+ ----------------+-----+-----+-----+-----+-----+
+
+'?' indicates combinations that may not be doable.
+
+====
+
diff --git a/win32/contrib/pthreads/WinCE-PORT b/win32/contrib/pthreads/WinCE-PORT new file mode 100644 index 000000000..4b11c737c --- /dev/null +++ b/win32/contrib/pthreads/WinCE-PORT @@ -0,0 +1,208 @@ +Some interesting news:
+
+I have been able to port pthread-win32 to Windows-CE,
+which uses a subset of the WIN32 API.
+
+Since we intend to keep using pthread-win32 for our
+Commercial WinCE developments, I would be very interested
+if WinCE support could be added to the main source tree
+of pthread-win32. Also, I would like to be credited
+for this port :-)
+
+Now, here is the story...
+
+The port was performed and tested on a Casio "Cassiopeia"
+PalmSize PC, which runs a MIP processor. The OS in the
+Casio is WinCE version 2.11, but I used VC++ 6.0 with
+the WinCE SDK for version 2.01.
+
+I used pthread-win32 to port a heavily multithreaded
+commercial application (real-time MPEG video player)
+from Linux to WinCE. I consider the changes that
+I have done to be quite well tested.
+
+Overall the modifications that we had to do are minor.
+
+The WinCE port were based on pthread-win32-snap-1999-05-30,
+but I am certain that they can be integrated very easiely
+to more recent versions of the source.
+
+I have attached the modified source code:
+pthread-win32-snap-1999-05-30-WinCE.
+
+All the changes do not affect the code compiled on non-WinCE
+environment, provided that the macros used for WinCE compilation
+are not used, of course!
+
+Overall description of the WinCE port:
+-------------------------------------
+
+Most of the changes had to be made in areas where
+pthread-win32 was relying on some standard-C librairies
+(e.g. _ftime, calloc, errno), which are not available
+on WinCE. We have changed the code to use native Win32
+API instead (or in some cases we made wrappers).
+
+The Win32 Semaphores are not available,
+so we had to re-implement Semaphores using mutexes
+and events.
+
+Limitations / known problems of the WinCE port:
+----------------------------------------------
+
+Not all the semaphore routines have been ported
+(semaphores are defined by Posix but are not part
+pf pthread). I have just done enough to make
+pthread routines (that rely internally on semaphores)
+work, like signal conditions.
+
+I noticed that the Win32 threads work slightly
+differently on WinCE. This may have some impact
+on some tricky parts of pthread-win32, but I have
+not really investigated. For example, on WinCE,
+the process is killed if the main thread falls off
+the bottom (or calls pthread_exit), regardless
+of the existence of any other detached thread.
+Microsoft manual indicates that this behavior is
+deffirent from that of Windows Threads for other
+Win32 platforms.
+
+
+Detailed descriptions of the changes and rationals:
+
+------------------------------------
+- use a new macro NEED_ERRNO.
+
+If defined, the code in errno.c that defines a reentrant errno
+is compiled, regardless of _MT and _REENTRANT.
+
+Rational: On WinCE, there is no support for <stdio.h>, <errno.h> or
+any other standard C library, i.e. even if _MT or _REENTRANT
+is defined, errno is not provided by any library. NEED_ERRNO
+must be set to compile for WinCE.
+
+------------------------------------
+- In implement.h, change #include <semaphore.h> to #include "semaphore.h".
+
+Rational: semaphore.h is provided in pthread-win32 and should not
+be searched in the systems standard include. would not compile.
+This change does not seem to create problems on "classic" win32
+(e.g. win95).
+
+------------------------------------
+- use a new macro NEED_CALLOC.
+
+If defined, some code in misc.c will provide a replacement
+for calloc, which is not available on Win32.
+
+
+------------------------------------
+- use a new macro NEED_CREATETHREAD.
+
+If defined, implement.h defines the macro _beginthreadex
+and _endthreadex.
+
+Rational: On WinCE, the wrappers _beginthreadex and _endthreadex
+do not exist. The native Win32 routines must be used.
+
+------------------------------------
+- in misc.c:
+
+#ifdef NEED_DUPLICATEHANDLE
+ /* DuplicateHandle does not exist on WinCE */
+ self->threadH = GetCurrentThread();
+#else
+ if( !DuplicateHandle(
+ GetCurrentProcess(),
+ GetCurrentThread(),
+ GetCurrentProcess(),
+ &self->threadH,
+ 0,
+ FALSE,
+ DUPLICATE_SAME_ACCESS ) )
+ {
+ free( self );
+ return (NULL);
+ }
+#endif
+
+Rational: On WinCE, DuplicateHandle does not exist. I could not understand
+why DuplicateHandle must be used. It seems to me that getting the current
+thread handle with GetCurrentThread() is sufficient, and it seems to work
+perfectly fine, so maybe DuplicateHandle was just plain useless to begin with ?
+
+------------------------------------
+- In private.c, added some code at the beginning of ptw32_processInitialize
+to detect the case of multiple calls to ptw32_processInitialize.
+
+Rational: In order to debug pthread-win32, it is easier to compile
+it as a regular library (it is not possible to debug DLL's on winCE).
+In that case, the application must call ptw32_rocessInitialize()
+explicitely, to initialize pthread-win32. It is safer in this circumstance
+to handle the case where ptw32_processInitialize() is called on
+an already initialized library:
+
+int
+ptw32_processInitialize (void)
+{
+ if (ptw32_processInitialized) {
+ /*
+ * ignore if already initialized. this is useful for
+ * programs that uses a non-dll pthread
+ * library. such programs must call ptw32_processInitialize() explicitely,
+ * since this initialization routine is automatically called only when
+ * the dll is loaded.
+ */
+ return TRUE;
+ }
+ ptw32_processInitialized = TRUE;
+ [...]
+}
+
+------------------------------------
+- in private.c, if macro NEED_FTIME is defined, add routines to
+convert timespec_to_filetime and filetime_to_timespec, and modified
+code that was using _ftime() to use Win32 API instead.
+
+Rational: _ftime is not available on WinCE. It is necessary to use
+the native Win32 time API instead.
+
+Note: the routine timespec_to_filetime is provided as a convenience and a mean
+to test that filetime_to_timespec works, but it is not used by the library.
+
+------------------------------------
+- in semaphore.c, if macro NEED_SEM is defined, add code for the routines
+_increase_semaphore and _decrease_semaphore, and modify significantly
+the implementation of the semaphores so that it does not use CreateSemaphore.
+
+Rational: CreateSemaphore is not available on WinCE. I had to re-implement
+semaphores using mutexes and Events.
+
+Note: Only the semaphore routines that are used by pthread are implemented
+(i.e. signal conditions rely on a subset of the semaphores routines, and
+this subset works). Some other semaphore routines (e.g. sem_trywait) are
+not yet supported on my WinCE port (and since I don't need them, I am not
+planning to do anything about them).
+
+------------------------------------
+- in tsd.c, changed the code that defines TLS_OUT_OF_INDEXES
+
+/* TLS_OUT_OF_INDEXES not defined on WinCE */
+#ifndef TLS_OUT_OF_INDEXES
+#define TLS_OUT_OF_INDEXES 0xffffffff
+#endif
+
+Rational: TLS_OUT_OF_INDEXES is not defined in any standard include file
+on WinCE.
+
+------------------------------------
+- added file need_errno.h
+
+Rational: On WinCE, there is no errno.h file. need_errno.h is just a
+copy of windows version of errno.h, with minor modifications due to the fact
+that some of the error codes are defined by the WinCE socket library.
+In pthread.h, if NEED_ERRNO is defined, the file need_errno.h is
+included (instead of <errno.h>).
+
+
+-- eof
diff --git a/win32/contrib/pthreads/acconfig.h b/win32/contrib/pthreads/acconfig.h new file mode 100644 index 000000000..7af1923ea --- /dev/null +++ b/win32/contrib/pthreads/acconfig.h @@ -0,0 +1,3 @@ +/* Do we know about the C type sigset_t? */
+#undef HAVE_SIGSET_T
+
diff --git a/win32/contrib/pthreads/attr.c b/win32/contrib/pthreads/attr.c new file mode 100644 index 000000000..67f7be9c8 --- /dev/null +++ b/win32/contrib/pthreads/attr.c @@ -0,0 +1,533 @@ +/*
+ * attr.c
+ *
+ * Description:
+ * This translation unit implements operations on thread attribute objects.
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright (C) 1998
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA
+ */
+
+/* ignore warning "unreferenced formal parameter" */
+#ifdef _MSC_VER
+#pragma warning( disable : 4100 )
+#endif
+
+#include "pthread.h"
+#include "implement.h"
+
+static INLINE int
+is_attr(const pthread_attr_t *attr)
+{
+ /* Return 0 if the attr object is valid, non-zero otherwise. */
+
+ return (attr == NULL ||
+ *attr == NULL ||
+ (*attr)->valid != PTW32_ATTR_VALID);
+}
+
+
+int
+pthread_attr_setstacksize(pthread_attr_t *attr,
+ size_t stacksize)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * This function specifies the size of the stack on
+ * which threads created with 'attr' will run.
+ *
+ * PARAMETERS
+ * attr
+ * pointer to an instance of pthread_attr_t
+ *
+ * stacksize
+ * stack size, in bytes.
+ *
+ *
+ * DESCRIPTION
+ * This function specifies the size of the stack on
+ * which threads created with 'attr' will run.
+ *
+ * NOTES:
+ * 1) Function supported only if this macro is
+ * defined:
+ *
+ * _POSIX_THREAD_ATTR_STACKSIZE
+ *
+ * 2) Find the default first (using
+ * pthread_attr_getstacksize), then increase
+ * by multiplying.
+ *
+ * 3) Only use if thread needs more than the
+ * default.
+ *
+ * RESULTS
+ * 0 successfully set stack size,
+ * EINVAL 'attr' is invalid or stacksize too
+ * small or too big.
+ * ENOSYS function not supported
+ *
+ * ------------------------------------------------------
+ */
+{
+#ifdef _POSIX_THREAD_ATTR_STACKSIZE
+
+ /* Verify that the stack size is within range. */
+ if (stacksize < PTHREAD_STACK_MIN)
+ {
+ return EINVAL;
+ }
+
+ if (is_attr(attr) != 0)
+ {
+ return EINVAL;
+ }
+
+ /* Everything is okay. */
+ (*attr)->stacksize = stacksize;
+ return 0;
+
+#else
+
+ return ENOSYS;
+
+#endif /* _POSIX_THREAD_ATTR_STACKSIZE */
+
+}
+
+int
+pthread_attr_getstacksize(const pthread_attr_t *attr,
+ size_t *stacksize)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * This function determines the size of the stack on
+ * which threads created with 'attr' will run.
+ *
+ * PARAMETERS
+ * attr
+ * pointer to an instance of pthread_attr_t
+ *
+ * stacksize
+ * pointer to size_t into which is returned the
+ * stack size, in bytes.
+ *
+ *
+ * DESCRIPTION
+ * This function determines the size of the stack on
+ * which threads created with 'attr' will run.
+ *
+ * NOTES:
+ * 1) Function supported only if this macro is
+ * defined:
+ *
+ * _POSIX_THREAD_ATTR_STACKSIZE
+ *
+ * 2) Use on newly created attributes object to
+ * find the default stack size.
+ *
+ * RESULTS
+ * 0 successfully retrieved stack size,
+ * EINVAL 'attr' is invalid
+ * ENOSYS function not supported
+ *
+ * ------------------------------------------------------
+ */
+{
+#ifdef _POSIX_THREAD_ATTR_STACKSIZE
+
+ if (is_attr(attr) != 0)
+ {
+ return EINVAL;
+ }
+
+ /* Everything is okay. */
+ *stacksize = (*attr)->stacksize;
+ return 0;
+
+#else
+
+ return ENOSYS;
+
+#endif /* _POSIX_THREAD_ATTR_STACKSIZE */
+
+}
+
+
+int
+pthread_attr_setstackaddr(pthread_attr_t *attr,
+ void *stackaddr)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * Threads created with 'attr' will run on the stack
+ * starting at 'stackaddr'.
+ * Stack must be at least PTHREAD_STACK_MIN bytes.
+ *
+ * PARAMETERS
+ * attr
+ * pointer to an instance of pthread_attr_t
+ *
+ * stacksize
+ * stack size, in bytes.
+ *
+ *
+ * DESCRIPTION
+ * Threads created with 'attr' will run on the stack
+ * starting at 'stackaddr'.
+ * Stack must be at least PTHREAD_STACK_MIN bytes.
+ *
+ * NOTES:
+ * 1) Function supported only if this macro is
+ * defined:
+ *
+ * _POSIX_THREAD_ATTR_STACKADDR
+ *
+ * 2) Create only one thread for each stack
+ * address..
+ *
+ * 3) Ensure that stackaddr is aligned.
+ *
+ * RESULTS
+ * 0 successfully set stack address,
+ * EINVAL 'attr' is invalid
+ * ENOSYS function not supported
+ *
+ * ------------------------------------------------------
+ */
+{
+#if defined( _POSIX_THREAD_ATTR_STACKADDR )
+
+ if (is_attr(attr) != 0)
+ {
+ return EINVAL;
+ }
+
+ (*attr)->stackaddr = stackaddr;
+ return 0;
+
+#else
+
+ return ENOSYS;
+
+#endif /* _POSIX_THREAD_ATTR_STACKADDR */
+}
+
+int
+pthread_attr_getstackaddr(const pthread_attr_t *attr,
+ void **stackaddr)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * This function determines the address of the stack
+ * on which threads created with 'attr' will run.
+ *
+ * PARAMETERS
+ * attr
+ * pointer to an instance of pthread_attr_t
+ *
+ * stackaddr
+ * pointer into which is returned the stack address.
+ *
+ *
+ * DESCRIPTION
+ * This function determines the address of the stack
+ * on which threads created with 'attr' will run.
+ *
+ * NOTES:
+ * 1) Function supported only if this macro is
+ * defined:
+ *
+ * _POSIX_THREAD_ATTR_STACKADDR
+ *
+ * 2) Create only one thread for each stack
+ * address..
+ *
+ * RESULTS
+ * 0 successfully retreived stack address,
+ * EINVAL 'attr' is invalid
+ * ENOSYS function not supported
+ *
+ * ------------------------------------------------------
+ */
+{
+#if defined( _POSIX_THREAD_ATTR_STACKADDR )
+
+ if (is_attr(attr) != 0)
+ {
+ return EINVAL;
+ }
+
+ *stackaddr = (*attr)->stackaddr;
+ return 0;
+
+#else
+
+ return ENOSYS;
+
+#endif /* _POSIX_THREAD_ATTR_STACKADDR */
+}
+
+
+int
+pthread_attr_init(pthread_attr_t *attr)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * Initializes a thread attributes object with default
+ * attributes.
+ *
+ * PARAMETERS
+ * attr
+ * pointer to an instance of pthread_attr_t
+ *
+ *
+ * DESCRIPTION
+ * Initializes a thread attributes object with default
+ * attributes.
+ *
+ * NOTES:
+ * 1) Used to define thread attributes
+ *
+ * RESULTS
+ * 0 successfully initialized attr,
+ * ENOMEM insufficient memory for attr.
+ *
+ * ------------------------------------------------------
+ */
+{
+ pthread_attr_t attr_result;
+
+ if (attr == NULL)
+ {
+ /* This is disallowed. */
+ return EINVAL;
+ }
+
+ attr_result = (pthread_attr_t) malloc (sizeof (*attr_result));
+
+ if (attr_result == NULL)
+ {
+ return ENOMEM;
+ }
+
+#ifdef _POSIX_THREAD_ATTR_STACKSIZE
+ /*
+ * Default to zero size. Unless changed explicitly this
+ * will allow Win32 to set the size to that of the
+ * main thread.
+ */
+ attr_result->stacksize = 0;
+#endif
+
+#ifdef _POSIX_THREAD_ATTR_STACKADDR
+ /* FIXME: Set this to something sensible when we support it. */
+ attr_result->stackaddr = NULL;
+#endif
+
+ attr_result->detachstate = PTHREAD_CREATE_JOINABLE;
+
+#if HAVE_SIGSET_T
+ memset(&(attr_result->sigmask), 0, sizeof(sigset_t));
+#endif /* HAVE_SIGSET_T */
+
+ /*
+ * Win32 sets new threads to THREAD_PRIORITY_NORMAL and
+ * not to that of the parent thread. We choose to default to
+ * this arrangement.
+ */
+ attr_result->param.sched_priority = THREAD_PRIORITY_NORMAL;
+ attr_result->inheritsched = PTHREAD_EXPLICIT_SCHED;
+
+ attr_result->valid = PTW32_ATTR_VALID;
+
+ *attr = attr_result;
+
+ return 0;
+}
+
+int
+pthread_attr_destroy(pthread_attr_t *attr)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * Destroys a thread attributes object.
+ *
+ * PARAMETERS
+ * attr
+ * pointer to an instance of pthread_attr_t
+ *
+ *
+ * DESCRIPTION
+ * Destroys a thread attributes object.
+ *
+ * NOTES:
+ * 1) Does not affect threads created with 'attr'.
+ *
+ * RESULTS
+ * 0 successfully destroyed attr,
+ * EINVAL 'attr' is invalid.
+ *
+ * ------------------------------------------------------
+ */
+{
+ if (is_attr(attr) != 0)
+ {
+ return EINVAL;
+ }
+
+ /*
+ * Set the attribute object to a specific invalid value.
+ */
+ (*attr)->valid = 0;
+ free (*attr);
+ *attr = NULL;
+
+ return 0;
+}
+
+int
+pthread_attr_getdetachstate(const pthread_attr_t *attr,
+ int *detachstate)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * This function determines whether threads created with
+ * 'attr' will run detached.
+ *
+ * PARAMETERS
+ * attr
+ * pointer to an instance of pthread_attr_t
+ *
+ * detachstate
+ * pointer to an integer into which is returned one
+ * of:
+ *
+ * PTHREAD_CREATE_JOINABLE
+ * Thread ID is valid, must be joined
+ *
+ * PTHREAD_CREATE_DETACHED
+ * Thread ID is invalid, cannot be joined,
+ * canceled, or modified
+ *
+ *
+ * DESCRIPTION
+ * This function determines whether threads created with
+ * 'attr' will run detached.
+ *
+ * NOTES:
+ * 1) You cannot join or cancel detached threads.
+ *
+ * RESULTS
+ * 0 successfully retrieved detach state,
+ * EINVAL 'attr' is invalid
+ *
+ * ------------------------------------------------------
+ */
+{
+ if (is_attr(attr) != 0 || detachstate == NULL)
+ {
+ *detachstate = PTHREAD_CREATE_DETACHED;
+ return EINVAL;
+ }
+
+ *detachstate = (*attr)->detachstate;
+ return 0;
+}
+
+int
+pthread_attr_setdetachstate(pthread_attr_t *attr,
+ int detachstate)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * This function specifies whether threads created with
+ * 'attr' will run detached.
+ *
+ * PARAMETERS
+ * attr
+ * pointer to an instance of pthread_attr_t
+ *
+ * detachstate
+ * an integer containing one of:
+ *
+ * PTHREAD_CREATE_JOINABLE
+ * Thread ID is valid, must be joined
+ *
+ * PTHREAD_CREATE_DETACHED
+ * Thread ID is invalid, cannot be joined,
+ * canceled, or modified
+ *
+ *
+ * DESCRIPTION
+ * This function specifies whether threads created with
+ * 'attr' will run detached.
+ *
+ * NOTES:
+ * 1) You cannot join or cancel detached threads.
+ *
+ * RESULTS
+ * 0 successfully set detach state,
+ * EINVAL 'attr' or 'detachstate' is invalid
+ *
+ * ------------------------------------------------------
+ */
+{
+ if (is_attr(attr) != 0)
+ {
+ return EINVAL;
+ }
+
+ if (detachstate != PTHREAD_CREATE_JOINABLE &&
+ detachstate != PTHREAD_CREATE_DETACHED)
+ {
+ return EINVAL;
+ }
+
+ (*attr)->detachstate = detachstate;
+ return 0;
+}
+
+
+int
+pthread_attr_setscope(pthread_attr_t *attr, int contentionscope)
+{
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+ if (contentionscope != PTHREAD_SCOPE_SYSTEM)
+ {
+ return ENOTSUP;
+ }
+
+ return 0;
+#else
+ return ENOSYS;
+#endif
+}
+
+
+int
+pthread_attr_getscope(const pthread_attr_t *attr, int *contentionscope)
+{
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+ *contentionscope = PTHREAD_SCOPE_SYSTEM;
+ return 0;
+#else
+ return ENOSYS;
+#endif
+}
+
diff --git a/win32/contrib/pthreads/barrier.c b/win32/contrib/pthreads/barrier.c new file mode 100644 index 000000000..eb4542b51 --- /dev/null +++ b/win32/contrib/pthreads/barrier.c @@ -0,0 +1,421 @@ +/*
+ * barrier.c
+ *
+ * Description:
+ * This translation unit implements barrier primitives.
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright (C) 1998
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA
+ */
+
+#include "pthread.h"
+#include "implement.h"
+
+
+#ifdef __MINGW32__
+#define _LONG long
+#define _LPLONG long*
+#else
+#define _LONG PVOID
+#define _LPLONG PVOID*
+#endif
+
+int
+pthread_barrier_init(pthread_barrier_t * barrier,
+ const pthread_barrierattr_t * attr,
+ unsigned int count)
+{
+ pthread_barrier_t b;
+
+ if (barrier == NULL || count == 0)
+ {
+ return EINVAL;
+ }
+
+ if (NULL != (b = (pthread_barrier_t) calloc(1, sizeof(*b))))
+ {
+ b->pshared = (attr != NULL && *attr != NULL
+ ? (*attr)->pshared
+ : PTHREAD_PROCESS_PRIVATE);
+
+ b->nCurrentBarrierHeight = b->nInitialBarrierHeight = count;
+ b->iStep = 0;
+
+ /*
+ * Two semaphores are used in the same way as two stepping
+ * stones might be used in crossing a stream. Once all
+ * threads are safely on one stone, the other stone can
+ * be moved ahead, and the threads can start moving to it.
+ * If some threads decide to eat their lunch before moving
+ * then the other threads have to wait.
+ */
+ if (0 == sem_init(&(b->semBarrierBreeched[0]), b->pshared, 0))
+ {
+ if (0 == sem_init(&(b->semBarrierBreeched[1]), b->pshared, 0))
+ {
+ *barrier = b;
+ return 0;
+ }
+ (void) sem_destroy(&(b->semBarrierBreeched[0]));
+ }
+ (void) free(b);
+ }
+
+ return ENOMEM;
+}
+
+int
+pthread_barrier_destroy(pthread_barrier_t *barrier)
+{
+ int result = 0;
+ pthread_barrier_t b;
+
+ if (barrier == NULL || *barrier == (pthread_barrier_t) PTW32_OBJECT_INVALID)
+ {
+ return EINVAL;
+ }
+
+ b = *barrier;
+ *barrier = NULL;
+
+ if (0 == (result = sem_destroy(&(b->semBarrierBreeched[0]))))
+ {
+ if (0 == (result = sem_destroy(&(b->semBarrierBreeched[1]))))
+ {
+ (void) free(b);
+ return 0;
+ }
+ (void) sem_init(&(b->semBarrierBreeched[0]),
+ b->pshared,
+ 0);
+ }
+
+ *barrier = b;
+ return(result);
+}
+
+
+int
+pthread_barrier_wait(pthread_barrier_t *barrier)
+{
+ int result;
+ int step;
+ pthread_barrier_t b;
+
+ if (barrier == NULL || *barrier == (pthread_barrier_t) PTW32_OBJECT_INVALID)
+ {
+ return EINVAL;
+ }
+
+ b = *barrier;
+ step = b->iStep;
+
+ if (0 == InterlockedDecrement((long *) &(b->nCurrentBarrierHeight)))
+ {
+ /* Must be done before posting the semaphore. */
+ b->nCurrentBarrierHeight = b->nInitialBarrierHeight;
+
+ /*
+ * There is no race condition between the semaphore wait and post
+ * because we are using two alternating semas and all threads have
+ * entered barrier_wait and checked nCurrentBarrierHeight before this
+ * barrier's sema can be posted. Any threads that have not quite
+ * entered sem_wait below when the multiple_post has completed
+ * will nevertheless continue through the semaphore (barrier)
+ * and will not be left stranded.
+ */
+ result = (b->nInitialBarrierHeight > 1
+ ? sem_post_multiple(&(b->semBarrierBreeched[step]),
+ b->nInitialBarrierHeight - 1)
+ : 0);
+ }
+ else
+ {
+ BOOL switchCancelState;
+ int oldCancelState;
+ pthread_t self = pthread_self();
+
+ /*
+ * This routine is not a cancelation point, so temporarily
+ * prevent sem_wait() from being one.
+ * PTHREAD_CANCEL_ASYNCHRONOUS threads can still be canceled.
+ */
+ switchCancelState = (self->cancelType == PTHREAD_CANCEL_DEFERRED &&
+ 0 == pthread_setcancelstate(PTHREAD_CANCEL_DISABLE,
+ &oldCancelState));
+
+ result = sem_wait(&(b->semBarrierBreeched[step]));
+
+ if (switchCancelState)
+ {
+ (void) pthread_setcancelstate(oldCancelState, NULL);
+ }
+ }
+
+ /*
+ * The first thread across will be the PTHREAD_BARRIER_SERIAL_THREAD.
+ * It also sets up the alternate semaphore as the next barrier.
+ */
+ if (0 == result)
+ {
+ result = ((_LONG) step ==
+ InterlockedCompareExchange((_LPLONG) &(b->iStep),
+ (_LONG) (1L - step),
+ (_LONG) step)
+ ? PTHREAD_BARRIER_SERIAL_THREAD
+ : 0);
+ }
+
+ return(result);
+}
+
+
+int
+pthread_barrierattr_init (pthread_barrierattr_t * attr)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * Initializes a barrier attributes object with default
+ * attributes.
+ *
+ * PARAMETERS
+ * attr
+ * pointer to an instance of pthread_barrierattr_t
+ *
+ *
+ * DESCRIPTION
+ * Initializes a barrier attributes object with default
+ * attributes.
+ *
+ * NOTES:
+ * 1) Used to define barrier types
+ *
+ * RESULTS
+ * 0 successfully initialized attr,
+ * ENOMEM insufficient memory for attr.
+ *
+ * ------------------------------------------------------
+ */
+{
+ pthread_barrierattr_t ba;
+ int result = 0;
+
+ ba = (pthread_barrierattr_t) calloc (1, sizeof (*ba));
+
+ if (ba == NULL)
+ {
+ result = ENOMEM;
+ }
+
+ ba->pshared = PTHREAD_PROCESS_PRIVATE;
+
+ *attr = ba;
+
+ return (result);
+
+} /* pthread_barrierattr_init */
+
+
+int
+pthread_barrierattr_destroy (pthread_barrierattr_t * attr)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * Destroys a barrier attributes object. The object can
+ * no longer be used.
+ *
+ * PARAMETERS
+ * attr
+ * pointer to an instance of pthread_barrierattr_t
+ *
+ *
+ * DESCRIPTION
+ * Destroys a barrier attributes object. The object can
+ * no longer be used.
+ *
+ * NOTES:
+ * 1) Does not affect barrieres created using 'attr'
+ *
+ * RESULTS
+ * 0 successfully released attr,
+ * EINVAL 'attr' is invalid.
+ *
+ * ------------------------------------------------------
+ */
+{
+ int result = 0;
+
+ if (attr == NULL || *attr == NULL)
+ {
+ result = EINVAL;
+ }
+ else
+ {
+ pthread_barrierattr_t ba = *attr;
+
+ *attr = NULL;
+ free (ba);
+
+ result = 0;
+ }
+
+ return (result);
+
+} /* pthread_barrierattr_destroy */
+
+
+int
+pthread_barrierattr_getpshared (const pthread_barrierattr_t * attr,
+ int *pshared)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * Determine whether barriers created with 'attr' can be
+ * shared between processes.
+ *
+ * PARAMETERS
+ * attr
+ * pointer to an instance of pthread_barrierattr_t
+ *
+ * pshared
+ * will be set to one of:
+ *
+ * PTHREAD_PROCESS_SHARED
+ * May be shared if in shared memory
+ *
+ * PTHREAD_PROCESS_PRIVATE
+ * Cannot be shared.
+ *
+ *
+ * DESCRIPTION
+ * Mutexes creatd with 'attr' can be shared between
+ * processes if pthread_barrier_t variable is allocated
+ * in memory shared by these processes.
+ * NOTES:
+ * 1) pshared barriers MUST be allocated in shared
+ * memory.
+ * 2) The following macro is defined if shared barriers
+ * are supported:
+ * _POSIX_THREAD_PROCESS_SHARED
+ *
+ * RESULTS
+ * 0 successfully retrieved attribute,
+ * EINVAL 'attr' is invalid,
+ *
+ * ------------------------------------------------------
+ */
+{
+ int result;
+
+ if ((attr != NULL && *attr != NULL) &&
+ (pshared != NULL))
+ {
+ *pshared = (*attr)->pshared;
+ result = 0;
+ }
+ else
+ {
+ *pshared = PTHREAD_PROCESS_PRIVATE;
+ result = EINVAL;
+ }
+
+ return (result);
+
+} /* pthread_barrierattr_getpshared */
+
+
+int
+pthread_barrierattr_setpshared (pthread_barrierattr_t * attr,
+ int pshared)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * Barriers created with 'attr' can be shared between
+ * processes if pthread_barrier_t variable is allocated
+ * in memory shared by these processes.
+ *
+ * PARAMETERS
+ * attr
+ * pointer to an instance of pthread_barrierattr_t
+ *
+ * pshared
+ * must be one of:
+ *
+ * PTHREAD_PROCESS_SHARED
+ * May be shared if in shared memory
+ *
+ * PTHREAD_PROCESS_PRIVATE
+ * Cannot be shared.
+ *
+ * DESCRIPTION
+ * Mutexes creatd with 'attr' can be shared between
+ * processes if pthread_barrier_t variable is allocated
+ * in memory shared by these processes.
+ *
+ * NOTES:
+ * 1) pshared barriers MUST be allocated in shared
+ * memory.
+ *
+ * 2) The following macro is defined if shared barriers
+ * are supported:
+ * _POSIX_THREAD_PROCESS_SHARED
+ *
+ * RESULTS
+ * 0 successfully set attribute,
+ * EINVAL 'attr' or pshared is invalid,
+ * ENOSYS PTHREAD_PROCESS_SHARED not supported,
+ *
+ * ------------------------------------------------------
+ */
+{
+ int result;
+
+ if ((attr != NULL && *attr != NULL) &&
+ ((pshared == PTHREAD_PROCESS_SHARED) ||
+ (pshared == PTHREAD_PROCESS_PRIVATE)))
+ {
+ if (pshared == PTHREAD_PROCESS_SHARED)
+ {
+
+#if !defined( _POSIX_THREAD_PROCESS_SHARED )
+
+ result = ENOSYS;
+ pshared = PTHREAD_PROCESS_PRIVATE;
+
+#else
+
+ result = 0;
+
+#endif /* _POSIX_THREAD_PROCESS_SHARED */
+
+ }
+ else
+ {
+ result = 0;
+ }
+
+ (*attr)->pshared = pshared;
+ }
+ else
+ {
+ result = EINVAL;
+ }
+
+ return (result);
+
+} /* pthread_barrierattr_setpshared */
diff --git a/win32/contrib/pthreads/cancel.c b/win32/contrib/pthreads/cancel.c new file mode 100644 index 000000000..6243257be --- /dev/null +++ b/win32/contrib/pthreads/cancel.c @@ -0,0 +1,388 @@ +/*
+ * cancel.c
+ *
+ * Description:
+ * POSIX thread functions related to thread cancellation.
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright (C) 1998
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA
+ */
+
+#include "pthread.h"
+#include "implement.h"
+
+
+#if defined(_M_IX86) || defined(_X86_)
+#define PROGCTR(Context) ((Context).Eip)
+#endif
+
+#if defined(_MIPS_)
+#define PROGCTR(Context) ((Context).Fir)
+#endif
+
+#if defined(_ALPHA_)
+#define PROGCTR(Context) ((Context).Fir)
+#endif
+
+#if defined(_PPC_)
+#define PROGCTR(Context) ((Context).Iar)
+#endif
+
+#if !defined(PROGCTR)
+#error Module contains CPU-specific code; modify and recompile.
+#endif
+
+
+static void
+ptw32_cancel_self(void)
+{
+ ptw32_throw(PTW32_EPS_CANCEL);
+
+ /* Never reached */
+}
+
+
+/*
+ * ptw32_cancel_thread implements asynchronous cancellation.
+ */
+static INLINE void
+ptw32_cancel_thread(pthread_t thread)
+{
+ HANDLE threadH = thread->threadH;
+
+ (void) pthread_mutex_lock(&thread->cancelLock);
+
+ SuspendThread(threadH);
+
+ if (WaitForSingleObject(threadH, 0) == WAIT_TIMEOUT)
+ {
+ CONTEXT context;
+ context.ContextFlags = CONTEXT_CONTROL;
+ GetThreadContext(threadH, &context);
+ PROGCTR(context) = (DWORD) ptw32_cancel_self;
+ SetThreadContext(threadH, &context);
+ ResumeThread(threadH);
+ }
+
+ (void) pthread_mutex_unlock(&thread->cancelLock);
+}
+
+
+int
+pthread_setcancelstate (int state, int *oldstate)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * This function atomically sets the calling thread's
+ * cancelability state to 'state' and returns the previous
+ * cancelability state at the location referenced by
+ * 'oldstate'
+ *
+ * PARAMETERS
+ * state,
+ * oldstate
+ * PTHREAD_CANCEL_ENABLE
+ * cancellation is enabled,
+ *
+ * PTHREAD_CANCEL_DISABLE
+ * cancellation is disabled
+ *
+ *
+ * DESCRIPTION
+ * This function atomically sets the calling thread's
+ * cancelability state to 'state' and returns the previous
+ * cancelability state at the location referenced by
+ * 'oldstate'.
+ *
+ * NOTES:
+ * 1) Use to disable cancellation around 'atomic' code that
+ * includes cancellation points
+ *
+ * COMPATIBILITY ADDITIONS
+ * If 'oldstate' is NULL then the previous state is not returned
+ * but the function still succeeds. (Solaris)
+ *
+ * RESULTS
+ * 0 successfully set cancelability type,
+ * EINVAL 'state' is invalid
+ *
+ * ------------------------------------------------------
+ */
+{
+ int result = 0;
+ pthread_t self = pthread_self();
+
+ if (self == NULL
+ || (state != PTHREAD_CANCEL_ENABLE
+ && state != PTHREAD_CANCEL_DISABLE))
+ {
+ return EINVAL;
+ }
+
+ /*
+ * Lock for async-cancel safety.
+ */
+ (void) pthread_mutex_lock(&self->cancelLock);
+
+ if (oldstate != NULL)
+ {
+ *oldstate = self->cancelState;
+ }
+
+ self->cancelState = state;
+
+ /*
+ * Check if there is a pending asynchronous cancel
+ */
+ if (self->cancelState == PTHREAD_CANCEL_ENABLE
+ && self->cancelType == PTHREAD_CANCEL_ASYNCHRONOUS
+ && WaitForSingleObject(self->cancelEvent, 0) == WAIT_OBJECT_0)
+ {
+ ResetEvent(self->cancelEvent);
+ (void) pthread_mutex_unlock(&self->cancelLock);
+ ptw32_throw(PTW32_EPS_CANCEL);
+
+ /* Never reached */
+ }
+
+ (void) pthread_mutex_unlock(&self->cancelLock);
+
+ return (result);
+
+} /* pthread_setcancelstate */
+
+
+int
+pthread_setcanceltype (int type, int *oldtype)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * This function atomically sets the calling thread's
+ * cancelability type to 'type' and returns the previous
+ * cancelability type at the location referenced by
+ * 'oldtype'
+ *
+ * PARAMETERS
+ * type,
+ * oldtype
+ * PTHREAD_CANCEL_DEFERRED
+ * only deferred cancelation is allowed,
+ *
+ * PTHREAD_CANCEL_ASYNCHRONOUS
+ * Asynchronous cancellation is allowed
+ *
+ *
+ * DESCRIPTION
+ * This function atomically sets the calling thread's
+ * cancelability type to 'type' and returns the previous
+ * cancelability type at the location referenced by
+ * 'oldtype'
+ *
+ * NOTES:
+ * 1) Use with caution; most code is not safe for use
+ * with asynchronous cancelability.
+ *
+ * COMPATIBILITY ADDITIONS
+ * If 'oldtype' is NULL then the previous type is not returned
+ * but the function still succeeds. (Solaris)
+ *
+ * RESULTS
+ * 0 successfully set cancelability type,
+ * EINVAL 'type' is invalid
+ *
+ * ------------------------------------------------------
+ */
+{
+ int result = 0;
+ pthread_t self = pthread_self();
+
+ if (self == NULL
+ || (type != PTHREAD_CANCEL_DEFERRED
+ && type != PTHREAD_CANCEL_ASYNCHRONOUS))
+ {
+ return EINVAL;
+ }
+
+ /*
+ * Lock for async-cancel safety.
+ */
+ (void) pthread_mutex_lock(&self->cancelLock);
+
+ if (oldtype != NULL)
+ {
+ *oldtype = self->cancelType;
+ }
+
+ self->cancelType = type;
+
+ /*
+ * Check if there is a pending asynchronous cancel
+ */
+ if (self->cancelState == PTHREAD_CANCEL_ENABLE
+ && self->cancelType == PTHREAD_CANCEL_ASYNCHRONOUS
+ && WaitForSingleObject(self->cancelEvent, 0) == WAIT_OBJECT_0)
+ {
+ ResetEvent(self->cancelEvent);
+ (void) pthread_mutex_unlock(&self->cancelLock);
+ ptw32_throw(PTW32_EPS_CANCEL);
+
+ /* Never reached */
+ }
+
+ (void) pthread_mutex_unlock(&self->cancelLock);
+
+ return (result);
+
+} /* pthread_setcanceltype */
+
+void
+pthread_testcancel (void)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * This function creates a deferred cancellation point
+ * in the calling thread. The call has no effect if the
+ * current cancelability state is
+ * PTHREAD_CANCEL_DISABLE
+ *
+ * PARAMETERS
+ * N/A
+ *
+ *
+ * DESCRIPTION
+ * This function creates a deferred cancellation point
+ * in the calling thread. The call has no effect if the
+ * current cancelability state is
+ * PTHREAD_CANCEL_DISABLE
+ *
+ * NOTES:
+ * 1) Cancellation is asynchronous. Use pthread_join
+ * to wait for termination of thread if necessary
+ *
+ * RESULTS
+ * N/A
+ *
+ * ------------------------------------------------------
+ */
+{
+ pthread_t self = pthread_self();
+
+ if (self != NULL
+ && self->cancelState == PTHREAD_CANCEL_ENABLE
+ && WaitForSingleObject (self->cancelEvent, 0) == WAIT_OBJECT_0
+ )
+ {
+ /*
+ * Canceling!
+ */
+ ptw32_throw(PTW32_EPS_CANCEL);
+ }
+} /* pthread_testcancel */
+
+int
+pthread_cancel (pthread_t thread)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * This function requests cancellation of 'thread'.
+ *
+ * PARAMETERS
+ * thread
+ * reference to an instance of pthread_t
+ *
+ *
+ * DESCRIPTION
+ * This function requests cancellation of 'thread'.
+ * NOTE: cancellation is asynchronous; use pthread_join to
+ * wait for termination of 'thread' if necessary.
+ *
+ * RESULTS
+ * 0 successfully requested cancellation,
+ * ESRCH no thread found corresponding to 'thread',
+ * ENOMEM implicit self thread create failed.
+ * ------------------------------------------------------
+ */
+{
+ int result;
+ int cancel_self;
+ pthread_t self;
+
+ if (thread == NULL )
+ {
+ return ESRCH;
+ }
+
+ result = 0;
+ if ((self = pthread_self()) == NULL)
+ {
+ return ENOMEM;
+ };
+
+ /*
+ * FIXME!!
+ *
+ * Can a thread cancel itself?
+ *
+ * The standard doesn't
+ * specify an error to be returned if the target
+ * thread is itself.
+ *
+ * If it may, then we need to ensure that a thread can't
+ * deadlock itself trying to cancel itself asyncronously
+ * (pthread_cancel is required to be an async-cancel
+ * safe function).
+ */
+ cancel_self = pthread_equal(thread, self);
+
+ /*
+ * Lock for async-cancel safety.
+ */
+ (void) pthread_mutex_lock(&self->cancelLock);
+
+ if (thread->cancelType == PTHREAD_CANCEL_ASYNCHRONOUS
+ && thread->cancelState == PTHREAD_CANCEL_ENABLE )
+ {
+ if (cancel_self)
+ {
+ (void) pthread_mutex_unlock(&self->cancelLock);
+ ptw32_throw(PTW32_EPS_CANCEL);
+
+ /* Never reached */
+ }
+
+ ptw32_cancel_thread(thread);
+ }
+ else
+ {
+ /*
+ * Set for deferred cancellation.
+ */
+ if (!SetEvent (thread->cancelEvent))
+ {
+ result = ESRCH;
+ }
+ }
+
+ (void) pthread_mutex_unlock(&self->cancelLock);
+
+ return (result);
+
+}
+
+
+
diff --git a/win32/contrib/pthreads/cleanup.c b/win32/contrib/pthreads/cleanup.c new file mode 100644 index 000000000..9794b5fb5 --- /dev/null +++ b/win32/contrib/pthreads/cleanup.c @@ -0,0 +1,138 @@ +/*
+ * cleanup.c
+ *
+ * Description:
+ * This translation unit implements routines associated
+ * with cleaning up threads.
+ *
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright (C) 1998
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA
+ */
+
+#include "pthread.h"
+#include "implement.h"
+
+
+/*
+ * The functions ptw32_pop_cleanup and ptw32_push_cleanup
+ * are implemented here for applications written in C with no
+ * SEH or C++ destructor support.
+ */
+
+ptw32_cleanup_t *
+ptw32_pop_cleanup (int execute)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * This function pops the most recently pushed cleanup
+ * handler. If execute is nonzero, then the cleanup handler
+ * is executed if non-null.
+ *
+ * PARAMETERS
+ * execute
+ * if nonzero, execute the cleanup handler
+ *
+ *
+ * DESCRIPTION
+ * This function pops the most recently pushed cleanup
+ * handler. If execute is nonzero, then the cleanup handler
+ * is executed if non-null.
+ * NOTE: specify 'execute' as nonzero to avoid duplication
+ * of common cleanup code.
+ *
+ * RESULTS
+ * N/A
+ *
+ * ------------------------------------------------------
+ */
+{
+ ptw32_cleanup_t *cleanup = NULL;
+
+ cleanup = (ptw32_cleanup_t *) pthread_getspecific (ptw32_cleanupKey);
+
+ if (cleanup != NULL)
+ {
+ if (execute && (cleanup->routine != NULL))
+ {
+
+ (*cleanup->routine) (cleanup->arg);
+
+ }
+
+ pthread_setspecific (ptw32_cleanupKey, (void *) cleanup->prev);
+
+ }
+
+ return (cleanup);
+
+} /* ptw32_pop_cleanup */
+
+
+void
+ptw32_push_cleanup (ptw32_cleanup_t * cleanup,
+ ptw32_cleanup_callback_t routine,
+ void *arg)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * This function pushes a new cleanup handler onto the thread's stack
+ * of cleanup handlers. Each cleanup handler pushed onto the stack is
+ * popped and invoked with the argument 'arg' when
+ * a) the thread exits by calling 'pthread_exit',
+ * b) when the thread acts on a cancellation request,
+ * c) or when the thrad calls pthread_cleanup_pop with a nonzero
+ * 'execute' argument
+ *
+ * PARAMETERS
+ * cleanup
+ * a pointer to an instance of pthread_cleanup_t,
+ *
+ * routine
+ * pointer to a cleanup handler,
+ *
+ * arg
+ * parameter to be passed to the cleanup handler
+ *
+ *
+ * DESCRIPTION
+ * This function pushes a new cleanup handler onto the thread's stack
+ * of cleanup handlers. Each cleanup handler pushed onto the stack is
+ * popped and invoked with the argument 'arg' when
+ * a) the thread exits by calling 'pthread_exit',
+ * b) when the thread acts on a cancellation request,
+ * c) or when the thrad calls pthread_cleanup_pop with a nonzero
+ * 'execute' argument
+ * NOTE: pthread_push_cleanup, ptw32_pop_cleanup must be paired
+ * in the same lexical scope.
+ *
+ * RESULTS
+ * pthread_cleanup_t *
+ * pointer to the previous cleanup
+ *
+ * ------------------------------------------------------
+ */
+{
+ cleanup->routine = routine;
+ cleanup->arg = arg;
+
+ cleanup->prev = (ptw32_cleanup_t *) pthread_getspecific (ptw32_cleanupKey);
+
+ pthread_setspecific (ptw32_cleanupKey, (void *) cleanup);
+
+} /* ptw32_push_cleanup */
diff --git a/win32/contrib/pthreads/condvar.c b/win32/contrib/pthreads/condvar.c new file mode 100644 index 000000000..c8876c4f2 --- /dev/null +++ b/win32/contrib/pthreads/condvar.c @@ -0,0 +1,1219 @@ +/*
+ * condvar.c
+ *
+ * Description:
+ * This translation unit implements condition variables and their primitives.
+ *
+ * Algorithm:
+ * The algorithm used in this implementation is that developed by
+ * Alexander Terekhov in colaboration with Louis Thomas. The bulk
+ * of the discussion is recorded in the file README.CV, which contains
+ * several generations of both colaborators original algorithms. The final
+ * algorithm used here is the one referred to as
+ *
+ * Algorithm 8a / IMPL_SEM,UNBLOCK_STRATEGY == UNBLOCK_ALL
+ *
+ * presented below in pseudo-code as it appeared:
+ *
+ *
+ * given:
+ * semBlockLock - bin.semaphore
+ * semBlockQueue - semaphore
+ * mtxExternal - mutex or CS
+ * mtxUnblockLock - mutex or CS
+ * nWaitersGone - int
+ * nWaitersBlocked - int
+ * nWaitersToUnblock - int
+ *
+ * wait( timeout ) {
+ *
+ * [auto: register int result ] // error checking omitted
+ * [auto: register int nSignalsWasLeft ]
+ * [auto: register int nWaitersWasGone ]
+ *
+ * sem_wait( semBlockLock );
+ * nWaitersBlocked++;
+ * sem_post( semBlockLock );
+ *
+ * unlock( mtxExternal );
+ * bTimedOut = sem_wait( semBlockQueue,timeout );
+ *
+ * lock( mtxUnblockLock );
+ * if ( 0 != (nSignalsWasLeft = nWaitersToUnblock) ) {
+ * if ( bTimeout ) { // timeout (or canceled)
+ * if ( 0 != nWaitersBlocked ) {
+ * nWaitersBlocked--;
+ * }
+ * else {
+ * nWaitersGone++; // count spurious wakeups.
+ * }
+ * }
+ * if ( 0 == --nWaitersToUnblock ) {
+ * if ( 0 != nWaitersBlocked ) {
+ * sem_post( semBlockLock ); // open the gate.
+ * nSignalsWasLeft = 0; // do not open the gate
+ * // below again.
+ * }
+ * else if ( 0 != (nWaitersWasGone = nWaitersGone) ) {
+ * nWaitersGone = 0;
+ * }
+ * }
+ * }
+ * else if ( INT_MAX/2 == ++nWaitersGone ) { // timeout/canceled or
+ * // spurious semaphore :-)
+ * sem_wait( semBlockLock );
+ * nWaitersBlocked -= nWaitersGone; // something is going on here
+ * // - test of timeouts? :-)
+ * sem_post( semBlockLock );
+ * nWaitersGone = 0;
+ * }
+ * unlock( mtxUnblockLock );
+ *
+ * if ( 1 == nSignalsWasLeft ) {
+ * if ( 0 != nWaitersWasGone ) {
+ * // sem_adjust( semBlockQueue,-nWaitersWasGone );
+ * while ( nWaitersWasGone-- ) {
+ * sem_wait( semBlockQueue ); // better now than spurious later
+ * }
+ * } sem_post( semBlockLock ); // open the gate
+ * }
+ *
+ * lock( mtxExternal );
+ *
+ * return ( bTimedOut ) ? ETIMEOUT : 0;
+ * }
+ *
+ * signal(bAll) {
+ *
+ * [auto: register int result ]
+ * [auto: register int nSignalsToIssue]
+ *
+ * lock( mtxUnblockLock );
+ *
+ * if ( 0 != nWaitersToUnblock ) { // the gate is closed!!!
+ * if ( 0 == nWaitersBlocked ) { // NO-OP
+ * return unlock( mtxUnblockLock );
+ * }
+ * if (bAll) {
+ * nWaitersToUnblock += nSignalsToIssue=nWaitersBlocked;
+ * nWaitersBlocked = 0;
+ * }
+ * else {
+ * nSignalsToIssue = 1;
+ * nWaitersToUnblock++;
+ * nWaitersBlocked--;
+ * }
+ * }
+ * else if ( nWaitersBlocked > nWaitersGone ) { // HARMLESS RACE CONDITION!
+ * sem_wait( semBlockLock ); // close the gate
+ * if ( 0 != nWaitersGone ) {
+ * nWaitersBlocked -= nWaitersGone;
+ * nWaitersGone = 0;
+ * }
+ * if (bAll) {
+ * nSignalsToIssue = nWaitersToUnblock = nWaitersBlocked;
+ * nWaitersBlocked = 0;
+ * }
+ * else {
+ * nSignalsToIssue = nWaitersToUnblock = 1;
+ * nWaitersBlocked--;
+ * }
+ * }
+ * else { // NO-OP
+ * return unlock( mtxUnblockLock );
+ * }
+ *
+ * unlock( mtxUnblockLock );
+ * sem_post( semBlockQueue,nSignalsToIssue );
+ * return result;
+ * }
+ *
+ * -------------------------------------------------------------
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright (C) 1998
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA
+ */
+
+#include "pthread.h"
+#include "implement.h"
+
+static INLINE int
+ptw32_cond_check_need_init (pthread_cond_t *cond)
+{
+ int result = 0;
+
+ /*
+ * The following guarded test is specifically for statically
+ * initialised condition variables (via PTHREAD_OBJECT_INITIALIZER).
+ *
+ * Note that by not providing this synchronisation we risk
+ * introducing race conditions into applications which are
+ * correctly written.
+ *
+ * Approach
+ * --------
+ * We know that static condition variables will not be PROCESS_SHARED
+ * so we can serialise access to internal state using
+ * Win32 Critical Sections rather than Win32 Mutexes.
+ *
+ * If using a single global lock slows applications down too much,
+ * multiple global locks could be created and hashed on some random
+ * value associated with each mutex, the pointer perhaps. At a guess,
+ * a good value for the optimal number of global locks might be
+ * the number of processors + 1.
+ *
+ */
+ EnterCriticalSection(&ptw32_cond_test_init_lock);
+
+ /*
+ * We got here possibly under race
+ * conditions. Check again inside the critical section.
+ * If a static cv has been destroyed, the application can
+ * re-initialise it only by calling pthread_cond_init()
+ * explicitly.
+ */
+ if (*cond == PTHREAD_COND_INITIALIZER)
+ {
+ result = pthread_cond_init(cond, NULL);
+ }
+ else if (*cond == NULL)
+ {
+ /*
+ * The cv has been destroyed while we were waiting to
+ * initialise it, so the operation that caused the
+ * auto-initialisation should fail.
+ */
+ result = EINVAL;
+ }
+
+ LeaveCriticalSection(&ptw32_cond_test_init_lock);
+
+ return result;
+}
+
+
+int
+pthread_condattr_init (pthread_condattr_t * attr)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * Initializes a condition variable attributes object
+ * with default attributes.
+ *
+ * PARAMETERS
+ * attr
+ * pointer to an instance of pthread_condattr_t
+ *
+ *
+ * DESCRIPTION
+ * Initializes a condition variable attributes object
+ * with default attributes.
+ *
+ * NOTES:
+ * 1) Use to define condition variable types
+ * 2) It is up to the application to ensure
+ * that it doesn't re-init an attribute
+ * without destroying it first. Otherwise
+ * a memory leak is created.
+ *
+ * RESULTS
+ * 0 successfully initialized attr,
+ * ENOMEM insufficient memory for attr.
+ *
+ * ------------------------------------------------------
+ */
+{
+ pthread_condattr_t attr_result;
+ int result = 0;
+
+ attr_result = (pthread_condattr_t) calloc (1, sizeof (*attr_result));
+
+ if (attr_result == NULL)
+ {
+ result = ENOMEM;
+ }
+
+ *attr = attr_result;
+
+ return result;
+
+} /* pthread_condattr_init */
+
+
+int
+pthread_condattr_destroy (pthread_condattr_t * attr)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * Destroys a condition variable attributes object.
+ * The object can no longer be used.
+ *
+ * PARAMETERS
+ * attr
+ * pointer to an instance of pthread_condattr_t
+ *
+ *
+ * DESCRIPTION
+ * Destroys a condition variable attributes object.
+ * The object can no longer be used.
+ *
+ * NOTES:
+ * 1) Does not affect condition variables created
+ * using 'attr'
+ *
+ * RESULTS
+ * 0 successfully released attr,
+ * EINVAL 'attr' is invalid.
+ *
+ * ------------------------------------------------------
+ */
+{
+ int result = 0;
+
+ if (attr == NULL || *attr == NULL)
+ {
+ result = EINVAL;
+ }
+ else
+ {
+ (void) free (*attr);
+
+ *attr = NULL;
+ result = 0;
+ }
+
+ return result;
+
+} /* pthread_condattr_destroy */
+
+
+int
+pthread_condattr_getpshared (const pthread_condattr_t * attr, int *pshared)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * Determine whether condition variables created with 'attr'
+ * can be shared between processes.
+ *
+ * PARAMETERS
+ * attr
+ * pointer to an instance of pthread_condattr_t
+ *
+ * pshared
+ * will be set to one of:
+ *
+ * PTHREAD_PROCESS_SHARED
+ * May be shared if in shared memory
+ *
+ * PTHREAD_PROCESS_PRIVATE
+ * Cannot be shared.
+ *
+ *
+ * DESCRIPTION
+ * Condition Variables created with 'attr' can be shared
+ * between processes if pthread_cond_t variable is allocated
+ * in memory shared by these processes.
+ * NOTES:
+ * 1) pshared condition variables MUST be allocated in
+ * shared memory.
+ *
+ * 2) The following macro is defined if shared mutexes
+ * are supported:
+ * _POSIX_THREAD_PROCESS_SHARED
+ *
+ * RESULTS
+ * 0 successfully retrieved attribute,
+ * EINVAL 'attr' is invalid,
+ *
+ * ------------------------------------------------------
+ */
+{
+ int result;
+
+ if ((attr != NULL && *attr != NULL) && (pshared != NULL))
+ {
+ *pshared = (*attr)->pshared;
+ result = 0;
+ }
+ else
+ {
+ *pshared = PTHREAD_PROCESS_PRIVATE;
+ result = EINVAL;
+ }
+
+ return result;
+
+} /* pthread_condattr_getpshared */
+
+
+int
+pthread_condattr_setpshared (pthread_condattr_t * attr, int pshared)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * Mutexes created with 'attr' can be shared between
+ * processes if pthread_mutex_t variable is allocated
+ * in memory shared by these processes.
+ *
+ * PARAMETERS
+ * attr
+ * pointer to an instance of pthread_mutexattr_t
+ *
+ * pshared
+ * must be one of:
+ *
+ * PTHREAD_PROCESS_SHARED
+ * May be shared if in shared memory
+ *
+ * PTHREAD_PROCESS_PRIVATE
+ * Cannot be shared.
+ *
+ * DESCRIPTION
+ * Mutexes creatd with 'attr' can be shared between
+ * processes if pthread_mutex_t variable is allocated
+ * in memory shared by these processes.
+ *
+ * NOTES:
+ * 1) pshared mutexes MUST be allocated in shared
+ * memory.
+ *
+ * 2) The following macro is defined if shared mutexes
+ * are supported:
+ * _POSIX_THREAD_PROCESS_SHARED
+ *
+ * RESULTS
+ * 0 successfully set attribute,
+ * EINVAL 'attr' or pshared is invalid,
+ * ENOSYS PTHREAD_PROCESS_SHARED not supported,
+ *
+ * ------------------------------------------------------
+ */
+{
+ int result;
+
+ if ((attr != NULL && *attr != NULL)
+ && ((pshared == PTHREAD_PROCESS_SHARED)
+ || (pshared == PTHREAD_PROCESS_PRIVATE)))
+ {
+ if (pshared == PTHREAD_PROCESS_SHARED)
+ {
+
+#if !defined( _POSIX_THREAD_PROCESS_SHARED )
+ result = ENOSYS;
+ pshared = PTHREAD_PROCESS_PRIVATE;
+#else
+ result = 0;
+
+#endif /* _POSIX_THREAD_PROCESS_SHARED */
+
+ }
+ else
+ {
+ result = 0;
+ }
+
+ (*attr)->pshared = pshared;
+ }
+ else
+ {
+ result = EINVAL;
+ }
+
+ return result;
+
+} /* pthread_condattr_setpshared */
+
+
+int
+pthread_cond_init (pthread_cond_t * cond, const pthread_condattr_t * attr)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * This function initializes a condition variable.
+ *
+ * PARAMETERS
+ * cond
+ * pointer to an instance of pthread_cond_t
+ *
+ * attr
+ * specifies optional creation attributes.
+ *
+ *
+ * DESCRIPTION
+ * This function initializes a condition variable.
+ *
+ * RESULTS
+ * 0 successfully created condition variable,
+ * EINVAL 'attr' is invalid,
+ * EAGAIN insufficient resources (other than
+ * memory,
+ * ENOMEM insufficient memory,
+ * EBUSY 'cond' is already initialized,
+ *
+ * ------------------------------------------------------
+ */
+{
+ int result;
+ pthread_cond_t cv = NULL;
+
+ if (cond == NULL)
+ {
+ return EINVAL;
+ }
+
+ if ((attr != NULL && *attr != NULL) &&
+ ((*attr)->pshared == PTHREAD_PROCESS_SHARED))
+ {
+ /*
+ * Creating condition variable that can be shared between
+ * processes.
+ */
+ result = ENOSYS;
+ goto DONE;
+ }
+
+ cv = (pthread_cond_t) calloc(1, sizeof (*cv));
+
+ if (cv == NULL)
+ {
+ result = ENOMEM;
+ goto DONE;
+ }
+
+ cv->nWaitersBlocked = 0;
+ cv->nWaitersUnblocked = 0;
+ cv->nWaitersToUnblock = 0;
+ cv->nWaitersGone = 0;
+
+ if (sem_init(&(cv->semBlockLock), 0, 1) != 0)
+ {
+ result = errno;
+ goto FAIL0;
+ }
+
+ if (sem_init(&(cv->semBlockQueue), 0, 0) != 0)
+ {
+ result = errno;
+ goto FAIL1;
+ }
+
+ if ((result = pthread_mutex_init(&(cv->mtxUnblockLock), 0)) != 0)
+ {
+ goto FAIL2;
+ }
+
+ result = 0;
+
+ goto DONE;
+
+ /*
+ * -------------
+ * Failed...
+ * -------------
+ */
+FAIL2:
+ (void) sem_destroy(&(cv->semBlockQueue));
+
+FAIL1:
+ (void) sem_destroy(&(cv->semBlockLock));
+
+FAIL0:
+ (void) free(cv);
+ cv = NULL;
+
+DONE:
+ *cond = cv;
+
+ return result;
+
+} /* pthread_cond_init */
+
+
+int
+pthread_cond_destroy (pthread_cond_t * cond)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * This function destroys a condition variable
+ *
+ *
+ * PARAMETERS
+ * cond
+ * pointer to an instance of pthread_cond_t
+ *
+ *
+ * DESCRIPTION
+ * This function destroys a condition variable.
+ *
+ * NOTES:
+ * 1) Safest after wakeup from 'cond', when
+ * no other threads will wait.
+ *
+ * RESULTS
+ * 0 successfully released condition variable,
+ * EINVAL 'cond' is invalid,
+ * EBUSY 'cond' is in use,
+ *
+ * ------------------------------------------------------
+ */
+{
+ pthread_cond_t cv;
+ int result = 0, result1 = 0, result2 = 0;
+
+ /*
+ * Assuming any race condition here is harmless.
+ */
+ if (cond == NULL
+ || *cond == NULL)
+ {
+ return EINVAL;
+ }
+
+ if (*cond != PTHREAD_COND_INITIALIZER)
+ {
+ cv = *cond;
+
+ /*
+ * Synchronize access to waiters blocked count (LEVEL-1)
+ */
+ if (sem_wait(&(cv->semBlockLock)) != 0)
+ {
+ return errno;
+ }
+
+ /*
+ * Synchronize access to waiters (to)unblock(ed) counts (LEVEL-2)
+ */
+ if ((result = pthread_mutex_lock(&(cv->mtxUnblockLock))) != 0)
+ {
+ (void) sem_post(&(cv->semBlockLock));
+ return result;
+ }
+
+ /*
+ * Check whether cv is still busy (still has waiters)
+ */
+ if (cv->nWaitersBlocked - cv->nWaitersGone - cv->nWaitersUnblocked > 0)
+ {
+ if (sem_post(&(cv->semBlockLock)) != 0)
+ {
+ result = errno;
+ }
+ result1 = pthread_mutex_unlock(&(cv->mtxUnblockLock));
+ result2 = EBUSY;
+ }
+ else
+ {
+ /*
+ * Now it is safe to destroy
+ */
+ *cond = NULL;
+ if (sem_destroy(&(cv->semBlockLock)) != 0)
+ {
+ result = errno;
+ }
+ if (sem_destroy(&(cv->semBlockQueue)) != 0)
+ {
+ result1 = errno;
+ }
+ if ((result2 = pthread_mutex_unlock(&(cv->mtxUnblockLock))) == 0)
+ {
+ result2 = pthread_mutex_destroy(&(cv->mtxUnblockLock));
+ }
+
+ (void) free(cv);
+ }
+ }
+ else
+ {
+ /*
+ * See notes in ptw32_cond_check_need_init() above also.
+ */
+ EnterCriticalSection(&ptw32_cond_test_init_lock);
+
+ /*
+ * Check again.
+ */
+ if (*cond == PTHREAD_COND_INITIALIZER)
+ {
+ /*
+ * This is all we need to do to destroy a statically
+ * initialised cond that has not yet been used (initialised).
+ * If we get to here, another thread
+ * waiting to initialise this cond will get an EINVAL.
+ */
+ *cond = NULL;
+ }
+ else
+ {
+ /*
+ * The cv has been initialised while we were waiting
+ * so assume it's in use.
+ */
+ result = EBUSY;
+ }
+
+ LeaveCriticalSection(&ptw32_cond_test_init_lock);
+ }
+
+ return ((result != 0) ? result : ((result1 != 0) ? result1 : result2));
+
+}
+
+/*
+ * Arguments for cond_wait_cleanup, since we can only pass a
+ * single void * to it.
+ */
+typedef struct {
+ pthread_mutex_t * mutexPtr;
+ pthread_cond_t cv;
+ int * resultPtr;
+ int signaled;
+} ptw32_cond_wait_cleanup_args_t;
+
+static void
+ptw32_cond_wait_cleanup(void * args)
+{
+ ptw32_cond_wait_cleanup_args_t * cleanup_args = (ptw32_cond_wait_cleanup_args_t *) args;
+ pthread_cond_t cv = cleanup_args->cv;
+ int * resultPtr = cleanup_args->resultPtr;
+ int nSignalsWasLeft;
+ int nWaitersWasGone = 0; /* Initialised to quell warnings. */
+ int result;
+
+ /*
+ * Whether we got here as a result of signal/broadcast or because of
+ * timeout on wait or thread cancellation we indicate that we are no
+ * longer waiting. The waiter is responsible for adjusting waiters
+ * (to)unblock(ed) counts (protected by unblock lock).
+ */
+ if ((result = pthread_mutex_lock(&(cv->mtxUnblockLock))) != 0)
+ {
+ *resultPtr = result;
+ return;
+ }
+
+ if ( 0 != (nSignalsWasLeft = cv->nWaitersToUnblock) )
+ {
+ if ( !cleanup_args->signaled )
+ {
+ if ( 0 != cv->nWaitersBlocked )
+ {
+ (cv->nWaitersBlocked)--;
+ }
+ else
+ {
+ (cv->nWaitersGone)++;
+ }
+ }
+ if ( 0 == --(cv->nWaitersToUnblock) )
+ {
+ if ( 0 != cv->nWaitersBlocked )
+ {
+ if (sem_post( &(cv->semBlockLock) ) != 0)
+ {
+ *resultPtr = errno;
+ /*
+ * This is a fatal error for this CV,
+ * so we deliberately don't unlock
+ * cv->mtxUnblockLock before returning.
+ */
+ return;
+ }
+ nSignalsWasLeft = 0;
+ }
+ else if ( 0 != (nWaitersWasGone = cv->nWaitersGone) )
+ {
+ cv->nWaitersGone = 0;
+ }
+ }
+ }
+ else if ( INT_MAX/2 == ++(cv->nWaitersGone) )
+ {
+ if (sem_wait( &(cv->semBlockLock) ) != 0)
+ {
+ *resultPtr = errno;
+ /*
+ * This is a fatal error for this CV,
+ * so we deliberately don't unlock
+ * cv->mtxUnblockLock before returning.
+ */
+ return;
+ }
+ cv->nWaitersBlocked -= cv->nWaitersGone;
+ if (sem_post( &(cv->semBlockLock) ) != 0)
+ {
+ *resultPtr = errno;
+ /*
+ * This is a fatal error for this CV,
+ * so we deliberately don't unlock
+ * cv->mtxUnblockLock before returning.
+ */
+ return;
+ }
+ cv->nWaitersGone = 0;
+ }
+
+ if ((result = pthread_mutex_unlock(&(cv->mtxUnblockLock))) != 0)
+ {
+ *resultPtr = result;
+ return;
+ }
+
+ if ( 1 == nSignalsWasLeft )
+ {
+ if ( 0 != nWaitersWasGone )
+ {
+ // sem_adjust( &(cv->semBlockQueue), -nWaitersWasGone );
+ while ( nWaitersWasGone-- )
+ {
+ if (sem_wait( &(cv->semBlockQueue)) != 0 )
+ {
+ *resultPtr = errno;
+ return;
+ }
+ }
+ }
+ if (sem_post(&(cv->semBlockLock)) != 0)
+ {
+ *resultPtr = errno;
+ return;
+ }
+ }
+
+ /*
+ * XSH: Upon successful return, the mutex has been locked and is owned
+ * by the calling thread
+ */
+ if ((result = pthread_mutex_lock(cleanup_args->mutexPtr)) != 0)
+ {
+ *resultPtr = result;
+ }
+
+} /* ptw32_cond_wait_cleanup */
+
+static INLINE int
+ptw32_cond_timedwait (pthread_cond_t * cond,
+ pthread_mutex_t * mutex,
+ const struct timespec *abstime)
+{
+ int result = 0;
+ pthread_cond_t cv;
+ ptw32_cond_wait_cleanup_args_t cleanup_args;
+
+ if (cond == NULL || *cond == NULL)
+ {
+ return EINVAL;
+ }
+
+ /*
+ * We do a quick check to see if we need to do more work
+ * to initialise a static condition variable. We check
+ * again inside the guarded section of ptw32_cond_check_need_init()
+ * to avoid race conditions.
+ */
+ if (*cond == PTHREAD_COND_INITIALIZER)
+ {
+ result = ptw32_cond_check_need_init(cond);
+ }
+
+ if (result != 0 && result != EBUSY)
+ {
+ return result;
+ }
+
+ cv = *cond;
+
+ if (sem_wait(&(cv->semBlockLock)) != 0)
+ {
+ return errno;
+ }
+
+ cv->nWaitersBlocked++;
+
+ if (sem_post(&(cv->semBlockLock)) != 0)
+ {
+ return errno;
+ }
+
+ /*
+ * Setup this waiter cleanup handler
+ */
+ cleanup_args.mutexPtr = mutex;
+ cleanup_args.cv = cv;
+ cleanup_args.resultPtr = &result;
+ /*
+ * If we're canceled, or the cancelable wait fails for any reason,
+ * including a timeout, then tell the cleanup routine that we
+ * have not been signaled.
+ */
+ cleanup_args.signaled = 0;
+
+ pthread_cleanup_push(ptw32_cond_wait_cleanup, (void *) &cleanup_args);
+
+ /*
+ * Now we can release 'mutex' and...
+ */
+ if ((result = pthread_mutex_unlock(mutex)) == 0)
+ {
+
+ /*
+ * ...wait to be awakened by
+ * pthread_cond_signal, or
+ * pthread_cond_broadcast, or
+ * timeout, or
+ * thread cancellation
+ *
+ * Note:
+ *
+ * ptw32_sem_timedwait is a cancellation point,
+ * hence providing the mechanism for making
+ * pthread_cond_wait a cancellation point.
+ * We use the cleanup mechanism to ensure we
+ * re-lock the mutex and adjust (to)unblock(ed) waiters
+ * counts if we are cancelled, timed out or signalled.
+ */
+ if (ptw32_sem_timedwait(&(cv->semBlockQueue), abstime) != 0)
+ {
+ result = errno;
+ }
+ }
+
+ /*
+ * Not executed if we're canceled. Signaled is false if we timed out.
+ */
+ cleanup_args.signaled = (result == 0);
+
+ /*
+ * Always cleanup
+ */
+ pthread_cleanup_pop(1);
+
+ /*
+ * "result" can be modified by the cleanup handler.
+ */
+ return result;
+
+} /* ptw32_cond_timedwait */
+
+
+static INLINE int
+ptw32_cond_unblock (pthread_cond_t * cond,
+ int unblockAll)
+ /*
+ * Notes.
+ *
+ * Does not use the external mutex for synchronisation,
+ * therefore semBlockLock is needed.
+ * mtxUnblockLock is for LEVEL-2 synch. LEVEL-2 is the
+ * state where the external mutex is not necessarily locked by
+ * any thread, ie. between cond_wait unlocking and re-acquiring
+ * the lock after having been signaled or a timeout or
+ * cancellation.
+ *
+ * Uses the following CV elements:
+ * nWaitersBlocked
+ * nWaitersToUnblock
+ * nWaitersGone
+ * mtxUnblockLock
+ * semBlockLock
+ * semBlockQueue
+ */
+{
+ int result;
+ pthread_cond_t cv;
+ int nSignalsToIssue;
+
+ if (cond == NULL || *cond == NULL)
+ {
+ return EINVAL;
+ }
+
+ cv = *cond;
+
+ /*
+ * No-op if the CV is static and hasn't been initialised yet.
+ * Assuming that any race condition is harmless.
+ */
+ if (cv == PTHREAD_COND_INITIALIZER)
+ {
+ return 0;
+ }
+
+ if ((result = pthread_mutex_lock(&(cv->mtxUnblockLock))) != 0)
+ {
+ return result;
+ }
+
+ if ( 0 != cv->nWaitersToUnblock )
+ {
+ if ( 0 == cv->nWaitersBlocked )
+ {
+ return pthread_mutex_unlock( &(cv->mtxUnblockLock) );
+ }
+ if (unblockAll)
+ {
+ cv->nWaitersToUnblock += (nSignalsToIssue = cv->nWaitersBlocked);
+ cv->nWaitersBlocked = 0;
+ }
+ else
+ {
+ nSignalsToIssue = 1;
+ cv->nWaitersToUnblock++;
+ cv->nWaitersBlocked--;
+ }
+ }
+ else if ( cv->nWaitersBlocked > cv->nWaitersGone )
+ {
+ if (sem_wait( &(cv->semBlockLock) ) != 0)
+ {
+ result = errno;
+ (void) pthread_mutex_unlock( &(cv->mtxUnblockLock) );
+ return result;
+ }
+ if ( 0 != cv->nWaitersGone )
+ {
+ cv->nWaitersBlocked -= cv->nWaitersGone;
+ cv->nWaitersGone = 0;
+ }
+ if (unblockAll)
+ {
+ nSignalsToIssue = cv->nWaitersToUnblock = cv->nWaitersBlocked;
+ cv->nWaitersBlocked = 0;
+ }
+ else
+ {
+ nSignalsToIssue = cv->nWaitersToUnblock = 1;
+ cv->nWaitersBlocked--;
+ }
+ }
+ else
+ {
+ return pthread_mutex_unlock( &(cv->mtxUnblockLock) );
+ }
+
+ if ((result = pthread_mutex_unlock( &(cv->mtxUnblockLock) )) == 0)
+ {
+ if (sem_post_multiple( &(cv->semBlockQueue), nSignalsToIssue ) != 0)
+ {
+ result = errno;
+ }
+ }
+
+ return result;
+
+} /* ptw32_cond_unblock */
+
+int
+pthread_cond_wait (pthread_cond_t * cond,
+ pthread_mutex_t * mutex)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * This function waits on a condition variable until
+ * awakened by a signal or broadcast.
+ *
+ * Caller MUST be holding the mutex lock; the
+ * lock is released and the caller is blocked waiting
+ * on 'cond'. When 'cond' is signaled, the mutex
+ * is re-acquired before returning to the caller.
+ *
+ * PARAMETERS
+ * cond
+ * pointer to an instance of pthread_cond_t
+ *
+ * mutex
+ * pointer to an instance of pthread_mutex_t
+ *
+ *
+ * DESCRIPTION
+ * This function waits on a condition variable until
+ * awakened by a signal or broadcast.
+ *
+ * NOTES:
+ *
+ * 1) The function must be called with 'mutex' LOCKED
+ * by the calling thread, or undefined behaviour
+ * will result.
+ *
+ * 2) This routine atomically releases 'mutex' and causes
+ * the calling thread to block on the condition variable.
+ * The blocked thread may be awakened by
+ * pthread_cond_signal or
+ * pthread_cond_broadcast.
+ *
+ * Upon successful completion, the 'mutex' has been locked and
+ * is owned by the calling thread.
+ *
+ *
+ * RESULTS
+ * 0 caught condition; mutex released,
+ * EINVAL 'cond' or 'mutex' is invalid,
+ * EINVAL different mutexes for concurrent waits,
+ * EINVAL mutex is not held by the calling thread,
+ *
+ * ------------------------------------------------------
+ */
+{
+ /*
+ * The NULL abstime arg means INFINITE waiting.
+ */
+ return (ptw32_cond_timedwait(cond, mutex, NULL));
+
+} /* pthread_cond_wait */
+
+
+int
+pthread_cond_timedwait (pthread_cond_t * cond,
+ pthread_mutex_t * mutex,
+ const struct timespec *abstime)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * This function waits on a condition variable either until
+ * awakened by a signal or broadcast; or until the time
+ * specified by abstime passes.
+ *
+ * PARAMETERS
+ * cond
+ * pointer to an instance of pthread_cond_t
+ *
+ * mutex
+ * pointer to an instance of pthread_mutex_t
+ *
+ * abstime
+ * pointer to an instance of (const struct timespec)
+ *
+ *
+ * DESCRIPTION
+ * This function waits on a condition variable either until
+ * awakened by a signal or broadcast; or until the time
+ * specified by abstime passes.
+ *
+ * NOTES:
+ * 1) The function must be called with 'mutex' LOCKED
+ * by the calling thread, or undefined behaviour
+ * will result.
+ *
+ * 2) This routine atomically releases 'mutex' and causes
+ * the calling thread to block on the condition variable.
+ * The blocked thread may be awakened by
+ * pthread_cond_signal or
+ * pthread_cond_broadcast.
+ *
+ *
+ * RESULTS
+ * 0 caught condition; mutex released,
+ * EINVAL 'cond', 'mutex', or abstime is invalid,
+ * EINVAL different mutexes for concurrent waits,
+ * EINVAL mutex is not held by the calling thread,
+ * ETIMEDOUT abstime ellapsed before cond was signaled.
+ *
+ * ------------------------------------------------------
+ */
+{
+ if (abstime == NULL)
+ {
+ return EINVAL;
+ }
+
+ return (ptw32_cond_timedwait(cond, mutex, abstime));
+
+} /* pthread_cond_timedwait */
+
+
+int
+pthread_cond_signal (pthread_cond_t * cond)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * This function signals a condition variable, waking
+ * one waiting thread.
+ * If SCHED_FIFO or SCHED_RR policy threads are waiting
+ * the highest priority waiter is awakened; otherwise,
+ * an unspecified waiter is awakened.
+ *
+ * PARAMETERS
+ * cond
+ * pointer to an instance of pthread_cond_t
+ *
+ *
+ * DESCRIPTION
+ * This function signals a condition variable, waking
+ * one waiting thread.
+ * If SCHED_FIFO or SCHED_RR policy threads are waiting
+ * the highest priority waiter is awakened; otherwise,
+ * an unspecified waiter is awakened.
+ *
+ * NOTES:
+ *
+ * 1) Use when any waiter can respond and only one need
+ * respond (all waiters being equal).
+ *
+ * RESULTS
+ * 0 successfully signaled condition,
+ * EINVAL 'cond' is invalid,
+ *
+ * ------------------------------------------------------
+ */
+{
+ /*
+ * The '0'(FALSE) unblockAll arg means unblock ONE waiter.
+ */
+ return (ptw32_cond_unblock(cond, 0));
+
+} /* pthread_cond_signal */
+
+int
+pthread_cond_broadcast (pthread_cond_t * cond)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * This function broadcasts the condition variable,
+ * waking all current waiters.
+ *
+ * PARAMETERS
+ * cond
+ * pointer to an instance of pthread_cond_t
+ *
+ *
+ * DESCRIPTION
+ * This function signals a condition variable, waking
+ * all waiting threads.
+ *
+ * NOTES:
+ *
+ * 1) Use when more than one waiter may respond to
+ * predicate change or if any waiting thread may
+ * not be able to respond
+ *
+ * RESULTS
+ * 0 successfully signalled condition to all
+ * waiting threads,
+ * EINVAL 'cond' is invalid
+ * ENOSPC a required resource has been exhausted,
+ *
+ * ------------------------------------------------------
+ */
+{
+ /*
+ * The '1'(TRUE) unblockAll arg means unblock ALL waiters.
+ */
+ return (ptw32_cond_unblock(cond, 1));
+
+} /* pthread_cond_broadcast */
diff --git a/win32/contrib/pthreads/config.guess b/win32/contrib/pthreads/config.guess new file mode 100644 index 000000000..2d6119a9a --- /dev/null +++ b/win32/contrib/pthreads/config.guess @@ -0,0 +1,940 @@ +#! /bin/sh
+# Attempt to guess a canonical system name.
+# Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
+#
+# This file 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 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Written by Per Bothner <bothner@cygnus.com>.
+# The master version of this file is at the FSF in /home/gd/gnu/lib.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub. If it succeeds, it prints the system name on stdout, and
+# exits with 0. Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit system type (host/target name).
+#
+# Only a few systems have been added to this list; please add others
+# (but try to keep the structure clean).
+#
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 8/24/94.)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+ PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ alpha:OSF1:*:*)
+ if test $UNAME_RELEASE = "V4.0"; then
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+ fi
+ # A Vn.n version is a released version.
+ # A Tn.n version is a released field test version.
+ # A Xn.n version is an unreleased experimental baselevel.
+ # 1.2 uses "1.2" for uname -r.
+ cat <<EOF >dummy.s
+ .globl main
+ .ent main
+main:
+ .frame \$30,0,\$26,0
+ .prologue 0
+ .long 0x47e03d80 # implver $0
+ lda \$2,259
+ .long 0x47e20c21 # amask $2,$1
+ srl \$1,8,\$2
+ sll \$2,2,\$2
+ sll \$0,3,\$0
+ addl \$1,\$0,\$0
+ addl \$2,\$0,\$0
+ ret \$31,(\$26),1
+ .end main
+EOF
+ ${CC-cc} dummy.s -o dummy 2>/dev/null
+ if test "$?" = 0 ; then
+ ./dummy
+ case "$?" in
+ 7)
+ UNAME_MACHINE="alpha"
+ ;;
+ 15)
+ UNAME_MACHINE="alphaev5"
+ ;;
+ 14)
+ UNAME_MACHINE="alphaev56"
+ ;;
+ 10)
+ UNAME_MACHINE="alphapca56"
+ ;;
+ 16)
+ UNAME_MACHINE="alphaev6"
+ ;;
+ esac
+ fi
+ rm -f dummy.s dummy
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]`
+ exit 0 ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+ exit 0 ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-cbm-sysv4
+ exit 0;;
+ amiga:NetBSD:*:*)
+ echo m68k-cbm-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ amiga:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ *:[Aa]miga[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-amigaos
+ exit 0 ;;
+ arc64:OpenBSD:*:*)
+ echo mips64el-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ arc:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ hkmips:OpenBSD:*:*)
+ echo mips-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ pmax:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sgi:OpenBSD:*:*)
+ echo mips-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ wgrisc:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+ exit 0;;
+ arm32:NetBSD:*:*)
+ echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ exit 0 ;;
+ SR2?01:HI-UX/MPP:*:*)
+ echo hppa1.1-hitachi-hiuxmpp
+ exit 0;;
+ Pyramid*:OSx*:*:*|MIS*:OSx*:*:*)
+ # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+ if test "`(/bin/universe) 2>/dev/null`" = att ; then
+ echo pyramid-pyramid-sysv3
+ else
+ echo pyramid-pyramid-bsd
+ fi
+ exit 0 ;;
+ NILE:*:*:dcosx)
+ echo pyramid-pyramid-svr4
+ exit 0 ;;
+ sun4H:SunOS:5.*:*)
+ echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ i86pc:SunOS:5.*:*)
+ echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:*:*)
+ case "`/usr/bin/arch -k`" in
+ Series*|S4*)
+ UNAME_RELEASE=`uname -v`
+ ;;
+ esac
+ # Japanese Language versions have a version number like `4.1.3-JL'.
+ echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+ exit 0 ;;
+ sun3*:SunOS:*:*)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ exit 0 ;;
+ sun*:*:4.2BSD:*)
+ UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+ case "`/bin/arch`" in
+ sun3)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ ;;
+ sun4)
+ echo sparc-sun-sunos${UNAME_RELEASE}
+ ;;
+ esac
+ exit 0 ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:NetBSD:*:*)
+ echo m68k-atari-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sun3*:NetBSD:*:*)
+ echo m68k-sun-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sun3*:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mac68k:NetBSD:*:*)
+ echo m68k-apple-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mac68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme88k:OpenBSD:*:*)
+ echo m88k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten${UNAME_RELEASE}
+ exit 0 ;;
+ macppc:NetBSD:*:*)
+ echo powerpc-apple-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+ exit 0 ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ 2020:CLIX:*:*)
+ echo clipper-intergraph-clix${UNAME_RELEASE}
+ exit 0 ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ sed 's/^ //' << EOF >dummy.c
+ int main (argc, argv) int argc; char **argv; {
+ #if defined (host_mips) && defined (MIPSEB)
+ #if defined (SYSTYPE_SYSV)
+ printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_SVR4)
+ printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+ printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+ #endif
+ #endif
+ exit (-1);
+ }
+EOF
+ ${CC-cc} dummy.c -o dummy \
+ && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+ && rm dummy.c dummy && exit 0
+ rm -f dummy.c dummy
+ echo mips-mips-riscos${UNAME_RELEASE}
+ exit 0 ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerunix
+ exit 0 ;;
+ m88k:CX/UX:7*:*)
+ echo m88k-harris-cxux7
+ exit 0 ;;
+ m88k:*:4*:R4*)
+ echo m88k-motorola-sysv4
+ exit 0 ;;
+ m88k:*:3*:R3*)
+ echo m88k-motorola-sysv3
+ exit 0 ;;
+ AViiON:dgux:*:*)
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
+ -o ${TARGET_BINARY_INTERFACE}x = x ] ; then
+ echo m88k-dg-dgux${UNAME_RELEASE}
+ else
+ echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ fi
+ else echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+ exit 0 ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ echo m88k-motorola-sysv3
+ exit 0 ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ echo m88k-tektronix-sysv3
+ exit 0 ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ echo m68k-tektronix-bsd
+ exit 0 ;;
+ *:IRIX*:*:*)
+ echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+ exit 0 ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i?86:AIX:*:*)
+ echo i386-ibm-aix
+ exit 0 ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ sed 's/^ //' << EOF >dummy.c
+ #include <sys/systemcfg.h>
+
+ main()
+ {
+ if (!__power_pc())
+ exit(1);
+ puts("powerpc-ibm-aix3.2.5");
+ exit(0);
+ }
+EOF
+ ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
+ rm -f dummy.c dummy
+ echo rs6000-ibm-aix3.2.5
+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ echo rs6000-ibm-aix3.2.4
+ else
+ echo rs6000-ibm-aix3.2
+ fi
+ exit 0 ;;
+ *:AIX:*:4)
+ if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+ else
+ IBM_ARCH=powerpc
+ fi
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=4.${UNAME_RELEASE}
+ fi
+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+ exit 0 ;;
+ *:AIX:*:*)
+ echo rs6000-ibm-aix
+ exit 0 ;;
+ ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+ echo romp-ibm-bsd4.4
+ exit 0 ;;
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
+ echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
+ exit 0 ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ echo rs6000-bull-bosx
+ exit 0 ;;
+ DPX/2?00:B.O.S.:*:*)
+ echo m68k-bull-sysv3
+ exit 0 ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ echo m68k-hp-bsd
+ exit 0 ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ echo m68k-hp-bsd4.4
+ exit 0 ;;
+ 9000/[3478]??:HP-UX:*:*)
+ case "${UNAME_MACHINE}" in
+ 9000/31? ) HP_ARCH=m68000 ;;
+ 9000/[34]?? ) HP_ARCH=m68k ;;
+ 9000/7?? | 9000/8?[1679] )
+ sed 's/^ //' << EOF >dummy.c
+ #include <stdlib.h>
+ #include <unistd.h>
+
+ int main ()
+ {
+ #if defined(_SC_KERNEL_BITS)
+ long bits = sysconf(_SC_KERNEL_BITS);
+ #endif
+ long cpu = sysconf (_SC_CPU_VERSION);
+
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+ case CPU_PA_RISC2_0:
+ #if defined(_SC_KERNEL_BITS)
+ switch (bits)
+ {
+ case 64: puts ("hppa2.0w"); break;
+ case 32: puts ("hppa2.0n"); break;
+ default: puts ("hppa2.0"); break;
+ } break;
+ #else /* !defined(_SC_KERNEL_BITS) */
+ puts ("hppa2.0"); break;
+ #endif
+ default: puts ("hppa1.0"); break;
+ }
+ exit (0);
+ }
+EOF
+ ${CC-cc} dummy.c -o dummy && HP_ARCH=`./dummy`
+ rm -f dummy.c dummy
+ esac
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ exit 0 ;;
+ 3050*:HI-UX:*:*)
+ sed 's/^ //' << EOF >dummy.c
+ #include <unistd.h>
+ int
+ main ()
+ {
+ long cpu = sysconf (_SC_CPU_VERSION);
+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
+ results, however. */
+ if (CPU_IS_PA_RISC (cpu))
+ {
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+ default: puts ("hppa-hitachi-hiuxwe2"); break;
+ }
+ }
+ else if (CPU_IS_HP_MC68K (cpu))
+ puts ("m68k-hitachi-hiuxwe2");
+ else puts ("unknown-hitachi-hiuxwe2");
+ exit (0);
+ }
+EOF
+ ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
+ rm -f dummy.c dummy
+ echo unknown-hitachi-hiuxwe2
+ exit 0 ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+ echo hppa1.1-hp-bsd
+ exit 0 ;;
+ 9000/8??:4.3bsd:*:*)
+ echo hppa1.0-hp-bsd
+ exit 0 ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ echo hppa1.1-hp-osf
+ exit 0 ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+ exit 0 ;;
+ i?86:OSF1:*:*)
+ if [ -x /usr/sbin/sysversion ] ; then
+ echo ${UNAME_MACHINE}-unknown-osf1mk
+ else
+ echo ${UNAME_MACHINE}-unknown-osf1
+ fi
+ exit 0 ;;
+ parisc*:Lites*:*:*)
+ echo hppa1.1-hp-lites
+ exit 0 ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+ exit 0 ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit 0 ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+ exit 0 ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+ exit 0 ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+ exit 0 ;;
+ CRAY*X-MP:*:*:*)
+ echo xmp-cray-unicos
+ exit 0 ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE}
+ exit 0 ;;
+ CRAY*[A-Z]90:*:*:*)
+ echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
+ exit 0 ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos${UNAME_RELEASE}
+ exit 0 ;;
+ CRAY-2:*:*:*)
+ echo cray2-cray-unicos
+ exit 0 ;;
+ F300:UNIX_System_V:*:*)
+ FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit 0 ;;
+ F301:UNIX_System_V:*:*)
+ echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
+ exit 0 ;;
+ hp3[0-9][05]:NetBSD:*:*)
+ echo m68k-hp-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ hp300:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ i?86:BSD/386:*:* | *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ *:FreeBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit 0 ;;
+ *:NetBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ exit 0 ;;
+ *:OpenBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ exit 0 ;;
+ i*:CYGWIN*:*)
+ echo ${UNAME_MACHINE}-pc-cygwin32
+ exit 0 ;;
+ i*:MINGW*:*)
+ echo ${UNAME_MACHINE}-pc-mingw32
+ exit 0 ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-unknown-cygwin32
+ exit 0 ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ *:GNU:*:*)
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ exit 0 ;;
+ *:Linux:*:*)
+ # uname on the ARM produces all sorts of strangeness, and we need to
+ # filter it out.
+ case "$UNAME_MACHINE" in
+ arm* | sa110*) UNAME_MACHINE="arm" ;;
+ esac
+
+ # The BFD linker knows what the default object file format is, so
+ # first see if it will tell us.
+ ld_help_string=`ld --help 2>&1`
+ ld_supported_emulations=`echo $ld_help_string \
+ | sed -ne '/supported emulations:/!d
+ s/[ ][ ]*/ /g
+ s/.*supported emulations: *//
+ s/ .*//
+ p'`
+ case "$ld_supported_emulations" in
+ i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;;
+ i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;;
+ sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
+ armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
+ m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
+ elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;;
+ esac
+
+ if test "${UNAME_MACHINE}" = "alpha" ; then
+ sed 's/^ //' <<EOF >dummy.s
+ .globl main
+ .ent main
+ main:
+ .frame \$30,0,\$26,0
+ .prologue 0
+ .long 0x47e03d80 # implver $0
+ lda \$2,259
+ .long 0x47e20c21 # amask $2,$1
+ srl \$1,8,\$2
+ sll \$2,2,\$2
+ sll \$0,3,\$0
+ addl \$1,\$0,\$0
+ addl \$2,\$0,\$0
+ ret \$31,(\$26),1
+ .end main
+EOF
+ LIBC=""
+ ${CC-cc} dummy.s -o dummy 2>/dev/null
+ if test "$?" = 0 ; then
+ ./dummy
+ case "$?" in
+ 7)
+ UNAME_MACHINE="alpha"
+ ;;
+ 15)
+ UNAME_MACHINE="alphaev5"
+ ;;
+ 14)
+ UNAME_MACHINE="alphaev56"
+ ;;
+ 10)
+ UNAME_MACHINE="alphapca56"
+ ;;
+ 16)
+ UNAME_MACHINE="alphaev6"
+ ;;
+ esac
+
+ objdump --private-headers dummy | \
+ grep ld.so.1 > /dev/null
+ if test "$?" = 0 ; then
+ LIBC="libc1"
+ fi
+ fi
+ rm -f dummy.s dummy
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
+ elif test "${UNAME_MACHINE}" = "mips" ; then
+ cat >dummy.c <<EOF
+main(argc, argv)
+ int argc;
+ char *argv[];
+{
+#ifdef __MIPSEB__
+ printf ("%s-unknown-linux-gnu\n", argv[1]);
+#endif
+#ifdef __MIPSEL__
+ printf ("%sel-unknown-linux-gnu\n", argv[1]);
+#endif
+ return 0;
+}
+EOF
+ ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
+ rm -f dummy.c dummy
+ else
+ # Either a pre-BFD a.out linker (linux-gnuoldld)
+ # or one that does not give us useful --help.
+ # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
+ # If ld does not provide *any* "supported emulations:"
+ # that means it is gnuoldld.
+ echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:"
+ test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
+
+ case "${UNAME_MACHINE}" in
+ i?86)
+ VENDOR=pc;
+ ;;
+ *)
+ VENDOR=unknown;
+ ;;
+ esac
+ # Determine whether the default compiler is a.out or elf
+ cat >dummy.c <<EOF
+#include <features.h>
+main(argc, argv)
+ int argc;
+ char *argv[];
+{
+#ifdef __ELF__
+# ifdef __GLIBC__
+# if __GLIBC__ >= 2
+ printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
+# else
+ printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
+# endif
+# else
+ printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
+# endif
+#else
+ printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
+#endif
+ return 0;
+}
+EOF
+ ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
+ rm -f dummy.c dummy
+ fi ;;
+# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
+# are messed up and put the nodename in both sysname and nodename.
+ i?86:DYNIX/ptx:4*:*)
+ echo i386-sequent-sysv4
+ exit 0 ;;
+ i?86:UNIX_SV:4.2MP:2.*)
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+ # I am not positive that other SVR4 systems won't match this,
+ # I just have to hope. -- rms.
+ # Use sysv4.2uw... so that sysv4* matches it.
+ echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ exit 0 ;;
+ i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ i?86:*:3.2:*)
+ if test -f /usr/options/cb.name; then
+ UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+ elif /bin/uname -X 2>/dev/null >/dev/null ; then
+ UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ else
+ echo ${UNAME_MACHINE}-pc-sysv32
+ fi
+ exit 0 ;;
+ pc:*:*:*)
+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
+ # the processor, so we play safe by assuming i386.
+ echo i386-pc-msdosdjgpp
+ exit 0 ;;
+ Intel:Mach:3*:*)
+ echo i386-pc-mach3
+ exit 0 ;;
+ paragon:*:*:*)
+ echo i860-intel-osf1
+ exit 0 ;;
+ i860:*:4.*:*) # i860-SVR4
+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+ echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ fi
+ exit 0 ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+ exit 0 ;;
+ M68*:*:R3V[567]*:*)
+ test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+ 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4.3${OS_REL} && exit 0
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4 && exit 0 ;;
+ m68*:LynxOS:2.*:*)
+ echo m68k-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+ exit 0 ;;
+ i?86:LynxOS:2.*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
+ echo rs6000-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv${UNAME_RELEASE}
+ exit 0 ;;
+ RM*:SINIX-*:*:*)
+ echo mips-sni-sysv4
+ exit 0 ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ echo ${UNAME_MACHINE}-sni-sysv4
+ else
+ echo ns32k-sni-sysv
+ fi
+ exit 0 ;;
+ PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit 0 ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes <hewes@openmarket.com>.
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+ exit 0 ;;
+ *:*:*:FTX*)
+ # From seanf@swdc.stratus.com.
+ echo i860-stratus-sysv4
+ exit 0 ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+ exit 0 ;;
+ news*:NEWS-OS:*:6*)
+ echo mips-sony-newsos6
+ exit 0 ;;
+ R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R4000:UNIX_SV:*:*)
+ if [ -d /usr/nec ]; then
+ echo mips-nec-sysv${UNAME_RELEASE}
+ else
+ echo mips-unknown-sysv${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
+ echo powerpc-be-beos
+ exit 0 ;;
+ BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
+ echo powerpc-apple-beos
+ exit 0 ;;
+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
+ echo i586-pc-beos
+ exit 0 ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+cat >dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+ printf ("arm-acorn-riscix"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+ printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+#if !defined (ultrix)
+ printf ("vax-dec-bsd\n"); exit (0);
+#else
+ printf ("vax-dec-ultrix\n"); exit (0);
+#endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
+rm -f dummy.c dummy
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+ case `getsysinfo -f cpu_type` in
+ c1*)
+ echo c1-convex-bsd
+ exit 0 ;;
+ c2*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit 0 ;;
+ c34*)
+ echo c34-convex-bsd
+ exit 0 ;;
+ c38*)
+ echo c38-convex-bsd
+ exit 0 ;;
+ c4*)
+ echo c4-convex-bsd
+ exit 0 ;;
+ esac
+fi
+
+#echo '(Unable to guess system type)' 1>&2
+
+exit 1
diff --git a/win32/contrib/pthreads/config.h b/win32/contrib/pthreads/config.h new file mode 100644 index 000000000..4f5679120 --- /dev/null +++ b/win32/contrib/pthreads/config.h @@ -0,0 +1,68 @@ +/* config.h.in Generated automatically from configure.in by autoheader. */
+
+#ifndef PTW32_CONFIG_H
+#define PTW32_CONFIG_H
+
+/* Do we know about the C type sigset_t? */
+#undef HAVE_SIGSET_T
+
+/* Define if you have the <signal.h> header file. */
+#undef HAVE_SIGNAL_H
+
+/* Define if you don't have Win32 DuplicateHandle. (eg. WinCE) */
+#undef NEED_DUPLICATEHANDLE
+
+/* Define if you don't have Win32 _beginthreadex. (eg. WinCE) */
+#undef NEED_CREATETHREAD
+
+/* Define if you don't have Win32 errno. (eg. WinCE) */
+#undef NEED_ERRNO
+
+/* Define if you don't have Win32 calloc. (eg. WinCE) */
+#undef NEED_CALLOC
+
+/* Define if you don't have Win32 ftime. (eg. WinCE) */
+#undef NEED_FTIME
+
+/* Define if you don't have Win32 semaphores. (eg. WinCE) */
+#undef NEED_SEM
+
+/* Define if you need to convert string parameters to unicode. (eg. WinCE) */
+#undef NEED_UNICODE_CONSTS
+
+/* Define if your C (not C++) compiler supports "inline" functions. */
+#undef HAVE_C_INLINE
+
+/* Do we know about type mode_t? */
+#undef HAVE_MODE_T
+
+/* Define if you have the timespec struct */
+#undef HAVE_STRUCT_TIMESPEC
+
+/*
+ * Target specific groups
+ */
+#ifdef WINCE
+#define NEED_DUPLICATEHANDLE
+#define NEED_CREATETHREAD
+#define NEED_ERRNO
+#define NEED_CALLOC
+#define NEED_FTIME
+#define NEED_SEM
+#define NEED_UNICODE_CONSTS
+#endif
+
+#ifdef _UWIN
+#define HAVE_MODE_T
+#define HAVE_STRUCT_TIMESPEC
+#endif
+
+#ifdef __GNUC__
+#define HAVE_C_INLINE
+#endif
+
+#ifdef __MINGW32__
+#define HAVE_MODE_T
+#endif
+
+#endif
\ No newline at end of file diff --git a/win32/contrib/pthreads/config.h.in b/win32/contrib/pthreads/config.h.in new file mode 100644 index 000000000..dad5a212d --- /dev/null +++ b/win32/contrib/pthreads/config.h.in @@ -0,0 +1,61 @@ +/* config.h.in. Generated automatically from configure.in by autoheader. */
+
+#ifndef PTW32_CONFIG_H
+#define PTW32_CONFIG_H
+
+/* Do we know about the C type sigset_t? */
+#undef HAVE_SIGSET_T
+
+/* Define if you have the <signal.h> header file. */
+#undef HAVE_SIGNAL_H
+
+/* Define if you don't have Win32 DuplicateHandle. (eg. WinCE) */
+#undef NEED_DUPLICATEHANDLE
+
+/* Define if you don't have Win32 _beginthreadex. (eg. WinCE) */
+#undef NEED_CREATETHREAD
+
+/* Define if you don't have Win32 errno. (eg. WinCE) */
+#undef NEED_ERRNO
+
+/* Define if you don't have Win32 calloc. (eg. WinCE) */
+#undef NEED_CALLOC
+
+/* Define if you don't have Win32 ftime. (eg. WinCE) */
+#undef NEED_FTIME
+
+/* Define if you don't have Win32 semaphores. (eg. WinCE) */
+#undef NEED_SEM
+
+/* Define if you need to convert string parameters to unicode. (eg. WinCE) */
+#undef NEED_UNICODE_CONSTS
+
+/* Do we know about type mode_t? */
+#undef HAVE_MODE_T
+
+/* Define if you have the timespec struct */
+#undef HAVE_STRUCT_TIMESPEC
+
+/*
+ * Target specific groups
+ */
+#ifdef WINCE
+#define NEED_DUPLICATEHANDLE
+#define NEED_CREATETHREAD
+#define NEED_ERRNO
+#define NEED_CALLOC
+#define NEED_FTIME
+#define NEED_SEM
+#define NEED_UNICODE_CONSTS
+#endif
+
+#ifdef _UWIN
+#define HAVE_MODE_T
+#define HAVE_STRUCT_TIMESPEC
+#endif
+
+#ifdef __MINGW32__
+#define HAVE_MODE_T
+#endif
+
+#endif
\ No newline at end of file diff --git a/win32/contrib/pthreads/config.sub b/win32/contrib/pthreads/config.sub new file mode 100644 index 000000000..c90c43d9f --- /dev/null +++ b/win32/contrib/pthreads/config.sub @@ -0,0 +1,956 @@ +#! /bin/sh
+# Configuration validation subroutine script, version 1.1.
+# Copyright (C) 1991, 92-97, 1998 Free Software Foundation, Inc.
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine. It does not imply ALL GNU software can.
+#
+# This file 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 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support. The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+if [ x$1 = x ]
+then
+ echo Configuration name missing. 1>&2
+ echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
+ echo "or $0 ALIAS" 1>&2
+ echo where ALIAS is a recognized configuration type. 1>&2
+ exit 1
+fi
+
+# First pass through any local machine types.
+case $1 in
+ *local*)
+ echo $1
+ exit 0
+ ;;
+ *)
+ ;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+ linux-gnu*)
+ os=-$maybe_os
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
+ *)
+ basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+ if [ $basic_machine != $1 ]
+ then os=`echo $1 | sed 's/.*-/-/'`
+ else os=; fi
+ ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work. We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+ -sun*os*)
+ # Prevent following clause from handling this invalid input.
+ ;;
+ -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+ -apple)
+ os=
+ basic_machine=$1
+ ;;
+ -hiux*)
+ os=-hiuxwe2
+ ;;
+ -sco5)
+ os=sco3.2v5
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco4)
+ os=-sco3.2v4
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2.[4-9]*)
+ os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2v[4-9]*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco*)
+ os=-sco3.2v2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -isc)
+ os=-isc2.2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -clix*)
+ basic_machine=clipper-intergraph
+ ;;
+ -isc*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -lynx*)
+ os=-lynxos
+ ;;
+ -ptx*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+ ;;
+ -windowsnt*)
+ os=`echo $os | sed -e 's/windowsnt/winnt/'`
+ ;;
+ -psos*)
+ os=-psos
+ ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+ # Recognize the basic CPU types without company name.
+ # Some are omitted here because they have special meanings below.
+ tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
+ | arme[lb] | pyramid | mn10200 | mn10300 \
+ | tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \
+ | hppa2.0 \
+ | alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \
+ | i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \
+ | mips64 | mipsel | mips64el | mips64orion | mips64orionel \
+ | mipstx39 | mipstx39el \
+ | sparc | sparclet | sparclite | sparc64 | v850)
+ basic_machine=$basic_machine-unknown
+ ;;
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+ # (2) the word "unknown" tends to confuse beginning users.
+ i[34567]86)
+ basic_machine=$basic_machine-pc
+ ;;
+ # Object if more than one company name word.
+ *-*-*)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+ # Recognize the basic CPU types with company name.
+ vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \
+ | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
+ | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
+ | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \
+ | xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* \
+ | alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \
+ | ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \
+ | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
+ | sparc64-* | mips64-* | mipsel-* \
+ | mips64el-* | mips64orion-* | mips64orionel-* \
+ | mipstx39-* | mipstx39el-* \
+ | f301-*)
+ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+ 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+ basic_machine=m68000-att
+ ;;
+ 3b*)
+ basic_machine=we32k-att
+ ;;
+ alliant | fx80)
+ basic_machine=fx80-alliant
+ ;;
+ altos | altos3068)
+ basic_machine=m68k-altos
+ ;;
+ am29k)
+ basic_machine=a29k-none
+ os=-bsd
+ ;;
+ amdahl)
+ basic_machine=580-amdahl
+ os=-sysv
+ ;;
+ amiga | amiga-*)
+ basic_machine=m68k-cbm
+ ;;
+ amigaos | amigados)
+ basic_machine=m68k-cbm
+ os=-amigaos
+ ;;
+ amigaunix | amix)
+ basic_machine=m68k-cbm
+ os=-sysv4
+ ;;
+ apollo68)
+ basic_machine=m68k-apollo
+ os=-sysv
+ ;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+ ;;
+ balance)
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ os=-bsd
+ ;;
+ convex-c2)
+ basic_machine=c2-convex
+ os=-bsd
+ ;;
+ convex-c32)
+ basic_machine=c32-convex
+ os=-bsd
+ ;;
+ convex-c34)
+ basic_machine=c34-convex
+ os=-bsd
+ ;;
+ convex-c38)
+ basic_machine=c38-convex
+ os=-bsd
+ ;;
+ cray | ymp)
+ basic_machine=ymp-cray
+ os=-unicos
+ ;;
+ cray2)
+ basic_machine=cray2-cray
+ os=-unicos
+ ;;
+ [ctj]90-cray)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ ;;
+ da30 | da30-*)
+ basic_machine=m68k-da30
+ ;;
+ decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+ basic_machine=mips-dec
+ ;;
+ delta | 3300 | motorola-3300 | motorola-delta \
+ | 3300-motorola | delta-motorola)
+ basic_machine=m68k-motorola
+ ;;
+ delta88)
+ basic_machine=m88k-motorola
+ os=-sysv3
+ ;;
+ dpx20 | dpx20-*)
+ basic_machine=rs6000-bull
+ os=-bosx
+ ;;
+ dpx2* | dpx2*-bull)
+ basic_machine=m68k-bull
+ os=-sysv3
+ ;;
+ ebmon29k)
+ basic_machine=a29k-amd
+ os=-ebmon
+ ;;
+ elxsi)
+ basic_machine=elxsi-elxsi
+ os=-bsd
+ ;;
+ encore | umax | mmax)
+ basic_machine=ns32k-encore
+ ;;
+ fx2800)
+ basic_machine=i860-alliant
+ ;;
+ genix)
+ basic_machine=ns32k-ns
+ ;;
+ gmicro)
+ basic_machine=tron-gmicro
+ os=-sysv
+ ;;
+ h3050r* | hiux*)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ h8300hms)
+ basic_machine=h8300-hitachi
+ os=-hms
+ ;;
+ harris)
+ basic_machine=m88k-harris
+ os=-sysv3
+ ;;
+ hp300-*)
+ basic_machine=m68k-hp
+ ;;
+ hp300bsd)
+ basic_machine=m68k-hp
+ os=-bsd
+ ;;
+ hp300hpux)
+ basic_machine=m68k-hp
+ os=-hpux
+ ;;
+ hp9k2[0-9][0-9] | hp9k31[0-9])
+ basic_machine=m68000-hp
+ ;;
+ hp9k3[2-9][0-9])
+ basic_machine=m68k-hp
+ ;;
+ hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][0-9] | hp8[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hppa-next)
+ os=-nextstep3
+ ;;
+ i370-ibm* | ibm*)
+ basic_machine=i370-ibm
+ os=-mvs
+ ;;
+# I'm not sure what "Sysv32" means. Should this be sysv3.2?
+ i[34567]86v32)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv32
+ ;;
+ i[34567]86v4*)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv4
+ ;;
+ i[34567]86v)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv
+ ;;
+ i[34567]86sol2)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-solaris2
+ ;;
+ iris | iris4d)
+ basic_machine=mips-sgi
+ case $os in
+ -irix*)
+ ;;
+ *)
+ os=-irix4
+ ;;
+ esac
+ ;;
+ isi68 | isi)
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
+ m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+ magnum | m3230)
+ basic_machine=mips-mips
+ os=-sysv
+ ;;
+ merlin)
+ basic_machine=ns32k-utek
+ os=-sysv
+ ;;
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+ mipsel*-linux*)
+ basic_machine=mipsel-unknown
+ os=-linux-gnu
+ ;;
+ mips*-linux*)
+ basic_machine=mips-unknown
+ os=-linux-gnu
+ ;;
+ mips3*-*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ ;;
+ mips3*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ ;;
+ ncr3000)
+ basic_machine=i486-ncr
+ os=-sysv4
+ ;;
+ news | news700 | news800 | news900)
+ basic_machine=m68k-sony
+ os=-newsos
+ ;;
+ news1000)
+ basic_machine=m68030-sony
+ os=-newsos
+ ;;
+ news-3600 | risc-news)
+ basic_machine=mips-sony
+ os=-newsos
+ ;;
+ next | m*-next )
+ basic_machine=m68k-next
+ case $os in
+ -nextstep* )
+ ;;
+ -ns2*)
+ os=-nextstep2
+ ;;
+ *)
+ os=-nextstep3
+ ;;
+ esac
+ ;;
+ nh3000)
+ basic_machine=m68k-harris
+ os=-cxux
+ ;;
+ nh[45]000)
+ basic_machine=m88k-harris
+ os=-cxux
+ ;;
+ nindy960)
+ basic_machine=i960-intel
+ os=-nindy
+ ;;
+ np1)
+ basic_machine=np1-gould
+ ;;
+ pa-hitachi)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ paragon)
+ basic_machine=i860-intel
+ os=-osf
+ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+ pbb)
+ basic_machine=m68k-tti
+ ;;
+ pc532 | pc532-*)
+ basic_machine=ns32k-pc532
+ ;;
+ pentium | p5 | k5 | nexen)
+ basic_machine=i586-pc
+ ;;
+ pentiumpro | p6 | k6 | 6x86)
+ basic_machine=i686-pc
+ ;;
+ pentiumii | pentium2)
+ basic_machine=i786-pc
+ ;;
+ pentium-* | p5-* | k5-* | nexen-*)
+ basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumpro-* | p6-* | k6-* | 6x86-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumii-* | pentium2-*)
+ basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pn)
+ basic_machine=pn-gould
+ ;;
+ power) basic_machine=rs6000-ibm
+ ;;
+ ppc) basic_machine=powerpc-unknown
+ ;;
+ ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppcle | powerpclittle | ppc-le | powerpc-little)
+ basic_machine=powerpcle-unknown
+ ;;
+ ppcle-* | powerpclittle-*)
+ basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ps2)
+ basic_machine=i386-ibm
+ ;;
+ rm[46]00)
+ basic_machine=mips-siemens
+ ;;
+ rtpc | rtpc-*)
+ basic_machine=romp-ibm
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ ;;
+ sh)
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
+ sps7)
+ basic_machine=m68k-bull
+ os=-sysv2
+ ;;
+ spur)
+ basic_machine=spur-unknown
+ ;;
+ sun2)
+ basic_machine=m68000-sun
+ ;;
+ sun2os3)
+ basic_machine=m68000-sun
+ os=-sunos3
+ ;;
+ sun2os4)
+ basic_machine=m68000-sun
+ os=-sunos4
+ ;;
+ sun3os3)
+ basic_machine=m68k-sun
+ os=-sunos3
+ ;;
+ sun3os4)
+ basic_machine=m68k-sun
+ os=-sunos4
+ ;;
+ sun4os3)
+ basic_machine=sparc-sun
+ os=-sunos3
+ ;;
+ sun4os4)
+ basic_machine=sparc-sun
+ os=-sunos4
+ ;;
+ sun4sol2)
+ basic_machine=sparc-sun
+ os=-solaris2
+ ;;
+ sun3 | sun3-*)
+ basic_machine=m68k-sun
+ ;;
+ sun4)
+ basic_machine=sparc-sun
+ ;;
+ sun386 | sun386i | roadrunner)
+ basic_machine=i386-sun
+ ;;
+ symmetry)
+ basic_machine=i386-sequent
+ os=-dynix
+ ;;
+ tx39)
+ basic_machine=mipstx39-unknown
+ ;;
+ tx39el)
+ basic_machine=mipstx39el-unknown
+ ;;
+ tower | tower-32)
+ basic_machine=m68k-ncr
+ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ ultra3)
+ basic_machine=a29k-nyu
+ os=-sym1
+ ;;
+ vaxv)
+ basic_machine=vax-dec
+ os=-sysv
+ ;;
+ vms)
+ basic_machine=vax-dec
+ os=-vms
+ ;;
+ vpp*|vx|vx-*)
+ basic_machine=f301-fujitsu
+ ;;
+ vxworks960)
+ basic_machine=i960-wrs
+ os=-vxworks
+ ;;
+ vxworks68)
+ basic_machine=m68k-wrs
+ os=-vxworks
+ ;;
+ vxworks29k)
+ basic_machine=a29k-wrs
+ os=-vxworks
+ ;;
+ xmp)
+ basic_machine=xmp-cray
+ os=-unicos
+ ;;
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
+ none)
+ basic_machine=none-none
+ os=-none
+ ;;
+
+# Here we handle the default manufacturer of certain CPU types. It is in
+# some cases the only manufacturer, in others, it is the most popular.
+ mips)
+ if [ x$os = x-linux-gnu ]; then
+ basic_machine=mips-unknown
+ else
+ basic_machine=mips-mips
+ fi
+ ;;
+ romp)
+ basic_machine=romp-ibm
+ ;;
+ rs6000)
+ basic_machine=rs6000-ibm
+ ;;
+ vax)
+ basic_machine=vax-dec
+ ;;
+ pdp11)
+ basic_machine=pdp11-dec
+ ;;
+ we32k)
+ basic_machine=we32k-att
+ ;;
+ sparc)
+ basic_machine=sparc-sun
+ ;;
+ cydra)
+ basic_machine=cydra-cydrome
+ ;;
+ orion)
+ basic_machine=orion-highlevel
+ ;;
+ orion105)
+ basic_machine=clipper-highlevel
+ ;;
+ *)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+ *-digital*)
+ basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+ ;;
+ *-commodore*)
+ basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+ ;;
+ *)
+ ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+ # First match some system type aliases
+ # that might get confused with valid system types.
+ # -solaris* is a basic system type, with this one exception.
+ -solaris1 | -solaris1.*)
+ os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ ;;
+ -solaris)
+ os=-solaris2
+ ;;
+ -svr4*)
+ os=-sysv4
+ ;;
+ -unixware*)
+ os=-sysv4.2uw
+ ;;
+ -gnu/linux*)
+ os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+ ;;
+ # First accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST END IN A *, to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+ | -aos* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
+ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ | -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -mingw32* | -linux-gnu* | -uxpv* | -beos*)
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -linux*)
+ os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ ;;
+ -sunos5*)
+ os=`echo $os | sed -e 's|sunos5|solaris2|'`
+ ;;
+ -sunos6*)
+ os=`echo $os | sed -e 's|sunos6|solaris3|'`
+ ;;
+ -osfrose*)
+ os=-osfrose
+ ;;
+ -osf*)
+ os=-osf
+ ;;
+ -utek*)
+ os=-bsd
+ ;;
+ -dynix*)
+ os=-bsd
+ ;;
+ -acis*)
+ os=-aos
+ ;;
+ -ctix* | -uts*)
+ os=-sysv
+ ;;
+ -ns2 )
+ os=-nextstep2
+ ;;
+ # Preserve the version number of sinix5.
+ -sinix5.*)
+ os=`echo $os | sed -e 's|sinix|sysv|'`
+ ;;
+ -sinix*)
+ os=-sysv4
+ ;;
+ -triton*)
+ os=-sysv3
+ ;;
+ -oss*)
+ os=-sysv3
+ ;;
+ -svr4)
+ os=-sysv4
+ ;;
+ -svr3)
+ os=-sysv3
+ ;;
+ -sysvr4)
+ os=-sysv4
+ ;;
+ # This must come after -sysvr4.
+ -sysv*)
+ ;;
+ -xenix)
+ os=-xenix
+ ;;
+ -none)
+ ;;
+ *)
+ # Get rid of the `-' at the beginning of $os.
+ os=`echo $os | sed 's/[^-]*-//'`
+ echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system. Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+ *-acorn)
+ os=-riscix1.2
+ ;;
+ arm*-semi)
+ os=-aout
+ ;;
+ pdp11-*)
+ os=-none
+ ;;
+ *-dec | vax-*)
+ os=-ultrix4.2
+ ;;
+ m68*-apollo)
+ os=-domain
+ ;;
+ i386-sun)
+ os=-sunos4.0.2
+ ;;
+ m68000-sun)
+ os=-sunos3
+ # This also exists in the configure program, but was not the
+ # default.
+ # os=-sunos4
+ ;;
+ *-tti) # must be before sparc entry or we get the wrong os.
+ os=-sysv3
+ ;;
+ sparc-* | *-sun)
+ os=-sunos4.1.1
+ ;;
+ *-be)
+ os=-beos
+ ;;
+ *-ibm)
+ os=-aix
+ ;;
+ *-hp)
+ os=-hpux
+ ;;
+ *-hitachi)
+ os=-hiux
+ ;;
+ i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+ os=-sysv
+ ;;
+ *-cbm)
+ os=-amigaos
+ ;;
+ *-dg)
+ os=-dgux
+ ;;
+ *-dolphin)
+ os=-sysv3
+ ;;
+ m68k-ccur)
+ os=-rtu
+ ;;
+ m88k-omron*)
+ os=-luna
+ ;;
+ *-next )
+ os=-nextstep
+ ;;
+ *-sequent)
+ os=-ptx
+ ;;
+ *-crds)
+ os=-unos
+ ;;
+ *-ns)
+ os=-genix
+ ;;
+ i370-*)
+ os=-mvs
+ ;;
+ *-next)
+ os=-nextstep3
+ ;;
+ *-gould)
+ os=-sysv
+ ;;
+ *-highlevel)
+ os=-bsd
+ ;;
+ *-encore)
+ os=-bsd
+ ;;
+ *-sgi)
+ os=-irix
+ ;;
+ *-siemens)
+ os=-sysv4
+ ;;
+ *-masscomp)
+ os=-rtu
+ ;;
+ f301-fujitsu)
+ os=-uxpv
+ ;;
+ *)
+ os=-none
+ ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer. We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+ *-unknown)
+ case $os in
+ -riscix*)
+ vendor=acorn
+ ;;
+ -sunos*)
+ vendor=sun
+ ;;
+ -aix*)
+ vendor=ibm
+ ;;
+ -hpux*)
+ vendor=hp
+ ;;
+ -hiux*)
+ vendor=hitachi
+ ;;
+ -unos*)
+ vendor=crds
+ ;;
+ -dgux*)
+ vendor=dg
+ ;;
+ -luna*)
+ vendor=omron
+ ;;
+ -genix*)
+ vendor=ns
+ ;;
+ -mvs*)
+ vendor=ibm
+ ;;
+ -ptx*)
+ vendor=sequent
+ ;;
+ -vxsim* | -vxworks*)
+ vendor=wrs
+ ;;
+ -aux*)
+ vendor=apple
+ ;;
+ esac
+ basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+ ;;
+esac
+
+echo $basic_machine$os
diff --git a/win32/contrib/pthreads/configure b/win32/contrib/pthreads/configure new file mode 100644 index 000000000..fcb74b107 --- /dev/null +++ b/win32/contrib/pthreads/configure @@ -0,0 +1,1331 @@ +#! /bin/sh
+
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf version 2.13
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+# Defaults:
+ac_help=
+ac_default_prefix=/usr/local
+# Any additions from configure.in:
+
+# Initialize some variables set by options.
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+build=NONE
+cache_file=./config.cache
+exec_prefix=NONE
+host=NONE
+no_create=
+nonopt=NONE
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+target=NONE
+verbose=
+x_includes=NONE
+x_libraries=NONE
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+# Initialize some other variables.
+subdirs=
+MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+# Maximum number of lines to put in a shell here document.
+ac_max_here_lines=12
+
+ac_prev=
+for ac_option
+do
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval "$ac_prev=\$ac_option"
+ ac_prev=
+ continue
+ fi
+
+ case "$ac_option" in
+ -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) ac_optarg= ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case "$ac_option" in
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir="$ac_optarg" ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build="$ac_optarg" ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file="$ac_optarg" ;;
+
+ -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+ | --da=*)
+ datadir="$ac_optarg" ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ eval "enable_${ac_feature}=no" ;;
+
+ -enable-* | --enable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "enable_${ac_feature}='$ac_optarg'" ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix="$ac_optarg" ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he)
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat << EOF
+Usage: configure [options] [host]
+Options: [defaults in brackets after descriptions]
+Configuration:
+ --cache-file=FILE cache test results in FILE
+ --help print this message
+ --no-create do not create output files
+ --quiet, --silent do not print \`checking...' messages
+ --version print the version of autoconf that created configure
+Directory and file names:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [same as prefix]
+ --bindir=DIR user executables in DIR [EPREFIX/bin]
+ --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
+ --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data in DIR
+ [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data in DIR
+ [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
+ --libdir=DIR object code libraries in DIR [EPREFIX/lib]
+ --includedir=DIR C header files in DIR [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
+ --infodir=DIR info documentation in DIR [PREFIX/info]
+ --mandir=DIR man documentation in DIR [PREFIX/man]
+ --srcdir=DIR find the sources in DIR [configure dir or ..]
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM
+ run sed PROGRAM on installed program names
+EOF
+ cat << EOF
+Host type:
+ --build=BUILD configure for building on BUILD [BUILD=HOST]
+ --host=HOST configure for HOST [guessed]
+ --target=TARGET configure for TARGET [TARGET=HOST]
+Features and packages:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --x-includes=DIR X include files are in DIR
+ --x-libraries=DIR X library files are in DIR
+EOF
+ if test -n "$ac_help"; then
+ echo "--enable and --with options recognized:$ac_help"
+ fi
+ exit 0 ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host="$ac_optarg" ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir="$ac_optarg" ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir="$ac_optarg" ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir="$ac_optarg" ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir="$ac_optarg" ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst \
+ | --locals | --local | --loca | --loc | --lo)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ localstatedir="$ac_optarg" ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir="$ac_optarg" ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir="$ac_optarg" ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix="$ac_optarg" ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix="$ac_optarg" ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix="$ac_optarg" ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name="$ac_optarg" ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir="$ac_optarg" ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir="$ac_optarg" ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site="$ac_optarg" ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir="$ac_optarg" ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir="$ac_optarg" ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target="$ac_optarg" ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers)
+ echo "configure generated by autoconf version 2.13"
+ exit 0 ;;
+
+ -with-* | --with-*)
+ ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "with_${ac_package}='$ac_optarg'" ;;
+
+ -without-* | --without-*)
+ ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ eval "with_${ac_package}=no" ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes="$ac_optarg" ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries="$ac_optarg" ;;
+
+ -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+ ;;
+
+ *)
+ if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+ echo "configure: warning: $ac_option: invalid host type" 1>&2
+ fi
+ if test "x$nonopt" != xNONE; then
+ { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+ fi
+ nonopt="$ac_option"
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+fi
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 6 checking for... messages and results
+# 5 compiler messages saved in config.log
+if test "$silent" = yes; then
+ exec 6>/dev/null
+else
+ exec 6>&1
+fi
+exec 5>./config.log
+
+echo "\
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+" 1>&5
+
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell metacharacters.
+ac_configure_args=
+for ac_arg
+do
+ case "$ac_arg" in
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c) ;;
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+ ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+ esac
+done
+
+# NLS nuisances.
+# Only set these to C if already set. These must not be set unconditionally
+# because not all systems understand e.g. LANG=C (notably SCO).
+# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+# Non-C LC_CTYPE values break the ctype check.
+if test "${LANG+set}" = set; then LANG=C; export LANG; fi
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo > confdefs.h
+
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+ac_unique_file=pthread.h
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then its parent.
+ ac_prog=$0
+ ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+ test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+ srcdir=$ac_confdir
+ if test ! -r $srcdir/$ac_unique_file; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+ if test "$ac_srcdir_defaulted" = yes; then
+ { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+ else
+ { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+ fi
+fi
+srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+ fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+ if test -r "$ac_site_file"; then
+ echo "loading site script $ac_site_file"
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ echo "loading cache $cache_file"
+ . $cache_file
+else
+ echo "creating cache $cache_file"
+ > $cache_file
+fi
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+ac_exeext=
+ac_objext=o
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+ # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+ if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+ ac_n= ac_c='
+' ac_t=' '
+ else
+ ac_n=-n ac_c= ac_t=
+ fi
+else
+ ac_n= ac_c='\c' ac_t=
+fi
+
+
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+ if test -f $ac_dir/install-sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f $ac_dir/install.sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
+fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+
+
+# Make sure we can run config.sub.
+if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
+else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:551: checking host system type" >&5
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+ case $nonopt in
+ NONE)
+ if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
+ else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+ fi ;;
+ *) host_alias=$nonopt ;;
+ esac ;;
+esac
+
+host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
+
+
+# Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:575: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="gcc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:605: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_prog_rejected=no
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# -gt 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ set dummy "$ac_dir/$ac_word" "$@"
+ shift
+ ac_cv_prog_CC="$@"
+ fi
+fi
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ if test -z "$CC"; then
+ case "`uname -s`" in
+ *win32* | *WIN32*)
+ # Extract the first word of "cl", so it can be a program name with args.
+set dummy cl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:656: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="cl"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+ ;;
+ esac
+ fi
+ test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:688: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext << EOF
+
+#line 699 "configure"
+#include "confdefs.h"
+
+main(){return(0);}
+EOF
+if { (eval echo configure:704: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ ac_cv_prog_cc_works=yes
+ # If we can't run a trivial program, we are probably using a cross compiler.
+ if (./conftest; exit) 2>/dev/null; then
+ ac_cv_prog_cc_cross=no
+ else
+ ac_cv_prog_cc_cross=yes
+ fi
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ ac_cv_prog_cc_works=no
+fi
+rm -fr conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+if test $ac_cv_prog_cc_works = no; then
+ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
+fi
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:730: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+echo "configure:735: checking whether we are using GNU C" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.c <<EOF
+#ifdef __GNUC__
+ yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:744: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+ ac_cv_prog_gcc=yes
+else
+ ac_cv_prog_gcc=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+
+ac_test_CFLAGS="${CFLAGS+set}"
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS=
+echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:763: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+ ac_cv_prog_cc_g=yes
+else
+ ac_cv_prog_cc_g=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+
+
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:796: checking how to run the C preprocessor" >&5
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # This must be in double quotes, not single quotes, because CPP may get
+ # substituted into the Makefile and "${CC-cc}" will confuse make.
+ CPP="${CC-cc} -E"
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp.
+ cat > conftest.$ac_ext <<EOF
+#line 811 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:817: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -E -traditional-cpp"
+ cat > conftest.$ac_ext <<EOF
+#line 828 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:834: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -nologo -E"
+ cat > conftest.$ac_ext <<EOF
+#line 845 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:851: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+ ac_cv_prog_CPP="$CPP"
+fi
+ CPP="$ac_cv_prog_CPP"
+else
+ ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+ac_safe=`echo "windows.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for windows.h""... $ac_c" 1>&6
+echo "configure:877: checking for windows.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 882 "configure"
+#include "confdefs.h"
+#include <windows.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:887: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ :
+else
+ echo "$ac_t""no" 1>&6
+{ echo "configure: error: Target system must be Win32" 1>&2; exit 1; }
+fi
+
+
+ac_safe=`echo "signal.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for signal.h""... $ac_c" 1>&6
+echo "configure:912: checking for signal.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 917 "configure"
+#include "confdefs.h"
+#include <signal.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:922: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ signal_h=yes
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+if test x$signal_h = xyes
+then
+ echo $ac_n "checking for sigset_t""... $ac_c" 1>&6
+echo "configure:946: checking for sigset_t" >&5
+if eval "test \"`echo '$''{'p32_cv_sigset_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 951 "configure"
+#include "confdefs.h"
+#include <signal.h>
+int main() {
+sigset_t x;
+; return 0; }
+EOF
+if { (eval echo configure:958: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ p32_cv_sigset_t=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ p32_cv_sigset_t=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$p32_cv_sigset_t" 1>&6
+
+ if test x$p32_cv_sigset_t = xyes ; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_SIGSET_T 1
+EOF
+
+ fi
+fi
+
+trap '' 1 2 15
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs. It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already. You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote substitution
+ # turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ -e "s/'/'\\\\''/g" \
+ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+ ;;
+ esac >> confcache
+if cmp -s $cache_file confcache; then
+ :
+else
+ if test -w $cache_file; then
+ echo "updating cache $cache_file"
+ cat confcache > $cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Any assignment to VPATH causes Sun make to only execute
+# the first set of double-colon rules, so remove it if not needed.
+# If there is a colon in the path, we need to keep it.
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
+fi
+
+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+
+DEFS=-DHAVE_CONFIG_H
+
+# Without the "./", some shells look in PATH for config.status.
+: ${CONFIG_STATUS=./config.status}
+
+echo creating $CONFIG_STATUS
+rm -f $CONFIG_STATUS
+cat > $CONFIG_STATUS <<EOF
+#! /bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# $0 $ac_configure_args
+#
+# Compiler output produced by configure, useful for debugging
+# configure, is in ./config.log if it exists.
+
+ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+for ac_option
+do
+ case "\$ac_option" in
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
+ exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
+ -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+ echo "$CONFIG_STATUS generated by autoconf version 2.13"
+ exit 0 ;;
+ -help | --help | --hel | --he | --h)
+ echo "\$ac_cs_usage"; exit 0 ;;
+ *) echo "\$ac_cs_usage"; exit 1 ;;
+ esac
+done
+
+ac_given_srcdir=$srcdir
+
+trap 'rm -fr `echo "Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+# Protect against being on the right side of a sed subst in config.status.
+sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
+ s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
+$ac_vpsub
+$extrasub
+s%@SHELL@%$SHELL%g
+s%@CFLAGS@%$CFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
+s%@DEFS@%$DEFS%g
+s%@LDFLAGS@%$LDFLAGS%g
+s%@LIBS@%$LIBS%g
+s%@exec_prefix@%$exec_prefix%g
+s%@prefix@%$prefix%g
+s%@program_transform_name@%$program_transform_name%g
+s%@bindir@%$bindir%g
+s%@sbindir@%$sbindir%g
+s%@libexecdir@%$libexecdir%g
+s%@datadir@%$datadir%g
+s%@sysconfdir@%$sysconfdir%g
+s%@sharedstatedir@%$sharedstatedir%g
+s%@localstatedir@%$localstatedir%g
+s%@libdir@%$libdir%g
+s%@includedir@%$includedir%g
+s%@oldincludedir@%$oldincludedir%g
+s%@infodir@%$infodir%g
+s%@mandir@%$mandir%g
+s%@host@%$host%g
+s%@host_alias@%$host_alias%g
+s%@host_cpu@%$host_cpu%g
+s%@host_vendor@%$host_vendor%g
+s%@host_os@%$host_os%g
+s%@CC@%$CC%g
+s%@CPP@%$CPP%g
+
+CEOF
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+
+# Split the substitutions into bite-sized pieces for seds with
+# small command number limits, like on Digital OSF/1 and HP-UX.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_file=1 # Number of current file.
+ac_beg=1 # First line for current file.
+ac_end=$ac_max_sed_cmds # Line after last line for current file.
+ac_more_lines=:
+ac_sed_cmds=""
+while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+ else
+ sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+ fi
+ if test ! -s conftest.s$ac_file; then
+ ac_more_lines=false
+ rm -f conftest.s$ac_file
+ else
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f conftest.s$ac_file"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+ fi
+ ac_file=`expr $ac_file + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_cmds`
+ fi
+done
+if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
+fi
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+
+CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+ else
+ ac_dir_suffix= ac_dots=
+ fi
+
+ case "$ac_given_srcdir" in
+ .) srcdir=.
+ if test -z "$ac_dots"; then top_srcdir=.
+ else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+ /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
+ *) # Relative path.
+ srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+ top_srcdir="$ac_dots$ac_given_srcdir" ;;
+ esac
+
+
+ echo creating "$ac_file"
+ rm -f "$ac_file"
+ configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+ case "$ac_file" in
+ *Makefile*) ac_comsub="1i\\
+# $configure_input" ;;
+ *) ac_comsub= ;;
+ esac
+
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+ sed -e "$ac_comsub
+s%@configure_input@%$configure_input%g
+s%@srcdir@%$srcdir%g
+s%@top_srcdir@%$top_srcdir%g
+" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
+fi; done
+rm -f conftest.s*
+
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)'
+ac_dB='\([ ][ ]*\)[^ ]*%\1#\2'
+ac_dC='\3'
+ac_dD='%g'
+# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
+ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_uB='\([ ]\)%\1#\2define\3'
+ac_uC=' '
+ac_uD='\4%g'
+# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_eB='$%\1#\2define\3'
+ac_eC=' '
+ac_eD='%g'
+
+if test "${CONFIG_HEADERS+set}" != set; then
+EOF
+cat >> $CONFIG_STATUS <<EOF
+ CONFIG_HEADERS="config.h"
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+fi
+for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ echo creating $ac_file
+
+ rm -f conftest.frag conftest.in conftest.out
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+ cat $ac_file_inputs > conftest.in
+
+EOF
+
+# Transform confdefs.h into a sed script conftest.vals that substitutes
+# the proper values into config.h.in to produce config.h. And first:
+# Protect against being on the right side of a sed subst in config.status.
+# Protect against being in an unquoted here document in config.status.
+rm -f conftest.vals
+cat > conftest.hdr <<\EOF
+s/[\\&%]/\\&/g
+s%[\\$`]%\\&%g
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
+s%ac_d%ac_u%gp
+s%ac_u%ac_e%gp
+EOF
+sed -n -f conftest.hdr confdefs.h > conftest.vals
+rm -f conftest.hdr
+
+# This sed command replaces #undef with comments. This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+cat >> conftest.vals <<\EOF
+s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
+EOF
+
+# Break up conftest.vals because some shells have a limit on
+# the size of here documents, and old seds have small limits too.
+
+rm -f conftest.tail
+while :
+do
+ ac_lines=`grep -c . conftest.vals`
+ # grep -c gives empty output for an empty file on some AIX systems.
+ if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
+ # Write a limited-size here document to conftest.frag.
+ echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
+ sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
+ echo 'CEOF
+ sed -f conftest.frag conftest.in > conftest.out
+ rm -f conftest.in
+ mv conftest.out conftest.in
+' >> $CONFIG_STATUS
+ sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
+ rm -f conftest.vals
+ mv conftest.tail conftest.vals
+done
+rm -f conftest.vals
+
+cat >> $CONFIG_STATUS <<\EOF
+ rm -f conftest.frag conftest.h
+ echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
+ cat conftest.in >> conftest.h
+ rm -f conftest.in
+ if cmp -s $ac_file conftest.h 2>/dev/null; then
+ echo "$ac_file is unchanged"
+ rm -f conftest.h
+ else
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ fi
+ rm -f $ac_file
+ mv conftest.h $ac_file
+ fi
+fi; done
+
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+
+exit 0
+EOF
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+
diff --git a/win32/contrib/pthreads/configure.in b/win32/contrib/pthreads/configure.in new file mode 100644 index 000000000..f5ea117f2 --- /dev/null +++ b/win32/contrib/pthreads/configure.in @@ -0,0 +1,23 @@ +dnl Process this file with autoconf to produce a configure script.
+
+AC_INIT(pthread.h)
+AC_CANONICAL_HOST
+AC_CONFIG_HEADER(config.h)
+AC_PROG_CC
+
+dnl Abort here if there is no windows.h
+AC_CHECK_HEADER([windows.h],,AC_MSG_ERROR([Target system must be Win32]))
+
+AC_CHECK_HEADER([signal.h],signal_h=yes,)
+if test x$signal_h = xyes
+then
+ AC_CACHE_CHECK([for sigset_t], p32_cv_sigset_t,
+ AC_TRY_COMPILE([#include <signal.h>], [sigset_t x;],
+ p32_cv_sigset_t=yes, p32_cv_sigset_t=no))
+
+ if test x$p32_cv_sigset_t = xyes ; then
+ AC_DEFINE(HAVE_SIGSET_T)
+ fi
+fi
+
+AC_OUTPUT(GNUmakefile)
diff --git a/win32/contrib/pthreads/create.c b/win32/contrib/pthreads/create.c new file mode 100644 index 000000000..e94ef7f91 --- /dev/null +++ b/win32/contrib/pthreads/create.c @@ -0,0 +1,261 @@ +/*
+ * create.c
+ *
+ * Description:
+ * This translation unit implements routines associated with spawning a new
+ * thread.
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright (C) 1998
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA
+ */
+
+#include "pthread.h"
+#include "implement.h"
+#ifndef _UWIN
+#include <process.h>
+#endif
+
+int
+pthread_create (pthread_t * tid,
+ const pthread_attr_t * attr,
+ void *(*start) (void *),
+ void *arg)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * This function creates a thread running the start function,
+ * passing it the parameter value, 'arg'.
+ *
+ * PARAMETERS
+ * tid
+ * pointer to an instance of pthread_t
+ *
+ * attr
+ * optional pointer to an instance of pthread_attr_t
+ *
+ * start
+ * pointer to the starting routine for the new thread
+ *
+ * arg
+ * optional parameter passed to 'start'
+ *
+ *
+ * DESCRIPTION
+ * This function creates a thread running the start function,
+ * passing it the parameter value, 'arg'. The 'attr'
+ * argument specifies optional creation attributes.
+ * The thread is identity of the new thread is returned
+ * as 'tid'
+ *
+ * RESULTS
+ * 0 successfully created thread,
+ * EINVAL attr invalid,
+ * EAGAIN insufficient resources.
+ *
+ * ------------------------------------------------------
+ */
+{
+ pthread_t thread;
+ HANDLE threadH = 0;
+ int result = EAGAIN;
+ int run = TRUE;
+ ThreadParms *parms = NULL;
+ long stackSize;
+
+ if ((thread = ptw32_new()) == NULL)
+ {
+ goto FAIL0;
+ }
+
+ thread->cancelEvent =
+ CreateEvent (
+ 0,
+ (int) TRUE, /* manualReset */
+ (int) FALSE, /* setSignaled */
+ NULL);
+
+ if (thread->cancelEvent == NULL)
+ {
+ goto FAIL0;
+ }
+
+ if ((parms = (ThreadParms *) malloc (sizeof (*parms))) == NULL)
+ {
+ goto FAIL0;
+ }
+
+ parms->tid = thread;
+ parms->start = start;
+ parms->arg = arg;
+
+ if (attr != NULL && *attr != NULL)
+ {
+ stackSize = (*attr)->stacksize;
+ thread->detachState = (*attr)->detachstate;
+
+#if HAVE_SIGSET_T
+
+ thread->sigmask = (*attr)->sigmask;
+
+#endif /* HAVE_SIGSET_T */
+
+ }
+ else
+ {
+ /*
+ * Default stackSize
+ */
+ stackSize = PTHREAD_STACK_MIN;
+ }
+
+ thread->state = run
+ ? PThreadStateInitial
+ : PThreadStateSuspended;
+
+ thread->keys = NULL;
+
+ /*
+ * Threads must be started in suspended mode and resumed if necessary
+ * after _beginthreadex returns us the handle. Otherwise we set up a
+ * race condition between the creating and the created threads.
+ * Note that we also retain a local copy of the handle for use
+ * by us in case thread->threadH gets NULLed later but before we've
+ * finished with it here.
+ */
+
+#if ! defined (__MINGW32__) || defined (__MSVCRT__)
+
+ thread->threadH = threadH = (HANDLE)
+ _beginthreadex (
+ (void *) NULL, /* No security info */
+ (unsigned) stackSize, /* default stack size */
+ ptw32_threadStart,
+ parms,
+ (unsigned) CREATE_SUSPENDED,
+ (unsigned *) &(thread->thread));
+
+ if (threadH != 0)
+ {
+ /*
+ * PTHREAD_EXPLICIT_SCHED is the default because Win32 threads
+ * don't inherit their creator's priority. They are started with
+ * THREAD_PRIORITY_NORMAL (win32 value). The result of not supplying
+ * an 'attr' arg to pthread_create() is equivalent to defaulting to
+ * PTHREAD_EXPLICIT_SCHED and priority THREAD_PRIORITY_NORMAL.
+ */
+ if (attr != NULL && *attr != NULL)
+ {
+ (void) SetThreadPriority(thread->threadH,
+ PTHREAD_INHERIT_SCHED == (*attr)->inheritsched
+ ? GetThreadPriority(GetCurrentThread())
+ : (*attr)->param.sched_priority );
+ }
+
+ if (run)
+ {
+ ResumeThread(threadH);
+ }
+ }
+
+#else /* __MINGW32__ && ! __MSVCRT__ */
+
+ /*
+ * This lock will force pthread_threadStart() to wait until we have
+ * the thread handle.
+ */
+ (void) pthread_mutex_lock(&thread->cancelLock);
+
+ thread->threadH = threadH = (HANDLE)
+ _beginthread (
+ ptw32_threadStart,
+ (unsigned) stackSize, /* default stack size */
+ parms);
+
+ /*
+ * Make the return code match _beginthreadex's.
+ */
+ if (threadH == (HANDLE) -1L)
+ {
+ thread->threadH = threadH = 0;
+ }
+ else
+ {
+ if (! run)
+ {
+ /*
+ * beginthread does not allow for create flags, so we do it now.
+ * Note that beginthread itself creates the thread in SUSPENDED
+ * mode, and then calls ResumeThread to start it.
+ */
+ SuspendThread (threadH);
+ }
+
+ /*
+ * PTHREAD_EXPLICIT_SCHED is the default because Win32 threads
+ * don't inherit their creator's priority. They are started with
+ * THREAD_PRIORITY_NORMAL (win32 value). The result of not supplying
+ * an 'attr' arg to pthread_create() is equivalent to defaulting to
+ * PTHREAD_EXPLICIT_SCHED and priority THREAD_PRIORITY_NORMAL.
+ */
+ if (attr != NULL && *attr != NULL)
+ {
+ (void) SetThreadPriority(thread->threadH,
+ PTHREAD_INHERIT_SCHED == (*attr)->inheritsched
+ ? GetThreadPriority(GetCurrentThread())
+ : (*attr)->param.sched_priority );
+ }
+ }
+
+ (void) pthread_mutex_unlock(&thread->cancelLock);
+
+#endif /* __MINGW32__ && ! __MSVCRT__ */
+
+ result = (threadH != 0) ? 0 : EAGAIN;
+
+ /*
+ * Fall Through Intentionally
+ */
+
+ /*
+ * ------------
+ * Failure Code
+ * ------------
+ */
+
+FAIL0:
+ if (result != 0)
+ {
+
+ ptw32_threadDestroy (thread);
+ thread = NULL;
+
+ if (parms != NULL)
+ {
+ free (parms);
+ }
+ }
+ *tid = thread;
+
+#ifdef _UWIN
+ if (result == 0)
+ pthread_count++;
+#endif
+ return (result);
+
+} /* pthread_create */
+
diff --git a/win32/contrib/pthreads/dll.c b/win32/contrib/pthreads/dll.c new file mode 100644 index 000000000..1e30bdd42 --- /dev/null +++ b/win32/contrib/pthreads/dll.c @@ -0,0 +1,85 @@ +/*
+ * dll.c
+ *
+ * Description:
+ * This translation unit implements DLL initialisation.
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright (C) 1998
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA
+ */
+
+#include "pthread.h"
+#include "implement.h"
+
+#if 1
+#include <stdio.h>
+#endif
+
+#ifdef _MSC_VER
+/*
+ * lpvReserved yields an unreferenced formal parameter;
+ * ignore it
+ */
+#pragma warning( disable : 4100 )
+#endif
+
+#ifdef __cplusplus
+/*
+ * Dear c++: Please don't mangle this name. -thanks
+ */
+extern "C"
+#endif /* __cplusplus */
+
+BOOL WINAPI
+DllMain (
+ HINSTANCE hinstDll,
+ DWORD fdwReason,
+ LPVOID lpvReserved
+)
+{
+ BOOL result = TRUE;
+
+ switch (fdwReason)
+ {
+
+ case DLL_PROCESS_ATTACH:
+ result = pthread_win32_process_attach_np();
+ break;
+
+ case DLL_THREAD_ATTACH:
+ /*
+ * A thread is being created
+ */
+ result = pthread_win32_thread_attach_np();
+ break;
+
+ case DLL_THREAD_DETACH:
+ /*
+ * A thread is exiting cleanly
+ */
+ result = pthread_win32_thread_detach_np();
+ break;
+
+ case DLL_PROCESS_DETACH:
+ (void) pthread_win32_thread_detach_np();
+ result = pthread_win32_process_detach_np();
+ break;
+ }
+ return (result);
+
+} /* DllMain */
diff --git a/win32/contrib/pthreads/errno.c b/win32/contrib/pthreads/errno.c new file mode 100644 index 000000000..d31e57ceb --- /dev/null +++ b/win32/contrib/pthreads/errno.c @@ -0,0 +1,82 @@ +/*
+ * errno.c
+ *
+ * Description:
+ * This translation unit implements routines associated with spawning a new
+ * thread.
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright (C) 1998
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA
+ */
+
+#if (! defined(HAVE_ERRNO)) && (! defined(_REENTRANT)) && (! defined(_MT))
+
+#include "pthread.h"
+#include "implement.h"
+
+static int reallyBad = ENOMEM;
+
+/*
+ * Re-entrant errno.
+ *
+ * Each thread has it's own errno variable in pthread_t.
+ *
+ * The benefit of using the pthread_t structure
+ * instead of another TSD key is TSD keys are limited
+ * on Win32 to 64 per process. Secondly, to implement
+ * it properly without using pthread_t you'd need
+ * to dynamically allocate an int on starting the thread
+ * and store it manually into TLS and then ensure that you free
+ * it on thread termination. We get all that for free
+ * by simply storing the errno on the pthread_t structure.
+ *
+ * MSVC and Mingw32 already have there own thread-safe errno.
+ *
+ * #if defined( _REENTRANT ) || defined( _MT )
+ * #define errno *_errno()
+ *
+ * int *_errno( void );
+ * #else
+ * extern int errno;
+ * #endif
+ *
+ */
+
+int * _errno( void )
+{
+ pthread_t self;
+ int *result;
+
+ if( ( self = pthread_self() ) == NULL )
+ {
+ /*
+ * Yikes! unable to allocate a thread!
+ * Throw an exception? return an error?
+ */
+ result = &reallyBad;
+ }
+ else
+ {
+ result = &(self->ptErrno);
+ }
+
+ return( result );
+
+} /* _errno */
+
+#endif /* (! HAVE_ERRNO) || (!_REENTRANT && (!_MT || !_MD)) */
diff --git a/win32/contrib/pthreads/exit.c b/win32/contrib/pthreads/exit.c new file mode 100644 index 000000000..ca9e60ef1 --- /dev/null +++ b/win32/contrib/pthreads/exit.c @@ -0,0 +1,91 @@ +/*
+ * exit.c
+ *
+ * Description:
+ * This translation unit implements routines associated with exiting from
+ * a thread.
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright (C) 1998
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA
+ */
+
+#include "pthread.h"
+#include "implement.h"
+#ifndef _UWIN
+# include <process.h>
+#endif
+
+void
+pthread_exit (void *value_ptr)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * This function terminates the calling thread, returning
+ * the value 'value_ptr' to any joining thread.
+ *
+ * PARAMETERS
+ * value_ptr
+ * a generic data value (i.e. not the address of a value)
+ *
+ *
+ * DESCRIPTION
+ * This function terminates the calling thread, returning
+ * the value 'value_ptr' to any joining thread.
+ * NOTE: thread should be joinable.
+ *
+ * RESULTS
+ * N/A
+ *
+ * ------------------------------------------------------
+ */
+{
+ pthread_t self;
+
+ /* If the current thread is implicit it was not started through
+ pthread_create(), therefore we cleanup and end the thread
+ here. Otherwise we raise an exception to unwind the exception
+ stack. The exception will be caught by ptw32_threadStart(),
+ which will cleanup and end the thread for us.
+ */
+
+ self = (pthread_t) pthread_getspecific (ptw32_selfThreadKey);
+#ifdef _UWIN
+ if(--pthread_count <= 0)
+ exit((int)value_ptr);
+#endif
+
+ if (self == NULL || self->implicit)
+ {
+ ptw32_callUserDestroyRoutines(self);
+
+#if ! defined (__MINGW32__) || defined (__MSVCRT__)
+ _endthreadex ((unsigned) value_ptr);
+#else
+ _endthread ();
+#endif
+
+ /* Never reached */
+ }
+
+ self->exitStatus = value_ptr;
+
+// ptw32_throw(PTW32_EPS_EXIT);
+
+ /* Never reached. */
+
+}
diff --git a/win32/contrib/pthreads/fork.c b/win32/contrib/pthreads/fork.c new file mode 100644 index 000000000..e2ace2595 --- /dev/null +++ b/win32/contrib/pthreads/fork.c @@ -0,0 +1,29 @@ +/*
+ * fork.c
+ *
+ * Description:
+ * Implementation of fork() for POSIX threads.
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright (C) 1998
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA
+ */
+
+
+#include "pthread.h"
+#include "implement.h"
+
diff --git a/win32/contrib/pthreads/global.c b/win32/contrib/pthreads/global.c new file mode 100644 index 000000000..f260fec98 --- /dev/null +++ b/win32/contrib/pthreads/global.c @@ -0,0 +1,66 @@ +/*
+ * global.c
+ *
+ * Description:
+ * This translation unit instantiates data associated with the implementation
+ * as a whole.
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright (C) 1998
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA
+ */
+
+#include "pthread.h"
+#include "implement.h"
+
+
+int ptw32_processInitialized = FALSE;
+pthread_key_t ptw32_selfThreadKey = NULL;
+pthread_key_t ptw32_cleanupKey = NULL;
+
+int ptw32_concurrency = 0;
+
+/*
+ * Global lock for testing internal state of PTHREAD_MUTEX_INITIALIZER
+ * created mutexes.
+ */
+CRITICAL_SECTION ptw32_mutex_test_init_lock;
+
+/*
+ * Global lock for testing internal state of PTHREAD_COND_INITIALIZER
+ * created condition variables.
+ */
+CRITICAL_SECTION ptw32_cond_test_init_lock;
+
+/*
+ * Global lock for testing internal state of PTHREAD_RWLOCK_INITIALIZER
+ * created read/write locks.
+ */
+CRITICAL_SECTION ptw32_rwlock_test_init_lock;
+
+/*
+ * Global lock for testing internal state of PTHREAD_SPINLOCK_INITIALIZER
+ * created spin locks.
+ */
+CRITICAL_SECTION ptw32_spinlock_test_init_lock;
+
+#ifdef _UWIN
+/*
+ * Keep a count of the number of threads.
+ */
+int pthread_count = 0;
+#endif
diff --git a/win32/contrib/pthreads/implement.h b/win32/contrib/pthreads/implement.h new file mode 100644 index 000000000..948dc2fab --- /dev/null +++ b/win32/contrib/pthreads/implement.h @@ -0,0 +1,505 @@ +/*
+ * implement.h
+ *
+ * Definitions that don't need to be public.
+ *
+ * Keeps all the internals out of pthread.h
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright (C) 1998
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA
+ */
+
+#ifndef _IMPLEMENT_H
+#define _IMPLEMENT_H
+
+#if !defined(malloc)
+#include <malloc.h>
+#endif
+
+#if !defined(INT_MAX)
+#include <limits.h>
+#endif
+
+/* use local include files during development */
+#include "semaphore.h"
+#include "sched.h"
+
+#if defined(HAVE_C_INLINE) || defined(__cplusplus)
+#define INLINE inline
+#else
+#define INLINE
+#endif
+
+typedef enum {
+ /*
+ * This enumeration represents the state of the thread;
+ * The thread is still "alive" if the numeric value of the
+ * state is greater or equal "PThreadStateRunning".
+ */
+ PThreadStateInitial = 0, /* Thread not running */
+ PThreadStateRunning, /* Thread alive & kicking */
+ PThreadStateSuspended, /* Thread alive but suspended */
+ PThreadStateCanceling, /* Thread alive but and is */
+ /* in the process of terminating */
+ /* due to a cancellation request */
+ PThreadStateException, /* Thread alive but exiting */
+ /* due to an exception */
+ PThreadStateLast
+}
+PThreadState;
+
+
+typedef enum {
+ /*
+ * This enumeration represents the reason why a thread has
+ * terminated/is terminating.
+ */
+ PThreadDemisePeaceful = 0, /* Death due natural causes */
+ PThreadDemiseCancelled, /* Death due to user cancel */
+ PThreadDemiseException, /* Death due to unhandled */
+ /* exception */
+ PThreadDemiseNotDead /* I'm not dead! */
+}
+PThreadDemise;
+
+struct pthread_t_ {
+#ifdef _UWIN
+ DWORD dummy[5];
+#endif
+ DWORD thread;
+ HANDLE threadH;
+ PThreadState state;
+ PThreadDemise demise;
+ void *exitStatus;
+ void *parms;
+ int ptErrno;
+ int detachState;
+ pthread_mutex_t cancelLock; /* Used for async-cancel safety */
+ int cancelState;
+ int cancelType;
+ HANDLE cancelEvent;
+#ifdef __CLEANUP_C
+ jmp_buf start_mark;
+#endif /* __CLEANUP_C */
+#if HAVE_SIGSET_T
+ sigset_t sigmask;
+#endif /* HAVE_SIGSET_T */
+ int implicit:1;
+ void *keys;
+};
+
+
+/*
+ * Special value to mark attribute objects as valid.
+ */
+#define PTW32_ATTR_VALID ((unsigned long) 0xC4C0FFEE)
+
+struct pthread_attr_t_ {
+ unsigned long valid;
+ void *stackaddr;
+ size_t stacksize;
+ int detachstate;
+ struct sched_param param;
+ int inheritsched;
+#if HAVE_SIGSET_T
+ sigset_t sigmask;
+#endif /* HAVE_SIGSET_T */
+};
+
+
+/*
+ * ====================
+ * ====================
+ * Semaphores, Mutexes and Condition Variables
+ * ====================
+ * ====================
+ */
+
+struct sem_t_ {
+#ifdef NEED_SEM
+ unsigned int value;
+ CRITICAL_SECTION sem_lock_cs;
+ HANDLE event;
+#else /* NEED_SEM */
+ HANDLE sem;
+#endif /* NEED_SEM */
+};
+
+#define PTW32_OBJECT_AUTO_INIT ((void *) -1)
+#define PTW32_OBJECT_INVALID NULL
+
+struct pthread_mutex_t_ {
+ LONG lock_idx;
+ int recursive_count;
+ int kind;
+ pthread_t ownerThread;
+ HANDLE wait_sema;
+ CRITICAL_SECTION try_lock_cs;
+};
+
+struct pthread_mutexattr_t_ {
+ int pshared;
+ int kind;
+};
+
+/*
+ * Possible values, other than PTW32_OBJECT_INVALID,
+ * for the "interlock" element in a spinlock.
+ *
+ * In this implementation, when a spinlock is initialised,
+ * the number of cpus available to the process is checked.
+ * If there is only one cpu then "interlock" is set equal to
+ * PTW32_SPIN_USE_MUTEX and u.mutex is a initialised mutex.
+ * If the number of cpus is greater than 1 then "interlock"
+ * is set equal to PTW32_SPIN_UNLOCKED and the number is
+ * stored in u.cpus. This arrangement allows the spinlock
+ * routines to attempt an InterlockedCompareExchange on "interlock"
+ * immediately and, if that fails, to try the inferior mutex.
+ *
+ * "u.cpus" isn't used for anything yet, but could be used at
+ * some point to optimise spinlock behaviour.
+ */
+#define PTW32_SPIN_UNLOCKED (1)
+#define PTW32_SPIN_LOCKED (2)
+#define PTW32_SPIN_USE_MUTEX (3)
+
+struct pthread_spinlock_t_ {
+ long interlock; /* Locking element for multi-cpus. */
+ union {
+ int cpus; /* No. of cpus if multi cpus, or */
+ pthread_mutex_t mutex; /* mutex if single cpu. */
+ } u;
+};
+
+struct pthread_barrier_t_ {
+ unsigned int nCurrentBarrierHeight;
+ unsigned int nInitialBarrierHeight;
+ int iStep;
+ int pshared;
+ sem_t semBarrierBreeched[2];
+};
+
+struct pthread_barrierattr_t_ {
+ int pshared;
+};
+
+struct pthread_key_t_ {
+ DWORD key;
+ void (*destructor) (void *);
+ pthread_mutex_t threadsLock;
+ void *threads;
+};
+
+
+typedef struct ThreadParms ThreadParms;
+typedef struct ThreadKeyAssoc ThreadKeyAssoc;
+
+struct ThreadParms {
+ pthread_t tid;
+ void *(*start) (void *);
+ void *arg;
+};
+
+
+struct pthread_cond_t_ {
+ long nWaitersBlocked; /* Number of threads blocked */
+ long nWaitersGone; /* Number of threads timed out */
+ long nWaitersUnblocked; /* Number of threads unblocked */
+ long nWaitersToUnblock; /* Number of threads to unblock */
+ sem_t semBlockQueue; /* Queue up threads waiting for the */
+ /* condition to become signalled */
+ sem_t semBlockLock; /* Semaphore that guards access to */
+ /* | waiters blocked count/block queue */
+ /* +-> Mandatory Sync.LEVEL-1 */
+ pthread_mutex_t mtxUnblockLock; /* Mutex that guards access to */
+ /* | waiters (to)unblock(ed) counts */
+ /* +-> Optional* Sync.LEVEL-2 */
+};
+
+
+struct pthread_condattr_t_ {
+ int pshared;
+};
+
+#define PTW32_RWLOCK_MAGIC 0xfacade2
+
+struct pthread_rwlock_t_ {
+ pthread_mutex_t mtxExclusiveAccess;
+ pthread_mutex_t mtxSharedAccessCompleted;
+ pthread_cond_t cndSharedAccessCompleted;
+ int nSharedAccessCount;
+ int nExclusiveAccessCount;
+ int nCompletedSharedAccessCount;
+ int nMagic;
+};
+
+struct pthread_rwlockattr_t_ {
+ int pshared;
+};
+
+
+struct ThreadKeyAssoc {
+ /*
+ * Purpose:
+ * This structure creates an association between a
+ * thread and a key.
+ * It is used to implement the implicit invocation
+ * of a user defined destroy routine for thread
+ * specific data registered by a user upon exiting a
+ * thread.
+ *
+ * Attributes:
+ * lock
+ * protects access to the rest of the structure
+ *
+ * thread
+ * reference to the thread that owns the association.
+ * As long as this is not NULL, the association remains
+ * referenced by the pthread_t.
+ *
+ * key
+ * reference to the key that owns the association.
+ * As long as this is not NULL, the association remains
+ * referenced by the pthread_key_t.
+ *
+ * nextKey
+ * The pthread_t->keys attribute is the head of a
+ * chain of associations that runs through the nextKey
+ * link. This chain provides the 1 to many relationship
+ * between a pthread_t and all pthread_key_t on which
+ * it called pthread_setspecific.
+ *
+ * nextThread
+ * The pthread_key_t->threads attribute is the head of
+ * a chain of assoctiations that runs through the
+ * nextThreads link. This chain provides the 1 to many
+ * relationship between a pthread_key_t and all the
+ * PThreads that have called pthread_setspecific for
+ * this pthread_key_t.
+ *
+ *
+ * Notes:
+ * 1) As long as one of the attributes, thread or key, is
+ * not NULL, the association is being referenced; once
+ * both are NULL, the association must be released.
+ *
+ * 2) Under WIN32, an association is only created by
+ * pthread_setspecific if the user provided a
+ * destroyRoutine when they created the key.
+ *
+ *
+ */
+ pthread_mutex_t lock;
+ pthread_t thread;
+ pthread_key_t key;
+ ThreadKeyAssoc *nextKey;
+ ThreadKeyAssoc *nextThread;
+};
+
+
+#ifdef __CLEANUP_SEH
+/*
+ * --------------------------------------------------------------
+ * MAKE_SOFTWARE_EXCEPTION
+ * This macro constructs a software exception code following
+ * the same format as the standard Win32 error codes as defined
+ * in WINERROR.H
+ * Values are 32 bit values layed out as follows:
+ *
+ * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+ * +---+-+-+-----------------------+-------------------------------+
+ * |Sev|C|R| Facility | Code |
+ * +---+-+-+-----------------------+-------------------------------+
+ *
+ * Severity Values:
+ */
+#define SE_SUCCESS 0x00
+#define SE_INFORMATION 0x01
+#define SE_WARNING 0x02
+#define SE_ERROR 0x03
+
+#define MAKE_SOFTWARE_EXCEPTION( _severity, _facility, _exception ) \
+( (DWORD) ( ( (_severity) << 30 ) | /* Severity code */ \
+ ( 1 << 29 ) | /* MS=0, User=1 */ \
+ ( 0 << 28 ) | /* Reserved */ \
+ ( (_facility) << 16 ) | /* Facility Code */ \
+ ( (_exception) << 0 ) /* Exception Code */ \
+ ) )
+
+/*
+ * We choose one specific Facility/Error code combination to
+ * identify our software exceptions vs. WIN32 exceptions.
+ * We store our actual component and error code within
+ * the optional information array.
+ */
+#define EXCEPTION_PTW32_SERVICES \
+ MAKE_SOFTWARE_EXCEPTION( SE_ERROR, \
+ PTW32_SERVICES_FACILITY, \
+ PTW32_SERVICES_ERROR )
+
+#define PTW32_SERVICES_FACILITY 0xBAD
+#define PTW32_SERVICES_ERROR 0xDEED
+
+#endif /* __CLEANUP_SEH */
+
+/*
+ * Services available through EXCEPTION_PTW32_SERVICES
+ * and also used [as parameters to ptw32_throw()] as
+ * generic exception selectors.
+ */
+
+#define PTW32_EPS_EXIT (1)
+#define PTW32_EPS_CANCEL (2)
+
+/* Mutex constants */
+enum {
+ PTW32_MUTEX_LOCK_IDX_INIT = -1,
+ PTW32_MUTEX_OWNER_ANONYMOUS = 1
+};
+
+
+/* Declared in global.c */
+extern int ptw32_processInitialized;
+extern pthread_key_t ptw32_selfThreadKey;
+extern pthread_key_t ptw32_cleanupKey;
+
+extern int ptw32_mutex_default_kind;
+
+extern int ptw32_concurrency;
+
+extern CRITICAL_SECTION ptw32_mutex_test_init_lock;
+extern CRITICAL_SECTION ptw32_cond_test_init_lock;
+extern CRITICAL_SECTION ptw32_rwlock_test_init_lock;
+extern CRITICAL_SECTION ptw32_spinlock_test_init_lock;
+
+#ifdef _UWIN
+extern int pthread_count;
+#endif
+
+/* Declared in misc.c */
+#ifdef NEED_CALLOC
+#define calloc(n, s) ptw32_calloc(n, s)
+void *ptw32_calloc(size_t n, size_t s);
+#endif
+
+/* Declared in private.c */
+void ptw32_throw(DWORD exception);
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*
+ * =====================
+ * =====================
+ * Forward Declarations
+ * =====================
+ * =====================
+ */
+int ptw32_processInitialize (void);
+
+void ptw32_processTerminate (void);
+
+void ptw32_threadDestroy (pthread_t tid);
+
+void ptw32_pop_cleanup_all (int execute);
+
+pthread_t ptw32_new (void);
+
+#if ! defined (__MINGW32__) || defined (__MSVCRT__)
+unsigned __stdcall
+#else
+void
+#endif
+ptw32_threadStart (void * vthreadParms);
+
+void ptw32_callUserDestroyRoutines (pthread_t thread);
+
+int ptw32_tkAssocCreate (ThreadKeyAssoc ** assocP,
+ pthread_t thread,
+ pthread_key_t key);
+
+void ptw32_tkAssocDestroy (ThreadKeyAssoc * assoc);
+
+int ptw32_sem_timedwait (sem_t * sem,
+ const struct timespec * abstime);
+
+#ifdef NEED_SEM
+void ptw32_decrease_semaphore(sem_t * sem);
+BOOL ptw32_increase_semaphore(sem_t * sem,
+ unsigned int n);
+#endif /* NEED_SEM */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#ifdef _UWIN_
+# ifdef _MT
+# ifdef __cplusplus
+ extern "C" {
+# endif
+ _CRTIMP unsigned long __cdecl _beginthread (void (__cdecl *) (void *),
+ unsigned, void *);
+ _CRTIMP void __cdecl _endthread(void);
+ _CRTIMP unsigned long __cdecl _beginthreadex(void *, unsigned,
+ unsigned (__stdcall *) (void *), void *, unsigned, unsigned *);
+ _CRTIMP void __cdecl _endthreadex(unsigned);
+# ifdef __cplusplus
+ }
+# endif
+# endif
+#else
+# include <process.h>
+#endif
+
+/*
+ * Check for old and new versions of cygwin. See the FAQ file:
+ *
+ * Question 1 - How do I get pthreads-win32 to link under Cygwin or Mingw32?
+ *
+ * Patch by Anders Norlander <anorland@hem2.passagen.se>
+ */
+#if defined(__CYGWIN32__) || defined(__CYGWIN__) || defined(NEED_CREATETHREAD)
+
+/*
+ * Macro uses args so we can cast start_proc to LPTHREAD_START_ROUTINE
+ * in order to avoid warnings because of return type
+ */
+
+#define _beginthreadex(security, \
+ stack_size, \
+ start_proc, \
+ arg, \
+ flags, \
+ pid) \
+ CreateThread(security, \
+ stack_size, \
+ (LPTHREAD_START_ROUTINE) start_proc, \
+ arg, \
+ flags, \
+ pid)
+
+#define _endthreadex ExitThread
+
+#endif /* __CYGWIN32__ || __CYGWIN__ || NEED_CREATETHREAD*/
+
+
+#endif /* _IMPLEMENT_H */
+
diff --git a/win32/contrib/pthreads/install-sh b/win32/contrib/pthreads/install-sh new file mode 100644 index 000000000..7303f8565 --- /dev/null +++ b/win32/contrib/pthreads/install-sh @@ -0,0 +1,247 @@ +#!/bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5 (mit/util/scripts/install.sh).
+#
+# Copyright 1991 by the Massachusetts Institute of Technology
+#
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of M.I.T. not be used in advertising or
+# publicity pertaining to distribution of the software without specific,
+# written prior permission. M.I.T. makes no representations about the
+# suitability of this software for any purpose. It is provided "as is"
+# without express or implied warranty.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+#
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+transformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -c) instcmd="$cpprog"
+ shift
+ continue;;
+
+ -d) dir_arg=true
+ shift
+ continue;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd="$stripprog"
+ shift
+ continue;;
+
+ -t=*) transformarg=`echo $1 | sed 's/-t=//'`
+ shift
+ continue;;
+
+ -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+ shift
+ continue;;
+
+ *) if [ x"$src" = x ]
+ then
+ src=$1
+ else
+ # this colon is to work around a 386BSD /bin/sh bug
+ :
+ dst=$1
+ fi
+ shift
+ continue;;
+ esac
+done
+
+if [ x"$src" = x ]
+then
+ echo "install: no input file specified"
+ exit 1
+else
+ true
+fi
+
+if [ x"$dir_arg" != x ]; then
+ dst=$src
+ src=""
+
+ if [ -d $dst ]; then
+ instcmd=:
+ chmodcmd=""
+ else
+ instcmd=mkdir
+ fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad
+# if $src (and thus $dsttmp) contains '*'.
+
+ if [ -f $src -o -d $src ]
+ then
+ true
+ else
+ echo "install: $src does not exist"
+ exit 1
+ fi
+
+ if [ x"$dst" = x ]
+ then
+ echo "install: no destination specified"
+ exit 1
+ else
+ true
+ fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+ if [ -d $dst ]
+ then
+ dst="$dst"/`basename $src`
+ else
+ true
+ fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+# this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='
+'
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+ pathcomp="${pathcomp}${1}"
+ shift
+
+ if [ ! -d "${pathcomp}" ] ;
+ then
+ $mkdirprog "${pathcomp}"
+ else
+ true
+ fi
+
+ pathcomp="${pathcomp}/"
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+ $doit $instcmd $dst &&
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+ if [ x"$transformarg" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ dstfile=`basename $dst $transformbasename |
+ sed $transformarg`$transformbasename
+ fi
+
+# don't allow the sed command to completely eliminate the filename
+
+ if [ x"$dstfile" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ true
+ fi
+
+# Make a temp file name in the proper directory.
+
+ dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+ $doit $instcmd $src $dsttmp &&
+
+ trap "rm -f ${dsttmp}" 0 &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing. If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+
+# Now rename the file to the real destination.
+
+ $doit $rmcmd -f $dstdir/$dstfile &&
+ $doit $mvcmd $dsttmp $dstdir/$dstfile
+
+fi &&
+
+
+exit 0
diff --git a/win32/contrib/pthreads/misc.c b/win32/contrib/pthreads/misc.c new file mode 100644 index 000000000..aa06013b4 --- /dev/null +++ b/win32/contrib/pthreads/misc.c @@ -0,0 +1,420 @@ +/*
+ * misc.c
+ *
+ * Description:
+ * This translation unit implements miscellaneous thread functions.
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright (C) 1998
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA
+ */
+
+#include "pthread.h"
+#include "implement.h"
+
+
+int
+pthread_once (
+ pthread_once_t * once_control,
+ void (*init_routine) (void)
+)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * If any thread in a process with a once_control parameter
+ * makes a call to pthread_once(), the first call will summon
+ * the init_routine(), but subsequent calls will not. The
+ * once_control parameter determines whether the associated
+ * initialization routine has been called. The init_routine()
+ * is complete upon return of pthread_once().
+ * This function guarantees that one and only one thread
+ * executes the initialization routine, init_routine when
+ * access is controlled by the pthread_once_t control
+ * key.
+ *
+ * PARAMETERS
+ * once_control
+ * pointer to an instance of pthread_once_t
+ *
+ * init_routine
+ * pointer to an initialization routine
+ *
+ *
+ * DESCRIPTION
+ * See above.
+ *
+ * RESULTS
+ * 0 success,
+ * EINVAL once_control or init_routine is NULL
+ *
+ * ------------------------------------------------------
+ */
+{
+ int result;
+
+ if (once_control == NULL || init_routine == NULL)
+ {
+
+ result = EINVAL;
+ goto FAIL0;
+
+ }
+ else
+ {
+ result = 0;
+ }
+
+ if (!once_control->done)
+ {
+ if (InterlockedIncrement (&(once_control->started)) == 0)
+ {
+ /*
+ * First thread to increment the started variable
+ */
+ (*init_routine) ();
+ once_control->done = TRUE;
+
+ }
+ else
+ {
+ /*
+ * Block until other thread finishes executing the onceRoutine
+ */
+ while (!(once_control->done))
+ {
+ /*
+ * The following gives up CPU cycles without pausing
+ * unnecessarily
+ */
+ Sleep (0);
+ }
+ }
+ }
+
+ /*
+ * Fall through Intentionally
+ */
+
+ /*
+ * ------------
+ * Failure Code
+ * ------------
+ */
+FAIL0:
+ return (result);
+
+} /* pthread_once */
+
+
+pthread_t
+pthread_self (void)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * This function returns a reference to the current running
+ * thread.
+ *
+ * PARAMETERS
+ * N/A
+ *
+ *
+ * DESCRIPTION
+ * This function returns a reference to the current running
+ * thread.
+ *
+ * RESULTS
+ * pthread_t reference to the current thread
+ *
+ * ------------------------------------------------------
+ */
+{
+ pthread_t self;
+
+#ifdef _UWIN
+ if(!ptw32_selfThreadKey)
+ return(NULL);
+#endif
+
+ self = (pthread_t) pthread_getspecific (ptw32_selfThreadKey);
+
+ if (self == NULL)
+ {
+ /*
+ * Need to create an implicit 'self' for the currently
+ * executing thread.
+ */
+ self = ptw32_new();
+
+ if (self != NULL)
+ {
+ /*
+ * This is a non-POSIX thread which has chosen to call
+ * a POSIX threads function for some reason. We assume that
+ * it isn't joinable, but we do assume that it's
+ * (deferred) cancelable.
+ */
+ self->implicit = 1;
+ self->detachState = PTHREAD_CREATE_DETACHED;
+ self->thread = GetCurrentThreadId ();
+
+#ifdef NEED_DUPLICATEHANDLE
+ /*
+ * DuplicateHandle does not exist on WinCE.
+ *
+ * NOTE:
+ * GetCurrentThread only returns a pseudo-handle
+ * which is only valid in the current thread context.
+ * Therefore, you should not pass the handle to
+ * other threads for whatever purpose.
+ */
+ self->threadH = GetCurrentThread();
+#else
+ if( !DuplicateHandle(
+ GetCurrentProcess(),
+ GetCurrentThread(),
+ GetCurrentProcess(),
+ &self->threadH,
+ 0,
+ FALSE,
+ DUPLICATE_SAME_ACCESS ) )
+ {
+ free( self );
+ return (NULL);
+ }
+#endif
+ }
+
+ pthread_setspecific (ptw32_selfThreadKey, self);
+ }
+
+ return (self);
+
+} /* pthread_self */
+
+int
+pthread_equal (pthread_t t1, pthread_t t2)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * This function returns zero if t1 and t2 are equal, else
+ * returns nonzero
+ *
+ * PARAMETERS
+ * t1,
+ * t2
+ * references to an instances of thread_t
+ *
+ *
+ * DESCRIPTION
+ * This function returns nonzero if t1 and t2 are equal, else
+ * returns zero.
+ *
+ * RESULTS
+ * non-zero if t1 and t2 refer to the same thread,
+ * 0 t1 and t2 do not refer to the same thread
+ *
+ * ------------------------------------------------------
+ */
+{
+ int result;
+
+ /*
+ * We also accept NULL == NULL - treating NULL as a thread
+ * for this special case, because there is no error that we can return.
+ */
+ result = ( ( t1 == t2 ) && ( t1 == NULL || ( t1->thread == t2->thread ) ) );
+
+ return (result);
+
+} /* pthread_equal */
+
+
+int
+pthread_setconcurrency(int level)
+{
+ if (level < 0)
+ {
+ return EINVAL;
+ }
+ else
+ {
+ ptw32_concurrency = level;
+ return 0;
+ }
+}
+
+
+int
+pthread_getconcurrency(void)
+{
+ return ptw32_concurrency;
+}
+
+
+static INLINE int
+ptw32_cancelable_wait (HANDLE waitHandle, DWORD timeout)
+ /*
+ * -------------------------------------------------------------------
+ * This provides an extra hook into the pthread_cancel
+ * mechanism that will allow you to wait on a Windows handle and make it a
+ * cancellation point. This function blocks until the given WIN32 handle is
+ * signaled or pthread_cancel has been called. It is implemented using
+ * WaitForMultipleObjects on 'waitHandle' and a manually reset WIN32
+ * event used to implement pthread_cancel.
+ *
+ * Given this hook it would be possible to implement more of the cancellation
+ * points.
+ * -------------------------------------------------------------------
+ */
+{
+ int result;
+ pthread_t self;
+ HANDLE handles[2];
+ DWORD nHandles = 1;
+ DWORD status;
+
+ handles[0] = waitHandle;
+
+ if ((self = pthread_self()) != NULL)
+ {
+ /*
+ * Get cancelEvent handle
+ */
+ if (self->cancelState == PTHREAD_CANCEL_ENABLE)
+ {
+
+ if ((handles[1] = self->cancelEvent) != NULL)
+ {
+ nHandles++;
+ }
+ }
+ }
+ else
+ {
+ handles[1] = NULL;
+ }
+
+ status = WaitForMultipleObjects (
+ nHandles,
+ handles,
+ FALSE,
+ timeout);
+
+
+ if (status == WAIT_FAILED)
+ {
+ result = EINVAL;
+ }
+ else if (status == WAIT_TIMEOUT)
+ {
+ result = ETIMEDOUT;
+ }
+ else if (status == WAIT_ABANDONED_0)
+ {
+ result = EINVAL;
+ }
+ else
+ {
+ /*
+ * Either got the mutex or the cancel event
+ * was signaled
+ */
+ switch (status - WAIT_OBJECT_0)
+ {
+
+ case 0:
+ /*
+ * Got the mutex
+ */
+ result = 0;
+ break;
+
+ case 1:
+ /*
+ * Got cancel request
+ */
+ ResetEvent (handles[1]);
+
+ if (self != NULL && !self->implicit)
+ {
+ /*
+ * Thread started with pthread_create
+ */
+ ptw32_throw(PTW32_EPS_CANCEL);
+ }
+
+ /* Should never get to here. */
+ result = EINVAL;
+ break;
+
+ default:
+ result = EINVAL;
+ break;
+ }
+ }
+
+ return (result);
+
+} /* CancelableWait */
+
+int
+pthreadCancelableWait (HANDLE waitHandle)
+{
+ return (ptw32_cancelable_wait(waitHandle, INFINITE));
+}
+
+int
+pthreadCancelableTimedWait (HANDLE waitHandle, DWORD timeout)
+{
+ return (ptw32_cancelable_wait(waitHandle, timeout));
+}
+
+
+pthread_t
+ptw32_new (void)
+{
+ pthread_t t;
+
+ t = (pthread_t) calloc (1, sizeof (*t));
+
+ if (t != NULL)
+ {
+ t->detachState = PTHREAD_CREATE_JOINABLE;
+ t->cancelState = PTHREAD_CANCEL_ENABLE;
+ t->cancelType = PTHREAD_CANCEL_DEFERRED;
+ t->cancelLock = PTHREAD_MUTEX_INITIALIZER;
+ }
+
+ return t;
+
+}
+
+
+#ifdef NEED_CALLOC
+void *
+ptw32_calloc(size_t n, size_t s) {
+ unsigned int m = n*s;
+ void *p;
+
+ p = malloc(m);
+ if (p == NULL) return NULL;
+
+ memset(p, 0, m);
+
+ return p;
+}
+#endif
diff --git a/win32/contrib/pthreads/mutex.c b/win32/contrib/pthreads/mutex.c new file mode 100644 index 000000000..7896570c1 --- /dev/null +++ b/win32/contrib/pthreads/mutex.c @@ -0,0 +1,784 @@ +/*
+ * mutex.c
+ *
+ * Description:
+ * This translation unit implements mutual exclusion (mutex) primitives.
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright (C) 1998
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA
+ */
+
+#include "pthread.h"
+#include "implement.h"
+
+
+static INLINE int
+ptw32_mutex_check_need_init(pthread_mutex_t *mutex)
+{
+ int result = 0;
+
+ /*
+ * The following guarded test is specifically for statically
+ * initialised mutexes (via PTHREAD_MUTEX_INITIALIZER).
+ *
+ * Note that by not providing this synchronisation we risk
+ * introducing race conditions into applications which are
+ * correctly written.
+ *
+ * Approach
+ * --------
+ * We know that static mutexes will not be PROCESS_SHARED
+ * so we can serialise access to internal state using
+ * Win32 Critical Sections rather than Win32 Mutexes.
+ *
+ * If using a single global lock slows applications down too much,
+ * multiple global locks could be created and hashed on some random
+ * value associated with each mutex, the pointer perhaps. At a guess,
+ * a good value for the optimal number of global locks might be
+ * the number of processors + 1.
+ *
+ */
+ EnterCriticalSection(&ptw32_mutex_test_init_lock);
+
+ /*
+ * We got here possibly under race
+ * conditions. Check again inside the critical section
+ * and only initialise if the mutex is valid (not been destroyed).
+ * If a static mutex has been destroyed, the application can
+ * re-initialise it only by calling pthread_mutex_init()
+ * explicitly.
+ */
+ if (*mutex == PTHREAD_MUTEX_INITIALIZER)
+ {
+ result = pthread_mutex_init(mutex, NULL);
+ }
+ else if (*mutex == NULL)
+ {
+ /*
+ * The mutex has been destroyed while we were waiting to
+ * initialise it, so the operation that caused the
+ * auto-initialisation should fail.
+ */
+ result = EINVAL;
+ }
+
+ LeaveCriticalSection(&ptw32_mutex_test_init_lock);
+
+ return(result);
+}
+
+int
+pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
+{
+ int result = 0;
+ pthread_mutex_t mx;
+
+ if (mutex == NULL)
+ {
+ return EINVAL;
+ }
+
+ mx = (pthread_mutex_t) calloc(1, sizeof(*mx));
+
+ if (mx == NULL)
+ {
+ result = ENOMEM;
+ goto FAIL0;
+ }
+
+ if (attr != NULL
+ && *attr != NULL
+ && (*attr)->pshared == PTHREAD_PROCESS_SHARED
+ )
+ {
+ /*
+ * Creating mutex that can be shared between
+ * processes.
+ */
+#if _POSIX_THREAD_PROCESS_SHARED
+
+ /*
+ * Not implemented yet.
+ */
+
+#error ERROR [__FILE__, line __LINE__]: Process shared mutexes are not supported yet.
+
+
+#else
+
+ result = ENOSYS;
+ goto FAIL0;
+
+#endif /* _POSIX_THREAD_PROCESS_SHARED */
+
+ }
+
+ mx->lock_idx = PTW32_MUTEX_LOCK_IDX_INIT;
+ mx->recursive_count = 0;
+ mx->kind = (attr == NULL || *attr == NULL
+ ? PTHREAD_MUTEX_DEFAULT
+ : (*attr)->kind);
+ mx->ownerThread = NULL;
+ InitializeCriticalSection( &mx->try_lock_cs );
+ mx->wait_sema = CreateSemaphore( NULL, 0, 1, NULL );
+
+ if( NULL == mx->wait_sema )
+ {
+ DeleteCriticalSection( &mx->try_lock_cs );
+ result = EAGAIN;
+ }
+
+ if (result != 0 && mx != NULL)
+ {
+ free(mx);
+ mx = NULL;
+ }
+
+FAIL0:
+ *mutex = mx;
+
+ return(result);
+}
+
+int
+pthread_mutex_destroy(pthread_mutex_t *mutex)
+{
+ int result = 0;
+ pthread_mutex_t mx;
+
+ if (mutex == NULL
+ || *mutex == NULL)
+ {
+ return EINVAL;
+ }
+
+ /*
+ * Check to see if we have something to delete.
+ */
+ if (*mutex != PTHREAD_MUTEX_INITIALIZER)
+ {
+ mx = *mutex;
+
+ result = pthread_mutex_trylock(&mx);
+
+ /*
+ * The mutex type may not be RECURSIVE therefore trylock may return EBUSY if
+ * we already own the mutex. Here we are assuming that it's OK to destroy
+ * a mutex that we own and have locked recursively. Is this correct?
+ *
+ * For FAST mutexes we record the owner as ANONYMOUS for speed. In this
+ * case we assume that the thread calling pthread_mutex_destroy() is the
+ * owner, if the mutex is owned at all.
+ */
+ if (result == 0
+ || mx->ownerThread == (pthread_t) PTW32_MUTEX_OWNER_ANONYMOUS
+ || pthread_equal( mx->ownerThread, pthread_self() ) )
+ {
+ /*
+ * FIXME!!!
+ * The mutex isn't held by another thread but we could still
+ * be too late invalidating the mutex below since another thread
+ * may alredy have entered mutex_lock and the check for a valid
+ * *mutex != NULL.
+ */
+ *mutex = NULL;
+
+ result = pthread_mutex_unlock(&mx);
+
+ if (result == 0)
+ {
+ DeleteCriticalSection( &mx->try_lock_cs );
+ CloseHandle( mx->wait_sema );
+ free(mx);
+ }
+ else
+ {
+ /*
+ * Restore the mutex before we return the error.
+ */
+ *mutex = mx;
+ }
+ }
+ }
+ else
+ {
+ /*
+ * See notes in ptw32_mutex_check_need_init() above also.
+ */
+ EnterCriticalSection(&ptw32_mutex_test_init_lock);
+
+ /*
+ * Check again.
+ */
+ if (*mutex == PTHREAD_MUTEX_INITIALIZER)
+ {
+ /*
+ * This is all we need to do to destroy a statically
+ * initialised mutex that has not yet been used (initialised).
+ * If we get to here, another thread
+ * waiting to initialise this mutex will get an EINVAL.
+ */
+ *mutex = NULL;
+ }
+ else
+ {
+ /*
+ * The mutex has been initialised while we were waiting
+ * so assume it's in use.
+ */
+ result = EBUSY;
+ }
+
+ LeaveCriticalSection(&ptw32_mutex_test_init_lock);
+ }
+
+ return(result);
+}
+
+int
+pthread_mutexattr_init (pthread_mutexattr_t * attr)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * Initializes a mutex attributes object with default
+ * attributes.
+ *
+ * PARAMETERS
+ * attr
+ * pointer to an instance of pthread_mutexattr_t
+ *
+ *
+ * DESCRIPTION
+ * Initializes a mutex attributes object with default
+ * attributes.
+ *
+ * NOTES:
+ * 1) Used to define mutex types
+ *
+ * RESULTS
+ * 0 successfully initialized attr,
+ * ENOMEM insufficient memory for attr.
+ *
+ * ------------------------------------------------------
+ */
+{
+ pthread_mutexattr_t ma;
+ int result = 0;
+
+ ma = (pthread_mutexattr_t) calloc (1, sizeof (*ma));
+
+ if (ma == NULL)
+ {
+ result = ENOMEM;
+ }
+
+ ma->pshared = PTHREAD_PROCESS_PRIVATE;
+ ma->kind = PTHREAD_MUTEX_DEFAULT;
+
+ *attr = ma;
+
+ return (result);
+
+} /* pthread_mutexattr_init */
+
+
+int
+pthread_mutexattr_destroy (pthread_mutexattr_t * attr)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * Destroys a mutex attributes object. The object can
+ * no longer be used.
+ *
+ * PARAMETERS
+ * attr
+ * pointer to an instance of pthread_mutexattr_t
+ *
+ *
+ * DESCRIPTION
+ * Destroys a mutex attributes object. The object can
+ * no longer be used.
+ *
+ * NOTES:
+ * 1) Does not affect mutexes created using 'attr'
+ *
+ * RESULTS
+ * 0 successfully released attr,
+ * EINVAL 'attr' is invalid.
+ *
+ * ------------------------------------------------------
+ */
+{
+ int result = 0;
+
+ if (attr == NULL || *attr == NULL)
+ {
+ result = EINVAL;
+ }
+ else
+ {
+ pthread_mutexattr_t ma = *attr;
+
+ *attr = NULL;
+ free (ma);
+
+ result = 0;
+ }
+
+ return (result);
+
+} /* pthread_mutexattr_destroy */
+
+
+int
+pthread_mutexattr_getpshared (const pthread_mutexattr_t * attr,
+ int *pshared)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * Determine whether mutexes created with 'attr' can be
+ * shared between processes.
+ *
+ * PARAMETERS
+ * attr
+ * pointer to an instance of pthread_mutexattr_t
+ *
+ * pshared
+ * will be set to one of:
+ *
+ * PTHREAD_PROCESS_SHARED
+ * May be shared if in shared memory
+ *
+ * PTHREAD_PROCESS_PRIVATE
+ * Cannot be shared.
+ *
+ *
+ * DESCRIPTION
+ * Mutexes creatd with 'attr' can be shared between
+ * processes if pthread_mutex_t variable is allocated
+ * in memory shared by these processes.
+ * NOTES:
+ * 1) pshared mutexes MUST be allocated in shared
+ * memory.
+ * 2) The following macro is defined if shared mutexes
+ * are supported:
+ * _POSIX_THREAD_PROCESS_SHARED
+ *
+ * RESULTS
+ * 0 successfully retrieved attribute,
+ * EINVAL 'attr' is invalid,
+ *
+ * ------------------------------------------------------
+ */
+{
+ int result;
+
+ if ((attr != NULL && *attr != NULL) &&
+ (pshared != NULL))
+ {
+ *pshared = (*attr)->pshared;
+ result = 0;
+ }
+ else
+ {
+ *pshared = PTHREAD_PROCESS_PRIVATE;
+ result = EINVAL;
+ }
+
+ return (result);
+
+} /* pthread_mutexattr_getpshared */
+
+
+int
+pthread_mutexattr_setpshared (pthread_mutexattr_t * attr,
+ int pshared)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * Mutexes created with 'attr' can be shared between
+ * processes if pthread_mutex_t variable is allocated
+ * in memory shared by these processes.
+ *
+ * PARAMETERS
+ * attr
+ * pointer to an instance of pthread_mutexattr_t
+ *
+ * pshared
+ * must be one of:
+ *
+ * PTHREAD_PROCESS_SHARED
+ * May be shared if in shared memory
+ *
+ * PTHREAD_PROCESS_PRIVATE
+ * Cannot be shared.
+ *
+ * DESCRIPTION
+ * Mutexes creatd with 'attr' can be shared between
+ * processes if pthread_mutex_t variable is allocated
+ * in memory shared by these processes.
+ *
+ * NOTES:
+ * 1) pshared mutexes MUST be allocated in shared
+ * memory.
+ *
+ * 2) The following macro is defined if shared mutexes
+ * are supported:
+ * _POSIX_THREAD_PROCESS_SHARED
+ *
+ * RESULTS
+ * 0 successfully set attribute,
+ * EINVAL 'attr' or pshared is invalid,
+ * ENOSYS PTHREAD_PROCESS_SHARED not supported,
+ *
+ * ------------------------------------------------------
+ */
+{
+ int result;
+
+ if ((attr != NULL && *attr != NULL) &&
+ ((pshared == PTHREAD_PROCESS_SHARED) ||
+ (pshared == PTHREAD_PROCESS_PRIVATE)))
+ {
+ if (pshared == PTHREAD_PROCESS_SHARED)
+ {
+
+#if !defined( _POSIX_THREAD_PROCESS_SHARED )
+
+ result = ENOSYS;
+ pshared = PTHREAD_PROCESS_PRIVATE;
+
+#else
+
+ result = 0;
+
+#endif /* _POSIX_THREAD_PROCESS_SHARED */
+
+ }
+ else
+ {
+ result = 0;
+ }
+
+ (*attr)->pshared = pshared;
+ }
+ else
+ {
+ result = EINVAL;
+ }
+
+ return (result);
+
+} /* pthread_mutexattr_setpshared */
+
+
+int
+pthread_mutexattr_settype (pthread_mutexattr_t * attr,
+ int kind)
+ /*
+ * ------------------------------------------------------
+ *
+ * DOCPUBLIC
+ * The pthread_mutexattr_settype() and
+ * pthread_mutexattr_gettype() functions respectively set and
+ * get the mutex type attribute. This attribute is set in the
+ * type parameter to these functions.
+ *
+ * PARAMETERS
+ * attr
+ * pointer to an instance of pthread_mutexattr_t
+ *
+ * type
+ * must be one of:
+ *
+ * PTHREAD_MUTEX_DEFAULT
+ *
+ * PTHREAD_MUTEX_NORMAL
+ *
+ * PTHREAD_MUTEX_ERRORCHECK
+ *
+ * PTHREAD_MUTEX_RECURSIVE
+ *
+ * DESCRIPTION
+ * The pthread_mutexattr_settype() and
+ * pthread_mutexattr_gettype() functions respectively set and
+ * get the mutex type attribute. This attribute is set in the
+ * type parameter to these functions. The default value of the
+ * type attribute is PTHREAD_MUTEX_DEFAULT.
+ *
+ * The type of mutex is contained in the type attribute of the
+ * mutex attributes. Valid mutex types include:
+ *
+ * PTHREAD_MUTEX_NORMAL
+ * This type of mutex does not detect deadlock. A
+ * thread attempting to relock this mutex without
+ * first unlocking it will deadlock. Attempting to
+ * unlock a mutex locked by a different thread
+ * results in undefined behavior. Attempting to
+ * unlock an unlocked mutex results in undefined
+ * behavior.
+ *
+ * PTHREAD_MUTEX_ERRORCHECK
+ * This type of mutex provides error checking. A
+ * thread attempting to relock this mutex without
+ * first unlocking it will return with an error. A
+ * thread attempting to unlock a mutex which another
+ * thread has locked will return with an error. A
+ * thread attempting to unlock an unlocked mutex will
+ * return with an error.
+ *
+ * PTHREAD_MUTEX_DEFAULT
+ * Same as PTHREAD_MUTEX_NORMAL.
+ *
+ * PTHREAD_MUTEX_RECURSIVE
+ * A thread attempting to relock this mutex without
+ * first unlocking it will succeed in locking the
+ * mutex. The relocking deadlock which can occur with
+ * mutexes of type PTHREAD_MUTEX_NORMAL cannot occur
+ * with this type of mutex. Multiple locks of this
+ * mutex require the same number of unlocks to
+ * release the mutex before another thread can
+ * acquire the mutex. A thread attempting to unlock a
+ * mutex which another thread has locked will return
+ * with an error. A thread attempting to unlock an
+ * unlocked mutex will return with an error. This
+ * type of mutex is only supported for mutexes whose
+ * process shared attribute is
+ * PTHREAD_PROCESS_PRIVATE.
+ *
+ * RESULTS
+ * 0 successfully set attribute,
+ * EINVAL 'attr' or 'type' is invalid,
+ *
+ * ------------------------------------------------------
+ */
+{
+ int result = 0;
+
+ if ((attr != NULL && *attr != NULL))
+ {
+ switch (kind)
+ {
+ case PTHREAD_MUTEX_FAST_NP:
+ case PTHREAD_MUTEX_RECURSIVE_NP:
+ case PTHREAD_MUTEX_ERRORCHECK_NP:
+ (*attr)->kind = kind;
+ break;
+ default:
+ result = EINVAL;
+ break;
+ }
+ }
+ else
+ {
+ result = EINVAL;
+ }
+
+ return (result);
+} /* pthread_mutexattr_settype */
+
+
+int
+pthread_mutexattr_gettype (pthread_mutexattr_t * attr,
+ int *kind)
+{
+ int result = 0;
+
+ if (attr != NULL && *attr != NULL && kind != NULL)
+ {
+ *kind = (*attr)->kind;
+ }
+ else
+ {
+ result = EINVAL;
+ }
+
+ return (result);
+}
+
+
+int
+pthread_mutex_lock(pthread_mutex_t *mutex)
+{
+ int result = 0;
+ pthread_mutex_t mx;
+
+
+ if (mutex == NULL || *mutex == NULL)
+ {
+ return EINVAL;
+ }
+
+ /*
+ * We do a quick check to see if we need to do more work
+ * to initialise a static mutex. We check
+ * again inside the guarded section of ptw32_mutex_check_need_init()
+ * to avoid race conditions.
+ */
+ if (*mutex == PTHREAD_MUTEX_INITIALIZER)
+ {
+ if ((result = ptw32_mutex_check_need_init(mutex)) != 0)
+ {
+ return(result);
+ }
+ }
+
+ mx = *mutex;
+
+ if( 0 == InterlockedIncrement( &mx->lock_idx ) )
+ {
+ mx->recursive_count = 1;
+ mx->ownerThread = (mx->kind != PTHREAD_MUTEX_FAST_NP
+ ? pthread_self()
+ : (pthread_t) PTW32_MUTEX_OWNER_ANONYMOUS);
+ }
+ else
+ {
+ if( mx->kind != PTHREAD_MUTEX_FAST_NP &&
+ pthread_equal( mx->ownerThread, pthread_self() ) )
+ {
+ mx->lock_idx--;
+
+ if( mx->kind == PTHREAD_MUTEX_RECURSIVE_NP )
+ {
+ mx->recursive_count++;
+ }
+ else
+ {
+ result = EDEADLK;
+ }
+ }
+ else
+ {
+ WaitForSingleObject( mx->wait_sema, INFINITE );
+ mx->recursive_count = 1;
+ mx->ownerThread = (mx->kind != PTHREAD_MUTEX_FAST_NP
+ ? pthread_self()
+ : (pthread_t) PTW32_MUTEX_OWNER_ANONYMOUS);
+ }
+ }
+
+ return(result);
+}
+
+int
+pthread_mutex_unlock(pthread_mutex_t *mutex)
+{
+ int result = 0;
+ pthread_mutex_t mx;
+
+ if (mutex == NULL || *mutex == NULL)
+ {
+ return EINVAL;
+ }
+
+ mx = *mutex;
+
+ /*
+ * If the thread calling us holds the mutex then there is no
+ * race condition. If another thread holds the
+ * lock then we shouldn't be in here.
+ */
+ if (mx != PTHREAD_MUTEX_INITIALIZER)
+ {
+ if (mx->ownerThread == (pthread_t) PTW32_MUTEX_OWNER_ANONYMOUS
+ || pthread_equal(mx->ownerThread, pthread_self()))
+ {
+ if( mx->kind != PTHREAD_MUTEX_RECURSIVE_NP
+ || 0 == --mx->recursive_count )
+ {
+ mx->ownerThread = NULL;
+
+ EnterCriticalSection( &mx->try_lock_cs );
+
+ if( InterlockedDecrement( &mx->lock_idx ) >= 0 )
+ {
+ /* Someone is waiting on that mutex */
+ ReleaseSemaphore( mx->wait_sema, 1, NULL );
+ }
+
+ LeaveCriticalSection( &mx->try_lock_cs );
+ }
+ }
+ else
+ {
+ result = EPERM;
+ }
+ }
+ else
+ {
+ result = EINVAL;
+ }
+
+ return(result);
+}
+
+int
+pthread_mutex_trylock(pthread_mutex_t *mutex)
+{
+ int result = 0;
+ pthread_mutex_t mx;
+
+ if (mutex == NULL || *mutex == NULL)
+ {
+ return EINVAL;
+ }
+
+ /*
+ * We do a quick check to see if we need to do more work
+ * to initialise a static mutex. We check
+ * again inside the guarded section of ptw32_mutex_check_need_init()
+ * to avoid race conditions.
+ */
+ if (*mutex == PTHREAD_MUTEX_INITIALIZER)
+ {
+ result = ptw32_mutex_check_need_init(mutex);
+ }
+
+ mx = *mutex;
+
+ if (result == 0)
+ {
+ /* Try to lock only if mutex seems available */
+ if( PTW32_MUTEX_LOCK_IDX_INIT == mx->lock_idx )
+ {
+ EnterCriticalSection( &mx->try_lock_cs );
+
+ if( 0 == InterlockedIncrement( &mx->lock_idx ) )
+ {
+ mx->recursive_count = 1;
+ mx->ownerThread = (mx->kind != PTHREAD_MUTEX_FAST_NP
+ ? pthread_self()
+ : (pthread_t) PTW32_MUTEX_OWNER_ANONYMOUS);
+ }
+ else
+ {
+ mx->lock_idx--;
+ result = EBUSY;
+ }
+
+ LeaveCriticalSection( &mx->try_lock_cs );
+ }
+ else
+ {
+ result = EBUSY;
+ }
+ }
+
+ return(result);
+}
diff --git a/win32/contrib/pthreads/need_errno.h b/win32/contrib/pthreads/need_errno.h new file mode 100644 index 000000000..d52313575 --- /dev/null +++ b/win32/contrib/pthreads/need_errno.h @@ -0,0 +1,132 @@ +/***
+* errno.h - system wide error numbers (set by system calls)
+*
+* Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved.
+*
+* Purpose:
+* This file defines the system-wide error numbers (set by
+* system calls). Conforms to the XENIX standard. Extended
+* for compatibility with Uniforum standard.
+* [System V]
+*
+* [Public]
+*
+****/
+
+#if _MSC_VER > 1000
+#pragma once
+#endif
+
+#ifndef _INC_ERRNO
+#define _INC_ERRNO
+
+#if !defined(_WIN32) && !defined(_MAC)
+#error ERROR: Only Mac or Win32 targets supported!
+#endif
+
+#include <winsock.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+/* Define _CRTIMP */
+
+#ifndef _CRTIMP
+#ifdef _DLL
+#define _CRTIMP __declspec(dllimport)
+#else /* ndef _DLL */
+#define _CRTIMP
+#endif /* _DLL */
+#endif /* _CRTIMP */
+
+
+/* Define __cdecl for non-Microsoft compilers */
+
+#if ( !defined(_MSC_VER) && !defined(__cdecl) )
+#define __cdecl
+#endif
+
+/* Define _CRTAPI1 (for compatibility with the NT SDK) */
+
+#ifndef _CRTAPI1
+#if _MSC_VER >= 800 && _M_IX86 >= 300
+#define _CRTAPI1 __cdecl
+#else
+#define _CRTAPI1
+#endif
+#endif
+
+
+/* declare reference to errno */
+
+#if (defined(_MT) || defined(_MD) || defined(_DLL)) && !defined(_MAC)
+_CRTIMP extern int * __cdecl _errno(void);
+#define errno (*_errno())
+#else /* ndef _MT && ndef _MD && ndef _DLL */
+_CRTIMP extern int errno;
+#endif /* _MT || _MD || _DLL */
+
+/* Error Codes */
+
+#define EPERM 1
+#define ENOENT 2
+#define ESRCH 3
+#define EINTR 4
+#define EIO 5
+#define ENXIO 6
+#define E2BIG 7
+#define ENOEXEC 8
+#define EBADF 9
+#define ECHILD 10
+#define EAGAIN 11
+#define ENOMEM 12
+#define EACCES 13
+#define EFAULT 14
+#define EBUSY 16
+#define EEXIST 17
+#define EXDEV 18
+#define ENODEV 19
+#define ENOTDIR 20
+#define EISDIR 21
+#define EINVAL 22
+#define ENFILE 23
+#define EMFILE 24
+#define ENOTTY 25
+#define EFBIG 27
+#define ENOSPC 28
+#define ESPIPE 29
+#define EROFS 30
+#define EMLINK 31
+#define EPIPE 32
+#define EDOM 33
+#define ERANGE 34
+#define EDEADLK 36
+
+/* defined differently in winsock.h on WinCE */
+#ifndef ENAMETOOLONG
+#define ENAMETOOLONG 38
+#endif
+
+#define ENOLCK 39
+#define ENOSYS 40
+
+/* defined differently in winsock.h on WinCE */
+#ifndef ENOTEMPTY
+#define ENOTEMPTY 41
+#endif
+
+#define EILSEQ 42
+
+/*
+ * Support EDEADLOCK for compatibiity with older MS-C versions.
+ */
+#define EDEADLOCK EDEADLK
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _INC_ERRNO */
diff --git a/win32/contrib/pthreads/nonportable.c b/win32/contrib/pthreads/nonportable.c new file mode 100644 index 000000000..078842ff0 --- /dev/null +++ b/win32/contrib/pthreads/nonportable.c @@ -0,0 +1,248 @@ +/*
+ * nonportable.c
+ *
+ * Description:
+ * This translation unit implements non-portable thread functions.
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright (C) 1998
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA
+ */
+
+#include "pthread.h"
+#include "implement.h"
+
+/*
+ * pthread_mutexattr_setkind_np()
+ */
+int pthread_mutexattr_setkind_np(pthread_mutexattr_t * attr, int kind)
+{
+ return pthread_mutexattr_settype( attr, kind );
+}
+
+
+/*
+ * pthread_mutexattr_getkind_np()
+ */
+int pthread_mutexattr_getkind_np(pthread_mutexattr_t * attr, int *kind)
+{
+ return pthread_mutexattr_gettype( attr, kind );
+}
+
+
+/*
+ * pthread_getw32threadhandle_np()
+ *
+ * Returns the win32 thread handle that the POSIX
+ * thread "thread" is running as.
+ *
+ * Applications can use the win32 handle to set
+ * win32 specific attributes of the thread.
+ */
+HANDLE
+pthread_getw32threadhandle_np(pthread_t thread)
+{
+ return (thread != NULL) ? (thread->threadH) : 0;
+}
+
+
+/*
+ * Provide pthread_delay_np posix function for NT
+ *
+ * DESCRIPTION
+ *
+ * This routine causes a thread to delay execution for a specific period of time.
+ * This period ends at the current time plus the specified interval. The routine
+ * will not return before the end of the period is reached, but may return an
+ * arbitrary amount of time after the period has gone by. This can be due to
+ * system load, thread priorities, and system timer granularity.
+ *
+ * Specifying an interval of zero (0) seconds and zero (0) nanoseconds is
+ * allowed and can be used to force the thread to give up the processor or to
+ * deliver a pending cancelation request.
+ *
+ * The timespec structure contains the following two fields:
+ *
+ * tv_sec is an integer number of seconds.
+ * tv_nsec is an integer number of nanoseconds.
+ *
+ * Return Values
+ *
+ * If an error condition occurs, this routine returns an integer value indicating
+ * the type of error. Possible return values are as follows:
+ *
+ * 0
+ * Successful completion.
+ * [EINVAL]
+ * The value specified by interval is invalid.
+ *
+ * Example
+ *
+ * The following code segment would wait for 5 and 1/2 seconds
+ *
+ * struct timespec tsWait;
+ * int intRC;
+ *
+ * tsWait.tv_sec = 5;
+ * tsWait.tv_nsec = 500000000L;
+ * intRC = pthread_delay_np(&tsWait);
+ */
+int
+pthread_delay_np (struct timespec * interval)
+{
+ DWORD wait_time, secs_in_millisecs, millisecs;
+
+ /*
+ * We are a cancelation point.
+ */
+ pthread_testcancel();
+
+ if (interval->tv_sec < 0 || interval->tv_nsec < 0)
+ {
+ return (EINVAL);
+ }
+
+ secs_in_millisecs = interval->tv_sec * 1000L; /* convert secs to millisecs */
+
+ /*
+ * Pedantically, we're ensuring that we don't return before the time is up,
+ * even by a fraction of a millisecond.
+ */
+ millisecs = (interval->tv_nsec + 999999L) / 1000000L; /* convert nanosecs to millisecs */
+
+ wait_time = secs_in_millisecs + millisecs;
+
+ Sleep(wait_time);
+
+ pthread_testcancel();
+
+ return (0);
+}
+
+
+/*
+ * pthread_getprocessors_np()
+ *
+ * Get the number of CPUs available to the process.
+ *
+ * If the available number of CPUs is 1 then pthread_spin_lock()
+ * will block rather than spin if the lock is already owned.
+ *
+ * pthread_spin_init() calls this routine when initialising
+ * a spinlock. If the number of available processors changes
+ * (after a call to SetProcessAffinityMask()) then only
+ * newly initialised spinlocks will notice.
+ */
+int
+pthread_getprocessors_np(int * count)
+{
+ DWORD vProcessCPUs;
+ DWORD vSystemCPUs;
+ int result = 0;
+
+ if (GetProcessAffinityMask(GetCurrentProcess(),
+ &vProcessCPUs,
+ &vSystemCPUs))
+ {
+ DWORD bit;
+ int CPUs = 0;
+
+ for (bit = 1; bit != 0; bit <<= 1)
+ {
+ if (vProcessCPUs & bit)
+ {
+ CPUs++;
+ }
+ }
+ *count = CPUs;
+ }
+ else
+ {
+ result = EAGAIN;
+ }
+
+ return(result);
+}
+
+
+BOOL
+pthread_win32_process_attach_np ()
+{
+ BOOL result = TRUE;
+
+ result = ptw32_processInitialize ();
+#ifdef _UWIN
+ pthread_count++;
+#endif
+
+ return result;
+}
+
+BOOL
+pthread_win32_process_detach_np ()
+{
+ if (ptw32_processInitialized)
+ {
+ pthread_t self = (pthread_t) pthread_getspecific (ptw32_selfThreadKey);
+
+ /*
+ * Detached threads have their resources automatically
+ * cleaned up upon exit (others must be 'joined').
+ */
+ if (self != NULL &&
+ self->detachState == PTHREAD_CREATE_DETACHED)
+ {
+ pthread_setspecific (ptw32_selfThreadKey, NULL);
+ ptw32_threadDestroy (self);
+ }
+
+ /*
+ * The DLL is being unmapped into the process's address space
+ */
+ ptw32_processTerminate ();
+ }
+
+ return TRUE;
+}
+
+BOOL
+pthread_win32_thread_attach_np ()
+{
+ return TRUE;
+}
+
+BOOL
+pthread_win32_thread_detach_np ()
+{
+ if (ptw32_processInitialized)
+ {
+ pthread_t self = (pthread_t) pthread_getspecific (ptw32_selfThreadKey);
+
+ /*
+ * Detached threads have their resources automatically
+ * cleaned up upon exit (others must be 'joined').
+ */
+ if (self != NULL &&
+ self->detachState == PTHREAD_CREATE_DETACHED)
+ {
+ pthread_setspecific (ptw32_selfThreadKey, NULL);
+ ptw32_threadDestroy (self);
+ }
+ }
+
+ return TRUE;
+}
diff --git a/win32/contrib/pthreads/private.c b/win32/contrib/pthreads/private.c new file mode 100644 index 000000000..9b10afb11 --- /dev/null +++ b/win32/contrib/pthreads/private.c @@ -0,0 +1,1022 @@ +/*
+ * private.c
+ *
+ * Description:
+ * This translation unit implements routines which are private to
+ * the implementation and may be used throughout it.
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright (C) 1998
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA
+ */
+
+#ifndef _UWIN
+# include <process.h>
+#endif
+#ifndef NEED_FTIME
+#include <sys/timeb.h>
+#endif
+#include "pthread.h"
+#include "semaphore.h"
+#include "implement.h"
+
+
+int
+ptw32_processInitialize (void)
+ /*
+ * ------------------------------------------------------
+ * DOCPRIVATE
+ * This function performs process wide initialization for
+ * the pthread library.
+ *
+ * PARAMETERS
+ * N/A
+ *
+ * DESCRIPTION
+ * This function performs process wide initialization for
+ * the pthread library.
+ * If successful, this routine sets the global variable
+ * ptw32_processInitialized to TRUE.
+ *
+ * RESULTS
+ * TRUE if successful,
+ * FALSE otherwise
+ *
+ * ------------------------------------------------------
+ */
+{
+ if (ptw32_processInitialized) {
+ /*
+ * ignore if already initialized. this is useful for
+ * programs that uses a non-dll pthread
+ * library. such programs must call ptw32_processInitialize() explicitely,
+ * since this initialization routine is automatically called only when
+ * the dll is loaded.
+ */
+ return TRUE;
+ }
+
+ ptw32_processInitialized = TRUE;
+
+ /*
+ * Initialize Keys
+ */
+ if ((pthread_key_create (&ptw32_selfThreadKey, NULL) != 0) ||
+ (pthread_key_create (&ptw32_cleanupKey, NULL) != 0))
+ {
+
+ ptw32_processTerminate ();
+ }
+
+ /*
+ * Set up the global test and init check locks.
+ */
+ InitializeCriticalSection(&ptw32_mutex_test_init_lock);
+ InitializeCriticalSection(&ptw32_cond_test_init_lock);
+ InitializeCriticalSection(&ptw32_rwlock_test_init_lock);
+ InitializeCriticalSection(&ptw32_spinlock_test_init_lock);
+
+ return (ptw32_processInitialized);
+
+} /* processInitialize */
+
+void
+ptw32_processTerminate (void)
+ /*
+ * ------------------------------------------------------
+ * DOCPRIVATE
+ * This function performs process wide termination for
+ * the pthread library.
+ *
+ * PARAMETERS
+ * N/A
+ *
+ * DESCRIPTION
+ * This function performs process wide termination for
+ * the pthread library.
+ * This routine sets the global variable
+ * ptw32_processInitialized to FALSE
+ *
+ * RESULTS
+ * N/A
+ *
+ * ------------------------------------------------------
+ */
+{
+ if (ptw32_processInitialized)
+ {
+
+ if (ptw32_selfThreadKey != NULL)
+ {
+ /*
+ * Release ptw32_selfThreadKey
+ */
+ pthread_key_delete (ptw32_selfThreadKey);
+
+ ptw32_selfThreadKey = NULL;
+ }
+
+ if (ptw32_cleanupKey != NULL)
+ {
+ /*
+ * Release ptw32_cleanupKey
+ */
+ pthread_key_delete (ptw32_cleanupKey);
+
+ ptw32_cleanupKey = NULL;
+ }
+
+ /*
+ * Destroy the global test and init check locks.
+ */
+ DeleteCriticalSection(&ptw32_spinlock_test_init_lock);
+ DeleteCriticalSection(&ptw32_rwlock_test_init_lock);
+ DeleteCriticalSection(&ptw32_cond_test_init_lock);
+ DeleteCriticalSection(&ptw32_mutex_test_init_lock);
+
+ ptw32_processInitialized = FALSE;
+ }
+
+} /* processTerminate */
+
+#ifdef __CLEANUP_SEH
+
+static DWORD
+ExceptionFilter (EXCEPTION_POINTERS * ep, DWORD * ei)
+{
+ switch (ep->ExceptionRecord->ExceptionCode)
+ {
+ case EXCEPTION_PTW32_SERVICES:
+ {
+ DWORD param;
+ DWORD numParams = ep->ExceptionRecord->NumberParameters;
+
+ numParams = (numParams > 3) ? 3 : numParams;
+
+ for (param = 0; param < numParams; param++)
+ {
+ ei[param] = ep->ExceptionRecord->ExceptionInformation[param];
+ }
+
+ return EXCEPTION_EXECUTE_HANDLER;
+ break;
+ }
+ default:
+ {
+ /*
+ * A system unexpected exception has occurred running the user's
+ * routine. We need to cleanup before letting the exception
+ * out of thread scope.
+ */
+ pthread_t self = pthread_self();
+
+ (void) pthread_mutex_destroy(&self->cancelLock);
+ ptw32_callUserDestroyRoutines(self);
+
+ return EXCEPTION_CONTINUE_SEARCH;
+ break;
+ }
+ }
+}
+
+#elif defined(__CLEANUP_CXX)
+
+#if defined(_MSC_VER)
+#include <eh.h>
+static terminate_function ptw32_oldTerminate;
+#else
+#include <new.h>
+static terminate_handler ptw32_oldTerminate;
+#endif
+
+#if 0
+#include <stdio.h>
+static pthread_mutex_t termLock = PTHREAD_MUTEX_INITIALIZER;
+#endif
+
+void
+ptw32_terminate ()
+{
+ pthread_t self = pthread_self();
+#if 0
+ FILE * fp;
+ pthread_mutex_lock(&termLock);
+ fp = fopen("pthread.log", "a");
+ fprintf(fp, "Terminate\n");
+ fclose(fp);
+ pthread_mutex_unlock(&termLock);
+#endif
+ set_terminate(ptw32_oldTerminate);
+ (void) pthread_mutex_destroy(&self->cancelLock);
+ ptw32_callUserDestroyRoutines(self);
+ terminate();
+}
+
+#endif /* _MSC_VER */
+
+#if ! defined (__MINGW32__) || defined (__MSVCRT__)
+unsigned __stdcall
+#else
+void
+#endif
+ptw32_threadStart (void * vthreadParms)
+{
+ ThreadParms *threadParms = (ThreadParms *) vthreadParms;
+ pthread_t self;
+ void *(*start) (void *);
+ void *arg;
+
+#ifdef __CLEANUP_SEH
+ DWORD ei[] = {0,0,0};
+#endif
+
+#ifdef __CLEANUP_C
+ int setjmp_rc;
+#endif
+
+ void * status = (void *) 0;
+
+ self = threadParms->tid;
+ start = threadParms->start;
+ arg = threadParms->arg;
+
+ free (threadParms);
+
+#if defined (__MINGW32__) && ! defined (__MSVCRT__)
+ /*
+ * beginthread does not return the thread id and is running
+ * before it returns us the thread handle, and so we do it here.
+ */
+ self->thread = GetCurrentThreadId ();
+ if (pthread_mutex_lock(&self->cancelLock) == 0)
+ {
+ /*
+ * We got the lock which means that our creator has
+ * our thread handle. Unlock and continue on.
+ */
+ (void) pthread_mutex_unlock(&self->cancelLock);
+ }
+#endif
+
+ pthread_setspecific (ptw32_selfThreadKey, self);
+
+#ifdef __CLEANUP_SEH
+
+ __try
+ {
+ /*
+ * Run the caller's routine;
+ */
+ status = self->exitStatus = (*start) (arg);
+#ifdef _UWIN
+ if (--pthread_count <= 0)
+ exit(0);
+#endif
+
+ }
+ __except (ExceptionFilter(GetExceptionInformation(), ei))
+ {
+ switch (ei[0])
+ {
+ case PTW32_EPS_CANCEL:
+ status = PTHREAD_CANCELED;
+#ifdef _UWIN
+ if (--pthread_count <= 0)
+ exit(0);
+#endif
+ break;
+ case PTW32_EPS_EXIT:
+ status = self->exitStatus;
+ break;
+ default:
+ status = PTHREAD_CANCELED;
+ break;
+ }
+ }
+
+#else /* __CLEANUP_SEH */
+
+#ifdef __CLEANUP_C
+
+ setjmp_rc = setjmp( self->start_mark );
+
+ if( 0 == setjmp_rc ) {
+
+ /*
+ * Run the caller's routine;
+ */
+ status = self->exitStatus = (*start) (arg);
+ }
+
+ else {
+
+ switch (setjmp_rc)
+ {
+ case PTW32_EPS_CANCEL:
+ status = PTHREAD_CANCELED;
+ break;
+ case PTW32_EPS_EXIT:
+ status = self->exitStatus;
+ break;
+ default:
+ status = PTHREAD_CANCELED;
+ break;
+ }
+ }
+
+#else /* __CLEANUP_C */
+
+#ifdef __CLEANUP_CXX
+
+ ptw32_oldTerminate = set_terminate(&ptw32_terminate);
+
+ try
+ {
+ /*
+ * Run the caller's routine in a nested try block so that we
+ * can run the user's terminate function, which may call
+ * pthread_exit() or be canceled.
+ */
+ try
+ {
+ status = self->exitStatus = (*start) (arg);
+ }
+ catch (ptw32_exception &)
+ {
+ /*
+ * Pass these through to the outer block.
+ */
+ throw;
+ }
+ catch(...)
+ {
+ /*
+ * We want to run the user's terminate function if supplied.
+ * That function may call pthread_exit() or be canceled, which will
+ * be handled by the outer try block.
+ *
+ * ptw32_terminate() will be called if there is no user
+ * supplied function.
+ */
+
+#if defined(_MSC_VER)
+ terminate_function term_func = set_terminate(0);
+#else
+ terminate_handler term_func = set_terminate(0);
+#endif
+
+ set_terminate(term_func);
+
+ if (term_func != 0) {
+ term_func();
+ }
+
+ throw;
+ }
+ }
+ catch (ptw32_exception_cancel &)
+ {
+ /*
+ * Thread was cancelled.
+ */
+ status = self->exitStatus = PTHREAD_CANCELED;
+ }
+ catch (ptw32_exception_exit &)
+ {
+ /*
+ * Thread was exited via pthread_exit().
+ */
+ status = self->exitStatus;
+ }
+ catch (...)
+ {
+ /*
+ * A system unexpected exception has occurred running the user's
+ * terminate routine. We get control back within this block - cleanup
+ * and release the exception out of thread scope.
+ */
+ status = self->exitStatus = PTHREAD_CANCELED;
+ (void) pthread_mutex_destroy(&self->cancelLock);
+ (void) set_terminate(ptw32_oldTerminate);
+ ptw32_callUserDestroyRoutines(self);
+ throw;
+
+ /*
+ * Never reached.
+ */
+ }
+
+ (void) set_terminate(ptw32_oldTerminate);
+
+#else
+
+#error ERROR [__FILE__, line __LINE__]: Cleanup type undefined.
+
+#endif /* __CLEANUP_CXX */
+#endif /* __CLEANUP_C */
+#endif /* __CLEANUP_SEH */
+
+
+ (void) pthread_mutex_destroy(&self->cancelLock);
+
+#if 1
+ if (self->detachState == PTHREAD_CREATE_DETACHED)
+ {
+ /*
+ * We need to cleanup the pthread now in case we have
+ * been statically linked, in which case the cleanup
+ * in dllMain won't get done. Joinable threads will
+ * be cleaned up by pthread_join().
+ *
+ * Note that implicitly created pthreads (those created
+ * for Win32 threads which have called pthreads routines)
+ * must be cleaned up explicitly by the application
+ * (by calling pthread_win32_thread_detach_np()) if
+ * this library has been statically linked. For the dll,
+ * dllMain will do the cleanup automatically.
+ */
+ (void) pthread_win32_thread_detach_np ();
+ }
+ else
+ {
+ ptw32_callUserDestroyRoutines (self);
+ }
+#else
+ ptw32_callUserDestroyRoutines (self);
+#endif
+
+#if ! defined (__MINGW32__) || defined (__MSVCRT__)
+ _endthreadex ((unsigned) status);
+#else
+ _endthread ();
+#endif
+
+ /*
+ * Never reached.
+ */
+
+#if ! defined (__MINGW32__) || defined (__MSVCRT__)
+ return (unsigned) status;
+#endif
+
+} /* ptw32_threadStart */
+
+void
+ptw32_threadDestroy (pthread_t thread)
+{
+ if (thread != NULL)
+ {
+ ptw32_callUserDestroyRoutines (thread);
+
+ if (thread->cancelEvent != NULL)
+ {
+ CloseHandle (thread->cancelEvent);
+ }
+
+#if ! defined (__MINGW32__) || defined (__MSVCRT__)
+ /* See documentation for endthread vs endthreadex. */
+ if( thread->threadH != 0 )
+ {
+ CloseHandle( thread->threadH );
+ }
+#endif
+
+ free (thread);
+ }
+
+} /* ptw32_threadDestroy */
+
+int
+ptw32_tkAssocCreate (ThreadKeyAssoc ** assocP,
+ pthread_t thread,
+ pthread_key_t key)
+ /*
+ * -------------------------------------------------------------------
+ * This routine creates an association that
+ * is unique for the given (thread,key) combination.The association
+ * is referenced by both the thread and the key.
+ * This association allows us to determine what keys the
+ * current thread references and what threads a given key
+ * references.
+ * See the detailed description
+ * at the beginning of this file for further details.
+ *
+ * Notes:
+ * 1) New associations are pushed to the beginning of the
+ * chain so that the internal ptw32_selfThreadKey association
+ * is always last, thus allowing selfThreadExit to
+ * be implicitly called by pthread_exit last.
+ *
+ * Parameters:
+ * assocP
+ * address into which the association is returned.
+ * thread
+ * current running thread. If NULL, then association
+ * is only added to the key. A NULL thread indicates
+ * that the user called pthread_setspecific prior
+ * to starting a thread. That's ok.
+ * key
+ * key on which to create an association.
+ * Returns:
+ * 0 - if successful,
+ * ENOMEM - not enough memory to create assoc or other object
+ * EINVAL - an internal error occurred
+ * ENOSYS - an internal error occurred
+ * -------------------------------------------------------------------
+ */
+{
+ int result;
+ ThreadKeyAssoc *assoc;
+
+ /*
+ * Have to create an association and add it
+ * to both the key and the thread.
+ */
+ assoc = (ThreadKeyAssoc *) calloc (1, sizeof (*assoc));
+
+ if (assoc == NULL)
+ {
+ result = ENOMEM;
+ goto FAIL0;
+ }
+
+ /*
+ * Initialise only when used for the first time.
+ */
+ assoc->lock = PTHREAD_MUTEX_INITIALIZER;
+ assoc->thread = thread;
+ assoc->key = key;
+
+ /*
+ * Register assoc with key
+ */
+ if ((result = pthread_mutex_lock (&(key->threadsLock))) != 0)
+ {
+ goto FAIL2;
+ }
+
+ assoc->nextThread = (ThreadKeyAssoc *) key->threads;
+ key->threads = (void *) assoc;
+
+ pthread_mutex_unlock (&(key->threadsLock));
+
+ if (thread != NULL)
+ {
+ /*
+ * Register assoc with thread
+ */
+ assoc->nextKey = (ThreadKeyAssoc *) thread->keys;
+ thread->keys = (void *) assoc;
+ }
+
+ *assocP = assoc;
+
+ return (result);
+
+ /*
+ * -------------
+ * Failure Code
+ * -------------
+ */
+FAIL2:
+ pthread_mutex_destroy (&(assoc->lock));
+ free (assoc);
+
+FAIL0:
+
+ return (result);
+
+} /* ptw32_tkAssocCreate */
+
+
+void
+ptw32_tkAssocDestroy (ThreadKeyAssoc * assoc)
+ /*
+ * -------------------------------------------------------------------
+ * This routine releases all resources for the given ThreadKeyAssoc
+ * once it is no longer being referenced
+ * ie) both the key and thread have stopped referencing it.
+ *
+ * Parameters:
+ * assoc
+ * an instance of ThreadKeyAssoc.
+ * Returns:
+ * N/A
+ * -------------------------------------------------------------------
+ */
+{
+
+ if ((assoc != NULL) &&
+ (assoc->key == NULL && assoc->thread == NULL))
+ {
+
+ pthread_mutex_destroy (&(assoc->lock));
+
+ free (assoc);
+ }
+
+} /* ptw32_tkAssocDestroy */
+
+
+void
+ptw32_callUserDestroyRoutines (pthread_t thread)
+ /*
+ * -------------------------------------------------------------------
+ * DOCPRIVATE
+ *
+ * This the routine runs through all thread keys and calls
+ * the destroy routines on the user's data for the current thread.
+ * It simulates the behaviour of POSIX Threads.
+ *
+ * PARAMETERS
+ * thread
+ * an instance of pthread_t
+ *
+ * RETURNS
+ * N/A
+ * -------------------------------------------------------------------
+ */
+{
+ ThreadKeyAssoc **nextP;
+ ThreadKeyAssoc *assoc;
+
+ if (thread != NULL)
+ {
+ /*
+ * Run through all Thread<-->Key associations
+ * for the current thread.
+ * If the pthread_key_t still exits (ie the assoc->key
+ * is not NULL) then call the user's TSD destroy routine.
+ * Notes:
+ * If assoc->key is NULL, then the user previously called
+ * PThreadKeyDestroy. The association is now only referenced
+ * by the current thread and must be released; otherwise
+ * the assoc will be destroyed when the key is destroyed.
+ */
+ nextP = (ThreadKeyAssoc **) & (thread->keys);
+ assoc = *nextP;
+
+ while (assoc != NULL)
+ {
+
+ if (pthread_mutex_lock (&(assoc->lock)) == 0)
+ {
+ pthread_key_t k;
+ if ((k = assoc->key) != NULL)
+ {
+ /*
+ * Key still active; pthread_key_delete
+ * will block on this same mutex before
+ * it can release actual key; therefore,
+ * key is valid and we can call the destroy
+ * routine;
+ */
+ void *value = NULL;
+
+ value = pthread_getspecific (k);
+ if (value != NULL && k->destructor != NULL)
+ {
+
+#ifdef __cplusplus
+
+ try
+ {
+ /*
+ * Run the caller's cleanup routine.
+ */
+ (*(k->destructor)) (value);
+ }
+ catch (...)
+ {
+ /*
+ * A system unexpected exception has occurred
+ * running the user's destructor.
+ * We get control back within this block in case
+ * the application has set up it's own terminate
+ * handler. Since we are leaving the thread we
+ * should not get any internal pthreads
+ * exceptions.
+ */
+ terminate();
+ }
+
+#else /* __cplusplus */
+
+ /*
+ * Run the caller's cleanup routine.
+ */
+ (*(k->destructor)) (value);
+
+#endif /* __cplusplus */
+ }
+ }
+
+ /*
+ * mark assoc->thread as NULL to indicate the
+ * thread no longer references this association
+ */
+ assoc->thread = NULL;
+
+ /*
+ * Remove association from the pthread_t chain
+ */
+ *nextP = assoc->nextKey;
+
+ pthread_mutex_unlock (&(assoc->lock));
+
+ ptw32_tkAssocDestroy (assoc);
+
+ assoc = *nextP;
+ }
+ }
+ }
+
+} /* ptw32_callUserDestroyRoutines */
+
+
+
+#ifdef NEED_FTIME
+
+/*
+ * time between jan 1, 1601 and jan 1, 1970 in units of 100 nanoseconds
+ */
+#define TIMESPEC_TO_FILETIME_OFFSET \
+ ( ((LONGLONG) 27111902 << 32) + (LONGLONG) 3577643008 )
+
+static INLINE void
+timespec_to_filetime(const struct timespec *ts, FILETIME *ft)
+ /*
+ * -------------------------------------------------------------------
+ * converts struct timespec
+ * where the time is expressed in seconds and nanoseconds from Jan 1, 1970.
+ * into FILETIME (as set by GetSystemTimeAsFileTime), where the time is
+ * expressed in 100 nanoseconds from Jan 1, 1601,
+ * -------------------------------------------------------------------
+ */
+{
+ *(LONGLONG *)ft = ts->tv_sec * 10000000 + (ts->tv_nsec + 50) / 100 + TIMESPEC_TO_FILETIME_OFFSET;
+}
+
+static INLINE void
+filetime_to_timespec(const FILETIME *ft, struct timespec *ts)
+ /*
+ * -------------------------------------------------------------------
+ * converts FILETIME (as set by GetSystemTimeAsFileTime), where the time is
+ * expressed in 100 nanoseconds from Jan 1, 1601,
+ * into struct timespec
+ * where the time is expressed in seconds and nanoseconds from Jan 1, 1970.
+ * -------------------------------------------------------------------
+ */
+{
+ ts->tv_sec = (int)((*(LONGLONG *)ft - TIMESPEC_TO_FILETIME_OFFSET) / 10000000);
+ ts->tv_nsec = (int)((*(LONGLONG *)ft - TIMESPEC_TO_FILETIME_OFFSET - ((LONGLONG)ts->tv_sec * (LONGLONG)10000000)) * 100);
+}
+
+#endif /* NEED_FTIME */
+
+int
+ptw32_sem_timedwait (sem_t * sem, const struct timespec * abstime)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * This function waits on a semaphore possibly until
+ * 'abstime' time.
+ *
+ * PARAMETERS
+ * sem
+ * pointer to an instance of sem_t
+ *
+ * abstime
+ * pointer to an instance of struct timespec
+ *
+ * DESCRIPTION
+ * This function waits on a semaphore. If the
+ * semaphore value is greater than zero, it decreases
+ * its value by one. If the semaphore value is zero, then
+ * the calling thread (or process) is blocked until it can
+ * successfully decrease the value or until interrupted by
+ * a signal.
+ *
+ * If 'abstime' is a NULL pointer then this function will
+ * block until it can successfully decrease the value or
+ * until interrupted by a signal.
+ *
+ * RESULTS
+ * 0 successfully decreased semaphore,
+ * -1 failed, error in errno
+ * ERRNO
+ * EINVAL 'sem' is not a valid semaphore,
+ * ENOSYS semaphores are not supported,
+ * EINTR the function was interrupted by a signal,
+ * EDEADLK a deadlock condition was detected.
+ * ETIMEDOUT abstime elapsed before success.
+ *
+ * ------------------------------------------------------
+ */
+{
+ int result = 0;
+
+#ifdef NEED_FTIME
+
+ struct timespec currSysTime;
+
+#else /* NEED_FTIME */
+
+ struct _timeb currSysTime;
+
+#endif /* NEED_FTIME */
+
+ const DWORD NANOSEC_PER_MILLISEC = 1000000;
+ const DWORD MILLISEC_PER_SEC = 1000;
+ DWORD milliseconds;
+
+ if (sem == NULL)
+ {
+ result = EINVAL;
+ }
+ else
+ {
+ if (abstime == NULL)
+ {
+ milliseconds = INFINITE;
+ }
+ else
+ {
+ /*
+ * Calculate timeout as milliseconds from current system time.
+ */
+
+ /* get current system time */
+
+#ifdef NEED_FTIME
+
+ {
+ FILETIME ft;
+ SYSTEMTIME st;
+
+ GetSystemTime(&st);
+ SystemTimeToFileTime(&st, &ft);
+ /*
+ * GetSystemTimeAsFileTime(&ft); would be faster,
+ * but it does not exist on WinCE
+ */
+
+ filetime_to_timespec(&ft, &currSysTime);
+ }
+
+ /*
+ * subtract current system time from abstime
+ */
+ milliseconds = (abstime->tv_sec - currSysTime.tv_sec) * MILLISEC_PER_SEC;
+ milliseconds += ((abstime->tv_nsec - currSysTime.tv_nsec) + (NANOSEC_PER_MILLISEC/2)) / NANOSEC_PER_MILLISEC;
+
+#else /* NEED_FTIME */
+ _ftime(&currSysTime);
+
+ /*
+ * subtract current system time from abstime
+ */
+ milliseconds = (abstime->tv_sec - currSysTime.time) * MILLISEC_PER_SEC;
+ milliseconds += ((abstime->tv_nsec + (NANOSEC_PER_MILLISEC/2)) / NANOSEC_PER_MILLISEC) -
+ currSysTime.millitm;
+
+#endif /* NEED_FTIME */
+
+
+ if (((int) milliseconds) < 0)
+ milliseconds = 0;
+ }
+
+#ifdef NEED_SEM
+
+ result = (pthreadCancelableTimedWait ((*sem)->event, milliseconds));
+
+#else /* NEED_SEM */
+
+ result = (pthreadCancelableTimedWait ((*sem)->sem, milliseconds));
+
+#endif
+
+ }
+
+ if (result != 0)
+ {
+
+ errno = result;
+ return -1;
+
+ }
+
+#ifdef NEED_SEM
+
+ ptw32_decrease_semaphore(sem);
+
+#endif /* NEED_SEM */
+
+ return 0;
+
+} /* ptw32_sem_timedwait */
+
+
+DWORD
+ptw32_get_exception_services_code(void)
+{
+#ifdef __CLEANUP_SEH
+
+ return EXCEPTION_PTW32_SERVICES;
+
+#else
+
+ return (DWORD) NULL;
+
+#endif
+}
+
+
+void
+ptw32_throw(DWORD exception)
+{
+#ifdef __CLEANUP_C
+ pthread_t self = pthread_self();
+#endif
+
+
+#ifdef __CLEANUP_SEH
+ DWORD exceptionInformation[3];
+#endif
+
+ if (exception != PTW32_EPS_CANCEL &&
+ exception != PTW32_EPS_EXIT)
+ {
+ /* Should never enter here */
+ exit(1);
+ }
+
+#ifdef __CLEANUP_SEH
+
+
+ exceptionInformation[0] = (DWORD) (exception);
+ exceptionInformation[1] = (DWORD) (0);
+ exceptionInformation[2] = (DWORD) (0);
+
+ RaiseException (
+ EXCEPTION_PTW32_SERVICES,
+ 0,
+ 3,
+ exceptionInformation);
+
+#else /* __CLEANUP_SEH */
+
+#ifdef __CLEANUP_C
+
+ ptw32_pop_cleanup_all( 1 );
+
+ longjmp( self->start_mark, exception );
+
+#else /* __CLEANUP_C */
+
+#ifdef __CLEANUP_CXX
+
+ switch (exception)
+ {
+ case PTW32_EPS_CANCEL:
+ throw ptw32_exception_cancel();
+ break;
+ case PTW32_EPS_EXIT:
+ throw ptw32_exception_exit();
+ break;
+ }
+
+#else
+
+#error ERROR [__FILE__, line __LINE__]: Cleanup type undefined.
+
+#endif /* __CLEANUP_CXX */
+
+#endif /* __CLEANUP_C */
+
+#endif /* __CLEANUP_SEH */
+
+ /* Never reached */
+}
+
+void
+ptw32_pop_cleanup_all(int execute)
+{
+ while( NULL != ptw32_pop_cleanup(execute) ) {
+ }
+}
diff --git a/win32/contrib/pthreads/pthread.def b/win32/contrib/pthreads/pthread.def new file mode 100644 index 000000000..bdf92ed69 --- /dev/null +++ b/win32/contrib/pthreads/pthread.def @@ -0,0 +1,157 @@ +; pthread.def
+; Last updated: $Date: 2003/04/20 16:42:08 $
+
+; Currently unimplemented functions are commented out.
+
+;LIBRARY pthread
+
+EXPORTS
+;pthread_atfork
+pthread_attr_destroy
+pthread_attr_getdetachstate
+pthread_attr_getinheritsched
+pthread_attr_getschedparam
+pthread_attr_getschedpolicy
+pthread_attr_getscope
+pthread_attr_getstackaddr
+pthread_attr_getstacksize
+pthread_attr_init
+pthread_attr_setdetachstate
+pthread_attr_setinheritsched
+pthread_attr_setschedparam
+pthread_attr_setschedpolicy
+pthread_attr_setscope
+pthread_attr_setstackaddr
+pthread_attr_setstacksize
+pthread_cancel
+;
+; These two are implemented as macros in pthread.h
+;
+;pthread_cleanup_pop
+;pthread_cleanup_push
+;
+pthread_condattr_destroy
+pthread_condattr_getpshared
+pthread_condattr_init
+pthread_condattr_setpshared
+pthread_cond_broadcast
+pthread_cond_destroy
+pthread_cond_init
+pthread_cond_signal
+pthread_cond_timedwait
+pthread_cond_wait
+pthread_create
+pthread_detach
+pthread_equal
+pthread_exit
+pthread_getconcurrency
+pthread_getschedparam
+pthread_getspecific
+pthread_join
+pthread_key_create
+pthread_key_delete
+;pthread_kill
+pthread_mutexattr_destroy
+;pthread_mutexattr_getprioceiling
+;pthread_mutexattr_getprotocol
+pthread_mutexattr_getpshared
+pthread_mutexattr_gettype
+pthread_mutexattr_init
+;pthread_mutexattr_setprioceiling
+;pthread_mutexattr_setprotocol
+pthread_mutexattr_setpshared
+pthread_mutexattr_settype
+pthread_mutexattr_destroy
+pthread_mutex_init
+pthread_mutex_destroy
+pthread_mutex_lock
+pthread_mutex_trylock
+pthread_mutex_unlock
+pthread_once
+pthread_self
+pthread_setcancelstate
+pthread_setcanceltype
+pthread_setconcurrency
+pthread_setschedparam
+pthread_setspecific
+;pthread_sigmask
+pthread_testcancel
+;
+; POSIX 1.b
+;
+sched_get_priority_min
+sched_get_priority_max
+sched_getscheduler
+sched_setscheduler
+sched_yield
+sem_init
+sem_destroy
+sem_trywait
+sem_wait
+sem_post
+sem_open
+sem_close
+sem_unlink
+sem_getvalue
+;
+; This next one is a macro
+;sched_rr_get_interval
+;
+;
+; Read/Write Locks
+;
+pthread_rwlock_init
+pthread_rwlock_destroy
+pthread_rwlock_tryrdlock
+pthread_rwlock_trywrlock
+pthread_rwlock_rdlock
+pthread_rwlock_wrlock
+pthread_rwlock_unlock
+;
+; Spin locks
+;
+pthread_spin_init
+pthread_spin_destroy
+pthread_spin_lock
+pthread_spin_unlock
+pthread_spin_trylock
+;
+; Barriers
+;
+pthread_barrier_init
+pthread_barrier_destroy
+pthread_barrier_wait
+pthread_barrierattr_init
+pthread_barrierattr_destroy
+pthread_barrierattr_getpshared
+pthread_barrierattr_setpshared
+;
+; Non-portable/compatibility with other implementations
+;
+pthread_delay_np
+pthread_mutexattr_getkind_np
+pthread_mutexattr_setkind_np
+;
+; Non-portable local implementation only
+;
+pthread_getw32threadhandle_np
+pthread_getprocessors_np
+pthreadCancelableWait
+pthreadCancelableTimedWait
+;
+; For use when linking statically
+;
+pthread_win32_process_attach_np
+pthread_win32_process_detach_np
+pthread_win32_thread_attach_np
+pthread_win32_thread_detach_np
+;
+; Needed if !defined(_MSC_VER) && !defined(__cplusplus)
+;
+ptw32_push_cleanup
+ptw32_pop_cleanup
+;
+; Not for use directly. Needed by macros in pthread.h
+; to return internal SEH code.
+;
+ptw32_get_exception_services_code
diff --git a/win32/contrib/pthreads/pthread.dsp b/win32/contrib/pthreads/pthread.dsp new file mode 100644 index 000000000..5706f6d00 --- /dev/null +++ b/win32/contrib/pthreads/pthread.dsp @@ -0,0 +1,207 @@ +# Microsoft Developer Studio Project File - Name="PThread" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=PThread - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "PThread.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "PThread.mak" CFG="PThread - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "PThread - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "PThread - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "PThread - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PTHREAD_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /G6 /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D _WIN32_WINNT=0x400 /D "PTHREAD_EXPORTS" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x809 /d "NDEBUG"
+# ADD RSC /l 0x809 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib /nologo /dll /machine:I386
+
+!ELSEIF "$(CFG)" == "PThread - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PTHREAD_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D _WIN32_WINNT=0x400 /D "PTHREAD_EXPORTS" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x809 /d "_DEBUG"
+# ADD RSC /l 0x809 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib /nologo /dll /map /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "PThread - Win32 Release"
+# Name "PThread - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\attr.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\cancel.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\cleanup.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\condvar.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\create.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\dll.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\exit.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\fork.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\global.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\misc.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mutex.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\private.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\rwlock.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sched.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\semaphore.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\signal.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sync.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\tsd.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\acconfig.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\config.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\implement.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\need_errno.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\pthread.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\sched.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\semaphore.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\pthread.def
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/win32/contrib/pthreads/pthread.dsw b/win32/contrib/pthreads/pthread.dsw new file mode 100644 index 000000000..141635c50 --- /dev/null +++ b/win32/contrib/pthreads/pthread.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "PThread"=.\PThread.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/win32/contrib/pthreads/pthread.h b/win32/contrib/pthreads/pthread.h new file mode 100644 index 000000000..31e2cf918 --- /dev/null +++ b/win32/contrib/pthreads/pthread.h @@ -0,0 +1,1077 @@ +/* This is the POSIX thread API (POSIX 1003).
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright (C) 1998
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA
+ */
+
+#if !defined( PTHREAD_H )
+#define PTHREAD_H
+
+#ifdef _UWIN
+# define HAVE_STRUCT_TIMESPEC 1
+# define HAVE_SIGNAL_H 1
+# undef HAVE_CONFIG_H
+# pragma comment(lib, "pthread")
+#endif
+
+/*
+ * -------------------------------------------------------------
+ *
+ *
+ * Module: pthread.h
+ *
+ * Purpose:
+ * Provides an implementation of PThreads based upon the
+ * standard:
+ *
+ * POSIX 1003.1c-1995 (POSIX.1c)
+ *
+ * Parts of the implementation also comply with the
+ * Open Group Unix 98 specification in order to enhance
+ * code portability between Windows, various commercial
+ * Unix implementations, and Linux.
+ *
+ * Authors:
+ * There have been many contributors to this library.
+ * The initial implementation was contributed by
+ * John Bossom, and several others have provided major
+ * sections or revisions of parts of the implementation.
+ * Often significant effort has been contributed to
+ * find and fix important bugs and other problems to
+ * improve the reliability of the library, which sometimes
+ * is not reflected in the amount of code which changed as
+ * result.
+ * As much as possible, the contributors are acknowledged
+ * in the ChangeLog file in the source code distribution
+ * where their changes are noted in detail.
+ *
+ * Contributors are listed in the MAINTAINERS file.
+ *
+ * As usual, all bouquets go to the contributors, and all
+ * brickbats go to the project maintainer.
+ *
+ * Maintainer:
+ * The code base for this project is coordinated and
+ * eventually pre-tested, packaged, and made available by
+ *
+ * Ross Johnson <rpj@ise.canberra.edu.au>
+ *
+ * QA Testers:
+ * Ultimately, the library is tested in the real world by
+ * a host of competent and demanding scientists and
+ * engineers who report bugs and/or provide solutions
+ * which are then fixed or incorporated into subsequent
+ * versions of the library. Each time a bug is fixed, a
+ * test case is written to prove the fix and ensure
+ * that later changes to the code don't reintroduce the
+ * same error. The number of test cases is slowly growing
+ * and therefore so is the code reliability.
+ *
+ * Compliance:
+ * See the file ANNOUNCE for the list of implemented
+ * and not-implemented routines and defined options.
+ * Of course, these are all defined is this file as well.
+ *
+ * Web site:
+ * The source code and other information about this library
+ * are available from
+ *
+ * http://sources.redhat.com/pthreads-win32/
+ *
+ * -------------------------------------------------------------
+ */
+
+/*
+ * -----------------
+ * autoconf switches
+ * -----------------
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
+
+#include <windows.h>
+
+#ifndef NEED_FTIME
+#include <time.h>
+#else /* NEED_FTIME */
+/* use native WIN32 time API */
+#endif /* NEED_FTIME */
+
+#if HAVE_SIGNAL_H
+#include <signal.h>
+#endif /* HAVE_SIGNAL_H */
+
+#include <setjmp.h>
+
+#ifndef HAVE_STRUCT_TIMESPEC
+struct timespec {
+ long tv_sec;
+ long tv_nsec;
+};
+#endif /* HAVE_STRUCT_TIMESPEC */
+
+#ifndef SIG_BLOCK
+#define SIG_BLOCK 0
+#endif /* SIG_BLOCK */
+
+#ifndef SIG_UNBLOCK
+#define SIG_UNBLOCK 1
+#endif /* SIG_UNBLOCK */
+
+#ifndef SIG_SETMASK
+#define SIG_SETMASK 2
+#endif /* SIG_SETMASK */
+
+/*
+ * note: ETIMEDOUT is correctly defined in winsock.h
+ */
+#include <winsock.h>
+
+#ifdef NEED_ERRNO
+# include "need_errno.h"
+#else
+# include <errno.h>
+#endif
+
+#include <sched.h>
+
+/*
+ * In case ETIMEDOUT hasn't been defined above somehow.
+ */
+#ifndef ETIMEDOUT
+# define ETIMEDOUT 10060 /* This is the value in winsock.h. */
+#endif
+
+/*
+ * Several systems don't define ENOTSUP. If not, we use
+ * the same value as Solaris.
+ */
+#ifndef ENOTSUP
+# define ENOTSUP 48
+#endif
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/*
+ * -------------------------------------------------------------
+ *
+ * POSIX 1003.1c-1995 Options
+ * ===========================
+ *
+ * _POSIX_THREADS (set)
+ * If set, you can use threads
+ *
+ * _POSIX_THREAD_ATTR_STACKSIZE (set)
+ * If set, you can control the size of a thread's
+ * stack
+ * pthread_attr_getstacksize
+ * pthread_attr_setstacksize
+ *
+ * _POSIX_THREAD_ATTR_STACKADDR (not set)
+ * If set, you can allocate and control a thread's
+ * stack. If not supported, the following functions
+ * will return ENOSYS, indicating they are not
+ * supported:
+ * pthread_attr_getstackaddr
+ * pthread_attr_setstackaddr
+ *
+ * _POSIX_THREAD_PRIORITY_SCHEDULING (set)
+ * If set, you can use realtime scheduling.
+ * Indicates the availability of:
+ * pthread_attr_getinheritsched
+ * pthread_attr_getschedparam
+ * pthread_attr_getschedpolicy
+ * pthread_attr_getscope
+ * pthread_attr_setinheritsched
+ * pthread_attr_setschedparam
+ * pthread_attr_setschedpolicy
+ * pthread_attr_setscope
+ * pthread_getschedparam
+ * pthread_setschedparam
+ * sched_get_priority_max
+ * sched_get_priority_min
+ * sched_rr_set_interval
+ *
+ * _POSIX_THREAD_PRIO_INHERIT (not set)
+ * If set, you can create priority inheritance
+ * mutexes.
+ * pthread_mutexattr_getprotocol +
+ * pthread_mutexattr_setprotocol +
+ *
+ * _POSIX_THREAD_PRIO_PROTECT (not set)
+ * If set, you can create priority ceiling mutexes
+ * Indicates the availability of:
+ * pthread_mutex_getprioceiling
+ * pthread_mutex_setprioceiling
+ * pthread_mutexattr_getprioceiling
+ * pthread_mutexattr_getprotocol +
+ * pthread_mutexattr_setprioceiling
+ * pthread_mutexattr_setprotocol +
+ *
+ * _POSIX_THREAD_PROCESS_SHARED (not set)
+ * If set, you can create mutexes and condition
+ * variables that can be shared with another
+ * process.If set, indicates the availability
+ * of:
+ * pthread_mutexattr_getpshared
+ * pthread_mutexattr_setpshared
+ * pthread_condattr_getpshared
+ * pthread_condattr_setpshared
+ *
+ * _POSIX_THREAD_SAFE_FUNCTIONS (set)
+ * If set you can use the special *_r library
+ * functions that provide thread-safe behaviour
+ *
+ * + These functions provide both 'inherit' and/or
+ * 'protect' protocol, based upon these macro
+ * settings.
+ *
+ * POSIX 1003.1c-1995 Limits
+ * ===========================
+ *
+ * PTHREAD_DESTRUCTOR_ITERATIONS
+ * Maximum number of attempts to destroy
+ * a thread's thread-specific data on
+ * termination (must be at least 4)
+ *
+ * PTHREAD_KEYS_MAX
+ * Maximum number of thread-specific data keys
+ * available per process (must be at least 128)
+ *
+ * PTHREAD_STACK_MIN
+ * Minimum supported stack size for a thread
+ *
+ * PTHREAD_THREADS_MAX
+ * Maximum number of threads supported per
+ * process (must be at least 64).
+ *
+ *
+ * POSIX 1003.1j/D10-1999 Options
+ * ==============================
+ *
+ * _POSIX_READER_WRITER_LOCKS (set)
+ * If set, you can use read/write locks
+ *
+ * _POSIX_SPIN_LOCKS (set)
+ * If set, you can use spin locks
+ *
+ * _POSIX_BARRIERS (set)
+ * If set, you can use barriers
+ *
+ * -------------------------------------------------------------
+ */
+
+/*
+ * POSIX Options
+ */
+#ifndef _POSIX_THREADS
+#define _POSIX_THREADS
+#endif
+
+#ifndef _POSIX_READER_WRITER_LOCKS
+#define _POSIX_READER_WRITER_LOCKS
+#endif
+
+#ifndef _POSIX_SPIN_LOCKS
+#define _POSIX_SPIN_LOCKS
+#endif
+
+#ifndef _POSIX_BARRIERS
+#define _POSIX_BARRIERS
+#endif
+
+#define _POSIX_THREAD_SAFE_FUNCTIONS
+#define _POSIX_THREAD_ATTR_STACKSIZE
+#define _POSIX_THREAD_PRIORITY_SCHEDULING
+
+#if defined( KLUDGE )
+/*
+ * The following are not supported
+ */
+#define _POSIX_THREAD_ATTR_STACKADDR
+#define _POSIX_THREAD_PRIO_INHERIT
+#define _POSIX_THREAD_PRIO_PROTECT
+#define _POSIX_THREAD_PROCESS_SHARED
+
+#endif /* KLUDGE */
+
+/*
+ * POSIX Limits
+ *
+ * PTHREAD_DESTRUCTOR_ITERATIONS
+ * Standard states this must be at least
+ * 4.
+ *
+ * PTHREAD_KEYS_MAX
+ * WIN32 permits only 64 TLS keys per process.
+ * This limitation could be worked around by
+ * simply simulating keys.
+ *
+ * PTHREADS_STACK_MIN
+ * POSIX specifies 0 which is also the value WIN32
+ * interprets as allowing the system to
+ * set the size to that of the main thread. The
+ * maximum stack size in Win32 is 1Meg. WIN32
+ * allocates more stack as required up to the 1Meg
+ * limit.
+ *
+ * PTHREAD_THREADS_MAX
+ * Not documented by WIN32. Wrote a test program
+ * that kept creating threads until it failed
+ * revealed this approximate number.
+ *
+ */
+#define PTHREAD_DESTRUCTOR_ITERATIONS 4
+#define PTHREAD_KEYS_MAX 64
+#define PTHREAD_STACK_MIN 0
+#define PTHREAD_THREADS_MAX 2019
+
+
+#ifdef _UWIN
+# include <sys/types.h>
+#else
+typedef struct pthread_t_ *pthread_t;
+typedef struct pthread_attr_t_ *pthread_attr_t;
+typedef struct pthread_once_t_ pthread_once_t;
+typedef struct pthread_key_t_ *pthread_key_t;
+typedef struct pthread_mutex_t_ *pthread_mutex_t;
+typedef struct pthread_mutexattr_t_ *pthread_mutexattr_t;
+typedef struct pthread_cond_t_ *pthread_cond_t;
+typedef struct pthread_condattr_t_ *pthread_condattr_t;
+#endif
+typedef struct pthread_rwlock_t_ *pthread_rwlock_t;
+typedef struct pthread_rwlockattr_t_ *pthread_rwlockattr_t;
+typedef struct pthread_spinlock_t_ *pthread_spinlock_t;
+typedef struct pthread_barrier_t_ *pthread_barrier_t;
+typedef struct pthread_barrierattr_t_ *pthread_barrierattr_t;
+
+/*
+ * ====================
+ * ====================
+ * POSIX Threads
+ * ====================
+ * ====================
+ */
+
+enum {
+/*
+ * pthread_attr_{get,set}detachstate
+ */
+ PTHREAD_CREATE_JOINABLE = 0, /* Default */
+ PTHREAD_CREATE_DETACHED = 1,
+
+/*
+ * pthread_attr_{get,set}inheritsched
+ */
+ PTHREAD_INHERIT_SCHED = 0,
+ PTHREAD_EXPLICIT_SCHED = 1, /* Default */
+
+/*
+ * pthread_{get,set}scope
+ */
+ PTHREAD_SCOPE_PROCESS = 0,
+ PTHREAD_SCOPE_SYSTEM = 1, /* Default */
+
+/*
+ * pthread_setcancelstate paramters
+ */
+ PTHREAD_CANCEL_ENABLE = 0, /* Default */
+ PTHREAD_CANCEL_DISABLE = 1,
+
+/*
+ * pthread_setcanceltype parameters
+ */
+ PTHREAD_CANCEL_ASYNCHRONOUS = 0,
+ PTHREAD_CANCEL_DEFERRED = 1, /* Default */
+
+/*
+ * pthread_mutexattr_{get,set}pshared
+ * pthread_condattr_{get,set}pshared
+ */
+ PTHREAD_PROCESS_PRIVATE = 0,
+ PTHREAD_PROCESS_SHARED = 1,
+
+/*
+ * pthread_barrier_wait
+ */
+ PTHREAD_BARRIER_SERIAL_THREAD = -1
+};
+
+/*
+ * ====================
+ * ====================
+ * Cancelation
+ * ====================
+ * ====================
+ */
+#define PTHREAD_CANCELED ((void *) -1)
+
+
+/*
+ * ====================
+ * ====================
+ * Once Key
+ * ====================
+ * ====================
+ */
+#define PTHREAD_ONCE_INIT { FALSE, -1 }
+
+struct pthread_once_t_
+{
+ int done; /* indicates if user function executed */
+ long started; /* First thread to increment this value */
+ /* to zero executes the user function */
+};
+
+
+/*
+ * ====================
+ * ====================
+ * Object initialisers
+ * ====================
+ * ====================
+ */
+#define PTHREAD_MUTEX_INITIALIZER ((pthread_mutex_t) -1)
+
+#define PTHREAD_COND_INITIALIZER ((pthread_cond_t) -1)
+
+#define PTHREAD_RWLOCK_INITIALIZER ((pthread_rwlock_t) -1)
+
+#define PTHREAD_SPINLOCK_INITIALIZER ((pthread_spinlock_t) -1)
+
+enum
+{
+ PTHREAD_MUTEX_FAST_NP,
+ PTHREAD_MUTEX_RECURSIVE_NP,
+ PTHREAD_MUTEX_ERRORCHECK_NP,
+ PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_FAST_NP,
+ PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP,
+ PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP,
+ PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL
+};
+
+
+/* There are three implementations of cancel cleanup.
+ * Note that pthread.h is included in both application
+ * compilation units and also internally for the library.
+ * The code here and within the library aims to work
+ * for all reasonable combinations of environments.
+ *
+ * The three implementations are:
+ *
+ * WIN32 SEH
+ * C
+ * C++
+ *
+ * Please note that exiting a push/pop block via
+ * "return", "exit", "break", or "continue" will
+ * lead to different behaviour amongst applications
+ * depending upon whether the library was built
+ * using SEH, C++, or C. For example, a library built
+ * with SEH will call the cleanup routine, while both
+ * C++ and C built versions will not.
+ */
+
+/*
+ * define defaults for cleanup code
+ */
+#if !defined( __CLEANUP_SEH ) && !defined( __CLEANUP_CXX ) && !defined( __CLEANUP_C )
+
+#if defined(_MSC_VER)
+#define __CLEANUP_SEH
+#elif defined(__cplusplus)
+#define __CLEANUP_CXX
+#else
+#define __CLEANUP_C
+#endif
+
+#endif
+
+#if defined( __CLEANUP_SEH ) && defined(__GNUC__)
+#error ERROR [__FILE__, line __LINE__]: GNUC does not support SEH.
+#endif
+
+typedef struct ptw32_cleanup_t ptw32_cleanup_t;
+typedef void (__cdecl *ptw32_cleanup_callback_t)(void *);
+
+struct ptw32_cleanup_t
+{
+ ptw32_cleanup_callback_t routine;
+ void *arg;
+ struct ptw32_cleanup_t *prev;
+};
+
+#ifdef __CLEANUP_SEH
+ /*
+ * WIN32 SEH version of cancel cleanup.
+ */
+
+#define pthread_cleanup_push( _rout, _arg ) \
+ { \
+ ptw32_cleanup_t _cleanup; \
+ \
+ _cleanup.routine = (ptw32_cleanup_callback_t)(_rout); \
+ _cleanup.arg = (_arg); \
+ __try \
+ { \
+
+#define pthread_cleanup_pop( _execute ) \
+ } \
+ __finally \
+ { \
+ if( _execute || AbnormalTermination()) \
+ { \
+ (*(_cleanup.routine))( _cleanup.arg ); \
+ } \
+ } \
+ }
+
+#else /* __CLEANUP_SEH */
+
+#ifdef __CLEANUP_C
+
+ /*
+ * C implementation of PThreads cancel cleanup
+ */
+
+#define pthread_cleanup_push( _rout, _arg ) \
+ { \
+ ptw32_cleanup_t _cleanup; \
+ \
+ ptw32_push_cleanup( &_cleanup, (ptw32_cleanup_callback_t) (_rout), (_arg) ); \
+
+#define pthread_cleanup_pop( _execute ) \
+ (void) ptw32_pop_cleanup( _execute ); \
+ }
+
+#else /* __CLEANUP_C */
+
+#ifdef __CLEANUP_CXX
+
+ /*
+ * C++ version of cancel cleanup.
+ * - John E. Bossom.
+ */
+
+ class PThreadCleanup {
+ /*
+ * PThreadCleanup
+ *
+ * Purpose
+ * This class is a C++ helper class that is
+ * used to implement pthread_cleanup_push/
+ * pthread_cleanup_pop.
+ * The destructor of this class automatically
+ * pops the pushed cleanup routine regardless
+ * of how the code exits the scope
+ * (i.e. such as by an exception)
+ */
+ ptw32_cleanup_callback_t cleanUpRout;
+ void * obj;
+ int executeIt;
+
+ public:
+ PThreadCleanup() :
+ cleanUpRout( NULL ),
+ obj( NULL ),
+ executeIt( 0 )
+ /*
+ * No cleanup performed
+ */
+ {
+ }
+
+ PThreadCleanup(
+ ptw32_cleanup_callback_t routine,
+ void * arg ) :
+ cleanUpRout( routine ),
+ obj( arg ),
+ executeIt( 1 )
+ /*
+ * Registers a cleanup routine for 'arg'
+ */
+ {
+ }
+
+ ~PThreadCleanup()
+ {
+ if ( executeIt && ((void *) cleanUpRout != NULL) )
+ {
+ (void) (*cleanUpRout)( obj );
+ }
+ }
+
+ void execute( int exec )
+ {
+ executeIt = exec;
+ }
+ };
+
+ /*
+ * C++ implementation of PThreads cancel cleanup;
+ * This implementation takes advantage of a helper
+ * class who's destructor automatically calls the
+ * cleanup routine if we exit our scope weirdly
+ */
+#define pthread_cleanup_push( _rout, _arg ) \
+ { \
+ PThreadCleanup cleanup((ptw32_cleanup_callback_t)(_rout), \
+ (void *) (_arg) );
+
+#define pthread_cleanup_pop( _execute ) \
+ cleanup.execute( _execute ); \
+ }
+
+#else
+
+#error ERROR [__FILE__, line __LINE__]: Cleanup type undefined.
+
+#endif /* __CLEANUP_CXX */
+
+#endif /* __CLEANUP_C */
+
+#endif /* __CLEANUP_SEH */
+
+/*
+ * ===============
+ * ===============
+ * Methods
+ * ===============
+ * ===============
+ */
+
+/*
+ * PThread Attribute Functions
+ */
+int pthread_attr_init (pthread_attr_t * attr);
+
+int pthread_attr_destroy (pthread_attr_t * attr);
+
+int pthread_attr_getdetachstate (const pthread_attr_t * attr,
+ int *detachstate);
+
+int pthread_attr_getstackaddr (const pthread_attr_t * attr,
+ void **stackaddr);
+
+int pthread_attr_getstacksize (const pthread_attr_t * attr,
+ size_t * stacksize);
+
+int pthread_attr_setdetachstate (pthread_attr_t * attr,
+ int detachstate);
+
+int pthread_attr_setstackaddr (pthread_attr_t * attr,
+ void *stackaddr);
+
+int pthread_attr_setstacksize (pthread_attr_t * attr,
+ size_t stacksize);
+
+int pthread_attr_getschedparam (const pthread_attr_t *attr,
+ struct sched_param *param);
+
+int pthread_attr_setschedparam (pthread_attr_t *attr,
+ const struct sched_param *param);
+
+int pthread_attr_setschedpolicy (pthread_attr_t *,
+ int);
+
+int pthread_attr_getschedpolicy (pthread_attr_t *,
+ int *);
+
+int pthread_attr_setinheritsched(pthread_attr_t * attr,
+ int inheritsched);
+
+int pthread_attr_getinheritsched(pthread_attr_t * attr,
+ int * inheritsched);
+
+int pthread_attr_setscope (pthread_attr_t *,
+ int);
+
+int pthread_attr_getscope (const pthread_attr_t *,
+ int *);
+
+/*
+ * PThread Functions
+ */
+int pthread_create (pthread_t * tid,
+ const pthread_attr_t * attr,
+ void *(*start) (void *),
+ void *arg);
+
+int pthread_detach (pthread_t tid);
+
+int pthread_equal (pthread_t t1,
+ pthread_t t2);
+
+void pthread_exit (void *value_ptr);
+
+int pthread_join (pthread_t thread,
+ void **value_ptr);
+
+pthread_t pthread_self (void);
+
+int pthread_cancel (pthread_t thread);
+
+int pthread_setcancelstate (int state,
+ int *oldstate);
+
+int pthread_setcanceltype (int type,
+ int *oldtype);
+
+void pthread_testcancel (void);
+
+int pthread_once (pthread_once_t * once_control,
+ void (*init_routine) (void));
+
+ptw32_cleanup_t *ptw32_pop_cleanup (int execute);
+
+void ptw32_push_cleanup (ptw32_cleanup_t * cleanup,
+ void (*routine) (void *),
+ void *arg);
+
+/*
+ * Thread Specific Data Functions
+ */
+int pthread_key_create (pthread_key_t * key,
+ void (*destructor) (void *));
+
+int pthread_key_delete (pthread_key_t key);
+
+int pthread_setspecific (pthread_key_t key,
+ const void *value);
+
+void *pthread_getspecific (pthread_key_t key);
+
+
+/*
+ * Mutex Attribute Functions
+ */
+int pthread_mutexattr_init (pthread_mutexattr_t * attr);
+
+int pthread_mutexattr_destroy (pthread_mutexattr_t * attr);
+
+int pthread_mutexattr_getpshared (const pthread_mutexattr_t
+ * attr,
+ int *pshared);
+
+int pthread_mutexattr_setpshared (pthread_mutexattr_t * attr,
+ int pshared);
+
+int pthread_mutexattr_settype (pthread_mutexattr_t * attr, int kind);
+int pthread_mutexattr_gettype (pthread_mutexattr_t * attr, int *kind);
+
+/*
+ * Barrier Attribute Functions
+ */
+int pthread_barrierattr_init (pthread_barrierattr_t * attr);
+
+int pthread_barrierattr_destroy (pthread_barrierattr_t * attr);
+
+int pthread_barrierattr_getpshared (const pthread_barrierattr_t
+ * attr,
+ int *pshared);
+
+int pthread_barrierattr_setpshared (pthread_barrierattr_t * attr,
+ int pshared);
+
+/*
+ * Mutex Functions
+ */
+int pthread_mutex_init (pthread_mutex_t * mutex,
+ const pthread_mutexattr_t * attr);
+
+int pthread_mutex_destroy (pthread_mutex_t * mutex);
+
+int pthread_mutex_lock (pthread_mutex_t * mutex);
+
+int pthread_mutex_trylock (pthread_mutex_t * mutex);
+
+int pthread_mutex_unlock (pthread_mutex_t * mutex);
+
+/*
+ * Spinlock Functions
+ */
+int pthread_spin_init (pthread_spinlock_t * lock, int pshared);
+
+int pthread_spin_destroy (pthread_spinlock_t * lock);
+
+int pthread_spin_lock (pthread_spinlock_t * lock);
+
+int pthread_spin_trylock (pthread_spinlock_t * lock);
+
+int pthread_spin_unlock (pthread_spinlock_t * lock);
+
+/*
+ * Barrier Functions
+ */
+int pthread_barrier_init (pthread_barrier_t * barrier,
+ const pthread_barrierattr_t * attr,
+ unsigned int count);
+
+int pthread_barrier_destroy (pthread_barrier_t * barrier);
+
+int pthread_barrier_wait (pthread_barrier_t * barrier);
+
+/*
+ * Condition Variable Attribute Functions
+ */
+int pthread_condattr_init (pthread_condattr_t * attr);
+
+int pthread_condattr_destroy (pthread_condattr_t * attr);
+
+int pthread_condattr_getpshared (const pthread_condattr_t * attr,
+ int *pshared);
+
+int pthread_condattr_setpshared (pthread_condattr_t * attr,
+ int pshared);
+
+/*
+ * Condition Variable Functions
+ */
+int pthread_cond_init (pthread_cond_t * cond,
+ const pthread_condattr_t * attr);
+
+int pthread_cond_destroy (pthread_cond_t * cond);
+
+int pthread_cond_wait (pthread_cond_t * cond,
+ pthread_mutex_t * mutex);
+
+int pthread_cond_timedwait (pthread_cond_t * cond,
+ pthread_mutex_t * mutex,
+ const struct timespec *abstime);
+
+int pthread_cond_signal (pthread_cond_t * cond);
+
+int pthread_cond_broadcast (pthread_cond_t * cond);
+
+/*
+ * Scheduling
+ */
+int pthread_setschedparam (pthread_t thread,
+ int policy,
+ const struct sched_param *param);
+
+int pthread_getschedparam (pthread_t thread,
+ int *policy,
+ struct sched_param *param);
+
+int pthread_setconcurrency (int);
+
+int pthread_getconcurrency (void);
+
+/*
+ * Read-Write Lock Functions
+ */
+int pthread_rwlock_init(pthread_rwlock_t *lock,
+ const pthread_rwlockattr_t *attr);
+
+int pthread_rwlock_destroy(pthread_rwlock_t *lock);
+
+int pthread_rwlock_tryrdlock(pthread_rwlock_t *);
+
+int pthread_rwlock_trywrlock(pthread_rwlock_t *);
+
+int pthread_rwlock_rdlock(pthread_rwlock_t *lock);
+
+int pthread_rwlock_wrlock(pthread_rwlock_t *lock);
+
+int pthread_rwlock_unlock(pthread_rwlock_t *lock);
+
+
+/*
+ * Non-portable functions
+ */
+
+/*
+ * Compatibility with Linux.
+ */
+int pthread_mutexattr_setkind_np(pthread_mutexattr_t * attr, int kind);
+int pthread_mutexattr_getkind_np(pthread_mutexattr_t * attr, int *kind);
+
+/*
+ * Possibly supported by other POSIX threads implementations
+ */
+int pthread_delay_np (struct timespec * interval);
+
+/*
+ * Returns the Win32 HANDLE for the POSIX thread.
+ */
+HANDLE pthread_getw32threadhandle_np(pthread_t thread);
+
+/*
+ * Returns the number of CPUs available to the process.
+ */
+int pthread_getprocessors_np(int * count);
+
+/*
+ * Useful if an application wants to statically link
+ * the lib rather than load the DLL at run-time.
+ */
+int pthread_win32_process_attach_np(void);
+int pthread_win32_process_detach_np(void);
+int pthread_win32_thread_attach_np(void);
+int pthread_win32_thread_detach_np(void);
+
+
+/*
+ * Protected Methods
+ *
+ * This function blocks until the given WIN32 handle
+ * is signaled or pthread_cancel had been called.
+ * This function allows the caller to hook into the
+ * PThreads cancel mechanism. It is implemented using
+ *
+ * WaitForMultipleObjects
+ *
+ * on 'waitHandle' and a manually reset WIN32 Event
+ * used to implement pthread_cancel. The 'timeout'
+ * argument to TimedWait is simply passed to
+ * WaitForMultipleObjects.
+ */
+int pthreadCancelableWait (HANDLE waitHandle);
+int pthreadCancelableTimedWait (HANDLE waitHandle, DWORD timeout);
+
+/*
+ * Thread-Safe C Runtime Library Mappings.
+ */
+#ifndef _UWIN
+#if 1
+#if (! defined(HAVE_ERRNO)) && (! defined(_REENTRANT)) && (! defined(_MT))
+int * _errno( void );
+#endif
+#else
+#if (! defined(NEED_ERRNO)) || (! defined( _REENTRANT ) && (! defined( _MT ) || ! defined( _MD )))
+#if defined(PTW32_BUILD)
+__declspec( dllexport ) int * _errno( void );
+#else
+int * _errno( void );
+#endif
+#endif
+#endif
+#endif
+
+/*
+ * WIN32 C runtime library had been made thread-safe
+ * without affecting the user interface. Provide
+ * mappings from the UNIX thread-safe versions to
+ * the standard C runtime library calls.
+ * Only provide function mappings for functions that
+ * actually exist on WIN32.
+ */
+
+#if !defined(__MINGW32__)
+#define strtok_r( _s, _sep, _lasts ) \
+ ( *(_lasts) = strtok( (_s), (_sep) ) )
+#endif /* !__MINGW32__ */
+
+#define asctime_r( _tm, _buf ) \
+ ( strcpy( (_buf), asctime( (_tm) ) ), \
+ (_buf) )
+
+#define ctime_r( _clock, _buf ) \
+ ( strcpy( (_buf), ctime( (_clock) ) ), \
+ (_buf) )
+
+#define gmtime_r( _clock, _result ) \
+ ( *(_result) = *gmtime( (_clock) ), \
+ (_result) )
+
+#define localtime_r( _clock, _result ) \
+ ( *(_result) = *localtime( (_clock) ), \
+ (_result) )
+
+#define rand_r( _seed ) \
+ ( _seed == _seed? rand() : rand() )
+
+
+#ifdef __cplusplus
+
+/*
+ * Internal exceptions
+ */
+class ptw32_exception {};
+class ptw32_exception_cancel : public ptw32_exception {};
+class ptw32_exception_exit : public ptw32_exception {};
+
+#endif
+
+/* FIXME: This is only required if the library was built using SEH */
+/*
+ * Get internal SEH tag
+ */
+DWORD ptw32_get_exception_services_code(void);
+
+#ifndef PTW32_BUILD
+
+#ifdef __CLEANUP_SEH
+
+/*
+ * Redefine the SEH __except keyword to ensure that applications
+ * propagate our internal exceptions up to the library's internal handlers.
+ */
+#define __except( E ) \
+ __except( ( GetExceptionCode() == ptw32_get_exception_services_code() ) \
+ ? EXCEPTION_CONTINUE_SEARCH : ( E ) )
+
+#endif /* __CLEANUP_SEH */
+
+#ifdef __cplusplus
+
+/*
+ * Redefine the C++ catch keyword to ensure that applications
+ * propagate our internal exceptions up to the library's internal handlers.
+ */
+#ifdef _MSC_VER
+ /*
+ * WARNING: Replace any 'catch( ... )' with 'PtW32CatchAll'
+ * if you want Pthread-Win32 cancelation and pthread_exit to work.
+ */
+
+#ifndef PtW32NoCatchWarn
+
+#pragma message("When compiling applications with MSVC++ and C++ exception handling:")
+#pragma message(" Replace any 'catch( ... )' with 'PtW32CatchAll' in POSIX threads")
+#pragma message(" if you want POSIX thread cancelation and pthread_exit to work.")
+
+#endif
+
+#define PtW32CatchAll \
+ catch( ptw32_exception & ) { throw; } \
+ catch( ... )
+
+#else /* _MSC_VER */
+
+#define catch( E ) \
+ catch( ptw32_exception & ) { throw; } \
+ catch( E )
+
+#endif /* _MSC_VER */
+
+#endif /* __cplusplus */
+
+#endif /* ! PTW32_BUILD */
+
+#ifdef __cplusplus
+} /* End of extern "C" */
+#endif /* __cplusplus */
+
+#endif /* PTHREAD_H */
diff --git a/win32/contrib/pthreads/pthread.ncb b/win32/contrib/pthreads/pthread.ncb Binary files differnew file mode 100644 index 000000000..b349a3cfb --- /dev/null +++ b/win32/contrib/pthreads/pthread.ncb diff --git a/win32/contrib/pthreads/pthread.opt b/win32/contrib/pthreads/pthread.opt Binary files differnew file mode 100644 index 000000000..638aaac20 --- /dev/null +++ b/win32/contrib/pthreads/pthread.opt diff --git a/win32/contrib/pthreads/rwlock.c b/win32/contrib/pthreads/rwlock.c new file mode 100644 index 000000000..2bb62f1e5 --- /dev/null +++ b/win32/contrib/pthreads/rwlock.c @@ -0,0 +1,616 @@ +/*
+ * rwlock.c
+ *
+ * Description:
+ * This translation unit implements read/write lock primitives.
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright (C) 1998
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA
+ */
+
+#include <errno.h>
+#include <limits.h>
+
+#include "pthread.h"
+#include "implement.h"
+
+static INLINE int
+ptw32_rwlock_check_need_init(pthread_rwlock_t *rwlock)
+{
+ int result = 0;
+
+ /*
+ * The following guarded test is specifically for statically
+ * initialised rwlocks (via PTHREAD_RWLOCK_INITIALIZER).
+ *
+ * Note that by not providing this synchronisation we risk
+ * introducing race conditions into applications which are
+ * correctly written.
+ *
+ * Approach
+ * --------
+ * We know that static rwlocks will not be PROCESS_SHARED
+ * so we can serialise access to internal state using
+ * Win32 Critical Sections rather than Win32 Mutexes.
+ *
+ * If using a single global lock slows applications down too much,
+ * multiple global locks could be created and hashed on some random
+ * value associated with each mutex, the pointer perhaps. At a guess,
+ * a good value for the optimal number of global locks might be
+ * the number of processors + 1.
+ *
+ */
+ EnterCriticalSection(&ptw32_rwlock_test_init_lock);
+
+ /*
+ * We got here possibly under race
+ * conditions. Check again inside the critical section
+ * and only initialise if the rwlock is valid (not been destroyed).
+ * If a static rwlock has been destroyed, the application can
+ * re-initialise it only by calling pthread_rwlock_init()
+ * explicitly.
+ */
+ if (*rwlock == PTHREAD_RWLOCK_INITIALIZER)
+ {
+ result = pthread_rwlock_init(rwlock, NULL);
+ }
+ else if (*rwlock == NULL)
+ {
+ /*
+ * The rwlock has been destroyed while we were waiting to
+ * initialise it, so the operation that caused the
+ * auto-initialisation should fail.
+ */
+ result = EINVAL;
+ }
+
+ LeaveCriticalSection(&ptw32_rwlock_test_init_lock);
+
+ return result;
+}
+
+int
+pthread_rwlock_init(pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr)
+{
+ int result;
+ pthread_rwlock_t rwl = 0;
+
+ if (rwlock == NULL)
+ {
+ return EINVAL;
+ }
+
+ if (attr != NULL && *attr != NULL)
+ {
+ result = EINVAL; /* Not supported */
+ goto DONE;
+ }
+
+ rwl = (pthread_rwlock_t) calloc(1, sizeof(*rwl));
+
+ if (rwl == NULL)
+ {
+ result = ENOMEM;
+ goto DONE;
+ }
+
+ rwl->nSharedAccessCount = 0;
+ rwl->nExclusiveAccessCount = 0;
+ rwl->nCompletedSharedAccessCount = 0;
+
+ result = pthread_mutex_init(&rwl->mtxExclusiveAccess, NULL);
+ if (result != 0)
+ {
+ goto FAIL0;
+ }
+
+ result = pthread_mutex_init(&rwl->mtxSharedAccessCompleted, NULL);
+ if (result != 0)
+ {
+ goto FAIL1;
+ }
+
+ result = pthread_cond_init(&rwl->cndSharedAccessCompleted, NULL);
+ if (result != 0)
+ {
+ goto FAIL2;
+ }
+
+ rwl->nMagic = PTW32_RWLOCK_MAGIC;
+
+ result = 0;
+ goto DONE;
+
+FAIL2:
+ (void) pthread_mutex_destroy(&(rwl->mtxSharedAccessCompleted));
+
+FAIL1:
+ (void) pthread_mutex_destroy(&(rwl->mtxExclusiveAccess));
+
+FAIL0:
+ (void) free(rwl);
+ rwl = NULL;
+
+DONE:
+ *rwlock = rwl;
+
+ return result;
+}
+
+int
+pthread_rwlock_destroy(pthread_rwlock_t *rwlock)
+{
+ pthread_rwlock_t rwl;
+ int result = 0, result1 = 0, result2 = 0;
+
+ if (rwlock == NULL || *rwlock == NULL)
+ {
+ return EINVAL;
+ }
+
+ if (*rwlock != PTHREAD_RWLOCK_INITIALIZER)
+ {
+ rwl = *rwlock;
+
+ if (rwl->nMagic != PTW32_RWLOCK_MAGIC)
+ {
+ return EINVAL;
+ }
+
+ if ((result = pthread_mutex_lock(&(rwl->mtxExclusiveAccess))) != 0)
+ {
+ return result;
+ }
+
+ if ((result = pthread_mutex_lock(&(rwl->mtxSharedAccessCompleted))) != 0)
+ {
+ (void) pthread_mutex_unlock(&(rwl->mtxExclusiveAccess));
+ return result;
+ }
+
+ /*
+ * Check whether any threads own/wait for the lock (wait for ex.access);
+ * report "BUSY" if so.
+ */
+ if (rwl->nExclusiveAccessCount > 0
+ || rwl->nSharedAccessCount > rwl->nCompletedSharedAccessCount)
+ {
+ result = pthread_mutex_unlock(&(rwl->mtxSharedAccessCompleted));
+ result1 = pthread_mutex_unlock(&(rwl->mtxExclusiveAccess));
+ result2 = EBUSY;
+ }
+ else
+ {
+ rwl->nMagic = 0;
+
+ if ((result = pthread_mutex_unlock(&(rwl->mtxSharedAccessCompleted))) != 0)
+ {
+ pthread_mutex_unlock(&rwl->mtxExclusiveAccess);
+ return result;
+ }
+
+ if ((result = pthread_mutex_unlock(&(rwl->mtxExclusiveAccess))) != 0)
+ {
+ return result;
+ }
+
+ *rwlock = NULL; /* Invalidate rwlock before anything else */
+ result = pthread_cond_destroy(&(rwl->cndSharedAccessCompleted));
+ result1 = pthread_mutex_destroy(&(rwl->mtxSharedAccessCompleted));
+ result2 = pthread_mutex_destroy(&(rwl->mtxExclusiveAccess));
+ (void) free(rwl);
+ }
+ }
+ else
+ {
+ /*
+ * See notes in ptw32_rwlock_check_need_init() above also.
+ */
+ EnterCriticalSection(&ptw32_rwlock_test_init_lock);
+
+ /*
+ * Check again.
+ */
+ if (*rwlock == PTHREAD_RWLOCK_INITIALIZER)
+ {
+ /*
+ * This is all we need to do to destroy a statically
+ * initialised rwlock that has not yet been used (initialised).
+ * If we get to here, another thread
+ * waiting to initialise this rwlock will get an EINVAL.
+ */
+ *rwlock = NULL;
+ }
+ else
+ {
+ /*
+ * The rwlock has been initialised while we were waiting
+ * so assume it's in use.
+ */
+ result = EBUSY;
+ }
+
+ LeaveCriticalSection(&ptw32_rwlock_test_init_lock);
+ }
+
+ return ((result != 0) ? result : ((result1 != 0) ? result1 : result2));
+}
+
+int
+pthread_rwlock_rdlock(pthread_rwlock_t *rwlock)
+{
+ int result;
+ pthread_rwlock_t rwl;
+
+ if (rwlock == NULL || *rwlock == NULL)
+ {
+ return EINVAL;
+ }
+
+ /*
+ * We do a quick check to see if we need to do more work
+ * to initialise a static rwlock. We check
+ * again inside the guarded section of ptw32_rwlock_check_need_init()
+ * to avoid race conditions.
+ */
+ if (*rwlock == PTHREAD_RWLOCK_INITIALIZER)
+ {
+ result = ptw32_rwlock_check_need_init(rwlock);
+
+ if (result != 0 && result != EBUSY)
+ {
+ return result;
+ }
+ }
+
+ rwl = *rwlock;
+
+ if (rwl->nMagic != PTW32_RWLOCK_MAGIC)
+ {
+ return EINVAL;
+ }
+
+ if ((result = pthread_mutex_lock(&(rwl->mtxExclusiveAccess))) != 0)
+ {
+ return result;
+ }
+
+ if (++rwl->nSharedAccessCount == INT_MAX)
+ {
+ if ((result = pthread_mutex_lock(&(rwl->mtxSharedAccessCompleted))) != 0)
+ {
+ (void) pthread_mutex_unlock(&(rwl->mtxExclusiveAccess));
+ return result;
+ }
+
+ rwl->nSharedAccessCount -= rwl->nCompletedSharedAccessCount;
+ rwl->nCompletedSharedAccessCount = 0;
+
+ if ((result = pthread_mutex_unlock(&(rwl->mtxSharedAccessCompleted))) != 0)
+ {
+ (void) pthread_mutex_unlock(&(rwl->mtxExclusiveAccess));
+ return result;
+ }
+ }
+
+ return (pthread_mutex_unlock(&(rwl->mtxExclusiveAccess)));
+}
+
+static void
+ptw32_rwlock_cancelwrwait(void * arg)
+{
+ pthread_rwlock_t rwl = (pthread_rwlock_t) arg;
+
+ rwl->nSharedAccessCount = -rwl->nCompletedSharedAccessCount;
+ rwl->nCompletedSharedAccessCount = 0;
+
+ (void) pthread_mutex_unlock(&(rwl->mtxSharedAccessCompleted));
+ (void) pthread_mutex_unlock(&(rwl->mtxExclusiveAccess));
+}
+
+int
+pthread_rwlock_wrlock(pthread_rwlock_t * rwlock)
+{
+ int result;
+ pthread_rwlock_t rwl;
+
+ if (rwlock == NULL || *rwlock == NULL)
+ {
+ return EINVAL;
+ }
+
+ /*
+ * We do a quick check to see if we need to do more work
+ * to initialise a static rwlock. We check
+ * again inside the guarded section of ptw32_rwlock_check_need_init()
+ * to avoid race conditions.
+ */
+ if (*rwlock == PTHREAD_RWLOCK_INITIALIZER)
+ {
+ result = ptw32_rwlock_check_need_init(rwlock);
+
+ if (result != 0 && result != EBUSY)
+ {
+ return result;
+ }
+ }
+
+ rwl = *rwlock;
+
+ if (rwl->nMagic != PTW32_RWLOCK_MAGIC)
+ {
+ return EINVAL;
+ }
+
+ if ((result = pthread_mutex_lock(&(rwl->mtxExclusiveAccess))) != 0)
+ {
+ return result;
+ }
+
+ if ((result = pthread_mutex_lock(&(rwl->mtxSharedAccessCompleted))) != 0)
+ {
+ (void) pthread_mutex_unlock(&(rwl->mtxExclusiveAccess));
+ return result;
+ }
+
+ if (rwl->nExclusiveAccessCount == 0)
+ {
+ if (rwl->nCompletedSharedAccessCount > 0)
+ {
+ rwl->nSharedAccessCount -= rwl->nCompletedSharedAccessCount;
+ rwl->nCompletedSharedAccessCount = 0;
+ }
+
+ if (rwl->nSharedAccessCount > 0)
+ {
+ /*
+ * pthread_rwlock_wrlock() is not a cancelation point
+ * so temporarily prevent pthread_cond_wait() from being one.
+ */
+ pthread_t self = pthread_self();
+ int oldCancelState;
+
+ rwl->nCompletedSharedAccessCount = -rwl->nSharedAccessCount;
+
+ if (self->cancelType == PTHREAD_CANCEL_DEFERRED)
+ {
+ pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldCancelState);
+ }
+
+ /* Could still be PTHREAD_CANCEL_ASYNCHRONOUS. */
+ pthread_cleanup_push(ptw32_rwlock_cancelwrwait, (void*)rwl);
+
+ do
+ {
+ result = pthread_cond_wait(&(rwl->cndSharedAccessCompleted),
+ &(rwl->mtxSharedAccessCompleted));
+ }
+ while (result == 0 && rwl->nCompletedSharedAccessCount < 0);
+
+ if (self->cancelType == PTHREAD_CANCEL_DEFERRED)
+ {
+ pthread_setcancelstate(oldCancelState, NULL);
+ }
+
+ pthread_cleanup_pop ((result != 0) ? 1 : 0);
+
+ if (result == 0)
+ {
+ rwl->nSharedAccessCount = 0;
+ }
+ }
+ }
+
+ if (result == 0)
+ {
+ rwl->nExclusiveAccessCount++;
+ }
+
+ return result;
+}
+
+int
+pthread_rwlock_unlock(pthread_rwlock_t * rwlock)
+{
+ int result, result1;
+ pthread_rwlock_t rwl;
+
+ if (rwlock == NULL || *rwlock == NULL)
+ {
+ return(EINVAL);
+ }
+
+ if (*rwlock == PTHREAD_RWLOCK_INITIALIZER)
+ {
+ /*
+ * Assume any race condition here is harmless.
+ */
+ return 0;
+ }
+
+ rwl = *rwlock;
+
+ if (rwl->nMagic != PTW32_RWLOCK_MAGIC)
+ {
+ return EINVAL;
+ }
+
+ if (rwl->nExclusiveAccessCount == 0)
+ {
+ if ((result = pthread_mutex_lock(&(rwl->mtxSharedAccessCompleted))) != 0)
+ {
+ return result;
+ }
+
+ if (++rwl->nCompletedSharedAccessCount == 0)
+ {
+ result = pthread_cond_signal(&(rwl->cndSharedAccessCompleted));
+ }
+
+ result1 = pthread_mutex_unlock(&(rwl->mtxSharedAccessCompleted));
+ }
+ else
+ {
+ rwl->nExclusiveAccessCount--;
+
+ result = pthread_mutex_unlock(&(rwl->mtxSharedAccessCompleted));
+ result1 = pthread_mutex_unlock(&(rwl->mtxExclusiveAccess));
+
+ }
+
+ return ((result != 0) ? result : result1);
+}
+
+int
+pthread_rwlock_tryrdlock(pthread_rwlock_t * rwlock)
+{
+ int result;
+ pthread_rwlock_t rwl;
+
+ if (rwlock == NULL || *rwlock == NULL)
+ {
+ return EINVAL;
+ }
+
+ /*
+ * We do a quick check to see if we need to do more work
+ * to initialise a static rwlock. We check
+ * again inside the guarded section of ptw32_rwlock_check_need_init()
+ * to avoid race conditions.
+ */
+ if (*rwlock == PTHREAD_RWLOCK_INITIALIZER)
+ {
+ result = ptw32_rwlock_check_need_init(rwlock);
+
+ if (result != 0 && result != EBUSY)
+ {
+ return result;
+ }
+ }
+
+ rwl = *rwlock;
+
+ if (rwl->nMagic != PTW32_RWLOCK_MAGIC)
+ {
+ return EINVAL;
+ }
+
+ if ((result = pthread_mutex_trylock(&(rwl->mtxExclusiveAccess))) != 0)
+ {
+ return result;
+ }
+
+ if (++rwl->nSharedAccessCount == INT_MAX)
+ {
+ if ((result = pthread_mutex_lock(&(rwl->mtxSharedAccessCompleted))) != 0)
+ {
+ (void) pthread_mutex_unlock(&(rwl->mtxExclusiveAccess));
+ return result;
+ }
+
+ rwl->nSharedAccessCount -= rwl->nCompletedSharedAccessCount;
+ rwl->nCompletedSharedAccessCount = 0;
+
+ if ((result = pthread_mutex_unlock(&(rwl->mtxSharedAccessCompleted))) != 0)
+ {
+ (void) pthread_mutex_unlock(&(rwl->mtxExclusiveAccess));
+ return result;
+ }
+ }
+
+ return (pthread_mutex_unlock(&rwl->mtxExclusiveAccess));
+}
+
+int
+pthread_rwlock_trywrlock(pthread_rwlock_t * rwlock)
+{
+ int result, result1;
+ pthread_rwlock_t rwl;
+
+ if (rwlock == NULL || *rwlock == NULL)
+ {
+ return EINVAL;
+ }
+
+ /*
+ * We do a quick check to see if we need to do more work
+ * to initialise a static rwlock. We check
+ * again inside the guarded section of ptw32_rwlock_check_need_init()
+ * to avoid race conditions.
+ */
+ if (*rwlock == PTHREAD_RWLOCK_INITIALIZER)
+ {
+ result = ptw32_rwlock_check_need_init(rwlock);
+
+ if (result != 0 && result != EBUSY)
+ {
+ return result;
+ }
+ }
+
+ rwl = *rwlock;
+
+ if (rwl->nMagic != PTW32_RWLOCK_MAGIC)
+ {
+ return EINVAL;
+ }
+
+ if ((result = pthread_mutex_trylock(&(rwl->mtxExclusiveAccess))) != 0)
+ {
+ return result;
+ }
+
+ if ((result = pthread_mutex_trylock(&(rwl->mtxSharedAccessCompleted))) != 0)
+ {
+ result1 = pthread_mutex_unlock(&(rwl->mtxExclusiveAccess));
+ return ((result1 != 0) ? result1 : result);
+ }
+
+ if (rwl->nExclusiveAccessCount == 0)
+ {
+ if (rwl->nCompletedSharedAccessCount > 0)
+ {
+ rwl->nSharedAccessCount -= rwl->nCompletedSharedAccessCount;
+ rwl->nCompletedSharedAccessCount = 0;
+ }
+
+ if (rwl->nSharedAccessCount > 0)
+ {
+ if ((result = pthread_mutex_unlock(&(rwl->mtxSharedAccessCompleted))) != 0)
+ {
+ (void) pthread_mutex_unlock(&(rwl->mtxExclusiveAccess));
+ return result;
+ }
+
+ if ((result = pthread_mutex_unlock(&(rwl->mtxExclusiveAccess))) == 0)
+ {
+ result = EBUSY;
+ }
+ }
+ else
+ {
+ rwl->nExclusiveAccessCount = 1;
+ }
+ }
+ else
+ {
+ result = EBUSY;
+ }
+
+ return result;
+}
diff --git a/win32/contrib/pthreads/sched.c b/win32/contrib/pthreads/sched.c new file mode 100644 index 000000000..ee5c1bed4 --- /dev/null +++ b/win32/contrib/pthreads/sched.c @@ -0,0 +1,377 @@ +/*
+ * sched.c
+ *
+ * Description:
+ * POSIX thread functions that deal with thread scheduling.
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright (C) 1998
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA
+ */
+
+#include "pthread.h"
+#include "implement.h"
+#include "sched.h"
+
+static int
+is_attr(const pthread_attr_t *attr)
+{
+ return (attr == NULL ||
+ *attr == NULL ||
+ (*attr)->valid != PTW32_ATTR_VALID) ? 1 : 0;
+}
+
+
+int
+pthread_attr_setschedpolicy(pthread_attr_t *attr,
+ int policy)
+{
+ if (is_attr(attr) != 0)
+ {
+ return EINVAL;
+ }
+
+ if (policy != SCHED_OTHER)
+ {
+ return ENOTSUP;
+ }
+
+ return 0;
+}
+
+
+int
+pthread_attr_getschedpolicy(pthread_attr_t *attr,
+ int * policy)
+{
+ if (is_attr(attr) != 0 || policy == NULL)
+ {
+ return EINVAL;
+ }
+
+ /*
+ * Validate the policy arg.
+ * Check that a policy constant wasn't passed rather than &policy.
+ */
+ if (policy <= (int *) SCHED_MAX)
+ {
+ return EINVAL;
+ }
+
+ *policy = SCHED_OTHER;
+
+ return 0;
+}
+
+
+int
+pthread_attr_setschedparam(pthread_attr_t *attr,
+ const struct sched_param *param)
+{
+ int priority;
+
+ if (is_attr(attr) != 0 || param == NULL)
+ {
+ return EINVAL;
+ }
+
+ priority = param->sched_priority;
+
+ /* Validate priority level. */
+ if (priority < sched_get_priority_min(SCHED_OTHER) ||
+ priority > sched_get_priority_max(SCHED_OTHER))
+ {
+ return EINVAL;
+ }
+
+ memcpy(&(*attr)->param, param, sizeof(*param));
+ return 0;
+}
+
+
+int
+pthread_attr_getschedparam(const pthread_attr_t *attr,
+ struct sched_param *param)
+{
+ if (is_attr(attr) != 0 || param == NULL)
+ {
+ return EINVAL;
+ }
+
+ memcpy(param, &(*attr)->param, sizeof(*param));
+ return 0;
+}
+
+
+int
+pthread_attr_setinheritsched(pthread_attr_t * attr,
+ int inheritsched)
+{
+ if (is_attr(attr) != 0)
+ {
+ return EINVAL;
+ }
+
+ if (PTHREAD_INHERIT_SCHED != inheritsched
+ && PTHREAD_EXPLICIT_SCHED != inheritsched)
+ {
+ return EINVAL;
+ }
+
+ (*attr)->inheritsched = inheritsched;
+ return 0;
+}
+
+
+int
+pthread_attr_getinheritsched(pthread_attr_t * attr,
+ int * inheritsched)
+{
+ if (is_attr(attr) != 0 || inheritsched == NULL)
+ {
+ return EINVAL;
+ }
+
+ *inheritsched = (*attr)->inheritsched;
+ return 0;
+}
+
+
+int
+pthread_setschedparam(pthread_t thread, int policy,
+ const struct sched_param *param)
+{
+ /* Validate the thread id. */
+ if (thread == NULL || thread->threadH == 0)
+ {
+ return EINVAL;
+ }
+
+ /* Validate the scheduling policy. */
+ if (policy < SCHED_MIN || policy > SCHED_MAX)
+ {
+ return EINVAL;
+ }
+
+ /* Ensure the policy is SCHED_OTHER. */
+ if (policy != SCHED_OTHER)
+ {
+ return ENOTSUP;
+ }
+
+ /* Validate priority level. */
+ if (param->sched_priority < sched_get_priority_min(policy) ||
+ param->sched_priority > sched_get_priority_max(policy))
+ {
+ return EINVAL;
+ }
+
+ /* This is practically guaranteed to return TRUE. */
+ (void) SetThreadPriority(thread->threadH, param->sched_priority);
+
+ return 0;
+}
+
+
+int
+pthread_getschedparam(pthread_t thread, int *policy,
+ struct sched_param *param)
+{
+ int prio;
+
+ /* Validate the thread id. */
+ if (thread == NULL || thread->threadH == 0)
+ {
+ return EINVAL;
+ }
+
+ /*
+ * Validate the policy and param args.
+ * Check that a policy constant wasn't passed rather than &policy.
+ */
+ if (policy <= (int *) SCHED_MAX || param == NULL)
+ {
+ return EINVAL;
+ }
+
+ /* Fill out the policy. */
+ *policy = SCHED_OTHER;
+
+ /* Fill out the sched_param structure. */
+ prio = GetThreadPriority(thread->threadH);
+ if (prio == THREAD_PRIORITY_ERROR_RETURN)
+ {
+ return EINVAL;
+ }
+
+ param->sched_priority = prio;
+ return 0;
+}
+
+
+/*
+ * On Windows98, THREAD_PRIORITY_LOWEST is (-2) and
+ * THREAD_PRIORITY_HIGHEST is 2, and everything works just fine.
+ *
+ * On WinCE 3.0, it so happen that THREAD_PRIORITY_LOWEST is 5
+ * and THREAD_PRIORITY_HIGHEST is 1 (yes, I know, it is funny:
+ * highest priority use smaller numbers) and the following happens:
+ *
+ * sched_get_priority_min() returns 5
+ * sched_get_priority_max() returns 1
+ */
+
+
+#define sched_Max(a,b) ((a)<(b)?(b):(a))
+#define sched_Min(a,b) ((a)>(b)?(b):(a))
+
+
+int
+sched_get_priority_max(int policy)
+{
+ if (policy < SCHED_MIN || policy > SCHED_MAX)
+ {
+ return EINVAL;
+ }
+
+#if (THREAD_PRIORITY_LOWEST > THREAD_PRIORITY_NORMAL)
+ /* WinCE? */
+ return sched_Max(THREAD_PRIORITY_IDLE, THREAD_PRIORITY_TIME_CRITICAL);
+#else
+ /* This is independent of scheduling policy in Win32. */
+ return sched_Max(THREAD_PRIORITY_LOWEST, THREAD_PRIORITY_HIGHEST);
+#endif
+}
+
+
+int
+sched_get_priority_min(int policy)
+{
+ if (policy < SCHED_MIN || policy > SCHED_MAX)
+ {
+ return EINVAL;
+ }
+
+#if (THREAD_PRIORITY_LOWEST > THREAD_PRIORITY_NORMAL)
+ /* WinCE? */
+ return sched_Min(THREAD_PRIORITY_IDLE, THREAD_PRIORITY_TIME_CRITICAL);
+#else
+ /* This is independent of scheduling policy in Win32. */
+ return sched_Min(THREAD_PRIORITY_LOWEST, THREAD_PRIORITY_HIGHEST);
+#endif
+}
+
+
+int
+sched_setscheduler(pid_t pid, int policy)
+{
+ /*
+ * Win32 only has one policy which we call SCHED_OTHER.
+ * However, we try to provide other valid side-effects
+ * such as EPERM and ESRCH errors. Choosing to check
+ * for a valid policy last allows us to get the most value out
+ * of this function.
+ */
+ if (0 != pid)
+ {
+ int selfPid = (int) GetCurrentProcessId();
+
+ if (pid != selfPid)
+ {
+ HANDLE h = OpenProcess(PROCESS_SET_INFORMATION, FALSE, (DWORD) pid);
+
+ if (NULL == h)
+ {
+ errno = (GetLastError() == (0xFF & ERROR_ACCESS_DENIED)) ? EPERM : ESRCH;
+ return -1;
+ }
+ }
+ }
+
+ if (SCHED_OTHER != policy)
+ {
+ errno = ENOSYS;
+ return -1;
+ }
+
+ /*
+ * Don't set anything because there is nothing to set.
+ * Just return the current (the only possible) value.
+ */
+ return SCHED_OTHER;
+}
+
+
+int
+sched_getscheduler(pid_t pid)
+{
+ /*
+ * Win32 only has one policy which we call SCHED_OTHER.
+ * However, we try to provide other valid side-effects
+ * such as EPERM and ESRCH errors.
+ */
+ if (0 != pid)
+ {
+ int selfPid = (int) GetCurrentProcessId();
+
+ if (pid != selfPid)
+ {
+ HANDLE h = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, (DWORD) pid);
+
+ if (NULL == h)
+ {
+ errno = (GetLastError() == (0xFF & ERROR_ACCESS_DENIED)) ? EPERM : ESRCH;
+ return -1;
+ }
+ }
+ }
+
+ return SCHED_OTHER;
+}
+
+
+int
+sched_yield(void)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * This function indicates that the calling thread is
+ * willing to give up some time slices to other threads.
+ *
+ * PARAMETERS
+ * N/A
+ *
+ *
+ * DESCRIPTION
+ * This function indicates that the calling thread is
+ * willing to give up some time slices to other threads.
+ * NOTE: Since this is part of POSIX 1003.1b
+ * (realtime extensions), it is defined as returning
+ * -1 if an error occurs and sets errno to the actual
+ * error.
+ *
+ * RESULTS
+ * 0 successfully created semaphore,
+ * ENOSYS sched_yield not supported,
+ *
+ * ------------------------------------------------------
+ */
+{
+ Sleep(0);
+
+ return 0;
+}
diff --git a/win32/contrib/pthreads/sched.h b/win32/contrib/pthreads/sched.h new file mode 100644 index 000000000..c9aaeb8a4 --- /dev/null +++ b/win32/contrib/pthreads/sched.h @@ -0,0 +1,89 @@ +/*
+ * Module: sched.h
+ *
+ * Purpose:
+ * Provides an implementation of POSIX realtime extensions
+ * as defined in
+ *
+ * POSIX 1003.1b-1993 (POSIX.1b)
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright (C) 1998
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA
+ */
+#ifndef _SCHED_H
+#define _SCHED_H
+
+#if defined(__MINGW32__) || defined(_UWIN)
+/* For pid_t */
+# include <sys/types.h>
+/* Required by Unix 98 */
+# include <time.h>
+#else
+typedef int pid_t;
+#endif
+
+/* Thread scheduling policies */
+
+enum {
+ SCHED_OTHER = 0,
+ SCHED_FIFO,
+ SCHED_RR,
+ SCHED_MIN = SCHED_OTHER,
+ SCHED_MAX = SCHED_RR
+};
+
+struct sched_param {
+ int sched_priority;
+};
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+int sched_yield (void);
+
+int sched_get_priority_min (int policy);
+
+int sched_get_priority_max (int policy);
+
+int sched_setscheduler (pid_t pid, int policy);
+
+int sched_getscheduler (pid_t pid);
+
+/*
+ * Note that this macro returns ENOTSUP rather than
+ * ENOSYS as might be expected. However, returning ENOSYS
+ * should mean that sched_get_priority_{min,max} are
+ * not implemented as well as sched_rr_get_interval.
+ * This is not the case, since we just don't support
+ * round-robin scheduling. Therefore I have chosen to
+ * return the same value as sched_setscheduler when
+ * SCHED_RR is passed to it.
+ */
+#define sched_rr_get_interval(_pid, _interval) \
+ ( errno = ENOTSUP, (int) -1 )
+
+
+#ifdef __cplusplus
+} /* End of extern "C" */
+#endif /* __cplusplus */
+
+
+#endif /* !_SCHED_H */
+
diff --git a/win32/contrib/pthreads/semaphore.c b/win32/contrib/pthreads/semaphore.c new file mode 100644 index 000000000..2f43d05c9 --- /dev/null +++ b/win32/contrib/pthreads/semaphore.c @@ -0,0 +1,557 @@ +/*
+ * -------------------------------------------------------------
+ *
+ * Module: semaphore.c
+ *
+ * Purpose:
+ * Semaphores aren't actually part of the PThreads standard.
+ * They are defined by the POSIX Standard:
+ *
+ * POSIX 1003.1b-1993 (POSIX.1b)
+ *
+ * -------------------------------------------------------------
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright (C) 1998
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA
+ */
+
+/* ignore warning "unreferenced formal parameter" */
+#ifdef _MSC_VER
+#pragma warning( disable : 4100 )
+#endif
+
+#include "pthread.h"
+#include "semaphore.h"
+#include "implement.h"
+
+int
+sem_init (sem_t * sem, int pshared, unsigned int value)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * This function initializes an unnamed semaphore. the
+ * initial value of the semaphore is 'value'
+ *
+ * PARAMETERS
+ * sem
+ * pointer to an instance of sem_t
+ *
+ * pshared
+ * if zero, this semaphore may only be shared between
+ * threads in the same process.
+ * if nonzero, the semaphore can be shared between
+ * processes
+ *
+ * value
+ * initial value of the semaphore counter
+ *
+ * DESCRIPTION
+ * This function initializes an unnamed semaphore. The
+ * initial value of the semaphore is set to 'value'.
+ *
+ * RESULTS
+ * 0 successfully created semaphore,
+ * -1 failed, error in errno
+ * ERRNO
+ * EINVAL 'sem' is not a valid semaphore,
+ * ENOSPC a required resource has been exhausted,
+ * ENOSYS semaphores are not supported,
+ * EPERM the process lacks appropriate privilege
+ *
+ * ------------------------------------------------------
+ */
+{
+ int result = 0;
+ sem_t s;
+
+ if (pshared != 0)
+ {
+ /*
+ * Creating a semaphore that can be shared between
+ * processes
+ */
+ result = EPERM;
+
+ }
+ else
+ {
+ s = (sem_t) calloc (1, sizeof (*s));
+
+#ifdef NEED_SEM
+
+ if (NULL == s)
+ {
+ result = ENOMEM;
+ }
+ else
+ {
+ s->value = value;
+ s->event = CreateEvent (NULL,
+ FALSE, /* manual reset */
+ FALSE, /* initial state */
+ NULL);
+ if (0 == s->Event)
+ {
+ result = ENOSPC;
+ }
+ else
+ {
+ if (value != 0)
+ {
+ SetEvent(s->event);
+ }
+
+ InitializeCriticalSection(&s->sem_lock_cs);
+ }
+
+#else /* NEED_SEM */
+
+ s->sem = CreateSemaphore (NULL, /* Always NULL */
+ value, /* Initial value */
+ 0x7FFFFFFFL, /* Maximum value */
+ NULL); /* Name */
+
+ if (0 == s->sem)
+ {
+ result = ENOSPC;
+ }
+
+#endif /* NEED_SEM */
+
+ }
+
+ if (result != 0)
+ {
+ errno = result;
+ return -1;
+ }
+
+ *sem = s;
+
+ return 0;
+
+} /* sem_init */
+
+
+int
+sem_destroy (sem_t * sem)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * This function destroys an unnamed semaphore.
+ *
+ * PARAMETERS
+ * sem
+ * pointer to an instance of sem_t
+ *
+ * DESCRIPTION
+ * This function destroys an unnamed semaphore.
+ *
+ * RESULTS
+ * 0 successfully destroyed semaphore,
+ * -1 failed, error in errno
+ * ERRNO
+ * EINVAL 'sem' is not a valid semaphore,
+ * ENOSYS semaphores are not supported,
+ * EBUSY threads (or processes) are currently
+ * blocked on 'sem'
+ *
+ * ------------------------------------------------------
+ */
+{
+ int result = 0;
+ sem_t s;
+
+ if (sem == NULL || *sem == NULL)
+ {
+ result = EINVAL;
+ }
+ else
+ {
+ s = *sem;
+ *sem = NULL;
+
+#ifdef NEED_SEM
+
+ if (! CloseHandle(s->event))
+ {
+ *sem = s;
+ result = EINVAL;
+ }
+ else
+ {
+ DeleteCriticalSection(&s->sem_lock_cs);
+ free(s);
+ }
+
+#else /* NEED_SEM */
+
+ if (! CloseHandle (s->sem))
+ {
+ *sem = s;
+ result = EINVAL;
+ }
+
+#endif /* NEED_SEM */
+
+ }
+
+ if (result != 0)
+ {
+ errno = result;
+ return -1;
+ }
+
+ return 0;
+
+} /* sem_destroy */
+
+
+int
+sem_trywait (sem_t * sem)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * This function tries to wait on a semaphore.
+ *
+ * PARAMETERS
+ * sem
+ * pointer to an instance of sem_t
+ *
+ * DESCRIPTION
+ * This function tries to wait on a semaphore. If the
+ * semaphore value is greater than zero, it decreases
+ * its value by one. If the semaphore value is zero, then
+ * this function returns immediately with the error EAGAIN
+ *
+ * RESULTS
+ * 0 successfully decreased semaphore,
+ * -1 failed, error in errno
+ * ERRNO
+ * EAGAIN the semaphore was already locked,
+ * EINVAL 'sem' is not a valid semaphore,
+ * ENOSYS semaphores are not supported,
+ * EINTR the function was interrupted by a signal,
+ * EDEADLK a deadlock condition was detected.
+ *
+ * ------------------------------------------------------
+ */
+{
+#ifdef NEED_SEM
+
+ /*
+ * not yet implemented!
+ */
+ int result = EINVAL;
+ return -1;
+
+#else /* NEED_SEM */
+
+ int result = 0;
+
+ if (sem == NULL || *sem == NULL)
+ {
+ result = EINVAL;
+ }
+ else if (WaitForSingleObject ((*sem)->sem, 0) == WAIT_TIMEOUT)
+ {
+ result = EAGAIN;
+ }
+
+ if (result != 0)
+ {
+ errno = result;
+ return -1;
+ }
+
+ return 0;
+
+#endif /* NEED_SEM */
+
+} /* sem_trywait */
+
+
+#ifdef NEED_SEM
+
+void
+ptw32_decrease_semaphore(sem_t * sem)
+{
+ register sem_t s = *sem;
+
+ EnterCriticalSection(&s->sem_lock_cs);
+
+ if (s->value != 0)
+ {
+ s->value--;
+ if (s->value != 0)
+ {
+ SetEvent(s->event);
+ }
+ }
+ else
+ {
+ /* this case should not happen! */
+ }
+
+ LeaveCriticalSection(&s->sem_lock_cs);
+}
+
+BOOL
+ptw32_increase_semaphore(sem_t * sem, unsigned int n)
+{
+ BOOL result;
+ register sem_t s = *sem;
+
+ EnterCriticalSection(&s->sem_lock_cs);
+
+ if (s->value + n > s->value)
+ {
+ s->value += n;
+ SetEvent(s->event);
+ result = TRUE;
+ }
+ else
+ {
+ result = FALSE;
+ }
+
+ LeaveCriticalSection(&s->sem_lock_cs);
+ return result;
+}
+
+#endif /* NEED_SEM */
+
+int
+sem_wait (sem_t * sem)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * This function waits on a semaphore.
+ *
+ * PARAMETERS
+ * sem
+ * pointer to an instance of sem_t
+ *
+ * DESCRIPTION
+ * This function waits on a semaphore. If the
+ * semaphore value is greater than zero, it decreases
+ * its value by one. If the semaphore value is zero, then
+ * the calling thread (or process) is blocked until it can
+ * successfully decrease the value or until interrupted by
+ * a signal.
+ *
+ * RESULTS
+ * 0 successfully decreased semaphore,
+ * -1 failed, error in errno
+ * ERRNO
+ * EINVAL 'sem' is not a valid semaphore,
+ * ENOSYS semaphores are not supported,
+ * EINTR the function was interrupted by a signal,
+ * EDEADLK a deadlock condition was detected.
+ *
+ * ------------------------------------------------------
+ */
+{
+ int result = 0;
+
+ if (sem == NULL || *sem == NULL)
+ {
+ result = EINVAL;
+ }
+ else
+ {
+
+#ifdef NEED_SEM
+
+ result = pthreadCancelableWait ((*sem)->event);
+
+#else /* NEED_SEM */
+
+ result = pthreadCancelableWait ((*sem)->sem);
+
+#endif /* NEED_SEM */
+
+ }
+
+ if (result != 0)
+ {
+ errno = result;
+ return -1;
+ }
+
+#ifdef NEED_SEM
+
+ ptw32_decrease_semaphore(sem);
+
+#endif /* NEED_SEM */
+
+ return 0;
+
+} /* sem_wait */
+
+
+int
+sem_post (sem_t * sem)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * This function posts a wakeup to a semaphore.
+ *
+ * PARAMETERS
+ * sem
+ * pointer to an instance of sem_t
+ *
+ * DESCRIPTION
+ * This function posts a wakeup to a semaphore. If there
+ * are waiting threads (or processes), one is awakened;
+ * otherwise, the semaphore value is incremented by one.
+ *
+ * RESULTS
+ * 0 successfully posted semaphore,
+ * -1 failed, error in errno
+ * ERRNO
+ * EINVAL 'sem' is not a valid semaphore,
+ * ENOSYS semaphores are not supported,
+ *
+ * ------------------------------------------------------
+ */
+{
+ int result = 0;
+
+ if (sem == NULL || *sem == NULL)
+ {
+ result = EINVAL;
+ }
+
+#ifdef NEED_SEM
+
+ else if (! ptw32_increase_semaphore (sem, 1))
+
+#else /* NEED_SEM */
+
+ else if (! ReleaseSemaphore ((*sem)->sem, 1, 0))
+
+#endif /* NEED_SEM */
+
+ {
+ result = EINVAL;
+ }
+
+ if (result != 0)
+ {
+ errno = result;
+ return -1;
+ }
+
+ return 0;
+
+} /* sem_post */
+
+
+int
+sem_post_multiple (sem_t * sem, int count )
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * This function posts multiple wakeups to a semaphore.
+ *
+ * PARAMETERS
+ * sem
+ * pointer to an instance of sem_t
+ *
+ * count
+ * counter, must be greater than zero.
+ *
+ * DESCRIPTION
+ * This function posts multiple wakeups to a semaphore. If there
+ * are waiting threads (or processes), n <= count are awakened;
+ * the semaphore value is incremented by count - n.
+ *
+ * RESULTS
+ * 0 successfully posted semaphore,
+ * -1 failed, error in errno
+ * ERRNO
+ * EINVAL 'sem' is not a valid semaphore
+ * or count is less than or equal to zero.
+ *
+ * ------------------------------------------------------
+ */
+{
+ int result = 0;
+
+ if (sem == NULL || *sem == NULL || count <= 0)
+ {
+ result = EINVAL;
+ }
+
+#ifdef NEED_SEM
+
+ else if (! ptw32_increase_semaphore (sem, count))
+
+#else /* NEED_SEM */
+
+ else if (! ReleaseSemaphore ((*sem)->sem, count, 0))
+
+#endif /* NEED_SEM */
+
+ {
+ result = EINVAL;
+ }
+
+ if (result != 0)
+ {
+ errno = result;
+ return -1;
+ }
+
+ return 0;
+
+} /* sem_post_multiple */
+
+
+int
+sem_open (const char * name, int oflag, mode_t mode, unsigned int value)
+{
+ errno = ENOSYS;
+ return -1;
+} /* sem_open */
+
+
+int
+sem_close (sem_t * sem)
+{
+ errno = ENOSYS;
+ return -1;
+} /* sem_close */
+
+
+int
+sem_unlink (const char * name)
+{
+ errno = ENOSYS;
+ return -1;
+} /* sem_unlink */
+
+
+int
+sem_getvalue (sem_t * sem, int * sval)
+{
+ errno = ENOSYS;
+ return -1;
+} /* sem_getvalue */
+
diff --git a/win32/contrib/pthreads/semaphore.h b/win32/contrib/pthreads/semaphore.h new file mode 100644 index 000000000..a0255cf6f --- /dev/null +++ b/win32/contrib/pthreads/semaphore.h @@ -0,0 +1,101 @@ +/*
+ * Module: semaphore.h
+ *
+ * Purpose:
+ * Semaphores aren't actually part of the PThreads standard.
+ * They are defined by the POSIX Standard:
+ *
+ * POSIX 1003.1b-1993 (POSIX.1b)
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright (C) 1998
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA
+ */
+#if !defined( SEMAPHORE_H )
+#define SEMAPHORE_H
+
+/*
+ * This is a duplicate of what is in the autoconf config.h,
+ * which is only used when building the pthread-win32 libraries.
+ */
+
+#ifndef PTW32_CONFIG_H
+# if defined(WINCE)
+# define NEED_ERRNO
+# define NEED_SEM
+# endif
+# if defined(_UWIN) || defined(__MINGW32__)
+# define HAVE_MODE_T
+# endif
+#endif
+
+/*
+ *
+ */
+
+#ifdef NEED_SEM
+#include "need_errno.h"
+#else
+#include <errno.h>
+#endif
+
+#define _POSIX_SEMAPHORES
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+#ifndef HAVE_MODE_T
+typedef unsigned int mode_t;
+#endif
+
+
+typedef struct sem_t_ * sem_t;
+
+int sem_init (sem_t * sem,
+ int pshared,
+ unsigned int value);
+
+int sem_destroy (sem_t * sem);
+
+int sem_trywait (sem_t * sem);
+
+int sem_wait (sem_t * sem);
+
+int sem_post (sem_t * sem);
+
+int sem_post_multiple (sem_t * sem,
+ int count);
+
+int sem_open (const char * name,
+ int oflag,
+ mode_t mode,
+ unsigned int value);
+
+int sem_close (sem_t * sem);
+
+int sem_unlink (const char * name);
+
+int sem_getvalue (sem_t * sem,
+ int * sval);
+
+#ifdef __cplusplus
+} /* End of extern "C" */
+#endif /* __cplusplus */
+
+#endif /* !SEMAPHORE_H */
diff --git a/win32/contrib/pthreads/signal.c b/win32/contrib/pthreads/signal.c new file mode 100644 index 000000000..867dc4cc7 --- /dev/null +++ b/win32/contrib/pthreads/signal.c @@ -0,0 +1,172 @@ +/*
+ * signal.c
+ *
+ * Description:
+ * Thread-aware signal functions.
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright (C) 1998
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA
+ */
+
+/*
+ * Strategy for implementing pthread_kill()
+ * ========================================
+ *
+ * Win32 does not implement signals.
+ * Signals are simply software interrupts.
+ * pthread_kill() asks the system to deliver a specified
+ * signal (interrupt) to a specified thread in the same
+ * process.
+ * Signals are always asynchronous (no deferred signals).
+ * Pthread-win32 has an async cancelation mechanism.
+ * A similar system can be written to deliver signals
+ * within the same process (on ix86 processors at least).
+ *
+ * Each thread maintains information about which
+ * signals it will respond to. Handler routines
+ * are set on a per-process basis - not per-thread.
+ * When signalled, a thread will check it's sigmask
+ * and, if the signal is not being ignored, call the
+ * handler routine associated with the signal. The
+ * thread must then (except for some signals) return to
+ * the point where it was interrupted.
+ *
+ * Ideally the system itself would check the target thread's
+ * mask before possibly needlessly bothering the thread
+ * itself. This could be done by pthread_kill(), that is,
+ * in the signaling thread since it has access to
+ * all pthread_t structures. It could also retrieve
+ * the handler routine address to minimise the target
+ * threads response overhead. This may also simplify
+ * serialisation of the access to the per-thread signal
+ * structures.
+ *
+ * pthread_kill() eventually calls a routine similar to
+ * ptw32_cancel_thread() which manipulates the target
+ * threads processor context to cause the thread to
+ * run the handler launcher routine. pthread_kill() must
+ * save the target threads current context so that the
+ * handler launcher routine can restore the context after
+ * the signal handler has returned. Some handlers will not
+ * return, eg. the default SIGKILL handler may simply
+ * call pthread_exit().
+ *
+ * The current context is saved in the target threads
+ * pthread_t structure.
+ */
+
+#include "pthread.h"
+#include "implement.h"
+
+#if HAVE_SIGSET_T
+
+static void
+ptw32_signal_thread()
+{
+}
+
+static void
+ptw32_signal_callhandler()
+{
+}
+
+int
+pthread_sigmask(int how, sigset_t const *set, sigset_t *oset)
+{
+ pthread_t thread = pthread_self();
+
+ if (thread == NULL)
+ {
+ return ENOENT;
+ }
+
+ /* Validate the `how' argument.*/
+ if (set != NULL)
+ {
+ switch (how)
+ {
+ case SIG_BLOCK:
+ break;
+ case SIG_UNBLOCK:
+ break;
+ case SIG_SETMASK:
+ break;
+ default:
+ /* Invalid `how' argument. */
+ return EINVAL;
+ }
+ }
+
+ /* Copy the old mask before modifying it. */
+ if (oset != NULL)
+ {
+ memcpy(oset, &(thread->sigmask), sizeof(sigset_t));
+ }
+
+ if (set != NULL)
+ {
+ unsigned int i;
+
+ /* FIXME: this code assumes that sigmask is an even multiple of
+ the size of a long integer. */
+
+ unsigned long *src = (unsigned long const *) set;
+ unsigned long *dest = (unsigned long *) &(thread->sigmask);
+
+ switch (how)
+ {
+ case SIG_BLOCK:
+ for (i = 0; i < (sizeof(sigset_t) / sizeof(unsigned long)); i++)
+ {
+ /* OR the bit field longword-wise. */
+ *dest++ |= *src++;
+ }
+ break;
+ case SIG_UNBLOCK:
+ for (i = 0; i < (sizeof(sigset_t) / sizeof(unsigned long)); i++)
+ {
+ /* XOR the bitfield longword-wise. */
+ *dest++ ^= *src++;
+ }
+ case SIG_SETMASK:
+ /* Replace the whole sigmask. */
+ memcpy(&(thread->sigmask), set, sizeof(sigset_t));
+ break;
+ }
+ }
+
+ return 0;
+}
+
+int pthread_kill(pthread_t thread,
+ int signo)
+{
+}
+
+int sigwait(const sigset_t *set,
+ int *sig)
+{
+}
+
+int sigaction(int signum,
+ const struct sigaction *act,
+ struct sigaction *oldact)
+{
+}
+
+#endif /* HAVE_SIGSET_T */
diff --git a/win32/contrib/pthreads/spin.c b/win32/contrib/pthreads/spin.c new file mode 100644 index 000000000..6bf95cc22 --- /dev/null +++ b/win32/contrib/pthreads/spin.c @@ -0,0 +1,301 @@ +/*
+ * spin.c
+ *
+ * Description:
+ * This translation unit implements spin lock primitives.
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright (C) 1998
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA
+ */
+
+#include "pthread.h"
+#include "implement.h"
+
+#ifdef __MINGW32__
+#define _LONG long
+#define _LPLONG long*
+#else
+#define _LONG PVOID
+#define _LPLONG PVOID*
+#endif
+
+static INLINE int
+ptw32_spinlock_check_need_init(pthread_spinlock_t *lock)
+{
+ int result = 0;
+
+ /*
+ * The following guarded test is specifically for statically
+ * initialised spinlocks (via PTHREAD_SPINLOCK_INITIALIZER).
+ *
+ * Note that by not providing this synchronisation we risk
+ * introducing race conditions into applications which are
+ * correctly written.
+ */
+ EnterCriticalSection(&ptw32_spinlock_test_init_lock);
+
+ /*
+ * We got here possibly under race
+ * conditions. Check again inside the critical section
+ * and only initialise if the spinlock is valid (not been destroyed).
+ * If a static spinlock has been destroyed, the application can
+ * re-initialise it only by calling pthread_spin_init()
+ * explicitly.
+ */
+ if (*lock == PTHREAD_SPINLOCK_INITIALIZER)
+ {
+ result = pthread_spin_init(lock, PTHREAD_PROCESS_PRIVATE);
+ }
+ else if (*lock == NULL)
+ {
+ /*
+ * The spinlock has been destroyed while we were waiting to
+ * initialise it, so the operation that caused the
+ * auto-initialisation should fail.
+ */
+ result = EINVAL;
+ }
+
+ LeaveCriticalSection(&ptw32_spinlock_test_init_lock);
+
+ return(result);
+}
+
+
+int
+pthread_spin_init(pthread_spinlock_t *lock, int pshared)
+{
+ pthread_spinlock_t s;
+ int result = 0;
+
+ if (lock == NULL)
+ {
+ return EINVAL;
+ }
+
+ s = (pthread_spinlock_t) calloc(1, sizeof(*s));
+
+ if (s == NULL)
+ {
+ return ENOMEM;
+ }
+
+ if (0 != pthread_getprocessors_np(&(s->u.cpus)))
+ {
+ s->u.cpus = 1;
+ }
+
+ if (s->u.cpus > 1)
+ {
+ if (pshared == PTHREAD_PROCESS_SHARED)
+ {
+ /*
+ * Creating spinlock that can be shared between
+ * processes.
+ */
+#if _POSIX_THREAD_PROCESS_SHARED
+
+ /*
+ * Not implemented yet.
+ */
+
+#error ERROR [__FILE__, line __LINE__]: Process shared spin locks are not supported yet.
+
+
+#else
+
+ result = ENOSYS;
+ goto FAIL0;
+
+#endif /* _POSIX_THREAD_PROCESS_SHARED */
+
+ }
+
+ s->interlock = PTW32_SPIN_UNLOCKED;
+ }
+ else
+ {
+ pthread_mutexattr_t ma;
+ result = pthread_mutexattr_init(&ma);
+
+ if (0 == result)
+ {
+ ma->pshared = pshared;
+ result = pthread_mutex_init(&(s->u.mutex), &ma);
+ if (0 == result)
+ {
+ s->interlock = PTW32_SPIN_USE_MUTEX;
+ }
+ }
+ }
+
+FAIL0:
+ *lock = (0 == result ? s : NULL);
+ return(result);
+}
+
+int
+pthread_spin_destroy(pthread_spinlock_t *lock)
+{
+ register pthread_spinlock_t s;
+
+ if (lock == NULL || *lock == NULL)
+ {
+ return EINVAL;
+ }
+
+ if ((s = *lock) != PTHREAD_SPINLOCK_INITIALIZER)
+ {
+ if (s->interlock == PTW32_SPIN_USE_MUTEX)
+ {
+ return pthread_mutex_destroy(&(s->u.mutex));
+ }
+
+ if ( (_LONG) PTW32_SPIN_UNLOCKED ==
+ InterlockedCompareExchange((_LPLONG) &(s->interlock),
+ (_LONG) PTW32_OBJECT_INVALID,
+ (_LONG) PTW32_SPIN_UNLOCKED))
+ {
+ return 0;
+ }
+
+ return EINVAL;
+ }
+ else
+ {
+ int result = 0;
+
+ /*
+ * See notes in ptw32_spinlock_check_need_init() above also.
+ */
+ EnterCriticalSection(&ptw32_spinlock_test_init_lock);
+
+ /*
+ * Check again.
+ */
+ if (*lock == PTHREAD_SPINLOCK_INITIALIZER)
+ {
+ /*
+ * This is all we need to do to destroy a statically
+ * initialised spinlock that has not yet been used (initialised).
+ * If we get to here, another thread
+ * waiting to initialise this mutex will get an EINVAL.
+ */
+ *lock = NULL;
+ }
+ else
+ {
+ /*
+ * The spinlock has been initialised while we were waiting
+ * so assume it's in use.
+ */
+ result = EBUSY;
+ }
+
+ LeaveCriticalSection(&ptw32_spinlock_test_init_lock);
+ return(result);
+ }
+}
+
+/*
+ * NOTE: For speed, these routines don't check if "lock" is valid.
+ */
+int
+pthread_spin_lock(pthread_spinlock_t *lock)
+{
+ register pthread_spinlock_t s = *lock;
+
+ if (s == PTHREAD_SPINLOCK_INITIALIZER)
+ {
+ int result;
+
+ if ((result = ptw32_spinlock_check_need_init(lock)) != 0)
+ {
+ return(result);
+ }
+ }
+
+ while ( (_LONG) PTW32_SPIN_LOCKED ==
+ InterlockedCompareExchange((_LPLONG) &(s->interlock),
+ (_LONG) PTW32_SPIN_LOCKED,
+ (_LONG) PTW32_SPIN_UNLOCKED) )
+ {}
+
+ if (s->interlock == PTW32_SPIN_LOCKED)
+ {
+ return 0;
+ }
+ else if (s->interlock == PTW32_SPIN_USE_MUTEX)
+ {
+ return pthread_mutex_lock(&(s->u.mutex));
+ }
+
+ return EINVAL;
+}
+
+int
+pthread_spin_unlock(pthread_spinlock_t *lock)
+{
+ register pthread_spinlock_t s = *lock;
+
+ if (s->interlock == PTW32_SPIN_USE_MUTEX)
+ {
+ return pthread_mutex_unlock(&(s->u.mutex));
+ }
+
+ if ((_LONG) PTW32_SPIN_LOCKED ==
+ InterlockedCompareExchange((_LPLONG) &(s->interlock),
+ (_LONG) PTW32_SPIN_UNLOCKED,
+ (_LONG) PTW32_SPIN_LOCKED ) )
+ {
+ return 0;
+ }
+
+ return EINVAL;
+}
+
+int
+pthread_spin_trylock(pthread_spinlock_t *lock)
+{
+ pthread_spinlock_t s = *lock;
+
+ if (s == PTHREAD_SPINLOCK_INITIALIZER)
+ {
+ int result;
+
+ if ((result = ptw32_spinlock_check_need_init(lock)) != 0)
+ {
+ return(result);
+ }
+ }
+
+ if ((_LONG) PTW32_SPIN_UNLOCKED ==
+ InterlockedCompareExchange((_LPLONG) &(s->interlock),
+ (_LONG) PTW32_SPIN_LOCKED,
+ (_LONG) PTW32_SPIN_UNLOCKED ) )
+ {
+ return 0;
+ }
+
+ if (s->interlock == PTW32_SPIN_USE_MUTEX)
+ {
+ return pthread_mutex_trylock(&(s->u.mutex));
+ }
+
+ return EINVAL;
+}
diff --git a/win32/contrib/pthreads/sync.c b/win32/contrib/pthreads/sync.c new file mode 100644 index 000000000..c0ed99e50 --- /dev/null +++ b/win32/contrib/pthreads/sync.c @@ -0,0 +1,188 @@ +/*
+ * sync.c
+ *
+ * Description:
+ * This translation unit implements functions related to thread
+ * synchronisation.
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright (C) 1998
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA
+ */
+
+#include "pthread.h"
+#include "implement.h"
+
+int
+pthread_detach (pthread_t tid)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * This function detaches the given thread.
+ *
+ * PARAMETERS
+ * thread
+ * an instance of a pthread_t
+ *
+ *
+ * DESCRIPTION
+ * This function detaches the given thread. You may
+ * detach the main thread or to detach a joinable thread
+ * (You should have used pthread_attr_t to create the
+ * thread as detached!)
+ * NOTE: detached threads cannot be joined nor canceled;
+ * storage is freed immediately on termination.
+ *
+ * RESULTS
+ * 0 successfully detached the thread,
+ * EINVAL thread is not a joinable thread,
+ * ENOSPC a required resource has been exhausted,
+ * ESRCH no thread could be found for 'thread',
+ *
+ * ------------------------------------------------------
+ */
+{
+ int result;
+
+ if (tid == NULL ||
+ tid->detachState == PTHREAD_CREATE_DETACHED)
+ {
+
+ result = EINVAL;
+
+ }
+ else
+ {
+ result = 0;
+ tid->detachState = PTHREAD_CREATE_DETACHED;
+ }
+
+ return (result);
+
+} /* pthread_detach */
+
+int
+pthread_join (pthread_t thread, void **value_ptr)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * This function waits for 'thread' to terminate and
+ * returns the thread's exit value if 'value_ptr' is not
+ * NULL. This also detaches the thread on successful
+ * completion.
+ *
+ * PARAMETERS
+ * thread
+ * an instance of pthread_t
+ *
+ * value_ptr
+ * pointer to an instance of pointer to void
+ *
+ *
+ * DESCRIPTION
+ * This function waits for 'thread' to terminate and
+ * returns the thread's exit value if 'value_ptr' is not
+ * NULL. This also detaches the thread on successful
+ * completion.
+ * NOTE: detached threads cannot be joined or canceled
+ *
+ * RESULTS
+ * 0 'thread' has completed
+ * EINVAL thread is not a joinable thread,
+ * ESRCH no thread could be found with ID 'thread',
+ * ENOENT thread couldn't find it's own valid handle,
+ * EDEADLK attempt to join thread with self
+ *
+ * ------------------------------------------------------
+ */
+{
+ int result = 0;
+ pthread_t self;
+
+ self = pthread_self ();
+ if (self == NULL)
+ {
+ return ENOENT;
+ }
+
+ if (pthread_equal (self, thread) != 0)
+ {
+ result = EDEADLK;
+ }
+ else if (thread->detachState == PTHREAD_CREATE_DETACHED)
+ {
+ result = EINVAL;
+ }
+ else
+ {
+ /*
+ * Pthread_join is a cancelation point.
+ * If we are canceled then our target thread must not be
+ * detached (destroyed). This is guarranteed because
+ * pthreadCancelableWait will not return if we
+ * are canceled.
+ */
+ result = pthreadCancelableWait(thread->threadH);
+
+ if (result == 0)
+ {
+
+#if ! defined (__MINGW32__) || defined (__MSVCRT__)
+
+ if (value_ptr != NULL
+ && !GetExitCodeThread (thread->threadH, (LPDWORD) value_ptr))
+ {
+ result = ESRCH;
+ }
+ else
+ {
+ /*
+ * The result of making multiple simultaneous calls to
+ * pthread_join() specifying the same target is undefined.
+ */
+ ptw32_threadDestroy (thread);
+ }
+
+#else /* __MINGW32__ && ! __MSVCRT__ */
+
+ /*
+ * If using CRTDLL, the thread may have exited, and endthread
+ * will have closed the handle.
+ */
+ if (value_ptr != NULL)
+ {
+ *value_ptr = self->exitStatus;
+ }
+
+ /*
+ * The result of making multiple simultaneous calls to
+ * pthread_join() specifying the same target is undefined.
+ */
+ ptw32_threadDestroy (thread);
+
+#endif /* __MINGW32__ && ! __MSVCRT__ */
+
+ }
+ else
+ {
+ result = ESRCH;
+ }
+ }
+
+ return (result);
+
+} /* pthread_join */
diff --git a/win32/contrib/pthreads/tsd.c b/win32/contrib/pthreads/tsd.c new file mode 100644 index 000000000..999dc34e5 --- /dev/null +++ b/win32/contrib/pthreads/tsd.c @@ -0,0 +1,333 @@ +/*
+ * tsd.c
+ *
+ * Description:
+ * POSIX thread functions which implement thread-specific data (TSD).
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright (C) 1998
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA
+ */
+
+#include "pthread.h"
+#include "implement.h"
+
+/* TLS_OUT_OF_INDEXES not defined on WinCE */
+#ifndef TLS_OUT_OF_INDEXES
+#define TLS_OUT_OF_INDEXES 0xffffffff
+#endif
+
+int
+pthread_key_create (pthread_key_t * key, void (*destructor) (void *))
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * This function creates a thread-specific data key visible
+ * to all threads. All existing and new threads have a value
+ * NULL for key until set using pthread_setspecific. When any
+ * thread with a non-NULL value for key terminates, 'destructor'
+ * is called with key's current value for that thread.
+ *
+ * PARAMETERS
+ * key
+ * pointer to an instance of pthread_key_t
+ *
+ *
+ * DESCRIPTION
+ * This function creates a thread-specific data key visible
+ * to all threads. All existing and new threads have a value
+ * NULL for key until set using pthread_setspecific. When any
+ * thread with a non-NULL value for key terminates, 'destructor'
+ * is called with key's current value for that thread.
+ *
+ * RESULTS
+ * 0 successfully created semaphore,
+ * EAGAIN insufficient resources or PTHREAD_KEYS_MAX
+ * exceeded,
+ * ENOMEM insufficient memory to create the key,
+ *
+ * ------------------------------------------------------
+ */
+{
+ int result = 0;
+ pthread_key_t newkey;
+
+ if ((newkey = (pthread_key_t) calloc (1, sizeof (*newkey))) == NULL)
+ {
+ result = ENOMEM;
+ }
+ else if ((newkey->key = TlsAlloc()) == TLS_OUT_OF_INDEXES)
+ {
+ result = EAGAIN;
+
+ free (newkey);
+ newkey = NULL;
+ }
+ else if (destructor != NULL)
+ {
+ /*
+ * Have to manage associations between thread and key;
+ * Therefore, need a lock that allows multiple threads
+ * to gain exclusive access to the key->threads list.
+ *
+ * The mutex will only be created when it is first locked.
+ */
+ newkey->threadsLock = PTHREAD_MUTEX_INITIALIZER;
+ newkey->destructor = destructor;
+ }
+
+ *key = newkey;
+
+ return (result);
+}
+
+int
+pthread_key_delete (pthread_key_t key)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * This function deletes a thread-specific data key. This
+ * does not change the value of the thread spcific data key
+ * for any thread and does not run the key's destructor
+ * in any thread so it should be used with caution.
+ *
+ * PARAMETERS
+ * key
+ * pointer to an instance of pthread_key_t
+ *
+ *
+ * DESCRIPTION
+ * This function deletes a thread-specific data key. This
+ * does not change the value of the thread spcific data key
+ * for any thread and does not run the key's destructor
+ * in any thread so it should be used with caution.
+ *
+ * RESULTS
+ * 0 successfully deleted the key,
+ * EINVAL key is invalid,
+ *
+ * ------------------------------------------------------
+ */
+{
+ int result = 0;
+
+ if (key != NULL)
+ {
+ if (key->threads != NULL &&
+ key->destructor != NULL &&
+ pthread_mutex_lock (&(key->threadsLock)) == 0)
+ {
+ /*
+ * Run through all Thread<-->Key associations
+ * for this key.
+ * If the pthread_t still exits (ie the assoc->thread
+ * is not NULL) then leave the assoc for the thread to
+ * destroy.
+ * Notes:
+ * If assoc->thread is NULL, then the associated thread
+ * is no longer referencing this assoc.
+ * The association is only referenced
+ * by this key and must be released; otherwise
+ * the assoc will be destroyed when the thread is destroyed.
+ */
+ ThreadKeyAssoc *assoc;
+
+ assoc = (ThreadKeyAssoc *) key->threads;
+
+ while (assoc != NULL)
+ {
+ if (pthread_mutex_lock (&(assoc->lock)) == 0)
+ {
+ ThreadKeyAssoc *next;
+
+ assoc->key = NULL;
+ next = assoc->nextThread;
+ assoc->nextThread = NULL;
+
+ pthread_mutex_unlock (&(assoc->lock));
+
+ ptw32_tkAssocDestroy (assoc);
+
+ assoc = next;
+ }
+ }
+ pthread_mutex_unlock (&(key->threadsLock));
+ }
+
+ TlsFree (key->key);
+ if (key->destructor != NULL)
+ {
+ pthread_mutex_destroy (&(key->threadsLock));
+ }
+
+#if defined( _DEBUG )
+ memset ((char *) key, 0, sizeof (*key));
+#endif
+ free (key);
+ }
+
+ return (result);
+}
+
+
+int
+pthread_setspecific (pthread_key_t key, const void *value)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * This function sets the value of the thread specific
+ * key in the calling thread.
+ *
+ * PARAMETERS
+ * key
+ * an instance of pthread_key_t
+ * value
+ * the value to set key to
+ *
+ *
+ * DESCRIPTION
+ * This function sets the value of the thread specific
+ * key in the calling thread.
+ *
+ * RESULTS
+ * 0 successfully set value
+ * EAGAIN could not set value
+ * ENOENT SERIOUS!!
+ *
+ * ------------------------------------------------------
+ */
+{
+ pthread_t self;
+ int result = 0;
+
+ if (key != ptw32_selfThreadKey)
+ {
+ /*
+ * Using pthread_self will implicitly create
+ * an instance of pthread_t for the current
+ * thread if one wasn't explicitly created
+ */
+ self = pthread_self ();
+ if (self == NULL)
+ {
+ return ENOENT;
+ }
+ }
+ else
+ {
+ /*
+ * Resolve catch-22 of registering thread with threadSelf
+ * key
+ */
+ self = (pthread_t) pthread_getspecific (ptw32_selfThreadKey);
+ if (self == NULL)
+ {
+ self = (pthread_t) value;
+ }
+ }
+
+ result = 0;
+
+ if (key != NULL)
+ {
+ ThreadKeyAssoc *assoc;
+
+ if (self != NULL &&
+ key->destructor != NULL &&
+ value != NULL)
+ {
+ /*
+ * Only require associations if we have to
+ * call user destroy routine.
+ * Don't need to locate an existing association
+ * when setting data to NULL for WIN32 since the
+ * data is stored with the operating system; not
+ * on the association; setting assoc to NULL short
+ * circuits the search.
+ */
+ assoc = (ThreadKeyAssoc *) self->keys;
+ /*
+ * Locate existing association
+ */
+ while (assoc != NULL)
+ {
+ if (assoc->key == key)
+ {
+ /*
+ * Association already exists
+ */
+ break;
+ }
+ assoc = assoc->nextKey;
+ }
+
+ /*
+ * create an association if not found
+ */
+ if (assoc == NULL)
+ {
+ result = ptw32_tkAssocCreate (&assoc, self, key);
+ }
+ }
+
+ if (result == 0)
+ {
+ if ( ! TlsSetValue (key->key, (LPVOID) value))
+ {
+ result = EAGAIN;
+ }
+ }
+ }
+
+ return (result);
+} /* pthread_setspecific */
+
+
+void *
+pthread_getspecific (pthread_key_t key)
+ /*
+ * ------------------------------------------------------
+ * DOCPUBLIC
+ * This function returns the current value of key in the
+ * calling thread. If no value has been set for 'key' in
+ * the thread, NULL is returned.
+ *
+ * PARAMETERS
+ * key
+ * an instance of pthread_key_t
+ *
+ *
+ * DESCRIPTION
+ * This function returns the current value of key in the
+ * calling thread. If no value has been set for 'key' in
+ * the thread, NULL is returned.
+ *
+ * RESULTS
+ * key value or NULL on failure
+ *
+ * ------------------------------------------------------
+ */
+{
+ int lasterror = GetLastError();
+
+ void *ptr = TlsGetValue (key->key);
+
+ SetLastError( lasterror );
+
+ return ptr;
+}
+
diff --git a/win32/contrib/timer/timer.c b/win32/contrib/timer/timer.c new file mode 100644 index 000000000..64c5362be --- /dev/null +++ b/win32/contrib/timer/timer.c @@ -0,0 +1,102 @@ +/*
+ * Copyright (C) 2000-2001 the xine project
+ *
+ * This file is part of xine, a unix video player.
+ *
+ * xine 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * xine 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * WIN32 PORT,
+ * by Matthew Grooms <elon@altavista.com>
+ *
+ * timer.c - Missing unix timer functions
+ *
+ */
+
+#include "stdio.h"
+#include "timer.h"
+
+/*
+ this function returns somewhat
+ accurate unix time with the data
+ accurate to the first call to get
+ of day and the resolution accurate
+ to ~ miliseconds.
+*/
+
+static time_t startseconds = 0;
+
+int gettimeofday( struct timeval *tp, struct timezone *tzp )
+{
+ MMTIME mmtime;
+
+ // clock() returns time in miliseconds
+
+ if( !startseconds )
+ startseconds = time( 0 );
+
+ timeGetSystemTime( &mmtime, sizeof( mmtime ) );
+
+ tp->tv_sec = ( mmtime.u.ms / 1000 ) + startseconds;
+ tp->tv_usec = ( mmtime.u.ms % 1000 ) * 1000;
+
+ return 0;
+};
+
+/*
+ These functions are designed to mimick
+ a subset of itimer for use with the
+ alarm signal on win32. This is just
+ enough for xine to work.
+*/
+
+static HANDLE sigalarm = 0;
+
+int setitimer( int which, struct itimerval * value, struct itimerval *ovalue )
+{
+ long int miliseconds;
+
+ if( !sigalarm )
+ sigalarm = CreateEvent( 0, FALSE, TRUE, "SIGALARM" );
+
+ miliseconds = value->it_value.tv_usec / 1000;
+
+ timeSetEvent( miliseconds, 0, ( LPTIMECALLBACK ) sigalarm, 0, TIME_PERIODIC | TIME_CALLBACK_EVENT_PULSE );
+
+ return 0;
+}
+
+/*
+ Wait for sigalarm to wake the thread
+*/
+
+int pause( void )
+{
+ WaitForSingleObject( sigalarm, INFINITE );
+
+ return 0;
+}
+
+int nanosleep( const struct timespec * rqtp, struct timespec * rmtp )
+{
+ Sleep( rqtp->tv_nsec / 1000000 );
+
+ return 0;
+}
+
+unsigned int sleep( unsigned int seconds )
+{
+ Sleep( seconds * 1000 );
+ return 0;
+}
\ No newline at end of file diff --git a/win32/contrib/timer/timer.h b/win32/contrib/timer/timer.h new file mode 100644 index 000000000..9be9d0557 --- /dev/null +++ b/win32/contrib/timer/timer.h @@ -0,0 +1,39 @@ +#include <time.h>
+#include <winsock.h>
+#include "pthread.h"
+
+#ifndef _ITIMER_
+#define _ITIMER_
+
+#define ITIMER_REAL 0
+#define ITIMER_VIRTUAL 1
+
+// time reference
+// ----------------------------------
+//
+// 1,000 milliseconds / sec
+// 1,000,000 microseconds / sec
+// 1,000,000,000 nanoseconds / sec
+//
+// timeval.time_sec = seconds
+// timeval.time_usec = microseconds
+
+struct itimerval
+{
+ struct timeval it_interval; /* timer interval */
+ struct timeval it_value; /* current value */
+};
+
+struct timezone {
+ int tz_minuteswest; /* minutes west of Greenwich */
+ int tz_dsttime; /* type of dst correction */
+};
+
+int gettimeofday( struct timeval *tp, struct timezone *tzp );
+int setitimer( int which, struct itimerval * value, struct itimerval *ovalue );
+int pause( void );
+
+unsigned int sleep( unsigned int seconds );
+int nanosleep( const struct timespec *rqtp, struct timespec *rmtp );
+
+#endif
\ No newline at end of file diff --git a/win32/contrib/zlib/ChangeLog b/win32/contrib/zlib/ChangeLog new file mode 100644 index 000000000..1f6525c74 --- /dev/null +++ b/win32/contrib/zlib/ChangeLog @@ -0,0 +1,471 @@ +
+ ChangeLog file for zlib
+
+Changes in 1.1.3 (9 July 1998)
+- fix "an inflate input buffer bug that shows up on rare but persistent
+ occasions" (Mark)
+- fix gzread and gztell for concatenated .gz files (Didier Le Botlan)
+- fix gzseek(..., SEEK_SET) in write mode
+- fix crc check after a gzeek (Frank Faubert)
+- fix miniunzip when the last entry in a zip file is itself a zip file
+ (J Lillge)
+- add contrib/asm586 and contrib/asm686 (Brian Raiter)
+ See http://www.muppetlabs.com/~breadbox/software/assembly.html
+- add support for Delphi 3 in contrib/delphi (Bob Dellaca)
+- add support for C++Builder 3 and Delphi 3 in contrib/delphi2 (Davide Moretti)
+- do not exit prematurely in untgz if 0 at start of block (Magnus Holmgren)
+- use macro EXTERN instead of extern to support DLL for BeOS (Sander Stoks)
+- added a FAQ file
+
+- Support gzdopen on Mac with Metrowerks (Jason Linhart)
+- Do not redefine Byte on Mac (Brad Pettit & Jason Linhart)
+- define SEEK_END too if SEEK_SET is not defined (Albert Chin-A-Young)
+- avoid some warnings with Borland C (Tom Tanner)
+- fix a problem in contrib/minizip/zip.c for 16-bit MSDOS (Gilles Vollant)
+- emulate utime() for WIN32 in contrib/untgz (Gilles Vollant)
+- allow several arguments to configure (Tim Mooney, Frodo Looijaard)
+- use libdir and includedir in Makefile.in (Tim Mooney)
+- support shared libraries on OSF1 V4 (Tim Mooney)
+- remove so_locations in "make clean" (Tim Mooney)
+- fix maketree.c compilation error (Glenn, Mark)
+- Python interface to zlib now in Python 1.5 (Jeremy Hylton)
+- new Makefile.riscos (Rich Walker)
+- initialize static descriptors in trees.c for embedded targets (Nick Smith)
+- use "foo-gz" in example.c for RISCOS and VMS (Nick Smith)
+- add the OS/2 files in Makefile.in too (Andrew Zabolotny)
+- fix fdopen and halloc macros for Microsoft C 6.0 (Tom Lane)
+- fix maketree.c to allow clean compilation of inffixed.h (Mark)
+- fix parameter check in deflateCopy (Gunther Nikl)
+- cleanup trees.c, use compressed_len only in debug mode (Christian Spieler)
+- Many portability patches by Christian Spieler:
+ . zutil.c, zutil.h: added "const" for zmem*
+ . Make_vms.com: fixed some typos
+ . Make_vms.com: msdos/Makefile.*: removed zutil.h from some dependency lists
+ . msdos/Makefile.msc: remove "default rtl link library" info from obj files
+ . msdos/Makefile.*: use model-dependent name for the built zlib library
+ . msdos/Makefile.emx, nt/Makefile.emx, nt/Makefile.gcc:
+ new makefiles, for emx (DOS/OS2), emx&rsxnt and mingw32 (Windows 9x / NT)
+- use define instead of typedef for Bytef also for MSC small/medium (Tom Lane)
+- replace __far with _far for better portability (Christian Spieler, Tom Lane)
+- fix test for errno.h in configure (Tim Newsham)
+
+Changes in 1.1.2 (19 March 98)
+- added contrib/minzip, mini zip and unzip based on zlib (Gilles Vollant)
+ See http://www.winimage.com/zLibDll/unzip.html
+- preinitialize the inflate tables for fixed codes, to make the code
+ completely thread safe (Mark)
+- some simplifications and slight speed-up to the inflate code (Mark)
+- fix gzeof on non-compressed files (Allan Schrum)
+- add -std1 option in configure for OSF1 to fix gzprintf (Martin Mokrejs)
+- use default value of 4K for Z_BUFSIZE for 16-bit MSDOS (Tim Wegner + Glenn)
+- added os2/Makefile.def and os2/zlib.def (Andrew Zabolotny)
+- add shared lib support for UNIX_SV4.2MP (MATSUURA Takanori)
+- do not wrap extern "C" around system includes (Tom Lane)
+- mention zlib binding for TCL in README (Andreas Kupries)
+- added amiga/Makefile.pup for Amiga powerUP SAS/C PPC (Andreas Kleinert)
+- allow "make install prefix=..." even after configure (Glenn Randers-Pehrson)
+- allow "configure --prefix $HOME" (Tim Mooney)
+- remove warnings in example.c and gzio.c (Glenn Randers-Pehrson)
+- move Makefile.sas to amiga/Makefile.sas
+
+Changes in 1.1.1 (27 Feb 98)
+- fix macros _tr_tally_* in deflate.h for debug mode (Glenn Randers-Pehrson)
+- remove block truncation heuristic which had very marginal effect for zlib
+ (smaller lit_bufsize than in gzip 1.2.4) and degraded a little the
+ compression ratio on some files. This also allows inlining _tr_tally for
+ matches in deflate_slow.
+- added msdos/Makefile.w32 for WIN32 Microsoft Visual C++ (Bob Frazier)
+
+Changes in 1.1.0 (24 Feb 98)
+- do not return STREAM_END prematurely in inflate (John Bowler)
+- revert to the zlib 1.0.8 inflate to avoid the gcc 2.8.0 bug (Jeremy Buhler)
+- compile with -DFASTEST to get compression code optimized for speed only
+- in minigzip, try mmap'ing the input file first (Miguel Albrecht)
+- increase size of I/O buffers in minigzip.c and gzio.c (not a big gain
+ on Sun but significant on HP)
+
+- add a pointer to experimental unzip library in README (Gilles Vollant)
+- initialize variable gcc in configure (Chris Herborth)
+
+Changes in 1.0.9 (17 Feb 1998)
+- added gzputs and gzgets functions
+- do not clear eof flag in gzseek (Mark Diekhans)
+- fix gzseek for files in transparent mode (Mark Diekhans)
+- do not assume that vsprintf returns the number of bytes written (Jens Krinke)
+- replace EXPORT with ZEXPORT to avoid conflict with other programs
+- added compress2 in zconf.h, zlib.def, zlib.dnt
+- new asm code from Gilles Vollant in contrib/asm386
+- simplify the inflate code (Mark):
+ . Replace ZALLOC's in huft_build() with single ZALLOC in inflate_blocks_new()
+ . ZALLOC the length list in inflate_trees_fixed() instead of using stack
+ . ZALLOC the value area for huft_build() instead of using stack
+ . Simplify Z_FINISH check in inflate()
+
+- Avoid gcc 2.8.0 comparison bug a little differently than zlib 1.0.8
+- in inftrees.c, avoid cc -O bug on HP (Farshid Elahi)
+- in zconf.h move the ZLIB_DLL stuff earlier to avoid problems with
+ the declaration of FAR (Gilles VOllant)
+- install libz.so* with mode 755 (executable) instead of 644 (Marc Lehmann)
+- read_buf buf parameter of type Bytef* instead of charf*
+- zmemcpy parameters are of type Bytef*, not charf* (Joseph Strout)
+- do not redeclare unlink in minigzip.c for WIN32 (John Bowler)
+- fix check for presence of directories in "make install" (Ian Willis)
+
+Changes in 1.0.8 (27 Jan 1998)
+- fixed offsets in contrib/asm386/gvmat32.asm (Gilles Vollant)
+- fix gzgetc and gzputc for big endian systems (Markus Oberhumer)
+- added compress2() to allow setting the compression level
+- include sys/types.h to get off_t on some systems (Marc Lehmann & QingLong)
+- use constant arrays for the static trees in trees.c instead of computing
+ them at run time (thanks to Ken Raeburn for this suggestion). To create
+ trees.h, compile with GEN_TREES_H and run "make test".
+- check return code of example in "make test" and display result
+- pass minigzip command line options to file_compress
+- simplifying code of inflateSync to avoid gcc 2.8 bug
+
+- support CC="gcc -Wall" in configure -s (QingLong)
+- avoid a flush caused by ftell in gzopen for write mode (Ken Raeburn)
+- fix test for shared library support to avoid compiler warnings
+- zlib.lib -> zlib.dll in msdos/zlib.rc (Gilles Vollant)
+- check for TARGET_OS_MAC in addition to MACOS (Brad Pettit)
+- do not use fdopen for Metrowerks on Mac (Brad Pettit))
+- add checks for gzputc and gzputc in example.c
+- avoid warnings in gzio.c and deflate.c (Andreas Kleinert)
+- use const for the CRC table (Ken Raeburn)
+- fixed "make uninstall" for shared libraries
+- use Tracev instead of Trace in infblock.c
+- in example.c use correct compressed length for test_sync
+- suppress +vnocompatwarnings in configure for HPUX (not always supported)
+
+Changes in 1.0.7 (20 Jan 1998)
+- fix gzseek which was broken in write mode
+- return error for gzseek to negative absolute position
+- fix configure for Linux (Chun-Chung Chen)
+- increase stack space for MSC (Tim Wegner)
+- get_crc_table and inflateSyncPoint are EXPORTed (Gilles Vollant)
+- define EXPORTVA for gzprintf (Gilles Vollant)
+- added man page zlib.3 (Rick Rodgers)
+- for contrib/untgz, fix makedir() and improve Makefile
+
+- check gzseek in write mode in example.c
+- allocate extra buffer for seeks only if gzseek is actually called
+- avoid signed/unsigned comparisons (Tim Wegner, Gilles Vollant)
+- add inflateSyncPoint in zconf.h
+- fix list of exported functions in nt/zlib.dnt and mdsos/zlib.def
+
+Changes in 1.0.6 (19 Jan 1998)
+- add functions gzprintf, gzputc, gzgetc, gztell, gzeof, gzseek, gzrewind and
+ gzsetparams (thanks to Roland Giersig and Kevin Ruland for some of this code)
+- Fix a deflate bug occuring only with compression level 0 (thanks to
+ Andy Buckler for finding this one).
+- In minigzip, pass transparently also the first byte for .Z files.
+- return Z_BUF_ERROR instead of Z_OK if output buffer full in uncompress()
+- check Z_FINISH in inflate (thanks to Marc Schluper)
+- Implement deflateCopy (thanks to Adam Costello)
+- make static libraries by default in configure, add --shared option.
+- move MSDOS or Windows specific files to directory msdos
+- suppress the notion of partial flush to simplify the interface
+ (but the symbol Z_PARTIAL_FLUSH is kept for compatibility with 1.0.4)
+- suppress history buffer provided by application to simplify the interface
+ (this feature was not implemented anyway in 1.0.4)
+- next_in and avail_in must be initialized before calling inflateInit or
+ inflateInit2
+- add EXPORT in all exported functions (for Windows DLL)
+- added Makefile.nt (thanks to Stephen Williams)
+- added the unsupported "contrib" directory:
+ contrib/asm386/ by Gilles Vollant <info@winimage.com>
+ 386 asm code replacing longest_match().
+ contrib/iostream/ by Kevin Ruland <kevin@rodin.wustl.edu>
+ A C++ I/O streams interface to the zlib gz* functions
+ contrib/iostream2/ by Tyge Løvset <Tyge.Lovset@cmr.no>
+ Another C++ I/O streams interface
+ contrib/untgz/ by "Pedro A. Aranda Guti\irrez" <paag@tid.es>
+ A very simple tar.gz file extractor using zlib
+ contrib/visual-basic.txt by Carlos Rios <c_rios@sonda.cl>
+ How to use compress(), uncompress() and the gz* functions from VB.
+- pass params -f (filtered data), -h (huffman only), -1 to -9 (compression
+ level) in minigzip (thanks to Tom Lane)
+
+- use const for rommable constants in deflate
+- added test for gzseek and gztell in example.c
+- add undocumented function inflateSyncPoint() (hack for Paul Mackerras)
+- add undocumented function zError to convert error code to string
+ (for Tim Smithers)
+- Allow compilation of gzio with -DNO_DEFLATE to avoid the compression code.
+- Use default memcpy for Symantec MSDOS compiler.
+- Add EXPORT keyword for check_func (needed for Windows DLL)
+- add current directory to LD_LIBRARY_PATH for "make test"
+- create also a link for libz.so.1
+- added support for FUJITSU UXP/DS (thanks to Toshiaki Nomura)
+- use $(SHAREDLIB) instead of libz.so in Makefile.in (for HPUX)
+- added -soname for Linux in configure (Chun-Chung Chen,
+- assign numbers to the exported functions in zlib.def (for Windows DLL)
+- add advice in zlib.h for best usage of deflateSetDictionary
+- work around compiler bug on Atari (cast Z_NULL in call of s->checkfn)
+- allow compilation with ANSI keywords only enabled for TurboC in large model
+- avoid "versionString"[0] (Borland bug)
+- add NEED_DUMMY_RETURN for Borland
+- use variable z_verbose for tracing in debug mode (L. Peter Deutsch).
+- allow compilation with CC
+- defined STDC for OS/2 (David Charlap)
+- limit external names to 8 chars for MVS (Thomas Lund)
+- in minigzip.c, use static buffers only for 16-bit systems
+- fix suffix check for "minigzip -d foo.gz"
+- do not return an error for the 2nd of two consecutive gzflush() (Felix Lee)
+- use _fdopen instead of fdopen for MSC >= 6.0 (Thomas Fanslau)
+- added makelcc.bat for lcc-win32 (Tom St Denis)
+- in Makefile.dj2, use copy and del instead of install and rm (Frank Donahoe)
+- Avoid expanded $Id: ChangeLog,v 1.1 2003/04/20 16:42:09 guenter Exp $. Use "rcs -kb" or "cvs admin -kb" to avoid Id expansion.
+- check for unistd.h in configure (for off_t)
+- remove useless check parameter in inflate_blocks_free
+- avoid useless assignment of s->check to itself in inflate_blocks_new
+- do not flush twice in gzclose (thanks to Ken Raeburn)
+- rename FOPEN as F_OPEN to avoid clash with /usr/include/sys/file.h
+- use NO_ERRNO_H instead of enumeration of operating systems with errno.h
+- work around buggy fclose on pipes for HP/UX
+- support zlib DLL with BORLAND C++ 5.0 (thanks to Glenn Randers-Pehrson)
+- fix configure if CC is already equal to gcc
+
+Changes in 1.0.5 (3 Jan 98)
+- Fix inflate to terminate gracefully when fed corrupted or invalid data
+- Use const for rommable constants in inflate
+- Eliminate memory leaks on error conditions in inflate
+- Removed some vestigial code in inflate
+- Update web address in README
+
+Changes in 1.0.4 (24 Jul 96)
+- In very rare conditions, deflate(s, Z_FINISH) could fail to produce an EOF
+ bit, so the decompressor could decompress all the correct data but went
+ on to attempt decompressing extra garbage data. This affected minigzip too.
+- zlibVersion and gzerror return const char* (needed for DLL)
+- port to RISCOS (no fdopen, no multiple dots, no unlink, no fileno)
+- use z_error only for DEBUG (avoid problem with DLLs)
+
+Changes in 1.0.3 (2 Jul 96)
+- use z_streamp instead of z_stream *, which is now a far pointer in MSDOS
+ small and medium models; this makes the library incompatible with previous
+ versions for these models. (No effect in large model or on other systems.)
+- return OK instead of BUF_ERROR if previous deflate call returned with
+ avail_out as zero but there is nothing to do
+- added memcmp for non STDC compilers
+- define NO_DUMMY_DECL for more Mac compilers (.h files merged incorrectly)
+- define __32BIT__ if __386__ or i386 is defined (pb. with Watcom and SCO)
+- better check for 16-bit mode MSC (avoids problem with Symantec)
+
+Changes in 1.0.2 (23 May 96)
+- added Windows DLL support
+- added a function zlibVersion (for the DLL support)
+- fixed declarations using Bytef in infutil.c (pb with MSDOS medium model)
+- Bytef is define's instead of typedef'd only for Borland C
+- avoid reading uninitialized memory in example.c
+- mention in README that the zlib format is now RFC1950
+- updated Makefile.dj2
+- added algorithm.doc
+
+Changes in 1.0.1 (20 May 96) [1.0 skipped to avoid confusion]
+- fix array overlay in deflate.c which sometimes caused bad compressed data
+- fix inflate bug with empty stored block
+- fix MSDOS medium model which was broken in 0.99
+- fix deflateParams() which could generated bad compressed data.
+- Bytef is define'd instead of typedef'ed (work around Borland bug)
+- added an INDEX file
+- new makefiles for DJGPP (Makefile.dj2), 32-bit Borland (Makefile.b32),
+ Watcom (Makefile.wat), Amiga SAS/C (Makefile.sas)
+- speed up adler32 for modern machines without auto-increment
+- added -ansi for IRIX in configure
+- static_init_done in trees.c is an int
+- define unlink as delete for VMS
+- fix configure for QNX
+- add configure branch for SCO and HPUX
+- avoid many warnings (unused variables, dead assignments, etc...)
+- no fdopen for BeOS
+- fix the Watcom fix for 32 bit mode (define FAR as empty)
+- removed redefinition of Byte for MKWERKS
+- work around an MWKERKS bug (incorrect merge of all .h files)
+
+Changes in 0.99 (27 Jan 96)
+- allow preset dictionary shared between compressor and decompressor
+- allow compression level 0 (no compression)
+- add deflateParams in zlib.h: allow dynamic change of compression level
+ and compression strategy.
+- test large buffers and deflateParams in example.c
+- add optional "configure" to build zlib as a shared library
+- suppress Makefile.qnx, use configure instead
+- fixed deflate for 64-bit systems (detected on Cray)
+- fixed inflate_blocks for 64-bit systems (detected on Alpha)
+- declare Z_DEFLATED in zlib.h (possible parameter for deflateInit2)
+- always return Z_BUF_ERROR when deflate() has nothing to do
+- deflateInit and inflateInit are now macros to allow version checking
+- prefix all global functions and types with z_ with -DZ_PREFIX
+- make falloc completely reentrant (inftrees.c)
+- fixed very unlikely race condition in ct_static_init
+- free in reverse order of allocation to help memory manager
+- use zlib-1.0/* instead of zlib/* inside the tar.gz
+- make zlib warning-free with "gcc -O3 -Wall -Wwrite-strings -Wpointer-arith
+ -Wconversion -Wstrict-prototypes -Wmissing-prototypes"
+- allow gzread on concatenated .gz files
+- deflateEnd now returns Z_DATA_ERROR if it was premature
+- deflate is finally (?) fully deterministic (no matches beyond end of input)
+- Document Z_SYNC_FLUSH
+- add uninstall in Makefile
+- Check for __cpluplus in zlib.h
+- Better test in ct_align for partial flush
+- avoid harmless warnings for Borland C++
+- initialize hash_head in deflate.c
+- avoid warning on fdopen (gzio.c) for HP cc -Aa
+- include stdlib.h for STDC compilers
+- include errno.h for Cray
+- ignore error if ranlib doesn't exist
+- call ranlib twice for NeXTSTEP
+- use exec_prefix instead of prefix for libz.a
+- renamed ct_* as _tr_* to avoid conflict with applications
+- clear z->msg in inflateInit2 before any error return
+- initialize opaque in example.c, gzio.c, deflate.c and inflate.c
+- fixed typo in zconf.h (_GNUC__ => __GNUC__)
+- check for WIN32 in zconf.h and zutil.c (avoid farmalloc in 32-bit mode)
+- fix typo in Make_vms.com (f$trnlnm -> f$getsyi)
+- in fcalloc, normalize pointer if size > 65520 bytes
+- don't use special fcalloc for 32 bit Borland C++
+- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc...
+- use Z_BINARY instead of BINARY
+- document that gzclose after gzdopen will close the file
+- allow "a" as mode in gzopen.
+- fix error checking in gzread
+- allow skipping .gz extra-field on pipes
+- added reference to Perl interface in README
+- put the crc table in FAR data (I dislike more and more the medium model :)
+- added get_crc_table
+- added a dimension to all arrays (Borland C can't count).
+- workaround Borland C bug in declaration of inflate_codes_new & inflate_fast
+- guard against multiple inclusion of *.h (for precompiled header on Mac)
+- Watcom C pretends to be Microsoft C small model even in 32 bit mode.
+- don't use unsized arrays to avoid silly warnings by Visual C++:
+ warning C4746: 'inflate_mask' : unsized array treated as '__far'
+ (what's wrong with far data in far model?).
+- define enum out of inflate_blocks_state to allow compilation with C++
+
+Changes in 0.95 (16 Aug 95)
+- fix MSDOS small and medium model (now easier to adapt to any compiler)
+- inlined send_bits
+- fix the final (:-) bug for deflate with flush (output was correct but
+ not completely flushed in rare occasions).
+- default window size is same for compression and decompression
+ (it's now sufficient to set MAX_WBITS in zconf.h).
+- voidp -> voidpf and voidnp -> voidp (for consistency with other
+ typedefs and because voidnp was not near in large model).
+
+Changes in 0.94 (13 Aug 95)
+- support MSDOS medium model
+- fix deflate with flush (could sometimes generate bad output)
+- fix deflateReset (zlib header was incorrectly suppressed)
+- added support for VMS
+- allow a compression level in gzopen()
+- gzflush now calls fflush
+- For deflate with flush, flush even if no more input is provided.
+- rename libgz.a as libz.a
+- avoid complex expression in infcodes.c triggering Turbo C bug
+- work around a problem with gcc on Alpha (in INSERT_STRING)
+- don't use inline functions (problem with some gcc versions)
+- allow renaming of Byte, uInt, etc... with #define.
+- avoid warning about (unused) pointer before start of array in deflate.c
+- avoid various warnings in gzio.c, example.c, infblock.c, adler32.c, zutil.c
+- avoid reserved word 'new' in trees.c
+
+Changes in 0.93 (25 June 95)
+- temporarily disable inline functions
+- make deflate deterministic
+- give enough lookahead for PARTIAL_FLUSH
+- Set binary mode for stdin/stdout in minigzip.c for OS/2
+- don't even use signed char in inflate (not portable enough)
+- fix inflate memory leak for segmented architectures
+
+Changes in 0.92 (3 May 95)
+- don't assume that char is signed (problem on SGI)
+- Clear bit buffer when starting a stored block
+- no memcpy on Pyramid
+- suppressed inftest.c
+- optimized fill_window, put longest_match inline for gcc
+- optimized inflate on stored blocks.
+- untabify all sources to simplify patches
+
+Changes in 0.91 (2 May 95)
+- Default MEM_LEVEL is 8 (not 9 for Unix) as documented in zlib.h
+- Document the memory requirements in zconf.h
+- added "make install"
+- fix sync search logic in inflateSync
+- deflate(Z_FULL_FLUSH) now works even if output buffer too short
+- after inflateSync, don't scare people with just "lo world"
+- added support for DJGPP
+
+Changes in 0.9 (1 May 95)
+- don't assume that zalloc clears the allocated memory (the TurboC bug
+ was Mark's bug after all :)
+- let again gzread copy uncompressed data unchanged (was working in 0.71)
+- deflate(Z_FULL_FLUSH), inflateReset and inflateSync are now fully implemented
+- added a test of inflateSync in example.c
+- moved MAX_WBITS to zconf.h because users might want to change that.
+- document explicitly that zalloc(64K) on MSDOS must return a normalized
+ pointer (zero offset)
+- added Makefiles for Microsoft C, Turbo C, Borland C++
+- faster crc32()
+
+Changes in 0.8 (29 April 95)
+- added fast inflate (inffast.c)
+- deflate(Z_FINISH) now returns Z_STREAM_END when done. Warning: this
+ is incompatible with previous versions of zlib which returned Z_OK.
+- work around a TurboC compiler bug (bad code for b << 0, see infutil.h)
+ (actually that was not a compiler bug, see 0.81 above)
+- gzread no longer reads one extra byte in certain cases
+- In gzio destroy(), don't reference a freed structure
+- avoid many warnings for MSDOS
+- avoid the ERROR symbol which is used by MS Windows
+
+Changes in 0.71 (14 April 95)
+- Fixed more MSDOS compilation problems :( There is still a bug with
+ TurboC large model.
+
+Changes in 0.7 (14 April 95)
+- Added full inflate support.
+- Simplified the crc32() interface. The pre- and post-conditioning
+ (one's complement) is now done inside crc32(). WARNING: this is
+ incompatible with previous versions; see zlib.h for the new usage.
+
+Changes in 0.61 (12 April 95)
+- workaround for a bug in TurboC. example and minigzip now work on MSDOS.
+
+Changes in 0.6 (11 April 95)
+- added minigzip.c
+- added gzdopen to reopen a file descriptor as gzFile
+- added transparent reading of non-gziped files in gzread.
+- fixed bug in gzread (don't read crc as data)
+- fixed bug in destroy (gzio.c) (don't return Z_STREAM_END for gzclose).
+- don't allocate big arrays in the stack (for MSDOS)
+- fix some MSDOS compilation problems
+
+Changes in 0.5:
+- do real compression in deflate.c. Z_PARTIAL_FLUSH is supported but
+ not yet Z_FULL_FLUSH.
+- support decompression but only in a single step (forced Z_FINISH)
+- added opaque object for zalloc and zfree.
+- added deflateReset and inflateReset
+- added a variable zlib_version for consistency checking.
+- renamed the 'filter' parameter of deflateInit2 as 'strategy'.
+ Added Z_FILTERED and Z_HUFFMAN_ONLY constants.
+
+Changes in 0.4:
+- avoid "zip" everywhere, use zlib instead of ziplib.
+- suppress Z_BLOCK_FLUSH, interpret Z_PARTIAL_FLUSH as block flush
+ if compression method == 8.
+- added adler32 and crc32
+- renamed deflateOptions as deflateInit2, call one or the other but not both
+- added the method parameter for deflateInit2.
+- added inflateInit2
+- simplied considerably deflateInit and inflateInit by not supporting
+ user-provided history buffer. This is supported only in deflateInit2
+ and inflateInit2.
+
+Changes in 0.3:
+- prefix all macro names with Z_
+- use Z_FINISH instead of deflateEnd to finish compression.
+- added Z_HUFFMAN_ONLY
+- added gzerror()
diff --git a/win32/contrib/zlib/FAQ b/win32/contrib/zlib/FAQ new file mode 100644 index 000000000..f297e8afb --- /dev/null +++ b/win32/contrib/zlib/FAQ @@ -0,0 +1,72 @@ +
+ Frequently Asked Questions about zlib
+
+
+If your question is not there, please check the zlib home page
+http://www.cdrom.com/pub/infozip/zlib/ which may have more recent information.
+
+
+1) I need a Windows DLL
+2) I need a Visual Basic interface to zlib
+3) compress() returns Z_BUF_ERROR
+4) deflate or inflate returns Z_BUF_ERROR
+5) Where is the zlib documentation (man pages, etc...)?
+6) Why don't you use GNU autoconf, libtool, etc...?
+7) There is a bug in zlib.
+8) I get "undefined reference to gzputc"
+
+
+
+1) I need a Windows DLL
+
+ The zlib sources can be compiled without change to produce a DLL.
+ If you want a precompiled DLL, see http://www.winimage.com/zLibDll
+
+
+2) I need a Visual Basic interface to zlib
+
+ See http://www.tcfb.com/dowseware/cmp-z-it.zip
+ http://web2.airmail.net/markn/articles/zlibtool/zlibtool.htm
+ and contrib/visual-basic.txt
+
+3) compress() returns Z_BUF_ERROR
+
+ Make sure that before the call of compress, the length of the
+ compressed buffer is equal to the total size of the compressed buffer
+ and not zero. For Visual Basic, check that this parameter is passed
+ by reference ("as any"), not by value ("as long").
+
+
+4) deflate or inflate returns Z_BUF_ERROR
+
+ Make sure that before the call avail_in and avail_out are not zero.
+
+
+5) Where is the zlib documentation (man pages, etc...)?
+
+ It's in zlib.h for the moment. Volunteers to transform this
+ to man pages, please contact jloup@gzip.org. Examples of zlib usage
+ are in the files example.c and minigzip.c.
+
+
+6) Why don't you use GNU autoconf, libtool, etc...?
+
+ Because we would like to keep zlib as a very small and simple package.
+ zlib is rather portable and doesn't need much configuration.
+
+
+7) There is a bug in zlib.
+
+ Most of the time, such problems are due to an incorrect usage
+ of zlib. Please try to reproduce the problem with a small
+ program and send us the corresponding source at zlib@quest.jpl.nasa.gov
+ Do not send multi-megabyte data files without prior agreement.
+
+
+8) I get "undefined reference to gzputc"
+
+ If "make test" produces something like
+ example.o(.text+0x174):
+ check that you don't have old files libz.* in /usr/lib, /usr/local/lib
+ or /usr/X11R6/lib. Remove old versions then do "make install".
+
diff --git a/win32/contrib/zlib/INDEX b/win32/contrib/zlib/INDEX new file mode 100644 index 000000000..9615c346e --- /dev/null +++ b/win32/contrib/zlib/INDEX @@ -0,0 +1,86 @@ +ChangeLog history of changes
+INDEX this file
+FAQ Frequently Asked Questions about zlib
+Make_vms.com script for Vax/VMS
+Makefile makefile for Unix (generated by configure)
+Makefile.in makefile for Unix (template for configure)
+Makefile.riscos makefile for RISCOS
+README guess what
+algorithm.txt description of the (de)compression algorithm
+configure configure script for Unix
+descrip.mms makefile for Vax/VMS
+zlib.3 mini man page for zlib (volunteers to write full
+ man pages from zlib.h welcome. write to jloup@gzip.org)
+
+amiga/Makefile.sas makefile for Amiga SAS/C
+amiga/Makefile.pup makefile for Amiga powerUP SAS/C PPC
+
+msdos/Makefile.w32 makefile for Microsoft Visual C++ 32-bit
+msdos/Makefile.b32 makefile for Borland C++ 32-bit
+msdos/Makefile.bor makefile for Borland C/C++ 16-bit
+msdos/Makefile.dj2 makefile for DJGPP 2.x
+msdos/Makefile.emx makefile for EMX 0.9c (32-bit DOS/OS2)
+msdos/Makefile.msc makefile for Microsoft C 16-bit
+msdos/Makefile.tc makefile for Turbo C
+msdos/Makefile.wat makefile for Watcom C
+msdos/zlib.def definition file for Windows DLL
+msdos/zlib.rc definition file for Windows DLL
+
+nt/Makefile.nt makefile for Windows NT
+nt/zlib.dnt definition file for Windows NT DLL
+nt/Makefile.emx makefile for EMX 0.9c/RSXNT 1.41 (Win32 Intel)
+nt/Makefile.gcc makefile for Windows NT using GCC (mingw32)
+
+
+ zlib public header files (must be kept):
+zconf.h
+zlib.h
+
+ private source files used to build the zlib library:
+adler32.c
+compress.c
+crc32.c
+deflate.c
+deflate.h
+gzio.c
+infblock.c
+infblock.h
+infcodes.c
+infcodes.h
+inffast.c
+inffast.h
+inflate.c
+inftrees.c
+inftrees.h
+infutil.c
+infutil.h
+maketree.c
+trees.c
+uncompr.c
+zutil.c
+zutil.h
+
+ source files for sample programs:
+example.c
+minigzip.c
+
+ unsupported contribution by third parties
+
+contrib/asm386/ by Gilles Vollant <info@winimage.com>
+ 386 asm code replacing longest_match().
+
+contrib/minizip/ by Gilles Vollant <info@winimage.com>
+ Mini zip and unzip based on zlib
+ See http://www.winimage.com/zLibDll/unzip.html
+
+contrib/iostream/ by Kevin Ruland <kevin@rodin.wustl.edu>
+ A C++ I/O streams interface to the zlib gz* functions
+
+contrib/iostream2/ by Tyge Løvset <Tyge.Lovset@cmr.no>
+ Another C++ I/O streams interface
+
+contrib/untgz/ by "Pedro A. Aranda Guti\irrez" <paag@tid.es>
+ A very simple tar.gz extractor using zlib
+
+contrib/visual-basic.txt by Carlos Rios <c_rios@sonda.cl>
+ How to use compress(), uncompress() and the gz* functions from VB.
diff --git a/win32/contrib/zlib/Make_vms.com b/win32/contrib/zlib/Make_vms.com new file mode 100644 index 000000000..37888173a --- /dev/null +++ b/win32/contrib/zlib/Make_vms.com @@ -0,0 +1,115 @@ +$! make libz under VMS
+$! written by Martin P.J. Zinser <m.zinser@gsi.de>
+$!
+$! Look for the compiler used
+$!
+$ ccopt = ""
+$ if f$getsyi("HW_MODEL").ge.1024
+$ then
+$ ccopt = "/prefix=all"+ccopt
+$ comp = "__decc__=1"
+$ if f$trnlnm("SYS").eqs."" then define sys sys$library:
+$ else
+$ if f$search("SYS$SYSTEM:DECC$COMPILER.EXE").eqs.""
+$ then
+$ comp = "__vaxc__=1"
+$ if f$trnlnm("SYS").eqs."" then define sys sys$library:
+$ else
+$ if f$trnlnm("SYS").eqs."" then define sys decc$library_include:
+$ ccopt = "/decc/prefix=all"+ccopt
+$ comp = "__decc__=1"
+$ endif
+$ endif
+$!
+$! Build the thing plain or with mms
+$!
+$ write sys$output "Compiling Zlib sources ..."
+$ if f$search("SYS$SYSTEM:MMS.EXE").eqs.""
+$ then
+$ dele example.obj;*,minigzip.obj;*
+$ CALL MAKE adler32.OBJ "CC ''CCOPT' adler32" -
+ adler32.c zlib.h zconf.h
+$ CALL MAKE compress.OBJ "CC ''CCOPT' compress" -
+ compress.c zlib.h zconf.h
+$ CALL MAKE crc32.OBJ "CC ''CCOPT' crc32" -
+ crc32.c zlib.h zconf.h
+$ CALL MAKE deflate.OBJ "CC ''CCOPT' deflate" -
+ deflate.c deflate.h zutil.h zlib.h zconf.h
+$ CALL MAKE gzio.OBJ "CC ''CCOPT' gzio" -
+ gzio.c zutil.h zlib.h zconf.h
+$ CALL MAKE infblock.OBJ "CC ''CCOPT' infblock" -
+ infblock.c zutil.h zlib.h zconf.h infblock.h
+$ CALL MAKE infcodes.OBJ "CC ''CCOPT' infcodes" -
+ infcodes.c zutil.h zlib.h zconf.h inftrees.h
+$ CALL MAKE inffast.OBJ "CC ''CCOPT' inffast" -
+ inffast.c zutil.h zlib.h zconf.h inffast.h
+$ CALL MAKE inflate.OBJ "CC ''CCOPT' inflate" -
+ inflate.c zutil.h zlib.h zconf.h infblock.h
+$ CALL MAKE inftrees.OBJ "CC ''CCOPT' inftrees" -
+ inftrees.c zutil.h zlib.h zconf.h inftrees.h
+$ CALL MAKE infutil.OBJ "CC ''CCOPT' infutil" -
+ infutil.c zutil.h zlib.h zconf.h inftrees.h infutil.h
+$ CALL MAKE trees.OBJ "CC ''CCOPT' trees" -
+ trees.c deflate.h zutil.h zlib.h zconf.h
+$ CALL MAKE uncompr.OBJ "CC ''CCOPT' uncompr" -
+ uncompr.c zlib.h zconf.h
+$ CALL MAKE zutil.OBJ "CC ''CCOPT' zutil" -
+ zutil.c zutil.h zlib.h zconf.h
+$ write sys$output "Building Zlib ..."
+$ CALL MAKE libz.OLB "lib/crea libz.olb *.obj" *.OBJ
+$ write sys$output "Building example..."
+$ CALL MAKE example.OBJ "CC ''CCOPT' example" -
+ example.c zlib.h zconf.h
+$ call make example.exe "LINK example,libz.olb/lib" example.obj libz.olb
+$ write sys$output "Building minigzip..."
+$ CALL MAKE minigzip.OBJ "CC ''CCOPT' minigzip" -
+ minigzip.c zlib.h zconf.h
+$ call make minigzip.exe -
+ "LINK minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib" -
+ minigzip.obj libz.olb
+$ else
+$ mms/macro=('comp')
+$ endif
+$ write sys$output "Zlib build completed"
+$ exit
+$!
+$!
+$MAKE: SUBROUTINE !SUBROUTINE TO CHECK DEPENDENCIES
+$ V = 'F$Verify(0)
+$! P1 = What we are trying to make
+$! P2 = Command to make it
+$! P3 - P8 What it depends on
+$
+$ If F$Search(P1) .Eqs. "" Then Goto Makeit
+$ Time = F$CvTime(F$File(P1,"RDT"))
+$arg=3
+$Loop:
+$ Argument = P'arg
+$ If Argument .Eqs. "" Then Goto Exit
+$ El=0
+$Loop2:
+$ File = F$Element(El," ",Argument)
+$ If File .Eqs. " " Then Goto Endl
+$ AFile = ""
+$Loop3:
+$ OFile = AFile
+$ AFile = F$Search(File)
+$ If AFile .Eqs. "" .Or. AFile .Eqs. OFile Then Goto NextEl
+$ If F$CvTime(F$File(AFile,"RDT")) .Ges. Time Then Goto Makeit
+$ Goto Loop3
+$NextEL:
+$ El = El + 1
+$ Goto Loop2
+$EndL:
+$ arg=arg+1
+$ If arg .Le. 8 Then Goto Loop
+$ Goto Exit
+$
+$Makeit:
+$ VV=F$VERIFY(0)
+$ write sys$output P2
+$ 'P2
+$ VV='F$Verify(VV)
+$Exit:
+$ If V Then Set Verify
+$ENDSUBROUTINE
diff --git a/win32/contrib/zlib/Makefile b/win32/contrib/zlib/Makefile new file mode 100644 index 000000000..4b1472d3d --- /dev/null +++ b/win32/contrib/zlib/Makefile @@ -0,0 +1,174 @@ +# Makefile for zlib
+# Copyright (C) 1995-1998 Jean-loup Gailly.
+# For conditions of distribution and use, see copyright notice in zlib.h
+
+# To compile and test, type:
+# ./configure; make test
+# The call of configure is optional if you don't have special requirements
+# If you wish to build zlib as a shared library, use: ./configure -s
+
+# To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
+# make install
+# To install in $HOME instead of /usr/local, use:
+# make install prefix=$HOME
+
+CC=cc
+
+CFLAGS=-O
+#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
+#CFLAGS=-g -DDEBUG
+#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
+# -Wstrict-prototypes -Wmissing-prototypes
+
+LDFLAGS=-L. -lz
+LDSHARED=$(CC)
+CPP=$(CC) -E
+
+VER=1.1.3
+LIBS=libz.a
+SHAREDLIB=libz.so
+
+AR=ar rc
+RANLIB=ranlib
+TAR=tar
+SHELL=/bin/sh
+
+prefix = /usr/local
+exec_prefix = ${prefix}
+libdir = ${exec_prefix}/lib
+includedir = ${prefix}/include
+
+OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
+ zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o
+
+OBJA =
+# to use the asm code: make OBJA=match.o
+
+TEST_OBJS = example.o minigzip.o
+
+DISTFILES = README FAQ INDEX ChangeLog configure Make*[a-z0-9] *.[ch] *.mms \
+ algorithm.txt zlib.3 msdos/Make*[a-z0-9] msdos/zlib.def msdos/zlib.rc \
+ nt/Make*[a-z0-9] nt/zlib.dnt amiga/Make*.??? os2/M*.os2 os2/zlib.def \
+ contrib/RE*.contrib contrib/*.txt contrib/asm386/*.asm contrib/asm386/*.c \
+ contrib/asm386/*.bat contrib/asm386/zlibvc.d?? contrib/asm[56]86/*.?86 \
+ contrib/asm[56]86/*.S contrib/iostream/*.cpp \
+ contrib/iostream/*.h contrib/iostream2/*.h contrib/iostream2/*.cpp \
+ contrib/untgz/Makefile contrib/untgz/*.c contrib/untgz/*.w32 \
+ contrib/minizip/[CM]*[pe] contrib/minizip/*.[ch] contrib/minizip/*.[td]?? \
+ contrib/delphi*/*.???
+
+all: example minigzip
+
+test: all
+ @LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
+ echo hello world | ./minigzip | ./minigzip -d || \
+ echo ' *** minigzip test FAILED ***' ; \
+ if ./example; then \
+ echo ' *** zlib test OK ***'; \
+ else \
+ echo ' *** zlib test FAILED ***'; \
+ fi
+
+libz.a: $(OBJS) $(OBJA)
+ $(AR) $@ $(OBJS) $(OBJA)
+ -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
+
+match.o: match.S
+ $(CPP) match.S > _match.s
+ $(CC) -c _match.s
+ mv _match.o match.o
+ rm -f _match.s
+
+$(SHAREDLIB).$(VER): $(OBJS)
+ $(LDSHARED) -o $@ $(OBJS)
+ rm -f $(SHAREDLIB) $(SHAREDLIB).1
+ ln -s $@ $(SHAREDLIB)
+ ln -s $@ $(SHAREDLIB).1
+
+example: example.o $(LIBS)
+ $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS)
+
+minigzip: minigzip.o $(LIBS)
+ $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
+
+install: $(LIBS)
+ -@if [ ! -d $(includedir) ]; then mkdir $(includedir); fi
+ -@if [ ! -d $(libdir) ]; then mkdir $(libdir); fi
+ cp zlib.h zconf.h $(includedir)
+ chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h
+ cp $(LIBS) $(libdir)
+ cd $(libdir); chmod 755 $(LIBS)
+ -@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
+ cd $(libdir); if test -f $(SHAREDLIB).$(VER); then \
+ rm -f $(SHAREDLIB) $(SHAREDLIB).1; \
+ ln -s $(SHAREDLIB).$(VER) $(SHAREDLIB); \
+ ln -s $(SHAREDLIB).$(VER) $(SHAREDLIB).1; \
+ (ldconfig || true) >/dev/null 2>&1; \
+ fi
+# The ranlib in install is needed on NeXTSTEP which checks file times
+# ldconfig is for Linux
+
+uninstall:
+ cd $(includedir); \
+ v=$(VER); \
+ if test -f zlib.h; then \
+ v=`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`; \
+ rm -f zlib.h zconf.h; \
+ fi; \
+ cd $(libdir); rm -f libz.a; \
+ if test -f $(SHAREDLIB).$$v; then \
+ rm -f $(SHAREDLIB).$$v $(SHAREDLIB) $(SHAREDLIB).1; \
+ fi
+
+clean:
+ rm -f *.o *~ example minigzip libz.a libz.so* foo.gz so_locations \
+ _match.s maketree
+
+distclean: clean
+
+zip:
+ mv Makefile Makefile~; cp -p Makefile.in Makefile
+ rm -f test.c ztest*.c contrib/minizip/test.zip
+ v=`sed -n -e 's/\.//g' -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\
+ zip -ul9 zlib$$v $(DISTFILES)
+ mv Makefile~ Makefile
+
+dist:
+ mv Makefile Makefile~; cp -p Makefile.in Makefile
+ rm -f test.c ztest*.c contrib/minizip/test.zip
+ d=zlib-`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\
+ rm -f $$d.tar.gz; \
+ if test ! -d ../$$d; then rm -f ../$$d; ln -s `pwd` ../$$d; fi; \
+ files=""; \
+ for f in $(DISTFILES); do files="$$files $$d/$$f"; done; \
+ cd ..; \
+ GZIP=-9 $(TAR) chofz $$d/$$d.tar.gz $$files; \
+ if test ! -d $$d; then rm -f $$d; fi
+ mv Makefile~ Makefile
+
+tags:
+ etags *.[ch]
+
+depend:
+ makedepend -- $(CFLAGS) -- *.[ch]
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.
+
+adler32.o: zlib.h zconf.h
+compress.o: zlib.h zconf.h
+crc32.o: zlib.h zconf.h
+deflate.o: deflate.h zutil.h zlib.h zconf.h
+example.o: zlib.h zconf.h
+gzio.o: zutil.h zlib.h zconf.h
+infblock.o: infblock.h inftrees.h infcodes.h infutil.h zutil.h zlib.h zconf.h
+infcodes.o: zutil.h zlib.h zconf.h
+infcodes.o: inftrees.h infblock.h infcodes.h infutil.h inffast.h
+inffast.o: zutil.h zlib.h zconf.h inftrees.h
+inffast.o: infblock.h infcodes.h infutil.h inffast.h
+inflate.o: zutil.h zlib.h zconf.h infblock.h
+inftrees.o: zutil.h zlib.h zconf.h inftrees.h
+infutil.o: zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h
+minigzip.o: zlib.h zconf.h
+trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
+uncompr.o: zlib.h zconf.h
+zutil.o: zutil.h zlib.h zconf.h
diff --git a/win32/contrib/zlib/Makefile.in b/win32/contrib/zlib/Makefile.in new file mode 100644 index 000000000..4b1472d3d --- /dev/null +++ b/win32/contrib/zlib/Makefile.in @@ -0,0 +1,174 @@ +# Makefile for zlib
+# Copyright (C) 1995-1998 Jean-loup Gailly.
+# For conditions of distribution and use, see copyright notice in zlib.h
+
+# To compile and test, type:
+# ./configure; make test
+# The call of configure is optional if you don't have special requirements
+# If you wish to build zlib as a shared library, use: ./configure -s
+
+# To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
+# make install
+# To install in $HOME instead of /usr/local, use:
+# make install prefix=$HOME
+
+CC=cc
+
+CFLAGS=-O
+#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
+#CFLAGS=-g -DDEBUG
+#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
+# -Wstrict-prototypes -Wmissing-prototypes
+
+LDFLAGS=-L. -lz
+LDSHARED=$(CC)
+CPP=$(CC) -E
+
+VER=1.1.3
+LIBS=libz.a
+SHAREDLIB=libz.so
+
+AR=ar rc
+RANLIB=ranlib
+TAR=tar
+SHELL=/bin/sh
+
+prefix = /usr/local
+exec_prefix = ${prefix}
+libdir = ${exec_prefix}/lib
+includedir = ${prefix}/include
+
+OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
+ zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o
+
+OBJA =
+# to use the asm code: make OBJA=match.o
+
+TEST_OBJS = example.o minigzip.o
+
+DISTFILES = README FAQ INDEX ChangeLog configure Make*[a-z0-9] *.[ch] *.mms \
+ algorithm.txt zlib.3 msdos/Make*[a-z0-9] msdos/zlib.def msdos/zlib.rc \
+ nt/Make*[a-z0-9] nt/zlib.dnt amiga/Make*.??? os2/M*.os2 os2/zlib.def \
+ contrib/RE*.contrib contrib/*.txt contrib/asm386/*.asm contrib/asm386/*.c \
+ contrib/asm386/*.bat contrib/asm386/zlibvc.d?? contrib/asm[56]86/*.?86 \
+ contrib/asm[56]86/*.S contrib/iostream/*.cpp \
+ contrib/iostream/*.h contrib/iostream2/*.h contrib/iostream2/*.cpp \
+ contrib/untgz/Makefile contrib/untgz/*.c contrib/untgz/*.w32 \
+ contrib/minizip/[CM]*[pe] contrib/minizip/*.[ch] contrib/minizip/*.[td]?? \
+ contrib/delphi*/*.???
+
+all: example minigzip
+
+test: all
+ @LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
+ echo hello world | ./minigzip | ./minigzip -d || \
+ echo ' *** minigzip test FAILED ***' ; \
+ if ./example; then \
+ echo ' *** zlib test OK ***'; \
+ else \
+ echo ' *** zlib test FAILED ***'; \
+ fi
+
+libz.a: $(OBJS) $(OBJA)
+ $(AR) $@ $(OBJS) $(OBJA)
+ -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
+
+match.o: match.S
+ $(CPP) match.S > _match.s
+ $(CC) -c _match.s
+ mv _match.o match.o
+ rm -f _match.s
+
+$(SHAREDLIB).$(VER): $(OBJS)
+ $(LDSHARED) -o $@ $(OBJS)
+ rm -f $(SHAREDLIB) $(SHAREDLIB).1
+ ln -s $@ $(SHAREDLIB)
+ ln -s $@ $(SHAREDLIB).1
+
+example: example.o $(LIBS)
+ $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS)
+
+minigzip: minigzip.o $(LIBS)
+ $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
+
+install: $(LIBS)
+ -@if [ ! -d $(includedir) ]; then mkdir $(includedir); fi
+ -@if [ ! -d $(libdir) ]; then mkdir $(libdir); fi
+ cp zlib.h zconf.h $(includedir)
+ chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h
+ cp $(LIBS) $(libdir)
+ cd $(libdir); chmod 755 $(LIBS)
+ -@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
+ cd $(libdir); if test -f $(SHAREDLIB).$(VER); then \
+ rm -f $(SHAREDLIB) $(SHAREDLIB).1; \
+ ln -s $(SHAREDLIB).$(VER) $(SHAREDLIB); \
+ ln -s $(SHAREDLIB).$(VER) $(SHAREDLIB).1; \
+ (ldconfig || true) >/dev/null 2>&1; \
+ fi
+# The ranlib in install is needed on NeXTSTEP which checks file times
+# ldconfig is for Linux
+
+uninstall:
+ cd $(includedir); \
+ v=$(VER); \
+ if test -f zlib.h; then \
+ v=`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`; \
+ rm -f zlib.h zconf.h; \
+ fi; \
+ cd $(libdir); rm -f libz.a; \
+ if test -f $(SHAREDLIB).$$v; then \
+ rm -f $(SHAREDLIB).$$v $(SHAREDLIB) $(SHAREDLIB).1; \
+ fi
+
+clean:
+ rm -f *.o *~ example minigzip libz.a libz.so* foo.gz so_locations \
+ _match.s maketree
+
+distclean: clean
+
+zip:
+ mv Makefile Makefile~; cp -p Makefile.in Makefile
+ rm -f test.c ztest*.c contrib/minizip/test.zip
+ v=`sed -n -e 's/\.//g' -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\
+ zip -ul9 zlib$$v $(DISTFILES)
+ mv Makefile~ Makefile
+
+dist:
+ mv Makefile Makefile~; cp -p Makefile.in Makefile
+ rm -f test.c ztest*.c contrib/minizip/test.zip
+ d=zlib-`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\
+ rm -f $$d.tar.gz; \
+ if test ! -d ../$$d; then rm -f ../$$d; ln -s `pwd` ../$$d; fi; \
+ files=""; \
+ for f in $(DISTFILES); do files="$$files $$d/$$f"; done; \
+ cd ..; \
+ GZIP=-9 $(TAR) chofz $$d/$$d.tar.gz $$files; \
+ if test ! -d $$d; then rm -f $$d; fi
+ mv Makefile~ Makefile
+
+tags:
+ etags *.[ch]
+
+depend:
+ makedepend -- $(CFLAGS) -- *.[ch]
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.
+
+adler32.o: zlib.h zconf.h
+compress.o: zlib.h zconf.h
+crc32.o: zlib.h zconf.h
+deflate.o: deflate.h zutil.h zlib.h zconf.h
+example.o: zlib.h zconf.h
+gzio.o: zutil.h zlib.h zconf.h
+infblock.o: infblock.h inftrees.h infcodes.h infutil.h zutil.h zlib.h zconf.h
+infcodes.o: zutil.h zlib.h zconf.h
+infcodes.o: inftrees.h infblock.h infcodes.h infutil.h inffast.h
+inffast.o: zutil.h zlib.h zconf.h inftrees.h
+inffast.o: infblock.h infcodes.h infutil.h inffast.h
+inflate.o: zutil.h zlib.h zconf.h infblock.h
+inftrees.o: zutil.h zlib.h zconf.h inftrees.h
+infutil.o: zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h
+minigzip.o: zlib.h zconf.h
+trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
+uncompr.o: zlib.h zconf.h
+zutil.o: zutil.h zlib.h zconf.h
diff --git a/win32/contrib/zlib/Makefile.riscos b/win32/contrib/zlib/Makefile.riscos new file mode 100644 index 000000000..8ba72ca67 --- /dev/null +++ b/win32/contrib/zlib/Makefile.riscos @@ -0,0 +1,151 @@ +# Project: zlib_1_03
+# Patched for zlib 1.1.2 rw@shadow.org.uk 19980430
+# test works out-of-the-box, installs `somewhere' on demand
+
+# Toolflags:
+CCflags = -c -depend !Depend -IC: -g -throwback -DRISCOS -fah
+C++flags = -c -depend !Depend -IC: -throwback
+Linkflags = -aif -c++ -o $@
+ObjAsmflags = -throwback -NoCache -depend !Depend
+CMHGflags =
+LibFileflags = -c -l -o $@
+Squeezeflags = -o $@
+
+# change the line below to where _you_ want the library installed.
+libdest = lib:zlib
+
+# Final targets:
+@.lib: @.o.adler32 @.o.compress @.o.crc32 @.o.deflate @.o.gzio \
+ @.o.infblock @.o.infcodes @.o.inffast @.o.inflate @.o.inftrees @.o.infutil @.o.trees \
+ @.o.uncompr @.o.zutil
+ LibFile $(LibFileflags) @.o.adler32 @.o.compress @.o.crc32 @.o.deflate \
+ @.o.gzio @.o.infblock @.o.infcodes @.o.inffast @.o.inflate @.o.inftrees @.o.infutil \
+ @.o.trees @.o.uncompr @.o.zutil
+test: @.minigzip @.example @.lib
+ @copy @.lib @.libc A~C~DF~L~N~P~Q~RS~TV
+ @echo running tests: hang on.
+ @/@.minigzip -f -9 libc
+ @/@.minigzip -d libc-gz
+ @/@.minigzip -f -1 libc
+ @/@.minigzip -d libc-gz
+ @/@.minigzip -h -9 libc
+ @/@.minigzip -d libc-gz
+ @/@.minigzip -h -1 libc
+ @/@.minigzip -d libc-gz
+ @/@.minigzip -9 libc
+ @/@.minigzip -d libc-gz
+ @/@.minigzip -1 libc
+ @/@.minigzip -d libc-gz
+ @diff @.lib @.libc
+ @echo that should have reported '@.lib and @.libc identical' if you have diff.
+ @/@.example @.fred @.fred
+ @echo that will have given lots of hello!'s.
+
+@.minigzip: @.o.minigzip @.lib C:o.Stubs
+ Link $(Linkflags) @.o.minigzip @.lib C:o.Stubs
+@.example: @.o.example @.lib C:o.Stubs
+ Link $(Linkflags) @.o.example @.lib C:o.Stubs
+
+install: @.lib
+ cdir $(libdest)
+ cdir $(libdest).h
+ @copy @.h.zlib $(libdest).h.zlib A~C~DF~L~N~P~Q~RS~TV
+ @copy @.h.zconf $(libdest).h.zconf A~C~DF~L~N~P~Q~RS~TV
+ @copy @.lib $(libdest).lib A~C~DF~L~N~P~Q~RS~TV
+ @echo okay, installed zlib in $(libdest)
+
+clean:; remove @.minigzip
+ remove @.example
+ remove @.libc
+ -wipe @.o.* F~r~cV
+ remove @.fred
+
+# User-editable dependencies:
+.c.o:
+ cc $(ccflags) -o $@ $<
+
+# Static dependencies:
+
+# Dynamic dependencies:
+o.example: c.example
+o.example: h.zlib
+o.example: h.zconf
+o.minigzip: c.minigzip
+o.minigzip: h.zlib
+o.minigzip: h.zconf
+o.adler32: c.adler32
+o.adler32: h.zlib
+o.adler32: h.zconf
+o.compress: c.compress
+o.compress: h.zlib
+o.compress: h.zconf
+o.crc32: c.crc32
+o.crc32: h.zlib
+o.crc32: h.zconf
+o.deflate: c.deflate
+o.deflate: h.deflate
+o.deflate: h.zutil
+o.deflate: h.zlib
+o.deflate: h.zconf
+o.gzio: c.gzio
+o.gzio: h.zutil
+o.gzio: h.zlib
+o.gzio: h.zconf
+o.infblock: c.infblock
+o.infblock: h.zutil
+o.infblock: h.zlib
+o.infblock: h.zconf
+o.infblock: h.infblock
+o.infblock: h.inftrees
+o.infblock: h.infcodes
+o.infblock: h.infutil
+o.infcodes: c.infcodes
+o.infcodes: h.zutil
+o.infcodes: h.zlib
+o.infcodes: h.zconf
+o.infcodes: h.inftrees
+o.infcodes: h.infblock
+o.infcodes: h.infcodes
+o.infcodes: h.infutil
+o.infcodes: h.inffast
+o.inffast: c.inffast
+o.inffast: h.zutil
+o.inffast: h.zlib
+o.inffast: h.zconf
+o.inffast: h.inftrees
+o.inffast: h.infblock
+o.inffast: h.infcodes
+o.inffast: h.infutil
+o.inffast: h.inffast
+o.inflate: c.inflate
+o.inflate: h.zutil
+o.inflate: h.zlib
+o.inflate: h.zconf
+o.inflate: h.infblock
+o.inftrees: c.inftrees
+o.inftrees: h.zutil
+o.inftrees: h.zlib
+o.inftrees: h.zconf
+o.inftrees: h.inftrees
+o.inftrees: h.inffixed
+o.infutil: c.infutil
+o.infutil: h.zutil
+o.infutil: h.zlib
+o.infutil: h.zconf
+o.infutil: h.infblock
+o.infutil: h.inftrees
+o.infutil: h.infcodes
+o.infutil: h.infutil
+o.trees: c.trees
+o.trees: h.deflate
+o.trees: h.zutil
+o.trees: h.zlib
+o.trees: h.zconf
+o.trees: h.trees
+o.uncompr: c.uncompr
+o.uncompr: h.zlib
+o.uncompr: h.zconf
+o.zutil: c.zutil
+o.zutil: h.zutil
+o.zutil: h.zlib
+o.zutil: h.zconf
diff --git a/win32/contrib/zlib/README b/win32/contrib/zlib/README new file mode 100644 index 000000000..f9ae6769b --- /dev/null +++ b/win32/contrib/zlib/README @@ -0,0 +1,148 @@ +zlib 1.1.3 is a general purpose data compression library. All the code
+is thread safe. The data format used by the zlib library
+is described by RFCs (Request for Comments) 1950 to 1952 in the files
+ftp://ds.internic.net/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate
+format) and rfc1952.txt (gzip format). These documents are also available in
+other formats from ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html
+
+All functions of the compression library are documented in the file zlib.h
+(volunteer to write man pages welcome, contact jloup@gzip.org). A usage
+example of the library is given in the file example.c which also tests that
+the library is working correctly. Another example is given in the file
+minigzip.c. The compression library itself is composed of all source files
+except example.c and minigzip.c.
+
+To compile all files and run the test program, follow the instructions
+given at the top of Makefile. In short "make test; make install"
+should work for most machines. For Unix: "configure; make test; make install"
+For MSDOS, use one of the special makefiles such as Makefile.msc.
+For VMS, use Make_vms.com or descrip.mms.
+
+Questions about zlib should be sent to <zlib@quest.jpl.nasa.gov>, or to
+Gilles Vollant <info@winimage.com> for the Windows DLL version.
+The zlib home page is http://www.cdrom.com/pub/infozip/zlib/
+The official zlib ftp site is ftp://ftp.cdrom.com/pub/infozip/zlib/
+Before reporting a problem, please check those sites to verify that
+you have the latest version of zlib; otherwise get the latest version and
+check whether the problem still exists or not.
+
+Mark Nelson <markn@tiny.com> wrote an article about zlib for the Jan. 1997
+issue of Dr. Dobb's Journal; a copy of the article is available in
+http://web2.airmail.net/markn/articles/zlibtool/zlibtool.htm
+
+The changes made in version 1.1.3 are documented in the file ChangeLog.
+The main changes since 1.1.2 are:
+
+- fix "an inflate input buffer bug that shows up on rare but persistent
+ occasions" (Mark)
+- fix gzread and gztell for concatenated .gz files (Didier Le Botlan)
+- fix gzseek(..., SEEK_SET) in write mode
+- fix crc check after a gzeek (Frank Faubert)
+- fix miniunzip when the last entry in a zip file is itself a zip file
+ (J Lillge)
+- add contrib/asm586 and contrib/asm686 (Brian Raiter)
+ See http://www.muppetlabs.com/~breadbox/software/assembly.html
+- add support for Delphi 3 in contrib/delphi (Bob Dellaca)
+- add support for C++Builder 3 and Delphi 3 in contrib/delphi2 (Davide Moretti)
+- do not exit prematurely in untgz if 0 at start of block (Magnus Holmgren)
+- use macro EXTERN instead of extern to support DLL for BeOS (Sander Stoks)
+- added a FAQ file
+
+plus many changes for portability.
+
+Unsupported third party contributions are provided in directory "contrib".
+
+A Java implementation of zlib is available in the Java Development Kit 1.1
+http://www.javasoft.com/products/JDK/1.1/docs/api/Package-java.util.zip.html
+See the zlib home page http://www.cdrom.com/pub/infozip/zlib/ for details.
+
+A Perl interface to zlib written by Paul Marquess <pmarquess@bfsec.bt.co.uk>
+is in the CPAN (Comprehensive Perl Archive Network) sites, such as:
+ftp://ftp.cis.ufl.edu/pub/perl/CPAN/modules/by-module/Compress/Compress-Zlib*
+
+A Python interface to zlib written by A.M. Kuchling <amk@magnet.com>
+is available in Python 1.5 and later versions, see
+http://www.python.org/doc/lib/module-zlib.html
+
+A zlib binding for TCL written by Andreas Kupries <a.kupries@westend.com>
+is availlable at http://www.westend.com/~kupries/doc/trf/man/man.html
+
+An experimental package to read and write files in .zip format,
+written on top of zlib by Gilles Vollant <info@winimage.com>, is
+available at http://www.winimage.com/zLibDll/unzip.html
+and also in the contrib/minizip directory of zlib.
+
+
+Notes for some targets:
+
+- To build a Windows DLL version, include in a DLL project zlib.def, zlib.rc
+ and all .c files except example.c and minigzip.c; compile with -DZLIB_DLL
+ The zlib DLL support was initially done by Alessandro Iacopetti and is
+ now maintained by Gilles Vollant <info@winimage.com>. Check the zlib DLL
+ home page at http://www.winimage.com/zLibDll
+
+ From Visual Basic, you can call the DLL functions which do not take
+ a structure as argument: compress, uncompress and all gz* functions.
+ See contrib/visual-basic.txt for more information, or get
+ http://www.tcfb.com/dowseware/cmp-z-it.zip
+
+- For 64-bit Irix, deflate.c must be compiled without any optimization.
+ With -O, one libpng test fails. The test works in 32 bit mode (with
+ the -n32 compiler flag). The compiler bug has been reported to SGI.
+
+- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1
+ it works when compiled with cc.
+
+- on Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1
+ is necessary to get gzprintf working correctly. This is done by configure.
+
+- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works
+ with other compilers. Use "make test" to check your compiler.
+
+- gzdopen is not supported on RISCOS, BEOS and by some Mac compilers.
+
+- For Turbo C the small model is supported only with reduced performance to
+ avoid any far allocation; it was tested with -DMAX_WBITS=11 -DMAX_MEM_LEVEL=3
+
+- For PalmOs, see http://www.cs.uit.no/~perm/PASTA/pilot/software.html
+ Per Harald Myrvang <perm@stud.cs.uit.no>
+
+
+Acknowledgments:
+
+ The deflate format used by zlib was defined by Phil Katz. The deflate
+ and zlib specifications were written by L. Peter Deutsch. Thanks to all the
+ people who reported problems and suggested various improvements in zlib;
+ they are too numerous to cite here.
+
+Copyright notice:
+
+ (C) 1995-1998 Jean-loup Gailly and Mark Adler
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+ Jean-loup Gailly Mark Adler
+ jloup@gzip.org madler@alumni.caltech.edu
+
+If you use the zlib library in a product, we would appreciate *not*
+receiving lengthy legal documents to sign. The sources are provided
+for free but without warranty of any kind. The library has been
+entirely written by Jean-loup Gailly and Mark Adler; it does not
+include third-party code.
+
+If you redistribute modified sources, we would appreciate that you include
+in the file ChangeLog history information documenting your changes.
diff --git a/win32/contrib/zlib/adler32.c b/win32/contrib/zlib/adler32.c new file mode 100644 index 000000000..1bcd64b53 --- /dev/null +++ b/win32/contrib/zlib/adler32.c @@ -0,0 +1,48 @@ +/* adler32.c -- compute the Adler-32 checksum of a data stream
+ * Copyright (C) 1995-1998 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* @(#) $Id: adler32.c,v 1.1 2003/04/20 16:42:09 guenter Exp $ */
+
+#include "zlib.h"
+
+#define BASE 65521L /* largest prime smaller than 65536 */
+#define NMAX 5552
+/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
+
+#define DO1(buf,i) {s1 += buf[i]; s2 += s1;}
+#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1);
+#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2);
+#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4);
+#define DO16(buf) DO8(buf,0); DO8(buf,8);
+
+/* ========================================================================= */
+uLong ZEXPORT adler32(adler, buf, len)
+ uLong adler;
+ const Bytef *buf;
+ uInt len;
+{
+ unsigned long s1 = adler & 0xffff;
+ unsigned long s2 = (adler >> 16) & 0xffff;
+ int k;
+
+ if (buf == Z_NULL) return 1L;
+
+ while (len > 0) {
+ k = len < NMAX ? len : NMAX;
+ len -= k;
+ while (k >= 16) {
+ DO16(buf);
+ buf += 16;
+ k -= 16;
+ }
+ if (k != 0) do {
+ s1 += *buf++;
+ s2 += s1;
+ } while (--k);
+ s1 %= BASE;
+ s2 %= BASE;
+ }
+ return (s2 << 16) | s1;
+}
diff --git a/win32/contrib/zlib/algorithm.txt b/win32/contrib/zlib/algorithm.txt new file mode 100644 index 000000000..f488cd1a9 --- /dev/null +++ b/win32/contrib/zlib/algorithm.txt @@ -0,0 +1,213 @@ +1. Compression algorithm (deflate)
+
+The deflation algorithm used by gzip (also zip and zlib) is a variation of
+LZ77 (Lempel-Ziv 1977, see reference below). It finds duplicated strings in
+the input data. The second occurrence of a string is replaced by a
+pointer to the previous string, in the form of a pair (distance,
+length). Distances are limited to 32K bytes, and lengths are limited
+to 258 bytes. When a string does not occur anywhere in the previous
+32K bytes, it is emitted as a sequence of literal bytes. (In this
+description, `string' must be taken as an arbitrary sequence of bytes,
+and is not restricted to printable characters.)
+
+Literals or match lengths are compressed with one Huffman tree, and
+match distances are compressed with another tree. The trees are stored
+in a compact form at the start of each block. The blocks can have any
+size (except that the compressed data for one block must fit in
+available memory). A block is terminated when deflate() determines that
+it would be useful to start another block with fresh trees. (This is
+somewhat similar to the behavior of LZW-based _compress_.)
+
+Duplicated strings are found using a hash table. All input strings of
+length 3 are inserted in the hash table. A hash index is computed for
+the next 3 bytes. If the hash chain for this index is not empty, all
+strings in the chain are compared with the current input string, and
+the longest match is selected.
+
+The hash chains are searched starting with the most recent strings, to
+favor small distances and thus take advantage of the Huffman encoding.
+The hash chains are singly linked. There are no deletions from the
+hash chains, the algorithm simply discards matches that are too old.
+
+To avoid a worst-case situation, very long hash chains are arbitrarily
+truncated at a certain length, determined by a runtime option (level
+parameter of deflateInit). So deflate() does not always find the longest
+possible match but generally finds a match which is long enough.
+
+deflate() also defers the selection of matches with a lazy evaluation
+mechanism. After a match of length N has been found, deflate() searches for
+a longer match at the next input byte. If a longer match is found, the
+previous match is truncated to a length of one (thus producing a single
+literal byte) and the process of lazy evaluation begins again. Otherwise,
+the original match is kept, and the next match search is attempted only N
+steps later.
+
+The lazy match evaluation is also subject to a runtime parameter. If
+the current match is long enough, deflate() reduces the search for a longer
+match, thus speeding up the whole process. If compression ratio is more
+important than speed, deflate() attempts a complete second search even if
+the first match is already long enough.
+
+The lazy match evaluation is not performed for the fastest compression
+modes (level parameter 1 to 3). For these fast modes, new strings
+are inserted in the hash table only when no match was found, or
+when the match is not too long. This degrades the compression ratio
+but saves time since there are both fewer insertions and fewer searches.
+
+
+2. Decompression algorithm (inflate)
+
+2.1 Introduction
+
+The real question is, given a Huffman tree, how to decode fast. The most
+important realization is that shorter codes are much more common than
+longer codes, so pay attention to decoding the short codes fast, and let
+the long codes take longer to decode.
+
+inflate() sets up a first level table that covers some number of bits of
+input less than the length of longest code. It gets that many bits from the
+stream, and looks it up in the table. The table will tell if the next
+code is that many bits or less and how many, and if it is, it will tell
+the value, else it will point to the next level table for which inflate()
+grabs more bits and tries to decode a longer code.
+
+How many bits to make the first lookup is a tradeoff between the time it
+takes to decode and the time it takes to build the table. If building the
+table took no time (and if you had infinite memory), then there would only
+be a first level table to cover all the way to the longest code. However,
+building the table ends up taking a lot longer for more bits since short
+codes are replicated many times in such a table. What inflate() does is
+simply to make the number of bits in the first table a variable, and set it
+for the maximum speed.
+
+inflate() sends new trees relatively often, so it is possibly set for a
+smaller first level table than an application that has only one tree for
+all the data. For inflate, which has 286 possible codes for the
+literal/length tree, the size of the first table is nine bits. Also the
+distance trees have 30 possible values, and the size of the first table is
+six bits. Note that for each of those cases, the table ended up one bit
+longer than the ``average'' code length, i.e. the code length of an
+approximately flat code which would be a little more than eight bits for
+286 symbols and a little less than five bits for 30 symbols. It would be
+interesting to see if optimizing the first level table for other
+applications gave values within a bit or two of the flat code size.
+
+
+2.2 More details on the inflate table lookup
+
+Ok, you want to know what this cleverly obfuscated inflate tree actually
+looks like. You are correct that it's not a Huffman tree. It is simply a
+lookup table for the first, let's say, nine bits of a Huffman symbol. The
+symbol could be as short as one bit or as long as 15 bits. If a particular
+symbol is shorter than nine bits, then that symbol's translation is duplicated
+in all those entries that start with that symbol's bits. For example, if the
+symbol is four bits, then it's duplicated 32 times in a nine-bit table. If a
+symbol is nine bits long, it appears in the table once.
+
+If the symbol is longer than nine bits, then that entry in the table points
+to another similar table for the remaining bits. Again, there are duplicated
+entries as needed. The idea is that most of the time the symbol will be short
+and there will only be one table look up. (That's whole idea behind data
+compression in the first place.) For the less frequent long symbols, there
+will be two lookups. If you had a compression method with really long
+symbols, you could have as many levels of lookups as is efficient. For
+inflate, two is enough.
+
+So a table entry either points to another table (in which case nine bits in
+the above example are gobbled), or it contains the translation for the symbol
+and the number of bits to gobble. Then you start again with the next
+ungobbled bit.
+
+You may wonder: why not just have one lookup table for how ever many bits the
+longest symbol is? The reason is that if you do that, you end up spending
+more time filling in duplicate symbol entries than you do actually decoding.
+At least for deflate's output that generates new trees every several 10's of
+kbytes. You can imagine that filling in a 2^15 entry table for a 15-bit code
+would take too long if you're only decoding several thousand symbols. At the
+other extreme, you could make a new table for every bit in the code. In fact,
+that's essentially a Huffman tree. But then you spend two much time
+traversing the tree while decoding, even for short symbols.
+
+So the number of bits for the first lookup table is a trade of the time to
+fill out the table vs. the time spent looking at the second level and above of
+the table.
+
+Here is an example, scaled down:
+
+The code being decoded, with 10 symbols, from 1 to 6 bits long:
+
+A: 0
+B: 10
+C: 1100
+D: 11010
+E: 11011
+F: 11100
+G: 11101
+H: 11110
+I: 111110
+J: 111111
+
+Let's make the first table three bits long (eight entries):
+
+000: A,1
+001: A,1
+010: A,1
+011: A,1
+100: B,2
+101: B,2
+110: -> table X (gobble 3 bits)
+111: -> table Y (gobble 3 bits)
+
+Each entry is what the bits decode to and how many bits that is, i.e. how
+many bits to gobble. Or the entry points to another table, with the number of
+bits to gobble implicit in the size of the table.
+
+Table X is two bits long since the longest code starting with 110 is five bits
+long:
+
+00: C,1
+01: C,1
+10: D,2
+11: E,2
+
+Table Y is three bits long since the longest code starting with 111 is six
+bits long:
+
+000: F,2
+001: F,2
+010: G,2
+011: G,2
+100: H,2
+101: H,2
+110: I,3
+111: J,3
+
+So what we have here are three tables with a total of 20 entries that had to
+be constructed. That's compared to 64 entries for a single table. Or
+compared to 16 entries for a Huffman tree (six two entry tables and one four
+entry table). Assuming that the code ideally represents the probability of
+the symbols, it takes on the average 1.25 lookups per symbol. That's compared
+to one lookup for the single table, or 1.66 lookups per symbol for the
+Huffman tree.
+
+There, I think that gives you a picture of what's going on. For inflate, the
+meaning of a particular symbol is often more than just a letter. It can be a
+byte (a "literal"), or it can be either a length or a distance which
+indicates a base value and a number of bits to fetch after the code that is
+added to the base value. Or it might be the special end-of-block code. The
+data structures created in inftrees.c try to encode all that information
+compactly in the tables.
+
+
+Jean-loup Gailly Mark Adler
+jloup@gzip.org madler@alumni.caltech.edu
+
+
+References:
+
+[LZ77] Ziv J., Lempel A., ``A Universal Algorithm for Sequential Data
+Compression,'' IEEE Transactions on Information Theory, Vol. 23, No. 3,
+pp. 337-343.
+
+``DEFLATE Compressed Data Format Specification'' available in
+ftp://ds.internic.net/rfc/rfc1951.txt
diff --git a/win32/contrib/zlib/compress.c b/win32/contrib/zlib/compress.c new file mode 100644 index 000000000..093c4a596 --- /dev/null +++ b/win32/contrib/zlib/compress.c @@ -0,0 +1,68 @@ +/* compress.c -- compress a memory buffer
+ * Copyright (C) 1995-1998 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* @(#) $Id: compress.c,v 1.1 2003/04/20 16:42:09 guenter Exp $ */
+
+#include "zlib.h"
+
+/* ===========================================================================
+ Compresses the source buffer into the destination buffer. The level
+ parameter has the same meaning as in deflateInit. sourceLen is the byte
+ length of the source buffer. Upon entry, destLen is the total size of the
+ destination buffer, which must be at least 0.1% larger than sourceLen plus
+ 12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
+
+ compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+ memory, Z_BUF_ERROR if there was not enough room in the output buffer,
+ Z_STREAM_ERROR if the level parameter is invalid.
+*/
+int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
+ Bytef *dest;
+ uLongf *destLen;
+ const Bytef *source;
+ uLong sourceLen;
+ int level;
+{
+ z_stream stream;
+ int err;
+
+ stream.next_in = (Bytef*)source;
+ stream.avail_in = (uInt)sourceLen;
+#ifdef MAXSEG_64K
+ /* Check for source > 64K on 16-bit machine: */
+ if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
+#endif
+ stream.next_out = dest;
+ stream.avail_out = (uInt)*destLen;
+ if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
+
+ stream.zalloc = (alloc_func)0;
+ stream.zfree = (free_func)0;
+ stream.opaque = (voidpf)0;
+
+ err = deflateInit(&stream, level);
+ if (err != Z_OK) return err;
+
+ err = deflate(&stream, Z_FINISH);
+ if (err != Z_STREAM_END) {
+ deflateEnd(&stream);
+ return err == Z_OK ? Z_BUF_ERROR : err;
+ }
+ *destLen = stream.total_out;
+
+ err = deflateEnd(&stream);
+ return err;
+}
+
+/* ===========================================================================
+ */
+int ZEXPORT compress (dest, destLen, source, sourceLen)
+ Bytef *dest;
+ uLongf *destLen;
+ const Bytef *source;
+ uLong sourceLen;
+{
+ return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
+}
diff --git a/win32/contrib/zlib/configure b/win32/contrib/zlib/configure new file mode 100644 index 000000000..5cd618e70 --- /dev/null +++ b/win32/contrib/zlib/configure @@ -0,0 +1,212 @@ +#!/bin/sh
+# configure script for zlib. This script is needed only if
+# you wish to build a shared library and your system supports them,
+# of if you need special compiler, flags or install directory.
+# Otherwise, you can just use directly "make test; make install"
+#
+# To create a shared library, use "configure --shared"; by default a static
+# library is created. If the primitive shared library support provided here
+# does not work, use ftp://prep.ai.mit.edu/pub/gnu/libtool-*.tar.gz
+#
+# To impose specific compiler or flags or install directory, use for example:
+# prefix=$HOME CC=cc CFLAGS="-O4" ./configure
+# or for csh/tcsh users:
+# (setenv prefix $HOME; setenv CC cc; setenv CFLAGS "-O4"; ./configure)
+# LDSHARED is the command to be used to create a shared library
+
+# Incorrect settings of CC or CFLAGS may prevent creating a shared library.
+# If you have problems, try without defining CC and CFLAGS before reporting
+# an error.
+
+LIBS=libz.a
+SHAREDLIB=libz.so
+VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`
+AR=${AR-"ar rc"}
+RANLIB=${RANLIB-"ranlib"}
+prefix=${prefix-/usr/local}
+exec_prefix=${exec_prefix-'${prefix}'}
+libdir=${libdir-'${exec_prefix}/lib'}
+includedir=${includedir-'${prefix}/include'}
+shared_ext='.so'
+shared=0
+gcc=0
+old_cc="$CC"
+old_cflags="$CFLAGS"
+
+while test $# -ge 1
+do
+case "$1" in
+ -h* | --h*)
+ echo 'usage:'
+ echo ' configure [--shared] [--prefix=PREFIX] [--exec_prefix=EXPREFIX]'
+ echo ' [--libdir=LIBDIR] [--includedir=INCLUDEDIR]'
+ exit 0;;
+ -p*=* | --p*=*) prefix=`echo $1 | sed 's/[-a-z_]*=//'`; shift;;
+ -e*=* | --e*=*) exec_prefix=`echo $1 | sed 's/[-a-z_]*=//'`; shift;;
+ -l*=* | --libdir=*) libdir=`echo $1 | sed 's/[-a-z_]*=//'`; shift;;
+ -i*=* | --includedir=*) includedir=`echo $1 | sed 's/[-a-z_]*=//'`;shift;;
+ -p* | --p*) prefix="$2"; shift; shift;;
+ -e* | --e*) exec_prefix="$2"; shift; shift;;
+ -l* | --l*) libdir="$2"; shift; shift;;
+ -i* | --i*) includedir="$2"; shift; shift;;
+ -s* | --s*) shared=1; shift;;
+ esac
+done
+
+test=ztest$$
+cat > $test.c <<EOF
+extern int getchar();
+int hello() {return getchar();}
+EOF
+
+test -z "$CC" && echo Checking for gcc...
+cc=${CC-gcc}
+cflags=${CFLAGS-"-O3"}
+# to force the asm version use: CFLAGS="-O3 -DASMV" ./configure
+case "$cc" in
+ *gcc*) gcc=1;;
+esac
+
+if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then
+ CC="$cc"
+ SFLAGS=${CFLAGS-"-fPIC -O3"}
+ CFLAGS="$cflags"
+ case `(uname -s || echo unknown) 2>/dev/null` in
+ Linux | linux) LDSHARED=${LDSHARED-"gcc -shared -Wl,-soname,libz.so.1"};;
+ *) LDSHARED=${LDSHARED-"gcc -shared"};;
+ esac
+else
+ # find system name and corresponding cc options
+ CC=${CC-cc}
+ case `(uname -sr || echo unknown) 2>/dev/null` in
+ HP-UX*) SFLAGS=${CFLAGS-"-O +z"}
+ CFLAGS=${CFLAGS-"-O"}
+# LDSHARED=${LDSHARED-"ld -b +vnocompatwarnings"}
+ LDSHARED=${LDSHARED-"ld -b"}
+ shared_ext='.sl'
+ SHAREDLIB='libz.sl';;
+ IRIX*) SFLAGS=${CFLAGS-"-ansi -O2 -rpath ."}
+ CFLAGS=${CFLAGS-"-ansi -O2"}
+ LDSHARED=${LDSHARED-"cc -shared"};;
+ OSF1\ V4*) SFLAGS=${CFLAGS-"-O -std1"}
+ CFLAGS=${CFLAGS-"-O -std1"}
+ LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,$SHAREDLIB -Wl,-msym -Wl,-rpath,$(libdir) -Wl,-set_version,${VER}:1.0"};;
+ OSF1*) SFLAGS=${CFLAGS-"-O -std1"}
+ CFLAGS=${CFLAGS-"-O -std1"}
+ LDSHARED=${LDSHARED-"cc -shared"};;
+ QNX*) SFLAGS=${CFLAGS-"-4 -O"}
+ CFLAGS=${CFLAGS-"-4 -O"}
+ LDSHARED=${LDSHARED-"cc"}
+ RANLIB=${RANLIB-"true"}
+ AR="cc -A";;
+ SCO_SV\ 3.2*) SFLAGS=${CFLAGS-"-O3 -dy -KPIC "}
+ CFLAGS=${CFLAGS-"-O3"}
+ LDSHARED=${LDSHARED-"cc -dy -KPIC -G"};;
+ SunOS\ 5*) SFLAGS=${CFLAGS-"-fast -xcg89 -KPIC -R."}
+ CFLAGS=${CFLAGS-"-fast -xcg89"}
+ LDSHARED=${LDSHARED-"cc -G"};;
+ SunOS\ 4*) SFLAGS=${CFLAGS-"-O2 -PIC"}
+ CFLAGS=${CFLAGS-"-O2"}
+ LDSHARED=${LDSHARED-"ld"};;
+ UNIX_System_V\ 4.2.0)
+ SFLAGS=${CFLAGS-"-KPIC -O"}
+ CFLAGS=${CFLAGS-"-O"}
+ LDSHARED=${LDSHARED-"cc -G"};;
+ UNIX_SV\ 4.2MP)
+ SFLAGS=${CFLAGS-"-Kconform_pic -O"}
+ CFLAGS=${CFLAGS-"-O"}
+ LDSHARED=${LDSHARED-"cc -G"};;
+ # send working options for other systems to support@gzip.org
+ *) SFLAGS=${CFLAGS-"-O"}
+ CFLAGS=${CFLAGS-"-O"}
+ LDSHARED=${LDSHARED-"cc -shared"};;
+ esac
+fi
+
+if test $shared -eq 1; then
+ echo Checking for shared library support...
+ # we must test in two steps (cc then ld), required at least on SunOS 4.x
+ if test "`($CC -c $SFLAGS $test.c) 2>&1`" = "" &&
+ test "`($LDSHARED -o $test$shared_ext $test.o) 2>&1`" = ""; then
+ CFLAGS="$SFLAGS"
+ LIBS="$SHAREDLIB.$VER"
+ echo Building shared library $SHAREDLIB.$VER with $CC.
+ elif test -z "$old_cc" -a -z "$old_cflags"; then
+ echo No shared library suppport.
+ shared=0;
+ else
+ echo 'No shared library suppport; try without defining CC and CFLAGS'
+ shared=0;
+ fi
+fi
+if test $shared -eq 0; then
+ LDSHARED="$CC"
+ echo Building static library $LIBS version $VER with $CC.
+fi
+
+cat > $test.c <<EOF
+#include <unistd.h>
+int main() { return 0; }
+EOF
+if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
+ CFLAGS="$CFLAGS -DHAVE_UNISTD_H"
+ echo "Checking for unistd.h... Yes."
+else
+ echo "Checking for unistd.h... No."
+fi
+
+cat > $test.c <<EOF
+#include <errno.h>
+int main() { return 0; }
+EOF
+if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
+ echo "Checking for errno.h... Yes."
+else
+ echo "Checking for errno.h... No."
+ CFLAGS="$CFLAGS -DNO_ERRNO_H"
+fi
+
+cat > $test.c <<EOF
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+caddr_t hello() {
+ return mmap((caddr_t)0, (off_t)0, PROT_READ, MAP_SHARED, 0, (off_t)0);
+}
+EOF
+if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
+ CFLAGS="$CFLAGS -DUSE_MMAP"
+ echo Checking for mmap support... Yes.
+else
+ echo Checking for mmap support... No.
+fi
+
+CPP=${CPP-"$CC -E"}
+case $CFLAGS in
+ *ASMV*)
+ if test "`nm $test.o | grep _hello`" = ""; then
+ CPP="$CPP -DNO_UNDERLINE"
+ echo Checking for underline in external names... No.
+ else
+ echo Checking for underline in external names... Yes.
+ fi;;
+esac
+
+rm -f $test.[co] $test$shared_ext
+
+# udpate Makefile
+sed < Makefile.in "
+/^CC *=/s%=.*%=$CC%
+/^CFLAGS *=/s%=.*%=$CFLAGS%
+/^CPP *=/s%=.*%=$CPP%
+/^LDSHARED *=/s%=.*%=$LDSHARED%
+/^LIBS *=/s%=.*%=$LIBS%
+/^SHAREDLIB *=/s%=.*%=$SHAREDLIB%
+/^AR *=/s%=.*%=$AR%
+/^RANLIB *=/s%=.*%=$RANLIB%
+/^VER *=/s%=.*%=$VER%
+/^prefix *=/s%=.*%=$prefix%
+/^exec_prefix *=/s%=.*%=$exec_prefix%
+/^libdir *=/s%=.*%=$libdir%
+/^includedir *=/s%=.*%=$includedir%
+" > Makefile
diff --git a/win32/contrib/zlib/crc32.c b/win32/contrib/zlib/crc32.c new file mode 100644 index 000000000..6004de84a --- /dev/null +++ b/win32/contrib/zlib/crc32.c @@ -0,0 +1,162 @@ +/* crc32.c -- compute the CRC-32 of a data stream
+ * Copyright (C) 1995-1998 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* @(#) $Id: crc32.c,v 1.1 2003/04/20 16:42:09 guenter Exp $ */
+
+#include "zlib.h"
+
+#define local static
+
+#ifdef DYNAMIC_CRC_TABLE
+
+local int crc_table_empty = 1;
+local uLongf crc_table[256];
+local void make_crc_table OF((void));
+
+/*
+ Generate a table for a byte-wise 32-bit CRC calculation on the polynomial:
+ x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1.
+
+ Polynomials over GF(2) are represented in binary, one bit per coefficient,
+ with the lowest powers in the most significant bit. Then adding polynomials
+ is just exclusive-or, and multiplying a polynomial by x is a right shift by
+ one. If we call the above polynomial p, and represent a byte as the
+ polynomial q, also with the lowest power in the most significant bit (so the
+ byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p,
+ where a mod b means the remainder after dividing a by b.
+
+ This calculation is done using the shift-register method of multiplying and
+ taking the remainder. The register is initialized to zero, and for each
+ incoming bit, x^32 is added mod p to the register if the bit is a one (where
+ x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by
+ x (which is shifting right by one and adding x^32 mod p if the bit shifted
+ out is a one). We start with the highest power (least significant bit) of
+ q and repeat for all eight bits of q.
+
+ The table is simply the CRC of all possible eight bit values. This is all
+ the information needed to generate CRC's on data a byte at a time for all
+ combinations of CRC register values and incoming bytes.
+*/
+local void make_crc_table()
+{
+ uLong c;
+ int n, k;
+ uLong poly; /* polynomial exclusive-or pattern */
+ /* terms of polynomial defining this crc (except x^32): */
+ static const Byte p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
+
+ /* make exclusive-or pattern from polynomial (0xedb88320L) */
+ poly = 0L;
+ for (n = 0; n < sizeof(p)/sizeof(Byte); n++)
+ poly |= 1L << (31 - p[n]);
+
+ for (n = 0; n < 256; n++)
+ {
+ c = (uLong)n;
+ for (k = 0; k < 8; k++)
+ c = c & 1 ? poly ^ (c >> 1) : c >> 1;
+ crc_table[n] = c;
+ }
+ crc_table_empty = 0;
+}
+#else
+/* ========================================================================
+ * Table of CRC-32's of all single-byte values (made by make_crc_table)
+ */
+local const uLongf crc_table[256] = {
+ 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
+ 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
+ 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
+ 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
+ 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L,
+ 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L,
+ 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L,
+ 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
+ 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L,
+ 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL,
+ 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L,
+ 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L,
+ 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L,
+ 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL,
+ 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL,
+ 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
+ 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL,
+ 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L,
+ 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L,
+ 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L,
+ 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL,
+ 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L,
+ 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L,
+ 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
+ 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L,
+ 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L,
+ 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L,
+ 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L,
+ 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L,
+ 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL,
+ 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL,
+ 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
+ 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L,
+ 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL,
+ 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL,
+ 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L,
+ 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL,
+ 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L,
+ 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL,
+ 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
+ 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL,
+ 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L,
+ 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L,
+ 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL,
+ 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L,
+ 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L,
+ 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L,
+ 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
+ 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
+ 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
+ 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
+ 0x2d02ef8dL
+};
+#endif
+
+/* =========================================================================
+ * This function can be used by asm versions of crc32()
+ */
+const uLongf * ZEXPORT get_crc_table()
+{
+#ifdef DYNAMIC_CRC_TABLE
+ if (crc_table_empty) make_crc_table();
+#endif
+ return (const uLongf *)crc_table;
+}
+
+/* ========================================================================= */
+#define DO1(buf) crc = crc_table[((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8);
+#define DO2(buf) DO1(buf); DO1(buf);
+#define DO4(buf) DO2(buf); DO2(buf);
+#define DO8(buf) DO4(buf); DO4(buf);
+
+/* ========================================================================= */
+uLong ZEXPORT crc32(crc, buf, len)
+ uLong crc;
+ const Bytef *buf;
+ uInt len;
+{
+ if (buf == Z_NULL) return 0L;
+#ifdef DYNAMIC_CRC_TABLE
+ if (crc_table_empty)
+ make_crc_table();
+#endif
+ crc = crc ^ 0xffffffffL;
+ while (len >= 8)
+ {
+ DO8(buf);
+ len -= 8;
+ }
+ if (len) do {
+ DO1(buf);
+ } while (--len);
+ return crc ^ 0xffffffffL;
+}
diff --git a/win32/contrib/zlib/deflate.c b/win32/contrib/zlib/deflate.c new file mode 100644 index 000000000..b0aff9814 --- /dev/null +++ b/win32/contrib/zlib/deflate.c @@ -0,0 +1,1350 @@ +/* deflate.c -- compress data using the deflation algorithm
+ * Copyright (C) 1995-1998 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/*
+ * ALGORITHM
+ *
+ * The "deflation" process depends on being able to identify portions
+ * of the input text which are identical to earlier input (within a
+ * sliding window trailing behind the input currently being processed).
+ *
+ * The most straightforward technique turns out to be the fastest for
+ * most input files: try all possible matches and select the longest.
+ * The key feature of this algorithm is that insertions into the string
+ * dictionary are very simple and thus fast, and deletions are avoided
+ * completely. Insertions are performed at each input character, whereas
+ * string matches are performed only when the previous match ends. So it
+ * is preferable to spend more time in matches to allow very fast string
+ * insertions and avoid deletions. The matching algorithm for small
+ * strings is inspired from that of Rabin & Karp. A brute force approach
+ * is used to find longer strings when a small match has been found.
+ * A similar algorithm is used in comic (by Jan-Mark Wams) and freeze
+ * (by Leonid Broukhis).
+ * A previous version of this file used a more sophisticated algorithm
+ * (by Fiala and Greene) which is guaranteed to run in linear amortized
+ * time, but has a larger average cost, uses more memory and is patented.
+ * However the F&G algorithm may be faster for some highly redundant
+ * files if the parameter max_chain_length (described below) is too large.
+ *
+ * ACKNOWLEDGEMENTS
+ *
+ * The idea of lazy evaluation of matches is due to Jan-Mark Wams, and
+ * I found it in 'freeze' written by Leonid Broukhis.
+ * Thanks to many people for bug reports and testing.
+ *
+ * REFERENCES
+ *
+ * Deutsch, L.P.,"DEFLATE Compressed Data Format Specification".
+ * Available in ftp://ds.internic.net/rfc/rfc1951.txt
+ *
+ * A description of the Rabin and Karp algorithm is given in the book
+ * "Algorithms" by R. Sedgewick, Addison-Wesley, p252.
+ *
+ * Fiala,E.R., and Greene,D.H.
+ * Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595
+ *
+ */
+
+/* @(#) $Id: deflate.c,v 1.1 2003/04/20 16:42:09 guenter Exp $ */
+
+#include "deflate.h"
+
+const char deflate_copyright[] =
+ " deflate 1.1.3 Copyright 1995-1998 Jean-loup Gailly ";
+/*
+ If you use the zlib library in a product, an acknowledgment is welcome
+ in the documentation of your product. If for some reason you cannot
+ include such an acknowledgment, I would appreciate that you keep this
+ copyright string in the executable of your product.
+ */
+
+/* ===========================================================================
+ * Function prototypes.
+ */
+typedef enum {
+ need_more, /* block not completed, need more input or more output */
+ block_done, /* block flush performed */
+ finish_started, /* finish started, need only more output at next deflate */
+ finish_done /* finish done, accept no more input or output */
+} block_state;
+
+typedef block_state (*compress_func) OF((deflate_state *s, int flush));
+/* Compression function. Returns the block state after the call. */
+
+local void fill_window OF((deflate_state *s));
+local block_state deflate_stored OF((deflate_state *s, int flush));
+local block_state deflate_fast OF((deflate_state *s, int flush));
+local block_state deflate_slow OF((deflate_state *s, int flush));
+local void lm_init OF((deflate_state *s));
+local void putShortMSB OF((deflate_state *s, uInt b));
+local void flush_pending OF((z_streamp strm));
+local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size));
+#ifdef ASMV
+ void match_init OF((void)); /* asm code initialization */
+ uInt longest_match OF((deflate_state *s, IPos cur_match));
+#else
+local uInt longest_match OF((deflate_state *s, IPos cur_match));
+#endif
+
+#ifdef DEBUG
+local void check_match OF((deflate_state *s, IPos start, IPos match,
+ int length));
+#endif
+
+/* ===========================================================================
+ * Local data
+ */
+
+#define NIL 0
+/* Tail of hash chains */
+
+#ifndef TOO_FAR
+# define TOO_FAR 4096
+#endif
+/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */
+
+#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
+/* Minimum amount of lookahead, except at the end of the input file.
+ * See deflate.c for comments about the MIN_MATCH+1.
+ */
+
+/* Values for max_lazy_match, good_match and max_chain_length, depending on
+ * the desired pack level (0..9). The values given below have been tuned to
+ * exclude worst case performance for pathological files. Better values may be
+ * found for specific files.
+ */
+typedef struct config_s {
+ ush good_length; /* reduce lazy search above this match length */
+ ush max_lazy; /* do not perform lazy search above this match length */
+ ush nice_length; /* quit search above this match length */
+ ush max_chain;
+ compress_func func;
+} config;
+
+local const config configuration_table[10] = {
+/* good lazy nice chain */
+/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */
+/* 1 */ {4, 4, 8, 4, deflate_fast}, /* maximum speed, no lazy matches */
+/* 2 */ {4, 5, 16, 8, deflate_fast},
+/* 3 */ {4, 6, 32, 32, deflate_fast},
+
+/* 4 */ {4, 4, 16, 16, deflate_slow}, /* lazy matches */
+/* 5 */ {8, 16, 32, 32, deflate_slow},
+/* 6 */ {8, 16, 128, 128, deflate_slow},
+/* 7 */ {8, 32, 128, 256, deflate_slow},
+/* 8 */ {32, 128, 258, 1024, deflate_slow},
+/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* maximum compression */
+
+/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4
+ * For deflate_fast() (levels <= 3) good is ignored and lazy has a different
+ * meaning.
+ */
+
+#define EQUAL 0
+/* result of memcmp for equal strings */
+
+struct static_tree_desc_s {int dummy;}; /* for buggy compilers */
+
+/* ===========================================================================
+ * Update a hash value with the given input byte
+ * IN assertion: all calls to to UPDATE_HASH are made with consecutive
+ * input characters, so that a running hash key can be computed from the
+ * previous key instead of complete recalculation each time.
+ */
+#define UPDATE_HASH(s,h,c) (h = (((h)<<s->hash_shift) ^ (c)) & s->hash_mask)
+
+
+/* ===========================================================================
+ * Insert string str in the dictionary and set match_head to the previous head
+ * of the hash chain (the most recent string with same hash key). Return
+ * the previous length of the hash chain.
+ * If this file is compiled with -DFASTEST, the compression level is forced
+ * to 1, and no hash chains are maintained.
+ * IN assertion: all calls to to INSERT_STRING are made with consecutive
+ * input characters and the first MIN_MATCH bytes of str are valid
+ * (except for the last MIN_MATCH-1 bytes of the input file).
+ */
+#ifdef FASTEST
+#define INSERT_STRING(s, str, match_head) \
+ (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
+ match_head = s->head[s->ins_h], \
+ s->head[s->ins_h] = (Pos)(str))
+#else
+#define INSERT_STRING(s, str, match_head) \
+ (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
+ s->prev[(str) & s->w_mask] = match_head = s->head[s->ins_h], \
+ s->head[s->ins_h] = (Pos)(str))
+#endif
+
+/* ===========================================================================
+ * Initialize the hash table (avoiding 64K overflow for 16 bit systems).
+ * prev[] will be initialized on the fly.
+ */
+#define CLEAR_HASH(s) \
+ s->head[s->hash_size-1] = NIL; \
+ zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));
+
+/* ========================================================================= */
+int ZEXPORT deflateInit_(strm, level, version, stream_size)
+ z_streamp strm;
+ int level;
+ const char *version;
+ int stream_size;
+{
+ return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
+ Z_DEFAULT_STRATEGY, version, stream_size);
+ /* To do: ignore strm->next_in if we use it as window */
+}
+
+/* ========================================================================= */
+int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
+ version, stream_size)
+ z_streamp strm;
+ int level;
+ int method;
+ int windowBits;
+ int memLevel;
+ int strategy;
+ const char *version;
+ int stream_size;
+{
+ deflate_state *s;
+ int noheader = 0;
+ static const char* my_version = ZLIB_VERSION;
+
+ ushf *overlay;
+ /* We overlay pending_buf and d_buf+l_buf. This works since the average
+ * output size for (length,distance) codes is <= 24 bits.
+ */
+
+ if (version == Z_NULL || version[0] != my_version[0] ||
+ stream_size != sizeof(z_stream)) {
+ return Z_VERSION_ERROR;
+ }
+ if (strm == Z_NULL) return Z_STREAM_ERROR;
+
+ strm->msg = Z_NULL;
+ if (strm->zalloc == Z_NULL) {
+ strm->zalloc = zcalloc;
+ strm->opaque = (voidpf)0;
+ }
+ if (strm->zfree == Z_NULL) strm->zfree = zcfree;
+
+ if (level == Z_DEFAULT_COMPRESSION) level = 6;
+#ifdef FASTEST
+ level = 1;
+#endif
+
+ if (windowBits < 0) { /* undocumented feature: suppress zlib header */
+ noheader = 1;
+ windowBits = -windowBits;
+ }
+ if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED ||
+ windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
+ strategy < 0 || strategy > Z_HUFFMAN_ONLY) {
+ return Z_STREAM_ERROR;
+ }
+ s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state));
+ if (s == Z_NULL) return Z_MEM_ERROR;
+ strm->state = (struct internal_state FAR *)s;
+ s->strm = strm;
+
+ s->noheader = noheader;
+ s->w_bits = windowBits;
+ s->w_size = 1 << s->w_bits;
+ s->w_mask = s->w_size - 1;
+
+ s->hash_bits = memLevel + 7;
+ s->hash_size = 1 << s->hash_bits;
+ s->hash_mask = s->hash_size - 1;
+ s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH);
+
+ s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte));
+ s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos));
+ s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos));
+
+ s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
+
+ overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
+ s->pending_buf = (uchf *) overlay;
+ s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L);
+
+ if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
+ s->pending_buf == Z_NULL) {
+ strm->msg = (char*)ERR_MSG(Z_MEM_ERROR);
+ deflateEnd (strm);
+ return Z_MEM_ERROR;
+ }
+ s->d_buf = overlay + s->lit_bufsize/sizeof(ush);
+ s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;
+
+ s->level = level;
+ s->strategy = strategy;
+ s->method = (Byte)method;
+
+ return deflateReset(strm);
+}
+
+/* ========================================================================= */
+int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
+ z_streamp strm;
+ const Bytef *dictionary;
+ uInt dictLength;
+{
+ deflate_state *s;
+ uInt length = dictLength;
+ uInt n;
+ IPos hash_head = 0;
+
+ if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL ||
+ strm->state->status != INIT_STATE) return Z_STREAM_ERROR;
+
+ s = strm->state;
+ strm->adler = adler32(strm->adler, dictionary, dictLength);
+
+ if (length < MIN_MATCH) return Z_OK;
+ if (length > MAX_DIST(s)) {
+ length = MAX_DIST(s);
+#ifndef USE_DICT_HEAD
+ dictionary += dictLength - length; /* use the tail of the dictionary */
+#endif
+ }
+ zmemcpy(s->window, dictionary, length);
+ s->strstart = length;
+ s->block_start = (long)length;
+
+ /* Insert all strings in the hash table (except for the last two bytes).
+ * s->lookahead stays null, so s->ins_h will be recomputed at the next
+ * call of fill_window.
+ */
+ s->ins_h = s->window[0];
+ UPDATE_HASH(s, s->ins_h, s->window[1]);
+ for (n = 0; n <= length - MIN_MATCH; n++) {
+ INSERT_STRING(s, n, hash_head);
+ }
+ if (hash_head) hash_head = 0; /* to make compiler happy */
+ return Z_OK;
+}
+
+/* ========================================================================= */
+int ZEXPORT deflateReset (strm)
+ z_streamp strm;
+{
+ deflate_state *s;
+
+ if (strm == Z_NULL || strm->state == Z_NULL ||
+ strm->zalloc == Z_NULL || strm->zfree == Z_NULL) return Z_STREAM_ERROR;
+
+ strm->total_in = strm->total_out = 0;
+ strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */
+ strm->data_type = Z_UNKNOWN;
+
+ s = (deflate_state *)strm->state;
+ s->pending = 0;
+ s->pending_out = s->pending_buf;
+
+ if (s->noheader < 0) {
+ s->noheader = 0; /* was set to -1 by deflate(..., Z_FINISH); */
+ }
+ s->status = s->noheader ? BUSY_STATE : INIT_STATE;
+ strm->adler = 1;
+ s->last_flush = Z_NO_FLUSH;
+
+ _tr_init(s);
+ lm_init(s);
+
+ return Z_OK;
+}
+
+/* ========================================================================= */
+int ZEXPORT deflateParams(strm, level, strategy)
+ z_streamp strm;
+ int level;
+ int strategy;
+{
+ deflate_state *s;
+ compress_func func;
+ int err = Z_OK;
+
+ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+ s = strm->state;
+
+ if (level == Z_DEFAULT_COMPRESSION) {
+ level = 6;
+ }
+ if (level < 0 || level > 9 || strategy < 0 || strategy > Z_HUFFMAN_ONLY) {
+ return Z_STREAM_ERROR;
+ }
+ func = configuration_table[s->level].func;
+
+ if (func != configuration_table[level].func && strm->total_in != 0) {
+ /* Flush the last buffer: */
+ err = deflate(strm, Z_PARTIAL_FLUSH);
+ }
+ if (s->level != level) {
+ s->level = level;
+ s->max_lazy_match = configuration_table[level].max_lazy;
+ s->good_match = configuration_table[level].good_length;
+ s->nice_match = configuration_table[level].nice_length;
+ s->max_chain_length = configuration_table[level].max_chain;
+ }
+ s->strategy = strategy;
+ return err;
+}
+
+/* =========================================================================
+ * Put a short in the pending buffer. The 16-bit value is put in MSB order.
+ * IN assertion: the stream state is correct and there is enough room in
+ * pending_buf.
+ */
+local void putShortMSB (s, b)
+ deflate_state *s;
+ uInt b;
+{
+ put_byte(s, (Byte)(b >> 8));
+ put_byte(s, (Byte)(b & 0xff));
+}
+
+/* =========================================================================
+ * Flush as much pending output as possible. All deflate() output goes
+ * through this function so some applications may wish to modify it
+ * to avoid allocating a large strm->next_out buffer and copying into it.
+ * (See also read_buf()).
+ */
+local void flush_pending(strm)
+ z_streamp strm;
+{
+ unsigned len = strm->state->pending;
+
+ if (len > strm->avail_out) len = strm->avail_out;
+ if (len == 0) return;
+
+ zmemcpy(strm->next_out, strm->state->pending_out, len);
+ strm->next_out += len;
+ strm->state->pending_out += len;
+ strm->total_out += len;
+ strm->avail_out -= len;
+ strm->state->pending -= len;
+ if (strm->state->pending == 0) {
+ strm->state->pending_out = strm->state->pending_buf;
+ }
+}
+
+/* ========================================================================= */
+int ZEXPORT deflate (strm, flush)
+ z_streamp strm;
+ int flush;
+{
+ int old_flush; /* value of flush param for previous deflate call */
+ deflate_state *s;
+
+ if (strm == Z_NULL || strm->state == Z_NULL ||
+ flush > Z_FINISH || flush < 0) {
+ return Z_STREAM_ERROR;
+ }
+ s = strm->state;
+
+ if (strm->next_out == Z_NULL ||
+ (strm->next_in == Z_NULL && strm->avail_in != 0) ||
+ (s->status == FINISH_STATE && flush != Z_FINISH)) {
+ ERR_RETURN(strm, Z_STREAM_ERROR);
+ }
+ if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR);
+
+ s->strm = strm; /* just in case */
+ old_flush = s->last_flush;
+ s->last_flush = flush;
+
+ /* Write the zlib header */
+ if (s->status == INIT_STATE) {
+
+ uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8;
+ uInt level_flags = (s->level-1) >> 1;
+
+ if (level_flags > 3) level_flags = 3;
+ header |= (level_flags << 6);
+ if (s->strstart != 0) header |= PRESET_DICT;
+ header += 31 - (header % 31);
+
+ s->status = BUSY_STATE;
+ putShortMSB(s, header);
+
+ /* Save the adler32 of the preset dictionary: */
+ if (s->strstart != 0) {
+ putShortMSB(s, (uInt)(strm->adler >> 16));
+ putShortMSB(s, (uInt)(strm->adler & 0xffff));
+ }
+ strm->adler = 1L;
+ }
+
+ /* Flush as much pending output as possible */
+ if (s->pending != 0) {
+ flush_pending(strm);
+ if (strm->avail_out == 0) {
+ /* Since avail_out is 0, deflate will be called again with
+ * more output space, but possibly with both pending and
+ * avail_in equal to zero. There won't be anything to do,
+ * but this is not an error situation so make sure we
+ * return OK instead of BUF_ERROR at next call of deflate:
+ */
+ s->last_flush = -1;
+ return Z_OK;
+ }
+
+ /* Make sure there is something to do and avoid duplicate consecutive
+ * flushes. For repeated and useless calls with Z_FINISH, we keep
+ * returning Z_STREAM_END instead of Z_BUFF_ERROR.
+ */
+ } else if (strm->avail_in == 0 && flush <= old_flush &&
+ flush != Z_FINISH) {
+ ERR_RETURN(strm, Z_BUF_ERROR);
+ }
+
+ /* User must not provide more input after the first FINISH: */
+ if (s->status == FINISH_STATE && strm->avail_in != 0) {
+ ERR_RETURN(strm, Z_BUF_ERROR);
+ }
+
+ /* Start a new block or continue the current one.
+ */
+ if (strm->avail_in != 0 || s->lookahead != 0 ||
+ (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
+ block_state bstate;
+
+ bstate = (*(configuration_table[s->level].func))(s, flush);
+
+ if (bstate == finish_started || bstate == finish_done) {
+ s->status = FINISH_STATE;
+ }
+ if (bstate == need_more || bstate == finish_started) {
+ if (strm->avail_out == 0) {
+ s->last_flush = -1; /* avoid BUF_ERROR next call, see above */
+ }
+ return Z_OK;
+ /* If flush != Z_NO_FLUSH && avail_out == 0, the next call
+ * of deflate should use the same flush parameter to make sure
+ * that the flush is complete. So we don't have to output an
+ * empty block here, this will be done at next call. This also
+ * ensures that for a very small output buffer, we emit at most
+ * one empty block.
+ */
+ }
+ if (bstate == block_done) {
+ if (flush == Z_PARTIAL_FLUSH) {
+ _tr_align(s);
+ } else { /* FULL_FLUSH or SYNC_FLUSH */
+ _tr_stored_block(s, (char*)0, 0L, 0);
+ /* For a full flush, this empty block will be recognized
+ * as a special marker by inflate_sync().
+ */
+ if (flush == Z_FULL_FLUSH) {
+ CLEAR_HASH(s); /* forget history */
+ }
+ }
+ flush_pending(strm);
+ if (strm->avail_out == 0) {
+ s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */
+ return Z_OK;
+ }
+ }
+ }
+ Assert(strm->avail_out > 0, "bug2");
+
+ if (flush != Z_FINISH) return Z_OK;
+ if (s->noheader) return Z_STREAM_END;
+
+ /* Write the zlib trailer (adler32) */
+ putShortMSB(s, (uInt)(strm->adler >> 16));
+ putShortMSB(s, (uInt)(strm->adler & 0xffff));
+ flush_pending(strm);
+ /* If avail_out is zero, the application will call deflate again
+ * to flush the rest.
+ */
+ s->noheader = -1; /* write the trailer only once! */
+ return s->pending != 0 ? Z_OK : Z_STREAM_END;
+}
+
+/* ========================================================================= */
+int ZEXPORT deflateEnd (strm)
+ z_streamp strm;
+{
+ int status;
+
+ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+
+ status = strm->state->status;
+ if (status != INIT_STATE && status != BUSY_STATE &&
+ status != FINISH_STATE) {
+ return Z_STREAM_ERROR;
+ }
+
+ /* Deallocate in reverse order of allocations: */
+ TRY_FREE(strm, strm->state->pending_buf);
+ TRY_FREE(strm, strm->state->head);
+ TRY_FREE(strm, strm->state->prev);
+ TRY_FREE(strm, strm->state->window);
+
+ ZFREE(strm, strm->state);
+ strm->state = Z_NULL;
+
+ return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;
+}
+
+/* =========================================================================
+ * Copy the source state to the destination state.
+ * To simplify the source, this is not supported for 16-bit MSDOS (which
+ * doesn't have enough memory anyway to duplicate compression states).
+ */
+int ZEXPORT deflateCopy (dest, source)
+ z_streamp dest;
+ z_streamp source;
+{
+#ifdef MAXSEG_64K
+ return Z_STREAM_ERROR;
+#else
+ deflate_state *ds;
+ deflate_state *ss;
+ ushf *overlay;
+
+
+ if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) {
+ return Z_STREAM_ERROR;
+ }
+
+ ss = source->state;
+
+ *dest = *source;
+
+ ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state));
+ if (ds == Z_NULL) return Z_MEM_ERROR;
+ dest->state = (struct internal_state FAR *) ds;
+ *ds = *ss;
+ ds->strm = dest;
+
+ ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
+ ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos));
+ ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos));
+ overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2);
+ ds->pending_buf = (uchf *) overlay;
+
+ if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
+ ds->pending_buf == Z_NULL) {
+ deflateEnd (dest);
+ return Z_MEM_ERROR;
+ }
+ /* following zmemcpy do not work for 16-bit MSDOS */
+ zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte));
+ zmemcpy(ds->prev, ss->prev, ds->w_size * sizeof(Pos));
+ zmemcpy(ds->head, ss->head, ds->hash_size * sizeof(Pos));
+ zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);
+
+ ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
+ ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush);
+ ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize;
+
+ ds->l_desc.dyn_tree = ds->dyn_ltree;
+ ds->d_desc.dyn_tree = ds->dyn_dtree;
+ ds->bl_desc.dyn_tree = ds->bl_tree;
+
+ return Z_OK;
+#endif
+}
+
+/* ===========================================================================
+ * Read a new buffer from the current input stream, update the adler32
+ * and total number of bytes read. All deflate() input goes through
+ * this function so some applications may wish to modify it to avoid
+ * allocating a large strm->next_in buffer and copying from it.
+ * (See also flush_pending()).
+ */
+local int read_buf(strm, buf, size)
+ z_streamp strm;
+ Bytef *buf;
+ unsigned size;
+{
+ unsigned len = strm->avail_in;
+
+ if (len > size) len = size;
+ if (len == 0) return 0;
+
+ strm->avail_in -= len;
+
+ if (!strm->state->noheader) {
+ strm->adler = adler32(strm->adler, strm->next_in, len);
+ }
+ zmemcpy(buf, strm->next_in, len);
+ strm->next_in += len;
+ strm->total_in += len;
+
+ return (int)len;
+}
+
+/* ===========================================================================
+ * Initialize the "longest match" routines for a new zlib stream
+ */
+local void lm_init (s)
+ deflate_state *s;
+{
+ s->window_size = (ulg)2L*s->w_size;
+
+ CLEAR_HASH(s);
+
+ /* Set the default configuration parameters:
+ */
+ s->max_lazy_match = configuration_table[s->level].max_lazy;
+ s->good_match = configuration_table[s->level].good_length;
+ s->nice_match = configuration_table[s->level].nice_length;
+ s->max_chain_length = configuration_table[s->level].max_chain;
+
+ s->strstart = 0;
+ s->block_start = 0L;
+ s->lookahead = 0;
+ s->match_length = s->prev_length = MIN_MATCH-1;
+ s->match_available = 0;
+ s->ins_h = 0;
+#ifdef ASMV
+ match_init(); /* initialize the asm code */
+#endif
+}
+
+/* ===========================================================================
+ * Set match_start to the longest match starting at the given string and
+ * return its length. Matches shorter or equal to prev_length are discarded,
+ * in which case the result is equal to prev_length and match_start is
+ * garbage.
+ * IN assertions: cur_match is the head of the hash chain for the current
+ * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
+ * OUT assertion: the match length is not greater than s->lookahead.
+ */
+#ifndef ASMV
+/* For 80x86 and 680x0, an optimized version will be provided in match.asm or
+ * match.S. The code will be functionally equivalent.
+ */
+#ifndef FASTEST
+local uInt longest_match(s, cur_match)
+ deflate_state *s;
+ IPos cur_match; /* current match */
+{
+ unsigned chain_length = s->max_chain_length;/* max hash chain length */
+ register Bytef *scan = s->window + s->strstart; /* current string */
+ register Bytef *match; /* matched string */
+ register int len; /* length of current match */
+ int best_len = s->prev_length; /* best match length so far */
+ int nice_match = s->nice_match; /* stop if match long enough */
+ IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
+ s->strstart - (IPos)MAX_DIST(s) : NIL;
+ /* Stop when cur_match becomes <= limit. To simplify the code,
+ * we prevent matches with the string of window index 0.
+ */
+ Posf *prev = s->prev;
+ uInt wmask = s->w_mask;
+
+#ifdef UNALIGNED_OK
+ /* Compare two bytes at a time. Note: this is not always beneficial.
+ * Try with and without -DUNALIGNED_OK to check.
+ */
+ register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1;
+ register ush scan_start = *(ushf*)scan;
+ register ush scan_end = *(ushf*)(scan+best_len-1);
+#else
+ register Bytef *strend = s->window + s->strstart + MAX_MATCH;
+ register Byte scan_end1 = scan[best_len-1];
+ register Byte scan_end = scan[best_len];
+#endif
+
+ /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
+ * It is easy to get rid of this optimization if necessary.
+ */
+ Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
+
+ /* Do not waste too much time if we already have a good match: */
+ if (s->prev_length >= s->good_match) {
+ chain_length >>= 2;
+ }
+ /* Do not look for matches beyond the end of the input. This is necessary
+ * to make deflate deterministic.
+ */
+ if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
+
+ Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
+
+ do {
+ Assert(cur_match < s->strstart, "no future");
+ match = s->window + cur_match;
+
+ /* Skip to next match if the match length cannot increase
+ * or if the match length is less than 2:
+ */
+#if (defined(UNALIGNED_OK) && MAX_MATCH == 258)
+ /* This code assumes sizeof(unsigned short) == 2. Do not use
+ * UNALIGNED_OK if your compiler uses a different size.
+ */
+ if (*(ushf*)(match+best_len-1) != scan_end ||
+ *(ushf*)match != scan_start) continue;
+
+ /* It is not necessary to compare scan[2] and match[2] since they are
+ * always equal when the other bytes match, given that the hash keys
+ * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at
+ * strstart+3, +5, ... up to strstart+257. We check for insufficient
+ * lookahead only every 4th comparison; the 128th check will be made
+ * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is
+ * necessary to put more guard bytes at the end of the window, or
+ * to check more often for insufficient lookahead.
+ */
+ Assert(scan[2] == match[2], "scan[2]?");
+ scan++, match++;
+ do {
+ } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
+ *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
+ *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
+ *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
+ scan < strend);
+ /* The funny "do {}" generates better code on most compilers */
+
+ /* Here, scan <= window+strstart+257 */
+ Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
+ if (*scan == *match) scan++;
+
+ len = (MAX_MATCH - 1) - (int)(strend-scan);
+ scan = strend - (MAX_MATCH-1);
+
+#else /* UNALIGNED_OK */
+
+ if (match[best_len] != scan_end ||
+ match[best_len-1] != scan_end1 ||
+ *match != *scan ||
+ *++match != scan[1]) continue;
+
+ /* The check at best_len-1 can be removed because it will be made
+ * again later. (This heuristic is not always a win.)
+ * It is not necessary to compare scan[2] and match[2] since they
+ * are always equal when the other bytes match, given that
+ * the hash keys are equal and that HASH_BITS >= 8.
+ */
+ scan += 2, match++;
+ Assert(*scan == *match, "match[2]?");
+
+ /* We check for insufficient lookahead only every 8th comparison;
+ * the 256th check will be made at strstart+258.
+ */
+ do {
+ } while (*++scan == *++match && *++scan == *++match &&
+ *++scan == *++match && *++scan == *++match &&
+ *++scan == *++match && *++scan == *++match &&
+ *++scan == *++match && *++scan == *++match &&
+ scan < strend);
+
+ Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
+
+ len = MAX_MATCH - (int)(strend - scan);
+ scan = strend - MAX_MATCH;
+
+#endif /* UNALIGNED_OK */
+
+ if (len > best_len) {
+ s->match_start = cur_match;
+ best_len = len;
+ if (len >= nice_match) break;
+#ifdef UNALIGNED_OK
+ scan_end = *(ushf*)(scan+best_len-1);
+#else
+ scan_end1 = scan[best_len-1];
+ scan_end = scan[best_len];
+#endif
+ }
+ } while ((cur_match = prev[cur_match & wmask]) > limit
+ && --chain_length != 0);
+
+ if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
+ return s->lookahead;
+}
+
+#else /* FASTEST */
+/* ---------------------------------------------------------------------------
+ * Optimized version for level == 1 only
+ */
+local uInt longest_match(s, cur_match)
+ deflate_state *s;
+ IPos cur_match; /* current match */
+{
+ register Bytef *scan = s->window + s->strstart; /* current string */
+ register Bytef *match; /* matched string */
+ register int len; /* length of current match */
+ register Bytef *strend = s->window + s->strstart + MAX_MATCH;
+
+ /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
+ * It is easy to get rid of this optimization if necessary.
+ */
+ Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
+
+ Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
+
+ Assert(cur_match < s->strstart, "no future");
+
+ match = s->window + cur_match;
+
+ /* Return failure if the match length is less than 2:
+ */
+ if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1;
+
+ /* The check at best_len-1 can be removed because it will be made
+ * again later. (This heuristic is not always a win.)
+ * It is not necessary to compare scan[2] and match[2] since they
+ * are always equal when the other bytes match, given that
+ * the hash keys are equal and that HASH_BITS >= 8.
+ */
+ scan += 2, match += 2;
+ Assert(*scan == *match, "match[2]?");
+
+ /* We check for insufficient lookahead only every 8th comparison;
+ * the 256th check will be made at strstart+258.
+ */
+ do {
+ } while (*++scan == *++match && *++scan == *++match &&
+ *++scan == *++match && *++scan == *++match &&
+ *++scan == *++match && *++scan == *++match &&
+ *++scan == *++match && *++scan == *++match &&
+ scan < strend);
+
+ Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
+
+ len = MAX_MATCH - (int)(strend - scan);
+
+ if (len < MIN_MATCH) return MIN_MATCH - 1;
+
+ s->match_start = cur_match;
+ return len <= s->lookahead ? len : s->lookahead;
+}
+#endif /* FASTEST */
+#endif /* ASMV */
+
+#ifdef DEBUG
+/* ===========================================================================
+ * Check that the match at match_start is indeed a match.
+ */
+local void check_match(s, start, match, length)
+ deflate_state *s;
+ IPos start, match;
+ int length;
+{
+ /* check that the match is indeed a match */
+ if (zmemcmp(s->window + match,
+ s->window + start, length) != EQUAL) {
+ fprintf(stderr, " start %u, match %u, length %d\n",
+ start, match, length);
+ do {
+ fprintf(stderr, "%c%c", s->window[match++], s->window[start++]);
+ } while (--length != 0);
+ z_error("invalid match");
+ }
+ if (z_verbose > 1) {
+ fprintf(stderr,"\\[%d,%d]", start-match, length);
+ do { putc(s->window[start++], stderr); } while (--length != 0);
+ }
+}
+#else
+# define check_match(s, start, match, length)
+#endif
+
+/* ===========================================================================
+ * Fill the window when the lookahead becomes insufficient.
+ * Updates strstart and lookahead.
+ *
+ * IN assertion: lookahead < MIN_LOOKAHEAD
+ * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD
+ * At least one byte has been read, or avail_in == 0; reads are
+ * performed for at least two bytes (required for the zip translate_eol
+ * option -- not supported here).
+ */
+local void fill_window(s)
+ deflate_state *s;
+{
+ register unsigned n, m;
+ register Posf *p;
+ unsigned more; /* Amount of free space at the end of the window. */
+ uInt wsize = s->w_size;
+
+ do {
+ more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);
+
+ /* Deal with !@#$% 64K limit: */
+ if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
+ more = wsize;
+
+ } else if (more == (unsigned)(-1)) {
+ /* Very unlikely, but possible on 16 bit machine if strstart == 0
+ * and lookahead == 1 (input done one byte at time)
+ */
+ more--;
+
+ /* If the window is almost full and there is insufficient lookahead,
+ * move the upper half to the lower one to make room in the upper half.
+ */
+ } else if (s->strstart >= wsize+MAX_DIST(s)) {
+
+ zmemcpy(s->window, s->window+wsize, (unsigned)wsize);
+ s->match_start -= wsize;
+ s->strstart -= wsize; /* we now have strstart >= MAX_DIST */
+ s->block_start -= (long) wsize;
+
+ /* Slide the hash table (could be avoided with 32 bit values
+ at the expense of memory usage). We slide even when level == 0
+ to keep the hash table consistent if we switch back to level > 0
+ later. (Using level 0 permanently is not an optimal usage of
+ zlib, so we don't care about this pathological case.)
+ */
+ n = s->hash_size;
+ p = &s->head[n];
+ do {
+ m = *--p;
+ *p = (Pos)(m >= wsize ? m-wsize : NIL);
+ } while (--n);
+
+ n = wsize;
+#ifndef FASTEST
+ p = &s->prev[n];
+ do {
+ m = *--p;
+ *p = (Pos)(m >= wsize ? m-wsize : NIL);
+ /* If n is not on any hash chain, prev[n] is garbage but
+ * its value will never be used.
+ */
+ } while (--n);
+#endif
+ more += wsize;
+ }
+ if (s->strm->avail_in == 0) return;
+
+ /* If there was no sliding:
+ * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
+ * more == window_size - lookahead - strstart
+ * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
+ * => more >= window_size - 2*WSIZE + 2
+ * In the BIG_MEM or MMAP case (not yet supported),
+ * window_size == input_size + MIN_LOOKAHEAD &&
+ * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
+ * Otherwise, window_size == 2*WSIZE so more >= 2.
+ * If there was sliding, more >= WSIZE. So in all cases, more >= 2.
+ */
+ Assert(more >= 2, "more < 2");
+
+ n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
+ s->lookahead += n;
+
+ /* Initialize the hash value now that we have some input: */
+ if (s->lookahead >= MIN_MATCH) {
+ s->ins_h = s->window[s->strstart];
+ UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
+#if MIN_MATCH != 3
+ Call UPDATE_HASH() MIN_MATCH-3 more times
+#endif
+ }
+ /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
+ * but this is not important since only literal bytes will be emitted.
+ */
+
+ } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
+}
+
+/* ===========================================================================
+ * Flush the current block, with given end-of-file flag.
+ * IN assertion: strstart is set to the end of the current match.
+ */
+#define FLUSH_BLOCK_ONLY(s, eof) { \
+ _tr_flush_block(s, (s->block_start >= 0L ? \
+ (charf *)&s->window[(unsigned)s->block_start] : \
+ (charf *)Z_NULL), \
+ (ulg)((long)s->strstart - s->block_start), \
+ (eof)); \
+ s->block_start = s->strstart; \
+ flush_pending(s->strm); \
+ Tracev((stderr,"[FLUSH]")); \
+}
+
+/* Same but force premature exit if necessary. */
+#define FLUSH_BLOCK(s, eof) { \
+ FLUSH_BLOCK_ONLY(s, eof); \
+ if (s->strm->avail_out == 0) return (eof) ? finish_started : need_more; \
+}
+
+/* ===========================================================================
+ * Copy without compression as much as possible from the input stream, return
+ * the current block state.
+ * This function does not insert new strings in the dictionary since
+ * uncompressible data is probably not useful. This function is used
+ * only for the level=0 compression option.
+ * NOTE: this function should be optimized to avoid extra copying from
+ * window to pending_buf.
+ */
+local block_state deflate_stored(s, flush)
+ deflate_state *s;
+ int flush;
+{
+ /* Stored blocks are limited to 0xffff bytes, pending_buf is limited
+ * to pending_buf_size, and each stored block has a 5 byte header:
+ */
+ ulg max_block_size = 0xffff;
+ ulg max_start;
+
+ if (max_block_size > s->pending_buf_size - 5) {
+ max_block_size = s->pending_buf_size - 5;
+ }
+
+ /* Copy as much as possible from input to output: */
+ for (;;) {
+ /* Fill the window as much as possible: */
+ if (s->lookahead <= 1) {
+
+ Assert(s->strstart < s->w_size+MAX_DIST(s) ||
+ s->block_start >= (long)s->w_size, "slide too late");
+
+ fill_window(s);
+ if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more;
+
+ if (s->lookahead == 0) break; /* flush the current block */
+ }
+ Assert(s->block_start >= 0L, "block gone");
+
+ s->strstart += s->lookahead;
+ s->lookahead = 0;
+
+ /* Emit a stored block if pending_buf will be full: */
+ max_start = s->block_start + max_block_size;
+ if (s->strstart == 0 || (ulg)s->strstart >= max_start) {
+ /* strstart == 0 is possible when wraparound on 16-bit machine */
+ s->lookahead = (uInt)(s->strstart - max_start);
+ s->strstart = (uInt)max_start;
+ FLUSH_BLOCK(s, 0);
+ }
+ /* Flush if we may have to slide, otherwise block_start may become
+ * negative and the data will be gone:
+ */
+ if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) {
+ FLUSH_BLOCK(s, 0);
+ }
+ }
+ FLUSH_BLOCK(s, flush == Z_FINISH);
+ return flush == Z_FINISH ? finish_done : block_done;
+}
+
+/* ===========================================================================
+ * Compress as much as possible from the input stream, return the current
+ * block state.
+ * This function does not perform lazy evaluation of matches and inserts
+ * new strings in the dictionary only for unmatched strings or for short
+ * matches. It is used only for the fast compression options.
+ */
+local block_state deflate_fast(s, flush)
+ deflate_state *s;
+ int flush;
+{
+ IPos hash_head = NIL; /* head of the hash chain */
+ int bflush; /* set if current block must be flushed */
+
+ for (;;) {
+ /* Make sure that we always have enough lookahead, except
+ * at the end of the input file. We need MAX_MATCH bytes
+ * for the next match, plus MIN_MATCH bytes to insert the
+ * string following the next match.
+ */
+ if (s->lookahead < MIN_LOOKAHEAD) {
+ fill_window(s);
+ if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
+ return need_more;
+ }
+ if (s->lookahead == 0) break; /* flush the current block */
+ }
+
+ /* Insert the string window[strstart .. strstart+2] in the
+ * dictionary, and set hash_head to the head of the hash chain:
+ */
+ if (s->lookahead >= MIN_MATCH) {
+ INSERT_STRING(s, s->strstart, hash_head);
+ }
+
+ /* Find the longest match, discarding those <= prev_length.
+ * At this point we have always match_length < MIN_MATCH
+ */
+ if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) {
+ /* To simplify the code, we prevent matches with the string
+ * of window index 0 (in particular we have to avoid a match
+ * of the string with itself at the start of the input file).
+ */
+ if (s->strategy != Z_HUFFMAN_ONLY) {
+ s->match_length = longest_match (s, hash_head);
+ }
+ /* longest_match() sets match_start */
+ }
+ if (s->match_length >= MIN_MATCH) {
+ check_match(s, s->strstart, s->match_start, s->match_length);
+
+ _tr_tally_dist(s, s->strstart - s->match_start,
+ s->match_length - MIN_MATCH, bflush);
+
+ s->lookahead -= s->match_length;
+
+ /* Insert new strings in the hash table only if the match length
+ * is not too large. This saves time but degrades compression.
+ */
+#ifndef FASTEST
+ if (s->match_length <= s->max_insert_length &&
+ s->lookahead >= MIN_MATCH) {
+ s->match_length--; /* string at strstart already in hash table */
+ do {
+ s->strstart++;
+ INSERT_STRING(s, s->strstart, hash_head);
+ /* strstart never exceeds WSIZE-MAX_MATCH, so there are
+ * always MIN_MATCH bytes ahead.
+ */
+ } while (--s->match_length != 0);
+ s->strstart++;
+ } else
+#endif
+ {
+ s->strstart += s->match_length;
+ s->match_length = 0;
+ s->ins_h = s->window[s->strstart];
+ UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
+#if MIN_MATCH != 3
+ Call UPDATE_HASH() MIN_MATCH-3 more times
+#endif
+ /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not
+ * matter since it will be recomputed at next deflate call.
+ */
+ }
+ } else {
+ /* No match, output a literal byte */
+ Tracevv((stderr,"%c", s->window[s->strstart]));
+ _tr_tally_lit (s, s->window[s->strstart], bflush);
+ s->lookahead--;
+ s->strstart++;
+ }
+ if (bflush) FLUSH_BLOCK(s, 0);
+ }
+ FLUSH_BLOCK(s, flush == Z_FINISH);
+ return flush == Z_FINISH ? finish_done : block_done;
+}
+
+/* ===========================================================================
+ * Same as above, but achieves better compression. We use a lazy
+ * evaluation for matches: a match is finally adopted only if there is
+ * no better match at the next window position.
+ */
+local block_state deflate_slow(s, flush)
+ deflate_state *s;
+ int flush;
+{
+ IPos hash_head = NIL; /* head of hash chain */
+ int bflush; /* set if current block must be flushed */
+
+ /* Process the input block. */
+ for (;;) {
+ /* Make sure that we always have enough lookahead, except
+ * at the end of the input file. We need MAX_MATCH bytes
+ * for the next match, plus MIN_MATCH bytes to insert the
+ * string following the next match.
+ */
+ if (s->lookahead < MIN_LOOKAHEAD) {
+ fill_window(s);
+ if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
+ return need_more;
+ }
+ if (s->lookahead == 0) break; /* flush the current block */
+ }
+
+ /* Insert the string window[strstart .. strstart+2] in the
+ * dictionary, and set hash_head to the head of the hash chain:
+ */
+ if (s->lookahead >= MIN_MATCH) {
+ INSERT_STRING(s, s->strstart, hash_head);
+ }
+
+ /* Find the longest match, discarding those <= prev_length.
+ */
+ s->prev_length = s->match_length, s->prev_match = s->match_start;
+ s->match_length = MIN_MATCH-1;
+
+ if (hash_head != NIL && s->prev_length < s->max_lazy_match &&
+ s->strstart - hash_head <= MAX_DIST(s)) {
+ /* To simplify the code, we prevent matches with the string
+ * of window index 0 (in particular we have to avoid a match
+ * of the string with itself at the start of the input file).
+ */
+ if (s->strategy != Z_HUFFMAN_ONLY) {
+ s->match_length = longest_match (s, hash_head);
+ }
+ /* longest_match() sets match_start */
+
+ if (s->match_length <= 5 && (s->strategy == Z_FILTERED ||
+ (s->match_length == MIN_MATCH &&
+ s->strstart - s->match_start > TOO_FAR))) {
+
+ /* If prev_match is also MIN_MATCH, match_start is garbage
+ * but we will ignore the current match anyway.
+ */
+ s->match_length = MIN_MATCH-1;
+ }
+ }
+ /* If there was a match at the previous step and the current
+ * match is not better, output the previous match:
+ */
+ if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) {
+ uInt max_insert = s->strstart + s->lookahead - MIN_MATCH;
+ /* Do not insert strings in hash table beyond this. */
+
+ check_match(s, s->strstart-1, s->prev_match, s->prev_length);
+
+ _tr_tally_dist(s, s->strstart -1 - s->prev_match,
+ s->prev_length - MIN_MATCH, bflush);
+
+ /* Insert in hash table all strings up to the end of the match.
+ * strstart-1 and strstart are already inserted. If there is not
+ * enough lookahead, the last two strings are not inserted in
+ * the hash table.
+ */
+ s->lookahead -= s->prev_length-1;
+ s->prev_length -= 2;
+ do {
+ if (++s->strstart <= max_insert) {
+ INSERT_STRING(s, s->strstart, hash_head);
+ }
+ } while (--s->prev_length != 0);
+ s->match_available = 0;
+ s->match_length = MIN_MATCH-1;
+ s->strstart++;
+
+ if (bflush) FLUSH_BLOCK(s, 0);
+
+ } else if (s->match_available) {
+ /* If there was no match at the previous position, output a
+ * single literal. If there was a match but the current match
+ * is longer, truncate the previous match to a single literal.
+ */
+ Tracevv((stderr,"%c", s->window[s->strstart-1]));
+ _tr_tally_lit(s, s->window[s->strstart-1], bflush);
+ if (bflush) {
+ FLUSH_BLOCK_ONLY(s, 0);
+ }
+ s->strstart++;
+ s->lookahead--;
+ if (s->strm->avail_out == 0) return need_more;
+ } else {
+ /* There is no previous match to compare with, wait for
+ * the next step to decide.
+ */
+ s->match_available = 1;
+ s->strstart++;
+ s->lookahead--;
+ }
+ }
+ Assert (flush != Z_NO_FLUSH, "no flush?");
+ if (s->match_available) {
+ Tracevv((stderr,"%c", s->window[s->strstart-1]));
+ _tr_tally_lit(s, s->window[s->strstart-1], bflush);
+ s->match_available = 0;
+ }
+ FLUSH_BLOCK(s, flush == Z_FINISH);
+ return flush == Z_FINISH ? finish_done : block_done;
+}
diff --git a/win32/contrib/zlib/deflate.h b/win32/contrib/zlib/deflate.h new file mode 100644 index 000000000..d84e05954 --- /dev/null +++ b/win32/contrib/zlib/deflate.h @@ -0,0 +1,318 @@ +/* deflate.h -- internal compression state
+ * Copyright (C) 1995-1998 Jean-loup Gailly
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+ part of the implementation of the compression library and is
+ subject to change. Applications should only use zlib.h.
+ */
+
+/* @(#) $Id: deflate.h,v 1.1 2003/04/20 16:42:09 guenter Exp $ */
+
+#ifndef _DEFLATE_H
+#define _DEFLATE_H
+
+#include "zutil.h"
+
+/* ===========================================================================
+ * Internal compression state.
+ */
+
+#define LENGTH_CODES 29
+/* number of length codes, not counting the special END_BLOCK code */
+
+#define LITERALS 256
+/* number of literal bytes 0..255 */
+
+#define L_CODES (LITERALS+1+LENGTH_CODES)
+/* number of Literal or Length codes, including the END_BLOCK code */
+
+#define D_CODES 30
+/* number of distance codes */
+
+#define BL_CODES 19
+/* number of codes used to transfer the bit lengths */
+
+#define HEAP_SIZE (2*L_CODES+1)
+/* maximum heap size */
+
+#define MAX_BITS 15
+/* All codes must not exceed MAX_BITS bits */
+
+#define INIT_STATE 42
+#define BUSY_STATE 113
+#define FINISH_STATE 666
+/* Stream status */
+
+
+/* Data structure describing a single value and its code string. */
+typedef struct ct_data_s {
+ union {
+ ush freq; /* frequency count */
+ ush code; /* bit string */
+ } fc;
+ union {
+ ush dad; /* father node in Huffman tree */
+ ush len; /* length of bit string */
+ } dl;
+} FAR ct_data;
+
+#define Freq fc.freq
+#define Code fc.code
+#define Dad dl.dad
+#define Len dl.len
+
+typedef struct static_tree_desc_s static_tree_desc;
+
+typedef struct tree_desc_s {
+ ct_data *dyn_tree; /* the dynamic tree */
+ int max_code; /* largest code with non zero frequency */
+ static_tree_desc *stat_desc; /* the corresponding static tree */
+} FAR tree_desc;
+
+typedef ush Pos;
+typedef Pos FAR Posf;
+typedef unsigned IPos;
+
+/* A Pos is an index in the character window. We use short instead of int to
+ * save space in the various tables. IPos is used only for parameter passing.
+ */
+
+typedef struct internal_state {
+ z_streamp strm; /* pointer back to this zlib stream */
+ int status; /* as the name implies */
+ Bytef *pending_buf; /* output still pending */
+ ulg pending_buf_size; /* size of pending_buf */
+ Bytef *pending_out; /* next pending byte to output to the stream */
+ int pending; /* nb of bytes in the pending buffer */
+ int noheader; /* suppress zlib header and adler32 */
+ Byte data_type; /* UNKNOWN, BINARY or ASCII */
+ Byte method; /* STORED (for zip only) or DEFLATED */
+ int last_flush; /* value of flush param for previous deflate call */
+
+ /* used by deflate.c: */
+
+ uInt w_size; /* LZ77 window size (32K by default) */
+ uInt w_bits; /* log2(w_size) (8..16) */
+ uInt w_mask; /* w_size - 1 */
+
+ Bytef *window;
+ /* Sliding window. Input bytes are read into the second half of the window,
+ * and move to the first half later to keep a dictionary of at least wSize
+ * bytes. With this organization, matches are limited to a distance of
+ * wSize-MAX_MATCH bytes, but this ensures that IO is always
+ * performed with a length multiple of the block size. Also, it limits
+ * the window size to 64K, which is quite useful on MSDOS.
+ * To do: use the user input buffer as sliding window.
+ */
+
+ ulg window_size;
+ /* Actual size of window: 2*wSize, except when the user input buffer
+ * is directly used as sliding window.
+ */
+
+ Posf *prev;
+ /* Link to older string with same hash index. To limit the size of this
+ * array to 64K, this link is maintained only for the last 32K strings.
+ * An index in this array is thus a window index modulo 32K.
+ */
+
+ Posf *head; /* Heads of the hash chains or NIL. */
+
+ uInt ins_h; /* hash index of string to be inserted */
+ uInt hash_size; /* number of elements in hash table */
+ uInt hash_bits; /* log2(hash_size) */
+ uInt hash_mask; /* hash_size-1 */
+
+ uInt hash_shift;
+ /* Number of bits by which ins_h must be shifted at each input
+ * step. It must be such that after MIN_MATCH steps, the oldest
+ * byte no longer takes part in the hash key, that is:
+ * hash_shift * MIN_MATCH >= hash_bits
+ */
+
+ long block_start;
+ /* Window position at the beginning of the current output block. Gets
+ * negative when the window is moved backwards.
+ */
+
+ uInt match_length; /* length of best match */
+ IPos prev_match; /* previous match */
+ int match_available; /* set if previous match exists */
+ uInt strstart; /* start of string to insert */
+ uInt match_start; /* start of matching string */
+ uInt lookahead; /* number of valid bytes ahead in window */
+
+ uInt prev_length;
+ /* Length of the best match at previous step. Matches not greater than this
+ * are discarded. This is used in the lazy match evaluation.
+ */
+
+ uInt max_chain_length;
+ /* To speed up deflation, hash chains are never searched beyond this
+ * length. A higher limit improves compression ratio but degrades the
+ * speed.
+ */
+
+ uInt max_lazy_match;
+ /* Attempt to find a better match only when the current match is strictly
+ * smaller than this value. This mechanism is used only for compression
+ * levels >= 4.
+ */
+# define max_insert_length max_lazy_match
+ /* Insert new strings in the hash table only if the match length is not
+ * greater than this length. This saves time but degrades compression.
+ * max_insert_length is used only for compression levels <= 3.
+ */
+
+ int level; /* compression level (1..9) */
+ int strategy; /* favor or force Huffman coding*/
+
+ uInt good_match;
+ /* Use a faster search when the previous match is longer than this */
+
+ int nice_match; /* Stop searching when current match exceeds this */
+
+ /* used by trees.c: */
+ /* Didn't use ct_data typedef below to supress compiler warning */
+ struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */
+ struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
+ struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */
+
+ struct tree_desc_s l_desc; /* desc. for literal tree */
+ struct tree_desc_s d_desc; /* desc. for distance tree */
+ struct tree_desc_s bl_desc; /* desc. for bit length tree */
+
+ ush bl_count[MAX_BITS+1];
+ /* number of codes at each bit length for an optimal tree */
+
+ int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */
+ int heap_len; /* number of elements in the heap */
+ int heap_max; /* element of largest frequency */
+ /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
+ * The same heap array is used to build all trees.
+ */
+
+ uch depth[2*L_CODES+1];
+ /* Depth of each subtree used as tie breaker for trees of equal frequency
+ */
+
+ uchf *l_buf; /* buffer for literals or lengths */
+
+ uInt lit_bufsize;
+ /* Size of match buffer for literals/lengths. There are 4 reasons for
+ * limiting lit_bufsize to 64K:
+ * - frequencies can be kept in 16 bit counters
+ * - if compression is not successful for the first block, all input
+ * data is still in the window so we can still emit a stored block even
+ * when input comes from standard input. (This can also be done for
+ * all blocks if lit_bufsize is not greater than 32K.)
+ * - if compression is not successful for a file smaller than 64K, we can
+ * even emit a stored file instead of a stored block (saving 5 bytes).
+ * This is applicable only for zip (not gzip or zlib).
+ * - creating new Huffman trees less frequently may not provide fast
+ * adaptation to changes in the input data statistics. (Take for
+ * example a binary file with poorly compressible code followed by
+ * a highly compressible string table.) Smaller buffer sizes give
+ * fast adaptation but have of course the overhead of transmitting
+ * trees more frequently.
+ * - I can't count above 4
+ */
+
+ uInt last_lit; /* running index in l_buf */
+
+ ushf *d_buf;
+ /* Buffer for distances. To simplify the code, d_buf and l_buf have
+ * the same number of elements. To use different lengths, an extra flag
+ * array would be necessary.
+ */
+
+ ulg opt_len; /* bit length of current block with optimal trees */
+ ulg static_len; /* bit length of current block with static trees */
+ uInt matches; /* number of string matches in current block */
+ int last_eob_len; /* bit length of EOB code for last block */
+
+#ifdef DEBUG
+ ulg compressed_len; /* total bit length of compressed file mod 2^32 */
+ ulg bits_sent; /* bit length of compressed data sent mod 2^32 */
+#endif
+
+ ush bi_buf;
+ /* Output buffer. bits are inserted starting at the bottom (least
+ * significant bits).
+ */
+ int bi_valid;
+ /* Number of valid bits in bi_buf. All bits above the last valid bit
+ * are always zero.
+ */
+
+} FAR deflate_state;
+
+/* Output a byte on the stream.
+ * IN assertion: there is enough room in pending_buf.
+ */
+#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);}
+
+
+#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
+/* Minimum amount of lookahead, except at the end of the input file.
+ * See deflate.c for comments about the MIN_MATCH+1.
+ */
+
+#define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD)
+/* In order to simplify the code, particularly on 16 bit machines, match
+ * distances are limited to MAX_DIST instead of WSIZE.
+ */
+
+ /* in trees.c */
+void _tr_init OF((deflate_state *s));
+int _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc));
+void _tr_flush_block OF((deflate_state *s, charf *buf, ulg stored_len,
+ int eof));
+void _tr_align OF((deflate_state *s));
+void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len,
+ int eof));
+
+#define d_code(dist) \
+ ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
+/* Mapping from a distance to a distance code. dist is the distance - 1 and
+ * must not have side effects. _dist_code[256] and _dist_code[257] are never
+ * used.
+ */
+
+#ifndef DEBUG
+/* Inline versions of _tr_tally for speed: */
+
+#if defined(GEN_TREES_H) || !defined(STDC)
+ extern uch _length_code[];
+ extern uch _dist_code[];
+#else
+ extern const uch _length_code[];
+ extern const uch _dist_code[];
+#endif
+
+# define _tr_tally_lit(s, c, flush) \
+ { uch cc = (c); \
+ s->d_buf[s->last_lit] = 0; \
+ s->l_buf[s->last_lit++] = cc; \
+ s->dyn_ltree[cc].Freq++; \
+ flush = (s->last_lit == s->lit_bufsize-1); \
+ }
+# define _tr_tally_dist(s, distance, length, flush) \
+ { uch len = (length); \
+ ush dist = (distance); \
+ s->d_buf[s->last_lit] = dist; \
+ s->l_buf[s->last_lit++] = len; \
+ dist--; \
+ s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
+ s->dyn_dtree[d_code(dist)].Freq++; \
+ flush = (s->last_lit == s->lit_bufsize-1); \
+ }
+#else
+# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
+# define _tr_tally_dist(s, distance, length, flush) \
+ flush = _tr_tally(s, distance, length)
+#endif
+
+#endif
diff --git a/win32/contrib/zlib/descrip.mms b/win32/contrib/zlib/descrip.mms new file mode 100644 index 000000000..d06e0c7e9 --- /dev/null +++ b/win32/contrib/zlib/descrip.mms @@ -0,0 +1,48 @@ +# descrip.mms: MMS description file for building zlib on VMS
+# written by Martin P.J. Zinser <m.zinser@gsi.de>
+
+cc_defs =
+c_deb =
+
+.ifdef __DECC__
+pref = /prefix=all
+.endif
+
+OBJS = adler32.obj, compress.obj, crc32.obj, gzio.obj, uncompr.obj,\
+ deflate.obj, trees.obj, zutil.obj, inflate.obj, infblock.obj,\
+ inftrees.obj, infcodes.obj, infutil.obj, inffast.obj
+
+CFLAGS= $(C_DEB) $(CC_DEFS) $(PREF)
+
+all : example.exe minigzip.exe
+ @ write sys$output " Example applications available"
+libz.olb : libz.olb($(OBJS))
+ @ write sys$output " libz available"
+
+example.exe : example.obj libz.olb
+ link example,libz.olb/lib
+
+minigzip.exe : minigzip.obj libz.olb
+ link minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib
+
+clean :
+ delete *.obj;*,libz.olb;*
+
+
+# Other dependencies.
+adler32.obj : zutil.h zlib.h zconf.h
+compress.obj : zlib.h zconf.h
+crc32.obj : zutil.h zlib.h zconf.h
+deflate.obj : deflate.h zutil.h zlib.h zconf.h
+example.obj : zlib.h zconf.h
+gzio.obj : zutil.h zlib.h zconf.h
+infblock.obj : zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h
+infcodes.obj : zutil.h zlib.h zconf.h inftrees.h infutil.h infcodes.h inffast.h
+inffast.obj : zutil.h zlib.h zconf.h inftrees.h infutil.h inffast.h
+inflate.obj : zutil.h zlib.h zconf.h infblock.h
+inftrees.obj : zutil.h zlib.h zconf.h inftrees.h
+infutil.obj : zutil.h zlib.h zconf.h inftrees.h infutil.h
+minigzip.obj : zlib.h zconf.h
+trees.obj : deflate.h zutil.h zlib.h zconf.h
+uncompr.obj : zlib.h zconf.h
+zutil.obj : zutil.h zlib.h zconf.h
diff --git a/win32/contrib/zlib/example.c b/win32/contrib/zlib/example.c new file mode 100644 index 000000000..4d6e0e22d --- /dev/null +++ b/win32/contrib/zlib/example.c @@ -0,0 +1,556 @@ +/* example.c -- usage example of the zlib compression library
+ * Copyright (C) 1995-1998 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* @(#) $Id: example.c,v 1.1 2003/04/20 16:42:09 guenter Exp $ */
+
+#include <stdio.h>
+#include "zlib.h"
+
+#ifdef STDC
+# include <string.h>
+# include <stdlib.h>
+#else
+ extern void exit OF((int));
+#endif
+
+#if defined(VMS) || defined(RISCOS)
+# define TESTFILE "foo-gz"
+#else
+# define TESTFILE "foo.gz"
+#endif
+
+#define CHECK_ERR(err, msg) { \
+ if (err != Z_OK) { \
+ fprintf(stderr, "%s error: %d\n", msg, err); \
+ exit(1); \
+ } \
+}
+
+const char hello[] = "hello, hello!";
+/* "hello world" would be more standard, but the repeated "hello"
+ * stresses the compression code better, sorry...
+ */
+
+const char dictionary[] = "hello";
+uLong dictId; /* Adler32 value of the dictionary */
+
+void test_compress OF((Byte *compr, uLong comprLen,
+ Byte *uncompr, uLong uncomprLen));
+void test_gzio OF((const char *out, const char *in,
+ Byte *uncompr, int uncomprLen));
+void test_deflate OF((Byte *compr, uLong comprLen));
+void test_inflate OF((Byte *compr, uLong comprLen,
+ Byte *uncompr, uLong uncomprLen));
+void test_large_deflate OF((Byte *compr, uLong comprLen,
+ Byte *uncompr, uLong uncomprLen));
+void test_large_inflate OF((Byte *compr, uLong comprLen,
+ Byte *uncompr, uLong uncomprLen));
+void test_flush OF((Byte *compr, uLong *comprLen));
+void test_sync OF((Byte *compr, uLong comprLen,
+ Byte *uncompr, uLong uncomprLen));
+void test_dict_deflate OF((Byte *compr, uLong comprLen));
+void test_dict_inflate OF((Byte *compr, uLong comprLen,
+ Byte *uncompr, uLong uncomprLen));
+int main OF((int argc, char *argv[]));
+
+/* ===========================================================================
+ * Test compress() and uncompress()
+ */
+void test_compress(compr, comprLen, uncompr, uncomprLen)
+ Byte *compr, *uncompr;
+ uLong comprLen, uncomprLen;
+{
+ int err;
+ uLong len = strlen(hello)+1;
+
+ err = compress(compr, &comprLen, (const Bytef*)hello, len);
+ CHECK_ERR(err, "compress");
+
+ strcpy((char*)uncompr, "garbage");
+
+ err = uncompress(uncompr, &uncomprLen, compr, comprLen);
+ CHECK_ERR(err, "uncompress");
+
+ if (strcmp((char*)uncompr, hello)) {
+ fprintf(stderr, "bad uncompress\n");
+ exit(1);
+ } else {
+ printf("uncompress(): %s\n", (char *)uncompr);
+ }
+}
+
+/* ===========================================================================
+ * Test read/write of .gz files
+ */
+void test_gzio(out, in, uncompr, uncomprLen)
+ const char *out; /* compressed output file */
+ const char *in; /* compressed input file */
+ Byte *uncompr;
+ int uncomprLen;
+{
+ int err;
+ int len = strlen(hello)+1;
+ gzFile file;
+ z_off_t pos;
+
+ file = gzopen(out, "wb");
+ if (file == NULL) {
+ fprintf(stderr, "gzopen error\n");
+ exit(1);
+ }
+ gzputc(file, 'h');
+ if (gzputs(file, "ello") != 4) {
+ fprintf(stderr, "gzputs err: %s\n", gzerror(file, &err));
+ exit(1);
+ }
+ if (gzprintf(file, ", %s!", "hello") != 8) {
+ fprintf(stderr, "gzprintf err: %s\n", gzerror(file, &err));
+ exit(1);
+ }
+ gzseek(file, 1L, SEEK_CUR); /* add one zero byte */
+ gzclose(file);
+
+ file = gzopen(in, "rb");
+ if (file == NULL) {
+ fprintf(stderr, "gzopen error\n");
+ }
+ strcpy((char*)uncompr, "garbage");
+
+ uncomprLen = gzread(file, uncompr, (unsigned)uncomprLen);
+ if (uncomprLen != len) {
+ fprintf(stderr, "gzread err: %s\n", gzerror(file, &err));
+ exit(1);
+ }
+ if (strcmp((char*)uncompr, hello)) {
+ fprintf(stderr, "bad gzread: %s\n", (char*)uncompr);
+ exit(1);
+ } else {
+ printf("gzread(): %s\n", (char *)uncompr);
+ }
+
+ pos = gzseek(file, -8L, SEEK_CUR);
+ if (pos != 6 || gztell(file) != pos) {
+ fprintf(stderr, "gzseek error, pos=%ld, gztell=%ld\n",
+ (long)pos, (long)gztell(file));
+ exit(1);
+ }
+
+ if (gzgetc(file) != ' ') {
+ fprintf(stderr, "gzgetc error\n");
+ exit(1);
+ }
+
+ gzgets(file, (char*)uncompr, uncomprLen);
+ uncomprLen = strlen((char*)uncompr);
+ if (uncomprLen != 6) { /* "hello!" */
+ fprintf(stderr, "gzgets err after gzseek: %s\n", gzerror(file, &err));
+ exit(1);
+ }
+ if (strcmp((char*)uncompr, hello+7)) {
+ fprintf(stderr, "bad gzgets after gzseek\n");
+ exit(1);
+ } else {
+ printf("gzgets() after gzseek: %s\n", (char *)uncompr);
+ }
+
+ gzclose(file);
+}
+
+/* ===========================================================================
+ * Test deflate() with small buffers
+ */
+void test_deflate(compr, comprLen)
+ Byte *compr;
+ uLong comprLen;
+{
+ z_stream c_stream; /* compression stream */
+ int err;
+ int len = strlen(hello)+1;
+
+ c_stream.zalloc = (alloc_func)0;
+ c_stream.zfree = (free_func)0;
+ c_stream.opaque = (voidpf)0;
+
+ err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION);
+ CHECK_ERR(err, "deflateInit");
+
+ c_stream.next_in = (Bytef*)hello;
+ c_stream.next_out = compr;
+
+ while (c_stream.total_in != (uLong)len && c_stream.total_out < comprLen) {
+ c_stream.avail_in = c_stream.avail_out = 1; /* force small buffers */
+ err = deflate(&c_stream, Z_NO_FLUSH);
+ CHECK_ERR(err, "deflate");
+ }
+ /* Finish the stream, still forcing small buffers: */
+ for (;;) {
+ c_stream.avail_out = 1;
+ err = deflate(&c_stream, Z_FINISH);
+ if (err == Z_STREAM_END) break;
+ CHECK_ERR(err, "deflate");
+ }
+
+ err = deflateEnd(&c_stream);
+ CHECK_ERR(err, "deflateEnd");
+}
+
+/* ===========================================================================
+ * Test inflate() with small buffers
+ */
+void test_inflate(compr, comprLen, uncompr, uncomprLen)
+ Byte *compr, *uncompr;
+ uLong comprLen, uncomprLen;
+{
+ int err;
+ z_stream d_stream; /* decompression stream */
+
+ strcpy((char*)uncompr, "garbage");
+
+ d_stream.zalloc = (alloc_func)0;
+ d_stream.zfree = (free_func)0;
+ d_stream.opaque = (voidpf)0;
+
+ d_stream.next_in = compr;
+ d_stream.avail_in = 0;
+ d_stream.next_out = uncompr;
+
+ err = inflateInit(&d_stream);
+ CHECK_ERR(err, "inflateInit");
+
+ while (d_stream.total_out < uncomprLen && d_stream.total_in < comprLen) {
+ d_stream.avail_in = d_stream.avail_out = 1; /* force small buffers */
+ err = inflate(&d_stream, Z_NO_FLUSH);
+ if (err == Z_STREAM_END) break;
+ CHECK_ERR(err, "inflate");
+ }
+
+ err = inflateEnd(&d_stream);
+ CHECK_ERR(err, "inflateEnd");
+
+ if (strcmp((char*)uncompr, hello)) {
+ fprintf(stderr, "bad inflate\n");
+ exit(1);
+ } else {
+ printf("inflate(): %s\n", (char *)uncompr);
+ }
+}
+
+/* ===========================================================================
+ * Test deflate() with large buffers and dynamic change of compression level
+ */
+void test_large_deflate(compr, comprLen, uncompr, uncomprLen)
+ Byte *compr, *uncompr;
+ uLong comprLen, uncomprLen;
+{
+ z_stream c_stream; /* compression stream */
+ int err;
+
+ c_stream.zalloc = (alloc_func)0;
+ c_stream.zfree = (free_func)0;
+ c_stream.opaque = (voidpf)0;
+
+ err = deflateInit(&c_stream, Z_BEST_SPEED);
+ CHECK_ERR(err, "deflateInit");
+
+ c_stream.next_out = compr;
+ c_stream.avail_out = (uInt)comprLen;
+
+ /* At this point, uncompr is still mostly zeroes, so it should compress
+ * very well:
+ */
+ c_stream.next_in = uncompr;
+ c_stream.avail_in = (uInt)uncomprLen;
+ err = deflate(&c_stream, Z_NO_FLUSH);
+ CHECK_ERR(err, "deflate");
+ if (c_stream.avail_in != 0) {
+ fprintf(stderr, "deflate not greedy\n");
+ exit(1);
+ }
+
+ /* Feed in already compressed data and switch to no compression: */
+ deflateParams(&c_stream, Z_NO_COMPRESSION, Z_DEFAULT_STRATEGY);
+ c_stream.next_in = compr;
+ c_stream.avail_in = (uInt)comprLen/2;
+ err = deflate(&c_stream, Z_NO_FLUSH);
+ CHECK_ERR(err, "deflate");
+
+ /* Switch back to compressing mode: */
+ deflateParams(&c_stream, Z_BEST_COMPRESSION, Z_FILTERED);
+ c_stream.next_in = uncompr;
+ c_stream.avail_in = (uInt)uncomprLen;
+ err = deflate(&c_stream, Z_NO_FLUSH);
+ CHECK_ERR(err, "deflate");
+
+ err = deflate(&c_stream, Z_FINISH);
+ if (err != Z_STREAM_END) {
+ fprintf(stderr, "deflate should report Z_STREAM_END\n");
+ exit(1);
+ }
+ err = deflateEnd(&c_stream);
+ CHECK_ERR(err, "deflateEnd");
+}
+
+/* ===========================================================================
+ * Test inflate() with large buffers
+ */
+void test_large_inflate(compr, comprLen, uncompr, uncomprLen)
+ Byte *compr, *uncompr;
+ uLong comprLen, uncomprLen;
+{
+ int err;
+ z_stream d_stream; /* decompression stream */
+
+ strcpy((char*)uncompr, "garbage");
+
+ d_stream.zalloc = (alloc_func)0;
+ d_stream.zfree = (free_func)0;
+ d_stream.opaque = (voidpf)0;
+
+ d_stream.next_in = compr;
+ d_stream.avail_in = (uInt)comprLen;
+
+ err = inflateInit(&d_stream);
+ CHECK_ERR(err, "inflateInit");
+
+ for (;;) {
+ d_stream.next_out = uncompr; /* discard the output */
+ d_stream.avail_out = (uInt)uncomprLen;
+ err = inflate(&d_stream, Z_NO_FLUSH);
+ if (err == Z_STREAM_END) break;
+ CHECK_ERR(err, "large inflate");
+ }
+
+ err = inflateEnd(&d_stream);
+ CHECK_ERR(err, "inflateEnd");
+
+ if (d_stream.total_out != 2*uncomprLen + comprLen/2) {
+ fprintf(stderr, "bad large inflate: %ld\n", d_stream.total_out);
+ exit(1);
+ } else {
+ printf("large_inflate(): OK\n");
+ }
+}
+
+/* ===========================================================================
+ * Test deflate() with full flush
+ */
+void test_flush(compr, comprLen)
+ Byte *compr;
+ uLong *comprLen;
+{
+ z_stream c_stream; /* compression stream */
+ int err;
+ int len = strlen(hello)+1;
+
+ c_stream.zalloc = (alloc_func)0;
+ c_stream.zfree = (free_func)0;
+ c_stream.opaque = (voidpf)0;
+
+ err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION);
+ CHECK_ERR(err, "deflateInit");
+
+ c_stream.next_in = (Bytef*)hello;
+ c_stream.next_out = compr;
+ c_stream.avail_in = 3;
+ c_stream.avail_out = (uInt)*comprLen;
+ err = deflate(&c_stream, Z_FULL_FLUSH);
+ CHECK_ERR(err, "deflate");
+
+ compr[3]++; /* force an error in first compressed block */
+ c_stream.avail_in = len - 3;
+
+ err = deflate(&c_stream, Z_FINISH);
+ if (err != Z_STREAM_END) {
+ CHECK_ERR(err, "deflate");
+ }
+ err = deflateEnd(&c_stream);
+ CHECK_ERR(err, "deflateEnd");
+
+ *comprLen = c_stream.total_out;
+}
+
+/* ===========================================================================
+ * Test inflateSync()
+ */
+void test_sync(compr, comprLen, uncompr, uncomprLen)
+ Byte *compr, *uncompr;
+ uLong comprLen, uncomprLen;
+{
+ int err;
+ z_stream d_stream; /* decompression stream */
+
+ strcpy((char*)uncompr, "garbage");
+
+ d_stream.zalloc = (alloc_func)0;
+ d_stream.zfree = (free_func)0;
+ d_stream.opaque = (voidpf)0;
+
+ d_stream.next_in = compr;
+ d_stream.avail_in = 2; /* just read the zlib header */
+
+ err = inflateInit(&d_stream);
+ CHECK_ERR(err, "inflateInit");
+
+ d_stream.next_out = uncompr;
+ d_stream.avail_out = (uInt)uncomprLen;
+
+ inflate(&d_stream, Z_NO_FLUSH);
+ CHECK_ERR(err, "inflate");
+
+ d_stream.avail_in = (uInt)comprLen-2; /* read all compressed data */
+ err = inflateSync(&d_stream); /* but skip the damaged part */
+ CHECK_ERR(err, "inflateSync");
+
+ err = inflate(&d_stream, Z_FINISH);
+ if (err != Z_DATA_ERROR) {
+ fprintf(stderr, "inflate should report DATA_ERROR\n");
+ /* Because of incorrect adler32 */
+ exit(1);
+ }
+ err = inflateEnd(&d_stream);
+ CHECK_ERR(err, "inflateEnd");
+
+ printf("after inflateSync(): hel%s\n", (char *)uncompr);
+}
+
+/* ===========================================================================
+ * Test deflate() with preset dictionary
+ */
+void test_dict_deflate(compr, comprLen)
+ Byte *compr;
+ uLong comprLen;
+{
+ z_stream c_stream; /* compression stream */
+ int err;
+
+ c_stream.zalloc = (alloc_func)0;
+ c_stream.zfree = (free_func)0;
+ c_stream.opaque = (voidpf)0;
+
+ err = deflateInit(&c_stream, Z_BEST_COMPRESSION);
+ CHECK_ERR(err, "deflateInit");
+
+ err = deflateSetDictionary(&c_stream,
+ (const Bytef*)dictionary, sizeof(dictionary));
+ CHECK_ERR(err, "deflateSetDictionary");
+
+ dictId = c_stream.adler;
+ c_stream.next_out = compr;
+ c_stream.avail_out = (uInt)comprLen;
+
+ c_stream.next_in = (Bytef*)hello;
+ c_stream.avail_in = (uInt)strlen(hello)+1;
+
+ err = deflate(&c_stream, Z_FINISH);
+ if (err != Z_STREAM_END) {
+ fprintf(stderr, "deflate should report Z_STREAM_END\n");
+ exit(1);
+ }
+ err = deflateEnd(&c_stream);
+ CHECK_ERR(err, "deflateEnd");
+}
+
+/* ===========================================================================
+ * Test inflate() with a preset dictionary
+ */
+void test_dict_inflate(compr, comprLen, uncompr, uncomprLen)
+ Byte *compr, *uncompr;
+ uLong comprLen, uncomprLen;
+{
+ int err;
+ z_stream d_stream; /* decompression stream */
+
+ strcpy((char*)uncompr, "garbage");
+
+ d_stream.zalloc = (alloc_func)0;
+ d_stream.zfree = (free_func)0;
+ d_stream.opaque = (voidpf)0;
+
+ d_stream.next_in = compr;
+ d_stream.avail_in = (uInt)comprLen;
+
+ err = inflateInit(&d_stream);
+ CHECK_ERR(err, "inflateInit");
+
+ d_stream.next_out = uncompr;
+ d_stream.avail_out = (uInt)uncomprLen;
+
+ for (;;) {
+ err = inflate(&d_stream, Z_NO_FLUSH);
+ if (err == Z_STREAM_END) break;
+ if (err == Z_NEED_DICT) {
+ if (d_stream.adler != dictId) {
+ fprintf(stderr, "unexpected dictionary");
+ exit(1);
+ }
+ err = inflateSetDictionary(&d_stream, (const Bytef*)dictionary,
+ sizeof(dictionary));
+ }
+ CHECK_ERR(err, "inflate with dict");
+ }
+
+ err = inflateEnd(&d_stream);
+ CHECK_ERR(err, "inflateEnd");
+
+ if (strcmp((char*)uncompr, hello)) {
+ fprintf(stderr, "bad inflate with dict\n");
+ exit(1);
+ } else {
+ printf("inflate with dictionary: %s\n", (char *)uncompr);
+ }
+}
+
+/* ===========================================================================
+ * Usage: example [output.gz [input.gz]]
+ */
+
+int main(argc, argv)
+ int argc;
+ char *argv[];
+{
+ Byte *compr, *uncompr;
+ uLong comprLen = 10000*sizeof(int); /* don't overflow on MSDOS */
+ uLong uncomprLen = comprLen;
+ static const char* myVersion = ZLIB_VERSION;
+
+ if (zlibVersion()[0] != myVersion[0]) {
+ fprintf(stderr, "incompatible zlib version\n");
+ exit(1);
+
+ } else if (strcmp(zlibVersion(), ZLIB_VERSION) != 0) {
+ fprintf(stderr, "warning: different zlib version\n");
+ }
+
+ compr = (Byte*)calloc((uInt)comprLen, 1);
+ uncompr = (Byte*)calloc((uInt)uncomprLen, 1);
+ /* compr and uncompr are cleared to avoid reading uninitialized
+ * data and to ensure that uncompr compresses well.
+ */
+ if (compr == Z_NULL || uncompr == Z_NULL) {
+ printf("out of memory\n");
+ exit(1);
+ }
+ test_compress(compr, comprLen, uncompr, uncomprLen);
+
+ test_gzio((argc > 1 ? argv[1] : TESTFILE),
+ (argc > 2 ? argv[2] : TESTFILE),
+ uncompr, (int)uncomprLen);
+
+ test_deflate(compr, comprLen);
+ test_inflate(compr, comprLen, uncompr, uncomprLen);
+
+ test_large_deflate(compr, comprLen, uncompr, uncomprLen);
+ test_large_inflate(compr, comprLen, uncompr, uncomprLen);
+
+ test_flush(compr, &comprLen);
+ test_sync(compr, comprLen, uncompr, uncomprLen);
+ comprLen = uncomprLen;
+
+ test_dict_deflate(compr, comprLen);
+ test_dict_inflate(compr, comprLen, uncompr, uncomprLen);
+
+ exit(0);
+ return 0; /* to avoid warning */
+}
diff --git a/win32/contrib/zlib/gzio.c b/win32/contrib/zlib/gzio.c new file mode 100644 index 000000000..155cb09a3 --- /dev/null +++ b/win32/contrib/zlib/gzio.c @@ -0,0 +1,875 @@ +/* gzio.c -- IO on .gz files
+ * Copyright (C) 1995-1998 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ *
+ * Compile this file with -DNO_DEFLATE to avoid the compression code.
+ */
+
+/* @(#) $Id: gzio.c,v 1.1 2003/04/20 16:42:09 guenter Exp $ */
+
+#include <stdio.h>
+
+#include "zutil.h"
+
+struct internal_state {int dummy;}; /* for buggy compilers */
+
+#ifndef Z_BUFSIZE
+# ifdef MAXSEG_64K
+# define Z_BUFSIZE 4096 /* minimize memory usage for 16-bit DOS */
+# else
+# define Z_BUFSIZE 16384
+# endif
+#endif
+#ifndef Z_PRINTF_BUFSIZE
+# define Z_PRINTF_BUFSIZE 4096
+#endif
+
+#define ALLOC(size) malloc(size)
+#define TRYFREE(p) {if (p) free(p);}
+
+static int gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */
+
+/* gzip flag byte */
+#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */
+#define HEAD_CRC 0x02 /* bit 1 set: header CRC present */
+#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */
+#define ORIG_NAME 0x08 /* bit 3 set: original file name present */
+#define COMMENT 0x10 /* bit 4 set: file comment present */
+#define RESERVED 0xE0 /* bits 5..7: reserved */
+
+typedef struct gz_stream {
+ z_stream stream;
+ int z_err; /* error code for last stream operation */
+ int z_eof; /* set if end of input file */
+ FILE *file; /* .gz file */
+ Byte *inbuf; /* input buffer */
+ Byte *outbuf; /* output buffer */
+ uLong crc; /* crc32 of uncompressed data */
+ char *msg; /* error message */
+ char *path; /* path name for debugging only */
+ int transparent; /* 1 if input file is not a .gz file */
+ char mode; /* 'w' or 'r' */
+ long startpos; /* start of compressed data in file (header skipped) */
+} gz_stream;
+
+
+local gzFile gz_open OF((const char *path, const char *mode, int fd));
+local int do_flush OF((gzFile file, int flush));
+local int get_byte OF((gz_stream *s));
+local void check_header OF((gz_stream *s));
+local int destroy OF((gz_stream *s));
+local void putLong OF((FILE *file, uLong x));
+local uLong getLong OF((gz_stream *s));
+
+/* ===========================================================================
+ Opens a gzip (.gz) file for reading or writing. The mode parameter
+ is as in fopen ("rb" or "wb"). The file is given either by file descriptor
+ or path name (if fd == -1).
+ gz_open return NULL if the file could not be opened or if there was
+ insufficient memory to allocate the (de)compression state; errno
+ can be checked to distinguish the two cases (if errno is zero, the
+ zlib error is Z_MEM_ERROR).
+*/
+local gzFile gz_open (path, mode, fd)
+ const char *path;
+ const char *mode;
+ int fd;
+{
+ int err;
+ int level = Z_DEFAULT_COMPRESSION; /* compression level */
+ int strategy = Z_DEFAULT_STRATEGY; /* compression strategy */
+ char *p = (char*)mode;
+ gz_stream *s;
+ char fmode[80]; /* copy of mode, without the compression level */
+ char *m = fmode;
+
+ if (!path || !mode) return Z_NULL;
+
+ s = (gz_stream *)ALLOC(sizeof(gz_stream));
+ if (!s) return Z_NULL;
+
+ s->stream.zalloc = (alloc_func)0;
+ s->stream.zfree = (free_func)0;
+ s->stream.opaque = (voidpf)0;
+ s->stream.next_in = s->inbuf = Z_NULL;
+ s->stream.next_out = s->outbuf = Z_NULL;
+ s->stream.avail_in = s->stream.avail_out = 0;
+ s->file = NULL;
+ s->z_err = Z_OK;
+ s->z_eof = 0;
+ s->crc = crc32(0L, Z_NULL, 0);
+ s->msg = NULL;
+ s->transparent = 0;
+
+ s->path = (char*)ALLOC(strlen(path)+1);
+ if (s->path == NULL) {
+ return destroy(s), (gzFile)Z_NULL;
+ }
+ strcpy(s->path, path); /* do this early for debugging */
+
+ s->mode = '\0';
+ do {
+ if (*p == 'r') s->mode = 'r';
+ if (*p == 'w' || *p == 'a') s->mode = 'w';
+ if (*p >= '0' && *p <= '9') {
+ level = *p - '0';
+ } else if (*p == 'f') {
+ strategy = Z_FILTERED;
+ } else if (*p == 'h') {
+ strategy = Z_HUFFMAN_ONLY;
+ } else {
+ *m++ = *p; /* copy the mode */
+ }
+ } while (*p++ && m != fmode + sizeof(fmode));
+ if (s->mode == '\0') return destroy(s), (gzFile)Z_NULL;
+
+ if (s->mode == 'w') {
+#ifdef NO_DEFLATE
+ err = Z_STREAM_ERROR;
+#else
+ err = deflateInit2(&(s->stream), level,
+ Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL, strategy);
+ /* windowBits is passed < 0 to suppress zlib header */
+
+ s->stream.next_out = s->outbuf = (Byte*)ALLOC(Z_BUFSIZE);
+#endif
+ if (err != Z_OK || s->outbuf == Z_NULL) {
+ return destroy(s), (gzFile)Z_NULL;
+ }
+ } else {
+ s->stream.next_in = s->inbuf = (Byte*)ALLOC(Z_BUFSIZE);
+
+ err = inflateInit2(&(s->stream), -MAX_WBITS);
+ /* windowBits is passed < 0 to tell that there is no zlib header.
+ * Note that in this case inflate *requires* an extra "dummy" byte
+ * after the compressed stream in order to complete decompression and
+ * return Z_STREAM_END. Here the gzip CRC32 ensures that 4 bytes are
+ * present after the compressed stream.
+ */
+ if (err != Z_OK || s->inbuf == Z_NULL) {
+ return destroy(s), (gzFile)Z_NULL;
+ }
+ }
+ s->stream.avail_out = Z_BUFSIZE;
+
+ errno = 0;
+ s->file = fd < 0 ? F_OPEN(path, fmode) : (FILE*)fdopen(fd, fmode);
+
+ if (s->file == NULL) {
+ return destroy(s), (gzFile)Z_NULL;
+ }
+ if (s->mode == 'w') {
+ /* Write a very simple .gz header:
+ */
+ fprintf(s->file, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1],
+ Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, OS_CODE);
+ s->startpos = 10L;
+ /* We use 10L instead of ftell(s->file) to because ftell causes an
+ * fflush on some systems. This version of the library doesn't use
+ * startpos anyway in write mode, so this initialization is not
+ * necessary.
+ */
+ } else {
+ check_header(s); /* skip the .gz header */
+ s->startpos = (ftell(s->file) - s->stream.avail_in);
+ }
+
+ return (gzFile)s;
+}
+
+/* ===========================================================================
+ Opens a gzip (.gz) file for reading or writing.
+*/
+gzFile ZEXPORT gzopen (path, mode)
+ const char *path;
+ const char *mode;
+{
+ return gz_open (path, mode, -1);
+}
+
+/* ===========================================================================
+ Associate a gzFile with the file descriptor fd. fd is not dup'ed here
+ to mimic the behavio(u)r of fdopen.
+*/
+gzFile ZEXPORT gzdopen (fd, mode)
+ int fd;
+ const char *mode;
+{
+ char name[20];
+
+ if (fd < 0) return (gzFile)Z_NULL;
+ sprintf(name, "<fd:%d>", fd); /* for debugging */
+
+ return gz_open (name, mode, fd);
+}
+
+/* ===========================================================================
+ * Update the compression level and strategy
+ */
+int ZEXPORT gzsetparams (file, level, strategy)
+ gzFile file;
+ int level;
+ int strategy;
+{
+ gz_stream *s = (gz_stream*)file;
+
+ if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
+
+ /* Make room to allow flushing */
+ if (s->stream.avail_out == 0) {
+
+ s->stream.next_out = s->outbuf;
+ if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) {
+ s->z_err = Z_ERRNO;
+ }
+ s->stream.avail_out = Z_BUFSIZE;
+ }
+
+ return deflateParams (&(s->stream), level, strategy);
+}
+
+/* ===========================================================================
+ Read a byte from a gz_stream; update next_in and avail_in. Return EOF
+ for end of file.
+ IN assertion: the stream s has been sucessfully opened for reading.
+*/
+local int get_byte(s)
+ gz_stream *s;
+{
+ if (s->z_eof) return EOF;
+ if (s->stream.avail_in == 0) {
+ errno = 0;
+ s->stream.avail_in = fread(s->inbuf, 1, Z_BUFSIZE, s->file);
+ if (s->stream.avail_in == 0) {
+ s->z_eof = 1;
+ if (ferror(s->file)) s->z_err = Z_ERRNO;
+ return EOF;
+ }
+ s->stream.next_in = s->inbuf;
+ }
+ s->stream.avail_in--;
+ return *(s->stream.next_in)++;
+}
+
+/* ===========================================================================
+ Check the gzip header of a gz_stream opened for reading. Set the stream
+ mode to transparent if the gzip magic header is not present; set s->err
+ to Z_DATA_ERROR if the magic header is present but the rest of the header
+ is incorrect.
+ IN assertion: the stream s has already been created sucessfully;
+ s->stream.avail_in is zero for the first time, but may be non-zero
+ for concatenated .gz files.
+*/
+local void check_header(s)
+ gz_stream *s;
+{
+ int method; /* method byte */
+ int flags; /* flags byte */
+ uInt len;
+ int c;
+
+ /* Check the gzip magic header */
+ for (len = 0; len < 2; len++) {
+ c = get_byte(s);
+ if (c != gz_magic[len]) {
+ if (len != 0) s->stream.avail_in++, s->stream.next_in--;
+ if (c != EOF) {
+ s->stream.avail_in++, s->stream.next_in--;
+ s->transparent = 1;
+ }
+ s->z_err = s->stream.avail_in != 0 ? Z_OK : Z_STREAM_END;
+ return;
+ }
+ }
+ method = get_byte(s);
+ flags = get_byte(s);
+ if (method != Z_DEFLATED || (flags & RESERVED) != 0) {
+ s->z_err = Z_DATA_ERROR;
+ return;
+ }
+
+ /* Discard time, xflags and OS code: */
+ for (len = 0; len < 6; len++) (void)get_byte(s);
+
+ if ((flags & EXTRA_FIELD) != 0) { /* skip the extra field */
+ len = (uInt)get_byte(s);
+ len += ((uInt)get_byte(s))<<8;
+ /* len is garbage if EOF but the loop below will quit anyway */
+ while (len-- != 0 && get_byte(s) != EOF) ;
+ }
+ if ((flags & ORIG_NAME) != 0) { /* skip the original file name */
+ while ((c = get_byte(s)) != 0 && c != EOF) ;
+ }
+ if ((flags & COMMENT) != 0) { /* skip the .gz file comment */
+ while ((c = get_byte(s)) != 0 && c != EOF) ;
+ }
+ if ((flags & HEAD_CRC) != 0) { /* skip the header crc */
+ for (len = 0; len < 2; len++) (void)get_byte(s);
+ }
+ s->z_err = s->z_eof ? Z_DATA_ERROR : Z_OK;
+}
+
+ /* ===========================================================================
+ * Cleanup then free the given gz_stream. Return a zlib error code.
+ Try freeing in the reverse order of allocations.
+ */
+local int destroy (s)
+ gz_stream *s;
+{
+ int err = Z_OK;
+
+ if (!s) return Z_STREAM_ERROR;
+
+ TRYFREE(s->msg);
+
+ if (s->stream.state != NULL) {
+ if (s->mode == 'w') {
+#ifdef NO_DEFLATE
+ err = Z_STREAM_ERROR;
+#else
+ err = deflateEnd(&(s->stream));
+#endif
+ } else if (s->mode == 'r') {
+ err = inflateEnd(&(s->stream));
+ }
+ }
+ if (s->file != NULL && fclose(s->file)) {
+#ifdef ESPIPE
+ if (errno != ESPIPE) /* fclose is broken for pipes in HP/UX */
+#endif
+ err = Z_ERRNO;
+ }
+ if (s->z_err < 0) err = s->z_err;
+
+ TRYFREE(s->inbuf);
+ TRYFREE(s->outbuf);
+ TRYFREE(s->path);
+ TRYFREE(s);
+ return err;
+}
+
+/* ===========================================================================
+ Reads the given number of uncompressed bytes from the compressed file.
+ gzread returns the number of bytes actually read (0 for end of file).
+*/
+int ZEXPORT gzread (file, buf, len)
+ gzFile file;
+ voidp buf;
+ unsigned len;
+{
+ gz_stream *s = (gz_stream*)file;
+ Bytef *start = (Bytef*)buf; /* starting point for crc computation */
+ Byte *next_out; /* == stream.next_out but not forced far (for MSDOS) */
+
+ if (s == NULL || s->mode != 'r') return Z_STREAM_ERROR;
+
+ if (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO) return -1;
+ if (s->z_err == Z_STREAM_END) return 0; /* EOF */
+
+ next_out = (Byte*)buf;
+ s->stream.next_out = (Bytef*)buf;
+ s->stream.avail_out = len;
+
+ while (s->stream.avail_out != 0) {
+
+ if (s->transparent) {
+ /* Copy first the lookahead bytes: */
+ uInt n = s->stream.avail_in;
+ if (n > s->stream.avail_out) n = s->stream.avail_out;
+ if (n > 0) {
+ zmemcpy(s->stream.next_out, s->stream.next_in, n);
+ next_out += n;
+ s->stream.next_out = next_out;
+ s->stream.next_in += n;
+ s->stream.avail_out -= n;
+ s->stream.avail_in -= n;
+ }
+ if (s->stream.avail_out > 0) {
+ s->stream.avail_out -= fread(next_out, 1, s->stream.avail_out,
+ s->file);
+ }
+ len -= s->stream.avail_out;
+ s->stream.total_in += (uLong)len;
+ s->stream.total_out += (uLong)len;
+ if (len == 0) s->z_eof = 1;
+ return (int)len;
+ }
+ if (s->stream.avail_in == 0 && !s->z_eof) {
+
+ errno = 0;
+ s->stream.avail_in = fread(s->inbuf, 1, Z_BUFSIZE, s->file);
+ if (s->stream.avail_in == 0) {
+ s->z_eof = 1;
+ if (ferror(s->file)) {
+ s->z_err = Z_ERRNO;
+ break;
+ }
+ }
+ s->stream.next_in = s->inbuf;
+ }
+ s->z_err = inflate(&(s->stream), Z_NO_FLUSH);
+
+ if (s->z_err == Z_STREAM_END) {
+ /* Check CRC and original size */
+ s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start));
+ start = s->stream.next_out;
+
+ if (getLong(s) != s->crc) {
+ s->z_err = Z_DATA_ERROR;
+ } else {
+ (void)getLong(s);
+ /* The uncompressed length returned by above getlong() may
+ * be different from s->stream.total_out) in case of
+ * concatenated .gz files. Check for such files:
+ */
+ check_header(s);
+ if (s->z_err == Z_OK) {
+ uLong total_in = s->stream.total_in;
+ uLong total_out = s->stream.total_out;
+
+ inflateReset(&(s->stream));
+ s->stream.total_in = total_in;
+ s->stream.total_out = total_out;
+ s->crc = crc32(0L, Z_NULL, 0);
+ }
+ }
+ }
+ if (s->z_err != Z_OK || s->z_eof) break;
+ }
+ s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start));
+
+ return (int)(len - s->stream.avail_out);
+}
+
+
+/* ===========================================================================
+ Reads one byte from the compressed file. gzgetc returns this byte
+ or -1 in case of end of file or error.
+*/
+int ZEXPORT gzgetc(file)
+ gzFile file;
+{
+ unsigned char c;
+
+ return gzread(file, &c, 1) == 1 ? c : -1;
+}
+
+
+/* ===========================================================================
+ Reads bytes from the compressed file until len-1 characters are
+ read, or a newline character is read and transferred to buf, or an
+ end-of-file condition is encountered. The string is then terminated
+ with a null character.
+ gzgets returns buf, or Z_NULL in case of error.
+
+ The current implementation is not optimized at all.
+*/
+char * ZEXPORT gzgets(file, buf, len)
+ gzFile file;
+ char *buf;
+ int len;
+{
+ char *b = buf;
+ if (buf == Z_NULL || len <= 0) return Z_NULL;
+
+ while (--len > 0 && gzread(file, buf, 1) == 1 && *buf++ != '\n') ;
+ *buf = '\0';
+ return b == buf && len > 0 ? Z_NULL : b;
+}
+
+
+#ifndef NO_DEFLATE
+/* ===========================================================================
+ Writes the given number of uncompressed bytes into the compressed file.
+ gzwrite returns the number of bytes actually written (0 in case of error).
+*/
+int ZEXPORT gzwrite (file, buf, len)
+ gzFile file;
+ const voidp buf;
+ unsigned len;
+{
+ gz_stream *s = (gz_stream*)file;
+
+ if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
+
+ s->stream.next_in = (Bytef*)buf;
+ s->stream.avail_in = len;
+
+ while (s->stream.avail_in != 0) {
+
+ if (s->stream.avail_out == 0) {
+
+ s->stream.next_out = s->outbuf;
+ if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) {
+ s->z_err = Z_ERRNO;
+ break;
+ }
+ s->stream.avail_out = Z_BUFSIZE;
+ }
+ s->z_err = deflate(&(s->stream), Z_NO_FLUSH);
+ if (s->z_err != Z_OK) break;
+ }
+ s->crc = crc32(s->crc, (const Bytef *)buf, len);
+
+ return (int)(len - s->stream.avail_in);
+}
+
+/* ===========================================================================
+ Converts, formats, and writes the args to the compressed file under
+ control of the format string, as in fprintf. gzprintf returns the number of
+ uncompressed bytes actually written (0 in case of error).
+*/
+#ifdef STDC
+#include <stdarg.h>
+
+int ZEXPORTVA gzprintf (gzFile file, const char *format, /* args */ ...)
+{
+ char buf[Z_PRINTF_BUFSIZE];
+ va_list va;
+ int len;
+
+ va_start(va, format);
+#ifdef HAS_vsnprintf
+ (void)vsnprintf(buf, sizeof(buf), format, va);
+#else
+ (void)vsprintf(buf, format, va);
+#endif
+ va_end(va);
+ len = strlen(buf); /* some *sprintf don't return the nb of bytes written */
+ if (len <= 0) return 0;
+
+ return gzwrite(file, buf, (unsigned)len);
+}
+#else /* not ANSI C */
+
+int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
+ a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
+ gzFile file;
+ const char *format;
+ int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
+ a11, a12, a13, a14, a15, a16, a17, a18, a19, a20;
+{
+ char buf[Z_PRINTF_BUFSIZE];
+ int len;
+
+#ifdef HAS_snprintf
+ snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8,
+ a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
+#else
+ sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8,
+ a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
+#endif
+ len = strlen(buf); /* old sprintf doesn't return the nb of bytes written */
+ if (len <= 0) return 0;
+
+ return gzwrite(file, buf, len);
+}
+#endif
+
+/* ===========================================================================
+ Writes c, converted to an unsigned char, into the compressed file.
+ gzputc returns the value that was written, or -1 in case of error.
+*/
+int ZEXPORT gzputc(file, c)
+ gzFile file;
+ int c;
+{
+ unsigned char cc = (unsigned char) c; /* required for big endian systems */
+
+ return gzwrite(file, &cc, 1) == 1 ? (int)cc : -1;
+}
+
+
+/* ===========================================================================
+ Writes the given null-terminated string to the compressed file, excluding
+ the terminating null character.
+ gzputs returns the number of characters written, or -1 in case of error.
+*/
+int ZEXPORT gzputs(file, s)
+ gzFile file;
+ const char *s;
+{
+ return gzwrite(file, (char*)s, (unsigned)strlen(s));
+}
+
+
+/* ===========================================================================
+ Flushes all pending output into the compressed file. The parameter
+ flush is as in the deflate() function.
+*/
+local int do_flush (file, flush)
+ gzFile file;
+ int flush;
+{
+ uInt len;
+ int done = 0;
+ gz_stream *s = (gz_stream*)file;
+
+ if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
+
+ s->stream.avail_in = 0; /* should be zero already anyway */
+
+ for (;;) {
+ len = Z_BUFSIZE - s->stream.avail_out;
+
+ if (len != 0) {
+ if ((uInt)fwrite(s->outbuf, 1, len, s->file) != len) {
+ s->z_err = Z_ERRNO;
+ return Z_ERRNO;
+ }
+ s->stream.next_out = s->outbuf;
+ s->stream.avail_out = Z_BUFSIZE;
+ }
+ if (done) break;
+ s->z_err = deflate(&(s->stream), flush);
+
+ /* Ignore the second of two consecutive flushes: */
+ if (len == 0 && s->z_err == Z_BUF_ERROR) s->z_err = Z_OK;
+
+ /* deflate has finished flushing only when it hasn't used up
+ * all the available space in the output buffer:
+ */
+ done = (s->stream.avail_out != 0 || s->z_err == Z_STREAM_END);
+
+ if (s->z_err != Z_OK && s->z_err != Z_STREAM_END) break;
+ }
+ return s->z_err == Z_STREAM_END ? Z_OK : s->z_err;
+}
+
+int ZEXPORT gzflush (file, flush)
+ gzFile file;
+ int flush;
+{
+ gz_stream *s = (gz_stream*)file;
+ int err = do_flush (file, flush);
+
+ if (err) return err;
+ fflush(s->file);
+ return s->z_err == Z_STREAM_END ? Z_OK : s->z_err;
+}
+#endif /* NO_DEFLATE */
+
+/* ===========================================================================
+ Sets the starting position for the next gzread or gzwrite on the given
+ compressed file. The offset represents a number of bytes in the
+ gzseek returns the resulting offset location as measured in bytes from
+ the beginning of the uncompressed stream, or -1 in case of error.
+ SEEK_END is not implemented, returns error.
+ In this version of the library, gzseek can be extremely slow.
+*/
+z_off_t ZEXPORT gzseek (file, offset, whence)
+ gzFile file;
+ z_off_t offset;
+ int whence;
+{
+ gz_stream *s = (gz_stream*)file;
+
+ if (s == NULL || whence == SEEK_END ||
+ s->z_err == Z_ERRNO || s->z_err == Z_DATA_ERROR) {
+ return -1L;
+ }
+
+ if (s->mode == 'w') {
+#ifdef NO_DEFLATE
+ return -1L;
+#else
+ if (whence == SEEK_SET) {
+ offset -= s->stream.total_in;
+ }
+ if (offset < 0) return -1L;
+
+ /* At this point, offset is the number of zero bytes to write. */
+ if (s->inbuf == Z_NULL) {
+ s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); /* for seeking */
+ zmemzero(s->inbuf, Z_BUFSIZE);
+ }
+ while (offset > 0) {
+ uInt size = Z_BUFSIZE;
+ if (offset < Z_BUFSIZE) size = (uInt)offset;
+
+ size = gzwrite(file, s->inbuf, size);
+ if (size == 0) return -1L;
+
+ offset -= size;
+ }
+ return (z_off_t)s->stream.total_in;
+#endif
+ }
+ /* Rest of function is for reading only */
+
+ /* compute absolute position */
+ if (whence == SEEK_CUR) {
+ offset += s->stream.total_out;
+ }
+ if (offset < 0) return -1L;
+
+ if (s->transparent) {
+ /* map to fseek */
+ s->stream.avail_in = 0;
+ s->stream.next_in = s->inbuf;
+ if (fseek(s->file, offset, SEEK_SET) < 0) return -1L;
+
+ s->stream.total_in = s->stream.total_out = (uLong)offset;
+ return offset;
+ }
+
+ /* For a negative seek, rewind and use positive seek */
+ if ((uLong)offset >= s->stream.total_out) {
+ offset -= s->stream.total_out;
+ } else if (gzrewind(file) < 0) {
+ return -1L;
+ }
+ /* offset is now the number of bytes to skip. */
+
+ if (offset != 0 && s->outbuf == Z_NULL) {
+ s->outbuf = (Byte*)ALLOC(Z_BUFSIZE);
+ }
+ while (offset > 0) {
+ int size = Z_BUFSIZE;
+ if (offset < Z_BUFSIZE) size = (int)offset;
+
+ size = gzread(file, s->outbuf, (uInt)size);
+ if (size <= 0) return -1L;
+ offset -= size;
+ }
+ return (z_off_t)s->stream.total_out;
+}
+
+/* ===========================================================================
+ Rewinds input file.
+*/
+int ZEXPORT gzrewind (file)
+ gzFile file;
+{
+ gz_stream *s = (gz_stream*)file;
+
+ if (s == NULL || s->mode != 'r') return -1;
+
+ s->z_err = Z_OK;
+ s->z_eof = 0;
+ s->stream.avail_in = 0;
+ s->stream.next_in = s->inbuf;
+ s->crc = crc32(0L, Z_NULL, 0);
+
+ if (s->startpos == 0) { /* not a compressed file */
+ rewind(s->file);
+ return 0;
+ }
+
+ (void) inflateReset(&s->stream);
+ return fseek(s->file, s->startpos, SEEK_SET);
+}
+
+/* ===========================================================================
+ Returns the starting position for the next gzread or gzwrite on the
+ given compressed file. This position represents a number of bytes in the
+ uncompressed data stream.
+*/
+z_off_t ZEXPORT gztell (file)
+ gzFile file;
+{
+ return gzseek(file, 0L, SEEK_CUR);
+}
+
+/* ===========================================================================
+ Returns 1 when EOF has previously been detected reading the given
+ input stream, otherwise zero.
+*/
+int ZEXPORT gzeof (file)
+ gzFile file;
+{
+ gz_stream *s = (gz_stream*)file;
+
+ return (s == NULL || s->mode != 'r') ? 0 : s->z_eof;
+}
+
+/* ===========================================================================
+ Outputs a long in LSB order to the given file
+*/
+local void putLong (file, x)
+ FILE *file;
+ uLong x;
+{
+ int n;
+ for (n = 0; n < 4; n++) {
+ fputc((int)(x & 0xff), file);
+ x >>= 8;
+ }
+}
+
+/* ===========================================================================
+ Reads a long in LSB order from the given gz_stream. Sets z_err in case
+ of error.
+*/
+local uLong getLong (s)
+ gz_stream *s;
+{
+ uLong x = (uLong)get_byte(s);
+ int c;
+
+ x += ((uLong)get_byte(s))<<8;
+ x += ((uLong)get_byte(s))<<16;
+ c = get_byte(s);
+ if (c == EOF) s->z_err = Z_DATA_ERROR;
+ x += ((uLong)c)<<24;
+ return x;
+}
+
+/* ===========================================================================
+ Flushes all pending output if necessary, closes the compressed file
+ and deallocates all the (de)compression state.
+*/
+int ZEXPORT gzclose (file)
+ gzFile file;
+{
+ int err;
+ gz_stream *s = (gz_stream*)file;
+
+ if (s == NULL) return Z_STREAM_ERROR;
+
+ if (s->mode == 'w') {
+#ifdef NO_DEFLATE
+ return Z_STREAM_ERROR;
+#else
+ err = do_flush (file, Z_FINISH);
+ if (err != Z_OK) return destroy((gz_stream*)file);
+
+ putLong (s->file, s->crc);
+ putLong (s->file, s->stream.total_in);
+#endif
+ }
+ return destroy((gz_stream*)file);
+}
+
+/* ===========================================================================
+ Returns the error message for the last error which occured on the
+ given compressed file. errnum is set to zlib error number. If an
+ error occured in the file system and not in the compression library,
+ errnum is set to Z_ERRNO and the application may consult errno
+ to get the exact error code.
+*/
+const char* ZEXPORT gzerror (file, errnum)
+ gzFile file;
+ int *errnum;
+{
+ char *m;
+ gz_stream *s = (gz_stream*)file;
+
+ if (s == NULL) {
+ *errnum = Z_STREAM_ERROR;
+ return (const char*)ERR_MSG(Z_STREAM_ERROR);
+ }
+ *errnum = s->z_err;
+ if (*errnum == Z_OK) return (const char*)"";
+
+ m = (char*)(*errnum == Z_ERRNO ? zstrerror(errno) : s->stream.msg);
+
+ if (m == NULL || *m == '\0') m = (char*)ERR_MSG(s->z_err);
+
+ TRYFREE(s->msg);
+ s->msg = (char*)ALLOC(strlen(s->path) + strlen(m) + 3);
+ strcpy(s->msg, s->path);
+ strcat(s->msg, ": ");
+ strcat(s->msg, m);
+ return (const char*)s->msg;
+}
diff --git a/win32/contrib/zlib/infblock.c b/win32/contrib/zlib/infblock.c new file mode 100644 index 000000000..478799d1e --- /dev/null +++ b/win32/contrib/zlib/infblock.c @@ -0,0 +1,398 @@ +/* infblock.c -- interpret and process block types to last block
+ * Copyright (C) 1995-1998 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+#include "zutil.h"
+#include "infblock.h"
+#include "inftrees.h"
+#include "infcodes.h"
+#include "infutil.h"
+
+struct inflate_codes_state {int dummy;}; /* for buggy compilers */
+
+/* simplify the use of the inflate_huft type with some defines */
+#define exop word.what.Exop
+#define bits word.what.Bits
+
+/* Table for deflate from PKZIP's appnote.txt. */
+local const uInt border[] = { /* Order of the bit length code lengths */
+ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
+
+/*
+ Notes beyond the 1.93a appnote.txt:
+
+ 1. Distance pointers never point before the beginning of the output
+ stream.
+ 2. Distance pointers can point back across blocks, up to 32k away.
+ 3. There is an implied maximum of 7 bits for the bit length table and
+ 15 bits for the actual data.
+ 4. If only one code exists, then it is encoded using one bit. (Zero
+ would be more efficient, but perhaps a little confusing.) If two
+ codes exist, they are coded using one bit each (0 and 1).
+ 5. There is no way of sending zero distance codes--a dummy must be
+ sent if there are none. (History: a pre 2.0 version of PKZIP would
+ store blocks with no distance codes, but this was discovered to be
+ too harsh a criterion.) Valid only for 1.93a. 2.04c does allow
+ zero distance codes, which is sent as one code of zero bits in
+ length.
+ 6. There are up to 286 literal/length codes. Code 256 represents the
+ end-of-block. Note however that the static length tree defines
+ 288 codes just to fill out the Huffman codes. Codes 286 and 287
+ cannot be used though, since there is no length base or extra bits
+ defined for them. Similarily, there are up to 30 distance codes.
+ However, static trees define 32 codes (all 5 bits) to fill out the
+ Huffman codes, but the last two had better not show up in the data.
+ 7. Unzip can check dynamic Huffman blocks for complete code sets.
+ The exception is that a single code would not be complete (see #4).
+ 8. The five bits following the block type is really the number of
+ literal codes sent minus 257.
+ 9. Length codes 8,16,16 are interpreted as 13 length codes of 8 bits
+ (1+6+6). Therefore, to output three times the length, you output
+ three codes (1+1+1), whereas to output four times the same length,
+ you only need two codes (1+3). Hmm.
+ 10. In the tree reconstruction algorithm, Code = Code + Increment
+ only if BitLength(i) is not zero. (Pretty obvious.)
+ 11. Correction: 4 Bits: # of Bit Length codes - 4 (4 - 19)
+ 12. Note: length code 284 can represent 227-258, but length code 285
+ really is 258. The last length deserves its own, short code
+ since it gets used a lot in very redundant files. The length
+ 258 is special since 258 - 3 (the min match length) is 255.
+ 13. The literal/length and distance code bit lengths are read as a
+ single stream of lengths. It is possible (and advantageous) for
+ a repeat code (16, 17, or 18) to go across the boundary between
+ the two sets of lengths.
+ */
+
+
+void inflate_blocks_reset(s, z, c)
+inflate_blocks_statef *s;
+z_streamp z;
+uLongf *c;
+{
+ if (c != Z_NULL)
+ *c = s->check;
+ if (s->mode == BTREE || s->mode == DTREE)
+ ZFREE(z, s->sub.trees.blens);
+ if (s->mode == CODES)
+ inflate_codes_free(s->sub.decode.codes, z);
+ s->mode = TYPE;
+ s->bitk = 0;
+ s->bitb = 0;
+ s->read = s->write = s->window;
+ if (s->checkfn != Z_NULL)
+ z->adler = s->check = (*s->checkfn)(0L, (const Bytef *)Z_NULL, 0);
+ Tracev((stderr, "inflate: blocks reset\n"));
+}
+
+
+inflate_blocks_statef *inflate_blocks_new(z, c, w)
+z_streamp z;
+check_func c;
+uInt w;
+{
+ inflate_blocks_statef *s;
+
+ if ((s = (inflate_blocks_statef *)ZALLOC
+ (z,1,sizeof(struct inflate_blocks_state))) == Z_NULL)
+ return s;
+ if ((s->hufts =
+ (inflate_huft *)ZALLOC(z, sizeof(inflate_huft), MANY)) == Z_NULL)
+ {
+ ZFREE(z, s);
+ return Z_NULL;
+ }
+ if ((s->window = (Bytef *)ZALLOC(z, 1, w)) == Z_NULL)
+ {
+ ZFREE(z, s->hufts);
+ ZFREE(z, s);
+ return Z_NULL;
+ }
+ s->end = s->window + w;
+ s->checkfn = c;
+ s->mode = TYPE;
+ Tracev((stderr, "inflate: blocks allocated\n"));
+ inflate_blocks_reset(s, z, Z_NULL);
+ return s;
+}
+
+
+int inflate_blocks(s, z, r)
+inflate_blocks_statef *s;
+z_streamp z;
+int r;
+{
+ uInt t; /* temporary storage */
+ uLong b; /* bit buffer */
+ uInt k; /* bits in bit buffer */
+ Bytef *p; /* input data pointer */
+ uInt n; /* bytes available there */
+ Bytef *q; /* output window write pointer */
+ uInt m; /* bytes to end of window or read pointer */
+
+ /* copy input/output information to locals (UPDATE macro restores) */
+ LOAD
+
+ /* process input based on current state */
+ while (1) switch (s->mode)
+ {
+ case TYPE:
+ NEEDBITS(3)
+ t = (uInt)b & 7;
+ s->last = t & 1;
+ switch (t >> 1)
+ {
+ case 0: /* stored */
+ Tracev((stderr, "inflate: stored block%s\n",
+ s->last ? " (last)" : ""));
+ DUMPBITS(3)
+ t = k & 7; /* go to byte boundary */
+ DUMPBITS(t)
+ s->mode = LENS; /* get length of stored block */
+ break;
+ case 1: /* fixed */
+ Tracev((stderr, "inflate: fixed codes block%s\n",
+ s->last ? " (last)" : ""));
+ {
+ uInt bl, bd;
+ inflate_huft *tl, *td;
+
+ inflate_trees_fixed(&bl, &bd, &tl, &td, z);
+ s->sub.decode.codes = inflate_codes_new(bl, bd, tl, td, z);
+ if (s->sub.decode.codes == Z_NULL)
+ {
+ r = Z_MEM_ERROR;
+ LEAVE
+ }
+ }
+ DUMPBITS(3)
+ s->mode = CODES;
+ break;
+ case 2: /* dynamic */
+ Tracev((stderr, "inflate: dynamic codes block%s\n",
+ s->last ? " (last)" : ""));
+ DUMPBITS(3)
+ s->mode = TABLE;
+ break;
+ case 3: /* illegal */
+ DUMPBITS(3)
+ s->mode = BAD;
+ z->msg = (char*)"invalid block type";
+ r = Z_DATA_ERROR;
+ LEAVE
+ }
+ break;
+ case LENS:
+ NEEDBITS(32)
+ if ((((~b) >> 16) & 0xffff) != (b & 0xffff))
+ {
+ s->mode = BAD;
+ z->msg = (char*)"invalid stored block lengths";
+ r = Z_DATA_ERROR;
+ LEAVE
+ }
+ s->sub.left = (uInt)b & 0xffff;
+ b = k = 0; /* dump bits */
+ Tracev((stderr, "inflate: stored length %u\n", s->sub.left));
+ s->mode = s->sub.left ? STORED : (s->last ? DRY : TYPE);
+ break;
+ case STORED:
+ if (n == 0)
+ LEAVE
+ NEEDOUT
+ t = s->sub.left;
+ if (t > n) t = n;
+ if (t > m) t = m;
+ zmemcpy(q, p, t);
+ p += t; n -= t;
+ q += t; m -= t;
+ if ((s->sub.left -= t) != 0)
+ break;
+ Tracev((stderr, "inflate: stored end, %lu total out\n",
+ z->total_out + (q >= s->read ? q - s->read :
+ (s->end - s->read) + (q - s->window))));
+ s->mode = s->last ? DRY : TYPE;
+ break;
+ case TABLE:
+ NEEDBITS(14)
+ s->sub.trees.table = t = (uInt)b & 0x3fff;
+#ifndef PKZIP_BUG_WORKAROUND
+ if ((t & 0x1f) > 29 || ((t >> 5) & 0x1f) > 29)
+ {
+ s->mode = BAD;
+ z->msg = (char*)"too many length or distance symbols";
+ r = Z_DATA_ERROR;
+ LEAVE
+ }
+#endif
+ t = 258 + (t & 0x1f) + ((t >> 5) & 0x1f);
+ if ((s->sub.trees.blens = (uIntf*)ZALLOC(z, t, sizeof(uInt))) == Z_NULL)
+ {
+ r = Z_MEM_ERROR;
+ LEAVE
+ }
+ DUMPBITS(14)
+ s->sub.trees.index = 0;
+ Tracev((stderr, "inflate: table sizes ok\n"));
+ s->mode = BTREE;
+ case BTREE:
+ while (s->sub.trees.index < 4 + (s->sub.trees.table >> 10))
+ {
+ NEEDBITS(3)
+ s->sub.trees.blens[border[s->sub.trees.index++]] = (uInt)b & 7;
+ DUMPBITS(3)
+ }
+ while (s->sub.trees.index < 19)
+ s->sub.trees.blens[border[s->sub.trees.index++]] = 0;
+ s->sub.trees.bb = 7;
+ t = inflate_trees_bits(s->sub.trees.blens, &s->sub.trees.bb,
+ &s->sub.trees.tb, s->hufts, z);
+ if (t != Z_OK)
+ {
+ ZFREE(z, s->sub.trees.blens);
+ r = t;
+ if (r == Z_DATA_ERROR)
+ s->mode = BAD;
+ LEAVE
+ }
+ s->sub.trees.index = 0;
+ Tracev((stderr, "inflate: bits tree ok\n"));
+ s->mode = DTREE;
+ case DTREE:
+ while (t = s->sub.trees.table,
+ s->sub.trees.index < 258 + (t & 0x1f) + ((t >> 5) & 0x1f))
+ {
+ inflate_huft *h;
+ uInt i, j, c;
+
+ t = s->sub.trees.bb;
+ NEEDBITS(t)
+ h = s->sub.trees.tb + ((uInt)b & inflate_mask[t]);
+ t = h->bits;
+ c = h->base;
+ if (c < 16)
+ {
+ DUMPBITS(t)
+ s->sub.trees.blens[s->sub.trees.index++] = c;
+ }
+ else /* c == 16..18 */
+ {
+ i = c == 18 ? 7 : c - 14;
+ j = c == 18 ? 11 : 3;
+ NEEDBITS(t + i)
+ DUMPBITS(t)
+ j += (uInt)b & inflate_mask[i];
+ DUMPBITS(i)
+ i = s->sub.trees.index;
+ t = s->sub.trees.table;
+ if (i + j > 258 + (t & 0x1f) + ((t >> 5) & 0x1f) ||
+ (c == 16 && i < 1))
+ {
+ ZFREE(z, s->sub.trees.blens);
+ s->mode = BAD;
+ z->msg = (char*)"invalid bit length repeat";
+ r = Z_DATA_ERROR;
+ LEAVE
+ }
+ c = c == 16 ? s->sub.trees.blens[i - 1] : 0;
+ do {
+ s->sub.trees.blens[i++] = c;
+ } while (--j);
+ s->sub.trees.index = i;
+ }
+ }
+ s->sub.trees.tb = Z_NULL;
+ {
+ uInt bl, bd;
+ inflate_huft *tl, *td;
+ inflate_codes_statef *c;
+
+ bl = 9; /* must be <= 9 for lookahead assumptions */
+ bd = 6; /* must be <= 9 for lookahead assumptions */
+ t = s->sub.trees.table;
+ t = inflate_trees_dynamic(257 + (t & 0x1f), 1 + ((t >> 5) & 0x1f),
+ s->sub.trees.blens, &bl, &bd, &tl, &td,
+ s->hufts, z);
+ ZFREE(z, s->sub.trees.blens);
+ if (t != Z_OK)
+ {
+ if (t == (uInt)Z_DATA_ERROR)
+ s->mode = BAD;
+ r = t;
+ LEAVE
+ }
+ Tracev((stderr, "inflate: trees ok\n"));
+ if ((c = inflate_codes_new(bl, bd, tl, td, z)) == Z_NULL)
+ {
+ r = Z_MEM_ERROR;
+ LEAVE
+ }
+ s->sub.decode.codes = c;
+ }
+ s->mode = CODES;
+ case CODES:
+ UPDATE
+ if ((r = inflate_codes(s, z, r)) != Z_STREAM_END)
+ return inflate_flush(s, z, r);
+ r = Z_OK;
+ inflate_codes_free(s->sub.decode.codes, z);
+ LOAD
+ Tracev((stderr, "inflate: codes end, %lu total out\n",
+ z->total_out + (q >= s->read ? q - s->read :
+ (s->end - s->read) + (q - s->window))));
+ if (!s->last)
+ {
+ s->mode = TYPE;
+ break;
+ }
+ s->mode = DRY;
+ case DRY:
+ FLUSH
+ if (s->read != s->write)
+ LEAVE
+ s->mode = DONE;
+ case DONE:
+ r = Z_STREAM_END;
+ LEAVE
+ case BAD:
+ r = Z_DATA_ERROR;
+ LEAVE
+ default:
+ r = Z_STREAM_ERROR;
+ LEAVE
+ }
+}
+
+
+int inflate_blocks_free(s, z)
+inflate_blocks_statef *s;
+z_streamp z;
+{
+ inflate_blocks_reset(s, z, Z_NULL);
+ ZFREE(z, s->window);
+ ZFREE(z, s->hufts);
+ ZFREE(z, s);
+ Tracev((stderr, "inflate: blocks freed\n"));
+ return Z_OK;
+}
+
+
+void inflate_set_dictionary(s, d, n)
+inflate_blocks_statef *s;
+const Bytef *d;
+uInt n;
+{
+ zmemcpy(s->window, d, n);
+ s->read = s->write = s->window + n;
+}
+
+
+/* Returns true if inflate is currently at the end of a block generated
+ * by Z_SYNC_FLUSH or Z_FULL_FLUSH.
+ * IN assertion: s != Z_NULL
+ */
+int inflate_blocks_sync_point(s)
+inflate_blocks_statef *s;
+{
+ return s->mode == LENS;
+}
diff --git a/win32/contrib/zlib/infblock.h b/win32/contrib/zlib/infblock.h new file mode 100644 index 000000000..393b25a59 --- /dev/null +++ b/win32/contrib/zlib/infblock.h @@ -0,0 +1,39 @@ +/* infblock.h -- header to use infblock.c
+ * Copyright (C) 1995-1998 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+ part of the implementation of the compression library and is
+ subject to change. Applications should only use zlib.h.
+ */
+
+struct inflate_blocks_state;
+typedef struct inflate_blocks_state FAR inflate_blocks_statef;
+
+extern inflate_blocks_statef * inflate_blocks_new OF((
+ z_streamp z,
+ check_func c, /* check function */
+ uInt w)); /* window size */
+
+extern int inflate_blocks OF((
+ inflate_blocks_statef *,
+ z_streamp ,
+ int)); /* initial return code */
+
+extern void inflate_blocks_reset OF((
+ inflate_blocks_statef *,
+ z_streamp ,
+ uLongf *)); /* check value on output */
+
+extern int inflate_blocks_free OF((
+ inflate_blocks_statef *,
+ z_streamp));
+
+extern void inflate_set_dictionary OF((
+ inflate_blocks_statef *s,
+ const Bytef *d, /* dictionary */
+ uInt n)); /* dictionary length */
+
+extern int inflate_blocks_sync_point OF((
+ inflate_blocks_statef *s));
diff --git a/win32/contrib/zlib/infcodes.c b/win32/contrib/zlib/infcodes.c new file mode 100644 index 000000000..916470da5 --- /dev/null +++ b/win32/contrib/zlib/infcodes.c @@ -0,0 +1,257 @@ +/* infcodes.c -- process literals and length/distance pairs
+ * Copyright (C) 1995-1998 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+#include "zutil.h"
+#include "inftrees.h"
+#include "infblock.h"
+#include "infcodes.h"
+#include "infutil.h"
+#include "inffast.h"
+
+/* simplify the use of the inflate_huft type with some defines */
+#define exop word.what.Exop
+#define bits word.what.Bits
+
+typedef enum { /* waiting for "i:"=input, "o:"=output, "x:"=nothing */
+ START, /* x: set up for LEN */
+ LEN, /* i: get length/literal/eob next */
+ LENEXT, /* i: getting length extra (have base) */
+ DIST, /* i: get distance next */
+ DISTEXT, /* i: getting distance extra */
+ COPY, /* o: copying bytes in window, waiting for space */
+ LIT, /* o: got literal, waiting for output space */
+ WASH, /* o: got eob, possibly still output waiting */
+ END, /* x: got eob and all data flushed */
+ BADCODE} /* x: got error */
+inflate_codes_mode;
+
+/* inflate codes private state */
+struct inflate_codes_state {
+
+ /* mode */
+ inflate_codes_mode mode; /* current inflate_codes mode */
+
+ /* mode dependent information */
+ uInt len;
+ union {
+ struct {
+ inflate_huft *tree; /* pointer into tree */
+ uInt need; /* bits needed */
+ } code; /* if LEN or DIST, where in tree */
+ uInt lit; /* if LIT, literal */
+ struct {
+ uInt get; /* bits to get for extra */
+ uInt dist; /* distance back to copy from */
+ } copy; /* if EXT or COPY, where and how much */
+ } sub; /* submode */
+
+ /* mode independent information */
+ Byte lbits; /* ltree bits decoded per branch */
+ Byte dbits; /* dtree bits decoder per branch */
+ inflate_huft *ltree; /* literal/length/eob tree */
+ inflate_huft *dtree; /* distance tree */
+
+};
+
+
+inflate_codes_statef *inflate_codes_new(bl, bd, tl, td, z)
+uInt bl, bd;
+inflate_huft *tl;
+inflate_huft *td; /* need separate declaration for Borland C++ */
+z_streamp z;
+{
+ inflate_codes_statef *c;
+
+ if ((c = (inflate_codes_statef *)
+ ZALLOC(z,1,sizeof(struct inflate_codes_state))) != Z_NULL)
+ {
+ c->mode = START;
+ c->lbits = (Byte)bl;
+ c->dbits = (Byte)bd;
+ c->ltree = tl;
+ c->dtree = td;
+ Tracev((stderr, "inflate: codes new\n"));
+ }
+ return c;
+}
+
+
+int inflate_codes(s, z, r)
+inflate_blocks_statef *s;
+z_streamp z;
+int r;
+{
+ uInt j; /* temporary storage */
+ inflate_huft *t; /* temporary pointer */
+ uInt e; /* extra bits or operation */
+ uLong b; /* bit buffer */
+ uInt k; /* bits in bit buffer */
+ Bytef *p; /* input data pointer */
+ uInt n; /* bytes available there */
+ Bytef *q; /* output window write pointer */
+ uInt m; /* bytes to end of window or read pointer */
+ Bytef *f; /* pointer to copy strings from */
+ inflate_codes_statef *c = s->sub.decode.codes; /* codes state */
+
+ /* copy input/output information to locals (UPDATE macro restores) */
+ LOAD
+
+ /* process input and output based on current state */
+ while (1) switch (c->mode)
+ { /* waiting for "i:"=input, "o:"=output, "x:"=nothing */
+ case START: /* x: set up for LEN */
+#ifndef SLOW
+ if (m >= 258 && n >= 10)
+ {
+ UPDATE
+ r = inflate_fast(c->lbits, c->dbits, c->ltree, c->dtree, s, z);
+ LOAD
+ if (r != Z_OK)
+ {
+ c->mode = r == Z_STREAM_END ? WASH : BADCODE;
+ break;
+ }
+ }
+#endif /* !SLOW */
+ c->sub.code.need = c->lbits;
+ c->sub.code.tree = c->ltree;
+ c->mode = LEN;
+ case LEN: /* i: get length/literal/eob next */
+ j = c->sub.code.need;
+ NEEDBITS(j)
+ t = c->sub.code.tree + ((uInt)b & inflate_mask[j]);
+ DUMPBITS(t->bits)
+ e = (uInt)(t->exop);
+ if (e == 0) /* literal */
+ {
+ c->sub.lit = t->base;
+ Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ?
+ "inflate: literal '%c'\n" :
+ "inflate: literal 0x%02x\n", t->base));
+ c->mode = LIT;
+ break;
+ }
+ if (e & 16) /* length */
+ {
+ c->sub.copy.get = e & 15;
+ c->len = t->base;
+ c->mode = LENEXT;
+ break;
+ }
+ if ((e & 64) == 0) /* next table */
+ {
+ c->sub.code.need = e;
+ c->sub.code.tree = t + t->base;
+ break;
+ }
+ if (e & 32) /* end of block */
+ {
+ Tracevv((stderr, "inflate: end of block\n"));
+ c->mode = WASH;
+ break;
+ }
+ c->mode = BADCODE; /* invalid code */
+ z->msg = (char*)"invalid literal/length code";
+ r = Z_DATA_ERROR;
+ LEAVE
+ case LENEXT: /* i: getting length extra (have base) */
+ j = c->sub.copy.get;
+ NEEDBITS(j)
+ c->len += (uInt)b & inflate_mask[j];
+ DUMPBITS(j)
+ c->sub.code.need = c->dbits;
+ c->sub.code.tree = c->dtree;
+ Tracevv((stderr, "inflate: length %u\n", c->len));
+ c->mode = DIST;
+ case DIST: /* i: get distance next */
+ j = c->sub.code.need;
+ NEEDBITS(j)
+ t = c->sub.code.tree + ((uInt)b & inflate_mask[j]);
+ DUMPBITS(t->bits)
+ e = (uInt)(t->exop);
+ if (e & 16) /* distance */
+ {
+ c->sub.copy.get = e & 15;
+ c->sub.copy.dist = t->base;
+ c->mode = DISTEXT;
+ break;
+ }
+ if ((e & 64) == 0) /* next table */
+ {
+ c->sub.code.need = e;
+ c->sub.code.tree = t + t->base;
+ break;
+ }
+ c->mode = BADCODE; /* invalid code */
+ z->msg = (char*)"invalid distance code";
+ r = Z_DATA_ERROR;
+ LEAVE
+ case DISTEXT: /* i: getting distance extra */
+ j = c->sub.copy.get;
+ NEEDBITS(j)
+ c->sub.copy.dist += (uInt)b & inflate_mask[j];
+ DUMPBITS(j)
+ Tracevv((stderr, "inflate: distance %u\n", c->sub.copy.dist));
+ c->mode = COPY;
+ case COPY: /* o: copying bytes in window, waiting for space */
+#ifndef __TURBOC__ /* Turbo C bug for following expression */
+ f = (uInt)(q - s->window) < c->sub.copy.dist ?
+ s->end - (c->sub.copy.dist - (q - s->window)) :
+ q - c->sub.copy.dist;
+#else
+ f = q - c->sub.copy.dist;
+ if ((uInt)(q - s->window) < c->sub.copy.dist)
+ f = s->end - (c->sub.copy.dist - (uInt)(q - s->window));
+#endif
+ while (c->len)
+ {
+ NEEDOUT
+ OUTBYTE(*f++)
+ if (f == s->end)
+ f = s->window;
+ c->len--;
+ }
+ c->mode = START;
+ break;
+ case LIT: /* o: got literal, waiting for output space */
+ NEEDOUT
+ OUTBYTE(c->sub.lit)
+ c->mode = START;
+ break;
+ case WASH: /* o: got eob, possibly more output */
+ if (k > 7) /* return unused byte, if any */
+ {
+ Assert(k < 16, "inflate_codes grabbed too many bytes")
+ k -= 8;
+ n++;
+ p--; /* can always return one */
+ }
+ FLUSH
+ if (s->read != s->write)
+ LEAVE
+ c->mode = END;
+ case END:
+ r = Z_STREAM_END;
+ LEAVE
+ case BADCODE: /* x: got error */
+ r = Z_DATA_ERROR;
+ LEAVE
+ default:
+ r = Z_STREAM_ERROR;
+ LEAVE
+ }
+#ifdef NEED_DUMMY_RETURN
+ return Z_STREAM_ERROR; /* Some dumb compilers complain without this */
+#endif
+}
+
+
+void inflate_codes_free(c, z)
+inflate_codes_statef *c;
+z_streamp z;
+{
+ ZFREE(z, c);
+ Tracev((stderr, "inflate: codes free\n"));
+}
diff --git a/win32/contrib/zlib/infcodes.h b/win32/contrib/zlib/infcodes.h new file mode 100644 index 000000000..795773577 --- /dev/null +++ b/win32/contrib/zlib/infcodes.h @@ -0,0 +1,27 @@ +/* infcodes.h -- header to use infcodes.c
+ * Copyright (C) 1995-1998 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+ part of the implementation of the compression library and is
+ subject to change. Applications should only use zlib.h.
+ */
+
+struct inflate_codes_state;
+typedef struct inflate_codes_state FAR inflate_codes_statef;
+
+extern inflate_codes_statef *inflate_codes_new OF((
+ uInt, uInt,
+ inflate_huft *, inflate_huft *,
+ z_streamp ));
+
+extern int inflate_codes OF((
+ inflate_blocks_statef *,
+ z_streamp ,
+ int));
+
+extern void inflate_codes_free OF((
+ inflate_codes_statef *,
+ z_streamp ));
+
diff --git a/win32/contrib/zlib/inffast.c b/win32/contrib/zlib/inffast.c new file mode 100644 index 000000000..641ccdc40 --- /dev/null +++ b/win32/contrib/zlib/inffast.c @@ -0,0 +1,170 @@ +/* inffast.c -- process literals and length/distance pairs fast
+ * Copyright (C) 1995-1998 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+#include "zutil.h"
+#include "inftrees.h"
+#include "infblock.h"
+#include "infcodes.h"
+#include "infutil.h"
+#include "inffast.h"
+
+struct inflate_codes_state {int dummy;}; /* for buggy compilers */
+
+/* simplify the use of the inflate_huft type with some defines */
+#define exop word.what.Exop
+#define bits word.what.Bits
+
+/* macros for bit input with no checking and for returning unused bytes */
+#define GRABBITS(j) {while(k<(j)){b|=((uLong)NEXTBYTE)<<k;k+=8;}}
+#define UNGRAB {c=z->avail_in-n;c=(k>>3)<c?k>>3:c;n+=c;p-=c;k-=c<<3;}
+
+/* Called with number of bytes left to write in window at least 258
+ (the maximum string length) and number of input bytes available
+ at least ten. The ten bytes are six bytes for the longest length/
+ distance pair plus four bytes for overloading the bit buffer. */
+
+int inflate_fast(bl, bd, tl, td, s, z)
+uInt bl, bd;
+inflate_huft *tl;
+inflate_huft *td; /* need separate declaration for Borland C++ */
+inflate_blocks_statef *s;
+z_streamp z;
+{
+ inflate_huft *t; /* temporary pointer */
+ uInt e; /* extra bits or operation */
+ uLong b; /* bit buffer */
+ uInt k; /* bits in bit buffer */
+ Bytef *p; /* input data pointer */
+ uInt n; /* bytes available there */
+ Bytef *q; /* output window write pointer */
+ uInt m; /* bytes to end of window or read pointer */
+ uInt ml; /* mask for literal/length tree */
+ uInt md; /* mask for distance tree */
+ uInt c; /* bytes to copy */
+ uInt d; /* distance back to copy from */
+ Bytef *r; /* copy source pointer */
+
+ /* load input, output, bit values */
+ LOAD
+
+ /* initialize masks */
+ ml = inflate_mask[bl];
+ md = inflate_mask[bd];
+
+ /* do until not enough input or output space for fast loop */
+ do { /* assume called with m >= 258 && n >= 10 */
+ /* get literal/length code */
+ GRABBITS(20) /* max bits for literal/length code */
+ if ((e = (t = tl + ((uInt)b & ml))->exop) == 0)
+ {
+ DUMPBITS(t->bits)
+ Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ?
+ "inflate: * literal '%c'\n" :
+ "inflate: * literal 0x%02x\n", t->base));
+ *q++ = (Byte)t->base;
+ m--;
+ continue;
+ }
+ do {
+ DUMPBITS(t->bits)
+ if (e & 16)
+ {
+ /* get extra bits for length */
+ e &= 15;
+ c = t->base + ((uInt)b & inflate_mask[e]);
+ DUMPBITS(e)
+ Tracevv((stderr, "inflate: * length %u\n", c));
+
+ /* decode distance base of block to copy */
+ GRABBITS(15); /* max bits for distance code */
+ e = (t = td + ((uInt)b & md))->exop;
+ do {
+ DUMPBITS(t->bits)
+ if (e & 16)
+ {
+ /* get extra bits to add to distance base */
+ e &= 15;
+ GRABBITS(e) /* get extra bits (up to 13) */
+ d = t->base + ((uInt)b & inflate_mask[e]);
+ DUMPBITS(e)
+ Tracevv((stderr, "inflate: * distance %u\n", d));
+
+ /* do the copy */
+ m -= c;
+ if ((uInt)(q - s->window) >= d) /* offset before dest */
+ { /* just copy */
+ r = q - d;
+ *q++ = *r++; c--; /* minimum count is three, */
+ *q++ = *r++; c--; /* so unroll loop a little */
+ }
+ else /* else offset after destination */
+ {
+ e = d - (uInt)(q - s->window); /* bytes from offset to end */
+ r = s->end - e; /* pointer to offset */
+ if (c > e) /* if source crosses, */
+ {
+ c -= e; /* copy to end of window */
+ do {
+ *q++ = *r++;
+ } while (--e);
+ r = s->window; /* copy rest from start of window */
+ }
+ }
+ do { /* copy all or what's left */
+ *q++ = *r++;
+ } while (--c);
+ break;
+ }
+ else if ((e & 64) == 0)
+ {
+ t += t->base;
+ e = (t += ((uInt)b & inflate_mask[e]))->exop;
+ }
+ else
+ {
+ z->msg = (char*)"invalid distance code";
+ UNGRAB
+ UPDATE
+ return Z_DATA_ERROR;
+ }
+ } while (1);
+ break;
+ }
+ if ((e & 64) == 0)
+ {
+ t += t->base;
+ if ((e = (t += ((uInt)b & inflate_mask[e]))->exop) == 0)
+ {
+ DUMPBITS(t->bits)
+ Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ?
+ "inflate: * literal '%c'\n" :
+ "inflate: * literal 0x%02x\n", t->base));
+ *q++ = (Byte)t->base;
+ m--;
+ break;
+ }
+ }
+ else if (e & 32)
+ {
+ Tracevv((stderr, "inflate: * end of block\n"));
+ UNGRAB
+ UPDATE
+ return Z_STREAM_END;
+ }
+ else
+ {
+ z->msg = (char*)"invalid literal/length code";
+ UNGRAB
+ UPDATE
+ return Z_DATA_ERROR;
+ }
+ } while (1);
+ } while (m >= 258 && n >= 10);
+
+ /* not enough input or output--restore pointers and return */
+ UNGRAB
+ UPDATE
+ return Z_OK;
+}
diff --git a/win32/contrib/zlib/inffast.h b/win32/contrib/zlib/inffast.h new file mode 100644 index 000000000..c6d96f4b4 --- /dev/null +++ b/win32/contrib/zlib/inffast.h @@ -0,0 +1,17 @@ +/* inffast.h -- header to use inffast.c
+ * Copyright (C) 1995-1998 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+ part of the implementation of the compression library and is
+ subject to change. Applications should only use zlib.h.
+ */
+
+extern int inflate_fast OF((
+ uInt,
+ uInt,
+ inflate_huft *,
+ inflate_huft *,
+ inflate_blocks_statef *,
+ z_streamp ));
diff --git a/win32/contrib/zlib/inffixed.h b/win32/contrib/zlib/inffixed.h new file mode 100644 index 000000000..e997507c3 --- /dev/null +++ b/win32/contrib/zlib/inffixed.h @@ -0,0 +1,151 @@ +/* inffixed.h -- table for decoding fixed codes
+ * Generated automatically by the maketree.c program
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+ part of the implementation of the compression library and is
+ subject to change. Applications should only use zlib.h.
+ */
+
+local uInt fixed_bl = 9;
+local uInt fixed_bd = 5;
+local inflate_huft fixed_tl[] = {
+ {{{96,7}},256}, {{{0,8}},80}, {{{0,8}},16}, {{{84,8}},115},
+ {{{82,7}},31}, {{{0,8}},112}, {{{0,8}},48}, {{{0,9}},192},
+ {{{80,7}},10}, {{{0,8}},96}, {{{0,8}},32}, {{{0,9}},160},
+ {{{0,8}},0}, {{{0,8}},128}, {{{0,8}},64}, {{{0,9}},224},
+ {{{80,7}},6}, {{{0,8}},88}, {{{0,8}},24}, {{{0,9}},144},
+ {{{83,7}},59}, {{{0,8}},120}, {{{0,8}},56}, {{{0,9}},208},
+ {{{81,7}},17}, {{{0,8}},104}, {{{0,8}},40}, {{{0,9}},176},
+ {{{0,8}},8}, {{{0,8}},136}, {{{0,8}},72}, {{{0,9}},240},
+ {{{80,7}},4}, {{{0,8}},84}, {{{0,8}},20}, {{{85,8}},227},
+ {{{83,7}},43}, {{{0,8}},116}, {{{0,8}},52}, {{{0,9}},200},
+ {{{81,7}},13}, {{{0,8}},100}, {{{0,8}},36}, {{{0,9}},168},
+ {{{0,8}},4}, {{{0,8}},132}, {{{0,8}},68}, {{{0,9}},232},
+ {{{80,7}},8}, {{{0,8}},92}, {{{0,8}},28}, {{{0,9}},152},
+ {{{84,7}},83}, {{{0,8}},124}, {{{0,8}},60}, {{{0,9}},216},
+ {{{82,7}},23}, {{{0,8}},108}, {{{0,8}},44}, {{{0,9}},184},
+ {{{0,8}},12}, {{{0,8}},140}, {{{0,8}},76}, {{{0,9}},248},
+ {{{80,7}},3}, {{{0,8}},82}, {{{0,8}},18}, {{{85,8}},163},
+ {{{83,7}},35}, {{{0,8}},114}, {{{0,8}},50}, {{{0,9}},196},
+ {{{81,7}},11}, {{{0,8}},98}, {{{0,8}},34}, {{{0,9}},164},
+ {{{0,8}},2}, {{{0,8}},130}, {{{0,8}},66}, {{{0,9}},228},
+ {{{80,7}},7}, {{{0,8}},90}, {{{0,8}},26}, {{{0,9}},148},
+ {{{84,7}},67}, {{{0,8}},122}, {{{0,8}},58}, {{{0,9}},212},
+ {{{82,7}},19}, {{{0,8}},106}, {{{0,8}},42}, {{{0,9}},180},
+ {{{0,8}},10}, {{{0,8}},138}, {{{0,8}},74}, {{{0,9}},244},
+ {{{80,7}},5}, {{{0,8}},86}, {{{0,8}},22}, {{{192,8}},0},
+ {{{83,7}},51}, {{{0,8}},118}, {{{0,8}},54}, {{{0,9}},204},
+ {{{81,7}},15}, {{{0,8}},102}, {{{0,8}},38}, {{{0,9}},172},
+ {{{0,8}},6}, {{{0,8}},134}, {{{0,8}},70}, {{{0,9}},236},
+ {{{80,7}},9}, {{{0,8}},94}, {{{0,8}},30}, {{{0,9}},156},
+ {{{84,7}},99}, {{{0,8}},126}, {{{0,8}},62}, {{{0,9}},220},
+ {{{82,7}},27}, {{{0,8}},110}, {{{0,8}},46}, {{{0,9}},188},
+ {{{0,8}},14}, {{{0,8}},142}, {{{0,8}},78}, {{{0,9}},252},
+ {{{96,7}},256}, {{{0,8}},81}, {{{0,8}},17}, {{{85,8}},131},
+ {{{82,7}},31}, {{{0,8}},113}, {{{0,8}},49}, {{{0,9}},194},
+ {{{80,7}},10}, {{{0,8}},97}, {{{0,8}},33}, {{{0,9}},162},
+ {{{0,8}},1}, {{{0,8}},129}, {{{0,8}},65}, {{{0,9}},226},
+ {{{80,7}},6}, {{{0,8}},89}, {{{0,8}},25}, {{{0,9}},146},
+ {{{83,7}},59}, {{{0,8}},121}, {{{0,8}},57}, {{{0,9}},210},
+ {{{81,7}},17}, {{{0,8}},105}, {{{0,8}},41}, {{{0,9}},178},
+ {{{0,8}},9}, {{{0,8}},137}, {{{0,8}},73}, {{{0,9}},242},
+ {{{80,7}},4}, {{{0,8}},85}, {{{0,8}},21}, {{{80,8}},258},
+ {{{83,7}},43}, {{{0,8}},117}, {{{0,8}},53}, {{{0,9}},202},
+ {{{81,7}},13}, {{{0,8}},101}, {{{0,8}},37}, {{{0,9}},170},
+ {{{0,8}},5}, {{{0,8}},133}, {{{0,8}},69}, {{{0,9}},234},
+ {{{80,7}},8}, {{{0,8}},93}, {{{0,8}},29}, {{{0,9}},154},
+ {{{84,7}},83}, {{{0,8}},125}, {{{0,8}},61}, {{{0,9}},218},
+ {{{82,7}},23}, {{{0,8}},109}, {{{0,8}},45}, {{{0,9}},186},
+ {{{0,8}},13}, {{{0,8}},141}, {{{0,8}},77}, {{{0,9}},250},
+ {{{80,7}},3}, {{{0,8}},83}, {{{0,8}},19}, {{{85,8}},195},
+ {{{83,7}},35}, {{{0,8}},115}, {{{0,8}},51}, {{{0,9}},198},
+ {{{81,7}},11}, {{{0,8}},99}, {{{0,8}},35}, {{{0,9}},166},
+ {{{0,8}},3}, {{{0,8}},131}, {{{0,8}},67}, {{{0,9}},230},
+ {{{80,7}},7}, {{{0,8}},91}, {{{0,8}},27}, {{{0,9}},150},
+ {{{84,7}},67}, {{{0,8}},123}, {{{0,8}},59}, {{{0,9}},214},
+ {{{82,7}},19}, {{{0,8}},107}, {{{0,8}},43}, {{{0,9}},182},
+ {{{0,8}},11}, {{{0,8}},139}, {{{0,8}},75}, {{{0,9}},246},
+ {{{80,7}},5}, {{{0,8}},87}, {{{0,8}},23}, {{{192,8}},0},
+ {{{83,7}},51}, {{{0,8}},119}, {{{0,8}},55}, {{{0,9}},206},
+ {{{81,7}},15}, {{{0,8}},103}, {{{0,8}},39}, {{{0,9}},174},
+ {{{0,8}},7}, {{{0,8}},135}, {{{0,8}},71}, {{{0,9}},238},
+ {{{80,7}},9}, {{{0,8}},95}, {{{0,8}},31}, {{{0,9}},158},
+ {{{84,7}},99}, {{{0,8}},127}, {{{0,8}},63}, {{{0,9}},222},
+ {{{82,7}},27}, {{{0,8}},111}, {{{0,8}},47}, {{{0,9}},190},
+ {{{0,8}},15}, {{{0,8}},143}, {{{0,8}},79}, {{{0,9}},254},
+ {{{96,7}},256}, {{{0,8}},80}, {{{0,8}},16}, {{{84,8}},115},
+ {{{82,7}},31}, {{{0,8}},112}, {{{0,8}},48}, {{{0,9}},193},
+ {{{80,7}},10}, {{{0,8}},96}, {{{0,8}},32}, {{{0,9}},161},
+ {{{0,8}},0}, {{{0,8}},128}, {{{0,8}},64}, {{{0,9}},225},
+ {{{80,7}},6}, {{{0,8}},88}, {{{0,8}},24}, {{{0,9}},145},
+ {{{83,7}},59}, {{{0,8}},120}, {{{0,8}},56}, {{{0,9}},209},
+ {{{81,7}},17}, {{{0,8}},104}, {{{0,8}},40}, {{{0,9}},177},
+ {{{0,8}},8}, {{{0,8}},136}, {{{0,8}},72}, {{{0,9}},241},
+ {{{80,7}},4}, {{{0,8}},84}, {{{0,8}},20}, {{{85,8}},227},
+ {{{83,7}},43}, {{{0,8}},116}, {{{0,8}},52}, {{{0,9}},201},
+ {{{81,7}},13}, {{{0,8}},100}, {{{0,8}},36}, {{{0,9}},169},
+ {{{0,8}},4}, {{{0,8}},132}, {{{0,8}},68}, {{{0,9}},233},
+ {{{80,7}},8}, {{{0,8}},92}, {{{0,8}},28}, {{{0,9}},153},
+ {{{84,7}},83}, {{{0,8}},124}, {{{0,8}},60}, {{{0,9}},217},
+ {{{82,7}},23}, {{{0,8}},108}, {{{0,8}},44}, {{{0,9}},185},
+ {{{0,8}},12}, {{{0,8}},140}, {{{0,8}},76}, {{{0,9}},249},
+ {{{80,7}},3}, {{{0,8}},82}, {{{0,8}},18}, {{{85,8}},163},
+ {{{83,7}},35}, {{{0,8}},114}, {{{0,8}},50}, {{{0,9}},197},
+ {{{81,7}},11}, {{{0,8}},98}, {{{0,8}},34}, {{{0,9}},165},
+ {{{0,8}},2}, {{{0,8}},130}, {{{0,8}},66}, {{{0,9}},229},
+ {{{80,7}},7}, {{{0,8}},90}, {{{0,8}},26}, {{{0,9}},149},
+ {{{84,7}},67}, {{{0,8}},122}, {{{0,8}},58}, {{{0,9}},213},
+ {{{82,7}},19}, {{{0,8}},106}, {{{0,8}},42}, {{{0,9}},181},
+ {{{0,8}},10}, {{{0,8}},138}, {{{0,8}},74}, {{{0,9}},245},
+ {{{80,7}},5}, {{{0,8}},86}, {{{0,8}},22}, {{{192,8}},0},
+ {{{83,7}},51}, {{{0,8}},118}, {{{0,8}},54}, {{{0,9}},205},
+ {{{81,7}},15}, {{{0,8}},102}, {{{0,8}},38}, {{{0,9}},173},
+ {{{0,8}},6}, {{{0,8}},134}, {{{0,8}},70}, {{{0,9}},237},
+ {{{80,7}},9}, {{{0,8}},94}, {{{0,8}},30}, {{{0,9}},157},
+ {{{84,7}},99}, {{{0,8}},126}, {{{0,8}},62}, {{{0,9}},221},
+ {{{82,7}},27}, {{{0,8}},110}, {{{0,8}},46}, {{{0,9}},189},
+ {{{0,8}},14}, {{{0,8}},142}, {{{0,8}},78}, {{{0,9}},253},
+ {{{96,7}},256}, {{{0,8}},81}, {{{0,8}},17}, {{{85,8}},131},
+ {{{82,7}},31}, {{{0,8}},113}, {{{0,8}},49}, {{{0,9}},195},
+ {{{80,7}},10}, {{{0,8}},97}, {{{0,8}},33}, {{{0,9}},163},
+ {{{0,8}},1}, {{{0,8}},129}, {{{0,8}},65}, {{{0,9}},227},
+ {{{80,7}},6}, {{{0,8}},89}, {{{0,8}},25}, {{{0,9}},147},
+ {{{83,7}},59}, {{{0,8}},121}, {{{0,8}},57}, {{{0,9}},211},
+ {{{81,7}},17}, {{{0,8}},105}, {{{0,8}},41}, {{{0,9}},179},
+ {{{0,8}},9}, {{{0,8}},137}, {{{0,8}},73}, {{{0,9}},243},
+ {{{80,7}},4}, {{{0,8}},85}, {{{0,8}},21}, {{{80,8}},258},
+ {{{83,7}},43}, {{{0,8}},117}, {{{0,8}},53}, {{{0,9}},203},
+ {{{81,7}},13}, {{{0,8}},101}, {{{0,8}},37}, {{{0,9}},171},
+ {{{0,8}},5}, {{{0,8}},133}, {{{0,8}},69}, {{{0,9}},235},
+ {{{80,7}},8}, {{{0,8}},93}, {{{0,8}},29}, {{{0,9}},155},
+ {{{84,7}},83}, {{{0,8}},125}, {{{0,8}},61}, {{{0,9}},219},
+ {{{82,7}},23}, {{{0,8}},109}, {{{0,8}},45}, {{{0,9}},187},
+ {{{0,8}},13}, {{{0,8}},141}, {{{0,8}},77}, {{{0,9}},251},
+ {{{80,7}},3}, {{{0,8}},83}, {{{0,8}},19}, {{{85,8}},195},
+ {{{83,7}},35}, {{{0,8}},115}, {{{0,8}},51}, {{{0,9}},199},
+ {{{81,7}},11}, {{{0,8}},99}, {{{0,8}},35}, {{{0,9}},167},
+ {{{0,8}},3}, {{{0,8}},131}, {{{0,8}},67}, {{{0,9}},231},
+ {{{80,7}},7}, {{{0,8}},91}, {{{0,8}},27}, {{{0,9}},151},
+ {{{84,7}},67}, {{{0,8}},123}, {{{0,8}},59}, {{{0,9}},215},
+ {{{82,7}},19}, {{{0,8}},107}, {{{0,8}},43}, {{{0,9}},183},
+ {{{0,8}},11}, {{{0,8}},139}, {{{0,8}},75}, {{{0,9}},247},
+ {{{80,7}},5}, {{{0,8}},87}, {{{0,8}},23}, {{{192,8}},0},
+ {{{83,7}},51}, {{{0,8}},119}, {{{0,8}},55}, {{{0,9}},207},
+ {{{81,7}},15}, {{{0,8}},103}, {{{0,8}},39}, {{{0,9}},175},
+ {{{0,8}},7}, {{{0,8}},135}, {{{0,8}},71}, {{{0,9}},239},
+ {{{80,7}},9}, {{{0,8}},95}, {{{0,8}},31}, {{{0,9}},159},
+ {{{84,7}},99}, {{{0,8}},127}, {{{0,8}},63}, {{{0,9}},223},
+ {{{82,7}},27}, {{{0,8}},111}, {{{0,8}},47}, {{{0,9}},191},
+ {{{0,8}},15}, {{{0,8}},143}, {{{0,8}},79}, {{{0,9}},255}
+ };
+local inflate_huft fixed_td[] = {
+ {{{80,5}},1}, {{{87,5}},257}, {{{83,5}},17}, {{{91,5}},4097},
+ {{{81,5}},5}, {{{89,5}},1025}, {{{85,5}},65}, {{{93,5}},16385},
+ {{{80,5}},3}, {{{88,5}},513}, {{{84,5}},33}, {{{92,5}},8193},
+ {{{82,5}},9}, {{{90,5}},2049}, {{{86,5}},129}, {{{192,5}},24577},
+ {{{80,5}},2}, {{{87,5}},385}, {{{83,5}},25}, {{{91,5}},6145},
+ {{{81,5}},7}, {{{89,5}},1537}, {{{85,5}},97}, {{{93,5}},24577},
+ {{{80,5}},4}, {{{88,5}},769}, {{{84,5}},49}, {{{92,5}},12289},
+ {{{82,5}},13}, {{{90,5}},3073}, {{{86,5}},193}, {{{192,5}},24577}
+ };
diff --git a/win32/contrib/zlib/inflate.c b/win32/contrib/zlib/inflate.c new file mode 100644 index 000000000..103fc2fa2 --- /dev/null +++ b/win32/contrib/zlib/inflate.c @@ -0,0 +1,366 @@ +/* inflate.c -- zlib interface to inflate modules
+ * Copyright (C) 1995-1998 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+#include "zutil.h"
+#include "infblock.h"
+
+struct inflate_blocks_state {int dummy;}; /* for buggy compilers */
+
+typedef enum {
+ METHOD, /* waiting for method byte */
+ FLAG, /* waiting for flag byte */
+ DICT4, /* four dictionary check bytes to go */
+ DICT3, /* three dictionary check bytes to go */
+ DICT2, /* two dictionary check bytes to go */
+ DICT1, /* one dictionary check byte to go */
+ DICT0, /* waiting for inflateSetDictionary */
+ BLOCKS, /* decompressing blocks */
+ CHECK4, /* four check bytes to go */
+ CHECK3, /* three check bytes to go */
+ CHECK2, /* two check bytes to go */
+ CHECK1, /* one check byte to go */
+ DONE, /* finished check, done */
+ BAD} /* got an error--stay here */
+inflate_mode;
+
+/* inflate private state */
+struct internal_state {
+
+ /* mode */
+ inflate_mode mode; /* current inflate mode */
+
+ /* mode dependent information */
+ union {
+ uInt method; /* if FLAGS, method byte */
+ struct {
+ uLong was; /* computed check value */
+ uLong need; /* stream check value */
+ } check; /* if CHECK, check values to compare */
+ uInt marker; /* if BAD, inflateSync's marker bytes count */
+ } sub; /* submode */
+
+ /* mode independent information */
+ int nowrap; /* flag for no wrapper */
+ uInt wbits; /* log2(window size) (8..15, defaults to 15) */
+ inflate_blocks_statef
+ *blocks; /* current inflate_blocks state */
+
+};
+
+
+int ZEXPORT inflateReset(z)
+z_streamp z;
+{
+ if (z == Z_NULL || z->state == Z_NULL)
+ return Z_STREAM_ERROR;
+ z->total_in = z->total_out = 0;
+ z->msg = Z_NULL;
+ z->state->mode = z->state->nowrap ? BLOCKS : METHOD;
+ inflate_blocks_reset(z->state->blocks, z, Z_NULL);
+ Tracev((stderr, "inflate: reset\n"));
+ return Z_OK;
+}
+
+
+int ZEXPORT inflateEnd(z)
+z_streamp z;
+{
+ if (z == Z_NULL || z->state == Z_NULL || z->zfree == Z_NULL)
+ return Z_STREAM_ERROR;
+ if (z->state->blocks != Z_NULL)
+ inflate_blocks_free(z->state->blocks, z);
+ ZFREE(z, z->state);
+ z->state = Z_NULL;
+ Tracev((stderr, "inflate: end\n"));
+ return Z_OK;
+}
+
+
+int ZEXPORT inflateInit2_(z, w, version, stream_size)
+z_streamp z;
+int w;
+const char *version;
+int stream_size;
+{
+ if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
+ stream_size != sizeof(z_stream))
+ return Z_VERSION_ERROR;
+
+ /* initialize state */
+ if (z == Z_NULL)
+ return Z_STREAM_ERROR;
+ z->msg = Z_NULL;
+ if (z->zalloc == Z_NULL)
+ {
+ z->zalloc = zcalloc;
+ z->opaque = (voidpf)0;
+ }
+ if (z->zfree == Z_NULL) z->zfree = zcfree;
+ if ((z->state = (struct internal_state FAR *)
+ ZALLOC(z,1,sizeof(struct internal_state))) == Z_NULL)
+ return Z_MEM_ERROR;
+ z->state->blocks = Z_NULL;
+
+ /* handle undocumented nowrap option (no zlib header or check) */
+ z->state->nowrap = 0;
+ if (w < 0)
+ {
+ w = - w;
+ z->state->nowrap = 1;
+ }
+
+ /* set window size */
+ if (w < 8 || w > 15)
+ {
+ inflateEnd(z);
+ return Z_STREAM_ERROR;
+ }
+ z->state->wbits = (uInt)w;
+
+ /* create inflate_blocks state */
+ if ((z->state->blocks =
+ inflate_blocks_new(z, z->state->nowrap ? Z_NULL : adler32, (uInt)1 << w))
+ == Z_NULL)
+ {
+ inflateEnd(z);
+ return Z_MEM_ERROR;
+ }
+ Tracev((stderr, "inflate: allocated\n"));
+
+ /* reset state */
+ inflateReset(z);
+ return Z_OK;
+}
+
+
+int ZEXPORT inflateInit_(z, version, stream_size)
+z_streamp z;
+const char *version;
+int stream_size;
+{
+ return inflateInit2_(z, DEF_WBITS, version, stream_size);
+}
+
+
+#define NEEDBYTE {if(z->avail_in==0)return r;r=f;}
+#define NEXTBYTE (z->avail_in--,z->total_in++,*z->next_in++)
+
+int ZEXPORT inflate(z, f)
+z_streamp z;
+int f;
+{
+ int r;
+ uInt b;
+
+ if (z == Z_NULL || z->state == Z_NULL || z->next_in == Z_NULL)
+ return Z_STREAM_ERROR;
+ f = f == Z_FINISH ? Z_BUF_ERROR : Z_OK;
+ r = Z_BUF_ERROR;
+ while (1) switch (z->state->mode)
+ {
+ case METHOD:
+ NEEDBYTE
+ if (((z->state->sub.method = NEXTBYTE) & 0xf) != Z_DEFLATED)
+ {
+ z->state->mode = BAD;
+ z->msg = (char*)"unknown compression method";
+ z->state->sub.marker = 5; /* can't try inflateSync */
+ break;
+ }
+ if ((z->state->sub.method >> 4) + 8 > z->state->wbits)
+ {
+ z->state->mode = BAD;
+ z->msg = (char*)"invalid window size";
+ z->state->sub.marker = 5; /* can't try inflateSync */
+ break;
+ }
+ z->state->mode = FLAG;
+ case FLAG:
+ NEEDBYTE
+ b = NEXTBYTE;
+ if (((z->state->sub.method << 8) + b) % 31)
+ {
+ z->state->mode = BAD;
+ z->msg = (char*)"incorrect header check";
+ z->state->sub.marker = 5; /* can't try inflateSync */
+ break;
+ }
+ Tracev((stderr, "inflate: zlib header ok\n"));
+ if (!(b & PRESET_DICT))
+ {
+ z->state->mode = BLOCKS;
+ break;
+ }
+ z->state->mode = DICT4;
+ case DICT4:
+ NEEDBYTE
+ z->state->sub.check.need = (uLong)NEXTBYTE << 24;
+ z->state->mode = DICT3;
+ case DICT3:
+ NEEDBYTE
+ z->state->sub.check.need += (uLong)NEXTBYTE << 16;
+ z->state->mode = DICT2;
+ case DICT2:
+ NEEDBYTE
+ z->state->sub.check.need += (uLong)NEXTBYTE << 8;
+ z->state->mode = DICT1;
+ case DICT1:
+ NEEDBYTE
+ z->state->sub.check.need += (uLong)NEXTBYTE;
+ z->adler = z->state->sub.check.need;
+ z->state->mode = DICT0;
+ return Z_NEED_DICT;
+ case DICT0:
+ z->state->mode = BAD;
+ z->msg = (char*)"need dictionary";
+ z->state->sub.marker = 0; /* can try inflateSync */
+ return Z_STREAM_ERROR;
+ case BLOCKS:
+ r = inflate_blocks(z->state->blocks, z, r);
+ if (r == Z_DATA_ERROR)
+ {
+ z->state->mode = BAD;
+ z->state->sub.marker = 0; /* can try inflateSync */
+ break;
+ }
+ if (r == Z_OK)
+ r = f;
+ if (r != Z_STREAM_END)
+ return r;
+ r = f;
+ inflate_blocks_reset(z->state->blocks, z, &z->state->sub.check.was);
+ if (z->state->nowrap)
+ {
+ z->state->mode = DONE;
+ break;
+ }
+ z->state->mode = CHECK4;
+ case CHECK4:
+ NEEDBYTE
+ z->state->sub.check.need = (uLong)NEXTBYTE << 24;
+ z->state->mode = CHECK3;
+ case CHECK3:
+ NEEDBYTE
+ z->state->sub.check.need += (uLong)NEXTBYTE << 16;
+ z->state->mode = CHECK2;
+ case CHECK2:
+ NEEDBYTE
+ z->state->sub.check.need += (uLong)NEXTBYTE << 8;
+ z->state->mode = CHECK1;
+ case CHECK1:
+ NEEDBYTE
+ z->state->sub.check.need += (uLong)NEXTBYTE;
+
+ if (z->state->sub.check.was != z->state->sub.check.need)
+ {
+ z->state->mode = BAD;
+ z->msg = (char*)"incorrect data check";
+ z->state->sub.marker = 5; /* can't try inflateSync */
+ break;
+ }
+ Tracev((stderr, "inflate: zlib check ok\n"));
+ z->state->mode = DONE;
+ case DONE:
+ return Z_STREAM_END;
+ case BAD:
+ return Z_DATA_ERROR;
+ default:
+ return Z_STREAM_ERROR;
+ }
+#ifdef NEED_DUMMY_RETURN
+ return Z_STREAM_ERROR; /* Some dumb compilers complain without this */
+#endif
+}
+
+
+int ZEXPORT inflateSetDictionary(z, dictionary, dictLength)
+z_streamp z;
+const Bytef *dictionary;
+uInt dictLength;
+{
+ uInt length = dictLength;
+
+ if (z == Z_NULL || z->state == Z_NULL || z->state->mode != DICT0)
+ return Z_STREAM_ERROR;
+
+ if (adler32(1L, dictionary, dictLength) != z->adler) return Z_DATA_ERROR;
+ z->adler = 1L;
+
+ if (length >= ((uInt)1<<z->state->wbits))
+ {
+ length = (1<<z->state->wbits)-1;
+ dictionary += dictLength - length;
+ }
+ inflate_set_dictionary(z->state->blocks, dictionary, length);
+ z->state->mode = BLOCKS;
+ return Z_OK;
+}
+
+
+int ZEXPORT inflateSync(z)
+z_streamp z;
+{
+ uInt n; /* number of bytes to look at */
+ Bytef *p; /* pointer to bytes */
+ uInt m; /* number of marker bytes found in a row */
+ uLong r, w; /* temporaries to save total_in and total_out */
+
+ /* set up */
+ if (z == Z_NULL || z->state == Z_NULL)
+ return Z_STREAM_ERROR;
+ if (z->state->mode != BAD)
+ {
+ z->state->mode = BAD;
+ z->state->sub.marker = 0;
+ }
+ if ((n = z->avail_in) == 0)
+ return Z_BUF_ERROR;
+ p = z->next_in;
+ m = z->state->sub.marker;
+
+ /* search */
+ while (n && m < 4)
+ {
+ static const Byte mark[4] = {0, 0, 0xff, 0xff};
+ if (*p == mark[m])
+ m++;
+ else if (*p)
+ m = 0;
+ else
+ m = 4 - m;
+ p++, n--;
+ }
+
+ /* restore */
+ z->total_in += p - z->next_in;
+ z->next_in = p;
+ z->avail_in = n;
+ z->state->sub.marker = m;
+
+ /* return no joy or set up to restart on a new block */
+ if (m != 4)
+ return Z_DATA_ERROR;
+ r = z->total_in; w = z->total_out;
+ inflateReset(z);
+ z->total_in = r; z->total_out = w;
+ z->state->mode = BLOCKS;
+ return Z_OK;
+}
+
+
+/* Returns true if inflate is currently at the end of a block generated
+ * by Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP
+ * implementation to provide an additional safety check. PPP uses Z_SYNC_FLUSH
+ * but removes the length bytes of the resulting empty stored block. When
+ * decompressing, PPP checks that at the end of input packet, inflate is
+ * waiting for these length bytes.
+ */
+int ZEXPORT inflateSyncPoint(z)
+z_streamp z;
+{
+ if (z == Z_NULL || z->state == Z_NULL || z->state->blocks == Z_NULL)
+ return Z_STREAM_ERROR;
+ return inflate_blocks_sync_point(z->state->blocks);
+}
diff --git a/win32/contrib/zlib/inftrees.c b/win32/contrib/zlib/inftrees.c new file mode 100644 index 000000000..d21c36039 --- /dev/null +++ b/win32/contrib/zlib/inftrees.c @@ -0,0 +1,455 @@ +/* inftrees.c -- generate Huffman trees for efficient decoding
+ * Copyright (C) 1995-1998 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+#include "zutil.h"
+#include "inftrees.h"
+
+#if !defined(BUILDFIXED) && !defined(STDC)
+# define BUILDFIXED /* non ANSI compilers may not accept inffixed.h */
+#endif
+
+const char inflate_copyright[] =
+ " inflate 1.1.3 Copyright 1995-1998 Mark Adler ";
+/*
+ If you use the zlib library in a product, an acknowledgment is welcome
+ in the documentation of your product. If for some reason you cannot
+ include such an acknowledgment, I would appreciate that you keep this
+ copyright string in the executable of your product.
+ */
+struct internal_state {int dummy;}; /* for buggy compilers */
+
+/* simplify the use of the inflate_huft type with some defines */
+#define exop word.what.Exop
+#define bits word.what.Bits
+
+
+local int huft_build OF((
+ uIntf *, /* code lengths in bits */
+ uInt, /* number of codes */
+ uInt, /* number of "simple" codes */
+ const uIntf *, /* list of base values for non-simple codes */
+ const uIntf *, /* list of extra bits for non-simple codes */
+ inflate_huft * FAR*,/* result: starting table */
+ uIntf *, /* maximum lookup bits (returns actual) */
+ inflate_huft *, /* space for trees */
+ uInt *, /* hufts used in space */
+ uIntf * )); /* space for values */
+
+/* Tables for deflate from PKZIP's appnote.txt. */
+local const uInt cplens[31] = { /* Copy lengths for literal codes 257..285 */
+ 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
+ 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
+ /* see note #13 above about 258 */
+local const uInt cplext[31] = { /* Extra bits for literal codes 257..285 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
+ 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 112, 112}; /* 112==invalid */
+local const uInt cpdist[30] = { /* Copy offsets for distance codes 0..29 */
+ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
+ 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
+ 8193, 12289, 16385, 24577};
+local const uInt cpdext[30] = { /* Extra bits for distance codes */
+ 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
+ 7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
+ 12, 12, 13, 13};
+
+/*
+ Huffman code decoding is performed using a multi-level table lookup.
+ The fastest way to decode is to simply build a lookup table whose
+ size is determined by the longest code. However, the time it takes
+ to build this table can also be a factor if the data being decoded
+ is not very long. The most common codes are necessarily the
+ shortest codes, so those codes dominate the decoding time, and hence
+ the speed. The idea is you can have a shorter table that decodes the
+ shorter, more probable codes, and then point to subsidiary tables for
+ the longer codes. The time it costs to decode the longer codes is
+ then traded against the time it takes to make longer tables.
+
+ This results of this trade are in the variables lbits and dbits
+ below. lbits is the number of bits the first level table for literal/
+ length codes can decode in one step, and dbits is the same thing for
+ the distance codes. Subsequent tables are also less than or equal to
+ those sizes. These values may be adjusted either when all of the
+ codes are shorter than that, in which case the longest code length in
+ bits is used, or when the shortest code is *longer* than the requested
+ table size, in which case the length of the shortest code in bits is
+ used.
+
+ There are two different values for the two tables, since they code a
+ different number of possibilities each. The literal/length table
+ codes 286 possible values, or in a flat code, a little over eight
+ bits. The distance table codes 30 possible values, or a little less
+ than five bits, flat. The optimum values for speed end up being
+ about one bit more than those, so lbits is 8+1 and dbits is 5+1.
+ The optimum values may differ though from machine to machine, and
+ possibly even between compilers. Your mileage may vary.
+ */
+
+
+/* If BMAX needs to be larger than 16, then h and x[] should be uLong. */
+#define BMAX 15 /* maximum bit length of any code */
+
+local int huft_build(b, n, s, d, e, t, m, hp, hn, v)
+uIntf *b; /* code lengths in bits (all assumed <= BMAX) */
+uInt n; /* number of codes (assumed <= 288) */
+uInt s; /* number of simple-valued codes (0..s-1) */
+const uIntf *d; /* list of base values for non-simple codes */
+const uIntf *e; /* list of extra bits for non-simple codes */
+inflate_huft * FAR *t; /* result: starting table */
+uIntf *m; /* maximum lookup bits, returns actual */
+inflate_huft *hp; /* space for trees */
+uInt *hn; /* hufts used in space */
+uIntf *v; /* working area: values in order of bit length */
+/* Given a list of code lengths and a maximum table size, make a set of
+ tables to decode that set of codes. Return Z_OK on success, Z_BUF_ERROR
+ if the given code set is incomplete (the tables are still built in this
+ case), Z_DATA_ERROR if the input is invalid (an over-subscribed set of
+ lengths), or Z_MEM_ERROR if not enough memory. */
+{
+
+ uInt a; /* counter for codes of length k */
+ uInt c[BMAX+1]; /* bit length count table */
+ uInt f; /* i repeats in table every f entries */
+ int g; /* maximum code length */
+ int h; /* table level */
+ register uInt i; /* counter, current code */
+ register uInt j; /* counter */
+ register int k; /* number of bits in current code */
+ int l; /* bits per table (returned in m) */
+ uInt mask; /* (1 << w) - 1, to avoid cc -O bug on HP */
+ register uIntf *p; /* pointer into c[], b[], or v[] */
+ inflate_huft *q; /* points to current table */
+ struct inflate_huft_s r; /* table entry for structure assignment */
+ inflate_huft *u[BMAX]; /* table stack */
+ register int w; /* bits before this table == (l * h) */
+ uInt x[BMAX+1]; /* bit offsets, then code stack */
+ uIntf *xp; /* pointer into x */
+ int y; /* number of dummy codes added */
+ uInt z; /* number of entries in current table */
+
+
+ /* Generate counts for each bit length */
+ p = c;
+#define C0 *p++ = 0;
+#define C2 C0 C0 C0 C0
+#define C4 C2 C2 C2 C2
+ C4 /* clear c[]--assume BMAX+1 is 16 */
+ p = b; i = n;
+ do {
+ c[*p++]++; /* assume all entries <= BMAX */
+ } while (--i);
+ if (c[0] == n) /* null input--all zero length codes */
+ {
+ *t = (inflate_huft *)Z_NULL;
+ *m = 0;
+ return Z_OK;
+ }
+
+
+ /* Find minimum and maximum length, bound *m by those */
+ l = *m;
+ for (j = 1; j <= BMAX; j++)
+ if (c[j])
+ break;
+ k = j; /* minimum code length */
+ if ((uInt)l < j)
+ l = j;
+ for (i = BMAX; i; i--)
+ if (c[i])
+ break;
+ g = i; /* maximum code length */
+ if ((uInt)l > i)
+ l = i;
+ *m = l;
+
+
+ /* Adjust last length count to fill out codes, if needed */
+ for (y = 1 << j; j < i; j++, y <<= 1)
+ if ((y -= c[j]) < 0)
+ return Z_DATA_ERROR;
+ if ((y -= c[i]) < 0)
+ return Z_DATA_ERROR;
+ c[i] += y;
+
+
+ /* Generate starting offsets into the value table for each length */
+ x[1] = j = 0;
+ p = c + 1; xp = x + 2;
+ while (--i) { /* note that i == g from above */
+ *xp++ = (j += *p++);
+ }
+
+
+ /* Make a table of values in order of bit lengths */
+ p = b; i = 0;
+ do {
+ if ((j = *p++) != 0)
+ v[x[j]++] = i;
+ } while (++i < n);
+ n = x[g]; /* set n to length of v */
+
+
+ /* Generate the Huffman codes and for each, make the table entries */
+ x[0] = i = 0; /* first Huffman code is zero */
+ p = v; /* grab values in bit order */
+ h = -1; /* no tables yet--level -1 */
+ w = -l; /* bits decoded == (l * h) */
+ u[0] = (inflate_huft *)Z_NULL; /* just to keep compilers happy */
+ q = (inflate_huft *)Z_NULL; /* ditto */
+ z = 0; /* ditto */
+
+ /* go through the bit lengths (k already is bits in shortest code) */
+ for (; k <= g; k++)
+ {
+ a = c[k];
+ while (a--)
+ {
+ /* here i is the Huffman code of length k bits for value *p */
+ /* make tables up to required level */
+ while (k > w + l)
+ {
+ h++;
+ w += l; /* previous table always l bits */
+
+ /* compute minimum size table less than or equal to l bits */
+ z = g - w;
+ z = z > (uInt)l ? l : z; /* table size upper limit */
+ if ((f = 1 << (j = k - w)) > a + 1) /* try a k-w bit table */
+ { /* too few codes for k-w bit table */
+ f -= a + 1; /* deduct codes from patterns left */
+ xp = c + k;
+ if (j < z)
+ while (++j < z) /* try smaller tables up to z bits */
+ {
+ if ((f <<= 1) <= *++xp)
+ break; /* enough codes to use up j bits */
+ f -= *xp; /* else deduct codes from patterns */
+ }
+ }
+ z = 1 << j; /* table entries for j-bit table */
+
+ /* allocate new table */
+ if (*hn + z > MANY) /* (note: doesn't matter for fixed) */
+ return Z_MEM_ERROR; /* not enough memory */
+ u[h] = q = hp + *hn;
+ *hn += z;
+
+ /* connect to last table, if there is one */
+ if (h)
+ {
+ x[h] = i; /* save pattern for backing up */
+ r.bits = (Byte)l; /* bits to dump before this table */
+ r.exop = (Byte)j; /* bits in this table */
+ j = i >> (w - l);
+ r.base = (uInt)(q - u[h-1] - j); /* offset to this table */
+ u[h-1][j] = r; /* connect to last table */
+ }
+ else
+ *t = q; /* first table is returned result */
+ }
+
+ /* set up table entry in r */
+ r.bits = (Byte)(k - w);
+ if (p >= v + n)
+ r.exop = 128 + 64; /* out of values--invalid code */
+ else if (*p < s)
+ {
+ r.exop = (Byte)(*p < 256 ? 0 : 32 + 64); /* 256 is end-of-block */
+ r.base = *p++; /* simple code is just the value */
+ }
+ else
+ {
+ r.exop = (Byte)(e[*p - s] + 16 + 64);/* non-simple--look up in lists */
+ r.base = d[*p++ - s];
+ }
+
+ /* fill code-like entries with r */
+ f = 1 << (k - w);
+ for (j = i >> w; j < z; j += f)
+ q[j] = r;
+
+ /* backwards increment the k-bit code i */
+ for (j = 1 << (k - 1); i & j; j >>= 1)
+ i ^= j;
+ i ^= j;
+
+ /* backup over finished tables */
+ mask = (1 << w) - 1; /* needed on HP, cc -O bug */
+ while ((i & mask) != x[h])
+ {
+ h--; /* don't need to update q */
+ w -= l;
+ mask = (1 << w) - 1;
+ }
+ }
+ }
+
+
+ /* Return Z_BUF_ERROR if we were given an incomplete table */
+ return y != 0 && g != 1 ? Z_BUF_ERROR : Z_OK;
+}
+
+
+int inflate_trees_bits(c, bb, tb, hp, z)
+uIntf *c; /* 19 code lengths */
+uIntf *bb; /* bits tree desired/actual depth */
+inflate_huft * FAR *tb; /* bits tree result */
+inflate_huft *hp; /* space for trees */
+z_streamp z; /* for messages */
+{
+ int r;
+ uInt hn = 0; /* hufts used in space */
+ uIntf *v; /* work area for huft_build */
+
+ if ((v = (uIntf*)ZALLOC(z, 19, sizeof(uInt))) == Z_NULL)
+ return Z_MEM_ERROR;
+ r = huft_build(c, 19, 19, (uIntf*)Z_NULL, (uIntf*)Z_NULL,
+ tb, bb, hp, &hn, v);
+ if (r == Z_DATA_ERROR)
+ z->msg = (char*)"oversubscribed dynamic bit lengths tree";
+ else if (r == Z_BUF_ERROR || *bb == 0)
+ {
+ z->msg = (char*)"incomplete dynamic bit lengths tree";
+ r = Z_DATA_ERROR;
+ }
+ ZFREE(z, v);
+ return r;
+}
+
+
+int inflate_trees_dynamic(nl, nd, c, bl, bd, tl, td, hp, z)
+uInt nl; /* number of literal/length codes */
+uInt nd; /* number of distance codes */
+uIntf *c; /* that many (total) code lengths */
+uIntf *bl; /* literal desired/actual bit depth */
+uIntf *bd; /* distance desired/actual bit depth */
+inflate_huft * FAR *tl; /* literal/length tree result */
+inflate_huft * FAR *td; /* distance tree result */
+inflate_huft *hp; /* space for trees */
+z_streamp z; /* for messages */
+{
+ int r;
+ uInt hn = 0; /* hufts used in space */
+ uIntf *v; /* work area for huft_build */
+
+ /* allocate work area */
+ if ((v = (uIntf*)ZALLOC(z, 288, sizeof(uInt))) == Z_NULL)
+ return Z_MEM_ERROR;
+
+ /* build literal/length tree */
+ r = huft_build(c, nl, 257, cplens, cplext, tl, bl, hp, &hn, v);
+ if (r != Z_OK || *bl == 0)
+ {
+ if (r == Z_DATA_ERROR)
+ z->msg = (char*)"oversubscribed literal/length tree";
+ else if (r != Z_MEM_ERROR)
+ {
+ z->msg = (char*)"incomplete literal/length tree";
+ r = Z_DATA_ERROR;
+ }
+ ZFREE(z, v);
+ return r;
+ }
+
+ /* build distance tree */
+ r = huft_build(c + nl, nd, 0, cpdist, cpdext, td, bd, hp, &hn, v);
+ if (r != Z_OK || (*bd == 0 && nl > 257))
+ {
+ if (r == Z_DATA_ERROR)
+ z->msg = (char*)"oversubscribed distance tree";
+ else if (r == Z_BUF_ERROR) {
+#ifdef PKZIP_BUG_WORKAROUND
+ r = Z_OK;
+ }
+#else
+ z->msg = (char*)"incomplete distance tree";
+ r = Z_DATA_ERROR;
+ }
+ else if (r != Z_MEM_ERROR)
+ {
+ z->msg = (char*)"empty distance tree with lengths";
+ r = Z_DATA_ERROR;
+ }
+ ZFREE(z, v);
+ return r;
+#endif
+ }
+
+ /* done */
+ ZFREE(z, v);
+ return Z_OK;
+}
+
+
+/* build fixed tables only once--keep them here */
+#ifdef BUILDFIXED
+local int fixed_built = 0;
+#define FIXEDH 544 /* number of hufts used by fixed tables */
+local inflate_huft fixed_mem[FIXEDH];
+local uInt fixed_bl;
+local uInt fixed_bd;
+local inflate_huft *fixed_tl;
+local inflate_huft *fixed_td;
+#else
+#include "inffixed.h"
+#endif
+
+
+int inflate_trees_fixed(bl, bd, tl, td, z)
+uIntf *bl; /* literal desired/actual bit depth */
+uIntf *bd; /* distance desired/actual bit depth */
+inflate_huft * FAR *tl; /* literal/length tree result */
+inflate_huft * FAR *td; /* distance tree result */
+z_streamp z; /* for memory allocation */
+{
+#ifdef BUILDFIXED
+ /* build fixed tables if not already */
+ if (!fixed_built)
+ {
+ int k; /* temporary variable */
+ uInt f = 0; /* number of hufts used in fixed_mem */
+ uIntf *c; /* length list for huft_build */
+ uIntf *v; /* work area for huft_build */
+
+ /* allocate memory */
+ if ((c = (uIntf*)ZALLOC(z, 288, sizeof(uInt))) == Z_NULL)
+ return Z_MEM_ERROR;
+ if ((v = (uIntf*)ZALLOC(z, 288, sizeof(uInt))) == Z_NULL)
+ {
+ ZFREE(z, c);
+ return Z_MEM_ERROR;
+ }
+
+ /* literal table */
+ for (k = 0; k < 144; k++)
+ c[k] = 8;
+ for (; k < 256; k++)
+ c[k] = 9;
+ for (; k < 280; k++)
+ c[k] = 7;
+ for (; k < 288; k++)
+ c[k] = 8;
+ fixed_bl = 9;
+ huft_build(c, 288, 257, cplens, cplext, &fixed_tl, &fixed_bl,
+ fixed_mem, &f, v);
+
+ /* distance table */
+ for (k = 0; k < 30; k++)
+ c[k] = 5;
+ fixed_bd = 5;
+ huft_build(c, 30, 0, cpdist, cpdext, &fixed_td, &fixed_bd,
+ fixed_mem, &f, v);
+
+ /* done */
+ ZFREE(z, v);
+ ZFREE(z, c);
+ fixed_built = 1;
+ }
+#endif
+ *bl = fixed_bl;
+ *bd = fixed_bd;
+ *tl = fixed_tl;
+ *td = fixed_td;
+ return Z_OK;
+}
diff --git a/win32/contrib/zlib/inftrees.h b/win32/contrib/zlib/inftrees.h new file mode 100644 index 000000000..8388fb8e9 --- /dev/null +++ b/win32/contrib/zlib/inftrees.h @@ -0,0 +1,58 @@ +/* inftrees.h -- header to use inftrees.c
+ * Copyright (C) 1995-1998 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+ part of the implementation of the compression library and is
+ subject to change. Applications should only use zlib.h.
+ */
+
+/* Huffman code lookup table entry--this entry is four bytes for machines
+ that have 16-bit pointers (e.g. PC's in the small or medium model). */
+
+typedef struct inflate_huft_s FAR inflate_huft;
+
+struct inflate_huft_s {
+ union {
+ struct {
+ Byte Exop; /* number of extra bits or operation */
+ Byte Bits; /* number of bits in this code or subcode */
+ } what;
+ uInt pad; /* pad structure to a power of 2 (4 bytes for */
+ } word; /* 16-bit, 8 bytes for 32-bit int's) */
+ uInt base; /* literal, length base, distance base,
+ or table offset */
+};
+
+/* Maximum size of dynamic tree. The maximum found in a long but non-
+ exhaustive search was 1004 huft structures (850 for length/literals
+ and 154 for distances, the latter actually the result of an
+ exhaustive search). The actual maximum is not known, but the
+ value below is more than safe. */
+#define MANY 1440
+
+extern int inflate_trees_bits OF((
+ uIntf *, /* 19 code lengths */
+ uIntf *, /* bits tree desired/actual depth */
+ inflate_huft * FAR *, /* bits tree result */
+ inflate_huft *, /* space for trees */
+ z_streamp)); /* for messages */
+
+extern int inflate_trees_dynamic OF((
+ uInt, /* number of literal/length codes */
+ uInt, /* number of distance codes */
+ uIntf *, /* that many (total) code lengths */
+ uIntf *, /* literal desired/actual bit depth */
+ uIntf *, /* distance desired/actual bit depth */
+ inflate_huft * FAR *, /* literal/length tree result */
+ inflate_huft * FAR *, /* distance tree result */
+ inflate_huft *, /* space for trees */
+ z_streamp)); /* for messages */
+
+extern int inflate_trees_fixed OF((
+ uIntf *, /* literal desired/actual bit depth */
+ uIntf *, /* distance desired/actual bit depth */
+ inflate_huft * FAR *, /* literal/length tree result */
+ inflate_huft * FAR *, /* distance tree result */
+ z_streamp)); /* for memory allocation */
diff --git a/win32/contrib/zlib/infutil.c b/win32/contrib/zlib/infutil.c new file mode 100644 index 000000000..16b2acc83 --- /dev/null +++ b/win32/contrib/zlib/infutil.c @@ -0,0 +1,87 @@ +/* inflate_util.c -- data and routines common to blocks and codes
+ * Copyright (C) 1995-1998 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+#include "zutil.h"
+#include "infblock.h"
+#include "inftrees.h"
+#include "infcodes.h"
+#include "infutil.h"
+
+struct inflate_codes_state {int dummy;}; /* for buggy compilers */
+
+/* And'ing with mask[n] masks the lower n bits */
+uInt inflate_mask[17] = {
+ 0x0000,
+ 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
+ 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
+};
+
+
+/* copy as much as possible from the sliding window to the output area */
+int inflate_flush(s, z, r)
+inflate_blocks_statef *s;
+z_streamp z;
+int r;
+{
+ uInt n;
+ Bytef *p;
+ Bytef *q;
+
+ /* local copies of source and destination pointers */
+ p = z->next_out;
+ q = s->read;
+
+ /* compute number of bytes to copy as far as end of window */
+ n = (uInt)((q <= s->write ? s->write : s->end) - q);
+ if (n > z->avail_out) n = z->avail_out;
+ if (n && r == Z_BUF_ERROR) r = Z_OK;
+
+ /* update counters */
+ z->avail_out -= n;
+ z->total_out += n;
+
+ /* update check information */
+ if (s->checkfn != Z_NULL)
+ z->adler = s->check = (*s->checkfn)(s->check, q, n);
+
+ /* copy as far as end of window */
+ zmemcpy(p, q, n);
+ p += n;
+ q += n;
+
+ /* see if more to copy at beginning of window */
+ if (q == s->end)
+ {
+ /* wrap pointers */
+ q = s->window;
+ if (s->write == s->end)
+ s->write = s->window;
+
+ /* compute bytes to copy */
+ n = (uInt)(s->write - q);
+ if (n > z->avail_out) n = z->avail_out;
+ if (n && r == Z_BUF_ERROR) r = Z_OK;
+
+ /* update counters */
+ z->avail_out -= n;
+ z->total_out += n;
+
+ /* update check information */
+ if (s->checkfn != Z_NULL)
+ z->adler = s->check = (*s->checkfn)(s->check, q, n);
+
+ /* copy */
+ zmemcpy(p, q, n);
+ p += n;
+ q += n;
+ }
+
+ /* update pointers */
+ z->next_out = p;
+ s->read = q;
+
+ /* done */
+ return r;
+}
diff --git a/win32/contrib/zlib/infutil.h b/win32/contrib/zlib/infutil.h new file mode 100644 index 000000000..5c6129057 --- /dev/null +++ b/win32/contrib/zlib/infutil.h @@ -0,0 +1,98 @@ +/* infutil.h -- types and macros common to blocks and codes
+ * Copyright (C) 1995-1998 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+ part of the implementation of the compression library and is
+ subject to change. Applications should only use zlib.h.
+ */
+
+#ifndef _INFUTIL_H
+#define _INFUTIL_H
+
+typedef enum {
+ TYPE, /* get type bits (3, including end bit) */
+ LENS, /* get lengths for stored */
+ STORED, /* processing stored block */
+ TABLE, /* get table lengths */
+ BTREE, /* get bit lengths tree for a dynamic block */
+ DTREE, /* get length, distance trees for a dynamic block */
+ CODES, /* processing fixed or dynamic block */
+ DRY, /* output remaining window bytes */
+ DONE, /* finished last block, done */
+ BAD} /* got a data error--stuck here */
+inflate_block_mode;
+
+/* inflate blocks semi-private state */
+struct inflate_blocks_state {
+
+ /* mode */
+ inflate_block_mode mode; /* current inflate_block mode */
+
+ /* mode dependent information */
+ union {
+ uInt left; /* if STORED, bytes left to copy */
+ struct {
+ uInt table; /* table lengths (14 bits) */
+ uInt index; /* index into blens (or border) */
+ uIntf *blens; /* bit lengths of codes */
+ uInt bb; /* bit length tree depth */
+ inflate_huft *tb; /* bit length decoding tree */
+ } trees; /* if DTREE, decoding info for trees */
+ struct {
+ inflate_codes_statef
+ *codes;
+ } decode; /* if CODES, current state */
+ } sub; /* submode */
+ uInt last; /* true if this block is the last block */
+
+ /* mode independent information */
+ uInt bitk; /* bits in bit buffer */
+ uLong bitb; /* bit buffer */
+ inflate_huft *hufts; /* single malloc for tree space */
+ Bytef *window; /* sliding window */
+ Bytef *end; /* one byte after sliding window */
+ Bytef *read; /* window read pointer */
+ Bytef *write; /* window write pointer */
+ check_func checkfn; /* check function */
+ uLong check; /* check on output */
+
+};
+
+
+/* defines for inflate input/output */
+/* update pointers and return */
+#define UPDBITS {s->bitb=b;s->bitk=k;}
+#define UPDIN {z->avail_in=n;z->total_in+=p-z->next_in;z->next_in=p;}
+#define UPDOUT {s->write=q;}
+#define UPDATE {UPDBITS UPDIN UPDOUT}
+#define LEAVE {UPDATE return inflate_flush(s,z,r);}
+/* get bytes and bits */
+#define LOADIN {p=z->next_in;n=z->avail_in;b=s->bitb;k=s->bitk;}
+#define NEEDBYTE {if(n)r=Z_OK;else LEAVE}
+#define NEXTBYTE (n--,*p++)
+#define NEEDBITS(j) {while(k<(j)){NEEDBYTE;b|=((uLong)NEXTBYTE)<<k;k+=8;}}
+#define DUMPBITS(j) {b>>=(j);k-=(j);}
+/* output bytes */
+#define WAVAIL (uInt)(q<s->read?s->read-q-1:s->end-q)
+#define LOADOUT {q=s->write;m=(uInt)WAVAIL;}
+#define WRAP {if(q==s->end&&s->read!=s->window){q=s->window;m=(uInt)WAVAIL;}}
+#define FLUSH {UPDOUT r=inflate_flush(s,z,r); LOADOUT}
+#define NEEDOUT {if(m==0){WRAP if(m==0){FLUSH WRAP if(m==0) LEAVE}}r=Z_OK;}
+#define OUTBYTE(a) {*q++=(Byte)(a);m--;}
+/* load local pointers */
+#define LOAD {LOADIN LOADOUT}
+
+/* masks for lower bits (size given to avoid silly warnings with Visual C++) */
+extern uInt inflate_mask[17];
+
+/* copy as much as possible from the sliding window to the output area */
+extern int inflate_flush OF((
+ inflate_blocks_statef *,
+ z_streamp ,
+ int));
+
+struct internal_state {int dummy;}; /* for buggy compilers */
+
+#endif
diff --git a/win32/contrib/zlib/maketree.c b/win32/contrib/zlib/maketree.c new file mode 100644 index 000000000..c547fff9e --- /dev/null +++ b/win32/contrib/zlib/maketree.c @@ -0,0 +1,85 @@ +/* maketree.c -- make inffixed.h table for decoding fixed codes
+ * Copyright (C) 1998 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+ part of the implementation of the compression library and is
+ subject to change. Applications should only use zlib.h.
+ */
+
+/* This program is included in the distribution for completeness.
+ You do not need to compile or run this program since inffixed.h
+ is already included in the distribution. To use this program
+ you need to compile zlib with BUILDFIXED defined and then compile
+ and link this program with the zlib library. Then the output of
+ this program can be piped to inffixed.h. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "zutil.h"
+#include "inftrees.h"
+
+/* simplify the use of the inflate_huft type with some defines */
+#define exop word.what.Exop
+#define bits word.what.Bits
+
+/* generate initialization table for an inflate_huft structure array */
+void maketree(uInt b, inflate_huft *t)
+{
+ int i, e;
+
+ i = 0;
+ while (1)
+ {
+ e = t[i].exop;
+ if (e && (e & (16+64)) == 0) /* table pointer */
+ {
+ fprintf(stderr, "maketree: cannot initialize sub-tables!\n");
+ exit(1);
+ }
+ if (i % 4 == 0)
+ printf("\n ");
+ printf(" {{{%u,%u}},%u}", t[i].exop, t[i].bits, t[i].base);
+ if (++i == (1<<b))
+ break;
+ putchar(',');
+ }
+ puts("");
+}
+
+/* create the fixed tables in C initialization syntax */
+void main(void)
+{
+ int r;
+ uInt bl, bd;
+ inflate_huft *tl, *td;
+ z_stream z;
+
+ z.zalloc = zcalloc;
+ z.opaque = (voidpf)0;
+ z.zfree = zcfree;
+ r = inflate_trees_fixed(&bl, &bd, &tl, &td, &z);
+ if (r)
+ {
+ fprintf(stderr, "inflate_trees_fixed error %d\n", r);
+ return;
+ }
+ puts("/* inffixed.h -- table for decoding fixed codes");
+ puts(" * Generated automatically by the maketree.c program");
+ puts(" */");
+ puts("");
+ puts("/* WARNING: this file should *not* be used by applications. It is");
+ puts(" part of the implementation of the compression library and is");
+ puts(" subject to change. Applications should only use zlib.h.");
+ puts(" */");
+ puts("");
+ printf("local uInt fixed_bl = %d;\n", bl);
+ printf("local uInt fixed_bd = %d;\n", bd);
+ printf("local inflate_huft fixed_tl[] = {");
+ maketree(bl, tl);
+ puts(" };");
+ printf("local inflate_huft fixed_td[] = {");
+ maketree(bd, td);
+ puts(" };");
+}
diff --git a/win32/contrib/zlib/minigzip.c b/win32/contrib/zlib/minigzip.c new file mode 100644 index 000000000..e358850c6 --- /dev/null +++ b/win32/contrib/zlib/minigzip.c @@ -0,0 +1,320 @@ +/* minigzip.c -- simulate gzip using the zlib compression library
+ * Copyright (C) 1995-1998 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/*
+ * minigzip is a minimal implementation of the gzip utility. This is
+ * only an example of using zlib and isn't meant to replace the
+ * full-featured gzip. No attempt is made to deal with file systems
+ * limiting names to 14 or 8+3 characters, etc... Error checking is
+ * very limited. So use minigzip only for testing; use gzip for the
+ * real thing. On MSDOS, use only on file names without extension
+ * or in pipe mode.
+ */
+
+/* @(#) $Id: minigzip.c,v 1.1 2003/04/20 16:42:09 guenter Exp $ */
+
+#include <stdio.h>
+#include "zlib.h"
+
+#ifdef STDC
+# include <string.h>
+# include <stdlib.h>
+#else
+ extern void exit OF((int));
+#endif
+
+#ifdef USE_MMAP
+# include <sys/types.h>
+# include <sys/mman.h>
+# include <sys/stat.h>
+#endif
+
+#if defined(MSDOS) || defined(OS2) || defined(WIN32)
+# include <fcntl.h>
+# include <io.h>
+# define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY)
+#else
+# define SET_BINARY_MODE(file)
+#endif
+
+#ifdef VMS
+# define unlink delete
+# define GZ_SUFFIX "-gz"
+#endif
+#ifdef RISCOS
+# define unlink remove
+# define GZ_SUFFIX "-gz"
+# define fileno(file) file->__file
+#endif
+#if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
+# include <unix.h> /* for fileno */
+#endif
+
+#ifndef WIN32 /* unlink already in stdio.h for WIN32 */
+ extern int unlink OF((const char *));
+#endif
+
+#ifndef GZ_SUFFIX
+# define GZ_SUFFIX ".gz"
+#endif
+#define SUFFIX_LEN (sizeof(GZ_SUFFIX)-1)
+
+#define BUFLEN 16384
+#define MAX_NAME_LEN 1024
+
+#ifdef MAXSEG_64K
+# define local static
+ /* Needed for systems with limitation on stack size. */
+#else
+# define local
+#endif
+
+char *prog;
+
+void error OF((const char *msg));
+void gz_compress OF((FILE *in, gzFile out));
+#ifdef USE_MMAP
+int gz_compress_mmap OF((FILE *in, gzFile out));
+#endif
+void gz_uncompress OF((gzFile in, FILE *out));
+void file_compress OF((char *file, char *mode));
+void file_uncompress OF((char *file));
+int main OF((int argc, char *argv[]));
+
+/* ===========================================================================
+ * Display error message and exit
+ */
+void error(msg)
+ const char *msg;
+{
+ fprintf(stderr, "%s: %s\n", prog, msg);
+ exit(1);
+}
+
+/* ===========================================================================
+ * Compress input to output then close both files.
+ */
+
+void gz_compress(in, out)
+ FILE *in;
+ gzFile out;
+{
+ local char buf[BUFLEN];
+ int len;
+ int err;
+
+#ifdef USE_MMAP
+ /* Try first compressing with mmap. If mmap fails (minigzip used in a
+ * pipe), use the normal fread loop.
+ */
+ if (gz_compress_mmap(in, out) == Z_OK) return;
+#endif
+ for (;;) {
+ len = fread(buf, 1, sizeof(buf), in);
+ if (ferror(in)) {
+ perror("fread");
+ exit(1);
+ }
+ if (len == 0) break;
+
+ if (gzwrite(out, buf, (unsigned)len) != len) error(gzerror(out, &err));
+ }
+ fclose(in);
+ if (gzclose(out) != Z_OK) error("failed gzclose");
+}
+
+#ifdef USE_MMAP /* MMAP version, Miguel Albrecht <malbrech@eso.org> */
+
+/* Try compressing the input file at once using mmap. Return Z_OK if
+ * if success, Z_ERRNO otherwise.
+ */
+int gz_compress_mmap(in, out)
+ FILE *in;
+ gzFile out;
+{
+ int len;
+ int err;
+ int ifd = fileno(in);
+ caddr_t buf; /* mmap'ed buffer for the entire input file */
+ off_t buf_len; /* length of the input file */
+ struct stat sb;
+
+ /* Determine the size of the file, needed for mmap: */
+ if (fstat(ifd, &sb) < 0) return Z_ERRNO;
+ buf_len = sb.st_size;
+ if (buf_len <= 0) return Z_ERRNO;
+
+ /* Now do the actual mmap: */
+ buf = mmap((caddr_t) 0, buf_len, PROT_READ, MAP_SHARED, ifd, (off_t)0);
+ if (buf == (caddr_t)(-1)) return Z_ERRNO;
+
+ /* Compress the whole file at once: */
+ len = gzwrite(out, (char *)buf, (unsigned)buf_len);
+
+ if (len != (int)buf_len) error(gzerror(out, &err));
+
+ munmap(buf, buf_len);
+ fclose(in);
+ if (gzclose(out) != Z_OK) error("failed gzclose");
+ return Z_OK;
+}
+#endif /* USE_MMAP */
+
+/* ===========================================================================
+ * Uncompress input to output then close both files.
+ */
+void gz_uncompress(in, out)
+ gzFile in;
+ FILE *out;
+{
+ local char buf[BUFLEN];
+ int len;
+ int err;
+
+ for (;;) {
+ len = gzread(in, buf, sizeof(buf));
+ if (len < 0) error (gzerror(in, &err));
+ if (len == 0) break;
+
+ if ((int)fwrite(buf, 1, (unsigned)len, out) != len) {
+ error("failed fwrite");
+ }
+ }
+ if (fclose(out)) error("failed fclose");
+
+ if (gzclose(in) != Z_OK) error("failed gzclose");
+}
+
+
+/* ===========================================================================
+ * Compress the given file: create a corresponding .gz file and remove the
+ * original.
+ */
+void file_compress(file, mode)
+ char *file;
+ char *mode;
+{
+ local char outfile[MAX_NAME_LEN];
+ FILE *in;
+ gzFile out;
+
+ strcpy(outfile, file);
+ strcat(outfile, GZ_SUFFIX);
+
+ in = fopen(file, "rb");
+ if (in == NULL) {
+ perror(file);
+ exit(1);
+ }
+ out = gzopen(outfile, mode);
+ if (out == NULL) {
+ fprintf(stderr, "%s: can't gzopen %s\n", prog, outfile);
+ exit(1);
+ }
+ gz_compress(in, out);
+
+ unlink(file);
+}
+
+
+/* ===========================================================================
+ * Uncompress the given file and remove the original.
+ */
+void file_uncompress(file)
+ char *file;
+{
+ local char buf[MAX_NAME_LEN];
+ char *infile, *outfile;
+ FILE *out;
+ gzFile in;
+ int len = strlen(file);
+
+ strcpy(buf, file);
+
+ if (len > SUFFIX_LEN && strcmp(file+len-SUFFIX_LEN, GZ_SUFFIX) == 0) {
+ infile = file;
+ outfile = buf;
+ outfile[len-3] = '\0';
+ } else {
+ outfile = file;
+ infile = buf;
+ strcat(infile, GZ_SUFFIX);
+ }
+ in = gzopen(infile, "rb");
+ if (in == NULL) {
+ fprintf(stderr, "%s: can't gzopen %s\n", prog, infile);
+ exit(1);
+ }
+ out = fopen(outfile, "wb");
+ if (out == NULL) {
+ perror(file);
+ exit(1);
+ }
+
+ gz_uncompress(in, out);
+
+ unlink(infile);
+}
+
+
+/* ===========================================================================
+ * Usage: minigzip [-d] [-f] [-h] [-1 to -9] [files...]
+ * -d : decompress
+ * -f : compress with Z_FILTERED
+ * -h : compress with Z_HUFFMAN_ONLY
+ * -1 to -9 : compression level
+ */
+
+int main(argc, argv)
+ int argc;
+ char *argv[];
+{
+ int uncompr = 0;
+ gzFile file;
+ char outmode[20];
+
+ strcpy(outmode, "wb6 ");
+
+ prog = argv[0];
+ argc--, argv++;
+
+ while (argc > 0) {
+ if (strcmp(*argv, "-d") == 0)
+ uncompr = 1;
+ else if (strcmp(*argv, "-f") == 0)
+ outmode[3] = 'f';
+ else if (strcmp(*argv, "-h") == 0)
+ outmode[3] = 'h';
+ else if ((*argv)[0] == '-' && (*argv)[1] >= '1' && (*argv)[1] <= '9' &&
+ (*argv)[2] == 0)
+ outmode[2] = (*argv)[1];
+ else
+ break;
+ argc--, argv++;
+ }
+ if (argc == 0) {
+ SET_BINARY_MODE(stdin);
+ SET_BINARY_MODE(stdout);
+ if (uncompr) {
+ file = gzdopen(fileno(stdin), "rb");
+ if (file == NULL) error("can't gzdopen stdin");
+ gz_uncompress(file, stdout);
+ } else {
+ file = gzdopen(fileno(stdout), outmode);
+ if (file == NULL) error("can't gzdopen stdout");
+ gz_compress(stdin, file);
+ }
+ } else {
+ do {
+ if (uncompr) {
+ file_uncompress(*argv);
+ } else {
+ file_compress(*argv, outmode);
+ }
+ } while (argv++, --argc);
+ }
+ exit(0);
+ return 0; /* to avoid warning */
+}
diff --git a/win32/contrib/zlib/nt/Makefile.emx b/win32/contrib/zlib/nt/Makefile.emx new file mode 100644 index 000000000..79984f74b --- /dev/null +++ b/win32/contrib/zlib/nt/Makefile.emx @@ -0,0 +1,138 @@ +# Makefile for zlib. Modified for emx/rsxnt by Chr. Spieler, 6/16/98.
+# Copyright (C) 1995-1998 Jean-loup Gailly.
+# For conditions of distribution and use, see copyright notice in zlib.h
+
+# To compile, or to compile and test, type:
+#
+# make -fmakefile.emx; make test -fmakefile.emx
+#
+
+CC=gcc -Zwin32
+
+#CFLAGS=-MMD -O
+#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
+#CFLAGS=-MMD -g -DDEBUG
+CFLAGS=-MMD -O3 $(BUTT) -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
+ -Wstrict-prototypes -Wmissing-prototypes
+
+# If cp.exe is available, replace "copy /Y" with "cp -fp" .
+CP=copy /Y
+# If gnu install.exe is available, replace $(CP) with ginstall.
+INSTALL=$(CP)
+# The default value of RM is "rm -f." If "rm.exe" is found, comment out:
+RM=del
+LDLIBS=-L. -lzlib
+LD=$(CC) -s -o
+LDSHARED=$(CC)
+
+INCL=zlib.h zconf.h
+LIBS=zlib.a
+
+AR=ar rcs
+
+prefix=/usr/local
+exec_prefix = $(prefix)
+
+OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
+ zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o
+
+TEST_OBJS = example.o minigzip.o
+
+all: example.exe minigzip.exe
+
+test: all
+ ./example
+ echo hello world | .\minigzip | .\minigzip -d
+
+%.o : %.c
+ $(CC) $(CFLAGS) -c $< -o $@
+
+zlib.a: $(OBJS)
+ $(AR) $@ $(OBJS)
+
+%.exe : %.o $(LIBS)
+ $(LD) $@ $< $(LDLIBS)
+
+
+.PHONY : clean
+
+clean:
+ $(RM) *.d
+ $(RM) *.o
+ $(RM) *.exe
+ $(RM) zlib.a
+ $(RM) foo.gz
+
+DEPS := $(wildcard *.d)
+ifneq ($(DEPS),)
+include $(DEPS)
+endif
+# Makefile for zlib. Modified for emx 0.9c by Chr. Spieler, 6/17/98.
+# Copyright (C) 1995-1998 Jean-loup Gailly.
+# For conditions of distribution and use, see copyright notice in zlib.h
+
+# To compile, or to compile and test, type:
+#
+# make -fmakefile.emx; make test -fmakefile.emx
+#
+
+CC=gcc
+
+#CFLAGS=-MMD -O
+#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
+#CFLAGS=-MMD -g -DDEBUG
+CFLAGS=-MMD -O3 $(BUTT) -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
+ -Wstrict-prototypes -Wmissing-prototypes
+
+# If cp.exe is available, replace "copy /Y" with "cp -fp" .
+CP=copy /Y
+# If gnu install.exe is available, replace $(CP) with ginstall.
+INSTALL=$(CP)
+# The default value of RM is "rm -f." If "rm.exe" is found, comment out:
+RM=del
+LDLIBS=-L. -lzlib
+LD=$(CC) -s -o
+LDSHARED=$(CC)
+
+INCL=zlib.h zconf.h
+LIBS=zlib.a
+
+AR=ar rcs
+
+prefix=/usr/local
+exec_prefix = $(prefix)
+
+OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
+ zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o
+
+TEST_OBJS = example.o minigzip.o
+
+all: example.exe minigzip.exe
+
+test: all
+ ./example
+ echo hello world | .\minigzip | .\minigzip -d
+
+%.o : %.c
+ $(CC) $(CFLAGS) -c $< -o $@
+
+zlib.a: $(OBJS)
+ $(AR) $@ $(OBJS)
+
+%.exe : %.o $(LIBS)
+ $(LD) $@ $< $(LDLIBS)
+
+
+.PHONY : clean
+
+clean:
+ $(RM) *.d
+ $(RM) *.o
+ $(RM) *.exe
+ $(RM) zlib.a
+ $(RM) foo.gz
+
+DEPS := $(wildcard *.d)
+ifneq ($(DEPS),)
+include $(DEPS)
+endif
diff --git a/win32/contrib/zlib/nt/Makefile.gcc b/win32/contrib/zlib/nt/Makefile.gcc new file mode 100644 index 000000000..aa7198d85 --- /dev/null +++ b/win32/contrib/zlib/nt/Makefile.gcc @@ -0,0 +1,87 @@ +# Makefile for zlib. Modified for mingw32 by C. Spieler, 6/16/98.
+# (This Makefile is directly derived from Makefile.dj2)
+# Copyright (C) 1995-1998 Jean-loup Gailly.
+# For conditions of distribution and use, see copyright notice in zlib.h
+
+# To compile, or to compile and test, type:
+#
+# make -fmakefile.gcc; make test -fmakefile.gcc
+#
+# To install libz.a, zconf.h and zlib.h in the mingw32 directories, type:
+#
+# make install -fmakefile.gcc
+#
+
+CC=gcc
+
+#CFLAGS=-MMD -O
+#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
+#CFLAGS=-MMD -g -DDEBUG
+CFLAGS=-MMD -O3 $(BUTT) -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
+ -Wstrict-prototypes -Wmissing-prototypes
+
+# If cp.exe is available, replace "copy /Y" with "cp -fp" .
+CP=copy /Y
+# If gnu install.exe is available, replace $(CP) with ginstall.
+INSTALL=$(CP)
+# The default value of RM is "rm -f." If "rm.exe" is found, comment out:
+RM=del
+LDLIBS=-L. -lz
+LD=$(CC) -s -o
+LDSHARED=$(CC)
+
+INCL=zlib.h zconf.h
+LIBS=libz.a
+
+AR=ar rcs
+
+prefix=/usr/local
+exec_prefix = $(prefix)
+
+OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
+ zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o
+
+TEST_OBJS = example.o minigzip.o
+
+all: example.exe minigzip.exe
+
+test: all
+ ./example
+ echo hello world | .\minigzip | .\minigzip -d
+
+%.o : %.c
+ $(CC) $(CFLAGS) -c $< -o $@
+
+libz.a: $(OBJS)
+ $(AR) $@ $(OBJS)
+
+%.exe : %.o $(LIBS)
+ $(LD) $@ $< $(LDLIBS)
+
+# INCLUDE_PATH and LIBRARY_PATH were set for [make] in djgpp.env .
+
+.PHONY : uninstall clean
+
+install: $(INCL) $(LIBS)
+ -@if not exist $(INCLUDE_PATH)\nul mkdir $(INCLUDE_PATH)
+ -@if not exist $(LIBRARY_PATH)\nul mkdir $(LIBRARY_PATH)
+ $(INSTALL) zlib.h $(INCLUDE_PATH)
+ $(INSTALL) zconf.h $(INCLUDE_PATH)
+ $(INSTALL) libz.a $(LIBRARY_PATH)
+
+uninstall:
+ $(RM) $(INCLUDE_PATH)\zlib.h
+ $(RM) $(INCLUDE_PATH)\zconf.h
+ $(RM) $(LIBRARY_PATH)\libz.a
+
+clean:
+ $(RM) *.d
+ $(RM) *.o
+ $(RM) *.exe
+ $(RM) libz.a
+ $(RM) foo.gz
+
+DEPS := $(wildcard *.d)
+ifneq ($(DEPS),)
+include $(DEPS)
+endif
diff --git a/win32/contrib/zlib/nt/Makefile.nt b/win32/contrib/zlib/nt/Makefile.nt new file mode 100644 index 000000000..4c49db53d --- /dev/null +++ b/win32/contrib/zlib/nt/Makefile.nt @@ -0,0 +1,88 @@ +# Makefile for zlib
+
+!include <ntwin32.mak>
+
+CC=cl
+LD=link
+CFLAGS=-O -nologo
+LDFLAGS=
+O=.obj
+
+# variables
+OBJ1 = adler32$(O) compress$(O) crc32$(O) gzio$(O) uncompr$(O) deflate$(O) \
+ trees$(O)
+OBJ2 = zutil$(O) inflate$(O) infblock$(O) inftrees$(O) infcodes$(O) \
+ infutil$(O) inffast$(O)
+
+all: zlib.dll example.exe minigzip.exe
+
+adler32.obj: adler32.c zutil.h zlib.h zconf.h
+ $(CC) -c $(cvarsdll) $(CFLAGS) $*.c
+
+compress.obj: compress.c zlib.h zconf.h
+ $(CC) -c $(cvarsdll) $(CFLAGS) $*.c
+
+crc32.obj: crc32.c zutil.h zlib.h zconf.h
+ $(CC) -c $(cvarsdll) $(CFLAGS) $*.c
+
+deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h
+ $(CC) -c $(cvarsdll) $(CFLAGS) $*.c
+
+gzio.obj: gzio.c zutil.h zlib.h zconf.h
+ $(CC) -c $(cvarsdll) $(CFLAGS) $*.c
+
+infblock.obj: infblock.c zutil.h zlib.h zconf.h infblock.h inftrees.h\
+ infcodes.h infutil.h
+ $(CC) -c $(cvarsdll) $(CFLAGS) $*.c
+
+infcodes.obj: infcodes.c zutil.h zlib.h zconf.h inftrees.h infutil.h\
+ infcodes.h inffast.h
+ $(CC) -c $(cvarsdll) $(CFLAGS) $*.c
+
+inflate.obj: inflate.c zutil.h zlib.h zconf.h infblock.h
+ $(CC) -c $(cvarsdll) $(CFLAGS) $*.c
+
+inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h
+ $(CC) -c $(cvarsdll) $(CFLAGS) $*.c
+
+infutil.obj: infutil.c zutil.h zlib.h zconf.h inftrees.h infutil.h
+ $(CC) -c $(cvarsdll) $(CFLAGS) $*.c
+
+inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h infutil.h inffast.h
+ $(CC) -c $(cvarsdll) $(CFLAGS) $*.c
+
+trees.obj: trees.c deflate.h zutil.h zlib.h zconf.h
+ $(CC) -c $(cvarsdll) $(CFLAGS) $*.c
+
+uncompr.obj: uncompr.c zlib.h zconf.h
+ $(CC) -c $(cvarsdll) $(CFLAGS) $*.c
+
+zutil.obj: zutil.c zutil.h zlib.h zconf.h
+ $(CC) -c $(cvarsdll) $(CFLAGS) $*.c
+
+example.obj: example.c zlib.h zconf.h
+ $(CC) -c $(cvarsdll) $(CFLAGS) $*.c
+
+minigzip.obj: minigzip.c zlib.h zconf.h
+ $(CC) -c $(cvarsdll) $(CFLAGS) $*.c
+
+zlib.dll: $(OBJ1) $(OBJ2) zlib.dnt
+ link $(dlllflags) -out:$@ -def:zlib.dnt $(OBJ1) $(OBJ2) $(guilibsdll)
+
+zlib.lib: zlib.dll
+
+example.exe: example.obj zlib.lib
+ $(LD) $(LDFLAGS) example.obj zlib.lib
+
+minigzip.exe: minigzip.obj zlib.lib
+ $(LD) $(LDFLAGS) minigzip.obj zlib.lib
+
+test: example.exe minigzip.exe
+ example
+ echo hello world | minigzip | minigzip -d
+
+clean:
+ del *.obj
+ del *.exe
+ del *.dll
+ del *.lib
diff --git a/win32/contrib/zlib/nt/zlib.dnt b/win32/contrib/zlib/nt/zlib.dnt new file mode 100644 index 000000000..ce97a8471 --- /dev/null +++ b/win32/contrib/zlib/nt/zlib.dnt @@ -0,0 +1,47 @@ +LIBRARY zlib.dll
+EXETYPE WINDOWS
+CODE PRELOAD MOVEABLE DISCARDABLE
+DATA PRELOAD MOVEABLE MULTIPLE
+
+EXPORTS
+ adler32 @1
+ compress @2
+ crc32 @3
+ deflate @4
+ deflateCopy @5
+ deflateEnd @6
+ deflateInit2_ @7
+ deflateInit_ @8
+ deflateParams @9
+ deflateReset @10
+ deflateSetDictionary @11
+ gzclose @12
+ gzdopen @13
+ gzerror @14
+ gzflush @15
+ gzopen @16
+ gzread @17
+ gzwrite @18
+ inflate @19
+ inflateEnd @20
+ inflateInit2_ @21
+ inflateInit_ @22
+ inflateReset @23
+ inflateSetDictionary @24
+ inflateSync @25
+ uncompress @26
+ zlibVersion @27
+ gzprintf @28
+ gzputc @29
+ gzgetc @30
+ gzseek @31
+ gzrewind @32
+ gztell @33
+ gzeof @34
+ gzsetparams @35
+ zError @36
+ inflateSyncPoint @37
+ get_crc_table @38
+ compress2 @39
+ gzputs @40
+ gzgets @41
diff --git a/win32/contrib/zlib/trees.c b/win32/contrib/zlib/trees.c new file mode 100644 index 000000000..2e0263f65 --- /dev/null +++ b/win32/contrib/zlib/trees.c @@ -0,0 +1,1214 @@ +/* trees.c -- output deflated data using Huffman coding
+ * Copyright (C) 1995-1998 Jean-loup Gailly
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/*
+ * ALGORITHM
+ *
+ * The "deflation" process uses several Huffman trees. The more
+ * common source values are represented by shorter bit sequences.
+ *
+ * Each code tree is stored in a compressed form which is itself
+ * a Huffman encoding of the lengths of all the code strings (in
+ * ascending order by source values). The actual code strings are
+ * reconstructed from the lengths in the inflate process, as described
+ * in the deflate specification.
+ *
+ * REFERENCES
+ *
+ * Deutsch, L.P.,"'Deflate' Compressed Data Format Specification".
+ * Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc
+ *
+ * Storer, James A.
+ * Data Compression: Methods and Theory, pp. 49-50.
+ * Computer Science Press, 1988. ISBN 0-7167-8156-5.
+ *
+ * Sedgewick, R.
+ * Algorithms, p290.
+ * Addison-Wesley, 1983. ISBN 0-201-06672-6.
+ */
+
+/* @(#) $Id: trees.c,v 1.1 2003/04/20 16:42:09 guenter Exp $ */
+
+/* #define GEN_TREES_H */
+
+#include "deflate.h"
+
+#ifdef DEBUG
+# include <ctype.h>
+#endif
+
+/* ===========================================================================
+ * Constants
+ */
+
+#define MAX_BL_BITS 7
+/* Bit length codes must not exceed MAX_BL_BITS bits */
+
+#define END_BLOCK 256
+/* end of block literal code */
+
+#define REP_3_6 16
+/* repeat previous bit length 3-6 times (2 bits of repeat count) */
+
+#define REPZ_3_10 17
+/* repeat a zero length 3-10 times (3 bits of repeat count) */
+
+#define REPZ_11_138 18
+/* repeat a zero length 11-138 times (7 bits of repeat count) */
+
+local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */
+ = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0};
+
+local const int extra_dbits[D_CODES] /* extra bits for each distance code */
+ = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13};
+
+local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */
+ = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7};
+
+local const uch bl_order[BL_CODES]
+ = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15};
+/* The lengths of the bit length codes are sent in order of decreasing
+ * probability, to avoid transmitting the lengths for unused bit length codes.
+ */
+
+#define Buf_size (8 * 2*sizeof(char))
+/* Number of bits used within bi_buf. (bi_buf might be implemented on
+ * more than 16 bits on some systems.)
+ */
+
+/* ===========================================================================
+ * Local data. These are initialized only once.
+ */
+
+#define DIST_CODE_LEN 512 /* see definition of array dist_code below */
+
+#if defined(GEN_TREES_H) || !defined(STDC)
+/* non ANSI compilers may not accept trees.h */
+
+local ct_data static_ltree[L_CODES+2];
+/* The static literal tree. Since the bit lengths are imposed, there is no
+ * need for the L_CODES extra codes used during heap construction. However
+ * The codes 286 and 287 are needed to build a canonical tree (see _tr_init
+ * below).
+ */
+
+local ct_data static_dtree[D_CODES];
+/* The static distance tree. (Actually a trivial tree since all codes use
+ * 5 bits.)
+ */
+
+uch _dist_code[DIST_CODE_LEN];
+/* Distance codes. The first 256 values correspond to the distances
+ * 3 .. 258, the last 256 values correspond to the top 8 bits of
+ * the 15 bit distances.
+ */
+
+uch _length_code[MAX_MATCH-MIN_MATCH+1];
+/* length code for each normalized match length (0 == MIN_MATCH) */
+
+local int base_length[LENGTH_CODES];
+/* First normalized length for each code (0 = MIN_MATCH) */
+
+local int base_dist[D_CODES];
+/* First normalized distance for each code (0 = distance of 1) */
+
+#else
+# include "trees.h"
+#endif /* GEN_TREES_H */
+
+struct static_tree_desc_s {
+ const ct_data *static_tree; /* static tree or NULL */
+ const intf *extra_bits; /* extra bits for each code or NULL */
+ int extra_base; /* base index for extra_bits */
+ int elems; /* max number of elements in the tree */
+ int max_length; /* max bit length for the codes */
+};
+
+local static_tree_desc static_l_desc =
+{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS};
+
+local static_tree_desc static_d_desc =
+{static_dtree, extra_dbits, 0, D_CODES, MAX_BITS};
+
+local static_tree_desc static_bl_desc =
+{(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS};
+
+/* ===========================================================================
+ * Local (static) routines in this file.
+ */
+
+local void tr_static_init OF((void));
+local void init_block OF((deflate_state *s));
+local void pqdownheap OF((deflate_state *s, ct_data *tree, int k));
+local void gen_bitlen OF((deflate_state *s, tree_desc *desc));
+local void gen_codes OF((ct_data *tree, int max_code, ushf *bl_count));
+local void build_tree OF((deflate_state *s, tree_desc *desc));
+local void scan_tree OF((deflate_state *s, ct_data *tree, int max_code));
+local void send_tree OF((deflate_state *s, ct_data *tree, int max_code));
+local int build_bl_tree OF((deflate_state *s));
+local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes,
+ int blcodes));
+local void compress_block OF((deflate_state *s, ct_data *ltree,
+ ct_data *dtree));
+local void set_data_type OF((deflate_state *s));
+local unsigned bi_reverse OF((unsigned value, int length));
+local void bi_windup OF((deflate_state *s));
+local void bi_flush OF((deflate_state *s));
+local void copy_block OF((deflate_state *s, charf *buf, unsigned len,
+ int header));
+
+#ifdef GEN_TREES_H
+local void gen_trees_header OF((void));
+#endif
+
+#ifndef DEBUG
+# define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
+ /* Send a code of the given tree. c and tree must not have side effects */
+
+#else /* DEBUG */
+# define send_code(s, c, tree) \
+ { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \
+ send_bits(s, tree[c].Code, tree[c].Len); }
+#endif
+
+/* ===========================================================================
+ * Output a short LSB first on the stream.
+ * IN assertion: there is enough room in pendingBuf.
+ */
+#define put_short(s, w) { \
+ put_byte(s, (uch)((w) & 0xff)); \
+ put_byte(s, (uch)((ush)(w) >> 8)); \
+}
+
+/* ===========================================================================
+ * Send a value on a given number of bits.
+ * IN assertion: length <= 16 and value fits in length bits.
+ */
+#ifdef DEBUG
+local void send_bits OF((deflate_state *s, int value, int length));
+
+local void send_bits(s, value, length)
+ deflate_state *s;
+ int value; /* value to send */
+ int length; /* number of bits */
+{
+ Tracevv((stderr," l %2d v %4x ", length, value));
+ Assert(length > 0 && length <= 15, "invalid length");
+ s->bits_sent += (ulg)length;
+
+ /* If not enough room in bi_buf, use (valid) bits from bi_buf and
+ * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid))
+ * unused bits in value.
+ */
+ if (s->bi_valid > (int)Buf_size - length) {
+ s->bi_buf |= (value << s->bi_valid);
+ put_short(s, s->bi_buf);
+ s->bi_buf = (ush)value >> (Buf_size - s->bi_valid);
+ s->bi_valid += length - Buf_size;
+ } else {
+ s->bi_buf |= value << s->bi_valid;
+ s->bi_valid += length;
+ }
+}
+#else /* !DEBUG */
+
+#define send_bits(s, value, length) \
+{ int len = length;\
+ if (s->bi_valid > (int)Buf_size - len) {\
+ int val = value;\
+ s->bi_buf |= (val << s->bi_valid);\
+ put_short(s, s->bi_buf);\
+ s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
+ s->bi_valid += len - Buf_size;\
+ } else {\
+ s->bi_buf |= (value) << s->bi_valid;\
+ s->bi_valid += len;\
+ }\
+}
+#endif /* DEBUG */
+
+
+#define MAX(a,b) (a >= b ? a : b)
+/* the arguments must not have side effects */
+
+/* ===========================================================================
+ * Initialize the various 'constant' tables.
+ */
+local void tr_static_init()
+{
+#if defined(GEN_TREES_H) || !defined(STDC)
+ static int static_init_done = 0;
+ int n; /* iterates over tree elements */
+ int bits; /* bit counter */
+ int length; /* length value */
+ int code; /* code value */
+ int dist; /* distance index */
+ ush bl_count[MAX_BITS+1];
+ /* number of codes at each bit length for an optimal tree */
+
+ if (static_init_done) return;
+
+ /* For some embedded targets, global variables are not initialized: */
+ static_l_desc.static_tree = static_ltree;
+ static_l_desc.extra_bits = extra_lbits;
+ static_d_desc.static_tree = static_dtree;
+ static_d_desc.extra_bits = extra_dbits;
+ static_bl_desc.extra_bits = extra_blbits;
+
+ /* Initialize the mapping length (0..255) -> length code (0..28) */
+ length = 0;
+ for (code = 0; code < LENGTH_CODES-1; code++) {
+ base_length[code] = length;
+ for (n = 0; n < (1<<extra_lbits[code]); n++) {
+ _length_code[length++] = (uch)code;
+ }
+ }
+ Assert (length == 256, "tr_static_init: length != 256");
+ /* Note that the length 255 (match length 258) can be represented
+ * in two different ways: code 284 + 5 bits or code 285, so we
+ * overwrite length_code[255] to use the best encoding:
+ */
+ _length_code[length-1] = (uch)code;
+
+ /* Initialize the mapping dist (0..32K) -> dist code (0..29) */
+ dist = 0;
+ for (code = 0 ; code < 16; code++) {
+ base_dist[code] = dist;
+ for (n = 0; n < (1<<extra_dbits[code]); n++) {
+ _dist_code[dist++] = (uch)code;
+ }
+ }
+ Assert (dist == 256, "tr_static_init: dist != 256");
+ dist >>= 7; /* from now on, all distances are divided by 128 */
+ for ( ; code < D_CODES; code++) {
+ base_dist[code] = dist << 7;
+ for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) {
+ _dist_code[256 + dist++] = (uch)code;
+ }
+ }
+ Assert (dist == 256, "tr_static_init: 256+dist != 512");
+
+ /* Construct the codes of the static literal tree */
+ for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0;
+ n = 0;
+ while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++;
+ while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++;
+ while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++;
+ while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++;
+ /* Codes 286 and 287 do not exist, but we must include them in the
+ * tree construction to get a canonical Huffman tree (longest code
+ * all ones)
+ */
+ gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count);
+
+ /* The static distance tree is trivial: */
+ for (n = 0; n < D_CODES; n++) {
+ static_dtree[n].Len = 5;
+ static_dtree[n].Code = bi_reverse((unsigned)n, 5);
+ }
+ static_init_done = 1;
+
+# ifdef GEN_TREES_H
+ gen_trees_header();
+# endif
+#endif /* defined(GEN_TREES_H) || !defined(STDC) */
+}
+
+/* ===========================================================================
+ * Genererate the file trees.h describing the static trees.
+ */
+#ifdef GEN_TREES_H
+# ifndef DEBUG
+# include <stdio.h>
+# endif
+
+# define SEPARATOR(i, last, width) \
+ ((i) == (last)? "\n};\n\n" : \
+ ((i) % (width) == (width)-1 ? ",\n" : ", "))
+
+void gen_trees_header()
+{
+ FILE *header = fopen("trees.h", "w");
+ int i;
+
+ Assert (header != NULL, "Can't open trees.h");
+ fprintf(header,
+ "/* header created automatically with -DGEN_TREES_H */\n\n");
+
+ fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n");
+ for (i = 0; i < L_CODES+2; i++) {
+ fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code,
+ static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5));
+ }
+
+ fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n");
+ for (i = 0; i < D_CODES; i++) {
+ fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code,
+ static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5));
+ }
+
+ fprintf(header, "const uch _dist_code[DIST_CODE_LEN] = {\n");
+ for (i = 0; i < DIST_CODE_LEN; i++) {
+ fprintf(header, "%2u%s", _dist_code[i],
+ SEPARATOR(i, DIST_CODE_LEN-1, 20));
+ }
+
+ fprintf(header, "const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {\n");
+ for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) {
+ fprintf(header, "%2u%s", _length_code[i],
+ SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20));
+ }
+
+ fprintf(header, "local const int base_length[LENGTH_CODES] = {\n");
+ for (i = 0; i < LENGTH_CODES; i++) {
+ fprintf(header, "%1u%s", base_length[i],
+ SEPARATOR(i, LENGTH_CODES-1, 20));
+ }
+
+ fprintf(header, "local const int base_dist[D_CODES] = {\n");
+ for (i = 0; i < D_CODES; i++) {
+ fprintf(header, "%5u%s", base_dist[i],
+ SEPARATOR(i, D_CODES-1, 10));
+ }
+
+ fclose(header);
+}
+#endif /* GEN_TREES_H */
+
+/* ===========================================================================
+ * Initialize the tree data structures for a new zlib stream.
+ */
+void _tr_init(s)
+ deflate_state *s;
+{
+ tr_static_init();
+
+ s->l_desc.dyn_tree = s->dyn_ltree;
+ s->l_desc.stat_desc = &static_l_desc;
+
+ s->d_desc.dyn_tree = s->dyn_dtree;
+ s->d_desc.stat_desc = &static_d_desc;
+
+ s->bl_desc.dyn_tree = s->bl_tree;
+ s->bl_desc.stat_desc = &static_bl_desc;
+
+ s->bi_buf = 0;
+ s->bi_valid = 0;
+ s->last_eob_len = 8; /* enough lookahead for inflate */
+#ifdef DEBUG
+ s->compressed_len = 0L;
+ s->bits_sent = 0L;
+#endif
+
+ /* Initialize the first block of the first file: */
+ init_block(s);
+}
+
+/* ===========================================================================
+ * Initialize a new block.
+ */
+local void init_block(s)
+ deflate_state *s;
+{
+ int n; /* iterates over tree elements */
+
+ /* Initialize the trees. */
+ for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0;
+ for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0;
+ for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0;
+
+ s->dyn_ltree[END_BLOCK].Freq = 1;
+ s->opt_len = s->static_len = 0L;
+ s->last_lit = s->matches = 0;
+}
+
+#define SMALLEST 1
+/* Index within the heap array of least frequent node in the Huffman tree */
+
+
+/* ===========================================================================
+ * Remove the smallest element from the heap and recreate the heap with
+ * one less element. Updates heap and heap_len.
+ */
+#define pqremove(s, tree, top) \
+{\
+ top = s->heap[SMALLEST]; \
+ s->heap[SMALLEST] = s->heap[s->heap_len--]; \
+ pqdownheap(s, tree, SMALLEST); \
+}
+
+/* ===========================================================================
+ * Compares to subtrees, using the tree depth as tie breaker when
+ * the subtrees have equal frequency. This minimizes the worst case length.
+ */
+#define smaller(tree, n, m, depth) \
+ (tree[n].Freq < tree[m].Freq || \
+ (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
+
+/* ===========================================================================
+ * Restore the heap property by moving down the tree starting at node k,
+ * exchanging a node with the smallest of its two sons if necessary, stopping
+ * when the heap property is re-established (each father smaller than its
+ * two sons).
+ */
+local void pqdownheap(s, tree, k)
+ deflate_state *s;
+ ct_data *tree; /* the tree to restore */
+ int k; /* node to move down */
+{
+ int v = s->heap[k];
+ int j = k << 1; /* left son of k */
+ while (j <= s->heap_len) {
+ /* Set j to the smallest of the two sons: */
+ if (j < s->heap_len &&
+ smaller(tree, s->heap[j+1], s->heap[j], s->depth)) {
+ j++;
+ }
+ /* Exit if v is smaller than both sons */
+ if (smaller(tree, v, s->heap[j], s->depth)) break;
+
+ /* Exchange v with the smallest son */
+ s->heap[k] = s->heap[j]; k = j;
+
+ /* And continue down the tree, setting j to the left son of k */
+ j <<= 1;
+ }
+ s->heap[k] = v;
+}
+
+/* ===========================================================================
+ * Compute the optimal bit lengths for a tree and update the total bit length
+ * for the current block.
+ * IN assertion: the fields freq and dad are set, heap[heap_max] and
+ * above are the tree nodes sorted by increasing frequency.
+ * OUT assertions: the field len is set to the optimal bit length, the
+ * array bl_count contains the frequencies for each bit length.
+ * The length opt_len is updated; static_len is also updated if stree is
+ * not null.
+ */
+local void gen_bitlen(s, desc)
+ deflate_state *s;
+ tree_desc *desc; /* the tree descriptor */
+{
+ ct_data *tree = desc->dyn_tree;
+ int max_code = desc->max_code;
+ const ct_data *stree = desc->stat_desc->static_tree;
+ const intf *extra = desc->stat_desc->extra_bits;
+ int base = desc->stat_desc->extra_base;
+ int max_length = desc->stat_desc->max_length;
+ int h; /* heap index */
+ int n, m; /* iterate over the tree elements */
+ int bits; /* bit length */
+ int xbits; /* extra bits */
+ ush f; /* frequency */
+ int overflow = 0; /* number of elements with bit length too large */
+
+ for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0;
+
+ /* In a first pass, compute the optimal bit lengths (which may
+ * overflow in the case of the bit length tree).
+ */
+ tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */
+
+ for (h = s->heap_max+1; h < HEAP_SIZE; h++) {
+ n = s->heap[h];
+ bits = tree[tree[n].Dad].Len + 1;
+ if (bits > max_length) bits = max_length, overflow++;
+ tree[n].Len = (ush)bits;
+ /* We overwrite tree[n].Dad which is no longer needed */
+
+ if (n > max_code) continue; /* not a leaf node */
+
+ s->bl_count[bits]++;
+ xbits = 0;
+ if (n >= base) xbits = extra[n-base];
+ f = tree[n].Freq;
+ s->opt_len += (ulg)f * (bits + xbits);
+ if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits);
+ }
+ if (overflow == 0) return;
+
+ Trace((stderr,"\nbit length overflow\n"));
+ /* This happens for example on obj2 and pic of the Calgary corpus */
+
+ /* Find the first bit length which could increase: */
+ do {
+ bits = max_length-1;
+ while (s->bl_count[bits] == 0) bits--;
+ s->bl_count[bits]--; /* move one leaf down the tree */
+ s->bl_count[bits+1] += 2; /* move one overflow item as its brother */
+ s->bl_count[max_length]--;
+ /* The brother of the overflow item also moves one step up,
+ * but this does not affect bl_count[max_length]
+ */
+ overflow -= 2;
+ } while (overflow > 0);
+
+ /* Now recompute all bit lengths, scanning in increasing frequency.
+ * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all
+ * lengths instead of fixing only the wrong ones. This idea is taken
+ * from 'ar' written by Haruhiko Okumura.)
+ */
+ for (bits = max_length; bits != 0; bits--) {
+ n = s->bl_count[bits];
+ while (n != 0) {
+ m = s->heap[--h];
+ if (m > max_code) continue;
+ if (tree[m].Len != (unsigned) bits) {
+ Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
+ s->opt_len += ((long)bits - (long)tree[m].Len)
+ *(long)tree[m].Freq;
+ tree[m].Len = (ush)bits;
+ }
+ n--;
+ }
+ }
+}
+
+/* ===========================================================================
+ * Generate the codes for a given tree and bit counts (which need not be
+ * optimal).
+ * IN assertion: the array bl_count contains the bit length statistics for
+ * the given tree and the field len is set for all tree elements.
+ * OUT assertion: the field code is set for all tree elements of non
+ * zero code length.
+ */
+local void gen_codes (tree, max_code, bl_count)
+ ct_data *tree; /* the tree to decorate */
+ int max_code; /* largest code with non zero frequency */
+ ushf *bl_count; /* number of codes at each bit length */
+{
+ ush next_code[MAX_BITS+1]; /* next code value for each bit length */
+ ush code = 0; /* running code value */
+ int bits; /* bit index */
+ int n; /* code index */
+
+ /* The distribution counts are first used to generate the code values
+ * without bit reversal.
+ */
+ for (bits = 1; bits <= MAX_BITS; bits++) {
+ next_code[bits] = code = (code + bl_count[bits-1]) << 1;
+ }
+ /* Check that the bit counts in bl_count are consistent. The last code
+ * must be all ones.
+ */
+ Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
+ "inconsistent bit counts");
+ Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
+
+ for (n = 0; n <= max_code; n++) {
+ int len = tree[n].Len;
+ if (len == 0) continue;
+ /* Now reverse the bits */
+ tree[n].Code = bi_reverse(next_code[len]++, len);
+
+ Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
+ n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));
+ }
+}
+
+/* ===========================================================================
+ * Construct one Huffman tree and assigns the code bit strings and lengths.
+ * Update the total bit length for the current block.
+ * IN assertion: the field freq is set for all tree elements.
+ * OUT assertions: the fields len and code are set to the optimal bit length
+ * and corresponding code. The length opt_len is updated; static_len is
+ * also updated if stree is not null. The field max_code is set.
+ */
+local void build_tree(s, desc)
+ deflate_state *s;
+ tree_desc *desc; /* the tree descriptor */
+{
+ ct_data *tree = desc->dyn_tree;
+ const ct_data *stree = desc->stat_desc->static_tree;
+ int elems = desc->stat_desc->elems;
+ int n, m; /* iterate over heap elements */
+ int max_code = -1; /* largest code with non zero frequency */
+ int node; /* new node being created */
+
+ /* Construct the initial heap, with least frequent element in
+ * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].
+ * heap[0] is not used.
+ */
+ s->heap_len = 0, s->heap_max = HEAP_SIZE;
+
+ for (n = 0; n < elems; n++) {
+ if (tree[n].Freq != 0) {
+ s->heap[++(s->heap_len)] = max_code = n;
+ s->depth[n] = 0;
+ } else {
+ tree[n].Len = 0;
+ }
+ }
+
+ /* The pkzip format requires that at least one distance code exists,
+ * and that at least one bit should be sent even if there is only one
+ * possible code. So to avoid special checks later on we force at least
+ * two codes of non zero frequency.
+ */
+ while (s->heap_len < 2) {
+ node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0);
+ tree[node].Freq = 1;
+ s->depth[node] = 0;
+ s->opt_len--; if (stree) s->static_len -= stree[node].Len;
+ /* node is 0 or 1 so it does not have extra bits */
+ }
+ desc->max_code = max_code;
+
+ /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
+ * establish sub-heaps of increasing lengths:
+ */
+ for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n);
+
+ /* Construct the Huffman tree by repeatedly combining the least two
+ * frequent nodes.
+ */
+ node = elems; /* next internal node of the tree */
+ do {
+ pqremove(s, tree, n); /* n = node of least frequency */
+ m = s->heap[SMALLEST]; /* m = node of next least frequency */
+
+ s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */
+ s->heap[--(s->heap_max)] = m;
+
+ /* Create a new node father of n and m */
+ tree[node].Freq = tree[n].Freq + tree[m].Freq;
+ s->depth[node] = (uch) (MAX(s->depth[n], s->depth[m]) + 1);
+ tree[n].Dad = tree[m].Dad = (ush)node;
+#ifdef DUMP_BL_TREE
+ if (tree == s->bl_tree) {
+ fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)",
+ node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq);
+ }
+#endif
+ /* and insert the new node in the heap */
+ s->heap[SMALLEST] = node++;
+ pqdownheap(s, tree, SMALLEST);
+
+ } while (s->heap_len >= 2);
+
+ s->heap[--(s->heap_max)] = s->heap[SMALLEST];
+
+ /* At this point, the fields freq and dad are set. We can now
+ * generate the bit lengths.
+ */
+ gen_bitlen(s, (tree_desc *)desc);
+
+ /* The field len is now set, we can generate the bit codes */
+ gen_codes ((ct_data *)tree, max_code, s->bl_count);
+}
+
+/* ===========================================================================
+ * Scan a literal or distance tree to determine the frequencies of the codes
+ * in the bit length tree.
+ */
+local void scan_tree (s, tree, max_code)
+ deflate_state *s;
+ ct_data *tree; /* the tree to be scanned */
+ int max_code; /* and its largest code of non zero frequency */
+{
+ int n; /* iterates over all tree elements */
+ int prevlen = -1; /* last emitted length */
+ int curlen; /* length of current code */
+ int nextlen = tree[0].Len; /* length of next code */
+ int count = 0; /* repeat count of the current code */
+ int max_count = 7; /* max repeat count */
+ int min_count = 4; /* min repeat count */
+
+ if (nextlen == 0) max_count = 138, min_count = 3;
+ tree[max_code+1].Len = (ush)0xffff; /* guard */
+
+ for (n = 0; n <= max_code; n++) {
+ curlen = nextlen; nextlen = tree[n+1].Len;
+ if (++count < max_count && curlen == nextlen) {
+ continue;
+ } else if (count < min_count) {
+ s->bl_tree[curlen].Freq += count;
+ } else if (curlen != 0) {
+ if (curlen != prevlen) s->bl_tree[curlen].Freq++;
+ s->bl_tree[REP_3_6].Freq++;
+ } else if (count <= 10) {
+ s->bl_tree[REPZ_3_10].Freq++;
+ } else {
+ s->bl_tree[REPZ_11_138].Freq++;
+ }
+ count = 0; prevlen = curlen;
+ if (nextlen == 0) {
+ max_count = 138, min_count = 3;
+ } else if (curlen == nextlen) {
+ max_count = 6, min_count = 3;
+ } else {
+ max_count = 7, min_count = 4;
+ }
+ }
+}
+
+/* ===========================================================================
+ * Send a literal or distance tree in compressed form, using the codes in
+ * bl_tree.
+ */
+local void send_tree (s, tree, max_code)
+ deflate_state *s;
+ ct_data *tree; /* the tree to be scanned */
+ int max_code; /* and its largest code of non zero frequency */
+{
+ int n; /* iterates over all tree elements */
+ int prevlen = -1; /* last emitted length */
+ int curlen; /* length of current code */
+ int nextlen = tree[0].Len; /* length of next code */
+ int count = 0; /* repeat count of the current code */
+ int max_count = 7; /* max repeat count */
+ int min_count = 4; /* min repeat count */
+
+ /* tree[max_code+1].Len = -1; */ /* guard already set */
+ if (nextlen == 0) max_count = 138, min_count = 3;
+
+ for (n = 0; n <= max_code; n++) {
+ curlen = nextlen; nextlen = tree[n+1].Len;
+ if (++count < max_count && curlen == nextlen) {
+ continue;
+ } else if (count < min_count) {
+ do { send_code(s, curlen, s->bl_tree); } while (--count != 0);
+
+ } else if (curlen != 0) {
+ if (curlen != prevlen) {
+ send_code(s, curlen, s->bl_tree); count--;
+ }
+ Assert(count >= 3 && count <= 6, " 3_6?");
+ send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2);
+
+ } else if (count <= 10) {
+ send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3);
+
+ } else {
+ send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7);
+ }
+ count = 0; prevlen = curlen;
+ if (nextlen == 0) {
+ max_count = 138, min_count = 3;
+ } else if (curlen == nextlen) {
+ max_count = 6, min_count = 3;
+ } else {
+ max_count = 7, min_count = 4;
+ }
+ }
+}
+
+/* ===========================================================================
+ * Construct the Huffman tree for the bit lengths and return the index in
+ * bl_order of the last bit length code to send.
+ */
+local int build_bl_tree(s)
+ deflate_state *s;
+{
+ int max_blindex; /* index of last bit length code of non zero freq */
+
+ /* Determine the bit length frequencies for literal and distance trees */
+ scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code);
+ scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code);
+
+ /* Build the bit length tree: */
+ build_tree(s, (tree_desc *)(&(s->bl_desc)));
+ /* opt_len now includes the length of the tree representations, except
+ * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.
+ */
+
+ /* Determine the number of bit length codes to send. The pkzip format
+ * requires that at least 4 bit length codes be sent. (appnote.txt says
+ * 3 but the actual value used is 4.)
+ */
+ for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) {
+ if (s->bl_tree[bl_order[max_blindex]].Len != 0) break;
+ }
+ /* Update opt_len to include the bit length tree and counts */
+ s->opt_len += 3*(max_blindex+1) + 5+5+4;
+ Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld",
+ s->opt_len, s->static_len));
+
+ return max_blindex;
+}
+
+/* ===========================================================================
+ * Send the header for a block using dynamic Huffman trees: the counts, the
+ * lengths of the bit length codes, the literal tree and the distance tree.
+ * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
+ */
+local void send_all_trees(s, lcodes, dcodes, blcodes)
+ deflate_state *s;
+ int lcodes, dcodes, blcodes; /* number of codes for each tree */
+{
+ int rank; /* index in bl_order */
+
+ Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
+ Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,
+ "too many codes");
+ Tracev((stderr, "\nbl counts: "));
+ send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */
+ send_bits(s, dcodes-1, 5);
+ send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */
+ for (rank = 0; rank < blcodes; rank++) {
+ Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
+ send_bits(s, s->bl_tree[bl_order[rank]].Len, 3);
+ }
+ Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent));
+
+ send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */
+ Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent));
+
+ send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */
+ Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent));
+}
+
+/* ===========================================================================
+ * Send a stored block
+ */
+void _tr_stored_block(s, buf, stored_len, eof)
+ deflate_state *s;
+ charf *buf; /* input block */
+ ulg stored_len; /* length of input block */
+ int eof; /* true if this is the last block for a file */
+{
+ send_bits(s, (STORED_BLOCK<<1)+eof, 3); /* send block type */
+#ifdef DEBUG
+ s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;
+ s->compressed_len += (stored_len + 4) << 3;
+#endif
+ copy_block(s, buf, (unsigned)stored_len, 1); /* with header */
+}
+
+/* ===========================================================================
+ * Send one empty static block to give enough lookahead for inflate.
+ * This takes 10 bits, of which 7 may remain in the bit buffer.
+ * The current inflate code requires 9 bits of lookahead. If the
+ * last two codes for the previous block (real code plus EOB) were coded
+ * on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode
+ * the last real code. In this case we send two empty static blocks instead
+ * of one. (There are no problems if the previous block is stored or fixed.)
+ * To simplify the code, we assume the worst case of last real code encoded
+ * on one bit only.
+ */
+void _tr_align(s)
+ deflate_state *s;
+{
+ send_bits(s, STATIC_TREES<<1, 3);
+ send_code(s, END_BLOCK, static_ltree);
+#ifdef DEBUG
+ s->compressed_len += 10L; /* 3 for block type, 7 for EOB */
+#endif
+ bi_flush(s);
+ /* Of the 10 bits for the empty block, we have already sent
+ * (10 - bi_valid) bits. The lookahead for the last real code (before
+ * the EOB of the previous block) was thus at least one plus the length
+ * of the EOB plus what we have just sent of the empty static block.
+ */
+ if (1 + s->last_eob_len + 10 - s->bi_valid < 9) {
+ send_bits(s, STATIC_TREES<<1, 3);
+ send_code(s, END_BLOCK, static_ltree);
+#ifdef DEBUG
+ s->compressed_len += 10L;
+#endif
+ bi_flush(s);
+ }
+ s->last_eob_len = 7;
+}
+
+/* ===========================================================================
+ * Determine the best encoding for the current block: dynamic trees, static
+ * trees or store, and output the encoded block to the zip file.
+ */
+void _tr_flush_block(s, buf, stored_len, eof)
+ deflate_state *s;
+ charf *buf; /* input block, or NULL if too old */
+ ulg stored_len; /* length of input block */
+ int eof; /* true if this is the last block for a file */
+{
+ ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
+ int max_blindex = 0; /* index of last bit length code of non zero freq */
+
+ /* Build the Huffman trees unless a stored block is forced */
+ if (s->level > 0) {
+
+ /* Check if the file is ascii or binary */
+ if (s->data_type == Z_UNKNOWN) set_data_type(s);
+
+ /* Construct the literal and distance trees */
+ build_tree(s, (tree_desc *)(&(s->l_desc)));
+ Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len,
+ s->static_len));
+
+ build_tree(s, (tree_desc *)(&(s->d_desc)));
+ Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len,
+ s->static_len));
+ /* At this point, opt_len and static_len are the total bit lengths of
+ * the compressed block data, excluding the tree representations.
+ */
+
+ /* Build the bit length tree for the above two trees, and get the index
+ * in bl_order of the last bit length code to send.
+ */
+ max_blindex = build_bl_tree(s);
+
+ /* Determine the best encoding. Compute first the block length in bytes*/
+ opt_lenb = (s->opt_len+3+7)>>3;
+ static_lenb = (s->static_len+3+7)>>3;
+
+ Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
+ opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
+ s->last_lit));
+
+ if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
+
+ } else {
+ Assert(buf != (char*)0, "lost buf");
+ opt_lenb = static_lenb = stored_len + 5; /* force a stored block */
+ }
+
+#ifdef FORCE_STORED
+ if (buf != (char*)0) { /* force stored block */
+#else
+ if (stored_len+4 <= opt_lenb && buf != (char*)0) {
+ /* 4: two words for the lengths */
+#endif
+ /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
+ * Otherwise we can't have processed more than WSIZE input bytes since
+ * the last block flush, because compression would have been
+ * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to
+ * transform a block into a stored block.
+ */
+ _tr_stored_block(s, buf, stored_len, eof);
+
+#ifdef FORCE_STATIC
+ } else if (static_lenb >= 0) { /* force static trees */
+#else
+ } else if (static_lenb == opt_lenb) {
+#endif
+ send_bits(s, (STATIC_TREES<<1)+eof, 3);
+ compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree);
+#ifdef DEBUG
+ s->compressed_len += 3 + s->static_len;
+#endif
+ } else {
+ send_bits(s, (DYN_TREES<<1)+eof, 3);
+ send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1,
+ max_blindex+1);
+ compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree);
+#ifdef DEBUG
+ s->compressed_len += 3 + s->opt_len;
+#endif
+ }
+ Assert (s->compressed_len == s->bits_sent, "bad compressed size");
+ /* The above check is made mod 2^32, for files larger than 512 MB
+ * and uLong implemented on 32 bits.
+ */
+ init_block(s);
+
+ if (eof) {
+ bi_windup(s);
+#ifdef DEBUG
+ s->compressed_len += 7; /* align on byte boundary */
+#endif
+ }
+ Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3,
+ s->compressed_len-7*eof));
+}
+
+/* ===========================================================================
+ * Save the match info and tally the frequency counts. Return true if
+ * the current block must be flushed.
+ */
+int _tr_tally (s, dist, lc)
+ deflate_state *s;
+ unsigned dist; /* distance of matched string */
+ unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */
+{
+ s->d_buf[s->last_lit] = (ush)dist;
+ s->l_buf[s->last_lit++] = (uch)lc;
+ if (dist == 0) {
+ /* lc is the unmatched char */
+ s->dyn_ltree[lc].Freq++;
+ } else {
+ s->matches++;
+ /* Here, lc is the match length - MIN_MATCH */
+ dist--; /* dist = match distance - 1 */
+ Assert((ush)dist < (ush)MAX_DIST(s) &&
+ (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&
+ (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match");
+
+ s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++;
+ s->dyn_dtree[d_code(dist)].Freq++;
+ }
+
+#ifdef TRUNCATE_BLOCK
+ /* Try to guess if it is profitable to stop the current block here */
+ if ((s->last_lit & 0x1fff) == 0 && s->level > 2) {
+ /* Compute an upper bound for the compressed length */
+ ulg out_length = (ulg)s->last_lit*8L;
+ ulg in_length = (ulg)((long)s->strstart - s->block_start);
+ int dcode;
+ for (dcode = 0; dcode < D_CODES; dcode++) {
+ out_length += (ulg)s->dyn_dtree[dcode].Freq *
+ (5L+extra_dbits[dcode]);
+ }
+ out_length >>= 3;
+ Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
+ s->last_lit, in_length, out_length,
+ 100L - out_length*100L/in_length));
+ if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1;
+ }
+#endif
+ return (s->last_lit == s->lit_bufsize-1);
+ /* We avoid equality with lit_bufsize because of wraparound at 64K
+ * on 16 bit machines and because stored blocks are restricted to
+ * 64K-1 bytes.
+ */
+}
+
+/* ===========================================================================
+ * Send the block data compressed using the given Huffman trees
+ */
+local void compress_block(s, ltree, dtree)
+ deflate_state *s;
+ ct_data *ltree; /* literal tree */
+ ct_data *dtree; /* distance tree */
+{
+ unsigned dist; /* distance of matched string */
+ int lc; /* match length or unmatched char (if dist == 0) */
+ unsigned lx = 0; /* running index in l_buf */
+ unsigned code; /* the code to send */
+ int extra; /* number of extra bits to send */
+
+ if (s->last_lit != 0) do {
+ dist = s->d_buf[lx];
+ lc = s->l_buf[lx++];
+ if (dist == 0) {
+ send_code(s, lc, ltree); /* send a literal byte */
+ Tracecv(isgraph(lc), (stderr," '%c' ", lc));
+ } else {
+ /* Here, lc is the match length - MIN_MATCH */
+ code = _length_code[lc];
+ send_code(s, code+LITERALS+1, ltree); /* send the length code */
+ extra = extra_lbits[code];
+ if (extra != 0) {
+ lc -= base_length[code];
+ send_bits(s, lc, extra); /* send the extra length bits */
+ }
+ dist--; /* dist is now the match distance - 1 */
+ code = d_code(dist);
+ Assert (code < D_CODES, "bad d_code");
+
+ send_code(s, code, dtree); /* send the distance code */
+ extra = extra_dbits[code];
+ if (extra != 0) {
+ dist -= base_dist[code];
+ send_bits(s, dist, extra); /* send the extra distance bits */
+ }
+ } /* literal or match pair ? */
+
+ /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
+ Assert(s->pending < s->lit_bufsize + 2*lx, "pendingBuf overflow");
+
+ } while (lx < s->last_lit);
+
+ send_code(s, END_BLOCK, ltree);
+ s->last_eob_len = ltree[END_BLOCK].Len;
+}
+
+/* ===========================================================================
+ * Set the data type to ASCII or BINARY, using a crude approximation:
+ * binary if more than 20% of the bytes are <= 6 or >= 128, ascii otherwise.
+ * IN assertion: the fields freq of dyn_ltree are set and the total of all
+ * frequencies does not exceed 64K (to fit in an int on 16 bit machines).
+ */
+local void set_data_type(s)
+ deflate_state *s;
+{
+ int n = 0;
+ unsigned ascii_freq = 0;
+ unsigned bin_freq = 0;
+ while (n < 7) bin_freq += s->dyn_ltree[n++].Freq;
+ while (n < 128) ascii_freq += s->dyn_ltree[n++].Freq;
+ while (n < LITERALS) bin_freq += s->dyn_ltree[n++].Freq;
+ s->data_type = (Byte)(bin_freq > (ascii_freq >> 2) ? Z_BINARY : Z_ASCII);
+}
+
+/* ===========================================================================
+ * Reverse the first len bits of a code, using straightforward code (a faster
+ * method would use a table)
+ * IN assertion: 1 <= len <= 15
+ */
+local unsigned bi_reverse(code, len)
+ unsigned code; /* the value to invert */
+ int len; /* its bit length */
+{
+ register unsigned res = 0;
+ do {
+ res |= code & 1;
+ code >>= 1, res <<= 1;
+ } while (--len > 0);
+ return res >> 1;
+}
+
+/* ===========================================================================
+ * Flush the bit buffer, keeping at most 7 bits in it.
+ */
+local void bi_flush(s)
+ deflate_state *s;
+{
+ if (s->bi_valid == 16) {
+ put_short(s, s->bi_buf);
+ s->bi_buf = 0;
+ s->bi_valid = 0;
+ } else if (s->bi_valid >= 8) {
+ put_byte(s, (Byte)s->bi_buf);
+ s->bi_buf >>= 8;
+ s->bi_valid -= 8;
+ }
+}
+
+/* ===========================================================================
+ * Flush the bit buffer and align the output on a byte boundary
+ */
+local void bi_windup(s)
+ deflate_state *s;
+{
+ if (s->bi_valid > 8) {
+ put_short(s, s->bi_buf);
+ } else if (s->bi_valid > 0) {
+ put_byte(s, (Byte)s->bi_buf);
+ }
+ s->bi_buf = 0;
+ s->bi_valid = 0;
+#ifdef DEBUG
+ s->bits_sent = (s->bits_sent+7) & ~7;
+#endif
+}
+
+/* ===========================================================================
+ * Copy a stored block, storing first the length and its
+ * one's complement if requested.
+ */
+local void copy_block(s, buf, len, header)
+ deflate_state *s;
+ charf *buf; /* the input data */
+ unsigned len; /* its length */
+ int header; /* true if block header must be written */
+{
+ bi_windup(s); /* align on byte boundary */
+ s->last_eob_len = 8; /* enough lookahead for inflate */
+
+ if (header) {
+ put_short(s, (ush)len);
+ put_short(s, (ush)~len);
+#ifdef DEBUG
+ s->bits_sent += 2*16;
+#endif
+ }
+#ifdef DEBUG
+ s->bits_sent += (ulg)len<<3;
+#endif
+ while (len--) {
+ put_byte(s, *buf++);
+ }
+}
diff --git a/win32/contrib/zlib/trees.h b/win32/contrib/zlib/trees.h new file mode 100644 index 000000000..1ca868b84 --- /dev/null +++ b/win32/contrib/zlib/trees.h @@ -0,0 +1,128 @@ +/* header created automatically with -DGEN_TREES_H */
+
+local const ct_data static_ltree[L_CODES+2] = {
+{{ 12},{ 8}}, {{140},{ 8}}, {{ 76},{ 8}}, {{204},{ 8}}, {{ 44},{ 8}},
+{{172},{ 8}}, {{108},{ 8}}, {{236},{ 8}}, {{ 28},{ 8}}, {{156},{ 8}},
+{{ 92},{ 8}}, {{220},{ 8}}, {{ 60},{ 8}}, {{188},{ 8}}, {{124},{ 8}},
+{{252},{ 8}}, {{ 2},{ 8}}, {{130},{ 8}}, {{ 66},{ 8}}, {{194},{ 8}},
+{{ 34},{ 8}}, {{162},{ 8}}, {{ 98},{ 8}}, {{226},{ 8}}, {{ 18},{ 8}},
+{{146},{ 8}}, {{ 82},{ 8}}, {{210},{ 8}}, {{ 50},{ 8}}, {{178},{ 8}},
+{{114},{ 8}}, {{242},{ 8}}, {{ 10},{ 8}}, {{138},{ 8}}, {{ 74},{ 8}},
+{{202},{ 8}}, {{ 42},{ 8}}, {{170},{ 8}}, {{106},{ 8}}, {{234},{ 8}},
+{{ 26},{ 8}}, {{154},{ 8}}, {{ 90},{ 8}}, {{218},{ 8}}, {{ 58},{ 8}},
+{{186},{ 8}}, {{122},{ 8}}, {{250},{ 8}}, {{ 6},{ 8}}, {{134},{ 8}},
+{{ 70},{ 8}}, {{198},{ 8}}, {{ 38},{ 8}}, {{166},{ 8}}, {{102},{ 8}},
+{{230},{ 8}}, {{ 22},{ 8}}, {{150},{ 8}}, {{ 86},{ 8}}, {{214},{ 8}},
+{{ 54},{ 8}}, {{182},{ 8}}, {{118},{ 8}}, {{246},{ 8}}, {{ 14},{ 8}},
+{{142},{ 8}}, {{ 78},{ 8}}, {{206},{ 8}}, {{ 46},{ 8}}, {{174},{ 8}},
+{{110},{ 8}}, {{238},{ 8}}, {{ 30},{ 8}}, {{158},{ 8}}, {{ 94},{ 8}},
+{{222},{ 8}}, {{ 62},{ 8}}, {{190},{ 8}}, {{126},{ 8}}, {{254},{ 8}},
+{{ 1},{ 8}}, {{129},{ 8}}, {{ 65},{ 8}}, {{193},{ 8}}, {{ 33},{ 8}},
+{{161},{ 8}}, {{ 97},{ 8}}, {{225},{ 8}}, {{ 17},{ 8}}, {{145},{ 8}},
+{{ 81},{ 8}}, {{209},{ 8}}, {{ 49},{ 8}}, {{177},{ 8}}, {{113},{ 8}},
+{{241},{ 8}}, {{ 9},{ 8}}, {{137},{ 8}}, {{ 73},{ 8}}, {{201},{ 8}},
+{{ 41},{ 8}}, {{169},{ 8}}, {{105},{ 8}}, {{233},{ 8}}, {{ 25},{ 8}},
+{{153},{ 8}}, {{ 89},{ 8}}, {{217},{ 8}}, {{ 57},{ 8}}, {{185},{ 8}},
+{{121},{ 8}}, {{249},{ 8}}, {{ 5},{ 8}}, {{133},{ 8}}, {{ 69},{ 8}},
+{{197},{ 8}}, {{ 37},{ 8}}, {{165},{ 8}}, {{101},{ 8}}, {{229},{ 8}},
+{{ 21},{ 8}}, {{149},{ 8}}, {{ 85},{ 8}}, {{213},{ 8}}, {{ 53},{ 8}},
+{{181},{ 8}}, {{117},{ 8}}, {{245},{ 8}}, {{ 13},{ 8}}, {{141},{ 8}},
+{{ 77},{ 8}}, {{205},{ 8}}, {{ 45},{ 8}}, {{173},{ 8}}, {{109},{ 8}},
+{{237},{ 8}}, {{ 29},{ 8}}, {{157},{ 8}}, {{ 93},{ 8}}, {{221},{ 8}},
+{{ 61},{ 8}}, {{189},{ 8}}, {{125},{ 8}}, {{253},{ 8}}, {{ 19},{ 9}},
+{{275},{ 9}}, {{147},{ 9}}, {{403},{ 9}}, {{ 83},{ 9}}, {{339},{ 9}},
+{{211},{ 9}}, {{467},{ 9}}, {{ 51},{ 9}}, {{307},{ 9}}, {{179},{ 9}},
+{{435},{ 9}}, {{115},{ 9}}, {{371},{ 9}}, {{243},{ 9}}, {{499},{ 9}},
+{{ 11},{ 9}}, {{267},{ 9}}, {{139},{ 9}}, {{395},{ 9}}, {{ 75},{ 9}},
+{{331},{ 9}}, {{203},{ 9}}, {{459},{ 9}}, {{ 43},{ 9}}, {{299},{ 9}},
+{{171},{ 9}}, {{427},{ 9}}, {{107},{ 9}}, {{363},{ 9}}, {{235},{ 9}},
+{{491},{ 9}}, {{ 27},{ 9}}, {{283},{ 9}}, {{155},{ 9}}, {{411},{ 9}},
+{{ 91},{ 9}}, {{347},{ 9}}, {{219},{ 9}}, {{475},{ 9}}, {{ 59},{ 9}},
+{{315},{ 9}}, {{187},{ 9}}, {{443},{ 9}}, {{123},{ 9}}, {{379},{ 9}},
+{{251},{ 9}}, {{507},{ 9}}, {{ 7},{ 9}}, {{263},{ 9}}, {{135},{ 9}},
+{{391},{ 9}}, {{ 71},{ 9}}, {{327},{ 9}}, {{199},{ 9}}, {{455},{ 9}},
+{{ 39},{ 9}}, {{295},{ 9}}, {{167},{ 9}}, {{423},{ 9}}, {{103},{ 9}},
+{{359},{ 9}}, {{231},{ 9}}, {{487},{ 9}}, {{ 23},{ 9}}, {{279},{ 9}},
+{{151},{ 9}}, {{407},{ 9}}, {{ 87},{ 9}}, {{343},{ 9}}, {{215},{ 9}},
+{{471},{ 9}}, {{ 55},{ 9}}, {{311},{ 9}}, {{183},{ 9}}, {{439},{ 9}},
+{{119},{ 9}}, {{375},{ 9}}, {{247},{ 9}}, {{503},{ 9}}, {{ 15},{ 9}},
+{{271},{ 9}}, {{143},{ 9}}, {{399},{ 9}}, {{ 79},{ 9}}, {{335},{ 9}},
+{{207},{ 9}}, {{463},{ 9}}, {{ 47},{ 9}}, {{303},{ 9}}, {{175},{ 9}},
+{{431},{ 9}}, {{111},{ 9}}, {{367},{ 9}}, {{239},{ 9}}, {{495},{ 9}},
+{{ 31},{ 9}}, {{287},{ 9}}, {{159},{ 9}}, {{415},{ 9}}, {{ 95},{ 9}},
+{{351},{ 9}}, {{223},{ 9}}, {{479},{ 9}}, {{ 63},{ 9}}, {{319},{ 9}},
+{{191},{ 9}}, {{447},{ 9}}, {{127},{ 9}}, {{383},{ 9}}, {{255},{ 9}},
+{{511},{ 9}}, {{ 0},{ 7}}, {{ 64},{ 7}}, {{ 32},{ 7}}, {{ 96},{ 7}},
+{{ 16},{ 7}}, {{ 80},{ 7}}, {{ 48},{ 7}}, {{112},{ 7}}, {{ 8},{ 7}},
+{{ 72},{ 7}}, {{ 40},{ 7}}, {{104},{ 7}}, {{ 24},{ 7}}, {{ 88},{ 7}},
+{{ 56},{ 7}}, {{120},{ 7}}, {{ 4},{ 7}}, {{ 68},{ 7}}, {{ 36},{ 7}},
+{{100},{ 7}}, {{ 20},{ 7}}, {{ 84},{ 7}}, {{ 52},{ 7}}, {{116},{ 7}},
+{{ 3},{ 8}}, {{131},{ 8}}, {{ 67},{ 8}}, {{195},{ 8}}, {{ 35},{ 8}},
+{{163},{ 8}}, {{ 99},{ 8}}, {{227},{ 8}}
+};
+
+local const ct_data static_dtree[D_CODES] = {
+{{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}},
+{{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}},
+{{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}},
+{{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}},
+{{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}},
+{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}}
+};
+
+const uch _dist_code[DIST_CODE_LEN] = {
+ 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8,
+ 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10,
+10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
+12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13,
+13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15,
+15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17,
+18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22,
+23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27,
+27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
+29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
+29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
+29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29
+};
+
+const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12,
+13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16,
+17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19,
+19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22,
+22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23,
+23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26,
+26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28
+};
+
+local const int base_length[LENGTH_CODES] = {
+0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56,
+64, 80, 96, 112, 128, 160, 192, 224, 0
+};
+
+local const int base_dist[D_CODES] = {
+ 0, 1, 2, 3, 4, 6, 8, 12, 16, 24,
+ 32, 48, 64, 96, 128, 192, 256, 384, 512, 768,
+ 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576
+};
+
diff --git a/win32/contrib/zlib/uncompr.c b/win32/contrib/zlib/uncompr.c new file mode 100644 index 000000000..36758a17c --- /dev/null +++ b/win32/contrib/zlib/uncompr.c @@ -0,0 +1,58 @@ +/* uncompr.c -- decompress a memory buffer
+ * Copyright (C) 1995-1998 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* @(#) $Id: uncompr.c,v 1.1 2003/04/20 16:42:09 guenter Exp $ */
+
+#include "zlib.h"
+
+/* ===========================================================================
+ Decompresses the source buffer into the destination buffer. sourceLen is
+ the byte length of the source buffer. Upon entry, destLen is the total
+ size of the destination buffer, which must be large enough to hold the
+ entire uncompressed data. (The size of the uncompressed data must have
+ been saved previously by the compressor and transmitted to the decompressor
+ by some mechanism outside the scope of this compression library.)
+ Upon exit, destLen is the actual size of the compressed buffer.
+ This function can be used to decompress a whole file at once if the
+ input file is mmap'ed.
+
+ uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
+ enough memory, Z_BUF_ERROR if there was not enough room in the output
+ buffer, or Z_DATA_ERROR if the input data was corrupted.
+*/
+int ZEXPORT uncompress (dest, destLen, source, sourceLen)
+ Bytef *dest;
+ uLongf *destLen;
+ const Bytef *source;
+ uLong sourceLen;
+{
+ z_stream stream;
+ int err;
+
+ stream.next_in = (Bytef*)source;
+ stream.avail_in = (uInt)sourceLen;
+ /* Check for source > 64K on 16-bit machine: */
+ if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
+
+ stream.next_out = dest;
+ stream.avail_out = (uInt)*destLen;
+ if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
+
+ stream.zalloc = (alloc_func)0;
+ stream.zfree = (free_func)0;
+
+ err = inflateInit(&stream);
+ if (err != Z_OK) return err;
+
+ err = inflate(&stream, Z_FINISH);
+ if (err != Z_STREAM_END) {
+ inflateEnd(&stream);
+ return err == Z_OK ? Z_BUF_ERROR : err;
+ }
+ *destLen = stream.total_out;
+
+ err = inflateEnd(&stream);
+ return err;
+}
diff --git a/win32/contrib/zlib/zconf.h b/win32/contrib/zlib/zconf.h new file mode 100644 index 000000000..90d1a107a --- /dev/null +++ b/win32/contrib/zlib/zconf.h @@ -0,0 +1,279 @@ +/* zconf.h -- configuration of the zlib compression library
+ * Copyright (C) 1995-1998 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* @(#) $Id: zconf.h,v 1.1 2003/04/20 16:42:09 guenter Exp $ */
+
+#ifndef _ZCONF_H
+#define _ZCONF_H
+
+/*
+ * If you *really* need a unique prefix for all types and library functions,
+ * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
+ */
+#ifdef Z_PREFIX
+# define deflateInit_ z_deflateInit_
+# define deflate z_deflate
+# define deflateEnd z_deflateEnd
+# define inflateInit_ z_inflateInit_
+# define inflate z_inflate
+# define inflateEnd z_inflateEnd
+# define deflateInit2_ z_deflateInit2_
+# define deflateSetDictionary z_deflateSetDictionary
+# define deflateCopy z_deflateCopy
+# define deflateReset z_deflateReset
+# define deflateParams z_deflateParams
+# define inflateInit2_ z_inflateInit2_
+# define inflateSetDictionary z_inflateSetDictionary
+# define inflateSync z_inflateSync
+# define inflateSyncPoint z_inflateSyncPoint
+# define inflateReset z_inflateReset
+# define compress z_compress
+# define compress2 z_compress2
+# define uncompress z_uncompress
+# define adler32 z_adler32
+# define crc32 z_crc32
+# define get_crc_table z_get_crc_table
+
+# define Byte z_Byte
+# define uInt z_uInt
+# define uLong z_uLong
+# define Bytef z_Bytef
+# define charf z_charf
+# define intf z_intf
+# define uIntf z_uIntf
+# define uLongf z_uLongf
+# define voidpf z_voidpf
+# define voidp z_voidp
+#endif
+
+#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
+# define WIN32
+#endif
+#if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386)
+# ifndef __32BIT__
+# define __32BIT__
+# endif
+#endif
+#if defined(__MSDOS__) && !defined(MSDOS)
+# define MSDOS
+#endif
+
+/*
+ * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
+ * than 64k bytes at a time (needed on systems with 16-bit int).
+ */
+#if defined(MSDOS) && !defined(__32BIT__)
+# define MAXSEG_64K
+#endif
+#ifdef MSDOS
+# define UNALIGNED_OK
+#endif
+
+#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32)) && !defined(STDC)
+# define STDC
+#endif
+#if defined(__STDC__) || defined(__cplusplus) || defined(__OS2__)
+# ifndef STDC
+# define STDC
+# endif
+#endif
+
+#ifndef STDC
+# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
+# define const
+# endif
+#endif
+
+/* Some Mac compilers merge all .h files incorrectly: */
+#if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__)
+# define NO_DUMMY_DECL
+#endif
+
+/* Old Borland C incorrectly complains about missing returns: */
+#if defined(__BORLANDC__) && (__BORLANDC__ < 0x500)
+# define NEED_DUMMY_RETURN
+#endif
+
+
+/* Maximum value for memLevel in deflateInit2 */
+#ifndef MAX_MEM_LEVEL
+# ifdef MAXSEG_64K
+# define MAX_MEM_LEVEL 8
+# else
+# define MAX_MEM_LEVEL 9
+# endif
+#endif
+
+/* Maximum value for windowBits in deflateInit2 and inflateInit2.
+ * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
+ * created by gzip. (Files created by minigzip can still be extracted by
+ * gzip.)
+ */
+#ifndef MAX_WBITS
+# define MAX_WBITS 15 /* 32K LZ77 window */
+#endif
+
+/* The memory requirements for deflate are (in bytes):
+ (1 << (windowBits+2)) + (1 << (memLevel+9))
+ that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
+ plus a few kilobytes for small objects. For example, if you want to reduce
+ the default memory requirements from 256K to 128K, compile with
+ make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
+ Of course this will generally degrade compression (there's no free lunch).
+
+ The memory requirements for inflate are (in bytes) 1 << windowBits
+ that is, 32K for windowBits=15 (default value) plus a few kilobytes
+ for small objects.
+*/
+
+ /* Type declarations */
+
+#ifndef OF /* function prototypes */
+# ifdef STDC
+# define OF(args) args
+# else
+# define OF(args) ()
+# endif
+#endif
+
+/* The following definitions for FAR are needed only for MSDOS mixed
+ * model programming (small or medium model with some far allocations).
+ * This was tested only with MSC; for other MSDOS compilers you may have
+ * to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
+ * just define FAR to be empty.
+ */
+#if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__)
+ /* MSC small or medium model */
+# define SMALL_MEDIUM
+# ifdef _MSC_VER
+# define FAR _far
+# else
+# define FAR far
+# endif
+#endif
+#if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__))
+# ifndef __32BIT__
+# define SMALL_MEDIUM
+# define FAR _far
+# endif
+#endif
+
+/* Compile with -DZLIB_DLL for Windows DLL support */
+#if defined(ZLIB_DLL)
+# if defined(_WINDOWS) || defined(WINDOWS)
+# ifdef FAR
+# undef FAR
+# endif
+# include <windows.h>
+# define ZEXPORT WINAPI
+# ifdef WIN32
+# define ZEXPORTVA WINAPIV
+# else
+# define ZEXPORTVA FAR _cdecl _export
+# endif
+# endif
+# if defined (__BORLANDC__)
+# if (__BORLANDC__ >= 0x0500) && defined (WIN32)
+# include <windows.h>
+# define ZEXPORT __declspec(dllexport) WINAPI
+# define ZEXPORTRVA __declspec(dllexport) WINAPIV
+# else
+# if defined (_Windows) && defined (__DLL__)
+# define ZEXPORT _export
+# define ZEXPORTVA _export
+# endif
+# endif
+# endif
+#endif
+
+#if defined (__BEOS__)
+# if defined (ZLIB_DLL)
+# define ZEXTERN extern __declspec(dllexport)
+# else
+# define ZEXTERN extern __declspec(dllimport)
+# endif
+#endif
+
+#ifndef ZEXPORT
+# define ZEXPORT
+#endif
+#ifndef ZEXPORTVA
+# define ZEXPORTVA
+#endif
+#ifndef ZEXTERN
+# define ZEXTERN extern
+#endif
+
+#ifndef FAR
+# define FAR
+#endif
+
+#if !defined(MACOS) && !defined(TARGET_OS_MAC)
+typedef unsigned char Byte; /* 8 bits */
+#endif
+typedef unsigned int uInt; /* 16 bits or more */
+typedef unsigned long uLong; /* 32 bits or more */
+
+#ifdef SMALL_MEDIUM
+ /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
+# define Bytef Byte FAR
+#else
+ typedef Byte FAR Bytef;
+#endif
+typedef char FAR charf;
+typedef int FAR intf;
+typedef uInt FAR uIntf;
+typedef uLong FAR uLongf;
+
+#ifdef STDC
+ typedef void FAR *voidpf;
+ typedef void *voidp;
+#else
+ typedef Byte FAR *voidpf;
+ typedef Byte *voidp;
+#endif
+
+#ifdef HAVE_UNISTD_H
+# include <sys/types.h> /* for off_t */
+# include <unistd.h> /* for SEEK_* and off_t */
+# define z_off_t off_t
+#endif
+#ifndef SEEK_SET
+# define SEEK_SET 0 /* Seek from beginning of file. */
+# define SEEK_CUR 1 /* Seek from current position. */
+# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
+#endif
+#ifndef z_off_t
+# define z_off_t long
+#endif
+
+/* MVS linker does not support external names larger than 8 bytes */
+#if defined(__MVS__)
+# pragma map(deflateInit_,"DEIN")
+# pragma map(deflateInit2_,"DEIN2")
+# pragma map(deflateEnd,"DEEND")
+# pragma map(inflateInit_,"ININ")
+# pragma map(inflateInit2_,"ININ2")
+# pragma map(inflateEnd,"INEND")
+# pragma map(inflateSync,"INSY")
+# pragma map(inflateSetDictionary,"INSEDI")
+# pragma map(inflate_blocks,"INBL")
+# pragma map(inflate_blocks_new,"INBLNE")
+# pragma map(inflate_blocks_free,"INBLFR")
+# pragma map(inflate_blocks_reset,"INBLRE")
+# pragma map(inflate_codes_free,"INCOFR")
+# pragma map(inflate_codes,"INCO")
+# pragma map(inflate_fast,"INFA")
+# pragma map(inflate_flush,"INFLU")
+# pragma map(inflate_mask,"INMA")
+# pragma map(inflate_set_dictionary,"INSEDI2")
+# pragma map(inflate_copyright,"INCOPY")
+# pragma map(inflate_trees_bits,"INTRBI")
+# pragma map(inflate_trees_dynamic,"INTRDY")
+# pragma map(inflate_trees_fixed,"INTRFI")
+# pragma map(inflate_trees_free,"INTRFR")
+#endif
+
+#endif /* _ZCONF_H */
diff --git a/win32/contrib/zlib/zlib.3 b/win32/contrib/zlib/zlib.3 new file mode 100644 index 000000000..0a7c40a89 --- /dev/null +++ b/win32/contrib/zlib/zlib.3 @@ -0,0 +1,107 @@ +.TH ZLIB 3 "9 July 1998"
+.SH NAME
+zlib \- compression/decompression library
+.SH SYNOPSIS
+[see
+.I zlib.h
+for full description]
+.SH DESCRIPTION
+The
+.I zlib
+library is a general purpose data compression library.
+The code is thread safe.
+It provides in-memory compression and decompression functions,
+including integrity checks of the uncompressed data.
+This version of the library supports only one compression method (deflation)
+but other algorithms will be added later and will have the same stream interface.
+.LP
+Compression can be done in a single step if the buffers are large enough
+(for example if an input file is mmap'ed),
+or can be done by repeated calls of the compression function.
+In the latter case,
+the application must provide more input and/or consume the output
+(providing more output space) before each call.
+.LP
+The library also supports reading and writing files in
+.I gzip
+(.gz) format
+with an interface similar to that of stdio.
+.LP
+The library does not install any signal handler. The decoder checks
+the consistency of the compressed data, so the library should never
+crash even in case of corrupted input.
+.LP
+All functions of the compression library are documented in the file
+.IR zlib.h.
+The distribution source includes examples of use of the library
+the files
+.I example.c
+and
+.IR minigzip.c .
+.LP
+A Java implementation of
+.IR zlib
+is available in the Java Development Kit 1.1
+.IP
+http://www.javasoft.com/products/JDK/1.1/docs/api/Package-java.util.zip.html
+.LP
+A Perl interface to
+.IR zlib ,
+written by Paul Marquess (pmarquess@bfsec.bt.co.uk)
+is available at CPAN (Comprehensive Perl Archive Network) sites,
+such as:
+.IP
+ftp://ftp.cis.ufl.edu/pub/perl/CPAN/modules/by-module/Compress/Compress-Zlib*
+.LP
+A Python interface to
+.IR zlib
+written by A.M. Kuchling <amk@magnet.com>
+is available from the Python Software Association sites, such as:
+.IP
+ftp://ftp.python.org/pub/python/contrib/Encoding/zlib*.tar.gz
+.SH "SEE ALSO"
+Questions about zlib should be sent to:
+.IP
+zlib@quest.jpl.nasa.gov
+or, if this fails, to the author addresses given below.
+The zlib home page is:
+.IP
+http://www.cdrom.com/pub/infozip/zlib/
+.LP
+The data format used by the zlib library is described by RFC
+(Request for Comments) 1950 to 1952 in the files:
+.IP
+ftp://ds.internic.net/rfc/rfc1950.txt (zlib format)
+.br
+rfc1951.txt (deflate format)
+.br
+rfc1952.txt (gzip format)
+.LP
+These documents are also available in other formats from:
+.IP
+ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html
+.SH AUTHORS
+Version 1.1.3
+Copyright (C) 1995-1998 Jean-loup Gailly (jloup@gzip.org)
+and Mark Adler (madler@alumni.caltech.edu).
+.LP
+This software is provided "as-is,"
+without any express or implied warranty.
+In no event will the authors be held liable for any damages
+arising from the use of this software.
+See the distribution directory with respect to requirements
+governing redistribution.
+The deflate format used by
+.I zlib
+was defined by Phil Katz.
+The deflate and
+.I zlib
+specifications were written by L. Peter Deutsch.
+Thanks to all the people who reported problems and suggested various
+improvements in
+.IR zlib ;
+who are too numerous to cite here.
+.LP
+UNIX manual page by R. P. C. Rodgers,
+U.S. National Library of Medicine (rodgers@nlm.nih.gov).
+.\" end of man page
diff --git a/win32/contrib/zlib/zlib.h b/win32/contrib/zlib/zlib.h new file mode 100644 index 000000000..34fe85f41 --- /dev/null +++ b/win32/contrib/zlib/zlib.h @@ -0,0 +1,893 @@ +/* zlib.h -- interface of the 'zlib' general purpose compression library
+ version 1.1.3, July 9th, 1998
+
+ Copyright (C) 1995-1998 Jean-loup Gailly and Mark Adler
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+ Jean-loup Gailly Mark Adler
+ jloup@gzip.org madler@alumni.caltech.edu
+
+
+ The data format used by the zlib library is described by RFCs (Request for
+ Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt
+ (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
+*/
+
+#ifndef _ZLIB_H
+#define _ZLIB_H
+
+#include "zconf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ZLIB_VERSION "1.1.3"
+
+/*
+ The 'zlib' compression library provides in-memory compression and
+ decompression functions, including integrity checks of the uncompressed
+ data. This version of the library supports only one compression method
+ (deflation) but other algorithms will be added later and will have the same
+ stream interface.
+
+ Compression can be done in a single step if the buffers are large
+ enough (for example if an input file is mmap'ed), or can be done by
+ repeated calls of the compression function. In the latter case, the
+ application must provide more input and/or consume the output
+ (providing more output space) before each call.
+
+ The library also supports reading and writing files in gzip (.gz) format
+ with an interface similar to that of stdio.
+
+ The library does not install any signal handler. The decoder checks
+ the consistency of the compressed data, so the library should never
+ crash even in case of corrupted input.
+*/
+
+typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
+typedef void (*free_func) OF((voidpf opaque, voidpf address));
+
+struct internal_state;
+
+typedef struct z_stream_s {
+ Bytef *next_in; /* next input byte */
+ uInt avail_in; /* number of bytes available at next_in */
+ uLong total_in; /* total nb of input bytes read so far */
+
+ Bytef *next_out; /* next output byte should be put there */
+ uInt avail_out; /* remaining free space at next_out */
+ uLong total_out; /* total nb of bytes output so far */
+
+ char *msg; /* last error message, NULL if no error */
+ struct internal_state FAR *state; /* not visible by applications */
+
+ alloc_func zalloc; /* used to allocate the internal state */
+ free_func zfree; /* used to free the internal state */
+ voidpf opaque; /* private data object passed to zalloc and zfree */
+
+ int data_type; /* best guess about the data type: ascii or binary */
+ uLong adler; /* adler32 value of the uncompressed data */
+ uLong reserved; /* reserved for future use */
+} z_stream;
+
+typedef z_stream FAR *z_streamp;
+
+/*
+ The application must update next_in and avail_in when avail_in has
+ dropped to zero. It must update next_out and avail_out when avail_out
+ has dropped to zero. The application must initialize zalloc, zfree and
+ opaque before calling the init function. All other fields are set by the
+ compression library and must not be updated by the application.
+
+ The opaque value provided by the application will be passed as the first
+ parameter for calls of zalloc and zfree. This can be useful for custom
+ memory management. The compression library attaches no meaning to the
+ opaque value.
+
+ zalloc must return Z_NULL if there is not enough memory for the object.
+ If zlib is used in a multi-threaded application, zalloc and zfree must be
+ thread safe.
+
+ On 16-bit systems, the functions zalloc and zfree must be able to allocate
+ exactly 65536 bytes, but will not be required to allocate more than this
+ if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,
+ pointers returned by zalloc for objects of exactly 65536 bytes *must*
+ have their offset normalized to zero. The default allocation function
+ provided by this library ensures this (see zutil.c). To reduce memory
+ requirements and avoid any allocation of 64K objects, at the expense of
+ compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).
+
+ The fields total_in and total_out can be used for statistics or
+ progress reports. After compression, total_in holds the total size of
+ the uncompressed data and may be saved for use in the decompressor
+ (particularly if the decompressor wants to decompress everything in
+ a single step).
+*/
+
+ /* constants */
+
+#define Z_NO_FLUSH 0
+#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */
+#define Z_SYNC_FLUSH 2
+#define Z_FULL_FLUSH 3
+#define Z_FINISH 4
+/* Allowed flush values; see deflate() below for details */
+
+#define Z_OK 0
+#define Z_STREAM_END 1
+#define Z_NEED_DICT 2
+#define Z_ERRNO (-1)
+#define Z_STREAM_ERROR (-2)
+#define Z_DATA_ERROR (-3)
+#define Z_MEM_ERROR (-4)
+#define Z_BUF_ERROR (-5)
+#define Z_VERSION_ERROR (-6)
+/* Return codes for the compression/decompression functions. Negative
+ * values are errors, positive values are used for special but normal events.
+ */
+
+#define Z_NO_COMPRESSION 0
+#define Z_BEST_SPEED 1
+#define Z_BEST_COMPRESSION 9
+#define Z_DEFAULT_COMPRESSION (-1)
+/* compression levels */
+
+#define Z_FILTERED 1
+#define Z_HUFFMAN_ONLY 2
+#define Z_DEFAULT_STRATEGY 0
+/* compression strategy; see deflateInit2() below for details */
+
+#define Z_BINARY 0
+#define Z_ASCII 1
+#define Z_UNKNOWN 2
+/* Possible values of the data_type field */
+
+#define Z_DEFLATED 8
+/* The deflate compression method (the only one supported in this version) */
+
+#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */
+
+#define zlib_version zlibVersion()
+/* for compatibility with versions < 1.0.2 */
+
+ /* basic functions */
+
+ZEXTERN const char * ZEXPORT zlibVersion OF((void));
+/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
+ If the first character differs, the library code actually used is
+ not compatible with the zlib.h header file used by the application.
+ This check is automatically made by deflateInit and inflateInit.
+ */
+
+/*
+ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
+
+ Initializes the internal stream state for compression. The fields
+ zalloc, zfree and opaque must be initialized before by the caller.
+ If zalloc and zfree are set to Z_NULL, deflateInit updates them to
+ use default allocation functions.
+
+ The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
+ 1 gives best speed, 9 gives best compression, 0 gives no compression at
+ all (the input data is simply copied a block at a time).
+ Z_DEFAULT_COMPRESSION requests a default compromise between speed and
+ compression (currently equivalent to level 6).
+
+ deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not
+ enough memory, Z_STREAM_ERROR if level is not a valid compression level,
+ Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
+ with the version assumed by the caller (ZLIB_VERSION).
+ msg is set to null if there is no error message. deflateInit does not
+ perform any compression: this will be done by deflate().
+*/
+
+
+ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
+/*
+ deflate compresses as much data as possible, and stops when the input
+ buffer becomes empty or the output buffer becomes full. It may introduce some
+ output latency (reading input without producing any output) except when
+ forced to flush.
+
+ The detailed semantics are as follows. deflate performs one or both of the
+ following actions:
+
+ - Compress more input starting at next_in and update next_in and avail_in
+ accordingly. If not all input can be processed (because there is not
+ enough room in the output buffer), next_in and avail_in are updated and
+ processing will resume at this point for the next call of deflate().
+
+ - Provide more output starting at next_out and update next_out and avail_out
+ accordingly. This action is forced if the parameter flush is non zero.
+ Forcing flush frequently degrades the compression ratio, so this parameter
+ should be set only when necessary (in interactive applications).
+ Some output may be provided even if flush is not set.
+
+ Before the call of deflate(), the application should ensure that at least
+ one of the actions is possible, by providing more input and/or consuming
+ more output, and updating avail_in or avail_out accordingly; avail_out
+ should never be zero before the call. The application can consume the
+ compressed output when it wants, for example when the output buffer is full
+ (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK
+ and with zero avail_out, it must be called again after making room in the
+ output buffer because there might be more output pending.
+
+ If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
+ flushed to the output buffer and the output is aligned on a byte boundary, so
+ that the decompressor can get all input data available so far. (In particular
+ avail_in is zero after the call if enough output space has been provided
+ before the call.) Flushing may degrade compression for some compression
+ algorithms and so it should be used only when necessary.
+
+ If flush is set to Z_FULL_FLUSH, all output is flushed as with
+ Z_SYNC_FLUSH, and the compression state is reset so that decompression can
+ restart from this point if previous compressed data has been damaged or if
+ random access is desired. Using Z_FULL_FLUSH too often can seriously degrade
+ the compression.
+
+ If deflate returns with avail_out == 0, this function must be called again
+ with the same value of the flush parameter and more output space (updated
+ avail_out), until the flush is complete (deflate returns with non-zero
+ avail_out).
+
+ If the parameter flush is set to Z_FINISH, pending input is processed,
+ pending output is flushed and deflate returns with Z_STREAM_END if there
+ was enough output space; if deflate returns with Z_OK, this function must be
+ called again with Z_FINISH and more output space (updated avail_out) but no
+ more input data, until it returns with Z_STREAM_END or an error. After
+ deflate has returned Z_STREAM_END, the only possible operations on the
+ stream are deflateReset or deflateEnd.
+
+ Z_FINISH can be used immediately after deflateInit if all the compression
+ is to be done in a single step. In this case, avail_out must be at least
+ 0.1% larger than avail_in plus 12 bytes. If deflate does not return
+ Z_STREAM_END, then it must be called again as described above.
+
+ deflate() sets strm->adler to the adler32 checksum of all input read
+ so far (that is, total_in bytes).
+
+ deflate() may update data_type if it can make a good guess about
+ the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered
+ binary. This field is only for information purposes and does not affect
+ the compression algorithm in any manner.
+
+ deflate() returns Z_OK if some progress has been made (more input
+ processed or more output produced), Z_STREAM_END if all input has been
+ consumed and all output has been produced (only when flush is set to
+ Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
+ if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible
+ (for example avail_in or avail_out was zero).
+*/
+
+
+ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
+/*
+ All dynamically allocated data structures for this stream are freed.
+ This function discards any unprocessed input and does not flush any
+ pending output.
+
+ deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
+ stream state was inconsistent, Z_DATA_ERROR if the stream was freed
+ prematurely (some input or output was discarded). In the error case,
+ msg may be set but then points to a static string (which must not be
+ deallocated).
+*/
+
+
+/*
+ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
+
+ Initializes the internal stream state for decompression. The fields
+ next_in, avail_in, zalloc, zfree and opaque must be initialized before by
+ the caller. If next_in is not Z_NULL and avail_in is large enough (the exact
+ value depends on the compression method), inflateInit determines the
+ compression method from the zlib header and allocates all data structures
+ accordingly; otherwise the allocation will be deferred to the first call of
+ inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to
+ use default allocation functions.
+
+ inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
+ memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
+ version assumed by the caller. msg is set to null if there is no error
+ message. inflateInit does not perform any decompression apart from reading
+ the zlib header if present: this will be done by inflate(). (So next_in and
+ avail_in may be modified, but next_out and avail_out are unchanged.)
+*/
+
+
+ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
+/*
+ inflate decompresses as much data as possible, and stops when the input
+ buffer becomes empty or the output buffer becomes full. It may some
+ introduce some output latency (reading input without producing any output)
+ except when forced to flush.
+
+ The detailed semantics are as follows. inflate performs one or both of the
+ following actions:
+
+ - Decompress more input starting at next_in and update next_in and avail_in
+ accordingly. If not all input can be processed (because there is not
+ enough room in the output buffer), next_in is updated and processing
+ will resume at this point for the next call of inflate().
+
+ - Provide more output starting at next_out and update next_out and avail_out
+ accordingly. inflate() provides as much output as possible, until there
+ is no more input data or no more space in the output buffer (see below
+ about the flush parameter).
+
+ Before the call of inflate(), the application should ensure that at least
+ one of the actions is possible, by providing more input and/or consuming
+ more output, and updating the next_* and avail_* values accordingly.
+ The application can consume the uncompressed output when it wants, for
+ example when the output buffer is full (avail_out == 0), or after each
+ call of inflate(). If inflate returns Z_OK and with zero avail_out, it
+ must be called again after making room in the output buffer because there
+ might be more output pending.
+
+ If the parameter flush is set to Z_SYNC_FLUSH, inflate flushes as much
+ output as possible to the output buffer. The flushing behavior of inflate is
+ not specified for values of the flush parameter other than Z_SYNC_FLUSH
+ and Z_FINISH, but the current implementation actually flushes as much output
+ as possible anyway.
+
+ inflate() should normally be called until it returns Z_STREAM_END or an
+ error. However if all decompression is to be performed in a single step
+ (a single call of inflate), the parameter flush should be set to
+ Z_FINISH. In this case all pending input is processed and all pending
+ output is flushed; avail_out must be large enough to hold all the
+ uncompressed data. (The size of the uncompressed data may have been saved
+ by the compressor for this purpose.) The next operation on this stream must
+ be inflateEnd to deallocate the decompression state. The use of Z_FINISH
+ is never required, but can be used to inform inflate that a faster routine
+ may be used for the single inflate() call.
+
+ If a preset dictionary is needed at this point (see inflateSetDictionary
+ below), inflate sets strm-adler to the adler32 checksum of the
+ dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise
+ it sets strm->adler to the adler32 checksum of all output produced
+ so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or
+ an error code as described below. At the end of the stream, inflate()
+ checks that its computed adler32 checksum is equal to that saved by the
+ compressor and returns Z_STREAM_END only if the checksum is correct.
+
+ inflate() returns Z_OK if some progress has been made (more input processed
+ or more output produced), Z_STREAM_END if the end of the compressed data has
+ been reached and all uncompressed output has been produced, Z_NEED_DICT if a
+ preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
+ corrupted (input stream not conforming to the zlib format or incorrect
+ adler32 checksum), Z_STREAM_ERROR if the stream structure was inconsistent
+ (for example if next_in or next_out was NULL), Z_MEM_ERROR if there was not
+ enough memory, Z_BUF_ERROR if no progress is possible or if there was not
+ enough room in the output buffer when Z_FINISH is used. In the Z_DATA_ERROR
+ case, the application may then call inflateSync to look for a good
+ compression block.
+*/
+
+
+ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
+/*
+ All dynamically allocated data structures for this stream are freed.
+ This function discards any unprocessed input and does not flush any
+ pending output.
+
+ inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
+ was inconsistent. In the error case, msg may be set but then points to a
+ static string (which must not be deallocated).
+*/
+
+ /* Advanced functions */
+
+/*
+ The following functions are needed only in some special applications.
+*/
+
+/*
+ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
+ int level,
+ int method,
+ int windowBits,
+ int memLevel,
+ int strategy));
+
+ This is another version of deflateInit with more compression options. The
+ fields next_in, zalloc, zfree and opaque must be initialized before by
+ the caller.
+
+ The method parameter is the compression method. It must be Z_DEFLATED in
+ this version of the library.
+
+ The windowBits parameter is the base two logarithm of the window size
+ (the size of the history buffer). It should be in the range 8..15 for this
+ version of the library. Larger values of this parameter result in better
+ compression at the expense of memory usage. The default value is 15 if
+ deflateInit is used instead.
+
+ The memLevel parameter specifies how much memory should be allocated
+ for the internal compression state. memLevel=1 uses minimum memory but
+ is slow and reduces compression ratio; memLevel=9 uses maximum memory
+ for optimal speed. The default value is 8. See zconf.h for total memory
+ usage as a function of windowBits and memLevel.
+
+ The strategy parameter is used to tune the compression algorithm. Use the
+ value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
+ filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no
+ string match). Filtered data consists mostly of small values with a
+ somewhat random distribution. In this case, the compression algorithm is
+ tuned to compress them better. The effect of Z_FILTERED is to force more
+ Huffman coding and less string matching; it is somewhat intermediate
+ between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects
+ the compression ratio but not the correctness of the compressed output even
+ if it is not set appropriately.
+
+ deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+ memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid
+ method). msg is set to null if there is no error message. deflateInit2 does
+ not perform any compression: this will be done by deflate().
+*/
+
+ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
+ const Bytef *dictionary,
+ uInt dictLength));
+/*
+ Initializes the compression dictionary from the given byte sequence
+ without producing any compressed output. This function must be called
+ immediately after deflateInit, deflateInit2 or deflateReset, before any
+ call of deflate. The compressor and decompressor must use exactly the same
+ dictionary (see inflateSetDictionary).
+
+ The dictionary should consist of strings (byte sequences) that are likely
+ to be encountered later in the data to be compressed, with the most commonly
+ used strings preferably put towards the end of the dictionary. Using a
+ dictionary is most useful when the data to be compressed is short and can be
+ predicted with good accuracy; the data can then be compressed better than
+ with the default empty dictionary.
+
+ Depending on the size of the compression data structures selected by
+ deflateInit or deflateInit2, a part of the dictionary may in effect be
+ discarded, for example if the dictionary is larger than the window size in
+ deflate or deflate2. Thus the strings most likely to be useful should be
+ put at the end of the dictionary, not at the front.
+
+ Upon return of this function, strm->adler is set to the Adler32 value
+ of the dictionary; the decompressor may later use this value to determine
+ which dictionary has been used by the compressor. (The Adler32 value
+ applies to the whole dictionary even if only a subset of the dictionary is
+ actually used by the compressor.)
+
+ deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
+ parameter is invalid (such as NULL dictionary) or the stream state is
+ inconsistent (for example if deflate has already been called for this stream
+ or if the compression method is bsort). deflateSetDictionary does not
+ perform any compression: this will be done by deflate().
+*/
+
+ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
+ z_streamp source));
+/*
+ Sets the destination stream as a complete copy of the source stream.
+
+ This function can be useful when several compression strategies will be
+ tried, for example when there are several ways of pre-processing the input
+ data with a filter. The streams that will be discarded should then be freed
+ by calling deflateEnd. Note that deflateCopy duplicates the internal
+ compression state which can be quite large, so this strategy is slow and
+ can consume lots of memory.
+
+ deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
+ enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
+ (such as zalloc being NULL). msg is left unchanged in both source and
+ destination.
+*/
+
+ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
+/*
+ This function is equivalent to deflateEnd followed by deflateInit,
+ but does not free and reallocate all the internal compression state.
+ The stream will keep the same compression level and any other attributes
+ that may have been set by deflateInit2.
+
+ deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
+ stream state was inconsistent (such as zalloc or state being NULL).
+*/
+
+ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
+ int level,
+ int strategy));
+/*
+ Dynamically update the compression level and compression strategy. The
+ interpretation of level and strategy is as in deflateInit2. This can be
+ used to switch between compression and straight copy of the input data, or
+ to switch to a different kind of input data requiring a different
+ strategy. If the compression level is changed, the input available so far
+ is compressed with the old level (and may be flushed); the new level will
+ take effect only at the next call of deflate().
+
+ Before the call of deflateParams, the stream state must be set as for
+ a call of deflate(), since the currently available input may have to
+ be compressed and flushed. In particular, strm->avail_out must be non-zero.
+
+ deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
+ stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR
+ if strm->avail_out was zero.
+*/
+
+/*
+ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
+ int windowBits));
+
+ This is another version of inflateInit with an extra parameter. The
+ fields next_in, avail_in, zalloc, zfree and opaque must be initialized
+ before by the caller.
+
+ The windowBits parameter is the base two logarithm of the maximum window
+ size (the size of the history buffer). It should be in the range 8..15 for
+ this version of the library. The default value is 15 if inflateInit is used
+ instead. If a compressed stream with a larger window size is given as
+ input, inflate() will return with the error code Z_DATA_ERROR instead of
+ trying to allocate a larger window.
+
+ inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+ memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative
+ memLevel). msg is set to null if there is no error message. inflateInit2
+ does not perform any decompression apart from reading the zlib header if
+ present: this will be done by inflate(). (So next_in and avail_in may be
+ modified, but next_out and avail_out are unchanged.)
+*/
+
+ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
+ const Bytef *dictionary,
+ uInt dictLength));
+/*
+ Initializes the decompression dictionary from the given uncompressed byte
+ sequence. This function must be called immediately after a call of inflate
+ if this call returned Z_NEED_DICT. The dictionary chosen by the compressor
+ can be determined from the Adler32 value returned by this call of
+ inflate. The compressor and decompressor must use exactly the same
+ dictionary (see deflateSetDictionary).
+
+ inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
+ parameter is invalid (such as NULL dictionary) or the stream state is
+ inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
+ expected one (incorrect Adler32 value). inflateSetDictionary does not
+ perform any decompression: this will be done by subsequent calls of
+ inflate().
+*/
+
+ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
+/*
+ Skips invalid compressed data until a full flush point (see above the
+ description of deflate with Z_FULL_FLUSH) can be found, or until all
+ available input is skipped. No output is provided.
+
+ inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
+ if no more input was provided, Z_DATA_ERROR if no flush point has been found,
+ or Z_STREAM_ERROR if the stream structure was inconsistent. In the success
+ case, the application may save the current current value of total_in which
+ indicates where valid compressed data was found. In the error case, the
+ application may repeatedly call inflateSync, providing more input each time,
+ until success or end of the input data.
+*/
+
+ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
+/*
+ This function is equivalent to inflateEnd followed by inflateInit,
+ but does not free and reallocate all the internal decompression state.
+ The stream will keep attributes that may have been set by inflateInit2.
+
+ inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
+ stream state was inconsistent (such as zalloc or state being NULL).
+*/
+
+
+ /* utility functions */
+
+/*
+ The following utility functions are implemented on top of the
+ basic stream-oriented functions. To simplify the interface, some
+ default options are assumed (compression level and memory usage,
+ standard memory allocation functions). The source code of these
+ utility functions can easily be modified if you need special options.
+*/
+
+ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
+ const Bytef *source, uLong sourceLen));
+/*
+ Compresses the source buffer into the destination buffer. sourceLen is
+ the byte length of the source buffer. Upon entry, destLen is the total
+ size of the destination buffer, which must be at least 0.1% larger than
+ sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the
+ compressed buffer.
+ This function can be used to compress a whole file at once if the
+ input file is mmap'ed.
+ compress returns Z_OK if success, Z_MEM_ERROR if there was not
+ enough memory, Z_BUF_ERROR if there was not enough room in the output
+ buffer.
+*/
+
+ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
+ const Bytef *source, uLong sourceLen,
+ int level));
+/*
+ Compresses the source buffer into the destination buffer. The level
+ parameter has the same meaning as in deflateInit. sourceLen is the byte
+ length of the source buffer. Upon entry, destLen is the total size of the
+ destination buffer, which must be at least 0.1% larger than sourceLen plus
+ 12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
+
+ compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+ memory, Z_BUF_ERROR if there was not enough room in the output buffer,
+ Z_STREAM_ERROR if the level parameter is invalid.
+*/
+
+ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
+ const Bytef *source, uLong sourceLen));
+/*
+ Decompresses the source buffer into the destination buffer. sourceLen is
+ the byte length of the source buffer. Upon entry, destLen is the total
+ size of the destination buffer, which must be large enough to hold the
+ entire uncompressed data. (The size of the uncompressed data must have
+ been saved previously by the compressor and transmitted to the decompressor
+ by some mechanism outside the scope of this compression library.)
+ Upon exit, destLen is the actual size of the compressed buffer.
+ This function can be used to decompress a whole file at once if the
+ input file is mmap'ed.
+
+ uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
+ enough memory, Z_BUF_ERROR if there was not enough room in the output
+ buffer, or Z_DATA_ERROR if the input data was corrupted.
+*/
+
+
+typedef voidp gzFile;
+
+ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
+/*
+ Opens a gzip (.gz) file for reading or writing. The mode parameter
+ is as in fopen ("rb" or "wb") but can also include a compression level
+ ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for
+ Huffman only compression as in "wb1h". (See the description
+ of deflateInit2 for more information about the strategy parameter.)
+
+ gzopen can be used to read a file which is not in gzip format; in this
+ case gzread will directly read from the file without decompression.
+
+ gzopen returns NULL if the file could not be opened or if there was
+ insufficient memory to allocate the (de)compression state; errno
+ can be checked to distinguish the two cases (if errno is zero, the
+ zlib error is Z_MEM_ERROR). */
+
+ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
+/*
+ gzdopen() associates a gzFile with the file descriptor fd. File
+ descriptors are obtained from calls like open, dup, creat, pipe or
+ fileno (in the file has been previously opened with fopen).
+ The mode parameter is as in gzopen.
+ The next call of gzclose on the returned gzFile will also close the
+ file descriptor fd, just like fclose(fdopen(fd), mode) closes the file
+ descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode).
+ gzdopen returns NULL if there was insufficient memory to allocate
+ the (de)compression state.
+*/
+
+ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
+/*
+ Dynamically update the compression level or strategy. See the description
+ of deflateInit2 for the meaning of these parameters.
+ gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
+ opened for writing.
+*/
+
+ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
+/*
+ Reads the given number of uncompressed bytes from the compressed file.
+ If the input file was not in gzip format, gzread copies the given number
+ of bytes into the buffer.
+ gzread returns the number of uncompressed bytes actually read (0 for
+ end of file, -1 for error). */
+
+ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
+ const voidp buf, unsigned len));
+/*
+ Writes the given number of uncompressed bytes into the compressed file.
+ gzwrite returns the number of uncompressed bytes actually written
+ (0 in case of error).
+*/
+
+ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...));
+/*
+ Converts, formats, and writes the args to the compressed file under
+ control of the format string, as in fprintf. gzprintf returns the number of
+ uncompressed bytes actually written (0 in case of error).
+*/
+
+ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
+/*
+ Writes the given null-terminated string to the compressed file, excluding
+ the terminating null character.
+ gzputs returns the number of characters written, or -1 in case of error.
+*/
+
+ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
+/*
+ Reads bytes from the compressed file until len-1 characters are read, or
+ a newline character is read and transferred to buf, or an end-of-file
+ condition is encountered. The string is then terminated with a null
+ character.
+ gzgets returns buf, or Z_NULL in case of error.
+*/
+
+ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
+/*
+ Writes c, converted to an unsigned char, into the compressed file.
+ gzputc returns the value that was written, or -1 in case of error.
+*/
+
+ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
+/*
+ Reads one byte from the compressed file. gzgetc returns this byte
+ or -1 in case of end of file or error.
+*/
+
+ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
+/*
+ Flushes all pending output into the compressed file. The parameter
+ flush is as in the deflate() function. The return value is the zlib
+ error number (see function gzerror below). gzflush returns Z_OK if
+ the flush parameter is Z_FINISH and all output could be flushed.
+ gzflush should be called only when strictly necessary because it can
+ degrade compression.
+*/
+
+ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
+ z_off_t offset, int whence));
+/*
+ Sets the starting position for the next gzread or gzwrite on the
+ given compressed file. The offset represents a number of bytes in the
+ uncompressed data stream. The whence parameter is defined as in lseek(2);
+ the value SEEK_END is not supported.
+ If the file is opened for reading, this function is emulated but can be
+ extremely slow. If the file is opened for writing, only forward seeks are
+ supported; gzseek then compresses a sequence of zeroes up to the new
+ starting position.
+
+ gzseek returns the resulting offset location as measured in bytes from
+ the beginning of the uncompressed stream, or -1 in case of error, in
+ particular if the file is opened for writing and the new starting position
+ would be before the current position.
+*/
+
+ZEXTERN int ZEXPORT gzrewind OF((gzFile file));
+/*
+ Rewinds the given file. This function is supported only for reading.
+
+ gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
+*/
+
+ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
+/*
+ Returns the starting position for the next gzread or gzwrite on the
+ given compressed file. This position represents a number of bytes in the
+ uncompressed data stream.
+
+ gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
+*/
+
+ZEXTERN int ZEXPORT gzeof OF((gzFile file));
+/*
+ Returns 1 when EOF has previously been detected reading the given
+ input stream, otherwise zero.
+*/
+
+ZEXTERN int ZEXPORT gzclose OF((gzFile file));
+/*
+ Flushes all pending output if necessary, closes the compressed file
+ and deallocates all the (de)compression state. The return value is the zlib
+ error number (see function gzerror below).
+*/
+
+ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
+/*
+ Returns the error message for the last error which occurred on the
+ given compressed file. errnum is set to zlib error number. If an
+ error occurred in the file system and not in the compression library,
+ errnum is set to Z_ERRNO and the application may consult errno
+ to get the exact error code.
+*/
+
+ /* checksum functions */
+
+/*
+ These functions are not related to compression but are exported
+ anyway because they might be useful in applications using the
+ compression library.
+*/
+
+ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
+
+/*
+ Update a running Adler-32 checksum with the bytes buf[0..len-1] and
+ return the updated checksum. If buf is NULL, this function returns
+ the required initial value for the checksum.
+ An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
+ much faster. Usage example:
+
+ uLong adler = adler32(0L, Z_NULL, 0);
+
+ while (read_buffer(buffer, length) != EOF) {
+ adler = adler32(adler, buffer, length);
+ }
+ if (adler != original_adler) error();
+*/
+
+ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
+/*
+ Update a running crc with the bytes buf[0..len-1] and return the updated
+ crc. If buf is NULL, this function returns the required initial value
+ for the crc. Pre- and post-conditioning (one's complement) is performed
+ within this function so it shouldn't be done by the application.
+ Usage example:
+
+ uLong crc = crc32(0L, Z_NULL, 0);
+
+ while (read_buffer(buffer, length) != EOF) {
+ crc = crc32(crc, buffer, length);
+ }
+ if (crc != original_crc) error();
+*/
+
+
+ /* various hacks, don't look :) */
+
+/* deflateInit and inflateInit are macros to allow checking the zlib version
+ * and the compiler's view of z_stream:
+ */
+ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
+ const char *version, int stream_size));
+ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
+ const char *version, int stream_size));
+ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method,
+ int windowBits, int memLevel,
+ int strategy, const char *version,
+ int stream_size));
+ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
+ const char *version, int stream_size));
+#define deflateInit(strm, level) \
+ deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream))
+#define inflateInit(strm) \
+ inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream))
+#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
+ deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
+ (strategy), ZLIB_VERSION, sizeof(z_stream))
+#define inflateInit2(strm, windowBits) \
+ inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
+
+
+#if !defined(_Z_UTIL_H) && !defined(NO_DUMMY_DECL)
+ struct internal_state {int dummy;}; /* hack for buggy compilers */
+#endif
+
+ZEXTERN const char * ZEXPORT zError OF((int err));
+ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z));
+ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ZLIB_H */
diff --git a/win32/contrib/zlib/zutil.c b/win32/contrib/zlib/zutil.c new file mode 100644 index 000000000..4ca1d4d3e --- /dev/null +++ b/win32/contrib/zlib/zutil.c @@ -0,0 +1,225 @@ +/* zutil.c -- target dependent utility functions for the compression library
+ * Copyright (C) 1995-1998 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* @(#) $Id: zutil.c,v 1.1 2003/04/20 16:42:09 guenter Exp $ */
+
+#include "zutil.h"
+
+struct internal_state {int dummy;}; /* for buggy compilers */
+
+#ifndef STDC
+extern void exit OF((int));
+#endif
+
+const char *z_errmsg[10] = {
+"need dictionary", /* Z_NEED_DICT 2 */
+"stream end", /* Z_STREAM_END 1 */
+"", /* Z_OK 0 */
+"file error", /* Z_ERRNO (-1) */
+"stream error", /* Z_STREAM_ERROR (-2) */
+"data error", /* Z_DATA_ERROR (-3) */
+"insufficient memory", /* Z_MEM_ERROR (-4) */
+"buffer error", /* Z_BUF_ERROR (-5) */
+"incompatible version",/* Z_VERSION_ERROR (-6) */
+""};
+
+
+const char * ZEXPORT zlibVersion()
+{
+ return ZLIB_VERSION;
+}
+
+#ifdef DEBUG
+
+# ifndef verbose
+# define verbose 0
+# endif
+int z_verbose = verbose;
+
+void z_error (m)
+ char *m;
+{
+ fprintf(stderr, "%s\n", m);
+ exit(1);
+}
+#endif
+
+/* exported to allow conversion of error code to string for compress() and
+ * uncompress()
+ */
+const char * ZEXPORT zError(err)
+ int err;
+{
+ return ERR_MSG(err);
+}
+
+
+#ifndef HAVE_MEMCPY
+
+void zmemcpy(dest, source, len)
+ Bytef* dest;
+ const Bytef* source;
+ uInt len;
+{
+ if (len == 0) return;
+ do {
+ *dest++ = *source++; /* ??? to be unrolled */
+ } while (--len != 0);
+}
+
+int zmemcmp(s1, s2, len)
+ const Bytef* s1;
+ const Bytef* s2;
+ uInt len;
+{
+ uInt j;
+
+ for (j = 0; j < len; j++) {
+ if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
+ }
+ return 0;
+}
+
+void zmemzero(dest, len)
+ Bytef* dest;
+ uInt len;
+{
+ if (len == 0) return;
+ do {
+ *dest++ = 0; /* ??? to be unrolled */
+ } while (--len != 0);
+}
+#endif
+
+#ifdef __TURBOC__
+#if (defined( __BORLANDC__) || !defined(SMALL_MEDIUM)) && !defined(__32BIT__)
+/* Small and medium model in Turbo C are for now limited to near allocation
+ * with reduced MAX_WBITS and MAX_MEM_LEVEL
+ */
+# define MY_ZCALLOC
+
+/* Turbo C malloc() does not allow dynamic allocation of 64K bytes
+ * and farmalloc(64K) returns a pointer with an offset of 8, so we
+ * must fix the pointer. Warning: the pointer must be put back to its
+ * original form in order to free it, use zcfree().
+ */
+
+#define MAX_PTR 10
+/* 10*64K = 640K */
+
+local int next_ptr = 0;
+
+typedef struct ptr_table_s {
+ voidpf org_ptr;
+ voidpf new_ptr;
+} ptr_table;
+
+local ptr_table table[MAX_PTR];
+/* This table is used to remember the original form of pointers
+ * to large buffers (64K). Such pointers are normalized with a zero offset.
+ * Since MSDOS is not a preemptive multitasking OS, this table is not
+ * protected from concurrent access. This hack doesn't work anyway on
+ * a protected system like OS/2. Use Microsoft C instead.
+ */
+
+voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
+{
+ voidpf buf = opaque; /* just to make some compilers happy */
+ ulg bsize = (ulg)items*size;
+
+ /* If we allocate less than 65520 bytes, we assume that farmalloc
+ * will return a usable pointer which doesn't have to be normalized.
+ */
+ if (bsize < 65520L) {
+ buf = farmalloc(bsize);
+ if (*(ush*)&buf != 0) return buf;
+ } else {
+ buf = farmalloc(bsize + 16L);
+ }
+ if (buf == NULL || next_ptr >= MAX_PTR) return NULL;
+ table[next_ptr].org_ptr = buf;
+
+ /* Normalize the pointer to seg:0 */
+ *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4;
+ *(ush*)&buf = 0;
+ table[next_ptr++].new_ptr = buf;
+ return buf;
+}
+
+void zcfree (voidpf opaque, voidpf ptr)
+{
+ int n;
+ if (*(ush*)&ptr != 0) { /* object < 64K */
+ farfree(ptr);
+ return;
+ }
+ /* Find the original pointer */
+ for (n = 0; n < next_ptr; n++) {
+ if (ptr != table[n].new_ptr) continue;
+
+ farfree(table[n].org_ptr);
+ while (++n < next_ptr) {
+ table[n-1] = table[n];
+ }
+ next_ptr--;
+ return;
+ }
+ ptr = opaque; /* just to make some compilers happy */
+ Assert(0, "zcfree: ptr not found");
+}
+#endif
+#endif /* __TURBOC__ */
+
+
+#if defined(M_I86) && !defined(__32BIT__)
+/* Microsoft C in 16-bit mode */
+
+# define MY_ZCALLOC
+
+#if (!defined(_MSC_VER) || (_MSC_VER <= 600))
+# define _halloc halloc
+# define _hfree hfree
+#endif
+
+voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
+{
+ if (opaque) opaque = 0; /* to make compiler happy */
+ return _halloc((long)items, size);
+}
+
+void zcfree (voidpf opaque, voidpf ptr)
+{
+ if (opaque) opaque = 0; /* to make compiler happy */
+ _hfree(ptr);
+}
+
+#endif /* MSC */
+
+
+#ifndef MY_ZCALLOC /* Any system without a special alloc function */
+
+#ifndef STDC
+extern voidp calloc OF((uInt items, uInt size));
+extern void free OF((voidpf ptr));
+#endif
+
+voidpf zcalloc (opaque, items, size)
+ voidpf opaque;
+ unsigned items;
+ unsigned size;
+{
+ if (opaque) items += size - size; /* make compiler happy */
+ return (voidpf)calloc(items, size);
+}
+
+void zcfree (opaque, ptr)
+ voidpf opaque;
+ voidpf ptr;
+{
+ free(ptr);
+ if (opaque) return; /* make compiler happy */
+}
+
+#endif /* MY_ZCALLOC */
diff --git a/win32/contrib/zlib/zutil.h b/win32/contrib/zlib/zutil.h new file mode 100644 index 000000000..6dbc7356e --- /dev/null +++ b/win32/contrib/zlib/zutil.h @@ -0,0 +1,220 @@ +/* zutil.h -- internal interface and configuration of the compression library
+ * Copyright (C) 1995-1998 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+ part of the implementation of the compression library and is
+ subject to change. Applications should only use zlib.h.
+ */
+
+/* @(#) $Id: zutil.h,v 1.1 2003/04/20 16:42:09 guenter Exp $ */
+
+#ifndef _Z_UTIL_H
+#define _Z_UTIL_H
+
+#include "zlib.h"
+
+#ifdef STDC
+# include <stddef.h>
+# include <string.h>
+# include <stdlib.h>
+#endif
+#ifdef NO_ERRNO_H
+ extern int errno;
+#else
+# include <errno.h>
+#endif
+
+#ifndef local
+# define local static
+#endif
+/* compile with -Dlocal if your debugger can't find static symbols */
+
+typedef unsigned char uch;
+typedef uch FAR uchf;
+typedef unsigned short ush;
+typedef ush FAR ushf;
+typedef unsigned long ulg;
+
+extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */
+/* (size given to avoid silly warnings with Visual C++) */
+
+#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
+
+#define ERR_RETURN(strm,err) \
+ return (strm->msg = (char*)ERR_MSG(err), (err))
+/* To be used only when the state is known to be valid */
+
+ /* common constants */
+
+#ifndef DEF_WBITS
+# define DEF_WBITS MAX_WBITS
+#endif
+/* default windowBits for decompression. MAX_WBITS is for compression only */
+
+#if MAX_MEM_LEVEL >= 8
+# define DEF_MEM_LEVEL 8
+#else
+# define DEF_MEM_LEVEL MAX_MEM_LEVEL
+#endif
+/* default memLevel */
+
+#define STORED_BLOCK 0
+#define STATIC_TREES 1
+#define DYN_TREES 2
+/* The three kinds of block type */
+
+#define MIN_MATCH 3
+#define MAX_MATCH 258
+/* The minimum and maximum match lengths */
+
+#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
+
+ /* target dependencies */
+
+#ifdef MSDOS
+# define OS_CODE 0x00
+# if defined(__TURBOC__) || defined(__BORLANDC__)
+# if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
+ /* Allow compilation with ANSI keywords only enabled */
+ void _Cdecl farfree( void *block );
+ void *_Cdecl farmalloc( unsigned long nbytes );
+# else
+# include <alloc.h>
+# endif
+# else /* MSC or DJGPP */
+# include <malloc.h>
+# endif
+#endif
+
+#ifdef OS2
+# define OS_CODE 0x06
+#endif
+
+#ifdef WIN32 /* Window 95 & Windows NT */
+# define OS_CODE 0x0b
+#endif
+
+#if defined(VAXC) || defined(VMS)
+# define OS_CODE 0x02
+# define F_OPEN(name, mode) \
+ fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
+#endif
+
+#ifdef AMIGA
+# define OS_CODE 0x01
+#endif
+
+#if defined(ATARI) || defined(atarist)
+# define OS_CODE 0x05
+#endif
+
+#if defined(MACOS) || defined(TARGET_OS_MAC)
+# define OS_CODE 0x07
+# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
+# include <unix.h> /* for fdopen */
+# else
+# ifndef fdopen
+# define fdopen(fd,mode) NULL /* No fdopen() */
+# endif
+# endif
+#endif
+
+#ifdef __50SERIES /* Prime/PRIMOS */
+# define OS_CODE 0x0F
+#endif
+
+#ifdef TOPS20
+# define OS_CODE 0x0a
+#endif
+
+#if defined(_BEOS_) || defined(RISCOS)
+# define fdopen(fd,mode) NULL /* No fdopen() */
+#endif
+
+#if (defined(_MSC_VER) && (_MSC_VER > 600))
+# define fdopen(fd,type) _fdopen(fd,type)
+#endif
+
+
+ /* Common defaults */
+
+#ifndef OS_CODE
+# define OS_CODE 0x03 /* assume Unix */
+#endif
+
+#ifndef F_OPEN
+# define F_OPEN(name, mode) fopen((name), (mode))
+#endif
+
+ /* functions */
+
+#ifdef HAVE_STRERROR
+ extern char *strerror OF((int));
+# define zstrerror(errnum) strerror(errnum)
+#else
+# define zstrerror(errnum) ""
+#endif
+
+#if defined(pyr)
+# define NO_MEMCPY
+#endif
+#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
+ /* Use our own functions for small and medium model with MSC <= 5.0.
+ * You may have to use the same strategy for Borland C (untested).
+ * The __SC__ check is for Symantec.
+ */
+# define NO_MEMCPY
+#endif
+#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
+# define HAVE_MEMCPY
+#endif
+#ifdef HAVE_MEMCPY
+# ifdef SMALL_MEDIUM /* MSDOS small or medium model */
+# define zmemcpy _fmemcpy
+# define zmemcmp _fmemcmp
+# define zmemzero(dest, len) _fmemset(dest, 0, len)
+# else
+# define zmemcpy memcpy
+# define zmemcmp memcmp
+# define zmemzero(dest, len) memset(dest, 0, len)
+# endif
+#else
+ extern void zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
+ extern int zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
+ extern void zmemzero OF((Bytef* dest, uInt len));
+#endif
+
+/* Diagnostic functions */
+#ifdef DEBUG
+# include <stdio.h>
+ extern int z_verbose;
+ extern void z_error OF((char *m));
+# define Assert(cond,msg) {if(!(cond)) z_error(msg);}
+# define Trace(x) {if (z_verbose>=0) fprintf x ;}
+# define Tracev(x) {if (z_verbose>0) fprintf x ;}
+# define Tracevv(x) {if (z_verbose>1) fprintf x ;}
+# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
+# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
+#else
+# define Assert(cond,msg)
+# define Trace(x)
+# define Tracev(x)
+# define Tracevv(x)
+# define Tracec(c,x)
+# define Tracecv(c,x)
+#endif
+
+
+typedef uLong (ZEXPORT *check_func) OF((uLong check, const Bytef *buf,
+ uInt len));
+voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
+void zcfree OF((voidpf opaque, voidpf ptr));
+
+#define ZALLOC(strm, items, size) \
+ (*((strm)->zalloc))((strm)->opaque, (items), (size))
+#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
+#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
+
+#endif /* _Z_UTIL_H */
diff --git a/win32/include/common.h b/win32/include/common.h new file mode 100644 index 000000000..bc9406c69 --- /dev/null +++ b/win32/include/common.h @@ -0,0 +1,244 @@ +/*
+ * Copyright (C) 2000-2003 the xine project
+ *
+ * This file is part of xine, a unix video player.
+ *
+ * xine 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * xine 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * $Id: common.h,v 1.1 2003/04/20 16:42:09 guenter Exp $
+ *
+ */
+
+#ifndef __COMMON_H__
+#define __COMMON_H__
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <xine.h>
+#include <xineutils.h>
+
+#if (0)
+#include "Imlib-light/Imlib.h"
+
+#include "xitk.h"
+
+#include "kbindings.h"
+#include "videowin.h"
+#include "mediamark.h"
+#include "actions.h"
+#include "config_wrapper.h"
+#include "control.h"
+#include "errors.h"
+#include "event.h"
+#include "event_sender.h"
+#include "i18n.h"
+#include "lang.h"
+#include "lirc.h"
+#include "mrl_browser.h"
+#include "network.h"
+#include "panel.h"
+#include "playlist.h"
+#include "session.h"
+#include "setup.h"
+#include "skins.h"
+#include "snapshot.h"
+#include "stream_infos.h"
+#include "viewlog.h"
+#include "download.h"
+#include "osd.h"
+#include "file_browser.h"
+#include "post.h"
+
+#include "utils.h"
+#endif
+
+#ifdef HAVE_ORBIT
+#include "../corba/xine-server.h"
+#endif
+
+#ifdef HAVE_LIRC
+#include <lirc/lirc_client.h>
+#endif
+
+/*
+ * config related constants
+ */
+#define CONFIG_LEVEL_BEG 0 /* => beginner */
+#define CONFIG_LEVEL_ADV 10 /* advanced user */
+#define CONFIG_LEVEL_EXP 20 /* expert */
+#define CONFIG_LEVEL_MAS 30 /* motku */
+#define CONFIG_LEVEL_DEB 40 /* debugger (only available in debug mode) */
+
+#define CONFIG_NO_DESC NULL
+#define CONFIG_NO_HELP NULL
+#define CONFIG_NO_CB NULL
+#define CONFIG_NO_DATA NULL
+
+/*
+ * flags for autoplay options
+ */
+#define PLAY_ON_START 0x00000001
+#define PLAYED_ON_START 0x00000002
+#define QUIT_ON_STOP 0x00000004
+#define FULL_ON_START 0x00000008
+#define HIDEGUI_ON_START 0x00000010
+#define PLAY_FROM_DVD 0x00000020
+#define PLAY_FROM_VCD 0x00000040
+
+/* Sound mixer capabilities */
+#define MIXER_CAP_NOTHING 0x00000000
+#define MIXER_CAP_VOL 0x00000001
+#define MIXER_CAP_MUTE 0x00000002
+
+/* Playlist loop modes */
+#define PLAYLIST_LOOP_NO_LOOP 0 /* no loop (default) */
+#define PLAYLIST_LOOP_LOOP 1 /* loop the whole playlist */
+#define PLAYLIST_LOOP_REPEAT 2 /* loop the current mrl */
+#define PLAYLIST_LOOP_SHUFFLE 3 /* random selection in playlist */
+#define PLAYLIST_LOOP_SHUF_PLUS 4 /* random selection in playlist, never ending */
+#define PLAYLIST_LOOP_MODES_NUM 5
+
+#define SAFE_FREE(x) do { \
+ if((x)) { \
+ free((x)); \
+ x = NULL; \
+ } \
+ } while(0)
+
+/* Our default location for skin downloads */
+#define SKIN_SERVER_URL "http://xine.sourceforge.net/skins/skins.slx"
+
+typedef struct {
+ xine_video_port_t *vo_port;
+ int post_video_num;
+ xine_post_t *post_video;
+
+ struct {
+ int hue;
+ int brightness;
+ int saturation;
+ int contrast;
+ } video_settings;
+
+ xine_audio_port_t *ao_port;
+
+ xine_stream_t *stream;
+ xine_stream_t *spu_stream;
+
+ xine_t *xine;
+
+ xine_event_queue_t *event_queue;
+
+ int smart_mode;
+
+ /* Visual stuff (like animation in video window while audio only playback) */
+ struct {
+ xine_stream_t *stream;
+ xine_event_queue_t *event_queue;
+ int running;
+ int current;
+ int enabled; /* 0, 1:vpost, 2:vanim */
+
+ char **mrls;
+ int num_mrls;
+
+ int post_plugin_num;
+ xine_post_t *post_output;
+ int post_changed;
+
+ } visual_anim;
+
+ struct {
+ int enabled;
+ int timeout;
+
+ xine_osd_t *sinfo;
+ int sinfo_visible;
+
+ xine_osd_t *bar[2];
+ int bar_visible;
+
+ xine_osd_t *status;
+ int status_visible;
+
+ xine_osd_t *info;
+ int info_visible;
+
+ } osd;
+
+ /* xine lib/gui configuration filename */
+ char *configfile;
+ int experience_level;
+
+ const char *logo_mrl;
+ int logo_mode;
+ int logo_has_changed;
+
+ /* stuff like FULL_ON_START, QUIT_ON_STOP */
+ /*action_id_t actions_on_start[16];*/
+ char *autoscan_plugin;
+
+
+ uint32_t debug_level;
+
+ int is_display_mrl;
+
+ int mrl_overrided;
+
+ int running;
+ int ignore_next;
+
+#ifdef HAVE_LIRC
+ int lirc_enable;
+#endif
+
+#ifdef HAVE_XF86VIDMODE
+ int XF86VidMode_fullscreen;
+#endif
+
+ struct {
+ int caps; /* MIXER_CAP_x */
+ int volume_level;
+ int mute;
+ } mixer;
+
+ int layer_above;
+ int always_layer_above;
+
+ int network;
+
+ int use_root_window;
+
+ const char *snapshot_location;
+
+ int ssaver_timeout;
+
+ int skip_by_chapter;
+
+ int auto_vo_visibility;
+ int auto_panel_visibility;
+
+ int eventer_sticky;
+ int stream_info_auto_update;
+
+ int play_anyway;
+
+ pthread_mutex_t download_mutex;
+
+} gGui_t;
+
+#endif
diff --git a/win32/include/config.h b/win32/include/config.h new file mode 100644 index 000000000..0c4654f4f --- /dev/null +++ b/win32/include/config.h @@ -0,0 +1,496 @@ +/* config.h. Generated by configure. */
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+
+#ifndef _CONFIG_H_
+#define _CONFIG_H_
+
+#if defined(WIN32)
+#include <windows.h>
+#include <stdio.h>
+#include <string.h>
+#endif
+
+/* Define this if you're running PowerPC architecture */
+/* #undef ARCH_PPC */
+
+/* Define this if you're running x86 architecture */
+/*define ARCH_X86*/
+
+/* maximum supported data alignment */
+#define ATTRIBUTE_ALIGNED_MAX 64
+
+/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
+ systems. This function is required for `alloca.c' support on those systems.
+ */
+/* #undef CRAY_STACKSEG_END */
+
+/* Define to 1 if using `alloca.c'. */
+/* #undef C_ALLOCA */
+
+/* Define this if you have a Motorola 74xx CPU */
+/* #undef ENABLE_ALTIVEC */
+
+/* Define to 1 if translation of program messages to the user's native
+ language is requested. */
+#undef ENABLE_NLS
+
+/* Define this if you have Sun UltraSPARC CPU */
+/* #undef ENABLE_VIS */
+
+/* Define to select libmad fixed pointarithmetic implementation */
+/* #undef FPM_64BIT */
+
+/* Define to select libmad fixed point arithmetic implementation */
+/* #undef FPM_ARM */
+
+/* Define to select libmad fixed point arithmetic implementation */
+/* #undef FPM_DEFAULT */
+
+/* Define to select libmad fixed point arithmetic implementation */
+#define FPM_INTEL 1
+
+/* Define to select libmad fixed point arithmetic implementation */
+/* #undef FPM_MIPS */
+
+/* Define to select libmad fixed point arithmetic implementation */
+/* #undef FPM_PPC */
+
+/* Define to select libmad fixed point arithmetic implementation */
+/* #undef FPM_SPARC */
+
+/* Define to 1 if you have `alloca', as a function or macro. */
+#define HAVE_ALLOCA 1
+
+/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
+ */
+#define HAVE_ALLOCA_H 1
+
+/* Define this if you have Alsa (libasound) installed */
+/* #undef HAVE_ALSA */
+
+/* Define this if you have alsa 0.9.x and more installed */
+/* #undef HAVE_ALSA09 */
+
+/* Define this if your asoundlib.h is installed in alsa/ */
+/* #undef HAVE_ALSA_ASOUNDLIB_H */
+
+/* Define to 1 if you have the <argz.h> header file. */
+/* #undef HAVE_ARGZ_H */
+
+/* Define this if you have ARTS (libartsc) installed */
+/* #undef HAVE_ARTS */
+
+/* Define to 1 if you have the <byteswap.h> header file. */
+/* #undef HAVE_BYTESWAP_H */
+
+/* Define this if you have CDROM ioctls */
+/* #undef HAVE_CDROM_IOCTLS */
+
+/* Define to 1 if you have the `dcgettext' function. */
+#define HAVE_DCGETTEXT 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define this if you have a suitable version of libdvdnav */
+#define HAVE_DVDNAV 1
+
+/* Define this if you have ESD (libesd) installed */
+/* #undef HAVE_ESD */
+
+/* Define this if you have linux framebuffer support */
+/* #undef HAVE_FB */
+
+/* Define to 1 if you have the `feof_unlocked' function. */
+/* #undef HAVE_FEOF_UNLOCKED */
+
+/* Define to 1 if you have the `fgets_unlocked' function. */
+/* #undef HAVE_FGETS_UNLOCKED */
+
+/* Define to 1 if you have the `getcwd' function. */
+#define HAVE_GETCWD 1
+
+/* Define to 1 if you have the `getegid' function. */
+#define HAVE_GETEGID 1
+
+/* Define to 1 if you have the `geteuid' function. */
+#define HAVE_GETEUID 1
+
+/* Define to 1 if you have the `getgid' function. */
+#define HAVE_GETGID 1
+
+/* Define to 1 if you have the `getpagesize' function. */
+#define HAVE_GETPAGESIZE 1
+
+/* Define to 1 if you have the `getpwuid_r' function. */
+#define HAVE_GETPWUID_R 1
+
+/* Define if the GNU gettext() function is already present or preinstalled. */
+#define HAVE_GETTEXT 1
+
+/* Define to 1 if you have the `getuid' function. */
+#define HAVE_GETUID 1
+
+/* Define this if you have GLU support available */
+/* #undef HAVE_GLU */
+
+/* Define this if you have GLut support available */
+/* #undef HAVE_GLUT */
+
+/* Define this if you have gnome-vfs installed */
+/* #undef HAVE_GNOME_VFS */
+
+/* Define if you have the iconv() function. */
+/* #undef HAVE_ICONV */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+/* #undef HAVE_INTTYPES_H */
+
+/* Define this if you have ip_mreqn in netinet/in.h */
+/* #undef HAVE_IP_MREQN */
+
+/* Define this if you have a usable IRIX al interface available */
+/* #undef HAVE_IRIXAL */
+
+/* Define this if you have kernel statistics available via kstat interface */
+/* #undef HAVE_KSTAT */
+
+/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
+/* #undef HAVE_LANGINFO_CODESET */
+
+/* Define if your <locale.h> file defines LC_MESSAGES. */
+#define HAVE_LC_MESSAGES 1
+
+/* Define this if you have libfame mpeg encoder installed (fame.sf.net) */
+/* #undef HAVE_LIBFAME */
+
+/* Define to 1 if you have the `posix4' library (-lposix4). */
+/* #undef HAVE_LIBPOSIX4 */
+
+/* Define this if you have librte mpeg encoder installed (zapping.sf.net) */
+/* #undef HAVE_LIBRTE */
+
+/* Define to 1 if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define to 1 if you have the <linux/cdrom.h> header file. */
+/* #undef HAVE_LINUX_CDROM_H */
+
+/* Define to 1 if you have the <locale.h> header file. */
+#define HAVE_LOCALE_H 1
+
+/* Define to 1 if you have the <malloc.h> header file. */
+#define HAVE_MALLOC_H 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `mempcpy' function. */
+/* #undef HAVE_MEMPCPY */
+
+/* Define this if you have mlib installed */
+/* #undef HAVE_MLIB */
+
+/* Define to 1 if you have a working `mmap' system call. */
+/* #undef HAVE_MMAP */
+
+/* Define to 1 if you have the `munmap' function. */
+#define HAVE_MUNMAP 1
+
+/* Define to 1 if you have the `nanosleep' function. */
+/* #undef HAVE_NANOSLEEP */
+
+/* Define this if you have libfame 0.8.10 or above */
+/* #undef HAVE_NEW_LIBFAME */
+
+/* Define to 1 if you have the <nl_types.h> header file. */
+/* #undef HAVE_NL_TYPES_H */
+
+/* Define this if you have OpenGL support available */
+/* #undef HAVE_OPENGL */
+
+/* Define to 1 if you have the `putenv' function. */
+#define HAVE_PUTENV 1
+
+/* Define this if you have SDL library installed */
+/* #undef HAVE_SDL */
+
+/* Define to 1 if you have the `setenv' function. */
+#define HAVE_SETENV 1
+
+/* Define to 1 if you have the `setlocale' function. */
+#define HAVE_SETLOCALE 1
+
+/* Define to 1 if you have the `sigaction' function. */
+#define HAVE_SIGACTION 1
+
+/* Define to 1 if you have the `sigset' function. */
+/* #undef HAVE_SIGSET */
+
+/* Define to 1 if you have the <stddef.h> header file. */
+#define HAVE_STDDEF_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+/* #undef HAVE_STDINT_H */
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the `stpcpy' function. */
+/* #undef HAVE_STPCPY */
+
+/* Define to 1 if you have the `strcasecmp' function. */
+#define HAVE_STRCASECMP 1
+
+/* Define to 1 if you have the `strchr' function. */
+#define HAVE_STRCHR 1
+
+/* Define to 1 if you have the `strdup' function. */
+#define HAVE_STRDUP 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strpbrk' function. */
+#define HAVE_STRPBRK 1
+
+/* Define to 1 if you have the `strsep' function. */
+#define HAVE_STRSEP 1
+
+/* Define to 1 if you have the `strtoul' function. */
+#define HAVE_STRTOUL 1
+
+/* Define this if your asoundlib.h is installed in sys/ */
+/* #undef HAVE_SYS_ASOUNDLIB_H */
+
+/* Define to 1 if you have the <sys/cdio.h> header file. */
+/* #undef HAVE_SYS_CDIO_H */
+
+/* Define to 1 if you have the <sys/mixer.h> header file. */
+/* #undef HAVE_SYS_MIXER_H */
+
+/* Define to 1 if you have the <sys/mman.h> header file. */
+#define HAVE_SYS_MMAN_H 1
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+/* #undef HAVE_SYS_PARAM_H */
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the `tsearch' function. */
+/* #undef HAVE_TSEARCH */
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `vsscanf' function. */
+#define HAVE_VSSCANF 1
+
+/* Define this if you have X11R6 installed */
+/* #undef HAVE_X11 */
+
+/* Define this if you have libXinerama installed */
+/* #undef HAVE_XINERAMA */
+
+/* Define this if you have libXv installed */
+/* #undef HAVE_XV */
+
+/* Define this if you have libXv.a */
+/* #undef HAVE_XV_STATIC */
+
+/* Define to 1 if you have the `__argz_count' function. */
+/* #undef HAVE___ARGZ_COUNT */
+
+/* Define to 1 if you have the `__argz_next' function. */
+/* #undef HAVE___ARGZ_NEXT */
+
+/* Define to 1 if you have the `__argz_stringify' function. */
+/* #undef HAVE___ARGZ_STRINGIFY */
+
+/* Define as const if the declaration of iconv() needs const. */
+/* #undef ICONV_CONST */
+
+/* Define this if you have mlib installed */
+/* #undef LIBA52_MLIB */
+
+/* Define this if you have mlib installed */
+/* #undef LIBMPEG2_MLIB */
+
+/* Name of package */
+#define PACKAGE "xine-lib"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME ""
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING ""
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION ""
+
+/* If using the C implementation of alloca, define if you know the
+ direction of stack growth for your system; otherwise it will be
+ automatically deduced at run-time.
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown */
+/* #undef STACK_DIRECTION */
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+#define VERSION "1-beta6"
+
+/* xine major version number */
+#define XINE_MAJOR 1
+
+/* xine minor version number */
+#define XINE_MINOR 0
+
+/* xine sub version number */
+#define XINE_SUB 0
+
+/* Define to 1 if the X Window System is missing or not being used. */
+#define X_DISPLAY_MISSING 1
+
+/* Define to 1 if your processor stores words with the most significant byte
+ first (like Motorola and SPARC, unlike Intel and VAX). */
+/* #undef WORDS_BIGENDIAN */
+
+
+/* Define this if you want nvtvd tvmode support */
+/* #undef XINE_HAVE_NVTV */
+
+#define HAVE_DVDCSS_DVDCSS_H 1
+
+#if defined(WIN32)
+
+/* Ridiculous hack to return valid xine support
+ * directories. These should be read from
+ * a registry entry set at install time.
+ */
+
+static char tmp_win32_path[ 1024 ];
+static char * exec_path_append_subdir( char * string )
+{
+ char * tmpchar;
+ char * cmdline;
+ char * back_slash;
+ char * fore_slash;
+ char * last_slash;
+
+ // get program exec command line
+ cmdline = GetCommandLine();
+
+ // check for " at beginning of string
+ if( *cmdline == '\"' )
+ {
+ // copy command line, skip first quote
+ strcpy( tmp_win32_path, cmdline + 1 );
+
+ // terminate at second set of quotes
+ tmpchar = strchr( tmp_win32_path, '\"' );
+ *tmpchar = 0;
+ }
+ else
+ {
+ // copy command line
+ strcpy( tmp_win32_path, cmdline );
+
+ // terminate at first space
+ tmpchar = strchr( tmp_win32_path, ' ' );
+ *tmpchar = 0;
+ }
+
+ // find the last occurance of a back
+ // slash or fore slash
+ back_slash = strrchr( tmp_win32_path, '\\' );
+ fore_slash = strrchr( tmp_win32_path, '/' );
+
+ // make sure the last back slash was not
+ // after a drive letter
+ if( back_slash > tmp_win32_path )
+ if( *( back_slash - 1 ) == ':' )
+ back_slash = 0;
+
+ // which slash was the latter slash
+ if( back_slash > fore_slash )
+ last_slash = back_slash;
+ else
+ last_slash = fore_slash;
+
+ // detect if we had a relative or
+ // distiguished path ( had a slash )
+ if( last_slash )
+ {
+ // we had a slash charachter in our
+ // command line
+ *( last_slash + 1 ) = 0;
+
+ // if had a string to append to the path
+ if( string )
+ strcat( tmp_win32_path, string );
+ }
+ else
+ {
+ // no slash, assume local directory
+ strcpy( tmp_win32_path, "./" );
+
+ // if had a string to append to the path
+ if( string )
+ strcat( tmp_win32_path, string );
+ }
+
+ return tmp_win32_path;
+}
+
+#define XINE_HOMEDIR exec_path_append_subdir( 0 )
+#define XINE_PLUGINDIR exec_path_append_subdir( "plugins" )
+#define XINE_FONTDIR exec_path_append_subdir( "fonts" )
+#define XINE_LOCALEDIR exec_path_append_subdir( "locale" )
+
+#else
+
+/* Path where catalog files will be. */
+#define XINE_LOCALEDIR "/usr/local/share/locale"
+
+/* Define this to plugins directory location */
+#define XINE_PLUGINDIR "/usr/local/lib/xine/plugins/1.0.0"
+
+/* Define this if you're running x86 architecture */
+#define __i386__ 1
+
+/* Path where aclocal m4 files will be. */
+#define XINE_ACFLAGS "-I ${prefix}/share/aclocal"
+
+#endif
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define as `__inline' if that's what the C compiler calls it, or to nothing
+ if it is not supported. */
+/* #undef inline */
+
+/* Define to `long' if <sys/types.h> does not define. */
+/* #undef off_t */
+
+/* Define to `unsigned' if <sys/types.h> does not define. */
+/* #undef size_t */
+
+#endif /* defined CONFIG_H */
diff --git a/win32/include/dirent.h b/win32/include/dirent.h new file mode 100644 index 000000000..588048c67 --- /dev/null +++ b/win32/include/dirent.h @@ -0,0 +1,32 @@ +/*
+
+ Declaration of POSIX directory browsing functions and types for Win32.
+
+ Kevlin Henney (mailto:kevlin@acm.org), March 1997.
+
+ Copyright Kevlin Henney, 1997. All rights reserved.
+
+ Permission to use, copy, modify, and distribute this software and its
+ documentation for any purpose is hereby granted without fee, provided
+ that this copyright and permissions notice appear in all copies and
+ derivatives, and that no charge may be made for the software and its
+ documentation except to cover cost of distribution.
+
+*/
+
+#ifndef DIRENT_INCLUDED
+#define DIRENT_INCLUDED
+
+typedef struct DIR DIR;
+
+struct dirent
+{
+ char *d_name;
+};
+
+DIR *opendir(const char *);
+int closedir(DIR *);
+struct dirent *readdir(DIR *);
+void rewinddir(DIR *);
+
+#endif
diff --git a/win32/include/dlfcn.h b/win32/include/dlfcn.h new file mode 100644 index 000000000..35074bcd1 --- /dev/null +++ b/win32/include/dlfcn.h @@ -0,0 +1,33 @@ +/*
+ * Copyright (C) 2000-2001 the xine project
+ *
+ * This file is part of xine, a unix video player.
+ *
+ * xine 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * xine 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * WIN32 PORT,
+ * by Matthew Grooms <elon@altavista.com>
+ *
+ * dlfcn.h - Mimic the dl functions of a *nix system
+ *
+ */
+
+#define RTLD_LAZY 0
+#define RTLD_GLOBAL 0
+
+#define dlopen( A, B ) LoadLibrary( A )
+#define dlclose( A ) FreeLibrary( A )
+#define dlsym( A, B ) ( void * ) GetProcAddress( A, B )
+#define dlerror() "dlerror"
diff --git a/win32/include/inttypes.h b/win32/include/inttypes.h new file mode 100644 index 000000000..90a7c81f5 --- /dev/null +++ b/win32/include/inttypes.h @@ -0,0 +1,59 @@ +/*
+ * Copyright (C) 2000-2001 the xine project
+ *
+ * This file is part of xine, a unix video player.
+ *
+ * xine 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * xine 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * WIN32 PORT,
+ * by Matthew Grooms <elon@altavista.com>
+ *
+ * inttypes.h - Standard integer definitions.
+ *
+ */
+
+#ifndef _SYS_INTTYPES_H_
+#define _SYS_INTTYPES_H_
+
+#define int8_t signed char
+#define int16_t signed short
+#define int32_t signed long
+#define int64_t signed hyper
+
+#define uint8_t unsigned char
+#define uint16_t unsigned short
+#define uint32_t unsigned long
+#define uint64_t unsigned hyper
+
+#define intptr_t signed int *
+#define uintptr_t unsigned int *
+
+#define __int8_t int8_t
+#define __int16_t int16_t
+#define __int32_t int32_t
+#define __int64_t int64_t
+
+#define __uint8_t uint8_t
+#define __uint16_t uint16_t
+#define __uint32_t uint32_t
+#define __uint64_t uint64_t
+
+#define __intptr_t intptr_t
+#define __uintptr_t uintptr_t
+
+typedef __int64 ulonglong;
+typedef __int64 longlong;
+
+#endif
diff --git a/win32/include/pthread.h b/win32/include/pthread.h new file mode 100644 index 000000000..31e2cf918 --- /dev/null +++ b/win32/include/pthread.h @@ -0,0 +1,1077 @@ +/* This is the POSIX thread API (POSIX 1003).
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright (C) 1998
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA
+ */
+
+#if !defined( PTHREAD_H )
+#define PTHREAD_H
+
+#ifdef _UWIN
+# define HAVE_STRUCT_TIMESPEC 1
+# define HAVE_SIGNAL_H 1
+# undef HAVE_CONFIG_H
+# pragma comment(lib, "pthread")
+#endif
+
+/*
+ * -------------------------------------------------------------
+ *
+ *
+ * Module: pthread.h
+ *
+ * Purpose:
+ * Provides an implementation of PThreads based upon the
+ * standard:
+ *
+ * POSIX 1003.1c-1995 (POSIX.1c)
+ *
+ * Parts of the implementation also comply with the
+ * Open Group Unix 98 specification in order to enhance
+ * code portability between Windows, various commercial
+ * Unix implementations, and Linux.
+ *
+ * Authors:
+ * There have been many contributors to this library.
+ * The initial implementation was contributed by
+ * John Bossom, and several others have provided major
+ * sections or revisions of parts of the implementation.
+ * Often significant effort has been contributed to
+ * find and fix important bugs and other problems to
+ * improve the reliability of the library, which sometimes
+ * is not reflected in the amount of code which changed as
+ * result.
+ * As much as possible, the contributors are acknowledged
+ * in the ChangeLog file in the source code distribution
+ * where their changes are noted in detail.
+ *
+ * Contributors are listed in the MAINTAINERS file.
+ *
+ * As usual, all bouquets go to the contributors, and all
+ * brickbats go to the project maintainer.
+ *
+ * Maintainer:
+ * The code base for this project is coordinated and
+ * eventually pre-tested, packaged, and made available by
+ *
+ * Ross Johnson <rpj@ise.canberra.edu.au>
+ *
+ * QA Testers:
+ * Ultimately, the library is tested in the real world by
+ * a host of competent and demanding scientists and
+ * engineers who report bugs and/or provide solutions
+ * which are then fixed or incorporated into subsequent
+ * versions of the library. Each time a bug is fixed, a
+ * test case is written to prove the fix and ensure
+ * that later changes to the code don't reintroduce the
+ * same error. The number of test cases is slowly growing
+ * and therefore so is the code reliability.
+ *
+ * Compliance:
+ * See the file ANNOUNCE for the list of implemented
+ * and not-implemented routines and defined options.
+ * Of course, these are all defined is this file as well.
+ *
+ * Web site:
+ * The source code and other information about this library
+ * are available from
+ *
+ * http://sources.redhat.com/pthreads-win32/
+ *
+ * -------------------------------------------------------------
+ */
+
+/*
+ * -----------------
+ * autoconf switches
+ * -----------------
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
+
+#include <windows.h>
+
+#ifndef NEED_FTIME
+#include <time.h>
+#else /* NEED_FTIME */
+/* use native WIN32 time API */
+#endif /* NEED_FTIME */
+
+#if HAVE_SIGNAL_H
+#include <signal.h>
+#endif /* HAVE_SIGNAL_H */
+
+#include <setjmp.h>
+
+#ifndef HAVE_STRUCT_TIMESPEC
+struct timespec {
+ long tv_sec;
+ long tv_nsec;
+};
+#endif /* HAVE_STRUCT_TIMESPEC */
+
+#ifndef SIG_BLOCK
+#define SIG_BLOCK 0
+#endif /* SIG_BLOCK */
+
+#ifndef SIG_UNBLOCK
+#define SIG_UNBLOCK 1
+#endif /* SIG_UNBLOCK */
+
+#ifndef SIG_SETMASK
+#define SIG_SETMASK 2
+#endif /* SIG_SETMASK */
+
+/*
+ * note: ETIMEDOUT is correctly defined in winsock.h
+ */
+#include <winsock.h>
+
+#ifdef NEED_ERRNO
+# include "need_errno.h"
+#else
+# include <errno.h>
+#endif
+
+#include <sched.h>
+
+/*
+ * In case ETIMEDOUT hasn't been defined above somehow.
+ */
+#ifndef ETIMEDOUT
+# define ETIMEDOUT 10060 /* This is the value in winsock.h. */
+#endif
+
+/*
+ * Several systems don't define ENOTSUP. If not, we use
+ * the same value as Solaris.
+ */
+#ifndef ENOTSUP
+# define ENOTSUP 48
+#endif
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/*
+ * -------------------------------------------------------------
+ *
+ * POSIX 1003.1c-1995 Options
+ * ===========================
+ *
+ * _POSIX_THREADS (set)
+ * If set, you can use threads
+ *
+ * _POSIX_THREAD_ATTR_STACKSIZE (set)
+ * If set, you can control the size of a thread's
+ * stack
+ * pthread_attr_getstacksize
+ * pthread_attr_setstacksize
+ *
+ * _POSIX_THREAD_ATTR_STACKADDR (not set)
+ * If set, you can allocate and control a thread's
+ * stack. If not supported, the following functions
+ * will return ENOSYS, indicating they are not
+ * supported:
+ * pthread_attr_getstackaddr
+ * pthread_attr_setstackaddr
+ *
+ * _POSIX_THREAD_PRIORITY_SCHEDULING (set)
+ * If set, you can use realtime scheduling.
+ * Indicates the availability of:
+ * pthread_attr_getinheritsched
+ * pthread_attr_getschedparam
+ * pthread_attr_getschedpolicy
+ * pthread_attr_getscope
+ * pthread_attr_setinheritsched
+ * pthread_attr_setschedparam
+ * pthread_attr_setschedpolicy
+ * pthread_attr_setscope
+ * pthread_getschedparam
+ * pthread_setschedparam
+ * sched_get_priority_max
+ * sched_get_priority_min
+ * sched_rr_set_interval
+ *
+ * _POSIX_THREAD_PRIO_INHERIT (not set)
+ * If set, you can create priority inheritance
+ * mutexes.
+ * pthread_mutexattr_getprotocol +
+ * pthread_mutexattr_setprotocol +
+ *
+ * _POSIX_THREAD_PRIO_PROTECT (not set)
+ * If set, you can create priority ceiling mutexes
+ * Indicates the availability of:
+ * pthread_mutex_getprioceiling
+ * pthread_mutex_setprioceiling
+ * pthread_mutexattr_getprioceiling
+ * pthread_mutexattr_getprotocol +
+ * pthread_mutexattr_setprioceiling
+ * pthread_mutexattr_setprotocol +
+ *
+ * _POSIX_THREAD_PROCESS_SHARED (not set)
+ * If set, you can create mutexes and condition
+ * variables that can be shared with another
+ * process.If set, indicates the availability
+ * of:
+ * pthread_mutexattr_getpshared
+ * pthread_mutexattr_setpshared
+ * pthread_condattr_getpshared
+ * pthread_condattr_setpshared
+ *
+ * _POSIX_THREAD_SAFE_FUNCTIONS (set)
+ * If set you can use the special *_r library
+ * functions that provide thread-safe behaviour
+ *
+ * + These functions provide both 'inherit' and/or
+ * 'protect' protocol, based upon these macro
+ * settings.
+ *
+ * POSIX 1003.1c-1995 Limits
+ * ===========================
+ *
+ * PTHREAD_DESTRUCTOR_ITERATIONS
+ * Maximum number of attempts to destroy
+ * a thread's thread-specific data on
+ * termination (must be at least 4)
+ *
+ * PTHREAD_KEYS_MAX
+ * Maximum number of thread-specific data keys
+ * available per process (must be at least 128)
+ *
+ * PTHREAD_STACK_MIN
+ * Minimum supported stack size for a thread
+ *
+ * PTHREAD_THREADS_MAX
+ * Maximum number of threads supported per
+ * process (must be at least 64).
+ *
+ *
+ * POSIX 1003.1j/D10-1999 Options
+ * ==============================
+ *
+ * _POSIX_READER_WRITER_LOCKS (set)
+ * If set, you can use read/write locks
+ *
+ * _POSIX_SPIN_LOCKS (set)
+ * If set, you can use spin locks
+ *
+ * _POSIX_BARRIERS (set)
+ * If set, you can use barriers
+ *
+ * -------------------------------------------------------------
+ */
+
+/*
+ * POSIX Options
+ */
+#ifndef _POSIX_THREADS
+#define _POSIX_THREADS
+#endif
+
+#ifndef _POSIX_READER_WRITER_LOCKS
+#define _POSIX_READER_WRITER_LOCKS
+#endif
+
+#ifndef _POSIX_SPIN_LOCKS
+#define _POSIX_SPIN_LOCKS
+#endif
+
+#ifndef _POSIX_BARRIERS
+#define _POSIX_BARRIERS
+#endif
+
+#define _POSIX_THREAD_SAFE_FUNCTIONS
+#define _POSIX_THREAD_ATTR_STACKSIZE
+#define _POSIX_THREAD_PRIORITY_SCHEDULING
+
+#if defined( KLUDGE )
+/*
+ * The following are not supported
+ */
+#define _POSIX_THREAD_ATTR_STACKADDR
+#define _POSIX_THREAD_PRIO_INHERIT
+#define _POSIX_THREAD_PRIO_PROTECT
+#define _POSIX_THREAD_PROCESS_SHARED
+
+#endif /* KLUDGE */
+
+/*
+ * POSIX Limits
+ *
+ * PTHREAD_DESTRUCTOR_ITERATIONS
+ * Standard states this must be at least
+ * 4.
+ *
+ * PTHREAD_KEYS_MAX
+ * WIN32 permits only 64 TLS keys per process.
+ * This limitation could be worked around by
+ * simply simulating keys.
+ *
+ * PTHREADS_STACK_MIN
+ * POSIX specifies 0 which is also the value WIN32
+ * interprets as allowing the system to
+ * set the size to that of the main thread. The
+ * maximum stack size in Win32 is 1Meg. WIN32
+ * allocates more stack as required up to the 1Meg
+ * limit.
+ *
+ * PTHREAD_THREADS_MAX
+ * Not documented by WIN32. Wrote a test program
+ * that kept creating threads until it failed
+ * revealed this approximate number.
+ *
+ */
+#define PTHREAD_DESTRUCTOR_ITERATIONS 4
+#define PTHREAD_KEYS_MAX 64
+#define PTHREAD_STACK_MIN 0
+#define PTHREAD_THREADS_MAX 2019
+
+
+#ifdef _UWIN
+# include <sys/types.h>
+#else
+typedef struct pthread_t_ *pthread_t;
+typedef struct pthread_attr_t_ *pthread_attr_t;
+typedef struct pthread_once_t_ pthread_once_t;
+typedef struct pthread_key_t_ *pthread_key_t;
+typedef struct pthread_mutex_t_ *pthread_mutex_t;
+typedef struct pthread_mutexattr_t_ *pthread_mutexattr_t;
+typedef struct pthread_cond_t_ *pthread_cond_t;
+typedef struct pthread_condattr_t_ *pthread_condattr_t;
+#endif
+typedef struct pthread_rwlock_t_ *pthread_rwlock_t;
+typedef struct pthread_rwlockattr_t_ *pthread_rwlockattr_t;
+typedef struct pthread_spinlock_t_ *pthread_spinlock_t;
+typedef struct pthread_barrier_t_ *pthread_barrier_t;
+typedef struct pthread_barrierattr_t_ *pthread_barrierattr_t;
+
+/*
+ * ====================
+ * ====================
+ * POSIX Threads
+ * ====================
+ * ====================
+ */
+
+enum {
+/*
+ * pthread_attr_{get,set}detachstate
+ */
+ PTHREAD_CREATE_JOINABLE = 0, /* Default */
+ PTHREAD_CREATE_DETACHED = 1,
+
+/*
+ * pthread_attr_{get,set}inheritsched
+ */
+ PTHREAD_INHERIT_SCHED = 0,
+ PTHREAD_EXPLICIT_SCHED = 1, /* Default */
+
+/*
+ * pthread_{get,set}scope
+ */
+ PTHREAD_SCOPE_PROCESS = 0,
+ PTHREAD_SCOPE_SYSTEM = 1, /* Default */
+
+/*
+ * pthread_setcancelstate paramters
+ */
+ PTHREAD_CANCEL_ENABLE = 0, /* Default */
+ PTHREAD_CANCEL_DISABLE = 1,
+
+/*
+ * pthread_setcanceltype parameters
+ */
+ PTHREAD_CANCEL_ASYNCHRONOUS = 0,
+ PTHREAD_CANCEL_DEFERRED = 1, /* Default */
+
+/*
+ * pthread_mutexattr_{get,set}pshared
+ * pthread_condattr_{get,set}pshared
+ */
+ PTHREAD_PROCESS_PRIVATE = 0,
+ PTHREAD_PROCESS_SHARED = 1,
+
+/*
+ * pthread_barrier_wait
+ */
+ PTHREAD_BARRIER_SERIAL_THREAD = -1
+};
+
+/*
+ * ====================
+ * ====================
+ * Cancelation
+ * ====================
+ * ====================
+ */
+#define PTHREAD_CANCELED ((void *) -1)
+
+
+/*
+ * ====================
+ * ====================
+ * Once Key
+ * ====================
+ * ====================
+ */
+#define PTHREAD_ONCE_INIT { FALSE, -1 }
+
+struct pthread_once_t_
+{
+ int done; /* indicates if user function executed */
+ long started; /* First thread to increment this value */
+ /* to zero executes the user function */
+};
+
+
+/*
+ * ====================
+ * ====================
+ * Object initialisers
+ * ====================
+ * ====================
+ */
+#define PTHREAD_MUTEX_INITIALIZER ((pthread_mutex_t) -1)
+
+#define PTHREAD_COND_INITIALIZER ((pthread_cond_t) -1)
+
+#define PTHREAD_RWLOCK_INITIALIZER ((pthread_rwlock_t) -1)
+
+#define PTHREAD_SPINLOCK_INITIALIZER ((pthread_spinlock_t) -1)
+
+enum
+{
+ PTHREAD_MUTEX_FAST_NP,
+ PTHREAD_MUTEX_RECURSIVE_NP,
+ PTHREAD_MUTEX_ERRORCHECK_NP,
+ PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_FAST_NP,
+ PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP,
+ PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP,
+ PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL
+};
+
+
+/* There are three implementations of cancel cleanup.
+ * Note that pthread.h is included in both application
+ * compilation units and also internally for the library.
+ * The code here and within the library aims to work
+ * for all reasonable combinations of environments.
+ *
+ * The three implementations are:
+ *
+ * WIN32 SEH
+ * C
+ * C++
+ *
+ * Please note that exiting a push/pop block via
+ * "return", "exit", "break", or "continue" will
+ * lead to different behaviour amongst applications
+ * depending upon whether the library was built
+ * using SEH, C++, or C. For example, a library built
+ * with SEH will call the cleanup routine, while both
+ * C++ and C built versions will not.
+ */
+
+/*
+ * define defaults for cleanup code
+ */
+#if !defined( __CLEANUP_SEH ) && !defined( __CLEANUP_CXX ) && !defined( __CLEANUP_C )
+
+#if defined(_MSC_VER)
+#define __CLEANUP_SEH
+#elif defined(__cplusplus)
+#define __CLEANUP_CXX
+#else
+#define __CLEANUP_C
+#endif
+
+#endif
+
+#if defined( __CLEANUP_SEH ) && defined(__GNUC__)
+#error ERROR [__FILE__, line __LINE__]: GNUC does not support SEH.
+#endif
+
+typedef struct ptw32_cleanup_t ptw32_cleanup_t;
+typedef void (__cdecl *ptw32_cleanup_callback_t)(void *);
+
+struct ptw32_cleanup_t
+{
+ ptw32_cleanup_callback_t routine;
+ void *arg;
+ struct ptw32_cleanup_t *prev;
+};
+
+#ifdef __CLEANUP_SEH
+ /*
+ * WIN32 SEH version of cancel cleanup.
+ */
+
+#define pthread_cleanup_push( _rout, _arg ) \
+ { \
+ ptw32_cleanup_t _cleanup; \
+ \
+ _cleanup.routine = (ptw32_cleanup_callback_t)(_rout); \
+ _cleanup.arg = (_arg); \
+ __try \
+ { \
+
+#define pthread_cleanup_pop( _execute ) \
+ } \
+ __finally \
+ { \
+ if( _execute || AbnormalTermination()) \
+ { \
+ (*(_cleanup.routine))( _cleanup.arg ); \
+ } \
+ } \
+ }
+
+#else /* __CLEANUP_SEH */
+
+#ifdef __CLEANUP_C
+
+ /*
+ * C implementation of PThreads cancel cleanup
+ */
+
+#define pthread_cleanup_push( _rout, _arg ) \
+ { \
+ ptw32_cleanup_t _cleanup; \
+ \
+ ptw32_push_cleanup( &_cleanup, (ptw32_cleanup_callback_t) (_rout), (_arg) ); \
+
+#define pthread_cleanup_pop( _execute ) \
+ (void) ptw32_pop_cleanup( _execute ); \
+ }
+
+#else /* __CLEANUP_C */
+
+#ifdef __CLEANUP_CXX
+
+ /*
+ * C++ version of cancel cleanup.
+ * - John E. Bossom.
+ */
+
+ class PThreadCleanup {
+ /*
+ * PThreadCleanup
+ *
+ * Purpose
+ * This class is a C++ helper class that is
+ * used to implement pthread_cleanup_push/
+ * pthread_cleanup_pop.
+ * The destructor of this class automatically
+ * pops the pushed cleanup routine regardless
+ * of how the code exits the scope
+ * (i.e. such as by an exception)
+ */
+ ptw32_cleanup_callback_t cleanUpRout;
+ void * obj;
+ int executeIt;
+
+ public:
+ PThreadCleanup() :
+ cleanUpRout( NULL ),
+ obj( NULL ),
+ executeIt( 0 )
+ /*
+ * No cleanup performed
+ */
+ {
+ }
+
+ PThreadCleanup(
+ ptw32_cleanup_callback_t routine,
+ void * arg ) :
+ cleanUpRout( routine ),
+ obj( arg ),
+ executeIt( 1 )
+ /*
+ * Registers a cleanup routine for 'arg'
+ */
+ {
+ }
+
+ ~PThreadCleanup()
+ {
+ if ( executeIt && ((void *) cleanUpRout != NULL) )
+ {
+ (void) (*cleanUpRout)( obj );
+ }
+ }
+
+ void execute( int exec )
+ {
+ executeIt = exec;
+ }
+ };
+
+ /*
+ * C++ implementation of PThreads cancel cleanup;
+ * This implementation takes advantage of a helper
+ * class who's destructor automatically calls the
+ * cleanup routine if we exit our scope weirdly
+ */
+#define pthread_cleanup_push( _rout, _arg ) \
+ { \
+ PThreadCleanup cleanup((ptw32_cleanup_callback_t)(_rout), \
+ (void *) (_arg) );
+
+#define pthread_cleanup_pop( _execute ) \
+ cleanup.execute( _execute ); \
+ }
+
+#else
+
+#error ERROR [__FILE__, line __LINE__]: Cleanup type undefined.
+
+#endif /* __CLEANUP_CXX */
+
+#endif /* __CLEANUP_C */
+
+#endif /* __CLEANUP_SEH */
+
+/*
+ * ===============
+ * ===============
+ * Methods
+ * ===============
+ * ===============
+ */
+
+/*
+ * PThread Attribute Functions
+ */
+int pthread_attr_init (pthread_attr_t * attr);
+
+int pthread_attr_destroy (pthread_attr_t * attr);
+
+int pthread_attr_getdetachstate (const pthread_attr_t * attr,
+ int *detachstate);
+
+int pthread_attr_getstackaddr (const pthread_attr_t * attr,
+ void **stackaddr);
+
+int pthread_attr_getstacksize (const pthread_attr_t * attr,
+ size_t * stacksize);
+
+int pthread_attr_setdetachstate (pthread_attr_t * attr,
+ int detachstate);
+
+int pthread_attr_setstackaddr (pthread_attr_t * attr,
+ void *stackaddr);
+
+int pthread_attr_setstacksize (pthread_attr_t * attr,
+ size_t stacksize);
+
+int pthread_attr_getschedparam (const pthread_attr_t *attr,
+ struct sched_param *param);
+
+int pthread_attr_setschedparam (pthread_attr_t *attr,
+ const struct sched_param *param);
+
+int pthread_attr_setschedpolicy (pthread_attr_t *,
+ int);
+
+int pthread_attr_getschedpolicy (pthread_attr_t *,
+ int *);
+
+int pthread_attr_setinheritsched(pthread_attr_t * attr,
+ int inheritsched);
+
+int pthread_attr_getinheritsched(pthread_attr_t * attr,
+ int * inheritsched);
+
+int pthread_attr_setscope (pthread_attr_t *,
+ int);
+
+int pthread_attr_getscope (const pthread_attr_t *,
+ int *);
+
+/*
+ * PThread Functions
+ */
+int pthread_create (pthread_t * tid,
+ const pthread_attr_t * attr,
+ void *(*start) (void *),
+ void *arg);
+
+int pthread_detach (pthread_t tid);
+
+int pthread_equal (pthread_t t1,
+ pthread_t t2);
+
+void pthread_exit (void *value_ptr);
+
+int pthread_join (pthread_t thread,
+ void **value_ptr);
+
+pthread_t pthread_self (void);
+
+int pthread_cancel (pthread_t thread);
+
+int pthread_setcancelstate (int state,
+ int *oldstate);
+
+int pthread_setcanceltype (int type,
+ int *oldtype);
+
+void pthread_testcancel (void);
+
+int pthread_once (pthread_once_t * once_control,
+ void (*init_routine) (void));
+
+ptw32_cleanup_t *ptw32_pop_cleanup (int execute);
+
+void ptw32_push_cleanup (ptw32_cleanup_t * cleanup,
+ void (*routine) (void *),
+ void *arg);
+
+/*
+ * Thread Specific Data Functions
+ */
+int pthread_key_create (pthread_key_t * key,
+ void (*destructor) (void *));
+
+int pthread_key_delete (pthread_key_t key);
+
+int pthread_setspecific (pthread_key_t key,
+ const void *value);
+
+void *pthread_getspecific (pthread_key_t key);
+
+
+/*
+ * Mutex Attribute Functions
+ */
+int pthread_mutexattr_init (pthread_mutexattr_t * attr);
+
+int pthread_mutexattr_destroy (pthread_mutexattr_t * attr);
+
+int pthread_mutexattr_getpshared (const pthread_mutexattr_t
+ * attr,
+ int *pshared);
+
+int pthread_mutexattr_setpshared (pthread_mutexattr_t * attr,
+ int pshared);
+
+int pthread_mutexattr_settype (pthread_mutexattr_t * attr, int kind);
+int pthread_mutexattr_gettype (pthread_mutexattr_t * attr, int *kind);
+
+/*
+ * Barrier Attribute Functions
+ */
+int pthread_barrierattr_init (pthread_barrierattr_t * attr);
+
+int pthread_barrierattr_destroy (pthread_barrierattr_t * attr);
+
+int pthread_barrierattr_getpshared (const pthread_barrierattr_t
+ * attr,
+ int *pshared);
+
+int pthread_barrierattr_setpshared (pthread_barrierattr_t * attr,
+ int pshared);
+
+/*
+ * Mutex Functions
+ */
+int pthread_mutex_init (pthread_mutex_t * mutex,
+ const pthread_mutexattr_t * attr);
+
+int pthread_mutex_destroy (pthread_mutex_t * mutex);
+
+int pthread_mutex_lock (pthread_mutex_t * mutex);
+
+int pthread_mutex_trylock (pthread_mutex_t * mutex);
+
+int pthread_mutex_unlock (pthread_mutex_t * mutex);
+
+/*
+ * Spinlock Functions
+ */
+int pthread_spin_init (pthread_spinlock_t * lock, int pshared);
+
+int pthread_spin_destroy (pthread_spinlock_t * lock);
+
+int pthread_spin_lock (pthread_spinlock_t * lock);
+
+int pthread_spin_trylock (pthread_spinlock_t * lock);
+
+int pthread_spin_unlock (pthread_spinlock_t * lock);
+
+/*
+ * Barrier Functions
+ */
+int pthread_barrier_init (pthread_barrier_t * barrier,
+ const pthread_barrierattr_t * attr,
+ unsigned int count);
+
+int pthread_barrier_destroy (pthread_barrier_t * barrier);
+
+int pthread_barrier_wait (pthread_barrier_t * barrier);
+
+/*
+ * Condition Variable Attribute Functions
+ */
+int pthread_condattr_init (pthread_condattr_t * attr);
+
+int pthread_condattr_destroy (pthread_condattr_t * attr);
+
+int pthread_condattr_getpshared (const pthread_condattr_t * attr,
+ int *pshared);
+
+int pthread_condattr_setpshared (pthread_condattr_t * attr,
+ int pshared);
+
+/*
+ * Condition Variable Functions
+ */
+int pthread_cond_init (pthread_cond_t * cond,
+ const pthread_condattr_t * attr);
+
+int pthread_cond_destroy (pthread_cond_t * cond);
+
+int pthread_cond_wait (pthread_cond_t * cond,
+ pthread_mutex_t * mutex);
+
+int pthread_cond_timedwait (pthread_cond_t * cond,
+ pthread_mutex_t * mutex,
+ const struct timespec *abstime);
+
+int pthread_cond_signal (pthread_cond_t * cond);
+
+int pthread_cond_broadcast (pthread_cond_t * cond);
+
+/*
+ * Scheduling
+ */
+int pthread_setschedparam (pthread_t thread,
+ int policy,
+ const struct sched_param *param);
+
+int pthread_getschedparam (pthread_t thread,
+ int *policy,
+ struct sched_param *param);
+
+int pthread_setconcurrency (int);
+
+int pthread_getconcurrency (void);
+
+/*
+ * Read-Write Lock Functions
+ */
+int pthread_rwlock_init(pthread_rwlock_t *lock,
+ const pthread_rwlockattr_t *attr);
+
+int pthread_rwlock_destroy(pthread_rwlock_t *lock);
+
+int pthread_rwlock_tryrdlock(pthread_rwlock_t *);
+
+int pthread_rwlock_trywrlock(pthread_rwlock_t *);
+
+int pthread_rwlock_rdlock(pthread_rwlock_t *lock);
+
+int pthread_rwlock_wrlock(pthread_rwlock_t *lock);
+
+int pthread_rwlock_unlock(pthread_rwlock_t *lock);
+
+
+/*
+ * Non-portable functions
+ */
+
+/*
+ * Compatibility with Linux.
+ */
+int pthread_mutexattr_setkind_np(pthread_mutexattr_t * attr, int kind);
+int pthread_mutexattr_getkind_np(pthread_mutexattr_t * attr, int *kind);
+
+/*
+ * Possibly supported by other POSIX threads implementations
+ */
+int pthread_delay_np (struct timespec * interval);
+
+/*
+ * Returns the Win32 HANDLE for the POSIX thread.
+ */
+HANDLE pthread_getw32threadhandle_np(pthread_t thread);
+
+/*
+ * Returns the number of CPUs available to the process.
+ */
+int pthread_getprocessors_np(int * count);
+
+/*
+ * Useful if an application wants to statically link
+ * the lib rather than load the DLL at run-time.
+ */
+int pthread_win32_process_attach_np(void);
+int pthread_win32_process_detach_np(void);
+int pthread_win32_thread_attach_np(void);
+int pthread_win32_thread_detach_np(void);
+
+
+/*
+ * Protected Methods
+ *
+ * This function blocks until the given WIN32 handle
+ * is signaled or pthread_cancel had been called.
+ * This function allows the caller to hook into the
+ * PThreads cancel mechanism. It is implemented using
+ *
+ * WaitForMultipleObjects
+ *
+ * on 'waitHandle' and a manually reset WIN32 Event
+ * used to implement pthread_cancel. The 'timeout'
+ * argument to TimedWait is simply passed to
+ * WaitForMultipleObjects.
+ */
+int pthreadCancelableWait (HANDLE waitHandle);
+int pthreadCancelableTimedWait (HANDLE waitHandle, DWORD timeout);
+
+/*
+ * Thread-Safe C Runtime Library Mappings.
+ */
+#ifndef _UWIN
+#if 1
+#if (! defined(HAVE_ERRNO)) && (! defined(_REENTRANT)) && (! defined(_MT))
+int * _errno( void );
+#endif
+#else
+#if (! defined(NEED_ERRNO)) || (! defined( _REENTRANT ) && (! defined( _MT ) || ! defined( _MD )))
+#if defined(PTW32_BUILD)
+__declspec( dllexport ) int * _errno( void );
+#else
+int * _errno( void );
+#endif
+#endif
+#endif
+#endif
+
+/*
+ * WIN32 C runtime library had been made thread-safe
+ * without affecting the user interface. Provide
+ * mappings from the UNIX thread-safe versions to
+ * the standard C runtime library calls.
+ * Only provide function mappings for functions that
+ * actually exist on WIN32.
+ */
+
+#if !defined(__MINGW32__)
+#define strtok_r( _s, _sep, _lasts ) \
+ ( *(_lasts) = strtok( (_s), (_sep) ) )
+#endif /* !__MINGW32__ */
+
+#define asctime_r( _tm, _buf ) \
+ ( strcpy( (_buf), asctime( (_tm) ) ), \
+ (_buf) )
+
+#define ctime_r( _clock, _buf ) \
+ ( strcpy( (_buf), ctime( (_clock) ) ), \
+ (_buf) )
+
+#define gmtime_r( _clock, _result ) \
+ ( *(_result) = *gmtime( (_clock) ), \
+ (_result) )
+
+#define localtime_r( _clock, _result ) \
+ ( *(_result) = *localtime( (_clock) ), \
+ (_result) )
+
+#define rand_r( _seed ) \
+ ( _seed == _seed? rand() : rand() )
+
+
+#ifdef __cplusplus
+
+/*
+ * Internal exceptions
+ */
+class ptw32_exception {};
+class ptw32_exception_cancel : public ptw32_exception {};
+class ptw32_exception_exit : public ptw32_exception {};
+
+#endif
+
+/* FIXME: This is only required if the library was built using SEH */
+/*
+ * Get internal SEH tag
+ */
+DWORD ptw32_get_exception_services_code(void);
+
+#ifndef PTW32_BUILD
+
+#ifdef __CLEANUP_SEH
+
+/*
+ * Redefine the SEH __except keyword to ensure that applications
+ * propagate our internal exceptions up to the library's internal handlers.
+ */
+#define __except( E ) \
+ __except( ( GetExceptionCode() == ptw32_get_exception_services_code() ) \
+ ? EXCEPTION_CONTINUE_SEARCH : ( E ) )
+
+#endif /* __CLEANUP_SEH */
+
+#ifdef __cplusplus
+
+/*
+ * Redefine the C++ catch keyword to ensure that applications
+ * propagate our internal exceptions up to the library's internal handlers.
+ */
+#ifdef _MSC_VER
+ /*
+ * WARNING: Replace any 'catch( ... )' with 'PtW32CatchAll'
+ * if you want Pthread-Win32 cancelation and pthread_exit to work.
+ */
+
+#ifndef PtW32NoCatchWarn
+
+#pragma message("When compiling applications with MSVC++ and C++ exception handling:")
+#pragma message(" Replace any 'catch( ... )' with 'PtW32CatchAll' in POSIX threads")
+#pragma message(" if you want POSIX thread cancelation and pthread_exit to work.")
+
+#endif
+
+#define PtW32CatchAll \
+ catch( ptw32_exception & ) { throw; } \
+ catch( ... )
+
+#else /* _MSC_VER */
+
+#define catch( E ) \
+ catch( ptw32_exception & ) { throw; } \
+ catch( E )
+
+#endif /* _MSC_VER */
+
+#endif /* __cplusplus */
+
+#endif /* ! PTW32_BUILD */
+
+#ifdef __cplusplus
+} /* End of extern "C" */
+#endif /* __cplusplus */
+
+#endif /* PTHREAD_H */
diff --git a/win32/include/pwd.h b/win32/include/pwd.h new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/win32/include/pwd.h diff --git a/win32/include/sched.h b/win32/include/sched.h new file mode 100644 index 000000000..c9aaeb8a4 --- /dev/null +++ b/win32/include/sched.h @@ -0,0 +1,89 @@ +/*
+ * Module: sched.h
+ *
+ * Purpose:
+ * Provides an implementation of POSIX realtime extensions
+ * as defined in
+ *
+ * POSIX 1003.1b-1993 (POSIX.1b)
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright (C) 1998
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA
+ */
+#ifndef _SCHED_H
+#define _SCHED_H
+
+#if defined(__MINGW32__) || defined(_UWIN)
+/* For pid_t */
+# include <sys/types.h>
+/* Required by Unix 98 */
+# include <time.h>
+#else
+typedef int pid_t;
+#endif
+
+/* Thread scheduling policies */
+
+enum {
+ SCHED_OTHER = 0,
+ SCHED_FIFO,
+ SCHED_RR,
+ SCHED_MIN = SCHED_OTHER,
+ SCHED_MAX = SCHED_RR
+};
+
+struct sched_param {
+ int sched_priority;
+};
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+int sched_yield (void);
+
+int sched_get_priority_min (int policy);
+
+int sched_get_priority_max (int policy);
+
+int sched_setscheduler (pid_t pid, int policy);
+
+int sched_getscheduler (pid_t pid);
+
+/*
+ * Note that this macro returns ENOTSUP rather than
+ * ENOSYS as might be expected. However, returning ENOSYS
+ * should mean that sched_get_priority_{min,max} are
+ * not implemented as well as sched_rr_get_interval.
+ * This is not the case, since we just don't support
+ * round-robin scheduling. Therefore I have chosen to
+ * return the same value as sched_setscheduler when
+ * SCHED_RR is passed to it.
+ */
+#define sched_rr_get_interval(_pid, _interval) \
+ ( errno = ENOTSUP, (int) -1 )
+
+
+#ifdef __cplusplus
+} /* End of extern "C" */
+#endif /* __cplusplus */
+
+
+#endif /* !_SCHED_H */
+
diff --git a/win32/include/semaphore.h b/win32/include/semaphore.h new file mode 100644 index 000000000..a0255cf6f --- /dev/null +++ b/win32/include/semaphore.h @@ -0,0 +1,101 @@ +/*
+ * Module: semaphore.h
+ *
+ * Purpose:
+ * Semaphores aren't actually part of the PThreads standard.
+ * They are defined by the POSIX Standard:
+ *
+ * POSIX 1003.1b-1993 (POSIX.1b)
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright (C) 1998
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA
+ */
+#if !defined( SEMAPHORE_H )
+#define SEMAPHORE_H
+
+/*
+ * This is a duplicate of what is in the autoconf config.h,
+ * which is only used when building the pthread-win32 libraries.
+ */
+
+#ifndef PTW32_CONFIG_H
+# if defined(WINCE)
+# define NEED_ERRNO
+# define NEED_SEM
+# endif
+# if defined(_UWIN) || defined(__MINGW32__)
+# define HAVE_MODE_T
+# endif
+#endif
+
+/*
+ *
+ */
+
+#ifdef NEED_SEM
+#include "need_errno.h"
+#else
+#include <errno.h>
+#endif
+
+#define _POSIX_SEMAPHORES
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+#ifndef HAVE_MODE_T
+typedef unsigned int mode_t;
+#endif
+
+
+typedef struct sem_t_ * sem_t;
+
+int sem_init (sem_t * sem,
+ int pshared,
+ unsigned int value);
+
+int sem_destroy (sem_t * sem);
+
+int sem_trywait (sem_t * sem);
+
+int sem_wait (sem_t * sem);
+
+int sem_post (sem_t * sem);
+
+int sem_post_multiple (sem_t * sem,
+ int count);
+
+int sem_open (const char * name,
+ int oflag,
+ mode_t mode,
+ unsigned int value);
+
+int sem_close (sem_t * sem);
+
+int sem_unlink (const char * name);
+
+int sem_getvalue (sem_t * sem,
+ int * sval);
+
+#ifdef __cplusplus
+} /* End of extern "C" */
+#endif /* __cplusplus */
+
+#endif /* !SEMAPHORE_H */
diff --git a/win32/include/sys/time.h b/win32/include/sys/time.h new file mode 100644 index 000000000..074a8a1e6 --- /dev/null +++ b/win32/include/sys/time.h @@ -0,0 +1,28 @@ +/*
+ * Copyright (C) 2000-2001 the xine project
+ *
+ * This file is part of xine, a unix video player.
+ *
+ * xine 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * xine 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * WIN32 PORT,
+ * by Matthew Grooms <elon@altavista.com>
+ *
+ * sys/time.h - There is no seperate sys/time.h for win32 so we simply
+ * include the standard time header as well as our xine
+ * timer functions.
+ */
+
+#include <time.h>
diff --git a/win32/include/timer.h b/win32/include/timer.h new file mode 100644 index 000000000..9be9d0557 --- /dev/null +++ b/win32/include/timer.h @@ -0,0 +1,39 @@ +#include <time.h>
+#include <winsock.h>
+#include "pthread.h"
+
+#ifndef _ITIMER_
+#define _ITIMER_
+
+#define ITIMER_REAL 0
+#define ITIMER_VIRTUAL 1
+
+// time reference
+// ----------------------------------
+//
+// 1,000 milliseconds / sec
+// 1,000,000 microseconds / sec
+// 1,000,000,000 nanoseconds / sec
+//
+// timeval.time_sec = seconds
+// timeval.time_usec = microseconds
+
+struct itimerval
+{
+ struct timeval it_interval; /* timer interval */
+ struct timeval it_value; /* current value */
+};
+
+struct timezone {
+ int tz_minuteswest; /* minutes west of Greenwich */
+ int tz_dsttime; /* type of dst correction */
+};
+
+int gettimeofday( struct timeval *tp, struct timezone *tzp );
+int setitimer( int which, struct itimerval * value, struct itimerval *ovalue );
+int pause( void );
+
+unsigned int sleep( unsigned int seconds );
+int nanosleep( const struct timespec *rqtp, struct timespec *rmtp );
+
+#endif
\ No newline at end of file diff --git a/win32/include/unistd.h b/win32/include/unistd.h new file mode 100644 index 000000000..22287d239 --- /dev/null +++ b/win32/include/unistd.h @@ -0,0 +1,58 @@ +/*
+ * Copyright (C) 2000-2001 the xine project
+ *
+ * This file is part of xine, a unix video player.
+ *
+ * xine 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * xine 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * WIN32 PORT,
+ * by Matthew Grooms <elon@altavista.com>
+ *
+ * unistd.h - This is mostly a catch all header that maps standard unix
+ * libc calls to the equivelent win32 functions.
+ *
+ */
+
+#include <windows.h>
+#include <malloc.h>
+#include <errno.h>
+#include <direct.h>
+
+#include "timer.h"
+
+#ifndef _SYS_UNISTD_H_
+#define _SYS_UNISTD_H_
+
+#define inline __inline
+
+#define mkdir( A, B ) _mkdir( A )
+#define lstat stat
+#define S_ISDIR(A) ( S_IFDIR & A )
+#define S_IXUSR S_IEXEC
+#define S_IXGRP S_IEXEC
+#define S_IXOTH S_IEXEC
+
+#define M_PI 3.14159265358979323846 /* pi */
+
+#define bzero( A, B ) memset( A, 0, B )
+#define strcasecmp _stricmp
+#define strncasecmp _strnicmp
+#define snprintf _snprintf
+#define vsnprintf _vsnprintf
+
+// FIXME : I dont remember why this is here
+#define readlink
+
+#endif
diff --git a/win32/include/xine/attributes.h b/win32/include/xine/attributes.h new file mode 100644 index 000000000..eac90ea9e --- /dev/null +++ b/win32/include/xine/attributes.h @@ -0,0 +1,44 @@ +/*
+ * attributes.h
+ * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
+ *
+ * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
+ *
+ * mpeg2dec 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * mpeg2dec 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* use gcc attribs to align critical data structures */
+
+#ifndef ATTRIBUTE_H_
+#define ATTRIBUTE_H_
+
+#ifdef ATTRIBUTE_ALIGNED_MAX
+#define ATTR_ALIGN(align) __attribute__ ((__aligned__ ((ATTRIBUTE_ALIGNED_MAX < align) ? ATTRIBUTE_ALIGNED_MAX : align)))
+#else
+#define ATTR_ALIGN(align)
+#endif
+
+/* disable GNU __attribute__ extension, when not compiling with GNU C */
+#if defined(__GNUC__)
+#ifndef ATTRIBUTE_PACKED
+#define ATTRIBUTE_PACKED 1
+#endif
+#else
+#undef ATTRIBUTE_PACKED
+#define __attribute__(x) /**/
+#endif
+
+#endif /* ATTRIBUTE_H_ */
+
diff --git a/win32/include/xine/compat.h b/win32/include/xine/compat.h new file mode 100644 index 000000000..6c2906f14 --- /dev/null +++ b/win32/include/xine/compat.h @@ -0,0 +1,58 @@ +/*
+ * Copyright (C) 2000-2001 the xine project
+ *
+ * This file is part of xine, a unix video player.
+ *
+ * xine 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * xine 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * $Id: compat.h,v 1.1 2003/04/20 16:42:10 guenter Exp $
+ *
+ */
+
+#ifndef XINE_COMPAT_H
+#define XINE_COMPAT_H
+
+#include <limits.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined _MSC_VER
+#define __XINE_FUNCTION__ __FILE__
+#elif defined __GNUC__
+#define __XINE_FUNCTION__ __FUNCTION__
+#else
+#define __XINE_FUNCTION__ __func__
+#endif
+
+#ifndef NAME_MAX
+#define XINE_NAME_MAX 256
+#else
+#define XINE_NAME_MAX NAME_MAX
+#endif
+
+#ifndef PATH_MAX
+#define XINE_PATH_MAX 768
+#else
+#define XINE_PATH_MAX PATH_MAX
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/win32/include/xine/xine.h b/win32/include/xine/xine.h new file mode 100644 index 000000000..193d7b7a9 --- /dev/null +++ b/win32/include/xine/xine.h @@ -0,0 +1,1580 @@ +/*
+ * Copyright (C) 2000-2002 the xine project
+ *
+ * This file is part of xine, a free video player.
+ *
+ * xine 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * xine 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * $Id: xine.h,v 1.1 2003/04/20 16:42:10 guenter Exp $
+ *
+ * public xine-lib (libxine) interface and documentation
+ *
+ *
+ * some programming guidelines about this api:
+ * -------------------------------------------
+ *
+ * (1) libxine has (per stream instance) a fairly static memory
+ * model
+ * (2) as a rule of thumb, never free() or realloc() any pointers
+ * returned by the xine engine (unless stated otherwise)
+ * or, in other words:
+ * do not free() stuff you have not malloc()ed
+ * (3) xine is multi-threaded, make sure your programming environment
+ * can handle this.
+ * for x11-related stuff this means that you either have to properly
+ * use xlockdisplay() or use two seperate connections to the x-server
+ *
+ */
+
+#ifndef HAVE_XINE_H
+#define HAVE_XINE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <inttypes.h>
+#include <sys/time.h>
+#include <time.h>
+
+
+/*********************************************************************
+ * xine opaque data types *
+ *********************************************************************/
+
+typedef struct xine_s xine_t;
+typedef struct xine_stream_s xine_stream_t;
+typedef struct xine_audio_port_s xine_audio_port_t;
+typedef struct xine_video_port_s xine_video_port_t;
+
+/* convenience types: simple player UIs might want to call ports drivers */
+typedef xine_audio_port_t xine_ao_driver_t;
+typedef xine_video_port_t xine_vo_driver_t;
+
+
+/*********************************************************************
+ * global engine handling *
+ *********************************************************************/
+
+/*
+ * version information
+ */
+
+/* dynamic info from actually linked libxine */
+const char *xine_get_version_string (void);
+void xine_get_version (int *major, int *minor, int *sub);
+
+/* compare given version to libxine version,
+ return 1 if compatible, 0 otherwise */
+int xine_check_version (int major, int minor, int sub) ;
+
+/* static info - which libxine release this header came from */
+#define XINE_MAJOR_VERSION 1
+#define XINE_MINOR_VERSION 0
+#define XINE_SUB_VERSION 0
+#define XINE_VERSION "1-beta10"
+
+/*
+ * pre-init the xine engine
+ *
+ * will first malloc and init a xine_t, create an empty config
+ * system, then scan through all installed plugins and add them
+ * to an internal list for later use.
+ *
+ * to fully init the xine engine, you have to load config values
+ * (either using your own storage method and calling
+ * xine_config_register_entry, or by using the xine_load_config
+ * utility function - see below) and then call xine_init
+ *
+ * the only proper way to shut down the xine engine is to
+ * call xine_exit() - do not try to free() the xine pointer
+ * yourself and do not try to access any internal data structures
+ */
+xine_t *xine_new (void);
+
+/*
+ * post_init the xine engine
+ */
+void xine_init (xine_t *self);
+
+/*
+ * helper functions to find and init audio/video drivers
+ * from xine's plugin collection
+ *
+ * id : identifier of the driver, may be NULL for auto-detection
+ * data : special data struct for ui/driver communications, depends
+ * on driver
+ * visual: video driver flavor selector, constants see below
+ *
+ * both functions may return NULL if driver failed to load, was not
+ * found ...
+ *
+ * use xine_close_audio/video_driver() to close loaded drivers
+ * and free resources allocated by them
+ */
+xine_audio_port_t *xine_open_audio_driver (xine_t *self, const char *id,
+ void *data);
+xine_video_port_t *xine_open_video_driver (xine_t *self, const char *id,
+ int visual, void *data);
+
+void xine_close_audio_driver (xine_t *self, xine_audio_port_t *driver);
+void xine_close_video_driver (xine_t *self, xine_video_port_t *driver);
+
+/* valid visual types */
+#define XINE_VISUAL_TYPE_NONE 0
+#define XINE_VISUAL_TYPE_X11 1
+#define XINE_VISUAL_TYPE_AA 2
+#define XINE_VISUAL_TYPE_FB 3
+#define XINE_VISUAL_TYPE_GTK 4
+#define XINE_VISUAL_TYPE_DFB 5
+#define XINE_VISUAL_TYPE_PM 6 /* used by the OS/2 port */
+#define XINE_VISUAL_TYPE_WIN32 7 /* used by the WIN32/_MSC_VER port */
+
+/*
+ * free all resources, close all plugins, close engine.
+ * self pointer is no longer valid after this call.
+ */
+void xine_exit (xine_t *self);
+
+
+/*********************************************************************
+ * stream handling *
+ *********************************************************************/
+
+/*
+ * create a new stream for media playback/access
+ *
+ * returns xine_stream_t* if OK,
+ * NULL on error (use xine_get_error for details)
+ *
+ * the only proper way to free the stream pointer returned by this
+ * function is to call xine_dispose() on it. do not try to access any
+ * fields in xine_stream_t, they're all private and subject to change
+ * without further notice.
+ */
+xine_stream_t *xine_stream_new (xine_t *self,
+ xine_audio_port_t *ao, xine_video_port_t *vo);
+
+/*
+ * Make one stream the slave of another.
+ * This establishes a binary master slave relation on streams, where
+ * certain operations (specified by parameter "affection") on the master
+ * stream are also applied to the slave stream.
+ * If you want more than one stream to react to one master, you have to
+ * apply the calls in a top down way:
+ * xine_stream_master_slave(stream1, stream2, 3);
+ * xine_stream_master_slave(stream2, stream3, 3);
+ * This will make stream1 affect stream2 and stream2 affect stream3, so
+ * effectively, operations on stream1 propagate to stream2 and 3.
+ *
+ * Please note that subsequent master_slave calls on the same streams
+ * will overwrite their previous master/slave setting.
+ * Be sure to not mess around.
+ *
+ * returns 1 on success, 0 on failure
+ */
+int xine_stream_master_slave(xine_stream_t *master, xine_stream_t *slave,
+ int affection);
+
+/* affection is some of the following ORed together: */
+/* playing the master plays the slave */
+#define XINE_MASTER_SLAVE_PLAY (1<<0)
+/* slave stops on master stop */
+#define XINE_MASTER_SLAVE_STOP (1<<1)
+
+/*
+ * open a stream
+ *
+ * look for input / demux / decoder plugins, find out about the format
+ * see if it is supported, set up internal buffers and threads
+ *
+ * returns 1 if OK, 0 on error (use xine_get_error for details)
+ */
+int xine_open (xine_stream_t *stream, const char *mrl);
+
+/*
+ * play a stream from a given position
+ *
+ * start_pos: 0..65535
+ * start_time: milliseconds
+ * if both start position parameters are != 0 start_pos will be used
+ * for non-seekable streams both values will be ignored
+ *
+ * returns 1 if OK, 0 on error (use xine_get_error for details)
+ */
+int xine_play (xine_stream_t *stream, int start_pos, int start_time);
+
+/*
+ * set xine to a trick mode for fast forward, backwards playback,
+ * low latency seeking. Please note that this works only with some
+ * input plugins. mode constants see below.
+ *
+ * returns 1 if OK, 0 on error (use xine_get_error for details)
+ */
+int xine_trick_mode (xine_stream_t *stream, int mode, int value);
+
+/* trick modes */
+#define XINE_TRICK_MODE_OFF 0
+#define XINE_TRICK_MODE_SEEK_TO_POSITION 1
+#define XINE_TRICK_MODE_SEEK_TO_TIME 2
+#define XINE_TRICK_MODE_FAST_FORWARD 3
+#define XINE_TRICK_MODE_FAST_REWIND 4
+
+/*
+ * stop stream playback
+ * xine_stream_t stays valid for new xine_open or xine_play
+ */
+void xine_stop (xine_stream_t *stream);
+
+/*
+ * stop stream playback, free all stream-related resources
+ * xine_stream_t stays valid for new xine_open
+ */
+void xine_close (xine_stream_t *stream);
+
+/*
+ * ask current/recent input plugin to eject media - may or may not work,
+ * depending on input plugin capabilities
+ */
+int xine_eject (xine_stream_t *stream);
+
+/*
+ * stop playback, dispose all stream-related resources
+ * xine_stream_t no longer valid when after this
+ */
+void xine_dispose (xine_stream_t *stream);
+
+/*
+ * set/get engine parameters.
+ */
+void xine_engine_set_param(xine_t *self, int param, int value);
+int xine_engine_get_param(xine_t *self, int param);
+
+#define XINE_ENGINE_PARAM_VERBOSITY 1
+
+/*
+ * set/get xine stream parameters
+ * e.g. playback speed, constants see below
+ */
+void xine_set_param (xine_stream_t *stream, int param, int value);
+int xine_get_param (xine_stream_t *stream, int param);
+
+/*
+ * xine engine parameters
+ */
+#define XINE_PARAM_SPEED 1 /* see below */
+#define XINE_PARAM_AV_OFFSET 2 /* unit: 1/90000 sec */
+#define XINE_PARAM_AUDIO_CHANNEL_LOGICAL 3 /* -1 => auto, -2 => off */
+#define XINE_PARAM_SPU_CHANNEL 4
+#define XINE_PARAM_VIDEO_CHANNEL 5
+#define XINE_PARAM_AUDIO_VOLUME 6 /* 0..100 */
+#define XINE_PARAM_AUDIO_MUTE 7 /* 1=>mute, 0=>unmute */
+#define XINE_PARAM_AUDIO_COMPR_LEVEL 8 /* <100=>off, % compress otherw*/
+#define XINE_PARAM_AUDIO_AMP_LEVEL 9 /* 0..200, 100=>100% (default) */
+#define XINE_PARAM_AUDIO_REPORT_LEVEL 10 /* 1=>send events, 0=> don't */
+#define XINE_PARAM_VERBOSITY 11 /* control console output */
+#define XINE_PARAM_SPU_OFFSET 12 /* unit: 1/90000 sec */
+#define XINE_PARAM_IGNORE_VIDEO 13 /* disable video decoding */
+#define XINE_PARAM_IGNORE_AUDIO 14 /* disable audio decoding */
+#define XINE_PARAM_IGNORE_SPU 15 /* disable spu decoding */
+#define XINE_PARAM_ENABLE_BROADCAST 16 /* (not implemented yet) */
+#define XINE_PARAM_METRONOM_PREBUFFER 17 /* unit: 1/90000 sec */
+
+
+/* speed values */
+#define XINE_SPEED_PAUSE 0
+#define XINE_SPEED_SLOW_4 1
+#define XINE_SPEED_SLOW_2 2
+#define XINE_SPEED_NORMAL 4
+#define XINE_SPEED_FAST_2 8
+#define XINE_SPEED_FAST_4 16
+
+/* video parameters */
+#define XINE_PARAM_VO_DEINTERLACE 0x01000000 /* bool */
+#define XINE_PARAM_VO_ASPECT_RATIO 0x01000001 /* see below */
+#define XINE_PARAM_VO_HUE 0x01000002 /* 0..65535 */
+#define XINE_PARAM_VO_SATURATION 0x01000003 /* 0..65535 */
+#define XINE_PARAM_VO_CONTRAST 0x01000004 /* 0..65535 */
+#define XINE_PARAM_VO_BRIGHTNESS 0x01000005 /* 0..65535 */
+#define XINE_PARAM_VO_ZOOM_X 0x01000008 /* percent */
+#define XINE_PARAM_VO_ZOOM_Y 0x0100000d /* percent */
+#define XINE_PARAM_VO_PAN_SCAN 0x01000009 /* bool */
+#define XINE_PARAM_VO_TVMODE 0x0100000a /* ??? */
+
+#define XINE_VO_ZOOM_STEP 100
+#define XINE_VO_ZOOM_MAX 400
+#define XINE_VO_ZOOM_MIN -85
+
+/* possible ratios for XINE_PARAM_VO_ASPECT_RATIO */
+#define XINE_VO_ASPECT_AUTO 0
+#define XINE_VO_ASPECT_SQUARE 1 /* 1:1 */
+#define XINE_VO_ASPECT_4_3 2 /* 4:3 */
+#define XINE_VO_ASPECT_ANAMORPHIC 3 /* 16:9 */
+#define XINE_VO_ASPECT_DVB 4 /* 1:2 */
+#define XINE_VO_ASPECT_NUM_RATIOS 5
+#define XINE_VO_ASPECT_PAN_SCAN 41
+#define XINE_VO_ASPECT_DONT_TOUCH 42
+
+/* stream format detection strategies */
+
+/* recognize stream type first by content then by extension. */
+#define XINE_DEMUX_DEFAULT_STRATEGY 0
+/* recognize stream type first by extension then by content. */
+#define XINE_DEMUX_REVERT_STRATEGY 1
+/* recognize stream type by content only. */
+#define XINE_DEMUX_CONTENT_STRATEGY 2
+/* recognize stream type by extension only. */
+#define XINE_DEMUX_EXTENSION_STRATEGY 3
+
+/* verbosity settings */
+#define XINE_VERBOSITY_NONE 0
+#define XINE_VERBOSITY_LOG 1
+#define XINE_VERBOSITY_DEBUG 2
+
+/*
+ * snapshot function
+ *
+ * image format can be YUV 4:2:0 or 4:2:2
+ * will copy the image data into memory that <img> points to
+ * (interleaved for yuv 4:2:2 or planary for 4:2:0)
+ *
+ * returns 1 on success, 0 failure.
+ */
+int xine_get_current_frame (xine_stream_t *stream,
+ int *width, int *height,
+ int *ratio_code, int *format,
+ uint8_t *img);
+
+/* xine image formats */
+#define XINE_IMGFMT_YV12 (('2'<<24)|('1'<<16)|('V'<<8)|'Y')
+#define XINE_IMGFMT_YUY2 (('2'<<24)|('Y'<<16)|('U'<<8)|'Y')
+
+
+/*********************************************************************
+ * media processing *
+ *********************************************************************/
+
+#ifdef XINE_ENABLE_EXPERIMENTAL_FEATURES
+
+/*
+ * access to decoded audio and video frames from a stream
+ * these functions are intended to provide the basis for
+ * re-encoding and other video processing applications
+ *
+ * warning: highly experimental
+ *
+ */
+
+xine_video_port_t *xine_new_framegrab_video_port (xine_t *self);
+
+typedef struct {
+
+ int64_t vpts; /* timestamp 1/90000 sec for a/v sync */
+ int64_t duration;
+ int width, height;
+ int colorspace; /* XINE_IMGFMT_* */
+ double aspect_ratio;
+
+ int pos_stream; /* bytes from stream start */
+ int pos_time; /* milliseconds */
+
+ uint8_t *data;
+ void *xine_frame; /* used internally by xine engine */
+} xine_video_frame_t;
+
+int xine_get_next_video_frame (xine_video_port_t *port,
+ xine_video_frame_t *frame);
+
+void xine_free_video_frame (xine_video_port_t *port, xine_video_frame_t *frame);
+
+xine_audio_port_t *xine_new_framegrab_audio_port (xine_t *self);
+
+typedef struct {
+
+ int64_t vpts; /* timestamp 1/90000 sec for a/v sync */
+ int num_samples;
+ int sample_rate;
+ int num_channels;
+ int bits_per_sample; /* per channel */
+
+ off_t pos_stream; /* bytes from stream start */
+ int pos_time; /* milliseconds */
+
+ uint8_t *data;
+ void *xine_frame; /* used internally by xine engine */
+} xine_audio_frame_t;
+
+int xine_get_next_audio_frame (xine_audio_port_t *port,
+ xine_audio_frame_t *frame);
+
+void xine_free_audio_frame (xine_audio_port_t *port, xine_audio_frame_t *frame);
+
+ /*
+ * maybe future aproach:
+ */
+
+int xine_get_video_frame (xine_stream_t *stream,
+ int timestamp, /* msec */
+ int *width, int *height,
+ int *ratio_code,
+ int *duration, /* msec */
+ int *format,
+ uint8_t *img);
+
+/* TODO: xine_get_audio_frame */
+
+#endif
+
+
+/*********************************************************************
+ * post plugin handling *
+ *********************************************************************/
+
+/*
+ * post effect plugin functions
+ *
+ * after the data leaves the decoder it can pass an arbitrary tree
+ * of post plugins allowing for effects to be applied to the video
+ * frames/audio buffers before they reach the output stage
+ */
+
+typedef struct xine_post_s xine_post_t;
+
+struct xine_post_s {
+
+ /* a NULL-terminated array of audio input ports this post plugin
+ * provides; you can hand these to other post plugin's outputs or
+ * pass them to the initialization of streams
+ */
+ xine_audio_port_t **audio_input;
+
+ /* a NULL-terminated array of video input ports this post plugin
+ * provides; you can hand these to other post plugin's outputs or
+ * pass them to the initialization of streams
+ */
+ xine_video_port_t **video_input;
+
+ /* the type of the post plugin
+ * one of XINE_POST_TYPE_* can be used here
+ */
+ int type;
+
+};
+
+/*
+ * initialize a post plugin
+ *
+ * returns xine_post_t* on success, NULL on failure
+ *
+ * Initializes the post plugin with the given name and connects its
+ * outputs to the NULL-terminated arrays of audio and video ports.
+ * Some plugins also care about the number of inputs you request
+ * (e.g. mixer plugins), others simply ignore this number.
+ */
+xine_post_t *xine_post_init(xine_t *xine, const char *name,
+ int inputs,
+ xine_audio_port_t **audio_target,
+ xine_video_port_t **video_target);
+
+/* get a list of all available post plugins */
+const char *const *xine_list_post_plugins(xine_t *xine);
+
+/* get a list of all post plugins of one type */
+const char *const *xine_list_post_plugins_typed(xine_t *xine, int type);
+
+/*
+ * post plugin input/output
+ *
+ * These structures encapsulate inputs/outputs for post plugins
+ * to transfer arbitrary data. Frontends can also provide inputs
+ * and outputs and connect them to post plugins to exchange data
+ * with them.
+ */
+
+typedef struct xine_post_in_s xine_post_in_t;
+typedef struct xine_post_out_s xine_post_out_t;
+
+struct xine_post_in_s {
+
+ /* the name identifying this input */
+ const char *name;
+
+ /* the datatype of this input, use one of XINE_POST_DATA_* here */
+ int type;
+
+ /* the data pointer; input is directed to this memory location,
+ * so you simply access the pointer to access the input data */
+ void *data;
+
+};
+
+struct xine_post_out_s {
+
+ /* the name identifying this output */
+ const char *name;
+
+ /* the datatype of this output, use one of XINE_POST_DATA_* here */
+ int type;
+
+ /* the data pointer; output should be directed to this memory location,
+ * so in the easy case you simply write through the pointer */
+ void *data;
+
+ /* this function is called, when the output should be redirected
+ * to another input, you sould set the data pointer to direct
+ * any output to this new input;
+ * a special situation is, when this function is called with a NULL
+ * argument: in this case you should disconnect the data pointer
+ * from any output and if necessary to avoid writing to some stray
+ * memory you should make it point to some dummy location,
+ * returns 1 on success, 0 on failure;
+ * if you do not implement rewiring, set this to NULL */
+ int (*rewire) (xine_post_out_t *self, void *data);
+
+};
+
+/* get a list of all inputs of a post plugin */
+const char *const *xine_post_list_inputs(xine_post_t *self);
+
+/* get a list of all outputs of a post plugin */
+const char *const *xine_post_list_outputs(xine_post_t *self);
+
+/* retrieve one specific input of a post plugin */
+const xine_post_in_t *xine_post_input(xine_post_t *self, char *name);
+
+/* retrieve one specific output of a post plugin */
+const xine_post_out_t *xine_post_output(xine_post_t *self, char *name);
+
+/*
+ * wire an input to an output
+ * returns 1 on success, 0 on failure
+ */
+int xine_post_wire(xine_post_out_t *source, xine_post_in_t *target);
+
+/*
+ * wire a video port to a video output
+ * This can be used to rewire different post plugins to the video output
+ * plugin layer. The ports you hand in at xine_post_init() will already
+ * be wired with the post plugin, so you need this function for
+ * _re_connecting only.
+ *
+ * returns 1 on success, 0 on failure
+ */
+int xine_post_wire_video_port(xine_post_out_t *source, xine_video_port_t *vo);
+
+/*
+ * wire an audio port to an audio output
+ * This can be used to rewire different post plugins to the audio output
+ * plugin layer. The ports you hand in at xine_post_init() will already
+ * be wired with the post plugin, so you need this function for
+ * _re_connecting only.
+ *
+ * returns 1 on success, 0 on failure
+ */
+int xine_post_wire_audio_port(xine_post_out_t *source, xine_audio_port_t *vo);
+
+/*
+ * Extracts an output for a stream. Use this to rewire the outputs of streams.
+ */
+xine_post_out_t * xine_get_video_source(xine_stream_t *stream);
+xine_post_out_t * xine_get_audio_source(xine_stream_t *stream);
+
+/*
+ * disposes the post plugin
+ * please make sure that no other post plugin and no stream is
+ * connected to any of this plugin's inputs
+ */
+void xine_post_dispose(xine_t *xine, xine_post_t *self);
+
+
+/* post plugin types */
+#define XINE_POST_TYPE_VIDEO_FILTER 0x010000
+#define XINE_POST_TYPE_VIDEO_VISUALIZATION 0x010001
+#define XINE_POST_TYPE_VIDEO_COMPOSE 0x010002
+#define XINE_POST_TYPE_AUDIO_FILTER 0x020000
+#define XINE_POST_TYPE_AUDIO_VISUALIZATION 0x020001
+
+
+/* post plugin data types */
+
+/* video port data
+ * input->data is a xine_video_port_t*
+ * output->data usually is a xine_video_port_t**
+ */
+#define XINE_POST_DATA_VIDEO 0
+
+/* audio port data
+ * input->data is a xine_audio_port_t*
+ * output->data usually is a xine_audio_port_t**
+ */
+#define XINE_POST_DATA_AUDIO 1
+
+/* integer data
+ * input->data is a int*
+ * output->data usually is a int*
+ */
+#define XINE_POST_DATA_INT 3
+
+/* double precision floating point data
+ * input->data is a double*
+ * output->data usually is a double*
+ */
+#define XINE_POST_DATA_DOUBLE 4
+
+
+/*********************************************************************
+ * information retrieval *
+ *********************************************************************/
+
+/*
+ * xine log functions
+ *
+ * frontends can display xine log output using these functions
+ */
+int xine_get_log_section_count(xine_t *self);
+
+/* return a NULL terminated array of log sections names */
+const char *const *xine_get_log_names(xine_t *self);
+
+/* print some log information to <buf> section */
+void xine_log (xine_t *self, int buf,
+ const char *format, ...);
+
+/* get log messages of specified section */
+const char *const *xine_get_log (xine_t *self, int buf);
+
+/* log callback will be called whenever something is logged */
+typedef void (*xine_log_cb_t) (void *user_data, int section);
+void xine_register_log_cb (xine_t *self, xine_log_cb_t cb,
+ void *user_data);
+
+/*
+ * error handling / engine status
+ */
+
+/* return last error */
+int xine_get_error (xine_stream_t *stream);
+
+/* get current xine engine status (constants see below) */
+int xine_get_status (xine_stream_t *stream);
+
+/*
+ * engine status codes
+ */
+#define XINE_STATUS_IDLE 0 /* no mrl assigned */
+#define XINE_STATUS_STOP 1
+#define XINE_STATUS_PLAY 2
+#define XINE_STATUS_QUIT 3
+
+/*
+ * xine error codes
+ */
+#define XINE_ERROR_NONE 0
+#define XINE_ERROR_NO_INPUT_PLUGIN 1
+#define XINE_ERROR_NO_DEMUX_PLUGIN 2
+#define XINE_ERROR_DEMUX_FAILED 3
+#define XINE_ERROR_MALFORMED_MRL 4
+
+/*
+ * try to find out audio/spu language of given channel
+ * (use -1 for current channel)
+ *
+ * returns 1 on success, 0 on failure
+ */
+int xine_get_audio_lang (xine_stream_t *stream, int channel,
+ char *lang);
+int xine_get_spu_lang (xine_stream_t *stream, int channel,
+ char *lang);
+
+/*
+ * get position / length information
+ *
+ * depending of the nature and system layer of the stream,
+ * some or all of this information may be unavailable or incorrect
+ * (e.g. live network streams may not have a valid length)
+ *
+ * returns 1 on success, 0 on failure (data was not updated,
+ * probably because it's not known yet... try again later)
+ */
+int xine_get_pos_length (xine_stream_t *stream,
+ int *pos_stream, /* 0..65535 */
+ int *pos_time, /* milliseconds */
+ int *length_time);/* milliseconds */
+
+/*
+ * get information about the stream such as
+ * video width/height, codecs, audio format, title, author...
+ *
+ * constants see below
+ */
+uint32_t xine_get_stream_info (xine_stream_t *stream, int info);
+const char *xine_get_meta_info (xine_stream_t *stream, int info);
+
+/* xine_get_stream_info */
+#define XINE_STREAM_INFO_BITRATE 0
+#define XINE_STREAM_INFO_SEEKABLE 1
+#define XINE_STREAM_INFO_VIDEO_WIDTH 2
+#define XINE_STREAM_INFO_VIDEO_HEIGHT 3
+#define XINE_STREAM_INFO_VIDEO_RATIO 4 /* *10000 */
+#define XINE_STREAM_INFO_VIDEO_CHANNELS 5
+#define XINE_STREAM_INFO_VIDEO_STREAMS 6
+#define XINE_STREAM_INFO_VIDEO_BITRATE 7
+#define XINE_STREAM_INFO_VIDEO_FOURCC 8
+#define XINE_STREAM_INFO_VIDEO_HANDLED 9 /* codec available? */
+#define XINE_STREAM_INFO_FRAME_DURATION 10 /* 1/90000 sec */
+#define XINE_STREAM_INFO_AUDIO_CHANNELS 11
+#define XINE_STREAM_INFO_AUDIO_BITS 12
+#define XINE_STREAM_INFO_AUDIO_SAMPLERATE 13
+#define XINE_STREAM_INFO_AUDIO_BITRATE 14
+#define XINE_STREAM_INFO_AUDIO_FOURCC 15
+#define XINE_STREAM_INFO_AUDIO_HANDLED 16 /* codec available? */
+#define XINE_STREAM_INFO_HAS_CHAPTERS 17
+#define XINE_STREAM_INFO_HAS_VIDEO 18
+#define XINE_STREAM_INFO_HAS_AUDIO 19
+#define XINE_STREAM_INFO_IGNORE_VIDEO 20
+#define XINE_STREAM_INFO_IGNORE_AUDIO 21
+#define XINE_STREAM_INFO_IGNORE_SPU 22
+#define XINE_STREAM_INFO_VIDEO_HAS_STILL 23
+#define XINE_STREAM_INFO_MAX_AUDIO_CHANNEL 24
+#define XINE_STREAM_INFO_MAX_SPU_CHANNEL 25
+#define XINE_STREAM_INFO_AUDIO_MODE 26
+
+/* xine_get_meta_info */
+#define XINE_META_INFO_TITLE 0
+#define XINE_META_INFO_COMMENT 1
+#define XINE_META_INFO_ARTIST 2
+#define XINE_META_INFO_GENRE 3
+#define XINE_META_INFO_ALBUM 4
+#define XINE_META_INFO_YEAR 5
+#define XINE_META_INFO_VIDEOCODEC 6
+#define XINE_META_INFO_AUDIOCODEC 7
+#define XINE_META_INFO_SYSTEMLAYER 8
+#define XINE_META_INFO_INPUT_PLUGIN 9
+
+
+/*********************************************************************
+ * plugin management / autoplay / mrl browsing *
+ *********************************************************************/
+
+/*
+ * note: the pointers to strings or string arrays returned
+ * by some of these functions are pointers to statically
+ * alloced internal xine memory chunks.
+ * they're only valid between xine function calls
+ * and should never be free()d.
+ */
+
+typedef struct {
+ char *origin; /* file plugin: path */
+ char *mrl; /* <type>://<location> */
+ char *link;
+ uint32_t type; /* see below */
+ off_t size; /* size of this source, may be 0 */
+} xine_mrl_t;
+
+/* mrl types */
+#define XINE_MRL_TYPE_unknown (0 << 0)
+#define XINE_MRL_TYPE_dvd (1 << 0)
+#define XINE_MRL_TYPE_vcd (1 << 1)
+#define XINE_MRL_TYPE_net (1 << 2)
+#define XINE_MRL_TYPE_rtp (1 << 3)
+#define XINE_MRL_TYPE_stdin (1 << 4)
+#define XINE_MRL_TYPE_cda (1 << 5)
+#define XINE_MRL_TYPE_file (1 << 6)
+#define XINE_MRL_TYPE_file_fifo (1 << 7)
+#define XINE_MRL_TYPE_file_chardev (1 << 8)
+#define XINE_MRL_TYPE_file_directory (1 << 9)
+#define XINE_MRL_TYPE_file_blockdev (1 << 10)
+#define XINE_MRL_TYPE_file_normal (1 << 11)
+#define XINE_MRL_TYPE_file_symlink (1 << 12)
+#define XINE_MRL_TYPE_file_sock (1 << 13)
+#define XINE_MRL_TYPE_file_exec (1 << 14)
+#define XINE_MRL_TYPE_file_backup (1 << 15)
+#define XINE_MRL_TYPE_file_hidden (1 << 16)
+
+/* get a list of browsable input plugin ids */
+const char *const *xine_get_browsable_input_plugin_ids (xine_t *self) ;
+
+/*
+ * ask input plugin named <plugin_id> to return
+ * a list of available MRLs in domain/directory <start_mrl>.
+ *
+ * <start_mrl> may be NULL indicating the toplevel domain/dir
+ * returns <start_mrl> if <start_mrl> is a valid MRL, not a directory
+ * returns NULL if <start_mrl> is an invalid MRL, not even a directory.
+ */
+xine_mrl_t **xine_get_browse_mrls (xine_t *self,
+ const char *plugin_id,
+ const char *start_mrl,
+ int *num_mrls);
+
+/* get a list of plugins that support the autoplay feature */
+const char *const *xine_get_autoplay_input_plugin_ids (xine_t *self);
+
+/* get autoplay MRL list from input plugin named <plugin_id> */
+char **xine_get_autoplay_mrls (xine_t *self,
+ const char *plugin_id,
+ int *num_mrls);
+
+/* get a list of file extensions for file types supported by xine
+ * the list is separated by spaces
+ *
+ * the pointer returned can be free()ed when no longer used */
+char *xine_get_file_extensions (xine_t *self);
+
+/* get a list of mime types supported by xine
+ *
+ * the pointer returned can be free()ed when no longer used */
+char *xine_get_mime_types (xine_t *self);
+
+/* get the demuxer identifier that handles a given mime type
+ *
+ * the pointer returned can be free()ed when no longer used
+ * returns NULL if no demuxer is available to handle this. */
+char *xine_get_demux_for_mime_type (xine_t *self, const char *mime_type);
+
+/* get a description string for an input plugin */
+const char *xine_get_input_plugin_description (xine_t *self,
+ const char *plugin_id);
+
+/* get lists of available audio and video output plugins */
+const char *const *xine_list_audio_output_plugins (xine_t *self) ;
+const char *const *xine_list_video_output_plugins (xine_t *self) ;
+
+
+/*********************************************************************
+ * visual specific gui <-> xine engine communication *
+ *********************************************************************/
+
+/* talk to video output driver - old method */
+int xine_gui_send_vo_data (xine_stream_t *self,
+ int type, void *data);
+
+/* new (preferred) method to talk to video driver. */
+int xine_port_send_gui_data (xine_video_port_t *vo,
+ int type, void *data);
+
+typedef struct {
+
+ /* area of that drawable to be used by video */
+ int x,y,w,h;
+
+} x11_rectangle_t;
+
+/*
+ * this is the visual data struct any x11 gui
+ * must supply to the xine_open_video_driver call
+ * ("data" parameter)
+ */
+typedef struct {
+
+ /* some information about the display */
+ void *display; /* Display* */
+ int screen;
+
+ /* drawable to display the video in/on */
+ unsigned long d; /* Drawable */
+
+ void *user_data;
+
+ /*
+ * dest size callback
+ *
+ * this will be called by the video driver to find out
+ * how big the video output area size will be for a
+ * given video size. The ui should _not_ adjust it's
+ * video out area, just do some calculations and return
+ * the size. This will be called for every frame, ui
+ * implementation should be fast.
+ * dest_pixel_aspect should be set to the used display pixel aspect.
+ * NOTE: Semantics has changed: video_width and video_height
+ * are no longer pixel aspect corrected. Get the old semantics
+ * in the UI with
+ * *dest_pixel_aspect = display_pixel_aspect;
+ * if (video_pixel_aspect >= display_pixel_aspect)
+ * video_width = video_width * video_pixel_aspect / display_pixel_aspect + .5;
+ * else
+ * video_height = video_height * display_pixel_aspect / video_pixel_aspect + .5;
+ */
+ void (*dest_size_cb) (void *user_data,
+ int video_width, int video_height,
+ double video_pixel_aspect,
+ int *dest_width, int *dest_height,
+ double *dest_pixel_aspect);
+
+ /*
+ * frame output callback
+ *
+ * this will be called by the video driver for every frame
+ * it's about to draw. ui can adapt it's size if necessary
+ * here.
+ * note: the ui doesn't have to adjust itself to this
+ * size, this is just to be taken as a hint.
+ * ui must return the actual size of the video output
+ * area and the video output driver will do it's best
+ * to adjust the video frames to that size (while
+ * preserving aspect ratio and stuff).
+ * dest_x, dest_y: offset inside window
+ * dest_width, dest_height: available drawing space
+ * dest_pixel_aspect: display pixel aspect
+ * win_x, win_y: window absolute screen position
+ * NOTE: Semantics has changed: video_width and video_height
+ * are no longer pixel aspect corrected. Get the old semantics
+ * in the UI with
+ * *dest_pixel_aspect = display_pixel_aspect;
+ * if (video_pixel_aspect >= display_pixel_aspect)
+ * video_width = video_width * video_pixel_aspect / display_pixel_aspect + .5;
+ * else
+ * video_height = video_height * display_pixel_aspect / video_pixel_aspect + .5;
+ */
+ void (*frame_output_cb) (void *user_data,
+ int video_width, int video_height,
+ double video_pixel_aspect,
+ int *dest_x, int *dest_y,
+ int *dest_width, int *dest_height,
+ double *dest_pixel_aspect,
+ int *win_x, int *win_y);
+
+} x11_visual_t;
+
+/*
+ * this is the visual data struct any fb gui
+ * may supply to the xine_open_video_driver call
+ * ("data" parameter) to get frame_output_cd calls
+ */
+
+typedef struct {
+
+ void (*frame_output_cb) (void *user_data,
+ int video_width, int video_height,
+ double video_pixel_aspect,
+ int *dest_x, int *dest_y,
+ int *dest_width, int *dest_height,
+ double *dest_pixel_aspect,
+ int *win_x, int *win_y);
+
+ void *user_data;
+
+} fb_visual_t;
+
+/*
+ * "type" constants for xine_gui_send_vo_data (...)
+ */
+
+/* xevent *data */
+#define XINE_GUI_SEND_COMPLETION_EVENT 1
+
+/* Drawable data */
+#define XINE_GUI_SEND_DRAWABLE_CHANGED 2
+
+/* xevent *data */
+#define XINE_GUI_SEND_EXPOSE_EVENT 3
+
+/* x11_rectangle_t *data */
+#define XINE_GUI_SEND_TRANSLATE_GUI_TO_VIDEO 4
+
+/* int data */
+#define XINE_GUI_SEND_VIDEOWIN_VISIBLE 5
+
+/* *data contains chosen visual, select a new one or change it to NULL
+ * to indicate the visual to use or that no visual will work */
+/* XVisualInfo **data */
+#define XINE_GUI_SEND_SELECT_VISUAL 8
+
+
+/*********************************************************************
+ * xine health check stuff *
+ *********************************************************************/
+
+#define XINE_HEALTH_CHECK_OK 0
+#define XINE_HEALTH_CHECK_FAIL 1
+#define XINE_HEALTH_CHECK_UNSUPPORTED 2
+#define XINE_HEALTH_CHECK_NO_SUCH_CHECK 3
+
+#define CHECK_KERNEL 0
+#define CHECK_MTRR 1
+#define CHECK_CDROM 2
+#define CHECK_DVDROM 3
+#define CHECK_DMA 4
+#define CHECK_X 5
+#define CHECK_XV 6
+
+struct xine_health_check_s {
+ int status;
+ const char* cdrom_dev;
+ const char* dvd_dev;
+ char* msg;
+ char* title;
+ char* explanation;
+};
+
+typedef struct xine_health_check_s xine_health_check_t;
+xine_health_check_t* xine_health_check(xine_health_check_t*, int check_num);
+
+
+/*********************************************************************
+ * configuration system *
+ *********************************************************************/
+
+/*
+ * config entry data types
+ */
+
+#define XINE_CONFIG_TYPE_UNKNOWN 0
+#define XINE_CONFIG_TYPE_RANGE 1
+#define XINE_CONFIG_TYPE_STRING 2
+#define XINE_CONFIG_TYPE_ENUM 3
+#define XINE_CONFIG_TYPE_NUM 4
+#define XINE_CONFIG_TYPE_BOOL 5
+
+typedef struct xine_cfg_entry_s xine_cfg_entry_t;
+
+typedef void (*xine_config_cb_t) (void *user_data,
+ xine_cfg_entry_t *entry);
+struct xine_cfg_entry_s {
+ const char *key; /* unique id (example: gui.logo_mrl) */
+
+ int type;
+
+ /* type unknown */
+ char *unknown_value;
+
+ /* type string */
+ char *str_value;
+ char *str_default;
+ char *str_sticky;
+
+ /* common to range, enum, num, bool: */
+ int num_value;
+ int num_default;
+
+ /* type range specific: */
+ int range_min;
+ int range_max;
+
+ /* type enum specific: */
+ char **enum_values;
+
+ /* help info for the user */
+ const char *description;
+ const char *help;
+
+ /* user experience level */
+ int exp_level; /* 0 => beginner,
+ 10 => advanced user,
+ 20 => expert */
+
+ /* callback function and data for live changeable values */
+ xine_config_cb_t callback;
+ void *callback_data;
+
+};
+
+const char *xine_config_register_string (xine_t *self,
+ const char *key,
+ const char *def_value,
+ const char *description,
+ const char *help,
+ int exp_level,
+ xine_config_cb_t changed_cb,
+ void *cb_data);
+
+int xine_config_register_range (xine_t *self,
+ const char *key,
+ int def_value,
+ int min, int max,
+ const char *description,
+ const char *help,
+ int exp_level,
+ xine_config_cb_t changed_cb,
+ void *cb_data);
+
+int xine_config_register_enum (xine_t *self,
+ const char *key,
+ int def_value,
+ char **values,
+ const char *description,
+ const char *help,
+ int exp_level,
+ xine_config_cb_t changed_cb,
+ void *cb_data);
+
+int xine_config_register_num (xine_t *self,
+ const char *key,
+ int def_value,
+ const char *description,
+ const char *help,
+ int exp_level,
+ xine_config_cb_t changed_cb,
+ void *cb_data);
+
+int xine_config_register_bool (xine_t *self,
+ const char *key,
+ int def_value,
+ const char *description,
+ const char *help,
+ int exp_level,
+ xine_config_cb_t changed_cb,
+ void *cb_data);
+
+/*
+ * the following functions will copy data from the internal xine_config
+ * data database to the xine_cfg_entry_t *entry you provide
+ *
+ * they return 1 on success, 0 on failure
+ */
+
+/* get first config item */
+int xine_config_get_first_entry (xine_t *self, xine_cfg_entry_t *entry);
+
+/* get next config item (iterate through the items) */
+int xine_config_get_next_entry (xine_t *self, xine_cfg_entry_t *entry);
+
+/* search for a config entry by key */
+int xine_config_lookup_entry (xine_t *self, const char *key,
+ xine_cfg_entry_t *entry);
+
+/*
+ * update a config entry (which was returned from lookup_entry() )
+ *
+ * xine will make a deep copy of the data in the entry into it's internal
+ * config database.
+ */
+void xine_config_update_entry (xine_t *self,
+ const xine_cfg_entry_t *entry);
+
+/*
+ * load/save config data from/to afile (e.g. $HOME/.xine/config)
+ */
+void xine_config_load (xine_t *self, const char *cfg_filename);
+void xine_config_save (xine_t *self, const char *cfg_filename);
+void xine_config_reset (xine_t *self);
+
+
+/*********************************************************************
+ * asynchroneous xine event mechanism *
+ *********************************************************************/
+
+/*
+ * to receive events you have to register an event queue with
+ * the xine engine (xine_event_new_queue, see below).
+ *
+ * then you can either
+ * 1) check for incoming events regularly (xine_event_get/wait),
+ * process them and free them using xine_event_free
+ * 2) use xine_event_create_listener_thread and specify a callback
+ * which will then be called for each event
+ *
+ * to send events to every module listening you don't need
+ * to register an event queue but simply call xine_event_send.
+ */
+
+/* event types */
+#define XINE_EVENT_UI_PLAYBACK_FINISHED 1 /* frontend can e.g. move on to next playlist entry */
+#define XINE_EVENT_UI_CHANNELS_CHANGED 2 /* inform ui that new channel info is available */
+#define XINE_EVENT_UI_SET_TITLE 3 /* request title display change in ui */
+#define XINE_EVENT_UI_MESSAGE 4 /* message (dialog) for the ui to display */
+#define XINE_EVENT_FRAME_FORMAT_CHANGE 5 /* e.g. aspect ratio change during dvd playback */
+#define XINE_EVENT_AUDIO_LEVEL 6 /* report current audio level (l/r) */
+#define XINE_EVENT_QUIT 7 /* last event sent when stream is disposed */
+#define XINE_EVENT_PROGRESS 8 /* index creation/network connections */
+#define XINE_EVENT_MRL_REFERENCE 9 /* demuxer->frontend: MRL reference(s) for the real stream */
+#define XINE_EVENT_UI_NUM_BUTTONS 10 /* number of buttons for interactive menus */
+
+/* input events coming from frontend */
+#define XINE_EVENT_INPUT_MOUSE_BUTTON 101
+#define XINE_EVENT_INPUT_MOUSE_MOVE 102
+#define XINE_EVENT_INPUT_MENU1 103
+#define XINE_EVENT_INPUT_MENU2 104
+#define XINE_EVENT_INPUT_MENU3 105
+#define XINE_EVENT_INPUT_MENU4 106
+#define XINE_EVENT_INPUT_MENU5 107
+#define XINE_EVENT_INPUT_MENU6 108
+#define XINE_EVENT_INPUT_MENU7 109
+#define XINE_EVENT_INPUT_UP 110
+#define XINE_EVENT_INPUT_DOWN 111
+#define XINE_EVENT_INPUT_LEFT 112
+#define XINE_EVENT_INPUT_RIGHT 113
+#define XINE_EVENT_INPUT_SELECT 114
+#define XINE_EVENT_INPUT_NEXT 115
+#define XINE_EVENT_INPUT_PREVIOUS 116
+#define XINE_EVENT_INPUT_ANGLE_NEXT 117
+#define XINE_EVENT_INPUT_ANGLE_PREVIOUS 118
+#define XINE_EVENT_INPUT_BUTTON_FORCE 119
+#define XINE_EVENT_INPUT_NUMBER_0 120
+#define XINE_EVENT_INPUT_NUMBER_1 121
+#define XINE_EVENT_INPUT_NUMBER_2 122
+#define XINE_EVENT_INPUT_NUMBER_3 123
+#define XINE_EVENT_INPUT_NUMBER_4 124
+#define XINE_EVENT_INPUT_NUMBER_5 125
+#define XINE_EVENT_INPUT_NUMBER_6 126
+#define XINE_EVENT_INPUT_NUMBER_7 127
+#define XINE_EVENT_INPUT_NUMBER_8 128
+#define XINE_EVENT_INPUT_NUMBER_9 129
+#define XINE_EVENT_INPUT_NUMBER_10_ADD 130
+
+/* specific event types */
+#define XINE_EVENT_SET_V4L2 200
+#define XINE_EVENT_PVR_SAVE 201
+#define XINE_EVENT_PVR_REPORT_NAME 202
+#define XINE_EVENT_PVR_REALTIME 203
+
+/*
+ * xine event struct
+ */
+typedef struct {
+ int type; /* event type (constants see above) */
+ xine_stream_t *stream; /* stream this event belongs to */
+
+ void *data; /* contents depending on type */
+ int data_length;
+
+ /* you do not have to provide this, it will be filled in by xine_event_send() */
+ struct timeval tv; /* timestamp of event creation */
+} xine_event_t;
+
+/*
+ * input event dynamic data
+ */
+typedef struct {
+ xine_event_t event;
+ uint8_t button; /* Generally 1 = left, 2 = mid, 3 = right */
+ uint16_t x,y; /* In Image space */
+} xine_input_data_t;
+
+/*
+ * UI event dynamic data - send information to/from UI.
+ */
+typedef struct {
+ int num_buttons;
+ int str_len;
+ char str[256]; /* might be longer */
+} xine_ui_data_t;
+
+/*
+ * Send messages to UI. used mostly to report errors.
+ */
+typedef struct {
+ /*
+ * old xine-ui versions expect xine_ui_data_t type.
+ * this struct is added for compatibility.
+ */
+ xine_ui_data_t compatibility;
+
+ /* See XINE_MSG_xxx for defined types. */
+ int type;
+
+ /* defined types are provided with a standard explanation.
+ * note: zero means no explanation.
+ */
+ int explanation; /* add to struct address to get a valid (char *) */
+
+ /* parameters are zero terminated strings */
+ int num_parameters;
+ int parameters; /* add to struct address to get a valid (char *) */
+
+ /* where messages are stored, will be longer
+ *
+ * this field begins with the message text itself (\0-terminated),
+ * followed by (optional) \0-terminated parameter strings
+ * the end marker is \0 \0
+ */
+ char messages[1];
+} xine_ui_message_data_t;
+
+
+/*
+ * notify frame format change
+ */
+typedef struct {
+ int width;
+ int height;
+ int aspect;
+} xine_format_change_data_t;
+
+/*
+ * audio level for left/right channel
+ */
+typedef struct {
+ int left;
+ int right; /* 0..255 */
+} xine_audio_level_data_t;
+
+/*
+ * index generation / buffering
+ */
+typedef struct {
+ const char *description; /* e.g. "connecting..." */
+ int percent;
+} xine_progress_data_t;
+
+/*
+ * mrl reference data is sent by demuxers when a reference stream is found.
+ * this stream just contains pointers (urls) to the real data, which are
+ * passed to frontend using this event type. (examples: .asx, .mov and .ram)
+ *
+ * ideally, frontends should add these mrls to a "hierarchical playlist".
+ * that is, instead of the original file, the ones provided here should be
+ * played instead. on pratice, just using a simple playlist should work.
+ *
+ * mrl references should be played in the same order they are received, just
+ * after the current stream finishes.
+ * alternative playlists may be provided and should be used in case of
+ * failure of the primary playlist.
+ */
+typedef struct {
+ int alternative; /* alternative playlist number, usually 0 */
+ char mrl[1]; /* might (will) be longer */
+} xine_mrl_reference_data_t;
+
+
+#ifdef XINE_ENABLE_EXPERIMENTAL_FEATURES
+
+/*
+ * configuration options for video4linux-like input plugins
+ */
+typedef struct {
+ /* input selection */
+ int input; /* select active input from card */
+ int channel; /* channel number */
+ int radio; /* ask for a radio channel */
+ uint32_t frequency; /* frequency divided by 62.5KHz or 62.5 Hz */
+ uint32_t transmission; /* The transmission standard. */
+
+ /* video parameters */
+ uint32_t framerate_numerator; /* framerate as numerator/denominator */
+ uint32_t framerate_denominator;
+ uint32_t framelines; /* Total lines per frame including blanking */
+ uint32_t colorstandard; /* One of the V4L2_COLOR_STD_* values */
+ uint32_t colorsubcarrier; /* The color subcarrier frequency */
+ int frame_width; /* scaled frame width */
+ int frame_height; /* scaled frame height */
+
+ /* used by pvr plugin */
+ int32_t session_id; /* -1 stops pvr recording */
+} xine_set_v4l2_data_t;
+
+/*
+ * ask pvr to save (ie. do not discard) the current session
+ * see comments on input_pvr.c to understand how it works.
+ */
+typedef struct {
+ /* mode values:
+ * -1 = do nothing, just set the name
+ * 0 = truncate current session and save from now on
+ * 1 = save from last sync point
+ * 2 = save everything on current session
+ */
+ int mode;
+ int id;
+ char name[256]; /* name for saving, might be longer */
+} xine_pvr_save_data_t;
+
+typedef struct {
+ /* mode values:
+ * 0 = non realtime
+ * 1 = realtime
+ */
+ int mode;
+} xine_pvr_realtime_t;
+
+#endif
+
+/*
+ * Defined message types for XINE_EVENT_UI_MESSAGE
+ * This is the mechanism to report async errors from engine.
+ *
+ * If frontend knows about the XINE_MSG_xxx type it may safely
+ * ignore the 'explanation' field and provide it's own custom
+ * dialog to the 'parameters'.
+ *
+ * right column specifies the usual parameters.
+ */
+
+#define XINE_MSG_NO_ERROR 0 /* (messages to UI) */
+#define XINE_MSG_GENERAL_WARNING 1 /* (warning message) */
+#define XINE_MSG_UNKNOWN_HOST 2 /* (host name) */
+#define XINE_MSG_UNKNOWN_DEVICE 3 /* (device name) */
+#define XINE_MSG_NETWORK_UNREACHABLE 4 /* none */
+#define XINE_MSG_CONNECTION_REFUSED 5 /* (host name) */
+#define XINE_MSG_FILE_NOT_FOUND 6 /* (file name or mrl) */
+#define XINE_MSG_READ_ERROR 7 /* (device/file/mrl) */
+#define XINE_MSG_LIBRARY_LOAD_ERROR 8 /* (library/decoder) */
+#define XINE_MSG_ENCRYPTED_SOURCE 9 /* none */
+
+/* opaque xine_event_queue_t */
+typedef struct xine_event_queue_s xine_event_queue_t;
+
+/*
+ * register a new event queue
+ *
+ * you have to receive messages from this queue regularly
+ *
+ * use xine_event_dispose_queue to unregister and free the queue
+ */
+xine_event_queue_t *xine_event_new_queue (xine_stream_t *stream);
+void xine_event_dispose_queue (xine_event_queue_t *queue);
+
+/*
+ * receive events (poll)
+ *
+ * use xine_event_free on the events received from these calls
+ * when they're no longer needed
+ */
+xine_event_t *xine_event_get (xine_event_queue_t *queue);
+xine_event_t *xine_event_wait (xine_event_queue_t *queue);
+void xine_event_free (xine_event_t *event);
+
+/*
+ * receive events (callback)
+ *
+ * a thread is created which will receive all events from
+ * the specified queue, call your callback on each of them
+ * and will then free the event when your callback returns
+ *
+ */
+typedef void (*xine_event_listener_cb_t) (void *user_data,
+ const xine_event_t *event);
+void xine_event_create_listener_thread (xine_event_queue_t *queue,
+ xine_event_listener_cb_t callback,
+ void *user_data);
+
+/*
+ * send an event to all queues
+ *
+ * the event will be copied so you can free or reuse
+ * *event as soon as xine_event_send returns.
+ */
+void xine_event_send (xine_stream_t *stream, const xine_event_t *event);
+
+
+/*********************************************************************
+ * OSD (on screen display) *
+ *********************************************************************/
+
+#define XINE_TEXT_PALETTE_SIZE 11
+
+#define XINE_OSD_TEXT1 (0 * XINE_TEXT_PALETTE_SIZE)
+#define XINE_OSD_TEXT2 (1 * XINE_TEXT_PALETTE_SIZE)
+#define XINE_OSD_TEXT3 (2 * XINE_TEXT_PALETTE_SIZE)
+#define XINE_OSD_TEXT4 (3 * XINE_TEXT_PALETTE_SIZE)
+#define XINE_OSD_TEXT5 (4 * XINE_TEXT_PALETTE_SIZE)
+#define XINE_OSD_TEXT6 (5 * XINE_TEXT_PALETTE_SIZE)
+#define XINE_OSD_TEXT7 (6 * XINE_TEXT_PALETTE_SIZE)
+#define XINE_OSD_TEXT8 (7 * XINE_TEXT_PALETTE_SIZE)
+#define XINE_OSD_TEXT9 (8 * XINE_TEXT_PALETTE_SIZE)
+#define XINE_OSD_TEXT10 (9 * XINE_TEXT_PALETTE_SIZE)
+
+/* white text, black border, transparent background */
+#define XINE_TEXTPALETTE_WHITE_BLACK_TRANSPARENT 0
+/* white text, noborder, transparent background */
+#define XINE_TEXTPALETTE_WHITE_NONE_TRANSPARENT 1
+/* white text, no border, translucid background */
+#define XINE_TEXTPALETTE_WHITE_NONE_TRANSLUCID 2
+/* yellow text, black border, transparent background */
+#define XINE_TEXTPALETTE_YELLOW_BLACK_TRANSPARENT 3
+
+typedef struct xine_osd_s xine_osd_t;
+
+xine_osd_t *xine_osd_new (xine_stream_t *self, int x, int y,
+ int width, int height);
+void xine_osd_draw_point (xine_osd_t *self, int x, int y, int color);
+
+void xine_osd_draw_line (xine_osd_t *self, int x1, int y1,
+ int x2, int y2, int color);
+void xine_osd_draw_rect (xine_osd_t *self, int x1, int y1,
+ int x2, int y2,
+ int color, int filled );
+/* for freetype2 fonts x1 and y1 specifies the beginning of the baseline,
+ for xine fonts x1 and y1 specifies the upper left corner of the text
+ to be rendered */
+void xine_osd_draw_text (xine_osd_t *self, int x1, int y1,
+ const char *text, int color_base);
+void xine_osd_draw_bitmap (xine_osd_t *self, uint8_t *bitmap,
+ int x1, int y1, int width, int height,
+ uint8_t *palette_map);
+/* for freetype2 fonts the height is taken from _baseline_ to top */
+void xine_osd_get_text_size (xine_osd_t *self, const char *text,
+ int *width, int *height);
+/* with freetype2 support compiled in, you can also specify a font file
+ as 'fontname' here */
+void xine_osd_set_font (xine_osd_t *self, const char *fontname,
+ int size);
+/* set position were overlay will be blended */
+void xine_osd_set_position (xine_osd_t *self, int x, int y);
+void xine_osd_show (xine_osd_t *self, int64_t vpts);
+void xine_osd_hide (xine_osd_t *self, int64_t vpts);
+/* empty drawing area */
+void xine_osd_clear (xine_osd_t *self);
+/*
+ * close osd rendering engine
+ * loaded fonts are unloaded
+ * osd objects are closed
+ */
+void xine_osd_free (xine_osd_t *self);
+void xine_osd_set_palette (xine_osd_t *self,
+ const uint32_t *const color,
+ const uint8_t *const trans );
+/*
+ * set on existing text palette
+ * (-1 to set used specified palette)
+ *
+ * color_base specifies the first color index to use for this text
+ * palette. The OSD palette is then modified starting at this
+ * color index, up to the size of the text palette.
+ *
+ * Use OSD_TEXT1, OSD_TEXT2, ... for some preassigned color indices.
+ */
+void xine_osd_set_text_palette (xine_osd_t *self,
+ int palette_number,
+ int color_base );
+/* get palette (color and transparency) */
+void xine_osd_get_palette (xine_osd_t *self, uint32_t *color,
+ uint8_t *trans);
+
+
+/*********************************************************************
+ * TV-mode API, to make it possible to use nvtvd to view movies *
+ *********************************************************************/
+
+/* connect to nvtvd server and save current TV and X settings */
+void xine_tvmode_init (xine_t *self);
+
+/* try to change TV state if enabled
+ * type select 'regular' (0) or 'TV' (1) state
+ * width frame width the mode should match best or 0 if unknown
+ * height frame height the mode should match best or 0 if unknown
+ * fps frame rate the mode should match best or 0 if unknown
+ * returns: finally selected state
+ */
+int xine_tvmode_switch (xine_t *self, int type, int width, int height, double fps);
+
+/* adapt (maximum) output size to visible area if necessary and return pixel
+ * aspect and real frame rate if available
+ */
+void xine_tvmode_size (xine_t *self, int *width, int *height,
+ double *pixelratio, double *fps);
+
+/* restore old TV and X settings and close nvtvd connection */
+void xine_tvmode_exit (xine_t *self);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/win32/include/xine/xineutils.h b/win32/include/xine/xineutils.h new file mode 100644 index 000000000..33696e718 --- /dev/null +++ b/win32/include/xine/xineutils.h @@ -0,0 +1,957 @@ +/*
+ * Copyright (C) 2000-2002 the xine project
+ *
+ * This file is part of xine, a free video player.
+ *
+ * xine 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * xine 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * $Id: xineutils.h,v 1.1 2003/04/20 16:42:10 guenter Exp $
+ *
+ */
+#ifndef XINEUTILS_H
+#define XINEUTILS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <inttypes.h>
+#include <pthread.h>
+#include "attributes.h"
+#include "compat.h"
+#include "xmlparser.h"
+#include "xine_buffer.h"
+#include "configfile.h"
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <string.h>
+
+#if defined(__SUNPRO_C) || !defined(XINE_COMPILE)
+#define inline
+#endif
+
+ /*
+ * debugable mutexes
+ */
+
+ typedef struct {
+ pthread_mutex_t mutex;
+ char id[80];
+ char *locked_by;
+ } xine_mutex_t;
+
+ int xine_mutex_init (xine_mutex_t *mutex, const pthread_mutexattr_t *mutexattr,
+ char *id);
+
+ int xine_mutex_lock (xine_mutex_t *mutex, char *who);
+ int xine_mutex_unlock (xine_mutex_t *mutex, char *who);
+ int xine_mutex_destroy (xine_mutex_t *mutex);
+
+
+
+ /* CPU Acceleration */
+
+/*
+ * The type of an value that fits in an MMX register (note that long
+ * long constant values MUST be suffixed by LL and unsigned long long
+ * values by ULL, lest they be truncated by the compiler)
+ */
+
+/* generic accelerations */
+#define MM_ACCEL_MLIB 0x00000001
+
+/* x86 accelerations */
+#define MM_ACCEL_X86_MMX 0x80000000
+#define MM_ACCEL_X86_3DNOW 0x40000000
+#define MM_ACCEL_X86_MMXEXT 0x20000000
+#define MM_ACCEL_X86_SSE 0x10000000
+#define MM_ACCEL_X86_SSE2 0x08000000
+/* powerpc accelerations */
+#define MM_ACCEL_PPC_ALTIVEC 0x04000000
+/* x86 compat defines */
+#define MM_MMX MM_ACCEL_X86_MMX
+#define MM_3DNOW MM_ACCEL_X86_3DNOW
+#define MM_MMXEXT MM_ACCEL_X86_MMXEXT
+#define MM_SSE MM_ACCEL_X86_SSE
+#define MM_SSE2 MM_ACCEL_X86_SSE2
+
+uint32_t xine_mm_accel (void);
+/* uint32_t xine_mm_support (void) ; */
+
+#ifdef ARCH_X86
+
+typedef union {
+#ifdef _MSC_VER
+ int64_t q; /* Quadword (64-bit) value */
+ uint64_t uq; /* Unsigned Quadword */
+#else
+ long long q; /* Quadword (64-bit) value */
+ unsigned long long uq; /* Unsigned Quadword */
+#endif
+ int d[2]; /* 2 Doubleword (32-bit) values */
+ unsigned int ud[2]; /* 2 Unsigned Doubleword */
+ short w[4]; /* 4 Word (16-bit) values */
+ unsigned short uw[4]; /* 4 Unsigned Word */
+ char b[8]; /* 8 Byte (8-bit) values */
+ unsigned char ub[8]; /* 8 Unsigned Byte */
+ float s[2]; /* Single-precision (32-bit) value */
+} ATTR_ALIGN(8) mmx_t; /* On an 8-byte (64-bit) boundary */
+
+
+
+#define mmx_i2r(op,imm,reg) \
+ __asm__ __volatile__ (#op " %0, %%" #reg \
+ : /* nothing */ \
+ : "i" (imm) )
+
+#define mmx_m2r(op,mem,reg) \
+ __asm__ __volatile__ (#op " %0, %%" #reg \
+ : /* nothing */ \
+ : "m" (mem))
+
+#define mmx_r2m(op,reg,mem) \
+ __asm__ __volatile__ (#op " %%" #reg ", %0" \
+ : "=m" (mem) \
+ : /* nothing */ )
+
+#define mmx_r2r(op,regs,regd) \
+ __asm__ __volatile__ (#op " %" #regs ", %" #regd)
+
+
+#define emms() __asm__ __volatile__ ("emms")
+
+#define movd_m2r(var,reg) mmx_m2r (movd, var, reg)
+#define movd_r2m(reg,var) mmx_r2m (movd, reg, var)
+#define movd_r2r(regs,regd) mmx_r2r (movd, regs, regd)
+
+#define movq_m2r(var,reg) mmx_m2r (movq, var, reg)
+#define movq_r2m(reg,var) mmx_r2m (movq, reg, var)
+#define movq_r2r(regs,regd) mmx_r2r (movq, regs, regd)
+
+#define packssdw_m2r(var,reg) mmx_m2r (packssdw, var, reg)
+#define packssdw_r2r(regs,regd) mmx_r2r (packssdw, regs, regd)
+#define packsswb_m2r(var,reg) mmx_m2r (packsswb, var, reg)
+#define packsswb_r2r(regs,regd) mmx_r2r (packsswb, regs, regd)
+
+#define packuswb_m2r(var,reg) mmx_m2r (packuswb, var, reg)
+#define packuswb_r2r(regs,regd) mmx_r2r (packuswb, regs, regd)
+
+#define paddb_m2r(var,reg) mmx_m2r (paddb, var, reg)
+#define paddb_r2r(regs,regd) mmx_r2r (paddb, regs, regd)
+#define paddd_m2r(var,reg) mmx_m2r (paddd, var, reg)
+#define paddd_r2r(regs,regd) mmx_r2r (paddd, regs, regd)
+#define paddw_m2r(var,reg) mmx_m2r (paddw, var, reg)
+#define paddw_r2r(regs,regd) mmx_r2r (paddw, regs, regd)
+
+#define paddsb_m2r(var,reg) mmx_m2r (paddsb, var, reg)
+#define paddsb_r2r(regs,regd) mmx_r2r (paddsb, regs, regd)
+#define paddsw_m2r(var,reg) mmx_m2r (paddsw, var, reg)
+#define paddsw_r2r(regs,regd) mmx_r2r (paddsw, regs, regd)
+
+#define paddusb_m2r(var,reg) mmx_m2r (paddusb, var, reg)
+#define paddusb_r2r(regs,regd) mmx_r2r (paddusb, regs, regd)
+#define paddusw_m2r(var,reg) mmx_m2r (paddusw, var, reg)
+#define paddusw_r2r(regs,regd) mmx_r2r (paddusw, regs, regd)
+
+#define pand_m2r(var,reg) mmx_m2r (pand, var, reg)
+#define pand_r2r(regs,regd) mmx_r2r (pand, regs, regd)
+
+#define pandn_m2r(var,reg) mmx_m2r (pandn, var, reg)
+#define pandn_r2r(regs,regd) mmx_r2r (pandn, regs, regd)
+
+#define pcmpeqb_m2r(var,reg) mmx_m2r (pcmpeqb, var, reg)
+#define pcmpeqb_r2r(regs,regd) mmx_r2r (pcmpeqb, regs, regd)
+#define pcmpeqd_m2r(var,reg) mmx_m2r (pcmpeqd, var, reg)
+#define pcmpeqd_r2r(regs,regd) mmx_r2r (pcmpeqd, regs, regd)
+#define pcmpeqw_m2r(var,reg) mmx_m2r (pcmpeqw, var, reg)
+#define pcmpeqw_r2r(regs,regd) mmx_r2r (pcmpeqw, regs, regd)
+
+#define pcmpgtb_m2r(var,reg) mmx_m2r (pcmpgtb, var, reg)
+#define pcmpgtb_r2r(regs,regd) mmx_r2r (pcmpgtb, regs, regd)
+#define pcmpgtd_m2r(var,reg) mmx_m2r (pcmpgtd, var, reg)
+#define pcmpgtd_r2r(regs,regd) mmx_r2r (pcmpgtd, regs, regd)
+#define pcmpgtw_m2r(var,reg) mmx_m2r (pcmpgtw, var, reg)
+#define pcmpgtw_r2r(regs,regd) mmx_r2r (pcmpgtw, regs, regd)
+
+#define pmaddwd_m2r(var,reg) mmx_m2r (pmaddwd, var, reg)
+#define pmaddwd_r2r(regs,regd) mmx_r2r (pmaddwd, regs, regd)
+
+#define pmulhw_m2r(var,reg) mmx_m2r (pmulhw, var, reg)
+#define pmulhw_r2r(regs,regd) mmx_r2r (pmulhw, regs, regd)
+
+#define pmullw_m2r(var,reg) mmx_m2r (pmullw, var, reg)
+#define pmullw_r2r(regs,regd) mmx_r2r (pmullw, regs, regd)
+
+#define por_m2r(var,reg) mmx_m2r (por, var, reg)
+#define por_r2r(regs,regd) mmx_r2r (por, regs, regd)
+
+#define pslld_i2r(imm,reg) mmx_i2r (pslld, imm, reg)
+#define pslld_m2r(var,reg) mmx_m2r (pslld, var, reg)
+#define pslld_r2r(regs,regd) mmx_r2r (pslld, regs, regd)
+#define psllq_i2r(imm,reg) mmx_i2r (psllq, imm, reg)
+#define psllq_m2r(var,reg) mmx_m2r (psllq, var, reg)
+#define psllq_r2r(regs,regd) mmx_r2r (psllq, regs, regd)
+#define psllw_i2r(imm,reg) mmx_i2r (psllw, imm, reg)
+#define psllw_m2r(var,reg) mmx_m2r (psllw, var, reg)
+#define psllw_r2r(regs,regd) mmx_r2r (psllw, regs, regd)
+
+#define psrad_i2r(imm,reg) mmx_i2r (psrad, imm, reg)
+#define psrad_m2r(var,reg) mmx_m2r (psrad, var, reg)
+#define psrad_r2r(regs,regd) mmx_r2r (psrad, regs, regd)
+#define psraw_i2r(imm,reg) mmx_i2r (psraw, imm, reg)
+#define psraw_m2r(var,reg) mmx_m2r (psraw, var, reg)
+#define psraw_r2r(regs,regd) mmx_r2r (psraw, regs, regd)
+
+#define psrld_i2r(imm,reg) mmx_i2r (psrld, imm, reg)
+#define psrld_m2r(var,reg) mmx_m2r (psrld, var, reg)
+#define psrld_r2r(regs,regd) mmx_r2r (psrld, regs, regd)
+#define psrlq_i2r(imm,reg) mmx_i2r (psrlq, imm, reg)
+#define psrlq_m2r(var,reg) mmx_m2r (psrlq, var, reg)
+#define psrlq_r2r(regs,regd) mmx_r2r (psrlq, regs, regd)
+#define psrlw_i2r(imm,reg) mmx_i2r (psrlw, imm, reg)
+#define psrlw_m2r(var,reg) mmx_m2r (psrlw, var, reg)
+#define psrlw_r2r(regs,regd) mmx_r2r (psrlw, regs, regd)
+
+#define psubb_m2r(var,reg) mmx_m2r (psubb, var, reg)
+#define psubb_r2r(regs,regd) mmx_r2r (psubb, regs, regd)
+#define psubd_m2r(var,reg) mmx_m2r (psubd, var, reg)
+#define psubd_r2r(regs,regd) mmx_r2r (psubd, regs, regd)
+#define psubw_m2r(var,reg) mmx_m2r (psubw, var, reg)
+#define psubw_r2r(regs,regd) mmx_r2r (psubw, regs, regd)
+
+#define psubsb_m2r(var,reg) mmx_m2r (psubsb, var, reg)
+#define psubsb_r2r(regs,regd) mmx_r2r (psubsb, regs, regd)
+#define psubsw_m2r(var,reg) mmx_m2r (psubsw, var, reg)
+#define psubsw_r2r(regs,regd) mmx_r2r (psubsw, regs, regd)
+
+#define psubusb_m2r(var,reg) mmx_m2r (psubusb, var, reg)
+#define psubusb_r2r(regs,regd) mmx_r2r (psubusb, regs, regd)
+#define psubusw_m2r(var,reg) mmx_m2r (psubusw, var, reg)
+#define psubusw_r2r(regs,regd) mmx_r2r (psubusw, regs, regd)
+
+#define punpckhbw_m2r(var,reg) mmx_m2r (punpckhbw, var, reg)
+#define punpckhbw_r2r(regs,regd) mmx_r2r (punpckhbw, regs, regd)
+#define punpckhdq_m2r(var,reg) mmx_m2r (punpckhdq, var, reg)
+#define punpckhdq_r2r(regs,regd) mmx_r2r (punpckhdq, regs, regd)
+#define punpckhwd_m2r(var,reg) mmx_m2r (punpckhwd, var, reg)
+#define punpckhwd_r2r(regs,regd) mmx_r2r (punpckhwd, regs, regd)
+
+#define punpcklbw_m2r(var,reg) mmx_m2r (punpcklbw, var, reg)
+#define punpcklbw_r2r(regs,regd) mmx_r2r (punpcklbw, regs, regd)
+#define punpckldq_m2r(var,reg) mmx_m2r (punpckldq, var, reg)
+#define punpckldq_r2r(regs,regd) mmx_r2r (punpckldq, regs, regd)
+#define punpcklwd_m2r(var,reg) mmx_m2r (punpcklwd, var, reg)
+#define punpcklwd_r2r(regs,regd) mmx_r2r (punpcklwd, regs, regd)
+
+#define pxor_m2r(var,reg) mmx_m2r (pxor, var, reg)
+#define pxor_r2r(regs,regd) mmx_r2r (pxor, regs, regd)
+
+
+/* 3DNOW extensions */
+
+#define pavgusb_m2r(var,reg) mmx_m2r (pavgusb, var, reg)
+#define pavgusb_r2r(regs,regd) mmx_r2r (pavgusb, regs, regd)
+
+
+/* AMD MMX extensions - also available in intel SSE */
+
+
+#define mmx_m2ri(op,mem,reg,imm) \
+ __asm__ __volatile__ (#op " %1, %0, %%" #reg \
+ : /* nothing */ \
+ : "X" (mem), "X" (imm))
+#define mmx_r2ri(op,regs,regd,imm) \
+ __asm__ __volatile__ (#op " %0, %%" #regs ", %%" #regd \
+ : /* nothing */ \
+ : "X" (imm) )
+
+#define mmx_fetch(mem,hint) \
+ __asm__ __volatile__ ("prefetch" #hint " %0" \
+ : /* nothing */ \
+ : "X" (mem))
+
+
+#define maskmovq(regs,maskreg) mmx_r2ri (maskmovq, regs, maskreg)
+
+#define movntq_r2m(mmreg,var) mmx_r2m (movntq, mmreg, var)
+
+#define pavgb_m2r(var,reg) mmx_m2r (pavgb, var, reg)
+#define pavgb_r2r(regs,regd) mmx_r2r (pavgb, regs, regd)
+#define pavgw_m2r(var,reg) mmx_m2r (pavgw, var, reg)
+#define pavgw_r2r(regs,regd) mmx_r2r (pavgw, regs, regd)
+
+#define pextrw_r2r(mmreg,reg,imm) mmx_r2ri (pextrw, mmreg, reg, imm)
+
+#define pinsrw_r2r(reg,mmreg,imm) mmx_r2ri (pinsrw, reg, mmreg, imm)
+
+#define pmaxsw_m2r(var,reg) mmx_m2r (pmaxsw, var, reg)
+#define pmaxsw_r2r(regs,regd) mmx_r2r (pmaxsw, regs, regd)
+
+#define pmaxub_m2r(var,reg) mmx_m2r (pmaxub, var, reg)
+#define pmaxub_r2r(regs,regd) mmx_r2r (pmaxub, regs, regd)
+
+#define pminsw_m2r(var,reg) mmx_m2r (pminsw, var, reg)
+#define pminsw_r2r(regs,regd) mmx_r2r (pminsw, regs, regd)
+
+#define pminub_m2r(var,reg) mmx_m2r (pminub, var, reg)
+#define pminub_r2r(regs,regd) mmx_r2r (pminub, regs, regd)
+
+#define pmovmskb(mmreg,reg) \
+ __asm__ __volatile__ ("movmskps %" #mmreg ", %" #reg)
+
+#define pmulhuw_m2r(var,reg) mmx_m2r (pmulhuw, var, reg)
+#define pmulhuw_r2r(regs,regd) mmx_r2r (pmulhuw, regs, regd)
+
+#define prefetcht0(mem) mmx_fetch (mem, t0)
+#define prefetcht1(mem) mmx_fetch (mem, t1)
+#define prefetcht2(mem) mmx_fetch (mem, t2)
+#define prefetchnta(mem) mmx_fetch (mem, nta)
+
+#define psadbw_m2r(var,reg) mmx_m2r (psadbw, var, reg)
+#define psadbw_r2r(regs,regd) mmx_r2r (psadbw, regs, regd)
+
+#define pshufw_m2r(var,reg,imm) mmx_m2ri(pshufw, var, reg, imm)
+#define pshufw_r2r(regs,regd,imm) mmx_r2ri(pshufw, regs, regd, imm)
+
+#define sfence() __asm__ __volatile__ ("sfence\n\t")
+
+typedef union {
+ float sf[4]; /* Single-precision (32-bit) value */
+} ATTR_ALIGN(16) sse_t; /* On a 16 byte (128-bit) boundary */
+
+
+#define sse_i2r(op, imm, reg) \
+ __asm__ __volatile__ (#op " %0, %%" #reg \
+ : /* nothing */ \
+ : "X" (imm) )
+
+#define sse_m2r(op, mem, reg) \
+ __asm__ __volatile__ (#op " %0, %%" #reg \
+ : /* nothing */ \
+ : "X" (mem))
+
+#define sse_r2m(op, reg, mem) \
+ __asm__ __volatile__ (#op " %%" #reg ", %0" \
+ : "=X" (mem) \
+ : /* nothing */ )
+
+#define sse_r2r(op, regs, regd) \
+ __asm__ __volatile__ (#op " %" #regs ", %" #regd)
+
+#define sse_r2ri(op, regs, regd, imm) \
+ __asm__ __volatile__ (#op " %0, %%" #regs ", %%" #regd \
+ : /* nothing */ \
+ : "X" (imm) )
+
+#define sse_m2ri(op, mem, reg, subop) \
+ __asm__ __volatile__ (#op " %0, %%" #reg ", " #subop \
+ : /* nothing */ \
+ : "X" (mem))
+
+
+#define movaps_m2r(var, reg) sse_m2r(movaps, var, reg)
+#define movaps_r2m(reg, var) sse_r2m(movaps, reg, var)
+#define movaps_r2r(regs, regd) sse_r2r(movaps, regs, regd)
+
+#define movntps_r2m(xmmreg, var) sse_r2m(movntps, xmmreg, var)
+
+#define movups_m2r(var, reg) sse_m2r(movups, var, reg)
+#define movups_r2m(reg, var) sse_r2m(movups, reg, var)
+#define movups_r2r(regs, regd) sse_r2r(movups, regs, regd)
+
+#define movhlps_r2r(regs, regd) sse_r2r(movhlps, regs, regd)
+
+#define movlhps_r2r(regs, regd) sse_r2r(movlhps, regs, regd)
+
+#define movhps_m2r(var, reg) sse_m2r(movhps, var, reg)
+#define movhps_r2m(reg, var) sse_r2m(movhps, reg, var)
+
+#define movlps_m2r(var, reg) sse_m2r(movlps, var, reg)
+#define movlps_r2m(reg, var) sse_r2m(movlps, reg, var)
+
+#define movss_m2r(var, reg) sse_m2r(movss, var, reg)
+#define movss_r2m(reg, var) sse_r2m(movss, reg, var)
+#define movss_r2r(regs, regd) sse_r2r(movss, regs, regd)
+
+#define shufps_m2r(var, reg, index) sse_m2ri(shufps, var, reg, index)
+#define shufps_r2r(regs, regd, index) sse_r2ri(shufps, regs, regd, index)
+
+#define cvtpi2ps_m2r(var, xmmreg) sse_m2r(cvtpi2ps, var, xmmreg)
+#define cvtpi2ps_r2r(mmreg, xmmreg) sse_r2r(cvtpi2ps, mmreg, xmmreg)
+
+#define cvtps2pi_m2r(var, mmreg) sse_m2r(cvtps2pi, var, mmreg)
+#define cvtps2pi_r2r(xmmreg, mmreg) sse_r2r(cvtps2pi, mmreg, xmmreg)
+
+#define cvttps2pi_m2r(var, mmreg) sse_m2r(cvttps2pi, var, mmreg)
+#define cvttps2pi_r2r(xmmreg, mmreg) sse_r2r(cvttps2pi, mmreg, xmmreg)
+
+#define cvtsi2ss_m2r(var, xmmreg) sse_m2r(cvtsi2ss, var, xmmreg)
+#define cvtsi2ss_r2r(reg, xmmreg) sse_r2r(cvtsi2ss, reg, xmmreg)
+
+#define cvtss2si_m2r(var, reg) sse_m2r(cvtss2si, var, reg)
+#define cvtss2si_r2r(xmmreg, reg) sse_r2r(cvtss2si, xmmreg, reg)
+
+#define cvttss2si_m2r(var, reg) sse_m2r(cvtss2si, var, reg)
+#define cvttss2si_r2r(xmmreg, reg) sse_r2r(cvtss2si, xmmreg, reg)
+
+#define movmskps(xmmreg, reg) \
+ __asm__ __volatile__ ("movmskps %" #xmmreg ", %" #reg)
+
+#define addps_m2r(var, reg) sse_m2r(addps, var, reg)
+#define addps_r2r(regs, regd) sse_r2r(addps, regs, regd)
+
+#define addss_m2r(var, reg) sse_m2r(addss, var, reg)
+#define addss_r2r(regs, regd) sse_r2r(addss, regs, regd)
+
+#define subps_m2r(var, reg) sse_m2r(subps, var, reg)
+#define subps_r2r(regs, regd) sse_r2r(subps, regs, regd)
+
+#define subss_m2r(var, reg) sse_m2r(subss, var, reg)
+#define subss_r2r(regs, regd) sse_r2r(subss, regs, regd)
+
+#define mulps_m2r(var, reg) sse_m2r(mulps, var, reg)
+#define mulps_r2r(regs, regd) sse_r2r(mulps, regs, regd)
+
+#define mulss_m2r(var, reg) sse_m2r(mulss, var, reg)
+#define mulss_r2r(regs, regd) sse_r2r(mulss, regs, regd)
+
+#define divps_m2r(var, reg) sse_m2r(divps, var, reg)
+#define divps_r2r(regs, regd) sse_r2r(divps, regs, regd)
+
+#define divss_m2r(var, reg) sse_m2r(divss, var, reg)
+#define divss_r2r(regs, regd) sse_r2r(divss, regs, regd)
+
+#define rcpps_m2r(var, reg) sse_m2r(rcpps, var, reg)
+#define rcpps_r2r(regs, regd) sse_r2r(rcpps, regs, regd)
+
+#define rcpss_m2r(var, reg) sse_m2r(rcpss, var, reg)
+#define rcpss_r2r(regs, regd) sse_r2r(rcpss, regs, regd)
+
+#define rsqrtps_m2r(var, reg) sse_m2r(rsqrtps, var, reg)
+#define rsqrtps_r2r(regs, regd) sse_r2r(rsqrtps, regs, regd)
+
+#define rsqrtss_m2r(var, reg) sse_m2r(rsqrtss, var, reg)
+#define rsqrtss_r2r(regs, regd) sse_r2r(rsqrtss, regs, regd)
+
+#define sqrtps_m2r(var, reg) sse_m2r(sqrtps, var, reg)
+#define sqrtps_r2r(regs, regd) sse_r2r(sqrtps, regs, regd)
+
+#define sqrtss_m2r(var, reg) sse_m2r(sqrtss, var, reg)
+#define sqrtss_r2r(regs, regd) sse_r2r(sqrtss, regs, regd)
+
+#define andps_m2r(var, reg) sse_m2r(andps, var, reg)
+#define andps_r2r(regs, regd) sse_r2r(andps, regs, regd)
+
+#define andnps_m2r(var, reg) sse_m2r(andnps, var, reg)
+#define andnps_r2r(regs, regd) sse_r2r(andnps, regs, regd)
+
+#define orps_m2r(var, reg) sse_m2r(orps, var, reg)
+#define orps_r2r(regs, regd) sse_r2r(orps, regs, regd)
+
+#define xorps_m2r(var, reg) sse_m2r(xorps, var, reg)
+#define xorps_r2r(regs, regd) sse_r2r(xorps, regs, regd)
+
+#define maxps_m2r(var, reg) sse_m2r(maxps, var, reg)
+#define maxps_r2r(regs, regd) sse_r2r(maxps, regs, regd)
+
+#define maxss_m2r(var, reg) sse_m2r(maxss, var, reg)
+#define maxss_r2r(regs, regd) sse_r2r(maxss, regs, regd)
+
+#define minps_m2r(var, reg) sse_m2r(minps, var, reg)
+#define minps_r2r(regs, regd) sse_r2r(minps, regs, regd)
+
+#define minss_m2r(var, reg) sse_m2r(minss, var, reg)
+#define minss_r2r(regs, regd) sse_r2r(minss, regs, regd)
+
+#define cmpps_m2r(var, reg, op) sse_m2ri(cmpps, var, reg, op)
+#define cmpps_r2r(regs, regd, op) sse_r2ri(cmpps, regs, regd, op)
+
+#define cmpeqps_m2r(var, reg) sse_m2ri(cmpps, var, reg, 0)
+#define cmpeqps_r2r(regs, regd) sse_r2ri(cmpps, regs, regd, 0)
+
+#define cmpltps_m2r(var, reg) sse_m2ri(cmpps, var, reg, 1)
+#define cmpltps_r2r(regs, regd) sse_r2ri(cmpps, regs, regd, 1)
+
+#define cmpleps_m2r(var, reg) sse_m2ri(cmpps, var, reg, 2)
+#define cmpleps_r2r(regs, regd) sse_r2ri(cmpps, regs, regd, 2)
+
+#define cmpunordps_m2r(var, reg) sse_m2ri(cmpps, var, reg, 3)
+#define cmpunordps_r2r(regs, regd) sse_r2ri(cmpps, regs, regd, 3)
+
+#define cmpneqps_m2r(var, reg) sse_m2ri(cmpps, var, reg, 4)
+#define cmpneqps_r2r(regs, regd) sse_r2ri(cmpps, regs, regd, 4)
+
+#define cmpnltps_m2r(var, reg) sse_m2ri(cmpps, var, reg, 5)
+#define cmpnltps_r2r(regs, regd) sse_r2ri(cmpps, regs, regd, 5)
+
+#define cmpnleps_m2r(var, reg) sse_m2ri(cmpps, var, reg, 6)
+#define cmpnleps_r2r(regs, regd) sse_r2ri(cmpps, regs, regd, 6)
+
+#define cmpordps_m2r(var, reg) sse_m2ri(cmpps, var, reg, 7)
+#define cmpordps_r2r(regs, regd) sse_r2ri(cmpps, regs, regd, 7)
+
+#define cmpss_m2r(var, reg, op) sse_m2ri(cmpss, var, reg, op)
+#define cmpss_r2r(regs, regd, op) sse_r2ri(cmpss, regs, regd, op)
+
+#define cmpeqss_m2r(var, reg) sse_m2ri(cmpss, var, reg, 0)
+#define cmpeqss_r2r(regs, regd) sse_r2ri(cmpss, regs, regd, 0)
+
+#define cmpltss_m2r(var, reg) sse_m2ri(cmpss, var, reg, 1)
+#define cmpltss_r2r(regs, regd) sse_r2ri(cmpss, regs, regd, 1)
+
+#define cmpless_m2r(var, reg) sse_m2ri(cmpss, var, reg, 2)
+#define cmpless_r2r(regs, regd) sse_r2ri(cmpss, regs, regd, 2)
+
+#define cmpunordss_m2r(var, reg) sse_m2ri(cmpss, var, reg, 3)
+#define cmpunordss_r2r(regs, regd) sse_r2ri(cmpss, regs, regd, 3)
+
+#define cmpneqss_m2r(var, reg) sse_m2ri(cmpss, var, reg, 4)
+#define cmpneqss_r2r(regs, regd) sse_r2ri(cmpss, regs, regd, 4)
+
+#define cmpnltss_m2r(var, reg) sse_m2ri(cmpss, var, reg, 5)
+#define cmpnltss_r2r(regs, regd) sse_r2ri(cmpss, regs, regd, 5)
+
+#define cmpnless_m2r(var, reg) sse_m2ri(cmpss, var, reg, 6)
+#define cmpnless_r2r(regs, regd) sse_r2ri(cmpss, regs, regd, 6)
+
+#define cmpordss_m2r(var, reg) sse_m2ri(cmpss, var, reg, 7)
+#define cmpordss_r2r(regs, regd) sse_r2ri(cmpss, regs, regd, 7)
+
+#define comiss_m2r(var, reg) sse_m2r(comiss, var, reg)
+#define comiss_r2r(regs, regd) sse_r2r(comiss, regs, regd)
+
+#define ucomiss_m2r(var, reg) sse_m2r(ucomiss, var, reg)
+#define ucomiss_r2r(regs, regd) sse_r2r(ucomiss, regs, regd)
+
+#define unpcklps_m2r(var, reg) sse_m2r(unpcklps, var, reg)
+#define unpcklps_r2r(regs, regd) sse_r2r(unpcklps, regs, regd)
+
+#define unpckhps_m2r(var, reg) sse_m2r(unpckhps, var, reg)
+#define unpckhps_r2r(regs, regd) sse_r2r(unpckhps, regs, regd)
+
+#define fxrstor(mem) \
+ __asm__ __volatile__ ("fxrstor %0" \
+ : /* nothing */ \
+ : "X" (mem))
+
+#define fxsave(mem) \
+ __asm__ __volatile__ ("fxsave %0" \
+ : /* nothing */ \
+ : "X" (mem))
+
+#define stmxcsr(mem) \
+ __asm__ __volatile__ ("stmxcsr %0" \
+ : /* nothing */ \
+ : "X" (mem))
+
+#define ldmxcsr(mem) \
+ __asm__ __volatile__ ("ldmxcsr %0" \
+ : /* nothing */ \
+ : "X" (mem))
+#endif /*ARCH_X86 */
+
+
+
+ /* Optimized/fast memcpy */
+
+/*
+ TODO : fix dll linkage problem for xine_fast_memcpy on win32
+
+ xine_fast_memcpy dll linkage is screwy here.
+ declairing as dllinport seems to fix the problem
+ but causes compiler warning with libxineutils
+*/
+#ifdef _MSC_VER
+void __declspec( dllimport ) *(* xine_fast_memcpy)(void *to, const void *from, size_t len);
+#else
+extern void *(* xine_fast_memcpy)(void *to, const void *from, size_t len);
+#endif
+
+#ifdef HAVE_XINE_INTERNAL_H
+/* Benchmark available memcpy methods */
+void xine_probe_fast_memcpy(config_values_t *config);
+#endif
+
+
+/*
+ * Debug stuff
+ */
+/*
+ * profiling (unworkable in non DEBUG isn't defined)
+ */
+void xine_profiler_init (void);
+int xine_profiler_allocate_slot (char *label);
+void xine_profiler_start_count (int id);
+void xine_profiler_stop_count (int id);
+void xine_profiler_print_results (void);
+
+/*
+ * Allocate and clean memory size_t 'size', then return the pointer
+ * to the allocated memory.
+ */
+void *xine_xmalloc(size_t size);
+
+/*
+ * Same as above, but memory is aligned to 'alignement'.
+ * **base is used to return pointer to un-aligned memory, use
+ * this to free the mem chunk
+ */
+void *xine_xmalloc_aligned(size_t alignment, size_t size, void **base);
+
+/*
+ * Get user home directory.
+ */
+const char *xine_get_homedir(void);
+
+/*
+ * Clean a string (remove spaces and '=' at the begin,
+ * and '\n', '\r' and spaces at the end.
+ */
+char *xine_chomp (char *str);
+
+/*
+ * A thread-safe usecond sleep
+ */
+void xine_usec_sleep(unsigned usec);
+
+
+ /*
+ * Some string functions
+ */
+
+
+void xine_strdupa(char *dest, char *src);
+#define xine_strdupa(d, s) do { \
+ (d) = NULL; \
+ if((s) != NULL) { \
+ (d) = (char *) alloca(strlen((s)) + 1); \
+ strcpy((d), (s)); \
+ } \
+ } while(0)
+
+/* Shamefully copied from glibc 2.2.3 */
+#ifdef HAVE_STRPBRK
+#define xine_strpbrk strpbrk
+#else
+static inline char *_x_strpbrk(const char *s, const char *accept) {
+
+ while(*s != '\0') {
+ const char *a = accept;
+ while(*a != '\0')
+ if(*a++ == *s)
+ return(char *) s;
+ ++s;
+ }
+
+ return NULL;
+}
+#define xine_strpbrk _x_strpbrk
+#endif
+
+#ifdef HAVE_STRSEP
+#define xine_strsep strsep
+#else
+static inline char *_x_strsep(char **stringp, const char *delim) {
+ char *begin, *end;
+
+ begin = *stringp;
+ if(begin == NULL)
+ return NULL;
+
+ if(delim[0] == '\0' || delim[1] == '\0') {
+ char ch = delim[0];
+
+ if(ch == '\0')
+ end = NULL;
+ else {
+ if(*begin == ch)
+ end = begin;
+ else if(*begin == '\0')
+ end = NULL;
+ else
+ end = strchr(begin + 1, ch);
+ }
+ }
+ else
+ end = xine_strpbrk(begin, delim);
+
+ if(end) {
+ *end++ = '\0';
+ *stringp = end;
+ }
+ else
+ *stringp = NULL;
+
+ return begin;
+}
+#define xine_strsep _x_strsep
+#endif
+
+
+#ifdef HAVE_SETENV
+#define xine_setenv setenv
+#else
+static inline void _x_setenv(const char *name, const char *val, int _xx)
+{
+ int len = strlen(name) + strlen(val) + 2;
+ char *env;
+
+ env = (char*)malloc(len);
+
+ if (env != NULL) {
+ strcpy(env, name);
+ strcat(env, "=");
+ strcat(env, val);
+ putenv(env);
+ }
+}
+#define xine_setenv _x_setenv
+#endif
+
+/*
+ * Color Conversion Utility Functions
+ * The following data structures and functions facilitate the conversion
+ * of RGB images to packed YUV (YUY2) images. There are also functions to
+ * convert from YUV9 -> YV12. All of the meaty details are written in
+ * color.c.
+ */
+
+typedef struct yuv_planes_s {
+
+ unsigned char *y;
+ unsigned char *u;
+ unsigned char *v;
+ unsigned int row_width; /* frame width */
+ unsigned int row_count; /* frame height */
+
+} yuv_planes_t;
+
+void init_yuv_conversion(void);
+void init_yuv_planes(yuv_planes_t *yuv_planes, int width, int height);
+void free_yuv_planes(yuv_planes_t *yuv_planes);
+
+extern void (*yuv444_to_yuy2)
+ (yuv_planes_t *yuv_planes, unsigned char *yuy2_map, int pitch);
+extern void (*yuv9_to_yv12)
+ (unsigned char *y_src, int y_src_pitch, unsigned char *y_dest, int y_dest_pitch,
+ unsigned char *u_src, int u_src_pitch, unsigned char *u_dest, int u_dest_pitch,
+ unsigned char *v_src, int v_src_pitch, unsigned char *v_dest, int v_dest_pitch,
+ int width, int height);
+extern void (*yuv411_to_yv12)
+ (unsigned char *y_src, int y_src_pitch, unsigned char *y_dest, int y_dest_pitch,
+ unsigned char *u_src, int u_src_pitch, unsigned char *u_dest, int u_dest_pitch,
+ unsigned char *v_src, int v_src_pitch, unsigned char *v_dest, int v_dest_pitch,
+ int width, int height);
+
+#define SCALEFACTOR 65536
+#define CENTERSAMPLE 128
+
+#define COMPUTE_Y(r, g, b) \
+ (unsigned char) \
+ ((y_r_table[r] + y_g_table[g] + y_b_table[b]) / SCALEFACTOR)
+#define COMPUTE_U(r, g, b) \
+ (unsigned char) \
+ ((u_r_table[r] + u_g_table[g] + u_b_table[b]) / SCALEFACTOR + CENTERSAMPLE)
+#define COMPUTE_V(r, g, b) \
+ (unsigned char) \
+ ((v_r_table[r] + v_g_table[g] + v_b_table[b]) / SCALEFACTOR + CENTERSAMPLE)
+
+#define UNPACK_BGR15(packed_pixel, r, g, b) \
+ b = (packed_pixel & 0x7C00) >> 7; \
+ g = (packed_pixel & 0x03E0) >> 2; \
+ r = (packed_pixel & 0x001F) << 3;
+
+#define UNPACK_BGR16(packed_pixel, r, g, b) \
+ b = (packed_pixel & 0xF800) >> 8; \
+ g = (packed_pixel & 0x07E0) >> 3; \
+ r = (packed_pixel & 0x001F) << 3;
+
+#define UNPACK_RGB15(packed_pixel, r, g, b) \
+ r = (packed_pixel & 0x7C00) >> 7; \
+ g = (packed_pixel & 0x03E0) >> 2; \
+ b = (packed_pixel & 0x001F) << 3;
+
+#define UNPACK_RGB16(packed_pixel, r, g, b) \
+ r = (packed_pixel & 0xF800) >> 8; \
+ g = (packed_pixel & 0x07E0) >> 3; \
+ b = (packed_pixel & 0x001F) << 3;
+
+extern int y_r_table[256];
+extern int y_g_table[256];
+extern int y_b_table[256];
+
+extern int u_r_table[256];
+extern int u_g_table[256];
+extern int u_b_table[256];
+
+extern int v_r_table[256];
+extern int v_g_table[256];
+extern int v_b_table[256];
+
+
+/* backtrace printout funtion for use in XINE_ASSERT() macro */
+void xine_print_trace(void);
+
+
+#ifdef DEBUG
+# define XINE_ABORT() \
+ abort();
+#else
+# define XINE_ABORT()
+ /* don't abort */
+#endif
+
+/**
+ * Provide assert like feature with better description of failure
+ * Thanks to Mark Thomas
+ */
+#if __GNUC__
+# define XINE_ASSERT(exp, desc, args...) \
+ do { \
+ if (!(exp)) { \
+ printf("%s:%s:%d: assertion `%s' failed. " desc "\n\n", \
+ __FILE__, __XINE_FUNCTION__, __LINE__, #exp, ##args); \
+ xine_print_trace(); \
+ XINE_ABORT(); \
+ } \
+ } while(0)
+#else /* not GNU C, assume we have a C99 compiler */
+
+#ifdef _MSC_VER
+/*
+ #define XINE_ASSERT(exp, desc) ((void)((exp) || \
+ (printf desc, _assert(#exp, __FILE__, __LINE__), 0)))
+
+*/
+# define XINE_ASSERT(exp, desc) \
+ do { \
+ if (!(exp)) { \
+ printf("%s:%s:%d: assertion `%s' failed. ", \
+ __FILE__, __XINE_FUNCTION__, __LINE__, #exp); \
+ printf(desc); \
+ printf("\n\n"); \
+ xine_print_trace(); \
+ XINE_ABORT(); \
+ } \
+ } while(0)
+#else
+# define XINE_ASSERT(exp, ...) \
+ do { \
+ if (!(exp)) { \
+ printf("%s:%s:%d: assertion `%s' failed. ", \
+ __FILE__, __XINE_FUNCTION__, __LINE__, #exp); \
+ printf(__VA_ARGS__); \
+ printf("\n\n"); \
+ xine_print_trace(); \
+ XINE_ABORT(); \
+ } \
+ } while(0)
+#endif /* _MSC_VER */
+
+#endif
+
+
+/******** double chained lists with builtin iterator *******/
+
+typedef struct xine_node_s {
+
+ struct xine_node_s *next, *prev;
+
+ void *content;
+
+ int priority;
+
+} xine_node_t;
+
+
+typedef struct {
+
+ xine_node_t *first, *last, *cur;
+
+} xine_list_t;
+
+
+
+xine_list_t *xine_list_new (void);
+
+
+/**
+ * dispose the whole list.
+ * note: disposes _only_ the list structure, content must be free()d elsewhere
+ */
+void xine_list_free(xine_list_t *l);
+
+
+/**
+ * returns: Boolean
+ */
+int xine_list_is_empty (xine_list_t *l);
+
+/**
+ * return content of first entry in list.
+ */
+void *xine_list_first_content (xine_list_t *l);
+
+/**
+ * return next content in list.
+ */
+void *xine_list_next_content (xine_list_t *l);
+
+/**
+ * Return last content of list.
+ */
+void *xine_list_last_content (xine_list_t *l);
+
+/**
+ * Return previous content of list.
+ */
+void *xine_list_prev_content (xine_list_t *l);
+
+/**
+ * Append content to list, sorted by decreasing priority.
+ */
+void xine_list_append_priority_content (xine_list_t *l, void *content, int priority);
+
+/**
+ * Append content to list.
+ */
+void xine_list_append_content (xine_list_t *l, void *content);
+
+/**
+ * Insert content in list.
+ */
+void xine_list_insert_content (xine_list_t *l, void *content);
+
+/**
+ * Remove current content in list.
+ * note: removes only the list entry; content must be free()d elsewhere.
+ */
+void xine_list_delete_current (xine_list_t *l);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/win32/include/zconf.h b/win32/include/zconf.h new file mode 100644 index 000000000..90d1a107a --- /dev/null +++ b/win32/include/zconf.h @@ -0,0 +1,279 @@ +/* zconf.h -- configuration of the zlib compression library
+ * Copyright (C) 1995-1998 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* @(#) $Id: zconf.h,v 1.1 2003/04/20 16:42:09 guenter Exp $ */
+
+#ifndef _ZCONF_H
+#define _ZCONF_H
+
+/*
+ * If you *really* need a unique prefix for all types and library functions,
+ * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
+ */
+#ifdef Z_PREFIX
+# define deflateInit_ z_deflateInit_
+# define deflate z_deflate
+# define deflateEnd z_deflateEnd
+# define inflateInit_ z_inflateInit_
+# define inflate z_inflate
+# define inflateEnd z_inflateEnd
+# define deflateInit2_ z_deflateInit2_
+# define deflateSetDictionary z_deflateSetDictionary
+# define deflateCopy z_deflateCopy
+# define deflateReset z_deflateReset
+# define deflateParams z_deflateParams
+# define inflateInit2_ z_inflateInit2_
+# define inflateSetDictionary z_inflateSetDictionary
+# define inflateSync z_inflateSync
+# define inflateSyncPoint z_inflateSyncPoint
+# define inflateReset z_inflateReset
+# define compress z_compress
+# define compress2 z_compress2
+# define uncompress z_uncompress
+# define adler32 z_adler32
+# define crc32 z_crc32
+# define get_crc_table z_get_crc_table
+
+# define Byte z_Byte
+# define uInt z_uInt
+# define uLong z_uLong
+# define Bytef z_Bytef
+# define charf z_charf
+# define intf z_intf
+# define uIntf z_uIntf
+# define uLongf z_uLongf
+# define voidpf z_voidpf
+# define voidp z_voidp
+#endif
+
+#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
+# define WIN32
+#endif
+#if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386)
+# ifndef __32BIT__
+# define __32BIT__
+# endif
+#endif
+#if defined(__MSDOS__) && !defined(MSDOS)
+# define MSDOS
+#endif
+
+/*
+ * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
+ * than 64k bytes at a time (needed on systems with 16-bit int).
+ */
+#if defined(MSDOS) && !defined(__32BIT__)
+# define MAXSEG_64K
+#endif
+#ifdef MSDOS
+# define UNALIGNED_OK
+#endif
+
+#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32)) && !defined(STDC)
+# define STDC
+#endif
+#if defined(__STDC__) || defined(__cplusplus) || defined(__OS2__)
+# ifndef STDC
+# define STDC
+# endif
+#endif
+
+#ifndef STDC
+# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
+# define const
+# endif
+#endif
+
+/* Some Mac compilers merge all .h files incorrectly: */
+#if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__)
+# define NO_DUMMY_DECL
+#endif
+
+/* Old Borland C incorrectly complains about missing returns: */
+#if defined(__BORLANDC__) && (__BORLANDC__ < 0x500)
+# define NEED_DUMMY_RETURN
+#endif
+
+
+/* Maximum value for memLevel in deflateInit2 */
+#ifndef MAX_MEM_LEVEL
+# ifdef MAXSEG_64K
+# define MAX_MEM_LEVEL 8
+# else
+# define MAX_MEM_LEVEL 9
+# endif
+#endif
+
+/* Maximum value for windowBits in deflateInit2 and inflateInit2.
+ * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
+ * created by gzip. (Files created by minigzip can still be extracted by
+ * gzip.)
+ */
+#ifndef MAX_WBITS
+# define MAX_WBITS 15 /* 32K LZ77 window */
+#endif
+
+/* The memory requirements for deflate are (in bytes):
+ (1 << (windowBits+2)) + (1 << (memLevel+9))
+ that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
+ plus a few kilobytes for small objects. For example, if you want to reduce
+ the default memory requirements from 256K to 128K, compile with
+ make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
+ Of course this will generally degrade compression (there's no free lunch).
+
+ The memory requirements for inflate are (in bytes) 1 << windowBits
+ that is, 32K for windowBits=15 (default value) plus a few kilobytes
+ for small objects.
+*/
+
+ /* Type declarations */
+
+#ifndef OF /* function prototypes */
+# ifdef STDC
+# define OF(args) args
+# else
+# define OF(args) ()
+# endif
+#endif
+
+/* The following definitions for FAR are needed only for MSDOS mixed
+ * model programming (small or medium model with some far allocations).
+ * This was tested only with MSC; for other MSDOS compilers you may have
+ * to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
+ * just define FAR to be empty.
+ */
+#if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__)
+ /* MSC small or medium model */
+# define SMALL_MEDIUM
+# ifdef _MSC_VER
+# define FAR _far
+# else
+# define FAR far
+# endif
+#endif
+#if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__))
+# ifndef __32BIT__
+# define SMALL_MEDIUM
+# define FAR _far
+# endif
+#endif
+
+/* Compile with -DZLIB_DLL for Windows DLL support */
+#if defined(ZLIB_DLL)
+# if defined(_WINDOWS) || defined(WINDOWS)
+# ifdef FAR
+# undef FAR
+# endif
+# include <windows.h>
+# define ZEXPORT WINAPI
+# ifdef WIN32
+# define ZEXPORTVA WINAPIV
+# else
+# define ZEXPORTVA FAR _cdecl _export
+# endif
+# endif
+# if defined (__BORLANDC__)
+# if (__BORLANDC__ >= 0x0500) && defined (WIN32)
+# include <windows.h>
+# define ZEXPORT __declspec(dllexport) WINAPI
+# define ZEXPORTRVA __declspec(dllexport) WINAPIV
+# else
+# if defined (_Windows) && defined (__DLL__)
+# define ZEXPORT _export
+# define ZEXPORTVA _export
+# endif
+# endif
+# endif
+#endif
+
+#if defined (__BEOS__)
+# if defined (ZLIB_DLL)
+# define ZEXTERN extern __declspec(dllexport)
+# else
+# define ZEXTERN extern __declspec(dllimport)
+# endif
+#endif
+
+#ifndef ZEXPORT
+# define ZEXPORT
+#endif
+#ifndef ZEXPORTVA
+# define ZEXPORTVA
+#endif
+#ifndef ZEXTERN
+# define ZEXTERN extern
+#endif
+
+#ifndef FAR
+# define FAR
+#endif
+
+#if !defined(MACOS) && !defined(TARGET_OS_MAC)
+typedef unsigned char Byte; /* 8 bits */
+#endif
+typedef unsigned int uInt; /* 16 bits or more */
+typedef unsigned long uLong; /* 32 bits or more */
+
+#ifdef SMALL_MEDIUM
+ /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
+# define Bytef Byte FAR
+#else
+ typedef Byte FAR Bytef;
+#endif
+typedef char FAR charf;
+typedef int FAR intf;
+typedef uInt FAR uIntf;
+typedef uLong FAR uLongf;
+
+#ifdef STDC
+ typedef void FAR *voidpf;
+ typedef void *voidp;
+#else
+ typedef Byte FAR *voidpf;
+ typedef Byte *voidp;
+#endif
+
+#ifdef HAVE_UNISTD_H
+# include <sys/types.h> /* for off_t */
+# include <unistd.h> /* for SEEK_* and off_t */
+# define z_off_t off_t
+#endif
+#ifndef SEEK_SET
+# define SEEK_SET 0 /* Seek from beginning of file. */
+# define SEEK_CUR 1 /* Seek from current position. */
+# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
+#endif
+#ifndef z_off_t
+# define z_off_t long
+#endif
+
+/* MVS linker does not support external names larger than 8 bytes */
+#if defined(__MVS__)
+# pragma map(deflateInit_,"DEIN")
+# pragma map(deflateInit2_,"DEIN2")
+# pragma map(deflateEnd,"DEEND")
+# pragma map(inflateInit_,"ININ")
+# pragma map(inflateInit2_,"ININ2")
+# pragma map(inflateEnd,"INEND")
+# pragma map(inflateSync,"INSY")
+# pragma map(inflateSetDictionary,"INSEDI")
+# pragma map(inflate_blocks,"INBL")
+# pragma map(inflate_blocks_new,"INBLNE")
+# pragma map(inflate_blocks_free,"INBLFR")
+# pragma map(inflate_blocks_reset,"INBLRE")
+# pragma map(inflate_codes_free,"INCOFR")
+# pragma map(inflate_codes,"INCO")
+# pragma map(inflate_fast,"INFA")
+# pragma map(inflate_flush,"INFLU")
+# pragma map(inflate_mask,"INMA")
+# pragma map(inflate_set_dictionary,"INSEDI2")
+# pragma map(inflate_copyright,"INCOPY")
+# pragma map(inflate_trees_bits,"INTRBI")
+# pragma map(inflate_trees_dynamic,"INTRDY")
+# pragma map(inflate_trees_fixed,"INTRFI")
+# pragma map(inflate_trees_free,"INTRFR")
+#endif
+
+#endif /* _ZCONF_H */
diff --git a/win32/include/zlib.h b/win32/include/zlib.h new file mode 100644 index 000000000..34fe85f41 --- /dev/null +++ b/win32/include/zlib.h @@ -0,0 +1,893 @@ +/* zlib.h -- interface of the 'zlib' general purpose compression library
+ version 1.1.3, July 9th, 1998
+
+ Copyright (C) 1995-1998 Jean-loup Gailly and Mark Adler
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+ Jean-loup Gailly Mark Adler
+ jloup@gzip.org madler@alumni.caltech.edu
+
+
+ The data format used by the zlib library is described by RFCs (Request for
+ Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt
+ (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
+*/
+
+#ifndef _ZLIB_H
+#define _ZLIB_H
+
+#include "zconf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ZLIB_VERSION "1.1.3"
+
+/*
+ The 'zlib' compression library provides in-memory compression and
+ decompression functions, including integrity checks of the uncompressed
+ data. This version of the library supports only one compression method
+ (deflation) but other algorithms will be added later and will have the same
+ stream interface.
+
+ Compression can be done in a single step if the buffers are large
+ enough (for example if an input file is mmap'ed), or can be done by
+ repeated calls of the compression function. In the latter case, the
+ application must provide more input and/or consume the output
+ (providing more output space) before each call.
+
+ The library also supports reading and writing files in gzip (.gz) format
+ with an interface similar to that of stdio.
+
+ The library does not install any signal handler. The decoder checks
+ the consistency of the compressed data, so the library should never
+ crash even in case of corrupted input.
+*/
+
+typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
+typedef void (*free_func) OF((voidpf opaque, voidpf address));
+
+struct internal_state;
+
+typedef struct z_stream_s {
+ Bytef *next_in; /* next input byte */
+ uInt avail_in; /* number of bytes available at next_in */
+ uLong total_in; /* total nb of input bytes read so far */
+
+ Bytef *next_out; /* next output byte should be put there */
+ uInt avail_out; /* remaining free space at next_out */
+ uLong total_out; /* total nb of bytes output so far */
+
+ char *msg; /* last error message, NULL if no error */
+ struct internal_state FAR *state; /* not visible by applications */
+
+ alloc_func zalloc; /* used to allocate the internal state */
+ free_func zfree; /* used to free the internal state */
+ voidpf opaque; /* private data object passed to zalloc and zfree */
+
+ int data_type; /* best guess about the data type: ascii or binary */
+ uLong adler; /* adler32 value of the uncompressed data */
+ uLong reserved; /* reserved for future use */
+} z_stream;
+
+typedef z_stream FAR *z_streamp;
+
+/*
+ The application must update next_in and avail_in when avail_in has
+ dropped to zero. It must update next_out and avail_out when avail_out
+ has dropped to zero. The application must initialize zalloc, zfree and
+ opaque before calling the init function. All other fields are set by the
+ compression library and must not be updated by the application.
+
+ The opaque value provided by the application will be passed as the first
+ parameter for calls of zalloc and zfree. This can be useful for custom
+ memory management. The compression library attaches no meaning to the
+ opaque value.
+
+ zalloc must return Z_NULL if there is not enough memory for the object.
+ If zlib is used in a multi-threaded application, zalloc and zfree must be
+ thread safe.
+
+ On 16-bit systems, the functions zalloc and zfree must be able to allocate
+ exactly 65536 bytes, but will not be required to allocate more than this
+ if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,
+ pointers returned by zalloc for objects of exactly 65536 bytes *must*
+ have their offset normalized to zero. The default allocation function
+ provided by this library ensures this (see zutil.c). To reduce memory
+ requirements and avoid any allocation of 64K objects, at the expense of
+ compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).
+
+ The fields total_in and total_out can be used for statistics or
+ progress reports. After compression, total_in holds the total size of
+ the uncompressed data and may be saved for use in the decompressor
+ (particularly if the decompressor wants to decompress everything in
+ a single step).
+*/
+
+ /* constants */
+
+#define Z_NO_FLUSH 0
+#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */
+#define Z_SYNC_FLUSH 2
+#define Z_FULL_FLUSH 3
+#define Z_FINISH 4
+/* Allowed flush values; see deflate() below for details */
+
+#define Z_OK 0
+#define Z_STREAM_END 1
+#define Z_NEED_DICT 2
+#define Z_ERRNO (-1)
+#define Z_STREAM_ERROR (-2)
+#define Z_DATA_ERROR (-3)
+#define Z_MEM_ERROR (-4)
+#define Z_BUF_ERROR (-5)
+#define Z_VERSION_ERROR (-6)
+/* Return codes for the compression/decompression functions. Negative
+ * values are errors, positive values are used for special but normal events.
+ */
+
+#define Z_NO_COMPRESSION 0
+#define Z_BEST_SPEED 1
+#define Z_BEST_COMPRESSION 9
+#define Z_DEFAULT_COMPRESSION (-1)
+/* compression levels */
+
+#define Z_FILTERED 1
+#define Z_HUFFMAN_ONLY 2
+#define Z_DEFAULT_STRATEGY 0
+/* compression strategy; see deflateInit2() below for details */
+
+#define Z_BINARY 0
+#define Z_ASCII 1
+#define Z_UNKNOWN 2
+/* Possible values of the data_type field */
+
+#define Z_DEFLATED 8
+/* The deflate compression method (the only one supported in this version) */
+
+#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */
+
+#define zlib_version zlibVersion()
+/* for compatibility with versions < 1.0.2 */
+
+ /* basic functions */
+
+ZEXTERN const char * ZEXPORT zlibVersion OF((void));
+/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
+ If the first character differs, the library code actually used is
+ not compatible with the zlib.h header file used by the application.
+ This check is automatically made by deflateInit and inflateInit.
+ */
+
+/*
+ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
+
+ Initializes the internal stream state for compression. The fields
+ zalloc, zfree and opaque must be initialized before by the caller.
+ If zalloc and zfree are set to Z_NULL, deflateInit updates them to
+ use default allocation functions.
+
+ The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
+ 1 gives best speed, 9 gives best compression, 0 gives no compression at
+ all (the input data is simply copied a block at a time).
+ Z_DEFAULT_COMPRESSION requests a default compromise between speed and
+ compression (currently equivalent to level 6).
+
+ deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not
+ enough memory, Z_STREAM_ERROR if level is not a valid compression level,
+ Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
+ with the version assumed by the caller (ZLIB_VERSION).
+ msg is set to null if there is no error message. deflateInit does not
+ perform any compression: this will be done by deflate().
+*/
+
+
+ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
+/*
+ deflate compresses as much data as possible, and stops when the input
+ buffer becomes empty or the output buffer becomes full. It may introduce some
+ output latency (reading input without producing any output) except when
+ forced to flush.
+
+ The detailed semantics are as follows. deflate performs one or both of the
+ following actions:
+
+ - Compress more input starting at next_in and update next_in and avail_in
+ accordingly. If not all input can be processed (because there is not
+ enough room in the output buffer), next_in and avail_in are updated and
+ processing will resume at this point for the next call of deflate().
+
+ - Provide more output starting at next_out and update next_out and avail_out
+ accordingly. This action is forced if the parameter flush is non zero.
+ Forcing flush frequently degrades the compression ratio, so this parameter
+ should be set only when necessary (in interactive applications).
+ Some output may be provided even if flush is not set.
+
+ Before the call of deflate(), the application should ensure that at least
+ one of the actions is possible, by providing more input and/or consuming
+ more output, and updating avail_in or avail_out accordingly; avail_out
+ should never be zero before the call. The application can consume the
+ compressed output when it wants, for example when the output buffer is full
+ (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK
+ and with zero avail_out, it must be called again after making room in the
+ output buffer because there might be more output pending.
+
+ If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
+ flushed to the output buffer and the output is aligned on a byte boundary, so
+ that the decompressor can get all input data available so far. (In particular
+ avail_in is zero after the call if enough output space has been provided
+ before the call.) Flushing may degrade compression for some compression
+ algorithms and so it should be used only when necessary.
+
+ If flush is set to Z_FULL_FLUSH, all output is flushed as with
+ Z_SYNC_FLUSH, and the compression state is reset so that decompression can
+ restart from this point if previous compressed data has been damaged or if
+ random access is desired. Using Z_FULL_FLUSH too often can seriously degrade
+ the compression.
+
+ If deflate returns with avail_out == 0, this function must be called again
+ with the same value of the flush parameter and more output space (updated
+ avail_out), until the flush is complete (deflate returns with non-zero
+ avail_out).
+
+ If the parameter flush is set to Z_FINISH, pending input is processed,
+ pending output is flushed and deflate returns with Z_STREAM_END if there
+ was enough output space; if deflate returns with Z_OK, this function must be
+ called again with Z_FINISH and more output space (updated avail_out) but no
+ more input data, until it returns with Z_STREAM_END or an error. After
+ deflate has returned Z_STREAM_END, the only possible operations on the
+ stream are deflateReset or deflateEnd.
+
+ Z_FINISH can be used immediately after deflateInit if all the compression
+ is to be done in a single step. In this case, avail_out must be at least
+ 0.1% larger than avail_in plus 12 bytes. If deflate does not return
+ Z_STREAM_END, then it must be called again as described above.
+
+ deflate() sets strm->adler to the adler32 checksum of all input read
+ so far (that is, total_in bytes).
+
+ deflate() may update data_type if it can make a good guess about
+ the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered
+ binary. This field is only for information purposes and does not affect
+ the compression algorithm in any manner.
+
+ deflate() returns Z_OK if some progress has been made (more input
+ processed or more output produced), Z_STREAM_END if all input has been
+ consumed and all output has been produced (only when flush is set to
+ Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
+ if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible
+ (for example avail_in or avail_out was zero).
+*/
+
+
+ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
+/*
+ All dynamically allocated data structures for this stream are freed.
+ This function discards any unprocessed input and does not flush any
+ pending output.
+
+ deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
+ stream state was inconsistent, Z_DATA_ERROR if the stream was freed
+ prematurely (some input or output was discarded). In the error case,
+ msg may be set but then points to a static string (which must not be
+ deallocated).
+*/
+
+
+/*
+ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
+
+ Initializes the internal stream state for decompression. The fields
+ next_in, avail_in, zalloc, zfree and opaque must be initialized before by
+ the caller. If next_in is not Z_NULL and avail_in is large enough (the exact
+ value depends on the compression method), inflateInit determines the
+ compression method from the zlib header and allocates all data structures
+ accordingly; otherwise the allocation will be deferred to the first call of
+ inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to
+ use default allocation functions.
+
+ inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
+ memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
+ version assumed by the caller. msg is set to null if there is no error
+ message. inflateInit does not perform any decompression apart from reading
+ the zlib header if present: this will be done by inflate(). (So next_in and
+ avail_in may be modified, but next_out and avail_out are unchanged.)
+*/
+
+
+ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
+/*
+ inflate decompresses as much data as possible, and stops when the input
+ buffer becomes empty or the output buffer becomes full. It may some
+ introduce some output latency (reading input without producing any output)
+ except when forced to flush.
+
+ The detailed semantics are as follows. inflate performs one or both of the
+ following actions:
+
+ - Decompress more input starting at next_in and update next_in and avail_in
+ accordingly. If not all input can be processed (because there is not
+ enough room in the output buffer), next_in is updated and processing
+ will resume at this point for the next call of inflate().
+
+ - Provide more output starting at next_out and update next_out and avail_out
+ accordingly. inflate() provides as much output as possible, until there
+ is no more input data or no more space in the output buffer (see below
+ about the flush parameter).
+
+ Before the call of inflate(), the application should ensure that at least
+ one of the actions is possible, by providing more input and/or consuming
+ more output, and updating the next_* and avail_* values accordingly.
+ The application can consume the uncompressed output when it wants, for
+ example when the output buffer is full (avail_out == 0), or after each
+ call of inflate(). If inflate returns Z_OK and with zero avail_out, it
+ must be called again after making room in the output buffer because there
+ might be more output pending.
+
+ If the parameter flush is set to Z_SYNC_FLUSH, inflate flushes as much
+ output as possible to the output buffer. The flushing behavior of inflate is
+ not specified for values of the flush parameter other than Z_SYNC_FLUSH
+ and Z_FINISH, but the current implementation actually flushes as much output
+ as possible anyway.
+
+ inflate() should normally be called until it returns Z_STREAM_END or an
+ error. However if all decompression is to be performed in a single step
+ (a single call of inflate), the parameter flush should be set to
+ Z_FINISH. In this case all pending input is processed and all pending
+ output is flushed; avail_out must be large enough to hold all the
+ uncompressed data. (The size of the uncompressed data may have been saved
+ by the compressor for this purpose.) The next operation on this stream must
+ be inflateEnd to deallocate the decompression state. The use of Z_FINISH
+ is never required, but can be used to inform inflate that a faster routine
+ may be used for the single inflate() call.
+
+ If a preset dictionary is needed at this point (see inflateSetDictionary
+ below), inflate sets strm-adler to the adler32 checksum of the
+ dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise
+ it sets strm->adler to the adler32 checksum of all output produced
+ so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or
+ an error code as described below. At the end of the stream, inflate()
+ checks that its computed adler32 checksum is equal to that saved by the
+ compressor and returns Z_STREAM_END only if the checksum is correct.
+
+ inflate() returns Z_OK if some progress has been made (more input processed
+ or more output produced), Z_STREAM_END if the end of the compressed data has
+ been reached and all uncompressed output has been produced, Z_NEED_DICT if a
+ preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
+ corrupted (input stream not conforming to the zlib format or incorrect
+ adler32 checksum), Z_STREAM_ERROR if the stream structure was inconsistent
+ (for example if next_in or next_out was NULL), Z_MEM_ERROR if there was not
+ enough memory, Z_BUF_ERROR if no progress is possible or if there was not
+ enough room in the output buffer when Z_FINISH is used. In the Z_DATA_ERROR
+ case, the application may then call inflateSync to look for a good
+ compression block.
+*/
+
+
+ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
+/*
+ All dynamically allocated data structures for this stream are freed.
+ This function discards any unprocessed input and does not flush any
+ pending output.
+
+ inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
+ was inconsistent. In the error case, msg may be set but then points to a
+ static string (which must not be deallocated).
+*/
+
+ /* Advanced functions */
+
+/*
+ The following functions are needed only in some special applications.
+*/
+
+/*
+ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
+ int level,
+ int method,
+ int windowBits,
+ int memLevel,
+ int strategy));
+
+ This is another version of deflateInit with more compression options. The
+ fields next_in, zalloc, zfree and opaque must be initialized before by
+ the caller.
+
+ The method parameter is the compression method. It must be Z_DEFLATED in
+ this version of the library.
+
+ The windowBits parameter is the base two logarithm of the window size
+ (the size of the history buffer). It should be in the range 8..15 for this
+ version of the library. Larger values of this parameter result in better
+ compression at the expense of memory usage. The default value is 15 if
+ deflateInit is used instead.
+
+ The memLevel parameter specifies how much memory should be allocated
+ for the internal compression state. memLevel=1 uses minimum memory but
+ is slow and reduces compression ratio; memLevel=9 uses maximum memory
+ for optimal speed. The default value is 8. See zconf.h for total memory
+ usage as a function of windowBits and memLevel.
+
+ The strategy parameter is used to tune the compression algorithm. Use the
+ value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
+ filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no
+ string match). Filtered data consists mostly of small values with a
+ somewhat random distribution. In this case, the compression algorithm is
+ tuned to compress them better. The effect of Z_FILTERED is to force more
+ Huffman coding and less string matching; it is somewhat intermediate
+ between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects
+ the compression ratio but not the correctness of the compressed output even
+ if it is not set appropriately.
+
+ deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+ memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid
+ method). msg is set to null if there is no error message. deflateInit2 does
+ not perform any compression: this will be done by deflate().
+*/
+
+ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
+ const Bytef *dictionary,
+ uInt dictLength));
+/*
+ Initializes the compression dictionary from the given byte sequence
+ without producing any compressed output. This function must be called
+ immediately after deflateInit, deflateInit2 or deflateReset, before any
+ call of deflate. The compressor and decompressor must use exactly the same
+ dictionary (see inflateSetDictionary).
+
+ The dictionary should consist of strings (byte sequences) that are likely
+ to be encountered later in the data to be compressed, with the most commonly
+ used strings preferably put towards the end of the dictionary. Using a
+ dictionary is most useful when the data to be compressed is short and can be
+ predicted with good accuracy; the data can then be compressed better than
+ with the default empty dictionary.
+
+ Depending on the size of the compression data structures selected by
+ deflateInit or deflateInit2, a part of the dictionary may in effect be
+ discarded, for example if the dictionary is larger than the window size in
+ deflate or deflate2. Thus the strings most likely to be useful should be
+ put at the end of the dictionary, not at the front.
+
+ Upon return of this function, strm->adler is set to the Adler32 value
+ of the dictionary; the decompressor may later use this value to determine
+ which dictionary has been used by the compressor. (The Adler32 value
+ applies to the whole dictionary even if only a subset of the dictionary is
+ actually used by the compressor.)
+
+ deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
+ parameter is invalid (such as NULL dictionary) or the stream state is
+ inconsistent (for example if deflate has already been called for this stream
+ or if the compression method is bsort). deflateSetDictionary does not
+ perform any compression: this will be done by deflate().
+*/
+
+ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
+ z_streamp source));
+/*
+ Sets the destination stream as a complete copy of the source stream.
+
+ This function can be useful when several compression strategies will be
+ tried, for example when there are several ways of pre-processing the input
+ data with a filter. The streams that will be discarded should then be freed
+ by calling deflateEnd. Note that deflateCopy duplicates the internal
+ compression state which can be quite large, so this strategy is slow and
+ can consume lots of memory.
+
+ deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
+ enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
+ (such as zalloc being NULL). msg is left unchanged in both source and
+ destination.
+*/
+
+ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
+/*
+ This function is equivalent to deflateEnd followed by deflateInit,
+ but does not free and reallocate all the internal compression state.
+ The stream will keep the same compression level and any other attributes
+ that may have been set by deflateInit2.
+
+ deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
+ stream state was inconsistent (such as zalloc or state being NULL).
+*/
+
+ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
+ int level,
+ int strategy));
+/*
+ Dynamically update the compression level and compression strategy. The
+ interpretation of level and strategy is as in deflateInit2. This can be
+ used to switch between compression and straight copy of the input data, or
+ to switch to a different kind of input data requiring a different
+ strategy. If the compression level is changed, the input available so far
+ is compressed with the old level (and may be flushed); the new level will
+ take effect only at the next call of deflate().
+
+ Before the call of deflateParams, the stream state must be set as for
+ a call of deflate(), since the currently available input may have to
+ be compressed and flushed. In particular, strm->avail_out must be non-zero.
+
+ deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
+ stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR
+ if strm->avail_out was zero.
+*/
+
+/*
+ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
+ int windowBits));
+
+ This is another version of inflateInit with an extra parameter. The
+ fields next_in, avail_in, zalloc, zfree and opaque must be initialized
+ before by the caller.
+
+ The windowBits parameter is the base two logarithm of the maximum window
+ size (the size of the history buffer). It should be in the range 8..15 for
+ this version of the library. The default value is 15 if inflateInit is used
+ instead. If a compressed stream with a larger window size is given as
+ input, inflate() will return with the error code Z_DATA_ERROR instead of
+ trying to allocate a larger window.
+
+ inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+ memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative
+ memLevel). msg is set to null if there is no error message. inflateInit2
+ does not perform any decompression apart from reading the zlib header if
+ present: this will be done by inflate(). (So next_in and avail_in may be
+ modified, but next_out and avail_out are unchanged.)
+*/
+
+ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
+ const Bytef *dictionary,
+ uInt dictLength));
+/*
+ Initializes the decompression dictionary from the given uncompressed byte
+ sequence. This function must be called immediately after a call of inflate
+ if this call returned Z_NEED_DICT. The dictionary chosen by the compressor
+ can be determined from the Adler32 value returned by this call of
+ inflate. The compressor and decompressor must use exactly the same
+ dictionary (see deflateSetDictionary).
+
+ inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
+ parameter is invalid (such as NULL dictionary) or the stream state is
+ inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
+ expected one (incorrect Adler32 value). inflateSetDictionary does not
+ perform any decompression: this will be done by subsequent calls of
+ inflate().
+*/
+
+ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
+/*
+ Skips invalid compressed data until a full flush point (see above the
+ description of deflate with Z_FULL_FLUSH) can be found, or until all
+ available input is skipped. No output is provided.
+
+ inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
+ if no more input was provided, Z_DATA_ERROR if no flush point has been found,
+ or Z_STREAM_ERROR if the stream structure was inconsistent. In the success
+ case, the application may save the current current value of total_in which
+ indicates where valid compressed data was found. In the error case, the
+ application may repeatedly call inflateSync, providing more input each time,
+ until success or end of the input data.
+*/
+
+ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
+/*
+ This function is equivalent to inflateEnd followed by inflateInit,
+ but does not free and reallocate all the internal decompression state.
+ The stream will keep attributes that may have been set by inflateInit2.
+
+ inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
+ stream state was inconsistent (such as zalloc or state being NULL).
+*/
+
+
+ /* utility functions */
+
+/*
+ The following utility functions are implemented on top of the
+ basic stream-oriented functions. To simplify the interface, some
+ default options are assumed (compression level and memory usage,
+ standard memory allocation functions). The source code of these
+ utility functions can easily be modified if you need special options.
+*/
+
+ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
+ const Bytef *source, uLong sourceLen));
+/*
+ Compresses the source buffer into the destination buffer. sourceLen is
+ the byte length of the source buffer. Upon entry, destLen is the total
+ size of the destination buffer, which must be at least 0.1% larger than
+ sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the
+ compressed buffer.
+ This function can be used to compress a whole file at once if the
+ input file is mmap'ed.
+ compress returns Z_OK if success, Z_MEM_ERROR if there was not
+ enough memory, Z_BUF_ERROR if there was not enough room in the output
+ buffer.
+*/
+
+ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
+ const Bytef *source, uLong sourceLen,
+ int level));
+/*
+ Compresses the source buffer into the destination buffer. The level
+ parameter has the same meaning as in deflateInit. sourceLen is the byte
+ length of the source buffer. Upon entry, destLen is the total size of the
+ destination buffer, which must be at least 0.1% larger than sourceLen plus
+ 12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
+
+ compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+ memory, Z_BUF_ERROR if there was not enough room in the output buffer,
+ Z_STREAM_ERROR if the level parameter is invalid.
+*/
+
+ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
+ const Bytef *source, uLong sourceLen));
+/*
+ Decompresses the source buffer into the destination buffer. sourceLen is
+ the byte length of the source buffer. Upon entry, destLen is the total
+ size of the destination buffer, which must be large enough to hold the
+ entire uncompressed data. (The size of the uncompressed data must have
+ been saved previously by the compressor and transmitted to the decompressor
+ by some mechanism outside the scope of this compression library.)
+ Upon exit, destLen is the actual size of the compressed buffer.
+ This function can be used to decompress a whole file at once if the
+ input file is mmap'ed.
+
+ uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
+ enough memory, Z_BUF_ERROR if there was not enough room in the output
+ buffer, or Z_DATA_ERROR if the input data was corrupted.
+*/
+
+
+typedef voidp gzFile;
+
+ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
+/*
+ Opens a gzip (.gz) file for reading or writing. The mode parameter
+ is as in fopen ("rb" or "wb") but can also include a compression level
+ ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for
+ Huffman only compression as in "wb1h". (See the description
+ of deflateInit2 for more information about the strategy parameter.)
+
+ gzopen can be used to read a file which is not in gzip format; in this
+ case gzread will directly read from the file without decompression.
+
+ gzopen returns NULL if the file could not be opened or if there was
+ insufficient memory to allocate the (de)compression state; errno
+ can be checked to distinguish the two cases (if errno is zero, the
+ zlib error is Z_MEM_ERROR). */
+
+ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
+/*
+ gzdopen() associates a gzFile with the file descriptor fd. File
+ descriptors are obtained from calls like open, dup, creat, pipe or
+ fileno (in the file has been previously opened with fopen).
+ The mode parameter is as in gzopen.
+ The next call of gzclose on the returned gzFile will also close the
+ file descriptor fd, just like fclose(fdopen(fd), mode) closes the file
+ descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode).
+ gzdopen returns NULL if there was insufficient memory to allocate
+ the (de)compression state.
+*/
+
+ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
+/*
+ Dynamically update the compression level or strategy. See the description
+ of deflateInit2 for the meaning of these parameters.
+ gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
+ opened for writing.
+*/
+
+ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
+/*
+ Reads the given number of uncompressed bytes from the compressed file.
+ If the input file was not in gzip format, gzread copies the given number
+ of bytes into the buffer.
+ gzread returns the number of uncompressed bytes actually read (0 for
+ end of file, -1 for error). */
+
+ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
+ const voidp buf, unsigned len));
+/*
+ Writes the given number of uncompressed bytes into the compressed file.
+ gzwrite returns the number of uncompressed bytes actually written
+ (0 in case of error).
+*/
+
+ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...));
+/*
+ Converts, formats, and writes the args to the compressed file under
+ control of the format string, as in fprintf. gzprintf returns the number of
+ uncompressed bytes actually written (0 in case of error).
+*/
+
+ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
+/*
+ Writes the given null-terminated string to the compressed file, excluding
+ the terminating null character.
+ gzputs returns the number of characters written, or -1 in case of error.
+*/
+
+ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
+/*
+ Reads bytes from the compressed file until len-1 characters are read, or
+ a newline character is read and transferred to buf, or an end-of-file
+ condition is encountered. The string is then terminated with a null
+ character.
+ gzgets returns buf, or Z_NULL in case of error.
+*/
+
+ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
+/*
+ Writes c, converted to an unsigned char, into the compressed file.
+ gzputc returns the value that was written, or -1 in case of error.
+*/
+
+ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
+/*
+ Reads one byte from the compressed file. gzgetc returns this byte
+ or -1 in case of end of file or error.
+*/
+
+ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
+/*
+ Flushes all pending output into the compressed file. The parameter
+ flush is as in the deflate() function. The return value is the zlib
+ error number (see function gzerror below). gzflush returns Z_OK if
+ the flush parameter is Z_FINISH and all output could be flushed.
+ gzflush should be called only when strictly necessary because it can
+ degrade compression.
+*/
+
+ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
+ z_off_t offset, int whence));
+/*
+ Sets the starting position for the next gzread or gzwrite on the
+ given compressed file. The offset represents a number of bytes in the
+ uncompressed data stream. The whence parameter is defined as in lseek(2);
+ the value SEEK_END is not supported.
+ If the file is opened for reading, this function is emulated but can be
+ extremely slow. If the file is opened for writing, only forward seeks are
+ supported; gzseek then compresses a sequence of zeroes up to the new
+ starting position.
+
+ gzseek returns the resulting offset location as measured in bytes from
+ the beginning of the uncompressed stream, or -1 in case of error, in
+ particular if the file is opened for writing and the new starting position
+ would be before the current position.
+*/
+
+ZEXTERN int ZEXPORT gzrewind OF((gzFile file));
+/*
+ Rewinds the given file. This function is supported only for reading.
+
+ gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
+*/
+
+ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
+/*
+ Returns the starting position for the next gzread or gzwrite on the
+ given compressed file. This position represents a number of bytes in the
+ uncompressed data stream.
+
+ gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
+*/
+
+ZEXTERN int ZEXPORT gzeof OF((gzFile file));
+/*
+ Returns 1 when EOF has previously been detected reading the given
+ input stream, otherwise zero.
+*/
+
+ZEXTERN int ZEXPORT gzclose OF((gzFile file));
+/*
+ Flushes all pending output if necessary, closes the compressed file
+ and deallocates all the (de)compression state. The return value is the zlib
+ error number (see function gzerror below).
+*/
+
+ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
+/*
+ Returns the error message for the last error which occurred on the
+ given compressed file. errnum is set to zlib error number. If an
+ error occurred in the file system and not in the compression library,
+ errnum is set to Z_ERRNO and the application may consult errno
+ to get the exact error code.
+*/
+
+ /* checksum functions */
+
+/*
+ These functions are not related to compression but are exported
+ anyway because they might be useful in applications using the
+ compression library.
+*/
+
+ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
+
+/*
+ Update a running Adler-32 checksum with the bytes buf[0..len-1] and
+ return the updated checksum. If buf is NULL, this function returns
+ the required initial value for the checksum.
+ An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
+ much faster. Usage example:
+
+ uLong adler = adler32(0L, Z_NULL, 0);
+
+ while (read_buffer(buffer, length) != EOF) {
+ adler = adler32(adler, buffer, length);
+ }
+ if (adler != original_adler) error();
+*/
+
+ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
+/*
+ Update a running crc with the bytes buf[0..len-1] and return the updated
+ crc. If buf is NULL, this function returns the required initial value
+ for the crc. Pre- and post-conditioning (one's complement) is performed
+ within this function so it shouldn't be done by the application.
+ Usage example:
+
+ uLong crc = crc32(0L, Z_NULL, 0);
+
+ while (read_buffer(buffer, length) != EOF) {
+ crc = crc32(crc, buffer, length);
+ }
+ if (crc != original_crc) error();
+*/
+
+
+ /* various hacks, don't look :) */
+
+/* deflateInit and inflateInit are macros to allow checking the zlib version
+ * and the compiler's view of z_stream:
+ */
+ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
+ const char *version, int stream_size));
+ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
+ const char *version, int stream_size));
+ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method,
+ int windowBits, int memLevel,
+ int strategy, const char *version,
+ int stream_size));
+ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
+ const char *version, int stream_size));
+#define deflateInit(strm, level) \
+ deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream))
+#define inflateInit(strm) \
+ inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream))
+#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
+ deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
+ (strategy), ZLIB_VERSION, sizeof(z_stream))
+#define inflateInit2(strm, windowBits) \
+ inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
+
+
+#if !defined(_Z_UTIL_H) && !defined(NO_DUMMY_DECL)
+ struct internal_state {int dummy;}; /* hack for buggy compilers */
+#endif
+
+ZEXTERN const char * ZEXPORT zError OF((int err));
+ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z));
+ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ZLIB_H */
diff --git a/win32/libdvdnav.def b/win32/libdvdnav.def new file mode 100644 index 000000000..0265ca71f --- /dev/null +++ b/win32/libdvdnav.def @@ -0,0 +1,47 @@ +;------------------------------------------------------------
+; LIBDVDNAV DLL DEFINITIONS FILE
+
+EXPORTS
+
+dvdnav_set_readahead_flag
+dvdnav_set_region_mask
+dvdnav_spu_language_select
+dvdnav_audio_language_select
+dvdnav_menu_language_select
+dvdnav_get_angle_info
+dvdnav_current_title_info
+dvdnav_title_play
+dvdnav_part_play
+dvdnav_get_number_of_titles
+dvdnav_get_title_string
+dvdnav_open
+dvdnav_close
+dvdnav_wait_skip
+dvdnav_get_video_scale_permission
+dvdnav_get_video_aspect
+dvdnav_still_skip
+dvdnav_err_to_string
+dvdnav_get_next_cache_block
+dvdnav_free_cache_block
+dvdnav_get_position
+dvdnav_sector_search
+dvdnav_get_current_highlight
+dvdnav_button_select_and_activate
+dvdnav_right_button_select
+dvdnav_left_button_select
+dvdnav_lower_button_select
+dvdnav_upper_button_select
+dvdnav_mouse_select
+dvdnav_button_select
+dvdnav_mouse_activate
+dvdnav_button_activate
+dvdnav_angle_change
+dvdnav_prev_pg_search
+dvdnav_next_pg_search
+dvdnav_menu_call
+dvdnav_spu_stream_to_lang
+dvdnav_get_spu_logical_stream
+dvdnav_audio_stream_to_lang
+dvdnav_get_audio_logical_stream
+dvdnav_is_domain_vts
+
diff --git a/win32/libdvdnav.dsp b/win32/libdvdnav.dsp new file mode 100644 index 000000000..c0a8846c8 --- /dev/null +++ b/win32/libdvdnav.dsp @@ -0,0 +1,145 @@ +# Microsoft Developer Studio Project File - Name="libdvdnav" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=libdvdnav - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "libdvdnav.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "libdvdnav.mak" CFG="libdvdnav - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "libdvdnav - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "libdvdnav - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "libdvdnav - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release/libdvdnav"
+# PROP Intermediate_Dir "Release/libdvdnav"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+LIB32=link.exe
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBDVDNAV_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBDVDNAV_EXPORTS" /D "XINE_COMPILE" /D "HAVE_CONFIG_H" /D "__WINE_WINDEF_H" /D "__WINE_WINGDI_H" /D "__WINE_VFW_H" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 /nologo /dll /machine:I386 /out:"Release/bin/libdvdnav.dll"
+
+!ELSEIF "$(CFG)" == "libdvdnav - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug/libdvdnav"
+# PROP Intermediate_Dir "Debug/libdvdnav"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+LIB32=link.exe
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBDVDNAV_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../intl" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /I "../src/input/libdvdread" /I "../src/input/libdvdnav" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBDVDNAV_EXPORTS" /D "XINE_COMPILE" /D "HAVE_CONFIG_H" /D "__WINE_WINDEF_H" /D "__WINE_WINGDI_H" /D "__WINE_VFW_H" /FR /YX /FD /I /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib comctl32.lib /nologo /dll /debug /machine:I386 /out:"Debug/bin/libdvdnav.dll" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "libdvdnav - Win32 Release"
+# Name "libdvdnav - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\src\input\libdvdnav\decoder.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\input\libdvdnav\dvdnav.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\input\libdvdnav\highlight.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\input\libdvdnav\navigation.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\input\libdvdnav\read_cache.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\input\libdvdnav\remap.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\input\libdvdnav\searching.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\input\libdvdnav\settings.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\input\libdvdnav\vm.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\input\libdvdnav\vmcmd.c
+# End Source File
+# End Group
+# Begin Group "DLL Defs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\libdvdnav.def
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/win32/libdvdnav.plg b/win32/libdvdnav.plg new file mode 100644 index 000000000..f0416f206 --- /dev/null +++ b/win32/libdvdnav.plg @@ -0,0 +1,159 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: libdvdnav - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPA1.tmp" with contents
+[
+/nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../intl" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /I "../src/input/libdvdread" /I "../src/input/libdvdnav" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBDVDNAV_EXPORTS" /D "XINE_COMPILE" /D "HAVE_CONFIG_H" /D "__WINE_WINDEF_H" /D "__WINE_WINGDI_H" /D "__WINE_VFW_H" /FR"Debug/libdvdnav/" /Fp"Debug/libdvdnav/libdvdnav.pch" /YX /Fo"Debug/libdvdnav/" /Fd"Debug/libdvdnav/" /FD /I /GZ /c
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\input\libdvdnav\dvdnav.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\input\libdvdnav\highlight.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\input\libdvdnav\navigation.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\input\libdvdnav\read_cache.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\input\libdvdnav\remap.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\input\libdvdnav\searching.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\input\libdvdnav\settings.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\input\libdvdnav\vm.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\input\libdvdnav\vmcmd.c"
+]
+Creating command line "cl.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPA1.tmp"
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPA2.tmp" with contents
+[
+kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib comctl32.lib /nologo /dll /incremental:yes /pdb:"Debug/libdvdnav/libdvdnav.pdb" /debug /machine:I386 /def:".\libdvdnav.def" /out:"Debug/bin/libdvdnav.dll" /implib:"Debug/libdvdnav/libdvdnav.lib" /pdbtype:sept
+".\Debug\libdvdnav\decoder.obj"
+".\Debug\libdvdnav\dvdnav.obj"
+".\Debug\libdvdnav\highlight.obj"
+".\Debug\libdvdnav\navigation.obj"
+".\Debug\libdvdnav\read_cache.obj"
+".\Debug\libdvdnav\remap.obj"
+".\Debug\libdvdnav\searching.obj"
+".\Debug\libdvdnav\settings.obj"
+".\Debug\libdvdnav\vm.obj"
+".\Debug\libdvdnav\vmcmd.obj"
+".\Debug\libxine\libxine.lib"
+".\Debug\libxinesuppt\libxinesuppt.lib"
+".\Debug\libxineutils\libxineutils.lib"
+".\Debug\libdvdread\libdvdread.lib"
+]
+Creating command line "link.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPA2.tmp"
+<h3>Output Window</h3>
+Compiling...
+decoder.c
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(115) : warning C4244: 'return' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(117) : warning C4244: 'function' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(127) : warning C4244: 'return' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(129) : warning C4244: 'function' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(160) : warning C4244: 'initializing' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(162) : warning C4244: 'function' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(171) : warning C4244: 'initializing' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(173) : warning C4244: 'function' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(174) : warning C4244: 'function' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(182) : warning C4244: 'initializing' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(184) : warning C4244: 'function' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(194) : warning C4244: 'initializing' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(196) : warning C4244: 'function' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(224) : warning C4244: '=' : conversion from 'long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(235) : warning C4244: 'initializing' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(236) : warning C4244: 'initializing' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(252) : warning C4244: 'initializing' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(259) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(263) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(264) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(268) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(269) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(273) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(274) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(292) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(296) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(300) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(301) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(310) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(314) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(315) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(316) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(320) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(328) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(332) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(333) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(337) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(338) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(342) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(343) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(370) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(378) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(385) : warning C4244: 'function' : conversion from 'unsigned short ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(411) : warning C4244: 'function' : conversion from 'long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(411) : warning C4244: 'function' : conversion from 'long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(414) : warning C4244: 'function' : conversion from 'long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(414) : warning C4244: 'function' : conversion from 'long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(415) : warning C4244: 'function' : conversion from 'long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(415) : warning C4244: 'function' : conversion from 'long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(418) : warning C4244: 'function' : conversion from 'long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(420) : warning C4244: 'function' : conversion from 'long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(423) : warning C4244: 'function' : conversion from 'long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(425) : warning C4244: 'function' : conversion from 'long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(428) : warning C4244: 'function' : conversion from 'long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(430) : warning C4244: 'function' : conversion from 'long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(434) : warning C4244: 'function' : conversion from 'long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(434) : warning C4244: 'function' : conversion from 'long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(434) : warning C4244: 'function' : conversion from 'long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(436) : warning C4244: 'function' : conversion from 'long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(441) : warning C4244: 'function' : conversion from 'long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(441) : warning C4244: 'function' : conversion from 'long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(441) : warning C4244: 'function' : conversion from 'long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(443) : warning C4244: 'function' : conversion from 'long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(447) : warning C4244: 'function' : conversion from 'long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(450) : warning C4244: 'function' : conversion from 'long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(450) : warning C4244: 'function' : conversion from 'long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(450) : warning C4244: 'function' : conversion from 'long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(453) : warning C4244: 'function' : conversion from 'long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(453) : warning C4244: 'function' : conversion from 'long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(453) : warning C4244: 'function' : conversion from 'long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(456) : warning C4244: 'function' : conversion from 'long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(456) : warning C4244: 'function' : conversion from 'long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(456) : warning C4244: 'function' : conversion from 'long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(463) : warning C4244: 'initializing' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(464) : warning C4244: 'initializing' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(465) : warning C4244: 'initializing' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(476) : warning C4244: 'initializing' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(477) : warning C4244: 'initializing' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(478) : warning C4244: 'initializing' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(580) : warning C4142: benign redefinition of type
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\decoder.c(580) : warning C4028: formal parameter 2 different from declaration
+dvdnav.c
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\dvdnav.c(557) : warning C4002: too many actual parameters for macro 'printerrf'
+highlight.c
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\highlight.c(420) : warning C4244: '=' : conversion from 'long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\highlight.c(491) : warning C4018: '<' : signed/unsigned mismatch
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\highlight.c(500) : warning C4018: '!=' : signed/unsigned mismatch
+navigation.c
+read_cache.c
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\read_cache.c(452) : warning C4003: not enough actual parameters for macro 'dprintf'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\read_cache.c(484) : warning C4003: not enough actual parameters for macro 'dprintf'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\read_cache.c(545) : warning C4002: too many actual parameters for macro 'dprintf'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\read_cache.c(558) : warning C4018: '>' : signed/unsigned mismatch
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\read_cache.c(563) : warning C4002: too many actual parameters for macro 'dprintf'
+remap.c
+searching.c
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\searching.c(79) : warning C4018: '<' : signed/unsigned mismatch
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\searching.c(436) : warning C4018: '==' : signed/unsigned mismatch
+settings.c
+vm.c
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\vm.c(875) : warning C4715: 'vm_get_video_attr' : not all control paths return a value
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\vm.c(888) : warning C4715: 'vm_get_audio_attr' : not all control paths return a value
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdnav\vm.c(901) : warning C4715: 'vm_get_subp_attr' : not all control paths return a value
+vmcmd.c
+Linking...
+ Creating library Debug/libdvdnav/libdvdnav.lib and object Debug/libdvdnav/libdvdnav.exp
+
+
+
+<h3>Results</h3>
+libdvdnav.dll - 0 error(s), 95 warning(s)
+</pre>
+</body>
+</html>
diff --git a/win32/libdvdread.def b/win32/libdvdread.def new file mode 100644 index 000000000..8f9dac2d9 --- /dev/null +++ b/win32/libdvdread.def @@ -0,0 +1,26 @@ +;------------------------------------------------------------
+; LIBDVDREAD DLL DEFINITIONS FILE
+
+EXPORTS
+
+DVDOpen
+DVDClose
+DVDOpenFile
+DVDCloseFile
+DVDReadBlocks
+
+navRead_DSI
+navRead_PCI
+
+ifoClose
+ifoRead_VOBU_ADMAP
+ifoRead_VTS_ATRT
+ifoRead_PTL_MAIT
+ifoRead_PGCI_UT
+ifoRead_TT_SRPT
+ifoRead_FP_PGC
+ifoOpenVMGI
+ifoRead_TITLE_VOBU_ADMAP
+ifoRead_PGCIT
+ifoRead_VTS_PTT_SRPT
+ifoOpenVTSI
\ No newline at end of file diff --git a/win32/libdvdread.dsp b/win32/libdvdread.dsp new file mode 100644 index 000000000..5d5941b0c --- /dev/null +++ b/win32/libdvdread.dsp @@ -0,0 +1,140 @@ +# Microsoft Developer Studio Project File - Name="libdvdread" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=libdvdread - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "libdvdread.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "libdvdread.mak" CFG="libdvdread - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "libdvdread - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "libdvdread - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "libdvdread - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release/libdvdread"
+# PROP Intermediate_Dir "Release/libdvdread"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBDVDREAD_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBDVDREAD_EXPORTS" /D "XINE_COMPILE" /D "HAVE_CONFIG_H" /D "__WINE_WINDEF_H" /D "__WINE_WINGDI_H" /D "__WINE_VFW_H" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 /nologo /dll /machine:I386 /out:"Release/bin/libdvdread.dll"
+# Begin Special Build Tool
+SOURCE="$(InputPath)"
+PostBuild_Desc=Moving Xine Includes
+PostBuild_Cmds=scripts\move_xine_deps.bat Release
+# End Special Build Tool
+
+!ELSEIF "$(CFG)" == "libdvdread - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug/libdvdread"
+# PROP Intermediate_Dir "Debug/libdvdread"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBDVDREAD_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../intl" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /I "../src/input/libdvdcss/src" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBDVDREAD_EXPORTS" /D "XINE_COMPILE" /D "HAVE_CONFIG_H" /D "__WINE_WINDEF_H" /D "__WINE_WINGDI_H" /D "__WINE_VFW_H" /FR /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib comctl32.lib /nologo /dll /debug /machine:I386 /out:"Debug/bin/libdvdread.dll" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "libdvdread - Win32 Release"
+# Name "libdvdread - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\src\input\libdvdread\dvd_input.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\input\libdvdread\dvd_reader.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\input\libdvdread\dvd_udf.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\input\libdvdread\ifo_print.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\input\libdvdread\ifo_read.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\input\libdvdread\md5.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\input\libdvdread\nav_print.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\input\libdvdread\nav_read.c
+# End Source File
+# End Group
+# Begin Group "DLL Defs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\libdvdread.def
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/win32/libdvdread.plg b/win32/libdvdread.plg new file mode 100644 index 000000000..dc059a90f --- /dev/null +++ b/win32/libdvdread.plg @@ -0,0 +1,74 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: libdvdread - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP80.tmp" with contents
+[
+/nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../intl" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /I "../src/input/libdvdcss/src" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBDVDREAD_EXPORTS" /D "XINE_COMPILE" /D "HAVE_CONFIG_H" /D "__WINE_WINDEF_H" /D "__WINE_WINGDI_H" /D "__WINE_VFW_H" /FR"Debug/libdvdread/" /Fp"Debug/libdvdread/libdvdread.pch" /YX /Fo"Debug/libdvdread/" /Fd"Debug/libdvdread/" /FD /GZ /c
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\input\libdvdread\dvd_input.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\input\libdvdread\dvd_reader.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\input\libdvdread\dvd_udf.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\input\libdvdread\ifo_print.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\input\libdvdread\ifo_read.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\input\libdvdread\md5.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\input\libdvdread\nav_print.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\input\libdvdread\nav_read.c"
+]
+Creating command line "cl.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP80.tmp"
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP81.tmp" with contents
+[
+kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib comctl32.lib /nologo /dll /incremental:yes /pdb:"Debug/libdvdread/libdvdread.pdb" /debug /machine:I386 /def:".\libdvdread.def" /out:"Debug/bin/libdvdread.dll" /implib:"Debug/libdvdread/libdvdread.lib" /pdbtype:sept
+".\Debug\libdvdread\dvd_input.obj"
+".\Debug\libdvdread\dvd_reader.obj"
+".\Debug\libdvdread\dvd_udf.obj"
+".\Debug\libdvdread\ifo_print.obj"
+".\Debug\libdvdread\ifo_read.obj"
+".\Debug\libdvdread\md5.obj"
+".\Debug\libdvdread\nav_print.obj"
+".\Debug\libdvdread\nav_read.obj"
+".\Debug\libxine\libxine.lib"
+".\Debug\libxinesuppt\libxinesuppt.lib"
+".\Debug\libxineutils\libxineutils.lib"
+".\Debug\libdvdcss.lib"
+]
+Creating command line "link.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP81.tmp"
+<h3>Output Window</h3>
+Compiling...
+dvd_input.c
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdread\dvd_input.c(164) : warning C4013: 'open' undefined; assuming extern returning int
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdread\dvd_input.c(190) : warning C4013: 'lseek' undefined; assuming extern returning int
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdread\dvd_input.c(218) : warning C4013: 'read' undefined; assuming extern returning int
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdread\dvd_input.c(231) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdread\dvd_input.c(250) : warning C4013: 'close' undefined; assuming extern returning int
+dvd_reader.c
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdread\dvd_reader.c(948) : warning C4142: benign redefinition of type
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdread\dvd_reader.c(948) : warning C4028: formal parameter 2 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdread\dvd_reader.c(1039) : warning C4018: '!=' : signed/unsigned mismatch
+dvd_udf.c
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdread\dvd_udf.c(368) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdread\dvd_udf.c(378) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdread\dvd_udf.c(389) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+ifo_print.c
+ifo_read.c
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdread\ifo_read.c(848) : warning C4018: '<=' : signed/unsigned mismatch
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdread\ifo_read.c(1071) : warning C4018: '<=' : signed/unsigned mismatch
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdread\ifo_read.c(1100) : warning C4018: '<=' : signed/unsigned mismatch
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdread\ifo_read.c(1134) : warning C4018: '<' : signed/unsigned mismatch
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\libdvdread\ifo_read.c(1409) : warning C4018: '<' : signed/unsigned mismatch
+md5.c
+nav_print.c
+nav_read.c
+Linking...
+ Creating library Debug/libdvdread/libdvdread.lib and object Debug/libdvdread/libdvdread.exp
+
+
+
+<h3>Results</h3>
+libdvdread.dll - 0 error(s), 16 warning(s)
+</pre>
+</body>
+</html>
diff --git a/win32/libxine.def b/win32/libxine.def new file mode 100644 index 000000000..d42ffb80d --- /dev/null +++ b/win32/libxine.def @@ -0,0 +1,79 @@ +;------------------------------------------------------------
+; LIBXINE DLL DEFINITIONS FILE
+
+EXPORTS
+
+xine_init
+xine_exit
+xine_play
+xine_set_speed
+xine_get_speed
+xine_stop
+xine_eject
+
+xine_open
+xine_new
+xine_stream_new
+
+xine_get_status
+xine_get_audio_channel
+xine_get_audio_lang
+get_audio_decoder
+xine_get_spu_channel
+xine_get_spu_lang
+xine_select_spu_channel
+get_spu_decoder
+xine_get_browsable_input_plugin_ids
+xine_get_browse_mrls
+xine_get_autoplay_input_plugin_ids
+xine_get_autoplay_mrls
+xine_list_video_output_plugins
+xine_list_audio_output_plugins
+xine_get_current_frame
+xine_get_osd_renderer
+
+xine_open_video_driver
+xine_open_audio_driver
+
+xine_log
+xine_get_log
+xine_get_error
+
+xine_get_version_string
+xine_get_version
+xine_check_version
+xine_set_param
+xine_get_param
+
+xine_get_current_info
+xine_get_stream_info
+xine_get_pos_length
+
+xine_set_speed
+xine_get_speed
+
+xine_tvmode_init
+xine_event_create_listener_thread
+xine_event_new_queue
+xine_event_send
+xine_event_free
+xine_event_get
+xine_event_dispose_queue
+
+xine_message
+
+xine_config_lookup_entry
+xine_config_load
+xine_config_update_entry
+xine_config_register_enum
+
+xine_demux_control_newpts
+xine_demux_control_start
+xine_demux_flush_engine
+
+fourcc_to_buf_video
+formattag_to_buf_audio
+xine_bmiheader_le2me
+xine_waveformatex_le2me
+buf_video_name
+buf_audio_name
diff --git a/win32/libxine.dsp b/win32/libxine.dsp new file mode 100644 index 000000000..b4ac97fd9 --- /dev/null +++ b/win32/libxine.dsp @@ -0,0 +1,203 @@ +# Microsoft Developer Studio Project File - Name="libxine" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=libxine - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "libxine.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "libxine.mak" CFG="libxine - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "libxine - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "libxine - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "libxine - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release/libxine"
+# PROP Intermediate_Dir "Release/libxine"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+LIB32=link.exe
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBXINE_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBXINE_EXPORTS" /D "XINE_COMPILE" /D "HAVE_CONFIG_H" /D "__WINE_WINDEF_H" /D "__WINE_WINGDI_H" /D "__WINE_VFW_H" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 /nologo /dll /machine:I386 /out:"Release/bin/libxine.dll"
+# Begin Special Build Tool
+SOURCE="$(InputPath)"
+PostBuild_Desc=Moving Xine Includes
+PostBuild_Cmds=scripts\move_xine_deps.bat Release
+# End Special Build Tool
+
+!ELSEIF "$(CFG)" == "libxine - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug/libxine"
+# PROP Intermediate_Dir "Debug/libxine"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+LIB32=link.exe
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBXINE_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "include" /I "../include" /I ".." /I "../intl" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBXINE_EXPORTS" /D "XINE_COMPILE" /D "HAVE_CONFIG_H" /D "__WINE_WINDEF_H" /D "__WINE_WINGDI_H" /D "__WINE_VFW_H" /FR /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib comctl32.lib /nologo /dll /debug /machine:I386 /out:"Debug/bin/libxine.dll" /pdbtype:sept
+# Begin Special Build Tool
+SOURCE="$(InputPath)"
+PostBuild_Desc=Moving Xine Dependencies
+PostBuild_Cmds=scripts\move_xine_deps.bat Debug
+# End Special Build Tool
+
+!ENDIF
+
+# Begin Target
+
+# Name "libxine - Win32 Release"
+# Name "libxine - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE="..\src\xine-engine\audio_decoder.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\src\xine-engine\audio_out.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\src\xine-engine\buffer.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\src\xine-engine\buffer_types.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\src\xine-engine\configfile.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\src\xine-engine\demux.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\src\xine-engine\events.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\src\xine-engine\load_plugins.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\src\xine-engine\locale.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\src\xine-engine\lrb.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\src\xine-engine\metronom.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\src\xine-engine\osd.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\src\xine-engine\post.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\src\xine-engine\resample.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\src\xine-engine\scratch.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\src\xine-engine\tvmode.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\src\xine-engine\video_decoder.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\src\xine-engine\video_out.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\src\xine-engine\video_overlay.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\src\xine-engine\vo_scale.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\src\xine-engine\xine.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\src\xine-engine\xine_interface.c"
+# End Source File
+# End Group
+# Begin Group "DLL Defs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\libxine.def
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/win32/libxine.dsw b/win32/libxine.dsw new file mode 100644 index 000000000..053bd51d0 --- /dev/null +++ b/win32/libxine.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "libxine"=".\libxine.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/win32/libxine.plg b/win32/libxine.plg new file mode 100644 index 000000000..f38dc1b49 --- /dev/null +++ b/win32/libxine.plg @@ -0,0 +1,140 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: libxine - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP254.tmp" with contents
+[
+/nologo /MDd /W3 /Gm /GX /ZI /Od /I "include" /I "../include" /I ".." /I "../intl" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBXINE_EXPORTS" /D "XINE_COMPILE" /D "HAVE_CONFIG_H" /D "__WINE_WINDEF_H" /D "__WINE_WINGDI_H" /D "__WINE_VFW_H" /FR"Debug/libxine/" /Fp"Debug/libxine/libxine.pch" /YX /Fo"Debug/libxine/" /Fd"Debug/libxine/" /FD /GZ /c
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\xine-engine\buffer_types.c"
+]
+Creating command line "cl.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP254.tmp"
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP255.tmp" with contents
+[
+kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib comctl32.lib /nologo /dll /incremental:yes /pdb:"Debug/libxine/libxine.pdb" /debug /machine:I386 /def:".\libxine.def" /out:"Debug/bin/libxine.dll" /implib:"Debug/libxine/libxine.lib" /pdbtype:sept
+".\Debug\libxine\audio_decoder.obj"
+".\Debug\libxine\audio_out.obj"
+".\Debug\libxine\buffer.obj"
+".\Debug\libxine\buffer_types.obj"
+".\Debug\libxine\configfile.obj"
+".\Debug\libxine\demux.obj"
+".\Debug\libxine\events.obj"
+".\Debug\libxine\load_plugins.obj"
+".\Debug\libxine\locale.obj"
+".\Debug\libxine\lrb.obj"
+".\Debug\libxine\metronom.obj"
+".\Debug\libxine\osd.obj"
+".\Debug\libxine\post.obj"
+".\Debug\libxine\resample.obj"
+".\Debug\libxine\scratch.obj"
+".\Debug\libxine\tvmode.obj"
+".\Debug\libxine\video_decoder.obj"
+".\Debug\libxine\video_out.obj"
+".\Debug\libxine\video_overlay.obj"
+".\Debug\libxine\vo_scale.obj"
+".\Debug\libxine\xine.obj"
+".\Debug\libxine\xine_interface.obj"
+".\Debug\libxinesuppt\libxinesuppt.lib"
+".\Debug\libxineutils\libxineutils.lib"
+]
+Creating command line "link.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP255.tmp"
+<h3>Output Window</h3>
+Compiling...
+buffer_types.c
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\xine-engine\buffer_types.c(899) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
+Linking...
+ Creating library Debug/libxine/libxine.lib and object Debug/libxine/libxine.exp
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP259.tmp" with contents
+[
+/nologo /o"Debug/libxine/libxine.bsc"
+".\Debug\libxine\audio_decoder.sbr"
+".\Debug\libxine\audio_out.sbr"
+".\Debug\libxine\buffer.sbr"
+".\Debug\libxine\buffer_types.sbr"
+".\Debug\libxine\configfile.sbr"
+".\Debug\libxine\demux.sbr"
+".\Debug\libxine\events.sbr"
+".\Debug\libxine\load_plugins.sbr"
+".\Debug\libxine\locale.sbr"
+".\Debug\libxine\lrb.sbr"
+".\Debug\libxine\metronom.sbr"
+".\Debug\libxine\osd.sbr"
+".\Debug\libxine\post.sbr"
+".\Debug\libxine\resample.sbr"
+".\Debug\libxine\scratch.sbr"
+".\Debug\libxine\tvmode.sbr"
+".\Debug\libxine\video_decoder.sbr"
+".\Debug\libxine\video_out.sbr"
+".\Debug\libxine\video_overlay.sbr"
+".\Debug\libxine\vo_scale.sbr"
+".\Debug\libxine\xine.sbr"
+".\Debug\libxine\xine_interface.sbr"]
+Creating command line "bscmake.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP259.tmp"
+Creating browse info file...
+<h3>Output Window</h3>
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP25A.bat" with contents
+[
+@echo off
+scripts\move_xine_deps.bat Debug
+]
+Creating command line "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP25A.bat"
+Moving Xine Dependencies
+mkdir source\xine ...
+include\xine, Are you sure (Y/N)?
+A subdirectory or file include\xine already exists.
+includes ...
+..\include\xine.h
+1 File(s) copied
+xine-engine ...
+File not found - events.h
+0 File(s) copied
+xine-utils ...
+..\src\xine-utils\attributes.h
+1 File(s) copied
+..\src\xine-utils\compat.h
+1 File(s) copied
+..\src\xine-utils\xineutils.h
+1 File(s) copied
+mkdir Debug\bin\fonts ...
+A subdirectory or file Debug\bin\fonts already exists.
+fonts ...
+..\misc\fonts\cc-16.xinefont.gz
+..\misc\fonts\cc-20.xinefont.gz
+..\misc\fonts\cc-24.xinefont.gz
+..\misc\fonts\cc-32.xinefont.gz
+..\misc\fonts\cci-16.xinefont.gz
+..\misc\fonts\cci-20.xinefont.gz
+..\misc\fonts\cci-24.xinefont.gz
+..\misc\fonts\cci-32.xinefont.gz
+..\misc\fonts\cetus-16.xinefont.gz
+..\misc\fonts\cetus-20.xinefont.gz
+..\misc\fonts\cetus-24.xinefont.gz
+..\misc\fonts\cetus-32.xinefont.gz
+..\misc\fonts\mono-16.xinefont.gz
+..\misc\fonts\mono-20.xinefont.gz
+..\misc\fonts\mono-24.xinefont.gz
+..\misc\fonts\mono-32.xinefont.gz
+..\misc\fonts\sans-16.xinefont.gz
+..\misc\fonts\sans-20.xinefont.gz
+..\misc\fonts\sans-24.xinefont.gz
+..\misc\fonts\sans-32.xinefont.gz
+..\misc\fonts\sanshu-16.xinefont.gz
+..\misc\fonts\sanshu-20.xinefont.gz
+..\misc\fonts\sanshu-24.xinefont.gz
+..\misc\fonts\sanshu-32.xinefont.gz
+..\misc\fonts\serif-16.xinefont.gz
+..\misc\fonts\serif-20.xinefont.gz
+..\misc\fonts\serif-24.xinefont.gz
+..\misc\fonts\serif-32.xinefont.gz
+28 File(s) copied
+
+
+
+<h3>Results</h3>
+libxine.dll - 0 error(s), 1 warning(s)
+</pre>
+</body>
+</html>
diff --git a/win32/libxinesupport.def b/win32/libxinesupport.def new file mode 100644 index 000000000..3af14cc34 --- /dev/null +++ b/win32/libxinesupport.def @@ -0,0 +1,219 @@ +;------------------------------------------------------------
+; LIBXINESUPPORT DLL DEFINITIONS FILE
+
+EXPORTS
+
+;------------------------------------------------------------
+; dirent exports
+
+opendir
+closedir
+readdir
+rewinddir
+
+;------------------------------------------------------------
+; pthread exports
+
+;pthread_atfork
+pthread_attr_destroy
+pthread_attr_getdetachstate
+pthread_attr_getinheritsched
+pthread_attr_getschedparam
+pthread_attr_getschedpolicy
+pthread_attr_getscope
+pthread_attr_getstackaddr
+pthread_attr_getstacksize
+pthread_attr_init
+pthread_attr_setdetachstate
+pthread_attr_setinheritsched
+pthread_attr_setschedparam
+pthread_attr_setschedpolicy
+pthread_attr_setscope
+pthread_attr_setstackaddr
+pthread_attr_setstacksize
+pthread_cancel
+;
+; These two are implemented as macros in pthread.h
+;
+;pthread_cleanup_pop
+;pthread_cleanup_push
+;
+pthread_condattr_destroy
+pthread_condattr_getpshared
+pthread_condattr_init
+pthread_condattr_setpshared
+pthread_cond_broadcast
+pthread_cond_destroy
+pthread_cond_init
+pthread_cond_signal
+pthread_cond_timedwait
+pthread_cond_wait
+pthread_create
+pthread_detach
+pthread_equal
+pthread_exit
+pthread_getconcurrency
+pthread_getschedparam
+pthread_getspecific
+pthread_join
+pthread_key_create
+pthread_key_delete
+;pthread_kill
+pthread_mutexattr_destroy
+;pthread_mutexattr_getprioceiling
+;pthread_mutexattr_getprotocol
+pthread_mutexattr_getpshared
+pthread_mutexattr_gettype
+pthread_mutexattr_init
+;pthread_mutexattr_setprioceiling
+;pthread_mutexattr_setprotocol
+pthread_mutexattr_setpshared
+pthread_mutexattr_settype
+pthread_mutexattr_destroy
+pthread_mutex_init
+pthread_mutex_destroy
+pthread_mutex_lock
+pthread_mutex_trylock
+pthread_mutex_unlock
+pthread_once
+pthread_self
+pthread_setcancelstate
+pthread_setcanceltype
+pthread_setconcurrency
+pthread_setschedparam
+pthread_setspecific
+;pthread_sigmask
+pthread_testcancel
+;
+; POSIX 1.b
+;
+sched_get_priority_min
+sched_get_priority_max
+sched_getscheduler
+sched_setscheduler
+sched_yield
+sem_init
+sem_destroy
+sem_trywait
+sem_wait
+sem_post
+sem_open
+sem_close
+sem_unlink
+sem_getvalue
+;
+; This next one is a macro
+;sched_rr_get_interval
+;
+;
+; Read/Write Locks
+;
+pthread_rwlock_init
+pthread_rwlock_destroy
+pthread_rwlock_tryrdlock
+pthread_rwlock_trywrlock
+pthread_rwlock_rdlock
+pthread_rwlock_wrlock
+pthread_rwlock_unlock
+;
+; Spin locks
+;
+pthread_spin_init
+pthread_spin_destroy
+pthread_spin_lock
+pthread_spin_unlock
+pthread_spin_trylock
+;
+; Barriers
+;
+pthread_barrier_init
+pthread_barrier_destroy
+pthread_barrier_wait
+pthread_barrierattr_init
+pthread_barrierattr_destroy
+pthread_barrierattr_getpshared
+pthread_barrierattr_setpshared
+;
+; Non-portable/compatibility with other implementations
+;
+pthread_delay_np
+pthread_mutexattr_getkind_np
+pthread_mutexattr_setkind_np
+;
+; Non-portable local implementation only
+;
+pthread_getw32threadhandle_np
+pthread_getprocessors_np
+pthreadCancelableWait
+pthreadCancelableTimedWait
+;
+; For use when linking statically
+;
+pthread_win32_process_attach_np
+pthread_win32_process_detach_np
+pthread_win32_thread_attach_np
+pthread_win32_thread_detach_np
+;
+; Needed if !defined(_MSC_VER) && !defined(__cplusplus)
+;
+ptw32_push_cleanup
+ptw32_pop_cleanup
+;
+; Not for use directly. Needed by macros in pthread.h
+; to return internal SEH code.
+;
+ptw32_get_exception_services_code
+
+;------------------------------------------------------------
+; timer exports
+
+adler32
+compress
+crc32
+deflate
+deflateCopy
+deflateEnd
+deflateInit2_
+deflateInit_
+deflateParams
+deflateReset
+deflateSetDictionary
+gzclose
+gzdopen
+gzerror
+gzflush
+gzopen
+gzread
+gzwrite
+inflate
+inflateEnd
+inflateInit2_
+inflateInit_
+inflateReset
+inflateSetDictionary
+inflateSync
+uncompress
+zlibVersion
+gzprintf
+gzputc
+gzgetc
+gzseek
+gzrewind
+gztell
+gzeof
+gzsetparams
+zError
+inflateSyncPoint
+get_crc_table
+compress2
+gzputs
+gzgets
+
+;------------------------------------------------------------
+; timer exports
+
+gettimeofday
+setitimer
+pause
+sleep
+nanosleep
diff --git a/win32/libxinesuppt.dsp b/win32/libxinesuppt.dsp new file mode 100644 index 000000000..880a02a5f --- /dev/null +++ b/win32/libxinesuppt.dsp @@ -0,0 +1,281 @@ +# Microsoft Developer Studio Project File - Name="libxinesuppt" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=libxinesuppt - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "libxinesuppt.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "libxinesuppt.mak" CFG="libxinesuppt - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "libxinesuppt - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "libxinesuppt - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "libxinesuppt - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release/libxinesuppt"
+# PROP Intermediate_Dir "Release/libxinesuppt"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBXINESUPPT_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "contrib/dirent" /I "contrib/pthreads" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBXINESUPPT_EXPORTS" /D "__CLEANUP_C" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 winmm.lib /nologo /dll /machine:I386 /out:"Release/bin/libxinesuppt.dll"
+# Begin Special Build Tool
+SOURCE="$(InputPath)"
+PostBuild_Desc=Moving Contrib Includes
+PostBuild_Cmds=scripts\move_contrib_deps.bat
+# End Special Build Tool
+
+!ELSEIF "$(CFG)" == "libxinesuppt - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug/libxinesuppt"
+# PROP Intermediate_Dir "Debug/libxinesuppt"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBXINESUPPT_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "contrib/dirent" /I "contrib/pthreads" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBXINESUPPT_EXPORTS" /D "__CLEANUP_C" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 winmm.lib /nologo /dll /debug /machine:I386 /out:"Debug/bin/libxinesuppt.dll" /pdbtype:sept
+# Begin Special Build Tool
+SOURCE="$(InputPath)"
+PostBuild_Desc=Moving Contrib Dependencies
+PostBuild_Cmds=scripts\move_contrib_deps.bat
+# End Special Build Tool
+
+!ENDIF
+
+# Begin Target
+
+# Name "libxinesuppt - Win32 Release"
+# Name "libxinesuppt - Win32 Debug"
+# Begin Group "Source Files ( dirent )"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\contrib\dirent\dirent.c
+# End Source File
+# End Group
+# Begin Group "Source Files ( pthreads )"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\contrib\pthreads\attr.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\contrib\pthreads\barrier.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\contrib\pthreads\cancel.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\contrib\pthreads\cleanup.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\contrib\pthreads\condvar.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\contrib\pthreads\create.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\contrib\pthreads\dll.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\contrib\pthreads\errno.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\contrib\pthreads\exit.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\contrib\pthreads\fork.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\contrib\pthreads\global.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\contrib\pthreads\misc.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\contrib\pthreads\mutex.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\contrib\pthreads\nonportable.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\contrib\pthreads\private.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\contrib\pthreads\rwlock.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\contrib\pthreads\sched.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\contrib\pthreads\sched.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\contrib\pthreads\semaphore.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\contrib\pthreads\signal.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\contrib\pthreads\spin.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\contrib\pthreads\sync.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\contrib\pthreads\tsd.c
+# End Source File
+# End Group
+# Begin Group "Source Files ( zlib )"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\contrib\zlib\adler32.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\contrib\zlib\compress.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\contrib\zlib\crc32.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\contrib\zlib\deflate.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\contrib\zlib\gzio.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\contrib\zlib\infblock.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\contrib\zlib\infcodes.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\contrib\zlib\inffast.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\contrib\zlib\inflate.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\contrib\zlib\inftrees.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\contrib\zlib\infutil.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\contrib\zlib\trees.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\contrib\zlib\uncompr.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\contrib\zlib\zutil.c
+# End Source File
+# End Group
+# Begin Group "Source Files ( timer )"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\contrib\timer\timer.c
+# End Source File
+# End Group
+# Begin Group "DLL Defs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\libxinesupport.def
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/win32/libxinesuppt.plg b/win32/libxinesuppt.plg new file mode 100644 index 000000000..b43c72d81 --- /dev/null +++ b/win32/libxinesuppt.plg @@ -0,0 +1,169 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: libxinesuppt - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP1BD.tmp" with contents
+[
+/nologo /MDd /W3 /Gm /GX /ZI /Od /I "contrib/dirent" /I "contrib/pthreads" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBXINESUPPT_EXPORTS" /D "__CLEANUP_C" /Fp"Debug/libxinesuppt/libxinesuppt.pch" /YX /Fo"Debug/libxinesuppt/" /Fd"Debug/libxinesuppt/" /FD /GZ /c
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\dirent\dirent.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\pthreads\attr.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\pthreads\barrier.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\pthreads\cancel.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\pthreads\cleanup.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\pthreads\condvar.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\pthreads\create.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\pthreads\dll.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\pthreads\errno.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\pthreads\exit.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\pthreads\fork.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\pthreads\global.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\pthreads\misc.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\pthreads\mutex.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\pthreads\nonportable.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\pthreads\private.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\pthreads\rwlock.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\pthreads\sched.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\pthreads\semaphore.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\pthreads\signal.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\pthreads\spin.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\pthreads\sync.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\pthreads\tsd.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\zlib\adler32.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\zlib\compress.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\zlib\crc32.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\zlib\deflate.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\zlib\gzio.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\zlib\infblock.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\zlib\infcodes.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\zlib\inffast.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\zlib\inflate.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\zlib\inftrees.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\zlib\infutil.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\zlib\trees.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\zlib\uncompr.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\zlib\zutil.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\contrib\timer\timer.c"
+]
+Creating command line "cl.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP1BD.tmp"
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP1BE.tmp" with contents
+[
+winmm.lib /nologo /dll /incremental:yes /pdb:"Debug/libxinesuppt/libxinesuppt.pdb" /debug /machine:I386 /def:".\libxinesupport.def" /out:"Debug/bin/libxinesuppt.dll" /implib:"Debug/libxinesuppt/libxinesuppt.lib" /pdbtype:sept
+".\Debug\libxinesuppt\dirent.obj"
+".\Debug\libxinesuppt\attr.obj"
+".\Debug\libxinesuppt\barrier.obj"
+".\Debug\libxinesuppt\cancel.obj"
+".\Debug\libxinesuppt\cleanup.obj"
+".\Debug\libxinesuppt\condvar.obj"
+".\Debug\libxinesuppt\create.obj"
+".\Debug\libxinesuppt\dll.obj"
+".\Debug\libxinesuppt\errno.obj"
+".\Debug\libxinesuppt\exit.obj"
+".\Debug\libxinesuppt\fork.obj"
+".\Debug\libxinesuppt\global.obj"
+".\Debug\libxinesuppt\misc.obj"
+".\Debug\libxinesuppt\mutex.obj"
+".\Debug\libxinesuppt\nonportable.obj"
+".\Debug\libxinesuppt\private.obj"
+".\Debug\libxinesuppt\rwlock.obj"
+".\Debug\libxinesuppt\sched.obj"
+".\Debug\libxinesuppt\semaphore.obj"
+".\Debug\libxinesuppt\signal.obj"
+".\Debug\libxinesuppt\spin.obj"
+".\Debug\libxinesuppt\sync.obj"
+".\Debug\libxinesuppt\tsd.obj"
+".\Debug\libxinesuppt\adler32.obj"
+".\Debug\libxinesuppt\compress.obj"
+".\Debug\libxinesuppt\crc32.obj"
+".\Debug\libxinesuppt\deflate.obj"
+".\Debug\libxinesuppt\gzio.obj"
+".\Debug\libxinesuppt\infblock.obj"
+".\Debug\libxinesuppt\infcodes.obj"
+".\Debug\libxinesuppt\inffast.obj"
+".\Debug\libxinesuppt\inflate.obj"
+".\Debug\libxinesuppt\inftrees.obj"
+".\Debug\libxinesuppt\infutil.obj"
+".\Debug\libxinesuppt\trees.obj"
+".\Debug\libxinesuppt\uncompr.obj"
+".\Debug\libxinesuppt\zutil.obj"
+".\Debug\libxinesuppt\timer.obj"
+]
+Creating command line "link.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP1BE.tmp"
+<h3>Output Window</h3>
+Compiling...
+dirent.c
+attr.c
+barrier.c
+cancel.c
+cleanup.c
+condvar.c
+create.c
+dll.c
+errno.c
+exit.c
+fork.c
+global.c
+misc.c
+mutex.c
+nonportable.c
+private.c
+rwlock.c
+sched.c
+semaphore.c
+signal.c
+spin.c
+sync.c
+tsd.c
+adler32.c
+compress.c
+crc32.c
+deflate.c
+gzio.c
+infblock.c
+infcodes.c
+inffast.c
+inflate.c
+inftrees.c
+infutil.c
+trees.c
+uncompr.c
+zutil.c
+timer.c
+Linking...
+ Creating library Debug/libxinesuppt/libxinesuppt.lib and object Debug/libxinesuppt/libxinesuppt.exp
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP1C2.bat" with contents
+[
+@echo off
+scripts\move_contrib_deps.bat
+]
+Creating command line "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP1C2.bat"
+Moving Contrib Dependencies
+dirent ...
+contrib\dirent\dirent.h
+1 File(s) copied
+pthreads ...
+contrib\pthreads\pthread.h
+1 File(s) copied
+contrib\pthreads\sched.h
+1 File(s) copied
+contrib\pthreads\semaphore.h
+1 File(s) copied
+zlib ...
+contrib\zlib\zlib.h
+1 File(s) copied
+contrib\zlib\zconf.h
+1 File(s) copied
+timer ...
+contrib\timer\timer.h
+1 File(s) copied
+
+
+
+<h3>Results</h3>
+libxinesuppt.dll - 0 error(s), 0 warning(s)
+</pre>
+</body>
+</html>
diff --git a/win32/libxineutils.dsp b/win32/libxineutils.dsp new file mode 100644 index 000000000..ef877f22b --- /dev/null +++ b/win32/libxineutils.dsp @@ -0,0 +1,147 @@ +# Microsoft Developer Studio Project File - Name="libxineutils" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=libxineutils - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "libxineutils.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "libxineutils.mak" CFG="libxineutils - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "libxineutils - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "libxineutils - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "libxineutils - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release/xinelibutils"
+# PROP Intermediate_Dir "Release/xinelibutils"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBXINEUTILS_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBXINEUTILS_EXPORTS" /D "XINE_COMPILE" /D "HAVE_CONFIG_H" /D "HAVE_NANOSLEEP" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 /nologo /dll /machine:I386 /out:"Release/bin/libxineutils.dll"
+
+!ELSEIF "$(CFG)" == "libxineutils - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug/libxineutils"
+# PROP Intermediate_Dir "Debug/libxineutils"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBXINEUTILS_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "include" /I "../include" /I "../src" /I ".." /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBXINEUTILS_EXPORTS" /D "XINE_COMPILE" /D "HAVE_CONFIG_H" /D "HAVE_NANOSLEEP" /FR /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 /nologo /dll /debug /machine:I386 /out:"Debug/bin/libxineutils.dll" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "libxineutils - Win32 Release"
+# Name "libxineutils - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE="..\src\xine-utils\color.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\src\xine-utils\cpu_accel.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\src\xine-utils\list.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\src\xine-utils\memcpy.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\src\xine-utils\monitor.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\src\xine-utils\utils.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\src\xine-utils\xine_buffer.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\src\xine-utils\xine_check.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\src\xine-utils\xine_mutex.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\src\xine-utils\xmllexer.c"
+# End Source File
+# Begin Source File
+
+SOURCE="..\src\xine-utils\xmlparser.c"
+# End Source File
+# End Group
+# Begin Group "DLL Defs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\xineutils.def
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/win32/libxineutils.plg b/win32/libxineutils.plg new file mode 100644 index 000000000..b249f04f6 --- /dev/null +++ b/win32/libxineutils.plg @@ -0,0 +1,62 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: libxineutils - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP1C7.tmp" with contents
+[
+/nologo /MDd /W3 /Gm /GX /ZI /Od /I "include" /I "../include" /I "../src" /I ".." /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBXINEUTILS_EXPORTS" /D "XINE_COMPILE" /D "HAVE_CONFIG_H" /D "HAVE_NANOSLEEP" /FR"Debug/libxineutils/" /Fp"Debug/libxineutils/libxineutils.pch" /YX /Fo"Debug/libxineutils/" /Fd"Debug/libxineutils/" /FD /GZ /c
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\xine-utils\cpu_accel.c"
+]
+Creating command line "cl.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP1C7.tmp"
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP1C8.tmp" with contents
+[
+/nologo /dll /incremental:yes /pdb:"Debug/libxineutils/libxineutils.pdb" /debug /machine:I386 /def:".\xineutils.def" /out:"Debug/bin/libxineutils.dll" /implib:"Debug/libxineutils/libxineutils.lib" /pdbtype:sept
+".\Debug\libxineutils\color.obj"
+".\Debug\libxineutils\cpu_accel.obj"
+".\Debug\libxineutils\list.obj"
+".\Debug\libxineutils\memcpy.obj"
+".\Debug\libxineutils\monitor.obj"
+".\Debug\libxineutils\utils.obj"
+".\Debug\libxineutils\xine_buffer.obj"
+".\Debug\libxineutils\xine_check.obj"
+".\Debug\libxineutils\xine_mutex.obj"
+".\Debug\libxineutils\xmllexer.obj"
+".\Debug\libxineutils\xmlparser.obj"
+".\Debug\libxinesuppt\libxinesuppt.lib"
+]
+Creating command line "link.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP1C8.tmp"
+<h3>Output Window</h3>
+Compiling...
+cpu_accel.c
+Linking...
+ Creating library Debug/libxineutils/libxineutils.lib and object Debug/libxineutils/libxineutils.exp
+LINK : warning LNK4049: locally defined symbol "_xine_fast_memcpy" imported
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP1CC.tmp" with contents
+[
+/nologo /o"Debug/libxineutils/libxineutils.bsc"
+".\Debug\libxineutils\color.sbr"
+".\Debug\libxineutils\cpu_accel.sbr"
+".\Debug\libxineutils\list.sbr"
+".\Debug\libxineutils\memcpy.sbr"
+".\Debug\libxineutils\monitor.sbr"
+".\Debug\libxineutils\utils.sbr"
+".\Debug\libxineutils\xine_buffer.sbr"
+".\Debug\libxineutils\xine_check.sbr"
+".\Debug\libxineutils\xine_mutex.sbr"
+".\Debug\libxineutils\xmllexer.sbr"
+".\Debug\libxineutils\xmlparser.sbr"]
+Creating command line "bscmake.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP1CC.tmp"
+Creating browse info file...
+<h3>Output Window</h3>
+
+
+
+<h3>Results</h3>
+libxineutils.dll - 0 error(s), 1 warning(s)
+</pre>
+</body>
+</html>
diff --git a/win32/scripts/move_contrib_deps.bat b/win32/scripts/move_contrib_deps.bat new file mode 100644 index 000000000..aae8c72bc --- /dev/null +++ b/win32/scripts/move_contrib_deps.bat @@ -0,0 +1,16 @@ +
+ECHO dirent ...
+xcopy /Y contrib\dirent\dirent.h include\
+
+ECHO pthreads ...
+xcopy /Y contrib\pthreads\pthread.h include\
+xcopy /Y contrib\pthreads\sched.h include\
+xcopy /Y contrib\pthreads\semaphore.h include\
+
+ECHO zlib ...
+xcopy /Y contrib\zlib\zlib.h include\
+xcopy /Y contrib\zlib\zconf.h include\
+
+ECHO timer ...
+xcopy /Y contrib\timer\timer.h include\
+
diff --git a/win32/scripts/move_xine_deps.bat b/win32/scripts/move_xine_deps.bat new file mode 100644 index 000000000..e3f78b9f1 --- /dev/null +++ b/win32/scripts/move_xine_deps.bat @@ -0,0 +1,22 @@ +
+
+ECHO mkdir source\xine ...
+rmdir /s include\xine
+mkdir include\xine
+
+ECHO includes ...
+xcopy /Y ..\include\xine.h include\xine
+
+ECHO xine-engine ...
+xcopy /Y ..\src\xine-engine\events.h include\xine
+
+ECHO xine-utils ...
+xcopy /Y ..\src\xine-utils\attributes.h include\xine
+xcopy /Y ..\src\xine-utils\compat.h include\xine
+xcopy /Y ..\src\xine-utils\xineutils.h include\xine
+
+ECHO mkdir %1\bin\fonts ...
+mkdir %1\bin\fonts
+
+ECHO fonts ...
+xcopy /Y /s ..\misc\fonts\*.gz %1\bin\fonts
\ No newline at end of file diff --git a/win32/source/bitmap1.bmp b/win32/source/bitmap1.bmp Binary files differnew file mode 100644 index 000000000..e4da913f5 --- /dev/null +++ b/win32/source/bitmap1.bmp diff --git a/win32/source/bmp00001.bmp b/win32/source/bmp00001.bmp Binary files differnew file mode 100644 index 000000000..872c46217 --- /dev/null +++ b/win32/source/bmp00001.bmp diff --git a/win32/source/bmp00002.bmp b/win32/source/bmp00002.bmp Binary files differnew file mode 100644 index 000000000..298ae556c --- /dev/null +++ b/win32/source/bmp00002.bmp diff --git a/win32/source/bmp00003.bmp b/win32/source/bmp00003.bmp Binary files differnew file mode 100644 index 000000000..f1b7369f8 --- /dev/null +++ b/win32/source/bmp00003.bmp diff --git a/win32/source/bmp00004.bmp b/win32/source/bmp00004.bmp Binary files differnew file mode 100644 index 000000000..4fcd24d30 --- /dev/null +++ b/win32/source/bmp00004.bmp diff --git a/win32/source/bmp00005.bmp b/win32/source/bmp00005.bmp Binary files differnew file mode 100644 index 000000000..e3891558b --- /dev/null +++ b/win32/source/bmp00005.bmp diff --git a/win32/source/bmp00006.bmp b/win32/source/bmp00006.bmp Binary files differnew file mode 100644 index 000000000..0d4f3f170 --- /dev/null +++ b/win32/source/bmp00006.bmp diff --git a/win32/source/bmp00007.bmp b/win32/source/bmp00007.bmp Binary files differnew file mode 100644 index 000000000..db8faada8 --- /dev/null +++ b/win32/source/bmp00007.bmp diff --git a/win32/source/bmp00008.bmp b/win32/source/bmp00008.bmp Binary files differnew file mode 100644 index 000000000..901fabc1b --- /dev/null +++ b/win32/source/bmp00008.bmp diff --git a/win32/source/bmp00009.bmp b/win32/source/bmp00009.bmp Binary files differnew file mode 100644 index 000000000..0649060c6 --- /dev/null +++ b/win32/source/bmp00009.bmp diff --git a/win32/source/bmp00010.bmp b/win32/source/bmp00010.bmp Binary files differnew file mode 100644 index 000000000..c9c374882 --- /dev/null +++ b/win32/source/bmp00010.bmp diff --git a/win32/source/bmp00011.bmp b/win32/source/bmp00011.bmp Binary files differnew file mode 100644 index 000000000..9d53f02ce --- /dev/null +++ b/win32/source/bmp00011.bmp diff --git a/win32/source/bmp_arro.bmp b/win32/source/bmp_arro.bmp Binary files differnew file mode 100644 index 000000000..a517fbd75 --- /dev/null +++ b/win32/source/bmp_arro.bmp diff --git a/win32/source/bmp_conf.bmp b/win32/source/bmp_conf.bmp Binary files differnew file mode 100644 index 000000000..0df61b47b --- /dev/null +++ b/win32/source/bmp_conf.bmp diff --git a/win32/source/bmp_ffor.bmp b/win32/source/bmp_ffor.bmp Binary files differnew file mode 100644 index 000000000..03f5bf844 --- /dev/null +++ b/win32/source/bmp_ffor.bmp diff --git a/win32/source/bmp_full.bmp b/win32/source/bmp_full.bmp Binary files differnew file mode 100644 index 000000000..7268627c3 --- /dev/null +++ b/win32/source/bmp_full.bmp diff --git a/win32/source/bmp_next.bmp b/win32/source/bmp_next.bmp Binary files differnew file mode 100644 index 000000000..37ed99699 --- /dev/null +++ b/win32/source/bmp_next.bmp diff --git a/win32/source/bmp_play.bmp b/win32/source/bmp_play.bmp Binary files differnew file mode 100644 index 000000000..e129a4b7d --- /dev/null +++ b/win32/source/bmp_play.bmp diff --git a/win32/source/bmp_prev.bmp b/win32/source/bmp_prev.bmp Binary files differnew file mode 100644 index 000000000..93de40bc7 --- /dev/null +++ b/win32/source/bmp_prev.bmp diff --git a/win32/source/bmp_volu.bmp b/win32/source/bmp_volu.bmp Binary files differnew file mode 100644 index 000000000..9774b430d --- /dev/null +++ b/win32/source/bmp_volu.bmp diff --git a/win32/source/icon1.ico b/win32/source/icon1.ico Binary files differnew file mode 100644 index 000000000..23a904bfa --- /dev/null +++ b/win32/source/icon1.ico diff --git a/win32/source/main.cpp b/win32/source/main.cpp new file mode 100644 index 000000000..f57cc2713 --- /dev/null +++ b/win32/source/main.cpp @@ -0,0 +1,184 @@ +/*
+ * Copyright (C) 2000-2001 the xine project
+ *
+ * This file is part of xine for win32 video player.
+ *
+ * xine 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * xine 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * Xine win32 UI
+ * by Matthew Grooms <elon@altavista.com>
+ */
+
+#include "xineui.h"
+#include "common.h"
+
+#include <fcntl.h>
+#include <io.h>
+
+#define MAX_CONSOLE_LINES 1000
+
+gGui_t *gGui;
+
+void RedirectIOToConsole()
+{
+ int hConHandle;
+ long lStdHandle;
+ CONSOLE_SCREEN_BUFFER_INFO coninfo;
+ FILE *fp;
+
+ // allocate a console for this app
+ AllocConsole();
+
+ // set the screen buffer to be big enough to let us scroll text
+ GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE),
+ &coninfo);
+ coninfo.dwSize.Y = MAX_CONSOLE_LINES;
+ SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE),
+ coninfo.dwSize);
+
+ // redirect unbuffered STDOUT to the console
+ lStdHandle = (long)GetStdHandle(STD_OUTPUT_HANDLE);
+ hConHandle = _open_osfhandle(lStdHandle, _O_TEXT);
+ fp = _fdopen( hConHandle, "w" );
+ *stdout = *fp;
+ setvbuf( stdout, NULL, _IONBF, 0 );
+
+ // redirect unbuffered STDIN to the console
+ lStdHandle = (long)GetStdHandle(STD_INPUT_HANDLE);
+ hConHandle = _open_osfhandle(lStdHandle, _O_TEXT);
+ fp = _fdopen( hConHandle, "r" );
+ *stdin = *fp;
+ setvbuf( stdin, NULL, _IONBF, 0 );
+
+ // redirect unbuffered STDERR to the console
+ lStdHandle = (long)GetStdHandle(STD_ERROR_HANDLE);
+ hConHandle = _open_osfhandle(lStdHandle, _O_TEXT);
+ fp = _fdopen( hConHandle, "w" );
+ *stderr = *fp;
+ setvbuf( stderr, NULL, _IONBF, 0 );
+
+ // make cout, wcout, cin, wcin, wcerr, cerr, wclog and clog
+ // point to console as well
+ /*ios::sync_with_stdio();*/
+}
+
+int WINAPI WinMain( HINSTANCE hinst, HINSTANCE hprevinst, LPSTR cmdline, int ncmdshow )
+{
+ XINE_UI xine_ui;
+
+
+#if !defined (__MINGW32__)
+ /* We only need the output window for MSVC */
+ RedirectIOToConsole();
+#endif
+
+ // prepair our mrl(s) and add them
+ // to our playlist
+
+ char * next_mrl = cmdline;
+ while( next_mrl )
+ {
+ char temp_mrl[ 1024 ];
+ memset( temp_mrl, 0, sizeof( temp_mrl ) );
+
+ if( *next_mrl == 0 )
+ break;
+
+ if( *next_mrl == ' ' )
+ {
+ next_mrl++;
+ continue;
+ }
+
+ if( *next_mrl == '\"' )
+ {
+ strcpy( temp_mrl, next_mrl + 1 );
+
+ char * end_mrl = strchr( temp_mrl, '\"' );
+ if( end_mrl )
+ {
+ *end_mrl = 0;
+ next_mrl = end_mrl + 1;
+ }
+ else
+ next_mrl = 0;
+ }
+ else
+ {
+ strcpy( temp_mrl, next_mrl );
+
+ char * end_mrl = strchr( temp_mrl, ' ' );
+ if( end_mrl )
+ {
+ *end_mrl = 0;
+ next_mrl = end_mrl + 1;
+ }
+ else
+ next_mrl = 0;
+ }
+
+ char * back_slash = strrchr( temp_mrl, '\\' );
+ char * fore_slash = strrchr( temp_mrl, '/' );
+ char * last_slash = 0;
+
+ if( back_slash > temp_mrl )
+ if( *( back_slash - 1 ) == ':' )
+ back_slash = 0;
+
+ if( back_slash > fore_slash )
+ last_slash = back_slash;
+ else
+ last_slash = fore_slash;
+
+ if( last_slash )
+ xine_ui.PlaylistAdd( last_slash + 1, temp_mrl, 0 );
+ else
+ xine_ui.PlaylistAdd( temp_mrl, temp_mrl, 0 );
+ }
+
+ // initialize common control tools
+
+ InitCommonControls();
+
+ // init gui
+
+ if( !xine_ui.InitGui( hinst ) )
+ return 1;
+
+ // init libxine
+
+ if( !xine_ui.InitXine() )
+ return 1;
+
+ // start playback
+
+ if( xine_ui.playcount )
+ xine_ui.Play( 0 );
+
+
+ // start the message loop.
+
+ MSG msg;
+
+ while( GetMessage( &msg, ( HWND ) NULL, 0, 0 ) )
+ {
+ TranslateMessage( &msg );
+ DispatchMessage( &msg );
+ }
+
+ // return the exit code to Windows.
+
+ return msg.wParam;
+}
diff --git a/win32/source/resource.aps b/win32/source/resource.aps Binary files differnew file mode 100644 index 000000000..ae5263339 --- /dev/null +++ b/win32/source/resource.aps diff --git a/win32/source/resource.h b/win32/source/resource.h new file mode 100644 index 000000000..7afff8c3c --- /dev/null +++ b/win32/source/resource.h @@ -0,0 +1,47 @@ +//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by resource.rc
+//
+#define dialog_main 101
+#define bmp_xine_logo 104
+#define bmp_play_button 105
+#define bmp_pause_button 106
+#define bmp_stop_button 107
+#define bmp_prev_button 108
+#define bmp_next_button 109
+#define bmp_fforward_button 110
+#define bmp_rwind_button 111
+#define bmp_eject_button 112
+#define bmp_volume_on_button 113
+#define bmp_volume_off_button 114
+#define ico_xine_logo 117
+#define bmp_arrow_up_normal 119
+#define bmp_arrow_down_selected 120
+#define bmp_arrow_up_selected 121
+#define bmp_arrow_down_normal 122
+#define bmp_fullscreen_off_normal 123
+#define bmp_fullscreen_off_selected 124
+#define bmp_fullscreen_on_normal 125
+#define bmp_fullscreen_on_selected 126
+#define bmp_configure_normal 127
+#define bmp_configure_selected 128
+#define slider_video 1000
+#define button_play 1001
+#define button_pause 1002
+#define button_stop 1003
+#define button_prev 1004
+#define button_rwiind 1005
+#define button_fforward 1006
+#define button_next 1007
+#define slider_audio 1008
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 128
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1016
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/win32/source/resource.rc b/win32/source/resource.rc new file mode 100644 index 000000000..653ecca5d --- /dev/null +++ b/win32/source/resource.rc @@ -0,0 +1,99 @@ +//Microsoft Developer Studio generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Bitmap
+//
+
+bmp_xine_logo BITMAP DISCARDABLE "xine_logo.bmp"
+bmp_play_button BITMAP DISCARDABLE "bitmap1.bmp"
+bmp_pause_button BITMAP DISCARDABLE "bmp_play.bmp"
+bmp_stop_button BITMAP DISCARDABLE "bmp00001.bmp"
+bmp_prev_button BITMAP DISCARDABLE "bmp00002.bmp"
+bmp_next_button BITMAP DISCARDABLE "bmp_prev.bmp"
+bmp_fforward_button BITMAP DISCARDABLE "bmp_next.bmp"
+bmp_rwind_button BITMAP DISCARDABLE "bmp_ffor.bmp"
+bmp_eject_button BITMAP DISCARDABLE "bmp00003.bmp"
+bmp_volume_on_button BITMAP DISCARDABLE "bmp00004.bmp"
+bmp_volume_off_button BITMAP DISCARDABLE "bmp_volu.bmp"
+bmp_arrow_up_normal BITMAP DISCARDABLE "bmp00005.bmp"
+bmp_arrow_down_selected BITMAP DISCARDABLE "bmp00006.bmp"
+bmp_arrow_up_selected BITMAP DISCARDABLE "bmp_arro.bmp"
+bmp_arrow_down_normal BITMAP DISCARDABLE "bmp00007.bmp"
+bmp_fullscreen_off_normal BITMAP DISCARDABLE "bmp_full.bmp"
+bmp_fullscreen_off_selected BITMAP DISCARDABLE "bmp00008.bmp"
+bmp_fullscreen_on_normal BITMAP DISCARDABLE "bmp00009.bmp"
+bmp_fullscreen_on_selected BITMAP DISCARDABLE "bmp00010.bmp"
+bmp_configure_normal BITMAP DISCARDABLE "bmp_conf.bmp"
+bmp_configure_selected BITMAP DISCARDABLE "bmp00011.bmp"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+ico_xine_logo ICON DISCARDABLE "icon1.ico"
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/win32/source/utils.cpp b/win32/source/utils.cpp new file mode 100644 index 000000000..cce30acc8 --- /dev/null +++ b/win32/source/utils.cpp @@ -0,0 +1,61 @@ +
+#include "xineui.h"
+
+int Question( HWND hwnd, LPSTR szFmt, ... )
+{
+
+ char szBuff[256];
+
+ *szBuff = 0;
+ wvsprintf( &szBuff[ strlen( szBuff ) ],
+ szFmt,
+ (CHAR *)(&szFmt+1) );
+
+ return MessageBox( hwnd, szBuff, "Question", MB_ICONQUESTION | MB_YESNO | MB_APPLMODAL );
+}
+
+void Error( HWND hwnd, LPSTR szFmt, ... )
+{
+
+ char szBuff[256];
+
+ *szBuff = 0;
+ wvsprintf( &szBuff[ strlen( szBuff ) ],
+ szFmt,
+ (CHAR *)(&szFmt+1) );
+
+ MessageBox( hwnd, szBuff, "Error", MB_ICONERROR | MB_OK | MB_APPLMODAL | MB_SYSTEMMODAL );
+}
+
+BOOL CenterWindow( HWND hwnd )
+{
+ RECT window_rect;
+ GetWindowRect( hwnd, &window_rect );
+
+ int screen_x = GetSystemMetrics( SM_CXFULLSCREEN );
+ int screen_y = GetSystemMetrics( SM_CYFULLSCREEN );
+
+ int window_x = screen_x / 2 - ( window_rect.right - window_rect.left ) / 2;
+ int window_y = screen_y / 2 - ( window_rect.bottom - window_rect.top ) / 2;
+
+ return SetWindowPos( hwnd, HWND_TOP, window_x, window_y, 0, 0, SWP_NOSIZE );
+}
+
+BOOL AnchorWindow( HWND hwnd )
+{
+ HWND phwnd = GetParent( hwnd );
+
+ RECT parent_rect;
+ GetWindowRect( phwnd, &parent_rect );
+
+ RECT window_rect;
+ GetWindowRect( hwnd, &window_rect );
+
+ int center_x = parent_rect.left + ( parent_rect.right - parent_rect.left ) / 2;
+ int center_y = parent_rect.top + ( parent_rect.bottom - parent_rect.top ) / 2;
+
+ int window_x = center_x - ( window_rect.right - window_rect.left ) / 2;
+ int window_y = center_y - ( window_rect.bottom - window_rect.top ) / 2;
+
+ return SetWindowPos( hwnd, HWND_TOP, window_x, window_y, 0, 0, SWP_NOSIZE );
+}
diff --git a/win32/source/utils.h b/win32/source/utils.h new file mode 100644 index 000000000..9fca5a926 --- /dev/null +++ b/win32/source/utils.h @@ -0,0 +1,14 @@ +
+#ifndef _UTILS_H_
+#define _UTILS_H_
+
+extern BOOL CenterWindow( HWND hwnd );
+extern BOOL AnchorWindow( HWND hwnd );
+
+extern void SetTextNormal( HWND hwnd, char * newstatus );
+extern void SetTextError( HWND hwnd, char * newstatus );
+
+extern int Question( HWND hwnd, LPSTR szFmt, ... );
+extern void Error( HWND hwnd, LPSTR szFmt, ... );
+
+#endif
\ No newline at end of file diff --git a/win32/source/wnd.ctrl.cpp b/win32/source/wnd.ctrl.cpp new file mode 100644 index 000000000..7b0ce9de3 --- /dev/null +++ b/win32/source/wnd.ctrl.cpp @@ -0,0 +1,430 @@ +/*
+ * Copyright (C) 2000-2001 the xine project
+ *
+ * This file is part of xine for win32 video player.
+ *
+ * xine 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * xine 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * Xine win32 UI
+ * by Matthew Grooms <elon@altavista.com>
+ */
+
+#include "xineui.h"
+
+#define WINDOW_WIDTH 215
+#define WINDOW_HEIGHT 85
+
+HIMAGELIST himagelist;
+
+LRESULT CALLBACK proc_ctrlwnd( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
+{
+ XINE_UI * xine_ui = ( XINE_UI * ) GetWindowLong( hwnd, GWL_USERDATA );
+
+ switch( msg )
+ {
+ case WM_COMMAND:
+ {
+ WORD ncode = HIWORD( wparam ); // notification code
+ WORD cid = LOWORD( wparam ); // item, control, or accelerator identifier
+ HWND chwnd = ( HWND ) lparam; // handle of control
+
+ if( cid == ID_PLAY_BTTN )
+ {
+ xine_ui->Play( 0 );
+ return 0L;
+ }
+
+ if( cid == ID_STOP_BTTN )
+ {
+ xine_ui->Stop();
+ return 0L;
+ }
+
+ if( cid == ID_PAUSE_BTTN )
+ {
+ xine_ui->SetSpeed( XINE_SPEED_PAUSE );
+ return 0L;
+ }
+
+ if( cid == ID_NEXT_BTTN )
+ {
+ xine_ui->Stop();
+ xine_ui->Play( xine_ui->playindex + 1 );
+ return 0L;
+ }
+
+ if( cid == ID_PREV_BTTN )
+ {
+ xine_ui->Stop();
+ xine_ui->Play( xine_ui->playindex - 1 );
+ return 0L;
+ }
+
+ if( cid == ID_RWND_BTTN )
+ {
+ int current_speed = xine_ui->GetSpeed();
+
+ if( current_speed == XINE_SPEED_FAST_4 )
+ xine_ui->SetSpeed( XINE_SPEED_FAST_2 );
+
+ else if( current_speed == XINE_SPEED_FAST_2 )
+ xine_ui->SetSpeed( XINE_SPEED_NORMAL );
+
+ else if( current_speed == XINE_SPEED_NORMAL )
+ xine_ui->SetSpeed( XINE_SPEED_SLOW_2 );
+
+ else if( current_speed == XINE_SPEED_SLOW_2 )
+ xine_ui->SetSpeed( XINE_SPEED_SLOW_4 );
+
+ else if( current_speed == XINE_SPEED_SLOW_4 )
+ xine_ui->SetSpeed( XINE_SPEED_PAUSE );
+
+ return 0L;
+ }
+
+ if( cid == ID_FFWD_BTTN )
+ {
+ int current_speed = xine_ui->GetSpeed();
+
+ if( current_speed == XINE_SPEED_PAUSE )
+ xine_ui->SetSpeed( XINE_SPEED_SLOW_4 );
+
+ else if( current_speed == XINE_SPEED_SLOW_4 )
+ xine_ui->SetSpeed( XINE_SPEED_SLOW_2 );
+
+ else if( current_speed == XINE_SPEED_SLOW_2 )
+ xine_ui->SetSpeed( XINE_SPEED_NORMAL );
+
+ else if( current_speed == XINE_SPEED_NORMAL )
+ xine_ui->SetSpeed( XINE_SPEED_FAST_2 );
+
+ else if( current_speed == XINE_SPEED_FAST_2 )
+ xine_ui->SetSpeed( XINE_SPEED_FAST_4 );
+
+ return 0L;
+ }
+
+ if( cid == ID_EJECT_BTTN )
+ {
+ xine_ui->init_playlistwnd();
+ return 0L;
+ }
+
+ }
+
+ case WM_HSCROLL:
+ {
+ int code = ( int ) LOWORD( wparam );
+ HWND hctrl = ( HWND ) lparam;
+
+ switch( code )
+ {
+ case TB_THUMBTRACK:
+ xine_ui->tracking = true;
+ break;
+
+ case TB_LINEUP:
+ case TB_LINEDOWN:
+ case TB_PAGEUP:
+ case TB_PAGEDOWN:
+ case TB_TOP:
+ case TB_BOTTOM:
+ case TB_ENDTRACK:
+ {
+ int new_time = SendMessage( hctrl, TBM_GETPOS, (WPARAM) 0, (LPARAM) 0 );
+ xine_ui->SetTime( new_time );
+ xine_ui->tracking = false;
+
+ return 0L;
+ }
+ }
+ }
+ break;
+
+ case WM_DESTROY:
+ // Cleanup and close the app
+ PostQuitMessage( 0 );
+ return 0L;
+ }
+
+ return DefWindowProc( hwnd, msg, wparam, lparam);
+}
+
+bool ToolbarAddButton( HWND htoolbar, int dataindex, int id )
+{
+ // define and add icon buttons
+ TBBUTTON button;
+ button.iBitmap = dataindex;
+ button.idCommand = id;
+ button.fsState = TBSTATE_ENABLED;
+ button.fsStyle = TBSTYLE_BUTTON;
+ button.iString = dataindex;
+
+ if( !SendMessage( htoolbar, TB_ADDBUTTONS, (UINT) 1, (LPARAM) &button ) )
+ return false;
+
+ return true;
+}
+
+bool ToolbarAddDivider( HWND htoolbar )
+{
+ // define and add icon divider
+ TBBUTTON button;
+ button.iBitmap = 0;
+ button.idCommand = 0;
+ button.fsState = TBSTATE_ENABLED;
+ button.fsStyle = TBSTYLE_SEP;
+ button.iString = 0;
+
+ if( !SendMessage( htoolbar, TB_ADDBUTTONS, (UINT) 1, (LPARAM) &button ) )
+ return false;
+
+ return true;
+}
+
+bool XINE_UI::init_ctrlwnd()
+{
+ WNDCLASSEX wc;
+
+ // register our window class
+
+ wc.cbSize = sizeof( wc );
+ wc.lpszClassName = TEXT( "xinectrlwindow" );
+ wc.lpfnWndProc = proc_ctrlwnd;
+ wc.style = CS_VREDRAW | CS_HREDRAW;
+ wc.hInstance = hinst;
+ wc.hIcon = LoadIcon( hinst, MAKEINTRESOURCE( ico_xine_logo ) );
+ wc.hIconSm = LoadIcon( hinst, MAKEINTRESOURCE( ico_xine_logo ) );
+ wc.hCursor = LoadCursor( NULL, IDC_ARROW );
+ wc.hbrBackground = ( HBRUSH ) ( 1 + COLOR_BTNFACE );
+ wc.lpszMenuName = 0;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+
+ if( !RegisterClassEx( &wc ) )
+ {
+ error( "Error RegisterClassEx : for xinectrlwindow" );
+ return false;
+ }
+
+ // calculate the proper size for the windows given client size
+
+ DWORD dwFrameWidth = GetSystemMetrics( SM_CXSIZEFRAME );
+ DWORD dwFrameHeight = GetSystemMetrics( SM_CYSIZEFRAME );
+ DWORD dwMenuHeight = GetSystemMetrics( SM_CYMENU );
+ DWORD dwCaptionHeight = GetSystemMetrics( SM_CYCAPTION );
+ DWORD dwWindowWidth = WINDOW_WIDTH + dwFrameWidth * 2;
+ DWORD dwWindowHeight = WINDOW_HEIGHT + dwFrameHeight * 2 +
+ dwMenuHeight + dwCaptionHeight;
+
+ // create the ctrl window
+
+ hctrlwnd = CreateWindowEx( 0,
+ TEXT( "xinectrlwindow" ),
+ TEXT( "xine" ),
+ WS_SYSMENU,
+ CW_USEDEFAULT, CW_USEDEFAULT,
+ dwWindowWidth, dwWindowHeight,
+ NULL,
+ NULL,
+ hinst,
+ NULL );
+ if( !hctrlwnd )
+ {
+ error( "Error CreateWindowEx : for xinectrlwindow" );
+ return 0;
+ }
+
+ // create our panel window ( handles its own error reporting )
+
+ init_panelwnd();
+ if( !hpanelwnd )
+ return false;
+
+ SetWindowPos( hpanelwnd, HWND_TOP, 5, 5, WINDOW_WIDTH - 5, 50, SWP_SHOWWINDOW );
+
+ // create our time slider
+
+ HWND htimebar = CreateWindowEx( WS_EX_TOOLWINDOW,
+ TRACKBAR_CLASS,
+ "Trackbar Control",
+ WS_CHILD | WS_VISIBLE | TBS_ENABLESELRANGE | TBS_NOTICKS,
+ 0, 0,
+ 0, 0,
+ hctrlwnd,
+ (HMENU) ID_TIMEBAR,
+ hinst,
+ 0 );
+
+ if( !htimebar )
+ {
+ error( "Error CreateWindowEx : for TRACKBAR_CLASS ( time )" );
+ return false;
+ }
+
+ SendMessage( htimebar, TBM_SETRANGE, (WPARAM) TRUE, (LPARAM) MAKELONG( 0, 1000 ) );
+ SendMessage( htimebar, TBM_SETPAGESIZE, 0, (LPARAM) 1 );
+ SendMessage( htimebar, TBM_SETSEL, (WPARAM) FALSE, (LPARAM) MAKELONG( 0, 0 ) );
+ SendMessage( htimebar, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) 0 );
+
+ SetWindowPos( htimebar, HWND_TOP, 5, 60, WINDOW_WIDTH - 10, 17, SWP_SHOWWINDOW );
+
+ // create our button toolbar
+
+ HWND htoolbar = CreateWindowEx( WS_EX_TOOLWINDOW,
+ TOOLBARCLASSNAME,
+ 0,
+ WS_CHILDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN |
+ TBSTYLE_TRANSPARENT | TBSTYLE_FLAT | CCS_NODIVIDER |
+ CCS_NOPARENTALIGN,
+ 0, 0,
+ 0, 0,
+ hctrlwnd,
+ (HMENU) ID_TOOLBAR,
+ hinst,
+ 0 );
+
+ if( !htoolbar )
+ {
+ error( "Error CreateWindowEx : for TOOLBARCLASSNAME" );
+ return false;
+ }
+
+ SendMessage( htoolbar, TB_BUTTONSTRUCTSIZE, sizeof( TBBUTTON ), 0 );
+
+ // create the toolbar image list
+
+ COLORREF TransColor = RGB( 255, 0, 255 );
+
+ himagelist = ImageList_Create( 11, 11, ILC_COLOR8 | ILC_MASK, 0, 7 );
+
+ HBITMAP h_bmp_play_button = LoadBitmap( hinst, MAKEINTRESOURCE( bmp_play_button ) );
+ HBITMAP h_bmp_pause_button = LoadBitmap( hinst, MAKEINTRESOURCE( bmp_pause_button ) );
+ HBITMAP h_bmp_stop_button = LoadBitmap( hinst, MAKEINTRESOURCE( bmp_stop_button ) );
+ HBITMAP h_bmp_prev_button = LoadBitmap( hinst, MAKEINTRESOURCE( bmp_prev_button ) );
+ HBITMAP h_bmp_rwind_button = LoadBitmap( hinst, MAKEINTRESOURCE( bmp_rwind_button ) );
+ HBITMAP h_bmp_fforward_button = LoadBitmap( hinst, MAKEINTRESOURCE( bmp_fforward_button ) );
+ HBITMAP h_bmp_next_button = LoadBitmap( hinst, MAKEINTRESOURCE( bmp_next_button ) );
+ HBITMAP h_bmp_eject_button = LoadBitmap( hinst, MAKEINTRESOURCE( bmp_eject_button ) );
+
+ ImageList_AddMasked( himagelist, h_bmp_play_button, TransColor );
+ ImageList_AddMasked( himagelist, h_bmp_pause_button, TransColor );
+ ImageList_AddMasked( himagelist, h_bmp_stop_button, TransColor );
+ ImageList_AddMasked( himagelist, h_bmp_prev_button, TransColor );
+ ImageList_AddMasked( himagelist, h_bmp_rwind_button, TransColor );
+ ImageList_AddMasked( himagelist, h_bmp_fforward_button, TransColor );
+ ImageList_AddMasked( himagelist, h_bmp_next_button, TransColor );
+ ImageList_AddMasked( himagelist, h_bmp_eject_button, TransColor );
+
+ DeleteObject( h_bmp_play_button );
+ DeleteObject( h_bmp_pause_button );
+ DeleteObject( h_bmp_stop_button );
+ DeleteObject( h_bmp_prev_button );
+ DeleteObject( h_bmp_rwind_button );
+ DeleteObject( h_bmp_fforward_button );
+ DeleteObject( h_bmp_next_button );
+ DeleteObject( h_bmp_eject_button );
+
+ SendMessage( htoolbar, TB_SETIMAGELIST, 0, (LPARAM) himagelist );
+ SendMessage( htoolbar, TB_SETBITMAPSIZE, 0, (LPARAM) MAKELONG( 11, 11 ) );
+ SendMessage( htoolbar, TB_SETBUTTONSIZE, 0, (LPARAM) MAKELONG( 22, 18 ) );
+
+ // add our buttons to our toolbar
+
+ ToolbarAddButton( htoolbar, 0, ID_PLAY_BTTN );
+ ToolbarAddButton( htoolbar, 1, ID_PAUSE_BTTN );
+ ToolbarAddButton( htoolbar, 2, ID_STOP_BTTN );
+ ToolbarAddDivider( htoolbar );
+ ToolbarAddButton( htoolbar, 3, ID_PREV_BTTN );
+ ToolbarAddButton( htoolbar, 4, ID_RWND_BTTN );
+ ToolbarAddButton( htoolbar, 5, ID_FFWD_BTTN );
+ ToolbarAddButton( htoolbar, 6, ID_NEXT_BTTN );
+ ToolbarAddDivider( htoolbar );
+ ToolbarAddButton( htoolbar, 7, ID_EJECT_BTTN );
+
+ SetWindowPos( htoolbar, HWND_TOP, 10, 80, 100, 100, SWP_SHOWWINDOW );
+
+ // show the ctrl window
+
+ ShowWindow( hctrlwnd, SW_SHOW );
+ UpdateWindow( hctrlwnd );
+
+ SetWindowLong( hctrlwnd, GWL_USERDATA, ( long ) this );
+
+ return true;
+}
+
+void XINE_UI::end_ctrlwnd()
+{
+ end_panelwnd();
+
+ ImageList_Destroy( himagelist );
+
+ HWND htoolbar = GetDlgItem( hctrlwnd, ID_TOOLBAR );
+ DestroyWindow( htoolbar );
+
+ HWND htimebar = GetDlgItem( hctrlwnd, ID_TIMEBAR );
+ DestroyWindow( htimebar );
+
+ DestroyWindow( hctrlwnd );
+ UnregisterClass( "xinectrlwindow", hinst );
+}
+
+bool _XINE_UI::UpdateCtrl()
+{
+ if( gGui->stream )
+ {
+ if( mode == XINE_STATUS_PLAY )
+ {
+ /*mrl_time_current = xine_get_current_time( gGui->stream );*/
+ if (xine_get_pos_length(gGui->stream, 0, &mrl_time_current, 0))
+ {
+ mrl_time_current /= 1000;
+ if( !tracking )
+ {
+ HWND htimebar = GetDlgItem( hctrlwnd, ID_TIMEBAR );
+ SendMessage( htimebar, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) mrl_time_current );
+ }
+ }
+ }
+ }
+
+ return true;
+}
+
+DWORD __stdcall update_loop_helper( void * param )
+{
+ XINE_UI * xine_ui = ( XINE_UI * ) param;
+
+ while( xine_ui->mode == XINE_STATUS_PLAY )
+ {
+ xine_ui->UpdateCtrl();
+ xine_ui->UpdatePanel();
+
+ Sleep( 500 );
+ }
+
+ return 0;
+}
+
+DWORD XINE_UI::UpdateLoop()
+{
+ // start ctrl update loop
+
+ DWORD panel_loop_id;
+ CreateThread( 0, 0, &update_loop_helper, ( void * ) this, 0, &panel_loop_id );
+
+ return 0;
+}
\ No newline at end of file diff --git a/win32/source/wnd.panel.cpp b/win32/source/wnd.panel.cpp new file mode 100644 index 000000000..42bf828f3 --- /dev/null +++ b/win32/source/wnd.panel.cpp @@ -0,0 +1,963 @@ +/*
+ * Copyright (C) 2000-2001 the xine project
+ *
+ * This file is part of xine for win32 video player.
+ *
+ * xine 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * xine 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * Xine win32 UI
+ * by Matthew Grooms <elon@altavista.com>
+ */
+
+#include "xineui.h"
+
+#define VOLBAR_WIDTH 13
+#define VOLBAR_HEIGHT 46
+
+#define VOLBUTTON_WIDTH 22
+#define VOLBUTTON_HEIGHT 40
+
+#define ARROW_WIDTH 7
+#define ARROW_HEIGHT 4
+
+#define PANEL_SPLIT 110
+
+static HFONT smallfont;
+static HFONT largefont;
+
+static HBITMAP configure_normal_bmp;
+static HBITMAP configure_selected_bmp;
+static HBITMAP fullscreenbutton_off_normal_bmp;
+static HBITMAP fullscreenbutton_off_selected_bmp;
+static HBITMAP fullscreenbutton_on_normal_bmp;
+static HBITMAP fullscreenbutton_on_selected_bmp;
+static HBITMAP volbutton_on_bmp;
+static HBITMAP volbutton_off_bmp;
+static HBITMAP arrowbutton_up_normal_bmp;
+static HBITMAP arrowbutton_up_selected_bmp;
+static HBITMAP arrowbutton_down_normal_bmp;
+static HBITMAP arrowbutton_down_selected_bmp;
+
+
+static void ResizeChildren( HWND hpanelwnd )
+{
+ RECT rect;
+ GetClientRect( hpanelwnd, &rect );
+
+ HWND htitlewnd = GetDlgItem( hpanelwnd, ID_TITLE );
+ if( htitlewnd )
+ {
+ SetWindowPos( htitlewnd, HWND_TOP,
+ 5, 5,
+ PANEL_SPLIT, 14,
+ SWP_SHOWWINDOW );
+ }
+
+ HWND htimewnd = GetDlgItem( hpanelwnd, ID_TIME );
+ if( htimewnd )
+ {
+ SetWindowPos( htimewnd, HWND_TOP,
+ 5, 25,
+ PANEL_SPLIT, 16,
+ SWP_SHOWWINDOW );
+ }
+
+ HWND hfullscreenwnd = GetDlgItem( hpanelwnd, ID_FULLSCREEN );
+ if( hfullscreenwnd )
+ {
+ SetWindowPos( hfullscreenwnd, HWND_TOP,
+ rect.right - 90, 5,
+ 16, 12,
+ SWP_SHOWWINDOW );
+ }
+
+ HWND hconfigurewnd = GetDlgItem( hpanelwnd, ID_CONFIG );
+ if( hconfigurewnd )
+ {
+ SetWindowPos( hconfigurewnd, HWND_TOP,
+ rect.right - 72, 5,
+ 32, 12,
+ SWP_SHOWWINDOW );
+ }
+
+ HWND hspulabelwnd = GetDlgItem( hpanelwnd, ID_SPULABEL );
+ if( hspulabelwnd )
+ {
+ SetWindowPos( hspulabelwnd, HWND_TOP,
+ rect.right - 103, 18,
+ 28, 12,
+ SWP_SHOWWINDOW );
+ }
+
+ HWND haudiolabelwnd = GetDlgItem( hpanelwnd, ID_AUDIOLABEL );
+ if( haudiolabelwnd )
+ {
+ SetWindowPos( haudiolabelwnd, HWND_TOP,
+ rect.right - 103, 31,
+ 28, 12,
+ SWP_SHOWWINDOW );
+ }
+
+ HWND hspuvaluewnd = GetDlgItem( hpanelwnd, ID_SPUVALUE );
+ if( hspuvaluewnd )
+ {
+ SetWindowPos( hspuvaluewnd, HWND_TOP,
+ rect.right - 61, 18,
+ 23, 12,
+ SWP_SHOWWINDOW );
+ }
+
+ HWND haudiovaluewnd = GetDlgItem( hpanelwnd, ID_AUDIOVALUE );
+ if( haudiovaluewnd )
+ {
+ SetWindowPos( haudiovaluewnd, HWND_TOP,
+ rect.right - 61, 31,
+ 23, 12,
+ SWP_SHOWWINDOW );
+ }
+
+ HWND hspuinc = GetDlgItem( hpanelwnd, ID_SPUINC );
+ if( hspuinc )
+ {
+ SetWindowPos( hspuinc, HWND_TOP,
+ rect.right - 71, rect.top + 20,
+ ARROW_WIDTH, ARROW_HEIGHT,
+ SWP_SHOWWINDOW );
+ }
+
+ HWND hspudec = GetDlgItem( hpanelwnd, ID_SPUDEC );
+ if( hspudec )
+ {
+ SetWindowPos( hspudec, HWND_TOP,
+ rect.right - 71, rect.top + 26,
+ ARROW_WIDTH, ARROW_HEIGHT,
+ SWP_SHOWWINDOW );
+ }
+
+ HWND haudioinc = GetDlgItem( hpanelwnd, ID_AUDIOINC );
+ if( haudioinc )
+ {
+ SetWindowPos( haudioinc, HWND_TOP,
+ rect.right - 71, rect.top + 33,
+ ARROW_WIDTH, ARROW_HEIGHT,
+ SWP_SHOWWINDOW );
+ }
+
+ HWND haudiodec = GetDlgItem( hpanelwnd, ID_AUDIODEC );
+ if( haudiodec )
+ {
+ SetWindowPos( haudiodec, HWND_TOP,
+ rect.right - 71, rect.top + 39,
+ ARROW_WIDTH, ARROW_HEIGHT,
+ SWP_SHOWWINDOW );
+ }
+
+ HWND hvolbutton = GetDlgItem( hpanelwnd, ID_VOLBUTTON );
+ if( hvolbutton )
+ {
+ SetWindowPos( hvolbutton, HWND_TOP,
+ rect.right - ( VOLBAR_WIDTH + VOLBUTTON_WIDTH ) - 2, rect.top + 4,
+ VOLBUTTON_WIDTH, VOLBUTTON_HEIGHT,
+ SWP_SHOWWINDOW );
+ }
+
+
+ HWND hvolbar = GetDlgItem( hpanelwnd, ID_VOLBAR );
+ if( hvolbar )
+ {
+ SetWindowPos( hvolbar, HWND_TOP,
+ rect.right - VOLBAR_WIDTH, rect.top + 1,
+ VOLBAR_WIDTH, VOLBAR_HEIGHT,
+ SWP_SHOWWINDOW );
+ }
+}
+
+LRESULT CALLBACK proc_panelwnd( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
+{
+ XINE_UI * xine_ui = ( XINE_UI * ) GetWindowLong( hwnd, GWL_USERDATA );
+
+ switch( msg )
+ {
+ case WM_COMMAND:
+ {
+ WORD ncode = HIWORD( wparam ); // notification code
+ WORD cid = LOWORD( wparam ); // item, control, or accelerator identifier
+ HWND chwnd = ( HWND ) lparam; // handle of control
+
+ if( cid == ID_FULLSCREEN )
+ {
+ if( ncode == BN_CLICKED )
+ {
+ if( GetWindowLong( chwnd, GWL_USERDATA ) )
+ {
+ SetWindowLong( chwnd, GWL_USERDATA, 0 );
+ xine_ui->DriverMessage( GUI_WIN32_MOVED_OR_RESIZED, 0 );
+ xine_ui->win32_visual.FullScreen = false;
+
+ int style = GetWindowLong( xine_ui->hvideownd, GWL_STYLE );
+ SetWindowLong( xine_ui->hvideownd, GWL_STYLE, style | WS_CAPTION | WS_SIZEBOX | WS_SYSMENU | WS_MAXIMIZEBOX );
+ ShowWindow( xine_ui->hvideownd, SW_SHOWNORMAL );
+
+ }
+ else
+ {
+ SetWindowLong( chwnd, GWL_USERDATA, 1 );
+ xine_ui->DriverMessage( GUI_WIN32_MOVED_OR_RESIZED, 0 );
+ xine_ui->win32_visual.FullScreen = true;
+
+ int style = GetWindowLong( xine_ui->hvideownd, GWL_STYLE );
+ SetWindowLong( xine_ui->hvideownd, GWL_STYLE, style & ~( WS_CAPTION | WS_BORDER | WS_SIZEBOX | WS_SYSMENU | WS_MAXIMIZEBOX ) );
+ ShowWindow( xine_ui->hvideownd, SW_MAXIMIZE );
+ }
+
+ // FIXME : There must be a better way to
+ // force a WM_DRAITEM message
+
+ ShowWindow( chwnd, SW_HIDE );
+ ShowWindow( chwnd, SW_SHOW );
+
+ return 0L;
+ }
+ }
+
+ if( cid == ID_SPUINC )
+ {
+ if( ncode == BN_CLICKED )
+ {
+ xine_ui->SelectSpuChannel( xine_get_param(gGui->stream, XINE_PARAM_SPU_CHANNEL) + 1 );
+ xine_ui->spu_channel = xine_get_param(gGui->stream, XINE_PARAM_SPU_CHANNEL);
+ return 0L;
+ }
+ }
+
+ if( cid == ID_SPUDEC )
+ {
+ if( ncode == BN_CLICKED )
+ {
+ xine_ui->SelectSpuChannel( xine_get_param(gGui->stream, XINE_PARAM_SPU_CHANNEL) - 1 );
+ xine_ui->spu_channel = xine_get_param(gGui->stream, XINE_PARAM_SPU_CHANNEL);
+ return 0L;
+ }
+ }
+
+ if( cid == ID_AUDIOINC )
+ {
+ if( ncode == BN_CLICKED )
+ {
+ xine_ui->SelectAudioChannel( xine_get_param(gGui->stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL) + 1 );
+ xine_ui->audio_channel = xine_get_param(gGui->stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL);
+ return 0L;
+ }
+ }
+
+ if( cid == ID_AUDIODEC )
+ {
+ if( ncode == BN_CLICKED )
+ {
+ xine_ui->SelectAudioChannel( xine_get_param(gGui->stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL) - 1 );
+ xine_ui->audio_channel = xine_get_param(gGui->stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL);
+ return 0L;
+ }
+ }
+
+ if( cid == ID_VOLBUTTON )
+ {
+ if( ncode == BN_CLICKED )
+ {
+ HWND hvolbar = GetDlgItem( hwnd, ID_VOLBAR );
+
+ if( GetWindowLong( chwnd, GWL_USERDATA ) )
+ {
+ SetWindowLong( chwnd, GWL_USERDATA, 0 );
+ EnableWindow( hvolbar, false );
+ xine_ui->SetMute( true );
+ }
+ else
+ {
+ SetWindowLong( chwnd, GWL_USERDATA, 1 );
+ EnableWindow( hvolbar, true );
+ xine_ui->SetMute( false );
+ }
+
+ // FIXME : There must be a better way to
+ // force a WM_DRAITEM message
+
+ ShowWindow( chwnd, SW_HIDE );
+ ShowWindow( chwnd, SW_SHOW );
+
+ return 0L;
+ }
+ }
+ }
+ break;
+
+ case WM_VSCROLL:
+ {
+ int code = ( int ) LOWORD( wparam );
+ HWND hcntrl = ( HWND ) lparam;
+
+ switch( code )
+ {
+ case TB_THUMBTRACK:
+ case TB_LINEUP:
+ case TB_LINEDOWN:
+ case TB_PAGEUP:
+ case TB_PAGEDOWN:
+ case TB_TOP:
+ case TB_BOTTOM:
+ case TB_ENDTRACK:
+ {
+ int new_volume = SendMessage( hcntrl, TBM_GETPOS, (WPARAM) 0, (LPARAM) 0 );
+ xine_ui->SetVolume( new_volume );
+ return 0L;
+ }
+ }
+
+ }
+ break;
+
+ case WM_SIZE:
+ {
+ ResizeChildren( hwnd );
+ }
+ break;
+
+ case WM_DRAWITEM:
+ {
+ LPDRAWITEMSTRUCT lpdis = ( LPDRAWITEMSTRUCT ) lparam;
+
+ if( lpdis->CtlID == ID_FULLSCREEN )
+ {
+ HDC hdcMem = CreateCompatibleDC( lpdis->hDC );
+ long bstate = GetWindowLong( lpdis->hwndItem, GWL_USERDATA );
+
+ if( bstate )
+ {
+ if( lpdis->itemState & ODS_SELECTED )
+ SelectObject( hdcMem, fullscreenbutton_on_selected_bmp );
+ else
+ SelectObject( hdcMem, fullscreenbutton_on_normal_bmp );
+ }
+ else
+ {
+ if( lpdis->itemState & ODS_SELECTED )
+ SelectObject( hdcMem, fullscreenbutton_off_selected_bmp );
+ else
+ SelectObject( hdcMem, fullscreenbutton_off_normal_bmp );
+ }
+
+ BitBlt( lpdis->hDC, 0, 0, 16, 12, hdcMem, 0, 0, SRCCOPY );
+
+ DeleteDC( hdcMem );
+ return TRUE;
+ }
+
+ if( lpdis->CtlID == ID_CONFIG )
+ {
+ HDC hdcMem = CreateCompatibleDC( lpdis->hDC );
+
+ if( lpdis->itemState & ODS_SELECTED )
+ SelectObject( hdcMem, configure_selected_bmp );
+ else
+ SelectObject( hdcMem, configure_normal_bmp );
+
+ BitBlt( lpdis->hDC, 0, 0, 32, 12, hdcMem, 0, 0, SRCCOPY );
+
+ DeleteDC( hdcMem );
+ return TRUE;
+ }
+
+ if( ( lpdis->CtlID == ID_SPUINC ) || ( lpdis->CtlID == ID_AUDIOINC ) )
+ {
+ HDC hdcMem = CreateCompatibleDC( lpdis->hDC );
+
+ if( lpdis->itemState & ODS_SELECTED )
+ SelectObject( hdcMem, arrowbutton_up_selected_bmp );
+ else
+ SelectObject( hdcMem, arrowbutton_up_normal_bmp );
+
+ BitBlt( lpdis->hDC, 0, 0, 7, 4, hdcMem, 0, 0, SRCCOPY );
+
+ DeleteDC( hdcMem );
+ return TRUE;
+ }
+
+ if( ( lpdis->CtlID == ID_SPUDEC ) || ( lpdis->CtlID == ID_AUDIODEC ) )
+ {
+ HDC hdcMem = CreateCompatibleDC( lpdis->hDC );
+
+ if( lpdis->itemState & ODS_SELECTED )
+ SelectObject( hdcMem, arrowbutton_down_selected_bmp );
+ else
+ SelectObject( hdcMem, arrowbutton_down_normal_bmp );
+
+ BitBlt( lpdis->hDC, 0, 0, 7, 4, hdcMem, 0, 0, SRCCOPY );
+
+ DeleteDC( hdcMem );
+ return TRUE;
+ }
+
+ if( lpdis->CtlID == ID_VOLBUTTON )
+ {
+ HDC hdcMem = CreateCompatibleDC( lpdis->hDC );
+ long bstate = GetWindowLong( lpdis->hwndItem, GWL_USERDATA );
+
+ if( bstate )
+ SelectObject( hdcMem, volbutton_on_bmp );
+ else
+ SelectObject( hdcMem, volbutton_off_bmp );
+
+ BitBlt( lpdis->hDC, 0, 0, VOLBUTTON_WIDTH, VOLBUTTON_HEIGHT,
+ hdcMem, 0, 0, SRCCOPY );
+
+ DeleteDC( hdcMem );
+ return TRUE;
+ }
+ }
+ break;
+
+ case WM_CTLCOLORBTN:
+ case WM_CTLCOLORSTATIC:
+ {
+ HDC hdcstatic = ( HDC ) wparam;
+ SetTextColor( hdcstatic, RGB( 255, 255, 255 ) );
+ SetBkColor( hdcstatic, RGB( 0, 0, 0 ) );
+
+ HBRUSH bkgrd = ( HBRUSH ) GetClassLong( hwnd, GCL_HBRBACKGROUND );
+
+ return ( long ) bkgrd;
+ }
+ break;
+
+ case WM_DESTROY:
+ if( xine_ui )
+ xine_ui->end_panelwnd();
+ return 0L;
+ }
+
+ return DefWindowProc( hwnd, msg, wparam, lparam);
+}
+
+bool _XINE_UI::init_panelwnd()
+{
+ WNDCLASSEX wc;
+
+ // register our window class
+
+ wc.cbSize = sizeof( wc );
+ wc.lpszClassName = TEXT( "xinepanelwindow" );
+ wc.lpfnWndProc = proc_panelwnd;
+ wc.style = CS_VREDRAW | CS_HREDRAW;
+ wc.hInstance = hinst;
+ wc.hIcon = 0,
+ wc.hIconSm = 0,
+ wc.hCursor = LoadCursor( NULL, IDC_ARROW );
+ wc.hbrBackground = ( HBRUSH ) GetStockObject( BLACK_BRUSH );
+ wc.lpszMenuName = 0;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+
+ if( !RegisterClassEx( &wc ) )
+ {
+ error( "Error RegisterClassEx : for xinepanelwindow" );
+ return false;
+ }
+
+ // create the ctrl window
+
+ hpanelwnd = CreateWindowEx( WS_EX_STATICEDGE,
+ TEXT( "xinepanelwindow" ),
+ 0,
+ WS_CHILD,
+ 0, 0,
+ 0, 0,
+ hctrlwnd,
+ ( HMENU ) ID_PANEL,
+ hinst,
+ NULL );
+ if( !hpanelwnd )
+ {
+ error( "Error CreateWindowEx : for xinepanelwindow" );
+ return false;
+ }
+
+ // create our fonts
+
+ smallfont = CreateFont( 13, // logical height of font
+ 5, // logical average character width
+ 0, // angle of escapement
+ 0, // base-line orientation angle
+ 0, // font weight
+ 0, // italic attribute flag
+ 0, // underline attribute flag
+ 0, // strikeout attribute flag
+ 0, // character set identifier
+ 0, // output precision
+ 0, // clipping precision
+ ANTIALIASED_QUALITY, // output quality
+ FF_MODERN | VARIABLE_PITCH , // pitch and family
+ "Areal" ); // pointer to typeface name string
+
+ largefont = CreateFont( 20, // logical height of font
+ 7, // logical average character width
+ 0, // angle of escapement
+ 0, // base-line orientation angle
+ 0, // font weight
+ 0, // italic attribute flag
+ 0, // underline attribute flag
+ 0, // strikeout attribute flag
+ 0, // character set identifier
+ 0, // output precision
+ 0, // clipping precision
+ ANTIALIASED_QUALITY, // output quality
+ FF_MODERN | VARIABLE_PITCH , // pitch and family
+ "Areal" ); // pointer to typeface name string
+
+ // create our title window
+
+ HWND htitle = CreateWindow( "STATIC",
+ 0,
+ WS_CHILD | WS_VISIBLE | SS_LEFT,
+ 0, 0,
+ 0, 0,
+ hpanelwnd,
+ (HMENU) ID_TITLE,
+ hinst,
+ 0 );
+
+ if( !htitle )
+ {
+ error( "Error CreateWindowEx : for STATIC ( htitle )" );
+ return false;
+ }
+
+ SendMessage( htitle, WM_SETFONT, ( WPARAM ) smallfont, false );
+
+ // create our time window
+
+ HWND htime = CreateWindow( "STATIC",
+ 0,
+ WS_CHILD | WS_VISIBLE | SS_LEFT,
+ 0, 0,
+ 0, 0,
+ hpanelwnd,
+ (HMENU) ID_TIME,
+ hinst,
+ 0 );
+
+ if( !htime )
+ {
+ error( "Error CreateWindowEx : for STATIC ( time )" );
+ return false;
+ }
+
+ SendMessage( htime, WM_SETFONT, ( WPARAM ) largefont, false );
+
+ // create our fullscreen button
+
+ fullscreenbutton_off_normal_bmp = LoadBitmap( hinst, MAKEINTRESOURCE( bmp_fullscreen_off_normal ) );
+ fullscreenbutton_off_selected_bmp = LoadBitmap( hinst, MAKEINTRESOURCE( bmp_fullscreen_off_selected ) );
+ fullscreenbutton_on_normal_bmp = LoadBitmap( hinst, MAKEINTRESOURCE( bmp_fullscreen_on_normal ) );
+ fullscreenbutton_on_selected_bmp = LoadBitmap( hinst, MAKEINTRESOURCE( bmp_fullscreen_on_selected ) );
+
+ if( !fullscreenbutton_off_normal_bmp || !fullscreenbutton_off_selected_bmp ||
+ !fullscreenbutton_on_normal_bmp || !fullscreenbutton_on_selected_bmp )
+ {
+ error( "Error LoadBitmap : for fullscreenbutton (s)" );
+ return false;
+ }
+
+ HWND hfullscrrenbutton = CreateWindow( "BUTTON",
+ 0,
+ WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
+ 0, 0,
+ 0, 0,
+ hpanelwnd,
+ (HMENU) ID_FULLSCREEN,
+ hinst,
+ 0 );
+
+ if( !hfullscrrenbutton )
+ {
+ error( "Error CreateWindowEx : for BUTTON ( hfullscrrenbutton )" );
+ return false;
+ }
+
+ SetWindowLong( hfullscrrenbutton, GWL_USERDATA, 0 );
+
+ // create our configure button
+
+ configure_normal_bmp = LoadBitmap( hinst, MAKEINTRESOURCE( bmp_configure_normal ) );
+ configure_selected_bmp = LoadBitmap( hinst, MAKEINTRESOURCE( bmp_configure_selected ) );
+
+ if( !configure_normal_bmp || !configure_selected_bmp )
+ {
+ error( "Error LoadBitmap : for configure button(s)" );
+ return false;
+ }
+
+ HWND hconfigbutton = CreateWindow( "BUTTON",
+ 0,
+ WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
+ 0, 0,
+ 0, 0,
+ hpanelwnd,
+ (HMENU) ID_CONFIG,
+ hinst,
+ 0 );
+
+ if( !hconfigbutton )
+ {
+ error( "Error CreateWindowEx : for BUTTON ( hconfigbutton )" );
+ return false;
+ }
+
+ SetWindowLong( hfullscrrenbutton, GWL_USERDATA, 0 );
+
+ // create our spu and audio label windows
+
+ HWND hspulabelwnd = CreateWindow( "STATIC",
+ "spu",
+ WS_CHILD | WS_VISIBLE | SS_RIGHT,
+ 0, 0,
+ 0, 0,
+ hpanelwnd,
+ (HMENU) ID_SPULABEL,
+ hinst,
+ 0 );
+
+ if( !hspulabelwnd )
+ {
+ error( "Error CreateWindowEx : for STATIC ( hspulabelwnd )" );
+ return false;
+ }
+
+ SendMessage( hspulabelwnd, WM_SETFONT, ( WPARAM ) smallfont, false );
+
+ HWND haudiolabelwnd = CreateWindow( "STATIC",
+ "aud",
+ WS_CHILD | WS_VISIBLE | SS_RIGHT,
+ 0, 0,
+ 0, 0,
+ hpanelwnd,
+ (HMENU) ID_AUDIOLABEL,
+ hinst,
+ 0 );
+
+ if( !haudiolabelwnd )
+ {
+ error( "Error CreateWindowEx : for STATIC ( haudiolabelwnd )" );
+ return false;
+ }
+
+ SendMessage( haudiolabelwnd, WM_SETFONT, ( WPARAM ) smallfont, false );
+
+ // create our spu and audio inc & dec buttons
+
+ arrowbutton_up_normal_bmp = LoadBitmap( hinst, MAKEINTRESOURCE( bmp_arrow_up_normal ) );
+ arrowbutton_up_selected_bmp = LoadBitmap( hinst, MAKEINTRESOURCE( bmp_arrow_up_selected ) );
+ arrowbutton_down_normal_bmp = LoadBitmap( hinst, MAKEINTRESOURCE( bmp_arrow_down_normal ) );
+ arrowbutton_down_selected_bmp = LoadBitmap( hinst, MAKEINTRESOURCE( bmp_arrow_down_selected ) );
+
+ if( !arrowbutton_up_normal_bmp || !arrowbutton_up_selected_bmp ||
+ !arrowbutton_down_normal_bmp || !arrowbutton_down_selected_bmp )
+ {
+ error( "Error LoadBitmap : for bmp_volume_button (s)" );
+ return false;
+ }
+
+ HWND hspuinc = CreateWindow( "BUTTON",
+ 0,
+ WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
+ 0, 0,
+ 0, 0,
+ hpanelwnd,
+ (HMENU) ID_SPUINC,
+ hinst,
+ 0 );
+
+ if( !hspuinc )
+ {
+ error( "Error CreateWindowEx : for BUTTON ( hspuinc )" );
+ return false;
+ }
+
+ HWND hspudec = CreateWindow( "BUTTON",
+ 0,
+ WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
+ 0, 0,
+ 0, 0,
+ hpanelwnd,
+ (HMENU) ID_SPUDEC,
+ hinst,
+ 0 );
+
+ if( !hspudec )
+ {
+ error( "Error CreateWindowEx : for BUTTON ( hspudec )" );
+ return false;
+ }
+
+ HWND haudioinc = CreateWindow( "BUTTON",
+ 0,
+ WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
+ 0, 0,
+ 0, 0,
+ hpanelwnd,
+ (HMENU) ID_AUDIOINC,
+ hinst,
+ 0 );
+
+ if( !haudioinc )
+ {
+ error( "Error CreateWindowEx : for BUTTON ( haudioinc )" );
+ return false;
+ }
+
+ HWND haudiodec = CreateWindow( "BUTTON",
+ 0,
+ WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
+ 0, 0,
+ 0, 0,
+ hpanelwnd,
+ (HMENU) ID_AUDIODEC,
+ hinst,
+ 0 );
+
+ if( !haudiodec )
+ {
+ error( "Error CreateWindowEx : for BUTTON ( haudiodec )" );
+ return false;
+ }
+
+ // create our spu and audio value windows
+
+ HWND hspuvaluewnd = CreateWindow( "STATIC",
+ "None",
+ WS_CHILD | WS_VISIBLE | SS_LEFT,
+ 0, 0,
+ 0, 0,
+ hpanelwnd,
+ (HMENU) ID_SPUVALUE,
+ hinst,
+ 0 );
+
+ if( !hspuvaluewnd )
+ {
+ error( "Error CreateWindowEx : for STATIC ( hspuvaluewnd )" );
+ return false;
+ }
+
+ SendMessage( hspuvaluewnd, WM_SETFONT, ( WPARAM ) smallfont, false );
+
+ HWND haudiovaluewnd = CreateWindow( "STATIC",
+ "None",
+ WS_CHILD | WS_VISIBLE | SS_LEFT,
+ 0, 0,
+ 0, 0,
+ hpanelwnd,
+ (HMENU) ID_AUDIOVALUE,
+ hinst,
+ 0 );
+
+ if( !haudiovaluewnd )
+ {
+ error( "Error CreateWindowEx : for STATIC ( haudiovaluewnd )" );
+ return false;
+ }
+
+ SendMessage( haudiovaluewnd, WM_SETFONT, ( WPARAM ) smallfont, false );
+
+ // create our volume button
+
+ volbutton_on_bmp = LoadBitmap( hinst, MAKEINTRESOURCE( bmp_volume_on_button ) );
+ volbutton_off_bmp = LoadBitmap( hinst, MAKEINTRESOURCE( bmp_volume_off_button ) );
+
+ if( !volbutton_on_bmp || !volbutton_off_bmp )
+ {
+ error( "Error LoadBitmap : for bmp_volume_button (s)" );
+ return false;
+ }
+
+ HWND hvolbutton = CreateWindow( "BUTTON",
+ 0,
+ WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
+ 0, 0,
+ 0, 0,
+ hpanelwnd,
+ (HMENU) ID_VOLBUTTON,
+ hinst,
+ 0 );
+
+ if( !hvolbutton )
+ {
+ error( "Error CreateWindowEx : for BUTTON ( volume )" );
+ return false;
+ }
+
+ SetWindowLong( hvolbutton, GWL_USERDATA, 1 );
+
+ // create our volume slider
+
+ HWND hvolbar = CreateWindowEx( WS_EX_TOOLWINDOW,
+ TRACKBAR_CLASS,
+ "Volume Control",
+ WS_CHILD | WS_VISIBLE | TBS_NOTICKS | TBS_VERT,
+ 0, 0,
+ 0, 0,
+ hpanelwnd,
+ (HMENU) ID_VOLBAR,
+ hinst,
+ 0 );
+
+ if( !hvolbar )
+ {
+ error( "Error CreateWindowEx : for TRACKBAR_CLASS ( volume )" );
+ return false;
+ }
+
+
+ SendMessage( hvolbar, TBM_SETRANGE, (WPARAM) TRUE, (LPARAM) MAKELONG( 0, 100 ) );
+ SendMessage( hvolbar, TBM_SETPAGESIZE, 0, (LPARAM) 1 );
+ SendMessage( hvolbar, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) 0 );
+
+ ShowWindow( hpanelwnd, SW_SHOW );
+ UpdateWindow( hpanelwnd );
+
+ UpdatePanel();
+
+ SetWindowLong( hpanelwnd, GWL_USERDATA, ( long ) this );
+
+ return true;
+}
+
+bool XINE_UI::UpdatePanel()
+{
+ char buffer[10];
+ char *lang = NULL;
+
+ UpdateWindow( hpanelwnd );
+
+ // set our title
+
+ if( mrl_short_name )
+ SetDlgItemText( hpanelwnd, ID_TITLE, mrl_short_name );
+ else
+ SetDlgItemText( hpanelwnd, ID_TITLE, "<no input>" );
+
+ // set our time
+
+ char tmpbuff[ 50 ];
+ sprintf( tmpbuff, "%u:%u:%u / %u:%u:%u",
+ mrl_time_current / ( 60 * 60 ), mrl_time_current / 60, mrl_time_current % 60,
+ mrl_time_length / ( 60 * 60 ), mrl_time_length / 60, mrl_time_length % 60 );
+
+ SetDlgItemText( hpanelwnd, ID_TIME, tmpbuff );
+
+ // set our spu channel
+ if (gGui != NULL) {
+ memset(&buffer, 0, sizeof(buffer));
+ switch (spu_channel) {
+ case -2:
+ lang = "off";
+ break;
+
+ case -1:
+ if(!xine_get_spu_lang (gGui->stream, spu_channel, &buffer[0]))
+ lang = "auto";
+ else
+ lang = buffer;
+ break;
+
+ default:
+ if(!xine_get_spu_lang (gGui->stream, spu_channel, &buffer[0]))
+ sprintf(buffer, "%3d", spu_channel);
+ lang = buffer;
+ break;
+ }
+
+ sprintf( tmpbuff, "%s", lang );
+ }
+ else {
+ sprintf( tmpbuff, "%i", spu_channel );
+ }
+
+ SetDlgItemText( hpanelwnd, ID_SPUVALUE, tmpbuff );
+
+ // set our audio channel
+ if (gGui != NULL) {
+ memset(&buffer, 0, sizeof(buffer));
+ switch (audio_channel) {
+ case -2:
+ lang = "off";
+ break;
+
+ case -1:
+ if(!xine_get_audio_lang (gGui->stream, audio_channel, &buffer[0]))
+ lang = "auto";
+ else
+ lang = buffer;
+ break;
+
+ default:
+ if(!xine_get_audio_lang (gGui->stream, audio_channel, &buffer[0]))
+ sprintf(buffer, "%3d", audio_channel);
+ lang = buffer;
+ break;
+ }
+
+ sprintf( tmpbuff, "%s", lang );
+ }
+ else {
+ sprintf( tmpbuff, "%i", audio_channel );
+ }
+
+ SetDlgItemText( hpanelwnd, ID_AUDIOVALUE, tmpbuff );
+
+ return true;
+}
+
+void XINE_UI::end_panelwnd()
+{
+ DeleteObject( win32_visual.Brush );
+ DestroyWindow( hvideownd );
+ UnregisterClass( "xinevideowindow", hinst );
+
+ HWND hvolbar = GetDlgItem( hpanelwnd, ID_VOLBAR );
+ DestroyWindow( hvolbar );
+
+ DeleteObject( smallfont );
+ DeleteObject( largefont );
+
+ DeleteObject( configure_normal_bmp );
+ DeleteObject( configure_selected_bmp );
+ DeleteObject( fullscreenbutton_off_normal_bmp );
+ DeleteObject( fullscreenbutton_off_selected_bmp );
+ DeleteObject( fullscreenbutton_on_normal_bmp );
+ DeleteObject( fullscreenbutton_on_selected_bmp );
+ DeleteObject( volbutton_on_bmp );
+ DeleteObject( volbutton_off_bmp );
+ DeleteObject( arrowbutton_up_normal_bmp );
+ DeleteObject( arrowbutton_up_selected_bmp );
+ DeleteObject( arrowbutton_down_normal_bmp );
+ DeleteObject( arrowbutton_down_selected_bmp );
+
+ HWND hvolbutton = GetDlgItem( hpanelwnd, ID_VOLBUTTON );
+ DestroyWindow( hvolbutton );
+
+ DestroyWindow( hpanelwnd );
+ UnregisterClass( "xinepanelwindow", hinst );
+}
+
diff --git a/win32/source/wnd.playlist.cpp b/win32/source/wnd.playlist.cpp new file mode 100644 index 000000000..1593144b0 --- /dev/null +++ b/win32/source/wnd.playlist.cpp @@ -0,0 +1,411 @@ +/*
+ * Copyright (C) 2000-2001 the xine project
+ *
+ * This file is part of xine for win32 video player.
+ *
+ * xine 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * xine 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * Xine win32 UI
+ * by Matthew Grooms <elon@altavista.com>
+ */
+
+#include "xineui.h"
+
+#define WINDOW_WIDTH 200
+#define WINDOW_HEIGHT 200
+
+HFONT hfont;
+
+bool AddPlaylistColumn( HWND hlistwnd, int width, int index )
+{
+ LV_COLUMN lvCol;
+ lvCol.mask = LVCF_FMT | LVCF_SUBITEM | LVCF_WIDTH;
+ lvCol.fmt = LVCFMT_LEFT;
+ lvCol.cx = width;
+ lvCol.iSubItem = index;
+
+ int columnindex = SendMessage( hlistwnd, LVM_INSERTCOLUMN, ( WPARAM ) index, ( LPARAM ) &lvCol );
+ if( columnindex == -1 )
+ return false;
+
+ return true;
+}
+
+bool AddPlaylistItem( HWND hlistwnd, void * lparam )
+{
+ int itemcount = ListView_GetItemCount( hlistwnd );
+
+ LV_ITEM newItem;
+ newItem.mask = LVIF_PARAM | LVIF_TEXT;
+ newItem.iItem = itemcount;
+ newItem.iSubItem = 0;
+ newItem.pszText = LPSTR_TEXTCALLBACK;
+ newItem.lParam = ( long ) lparam;
+
+ if( SendMessage( hlistwnd, LVM_INSERTITEM, 0, ( LPARAM ) &newItem ) == -1 )
+ return false;
+
+ return true;
+}
+
+void ResizeChildren( HWND hplaylistwnd )
+{
+ RECT rect;
+ GetClientRect( hplaylistwnd, &rect );
+
+ HWND hstauswnd = GetDlgItem( hplaylistwnd, ID_STATUS );
+ SetWindowPos( hstauswnd, HWND_TOP,
+ rect.left + 5, rect.bottom - 25,
+ rect.right - rect.left - 10, 20,
+ SWP_SHOWWINDOW );
+
+ HWND hlistwnd = GetDlgItem( hplaylistwnd, ID_LIST );
+ SetWindowPos( hlistwnd, HWND_TOP,
+ rect.left + 5, rect.top + 5,
+ rect.right - rect.left - 55, rect.bottom - rect.top - 30,
+ SWP_SHOWWINDOW );
+
+ HWND haddwnd = GetDlgItem( hplaylistwnd, ID_ADD );
+ SetWindowPos( haddwnd, HWND_TOP,
+ rect.right - 40, rect.top + 5,
+ 35, 20,
+ SWP_SHOWWINDOW );
+
+ HWND hdelwnd = GetDlgItem( hplaylistwnd, ID_DEL );
+ SetWindowPos( hdelwnd, HWND_TOP,
+ rect.right - 40, rect.top + 30,
+ 35, 20,
+ SWP_SHOWWINDOW );
+
+ GetClientRect( hlistwnd, &rect );
+ SendMessage( hlistwnd, LVM_SETCOLUMNWIDTH, 1, rect.right - rect.left - 22 );
+}
+
+LRESULT CALLBACK proc_playlistwnd( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
+{
+ XINE_UI * xine_ui = ( XINE_UI * ) GetWindowLong( hwnd, GWL_USERDATA );
+
+ switch( msg )
+ {
+ case WM_NOTIFY:
+ {
+ int controlid = ( int ) wparam;
+ NMHDR * lpnm = ( NMHDR * ) lparam;
+ NMLVDISPINFO * nmlvdi = ( NMLVDISPINFO * ) lparam;
+
+ if( lpnm->code == LVN_GETDISPINFO )
+ {
+ PLAYITEM * playitem = ( PLAYITEM * ) ( nmlvdi->item.lParam );
+
+ // first column
+
+ if( nmlvdi->item.iSubItem == 0 )
+ nmlvdi->item.iImage = playitem->mrl_type;
+
+ // second column
+
+ if( nmlvdi->item.iSubItem == 1 )
+ nmlvdi->item.pszText = playitem->mrl_short_name;
+ }
+
+ return 0L;
+ }
+ break;
+
+
+ case WM_COMMAND:
+ {
+ WORD ncode = HIWORD( wparam ); // notification code
+ WORD cid = LOWORD( wparam ); // item, control, or accelerator identifier
+ HWND chwnd = ( HWND ) lparam; // handle of control
+
+ if( cid == ID_ADD )
+ {
+ OPENFILENAME ofn; // common dialog box structure
+ char tmpbuff[ 2048 ]; // buffer for filename
+ memset( &tmpbuff, 0, sizeof( tmpbuff ) );
+
+ memset( &ofn, 0, sizeof( OPENFILENAME ) );
+ ofn.lStructSize = sizeof( OPENFILENAME );
+ ofn.hwndOwner = hwnd;
+ ofn.lpstrFile = tmpbuff;
+ ofn.nMaxFile = sizeof( tmpbuff );
+ ofn.lpstrFilter = "All\0*.*\0";
+ ofn.nFilterIndex = 1;
+ ofn.lpstrFileTitle = 0;
+ ofn.nMaxFileTitle = 0;
+ ofn.lpstrInitialDir = 0;
+ ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_ALLOWMULTISELECT | OFN_EXPLORER;
+
+ // Display the Open dialog box.
+
+ if( GetOpenFileName( &ofn ) )
+ {
+ HWND hlistwnd = GetDlgItem( hwnd, ID_LIST );
+ char * szItem = tmpbuff;
+ char szLength = strlen( szItem );
+
+ // did we get multiple files
+
+ if( !szItem[ szLength + 1 ] )
+ {
+ // single file
+
+ // add to playlist and to listview
+
+ PLAYITEM * playitem = xine_ui->PlaylistAdd( szItem + ofn.nFileOffset, szItem, 0 );
+ AddPlaylistItem( hlistwnd, playitem );
+ }
+ else
+ {
+ // multiple files
+
+ szItem = szItem + szLength + 1;
+ szLength = strlen( szItem );
+
+ while( szLength )
+ {
+ char tmpfname[ 1024 ];
+ sprintf( tmpfname, "%s\\%s", tmpbuff, szItem );
+
+ // add to playlist and to listview
+
+ PLAYITEM * playitem = xine_ui->PlaylistAdd( szItem, tmpfname, 0 );
+ AddPlaylistItem( hlistwnd, playitem );
+
+ szItem = szItem + szLength + 1;
+ szLength = strlen( szItem );
+ }
+ }
+
+ xine_ui->Play( xine_ui->playindex );
+ }
+
+ return 0L;
+ }
+
+ if( cid == ID_DEL )
+ {
+ HWND hlistwnd = GetDlgItem( hwnd, ID_LIST );
+ int lvindex;
+
+ while( ( lvindex = ListView_GetNextItem( hlistwnd, -1, LVNI_SELECTED ) ) != -1 )
+ {
+ LVITEM lvitem;
+ lvitem.mask = LVIF_PARAM;
+ lvitem.iItem = lvindex;
+ ListView_GetItem( hlistwnd, &lvitem );
+
+ PLAYITEM * playitem = ( PLAYITEM * ) lvitem.lParam;
+
+ if( xine_ui->PlaylistDel( lvindex ) )
+ ListView_DeleteItem( hlistwnd, lvindex );
+ }
+
+ xine_ui->Play( xine_ui->playindex );
+ return 0L;
+ }
+ }
+ break;
+
+ case WM_SIZE:
+ {
+ ResizeChildren( hwnd );
+ return 0L;
+ }
+
+ case WM_DESTROY:
+ {
+ xine_ui->end_playlistwnd();
+ return 0L;
+ }
+
+ }
+
+ return DefWindowProc( hwnd, msg, wparam, lparam);
+}
+
+
+bool XINE_UI::init_playlistwnd()
+{
+ // if our playlist is already open, return
+
+ if( hplaylistwnd )
+ return true;
+
+ WNDCLASSEX wc;
+
+ // register our window class
+
+ wc.cbSize = sizeof( wc );
+ wc.lpszClassName = TEXT( "xineplaylistwindow" );
+ wc.lpfnWndProc = proc_playlistwnd;
+ wc.style = CS_VREDRAW | CS_HREDRAW;
+ wc.hInstance = hinst;
+ wc.hIcon = LoadIcon( hinst, MAKEINTRESOURCE( ico_xine_logo ) );
+ wc.hIconSm = LoadIcon( hinst, MAKEINTRESOURCE( ico_xine_logo ) );
+ wc.hCursor = LoadCursor( NULL, IDC_ARROW );
+ wc.hbrBackground = ( HBRUSH ) ( 1 + COLOR_BTNFACE );
+ wc.lpszMenuName = 0;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+
+ if( !RegisterClassEx( &wc ) )
+ {
+ error( "init_videownd : cannot register window class" );
+ return false;
+ }
+
+ // calculate the proper size for the windows given client size
+
+ DWORD dwFrameWidth = GetSystemMetrics( SM_CXSIZEFRAME );
+ DWORD dwFrameHeight = GetSystemMetrics( SM_CYSIZEFRAME );
+ DWORD dwMenuHeight = GetSystemMetrics( SM_CYMENU );
+ DWORD dwCaptionHeight = GetSystemMetrics( SM_CYCAPTION );
+ DWORD dwWindowWidth = WINDOW_WIDTH + dwFrameWidth * 2;
+ DWORD dwWindowHeight = WINDOW_HEIGHT + dwFrameHeight * 2 +
+ dwMenuHeight + dwCaptionHeight;
+
+ // create and show the main window
+
+ hplaylistwnd = CreateWindowEx( 0,
+ TEXT( "xineplaylistwindow" ),
+ TEXT( "xine Playlist" ),
+ WS_POPUP | WS_CAPTION | WS_CHILD | WS_SIZEBOX | WS_SYSMENU,
+ CW_USEDEFAULT, CW_USEDEFAULT,
+ dwWindowWidth, dwWindowHeight,
+ hctrlwnd,
+ NULL,
+ hinst,
+ NULL );
+ if( !hplaylistwnd )
+ {
+ error( "init_playlistwnd : cannot create video window" );
+ return false;
+ }
+
+ ShowWindow( hplaylistwnd, SW_SHOW );
+ UpdateWindow( hplaylistwnd );
+
+ SetWindowLong( hplaylistwnd, GWL_USERDATA, ( long ) this );
+
+ if( !CreateStatusWindow( WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP,
+ "Add or Delete files from the playlist",
+ hplaylistwnd,
+ ID_STATUS ) )
+ {
+ error( "CreateStatusWindow : cannot create status window" );
+ return false;
+ }
+
+ hfont = CreateFont( 13, // logical height of font
+ 5, // logical average character width
+ 0, // angle of escapement
+ 0, // base-line orientation angle
+ 0, // font weight
+ 0, // italic attribute flag
+ 0, // underline attribute flag
+ 0, // strikeout attribute flag
+ 0, // character set identifier
+ 0, // output precision
+ 0, // clipping precision
+ PROOF_QUALITY, // output quality
+ FF_MODERN | VARIABLE_PITCH , // pitch and family
+ "Areal" ); // pointer to typeface name string
+
+ if( !hfont )
+ {
+ error( "CreateFont : cannot create font" );
+ return false;
+ }
+
+ HWND hlistwnd = CreateWindowEx( WS_EX_STATICEDGE,
+ WC_LISTVIEW,
+ 0,
+ WS_CHILD | WS_VISIBLE | LVS_REPORT | LVS_NOCOLUMNHEADER,
+ 0, 0,
+ 0, 0,
+ hplaylistwnd,
+ ( HMENU ) ID_LIST,
+ hinst,
+ NULL );
+ if( !hlistwnd )
+ {
+ error( "CreateWindow : cannot create list view" );
+ return false;
+ }
+
+ AddPlaylistColumn( hlistwnd, 20, 0 );
+ AddPlaylistColumn( hlistwnd, 100, 1 );
+
+ SendMessage( hlistwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, ( LPARAM ) LVS_EX_FULLROWSELECT );
+ SendMessage( hlistwnd, WM_SETFONT, ( WPARAM ) hfont, MAKELPARAM( TRUE, 0 ) );
+ ListView_SetBkColor( hlistwnd, RGB( 0, 0, 0 ) );
+ ListView_SetTextBkColor( hlistwnd, RGB( 0, 0, 0 ) );
+ ListView_SetTextColor( hlistwnd, RGB( 255, 255, 255 ) );
+
+ HWND haddwnd = CreateWindow( "BUTTON",
+ TEXT( "Add" ),
+ WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
+ 0, 0,
+ 0, 0,
+ hplaylistwnd,
+ ( HMENU ) ID_ADD,
+ hinst,
+ NULL );
+ if( !haddwnd )
+ {
+ error( "CreateWindow : cannot create add button" );
+ return false;
+ }
+
+ SendMessage( haddwnd, WM_SETFONT, ( WPARAM ) hfont, MAKELPARAM( TRUE, 0 ) );
+
+ HWND hdelwnd = CreateWindow( "BUTTON",
+ TEXT( "Del" ),
+ WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
+ 0, 0,
+ 0, 0,
+ hplaylistwnd,
+ ( HMENU ) ID_DEL,
+ hinst,
+ NULL );
+ if( !hdelwnd )
+ {
+ error( "CreateWindow : cannot create del button" );
+ return false;
+ }
+
+ SendMessage( hdelwnd, WM_SETFONT, ( WPARAM ) hfont, MAKELPARAM( TRUE, 0 ) );
+
+ // resize all playlist window children
+
+ ResizeChildren( hplaylistwnd );
+
+ // add all playlist items to view
+
+ for( int x = 0; x < playcount; x++ )
+ AddPlaylistItem( hlistwnd, playlist[ x ] );
+
+ return true;
+}
+
+void XINE_UI::end_playlistwnd()
+{
+ DestroyWindow( hplaylistwnd );
+ UnregisterClass( "xineplaylistwindow", hinst );
+
+ hplaylistwnd = 0;
+}
diff --git a/win32/source/wnd.video.cpp b/win32/source/wnd.video.cpp new file mode 100644 index 000000000..72c2856bb --- /dev/null +++ b/win32/source/wnd.video.cpp @@ -0,0 +1,158 @@ +/*
+ * Copyright (C) 2000-2001 the xine project
+ *
+ * This file is part of xine for win32 video player.
+ *
+ * xine 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * xine 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * Xine win32 UI
+ * by Matthew Grooms <elon@altavista.com>
+ */
+
+#include "xineui.h"
+
+#define WINDOW_WIDTH 640
+#define WINDOW_HEIGHT 480
+
+LRESULT CALLBACK proc_videownd( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
+{
+ XINE_UI * xine_ui = ( XINE_UI * ) GetWindowLong( hwnd, GWL_USERDATA );
+
+ switch( msg )
+ {
+ case WM_RBUTTONDOWN:
+ {
+ if( xine_ui )
+ if( xine_ui->hctrlwnd )
+ {
+ SetWindowPos( xine_ui->hctrlwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW );
+ UpdateWindow( xine_ui->hpanelwnd );
+ }
+
+ return 0L;
+ }
+
+ case WM_MOVE:
+ {
+ if( xine_ui )
+ xine_ui->DriverMessage( GUI_WIN32_MOVED_OR_RESIZED, 0 );
+ return 0L;
+ }
+
+ case WM_SIZE:
+ {
+ if( xine_ui )
+ xine_ui->DriverMessage( GUI_WIN32_MOVED_OR_RESIZED, 0 );
+ return 0L;
+ }
+
+ case WM_DESTROY:
+ {
+ PostQuitMessage( 0 );
+ return 0L;
+ }
+ }
+
+ return DefWindowProc( hwnd, msg, wparam, lparam);
+}
+
+
+bool XINE_UI::init_videownd()
+{
+ WNDCLASSEX wc;
+ HWND desktop;
+ HDC hdc;
+ COLORREF colorkey;
+
+ // colorkey section borrowed from videolan code
+
+ desktop = GetDesktopWindow();
+ hdc = GetDC( desktop );
+ for( colorkey = 5; colorkey < 0xFF /*all shades of red*/; colorkey++ )
+ {
+ if( colorkey == GetNearestColor( hdc, colorkey ) )
+ break;
+ }
+ ReleaseDC( desktop, hdc );
+
+ // create the brush
+
+ win32_visual.Brush = CreateSolidBrush( colorkey );
+ win32_visual.ColorKey = ( int ) colorkey;
+
+ // register our window class
+
+ wc.cbSize = sizeof( wc );
+ wc.lpszClassName = TEXT( "xinevideowindow" );
+ wc.lpfnWndProc = proc_videownd;
+ wc.style = CS_VREDRAW | CS_HREDRAW;
+ wc.hInstance = hinst;
+ wc.hIcon = LoadIcon( hinst, MAKEINTRESOURCE( ico_xine_logo ) );
+ wc.hIconSm = LoadIcon( hinst, MAKEINTRESOURCE( ico_xine_logo ) );
+ wc.hCursor = LoadCursor( NULL, IDC_ARROW );
+ wc.hbrBackground = ( HBRUSH ) win32_visual.Brush;
+ wc.lpszMenuName = 0;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+
+ if( !RegisterClassEx( &wc ) )
+ {
+ error( "init_videownd : cannot register window class" );
+ return false;
+ }
+
+ // calculate the proper size for the windows given client size
+
+ DWORD dwFrameWidth = GetSystemMetrics( SM_CXSIZEFRAME );
+ DWORD dwFrameHeight = GetSystemMetrics( SM_CYSIZEFRAME );
+ DWORD dwMenuHeight = GetSystemMetrics( SM_CYMENU );
+ DWORD dwCaptionHeight = GetSystemMetrics( SM_CYCAPTION );
+ DWORD dwWindowWidth = WINDOW_WIDTH + dwFrameWidth * 2;
+ DWORD dwWindowHeight = WINDOW_HEIGHT + dwFrameHeight * 2 +
+ dwMenuHeight + dwCaptionHeight;
+
+ // create and show the main window
+
+ hvideownd = CreateWindowEx( 0,
+ TEXT( "xinevideowindow" ),
+ TEXT( "xine Video Output" ),
+ WS_SIZEBOX | WS_SYSMENU | WS_MAXIMIZEBOX,
+ CW_USEDEFAULT, CW_USEDEFAULT,
+ dwWindowWidth, dwWindowHeight,
+ NULL,
+ NULL,
+ hinst,
+ NULL );
+ if( !hvideownd )
+ {
+ error( "init_videownd : cannot create video window" );
+ return false;
+ }
+
+ ShowWindow( hvideownd, SW_SHOW );
+ UpdateWindow( hvideownd );
+
+ win32_visual.WndHnd = hvideownd;
+ SetWindowLong( hvideownd, GWL_USERDATA, ( long ) this );
+
+ return true;
+}
+
+void XINE_UI::end_videownd()
+{
+ DeleteObject( win32_visual.Brush );
+ DestroyWindow( hvideownd );
+ UnregisterClass( "xinevideowindow", hinst );
+}
diff --git a/win32/source/xine_logo.bmp b/win32/source/xine_logo.bmp Binary files differnew file mode 100644 index 000000000..f58b27f00 --- /dev/null +++ b/win32/source/xine_logo.bmp diff --git a/win32/source/xineconsole.cpp b/win32/source/xineconsole.cpp new file mode 100644 index 000000000..21055b667 --- /dev/null +++ b/win32/source/xineconsole.cpp @@ -0,0 +1,65 @@ +#include <windows.h>
+#include <commctrl.h>
+#include <stdio.h>
+#include <conio.h>
+#include "utils.h"
+#include "xineint.h"
+
+
+void event_listener( void * user_data, xine_event_t * xine_event )
+{
+ printf ("main: event listener, got event type %d\n", xine_event->type);
+
+ switch( xine_event->type )
+ {
+ case XINE_EVENT_UI_CHANNELS_CHANGED:
+ printf( "xine-event : XINE_EVENT_UI_CHANNELS_CHANGED\n" );
+ break;
+
+ case XINE_EVENT_UI_SET_TITLE:
+ printf( "xine-event : XINE_EVENT_UI_SET_TITLE\n" );
+ break;
+
+ case XINE_EVENT_UI_PLAYBACK_FINISHED:
+ printf( "xine-event : XINE_EVENT_PLAYBACK_FINISHED\n" );
+ break;
+
+#if 0
+ case XINE_EVENT_NEED_NEXT_MRL:
+ printf( "xine-event : XINE_EVENT_NEED_NEXT_MRL\n" );
+ break;
+
+ case XINE_EVENT_BRANCHED:
+ printf( "xine-event : XINE_EVENT_BRANCHED\n" );
+ break;
+#endif
+ }
+}
+
+int main( int argc, char *argv[ ], char *envp[ ] )
+{
+ win32_visual_t win32_visual;
+
+ // print welcome
+
+ printf( "xine win32 console app v 0.1\n" );
+
+ // init xine libs
+
+ config_values_t config;
+ memset( &win32_visual, 0, sizeof( win32_visual ) );
+ xine_t * xine = xine_startup( &config, &win32_visual );
+
+ if( !argv[1] )
+ printf( "xineconsole error : no media input file specified\n" );
+ else
+ xine_play( xine, argv[1], 0, 0 );
+
+ xine_register_event_listener( xine, event_listener, &win32_visual );
+
+ xine_set_audio_property( xine, AO_PROP_MUTE_VOL, 1 );
+
+ getch();
+
+ return 0;
+}
diff --git a/win32/source/xineint.cpp b/win32/source/xineint.cpp new file mode 100644 index 000000000..2534f8555 --- /dev/null +++ b/win32/source/xineint.cpp @@ -0,0 +1,209 @@ +
+#include "xineui.h"
+
+static vo_driver_t * load_video_out_driver( char * video_driver_id, config_values_t * config, win32_visual_t * win32_visual )
+{
+ vo_driver_t * vo_driver = 0;
+
+ /*
+ * Setting default (configfile stuff need registering before updating, etc...).
+ */
+
+ char ** driver_ids = xine_list_video_output_plugins( VISUAL_TYPE_WIN32 );
+ int i;
+
+ /* video output driver auto-probing */
+
+ i = 0;
+
+ while( driver_ids[i] )
+ {
+ video_driver_id = driver_ids[i];
+
+// printf (_("main: probing <%s> video output plugin\n"), video_driver_id);
+
+ vo_driver = xine_load_video_output_plugin( config, video_driver_id, VISUAL_TYPE_WIN32, (void *) win32_visual );
+
+ if( vo_driver )
+ {
+ if(driver_ids)
+ free(driver_ids);
+
+ config->update_string( config, "video.driver", video_driver_id );
+ return vo_driver;
+ }
+
+ i++;
+ }
+
+// Error( 0, "main: all available video drivers failed.\n");
+ return 0;
+}
+
+
+static ao_driver_t * load_audio_out_driver( char * audio_driver_id, config_values_t * config )
+{
+ ao_driver_t * ao_driver = 0;
+
+ /*
+ * Setting default (configfile stuff need registering before updating, etc...).
+ */
+
+ char * default_driver = config->register_string( config, "audio.driver", "auto", "audio driver to use", NULL, NULL, NULL );
+
+ /*
+ * if no audio driver was specified at the command line,
+ * look up audio driver id in the config file
+ */
+
+ if( !audio_driver_id )
+ audio_driver_id = default_driver;
+
+ /* probe ? */
+
+ if( !strncmp( audio_driver_id, "auto", 4 ) )
+ {
+ char **driver_ids = xine_list_audio_output_plugins();
+ int i = 0;
+
+// Error( 0, "main: probing audio drivers...\n" );
+
+ while( driver_ids[i] != NULL )
+ {
+ audio_driver_id = driver_ids[i];
+// Error( 0, "main: trying to autoload '%s' audio driver :", driver_ids[i] );
+ ao_driver = xine_load_audio_output_plugin( config, driver_ids[i] );
+
+ if( ao_driver )
+ {
+ printf ("main: ...worked, using '%s' audio driver.\n", driver_ids[i] );
+ config->update_string( config, "audio.driver", audio_driver_id );
+
+ return ao_driver;
+ }
+
+ i++;
+ }
+
+// Error( 0, "main: audio driver probing failed => no audio output\n" );
+
+ config->update_string( config, "audio.driver", "null" );
+
+ }
+ else
+ {
+ /* don't want to load an audio driver ? */
+ if( !strnicmp( audio_driver_id, "NULL", 4 ) )
+ {
+// Error( 0,"main: not using any audio driver (as requested).\n");
+ config->update_string( config, "audio.driver", "null" );
+
+ }
+ else
+ {
+
+ ao_driver = xine_load_audio_output_plugin( config, audio_driver_id );
+
+ if( !ao_driver )
+ {
+// Error( 0, "main: the specified audio driver '%s' failed\n", audio_driver_id );
+ exit(1);
+ }
+
+ config->update_string( config, "audio.driver", audio_driver_id );
+ }
+ }
+
+ return ao_driver;
+}
+
+xine_t * xine_startup( config_values_t * config, win32_visual_t * win32_visual )
+{
+ vo_driver_t * vo_driver;
+ ao_driver_t * ao_driver;
+
+ int audio_channel = -1;
+ int spu_channel = -1;
+
+ xine_t * xine;
+ xine_stream_t *stream;
+ xine_stream_t *spu_stream;
+
+ /*
+ * Check xine library version
+ */
+
+#if (1)
+ if(!xine_check_version(1, 0, 0)) {
+ int major, minor, sub;
+
+ xine_get_version (&major, &minor, &sub);
+ fprintf(stderr, _("Require xine library version 1.0.0, found %d.%d.%d.\n"),
+ major, minor,sub);
+ exit(1);
+ }
+#else
+ if( !xine_check_version( 0, 9, 4 ) )
+ {
+// Error( 0, "require xine library version 0.9.4, found %d.%d.%d.\n",
+// xine_get_major_version(), xine_get_minor_version(), xine_get_sub_version() );
+ return false;
+ }
+#endif
+
+ /*
+ * generate and init a config "object"
+ */
+ char * cfgfile = "config";
+ char * configfile = ( char * ) xine_xmalloc( ( strlen( ( xine_get_homedir( ) ) ) + strlen( cfgfile ) ) +2 );
+ sprintf( configfile, "%s/%s", ( xine_get_homedir() ), cfgfile );
+
+ /*config = config_file_init( configfile );*/
+ xine = xine_new();
+ xine_config_load(xine, configfile);
+
+ /*
+ * Try to load video output plugin, by stored name or probing
+ */
+
+ vo_driver = load_video_out_driver( "vo_directx", config, win32_visual );
+
+ /*
+ * Try to load audio output plugin, by stored name or probing
+ */
+
+ ao_driver = load_audio_out_driver( "auto", config );
+
+ /*
+ * xine init
+ */
+ stream = xine_stream_new(xine, ao_driver, vo_driver);
+ spu_stream = xine_stream_new(xine, NULL, vo_driver);
+
+ osd_init();
+
+ event_queue = xine_event_new_queue(gGui->stream);
+ xine_event_create_listener_thread(gGui->event_queue, event_listener, NULL);
+
+ xine_tvmode_init(xine);
+
+ /* TC - We need to allow switches on the command line for this stuff! */
+ xine_set_param(stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL, audio_channel);
+ xine_set_param(stream, XINE_PARAM_SPU_CHANNEL, spu_channel);
+
+#if (0)
+ /* Visual animation stream init */
+ gGui->visual_anim.stream = xine_stream_new(gGui->xine, NULL, gGui->vo_port);
+ gGui->visual_anim.event_queue = xine_event_new_queue(gGui->visual_anim.stream);
+ gGui->visual_anim.current = 0;
+ xine_event_create_listener_thread(gGui->visual_anim.event_queue, event_listener, NULL);
+ xine_set_param(gGui->visual_anim.stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL, -2);
+ xine_set_param(gGui->visual_anim.stream, XINE_PARAM_SPU_CHANNEL, -2);
+
+ /* Playlist scanning feature stream */
+ gGui->playlist.scan_stream = xine_stream_new(gGui->xine, gGui->ao_port, gGui->vo_port);
+ xine_set_param(gGui->playlist.scan_stream, XINE_PARAM_SPU_CHANNEL, -2);
+#endif
+
+ return xine;
+}
\ No newline at end of file diff --git a/win32/source/xineint.h b/win32/source/xineint.h new file mode 100644 index 000000000..88166a7b6 --- /dev/null +++ b/win32/source/xineint.h @@ -0,0 +1,33 @@ +/*
+ * Copyright (C) 2000-2001 the xine project
+ *
+ * This file is part of xine for win32 video player.
+ *
+ * xine 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * xine 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * Xine win32 UI
+ * by Matthew Grooms <elon@altavista.com>
+ */
+
+#include "configfile.h"
+#include "xine.h"
+#include "xineutils.h"
+#include "video_out_win32.h"
+
+#include <windows.h>
+#include <windowsx.h>
+#include "inttypes.h"
+
+xine_t * xine_startup( config_values_t * config, win32_visual_t * win32_visual );
diff --git a/win32/source/xineui.cpp b/win32/source/xineui.cpp new file mode 100644 index 000000000..5214547e4 --- /dev/null +++ b/win32/source/xineui.cpp @@ -0,0 +1,864 @@ +/*
+ * Copyright (C) 2000-2001 the xine project
+ *
+ * This file is part of xine for win32 video player.
+ *
+ * xine 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * xine 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * Xine win32 UI
+ * by Matthew Grooms <elon@altavista.com>
+ */
+
+#include "xineui.h"
+#include "common.h"
+
+/*
+#define LOG 1
+*/
+/**/
+
+static char **video_driver_ids;
+static char **audio_driver_ids;
+
+
+static void config_update(xine_cfg_entry_t *entry,
+ int type, int min, int max, int value, char *string) {
+
+ switch(type) {
+
+ case XINE_CONFIG_TYPE_UNKNOWN:
+ fprintf(stderr, "Config key '%s' isn't registered yet.\n", entry->key);
+ return;
+ break;
+
+ case XINE_CONFIG_TYPE_RANGE:
+ entry->range_min = min;
+ entry->range_max = max;
+ break;
+
+ case XINE_CONFIG_TYPE_STRING:
+ entry->str_value = string;
+ break;
+
+ case XINE_CONFIG_TYPE_ENUM:
+ case XINE_CONFIG_TYPE_NUM:
+ case XINE_CONFIG_TYPE_BOOL:
+ entry->num_value = value;
+ break;
+
+ default:
+ fprintf(stderr, "Unknown config type %d\n", type);
+ return;
+ break;
+ }
+
+ xine_config_update_entry(gGui->xine, entry);
+}
+
+static void config_update_num(char *key, int value) {
+ xine_cfg_entry_t entry;
+
+ if(xine_config_lookup_entry(gGui->xine, key, &entry))
+ config_update(&entry, XINE_CONFIG_TYPE_NUM, 0, 0, value, NULL);
+ else
+ fprintf(stderr, "WOW, key %s isn't registered\n", key);
+}
+
+/*
+ * Try to load video output plugin, by stored name or probing
+ */
+static xine_video_port_t *load_video_out_driver(int driver_number, win32_visual_t *vis) {
+ xine_video_port_t *video_port = NULL;
+ int driver_num;
+
+
+ /*
+ * Setting default (configfile stuff need registering before updating, etc...).
+ */
+ driver_num =
+ xine_config_register_enum(gGui->xine, "video.driver",
+ 0, video_driver_ids,
+ ("video driver to use"),
+ ("Choose video driver. "
+ "NOTE: you may restart xine to use the new driver"),
+ CONFIG_LEVEL_ADV,
+ CONFIG_NO_CB,
+ CONFIG_NO_DATA);
+
+ if (driver_number < 0) {
+ /* video output driver auto-probing */
+ const char *const *driver_ids;
+ int i;
+
+ if((!strcasecmp(video_driver_ids[driver_num], "none")) ||
+ (!strcasecmp(video_driver_ids[driver_num], "null"))) {
+
+ /*vis = (win32_visual_t *) xine_xmalloc(sizeof(win32_visual_t));*/
+ video_port = xine_open_video_driver(gGui->xine,
+ video_driver_ids[driver_num],
+ XINE_VISUAL_TYPE_NONE,
+ (void *) vis);
+ if (video_port)
+ return video_port;
+
+ }
+ else if(strcasecmp(video_driver_ids[driver_num], "auto")) {
+
+ vis = (win32_visual_t *) xine_xmalloc(sizeof(win32_visual_t));
+ video_port = xine_open_video_driver(gGui->xine,
+ video_driver_ids[driver_num],
+ XINE_VISUAL_TYPE_WIN32,
+ (void *) vis);
+ if (video_port)
+ return video_port;
+ }
+
+ /* note: xine-lib can do auto-probing for us if we want.
+ * but doing it here should do no harm.
+ */
+ i = 0;
+ driver_ids = xine_list_video_output_plugins (gGui->xine);
+
+ while (driver_ids[i]) {
+
+ printf (("main: probing <%s> video output plugin\n"), driver_ids[i]);
+
+ /*vis = (win32_visual_t *) xine_xmalloc(sizeof(win32_visual_t));*/
+ video_port = xine_open_video_driver(gGui->xine,
+ driver_ids[i],
+ XINE_VISUAL_TYPE_WIN32,
+ (void *) vis);
+ if (video_port) {
+ return video_port;
+ }
+
+ i++;
+ }
+
+ if (!video_port) {
+ printf (("main: all available video drivers failed.\n"));
+ exit (1);
+ }
+
+ }
+ else {
+
+ /* 'none' plugin is a special case, just change the visual type */
+ if((!strcasecmp(video_driver_ids[driver_number], "none"))
+ || (!strcasecmp(video_driver_ids[driver_number], "null"))) {
+
+ vis = (win32_visual_t *) xine_xmalloc(sizeof(win32_visual_t));
+ video_port = xine_open_video_driver(gGui->xine,
+ video_driver_ids[driver_number],
+ XINE_VISUAL_TYPE_NONE,
+ (void *) &vis);
+
+ /* do not save on config, otherwise user would never see images again... */
+ }
+ else {
+ vis = (win32_visual_t *) xine_xmalloc(sizeof(win32_visual_t));
+ video_port = xine_open_video_driver(gGui->xine,
+ video_driver_ids[driver_number],
+ XINE_VISUAL_TYPE_WIN32,
+ (void *) &vis);
+
+#if (0)
+ /* save requested driver (-V) */
+ if(video_port)
+ config_update_num("video.driver", driver_number);
+#endif
+ }
+
+ if(!video_port) {
+ printf (("main: video driver <%s> failed\n"), video_driver_ids[driver_number]);
+ exit (1);
+ }
+
+ }
+
+ return video_port;
+}
+
+/*
+ * Try to load audio output plugin, by stored name or probing
+ */
+static xine_audio_port_t *load_audio_out_driver(int driver_number) {
+ xine_audio_port_t *audio_port = NULL;
+ int driver_num;
+
+ /*
+ * Setting default (configfile stuff need registering before updating, etc...).
+ */
+ driver_num =
+ xine_config_register_enum(gGui->xine, "video.driver",
+ 0, video_driver_ids,
+ ("video driver to use"),
+ ("Choose video driver. "
+ "NOTE: you may restart xine to use the new driver"),
+ CONFIG_LEVEL_ADV,
+ CONFIG_NO_CB,
+ CONFIG_NO_DATA);
+
+
+ driver_num =
+ xine_config_register_enum(gGui->xine, "audio.driver",
+ 0, audio_driver_ids,
+ ("audio driver to use"),
+ ("Choose audio driver. "
+ "NOTE: you may restart xine to use the new driver"),
+ CONFIG_LEVEL_ADV,
+ CONFIG_NO_CB,
+ CONFIG_NO_DATA);
+
+ if (driver_number < 0) {
+ const char *const *driver_ids;
+ int i;
+
+ if (strcasecmp(audio_driver_ids[driver_num], "auto")) {
+
+ /* don't want to load an audio driver ? */
+ if (!strncasecmp(audio_driver_ids[driver_num], "NULL", 4)) {
+ printf(("main: not using any audio driver (as requested).\n"));
+ return NULL;
+ }
+
+ audio_port = xine_open_audio_driver(gGui->xine,
+ audio_driver_ids[driver_num],
+ NULL);
+ if (audio_port)
+ return audio_port;
+ }
+
+ /* note: xine-lib can do auto-probing for us if we want.
+ * but doing it here should do no harm.
+ */
+ i = 0;
+ driver_ids = xine_list_audio_output_plugins (gGui->xine);
+
+ while (driver_ids[i]) {
+
+ printf (("main: probing <%s> audio output plugin\n"), driver_ids[i]);
+
+ audio_port = xine_open_audio_driver(gGui->xine,
+ driver_ids[i],
+ NULL);
+ if (audio_port) {
+ return audio_port;
+ }
+
+ i++;
+ }
+
+ printf(("main: audio driver probing failed => no audio output\n"));
+ }
+ else {
+
+ /* don't want to load an audio driver ? */
+ if (!strncasecmp (audio_driver_ids[driver_number], "NULL", 4)) {
+
+ printf(("main: not using any audio driver (as requested).\n"));
+
+ /* calling -A null is useful to developers, but we should not save it at
+ * config. if user doesn't have a sound card he may go to setup screen
+ * changing audio.driver to NULL in order to make xine start a bit faster.
+ */
+
+ }
+ else {
+
+ audio_port = xine_open_audio_driver(gGui->xine, audio_driver_ids[driver_number], NULL);
+
+ if (!audio_port) {
+ printf (("main: audio driver <%s> failed\n"), audio_driver_ids[driver_number]);
+ exit (1);
+ }
+
+ /* save requested driver (-A) */
+ config_update_num("audio.driver", driver_number);
+ }
+
+ }
+
+ return audio_port;
+}
+
+
+static void event_listener(void *user_data, const xine_event_t *event) {
+ struct timeval tv;
+
+ XINE_UI * xine_ui = ( XINE_UI * ) user_data;
+
+ /*
+ * Ignoring finished event logo is displayed (or played), that save us
+ * from a loop of death
+ */
+ if(gGui->logo_mode && (event->type == XINE_EVENT_UI_PLAYBACK_FINISHED))
+ return;
+
+ gettimeofday (&tv, NULL);
+
+ if(abs(tv.tv_sec - event->tv.tv_sec) > 3) {
+ printf("Event too old, discarding\n");
+ return;
+ }
+
+
+ switch( event->type )
+ {
+ case XINE_EVENT_UI_CHANNELS_CHANGED:
+ {
+ xine_ui->spu_channel = xine_get_param(gGui->stream, XINE_PARAM_SPU_CHANNEL);
+ xine_ui->audio_channel = xine_get_param(gGui->stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL);
+ }
+ break;
+
+ case XINE_EVENT_UI_PLAYBACK_FINISHED:
+ xine_ui->Stop();
+ xine_ui->Play( xine_ui->playindex + 1 );
+ break;
+
+#if (0)
+ case XINE_EVENT_NEED_NEXT_MRL:
+ {
+ xine_next_mrl_event_t * xine_next_mrl_event = ( xine_next_mrl_event_t * ) xine_event;
+
+ PLAYITEM * playitem = 0;
+ if( xine_ui->playindex < ( xine_ui->playcount - 1 ) )
+ {
+ xine_ui->mrl_short_name = xine_ui->playlist[ xine_ui->playindex + 1 ]->mrl_short_name;
+ xine_ui->mrl_long_name = xine_ui->playlist[ xine_ui->playindex + 1 ]->mrl_long_name;
+ xine_next_mrl_event->mrl = xine_ui->mrl_long_name;
+ xine_ui->playindex++;
+ }
+ else
+ xine_next_mrl_event->mrl = 0;
+
+ xine_next_mrl_event->handled = 1;
+ }
+ break;
+
+ case XINE_EVENT_BRANCHED:
+#ifdef LOG
+ printf("xineui.cpp : event received XINE_EVENT_BRANCHED\n");
+#endif
+// gui_branched_callback ();
+ break;
+#endif
+
+ /* e.g. aspect ratio change during dvd playback */
+ case XINE_EVENT_FRAME_FORMAT_CHANGE:
+#ifdef LOG
+ printf("xineui.cpp : event received XINE_EVENT_FRAME_FORMAT_CHANGE\n");
+#endif
+ break;
+
+ /* report current audio level (l/r) */
+ case XINE_EVENT_AUDIO_LEVEL:
+ if(event->stream == gGui->stream) {
+ xine_audio_level_data_t *aevent = (xine_audio_level_data_t *) event->data;
+
+ printf("XINE_EVENT_AUDIO_LEVEL: left 0>%d<255, right 0>%d<255\n",
+ aevent->left, aevent->right);
+ }
+ break;
+
+ /* last event sent when stream is disposed */
+ case XINE_EVENT_QUIT:
+#ifdef LOG
+ printf("xineui.cpp : event received XINE_EVENT_QUIT\n");
+#endif
+ break;
+
+ default:
+#ifdef LOG
+ printf("xineui.cpp : unsupported event received 0x%X\n", event->type);
+#endif
+ break;
+
+ }
+}
+
+_XINE_UI::_XINE_UI()
+{
+ memset( this, 0, sizeof( _XINE_UI ) );
+}
+
+_XINE_UI::~_XINE_UI()
+{
+ EndGui();
+ EndXine();
+}
+
+bool _XINE_UI::InitGui( HINSTANCE hinstance )
+{
+ if( !hinstance )
+ return false;
+
+ hinst = hinstance;
+
+ if( !init_ctrlwnd() )
+ return false;
+
+ if( !init_videownd() )
+ return false;
+
+ return true;
+}
+
+void _XINE_UI::EndGui()
+{
+ end_ctrlwnd();
+ end_videownd();
+}
+
+bool _XINE_UI::InitXine()
+{
+ int i;
+ int audio_channel = -1;
+ int spu_channel = -1;
+ char *audio_driver_id = NULL;
+ char *video_driver_id = NULL;
+ int driver_num;
+ int session = -1;
+ char *session_mrl = NULL;
+ int major, minor, sub;
+
+ /* Check xine library version */
+ if( !xine_check_version( 0, 9, 4 ) )
+ {
+ xine_get_version(&major, &minor, &sub);
+ error( "require xine library version 0.9.4, found %d.%d.%d.\n",
+ major, minor, sub );
+ return false;
+ }
+
+ gGui = (gGui_t *) xine_xmalloc(sizeof(gGui_t));
+ gui = gGui;
+
+ gGui->stream = NULL;
+ gGui->debug_level = 0;
+ gGui->autoscan_plugin = NULL;
+ gGui->network = 0;
+ gGui->use_root_window = 0;
+
+ /*gGui->vo_port*/
+
+#ifdef HAVE_XF86VIDMODE
+ gGui->XF86VidMode_fullscreen = 0;
+#endif
+
+#if (0)
+ /* generate and init a config "object" */
+ char * cfgfile = "config";
+ gGui->configfile = ( char * ) xine_xmalloc( ( strlen( ( xine_get_homedir( ) ) ) + strlen( cfgfile ) ) +2 );
+ sprintf( configfile, "%s/%s", ( xine_get_homedir() ), cfgfile );
+
+ /*config = config_file_init( configfile );*/
+
+#else
+ /*
+ * Initialize config
+ */
+ {
+ char *cfgdir = ".xine";
+ char *cfgfile = "config";
+
+ if (!(gGui->configfile = getenv ("XINERC"))) {
+ gGui->configfile = (char *) xine_xmalloc(strlen(xine_get_homedir())
+ + strlen(cfgdir)
+ + strlen(cfgfile)
+ + 3);
+ sprintf (gGui->configfile, "%s/%s", xine_get_homedir(), cfgdir);
+ mkdir (gGui->configfile, 0755);
+ sprintf (gGui->configfile + strlen(gGui->configfile), "/%s", cfgfile);
+ }
+
+#if (0)
+ /* Popup setup window if there is no config file */
+ if(stat(gGui->configfile, &st) < 0)
+ gGui->actions_on_start[aos++] = ACTID_SETUP;
+#endif
+
+ }
+#endif
+
+
+ gGui->xine = xine_new();
+ xine_config_load(gGui->xine, gGui->configfile);
+
+#if (0)
+ /*
+ * init gui
+ */
+ gui_init(_argc - optind, &_argv[optind], &window_attribute);
+#endif
+
+ pthread_mutex_init(&gGui->download_mutex, NULL);
+
+#if (0)
+ /* Automatically start playback if new_mode is enabled and playlist is filled */
+ if(gGui->smart_mode &&
+ (gGui->playlist.num || actions_on_start(gGui->actions_on_start, ACTID_PLAYLIST)) &&
+ (!(actions_on_start(gGui->actions_on_start, ACTID_PLAY))))
+ gGui->actions_on_start[aos++] = ACTID_PLAY;
+#endif
+
+ /*
+ * xine init
+ */
+ xine_init(gGui->xine);
+
+
+ /*
+ * load and init output drivers
+ */
+ /* Video out plugin */
+ driver_num = -1;
+ {
+ const char *const *vids = xine_list_video_output_plugins(gGui->xine);
+ int i = 0;
+
+ while(vids[i++]);
+
+ video_driver_ids = (char **) xine_xmalloc(sizeof(char *) * (i + 1));
+ i = 0;
+ video_driver_ids[i] = strdup("auto");
+ while(vids[i]) {
+ video_driver_ids[i + 1] = strdup(vids[i]);
+ i++;
+ }
+
+ video_driver_ids[i + 1] = NULL;
+
+ if(video_driver_id) {
+ for(i = 0; video_driver_ids[i] != NULL; i++) {
+ if(!strcasecmp(video_driver_id, video_driver_ids[i])) {
+ driver_num = i;
+ break;
+ }
+ }
+ }
+ gGui->vo_port = load_video_out_driver(driver_num, &win32_visual);
+ }
+
+ {
+ xine_cfg_entry_t cfg_vo_entry;
+
+ if(xine_config_lookup_entry(gGui->xine, "video.driver", &cfg_vo_entry)) {
+
+ if(!strcasecmp(video_driver_ids[cfg_vo_entry.num_value], "dxr3")) {
+ xine_cfg_entry_t cfg_entry;
+ }
+ }
+ }
+ SAFE_FREE(video_driver_id);
+
+ /* Audio out plugin */
+ driver_num = -1;
+ {
+ const char *const *aids = xine_list_audio_output_plugins(gGui->xine);
+ int i = 0;
+
+ while(aids[i++]);
+
+ audio_driver_ids = (char **) xine_xmalloc(sizeof(char *) * (i + 2));
+ i = 0;
+ audio_driver_ids[i] = strdup("auto");
+ audio_driver_ids[i + 1] = strdup("null");
+ while(aids[i]) {
+ audio_driver_ids[i + 2] = strdup(aids[i]);
+ i++;
+ }
+
+ audio_driver_ids[i + 2] = NULL;
+
+ if(audio_driver_id) {
+ for(i = 0; audio_driver_ids[i] != NULL; i++) {
+ if(!strcasecmp(audio_driver_id, audio_driver_ids[i])) {
+ driver_num = i;
+ break;
+ }
+ }
+ }
+ gGui->ao_port = load_audio_out_driver(driver_num);
+ }
+ SAFE_FREE(audio_driver_id);
+
+ /* post_init(); */
+
+ gGui->stream = xine_stream_new(gGui->xine, gGui->ao_port, gGui->vo_port);
+ gGui->spu_stream = xine_stream_new(gGui->xine, NULL, gGui->vo_port);
+
+#if (0)
+ osd_init();
+
+ /*
+ * Setup logo.
+ */
+ gGui->logo_mode = 0;
+ gGui->logo_has_changed = 0;
+ gGui->logo_mrl = xine_config_register_string (gGui->xine, "gui.logo_mrl", XINE_LOGO_MRL,
+ _("Logo mrl"),
+ CONFIG_NO_HELP,
+ CONFIG_LEVEL_EXP,
+ main_change_logo_cb,
+ CONFIG_NO_DATA);
+#endif
+
+ gGui->event_queue = xine_event_new_queue(gGui->stream);
+ xine_event_create_listener_thread(gGui->event_queue, event_listener, this);
+
+ xine_tvmode_init(gGui->xine);
+
+
+#if 1
+ xine_set_param(gGui->stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL, audio_channel);
+ xine_set_param(gGui->stream, XINE_PARAM_SPU_CHANNEL, spu_channel);
+#else
+ xine_set_param(gGui->stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL, 0);
+ xine_set_param(gGui->stream, XINE_PARAM_SPU_CHANNEL, 0);
+#endif
+
+
+#if 0
+ /* Visual animation stream init */
+ gGui->visual_anim.stream = xine_stream_new(gGui->xine, NULL, gGui->vo_port);
+ gGui->visual_anim.event_queue = xine_event_new_queue(gGui->visual_anim.stream);
+ gGui->visual_anim.current = 0;
+ xine_event_create_listener_thread(gGui->visual_anim.event_queue, event_listener, this);
+ xine_set_param(gGui->visual_anim.stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL, -2);
+ xine_set_param(gGui->visual_anim.stream, XINE_PARAM_SPU_CHANNEL, -2);
+#endif
+
+#if (0)
+ /* Playlist scanning feature stream */
+ gGui->playlist.scan_stream = xine_stream_new(gGui->xine, gGui->ao_port, gGui->vo_port);
+ xine_set_param(gGui->playlist.scan_stream, XINE_PARAM_SPU_CHANNEL, -2);
+#endif
+
+ return true;
+}
+
+void _XINE_UI::EndXine()
+{
+ if( gui && gui->xine )
+ xine_exit( gui->xine );
+}
+
+void _XINE_UI::error( LPSTR szfmt, ... )
+{
+ char tempbuff[ 256 ];
+ *tempbuff = 0;
+ wvsprintf( &tempbuff[ strlen( tempbuff ) ], szfmt, ( char * )( &szfmt + 1 ) );
+ MessageBox( 0, tempbuff, "Error", MB_ICONERROR | MB_OK | MB_APPLMODAL | MB_SYSTEMMODAL );
+}
+
+void _XINE_UI::warning( LPSTR szfmt, ... )
+{
+ char tempbuff[ 256 ];
+ *tempbuff = 0;
+ wvsprintf( &tempbuff[ strlen( tempbuff ) ], szfmt, ( char * )( &szfmt + 1 ) );
+ MessageBox( 0, tempbuff, "Warning", MB_ICONWARNING | MB_OK | MB_APPLMODAL | MB_SYSTEMMODAL );
+}
+
+PLAYITEM * _XINE_UI::PlaylistAdd( char * short_name, char * long_name, int type )
+{
+ if( playcount >= MAX_PLAYITEMS )
+ return false;
+
+ PLAYITEM * playitem = new PLAYITEM;
+
+ playitem->mrl_short_name = strdup( short_name );
+ playitem->mrl_long_name = strdup( long_name );
+ playitem->mrl_type = type;
+
+ playlist[ playcount ] = playitem;
+ playcount++;
+
+ return playitem;
+}
+
+bool _XINE_UI::PlaylistDel( int index )
+{
+ if( index >= playcount )
+ return false;
+
+ PLAYITEM * playitem = playlist[ index ];
+
+ free( playitem->mrl_short_name );
+ free( playitem->mrl_long_name );
+
+ delete playitem;
+
+ memcpy( &playlist[ index ], &playlist[ index + 1 ], ( playcount - index ) * sizeof( PLAYITEM * ) );
+ playcount--;
+
+ if( ( index < playindex ) && ( playcount > 0 ) )
+ playindex--;
+
+ if( index == playindex )
+ {
+ if( playindex >= playcount )
+ playindex--;
+
+ mrl_short_name = 0;
+ mrl_long_name = 0;
+ Stop();
+ }
+
+ return true;
+}
+
+bool _XINE_UI::Play( int newindex )
+{
+ int pos_stream, pos_time;
+ int length_time;
+
+ // if we are paused, just continue playing
+
+ if( mode == XINE_STATUS_PLAY )
+ {
+ SetSpeed( XINE_SPEED_NORMAL );
+ return true;
+ }
+
+ // make sure the playindex is valid
+
+ if( ( newindex >= 0 ) && ( newindex < playcount ) )
+ playindex = newindex;
+ else
+ return false;
+
+ // is this different mrl then we are already playing
+
+ if( newindex == playindex )
+ {
+ // its the same, play from current time
+
+ HWND htimebar = GetDlgItem( hctrlwnd, ID_TIMEBAR );
+ mrl_time_current = SendMessage( htimebar, TBM_GETPOS, (WPARAM) 0, (LPARAM) 0 );
+ }
+ else
+ {
+ // its different, rewind and play from 0
+
+ mrl_time_current = 0;
+ }
+
+ // store our new mrl info
+
+ mrl_short_name = playlist[ playindex ]->mrl_short_name;
+ mrl_long_name = playlist[ playindex ]->mrl_long_name;
+ mrl_type = playlist[ playindex ]->mrl_type;
+
+ // play our mrl
+ if(!xine_open(gGui->stream, (const char *)mrl_long_name)) {
+ return 0;
+ }
+
+ if(xine_play(gGui->stream, 0, mrl_time_current))
+ {
+ mrl_time_length = 0;
+ if (xine_get_pos_length (gGui->stream, &pos_stream, &pos_time, &length_time))
+ {
+ mrl_time_length = length_time/1000;
+ }
+
+ /*mrl_time_length = xine_get_stream_length( gGui->stream )/1000;*/
+
+ HWND htimebar = GetDlgItem( hctrlwnd, ID_TIMEBAR );
+ SendMessage( htimebar, TBM_SETRANGE, (WPARAM) TRUE, (LPARAM) MAKELONG( 0, mrl_time_length ) );
+ mode = XINE_STATUS_PLAY;
+
+ // start our update loop
+
+ UpdateLoop();
+ }
+
+ return true;
+}
+
+bool _XINE_UI::Stop()
+{
+ mode = XINE_STATUS_STOP;
+ mrl_time_current = 0;
+ UpdateCtrl();
+ UpdatePanel();
+ xine_stop( gGui->stream );
+
+ return true;
+}
+
+bool _XINE_UI::SetSpeed( int speed )
+{
+ /*xine_set_speed( gGui->stream, speed );*/
+ xine_set_param(gGui->stream, XINE_PARAM_SPEED, speed);
+ return true;
+}
+
+int _XINE_UI::GetSpeed()
+{
+ /*return xine_get_speed( gGui->stream );*/
+ return xine_get_param(gGui->stream, XINE_PARAM_SPEED);
+
+}
+
+bool _XINE_UI::SetTime( int time )
+{
+ if( mode == XINE_STATUS_PLAY )
+ {
+ if(!xine_open(gGui->stream, (const char *)mrl_long_name)) {
+ return false;
+ }
+
+ xine_play(gGui->stream, 0, time);
+
+
+ mrl_time_current = time;
+ }
+
+ return true;
+}
+
+bool _XINE_UI::SelectSpuChannel( int channel )
+{
+ xine_set_param(gGui->stream, XINE_PARAM_SPU_CHANNEL, channel);
+ return true;
+}
+
+bool _XINE_UI::SelectAudioChannel( int channel )
+{
+ xine_set_param(gGui->stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL, channel);
+ return true;
+}
+
+bool _XINE_UI::SetVolume( int volume )
+{
+ xine_set_param(gGui->stream, XINE_PARAM_AUDIO_VOLUME, volume);
+ return true;
+}
+
+bool _XINE_UI::SetMute( bool mute )
+{
+ xine_set_param(gGui->stream, XINE_PARAM_AUDIO_MUTE, mute);
+ return true;
+}
+
+bool _XINE_UI::DriverMessage( int type, void * param )
+{
+ gGui->vo_port->driver->gui_data_exchange( gGui->vo_port->driver, type, param );
+ return true;
+}
+
diff --git a/win32/source/xineui.h b/win32/source/xineui.h new file mode 100644 index 000000000..73a23c9c8 --- /dev/null +++ b/win32/source/xineui.h @@ -0,0 +1,163 @@ +/*
+ * Copyright (C) 2000-2001 the xine project
+ *
+ * This file is part of xine for win32 video player.
+ *
+ * xine 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * xine 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * Xine win32 UI
+ * by Matthew Grooms <elon@altavista.com>
+ */
+
+#include <windows.h>
+#include <commctrl.h>
+#include <stdio.h>
+#include <math.h>
+#include <ddraw.h>
+
+#include "xine.h"
+#include "xineint.h"
+#include "resource.h"
+
+#include "common.h"
+
+#include "video_out.h"
+#include "audio_out.h"
+
+#include "video_out_win32.h"
+
+#ifndef _XINEUI_H_
+#define _XINEUI_H_
+
+#define ID_PANEL 10001
+#define ID_TIMEBAR 10002
+#define ID_TOOLBAR 10003
+
+#define ID_PLAY_BTTN 20001
+#define ID_PAUSE_BTTN 20002
+#define ID_STOP_BTTN 20003
+#define ID_PREV_BTTN 20004
+#define ID_NEXT_BTTN 20005
+#define ID_FFWD_BTTN 20006
+#define ID_RWND_BTTN 20007
+#define ID_EJECT_BTTN 20008
+
+#define ID_TITLE 10001
+#define ID_TIME 10002
+#define ID_CONFIG 10003
+#define ID_FULLSCREEN 10004
+#define ID_SPULABEL 10005
+#define ID_SPUINC 10006
+#define ID_SPUDEC 10007
+#define ID_SPUVALUE 10008
+#define ID_AUDIOLABEL 10009
+#define ID_AUDIOINC 10010
+#define ID_AUDIODEC 10011
+#define ID_AUDIOVALUE 10012
+#define ID_VOLBUTTON 10013
+#define ID_VOLBAR 10014
+
+#define ID_STATUS 10001
+#define ID_LIST 10002
+#define ID_ADD 10003
+#define ID_DEL 10004
+
+typedef struct _PLAYITEM
+{
+ char * mrl_short_name;
+ char * mrl_long_name;
+ int mrl_type;
+
+}PLAYITEM;
+
+#define MAX_PLAYITEMS 10004
+
+typedef class _XINE_UI
+{
+ public:
+
+ config_values_t * config;
+
+ gGui_t *gui;
+
+ bool init_ctrlwnd();
+ void end_ctrlwnd();
+ bool init_videownd();
+ void end_videownd();
+ bool init_panelwnd();
+ void end_panelwnd();
+ bool init_playlistwnd();
+ void end_playlistwnd();
+
+ void error( LPSTR szfmt, ... );
+ void warning( LPSTR szfmt, ... );
+
+ char * mrl_long_name;
+ char * mrl_short_name;
+ int mrl_type;
+ int mrl_time_length;
+ int mrl_time_current;
+ int spu_channel;
+ int audio_channel;
+ int mode;
+
+ PLAYITEM * playlist[ MAX_PLAYITEMS ];
+ int playcount;
+ int playindex;
+
+ win32_visual_t win32_visual;
+
+ HINSTANCE hinst;
+ HWND hctrlwnd;
+ HWND hpanelwnd;
+ HWND hvideownd;
+ HWND hplaylistwnd;
+ bool tracking;
+
+ _XINE_UI();
+ ~_XINE_UI();
+
+ DWORD UpdateLoop();
+ bool UpdateCtrl();
+ bool UpdatePanel();
+
+ bool InitGui( HINSTANCE hinstance );
+ void EndGui();
+ bool InitXine();
+ void EndXine();
+
+ PLAYITEM * PlaylistAdd( char * short_name, char * long_name, int type );
+ bool PlaylistDel( int index );
+
+ bool Play( int playindex );
+ bool Stop();
+ bool SetTime( int time );
+
+ bool SetSpeed( int speed );
+ int GetSpeed();
+
+ bool SelectSpuChannel( int channel );
+ bool SelectAudioChannel( int channel );
+
+ bool SetVolume( int volume );
+ bool SetMute( bool mute );
+
+ bool DriverMessage( int type, void * param );
+
+}XINE_UI;
+
+extern gGui_t *gGui;
+
+#endif
\ No newline at end of file diff --git a/win32/xine.dsw b/win32/xine.dsw new file mode 100644 index 000000000..937aef24e --- /dev/null +++ b/win32/xine.dsw @@ -0,0 +1,584 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "libdvdcss"=".\libdvdcss.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "libdvdnav"=".\libdvdnav.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name libxine
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxinesuppt
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxineutils
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libdvdread
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "libdvdread"=".\libdvdread.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name libxine
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxinesuppt
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxineutils
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libdvdcss
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "libxine"=".\libxine.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name libxinesuppt
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxineutils
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "libxinesuppt"=".\libxinesuppt.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "libxineutils"=".\libxineutils.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name libxinesuppt
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "xineplug_ao_out_directx"=".\xineplug_ao_out_directx.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "xineplug_decode_a52"=".\xineplug_decode_a52.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name libxinesuppt
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxineutils
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "xineplug_decode_dts"=".\xineplug_decode_dts.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name libxinesuppt
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxineutils
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "xineplug_decode_ff"=".\xineplug_decode_ff.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name libxinesuppt
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxineutils
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "xineplug_decode_lpcm"=".\xineplug_decode_lpcm.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name libxinesuppt
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxineutils
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "xineplug_decode_mad"=".\xineplug_decode_mad.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name libxinesuppt
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxineutils
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "xineplug_decode_mpeg2"=".\xineplug_decode_mpeg2.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name libxinesuppt
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxine
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxineutils
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "xineplug_decode_real"=".\xineplug_decode_real.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name libxine
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxinesuppt
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxineutils
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "xineplug_decode_spu"=".\xineplug_decode_spu.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name libxinesuppt
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxine
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxineutils
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "xineplug_decode_spucc"=".\xineplug_decode_spucc.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name libxine
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxinesuppt
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxineutils
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "xineplug_decode_sputext"=".\xineplug_decode_sputext.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name libxine
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxinesuppt
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxineutils
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "xineplug_dmx_asf"=".\xineplug_dmx_asf.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name libxinesuppt
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxineutils
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxine
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "xineplug_dmx_avi"=".\xineplug_dmx_avi.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name libxinesuppt
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxineutils
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxine
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "xineplug_dmx_cda"=".\xineplug_dmx_cda.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name libxine
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxinesuppt
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxineutils
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "xineplug_dmx_mpeg"=".\xineplug_dmx_mpeg.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name libxinesuppt
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxine
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxineutils
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "xineplug_dmx_mpeg_audio"=".\xineplug_dmx_mpeg_audio.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name libxinesuppt
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxine
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxineutils
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "xineplug_dmx_mpeg_block"=".\xineplug_dmx_mpeg_block.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name libxinesuppt
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxine
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxineutils
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "xineplug_dmx_mpeg_pes"=".\xineplug_dmx_mpeg_pes.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name libxinesuppt
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxine
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxineutils
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "xineplug_dmx_mpeg_ts"=".\xineplug_dmx_mpeg_ts.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name libxinesuppt
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxine
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxineutils
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "xineplug_inp_dvd"=".\xineplug_inp_dvd.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name libdvdcss
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libdvdread
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxine
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxinesuppt
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxineutils
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libdvdnav
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "xineplug_inp_file"=".\xineplug_inp_file.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name libxinesuppt
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxine
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxineutils
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "xineplug_vo_out_directx"=".\xineplug_vo_out_directx.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name libxineutils
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "xineui"=".\xineui.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name libxine
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxinesuppt
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name libxineutils
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/win32/xineconsole.dsp b/win32/xineconsole.dsp new file mode 100644 index 000000000..ef95d92f5 --- /dev/null +++ b/win32/xineconsole.dsp @@ -0,0 +1,98 @@ +# Microsoft Developer Studio Project File - Name="xineconsole" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=xineconsole - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xineconsole.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xineconsole.mak" CFG="xineconsole - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xineconsole - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "xineconsole - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xineconsole - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release/console"
+# PROP Intermediate_Dir "Release/console"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "source" /I "include" /I "../src/video_out" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"Release/bin/xineconsole.exe"
+
+!ELSEIF "$(CFG)" == "xineconsole - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug/xineconsole"
+# PROP Intermediate_Dir "Debug/xineconsole"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /I "../src/video_out" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /map /debug /machine:I386 /out:"Debug/bin/xineconsole.exe" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "xineconsole - Win32 Release"
+# Name "xineconsole - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\source\xineconsole.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\source\xineint.cpp
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/win32/xineconsole.plg b/win32/xineconsole.plg new file mode 100644 index 000000000..8738a2cfb --- /dev/null +++ b/win32/xineconsole.plg @@ -0,0 +1,51 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: xineconsole - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\DOCUME~1\Tim\LOCALS~1\Temp\RSPA85.tmp" with contents
+[
+/nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /I "../src/video_out" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR"Debug/xineconsole/" /Fp"Debug/xineconsole/xineconsole.pch" /YX /Fo"Debug/xineconsole/" /Fd"Debug/xineconsole/" /FD /GZ /c
+"C:\PCChamp\PROJECTS\Xine\xine-lib-1-beta6-win32\win32\source\xineconsole.cpp"
+"C:\PCChamp\PROJECTS\Xine\xine-lib-1-beta6-win32\win32\source\xineint.cpp"
+]
+Creating command line "cl.exe @C:\DOCUME~1\Tim\LOCALS~1\Temp\RSPA85.tmp"
+Creating temporary file "C:\DOCUME~1\Tim\LOCALS~1\Temp\RSPA86.tmp" with contents
+[
+kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:yes /pdb:"Debug/xineconsole/xineconsole.pdb" /map:"Debug/xineconsole/xineconsole.map" /debug /machine:I386 /out:"Debug/bin/xineconsole.exe" /pdbtype:sept
+".\Debug\xineconsole\xineconsole.obj"
+".\Debug\xineconsole\xineint.obj"
+".\Debug\libxine\libxine.lib"
+".\Debug\libxinesuppt\libxinesuppt.lib"
+".\Debug\libxineutils\libxineutils.lib"
+]
+Creating command line "link.exe @C:\DOCUME~1\Tim\LOCALS~1\Temp\RSPA86.tmp"
+<h3>Output Window</h3>
+Compiling...
+xineconsole.cpp
+C:\PCChamp\PROJECTS\Xine\xine-lib-1-beta6-win32\win32\source\xineconsole.cpp(56) : error C2660: 'xine_play' : function does not take 4 parameters
+C:\PCChamp\PROJECTS\Xine\xine-lib-1-beta6-win32\win32\source\xineconsole.cpp(58) : error C2065: 'xine_register_event_listener' : undeclared identifier
+C:\PCChamp\PROJECTS\Xine\xine-lib-1-beta6-win32\win32\source\xineconsole.cpp(60) : error C2065: 'xine_set_audio_property' : undeclared identifier
+C:\PCChamp\PROJECTS\Xine\xine-lib-1-beta6-win32\win32\source\xineconsole.cpp(60) : error C2065: 'AO_PROP_MUTE_VOL' : undeclared identifier
+xineint.cpp
+When compiling applications with MSVC++ and C++ exception handling:
+ Replace any 'catch( ... )' with 'PtW32CatchAll' in POSIX threads
+ if you want POSIX thread cancelation and pthread_exit to work.
+c:\pcchamp\projects\xine\xine-lib-1-beta6-win32\src\xine-engine\audio_out.h(36) : fatal error C1083: Cannot open include file: 'xine/metronom.h': No such file or directory
+Error executing cl.exe.
+Creating command line "bscmake.exe /nologo /o"Debug/xineconsole/xineconsole.bsc" ".\Debug\xineconsole\xineconsole.sbr" ".\Debug\xineconsole\xineint.sbr""
+Creating browse info file...
+BSCMAKE: error BK1506 : cannot open file '.\Debug\xineconsole\xineint.sbr': No such file or directory
+Error executing bscmake.exe.
+<h3>Output Window</h3>
+
+
+
+<h3>Results</h3>
+xineconsole.exe - 6 error(s), 0 warning(s)
+</pre>
+</body>
+</html>
diff --git a/win32/xineplug_ao_out.def b/win32/xineplug_ao_out.def new file mode 100644 index 000000000..13e57653f --- /dev/null +++ b/win32/xineplug_ao_out.def @@ -0,0 +1,7 @@ +;------------------------------------------------------------
+; XINEPLUG_AO_OUT DLL DEFINITIONS FILE
+
+EXPORTS
+
+xine_plugin_info
+get_audio_out_plugin_info
\ No newline at end of file diff --git a/win32/xineplug_ao_out_directx.dsp b/win32/xineplug_ao_out_directx.dsp new file mode 100644 index 000000000..f01ad1544 --- /dev/null +++ b/win32/xineplug_ao_out_directx.dsp @@ -0,0 +1,107 @@ +# Microsoft Developer Studio Project File - Name="xineplug_ao_out_directx" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=xineplug_ao_out_directx - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_ao_out_directx.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_ao_out_directx.mak" CFG="xineplug_ao_out_directx - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xineplug_ao_out_directx - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "xineplug_ao_out_directx - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xineplug_ao_out_directx - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release/xineplug_ao_out_directx"
+# PROP Intermediate_Dir "Release/xineplug_ao_out_directx"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_AO_OUT_DIRECTX_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_AO_OUT_DIRECTX_EXPORTS" /D "XINE_COMPILE" /FR /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib dsound.lib dxguid.lib /nologo /dll /machine:I386 /out:"Release/bin/plugins/xineplug_ao_out_directx.so"
+
+!ELSEIF "$(CFG)" == "xineplug_ao_out_directx - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug/xineplug_ao_out_directx"
+# PROP Intermediate_Dir "Debug/xineplug_ao_out_directx"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_AO_OUT_DIRECTX_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_AO_OUT_DIRECTX_EXPORTS" /D "XINE_COMPILE" /FR /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib dsound.lib dxguid.lib /nologo /dll /debug /machine:I386 /out:"Debug/bin/plugins/xineplug_ao_out_directx.so" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "xineplug_ao_out_directx - Win32 Release"
+# Name "xineplug_ao_out_directx - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\src\audio_out\audio_directx_out.c
+# End Source File
+# End Group
+# Begin Group "DLL Defs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\xineplug_ao_out.def
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/win32/xineplug_ao_out_directx.plg b/win32/xineplug_ao_out_directx.plg new file mode 100644 index 000000000..2277cc673 --- /dev/null +++ b/win32/xineplug_ao_out_directx.plg @@ -0,0 +1,38 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: xineplug_ao_out_directx - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP1FA.tmp" with contents
+[
+/nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_AO_OUT_DIRECTX_EXPORTS" /D "XINE_COMPILE" /FR"Debug/xineplug_ao_out_directx/" /Fp"Debug/xineplug_ao_out_directx/xineplug_ao_out_directx.pch" /YX /Fo"Debug/xineplug_ao_out_directx/" /Fd"Debug/xineplug_ao_out_directx/" /FD /GZ /c
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\audio_out\audio_directx_out.c"
+]
+Creating command line "cl.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP1FA.tmp"
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP1FB.tmp" with contents
+[
+kernel32.lib user32.lib gdi32.lib dsound.lib dxguid.lib /nologo /dll /incremental:yes /pdb:"Debug/xineplug_ao_out_directx/xineplug_ao_out_directx.pdb" /debug /machine:I386 /def:".\xineplug_ao_out.def" /out:"Debug/bin/plugins/xineplug_ao_out_directx.so" /implib:"Debug/xineplug_ao_out_directx/xineplug_ao_out_directx.lib" /pdbtype:sept
+".\Debug\xineplug_ao_out_directx\audio_directx_out.obj"
+]
+Creating command line "link.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP1FB.tmp"
+<h3>Output Window</h3>
+Compiling...
+audio_directx_out.c
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\audio_out\audio_directx_out.c(637) : warning C4018: '>' : signed/unsigned mismatch
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\audio_out\audio_directx_out.c(910) : warning C4028: formal parameter 1 different from declaration
+Linking...
+ Creating library Debug/xineplug_ao_out_directx/xineplug_ao_out_directx.lib and object Debug/xineplug_ao_out_directx/xineplug_ao_out_directx.exp
+Creating command line "bscmake.exe /nologo /o"Debug/xineplug_ao_out_directx/xineplug_ao_out_directx.bsc" ".\Debug\xineplug_ao_out_directx\audio_directx_out.sbr""
+Creating browse info file...
+<h3>Output Window</h3>
+
+
+
+<h3>Results</h3>
+xineplug_ao_out_directx.so - 0 error(s), 2 warning(s)
+</pre>
+</body>
+</html>
diff --git a/win32/xineplug_decode_ ao.def b/win32/xineplug_decode_ ao.def new file mode 100644 index 000000000..7b21f8559 --- /dev/null +++ b/win32/xineplug_decode_ ao.def @@ -0,0 +1,6 @@ +;------------------------------------------------------------
+; XINEPLUG_DECODE_AO DLL DEFINITIONS FILE
+
+EXPORTS
+
+xine_plugin_info
\ No newline at end of file diff --git a/win32/xineplug_decode_a52.dsp b/win32/xineplug_decode_a52.dsp new file mode 100644 index 000000000..6989c2938 --- /dev/null +++ b/win32/xineplug_decode_a52.dsp @@ -0,0 +1,127 @@ +# Microsoft Developer Studio Project File - Name="xineplug_decode_a52" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=xineplug_decode_a52 - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_decode_a52.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_decode_a52.mak" CFG="xineplug_decode_a52 - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xineplug_decode_a52 - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "xineplug_decode_a52 - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xineplug_decode_a52 - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release/xineplug_decode_a52"
+# PROP Intermediate_Dir "Release/xineplug_decode_a52"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_A52_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_A52_EXPORTS" /D "XINE_COMPILE" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 /nologo /dll /machine:I386 /out:"Release/bin/plugins/xineplug_decode_a52.so"
+
+!ELSEIF "$(CFG)" == "xineplug_decode_a52 - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug/xineplug_decode_a52"
+# PROP Intermediate_Dir "Debug/xineplug_decode_a52"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_A52_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_A52_EXPORTS" /D "XINE_COMPILE" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 /nologo /dll /debug /machine:I386 /out:"Debug/bin/plugins/xineplug_decode_a52.so" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "xineplug_decode_a52 - Win32 Release"
+# Name "xineplug_decode_a52 - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\src\liba52\bit_allocate.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\liba52\bitstream.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\liba52\downmix.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\liba52\imdct.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\liba52\parse.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\liba52\xine_decoder.c
+# End Source File
+# End Group
+# Begin Group "DLL Defs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=".\xineplug_decode_ ao.def"
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/win32/xineplug_decode_a52.plg b/win32/xineplug_decode_a52.plg new file mode 100644 index 000000000..d5096ba6b --- /dev/null +++ b/win32/xineplug_decode_a52.plg @@ -0,0 +1,661 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: xineplug_decode_a52 - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP206.tmp" with contents
+[
+/nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_A52_EXPORTS" /D "XINE_COMPILE" /Fp"Debug/xineplug_decode_a52/xineplug_decode_a52.pch" /YX /Fo"Debug/xineplug_decode_a52/" /Fd"Debug/xineplug_decode_a52/" /FD /GZ /c
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\liba52\bitstream.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\liba52\parse.c"
+]
+Creating command line "cl.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP206.tmp"
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP207.tmp" with contents
+[
+/nologo /dll /incremental:yes /pdb:"Debug/xineplug_decode_a52/xineplug_decode_a52.pdb" /debug /machine:I386 /def:".\xineplug_decode_ ao.def" /out:"Debug/bin/plugins/xineplug_decode_a52.so" /implib:"Debug/xineplug_decode_a52/xineplug_decode_a52.lib" /pdbtype:sept
+".\Debug\xineplug_decode_a52\bit_allocate.obj"
+".\Debug\xineplug_decode_a52\bitstream.obj"
+".\Debug\xineplug_decode_a52\downmix.obj"
+".\Debug\xineplug_decode_a52\imdct.obj"
+".\Debug\xineplug_decode_a52\parse.obj"
+".\Debug\xineplug_decode_a52\xine_decoder.obj"
+".\Debug\libxinesuppt\libxinesuppt.lib"
+".\Debug\libxineutils\libxineutils.lib"
+]
+Creating command line "link.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP207.tmp"
+<h3>Output Window</h3>
+Compiling...
+bitstream.c
+parse.c
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(54) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(54) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(54) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(54) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(54) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(54) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(54) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(54) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(54) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(56) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(56) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(56) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(56) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(56) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(56) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(56) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(56) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(56) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(61) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(61) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(61) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(61) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(61) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(61) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(62) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(62) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(62) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(62) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(62) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(62) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(63) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(63) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(63) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(63) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(63) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(63) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(68) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(68) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(68) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(68) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(68) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(68) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(69) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(69) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(69) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(69) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(69) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(69) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(70) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(70) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(70) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(70) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(70) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(70) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(85) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(85) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(85) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(85) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(85) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(85) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(85) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(85) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(85) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(85) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(85) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(85) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(85) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(85) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(85) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(85) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(85) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(85) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(85) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(85) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(85) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(85) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(85) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(85) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(85) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(86) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(86) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(86) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(86) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(86) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(86) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(86) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(86) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(86) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(86) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(86) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(86) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(86) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(86) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(86) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(86) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(86) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(86) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(86) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(86) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(86) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(86) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(86) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(86) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(86) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(88) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(88) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(88) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(88) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(88) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(88) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(88) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(88) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(88) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(88) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(88) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(88) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(88) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(88) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(88) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(88) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(88) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(88) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(88) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(88) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(88) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(88) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(88) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(88) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(88) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(89) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(89) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(89) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(89) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(89) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(89) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(89) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(89) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(89) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(89) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(89) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(89) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(89) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(89) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(89) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(89) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(89) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(89) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(89) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(89) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(89) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(89) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(89) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(89) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(89) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(94) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(94) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(94) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(94) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(94) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(94) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(94) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(94) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(94) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(94) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(94) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(94) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(94) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(94) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(94) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(94) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(94) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(94) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(94) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(94) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(95) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(95) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(95) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(95) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(95) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(95) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(95) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(95) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(95) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(95) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(95) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(95) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(95) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(95) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(95) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(95) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(95) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(95) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(95) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(95) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(96) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(96) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(96) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(96) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(96) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(96) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(96) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(96) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(96) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(96) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(96) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(96) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(96) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(96) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(96) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(96) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(96) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(96) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(96) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(96) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(97) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(97) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(97) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(97) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(97) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(97) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(97) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(97) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(97) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(97) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(97) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(97) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(97) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(97) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(97) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(97) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(97) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(97) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(97) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(97) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(98) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(98) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(98) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(98) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(98) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(98) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(98) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(98) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(98) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(98) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(98) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(98) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(98) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(98) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(98) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(98) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(98) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(98) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(98) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(98) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(103) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(103) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(103) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(103) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(103) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(103) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(103) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(103) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(103) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(103) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(103) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(103) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(103) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(103) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(103) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(103) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(103) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(103) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(103) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(103) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(104) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(104) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(104) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(104) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(104) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(104) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(104) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(104) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(104) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(104) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(104) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(104) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(104) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(104) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(104) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(104) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(104) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(104) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(104) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(104) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(105) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(105) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(105) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(105) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(105) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(105) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(105) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(105) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(105) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(105) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(105) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(105) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(105) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(105) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(105) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(105) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(105) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(105) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(105) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(105) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(106) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(106) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(106) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(106) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(106) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(106) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(106) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(106) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(106) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(106) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(106) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(106) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(106) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(106) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(106) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(106) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(106) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(106) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(106) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(106) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(107) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(107) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(107) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(107) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(107) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(107) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(107) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(107) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(107) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(107) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(107) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(107) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(107) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(107) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(107) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(107) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(107) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(107) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(107) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(107) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(118) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(118) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(118) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(119) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(119) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(119) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(135) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(135) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(135) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(135) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(135) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(135) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(135) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(135) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(135) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(135) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(135) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(136) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(136) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(136) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(136) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(136) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(136) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(136) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(136) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(136) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(136) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(136) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(137) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(137) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(137) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(137) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(137) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(137) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(137) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(137) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(137) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(137) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(137) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(138) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(138) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(138) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(138) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(138) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(138) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(138) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(138) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(138) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(138) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(138) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(139) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(139) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(139) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(139) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(139) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(139) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(139) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(139) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(139) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(139) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(139) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(141) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(141) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(141) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(141) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(141) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(141) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(141) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(141) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(141) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(141) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(141) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(142) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(142) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(142) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(142) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(142) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(142) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(142) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(142) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(142) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(142) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(142) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(143) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(143) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(143) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(143) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(143) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(143) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(143) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(143) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(143) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(143) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(143) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(144) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(144) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(144) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(144) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(144) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(144) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(144) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(144) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(144) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(144) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(144) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(145) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(145) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(145) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(145) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(145) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(145) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(145) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(145) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(145) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(145) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(145) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(150) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(150) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(150) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(150) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(150) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(150) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(150) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(150) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(150) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(150) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(151) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(151) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(151) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(151) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(151) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(151) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(151) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(151) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(151) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(151) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(152) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(152) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(152) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(152) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(152) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(152) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(152) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(152) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(152) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(152) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(153) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(153) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(153) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(153) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(153) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(153) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(153) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(153) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(153) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(153) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(154) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(154) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(154) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(154) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(154) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(154) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(154) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(154) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(154) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(154) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(155) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(155) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(155) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(155) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(155) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(155) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(155) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(155) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(155) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(155) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(156) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(156) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(156) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(156) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(156) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(156) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(156) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(156) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(156) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(156) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(157) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(157) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(157) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(157) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(157) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(157) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(157) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(157) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(157) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(157) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(158) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(158) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(158) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(158) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(158) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(158) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(158) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(158) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(158) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(158) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(159) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(159) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(159) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(159) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(159) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(159) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(159) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(159) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(159) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(159) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(160) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(160) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(160) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(160) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(160) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(160) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(160) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(160) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(160) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(160) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(177) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(177) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(177) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(178) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(178) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(178) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(179) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(179) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(180) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(180) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(180) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(181) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(181) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\tables.h(181) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\parse.c(127) : warning C4305: 'initializing' : truncation from 'const double ' to 'float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\parse.c(127) : warning C4305: 'initializing' : truncation from 'const double ' to 'float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\parse.c(127) : warning C4305: 'initializing' : truncation from 'const double ' to 'float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\parse.c(128) : warning C4305: 'initializing' : truncation from 'const double ' to 'float '
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\parse.c(148) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\parse.c(332) : warning C4244: '=' : conversion from 'double ' to 'float ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\parse.c(434) : warning C4244: '=' : conversion from 'double ' to 'float ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\parse.c(503) : warning C4244: '=' : conversion from 'long ' to 'float ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\parse.c(530) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\parse.c(533) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\parse.c(568) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\parse.c(631) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\parse.c(633) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\parse.c(635) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\parse.c(671) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\parse.c(680) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\parse.c(688) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\parse.c(692) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\parse.c(694) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\parse.c(696) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\parse.c(698) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\parse.c(702) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\parse.c(703) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\parse.c(709) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liba52\parse.c(711) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+Linking...
+ Creating library Debug/xineplug_decode_a52/xineplug_decode_a52.lib and object Debug/xineplug_decode_a52/xineplug_decode_a52.exp
+
+
+
+<h3>Results</h3>
+xineplug_decode_a52.so - 0 error(s), 619 warning(s)
+</pre>
+</body>
+</html>
diff --git a/win32/xineplug_decode_divx4.dsp b/win32/xineplug_decode_divx4.dsp new file mode 100644 index 000000000..e34bbc55e --- /dev/null +++ b/win32/xineplug_decode_divx4.dsp @@ -0,0 +1,107 @@ +# Microsoft Developer Studio Project File - Name="xineplug_decode_divx4" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=xineplug_decode_divx4 - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_decode_divx4.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_decode_divx4.mak" CFG="xineplug_decode_divx4 - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xineplug_decode_divx4 - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "xineplug_decode_divx4 - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xineplug_decode_divx4 - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release/xineplug_decode_divx4"
+# PROP Intermediate_Dir "Release/xineplug_decode_divx4"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_DIVX4_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_DIVX4_EXPORTS" /D "XINE_COMPILE" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 /nologo /dll /machine:I386 /out:"Release/bin/plugins/xineplug_decode_divx4.so"
+
+!ELSEIF "$(CFG)" == "xineplug_decode_divx4 - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug/xineplug_decode_divx4"
+# PROP Intermediate_Dir "Debug/xineplug_decode_divx4"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_DIVX4_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_DIVX4_EXPORTS" /D "XINE_COMPILE" /FR /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 /nologo /dll /debug /machine:I386 /out:"Debug/bin/plugins/xineplug_decode_divx4.so" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "xineplug_decode_divx4 - Win32 Release"
+# Name "xineplug_decode_divx4 - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\src\libdivx4\xine_decoder.c
+# End Source File
+# End Group
+# Begin Group "DLL Defs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\xineplug_decode_vo.def
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/win32/xineplug_decode_divx4.plg b/win32/xineplug_decode_divx4.plg new file mode 100644 index 000000000..71a2386c2 --- /dev/null +++ b/win32/xineplug_decode_divx4.plg @@ -0,0 +1,111 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: xineplug_decode_divx4 - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPA8.tmp" with contents
+[
+/nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_DIVX4_EXPORTS" /D "XINE_COMPILE" /FR"Debug/xineplug_decode_divx4/" /Fp"Debug/xineplug_decode_divx4/xineplug_decode_divx4.pch" /YX /Fo"Debug/xineplug_decode_divx4/" /Fd"Debug/xineplug_decode_divx4/" /FD /GZ /c
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c"
+]
+Creating command line "cl.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPA8.tmp"
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPA9.tmp" with contents
+[
+/nologo /dll /incremental:yes /pdb:"Debug/xineplug_decode_divx4/xineplug_decode_divx4.pdb" /debug /machine:I386 /def:".\xineplug_decode_vo.def" /out:"Debug/bin/plugins/xineplug_decode_divx4.so" /implib:"Debug/xineplug_decode_divx4/xineplug_decode_divx4.lib" /pdbtype:sept
+".\Debug\xineplug_decode_divx4\xine_decoder.obj"
+".\Debug\libxinesuppt\libxinesuppt.lib"
+".\Debug\libxineutils\libxineutils.lib"
+]
+Creating command line "link.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPA9.tmp"
+<h3>Output Window</h3>
+Compiling...
+xine_decoder.c
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(100) : error C2061: syntax error : identifier 'vo_instance_t'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(111) : error C2372: 'decore' : redefinition; different types of indirection
+ c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\decore-if.h(165) : see declaration of 'decore'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(126) : error C2059: syntax error : '}'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(152) : error C2143: syntax error : missing ')' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(152) : error C2143: syntax error : missing '{' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(152) : error C2059: syntax error : ')'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(153) : error C2054: expected '(' to follow 'this'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(191) : error C2143: syntax error : missing ')' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(191) : error C2143: syntax error : missing '{' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(191) : error C2059: syntax error : ')'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(192) : error C2054: expected '(' to follow 'this'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(206) : error C2143: syntax error : missing ')' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(206) : error C2143: syntax error : missing '{' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(206) : error C2059: syntax error : ')'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(206) : error C2054: expected '(' to follow 'this'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(226) : error C2143: syntax error : missing ')' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(226) : error C2143: syntax error : missing '{' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(226) : error C2371: 'buf_element_t' : redefinition; different basic types
+ c:\pcchamp\projects\xine\xine-lib-1-beta10\src\xine-engine\buffer.h(225) : see declaration of 'buf_element_t'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(226) : error C2143: syntax error : missing ';' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(226) : error C2059: syntax error : ')'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(227) : error C2371: 'buf' : redefinition; different basic types
+ c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(107) : see declaration of 'buf'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(227) : error C2054: expected '(' to follow 'buf'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(271) : error C2143: syntax error : missing ')' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(271) : error C2143: syntax error : missing '{' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(271) : error C2371: 'vo_frame_t' : redefinition; different basic types
+ c:\pcchamp\projects\xine\xine-lib-1-beta10\src\xine-engine\video_out.h(54) : see declaration of 'vo_frame_t'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(271) : error C2143: syntax error : missing ';' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(272) : error C2371: 'DEC_PICTURE' : redefinition; different basic types
+ c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\decore-if.h(161) : see declaration of 'DEC_PICTURE'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(272) : error C2146: syntax error : missing ';' before identifier 'pict'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(272) : error C2059: syntax error : ')'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(273) : error C2054: expected '(' to follow 'pict'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(336) : error C2065: 'divx4_decoder_t' : undeclared identifier
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(336) : error C2297: '*' : illegal, right operand has type 'int *'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(336) : error C2059: syntax error : ')'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(340) : error C2223: left of '->can_handle_311' must point to struct/union
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(342) : warning C4033: 'divx4_can_handle' must return a value
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(346) : error C2143: syntax error : missing ')' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(346) : error C2081: 'vo_instance_t' : name in formal parameter list illegal
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(346) : error C2143: syntax error : missing '{' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(346) : error C2059: syntax error : ')'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(346) : error C2054: expected '(' to follow 'video_out'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(363) : error C2297: '*' : illegal, right operand has type 'int *'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(363) : error C2059: syntax error : ')'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(367) : warning C4013: 'divx4_get_version' undefined; assuming extern returning int
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(368) : error C2223: left of '->decoder_ok' must point to struct/union
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(368) : warning C4013: 'divx4_check_version' undefined; assuming extern returning int
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(369) : warning C4013: 'divx4_init_decoder' undefined; assuming extern returning int
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(370) : error C2223: left of '->decoder_ok' must point to struct/union
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(371) : error C2223: left of '->video_out' must point to struct/union
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(371) : error C2223: left of '->video_out' must point to struct/union
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(373) : error C2223: left of '->buf' must point to struct/union
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(374) : error C2223: left of '->buf' must point to struct/union
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(374) : error C2198: 'free' : too few actual parameters
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(376) : error C2223: left of '->buf' must point to struct/union
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(377) : error C2223: left of '->bufsize' must point to struct/union
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(382) : error C2223: left of '->decoder_ok' must point to struct/union
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(390) : error C2223: left of '->size' must point to struct/union
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(390) : error C2223: left of '->bufsize' must point to struct/union
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(391) : error C2223: left of '->bufsize' must point to struct/union
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(391) : error C2223: left of '->size' must point to struct/union
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(393) : error C2223: left of '->bufsize' must point to struct/union
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(394) : error C2223: left of '->buf' must point to struct/union
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(394) : error C2223: left of '->buf' must point to struct/union
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(394) : error C2223: left of '->bufsize' must point to struct/union
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(394) : error C2198: 'realloc' : too few actual parameters
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(397) : error C2223: left of '->buf' must point to struct/union
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(397) : error C2223: left of '->size' must point to struct/union
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdivx4\xine_decoder.c(397) : fatal error C1903: unable to recover from previous error(s); stopping compilation
+Error executing cl.exe.
+Creating command line "bscmake.exe /nologo /o"Debug/xineplug_decode_divx4/xineplug_decode_divx4.bsc" ".\Debug\xineplug_decode_divx4\xine_decoder.sbr""
+Creating browse info file...
+BSCMAKE: error BK1506 : cannot open file '.\Debug\xineplug_decode_divx4\xine_decoder.sbr': No such file or directory
+Error executing bscmake.exe.
+<h3>Output Window</h3>
+
+
+
+<h3>Results</h3>
+xineplug_decode_divx4.so - 64 error(s), 4 warning(s)
+</pre>
+</body>
+</html>
diff --git a/win32/xineplug_decode_dts.dsp b/win32/xineplug_decode_dts.dsp new file mode 100644 index 000000000..8684eedc4 --- /dev/null +++ b/win32/xineplug_decode_dts.dsp @@ -0,0 +1,107 @@ +# Microsoft Developer Studio Project File - Name="xineplug_decode_dts" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=xineplug_decode_dts - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_decode_dts.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_decode_dts.mak" CFG="xineplug_decode_dts - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xineplug_decode_dts - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "xineplug_decode_dts - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xineplug_decode_dts - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release/xineplug_decode_dts"
+# PROP Intermediate_Dir "Release/xineplug_decode_dts"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_DTS_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_DTS_EXPORTS" /D "XINE_COMPILE" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 /nologo /dll /machine:I386 /out:"Release/bin/plugins/xineplug_decode_dts.so"
+
+!ELSEIF "$(CFG)" == "xineplug_decode_dts - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug/xineplug_decode_dts"
+# PROP Intermediate_Dir "Debug/xineplug_decode_dts"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_DTS_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_DTS_EXPORTS" /D "XINE_COMPILE" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 /nologo /dll /debug /machine:I386 /out:"Debug/bin/plugins/xineplug_decode_dts.so" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "xineplug_decode_dts - Win32 Release"
+# Name "xineplug_decode_dts - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\src\libdts\xine_decoder.c
+# End Source File
+# End Group
+# Begin Group "DLL Defs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=".\xineplug_decode_ ao.def"
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/win32/xineplug_decode_dts.plg b/win32/xineplug_decode_dts.plg new file mode 100644 index 000000000..abbd3fa09 --- /dev/null +++ b/win32/xineplug_decode_dts.plg @@ -0,0 +1,39 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: xineplug_decode_dts - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPBC.tmp" with contents
+[
+/nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_DTS_EXPORTS" /D "XINE_COMPILE" /Fp"Debug/xineplug_decode_dts/xineplug_decode_dts.pch" /YX /Fo"Debug/xineplug_decode_dts/" /Fd"Debug/xineplug_decode_dts/" /FD /GZ /c
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\libdts\xine_decoder.c"
+]
+Creating command line "cl.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPBC.tmp"
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPBD.tmp" with contents
+[
+/nologo /dll /incremental:yes /pdb:"Debug/xineplug_decode_dts/xineplug_decode_dts.pdb" /debug /machine:I386 /def:".\xineplug_decode_ ao.def" /out:"Debug/bin/plugins/xineplug_decode_dts.so" /implib:"Debug/xineplug_decode_dts/xineplug_decode_dts.lib" /pdbtype:sept
+".\Debug\xineplug_decode_dts\xine_decoder.obj"
+".\Debug\libxinesuppt\libxinesuppt.lib"
+".\Debug\libxineutils\libxineutils.lib"
+]
+Creating command line "link.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPBD.tmp"
+<h3>Output Window</h3>
+Compiling...
+xine_decoder.c
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdts\xine_decoder.c(115) : warning C4018: '<=' : signed/unsigned mismatch
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdts\xine_decoder.c(139) : warning C4018: '==' : signed/unsigned mismatch
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdts\xine_decoder.c(199) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdts\xine_decoder.c(201) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libdts\xine_decoder.c(202) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+Linking...
+
+
+
+<h3>Results</h3>
+xineplug_decode_dts.so - 0 error(s), 5 warning(s)
+</pre>
+</body>
+</html>
diff --git a/win32/xineplug_decode_ff.dsp b/win32/xineplug_decode_ff.dsp new file mode 100644 index 000000000..616d6b639 --- /dev/null +++ b/win32/xineplug_decode_ff.dsp @@ -0,0 +1,107 @@ +# Microsoft Developer Studio Project File - Name="xineplug_decode_ff" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=xineplug_decode_ff - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_decode_ff.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_decode_ff.mak" CFG="xineplug_decode_ff - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xineplug_decode_ff - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "xineplug_decode_ff - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xineplug_decode_ff - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release/xineplug_decode_ff"
+# PROP Intermediate_Dir "Release/xineplug_decode_ff"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_FF_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_FF_EXPORTS" /D "XINE_COMPILE" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 /nologo /dll /machine:I386 /out:"Release/bin/plugins/xineplug_decode_ff.so"
+
+!ELSEIF "$(CFG)" == "xineplug_decode_ff - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug/xineplug_decode_ff"
+# PROP Intermediate_Dir "Debug/xineplug_decode_ff"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_FF_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /I ".." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_FF_EXPORTS" /D "XINE_COMPILE" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 /nologo /dll /debug /machine:I386 /out:"Debug/bin/plugins/xineplug_decode_ff.so" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "xineplug_decode_ff - Win32 Release"
+# Name "xineplug_decode_ff - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\src\libffmpeg\libavcodec\huffyuv.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\libffmpeg\xine_decoder.c
+# End Source File
+# End Group
+# Begin Group "DLL Defs"
+
+# PROP Default_Filter ""
+# End Group
+# End Target
+# End Project
diff --git a/win32/xineplug_decode_ff.plg b/win32/xineplug_decode_ff.plg new file mode 100644 index 000000000..165fbf785 --- /dev/null +++ b/win32/xineplug_decode_ff.plg @@ -0,0 +1,259 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: xineplug_decode_ff - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPC1.tmp" with contents
+[
+/nologo /MDd /W3 /Gm /GX /ZI /Od /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /I ".." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_FF_EXPORTS" /D "XINE_COMPILE" /Fp"Debug/xineplug_decode_ff/xineplug_decode_ff.pch" /YX /Fo"Debug/xineplug_decode_ff/" /Fd"Debug/xineplug_decode_ff/" /FD /GZ /c
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\huffyuv.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\libffmpeg\xine_decoder.c"
+]
+Creating command line "cl.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPC1.tmp"
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPC2.tmp" with contents
+[
+/nologo /dll /incremental:yes /pdb:"Debug/xineplug_decode_ff/xineplug_decode_ff.pdb" /debug /machine:I386 /out:"Debug/bin/plugins/xineplug_decode_ff.so" /implib:"Debug/xineplug_decode_ff/xineplug_decode_ff.lib" /pdbtype:sept
+".\Debug\xineplug_decode_ff\huffyuv.obj"
+".\Debug\xineplug_decode_ff\xine_decoder.obj"
+".\Debug\libxinesuppt\libxinesuppt.lib"
+".\Debug\libxineutils\libxineutils.lib"
+]
+Creating command line "link.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPC2.tmp"
+<h3>Output Window</h3>
+Compiling...
+huffyuv.c
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(227) : error C2014: preprocessor command must start as first nonwhite space
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(228) : error C2632: 'long' followed by 'long' is illegal
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(228) : error C2371: 'pts' : redefinition; different basic types
+ c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(226) : see declaration of 'pts'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(229) : error C2014: preprocessor command must start as first nonwhite space
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(329) : error C2121: '#' : invalid character : possibly the result of a macro expansion
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(329) : error C2061: syntax error : identifier 'ifdef'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(639) : error C2143: syntax error : missing ')' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(639) : error C2081: 'AVFrame' : name in formal parameter list illegal
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(639) : error C2143: syntax error : missing ';' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(639) : error C2059: syntax error : '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(639) : error C2059: syntax error : ')'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(648) : error C2143: syntax error : missing ')' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(648) : error C2081: 'AVFrame' : name in formal parameter list illegal
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(648) : error C2143: syntax error : missing '{' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(648) : error C2059: syntax error : ')'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(894) : error C2143: syntax error : missing '{' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1066) : error C2059: syntax error : '}'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1121) : error C2143: syntax error : missing ')' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1121) : error C2143: syntax error : missing ';' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1121) : error C2059: syntax error : '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1121) : error C2059: syntax error : ')'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1122) : error C2143: syntax error : missing ')' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1122) : error C2143: syntax error : missing '{' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1122) : error C2059: syntax error : ','
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1122) : error C2059: syntax error : ')'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1123) : error C2143: syntax error : missing ')' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1123) : error C2143: syntax error : missing '{' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1123) : error C2059: syntax error : ')'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1123) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1124) : error C2143: syntax error : missing ')' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1124) : error C2143: syntax error : missing '{' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1124) : error C2059: syntax error : ','
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1125) : error C2059: syntax error : ')'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1129) : error C2059: syntax error : '}'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1140) : error C2061: syntax error : identifier 'ac3_encoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1140) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1141) : error C2061: syntax error : identifier 'mp2_encoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1141) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1142) : error C2061: syntax error : identifier 'mp3lame_encoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1142) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1143) : error C2061: syntax error : identifier 'oggvorbis_encoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1143) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1144) : error C2061: syntax error : identifier 'mpeg1video_encoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1144) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1145) : error C2061: syntax error : identifier 'h263_encoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1145) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1146) : error C2061: syntax error : identifier 'h263p_encoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1146) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1147) : error C2061: syntax error : identifier 'rv10_encoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1147) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1148) : error C2061: syntax error : identifier 'mjpeg_encoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1148) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1149) : error C2061: syntax error : identifier 'mpeg4_encoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1149) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1150) : error C2061: syntax error : identifier 'msmpeg4v1_encoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1150) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1151) : error C2061: syntax error : identifier 'msmpeg4v2_encoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1151) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1152) : error C2061: syntax error : identifier 'msmpeg4v3_encoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1152) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1153) : error C2061: syntax error : identifier 'wmv1_encoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1153) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1154) : error C2061: syntax error : identifier 'wmv2_encoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1154) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1155) : error C2061: syntax error : identifier 'huffyuv_encoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1155) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1157) : error C2061: syntax error : identifier 'h263_decoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1157) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1158) : error C2061: syntax error : identifier 'mpeg4_decoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1158) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1159) : error C2061: syntax error : identifier 'msmpeg4v1_decoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1159) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1160) : error C2061: syntax error : identifier 'msmpeg4v2_decoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1160) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1161) : error C2061: syntax error : identifier 'msmpeg4v3_decoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1161) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1162) : error C2061: syntax error : identifier 'wmv1_decoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1162) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1163) : error C2061: syntax error : identifier 'wmv2_decoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1163) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1164) : error C2061: syntax error : identifier 'mpeg_decoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1164) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1165) : error C2061: syntax error : identifier 'h263i_decoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1165) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1166) : error C2061: syntax error : identifier 'rv10_decoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1166) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1167) : error C2061: syntax error : identifier 'svq1_decoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1167) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1168) : error C2061: syntax error : identifier 'dvvideo_decoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1168) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1169) : error C2061: syntax error : identifier 'dvaudio_decoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1169) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1170) : error C2061: syntax error : identifier 'wmav1_decoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1170) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1171) : error C2061: syntax error : identifier 'wmav2_decoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1171) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1172) : error C2061: syntax error : identifier 'mjpeg_decoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1172) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1173) : error C2061: syntax error : identifier 'mjpegb_decoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1173) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1174) : error C2061: syntax error : identifier 'mp2_decoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1174) : fatal error C1003: error count exceeds 100; stopping compilation
+xine_decoder.c
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\common.h(87) : warning C4114: same type qualifier used more than once
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\common.h(87) : error C2632: 'short' followed by 'short' is illegal
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\common.h(87) : warning C4091: 'typedef ' : ignored on left of 'unsigned short ' when no variable is declared
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\common.h(88) : warning C4114: same type qualifier used more than once
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\common.h(88) : error C2632: 'short' followed by 'short' is illegal
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\common.h(88) : warning C4091: 'typedef ' : ignored on left of 'short ' when no variable is declared
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\common.h(89) : warning C4114: same type qualifier used more than once
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\common.h(89) : error C2632: 'char' followed by 'char' is illegal
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\common.h(89) : warning C4091: 'typedef ' : ignored on left of 'unsigned char ' when no variable is declared
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\common.h(90) : warning C4114: same type qualifier used more than once
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\common.h(90) : warning C4091: 'typedef ' : ignored on left of 'unsigned long ' when no variable is declared
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\common.h(91) : warning C4114: same type qualifier used more than once
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\common.h(91) : error C2632: '__int64' followed by '__int64' is illegal
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\common.h(91) : warning C4091: 'typedef ' : ignored on left of 'unsigned __int64 ' when no variable is declared
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\common.h(92) : warning C4114: same type qualifier used more than once
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\common.h(92) : error C2632: 'char' followed by 'char' is illegal
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\common.h(92) : warning C4091: 'typedef ' : ignored on left of 'char ' when no variable is declared
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\common.h(93) : warning C4114: same type qualifier used more than once
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\common.h(93) : warning C4091: 'typedef ' : ignored on left of 'long ' when no variable is declared
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\common.h(94) : warning C4114: same type qualifier used more than once
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\common.h(94) : error C2632: '__int64' followed by '__int64' is illegal
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\common.h(94) : warning C4091: 'typedef ' : ignored on left of '__int64 ' when no variable is declared
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(227) : error C2014: preprocessor command must start as first nonwhite space
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(228) : error C2632: 'long' followed by 'long' is illegal
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(228) : error C2371: 'pts' : redefinition; different basic types
+ c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(226) : see declaration of 'pts'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(229) : error C2014: preprocessor command must start as first nonwhite space
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(329) : error C2121: '#' : invalid character : possibly the result of a macro expansion
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(329) : error C2061: syntax error : identifier 'ifdef'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(639) : error C2143: syntax error : missing ')' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(639) : error C2081: 'AVFrame' : name in formal parameter list illegal
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(639) : error C2143: syntax error : missing ';' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(639) : error C2059: syntax error : '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(639) : error C2059: syntax error : ')'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(648) : error C2143: syntax error : missing ')' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(648) : error C2081: 'AVFrame' : name in formal parameter list illegal
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(648) : error C2143: syntax error : missing '{' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(648) : error C2059: syntax error : ')'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(894) : error C2143: syntax error : missing '{' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1066) : error C2059: syntax error : '}'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1121) : error C2143: syntax error : missing ')' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1121) : error C2143: syntax error : missing ';' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1121) : error C2059: syntax error : '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1121) : error C2059: syntax error : ')'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1122) : error C2143: syntax error : missing ')' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1122) : error C2143: syntax error : missing '{' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1122) : error C2059: syntax error : ','
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1122) : error C2059: syntax error : ')'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1123) : error C2143: syntax error : missing ')' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1123) : error C2143: syntax error : missing '{' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1123) : error C2059: syntax error : ')'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1123) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1124) : error C2143: syntax error : missing ')' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1124) : error C2143: syntax error : missing '{' before '*'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1124) : error C2059: syntax error : ','
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1125) : error C2059: syntax error : ')'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1129) : error C2059: syntax error : '}'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1140) : error C2061: syntax error : identifier 'ac3_encoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1140) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1141) : error C2061: syntax error : identifier 'mp2_encoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1141) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1142) : error C2061: syntax error : identifier 'mp3lame_encoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1142) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1143) : error C2061: syntax error : identifier 'oggvorbis_encoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1143) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1144) : error C2061: syntax error : identifier 'mpeg1video_encoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1144) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1145) : error C2061: syntax error : identifier 'h263_encoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1145) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1146) : error C2061: syntax error : identifier 'h263p_encoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1146) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1147) : error C2061: syntax error : identifier 'rv10_encoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1147) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1148) : error C2061: syntax error : identifier 'mjpeg_encoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1148) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1149) : error C2061: syntax error : identifier 'mpeg4_encoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1149) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1150) : error C2061: syntax error : identifier 'msmpeg4v1_encoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1150) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1151) : error C2061: syntax error : identifier 'msmpeg4v2_encoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1151) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1152) : error C2061: syntax error : identifier 'msmpeg4v3_encoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1152) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1153) : error C2061: syntax error : identifier 'wmv1_encoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1153) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1154) : error C2061: syntax error : identifier 'wmv2_encoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1154) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1155) : error C2061: syntax error : identifier 'huffyuv_encoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1155) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1157) : error C2061: syntax error : identifier 'h263_decoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1157) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1158) : error C2061: syntax error : identifier 'mpeg4_decoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1158) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1159) : error C2061: syntax error : identifier 'msmpeg4v1_decoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1159) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1160) : error C2061: syntax error : identifier 'msmpeg4v2_decoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1160) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1161) : error C2061: syntax error : identifier 'msmpeg4v3_decoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1161) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1162) : error C2061: syntax error : identifier 'wmv1_decoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1162) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1163) : error C2061: syntax error : identifier 'wmv2_decoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1163) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1164) : error C2061: syntax error : identifier 'mpeg_decoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1164) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1165) : error C2061: syntax error : identifier 'h263i_decoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1165) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1166) : error C2061: syntax error : identifier 'rv10_decoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1166) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1167) : error C2061: syntax error : identifier 'svq1_decoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1167) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1168) : error C2061: syntax error : identifier 'dvvideo_decoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1168) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1169) : error C2061: syntax error : identifier 'dvaudio_decoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1169) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1170) : error C2061: syntax error : identifier 'wmav1_decoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1170) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1171) : error C2061: syntax error : identifier 'wmav2_decoder'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libffmpeg\libavcodec\avcodec.h(1171) : fatal error C1003: error count exceeds 100; stopping compilation
+Error executing cl.exe.
+
+
+
+<h3>Results</h3>
+xineplug_decode_ff.so - 204 error(s), 16 warning(s)
+</pre>
+</body>
+</html>
diff --git a/win32/xineplug_decode_lpcm.dsp b/win32/xineplug_decode_lpcm.dsp new file mode 100644 index 000000000..9924466bb --- /dev/null +++ b/win32/xineplug_decode_lpcm.dsp @@ -0,0 +1,107 @@ +# Microsoft Developer Studio Project File - Name="xineplug_decode_lpcm" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=xineplug_decode_lpcm - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_decode_lpcm.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_decode_lpcm.mak" CFG="xineplug_decode_lpcm - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xineplug_decode_lpcm - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "xineplug_decode_lpcm - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xineplug_decode_lpcm - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release/xineplug_decode_lpcm"
+# PROP Intermediate_Dir "Release/xineplug_decode_lpcm"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_LPCM_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_LPCM_EXPORTS" /D "XINE_COMPILE" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 wsock32.lib /nologo /dll /machine:I386 /out:"Release/bin/plugins/xineplug_decode_lpcm.so"
+
+!ELSEIF "$(CFG)" == "xineplug_decode_lpcm - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug/xineplug_decode_lpcm"
+# PROP Intermediate_Dir "Debug/xineplug_decode_lpcm"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_LPCM_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_LPCM_EXPORTS" /D "XINE_COMPILE" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 wsock32.lib /nologo /dll /debug /machine:I386 /out:"Debug/bin/plugins/xineplug_decode_lpcm.so" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "xineplug_decode_lpcm - Win32 Release"
+# Name "xineplug_decode_lpcm - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\src\liblpcm\xine_decoder.c
+# End Source File
+# End Group
+# Begin Group "DLL Defs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=".\xineplug_decode_ ao.def"
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/win32/xineplug_decode_lpcm.plg b/win32/xineplug_decode_lpcm.plg new file mode 100644 index 000000000..e8d2febef --- /dev/null +++ b/win32/xineplug_decode_lpcm.plg @@ -0,0 +1,39 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: xineplug_decode_lpcm - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPC3.tmp" with contents
+[
+/nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_LPCM_EXPORTS" /D "XINE_COMPILE" /Fp"Debug/xineplug_decode_lpcm/xineplug_decode_lpcm.pch" /YX /Fo"Debug/xineplug_decode_lpcm/" /Fd"Debug/xineplug_decode_lpcm/" /FD /GZ /c
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\liblpcm\xine_decoder.c"
+]
+Creating command line "cl.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPC3.tmp"
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPC4.tmp" with contents
+[
+wsock32.lib /nologo /dll /incremental:yes /pdb:"Debug/xineplug_decode_lpcm/xineplug_decode_lpcm.pdb" /debug /machine:I386 /def:".\xineplug_decode_ ao.def" /out:"Debug/bin/plugins/xineplug_decode_lpcm.so" /implib:"Debug/xineplug_decode_lpcm/xineplug_decode_lpcm.lib" /pdbtype:sept
+".\Debug\xineplug_decode_lpcm\xine_decoder.obj"
+".\Debug\libxinesuppt\libxinesuppt.lib"
+".\Debug\libxineutils\libxineutils.lib"
+]
+Creating command line "link.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPC4.tmp"
+<h3>Output Window</h3>
+Compiling...
+xine_decoder.c
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liblpcm\xine_decoder.c(96) : warning C4018: '!=' : signed/unsigned mismatch
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liblpcm\xine_decoder.c(97) : warning C4018: '!=' : signed/unsigned mismatch
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liblpcm\xine_decoder.c(98) : warning C4018: '!=' : signed/unsigned mismatch
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liblpcm\xine_decoder.c(143) : warning C4133: 'function' : incompatible types - from 'short *' to 'char *'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\liblpcm\xine_decoder.c(143) : warning C4133: 'function' : incompatible types - from 'short *' to 'char *'
+Linking...
+
+
+
+<h3>Results</h3>
+xineplug_decode_lpcm.so - 0 error(s), 5 warning(s)
+</pre>
+</body>
+</html>
diff --git a/win32/xineplug_decode_mad.dsp b/win32/xineplug_decode_mad.dsp new file mode 100644 index 000000000..a100002ee --- /dev/null +++ b/win32/xineplug_decode_mad.dsp @@ -0,0 +1,143 @@ +# Microsoft Developer Studio Project File - Name="xineplug_decode_mad" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=xineplug_decode_mad - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_decode_mad.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_decode_mad.mak" CFG="xineplug_decode_mad - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xineplug_decode_mad - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "xineplug_decode_mad - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xineplug_decode_mad - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release/xineplug_decode_mad"
+# PROP Intermediate_Dir "Release/xineplug_decode_mad"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_MAD_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_MAD_EXPORTS" /D "XINE_COMPILE" /D "FPM_DEFAULT" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 /nologo /dll /machine:I386 /out:"Release/bin/plugins/xineplug_decode_mad.so"
+
+!ELSEIF "$(CFG)" == "xineplug_decode_mad - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug/xineplug_decode_mad"
+# PROP Intermediate_Dir "Debug/xineplug_decode_mad"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_MAD_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_MAD_EXPORTS" /D "XINE_COMPILE" /D "FPM_DEFAULT" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 /nologo /dll /debug /machine:I386 /out:"Debug/bin/plugins/xineplug_decode_mad.so" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "xineplug_decode_mad - Win32 Release"
+# Name "xineplug_decode_mad - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\src\libmad\bit.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\libmad\fixed.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\libmad\frame.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\libmad\huffman.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\libmad\layer12.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\libmad\layer3.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\libmad\stream.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\libmad\synth.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\libmad\timer.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\libmad\xine_decoder.c
+# End Source File
+# End Group
+# Begin Group "DLL Defs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=".\xineplug_decode_ ao.def"
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/win32/xineplug_decode_mad.plg b/win32/xineplug_decode_mad.plg new file mode 100644 index 000000000..d7417b507 --- /dev/null +++ b/win32/xineplug_decode_mad.plg @@ -0,0 +1,68 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: xineplug_decode_mad - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPC5.tmp" with contents
+[
+/nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_MAD_EXPORTS" /D "XINE_COMPILE" /D "FPM_DEFAULT" /Fp"Debug/xineplug_decode_mad/xineplug_decode_mad.pch" /YX /Fo"Debug/xineplug_decode_mad/" /Fd"Debug/xineplug_decode_mad/" /FD /GZ /c
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\libmad\layer3.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\libmad\timer.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\libmad\xine_decoder.c"
+]
+Creating command line "cl.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPC5.tmp"
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPC6.tmp" with contents
+[
+/nologo /dll /incremental:yes /pdb:"Debug/xineplug_decode_mad/xineplug_decode_mad.pdb" /debug /machine:I386 /def:".\xineplug_decode_ ao.def" /out:"Debug/bin/plugins/xineplug_decode_mad.so" /implib:"Debug/xineplug_decode_mad/xineplug_decode_mad.lib" /pdbtype:sept
+".\Debug\xineplug_decode_mad\bit.obj"
+".\Debug\xineplug_decode_mad\fixed.obj"
+".\Debug\xineplug_decode_mad\frame.obj"
+".\Debug\xineplug_decode_mad\huffman.obj"
+".\Debug\xineplug_decode_mad\layer12.obj"
+".\Debug\xineplug_decode_mad\layer3.obj"
+".\Debug\xineplug_decode_mad\stream.obj"
+".\Debug\xineplug_decode_mad\synth.obj"
+".\Debug\xineplug_decode_mad\timer.obj"
+".\Debug\xineplug_decode_mad\xine_decoder.obj"
+".\Debug\libxinesuppt\libxinesuppt.lib"
+".\Debug\libxineutils\libxineutils.lib"
+]
+Creating command line "link.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPC6.tmp"
+<h3>Output Window</h3>
+Compiling...
+layer3.c
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmad\layer3.c(524) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmad\layer3.c(533) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmad\layer3.c(534) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmad\layer3.c(535) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmad\layer3.c(536) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned short ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmad\layer3.c(547) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmad\layer3.c(564) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmad\layer3.c(571) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmad\layer3.c(577) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmad\layer3.c(579) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmad\layer3.c(580) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmad\layer3.c(645) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmad\layer3.c(729) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmad\layer3.c(733) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmad\layer3.c(746) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmad\layer3.c(755) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmad\layer3.c(764) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmad\layer3.c(773) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmad\layer3.c(1053) : warning C4018: '<' : signed/unsigned mismatch
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmad\layer3.c(1088) : warning C4018: '<' : signed/unsigned mismatch
+timer.c
+xine_decoder.c
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmad\xine_decoder.c(188) : warning C4018: '!=' : signed/unsigned mismatch
+Linking...
+
+
+
+<h3>Results</h3>
+xineplug_decode_mad.so - 0 error(s), 21 warning(s)
+</pre>
+</body>
+</html>
diff --git a/win32/xineplug_decode_mpeg2.dsp b/win32/xineplug_decode_mpeg2.dsp new file mode 100644 index 000000000..20147477c --- /dev/null +++ b/win32/xineplug_decode_mpeg2.dsp @@ -0,0 +1,159 @@ +# Microsoft Developer Studio Project File - Name="xineplug_decode_mpeg2" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=xineplug_decode_mpeg2 - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_decode_mpeg2.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_decode_mpeg2.mak" CFG="xineplug_decode_mpeg2 - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xineplug_decode_mpeg2 - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "xineplug_decode_mpeg2 - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xineplug_decode_mpeg2 - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release/xineplug_decode_mpeg2"
+# PROP Intermediate_Dir "Release/xineplug_decode_mpeg2"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_MPEG2_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_MPEG2_EXPORTS" /D "XINE_COMPILE" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 /nologo /dll /machine:I386 /out:"Release/bin/plugins/xineplug_decode_mpeg2.so"
+
+!ELSEIF "$(CFG)" == "xineplug_decode_mpeg2 - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug/xineplug_decode_mpeg2"
+# PROP Intermediate_Dir "Debug/xineplug_decode_mpeg2"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_MPEG2_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_MPEG2_EXPORTS" /D "XINE_COMPILE" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 /nologo /dll /debug /machine:I386 /out:"Debug/bin/plugins/xineplug_decode_mpeg2.so" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "xineplug_decode_mpeg2 - Win32 Release"
+# Name "xineplug_decode_mpeg2 - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\src\libmpeg2\cpu_state.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\libmpeg2\decode.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\libmpeg2\header.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\libmpeg2\idct.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\libmpeg2\idct_altivec.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\libmpeg2\idct_mlib.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\libmpeg2\idct_mmx.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\libmpeg2\motion_comp.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\libmpeg2\motion_comp_altivec.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\libmpeg2\motion_comp_mlib.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\libmpeg2\motion_comp_mmx.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\libmpeg2\slice.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\libmpeg2\stats.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\libmpeg2\xine_decoder.c
+# End Source File
+# End Group
+# Begin Group "DLL Defs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\xineplug_decode_vo.def
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/win32/xineplug_decode_mpeg2.plg b/win32/xineplug_decode_mpeg2.plg new file mode 100644 index 000000000..bab7f1540 --- /dev/null +++ b/win32/xineplug_decode_mpeg2.plg @@ -0,0 +1,160 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: xineplug_decode_mpeg2 - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPC7.tmp" with contents
+[
+/nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_MPEG2_EXPORTS" /D "XINE_COMPILE" /Fp"Debug/xineplug_decode_mpeg2/xineplug_decode_mpeg2.pch" /YX /Fo"Debug/xineplug_decode_mpeg2/" /Fd"Debug/xineplug_decode_mpeg2/" /FD /GZ /c
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\libmpeg2\cpu_state.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\libmpeg2\decode.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\libmpeg2\idct.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\libmpeg2\motion_comp.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\libmpeg2\slice.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\libmpeg2\xine_decoder.c"
+]
+Creating command line "cl.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPC7.tmp"
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPC8.tmp" with contents
+[
+/nologo /dll /incremental:yes /pdb:"Debug/xineplug_decode_mpeg2/xineplug_decode_mpeg2.pdb" /debug /machine:I386 /def:".\xineplug_decode_vo.def" /out:"Debug/bin/plugins/xineplug_decode_mpeg2.so" /implib:"Debug/xineplug_decode_mpeg2/xineplug_decode_mpeg2.lib" /pdbtype:sept
+".\Debug\xineplug_decode_mpeg2\cpu_state.obj"
+".\Debug\xineplug_decode_mpeg2\decode.obj"
+".\Debug\xineplug_decode_mpeg2\header.obj"
+".\Debug\xineplug_decode_mpeg2\idct.obj"
+".\Debug\xineplug_decode_mpeg2\idct_altivec.obj"
+".\Debug\xineplug_decode_mpeg2\idct_mlib.obj"
+".\Debug\xineplug_decode_mpeg2\idct_mmx.obj"
+".\Debug\xineplug_decode_mpeg2\motion_comp.obj"
+".\Debug\xineplug_decode_mpeg2\motion_comp_altivec.obj"
+".\Debug\xineplug_decode_mpeg2\motion_comp_mlib.obj"
+".\Debug\xineplug_decode_mpeg2\motion_comp_mmx.obj"
+".\Debug\xineplug_decode_mpeg2\slice.obj"
+".\Debug\xineplug_decode_mpeg2\stats.obj"
+".\Debug\xineplug_decode_mpeg2\xine_decoder.obj"
+".\Debug\libxinesuppt\libxinesuppt.lib"
+".\Debug\libxine\libxine.lib"
+".\Debug\libxineutils\libxineutils.lib"
+]
+Creating command line "link.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPC8.tmp"
+<h3>Output Window</h3>
+Compiling...
+cpu_state.c
+decode.c
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\decode.c(166) : warning C4244: '=' : conversion from 'const double ' to 'int ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\decode.c(169) : warning C4244: '=' : conversion from 'const double ' to 'int ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\decode.c(175) : warning C4244: '=' : conversion from 'const double ' to 'int ', possible loss of data
+idct.c
+motion_comp.c
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\motion_comp.c(145) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\motion_comp.c(145) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\motion_comp.c(145) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\motion_comp.c(145) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\motion_comp.c(145) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\motion_comp.c(145) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\motion_comp.c(145) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\motion_comp.c(145) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\motion_comp.c(145) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\motion_comp.c(145) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\motion_comp.c(145) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\motion_comp.c(145) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\motion_comp.c(145) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\motion_comp.c(145) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\motion_comp.c(145) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\motion_comp.c(145) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\motion_comp.c(145) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\motion_comp.c(145) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\motion_comp.c(145) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\motion_comp.c(145) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\motion_comp.c(145) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\motion_comp.c(145) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\motion_comp.c(145) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\motion_comp.c(145) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\motion_comp.c(145) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\motion_comp.c(145) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\motion_comp.c(145) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\motion_comp.c(145) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\motion_comp.c(145) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\motion_comp.c(145) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\motion_comp.c(145) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\motion_comp.c(145) : warning C4028: formal parameter 4 different from declaration
+slice.c
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1700) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1700) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1700) : warning C4024: 'motion_mp1' : different types for formal and actual parameter 3
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1700) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1700) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1700) : warning C4024: 'motion_mp1' : different types for formal and actual parameter 3
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1702) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1702) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1702) : warning C4024: 'motion_fr_frame' : different types for formal and actual parameter 3
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1702) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1702) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1702) : warning C4024: 'motion_fr_frame' : different types for formal and actual parameter 3
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1706) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1706) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1706) : warning C4024: 'motion_fr_field' : different types for formal and actual parameter 3
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1706) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1706) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1706) : warning C4024: 'motion_fr_field' : different types for formal and actual parameter 3
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1710) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1710) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1710) : warning C4024: 'motion_fr_dmv' : different types for formal and actual parameter 3
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1710) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1710) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1710) : warning C4024: 'motion_fr_dmv' : different types for formal and actual parameter 3
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1719) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1719) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1719) : warning C4024: 'motion_zero' : different types for formal and actual parameter 3
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1719) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1719) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1719) : warning C4024: 'motion_zero' : different types for formal and actual parameter 3
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1725) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1725) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1725) : warning C4024: 'motion_fi_field' : different types for formal and actual parameter 3
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1725) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1725) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1725) : warning C4024: 'motion_fi_field' : different types for formal and actual parameter 3
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1729) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1729) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1729) : warning C4024: 'motion_fi_16x8' : different types for formal and actual parameter 3
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1729) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1729) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1729) : warning C4024: 'motion_fi_16x8' : different types for formal and actual parameter 3
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1733) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1733) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1733) : warning C4024: 'motion_fi_dmv' : different types for formal and actual parameter 3
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1733) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1733) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1733) : warning C4024: 'motion_fi_dmv' : different types for formal and actual parameter 3
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1742) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1742) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1742) : warning C4024: 'motion_zero' : different types for formal and actual parameter 3
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1742) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1742) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1742) : warning C4024: 'motion_zero' : different types for formal and actual parameter 3
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1825) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1825) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1825) : warning C4024: 'motion_zero' : different types for formal and actual parameter 3
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1825) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1825) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1825) : warning C4024: 'motion_zero' : different types for formal and actual parameter 3
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1830) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1830) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1830) : warning C4024: 'motion_reuse' : different types for formal and actual parameter 3
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1830) : warning C4028: formal parameter 3 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1830) : warning C4028: formal parameter 4 different from declaration
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libmpeg2\slice.c(1830) : warning C4024: 'motion_reuse' : different types for formal and actual parameter 3
+xine_decoder.c
+Linking...
+ Creating library Debug/xineplug_decode_mpeg2/xineplug_decode_mpeg2.lib and object Debug/xineplug_decode_mpeg2/xineplug_decode_mpeg2.exp
+
+
+
+<h3>Results</h3>
+xineplug_decode_mpeg2.so - 0 error(s), 101 warning(s)
+</pre>
+</body>
+</html>
diff --git a/win32/xineplug_decode_real.dsp b/win32/xineplug_decode_real.dsp new file mode 100644 index 000000000..caa8f6e9d --- /dev/null +++ b/win32/xineplug_decode_real.dsp @@ -0,0 +1,109 @@ +# Microsoft Developer Studio Project File - Name="xineplug_decode_real" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=xineplug_decode_real - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_decode_real.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_decode_real.mak" CFG="xineplug_decode_real - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xineplug_decode_real - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "xineplug_decode_real - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xineplug_decode_real - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release/xineplug_decode_real"
+# PROP Intermediate_Dir "Release/xineplug_decode_real"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+LIB32=link.exe
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_REAL_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_REAL_EXPORTS" /D "XINE_COMPILE" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 wsock32.lib /nologo /dll /machine:I386 /out:"Release/bin/plugins/xineplug_decode_real.so"
+
+!ELSEIF "$(CFG)" == "xineplug_decode_real - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug/xineplug_decode_real"
+# PROP Intermediate_Dir "Debug/xineplug_decode_real"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+LIB32=link.exe
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_REAL_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_REAL_EXPORTS" /D "XINE_COMPILE" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 wsock32.lib /nologo /dll /debug /machine:I386 /out:"Debug/bin/plugins/xineplug_decode_real.so" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "xineplug_decode_real - Win32 Release"
+# Name "xineplug_decode_real - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\src\libreal\xine_decoder.c
+# End Source File
+# End Group
+# Begin Group "DLL Defs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=".\xineplug_decode_ ao.def"
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/win32/xineplug_decode_real.plg b/win32/xineplug_decode_real.plg new file mode 100644 index 000000000..bf867202c --- /dev/null +++ b/win32/xineplug_decode_real.plg @@ -0,0 +1,28 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: xineplug_decode_real - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP114.tmp" with contents
+[
+wsock32.lib /nologo /dll /incremental:yes /pdb:"Debug/xineplug_decode_real/xineplug_decode_real.pdb" /debug /machine:I386 /def:".\xineplug_decode_ ao.def" /out:"Debug/bin/plugins/xineplug_decode_real.so" /implib:"Debug/xineplug_decode_real/xineplug_decode_real.lib" /pdbtype:sept
+".\Debug\xineplug_decode_real\xine_decoder.obj"
+".\Debug\libxine\libxine.lib"
+".\Debug\libxinesuppt\libxinesuppt.lib"
+".\Debug\libxineutils\libxineutils.lib"
+]
+Creating command line "link.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP114.tmp"
+<h3>Output Window</h3>
+Linking...
+ Creating library Debug/xineplug_decode_real/xineplug_decode_real.lib and object Debug/xineplug_decode_real/xineplug_decode_real.exp
+
+
+
+<h3>Results</h3>
+xineplug_decode_real.so - 0 error(s), 0 warning(s)
+</pre>
+</body>
+</html>
diff --git a/win32/xineplug_decode_spu.def b/win32/xineplug_decode_spu.def new file mode 100644 index 000000000..eebd07033 --- /dev/null +++ b/win32/xineplug_decode_spu.def @@ -0,0 +1,6 @@ +;------------------------------------------------------------
+; XINEPLUG_DECODE_SPU DLL DEFINITIONS FILE
+
+EXPORTS
+
+xine_plugin_info
\ No newline at end of file diff --git a/win32/xineplug_decode_spu.dsp b/win32/xineplug_decode_spu.dsp new file mode 100644 index 000000000..982e0b323 --- /dev/null +++ b/win32/xineplug_decode_spu.dsp @@ -0,0 +1,115 @@ +# Microsoft Developer Studio Project File - Name="xineplug_decode_spu" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=xineplug_decode_spu - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_decode_spu.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_decode_spu.mak" CFG="xineplug_decode_spu - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xineplug_decode_spu - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "xineplug_decode_spu - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xineplug_decode_spu - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release/xineplug_decode_spu"
+# PROP Intermediate_Dir "Release/xineplug_decode_spu"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_SPU_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_SPU_EXPORTS" /D "XINE_COMPILE" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 /nologo /dll /machine:I386 /out:"Release/bin/plugins/xineplug_decode_spu.so"
+
+!ELSEIF "$(CFG)" == "xineplug_decode_spu - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug/xineplug_decode_spu"
+# PROP Intermediate_Dir "Debug/xineplug_decode_spu"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_SPU_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /I "../src/input/libdvdread" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_SPU_EXPORTS" /D "XINE_COMPILE" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 /nologo /dll /debug /machine:I386 /out:"Debug/bin/plugins/xineplug_decode_spu.so" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "xineplug_decode_spu - Win32 Release"
+# Name "xineplug_decode_spu - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\src\libspudec\nav_read.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\libspudec\spu.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\libspudec\xine_decoder.c
+# End Source File
+# End Group
+# Begin Group "DLL Defs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\xineplug_decode_spu.def
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/win32/xineplug_decode_spu.plg b/win32/xineplug_decode_spu.plg new file mode 100644 index 000000000..414e1f020 --- /dev/null +++ b/win32/xineplug_decode_spu.plg @@ -0,0 +1,46 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: xineplug_decode_spu - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPCC.tmp" with contents
+[
+/nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /I "../src/input/libdvdread" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_SPU_EXPORTS" /D "XINE_COMPILE" /Fp"Debug/xineplug_decode_spu/xineplug_decode_spu.pch" /YX /Fo"Debug/xineplug_decode_spu/" /Fd"Debug/xineplug_decode_spu/" /FD /GZ /c
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\libspudec\nav_read.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\libspudec\spu.c"
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\libspudec\xine_decoder.c"
+]
+Creating command line "cl.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPCC.tmp"
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPCD.tmp" with contents
+[
+/nologo /dll /incremental:yes /pdb:"Debug/xineplug_decode_spu/xineplug_decode_spu.pdb" /debug /machine:I386 /def:".\xineplug_decode_spu.def" /out:"Debug/bin/plugins/xineplug_decode_spu.so" /implib:"Debug/xineplug_decode_spu/xineplug_decode_spu.lib" /pdbtype:sept
+".\Debug\xineplug_decode_spu\nav_read.obj"
+".\Debug\xineplug_decode_spu\spu.obj"
+".\Debug\xineplug_decode_spu\xine_decoder.obj"
+".\Debug\libxinesuppt\libxinesuppt.lib"
+".\Debug\libxine\libxine.lib"
+".\Debug\libxineutils\libxineutils.lib"
+]
+Creating command line "link.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPCD.tmp"
+<h3>Output Window</h3>
+Compiling...
+nav_read.c
+spu.c
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libspudec\spu.c(323) : warning C4018: '!=' : signed/unsigned mismatch
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libspudec\spu.c(580) : warning C4018: '>=' : signed/unsigned mismatch
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libspudec\spu.c(581) : warning C4018: '>=' : signed/unsigned mismatch
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libspudec\spu.c(886) : warning C4244: '=' : conversion from 'unsigned long ' to 'unsigned char ', possible loss of data
+xine_decoder.c
+Linking...
+ Creating library Debug/xineplug_decode_spu/xineplug_decode_spu.lib and object Debug/xineplug_decode_spu/xineplug_decode_spu.exp
+
+
+
+<h3>Results</h3>
+xineplug_decode_spu.so - 0 error(s), 4 warning(s)
+</pre>
+</body>
+</html>
diff --git a/win32/xineplug_decode_spucc.dsp b/win32/xineplug_decode_spucc.dsp new file mode 100644 index 000000000..1270458d0 --- /dev/null +++ b/win32/xineplug_decode_spucc.dsp @@ -0,0 +1,117 @@ +# Microsoft Developer Studio Project File - Name="xineplug_decode_spucc" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=xineplug_decode_spucc - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_decode_spucc.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_decode_spucc.mak" CFG="xineplug_decode_spucc - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xineplug_decode_spucc - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "xineplug_decode_spucc - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xineplug_decode_spucc - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release/xineplug_decode_spucc"
+# PROP Intermediate_Dir "Release/xineplug_decode_spucc"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+LIB32=link.exe
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_SPUCC_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_SPUCC_EXPORTS" /D "XINE_COMPILE" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 wsock32.lib /nologo /dll /machine:I386 /out:"Release/bin/plugins/xineplug_decode_spucc.so"
+
+!ELSEIF "$(CFG)" == "xineplug_decode_spucc - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug/xineplug_decode_spucc"
+# PROP Intermediate_Dir "Debug/xineplug_decode_spucc"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+LIB32=link.exe
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_SPUCC_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_SPUCC_EXPORTS" /D "XINE_COMPILE" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 wsock32.lib /nologo /dll /debug /machine:I386 /out:"Debug/bin/plugins/xineplug_decode_spucc.so" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "xineplug_decode_spucc - Win32 Release"
+# Name "xineplug_decode_spucc - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\src\libspucc\cc_decoder.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\libspucc\cc_decoder.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\libspucc\xine_decoder.c
+# End Source File
+# End Group
+# Begin Group "DLL Defs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=".\xineplug_decode_ ao.def"
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/win32/xineplug_decode_spucc.plg b/win32/xineplug_decode_spucc.plg new file mode 100644 index 000000000..1328eb2a2 --- /dev/null +++ b/win32/xineplug_decode_spucc.plg @@ -0,0 +1,37 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: xineplug_decode_spucc - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP130.tmp" with contents
+[
+/nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_SPUCC_EXPORTS" /D "XINE_COMPILE" /Fp"Debug/xineplug_decode_spucc/xineplug_decode_spucc.pch" /YX /Fo"Debug/xineplug_decode_spucc/" /Fd"Debug/xineplug_decode_spucc/" /FD /GZ /c
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\libspucc\cc_decoder.c"
+]
+Creating command line "cl.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP130.tmp"
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP131.tmp" with contents
+[
+wsock32.lib /nologo /dll /incremental:yes /pdb:"Debug/xineplug_decode_spucc/xineplug_decode_spucc.pdb" /debug /machine:I386 /def:".\xineplug_decode_ ao.def" /out:"Debug/bin/plugins/xineplug_decode_spucc.so" /implib:"Debug/xineplug_decode_spucc/xineplug_decode_spucc.lib" /pdbtype:sept
+".\Debug\xineplug_decode_spucc\xine_decoder.obj"
+".\Debug\xineplug_decode_spucc\cc_decoder.obj"
+".\Debug\libxine\libxine.lib"
+".\Debug\libxinesuppt\libxinesuppt.lib"
+".\Debug\libxineutils\libxineutils.lib"
+]
+Creating command line "link.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP131.tmp"
+<h3>Output Window</h3>
+Compiling...
+cc_decoder.c
+C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\libspucc\cc_decoder.c(66) : error C2059: syntax error : 'constant'
+Error executing cl.exe.
+
+
+
+<h3>Results</h3>
+xineplug_decode_spucc.so - 1 error(s), 0 warning(s)
+</pre>
+</body>
+</html>
diff --git a/win32/xineplug_decode_sputext.dsp b/win32/xineplug_decode_sputext.dsp new file mode 100644 index 000000000..08ee6e46c --- /dev/null +++ b/win32/xineplug_decode_sputext.dsp @@ -0,0 +1,107 @@ +# Microsoft Developer Studio Project File - Name="xineplug_decode_sputext" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=xineplug_decode_sputext - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_decode_sputext.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_decode_sputext.mak" CFG="xineplug_decode_sputext - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xineplug_decode_sputext - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "xineplug_decode_sputext - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xineplug_decode_sputext - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release/xineplug_decode_sputext"
+# PROP Intermediate_Dir "Release/xineplug_decode_sputext"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_SPUTEXT_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_SPUTEXT_EXPORTS" /D "XINE_COMPILE" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 /nologo /dll /machine:I386 /out:"Release/bin/plugins/xineplug_decode_sputext.so"
+
+!ELSEIF "$(CFG)" == "xineplug_decode_sputext - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug/xineplug_decode_sputext"
+# PROP Intermediate_Dir "Debug/xineplug_decode_sputext"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_SPUTEXT_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_SPUTEXT_EXPORTS" /D "XINE_COMPILE" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 /nologo /dll /debug /machine:I386 /out:"Debug/bin/plugins/xineplug_decode_sputext.so" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "xineplug_decode_sputext - Win32 Release"
+# Name "xineplug_decode_sputext - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\src\libsputext\xine_decoder.c
+# End Source File
+# End Group
+# Begin Group "DLL Defs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\xineplug_decode_spu.def
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/win32/xineplug_decode_sputext.plg b/win32/xineplug_decode_sputext.plg new file mode 100644 index 000000000..7f95cf01f --- /dev/null +++ b/win32/xineplug_decode_sputext.plg @@ -0,0 +1,41 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: xineplug_decode_sputext - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPD1.tmp" with contents
+[
+/nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_SPUTEXT_EXPORTS" /D "XINE_COMPILE" /Fp"Debug/xineplug_decode_sputext/xineplug_decode_sputext.pch" /YX /Fo"Debug/xineplug_decode_sputext/" /Fd"Debug/xineplug_decode_sputext/" /FD /GZ /c
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\libsputext\xine_decoder.c"
+]
+Creating command line "cl.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPD1.tmp"
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPD2.tmp" with contents
+[
+/nologo /dll /incremental:yes /pdb:"Debug/xineplug_decode_sputext/xineplug_decode_sputext.pdb" /debug /machine:I386 /def:".\xineplug_decode_spu.def" /out:"Debug/bin/plugins/xineplug_decode_sputext.so" /implib:"Debug/xineplug_decode_sputext/xineplug_decode_sputext.lib" /pdbtype:sept
+".\Debug\xineplug_decode_sputext\xine_decoder.obj"
+".\Debug\libxine\libxine.lib"
+".\Debug\libxinesuppt\libxinesuppt.lib"
+".\Debug\libxineutils\libxineutils.lib"
+]
+Creating command line "link.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPD2.tmp"
+<h3>Output Window</h3>
+Compiling...
+xine_decoder.c
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libsputext\xine_decoder.c(202) : warning C4018: '!=' : signed/unsigned mismatch
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libsputext\xine_decoder.c(228) : warning C4244: '+=' : conversion from '__int64 ' to 'long ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libsputext\xine_decoder.c(229) : warning C4244: '+=' : conversion from '__int64 ' to 'long ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libsputext\xine_decoder.c(282) : warning C4244: '=' : conversion from '__int64 ' to 'long ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\libsputext\xine_decoder.c(283) : warning C4244: '=' : conversion from '__int64 ' to 'long ', possible loss of data
+Linking...
+ Creating library Debug/xineplug_decode_sputext/xineplug_decode_sputext.lib and object Debug/xineplug_decode_sputext/xineplug_decode_sputext.exp
+
+
+
+<h3>Results</h3>
+xineplug_decode_sputext.so - 0 error(s), 5 warning(s)
+</pre>
+</body>
+</html>
diff --git a/win32/xineplug_decode_vfill.dsp b/win32/xineplug_decode_vfill.dsp new file mode 100644 index 000000000..db9b8c2c9 --- /dev/null +++ b/win32/xineplug_decode_vfill.dsp @@ -0,0 +1,107 @@ +# Microsoft Developer Studio Project File - Name="xineplug_decode_vfill" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=xineplug_decode_vfill - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_decode_vfill.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_decode_vfill.mak" CFG="xineplug_decode_vfill - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xineplug_decode_vfill - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "xineplug_decode_vfill - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xineplug_decode_vfill - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release/xineplug_decode_vfill"
+# PROP Intermediate_Dir "Release/xineplug_decode_vfill"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_VFILL_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_VFILL_EXPORTS" /D "XINE_COMPILE" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 /nologo /dll /machine:I386 /out:"Release/bin/plugins/xineplug_decode_vfill.so"
+
+!ELSEIF "$(CFG)" == "xineplug_decode_vfill - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug/xineplug_decode_vfill"
+# PROP Intermediate_Dir "Debug/xineplug_decode_vfill"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_VFILL_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_VFILL_EXPORTS" /D "XINE_COMPILE" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 /nologo /dll /debug /machine:I386 /out:"Debug/bin/plugins/xineplug_decode_vfill.so" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "xineplug_decode_vfill - Win32 Release"
+# Name "xineplug_decode_vfill - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\src\libvfill\xine_decoder.c
+# End Source File
+# End Group
+# Begin Group "DLL Defs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\xineplug_decode_vo.def
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/win32/xineplug_decode_vfill.plg b/win32/xineplug_decode_vfill.plg new file mode 100644 index 000000000..7eab3589b --- /dev/null +++ b/win32/xineplug_decode_vfill.plg @@ -0,0 +1,37 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: xineplug_decode_vfill - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Build : warning : failed to (or don't know how to) build 'C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\libvfill\xine_decoder.c'
+
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPD6.tmp" with contents
+[
+/nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DECODE_VFILL_EXPORTS" /D "XINE_COMPILE" /Fp"Debug/xineplug_decode_vfill/xineplug_decode_vfill.pch" /YX /Fo"Debug/xineplug_decode_vfill/" /Fd"Debug/xineplug_decode_vfill/" /FD /GZ /c
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\libvfill\xine_decoder.c"
+]
+Creating command line "cl.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPD6.tmp"
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPD7.tmp" with contents
+[
+/nologo /dll /incremental:yes /pdb:"Debug/xineplug_decode_vfill/xineplug_decode_vfill.pdb" /debug /machine:I386 /def:".\xineplug_decode_vo.def" /out:"Debug/bin/plugins/xineplug_decode_vfill.so" /implib:"Debug/xineplug_decode_vfill/xineplug_decode_vfill.lib" /pdbtype:sept
+".\Debug\xineplug_decode_vfill\xine_decoder.obj"
+".\Debug\libxinesuppt\libxinesuppt.lib"
+".\Debug\libxineutils\libxineutils.lib"
+]
+Creating command line "link.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPD7.tmp"
+<h3>Output Window</h3>
+Compiling...
+xine_decoder.c
+fatal error C1083: Cannot open source file: 'C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\libvfill\xine_decoder.c': No such file or directory
+Error executing cl.exe.
+
+
+
+<h3>Results</h3>
+xineplug_decode_vfill.so - 1 error(s), 1 warning(s)
+</pre>
+</body>
+</html>
diff --git a/win32/xineplug_decode_vo.def b/win32/xineplug_decode_vo.def new file mode 100644 index 000000000..c1c1335f1 --- /dev/null +++ b/win32/xineplug_decode_vo.def @@ -0,0 +1,6 @@ +;------------------------------------------------------------
+; XINEPLUG_DECODE_VO DLL DEFINITIONS FILE
+
+EXPORTS
+
+xine_plugin_info
\ No newline at end of file diff --git a/win32/xineplug_dmx.def b/win32/xineplug_dmx.def new file mode 100644 index 000000000..387652f88 --- /dev/null +++ b/win32/xineplug_dmx.def @@ -0,0 +1,6 @@ +;------------------------------------------------------------
+; XINEPLUG_DMX DLL DEFINITIONS FILE
+
+EXPORTS
+
+xine_plugin_info
\ No newline at end of file diff --git a/win32/xineplug_dmx.dsp b/win32/xineplug_dmx.dsp new file mode 100644 index 000000000..62b693c27 --- /dev/null +++ b/win32/xineplug_dmx.dsp @@ -0,0 +1,111 @@ +# Microsoft Developer Studio Project File - Name="xineplug_dmx" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=xineplug_dmx - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_dmx.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_dmx.mak" CFG="xineplug_dmx - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xineplug_dmx - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "xineplug_dmx - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xineplug_dmx - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release/xineplug_dmx"
+# PROP Intermediate_Dir "Release/xineplug_dmx"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_EXPORTS" /D "XINE_COMPILE" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 /nologo /dll /machine:I386 /out:"Release/bin/plugins/xineplug_dmx..so"
+
+!ELSEIF "$(CFG)" == "xineplug_dmx - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug/xineplug_dmx"
+# PROP Intermediate_Dir "Debug/xineplug_dmx"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_EXPORTS" /D "XINE_COMPILE" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 /nologo /dll /debug /machine:I386 /out:"Debug/bin/plugins/xineplug_dmx.so" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "xineplug_dmx - Win32 Release"
+# Name "xineplug_dmx - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\src\demuxers\demux_cdda.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\demuxers\group_audio.c
+# End Source File
+# End Group
+# Begin Group "Dll Defs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\xineplug_dmx.def
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/win32/xineplug_dmx.plg b/win32/xineplug_dmx.plg new file mode 100644 index 000000000..bab49772a --- /dev/null +++ b/win32/xineplug_dmx.plg @@ -0,0 +1,41 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: xineplug_dmx - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\DOCUME~1\Tim\LOCALS~1\Temp\RSP2C9.tmp" with contents
+[
+/nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_EXPORTS" /D "XINE_COMPILE" /Fp"Debug/xineplug_dmx/xineplug_dmx.pch" /YX /Fo"Debug/xineplug_dmx/" /Fd"Debug/xineplug_dmx/" /FD /GZ /c
+"C:\PCChamp\PROJECTS\Xine\xine-lib-1-beta9\src\demuxers\demux_cdda.c"
+]
+Creating command line "cl.exe @C:\DOCUME~1\Tim\LOCALS~1\Temp\RSP2C9.tmp"
+Creating temporary file "C:\DOCUME~1\Tim\LOCALS~1\Temp\RSP2CA.tmp" with contents
+[
+/nologo /dll /incremental:yes /pdb:"Debug/xineplug_dmx/xineplug_dmx.pdb" /debug /machine:I386 /def:".\xineplug_dmx.def" /out:"Debug/bin/plugins/xineplug_dmx.so" /implib:"Debug/xineplug_dmx/xineplug_dmx.lib" /pdbtype:sept
+".\Debug\xineplug_dmx\demux_cdda.obj"
+".\Debug\xineplug_dmx\group_audio.obj"
+".\Debug\libxine\libxine.lib"
+".\Debug\libxinesuppt\libxinesuppt.lib"
+".\Debug\libxineutils\libxineutils.lib"
+]
+Creating command line "link.exe @C:\DOCUME~1\Tim\LOCALS~1\Temp\RSP2CA.tmp"
+<h3>Output Window</h3>
+Compiling...
+demux_cdda.c
+c:\pcchamp\projects\xine\xine-lib-1-beta9\src\demuxers\demux_cdda.c(97) : warning C4244: '=' : conversion from '__int64 ' to 'int ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta9\src\demuxers\demux_cdda.c(294) : error C2146: syntax error : missing ';' before identifier 'plugin_info_t'
+c:\pcchamp\projects\xine\xine-lib-1-beta9\src\demuxers\demux_cdda.c(294) : error C2061: syntax error : identifier 'xine_plugin_info'
+c:\pcchamp\projects\xine\xine-lib-1-beta9\src\demuxers\demux_cdda.c(294) : error C2059: syntax error : ';'
+c:\pcchamp\projects\xine\xine-lib-1-beta9\src\demuxers\demux_cdda.c(294) : error C2059: syntax error : '['
+Error executing cl.exe.
+
+
+
+<h3>Results</h3>
+xineplug_dmx.so - 4 error(s), 1 warning(s)
+</pre>
+</body>
+</html>
diff --git a/win32/xineplug_dmx_asf.def b/win32/xineplug_dmx_asf.def new file mode 100644 index 000000000..a7b935066 --- /dev/null +++ b/win32/xineplug_dmx_asf.def @@ -0,0 +1,6 @@ +;------------------------------------------------------------
+; XINEPLUG_DMX_ASF DLL DEFINITIONS FILE
+
+EXPORTS
+
+xine_plugin_info
\ No newline at end of file diff --git a/win32/xineplug_dmx_asf.dsp b/win32/xineplug_dmx_asf.dsp new file mode 100644 index 000000000..420028982 --- /dev/null +++ b/win32/xineplug_dmx_asf.dsp @@ -0,0 +1,107 @@ +# Microsoft Developer Studio Project File - Name="xineplug_dmx_asf" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=xineplug_dmx_asf - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_dmx_asf.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_dmx_asf.mak" CFG="xineplug_dmx_asf - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xineplug_dmx_asf - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "xineplug_dmx_asf - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xineplug_dmx_asf - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release/xineplug_dmx_asf"
+# PROP Intermediate_Dir "Release/xineplug_dmx_asf"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_ASF_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_ASF_EXPORTS" /D "XINE_COMPILE" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 /nologo /dll /machine:I386 /out:"Release/bin/plugins/xineplug_dmx_asf.so"
+
+!ELSEIF "$(CFG)" == "xineplug_dmx_asf - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug/xineplug_dmx_asf"
+# PROP Intermediate_Dir "Debug/xineplug_dmx_asf"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_ASF_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_ASF_EXPORTS" /D "XINE_COMPILE" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 /nologo /dll /debug /machine:I386 /out:"Debug/bin/plugins/xineplug_dmx_asf.so" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "xineplug_dmx_asf - Win32 Release"
+# Name "xineplug_dmx_asf - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\src\demuxers\demux_asf.c
+# End Source File
+# End Group
+# Begin Group "Dll Defs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\xineplug_dmx_asf.def
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/win32/xineplug_dmx_asf.plg b/win32/xineplug_dmx_asf.plg new file mode 100644 index 000000000..1cdde1f32 --- /dev/null +++ b/win32/xineplug_dmx_asf.plg @@ -0,0 +1,75 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: xineplug_dmx_asf - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPD8.tmp" with contents
+[
+/nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_ASF_EXPORTS" /D "XINE_COMPILE" /Fp"Debug/xineplug_dmx_asf/xineplug_dmx_asf.pch" /YX /Fo"Debug/xineplug_dmx_asf/" /Fd"Debug/xineplug_dmx_asf/" /FD /GZ /c
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\demuxers\demux_asf.c"
+]
+Creating command line "cl.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPD8.tmp"
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPD9.tmp" with contents
+[
+/nologo /dll /incremental:yes /pdb:"Debug/xineplug_dmx_asf/xineplug_dmx_asf.pdb" /debug /machine:I386 /def:".\xineplug_dmx_asf.def" /out:"Debug/bin/plugins/xineplug_dmx_asf.so" /implib:"Debug/xineplug_dmx_asf/xineplug_dmx_asf.lib" /pdbtype:sept
+".\Debug\xineplug_dmx_asf\demux_asf.obj"
+".\Debug\libxinesuppt\libxinesuppt.lib"
+".\Debug\libxineutils\libxineutils.lib"
+".\Debug\libxine\libxine.lib"
+]
+Creating command line "link.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPD9.tmp"
+<h3>Output Window</h3>
+Compiling...
+demux_asf.c
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\demuxers\asfheader.h(106) : error C2371: 'GUID' : redefinition; different basic types
+ c:\program files\microsoft visual studio\vc98\include\winnt.h(669) : see declaration of 'GUID'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\demuxers\demux_asf.c(246) : error C2039: 'v1' : is not a member of '_GUID'
+ c:\program files\microsoft visual studio\vc98\include\winnt.h(664) : see declaration of '_GUID'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\demuxers\demux_asf.c(247) : error C2039: 'v2' : is not a member of '_GUID'
+ c:\program files\microsoft visual studio\vc98\include\winnt.h(664) : see declaration of '_GUID'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\demuxers\demux_asf.c(248) : error C2039: 'v3' : is not a member of '_GUID'
+ c:\program files\microsoft visual studio\vc98\include\winnt.h(664) : see declaration of '_GUID'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\demuxers\demux_asf.c(250) : error C2039: 'v4' : is not a member of '_GUID'
+ c:\program files\microsoft visual studio\vc98\include\winnt.h(664) : see declaration of '_GUID'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\demuxers\demux_asf.c(265) : error C2039: 'v1' : is not a member of '_GUID'
+ c:\program files\microsoft visual studio\vc98\include\winnt.h(664) : see declaration of '_GUID'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\demuxers\demux_asf.c(265) : error C2039: 'v2' : is not a member of '_GUID'
+ c:\program files\microsoft visual studio\vc98\include\winnt.h(664) : see declaration of '_GUID'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\demuxers\demux_asf.c(265) : error C2039: 'v3' : is not a member of '_GUID'
+ c:\program files\microsoft visual studio\vc98\include\winnt.h(664) : see declaration of '_GUID'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\demuxers\demux_asf.c(266) : error C2039: 'v4' : is not a member of '_GUID'
+ c:\program files\microsoft visual studio\vc98\include\winnt.h(664) : see declaration of '_GUID'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\demuxers\demux_asf.c(266) : error C2039: 'v4' : is not a member of '_GUID'
+ c:\program files\microsoft visual studio\vc98\include\winnt.h(664) : see declaration of '_GUID'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\demuxers\demux_asf.c(266) : error C2039: 'v4' : is not a member of '_GUID'
+ c:\program files\microsoft visual studio\vc98\include\winnt.h(664) : see declaration of '_GUID'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\demuxers\demux_asf.c(266) : error C2039: 'v4' : is not a member of '_GUID'
+ c:\program files\microsoft visual studio\vc98\include\winnt.h(664) : see declaration of '_GUID'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\demuxers\demux_asf.c(266) : error C2039: 'v4' : is not a member of '_GUID'
+ c:\program files\microsoft visual studio\vc98\include\winnt.h(664) : see declaration of '_GUID'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\demuxers\demux_asf.c(266) : error C2039: 'v4' : is not a member of '_GUID'
+ c:\program files\microsoft visual studio\vc98\include\winnt.h(664) : see declaration of '_GUID'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\demuxers\demux_asf.c(266) : error C2039: 'v4' : is not a member of '_GUID'
+ c:\program files\microsoft visual studio\vc98\include\winnt.h(664) : see declaration of '_GUID'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\demuxers\demux_asf.c(266) : error C2039: 'v4' : is not a member of '_GUID'
+ c:\program files\microsoft visual studio\vc98\include\winnt.h(664) : see declaration of '_GUID'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\demuxers\demux_asf.c(370) : warning C4244: '=' : conversion from 'unsigned __int64 ' to 'unsigned long ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\demuxers\demux_asf.c(527) : warning C4244: 'function' : conversion from 'unsigned __int64 ' to 'long ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\demuxers\demux_asf.c(576) : warning C4244: 'function' : conversion from 'unsigned __int64 ' to 'long ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\demuxers\demux_asf.c(760) : warning C4244: '=' : conversion from '__int64 ' to 'long ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\demuxers\demux_asf.c(962) : warning C4244: '=' : conversion from '__int64 ' to 'int ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\demuxers\demux_asf.c(992) : warning C4244: '=' : conversion from 'unsigned __int64 ' to 'unsigned long ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\demuxers\demux_asf.c(1102) : warning C4018: '>' : signed/unsigned mismatch
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\demuxers\demux_asf.c(1233) : warning C4018: '>' : signed/unsigned mismatch
+Error executing cl.exe.
+
+
+
+<h3>Results</h3>
+xineplug_dmx_asf.so - 16 error(s), 8 warning(s)
+</pre>
+</body>
+</html>
diff --git a/win32/xineplug_dmx_avi.def b/win32/xineplug_dmx_avi.def new file mode 100644 index 000000000..d9f1eeb78 --- /dev/null +++ b/win32/xineplug_dmx_avi.def @@ -0,0 +1,6 @@ +;------------------------------------------------------------
+; XINEPLUG_DMX_AVI DLL DEFINITIONS FILE
+
+EXPORTS
+
+xine_plugin_info
\ No newline at end of file diff --git a/win32/xineplug_dmx_avi.dsp b/win32/xineplug_dmx_avi.dsp new file mode 100644 index 000000000..6a7c605b9 --- /dev/null +++ b/win32/xineplug_dmx_avi.dsp @@ -0,0 +1,107 @@ +# Microsoft Developer Studio Project File - Name="xineplug_dmx_avi" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=xineplug_dmx_avi - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_dmx_avi.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_dmx_avi.mak" CFG="xineplug_dmx_avi - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xineplug_dmx_avi - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "xineplug_dmx_avi - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xineplug_dmx_avi - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release/xineplug_dmx_avi"
+# PROP Intermediate_Dir "Release/xineplug_dmx_avi"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_AVI_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_AVI_EXPORTS" /D "XINE_COMPILE" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 /nologo /dll /machine:I386 /out:"Release/bin/plugins/xineplug_dmx_avi.so"
+
+!ELSEIF "$(CFG)" == "xineplug_dmx_avi - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug/xineplug_dmx_avi"
+# PROP Intermediate_Dir "Debug/xineplug_dmx_avi"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_AVI_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_AVI_EXPORTS" /D "XINE_COMPILE" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 /nologo /dll /debug /machine:I386 /out:"Debug/bin/plugins/xineplug_dmx_avi.so" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "xineplug_dmx_avi - Win32 Release"
+# Name "xineplug_dmx_avi - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\src\demuxers\demux_avi.c
+# End Source File
+# End Group
+# Begin Group "Dll Defs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\xineplug_dmx_avi.def
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/win32/xineplug_dmx_avi.plg b/win32/xineplug_dmx_avi.plg new file mode 100644 index 000000000..9f683f593 --- /dev/null +++ b/win32/xineplug_dmx_avi.plg @@ -0,0 +1,16 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: xineplug_dmx_avi - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+
+
+
+<h3>Results</h3>
+xineplug_dmx_avi.so - 0 error(s), 0 warning(s)
+</pre>
+</body>
+</html>
diff --git a/win32/xineplug_dmx_cda.dsp b/win32/xineplug_dmx_cda.dsp new file mode 100644 index 000000000..7c65626f5 --- /dev/null +++ b/win32/xineplug_dmx_cda.dsp @@ -0,0 +1,107 @@ +# Microsoft Developer Studio Project File - Name="xineplug_dmx_cda" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=xineplug_dmx_cda - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_dmx_cda.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_dmx_cda.mak" CFG="xineplug_dmx_cda - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xineplug_dmx_cda - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "xineplug_dmx_cda - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xineplug_dmx_cda - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release/xineplug_dmx_cda"
+# PROP Intermediate_Dir "Release/xineplug_dmx_cda"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_CDA_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_CDA_EXPORTS" /D "XINE_COMPILE" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 /nologo /dll /machine:I386 /out:"Release/bin/plugins/xineplug_dmx_cda..so"
+
+!ELSEIF "$(CFG)" == "xineplug_dmx_cda - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug/xineplug_dmx_cda"
+# PROP Intermediate_Dir "Debug/xineplug_dmx_cda"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_CDA_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_CDA_EXPORTS" /D "XINE_COMPILE" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 /nologo /dll /debug /machine:I386 /out:"Debug/bin/plugins/xineplug_dmx_cda.so" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "xineplug_dmx_cda - Win32 Release"
+# Name "xineplug_dmx_cda - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\src\demuxers\demux_cdda.c
+# End Source File
+# End Group
+# Begin Group "Dll Defs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\xineplug_dmx.def
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/win32/xineplug_dmx_cda.plg b/win32/xineplug_dmx_cda.plg new file mode 100644 index 000000000..d02b6674a --- /dev/null +++ b/win32/xineplug_dmx_cda.plg @@ -0,0 +1,16 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: xineplug_dmx_cda - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+
+
+
+<h3>Results</h3>
+xineplug_dmx_cda.so - 0 error(s), 0 warning(s)
+</pre>
+</body>
+</html>
diff --git a/win32/xineplug_dmx_mpeg.dsp b/win32/xineplug_dmx_mpeg.dsp new file mode 100644 index 000000000..0f03ffbcf --- /dev/null +++ b/win32/xineplug_dmx_mpeg.dsp @@ -0,0 +1,107 @@ +# Microsoft Developer Studio Project File - Name="xineplug_dmx_mpeg" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=xineplug_dmx_mpeg - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_dmx_mpeg.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_dmx_mpeg.mak" CFG="xineplug_dmx_mpeg - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xineplug_dmx_mpeg - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "xineplug_dmx_mpeg - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xineplug_dmx_mpeg - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release/xineplug_dmx_mpeg"
+# PROP Intermediate_Dir "Release/xineplug_dmx_mpeg"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_MPEG_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_MPEG_EXPORTS" /D "XINE_COMPILE" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 /nologo /dll /machine:I386 /out:"Release/bin/plugins/xineplug_dmx_mpeg.so"
+
+!ELSEIF "$(CFG)" == "xineplug_dmx_mpeg - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug/xineplug_dmx_mpeg"
+# PROP Intermediate_Dir "Debug/xineplug_dmx_mpeg"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_MPEG_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_MPEG_EXPORTS" /D "XINE_COMPILE" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 /nologo /dll /debug /machine:I386 /out:"Debug/bin/plugins/xineplug_dmx_mpeg.so" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "xineplug_dmx_mpeg - Win32 Release"
+# Name "xineplug_dmx_mpeg - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\src\demuxers\demux_mpeg.c
+# End Source File
+# End Group
+# Begin Group "Dll Defs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\xineplug_dmx.def
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/win32/xineplug_dmx_mpeg.plg b/win32/xineplug_dmx_mpeg.plg new file mode 100644 index 000000000..128716d5a --- /dev/null +++ b/win32/xineplug_dmx_mpeg.plg @@ -0,0 +1,37 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: xineplug_dmx_mpeg - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPDA.tmp" with contents
+[
+/nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_MPEG_EXPORTS" /D "XINE_COMPILE" /Fp"Debug/xineplug_dmx_mpeg/xineplug_dmx_mpeg.pch" /YX /Fo"Debug/xineplug_dmx_mpeg/" /Fd"Debug/xineplug_dmx_mpeg/" /FD /GZ /c
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\demuxers\demux_mpeg.c"
+]
+Creating command line "cl.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPDA.tmp"
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPDB.tmp" with contents
+[
+/nologo /dll /incremental:yes /pdb:"Debug/xineplug_dmx_mpeg/xineplug_dmx_mpeg.pdb" /debug /machine:I386 /def:".\xineplug_dmx.def" /out:"Debug/bin/plugins/xineplug_dmx_mpeg.so" /implib:"Debug/xineplug_dmx_mpeg/xineplug_dmx_mpeg.lib" /pdbtype:sept
+".\Debug\xineplug_dmx_mpeg\demux_mpeg.obj"
+".\Debug\libxinesuppt\libxinesuppt.lib"
+".\Debug\libxine\libxine.lib"
+".\Debug\libxineutils\libxineutils.lib"
+]
+Creating command line "link.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPDB.tmp"
+<h3>Output Window</h3>
+Compiling...
+demux_mpeg.c
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\demuxers\demux_mpeg.c(139) : warning C4244: '=' : conversion from '__int64 ' to 'long ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\demuxers\demux_mpeg.c(198) : warning C4018: '!=' : signed/unsigned mismatch
+Linking...
+
+
+
+<h3>Results</h3>
+xineplug_dmx_mpeg.so - 0 error(s), 2 warning(s)
+</pre>
+</body>
+</html>
diff --git a/win32/xineplug_dmx_mpeg_audio.dsp b/win32/xineplug_dmx_mpeg_audio.dsp new file mode 100644 index 000000000..981dbcde8 --- /dev/null +++ b/win32/xineplug_dmx_mpeg_audio.dsp @@ -0,0 +1,107 @@ +# Microsoft Developer Studio Project File - Name="xineplug_dmx_mpeg_audio" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=xineplug_dmx_mpeg_audio - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_dmx_mpeg_audio.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_dmx_mpeg_audio.mak" CFG="xineplug_dmx_mpeg_audio - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xineplug_dmx_mpeg_audio - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "xineplug_dmx_mpeg_audio - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xineplug_dmx_mpeg_audio - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release/xineplug_dmx_mpeg_audio"
+# PROP Intermediate_Dir "Release/xineplug_dmx_mpeg_audio"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_MPEG_AUDIO_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_MPEG_AUDIO_EXPORTS" /D "XINE_COMPILE" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 /nologo /dll /machine:I386 /out:"Release/bin/plugins/xineplug_dmx_mpeg_audio.so"
+
+!ELSEIF "$(CFG)" == "xineplug_dmx_mpeg_audio - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug/xineplug_dmx_mpeg_audio"
+# PROP Intermediate_Dir "Debug/xineplug_dmx_mpeg_audio"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_MPEG_AUDIO_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_MPEG_AUDIO_EXPORTS" /D "XINE_COMPILE" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 /nologo /dll /debug /machine:I386 /out:"Debug/bin/plugins/xineplug_dmx_mpeg_audio.so" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "xineplug_dmx_mpeg_audio - Win32 Release"
+# Name "xineplug_dmx_mpeg_audio - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\src\demuxers\demux_mpgaudio.c
+# End Source File
+# End Group
+# Begin Group "Dll Defs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\xineplug_dmx.def
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/win32/xineplug_dmx_mpeg_audio.plg b/win32/xineplug_dmx_mpeg_audio.plg new file mode 100644 index 000000000..c39481bb7 --- /dev/null +++ b/win32/xineplug_dmx_mpeg_audio.plg @@ -0,0 +1,37 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: xineplug_dmx_mpeg_audio - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPE8.tmp" with contents
+[
+/nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_MPEG_AUDIO_EXPORTS" /D "XINE_COMPILE" /Fp"Debug/xineplug_dmx_mpeg_audio/xineplug_dmx_mpeg_audio.pch" /YX /Fo"Debug/xineplug_dmx_mpeg_audio/" /Fd"Debug/xineplug_dmx_mpeg_audio/" /FD /GZ /c
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\demuxers\demux_mpgaudio.c"
+]
+Creating command line "cl.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPE8.tmp"
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPE9.tmp" with contents
+[
+/nologo /dll /incremental:yes /pdb:"Debug/xineplug_dmx_mpeg_audio/xineplug_dmx_mpeg_audio.pdb" /debug /machine:I386 /def:".\xineplug_dmx.def" /out:"Debug/bin/plugins/xineplug_dmx_mpeg_audio.so" /implib:"Debug/xineplug_dmx_mpeg_audio/xineplug_dmx_mpeg_audio.lib" /pdbtype:sept
+".\Debug\xineplug_dmx_mpeg_audio\demux_mpgaudio.obj"
+".\Debug\libxinesuppt\libxinesuppt.lib"
+".\Debug\libxine\libxine.lib"
+".\Debug\libxineutils\libxineutils.lib"
+]
+Creating command line "link.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPE9.tmp"
+<h3>Output Window</h3>
+Compiling...
+demux_mpgaudio.c
+C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\demuxers\demux_mpgaudio.c(374) : warning C4244: 'function' : conversion from '__int64 ' to 'int ', possible loss of data
+C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\demuxers\demux_mpgaudio.c(432) : warning C4244: '=' : conversion from 'unsigned __int64 ' to 'int ', possible loss of data
+Linking...
+
+
+
+<h3>Results</h3>
+xineplug_dmx_mpeg_audio.so - 0 error(s), 2 warning(s)
+</pre>
+</body>
+</html>
diff --git a/win32/xineplug_dmx_mpeg_block.dsp b/win32/xineplug_dmx_mpeg_block.dsp new file mode 100644 index 000000000..e1be2b6d3 --- /dev/null +++ b/win32/xineplug_dmx_mpeg_block.dsp @@ -0,0 +1,107 @@ +# Microsoft Developer Studio Project File - Name="xineplug_dmx_mpeg_block" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=xineplug_dmx_mpeg_block - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_dmx_mpeg_block.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_dmx_mpeg_block.mak" CFG="xineplug_dmx_mpeg_block - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xineplug_dmx_mpeg_block - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "xineplug_dmx_mpeg_block - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xineplug_dmx_mpeg_block - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release/xineplug_dmx_mpeg_block"
+# PROP Intermediate_Dir "Release/xineplug_dmx_mpeg_block"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_MPEG_BLOCK_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_MPEG_BLOCK_EXPORTS" /D "XINE_COMPILE" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 /nologo /dll /machine:I386 /out:"Release/bin/plugins/xineplug_dmx_mpeg_block.so"
+
+!ELSEIF "$(CFG)" == "xineplug_dmx_mpeg_block - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug/xineplug_dmx_mpeg_block"
+# PROP Intermediate_Dir "Debug/xineplug_dmx_mpeg_block"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_MPEG_BLOCK_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_MPEG_BLOCK_EXPORTS" /D "XINE_COMPILE" /D "USE_ILL_ADVISED_ESTIMATE_RATE_INITIALLY" /D "ESTIMATE_RATE_FIXED" /FR /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 /nologo /dll /debug /machine:I386 /out:"Debug/bin/plugins/xineplug_dmx_mpeg_block.so" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "xineplug_dmx_mpeg_block - Win32 Release"
+# Name "xineplug_dmx_mpeg_block - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\src\demuxers\demux_mpeg_block.c
+# End Source File
+# End Group
+# Begin Group "Dll Defs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\xineplug_dmx.def
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/win32/xineplug_dmx_mpeg_block.plg b/win32/xineplug_dmx_mpeg_block.plg new file mode 100644 index 000000000..ba0a4b8c5 --- /dev/null +++ b/win32/xineplug_dmx_mpeg_block.plg @@ -0,0 +1,41 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: xineplug_dmx_mpeg_block - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPED.tmp" with contents
+[
+/nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_MPEG_BLOCK_EXPORTS" /D "XINE_COMPILE" /D "USE_ILL_ADVISED_ESTIMATE_RATE_INITIALLY" /D "ESTIMATE_RATE_FIXED" /FR"Debug/xineplug_dmx_mpeg_block/" /Fp"Debug/xineplug_dmx_mpeg_block/xineplug_dmx_mpeg_block.pch" /YX /Fo"Debug/xineplug_dmx_mpeg_block/" /Fd"Debug/xineplug_dmx_mpeg_block/" /FD /GZ /c
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\demuxers\demux_mpeg_block.c"
+]
+Creating command line "cl.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPED.tmp"
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPEE.tmp" with contents
+[
+/nologo /dll /incremental:yes /pdb:"Debug/xineplug_dmx_mpeg_block/xineplug_dmx_mpeg_block.pdb" /debug /machine:I386 /def:".\xineplug_dmx.def" /out:"Debug/bin/plugins/xineplug_dmx_mpeg_block.so" /implib:"Debug/xineplug_dmx_mpeg_block/xineplug_dmx_mpeg_block.lib" /pdbtype:sept
+".\Debug\xineplug_dmx_mpeg_block\demux_mpeg_block.obj"
+".\Debug\libxinesuppt\libxinesuppt.lib"
+".\Debug\libxine\libxine.lib"
+".\Debug\libxineutils\libxineutils.lib"
+]
+Creating command line "link.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPEE.tmp"
+<h3>Output Window</h3>
+Compiling...
+demux_mpeg_block.c
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\demuxers\demux_mpeg_block.c(389) : warning C4244: '=' : conversion from '__int64 ' to 'int ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\demuxers\demux_mpeg_block.c(836) : warning C4244: '=' : conversion from '__int64 ' to 'int ', possible loss of data
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\demuxers\demux_mpeg_block.c(972) : warning C4244: '=' : conversion from '__int64 ' to 'long ', possible loss of data
+Linking...
+Creating command line "bscmake.exe /nologo /o"Debug/xineplug_dmx_mpeg_block/xineplug_dmx_mpeg_block.bsc" ".\Debug\xineplug_dmx_mpeg_block\demux_mpeg_block.sbr""
+Creating browse info file...
+<h3>Output Window</h3>
+
+
+
+<h3>Results</h3>
+xineplug_dmx_mpeg_block.so - 0 error(s), 3 warning(s)
+</pre>
+</body>
+</html>
diff --git a/win32/xineplug_dmx_mpeg_elem.dsp b/win32/xineplug_dmx_mpeg_elem.dsp new file mode 100644 index 000000000..9256388f4 --- /dev/null +++ b/win32/xineplug_dmx_mpeg_elem.dsp @@ -0,0 +1,107 @@ +# Microsoft Developer Studio Project File - Name="xineplug_dmx_mpeg_elem" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=xineplug_dmx_mpeg_elem - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_dmx_mpeg_elem.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_dmx_mpeg_elem.mak" CFG="xineplug_dmx_mpeg_elem - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xineplug_dmx_mpeg_elem - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "xineplug_dmx_mpeg_elem - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xineplug_dmx_mpeg_elem - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release/xineplug_dmx_mpeg_elem"
+# PROP Intermediate_Dir "Release/xineplug_dmx_mpeg_elem"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_MPEG_ELEM_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_MPEG_ELEM_EXPORTS" /D "XINE_COMPILE" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 /nologo /dll /machine:I386 /out:"Release/bin/plugins/xineplug_dmx_mpeg_elem.so"
+
+!ELSEIF "$(CFG)" == "xineplug_dmx_mpeg_elem - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug/xineplug_dmx_mpeg_elem"
+# PROP Intermediate_Dir "Debug/xineplug_dmx_mpeg_elem"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_MPEG_ELEM_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_MPEG_ELEM_EXPORTS" /D "XINE_COMPILE" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 /nologo /dll /debug /machine:I386 /out:"Debug/bin/plugins/xineplug_dmx_mpeg_elem.so" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "xineplug_dmx_mpeg_elem - Win32 Release"
+# Name "xineplug_dmx_mpeg_elem - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\src\demuxers\demux_elem.c
+# End Source File
+# End Group
+# Begin Group "Dll Defs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\xineplug_dmx.def
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/win32/xineplug_dmx_mpeg_elem.plg b/win32/xineplug_dmx_mpeg_elem.plg new file mode 100644 index 000000000..8b4b7f183 --- /dev/null +++ b/win32/xineplug_dmx_mpeg_elem.plg @@ -0,0 +1,16 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: xineplug_dmx_mpeg_elem - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+
+
+
+<h3>Results</h3>
+xineplug_dmx_mpeg_elem.so - 0 error(s), 0 warning(s)
+</pre>
+</body>
+</html>
diff --git a/win32/xineplug_dmx_mpeg_pes.dsp b/win32/xineplug_dmx_mpeg_pes.dsp new file mode 100644 index 000000000..25a2e938c --- /dev/null +++ b/win32/xineplug_dmx_mpeg_pes.dsp @@ -0,0 +1,107 @@ +# Microsoft Developer Studio Project File - Name="xineplug_dmx_mpeg_pes" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=xineplug_dmx_mpeg_pes - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_dmx_mpeg_pes.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_dmx_mpeg_pes.mak" CFG="xineplug_dmx_mpeg_pes - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xineplug_dmx_mpeg_pes - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "xineplug_dmx_mpeg_pes - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xineplug_dmx_mpeg_pes - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release/xineplug_dmx_mpeg_pes"
+# PROP Intermediate_Dir "Release/xineplug_dmx_mpeg_pes"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_MPEG_PES_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_MPEG_PES_EXPORTS" /D "XINE_COMPILE" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 /nologo /dll /machine:I386 /out:"Release/bin/plugins/xineplug_dmx_mpeg_pes.so"
+
+!ELSEIF "$(CFG)" == "xineplug_dmx_mpeg_pes - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug/xineplug_dmx_mpeg_pes"
+# PROP Intermediate_Dir "Debug/xineplug_dmx_mpeg_pes"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_MPEG_PES_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_MPEG_PES_EXPORTS" /D "XINE_COMPILE" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 /nologo /dll /debug /machine:I386 /out:"Debug/bin/plugins/xineplug_dmx_mpeg_pes.so" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "xineplug_dmx_mpeg_pes - Win32 Release"
+# Name "xineplug_dmx_mpeg_pes - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\src\demuxers\demux_pes.c
+# End Source File
+# End Group
+# Begin Group "Dll Defs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\xineplug_dmx.def
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/win32/xineplug_dmx_mpeg_pes.plg b/win32/xineplug_dmx_mpeg_pes.plg new file mode 100644 index 000000000..cc841ea79 --- /dev/null +++ b/win32/xineplug_dmx_mpeg_pes.plg @@ -0,0 +1,54 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: xineplug_dmx_mpeg_pes - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPFC.tmp" with contents
+[
+/nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_MPEG_PES_EXPORTS" /D "XINE_COMPILE" /Fp"Debug/xineplug_dmx_mpeg_pes/xineplug_dmx_mpeg_pes.pch" /YX /Fo"Debug/xineplug_dmx_mpeg_pes/" /Fd"Debug/xineplug_dmx_mpeg_pes/" /FD /GZ /c
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\demuxers\demux_pes.c"
+]
+Creating command line "cl.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPFC.tmp"
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPFD.tmp" with contents
+[
+/nologo /dll /incremental:yes /pdb:"Debug/xineplug_dmx_mpeg_pes/xineplug_dmx_mpeg_pes.pdb" /debug /machine:I386 /def:".\xineplug_dmx.def" /out:"Debug/bin/plugins/xineplug_dmx_mpeg_pes.so" /implib:"Debug/xineplug_dmx_mpeg_pes/xineplug_dmx_mpeg_pes.lib" /pdbtype:sept
+".\Debug\xineplug_dmx_mpeg_pes\demux_pes.obj"
+".\Debug\libxinesuppt\libxinesuppt.lib"
+".\Debug\libxine\libxine.lib"
+".\Debug\libxineutils\libxineutils.lib"
+]
+Creating command line "link.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSPFD.tmp"
+<h3>Output Window</h3>
+Compiling...
+demux_pes.c
+C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\demuxers\demux_pes.c(89) : warning C4018: '!=' : signed/unsigned mismatch
+C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\demuxers\demux_pes.c(120) : warning C4133: 'function' : incompatible types - from 'struct xine_s *' to 'struct xine_stream_s *'
+C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\demuxers\demux_pes.c(347) : warning C4133: 'function' : incompatible types - from 'struct xine_s *' to 'struct xine_stream_s *'
+C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\demuxers\demux_pes.c(383) : warning C4133: 'function' : incompatible types - from 'struct xine_s *' to 'struct xine_stream_s *'
+C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\demuxers\demux_pes.c(385) : warning C4133: 'function' : incompatible types - from 'struct xine_s *' to 'struct xine_stream_s *'
+C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\demuxers\demux_pes.c(413) : warning C4133: 'function' : incompatible types - from 'struct xine_s *' to 'struct xine_stream_s *'
+C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\demuxers\demux_pes.c(466) : warning C4133: 'function' : incompatible types - from 'struct xine_s *' to 'struct xine_stream_s *'
+C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\demuxers\demux_pes.c(623) : error C2039: 'open' : is not a member of 'demux_plugin_s'
+ c:\pcchamp\projects\xine\xine-lib-1-beta10\src\demuxers\demux.h(94) : see declaration of 'demux_plugin_s'
+C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\demuxers\demux_pes.c(624) : error C2039: 'start' : is not a member of 'demux_plugin_s'
+ c:\pcchamp\projects\xine\xine-lib-1-beta10\src\demuxers\demux.h(94) : see declaration of 'demux_plugin_s'
+C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\demuxers\demux_pes.c(626) : error C2039: 'stop' : is not a member of 'demux_plugin_s'
+ c:\pcchamp\projects\xine\xine-lib-1-beta10\src\demuxers\demux.h(94) : see declaration of 'demux_plugin_s'
+C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\demuxers\demux_pes.c(627) : error C2039: 'close' : is not a member of 'demux_plugin_s'
+ c:\pcchamp\projects\xine\xine-lib-1-beta10\src\demuxers\demux.h(94) : see declaration of 'demux_plugin_s'
+C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\demuxers\demux_pes.c(629) : error C2039: 'get_identifier' : is not a member of 'demux_plugin_s'
+ c:\pcchamp\projects\xine\xine-lib-1-beta10\src\demuxers\demux.h(94) : see declaration of 'demux_plugin_s'
+C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\demuxers\demux_pes.c(633) : error C2039: 'get_mimetypes' : is not a member of 'demux_plugin_s'
+ c:\pcchamp\projects\xine\xine-lib-1-beta10\src\demuxers\demux.h(94) : see declaration of 'demux_plugin_s'
+Error executing cl.exe.
+
+
+
+<h3>Results</h3>
+xineplug_dmx_mpeg_pes.so - 6 error(s), 7 warning(s)
+</pre>
+</body>
+</html>
diff --git a/win32/xineplug_dmx_mpeg_ts.dsp b/win32/xineplug_dmx_mpeg_ts.dsp new file mode 100644 index 000000000..7a24f316c --- /dev/null +++ b/win32/xineplug_dmx_mpeg_ts.dsp @@ -0,0 +1,107 @@ +# Microsoft Developer Studio Project File - Name="xineplug_dmx_mpeg_ts" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=xineplug_dmx_mpeg_ts - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_dmx_mpeg_ts.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_dmx_mpeg_ts.mak" CFG="xineplug_dmx_mpeg_ts - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xineplug_dmx_mpeg_ts - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "xineplug_dmx_mpeg_ts - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xineplug_dmx_mpeg_ts - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release/xineplug_dmx_mpeg_ts"
+# PROP Intermediate_Dir "Release/xineplug_dmx_mpeg_ts"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_MPEG_TS_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_MPEG_TS_EXPORTS" /D "XINE_COMPILE" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 /nologo /dll /machine:I386 /out:"Release/bin/plugins/xineplug_dmx_mpeg_ts.so"
+
+!ELSEIF "$(CFG)" == "xineplug_dmx_mpeg_ts - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug/xineplug_dmx_mpeg_ts"
+# PROP Intermediate_Dir "Debug/xineplug_dmx_mpeg_ts"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_MPEG_TS_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_DMX_MPEG_TS_EXPORTS" /D "XINE_COMPILE" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 /nologo /dll /debug /machine:I386 /out:"Debug/bin/plugins/xineplug_dmx_mpeg_ts.so" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "xineplug_dmx_mpeg_ts - Win32 Release"
+# Name "xineplug_dmx_mpeg_ts - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\src\demuxers\demux_ts.c
+# End Source File
+# End Group
+# Begin Group "Dll Defs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\xineplug_dmx.def
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/win32/xineplug_dmx_mpeg_ts.plg b/win32/xineplug_dmx_mpeg_ts.plg new file mode 100644 index 000000000..2548120d1 --- /dev/null +++ b/win32/xineplug_dmx_mpeg_ts.plg @@ -0,0 +1,16 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: xineplug_dmx_mpeg_ts - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+
+
+
+<h3>Results</h3>
+xineplug_dmx_mpeg_ts.so - 0 error(s), 0 warning(s)
+</pre>
+</body>
+</html>
diff --git a/win32/xineplug_inp.def b/win32/xineplug_inp.def new file mode 100644 index 000000000..7df666a7d --- /dev/null +++ b/win32/xineplug_inp.def @@ -0,0 +1,6 @@ +;------------------------------------------------------------
+; XINEPLUG_INP DLL DEFINITIONS FILE
+
+EXPORTS
+
+xine_plugin_info
\ No newline at end of file diff --git a/win32/xineplug_inp_dvd.dsp b/win32/xineplug_inp_dvd.dsp new file mode 100644 index 000000000..8d2207c8b --- /dev/null +++ b/win32/xineplug_inp_dvd.dsp @@ -0,0 +1,112 @@ +# Microsoft Developer Studio Project File - Name="xineplug_inp_dvd" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=xineplug_inp_dvd - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_inp_dvd.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_inp_dvd.mak" CFG="xineplug_inp_dvd - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xineplug_inp_dvd - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "xineplug_inp_dvd - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xineplug_inp_dvd - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+LIB32=link.exe
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_INP_DVD_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_INP_DVD_EXPORTS" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+
+!ELSEIF "$(CFG)" == "xineplug_inp_dvd - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+LIB32=link.exe
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_INP_DVD_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /I "../src/input/libdvdnav" /I "../src/input/libdvdread" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_INP_DVD_EXPORTS" /D "XINE_COMPILE" /D "HAVE_CONFIG_H" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 /nologo /dll /debug /machine:I386 /out:"Debug/bin/plugins/xineplug_inp_dvd.so" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "xineplug_inp_dvd - Win32 Release"
+# Name "xineplug_inp_dvd - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\src\input\input_dvd.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "DLL Defs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\xineplug_inp.def
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/win32/xineplug_inp_dvd.plg b/win32/xineplug_inp_dvd.plg new file mode 100644 index 000000000..f3de005da --- /dev/null +++ b/win32/xineplug_inp_dvd.plg @@ -0,0 +1,31 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: xineplug_inp_dvd - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP140.tmp" with contents
+[
+/nologo /dll /incremental:yes /pdb:"Debug/xineplug_inp_dvd.pdb" /debug /machine:I386 /def:".\xineplug_inp.def" /out:"Debug/bin/plugins/xineplug_inp_dvd.so" /implib:"Debug/xineplug_inp_dvd.lib" /pdbtype:sept
+".\Debug\input_dvd.obj"
+".\Debug\libxine.lib"
+".\Debug\libdvdread\libdvdread.lib"
+".\Debug\libxine\libxine.lib"
+".\Debug\libxinesuppt\libxinesuppt.lib"
+".\Debug\libxineutils\libxineutils.lib"
+".\Debug\libdvdnav\libdvdnav.lib"
+]
+Creating command line "link.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP140.tmp"
+<h3>Output Window</h3>
+Linking...
+ Creating library Debug/xineplug_inp_dvd.lib and object Debug/xineplug_inp_dvd.exp
+
+
+
+<h3>Results</h3>
+xineplug_inp_dvd.so - 0 error(s), 0 warning(s)
+</pre>
+</body>
+</html>
diff --git a/win32/xineplug_inp_file.dsp b/win32/xineplug_inp_file.dsp new file mode 100644 index 000000000..02167d860 --- /dev/null +++ b/win32/xineplug_inp_file.dsp @@ -0,0 +1,107 @@ +# Microsoft Developer Studio Project File - Name="xineplug_inp_file" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=xineplug_inp_file - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_inp_file.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_inp_file.mak" CFG="xineplug_inp_file - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xineplug_inp_file - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "xineplug_inp_file - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xineplug_inp_file - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release/xineplug_inp_file"
+# PROP Intermediate_Dir "Release/xineplug_inp_file"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_INP_FILE_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_INP_FILE_EXPORTS" /D "XINE_COMPILE" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 /nologo /dll /machine:I386 /out:"Release/bin/plugins/xineplug_inp_file.so"
+
+!ELSEIF "$(CFG)" == "xineplug_inp_file - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug/xineplug_inp_file"
+# PROP Intermediate_Dir "Debug/xineplug_inp_file"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_INP_FILE_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_INP_FILE_EXPORTS" /D "XINE_COMPILE" /FR /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 /nologo /dll /debug /machine:I386 /out:"Debug/bin/plugins/xineplug_inp_file.so" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "xineplug_inp_file - Win32 Release"
+# Name "xineplug_inp_file - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\src\input\input_file.c
+# End Source File
+# End Group
+# Begin Group "DLL Defs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\xineplug_inp.def
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/win32/xineplug_inp_file.plg b/win32/xineplug_inp_file.plg new file mode 100644 index 000000000..134b027fd --- /dev/null +++ b/win32/xineplug_inp_file.plg @@ -0,0 +1,46 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: xineplug_inp_file - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP104.tmp" with contents
+[
+/nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "include" /I "../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_INP_FILE_EXPORTS" /D "XINE_COMPILE" /FR"Debug/xineplug_inp_file/" /Fp"Debug/xineplug_inp_file/xineplug_inp_file.pch" /YX /Fo"Debug/xineplug_inp_file/" /Fd"Debug/xineplug_inp_file/" /FD /GZ /c
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\src\input\input_file.c"
+]
+Creating command line "cl.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP104.tmp"
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP105.tmp" with contents
+[
+/nologo /dll /incremental:yes /pdb:"Debug/xineplug_inp_file/xineplug_inp_file.pdb" /debug /machine:I386 /def:".\xineplug_inp.def" /out:"Debug/bin/plugins/xineplug_inp_file.so" /implib:"Debug/xineplug_inp_file/xineplug_inp_file.lib" /pdbtype:sept
+".\Debug\xineplug_inp_file\input_file.obj"
+".\Debug\libxinesuppt\libxinesuppt.lib"
+".\Debug\libxine\libxine.lib"
+".\Debug\libxineutils\libxineutils.lib"
+]
+Creating command line "link.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP105.tmp"
+<h3>Output Window</h3>
+Compiling...
+input_file.c
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\input_file.c(72) : warning C4101: 'buf' : unreferenced local variable
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\input_file.c(97) : warning C4013: 'read' undefined; assuming extern returning int
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\input_file.c(135) : warning C4013: 'lseek' undefined; assuming extern returning int
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\input_file.c(192) : warning C4013: 'close' undefined; assuming extern returning int
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\input_file.c(245) : warning C4013: 'open' undefined; assuming extern returning int
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\input_file.c(665) : warning C4113: 'int (__cdecl *)()' differs in parameter lists from 'int (__cdecl *)(const void *,const void *)'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\input_file.c(668) : warning C4113: 'int (__cdecl *)()' differs in parameter lists from 'int (__cdecl *)(const void *,const void *)'
+c:\pcchamp\projects\xine\xine-lib-1-beta10\src\input\input_file.c(671) : warning C4113: 'int (__cdecl *)()' differs in parameter lists from 'int (__cdecl *)(const void *,const void *)'
+Linking...
+Creating command line "bscmake.exe /nologo /o"Debug/xineplug_inp_file/xineplug_inp_file.bsc" ".\Debug\xineplug_inp_file\input_file.sbr""
+Creating browse info file...
+<h3>Output Window</h3>
+
+
+
+<h3>Results</h3>
+xineplug_inp_file.so - 0 error(s), 8 warning(s)
+</pre>
+</body>
+</html>
diff --git a/win32/xineplug_vo_out.def b/win32/xineplug_vo_out.def new file mode 100644 index 000000000..ccdfb17ab --- /dev/null +++ b/win32/xineplug_vo_out.def @@ -0,0 +1,7 @@ +;------------------------------------------------------------
+; XINEPLUG_VO_OUT DLL DEFINITIONS FILE
+
+EXPORTS
+
+xine_plugin_info
+get_video_out_plugin_info
\ No newline at end of file diff --git a/win32/xineplug_vo_out_directx.dsp b/win32/xineplug_vo_out_directx.dsp new file mode 100644 index 000000000..973c1c0e7 --- /dev/null +++ b/win32/xineplug_vo_out_directx.dsp @@ -0,0 +1,115 @@ +# Microsoft Developer Studio Project File - Name="xineplug_vo_out_directx" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=xineplug_vo_out_directx - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_vo_out_directx.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xineplug_vo_out_directx.mak" CFG="xineplug_vo_out_directx - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xineplug_vo_out_directx - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "xineplug_vo_out_directx - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xineplug_vo_out_directx - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release/xineplug_vo_out_directx"
+# PROP Intermediate_Dir "Release/xineplug_vo_out_directx"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_VO_OUT_DIRECTX_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_VO_OUT_DIRECTX_EXPORTS" /D "XINE_COMPILE" /FR /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib ddraw.lib dxguid.lib /nologo /dll /machine:I386 /out:"Release/bin/plugins/xineplug_vo_out_directx.so"
+
+!ELSEIF "$(CFG)" == "xineplug_vo_out_directx - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug/xineplug_vo_out_directx"
+# PROP Intermediate_Dir "Debug/xineplug_vo_out_directx"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_VO_OUT_DIRECTX_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "../.." /I "include" /I "../include" /I "../../include" /I "../src" /I "../src/xine-engine" /I "../src/xine-utils" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XINEPLUG_VO_OUT_DIRECTX_EXPORTS" /D "XINE_COMPILE" /FR /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib ddraw.lib dxguid.lib /nologo /dll /debug /machine:I386 /out:"Debug/bin/plugins/xineplug_vo_out_directx.so" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "xineplug_vo_out_directx - Win32 Release"
+# Name "xineplug_vo_out_directx - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\src\video_out\alphablend.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\video_out\video_out_directx.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\video_out\yuv2rgb.c
+# End Source File
+# End Group
+# Begin Group "DLL Defs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\xineplug_vo_out.def
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/win32/xineplug_vo_out_directx.plg b/win32/xineplug_vo_out_directx.plg new file mode 100644 index 000000000..f624d4879 --- /dev/null +++ b/win32/xineplug_vo_out_directx.plg @@ -0,0 +1,16 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: xineplug_vo_out_directx - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+
+
+
+<h3>Results</h3>
+xineplug_vo_out_directx.so - 0 error(s), 0 warning(s)
+</pre>
+</body>
+</html>
diff --git a/win32/xineui.dsp b/win32/xineui.dsp new file mode 100644 index 000000000..6099cbbd6 --- /dev/null +++ b/win32/xineui.dsp @@ -0,0 +1,219 @@ +# Microsoft Developer Studio Project File - Name="xineui" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Application" 0x0101
+
+CFG=xineui - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xineui.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xineui.mak" CFG="xineui - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xineui - Win32 Release" (based on "Win32 (x86) Application")
+!MESSAGE "xineui - Win32 Debug" (based on "Win32 (x86) Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xineui - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release/xineui"
+# PROP Intermediate_Dir "Release/xineui"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "source" /I "include" /I "../src/video_out" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FR /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib comctl32.lib ddraw.lib /nologo /subsystem:windows /machine:I386 /out:"Release/bin/xineui.exe"
+
+!ELSEIF "$(CFG)" == "xineui - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug/xineui"
+# PROP Intermediate_Dir "Debug/xineui"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "source" /I "include" /I "../include" /I ".." /I "../src/video_out" /I "../src/xine-utils" /I "../src/xine-engine" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "XINE_COMPILE" /FR /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib comctl32.lib /nologo /subsystem:windows /debug /machine:I386 /out:"Debug/bin/xineui.exe" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "xineui - Win32 Release"
+# Name "xineui - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\source\main.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\source\wnd.ctrl.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\source\wnd.panel.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\source\wnd.playlist.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\source\wnd.video.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\source\xineui.cpp
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\source\bitmap1.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\source\bmp00001.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\source\bmp00002.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\source\bmp00003.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\source\bmp00004.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\source\bmp00005.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\source\bmp00006.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\source\bmp00007.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\source\bmp00008.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\source\bmp00009.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\source\bmp00010.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\source\bmp00011.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\source\bmp_arro.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\source\bmp_conf.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\source\bmp_ffor.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\source\bmp_full.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\source\bmp_next.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\source\bmp_play.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\source\bmp_prev.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\source\bmp_volu.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\source\icon1.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\source\maskbmp.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\source\resource.rc
+# End Source File
+# Begin Source File
+
+SOURCE=.\source\xine_logo.bmp
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/win32/xineui.plg b/win32/xineui.plg new file mode 100644 index 000000000..be61b6379 --- /dev/null +++ b/win32/xineui.plg @@ -0,0 +1,44 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: xineui - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP106.tmp" with contents
+[
+/nologo /MDd /W3 /Gm /GX /ZI /Od /I "source" /I "include" /I "../include" /I ".." /I "../src/video_out" /I "../src/xine-utils" /I "../src/xine-engine" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "XINE_COMPILE" /FR"Debug/xineui/" /Fp"Debug/xineui/xineui.pch" /YX /Fo"Debug/xineui/" /Fd"Debug/xineui/" /FD /GZ /c
+"C:\PCChamp\Projects\Xine\xine-lib-1-beta10\win32\source\main.cpp"
+]
+Creating command line "cl.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP106.tmp"
+Creating temporary file "C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP107.tmp" with contents
+[
+kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib comctl32.lib /nologo /subsystem:windows /incremental:yes /pdb:"Debug/xineui/xineui.pdb" /debug /machine:I386 /out:"Debug/bin/xineui.exe" /pdbtype:sept
+".\Debug\xineui\main.obj"
+".\Debug\xineui\wnd.ctrl.obj"
+".\Debug\xineui\wnd.panel.obj"
+".\Debug\xineui\wnd.playlist.obj"
+".\Debug\xineui\wnd.video.obj"
+".\Debug\xineui\xineui.obj"
+".\Debug\xineui\resource.res"
+".\Debug\libxine\libxine.lib"
+".\Debug\libxinesuppt\libxinesuppt.lib"
+".\Debug\libxineutils\libxineutils.lib"
+]
+Creating command line "link.exe @C:\DOCUME~1\TCHAMP~2.AME\LOCALS~1\Temp\RSP107.tmp"
+<h3>Output Window</h3>
+Compiling...
+main.cpp
+Linking...
+Creating command line "bscmake.exe /nologo /o"Debug/xineui/xineui.bsc" ".\Debug\xineui\main.sbr" ".\Debug\xineui\wnd.ctrl.sbr" ".\Debug\xineui\wnd.panel.sbr" ".\Debug\xineui\wnd.playlist.sbr" ".\Debug\xineui\wnd.video.sbr" ".\Debug\xineui\xineui.sbr""
+Creating browse info file...
+<h3>Output Window</h3>
+
+
+
+<h3>Results</h3>
+xineui.exe - 0 error(s), 0 warning(s)
+</pre>
+</body>
+</html>
diff --git a/win32/xineutils.def b/win32/xineutils.def new file mode 100644 index 000000000..a5aa4a21d --- /dev/null +++ b/win32/xineutils.def @@ -0,0 +1,43 @@ +;------------------------------------------------------------
+; LIBXINEUTILS DLL DEFINITIONS FILE
+
+EXPORTS
+
+xine_fast_memcpy
+xine_probe_fast_memcpy
+
+xine_mm_accel
+
+;xine_profiler_init
+;xine_profiler_allocate_slot
+;xine_profiler_start_count
+;xine_profiler_stop_count
+;xine_profiler_print_results
+
+xine_xmalloc
+
+xine_xmalloc_aligned
+xine_get_homedir
+
+xine_print_trace
+
+xine_chomp
+xine_usec_sleep
+
+xine_profiler_stop_count
+xine_profiler_start_count
+xine_profiler_allocate_slot
+
+xine_list_new
+xine_list_first_content
+xine_list_next_content
+xine_list_append_content
+xine_list_append_priority_content
+xine_list_delete_current
+xine_list_free
+
+init_yuv_conversion
+
+xml_parser_free_tree
+xml_parser_build_tree
+xml_parser_init
\ No newline at end of file |