Back to index

lightning-sunbird  0.9+nobinonly
SymFiles.h
Go to the documentation of this file.
00001 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
00002  *
00003  * The contents of this file are subject to the Netscape Public
00004  * License Version 1.1 (the "License"); you may not use this file
00005  * except in compliance with the License. You may obtain a copy of
00006  * the License at http://www.mozilla.org/NPL/
00007  *
00008  * Software distributed under the License is distributed on an "AS
00009  * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
00010  * implied. See the License for the specific language governing
00011  * rights and limitations under the License.
00012  *
00013  * The Original Code is Mozilla Communicator client code, released
00014  * March 31, 1998.
00015  *
00016  * The Initial Developer of the Original Code is Netscape
00017  * Communications Corporation.  Portions created by Netscape are
00018  * Copyright (C) 1998 Netscape Communications Corporation. All
00019  * Rights Reserved.
00020  *
00021  * Contributor(s):
00022  *
00023  * Patrick C. Beard <beard@netscape.com>
00024  *
00025  * Alternatively, the contents of this file may be used under the
00026  * terms of the GNU Public License (the "GPL"), in which case the
00027  * provisions of the GPL are applicable instead of those above.
00028  * If you wish to allow use of your version of this file only
00029  * under the terms of the GPL and not to allow others to use your
00030  * version of this file under the NPL, indicate your decision by
00031  * deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL.  If you do not delete
00033  * the provisions above, a recipient may use your version of this
00034  * file under either the NPL or the GPL.
00035  */
00036 
00037 #include <MacTypes.h>
00038 
00039 #ifndef __SYM_FILES__
00040 #define __SYM_FILES__
00041 
00042 #if PRAGMA_STRUCT_ALIGN
00043        #pragma options align=mac68k
00044 #elif PRAGMA_STRUCT_PACKPUSH
00045        #pragma pack(push, 2)
00046 #elif PRAGMA_STRUCT_PACK
00047        #pragma pack(2)
00048 #endif
00049 
00050 /* Note:  these structures are for .xSYM file format v3.3. */
00051 
00052 struct DiskTableInfo {
00053        UInt16               dti_first_page;                           /* table's first page */
00054        UInt16               dti_page_count;                           /* # pages in the table */
00055        UInt32               dti_object_count;                  /* # objects in the table */
00056 };
00057 typedef struct DiskTableInfo DiskTableInfo;
00058 
00059 struct DiskSymbolHeaderBlock {
00060        Str31                dshb_id;                                  /* Version information */
00061        UInt16               dshb_page_size;                           /* Size of the pages/blocks */
00062        UInt16               dshb_hash_page;                           /* Disk page for the hash table */
00063        UInt16               dshb_root_mte;                            /* MTE index of the program root */
00064        UInt32               dshb_mod_date;                            /* executable's mod date */
00065 
00066        DiskTableInfo dshb_frte;                                /* Per TABLE information */
00067        DiskTableInfo dshb_rte;
00068        DiskTableInfo dshb_mte;
00069        DiskTableInfo dshb_cmte;
00070        DiskTableInfo dshb_cvte;
00071        DiskTableInfo dshb_csnte;
00072        DiskTableInfo dshb_clte;
00073        DiskTableInfo dshb_ctte;
00074        DiskTableInfo dshb_tte;
00075        DiskTableInfo dshb_nte;
00076        DiskTableInfo dshb_tinfo;
00077        DiskTableInfo dshb_fite;
00078        DiskTableInfo dshb_const;
00079 
00080        OSType               dshb_file_creator;                 /* executable's creator */
00081        OSType               dshb_file_type;                           /* executable's file type */
00082 };
00083 typedef struct DiskSymbolHeaderBlock DiskSymbolHeaderBlock;
00084 
00085 /*
00086 RESOURCE_TABLE_ENTRY = RECORD
00087        rte_ResType: ResType; { resource type }
00088        rte_res_number: INTEGER; { resource id }
00089        rte_nte_index: LONGINT; { the resource's name }
00090        rte_mte_first: INTEGER; { first MTE contained in the resource }
00091        rte_mte_last: INTEGER; { last MTE contained in the resource }
00092        rte_res_size: LONGINT; { the size of the resource }
00093 END;
00094  */
00095 
00096 struct ResourceTableEntry {
00097        ResType                     rte_ResType;                       /* resource type */
00098        SInt16               rte_res_number;                           /* resource id */
00099        UInt32               rte_nte_index;                            /* resource name */
00100        UInt16               rte_mte_first;                            /* first MTE contained in the resource */
00101        UInt16               rte_mte_last;                      /* last MTE contained in the resource */
00102        UInt32               rte_res_size;                      /* the size of the resource */
00103 };
00104 typedef struct ResourceTableEntry ResourceTableEntry;
00105 
00106 /*
00107 FILE_REFERENCE = RECORD
00108        fref_frte_index: LONGINT; { File Reference Table index }
00109        fref_offset: LONGINT; { absolute offset into the source file }
00110 END;
00111 */
00112 
00113 struct FileReference {
00114        UInt16               fref_frte_index;                   /* File Reference Table index */
00115        UInt32               fref_offset;                       /* absolute offset into the source file */
00116 };
00117 typedef struct FileReference FileReference;
00118 
00119 /*
00120 MODULES_TABLE_ENTRY = RECORD
00121        mte_rte_index: UNSIGNED; { which resource the MTE is in }
00122        mte_res_offset: LONGINT; { offset into the resource }
00123        mte_size: LONGINT; { size of the MTE }
00124        mte_kind: SignedByte; { kind of MTE }
00125        mte_scope: SignedByte; { MTE's visibility }
00126        mte_parent: INTEGER; { index of parent MTE }
00127        mte_imp_fref: FILE_REFERENCE; { implementation source location }
00128        mte_imp_end: LONGINT; { end of implementation }
00129        mte_nte_index: LONGINT; { MTE's name }
00130        mte_cmte_index: INTEGER; { MTEs contained by this MTE }
00131        mte_cvte_index: LONGINT; { variables contained by this MTE}
00132        mte_clte_index: INTEGER; { labels contained by this MTE }
00133        mte_ctte_index: INTEGER; { types contained by this MTE }
00134        mte_csnte_idx_1: LONGINT; { CSNTE index of first statement }
00135        mte_csnte_idx_2: LONGINT; { CSNTE index of last statement }
00136 END;
00137  */
00138 
00139 struct ModulesTableEntry {
00140        UInt16                      mte_rte_index;                            /* which resource the MTE is in */
00141        UInt32               mte_res_offset;                           /* offset into the resource */
00142        UInt32               mte_size;                                 /* size of the MTE */
00143        SInt8                mte_kind;                                 /* kind of MTE */
00144        SInt8                mte_scope;                                /* MTE's visibility */
00145        UInt16               mte_parent;                               /* index of parent MTE */
00146        FileReference mte_imp_fref;                      /* implementation source location */
00147        UInt32               mte_imp_end;                       /* end of implementation */
00148        UInt32               mte_nte_index;                            /* MTE's name */
00149        UInt16               mte_cmte_index;                           /* MTEs contained by this MTE */
00150        UInt32               mte_cvte_index;                           /* variables contained by this MTE */
00151        UInt16               mte_clte_index;                           /* labels contained by this MTE */
00152        UInt16               mte_ctte_index;                           /* types contained by this MTE */
00153        UInt32               mte_csnte_idx_1;                   /* CSNTE index of first statement */
00154        UInt32               mte_csnte_idx_2;                   /* CSNTE index of last statement */
00155 };
00156 typedef struct ModulesTableEntry ModulesTableEntry;
00157 
00158 /*
00159  * The type of module.  Taken from the OMF document
00160  */
00161 enum {
00162        kModuleKindNone                                  = 0,
00163        kModuleKindProgram                        = 1,
00164        kModuleKindUnit                                  = 2,
00165        kModuleKindProcedure               = 3,
00166        kModuleKindFunction                       = 4,
00167        kModuleKindData                                  = 5,
00168        kModuleKindBlock                          = 6                         /* The module is an internal block */
00169 };
00170 
00171 /*
00172 FILE_REFERENCE_TABLE_ENTRY = RECORD
00173        CASE INTEGER OF
00174        FILE_NAME_INDEX:
00175        (
00176               frte_name_entry: INTEGER; { = FILE_NAME_INDEX }
00177               frte_nte_index: LONGINT; { name of the source file }
00178               frte_mod_date: LONGINT; { the source file's mod date }
00179        );
00180        0: { FILE_NAME_INDEX and  END_OF_LIST, a FRTE entry: }
00181        (
00182               frte_mte_index: INTEGER; { the MTE's index }
00183               frte_file_offset: LONGINT; { the MTE's source file offset}
00184        );
00185        END_OF_LIST:
00186        (
00187               frte_end_of_list: INTEGER; { = END_OF_LIST }
00188        );
00189 END;
00190 */
00191 
00192 enum {
00193        kEndOfList = 0xFFFF,
00194        kFileNameIndex = kEndOfList - 1
00195 };
00196 
00197 union FileReferenceTableEntry {
00198        struct {
00199               UInt16               name_entry;                        /* = kFileNameIndex  */
00200               UInt32               nte_index;                         /* Name table entry         */
00201               UInt32               mod_date;                          /* When file was last modified */
00202        } frte_fn;
00203 
00204        struct {
00205               UInt16               mte_index;                         /* Module table entry < kFileNameIndex */
00206               UInt32               file_offset;                /* Absolute offset into the source file */
00207        } frte_mte;
00208 
00209        UInt16                      frte_end_of_list;           /* = kEndOfList */
00210 };
00211 typedef union FileReferenceTableEntry FileReferenceTableEntry;
00212 
00213 /*
00214 CONTAINED_STATEMENTS_TABLE_ENTRY = RECORD
00215        CASE INTEGER OF
00216        SOURCE_FILE_CHANGE:
00217        (
00218               csnte_file_change: INTEGER; { = SOURCE_FILE_CHANGE }
00219               csnte_fref: FILE_REFERENCE; { the new source file }
00220        );
00221        0: { to SOURCE_FILE_CHANGE or END_OF_LIST, a statement entry:}
00222        (
00223               csnte_mte_index: INTEGER; { the MTE the statement is in }
00224               csnte_file_delta: INTEGER; { delta from previous src loc }
00225               csnte_mte_offset: LONGINT; { code location, offset into MTE }
00226        );
00227        END_OF_LIST:
00228        (
00229               csnte_end_of_list: INTEGER; { indicates end of stmt list }
00230        );
00231 END;
00232  */
00233 
00234 enum {
00235        kSourceFileChange = kEndOfList - 1
00236 };
00237 
00238 union ContainedStatementsTableEntry {
00239        struct {
00240               UInt16               change;                                   /* = kSourceFileChange      */
00241               FileReference fref;                              /* the new source file */
00242        } csnte_file;
00243 
00244        struct {
00245               UInt16               mte_index;                         /* the MTE the statement is in */
00246               UInt16               file_delta;                        /* delta from previous src loc */
00247               UInt32               mte_offset;                        /* code location, offset into MTE */
00248        } csnte;
00249 
00250        UInt16        csnte_end_of_list;                        /* = END_OF_LIST */
00251 };
00252 typedef union ContainedStatementsTableEntry ContainedStatementsTableEntry;
00253 
00254 #if PRAGMA_STRUCT_ALIGN
00255        #pragma options align=reset
00256 #elif PRAGMA_STRUCT_PACKPUSH
00257        #pragma pack(pop)
00258 #elif PRAGMA_STRUCT_PACK
00259        #pragma pack()
00260 #endif
00261 
00262 #endif /* __SYM_FILES__ */