Showing posts with label extras. Show all posts
Showing posts with label extras. Show all posts

Sunday, September 27, 2015

GitHub access

Pantheios GitHub access now at:




Fork away!

Friday, January 7, 2011

Pantheios::Extras::DiagUtil 0.1.1 (alpha 1)

I've just released the first publicly available version - 0.1.1 (alpha 1) - of Pantheios.Extras.DiagUtil; details here.


It allows a user to replace code such as:

 #if defined(_MSC_VER) && \
     defined(_DEBUG)
 # include <crtdbg.h>
 #endif

 int main(int argc, char** argv)
 {
 #if defined(_MSC_VER) && \
     defined(_DEBUG)
  _CrtMemState  memState;

  _CrtMemCheckpoint(&memState);
 #endif

  int result;

  . . .  // main program logic (which must assign to result)

 #if defined(_MSC_VER) && \
     defined(_DEBUG)

  _CrtMemDumpAllObjectsSince(&memState);
 #endif

  return result;
 }

with:

 #include <pantheios/extras/diagutil.hpp>

 int program(int argc, char** argv)
 {
  . . . // main program logic

  return EXIT_SUCCESS;
 }

 int main(int argc, char** argv)
 {
  return pantheios::extras::diagutil::
           main_leak_trace::invoke(argc, argv, program);
 }

or, if your program is written in C, with:

 #include <pantheios/extras/diagutil.h>

 int program(int argc, char** argv)
 {
  . . . // main program logic

  return EXIT_SUCCESS;
 }

 int main(int argc, char** argv)
 {
  return pantheios_extras_diagutil_main_leak_trace_invoke(
           argc, argv, program);
  }

The immediate advantate is clear: substantially improved transparency in your application code. There are three secondary advantages:
  • you do not need to explicitly conditionally include crtdbg.h
  • the library can be enhanced in the future to work with other compiler-extensions, without requiring any changes to your code
  • you do not have to avoid the use of return statements in your main program logic, and to remember to assign to result

More memory-tracing functionality will appear in forthcoming releases.

Thursday, January 6, 2011

Pantheios::Extras::Main 0.1.1 (alpha 1) released

I've just released the first publicly available version - 0.1.1 (alpha 1) - of Pantheios.Extras.Main; details here.


It allows a user to replace code such as:

char const PROGRAM_NAME[] = "myprogram";

  int main(int argc, char** argv)
  {
    try
    {
      . . . // program logic

      return EXIT_SUCCESS;
    }
    catch(std::bad_alloc&)
    {
      pantheios::logputs(pantheios::alert, "out of memory");
      fprintf(stderr, "%s: out of memory\n", PROGRAM_NAME);
    }
    catch(std::exception& x)
    {
      pantheios::log_CRITICAL(x);
      fprintf(stderr, "%s: %s\n", PROGRAM_NAME, x.what());
    }
    catch(...)
    {
      pantheios::logputs(pantheios::emergency,
        "unexpected unknown failure");
      fprintf(stderr,
        "%s: unexpected unknown failure\n",
        PROGRAM_NAME);
    }

    return EXIT_FAILURE;
  }

with:

char const PROGRAM_NAME[] = "myprogram";

  int program(int argc, char** argv)
  {
    . . . // program logic

    return EXIT_SUCCESS;
  }

  int main(int argc, char** argv)
  {
    return pantheios::extras::main::invoke(argc, argv,
      program, PROGRAM_NAME);
  }

As discussed in the sixth instalment of Quality Matters, Exceptions for Practically-Unrecoverable Conditions, without an exhaustive top-level try-catch statement, program robustness cannot be averred. Pantheios.Extras.Main let's you achieve that in a single statement.

Tuesday, January 4, 2011

Pantheios 1.0.1 beta 208 released

Pantheios 1.0.1 beta 208 is released. It contains:

  • addition of new API function, pantheios_be_file_flush(), to be.file.
  • fix of defect in be.file, whereby interpretation of date/time format specifiers in its file path - a feature added in 1.0.1 beta 197 - failed to add 1900 to year and 1 to month in be.file's
  • changes in names of status codes, removing word ERROR, and replacing with FAILURE.
  • removal of all remaining vestigial uses of magic numbers - principally -1 and -2 - from exception-catch clauses in core and several back-ends, and replacement with suitable status codes (e.g. PANTHEIOS_INIT_RC_UNSPECIFIED_FAILURE).
  • non-functional enhancements to be.N, in preparation for new functionality in a forthcoming release
  • added a new FAQ item (#19), which explains how to use get Pantheios to compile the libraries when using Microsoft Visual C++'s -Zc:wchar_t- flag.
  • removed -D_CRT_SECURE_NO_DEPRECATE from all Visual C++ (8+) makefiles, since all Pantheios (and supporting STLSoft) files are now compatible with Microsoft's "safe string" library.
  • added a new example, example.cpp.util.strdup, illustrating use of utility functions pantheios::util::strdup_throw() and pantheios::util::strdup_nothrow().
  • removed all include/pantheios/extras/* files, which will (re-)appear in separate package distributions henceforth.