1 #ifdef RCSID
2 static char RCSid[] =
3 "$Header: d:/cvsroot/tads/tads3/VMMCREG.CPP,v 1.2 1999/05/17 02:52:28 MJRoberts Exp $";
4 #endif
5 
6 /*
7  *   Copyright (c) 1998, 2002 Michael J. Roberts.  All Rights Reserved.
8  *
9  *   Please see the accompanying license file, LICENSE.TXT, for information
10  *   on using and copying this software.
11  */
12 /*
13 Name
14   vmmcreg.cpp - Metaclass Registry
15 Function
16   The registry provides a static constant global table of the metaclasses
17   that are linked in to this VM implementation.
18 
19   This file is dependent on the host application environment configuration.
20   This particular file builds a table for the base set of T3 VM metaclasses.
21   Some host environments may define an extended set of metaclasses; if
22   you're building a host system with added metaclasses, do the following:
23 
24   1.  Make a copy of this file (DO NOT MODIFY THE ORIGINAL).
25 
26   2.  Remove this file (and/or files mechanically derived from this file,
27       such as the compiled object file) from your makefile, and add your
28       modified version of this file (and/or attendant derived files)
29       instead.
30 
31   3.  At EACH line marked with a "!!!" comment below, add a #include
32       for each of your added metaclass header files.  (You don't need
33       to include the core metaclasses, such as list and string, since
34       you should still include "vmmccore.h", which takes care of
35       including the core files.)
36 Notes
37 
38 Modified
39   12/01/98 MJRoberts  - Creation
40 */
41 
42 #include "vmmcreg.h"
43 
44 // !!! INCLUDE HOST-SPECIFIC METACLASS HEADERS HERE (FIRST OF TWO)
45 
46 /* the global registry table */
47 vm_meta_reg_t G_meta_reg_table[] =
48 {
49     /*
50      *   enable table-building mode, and include the core metaclasses
51      *   common to all T3 VM implementations
52      */
53 #define VMMCCORE_BUILD_TABLE
54 #include "vmmccore.h"
55 
56 // !!! INCLUDE HOST-SPECIFIC METACLASS HEADERS HERE (SECOND OF TWO)
57 
58     /*
59      *   last entry in the table (this is only required because of the
60      *   trailing comma in the registration macro)
61      */
62     { 0 }
63 };
64 
65 /* ------------------------------------------------------------------------ */
66 /*
67  *   Register the metaclasses
68  */
vm_register_metaclasses()69 void vm_register_metaclasses()
70 {
71     uint i;
72     vm_meta_reg_t *entry;
73 
74     /*
75      *   run through the metaclass table and tell each metaclass its
76      *   registration table index
77      */
78     for (i = 0, entry = G_meta_reg_table ; entry->meta != 0 ;
79          ++i, ++entry)
80     {
81         /*
82          *   Call this entry's class method to set its registration index.
83          *   This is static information that never changes throughout the
84          *   program's execution - we simply establish the registration
85          *   table index for each metaclass once upon initialization.
86          */
87         (*entry->meta)->set_metaclass_reg_index(i);
88     }
89 }
90