prvrsion.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3. * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4. *
  5. * The contents of this file are subject to the Mozilla Public License Version
  6. * 1.1 (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. * http://www.mozilla.org/MPL/
  9. *
  10. * Software distributed under the License is distributed on an "AS IS" basis,
  11. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12. * for the specific language governing rights and limitations under the
  13. * License.
  14. *
  15. * The Original Code is the Netscape Portable Runtime (NSPR).
  16. *
  17. * The Initial Developer of the Original Code is
  18. * Netscape Communications Corporation.
  19. * Portions created by the Initial Developer are Copyright (C) 1998-2000
  20. * the Initial Developer. All Rights Reserved.
  21. *
  22. * Contributor(s):
  23. *
  24. * Alternatively, the contents of this file may be used under the terms of
  25. * either the GNU General Public License Version 2 or later (the "GPL"), or
  26. * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27. * in which case the provisions of the GPL or the LGPL are applicable instead
  28. * of those above. If you wish to allow use of your version of this file only
  29. * under the terms of either the GPL or the LGPL, and not to allow others to
  30. * use your version of this file under the terms of the MPL, indicate your
  31. * decision by deleting the provisions above and replace them with the notice
  32. * and other provisions required by the GPL or the LGPL. If you do not delete
  33. * the provisions above, a recipient may use your version of this file under
  34. * the terms of any one of the MPL, the GPL or the LGPL.
  35. *
  36. * ***** END LICENSE BLOCK ***** */
  37. /* author: jstewart */
  38. #if defined(_PRVERSION_H)
  39. #else
  40. #define _PRVERSION_H
  41. #include "prtypes.h"
  42. PR_BEGIN_EXTERN_C
  43. /* All components participating in the PR version protocol must expose
  44. * a structure and a function. The structure is defined below and named
  45. * according to the naming conventions outlined further below. The function
  46. * is called libVersionPoint and returns a pointer to this structure.
  47. */
  48. /* on NT, always pack the structure the same. */
  49. #ifdef _WIN32
  50. #pragma pack(push, 8)
  51. #endif
  52. typedef struct {
  53. /*
  54. * The first field defines which version of this structure is in use.
  55. * At this time, only version 2 is specified. If this value is not
  56. * 2, you must read no further into the structure.
  57. */
  58. PRInt32 version;
  59. /* for Version 2, this is the body format. */
  60. PRInt64 buildTime; /* 64 bits - usecs since midnight, 1/1/1970 */
  61. char * buildTimeString;/* a human readable version of the time */
  62. PRUint8 vMajor; /* Major version of this component */
  63. PRUint8 vMinor; /* Minor version of this component */
  64. PRUint8 vPatch; /* Patch level of this component */
  65. PRBool beta; /* true if this is a beta component */
  66. PRBool debug; /* true if this is a debug component */
  67. PRBool special; /* true if this component is a special build */
  68. char * filename; /* The original filename */
  69. char * description; /* description of this component */
  70. char * security; /* level of security in this component */
  71. char * copyright; /* The copyright for this file */
  72. char * comment; /* free form field for misc usage */
  73. char * specialString; /* the special variant for this build */
  74. } PRVersionDescription;
  75. /* on NT, restore the previous packing */
  76. #ifdef _WIN32
  77. #pragma pack(pop)
  78. #endif
  79. /*
  80. * All components must define an entrypoint named libVersionPoint which
  81. * is of type versionEntryPointType.
  82. *
  83. * For example, for a library named libfoo, we would have:
  84. *
  85. * PRVersionDescription prVersionDescription_libfoo =
  86. * {
  87. * ...
  88. * };
  89. *
  90. * PR_IMPLEMENT(const PRVersionDescription*) libVersionPoint(void)
  91. * {
  92. * return &prVersionDescription_libfoo;
  93. * }
  94. */
  95. typedef const PRVersionDescription *(*versionEntryPointType)(void);
  96. /*
  97. * Where you declare your libVersionPoint, do it like this:
  98. * PR_IMPLEMENT(const PRVersionDescription *) libVersionPoint(void) {
  99. * fill it in...
  100. * }
  101. */
  102. /*
  103. * NAMING CONVENTION FOR struct
  104. *
  105. * all components should also expose a static PRVersionDescription
  106. * The name of the struct should be calculated as follows:
  107. * Take the value of filename. (If filename is not specified, calculate
  108. * a short, unique string.) Convert all non-alphanumeric characters
  109. * to '_'. To this, prepend "PRVersionDescription_". Thus for libfoo.so,
  110. * the symbol name is "PRVersionDescription_libfoo_so".
  111. * so the file should have
  112. * PRVersionDescription PRVersionDescription_libfoo_so { fill it in };
  113. * on NT, this file should be declspec export.
  114. */
  115. PR_END_EXTERN_C
  116. #endif /* defined(_PRVERSION_H) */
  117. /* prvrsion.h */