Bug 801227: Patch v2 (unbitrotted) r=anant a=abillings
[gecko.git] / nsprpub / pr / include / prvrsion.h
bloba8415b2a08e11ba35019a232fe8cc17101e19f48
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/. */
7 /* author: jstewart */
9 #if defined(_PRVERSION_H)
10 #else
11 #define _PRVERSION_H
13 #include "prtypes.h"
15 PR_BEGIN_EXTERN_C
17 /* All components participating in the PR version protocol must expose
18 * a structure and a function. The structure is defined below and named
19 * according to the naming conventions outlined further below. The function
20 * is called libVersionPoint and returns a pointer to this structure.
23 /* on NT, always pack the structure the same. */
24 #ifdef _WIN32
25 #pragma pack(push, 8)
26 #endif
28 typedef struct {
30 * The first field defines which version of this structure is in use.
31 * At this time, only version 2 is specified. If this value is not
32 * 2, you must read no further into the structure.
34 PRInt32 version;
36 /* for Version 2, this is the body format. */
37 PRInt64 buildTime; /* 64 bits - usecs since midnight, 1/1/1970 */
38 char * buildTimeString;/* a human readable version of the time */
40 PRUint8 vMajor; /* Major version of this component */
41 PRUint8 vMinor; /* Minor version of this component */
42 PRUint8 vPatch; /* Patch level of this component */
44 PRBool beta; /* true if this is a beta component */
45 PRBool debug; /* true if this is a debug component */
46 PRBool special; /* true if this component is a special build */
48 char * filename; /* The original filename */
49 char * description; /* description of this component */
50 char * security; /* level of security in this component */
51 char * copyright; /* The copyright for this file */
52 char * comment; /* free form field for misc usage */
53 char * specialString; /* the special variant for this build */
54 } PRVersionDescription;
56 /* on NT, restore the previous packing */
57 #ifdef _WIN32
58 #pragma pack(pop)
59 #endif
62 * All components must define an entrypoint named libVersionPoint which
63 * is of type versionEntryPointType.
65 * For example, for a library named libfoo, we would have:
67 * PRVersionDescription prVersionDescription_libfoo =
68 * {
69 * ...
70 * };
72 * PR_IMPLEMENT(const PRVersionDescription*) libVersionPoint(void)
73 * {
74 * return &prVersionDescription_libfoo;
75 * }
77 typedef const PRVersionDescription *(*versionEntryPointType)(void);
79 /*
80 * Where you declare your libVersionPoint, do it like this:
81 * PR_IMPLEMENT(const PRVersionDescription *) libVersionPoint(void) {
82 * fill it in...
83 * }
87 * NAMING CONVENTION FOR struct
89 * all components should also expose a static PRVersionDescription
90 * The name of the struct should be calculated as follows:
91 * Take the value of filename. (If filename is not specified, calculate
92 * a short, unique string.) Convert all non-alphanumeric characters
93 * to '_'. To this, prepend "PRVersionDescription_". Thus for libfoo.so,
94 * the symbol name is "PRVersionDescription_libfoo_so".
95 * so the file should have
96 * PRVersionDescription PRVersionDescription_libfoo_so { fill it in };
97 * on NT, this file should be declspec export.
100 PR_END_EXTERN_C
102 #endif /* defined(_PRVERSION_H) */
104 /* prvrsion.h */