Design Notes for Phantasmal's Object
Manager
Known Bugs
Don't compile a library that isn't used by anything before the
ObjectD gets compiled. If you do, then when you rebuild that library
(say, during a full rebuild), you'll get a log message saying that an
unregistered issue of the lib is being removed. This is an artifact of
the way Phantasmal's ObjectD does object discovery during its
initialiation.
Major data
- obj_issues
- This is a HEAVY_ARRAY of issue numbers for each clonable and
library.
- dest_issues
- The is a mapping, keyed by object name, of objects whose most
recent issue has been destructed.
- fixups
- This mapping exists only during initialization. It is created by
the recompile_to_track_libs function from recomp_paths. It maps from a
library to the set of child objects that the library inherits.
- recomp_paths
- This mapping is useful only during initialization. It is keyed by
object name, and the value is a list of what objects the key object is
inherited by. It is set indirectly by compile_object and compile_lib,
so it is indirectly set by recompiling all objects during init.
- all_libs
- This is a mapping of library names to their most current issue
numbers.
Major Functions
- recompile_to_track_libs
- Builds the fixups array from recomp_paths, while destructing and
recompiling every library in recomp_paths.
- fix_parent_arrays
- For each library L in fixups, for each child C to fix it for,
replace L's program name with L's issue number in C's parent
array.
- fix_child_arrays
- For every library, clear the previous issue number and the list of
children. For every library, register_inherit_data(). For every object
in ObjRegD (plus TELNET_CONN and BINARY_CONN), call
register_inherit_data() on its issue.
- recompile_every_clonable
- For each object in ObjRegD plus TELNET_CONN and BINARY_CONN,
recompile every non-clone object.
- recompile_every_object
- First, recompile_every_clonable(). Then recompile_to_track_libs(),
fix_parent_arrays(), and fix_child_arrays(). This is most of the init
sequence.
- count_clones
- Go through ObjRegD, adding clones to their appropriate issue
structures.
- unregister_inherit_data(object issue)
- Remove this issue from its children's "parent" lists.
- register_inherit_data(object issue)
- Add this issue to its children's "parent" lists.
- clear_child_data(object issue)
- Remove this issue from its parents' "child" lists.
Initialization call sequence
- recompile_every_object:
- recompile_every_clonable
- recompile_to_track_libs
- fix_parent_arrays
- fix_child_arrays
- count_clones
Remember that when an object is recompiled, add_clonable or add_lib
is called. Either will call convert_inherited_str_to_mixed, which will
add any tracked libraries the object inherits to all_libs. The function
will also add appropriate dependencies to recomp_paths if called during
init.
|