andre@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ andre@0: /* This Source Code Form is subject to the terms of the Mozilla Public andre@0: * License, v. 2.0. If a copy of the MPL was not distributed with this andre@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ andre@0: andre@0: andre@0: /* author: jstewart */ andre@0: andre@0: #if defined(_PRVERSION_H) andre@0: #else andre@0: #define _PRVERSION_H andre@0: andre@0: #include "prtypes.h" andre@0: andre@0: PR_BEGIN_EXTERN_C andre@0: andre@0: /* All components participating in the PR version protocol must expose andre@0: * a structure and a function. The structure is defined below and named andre@0: * according to the naming conventions outlined further below. The function andre@0: * is called libVersionPoint and returns a pointer to this structure. andre@0: */ andre@0: andre@0: /* on NT, always pack the structure the same. */ andre@0: #ifdef _WIN32 andre@0: #pragma pack(push, 8) andre@0: #endif andre@0: andre@0: typedef struct { andre@0: /* andre@0: * The first field defines which version of this structure is in use. andre@0: * At this time, only version 2 is specified. If this value is not andre@0: * 2, you must read no further into the structure. andre@0: */ andre@0: PRInt32 version; andre@0: andre@0: /* for Version 2, this is the body format. */ andre@0: PRInt64 buildTime; /* 64 bits - usecs since midnight, 1/1/1970 */ andre@0: char * buildTimeString;/* a human readable version of the time */ andre@0: andre@0: PRUint8 vMajor; /* Major version of this component */ andre@0: PRUint8 vMinor; /* Minor version of this component */ andre@0: PRUint8 vPatch; /* Patch level of this component */ andre@0: andre@0: PRBool beta; /* true if this is a beta component */ andre@0: PRBool debug; /* true if this is a debug component */ andre@0: PRBool special; /* true if this component is a special build */ andre@0: andre@0: char * filename; /* The original filename */ andre@0: char * description; /* description of this component */ andre@0: char * security; /* level of security in this component */ andre@0: char * copyright; /* The copyright for this file */ andre@0: char * comment; /* free form field for misc usage */ andre@0: char * specialString; /* the special variant for this build */ andre@0: } PRVersionDescription; andre@0: andre@0: /* on NT, restore the previous packing */ andre@0: #ifdef _WIN32 andre@0: #pragma pack(pop) andre@0: #endif andre@0: andre@0: /* andre@0: * All components must define an entrypoint named libVersionPoint which andre@0: * is of type versionEntryPointType. andre@0: * andre@0: * For example, for a library named libfoo, we would have: andre@0: * andre@0: * PRVersionDescription prVersionDescription_libfoo = andre@0: * { andre@0: * ... andre@0: * }; andre@0: * andre@0: * PR_IMPLEMENT(const PRVersionDescription*) libVersionPoint(void) andre@0: * { andre@0: * return &prVersionDescription_libfoo; andre@0: * } andre@0: */ andre@0: typedef const PRVersionDescription *(*versionEntryPointType)(void); andre@0: andre@0: /* andre@0: * Where you declare your libVersionPoint, do it like this: andre@0: * PR_IMPLEMENT(const PRVersionDescription *) libVersionPoint(void) { andre@0: * fill it in... andre@0: * } andre@0: */ andre@0: andre@0: /* andre@0: * NAMING CONVENTION FOR struct andre@0: * andre@0: * all components should also expose a static PRVersionDescription andre@0: * The name of the struct should be calculated as follows: andre@0: * Take the value of filename. (If filename is not specified, calculate andre@0: * a short, unique string.) Convert all non-alphanumeric characters andre@0: * to '_'. To this, prepend "PRVersionDescription_". Thus for libfoo.so, andre@0: * the symbol name is "PRVersionDescription_libfoo_so". andre@0: * so the file should have andre@0: * PRVersionDescription PRVersionDescription_libfoo_so { fill it in }; andre@0: * on NT, this file should be declspec export. andre@0: */ andre@0: andre@0: PR_END_EXTERN_C andre@0: andre@0: #endif /* defined(_PRVERSION_H) */ andre@0: andre@0: /* prvrsion.h */ andre@0: