Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 33bd170
Author: Dan Smith <[email protected]>
Date:   Mon Dec 13 11:44:54 2021 -0500

    nitro release 2.10.7

commit ef19ad2
Author: Dan Smith <[email protected]>
Date:   Mon Dec 13 11:42:09 2021 -0500

    coda-oss release 2021-12-13

commit 86c1856
Author: Dan Smith <[email protected]>
Date:   Fri Dec 10 11:57:26 2021 -0500

    xml.lite tweaks from coda-oss

commit f21f79d
Author: Dan Smith <[email protected]>
Date:   Thu Dec 9 17:36:09 2021 -0500

    test_xmlParser might be be running in coda-oss

commit 3526cd0
Author: Dan Smith <[email protected]>
Date:   Thu Dec 9 16:09:17 2021 -0500

    "private" is part of name mangling

commit 351a45f
Author: Dan Smith <[email protected]>
Date:   Thu Dec 9 15:54:13 2021 -0500

    more xml.lite updates from coda-oss

commit 1c72ba2
Author: Dan Smith <[email protected]>
Date:   Thu Dec 9 15:15:34 2021 -0500

    trying to fine the right macro for SWIG

commit 8d6e11d
Author: Dan Smith <[email protected]>
Date:   Thu Dec 9 14:51:34 2021 -0500

    need updates to Python bindings too

commit e208dd4
Author: Dan Smith <[email protected]>
Date:   Thu Dec 9 14:41:12 2021 -0500

    xml.lite changes from coda-oss

commit 169df75
Author: Dan Smith <[email protected]>
Date:   Wed Dec 8 14:32:37 2021 -0500

    latest from coda-oss
  • Loading branch information
Dan Smith committed Dec 13, 2021
1 parent 1a74d40 commit c9c0ec3
Show file tree
Hide file tree
Showing 8 changed files with 109 additions and 30 deletions.
2 changes: 2 additions & 0 deletions externals/coda-oss/cmake/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,12 @@ These options may be passed in the cmake configure step as `-DOPTION_NAME="optio
|BUILD_SHARED_LIBS|OFF|build shared libraries if on, static if off (note: not working on Windows)|
|STATIC_CRT|OFF|for Windows MSVC builds only, link with /MT (or /MTd for Debug builds) if on, or with /MD (or /MDd for Debug builds) if off|
|CODA_BUILD_TESTS| ON |build tests if on|
|CODA_INSTALL_TESTS| ON |install tests if on|
|CODA_PARTIAL_INSTALL|OFF|make the install target not depend on all defined targets, only the targets which have already been built will be installed; cmake/CodaBuild.cmake for further information and caveats|
|MT_DEFAULT_PINNING|OFF|use affinity-based CPU pinning by default in MT|
|ENABLE_BOOST|OFF|build modules dependent on Boost if enabled|
|ENABLE_PYTHON|ON|build Python modules if enabled|
|ENABLE_SWIG|OFF|enable SWIG bindings generation if enabled, otherwise use previously-generated files|
|ENABLE_JARS|ON|include jars with the install|
|ENABLE_JPEG|ON|build libjpeg driver and modules depending on it|
|ENABLE_J2K|ON|build openjpeg (jpeg2000) driver and modules depending on it|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ static_assert(CODA_OSS_MAKE_VERSION_MMPB(9999, 9999, 9999, 9999) <= UINT64_MAX,

// Do this ala C++ ... we don't currently have major/minor/patch
//#define CODA_OSS_VERSION_ 20210910L // c.f. __cplusplus
#define CODA_OSS_VERSION_ 2021 ## 0011 ## 0001 ## 0000 ## L
#define CODA_OSS_VERSION_ 2021 ## 0012 ## 0013 ## 0000 ## L

// Use the same macros other projects might want to use; overkill for us.
#define CODA_OSS_VERSION_MAJOR 2021
#define CODA_OSS_VERSION_MINOR 11
#define CODA_OSS_VERSION_PATCH 1
#define CODA_OSS_VERSION_MINOR 12
#define CODA_OSS_VERSION_PATCH 13
#define CODA_OSS_VERSION_BUILD 0
#define CODA_OSS_VERSION CODA_OSS_MAKE_VERSION_MMPB(CODA_OSS_VERSION_MAJOR, CODA_OSS_VERSION_MINOR, CODA_OSS_VERSION_PATCH, CODA_OSS_VERSION_BUILD)

Expand Down
32 changes: 13 additions & 19 deletions externals/coda-oss/modules/c++/xml.lite/include/xml/lite/Element.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
#define __XML_LITE_ELEMENT_H__
#pragma once

#include <assert.h>

#include <memory>
#include <string>
#include <new> // std::nothrow_t
Expand Down Expand Up @@ -479,8 +477,7 @@ class Element
const std::string& formatter) const;
};

extern void create(const std::string& name, const std::string& uri, const std::string& value, Element& parent,
Element*& result);
extern Element& create(const std::string& name, const std::string& uri, const std::string& value, Element& parent);

#ifndef SWIG
// The (old) version of SWIG we're using doesn't like certain C++11 features.
Expand Down Expand Up @@ -542,41 +539,38 @@ inline void setValue(Element& element, const T& value)
}

template <typename T, typename ToString>
inline Element& createElement(const std::string& name, const std::string& uri, const T& value, Element& parent,
inline Element& create(const std::string& name, const std::string& uri, const T& value, Element& parent,
ToString toString)
{
Element* retval;
xml::lite::create(name, uri, toString(value), parent, retval);
assert(retval != nullptr);
return *retval;
return create(name, uri, toString(value), parent);
}
template<typename T>
inline Element& createElement(const std::string& name, const std::string& uri, const T& value, Element& parent)
inline Element& create(const std::string& name, const std::string& uri, const T& value, Element& parent)
{
return createElement(name, uri, value, parent, details::toString<T>);
return create(name, uri, value, parent, details::toString<T>);
}

template <typename T, typename ToString>
inline Element& createElement(const std::string& name, const std::string& uri, const sys::Optional<T>& v, Element& parent,
inline Element& create(const std::string& name, const std::string& uri, const sys::Optional<T>& v, Element& parent,
ToString toString)
{
return createElement(name, uri, v.value(), parent, toString);
return create(name, uri, v.value(), parent, toString);
}
template<typename T>
inline Element& createElement(const std::string& name, const std::string& uri, const sys::Optional<T>& v, Element& parent)
inline Element& create(const std::string& name, const std::string& uri, const sys::Optional<T>& v, Element& parent)
{
return createElement(name, uri, v.value(), parent);
return create(name, uri, v.value(), parent);
}
template <typename T, typename ToString>
inline Element* createOptonalElement(const std::string& name, const std::string& uri, const sys::Optional<T>& v, Element& parent,
inline Element* optionalCreate(const std::string& name, const std::string& uri, const sys::Optional<T>& v, Element& parent,
ToString toString)
{
return v.has_value() ? &createElement(name, uri, v, parent, toString) : nullptr;
return v.has_value() ? &create(name, uri, v, parent, toString) : nullptr;
}
template<typename T>
inline Element* createOptonalElement(const std::string& name, const std::string& uri, const sys::Optional<T>& v, Element& parent)
inline Element* optionalCreate(const std::string& name, const std::string& uri, const sys::Optional<T>& v, Element& parent)
{
return v.has_value() ? &createElement(name, uri, v, parent) : nullptr;
return v.has_value() ? &create(name, uri, v, parent) : nullptr;
}

#endif // SWIG
Expand Down
7 changes: 3 additions & 4 deletions externals/coda-oss/modules/c++/xml.lite/source/Element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -531,9 +531,8 @@ void xml::lite::Element::setCharacterData(const sys::U8string& characters)
setCharacterData(str::c_str<std::string::const_pointer>(characters), StringEncoding::Utf8);
}

void xml::lite::create(const std::string& name, const std::string& uri,
const std::string& value, Element& parent, Element* &result)
xml::lite::Element& xml::lite::create(const std::string& name, const std::string& uri,
const std::string& value, Element& parent)
{
auto elem = Element::create(name, uri, value);
result = & parent.addChild(std::move(elem));
return parent.addChild(Element::create(name, uri, value));
}
82 changes: 82 additions & 0 deletions externals/nitro/.regenerate_python_bindings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
from subprocess import check_output, check_call, DEVNULL
import os
import sys
from platform import dist
from sys import stdout
from threading import Timer, Event
import itertools, sys


def thinking(evt):
def thought():
# https://stackoverflow.com/a/22616059/5401366
spinner = itertools.cycle(["-", "/", "|", "\\"])
while not evt.isSet():
stdout.write(next(spinner)) # write the next character
stdout.flush() # flush stdout buffer (actual character display)
stdout.write("\b") # erase the last written char

return thought


def linux_version():
distro, version, _ = dist()
maj_version = version.split(".")[0]
return distro, maj_version


def swig_version():
decoded_result = check_output(["swig", "-version"]).decode("ascii")
return decoded_result.split("\n")[1].split(" ")[-1]


def python(args):

stdout, stderr = (
(sys.stdout, sys.stderr)
if "DEBUG_PY_BINDINGS" in os.environ
else (DEVNULL, DEVNULL)
)

return check_call([sys.executable] + args.split(" "), stdout=stdout, stderr=stderr)


def main():

(distro, major_version) = linux_version()

if distro != "centos" and major_version != "7":
print(
"Found non-standard os %s{}:%s{}, which may introduce subtle differences in generated code; YMMV"
% (distro, major_version)
)

sv = swig_version()
if sv != "3.0.12":
print("Found unapproved swig version '%s'. Output may vary a great deal!" % sv)

print("Thinking about how great cmake is...")

evt = Event()
thread = Timer(0.7, thinking(evt))
thread.start()

try:
python("waf configure --enable-debugging --prefix=installed --enable-swig")
print("Just")

python("waf build")
print("about")

except Exception as e:
print("Thoughts interrupted by: ")
print(e)
finally:
python("waf distclean")
print("done")

evt.set()


if __name__ == "__main__":
main()
4 changes: 3 additions & 1 deletion externals/nitro/modules/c++/nitf-c++.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -386,9 +386,11 @@
<ClInclude Include="nitf\include\nitf\TREs\TREField.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="nitf\include\nitf\Version.hpp" />
<ClInclude Include="nitf\include\nitf\Enum.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="nitf\include\nitf\Version.hpp">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions externals/nitro/modules/c++/nitf/include/nitf/Version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@

#define NITF_VERSION_MAJOR 2
#define NITF_VERSION_MINOR 10
#define NITF_VERSION_PATCH 6
#define NITF_VERSION_BUILD 0
#define NITF_VERSION_PATCH 7
#define NITF_VERSION_BUILD 0
#define NITF_VERSION CODA_OSS_MAKE_VERSION_MMPB(NITF_VERSION_MAJOR, NITF_VERSION_MINOR, NITF_VERSION_PATCH, NITF_VERSION_BUILD)

namespace nitf
Expand Down
2 changes: 1 addition & 1 deletion externals/nitro/modules/c/nrt/include/nrt/Version.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once

#if !defined(NRT_LIB_VERSION)
#define NRT_LIB_VERSION "2.10.6"
#define NRT_LIB_VERSION "2.10.7"
#endif

0 comments on commit c9c0ec3

Please sign in to comment.