nsprpub/pr/include/prvrsion.h

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rwxr-xr-x

Integrate suggestion from review to improve consistency with existing code.

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

mercurial