prvrsion.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. /* author: jstewart */
  6. #if defined(_PRVERSION_H)
  7. #else
  8. #define _PRVERSION_H
  9. #include "prtypes.h"
  10. PR_BEGIN_EXTERN_C
  11. /* All components participating in the PR version protocol must expose
  12. * a structure and a function. The structure is defined below and named
  13. * according to the naming conventions outlined further below. The function
  14. * is called libVersionPoint and returns a pointer to this structure.
  15. */
  16. /* on NT, always pack the structure the same. */
  17. #ifdef _WIN32
  18. #pragma pack(push, 8)
  19. #endif
  20. typedef struct {
  21. /*
  22. * The first field defines which version of this structure is in use.
  23. * At this time, only version 2 is specified. If this value is not
  24. * 2, you must read no further into the structure.
  25. */
  26. PRInt32 version;
  27. /* for Version 2, this is the body format. */
  28. PRInt64 buildTime; /* 64 bits - usecs since midnight, 1/1/1970 */
  29. char * buildTimeString;/* a human readable version of the time */
  30. PRUint8 vMajor; /* Major version of this component */
  31. PRUint8 vMinor; /* Minor version of this component */
  32. PRUint8 vPatch; /* Patch level of this component */
  33. PRBool beta; /* true if this is a beta component */
  34. PRBool debug; /* true if this is a debug component */
  35. PRBool special; /* true if this component is a special build */
  36. char * filename; /* The original filename */
  37. char * description; /* description of this component */
  38. char * security; /* level of security in this component */
  39. char * copyright; /* The copyright for this file */
  40. char * comment; /* free form field for misc usage */
  41. char * specialString; /* the special variant for this build */
  42. } PRVersionDescription;
  43. /* on NT, restore the previous packing */
  44. #ifdef _WIN32
  45. #pragma pack(pop)
  46. #endif
  47. /*
  48. * All components must define an entrypoint named libVersionPoint which
  49. * is of type versionEntryPointType.
  50. *
  51. * For example, for a library named libfoo, we would have:
  52. *
  53. * PRVersionDescription prVersionDescription_libfoo =
  54. * {
  55. * ...
  56. * };
  57. *
  58. * PR_IMPLEMENT(const PRVersionDescription*) libVersionPoint(void)
  59. * {
  60. * return &prVersionDescription_libfoo;
  61. * }
  62. */
  63. typedef const PRVersionDescription *(*versionEntryPointType)(void);
  64. /*
  65. * Where you declare your libVersionPoint, do it like this:
  66. * PR_IMPLEMENT(const PRVersionDescription *) libVersionPoint(void) {
  67. * fill it in...
  68. * }
  69. */
  70. /*
  71. * NAMING CONVENTION FOR struct
  72. *
  73. * all components should also expose a static PRVersionDescription
  74. * The name of the struct should be calculated as follows:
  75. * Take the value of filename. (If filename is not specified, calculate
  76. * a short, unique string.) Convert all non-alphanumeric characters
  77. * to '_'. To this, prepend "PRVersionDescription_". Thus for libfoo.so,
  78. * the symbol name is "PRVersionDescription_libfoo_so".
  79. * so the file should have
  80. * PRVersionDescription PRVersionDescription_libfoo_so { fill it in };
  81. * on NT, this file should be declspec export.
  82. */
  83. PR_END_EXTERN_C
  84. #endif /* defined(_PRVERSION_H) */
  85. /* prvrsion.h */