Skip to content
Browse files

Added OpenEXR 2.1.0 (OSX)

  • Loading branch information...
1 parent 98b301c commit 711298aea6c300608e8a16ad6d20b11195023cef @betajippity committed Mar 4, 2014
Showing with 9,472 additions and 0 deletions.
  1. +1 −0 README.md
  2. BIN bin/osx/openexr/exrenvmap
  3. BIN bin/osx/openexr/exrheader
  4. BIN bin/osx/openexr/exrmakepreview
  5. BIN bin/osx/openexr/exrmaketiled
  6. BIN bin/osx/openexr/exrmultipart
  7. BIN bin/osx/openexr/exrmultiview
  8. BIN bin/osx/openexr/exrstdattr
  9. +60 −0 include/OpenEXR/Iex.h
  10. +264 −0 include/OpenEXR/IexBaseExc.h
  11. +208 −0 include/OpenEXR/IexErrnoExc.h
  12. +51 −0 include/OpenEXR/IexExport.h
  13. +229 −0 include/OpenEXR/IexForward.h
  14. +170 −0 include/OpenEXR/IexMacros.h
  15. +57 −0 include/OpenEXR/IexMathExc.h
  16. +146 −0 include/OpenEXR/IexMathFloatExc.h
  17. +91 −0 include/OpenEXR/IexMathFpu.h
  18. +62 −0 include/OpenEXR/IexMathIeeeExc.h
  19. +112 −0 include/OpenEXR/IexNamespace.h
  20. +97 −0 include/OpenEXR/IexThrowErrnoExc.h
  21. +18 −0 include/OpenEXR/IlmBaseConfig.h
  22. +143 −0 include/OpenEXR/IlmThread.h
  23. +46 −0 include/OpenEXR/IlmThreadExport.h
  24. +52 −0 include/OpenEXR/IlmThreadForward.h
  25. +160 −0 include/OpenEXR/IlmThreadMutex.h
  26. +114 −0 include/OpenEXR/IlmThreadNamespace.h
  27. +160 −0 include/OpenEXR/IlmThreadPool.h
  28. +112 −0 include/OpenEXR/IlmThreadSemaphore.h
  29. +849 −0 include/OpenEXR/ImathBox.h
  30. +1,016 −0 include/OpenEXR/ImathBoxAlgo.h
  31. +736 −0 include/OpenEXR/ImathColor.h
  32. +257 −0 include/OpenEXR/ImathColorAlgo.h
  33. +926 −0 include/OpenEXR/ImathEuler.h
  34. +73 −0 include/OpenEXR/ImathExc.h
  35. +46 −0 include/OpenEXR/ImathExport.h
  36. +72 −0 include/OpenEXR/ImathForward.h
  37. +192 −0 include/OpenEXR/ImathFrame.h
  38. +741 −0 include/OpenEXR/ImathFrustum.h
  39. +417 −0 include/OpenEXR/ImathFrustumTest.h
  40. +269 −0 include/OpenEXR/ImathFun.h
  41. +166 −0 include/OpenEXR/ImathGL.h
  42. +54 −0 include/OpenEXR/ImathGLU.h
  43. +68 −0 include/OpenEXR/ImathHalfLimits.h
  44. +62 −0 include/OpenEXR/ImathInt64.h
  45. +226 −0 include/OpenEXR/ImathInterval.h
  46. +268 −0 include/OpenEXR/ImathLimits.h
  47. +185 −0 include/OpenEXR/ImathLine.h
  48. +288 −0 include/OpenEXR/ImathLineAlgo.h
  49. +208 −0 include/OpenEXR/ImathMath.h
Sorry, we could not display the entire diff because it was too big.
View
1 README.md
@@ -15,5 +15,6 @@ Nuparu currently consists of:
* [OpenVDB](http://www.openvdb.org/) 2.1.0 (OSX)
* [Partio](http://www.disneyanimation.com/technology/partio.html) 1.1.0 (OSX)
* [RMSD](http://boscoh.com/code/), with minor modifications for C++ (OSX/Linux/Win)
+* [OpenEXR](http://www.openexr.com) 2.1.0 (OSX)
Note: OpenVDB's dependencies are dynamically linked, so OpenVDB requires [Ilmbase/OpenEXR](http://www.openexr.com/) and [Intel TBB](https://www.threadingbuildingblocks.org/) to be installed.
View
BIN bin/osx/openexr/exrenvmap
Binary file not shown.
View
BIN bin/osx/openexr/exrheader
Binary file not shown.
View
BIN bin/osx/openexr/exrmakepreview
Binary file not shown.
View
BIN bin/osx/openexr/exrmaketiled
Binary file not shown.
View
BIN bin/osx/openexr/exrmultipart
Binary file not shown.
View
BIN bin/osx/openexr/exrmultiview
Binary file not shown.
View
BIN bin/osx/openexr/exrstdattr
Binary file not shown.
View
60 include/OpenEXR/Iex.h
@@ -0,0 +1,60 @@
+///////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
+// Digital Ltd. LLC
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Industrial Light & Magic nor the names of
+// its contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+///////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef INCLUDED_IEX_H
+#define INCLUDED_IEX_H
+
+
+//--------------------------------
+//
+// Exception handling
+//
+//--------------------------------
+
+
+#include "IexMacros.h"
+#include "IexBaseExc.h"
+#include "IexMathExc.h"
+#include "IexThrowErrnoExc.h"
+
+// Note that we do not include file IexErrnoExc.h here. That file
+// defines over 150 classes and significantly slows down compilation.
+// If you throw ErrnoExc exceptions using the throwErrnoExc() function,
+// you don't need IexErrnoExc.h. You have to include IexErrnoExc.h
+// only if you want to catch specific subclasses of ErrnoExc.
+
+
+#endif
View
264 include/OpenEXR/IexBaseExc.h
@@ -0,0 +1,264 @@
+///////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2002-2012, Industrial Light & Magic, a division of Lucas
+// Digital Ltd. LLC
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Industrial Light & Magic nor the names of
+// its contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+///////////////////////////////////////////////////////////////////////////
+
+
+#ifndef INCLUDED_IEXBASEEXC_H
+#define INCLUDED_IEXBASEEXC_H
+
+#include "IexNamespace.h"
+#include "IexExport.h"
+
+//----------------------------------------------------------
+//
+// A general exception base class, and a few
+// useful exceptions derived from the base class.
+//
+//----------------------------------------------------------
+
+#include <string>
+#include <exception>
+#include <sstream>
+
+IEX_INTERNAL_NAMESPACE_HEADER_ENTER
+
+
+//-------------------------------
+// Our most basic exception class
+//-------------------------------
+
+class BaseExc: public std::string, public std::exception
+{
+ public:
+
+ //----------------------------
+ // Constructors and destructor
+ //----------------------------
+
+ IEX_EXPORT BaseExc (const char *s = 0) throw(); // std::string (s)
+ IEX_EXPORT BaseExc (const std::string &s) throw(); // std::string (s)
+ IEX_EXPORT BaseExc (std::stringstream &s) throw(); // std::string (s.str())
+
+ IEX_EXPORT BaseExc (const BaseExc &be) throw();
+ IEX_EXPORT virtual ~BaseExc () throw ();
+
+ //--------------------------------------------
+ // what() method -- e.what() returns e.c_str()
+ //--------------------------------------------
+
+ IEX_EXPORT virtual const char * what () const throw ();
+
+
+ //--------------------------------------------------
+ // Convenient methods to change the exception's text
+ //--------------------------------------------------
+
+ IEX_EXPORT BaseExc & assign (std::stringstream &s); // assign (s.str())
+ IEX_EXPORT BaseExc & operator = (std::stringstream &s);
+
+ IEX_EXPORT BaseExc & append (std::stringstream &s); // append (s.str())
+ IEX_EXPORT BaseExc & operator += (std::stringstream &s);
+
+
+ //--------------------------------------------------
+ // These methods from the base class get obscured by
+ // the definitions above.
+ //--------------------------------------------------
+
+ IEX_EXPORT BaseExc & assign (const char *s);
+ IEX_EXPORT BaseExc & operator = (const char *s);
+
+ IEX_EXPORT BaseExc & append (const char *s);
+ IEX_EXPORT BaseExc & operator += (const char *s);
+
+
+ //--------------------------------------------------
+ // Stack trace for the point at which the exception
+ // was thrown. The stack trace will be an empty
+ // string unless a working stack-tracing routine
+ // has been installed (see below, setStackTracer()).
+ //--------------------------------------------------
+
+ IEX_EXPORT const std::string & stackTrace () const;
+
+ private:
+
+ std::string _stackTrace;
+};
+
+
+//-----------------------------------------------------
+// A macro to save typing when declararing an exception
+// class derived directly or indirectly from BaseExc:
+//-----------------------------------------------------
+
+#define DEFINE_EXC_EXP(exp, name, base) \
+ class exp name: public base \
+ { \
+ public: \
+ name() throw(): base (0) {} \
+ name (const char* text) throw(): base (text) {} \
+ name (const std::string &text) throw(): base (text) {} \
+ name (std::stringstream &text) throw(): base (text) {} \
+ ~name() throw() { } \
+ };
+
+// For backward compatibility.
+#define DEFINE_EXC(name, base) DEFINE_EXC_EXP(, name, base)
+
+
+//--------------------------------------------------------
+// Some exceptions which should be useful in most programs
+//--------------------------------------------------------
+DEFINE_EXC_EXP (IEX_EXPORT, ArgExc, BaseExc) // Invalid arguments to a function call
+
+DEFINE_EXC_EXP (IEX_EXPORT, LogicExc, BaseExc) // General error in a program's logic,
+ // for example, a function was called
+ // in a context where the call does
+ // not make sense.
+
+DEFINE_EXC_EXP (IEX_EXPORT, InputExc, BaseExc) // Invalid input data, e.g. from a file
+
+DEFINE_EXC_EXP (IEX_EXPORT, IoExc, BaseExc) // Input or output operation failed
+
+DEFINE_EXC_EXP (IEX_EXPORT, MathExc, BaseExc) // Arithmetic exception; more specific
+ // exceptions derived from this class
+ // are defined in ExcMath.h
+
+DEFINE_EXC_EXP (IEX_EXPORT, ErrnoExc, BaseExc) // Base class for exceptions corresponding
+ // to errno values (see errno.h); more
+ // specific exceptions derived from this
+ // class are defined in ExcErrno.h
+
+DEFINE_EXC_EXP (IEX_EXPORT, NoImplExc, BaseExc) // Missing method exception e.g. from a
+ // call to a method that is only partially
+ // or not at all implemented. A reminder
+ // to lazy software people to get back
+ // to work.
+
+DEFINE_EXC_EXP (IEX_EXPORT, NullExc, BaseExc) // A pointer is inappropriately null.
+
+DEFINE_EXC_EXP (IEX_EXPORT, TypeExc, BaseExc) // An object is an inappropriate type,
+ // i.e. a dynamnic_cast failed.
+
+
+//----------------------------------------------------------------------
+// Stack-tracing support:
+//
+// setStackTracer(st)
+//
+// installs a stack-tracing routine, st, which will be called from
+// class BaseExc's constructor every time an exception derived from
+// BaseExc is thrown. The stack-tracing routine should return a
+// string that contains a printable representation of the program's
+// current call stack. This string will be stored in the BaseExc
+// object; the string is accesible via the BaseExc::stackTrace()
+// method.
+//
+// setStackTracer(0)
+//
+// removes the current stack tracing routine. When an exception
+// derived from BaseExc is thrown, the stack trace string stored
+// in the BaseExc object will be empty.
+//
+// stackTracer()
+//
+// returns a pointer to the current stack-tracing routine, or 0
+// if there is no current stack stack-tracing routine.
+//
+//----------------------------------------------------------------------
+
+typedef std::string (* StackTracer) ();
+
+IEX_EXPORT void setStackTracer (StackTracer stackTracer);
+IEX_EXPORT StackTracer stackTracer ();
+
+
+//-----------------
+// Inline functions
+//-----------------
+
+inline BaseExc &
+BaseExc::operator = (std::stringstream &s)
+{
+ return assign (s);
+}
+
+
+inline BaseExc &
+BaseExc::operator += (std::stringstream &s)
+{
+ return append (s);
+}
+
+
+inline BaseExc &
+BaseExc::assign (const char *s)
+{
+ std::string::assign(s);
+ return *this;
+}
+
+
+inline BaseExc &
+BaseExc::operator = (const char *s)
+{
+ return assign(s);
+}
+
+
+inline BaseExc &
+BaseExc::append (const char *s)
+{
+ std::string::append(s);
+ return *this;
+}
+
+
+inline BaseExc &
+BaseExc::operator += (const char *s)
+{
+ return append(s);
+}
+
+
+inline const std::string &
+BaseExc::stackTrace () const
+{
+ return _stackTrace;
+}
+
+
+IEX_INTERNAL_NAMESPACE_HEADER_EXIT
+
+#endif // INCLUDED_IEXBASEEXC_H
View
208 include/OpenEXR/IexErrnoExc.h
@@ -0,0 +1,208 @@
+///////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2002-2012, Industrial Light & Magic, a division of Lucas
+// Digital Ltd. LLC
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Industrial Light & Magic nor the names of
+// its contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+///////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef INCLUDED_IEXERRNOEXC_H
+#define INCLUDED_IEXERRNOEXC_H
+
+//----------------------------------------------------------------
+//
+// Exceptions which correspond to "errno" error codes.
+//
+//----------------------------------------------------------------
+
+#include "IexBaseExc.h"
+
+IEX_INTERNAL_NAMESPACE_HEADER_ENTER
+
+DEFINE_EXC (EpermExc, ErrnoExc)
+DEFINE_EXC (EnoentExc, ErrnoExc)
+DEFINE_EXC (EsrchExc, ErrnoExc)
+DEFINE_EXC (EintrExc, ErrnoExc)
+DEFINE_EXC (EioExc, ErrnoExc)
+DEFINE_EXC (EnxioExc, ErrnoExc)
+DEFINE_EXC (E2bigExc, ErrnoExc)
+DEFINE_EXC (EnoexecExc, ErrnoExc)
+DEFINE_EXC (EbadfExc, ErrnoExc)
+DEFINE_EXC (EchildExc, ErrnoExc)
+DEFINE_EXC (EagainExc, ErrnoExc)
+DEFINE_EXC (EnomemExc, ErrnoExc)
+DEFINE_EXC (EaccesExc, ErrnoExc)
+DEFINE_EXC (EfaultExc, ErrnoExc)
+DEFINE_EXC (EnotblkExc, ErrnoExc)
+DEFINE_EXC (EbusyExc, ErrnoExc)
+DEFINE_EXC (EexistExc, ErrnoExc)
+DEFINE_EXC (ExdevExc, ErrnoExc)
+DEFINE_EXC (EnodevExc, ErrnoExc)
+DEFINE_EXC (EnotdirExc, ErrnoExc)
+DEFINE_EXC (EisdirExc, ErrnoExc)
+DEFINE_EXC (EinvalExc, ErrnoExc)
+DEFINE_EXC (EnfileExc, ErrnoExc)
+DEFINE_EXC (EmfileExc, ErrnoExc)
+DEFINE_EXC (EnottyExc, ErrnoExc)
+DEFINE_EXC (EtxtbsyExc, ErrnoExc)
+DEFINE_EXC (EfbigExc, ErrnoExc)
+DEFINE_EXC (EnospcExc, ErrnoExc)
+DEFINE_EXC (EspipeExc, ErrnoExc)
+DEFINE_EXC (ErofsExc, ErrnoExc)
+DEFINE_EXC (EmlinkExc, ErrnoExc)
+DEFINE_EXC (EpipeExc, ErrnoExc)
+DEFINE_EXC (EdomExc, ErrnoExc)
+DEFINE_EXC (ErangeExc, ErrnoExc)
+DEFINE_EXC (EnomsgExc, ErrnoExc)
+DEFINE_EXC (EidrmExc, ErrnoExc)
+DEFINE_EXC (EchrngExc, ErrnoExc)
+DEFINE_EXC (El2nsyncExc, ErrnoExc)
+DEFINE_EXC (El3hltExc, ErrnoExc)
+DEFINE_EXC (El3rstExc, ErrnoExc)
+DEFINE_EXC (ElnrngExc, ErrnoExc)
+DEFINE_EXC (EunatchExc, ErrnoExc)
+DEFINE_EXC (EnocsiExc, ErrnoExc)
+DEFINE_EXC (El2hltExc, ErrnoExc)
+DEFINE_EXC (EdeadlkExc, ErrnoExc)
+DEFINE_EXC (EnolckExc, ErrnoExc)
+DEFINE_EXC (EbadeExc, ErrnoExc)
+DEFINE_EXC (EbadrExc, ErrnoExc)
+DEFINE_EXC (ExfullExc, ErrnoExc)
+DEFINE_EXC (EnoanoExc, ErrnoExc)
+DEFINE_EXC (EbadrqcExc, ErrnoExc)
+DEFINE_EXC (EbadsltExc, ErrnoExc)
+DEFINE_EXC (EdeadlockExc, ErrnoExc)
+DEFINE_EXC (EbfontExc, ErrnoExc)
+DEFINE_EXC (EnostrExc, ErrnoExc)
+DEFINE_EXC (EnodataExc, ErrnoExc)
+DEFINE_EXC (EtimeExc, ErrnoExc)
+DEFINE_EXC (EnosrExc, ErrnoExc)
+DEFINE_EXC (EnonetExc, ErrnoExc)
+DEFINE_EXC (EnopkgExc, ErrnoExc)
+DEFINE_EXC (EremoteExc, ErrnoExc)
+DEFINE_EXC (EnolinkExc, ErrnoExc)
+DEFINE_EXC (EadvExc, ErrnoExc)
+DEFINE_EXC (EsrmntExc, ErrnoExc)
+DEFINE_EXC (EcommExc, ErrnoExc)
+DEFINE_EXC (EprotoExc, ErrnoExc)
+DEFINE_EXC (EmultihopExc, ErrnoExc)
+DEFINE_EXC (EbadmsgExc, ErrnoExc)
+DEFINE_EXC (EnametoolongExc, ErrnoExc)
+DEFINE_EXC (EoverflowExc, ErrnoExc)
+DEFINE_EXC (EnotuniqExc, ErrnoExc)
+DEFINE_EXC (EbadfdExc, ErrnoExc)
+DEFINE_EXC (EremchgExc, ErrnoExc)
+DEFINE_EXC (ElibaccExc, ErrnoExc)
+DEFINE_EXC (ElibbadExc, ErrnoExc)
+DEFINE_EXC (ElibscnExc, ErrnoExc)
+DEFINE_EXC (ElibmaxExc, ErrnoExc)
+DEFINE_EXC (ElibexecExc, ErrnoExc)
+DEFINE_EXC (EilseqExc, ErrnoExc)
+DEFINE_EXC (EnosysExc, ErrnoExc)
+DEFINE_EXC (EloopExc, ErrnoExc)
+DEFINE_EXC (ErestartExc, ErrnoExc)
+DEFINE_EXC (EstrpipeExc, ErrnoExc)
+DEFINE_EXC (EnotemptyExc, ErrnoExc)
+DEFINE_EXC (EusersExc, ErrnoExc)
+DEFINE_EXC (EnotsockExc, ErrnoExc)
+DEFINE_EXC (EdestaddrreqExc, ErrnoExc)
+DEFINE_EXC (EmsgsizeExc, ErrnoExc)
+DEFINE_EXC (EprototypeExc, ErrnoExc)
+DEFINE_EXC (EnoprotooptExc, ErrnoExc)
+DEFINE_EXC (EprotonosupportExc, ErrnoExc)
+DEFINE_EXC (EsocktnosupportExc, ErrnoExc)
+DEFINE_EXC (EopnotsuppExc, ErrnoExc)
+DEFINE_EXC (EpfnosupportExc, ErrnoExc)
+DEFINE_EXC (EafnosupportExc, ErrnoExc)
+DEFINE_EXC (EaddrinuseExc, ErrnoExc)
+DEFINE_EXC (EaddrnotavailExc, ErrnoExc)
+DEFINE_EXC (EnetdownExc, ErrnoExc)
+DEFINE_EXC (EnetunreachExc, ErrnoExc)
+DEFINE_EXC (EnetresetExc, ErrnoExc)
+DEFINE_EXC (EconnabortedExc, ErrnoExc)
+DEFINE_EXC (EconnresetExc, ErrnoExc)
+DEFINE_EXC (EnobufsExc, ErrnoExc)
+DEFINE_EXC (EisconnExc, ErrnoExc)
+DEFINE_EXC (EnotconnExc, ErrnoExc)
+DEFINE_EXC (EshutdownExc, ErrnoExc)
+DEFINE_EXC (EtoomanyrefsExc, ErrnoExc)
+DEFINE_EXC (EtimedoutExc, ErrnoExc)
+DEFINE_EXC (EconnrefusedExc, ErrnoExc)
+DEFINE_EXC (EhostdownExc, ErrnoExc)
+DEFINE_EXC (EhostunreachExc, ErrnoExc)
+DEFINE_EXC (EalreadyExc, ErrnoExc)
+DEFINE_EXC (EinprogressExc, ErrnoExc)
+DEFINE_EXC (EstaleExc, ErrnoExc)
+DEFINE_EXC (EioresidExc, ErrnoExc)
+DEFINE_EXC (EucleanExc, ErrnoExc)
+DEFINE_EXC (EnotnamExc, ErrnoExc)
+DEFINE_EXC (EnavailExc, ErrnoExc)
+DEFINE_EXC (EisnamExc, ErrnoExc)
+DEFINE_EXC (EremoteioExc, ErrnoExc)
+DEFINE_EXC (EinitExc, ErrnoExc)
+DEFINE_EXC (EremdevExc, ErrnoExc)
+DEFINE_EXC (EcanceledExc, ErrnoExc)
+DEFINE_EXC (EnolimfileExc, ErrnoExc)
+DEFINE_EXC (EproclimExc, ErrnoExc)
+DEFINE_EXC (EdisjointExc, ErrnoExc)
+DEFINE_EXC (EnologinExc, ErrnoExc)
+DEFINE_EXC (EloginlimExc, ErrnoExc)
+DEFINE_EXC (EgrouploopExc, ErrnoExc)
+DEFINE_EXC (EnoattachExc, ErrnoExc)
+DEFINE_EXC (EnotsupExc, ErrnoExc)
+DEFINE_EXC (EnoattrExc, ErrnoExc)
+DEFINE_EXC (EdircorruptedExc, ErrnoExc)
+DEFINE_EXC (EdquotExc, ErrnoExc)
+DEFINE_EXC (EnfsremoteExc, ErrnoExc)
+DEFINE_EXC (EcontrollerExc, ErrnoExc)
+DEFINE_EXC (EnotcontrollerExc, ErrnoExc)
+DEFINE_EXC (EenqueuedExc, ErrnoExc)
+DEFINE_EXC (EnotenqueuedExc, ErrnoExc)
+DEFINE_EXC (EjoinedExc, ErrnoExc)
+DEFINE_EXC (EnotjoinedExc, ErrnoExc)
+DEFINE_EXC (EnoprocExc, ErrnoExc)
+DEFINE_EXC (EmustrunExc, ErrnoExc)
+DEFINE_EXC (EnotstoppedExc, ErrnoExc)
+DEFINE_EXC (EclockcpuExc, ErrnoExc)
+DEFINE_EXC (EinvalstateExc, ErrnoExc)
+DEFINE_EXC (EnoexistExc, ErrnoExc)
+DEFINE_EXC (EendofminorExc, ErrnoExc)
+DEFINE_EXC (EbufsizeExc, ErrnoExc)
+DEFINE_EXC (EemptyExc, ErrnoExc)
+DEFINE_EXC (EnointrgroupExc, ErrnoExc)
+DEFINE_EXC (EinvalmodeExc, ErrnoExc)
+DEFINE_EXC (EcantextentExc, ErrnoExc)
+DEFINE_EXC (EinvaltimeExc, ErrnoExc)
+DEFINE_EXC (EdestroyedExc, ErrnoExc)
+
+IEX_INTERNAL_NAMESPACE_HEADER_EXIT
+
+#endif
View
51 include/OpenEXR/IexExport.h
@@ -0,0 +1,51 @@
+#ifndef IEXEXPORT_H
+#define IEXEXPORT_H
+
+///////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2012, Industrial Light & Magic, a division of Lucas
+// Digital Ltd. LLC
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Industrial Light & Magic nor the names of
+// its contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+///////////////////////////////////////////////////////////////////////////
+
+#if defined(OPENEXR_DLL)
+ #if defined(IEX_EXPORTS)
+ #define IEX_EXPORT __declspec(dllexport)
+ #else
+ #define IEX_EXPORT __declspec(dllimport)
+ #endif
+ #define IEX_EXPORT_CONST
+#else
+ #define IEX_EXPORT
+ #define IEX_EXPORT_CONST const
+#endif
+
+#endif // #ifndef IEXEXPORT_H
+
View
229 include/OpenEXR/IexForward.h
@@ -0,0 +1,229 @@
+///////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2012, Industrial Light & Magic, a division of Lucas
+// Digital Ltd. LLC
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Industrial Light & Magic nor the names of
+// its contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+///////////////////////////////////////////////////////////////////////////
+
+#ifndef INCLUDED_IEXFORWARD_H
+#define INCLUDED_IEXFORWARD_H
+
+#include "IexNamespace.h"
+
+IEX_INTERNAL_NAMESPACE_HEADER_ENTER
+
+//
+// Base exceptions.
+//
+
+class BaseExc;
+class ArgExc;
+class LogicExc;
+class InputExc;
+class IoExc;
+class MathExc;
+class ErrnoExc;
+class NoImplExc;
+class NullExc;
+class TypeExc;
+
+//
+// Math exceptions.
+//
+
+class OverflowExc;
+class UnderflowExc;
+class DivzeroExc;
+class InexactExc;
+class InvalidFpOpExc;
+
+//
+// Errno exceptions.
+//
+
+class EpermExc;
+class EnoentExc;
+class EsrchExc;
+class EintrExc;
+class EioExc;
+class EnxioExc;
+class E2bigExc;
+class EnoexecExc;
+class EbadfExc;
+class EchildExc;
+class EagainExc;
+class EnomemExc;
+class EaccesExc;
+class EfaultExc;
+class EnotblkExc;
+class EbusyExc;
+class EexistExc;
+class ExdevExc;
+class EnodevExc;
+class EnotdirExc;
+class EisdirExc;
+class EinvalExc;
+class EnfileExc;
+class EmfileExc;
+class EnottyExc;
+class EtxtbsyExc;
+class EfbigExc;
+class EnospcExc;
+class EspipeExc;
+class ErofsExc;
+class EmlinkExc;
+class EpipeExc;
+class EdomExc;
+class ErangeExc;
+class EnomsgExc;
+class EidrmExc;
+class EchrngExc;
+class El2nsyncExc;
+class El3hltExc;
+class El3rstExc;
+class ElnrngExc;
+class EunatchExc;
+class EnocsiExc;
+class El2hltExc;
+class EdeadlkExc;
+class EnolckExc;
+class EbadeExc;
+class EbadrExc;
+class ExfullExc;
+class EnoanoExc;
+class EbadrqcExc;
+class EbadsltExc;
+class EdeadlockExc;
+class EbfontExc;
+class EnostrExc;
+class EnodataExc;
+class EtimeExc;
+class EnosrExc;
+class EnonetExc;
+class EnopkgExc;
+class EremoteExc;
+class EnolinkExc;
+class EadvExc;
+class EsrmntExc;
+class EcommExc;
+class EprotoExc;
+class EmultihopExc;
+class EbadmsgExc;
+class EnametoolongExc;
+class EoverflowExc;
+class EnotuniqExc;
+class EbadfdExc;
+class EremchgExc;
+class ElibaccExc;
+class ElibbadExc;
+class ElibscnExc;
+class ElibmaxExc;
+class ElibexecExc;
+class EilseqExc;
+class EnosysExc;
+class EloopExc;
+class ErestartExc;
+class EstrpipeExc;
+class EnotemptyExc;
+class EusersExc;
+class EnotsockExc;
+class EdestaddrreqExc;
+class EmsgsizeExc;
+class EprototypeExc;
+class EnoprotooptExc;
+class EprotonosupportExc;
+class EsocktnosupportExc;
+class EopnotsuppExc;
+class EpfnosupportExc;
+class EafnosupportExc;
+class EaddrinuseExc;
+class EaddrnotavailExc;
+class EnetdownExc;
+class EnetunreachExc;
+class EnetresetExc;
+class EconnabortedExc;
+class EconnresetExc;
+class EnobufsExc;
+class EisconnExc;
+class EnotconnExc;
+class EshutdownExc;
+class EtoomanyrefsExc;
+class EtimedoutExc;
+class EconnrefusedExc;
+class EhostdownExc;
+class EhostunreachExc;
+class EalreadyExc;
+class EinprogressExc;
+class EstaleExc;
+class EioresidExc;
+class EucleanExc;
+class EnotnamExc;
+class EnavailExc;
+class EisnamExc;
+class EremoteioExc;
+class EinitExc;
+class EremdevExc;
+class EcanceledExc;
+class EnolimfileExc;
+class EproclimExc;
+class EdisjointExc;
+class EnologinExc;
+class EloginlimExc;
+class EgrouploopExc;
+class EnoattachExc;
+class EnotsupExc;
+class EnoattrExc;
+class EdircorruptedExc;
+class EdquotExc;
+class EnfsremoteExc;
+class EcontrollerExc;
+class EnotcontrollerExc;
+class EenqueuedExc;
+class EnotenqueuedExc;
+class EjoinedExc;
+class EnotjoinedExc;
+class EnoprocExc;
+class EmustrunExc;
+class EnotstoppedExc;
+class EclockcpuExc;
+class EinvalstateExc;
+class EnoexistExc;
+class EendofminorExc;
+class EbufsizeExc;
+class EemptyExc;
+class EnointrgroupExc;
+class EinvalmodeExc;
+class EcantextentExc;
+class EinvaltimeExc;
+class EdestroyedExc;
+
+IEX_INTERNAL_NAMESPACE_HEADER_EXIT
+
+#endif // INCLUDED_IEXFORWARD_H
View
170 include/OpenEXR/IexMacros.h
@@ -0,0 +1,170 @@
+///////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2002-2012, Industrial Light & Magic, a division of Lucas
+// Digital Ltd. LLC
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Industrial Light & Magic nor the names of
+// its contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+///////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef INCLUDED_IEXMACROS_H
+#define INCLUDED_IEXMACROS_H
+
+//--------------------------------------------------------------------
+//
+// Macros which make throwing exceptions more convenient
+//
+//--------------------------------------------------------------------
+
+#include <sstream>
+
+
+//----------------------------------------------------------------------------
+// A macro to throw exceptions whose text is assembled using stringstreams.
+//
+// Example:
+//
+// THROW (InputExc, "Syntax error in line " << line ", " << file << ".");
+//
+//----------------------------------------------------------------------------
+
+#include "IexExport.h"
+#include "IexForward.h"
+
+IEX_EXPORT void iex_debugTrap();
+
+#define THROW(type, text) \
+ do \
+ { \
+ iex_debugTrap(); \
+ std::stringstream s; \
+ s << text; \
+ throw type (s); \
+ } \
+ while (0)
+
+
+//----------------------------------------------------------------------------
+// Macros to add to or to replace the text of an exception.
+// The new text is assembled using stringstreams.
+//
+// Examples:
+//
+// Append to end of an exception's text:
+//
+// catch (BaseExc &e)
+// {
+// APPEND_EXC (e, " Directory " << name << " does not exist.");
+// throw;
+// }
+//
+// Replace an exception's text:
+//
+// catch (BaseExc &e)
+// {
+// REPLACE_EXC (e, "Directory " << name << " does not exist. " << e);
+// throw;
+// }
+//----------------------------------------------------------------------------
+
+#define APPEND_EXC(exc, text) \
+ do \
+ { \
+ std::stringstream s; \
+ s << text; \
+ exc.append (s); \
+ } \
+ while (0)
+
+#define REPLACE_EXC(exc, text) \
+ do \
+ { \
+ std::stringstream s; \
+ s << text; \
+ exc.assign (s); \
+ } \
+ while (0)
+
+
+//-------------------------------------------------------------
+// A macro to throw ErrnoExc exceptions whose text is assembled
+// using stringstreams:
+//
+// Example:
+//
+// THROW_ERRNO ("Cannot open file " << name << " (%T).");
+//
+//-------------------------------------------------------------
+
+#define THROW_ERRNO(text) \
+ do \
+ { \
+ std::stringstream s; \
+ s << text; \
+ ::IEX_NAMESPACE::throwErrnoExc (s.str()); \
+ } \
+ while (0)
+
+
+//-------------------------------------------------------------
+// A macro to throw exceptions if an assertion is false.
+//
+// Example:
+//
+// ASSERT (ptr != 0, NullExc, "Null pointer" );
+//
+//-------------------------------------------------------------
+
+#define ASSERT(assertion, type, text) \
+ do \
+ { \
+ if( (assertion) == false ) \
+ { \
+ THROW( type, text ); \
+ } \
+ } \
+ while (0)
+
+//-------------------------------------------------------------
+// A macro to throw an IEX_NAMESPACE::LogicExc if an assertion is false,
+// with the text composed from the source code file, line number,
+// and assertion argument text.
+//
+// Example:
+//
+// LOGIC_ASSERT (i < n);
+//
+//-------------------------------------------------------------
+#define LOGIC_ASSERT(assertion) \
+ ASSERT(assertion, \
+ IEX_NAMESPACE::LogicExc, \
+ __FILE__ << "(" << __LINE__ << "): logical assertion failed: " << #assertion )
+
+#endif
View
57 include/OpenEXR/IexMathExc.h
@@ -0,0 +1,57 @@
+///////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2002-2012, Industrial Light & Magic, a division of Lucas
+// Digital Ltd. LLC
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Industrial Light & Magic nor the names of
+// its contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+///////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef INCLUDED_IEXMATHEXC_H
+#define INCLUDED_IEXMATHEXC_H
+
+#include "IexBaseExc.h"
+
+IEX_INTERNAL_NAMESPACE_HEADER_ENTER
+
+//---------------------------------------------------------
+// Exception classess which correspond to specific floating
+// point exceptions.
+//---------------------------------------------------------
+
+DEFINE_EXC (OverflowExc, MathExc) // Overflow
+DEFINE_EXC (UnderflowExc, MathExc) // Underflow
+DEFINE_EXC (DivzeroExc, MathExc) // Division by zero
+DEFINE_EXC (InexactExc, MathExc) // Inexact result
+DEFINE_EXC (InvalidFpOpExc, MathExc) // Invalid operation
+
+IEX_INTERNAL_NAMESPACE_HEADER_EXIT
+
+#endif // INCLUDED_IEXMATHEXC_H
View
146 include/OpenEXR/IexMathFloatExc.h
@@ -0,0 +1,146 @@
+///////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
+// Digital Ltd. LLC
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Industrial Light & Magic nor the names of
+// its contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+///////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef INCLUDED_IEXMATHFLOATEXC_H
+#define INCLUDED_IEXMATHFLOATEXC_H
+
+#ifndef IEXMATH_EXPORT_H
+#define IEXMATH_EXPORT_H
+
+#if defined(OPENEXR_DLL)
+ #if defined(IEX_EXPORTS)
+ #define IEXMATH_EXPORT __declspec(dllexport)
+ #else
+ #define IEXMATH_EXPORT __declspec(dllimport)
+ #endif
+ #define IEXMATH_EXPORT_CONST
+#else
+ #define IEXMATH_EXPORT
+ #define IEXMATH_EXPORT_CONST const
+#endif
+
+#endif
+
+#include "IexNamespace.h"
+#include "IexMathExc.h"
+//#include <IexBaseExc.h>
+#include "IexMathIeeeExc.h"
+
+IEX_INTERNAL_NAMESPACE_HEADER_ENTER
+
+
+//-------------------------------------------------------------
+// Function mathExcOn() defines which floating point exceptions
+// will be trapped and converted to C++ exceptions.
+//-------------------------------------------------------------
+
+IEXMATH_EXPORT
+void mathExcOn (int when = (IEEE_OVERFLOW | IEEE_DIVZERO | IEEE_INVALID));
+
+
+//----------------------------------------------------------------------
+// Function getMathExcOn() tells you for which floating point exceptions
+// trapping and conversion to C++ exceptions is currently enabled.
+//----------------------------------------------------------------------
+
+IEXMATH_EXPORT
+int getMathExcOn();
+
+
+//------------------------------------------------------------------------
+// A classs that temporarily sets floating point exception trapping
+// and conversion, and later restores the previous settings.
+//
+// Example:
+//
+// float
+// trickyComputation (float x)
+// {
+// MathExcOn meo (0); // temporarily disable floating
+// // point exception trapping
+//
+// float result = ...; // computation which may cause
+// // floating point exceptions
+//
+// return result; // destruction of meo restores
+// } // the program's previous floating
+// // point exception settings
+//------------------------------------------------------------------------
+
+class IEXMATH_EXPORT MathExcOn
+{
+ public:
+
+ MathExcOn (int when)
+ :
+ _changed (false)
+ {
+ _saved = getMathExcOn();
+
+ if (_saved != when)
+ {
+ _changed = true;
+ mathExcOn (when);
+ }
+ }
+
+ ~MathExcOn ()
+ {
+ if (_changed)
+ mathExcOn (_saved);
+ }
+
+ // It is possible for functions to set the exception registers
+ // yet not trigger a SIGFPE. Specifically, the implementation
+ // of pow(x, y) we're using can generates a NaN from a negative x
+ // and fractional y but a SIGFPE is not generated.
+ // This function examimes the exception registers and calls the
+ // fpHandler if those registers modulo the exception mask are set.
+ // It should be called wherever this class is commonly used where it has
+ // been found that certain floating point exceptions are not being thrown.
+
+ void handleOutstandingExceptions();
+
+ private:
+
+ bool _changed;
+ int _saved;
+};
+
+
+IEX_INTERNAL_NAMESPACE_HEADER_EXIT
+
+#endif
View
91 include/OpenEXR/IexMathFpu.h
@@ -0,0 +1,91 @@
+#ifndef INCLUDED_IEXMATHFPU_H
+#define INCLUDED_IEXMATHFPU_H
+
+///////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 1997, Industrial Light & Magic, a division of Lucas
+// Digital Ltd. LLC
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Industrial Light & Magic nor the names of
+// its contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+///////////////////////////////////////////////////////////////////////////
+
+
+//------------------------------------------------------------------------
+//
+// Functions to control floating point exceptions.
+//
+//------------------------------------------------------------------------
+
+#include "IexMathIeeeExc.h"
+#include "IexNamespace.h"
+
+IEX_INTERNAL_NAMESPACE_HEADER_ENTER
+
+
+//-----------------------------------------
+// setFpExceptions() defines which floating
+// point exceptions cause SIGFPE signals.
+//-----------------------------------------
+
+void setFpExceptions (int when = (IEEE_OVERFLOW | IEEE_DIVZERO | IEEE_INVALID));
+
+
+//----------------------------------------
+// fpExceptions() tells you which floating
+// point exceptions cause SIGFPE signals.
+//----------------------------------------
+
+int fpExceptions ();
+
+
+//------------------------------------------
+// setFpExceptionHandler() defines a handler
+// that will be called when SIGFPE occurs.
+//------------------------------------------
+
+extern "C" typedef void (* FpExceptionHandler) (int type, const char explanation[]);
+
+void setFpExceptionHandler (FpExceptionHandler handler);
+
+// -----------------------------------------
+// handleExceptionsSetInRegisters() examines
+// the exception registers and calls the
+// floating point exception handler if the
+// bits are set. This function exists to
+// allow trapping of exception register states
+// that can get set though no SIGFPE occurs.
+// -----------------------------------------
+
+void handleExceptionsSetInRegisters();
+
+
+IEX_INTERNAL_NAMESPACE_HEADER_EXIT
+
+
+#endif
View
62 include/OpenEXR/IexMathIeeeExc.h
@@ -0,0 +1,62 @@
+#ifndef INCLUDED_IEXMATHIEEE_EXC_H
+#define INCLUDED_IEXMATHIEEE_EXC_H
+
+///////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 1997, Industrial Light & Magic, a division of Lucas
+// Digital Ltd. LLC
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Industrial Light & Magic nor the names of
+// its contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+///////////////////////////////////////////////////////////////////////////
+
+
+//---------------------------------------------------------------------------
+//
+// Names for the loating point exceptions defined by IEEE standard 754
+//
+//---------------------------------------------------------------------------
+
+#include "IexNamespace.h"
+
+IEX_INTERNAL_NAMESPACE_HEADER_ENTER
+
+
+enum IeeeExcType
+{
+ IEEE_OVERFLOW = 1,
+ IEEE_UNDERFLOW = 2,
+ IEEE_DIVZERO = 4,
+ IEEE_INEXACT = 8,
+ IEEE_INVALID = 16
+};
+
+
+IEX_INTERNAL_NAMESPACE_HEADER_EXIT
+
+#endif
View
112 include/OpenEXR/IexNamespace.h
@@ -0,0 +1,112 @@
+///////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2012, Industrial Light & Magic, a division of Lucas
+// Digital Ltd. LLC
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Industrial Light & Magic nor the names of
+// its contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+///////////////////////////////////////////////////////////////////////////
+
+#ifndef INCLUDED_IEXNAMESPACE_H
+#define INCLUDED_IEXNAMESPACE_H
+
+//
+// The purpose of this file is to make it possible to specify an
+// IEX_INTERNAL_NAMESPACE as a preprocessor definition and have all of the
+// Iex symbols defined within that namespace rather than the standard
+// Iex namespace. Those symbols are made available to client code through
+// the IEX_NAMESPACE in addition to the IEX_INTERNAL_NAMESPACE.
+//
+// To ensure source code compatibility, the IEX_NAMESPACE defaults to Iex
+// and then "using namespace IEX_INTERNAL_NAMESPACE;" brings all of the
+// declarations from the IEX_INTERNAL_NAMESPACE into the IEX_NAMESPACE. This
+// means that client code can continue to use syntax like Iex::BaseExc, but
+// at link time it will resolve to a mangled symbol based on the
+// IEX_INTERNAL_NAMESPACE.
+//
+// As an example, if one needed to build against a newer version of Iex and
+// have it run alongside an older version in the same application, it is now
+// possible to use an internal namespace to prevent collisions between the
+// older versions of Iex symbols and the newer ones. To do this, the
+// following could be defined at build time:
+//
+// IEX_INTERNAL_NAMESPACE = Iex_v2
+//
+// This means that declarations inside Iex headers look like this (after the
+// preprocessor has done its work):
+//
+// namespace Iex_v2 {
+// ...
+// class declarations
+// ...
+// }
+//
+// namespace Iex {
+// using namespace Iex_v2;
+// }
+//
+
+//
+// Open Source version of this file pulls in the IlmBaseConfig.h file
+// for the configure time options.
+//
+#include "IlmBaseConfig.h"
+
+#ifndef IEX_NAMESPACE
+#define IEX_NAMESPACE Iex
+#endif
+
+#ifndef IEX_INTERNAL_NAMESPACE
+#define IEX_INTERNAL_NAMESPACE IEX_NAMESPACE
+#endif
+
+//
+// We need to be sure that we import the internal namespace into the public one.
+// To do this, we use the small bit of code below which initially defines
+// IEX_INTERNAL_NAMESPACE (so it can be referenced) and then defines
+// IEX_NAMESPACE and pulls the internal symbols into the public namespace.
+//
+
+namespace IEX_INTERNAL_NAMESPACE {}
+namespace IEX_NAMESPACE {
+ using namespace IEX_INTERNAL_NAMESPACE;
+}
+
+//
+// There are identical pairs of HEADER/SOURCE ENTER/EXIT macros so that
+// future extension to the namespace mechanism is possible without changing
+// project source code.
+//
+
+#define IEX_INTERNAL_NAMESPACE_HEADER_ENTER namespace IEX_INTERNAL_NAMESPACE {
+#define IEX_INTERNAL_NAMESPACE_HEADER_EXIT }
+
+#define IEX_INTERNAL_NAMESPACE_SOURCE_ENTER namespace IEX_INTERNAL_NAMESPACE {
+#define IEX_INTERNAL_NAMESPACE_SOURCE_EXIT }
+
+#endif // INCLUDED_IEXNAMESPACE_H
View
97 include/OpenEXR/IexThrowErrnoExc.h
@@ -0,0 +1,97 @@
+///////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2002-2012, Industrial Light & Magic, a division of Lucas
+// Digital Ltd. LLC
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Industrial Light & Magic nor the names of
+// its contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+///////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef INCLUDED_IEXTHROWERRNOEXC_H
+#define INCLUDED_IEXTHROWERRNOEXC_H
+
+//----------------------------------------------------------
+//
+// A function which throws ExcErrno exceptions
+//
+//----------------------------------------------------------
+
+#include "IexBaseExc.h"
+#include "IexExport.h"
+
+IEX_INTERNAL_NAMESPACE_HEADER_ENTER
+
+
+//--------------------------------------------------------------------------
+//
+// Function throwErrnoExc() throws an exception which corresponds to
+// error code errnum. The exception text is initialized with a copy
+// of the string passed to throwErrnoExc(), where all occurrences of
+// "%T" have been replaced with the output of strerror(oserror()).
+//
+// Example:
+//
+// If opening file /tmp/output failed with an ENOENT error code,
+// calling
+//
+// throwErrnoExc ();
+//
+// or
+//
+// throwErrnoExc ("%T.");
+//
+// will throw an EnoentExc whose text reads
+//
+// No such file or directory.
+//
+// More detailed messages can be assembled using stringstreams:
+//
+// std::stringstream s;
+// s << "Cannot open file " << name << " (%T).";
+// throwErrnoExc (s);
+//
+// The resulting exception contains the following text:
+//
+// Cannot open file /tmp/output (No such file or directory).
+//
+// Alternatively, you may want to use the THROW_ERRNO macro defined
+// in IexMacros.h:
+//
+// THROW_ERRNO ("Cannot open file " << name << " (%T).")
+//
+//--------------------------------------------------------------------------
+
+IEX_EXPORT void throwErrnoExc(const std::string &txt, int errnum);
+IEX_EXPORT void throwErrnoExc(const std::string &txt);
+IEX_EXPORT void throwErrnoExc();
+
+IEX_INTERNAL_NAMESPACE_HEADER_EXIT
+
+#endif // INCLUDED_IEXTHROWERRNOEXC_H
View
18 include/OpenEXR/IlmBaseConfig.h
@@ -0,0 +1,18 @@
+#define HAVE_PTHREAD 1
+#define ILMBASE_INTERNAL_NAMESPACE_CUSTOM 1
+#define IMATH_INTERNAL_NAMESPACE Imath_2_1
+#define IEX_INTERNAL_NAMESPACE Iex_2_1
+#define ILMTHREAD_INTERNAL_NAMESPACE IlmThread_2_1
+#define IMATH_NAMESPACE Imath
+#define IEX_NAMESPACE Iex
+#define ILMTHREAD_NAMESPACE IlmThread
+#define ILMBASE_VERSION_STRING "2.1.0"
+#define ILMBASE_PACKAGE_STRING "IlmBase 2.1.0"
+#define ILMBASE_VERSION_MAJOR 2
+#define ILMBASE_VERSION_MINOR 1
+#define ILMBASE_VERSION_PATCH 0
+
+// Version as a single hex number, e.g. 0x01000300 == 1.0.3
+#define ILMBASE_VERSION_HEX ((ILMBASE_VERSION_MAJOR << 24) | \
+ (ILMBASE_VERSION_MINOR << 16) | \
+ (ILMBASE_VERSION_PATCH << 8))
View
143 include/OpenEXR/IlmThread.h
@@ -0,0 +1,143 @@
+///////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2005-2012, Industrial Light & Magic, a division of Lucas
+// Digital Ltd. LLC
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Industrial Light & Magic nor the names of
+// its contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+///////////////////////////////////////////////////////////////////////////
+
+#ifndef INCLUDED_ILM_THREAD_H
+#define INCLUDED_ILM_THREAD_H
+
+//-----------------------------------------------------------------------------
+//
+// class Thread
+//
+// Class Thread is a portable interface to a system-dependent thread
+// primitive. In order to make a thread actually do something useful,
+// you must derive a subclass from class Thread and implement the
+// run() function. If the operating system supports threading then
+// the run() function will be executed int a new thread.
+//
+// The actual creation of the thread is done by the start() routine
+// which then calls the run() function. In general the start()
+// routine should be called from the constructor of the derived class.
+//
+// The base-class thread destructor will join/destroy the thread.
+//
+// IMPORTANT: Due to the mechanisms that encapsulate the low-level
+// threading primitives in a C++ class there is a race condition
+// with code resembling the following:
+//
+// {
+// WorkerThread myThread;
+// } // myThread goes out of scope, is destroyed
+// // and the thread is joined
+//
+// The race is between the parent thread joining the child thread
+// in the destructor of myThread, and the run() function in the
+// child thread. If the destructor gets executed first then run()
+// will be called with an invalid "this" pointer.
+//
+// This issue can be fixed by using a Semaphore to keep track of
+// whether the run() function has already been called. You can
+// include a Semaphore member variable within your derived class
+// which you post() on in the run() function, and wait() on in the
+// destructor before the thread is joined. Alternatively you could
+// do something like this:
+//
+// Semaphore runStarted;
+//
+// void WorkerThread::run ()
+// {
+// runStarted.post()
+// // do some work
+// ...
+// }
+//
+// {
+// WorkerThread myThread;
+// runStarted.wait (); // ensure that we have started
+// // the run function
+// } // myThread goes out of scope, is destroyed
+// // and the thread is joined
+//
+//-----------------------------------------------------------------------------
+
+#include "IlmBaseConfig.h"
+#include "IlmThreadExport.h"
+#include "IlmThreadNamespace.h"
+
+#if defined _WIN32 || defined _WIN64
+ #ifdef NOMINMAX
+ #undef NOMINMAX
+ #endif
+ #define NOMINMAX
+ #include <windows.h>
+ #include <process.h>
+#elif HAVE_PTHREAD
+ #include <pthread.h>
+#endif
+
+ILMTHREAD_INTERNAL_NAMESPACE_HEADER_ENTER
+
+//
+// Query function to determine if the current platform supports
+// threads AND this library was compiled with threading enabled.
+//
+
+ILMTHREAD_EXPORT bool supportsThreads ();
+
+
+class ILMTHREAD_EXPORT Thread
+{
+ public:
+
+ Thread ();
+ virtual ~Thread ();
+
+ void start ();
+ virtual void run () = 0;
+
+ private:
+
+ #if defined _WIN32 || defined _WIN64
+ HANDLE _thread;
+ #elif HAVE_PTHREAD
+ pthread_t _thread;
+ #endif
+
+ void operator = (const Thread& t); // not implemented
+ Thread (const Thread& t); // not implemented
+};
+
+
+ILMTHREAD_INTERNAL_NAMESPACE_HEADER_EXIT
+
+#endif // INCLUDED_ILM_THREAD_H
View
46 include/OpenEXR/IlmThreadExport.h
@@ -0,0 +1,46 @@
+///////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2012, Industrial Light & Magic, a division of Lucas
+// Digital Ltd. LLC
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Industrial Light & Magic nor the names of
+// its contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+///////////////////////////////////////////////////////////////////////////
+
+#if defined(OPENEXR_DLL)
+ #if defined(ILMTHREAD_EXPORTS)
+ #define ILMTHREAD_EXPORT __declspec(dllexport)
+ #define ILMTHREAD_EXPORT_CONST extern __declspec(dllexport)
+ #else
+ #define ILMTHREAD_EXPORT __declspec(dllimport)
+ #define ILMTHREAD_EXPORT_CONST extern __declspec(dllimport)
+ #endif
+#else
+ #define ILMTHREAD_EXPORT
+ #define ILMTHREAD_EXPORT_CONST extern const
+#endif
View
52 include/OpenEXR/IlmThreadForward.h
@@ -0,0 +1,52 @@
+///////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2012, Industrial Light & Magic, a division of Lucas
+// Digital Ltd. LLC
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Industrial Light & Magic nor the names of
+// its contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+///////////////////////////////////////////////////////////////////////////
+
+#ifndef INCLUDED_ILMTHREADFORWARD_H
+#define INCLUDED_ILMTHREADFORWARD_H
+
+#include "IlmThreadNamespace.h"
+
+ILMTHREAD_INTERNAL_NAMESPACE_HEADER_ENTER
+
+class Thread;
+class Mutex;
+class Lock;
+class ThreadPool;
+class Task;
+class TaskGroup;
+class Semaphore;
+
+ILMTHREAD_INTERNAL_NAMESPACE_HEADER_EXIT
+
+#endif // INCLUDED_ILMTHREADFORWARD_H
View
160 include/OpenEXR/IlmThreadMutex.h
@@ -0,0 +1,160 @@
+///////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2005-2012, Industrial Light & Magic, a division of Lucas
+// Digital Ltd. LLC
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Industrial Light & Magic nor the names of
+// its contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+///////////////////////////////////////////////////////////////////////////
+
+#ifndef INCLUDED_ILM_THREAD_MUTEX_H
+#define INCLUDED_ILM_THREAD_MUTEX_H
+
+//-----------------------------------------------------------------------------
+//
+// class Mutex, class Lock
+//
+// Class Mutex is a wrapper for a system-dependent mutual exclusion
+// mechanism. Actual locking and unlocking of a Mutex object must
+// be performed using an instance of a Lock (defined below).
+//
+// Class lock provides safe locking and unlocking of mutexes even in
+// the presence of C++ exceptions. Constructing a Lock object locks
+// the mutex; destroying the Lock unlocks the mutex.
+//
+// Lock objects are not themselves thread-safe. You should never
+// share a Lock object among multiple threads.
+//
+// Typical usage:
+//
+// Mutex mtx; // Create a Mutex object that is visible
+// //to multiple threads
+//
+// ... // create some threads
+//
+// // Then, within each thread, construct a critical section like so:
+//
+// {
+// Lock lock (mtx); // Lock constructor locks the mutex
+// ... // do some computation on shared data
+// } // leaving the block unlocks the mutex
+//
+//-----------------------------------------------------------------------------
+
+#include "IlmThreadExport.h"
+#include "IlmBaseConfig.h"
+#include "IlmThreadNamespace.h"
+
+#if defined _WIN32 || defined _WIN64
+ #ifdef NOMINMAX
+ #undef NOMINMAX
+ #endif
+ #define NOMINMAX
+ #include <windows.h>
+#elif HAVE_PTHREAD
+ #include <pthread.h>
+#endif
+
+ILMTHREAD_INTERNAL_NAMESPACE_HEADER_ENTER
+
+class Lock;
+
+
+class ILMTHREAD_EXPORT Mutex
+{
+ public:
+
+ Mutex ();
+ virtual ~Mutex ();
+
+ private:
+
+ void lock () const;
+ void unlock () const;
+
+ #if defined _WIN32 || defined _WIN64
+ mutable CRITICAL_SECTION _mutex;
+ #elif HAVE_PTHREAD
+ mutable pthread_mutex_t _mutex;
+ #endif
+
+ void operator = (const Mutex& M); // not implemented
+ Mutex (const Mutex& M); // not implemented
+
+ friend class Lock;
+};
+
+
+class ILMTHREAD_EXPORT Lock
+{
+ public:
+
+ Lock (const Mutex& m, bool autoLock = true):
+ _mutex (m),
+ _locked (false)
+ {
+ if (autoLock)
+ {
+ _mutex.lock();
+ _locked = true;
+ }
+ }
+
+ ~Lock ()
+ {
+ if (_locked)
+ _mutex.unlock();
+ }
+
+ void acquire ()
+ {
+ _mutex.lock();
+ _locked = true;
+ }
+
+ void release ()
+ {
+ _mutex.unlock();
+ _locked = false;
+ }
+
+ bool locked ()
+ {
+ return _locked;
+ }
+
+ private:
+
+ const Mutex & _mutex;
+ bool _locked;
+};
+
+
+ILMTHREAD_INTERNAL_NAMESPACE_HEADER_EXIT
+
+#endif // INCLUDED_ILM_THREAD_MUTEX_H
View
114 include/OpenEXR/IlmThreadNamespace.h
@@ -0,0 +1,114 @@
+///////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2012, Industrial Light & Magic, a division of Lucas
+// Digital Ltd. LLC
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Industrial Light & Magic nor the names of
+// its contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+///////////////////////////////////////////////////////////////////////////
+
+#ifndef INCLUDED_ILMTHREADNAMESPACE_H
+#define INCLUDED_ILMTHREADNAMESPACE_H
+
+//
+// The purpose of this file is to make it possible to specify an
+// ILMTHREAD_INTERNAL_NAMESPACE as a preprocessor definition and have all of
+// the IlmThread symbols defined within that namespace rather than the
+// standard IlmThread namespace. Those symbols are made available to client
+// code through the ILMTHREAD_NAMESPACE in addition to the
+// ILMTHREAD_INTERNAL_NAMESPACE.
+//
+// To ensure source code compatibility, the ILMTHREAD_NAMESPACE defaults to
+// IlmThread and then "using namespace ILMTHREAD_INTERNAL_NAMESPACE;" brings
+// all of the declarations from the ILMTHREAD_INTERNAL_NAMESPACE into the
+// ILMTHREAD_NAMESPACE. This means that client code can continue to use
+// syntax like IlmThread::Thread, but at link time it will resolve to a
+// mangled symbol based on the ILMTHREAD_INTERNAL_NAMESPACE.
+//
+// As an example, if one needed to build against a newer version of IlmThread
+// and have it run alongside an older version in the same application, it is
+// now possible to use an internal namespace to prevent collisions between
+// the older versions of IlmThread symbols and the newer ones. To do this,
+// the following could be defined at build time:
+//
+// ILMTHREAD_INTERNAL_NAMESPACE = IlmThread_v2
+//
+// This means that declarations inside IlmThread headers look like this
+// (after the preprocessor has done its work):
+//
+// namespace IlmThread_v2 {
+// ...
+// class declarations
+// ...
+// }
+//
+// namespace IlmThread {
+// using namespace IlmThread_v2;
+// }
+//
+
+//
+// Open Source version of this file pulls in the IlmBaseConfig.h file
+// for the configure time options.
+//
+#include "IlmBaseConfig.h"
+
+#ifndef ILMTHREAD_NAMESPACE
+#define ILMTHREAD_NAMESPACE IlmThread
+#endif
+
+#ifndef ILMTHREAD_INTERNAL_NAMESPACE
+#define ILMTHREAD_INTERNAL_NAMESPACE ILMTHREAD_NAMESPACE
+#endif
+
+//
+// We need to be sure that we import the internal namespace into the public one.
+// To do this, we use the small bit of code below which initially defines
+// ILMTHREAD_INTERNAL_NAMESPACE (so it can be referenced) and then defines
+// ILMTHREAD_NAMESPACE and pulls the internal symbols into the public
+// namespace.
+//
+
+namespace ILMTHREAD_INTERNAL_NAMESPACE {}
+namespace ILMTHREAD_NAMESPACE {
+ using namespace ILMTHREAD_INTERNAL_NAMESPACE;
+}
+
+//
+// There are identical pairs of HEADER/SOURCE ENTER/EXIT macros so that
+// future extension to the namespace mechanism is possible without changing
+// project source code.
+//
+
+#define ILMTHREAD_INTERNAL_NAMESPACE_HEADER_ENTER namespace ILMTHREAD_INTERNAL_NAMESPACE {
+#define ILMTHREAD_INTERNAL_NAMESPACE_HEADER_EXIT }
+
+#define ILMTHREAD_INTERNAL_NAMESPACE_SOURCE_ENTER namespace ILMTHREAD_INTERNAL_NAMESPACE {
+#define ILMTHREAD_INTERNAL_NAMESPACE_SOURCE_EXIT }
+
+#endif // INCLUDED_ILMTHREADNAMESPACE_H
View
160 include/OpenEXR/IlmThreadPool.h
@@ -0,0 +1,160 @@
+///////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2005-2012, Industrial Light & Magic, a division of Lucas
+// Digital Ltd. LLC
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Industrial Light & Magic nor the names of
+// its contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+///////////////////////////////////////////////////////////////////////////
+
+#ifndef INCLUDED_ILM_THREAD_POOL_H
+#define INCLUDED_ILM_THREAD_POOL_H
+
+
+//-----------------------------------------------------------------------------
+//
+// class Task, class ThreadPool, class TaskGroup
+//
+// Class ThreadPool manages a set of worker threads and accepts
+// tasks for processing. Tasks added to the thread pool are
+// executed concurrently by the worker threads.
+//
+// Class Task provides an abstract interface for a task which
+// a ThreadPool works on. Derived classes need to implement the
+// execute() function which performs the actual task.
+//
+// Class TaskGroup allows synchronization on the completion of a set
+// of tasks. Every task that is added to a ThreadPool belongs to a
+// single TaskGroup. The destructor of the TaskGroup waits for all
+// tasks in the group to finish.
+//
+// Note: if you plan to use the ThreadPool interface in your own
+// applications note that the implementation of the ThreadPool calls
+// operator delete on tasks as they complete. If you define a custom
+// operator new for your tasks, for instance to use a custom heap,
+// then you must also write an appropriate operator delete.
+//
+//-----------------------------------------------------------------------------
+
+#include "IlmThreadNamespace.h"
+#include "IlmThreadExport.h"
+
+ILMTHREAD_INTERNAL_NAMESPACE_HEADER_ENTER
+
+class TaskGroup;
+class Task;
+
+
+class ILMTHREAD_EXPORT ThreadPool
+{
+ public:
+
+ //-------------------------------------------------------
+ // Constructor -- creates numThreads worker threads which
+ // wait until a task is available.
+ //-------------------------------------------------------
+
+ ThreadPool (unsigned numThreads = 0);
+
+
+ //-----------------------------------------------------------
+ // Destructor -- waits for all tasks to complete, joins all
+ // the threads to the calling thread, and then destroys them.
+ //-----------------------------------------------------------
+
+ virtual ~ThreadPool ();
+
+
+ //--------------------------------------------------------
+ // Query and set the number of worker threads in the pool.
+ //
+ // Warning: never call setNumThreads from within a worker
+ // thread as this will almost certainly cause a deadlock
+ // or crash.
+ //--------------------------------------------------------
+
+ int numThreads () const;
+ void setNumThreads (int count);
+
+
+ //------------------------------------------------------------
+ // Add a task for processing. The ThreadPool can handle any
+ // number of tasks regardless of the number of worker threads.
+ // The tasks are first added onto a queue, and are executed
+ // by threads as they become available, in FIFO order.
+ //------------------------------------------------------------
+
+ void addTask (Task* task);
+
+
+ //-------------------------------------------
+ // Access functions for the global threadpool
+ //-------------------------------------------
+
+ static ThreadPool& globalThreadPool ();
+ static void addGlobalTask (Task* task);
+
+ struct Data;
+
+ protected:
+
+ Data * _data;
+};
+
+
+class ILMTHREAD_EXPORT Task
+{
+ public:
+
+ Task (TaskGroup* g);
+ virtual ~Task ();
+
+ virtual void execute () = 0;
+ TaskGroup * group();
+
+ protected:
+
+ TaskGroup * _group;
+};
+
+
+class ILMTHREAD_EXPORT TaskGroup
+{
+ public:
+
+ TaskGroup();
+ ~TaskGroup();
+
+ struct Data;
+ Data* const _data;
+};
+
+
+ILMTHREAD_INTERNAL_NAMESPACE_HEADER_EXIT
+
+#endif // INCLUDED_ILM_THREAD_POOL_H
View
112 include/OpenEXR/IlmThreadSemaphore.h
@@ -0,0 +1,112 @@
+///////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2005-2012, Industrial Light & Magic, a division of Lucas
+// Digital Ltd. LLC
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Industrial Light & Magic nor the names of
+// its contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+///////////////////////////////////////////////////////////////////////////
+
+#ifndef INCLUDED_ILM_THREAD_SEMAPHORE_H
+#define INCLUDED_ILM_THREAD_SEMAPHORE_H
+
+//-----------------------------------------------------------------------------
+//
+// class Semaphore -- a wrapper class for
+// system-dependent counting semaphores
+//
+//-----------------------------------------------------------------------------
+
+#include "IlmBaseConfig.h"
+#include "IlmThreadExport.h"
+#include "IlmThreadNamespace.h"
+
+#if defined _WIN32 || defined _WIN64
+ #ifdef NOMINMAX
+ #undef NOMINMAX
+ #endif
+ #define NOMINMAX
+ #include <windows.h>
+#elif HAVE_PTHREAD && !HAVE_POSIX_SEMAPHORES
+ #include <pthread.h>
+#elif HAVE_PTHREAD && HAVE_POSIX_SEMAPHORES
+ #include <semaphore.h>
+#endif
+
+ILMTHREAD_INTERNAL_NAMESPACE_HEADER_ENTER
+
+
+class ILMTHREAD_EXPORT Semaphore
+{
+ public:
+
+ Semaphore (unsigned int value = 0);
+ virtual ~Semaphore();
+
+ void wait();
+ bool tryWait();
+ void post();
+ int value() const;
+
+ private:
+
+ #if defined _WIN32 || defined _WIN64
+
+ mutable HANDLE _semaphore;
+
+ #elif HAVE_PTHREAD && !HAVE_POSIX_SEMAPHORES
+
+ //
+ // If the platform has Posix threads but no semapohores,
+ // then we implement them ourselves using condition variables
+ //
+
+ struct sema_t
+ {
+ unsigned int count;
+ unsigned long numWaiting;
+ pthread_mutex_t mutex;
+ pthread_cond_t nonZero;
+ };
+
+ mutable sema_t _semaphore;
+
+ #elif HAVE_PTHREAD && HAVE_POSIX_SEMAPHORES
+
+ mutable sem_t _semaphore;
+
+ #endif
+
+ void operator = (const Semaphore& s); // not implemented
+ Semaphore (const Semaphore& s); // not implemented
+};
+
+
+ILMTHREAD_INTERNAL_NAMESPACE_HEADER_EXIT
+
+#endif // INCLUDED_ILM_THREAD_SEMAPHORE_H
View
849 include/OpenEXR/ImathBox.h
@@ -0,0 +1,849 @@
+///////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2004-2012, Industrial Light & Magic, a division of Lucas
+// Digital Ltd. LLC
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Industrial Light & Magic nor the names of
+// its contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE