nsprpub/pr/include/prvrsion.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/nsprpub/pr/include/prvrsion.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,105 @@
     1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +
    1.10 +/* author: jstewart */
    1.11 +
    1.12 +#if defined(_PRVERSION_H)
    1.13 +#else
    1.14 +#define _PRVERSION_H
    1.15 +
    1.16 +#include "prtypes.h"
    1.17 +
    1.18 +PR_BEGIN_EXTERN_C
    1.19 +
    1.20 +/* All components participating in the PR version protocol must expose
    1.21 + * a structure and a function. The structure is defined below and named
    1.22 + * according to the naming conventions outlined further below.  The function
    1.23 + * is called libVersionPoint and returns a pointer to this structure.
    1.24 + */
    1.25 +
    1.26 +/* on NT, always pack the structure the same. */
    1.27 +#ifdef _WIN32
    1.28 +#pragma pack(push, 8)
    1.29 +#endif
    1.30 +
    1.31 +typedef struct {
    1.32 +    /*
    1.33 +     * The first field defines which version of this structure is in use.
    1.34 +     * At this time, only version 2 is specified. If this value is not 
    1.35 +     * 2, you must read no further into the structure.
    1.36 +     */
    1.37 +    PRInt32    version; 
    1.38 +  
    1.39 +    /* for Version 2, this is the body format. */
    1.40 +    PRInt64         buildTime;      /* 64 bits - usecs since midnight, 1/1/1970 */
    1.41 +    char *          buildTimeString;/* a human readable version of the time */
    1.42 +  
    1.43 +    PRUint8   vMajor;               /* Major version of this component */
    1.44 +    PRUint8   vMinor;               /* Minor version of this component */
    1.45 +    PRUint8   vPatch;               /* Patch level of this component */
    1.46 +  
    1.47 +    PRBool          beta;           /* true if this is a beta component */
    1.48 +    PRBool          debug;          /* true if this is a debug component */
    1.49 +    PRBool          special;        /* true if this component is a special build */
    1.50 +  
    1.51 +    char *          filename;       /* The original filename */
    1.52 +    char *          description;    /* description of this component */
    1.53 +    char *          security;       /* level of security in this component */
    1.54 +    char *          copyright;      /* The copyright for this file */
    1.55 +    char *          comment;        /* free form field for misc usage */
    1.56 +    char *          specialString;  /* the special variant for this build */
    1.57 +} PRVersionDescription;
    1.58 +
    1.59 +/* on NT, restore the previous packing */
    1.60 +#ifdef _WIN32
    1.61 +#pragma pack(pop)
    1.62 +#endif
    1.63 +
    1.64 +/*
    1.65 + * All components must define an entrypoint named libVersionPoint which
    1.66 + * is of type versionEntryPointType.
    1.67 + *
    1.68 + * For example, for a library named libfoo, we would have:
    1.69 + *
    1.70 + *   PRVersionDescription prVersionDescription_libfoo =
    1.71 + *   {
    1.72 + *       ...
    1.73 + *   };
    1.74 + *
    1.75 + *   PR_IMPLEMENT(const PRVersionDescription*) libVersionPoint(void)
    1.76 + *   {
    1.77 + *       return &prVersionDescription_libfoo;
    1.78 + *   }
    1.79 + */
    1.80 +typedef const PRVersionDescription *(*versionEntryPointType)(void);
    1.81 +
    1.82 +/* 
    1.83 + * Where you declare your libVersionPoint, do it like this: 
    1.84 + * PR_IMPLEMENT(const PRVersionDescription *) libVersionPoint(void) {
    1.85 + *  fill it in...
    1.86 + * }
    1.87 + */
    1.88 +
    1.89 +/*
    1.90 + * NAMING CONVENTION FOR struct
    1.91 + *
    1.92 + * all components should also expose a static PRVersionDescription
    1.93 + * The name of the struct should be calculated as follows:
    1.94 + * Take the value of filename. (If filename is not specified, calculate
    1.95 + * a short, unique string.)  Convert all non-alphanumeric characters
    1.96 + * to '_'.  To this, prepend "PRVersionDescription_".  Thus for libfoo.so,
    1.97 + * the symbol name is "PRVersionDescription_libfoo_so".
    1.98 + * so the file should have
    1.99 + * PRVersionDescription PRVersionDescription_libfoo_so { fill it in };
   1.100 + * on NT, this file should be declspec export.
   1.101 + */
   1.102 +
   1.103 +PR_END_EXTERN_C
   1.104 +
   1.105 +#endif  /* defined(_PRVERSION_H) */
   1.106 +
   1.107 +/* prvrsion.h */
   1.108 +

mercurial