Back to index

lightning-sunbird  0.9+nobinonly
prvrsion.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is the Netscape Portable Runtime (NSPR).
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998-2000
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either the GNU General Public License Version 2 or later (the "GPL"), or
00026  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 
00039 /* author: jstewart */
00040 
00041 #if defined(_PRVERSION_H)
00042 #else
00043 #define _PRVERSION_H
00044 
00045 #include "prtypes.h"
00046 
00047 PR_BEGIN_EXTERN_C
00048 
00049 /* All components participating in the PR version protocol must expose
00050  * a structure and a function. The structure is defined below and named
00051  * according to the naming conventions outlined further below.  The function
00052  * is called libVersionPoint and returns a pointer to this structure.
00053  */
00054 
00055 /* on NT, always pack the structure the same. */
00056 #ifdef _WIN32
00057 #pragma pack(push, 8)
00058 #endif
00059 
00060 typedef struct {
00061     /*
00062      * The first field defines which version of this structure is in use.
00063      * At this time, only version 2 is specified. If this value is not 
00064      * 2, you must read no further into the structure.
00065      */
00066     PRInt32    version; 
00067   
00068     /* for Version 2, this is the body format. */
00069     PRInt64         buildTime;      /* 64 bits - usecs since midnight, 1/1/1970 */
00070     char *          buildTimeString;/* a human readable version of the time */
00071   
00072     PRUint8   vMajor;               /* Major version of this component */
00073     PRUint8   vMinor;               /* Minor version of this component */
00074     PRUint8   vPatch;               /* Patch level of this component */
00075   
00076     PRBool          beta;           /* true if this is a beta component */
00077     PRBool          debug;          /* true if this is a debug component */
00078     PRBool          special;        /* true if this component is a special build */
00079   
00080     char *          filename;       /* The original filename */
00081     char *          description;    /* description of this component */
00082     char *          security;       /* level of security in this component */
00083     char *          copyright;      /* The copyright for this file */
00084     char *          comment;        /* free form field for misc usage */
00085     char *          specialString;  /* the special variant for this build */
00086 } PRVersionDescription;
00087 
00088 /* on NT, restore the previous packing */
00089 #ifdef _WIN32
00090 #pragma pack(pop)
00091 #endif
00092 
00093 /*
00094  * All components must define an entrypoint named libVersionPoint which
00095  * is of type versionEntryPointType.
00096  *
00097  * For example, for a library named libfoo, we would have:
00098  *
00099  *   PRVersionDescription prVersionDescription_libfoo =
00100  *   {
00101  *       ...
00102  *   };
00103  *
00104  *   PR_IMPLEMENT(const PRVersionDescription*) libVersionPoint(void)
00105  *   {
00106  *       return &prVersionDescription_libfoo;
00107  *   }
00108  */
00109 typedef const PRVersionDescription *(*versionEntryPointType)(void);
00110 
00111 /* 
00112  * Where you declare your libVersionPoint, do it like this: 
00113  * PR_IMPLEMENT(const PRVersionDescription *) libVersionPoint(void) {
00114  *  fill it in...
00115  * }
00116  */
00117 
00118 /*
00119  * NAMING CONVENTION FOR struct
00120  *
00121  * all components should also expose a static PRVersionDescription
00122  * The name of the struct should be calculated as follows:
00123  * Take the value of filename. (If filename is not specified, calculate
00124  * a short, unique string.)  Convert all non-alphanumeric characters
00125  * to '_'.  To this, prepend "PRVersionDescription_".  Thus for libfoo.so,
00126  * the symbol name is "PRVersionDescription_libfoo_so".
00127  * so the file should have
00128  * PRVersionDescription PRVersionDescription_libfoo_so { fill it in };
00129  * on NT, this file should be declspec export.
00130  */
00131 
00132 PR_END_EXTERN_C
00133 
00134 #endif  /* defined(_PRVERSION_H) */
00135 
00136 /* prvrsion.h */
00137