LCOV - code coverage report
Current view: directory - objdir/dist/include - xpt_struct.h (source / functions) Found Hit Coverage
Test: app.info Lines: 20 3 15.0 %
Date: 2012-06-02 Functions: 20 3 15.0 %

       1                 : /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       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 mozilla.org code.
      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
      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 of the GNU General Public License Version 2 or later (the "GPL"),
      26                 :  * or 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                 :  * Structures matching the in-memory representation of typelib structures.
      40                 :  * http://www.mozilla.org/scriptable/typelib_file.html
      41                 :  */
      42                 : 
      43                 : #ifndef __xpt_struct_h__
      44                 : #define __xpt_struct_h__
      45                 : 
      46                 : #include "xpt_arena.h"
      47                 : 
      48                 : PR_BEGIN_EXTERN_C
      49                 : 
      50                 : /*
      51                 :  * Originally, I was going to have structures that exactly matched the on-disk
      52                 :  * representation, but that proved difficult: different compilers can pack
      53                 :  * their structs differently, and that makes overlaying them atop a
      54                 :  * read-from-disk byte buffer troublesome.  So now I just have some structures
      55                 :  * that are used in memory, and we're going to write a nice XDR library to
      56                 :  * write them to disk and stuff.  It is pure joy. -- shaver
      57                 :  */
      58                 : 
      59                 : /* Structures for the typelib components */
      60                 : 
      61                 : typedef struct XPTHeader XPTHeader;
      62                 : typedef struct XPTInterfaceDirectoryEntry XPTInterfaceDirectoryEntry;
      63                 : typedef struct XPTInterfaceDescriptor XPTInterfaceDescriptor;
      64                 : typedef struct XPTConstDescriptor XPTConstDescriptor;
      65                 : typedef struct XPTMethodDescriptor XPTMethodDescriptor;
      66                 : typedef struct XPTParamDescriptor XPTParamDescriptor;
      67                 : typedef struct XPTTypeDescriptor XPTTypeDescriptor;
      68                 : typedef struct XPTTypeDescriptorPrefix XPTTypeDescriptorPrefix;
      69                 : typedef struct XPTString XPTString;
      70                 : typedef struct XPTAnnotation XPTAnnotation;
      71                 : #ifndef nsID_h__
      72                 : /*
      73                 :  * We can't include nsID.h, because it's full of C++ goop and we're not doing
      74                 :  * C++ here, so we define our own minimal struct.  We protect against multiple
      75                 :  * definitions of this struct, though, and use the same field naming.
      76                 :  */
      77                 : struct nsID {
      78                 :     PRUint32 m0;
      79                 :     PRUint16 m1;
      80                 :     PRUint16 m2;
      81                 :     PRUint8  m3[8];
      82                 : };
      83                 : 
      84                 : typedef struct nsID nsID;
      85                 : #endif
      86                 : 
      87                 : #define XPT_COPY_IID(to, from)                                                \
      88                 :   (to).m0 = (from).m0;                                                        \
      89                 :   (to).m1 = (from).m1;                                                        \
      90                 :   (to).m2 = (from).m2;                                                        \
      91                 :   (to).m3[0] = (from).m3[0];                                                  \
      92                 :   (to).m3[1] = (from).m3[1];                                                  \
      93                 :   (to).m3[2] = (from).m3[2];                                                  \
      94                 :   (to).m3[3] = (from).m3[3];                                                  \
      95                 :   (to).m3[4] = (from).m3[4];                                                  \
      96                 :   (to).m3[5] = (from).m3[5];                                                  \
      97                 :   (to).m3[6] = (from).m3[6];                                                  \
      98                 :   (to).m3[7] = (from).m3[7];
      99                 : 
     100                 : 
     101                 : /*
     102                 :  * Every XPCOM typelib file begins with a header.
     103                 :  */
     104                 : struct XPTHeader {
     105                 :     PRUint8                     magic[16];
     106                 :     PRUint8                     major_version;
     107                 :     PRUint8                     minor_version;
     108                 :     PRUint16                    num_interfaces;
     109                 :     PRUint32                    file_length;
     110                 :     XPTInterfaceDirectoryEntry  *interface_directory;
     111                 :     PRUint32                    data_pool;
     112                 :     XPTAnnotation               *annotations;
     113                 : };
     114                 : 
     115                 : #define XPT_MAGIC "XPCOM\nTypeLib\r\n\032"
     116                 : /* For error messages. */
     117                 : #define XPT_MAGIC_STRING "XPCOM\\nTypeLib\\r\\n\\032"
     118                 : #define XPT_MAJOR_VERSION 0x01
     119                 : #define XPT_MINOR_VERSION 0x02
     120                 : 
     121                 : /* Any file with a major version number of XPT_MAJOR_INCOMPATIBLE_VERSION 
     122                 :  * or higher is to be considered incompatible by this version of xpt and
     123                 :  * we will refuse to read it. We will return a header with magic, major and
     124                 :  * minor versions set from the file. num_interfaces and file_length will be
     125                 :  * set to zero to confirm our inability to read the file; i.e. even if some
     126                 :  * client of this library gets out of sync with us regarding the agreed upon
     127                 :  * value for XPT_MAJOR_INCOMPATIBLE_VERSION, anytime num_interfaces and
     128                 :  * file_length are both zero we *know* that this library refused to read the 
     129                 :  * file due to version imcompatibility.  
     130                 :  */
     131                 : #define XPT_MAJOR_INCOMPATIBLE_VERSION 0x02
     132                 : 
     133                 : /*
     134                 :  * The "[-t version number]" cmd line parameter to the XPIDL compiler and XPT
     135                 :  * linker specifies the major and minor version number of the output 
     136                 :  * type library.
     137                 :  * 
     138                 :  * The goal is for the compiler to check that the input IDL file only uses 
     139                 :  * constructs that are supported in the version specified. The linker will
     140                 :  * check that all typelib files it reads are of the version specified or
     141                 :  * below.
     142                 :  * 
     143                 :  * Both the compiler and the linker will report errors and abort if these
     144                 :  * checks fail.
     145                 :  * 
     146                 :  * When you rev up major or minor versions of the type library in the future,
     147                 :  * think about the new stuff that you added to the type library and add checks
     148                 :  * to make sure that occurrences of that new "stuff" will get caught when [-t
     149                 :  * version number] is used with the compiler. Here's what you'll probably
     150                 :  * have to do each time you rev up major/minor versions:
     151                 :  * 
     152                 :  *   1) Add the current version number string (before your change) to the
     153                 :  *   XPT_TYPELIB_VERSIONS list.
     154                 :  * 
     155                 :  *   2) Do your changes add new features to XPIDL? Ensure that those new
     156                 :  *   features are rejected by the XPIDL compiler when any version number in
     157                 :  *   the XPT_TYPELIB_VERSIONS list is specified on the command line. The
     158                 :  *   one place that currently does this kind of error checking is the function
     159                 :  *   verify_type_fits_version() in xpidl_util.c. It currently checks
     160                 :  *   attribute types, parameter types, and return types. You'll probably have
     161                 :  *   to add to it or generalize it further based on what kind of changes you
     162                 :  *   are making.
     163                 :  *
     164                 :  *   3) You will probably NOT need to make any changes to the error checking
     165                 :  *   in the linker.
     166                 :  */
     167                 :   
     168                 : #define XPT_VERSION_UNKNOWN     0
     169                 : #define XPT_VERSION_UNSUPPORTED 1
     170                 : #define XPT_VERSION_OLD         2
     171                 : #define XPT_VERSION_CURRENT     3
     172                 : 
     173                 : typedef struct {
     174                 :     const char* str;
     175                 :     PRUint8     major;
     176                 :     PRUint8     minor;
     177                 :     PRUint16    code;
     178                 : } XPT_TYPELIB_VERSIONS_STRUCT; 
     179                 : 
     180                 : /* Currently accepted list of versions for typelibs */
     181                 : #define XPT_TYPELIB_VERSIONS {                                                \
     182                 :     {"1.0", 1, 0, XPT_VERSION_UNSUPPORTED},                                   \
     183                 :     {"1.1", 1, 1, XPT_VERSION_OLD},                                           \
     184                 :     {"1.2", 1, 2, XPT_VERSION_CURRENT}                                        \
     185                 : }
     186                 : 
     187                 : extern XPT_PUBLIC_API(PRUint16)
     188               0 : XPT_ParseVersionString(const char* str, PRUint8* major, PRUint8* minor);
     189                 : 
     190                 : extern XPT_PUBLIC_API(XPTHeader *)
     191               0 : XPT_NewHeader(XPTArena *arena, PRUint16 num_interfaces, 
     192                 :               PRUint8 major_version, PRUint8 minor_version);
     193                 : 
     194                 : extern XPT_PUBLIC_API(void)
     195               0 : XPT_FreeHeader(XPTArena *arena, XPTHeader* aHeader);
     196                 : 
     197                 : /* size of header and annotations */
     198                 : extern XPT_PUBLIC_API(PRUint32)
     199               0 : XPT_SizeOfHeader(XPTHeader *header);
     200                 : 
     201                 : /* size of header and annotations and InterfaceDirectoryEntries */
     202                 : extern XPT_PUBLIC_API(PRUint32)
     203               0 : XPT_SizeOfHeaderBlock(XPTHeader *header);
     204                 : 
     205                 : /*
     206                 :  * A contiguous array of fixed-size InterfaceDirectoryEntry records begins at 
     207                 :  * the byte offset identified by the interface_directory field in the file 
     208                 :  * header.  The array is used to quickly locate an interface description 
     209                 :  * using its IID.  No interface should appear more than once in the array.
     210                 :  */
     211                 : struct XPTInterfaceDirectoryEntry {
     212                 :     nsID                   iid;
     213                 :     char                   *name;
     214                 :     char                   *name_space;
     215                 :     XPTInterfaceDescriptor *interface_descriptor;
     216                 : 
     217                 : #if 0 /* not yet */
     218                 :     /* not stored on disk */
     219                 :     PRUint32                 offset; /* the offset for an ID still to be read */
     220                 : #endif
     221                 : };
     222                 : 
     223                 : extern XPT_PUBLIC_API(PRBool)
     224               0 : XPT_FillInterfaceDirectoryEntry(XPTArena *arena, 
     225                 :                                 XPTInterfaceDirectoryEntry *ide,
     226                 :                                 nsID *iid, char *name, char *name_space,
     227                 :                                 XPTInterfaceDescriptor *descriptor);
     228                 : 
     229                 : extern XPT_PUBLIC_API(void)
     230               0 : XPT_DestroyInterfaceDirectoryEntry(XPTArena *arena, 
     231                 :                                    XPTInterfaceDirectoryEntry* ide);
     232                 : 
     233                 : /*
     234                 :  * An InterfaceDescriptor is a variable-size record used to describe a 
     235                 :  * single XPCOM interface, including all of its methods. 
     236                 :  */
     237                 : struct XPTInterfaceDescriptor {
     238                 :     PRUint16                parent_interface;
     239                 :     PRUint16                num_methods;
     240                 :     XPTMethodDescriptor     *method_descriptors;
     241                 :     PRUint16                num_constants;
     242                 :     XPTConstDescriptor      *const_descriptors;
     243                 :     PRUint8                 flags;
     244                 : 
     245                 :     /* additional_types are used for arrays where we may need multiple
     246                 :     *  XPTTypeDescriptors for a single XPTMethodDescriptor. Since we still
     247                 :     *  want to have a simple array of XPTMethodDescriptor (each with a single
     248                 :     *  embedded XPTTypeDescriptor), a XPTTypeDescriptor can have a reference
     249                 :     *  to an 'additional_type'. That reference is an index in this 
     250                 :     *  "additional_types" array. So a given XPTMethodDescriptor might have 
     251                 :     *  a whole chain of these XPTTypeDescriptors to represent, say, a multi
     252                 :     *  dimensional array.
     253                 :     *
     254                 :     *  Note that in the typelib file these additional types are stored 'inline'
     255                 :     *  in the MethodDescriptor. But, in the typelib MethodDescriptors can be 
     256                 :     *  of varying sizes, where in XPT's in memory mapping of the data we want 
     257                 :     *  them to be of fixed size. This additional_types scheme is here to allow 
     258                 :     *  for that.
     259                 :     */
     260                 : 
     261                 :     XPTTypeDescriptor       *additional_types;
     262                 :     PRUint16                num_additional_types;
     263                 : };
     264                 : 
     265                 : #define XPT_ID_SCRIPTABLE           0x80
     266                 : #define XPT_ID_FUNCTION             0x40
     267                 : #define XPT_ID_BUILTINCLASS         0x20
     268                 : #define XPT_ID_FLAGMASK             0xe0
     269                 : #define XPT_ID_TAGMASK              (~XPT_ID_FLAGMASK)
     270                 : #define XPT_ID_TAG(id)              ((id).flags & XPT_ID_TAGMASK)
     271                 : 
     272                 : #define XPT_ID_IS_SCRIPTABLE(flags) (!!(flags & XPT_ID_SCRIPTABLE))
     273                 : #define XPT_ID_IS_FUNCTION(flags) (!!(flags & XPT_ID_FUNCTION))
     274                 : #define XPT_ID_IS_BUILTINCLASS(flags) (!!(flags & XPT_ID_BUILTINCLASS))
     275                 : 
     276                 : extern XPT_PUBLIC_API(PRBool)
     277               0 : XPT_GetInterfaceIndexByName(XPTInterfaceDirectoryEntry *ide_block,
     278                 :                             PRUint16 num_interfaces, char *name, 
     279                 :                             PRUint16 *indexp);
     280                 : 
     281                 : extern XPT_PUBLIC_API(XPTInterfaceDescriptor *)
     282               0 : XPT_NewInterfaceDescriptor(XPTArena *arena, 
     283                 :                            PRUint16 parent_interface, PRUint16 num_methods,
     284                 :                            PRUint16 num_constants, PRUint8 flags);
     285                 : 
     286                 : extern XPT_PUBLIC_API(void)
     287               0 : XPT_FreeInterfaceDescriptor(XPTArena *arena, XPTInterfaceDescriptor* id);
     288                 : 
     289                 : extern XPT_PUBLIC_API(PRBool)
     290          252654 : XPT_InterfaceDescriptorAddTypes(XPTArena *arena, XPTInterfaceDescriptor *id, 
     291                 :                                 PRUint16 num);
     292                 : 
     293                 : extern XPT_PUBLIC_API(PRBool)
     294               0 : XPT_InterfaceDescriptorAddMethods(XPTArena *arena, XPTInterfaceDescriptor *id, 
     295                 :                                   PRUint16 num);
     296                 : 
     297                 : extern XPT_PUBLIC_API(PRBool)
     298               0 : XPT_InterfaceDescriptorAddConsts(XPTArena *arena, XPTInterfaceDescriptor *id, 
     299                 :                                  PRUint16 num);
     300                 : 
     301                 : /*
     302                 :  * This is our special string struct with a length value associated with it,
     303                 :  * which means that it can contains embedded NULs.
     304                 :  */
     305                 : struct XPTString {
     306                 :     PRUint16 length;
     307                 :     char   *bytes;
     308                 : };
     309                 : 
     310                 : extern XPT_PUBLIC_API(XPTString *)
     311               0 : XPT_NewString(XPTArena *arena, PRUint16 length, char *bytes);
     312                 : 
     313                 : extern XPT_PUBLIC_API(XPTString *)
     314               0 : XPT_NewStringZ(XPTArena *arena, char *bytes);
     315                 : 
     316                 : /* 
     317                 :  * A TypeDescriptor is a variable-size record used to identify the type of a 
     318                 :  * method argument or return value. 
     319                 :  *
     320                 :  * There are three types of TypeDescriptors:
     321                 :  *
     322                 :  * SimpleTypeDescriptor
     323                 :  * InterfaceTypeDescriptor
     324                 :  * InterfaceIsTypeDescriptor
     325                 :  *
     326                 :  * The tag field in the prefix indicates which of the variant TypeDescriptor 
     327                 :  * records is being used, and hence the way any remaining fields should be 
     328                 :  * parsed. Values from 0 to 17 refer to SimpleTypeDescriptors. The value 18 
     329                 :  * designates an InterfaceTypeDescriptor, while 19 represents an 
     330                 :  * InterfaceIsTypeDescriptor.
     331                 :  */
     332                 : 
     333                 : /* why bother with a struct?  - other code relies on this being a struct */
     334        70798341 : struct XPTTypeDescriptorPrefix {
     335                 :     PRUint8 flags;
     336                 : };
     337                 : 
     338                 : /* flag bits -- fur and jband were right, I was miserably wrong */
     339                 : 
     340                 : // THESE TWO FLAGS ARE DEPRECATED. DO NOT USE THEM. See bug 692342.
     341                 : #define XPT_TDP_POINTER          0x80
     342                 : #define XPT_TDP_REFERENCE        0x20
     343                 : 
     344                 : #define XPT_TDP_FLAGMASK         0xe0
     345                 : #define XPT_TDP_TAGMASK          (~XPT_TDP_FLAGMASK)
     346                 : #define XPT_TDP_TAG(tdp)         ((tdp).flags & XPT_TDP_TAGMASK)
     347                 : 
     348                 : #define XPT_TDP_IS_POINTER(flags)        (flags & XPT_TDP_POINTER)
     349                 : #define XPT_TDP_IS_REFERENCE(flags)      (flags & XPT_TDP_REFERENCE)
     350                 : 
     351                 : /* 
     352                 :  * The following enum maps mnemonic names to the different numeric values 
     353                 :  * of XPTTypeDescriptor->tag.
     354                 :  */
     355                 : enum XPTTypeDescriptorTags {
     356                 :     TD_INT8              = 0,
     357                 :     TD_INT16             = 1,
     358                 :     TD_INT32             = 2,
     359                 :     TD_INT64             = 3,
     360                 :     TD_UINT8             = 4,
     361                 :     TD_UINT16            = 5,
     362                 :     TD_UINT32            = 6,
     363                 :     TD_UINT64            = 7,
     364                 :     TD_FLOAT             = 8, 
     365                 :     TD_DOUBLE            = 9,
     366                 :     TD_BOOL              = 10,  
     367                 :     TD_CHAR              = 11,  
     368                 :     TD_WCHAR             = 12, 
     369                 :     TD_VOID              = 13,  
     370                 :     TD_PNSIID            = 14,
     371                 :     TD_DOMSTRING         = 15,
     372                 :     TD_PSTRING           = 16,
     373                 :     TD_PWSTRING          = 17,
     374                 :     TD_INTERFACE_TYPE    = 18,
     375                 :     TD_INTERFACE_IS_TYPE = 19,
     376                 :     TD_ARRAY             = 20,
     377                 :     TD_PSTRING_SIZE_IS   = 21,
     378                 :     TD_PWSTRING_SIZE_IS  = 22,
     379                 :     TD_UTF8STRING        = 23,
     380                 :     TD_CSTRING           = 24,
     381                 :     TD_ASTRING           = 25,
     382                 :     TD_JSVAL             = 26
     383                 : };
     384                 : 
     385                 : struct XPTTypeDescriptor {
     386                 :     XPTTypeDescriptorPrefix prefix;
     387                 :     PRUint8 argnum;                 /* used for iid_is and size_is */
     388                 :     PRUint8 argnum2;                /* used for length_is */
     389                 :     union {                         
     390                 :         PRUint16 iface;             /* used for TD_INTERFACE_TYPE */
     391                 :         PRUint16 additional_type;   /* used for TD_ARRAY */
     392                 :     } type;
     393                 : };
     394                 : 
     395                 : #define XPT_COPY_TYPE(to, from)                                               \
     396                 :   (to).prefix.flags = (from).prefix.flags;                                    \
     397                 :   (to).argnum = (from).argnum;                                                \
     398                 :   (to).argnum2 = (from).argnum2;                                              \
     399                 :   (to).type.additional_type = (from).type.additional_type;
     400                 : 
     401                 : /*
     402                 :  * A ConstDescriptor is a variable-size record that records the name and 
     403                 :  * value of a scoped interface constant. 
     404                 :  *
     405                 :  * The types of the method parameter are restricted to the following subset 
     406                 :  * of TypeDescriptors: 
     407                 :  *
     408                 :  * int8, uint8, int16, uint16, int32, uint32, 
     409                 :  * int64, uint64, wchar_t, char, string
     410                 :  * 
     411                 :  * The type (and thus the size) of the value record is determined by the 
     412                 :  * contents of the associated TypeDescriptor record. For instance, if type 
     413                 :  * corresponds to int16, then value is a two-byte record consisting of a 
     414                 :  * 16-bit signed integer.  For a ConstDescriptor type of string, the value 
     415                 :  * record is of type String*, i.e. an offset within the data pool to a 
     416                 :  * String record containing the constant string.
     417                 :  */
     418                 : union XPTConstValue {
     419                 :     PRInt8    i8;
     420                 :     PRUint8   ui8; 
     421                 :     PRInt16   i16; 
     422                 :     PRUint16  ui16;
     423                 :     PRInt32   i32; 
     424                 :     PRUint32  ui32;
     425                 :     PRInt64   i64; 
     426                 :     PRUint64  ui64; 
     427                 :     float     flt;
     428                 :     double    dbl;
     429                 :     PRBool    bul;
     430                 :     char      ch; 
     431                 :     PRUint16  wch;
     432                 :     nsID      *iid;
     433                 :     XPTString *string;
     434                 :     char      *str;
     435                 :     PRUint16  *wstr;
     436                 : }; /* varies according to type */
     437                 : 
     438                 : struct XPTConstDescriptor {
     439                 :     char                *name;
     440                 :     XPTTypeDescriptor   type;
     441                 :     union XPTConstValue value;
     442                 : };
     443                 : 
     444                 : /*
     445                 :  * A ParamDescriptor is a variable-size record used to describe either a 
     446                 :  * single argument to a method or a method's result.
     447                 :  */
     448        68929373 : struct XPTParamDescriptor {
     449                 :     PRUint8           flags;
     450                 :     XPTTypeDescriptor type;
     451                 : };
     452                 : 
     453                 : /* flag bits -- jband and fur were right, and I was miserably wrong */
     454                 : #define XPT_PD_IN       0x80
     455                 : #define XPT_PD_OUT      0x40
     456                 : #define XPT_PD_RETVAL   0x20
     457                 : #define XPT_PD_SHARED   0x10
     458                 : #define XPT_PD_DIPPER   0x08
     459                 : #define XPT_PD_OPTIONAL 0x04
     460                 : #define XPT_PD_FLAGMASK 0xfc
     461                 : 
     462                 : #define XPT_PD_IS_IN(flags)     (flags & XPT_PD_IN)
     463                 : #define XPT_PD_IS_OUT(flags)    (flags & XPT_PD_OUT)
     464                 : #define XPT_PD_IS_RETVAL(flags) (flags & XPT_PD_RETVAL)
     465                 : #define XPT_PD_IS_SHARED(flags) (flags & XPT_PD_SHARED)
     466                 : #define XPT_PD_IS_DIPPER(flags) (flags & XPT_PD_DIPPER)
     467                 : #define XPT_PD_IS_OPTIONAL(flags) (flags & XPT_PD_OPTIONAL)
     468                 : 
     469                 : extern XPT_PUBLIC_API(PRBool)
     470               0 : XPT_FillParamDescriptor(XPTArena *arena, 
     471                 :                         XPTParamDescriptor *pd, PRUint8 flags,
     472                 :                         XPTTypeDescriptor *type);
     473                 : 
     474                 : /*
     475                 :  * A MethodDescriptor is a variable-size record used to describe a single 
     476                 :  * interface method.
     477                 :  */
     478                 : struct XPTMethodDescriptor {
     479                 :     char                *name;
     480                 :     XPTParamDescriptor  *params;
     481                 :     XPTParamDescriptor  *result;
     482                 :     PRUint8             flags;
     483                 :     PRUint8             num_args;
     484                 : };
     485                 : 
     486                 : /* flag bits -- jband and fur were right, and I was miserably wrong */
     487                 : #define XPT_MD_GETTER   0x80
     488                 : #define XPT_MD_SETTER   0x40
     489                 : #define XPT_MD_NOTXPCOM 0x20
     490                 : #define XPT_MD_CTOR     0x10
     491                 : #define XPT_MD_HIDDEN   0x08
     492                 : #define XPT_MD_OPT_ARGC 0x04
     493                 : #define XPT_MD_CONTEXT  0x02
     494                 : #define XPT_MD_FLAGMASK 0xfe
     495                 : 
     496                 : #define XPT_MD_IS_GETTER(flags)      (flags & XPT_MD_GETTER)
     497                 : #define XPT_MD_IS_SETTER(flags)      (flags & XPT_MD_SETTER)
     498                 : #define XPT_MD_IS_NOTXPCOM(flags)    (flags & XPT_MD_NOTXPCOM)
     499                 : #define XPT_MD_IS_CTOR(flags)        (flags & XPT_MD_CTOR)
     500                 : #define XPT_MD_IS_HIDDEN(flags)      (flags & XPT_MD_HIDDEN)
     501                 : #define XPT_MD_WANTS_OPT_ARGC(flags) (flags & XPT_MD_OPT_ARGC)
     502                 : #define XPT_MD_WANTS_CONTEXT(flags)  (flags & XPT_MD_CONTEXT)
     503                 : 
     504                 : extern XPT_PUBLIC_API(PRBool)
     505               0 : XPT_FillMethodDescriptor(XPTArena *arena, 
     506                 :                          XPTMethodDescriptor *meth, PRUint8 flags, char *name,
     507                 :                          PRUint8 num_args);
     508                 : 
     509                 : /*
     510                 :  * Annotation records are variable-size records used to store secondary 
     511                 :  * information about the typelib, e.g. such as the name of the tool that 
     512                 :  * generated the typelib file, the date it was generated, etc.  The 
     513                 :  * information is stored with very loose format requirements so as to 
     514                 :  * allow virtually any private data to be stored in the typelib.
     515                 :  *
     516                 :  * There are two types of Annotations:
     517                 :  *
     518                 :  * EmptyAnnotation
     519                 :  * PrivateAnnotation
     520                 :  *
     521                 :  * The tag field of the prefix discriminates among the variant record 
     522                 :  * types for Annotation's.  If the tag is 0, this record is an 
     523                 :  * EmptyAnnotation. EmptyAnnotation's are ignored - they're only used to 
     524                 :  * indicate an array of Annotation's that's completely empty.  If the tag 
     525                 :  * is 1, the record is a PrivateAnnotation. 
     526                 :  */
     527                 : 
     528                 : struct XPTAnnotation {
     529                 :     XPTAnnotation *next;
     530                 :     PRUint8       flags;
     531                 :     /* remaining fields are present in typelib iff XPT_ANN_IS_PRIVATE */
     532                 :     XPTString     *creator;
     533                 :     XPTString     *private_data;
     534                 : };
     535                 : 
     536                 : #define XPT_ANN_LAST                    0x80
     537                 : #define XPT_ANN_IS_LAST(flags)          (flags & XPT_ANN_LAST)
     538                 : #define XPT_ANN_PRIVATE                 0x40
     539                 : #define XPT_ANN_IS_PRIVATE(flags)       (flags & XPT_ANN_PRIVATE)
     540                 : 
     541                 : extern XPT_PUBLIC_API(XPTAnnotation *)
     542               0 : XPT_NewAnnotation(XPTArena *arena, PRUint8 flags, XPTString *creator, 
     543                 :                   XPTString *private_data);
     544                 : 
     545                 : PR_END_EXTERN_C
     546                 : 
     547                 : #endif /* __xpt_struct_h__ */

Generated by: LCOV version 1.7