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