prvrsion.h (3547B)
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 6 7 /* author: jstewart */ 8 9 #if defined(_PRVERSION_H) 10 #else 11 #define _PRVERSION_H 12 13 #include "prtypes.h" 14 15 PR_BEGIN_EXTERN_C 16 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. 21 */ 22 23 /* on NT, always pack the structure the same. */ 24 #ifdef _WIN32 25 #pragma pack(push, 8) 26 #endif 27 28 typedef struct { 29 /* 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. 33 */ 34 PRInt32 version; 35 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 */ 39 40 PRUint8 vMajor; /* Major version of this component */ 41 PRUint8 vMinor; /* Minor version of this component */ 42 PRUint8 vPatch; /* Patch level of this component */ 43 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 */ 47 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; 55 56 /* on NT, restore the previous packing */ 57 #ifdef _WIN32 58 #pragma pack(pop) 59 #endif 60 61 /* 62 * All components must define an entrypoint named libVersionPoint which 63 * is of type versionEntryPointType. 64 * 65 * For example, for a library named libfoo, we would have: 66 * 67 * PRVersionDescription prVersionDescription_libfoo = 68 * { 69 * ... 70 * }; 71 * 72 * PR_IMPLEMENT(const PRVersionDescription*) libVersionPoint(void) 73 * { 74 * return &prVersionDescription_libfoo; 75 * } 76 */ 77 typedef const PRVersionDescription *(*versionEntryPointType)(void); 78 79 /* 80 * Where you declare your libVersionPoint, do it like this: 81 * PR_IMPLEMENT(const PRVersionDescription *) libVersionPoint(void) { 82 * fill it in... 83 * } 84 */ 85 86 /* 87 * NAMING CONVENTION FOR struct 88 * 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. 98 */ 99 100 PR_END_EXTERN_C 101 102 #endif /* defined(_PRVERSION_H) */ 103 104 /* prvrsion.h */