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