You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

169 lines
6.6 KiB

  1. /* /////////////////////////////////////////////////////////////////////////
  2. * File: pantheios/frontends/stock.h
  3. *
  4. * Purpose: Declaration of the Pantheios Stock Front-end API Common
  5. * Elements.
  6. *
  7. * Created: 23rd November 2007
  8. * Updated: 6th August 2012
  9. *
  10. * Home: http://www.pantheios.org/
  11. *
  12. * Copyright (c) 2007-2012, Matthew Wilson and Synesis Software
  13. * All rights reserved.
  14. *
  15. * Redistribution and use in source and binary forms, with or without
  16. * modification, are permitted provided that the following conditions are
  17. * met:
  18. *
  19. * - Redistributions of source code must retain the above copyright notice,
  20. * this list of conditions and the following disclaimer.
  21. * - Redistributions in binary form must reproduce the above copyright
  22. * notice, this list of conditions and the following disclaimer in the
  23. * documentation and/or other materials provided with the distribution.
  24. * - Neither the name(s) of Matthew Wilson and Synesis Software nor the
  25. * names of any contributors may be used to endorse or promote products
  26. * derived from this software without specific prior written permission.
  27. *
  28. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
  29. * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  30. * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  31. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  32. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  33. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  34. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  35. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  36. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  37. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  38. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  39. *
  40. * ////////////////////////////////////////////////////////////////////// */
  41. /** \file pantheios/frontends/stock.h
  42. *
  43. * [C, C++] Declaration of the Pantheios Stock Front-end API Common
  44. * Elements.
  45. */
  46. #ifndef PANTHEIOS_INCL_PANTHEIOS_FRONTENDS_H_STOCK
  47. #define PANTHEIOS_INCL_PANTHEIOS_FRONTENDS_H_STOCK
  48. /* /////////////////////////////////////////////////////////////////////////
  49. * Version information
  50. */
  51. #ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
  52. # define PANTHEIOS_VER_PANTHEIOS_FRONTENDS_H_STOCK_MAJOR 1
  53. # define PANTHEIOS_VER_PANTHEIOS_FRONTENDS_H_STOCK_MINOR 2
  54. # define PANTHEIOS_VER_PANTHEIOS_FRONTENDS_H_STOCK_REVISION 2
  55. # define PANTHEIOS_VER_PANTHEIOS_FRONTENDS_H_STOCK_EDIT 13
  56. #endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
  57. /* /////////////////////////////////////////////////////////////////////////
  58. * Includes
  59. */
  60. #ifndef PANTHEIOS_INCL_PANTHEIOS_H_PANTHEIOS
  61. # include <pantheios/pantheios.h>
  62. #endif /* !PANTHEIOS_INCL_PANTHEIOS_H_PANTHEIOS */
  63. #ifndef PANTHEIOS_INCL_PANTHEIOS_H_FRONTEND
  64. # include <pantheios/frontend.h>
  65. #endif /* !PANTHEIOS_INCL_PANTHEIOS_H_FRONTEND */
  66. /** \defgroup group__frontend__stock_frontends Pantheios Stock Front-ends
  67. * \ingroup group__frontend Pantheios
  68. * Pre-built front-ends supplied with the Pantheios library
  69. *
  70. * Pantheios comes with several pre-written stock front-end libraries, which
  71. * cover most common needs for diagnostic logging. They also serve as good
  72. * examples of how to write a custom front-end.
  73. */
  74. /* /////////////////////////////////////////////////////////////////////////
  75. * Compiler compatibility
  76. */
  77. #if defined(__DMC__) && \
  78. __DMC__ < 0x0850
  79. /* Previous versions of Digital Mars compiler/linker did not operate
  80. * correctly with declaration of extern const char [].
  81. */
  82. # error Not compatible with Digital Mars C/C++ prior to version 8.50. Download the latest free version at www.digitalmars.com
  83. #endif /* compiler */
  84. /* /////////////////////////////////////////////////////////////////////////
  85. * External Declarations
  86. */
  87. /** The application must define this variable, to contain the
  88. * application name/identity.
  89. *
  90. * \ingroup group__frontend__stock_frontends
  91. *
  92. * The variable is an immutable array of <code>PAN_CHAR_T</code> (i.e.
  93. * <code>char</code> in multibyte string builds, <code>wchar_t</code> in
  94. * wide string builds) whose name is non-mangled and has external linkage.
  95. *
  96. * Therefore, when defining within a C++ compilation unit it must be
  97. * declared <code>extern "C"</code>; when defined within a C compilation
  98. * unit it must be extern (optionally declared <code>extern</code>; it
  99. * must not be declared <code>static</code>).
  100. *
  101. * Examples:
  102. \htmlonly
  103. <pre>
  104. // C: multibyte string build
  105. char const PANTHEIOS_FE_PROCESS_IDENTITY[] = "my.app";
  106. // C++: wide string build
  107. extern "C" wchar_t const PANTHEIOS_FE_PROCESS_IDENTITY[] = L"my.app";
  108. </pre>
  109. \endhtmlonly
  110. *
  111. * For convenience, the constructs PANTHEIOS_EXTERN_C, PAN_CHAR_T, and
  112. * PANTHEIOS_LITERAL_STRING() may be employed to write the variable
  113. * definition in a manner independent of language and/or character encoding,
  114. * as in:
  115. \htmlonly
  116. <pre>
  117. /\* C or C++; multibyte or wide string build \*\/
  118. PANTHEIOS_EXTERN_C PAN_CHAR_T const PANTHEIOS_FE_PROCESS_IDENTITY[] = PANTHEIOS_LITERAL_STRING("my.app");
  119. </pre>
  120. \endhtmlonly
  121. *
  122. * \note The process identity must not contain any whitespace characters,
  123. * otherwise Pantheios library initialisation will fail.
  124. *
  125. * \warn If you define the variable as a pointer
  126. * (<code>PAN_CHAR_T const*</code>) the behaviour of the link unit is
  127. * undefined.
  128. */
  129. PANTHEIOS_EXTERN_C PAN_CHAR_T const PANTHEIOS_FE_PROCESS_IDENTITY[];
  130. /* /////////////////////////////////////////////////////////////////////////
  131. * Application-defined functions
  132. */
  133. /** \ref page__frontend__callbacks "Callback" function defined by the
  134. * application, invoked during API initialisation.
  135. *
  136. * \ingroup group__frontend__stock_frontends
  137. *
  138. * \note This function is only required when the
  139. * \ref page__frontend__callbacks "callback" version of the front-end
  140. * library is used.
  141. *
  142. * \note This function *MUST NOT* throw an exception, and *MUST NOT* return
  143. * <code>NULL</code>. If the implementation fails to acquire/produce the
  144. * identity, it must call <code>pantheios_exitProcess(1)</code>. It may
  145. * optionally call <code>pantheios_util_onBailOut4()</code> first.
  146. */
  147. PANTHEIOS_CALL(PAN_CHAR_T const*) pantheios_fe_getAppProcessIdentity(void) /* throw() */;
  148. /* ////////////////////////////////////////////////////////////////////// */
  149. #endif /* PANTHEIOS_INCL_PANTHEIOS_FRONTENDS_H_STOCK */
  150. /* ///////////////////////////// end of file //////////////////////////// */