Script Index


/var/lib/sorcery/modules/libdepends

A spell is represented as a node containing some pieces of data seperated by colons. spell:dependent spell:on/off:type:casting_flag:is_a_target_flag

Contributers

Chris Brien (christopher_brien@hotmail.com) Paul Mahon (pmahon@sourcemage.org)

Synopsis

Functions for dealing with dependencies as a non-cyclic directed graph. Since that's such a mouthful, it will simply be referred to as a tree, even though it's not.


function run_prepare()

Parameters:

Globals

SCRIPT_DIRECTORY

Description

Run the spell's PREPARE script if it exists


function run_other()

Parameters:

Description

This will be home to all "other" questions we are supposed to ask about during this phase of things, right now its a placeholder


function run_configure()

Parameters:

Description

Run the spell's CONFIGURE script if it exists


function run_depends()

Parameters:

Description

Run a spell's DEPENDS if it exists


function run_up_triggers()

Parameters:

Description

Run a spell's UP_TRIGGERS if it exists


function run_our_sub_depends()

Parameters:

Description

process any sub-depends the current spell is going to provide These come from the live sub-depends table and from spells that have already been processed


function run_other_sub_depends()

Parameters:

Description

run any sub-depends that we requested on behalf of the sub-dependee


function process_sub_depends()

Parameters:

Description

Run a spell's SUB_DEPENDS file for a specific sub-depends. This is idempotent, if a sub-depends has already been processed it will not run the SUB_DEPENDS file again. Expects the sub-dependee to be loaded. If the spell does not have a SUB_DEPENDS file, it is a failure.


function compute_installed_depends()

Parameters:

Description

Create a map of spells to their dependent spells. Then for all installed or held spells, output a libhash command to join the spell name and dependency info. Then evaluate the output, thus filling a libhash with dependency info.


function compute_reverse_installed_depends()

Parameters:

Description

Create a map of spells to their dependent spells. Then for all installed or held spells, output a libhash command to join the spell name and dependency info. Then evaluate the output, thus filling a libhash with dependency info.


function compute_uninstalled_depends()

Parameters:

Description

calling this will accomplish several things:

  1. most importantly it finds the closure of all spells that need to be cast
  2. it builds a hash table mapping spells to their depends, possibly by asking the user for input
  3. it updates DEPENDS_STATUS, arguably it shouldn't be doing this.
What happens: take all the spells we've been asked to resolve for each one of them run its details file the details file will call back to depends/optional_depends at this point we determine/find/query for depends info update the hash table, update DEPENDS_STATUS, and append to the list of spells to resolve


function private_run_depends()

Parameters:

Description

A private function for running a spell's DEPENDS script. No functions except libdepends functions should use this.


function private_should_cast()

Parameters:

Description

Decides if a spell should be cast, or if we can leave it alone. Check if the spell is installed, or if theres some other reason to rebuild it.


function private_upward_depends()

Parameters:

Description

Find all the spells that depend on the spell given as $1


function private_recast_optionals()

Parameters:

Description

Find spells that optionally depended on the current spell but had the dependency disabled, ask if the user wants to recast the spell. Also finds disabled features that the current spell is a provider of.


function real_generic_required_depends()

Parameters:

Description

Delegates provider and spell cases to different worker functions. and gets grimoires if necessary for cross grimoire depends Called by real_depends and real_runtime_depends


function real_depends()

Parameters:

Description

Passthrough to real_generic_required_depends, specifies the parts that differ from runtime depends


function real_runtime_depends()

Parameters:

Description

Passthrough to real_generic_required_depends, specifies the parts that differ from required depends


function real_generic_optional_depends()

Parameters:

Description

Delegates provider and spell cases to different worker functions. Called by real_depends and real_runtime_depends


function real_optional_depends()

Parameters:

Description

Passthrough to real_generic_optional_depends, specifies the parts that differ from suggest depends


function real_suggest_depends()

Parameters:

Description

Passthrough to real_generic_required_depends, specifies the parts that differ from optional depends


function work_depends_provider()

Parameters:

Description

Asks the user what provider for a depends is desired if a choice has not ben made before.


function work_depends_spell()

Parameters:

Description

One of the worker functions. Checks for exiled spell and passes on to the common dependency function, private_common_depends


function work_optional_depends_provider()

Parameters:

Description

Handles optional dependency on a provider.


function optional_depends_query()

Parameters:

Returns:

Description

Works just like normal query but can show short description of a spell and stops the timer for taking the default answer if h/H is pressed. Type of query is chosen in sorcery feature menu.


function work_optional_depends_spell()

Parameters:

Description

Handles optional dependency on a spell.


function select_provider()

Parameters:

Description

Present a list to the user complete with info about whats installed and what isnt and allow a default value to be used


function real_up_trigger()

Parameters:

Description

Create a trigger on ourself effecting the target spell, shorthand for putting a TRIGGERS file in the target spell.


function private_up_trigger()

Parameters:

Description

Register a trigger, when $SPELL is cast, a $ACTION is executed on $TARGET


function real_sub_depends()

Parameters:

Description

Request a sub-depends from $SPELL on $1 for $2 This queues the sub-depends for later processing, if the sub-dependee does not already support the sub-depends.


function real_force_depends()

Parameters:

Description

Force a spell to be recast, if it comes up for processing if the spell was already looked at and processed nothing happens if the spell was already looked at and didnt need processing, then it'll get re-processed (assuming the caller also did a depends on it)


function private_common_depends()

Parameters:

Description

all the depends callbacks eventually bottom out here if a spell depends or doesnt depend on some other spell


function real_default_sorcery_trigger_check()

Parameters:

Description

Default trigger checking function. Asks user if they want to run the trigger.


function private_add_triggerees()

Parameters:

Description

Inspects each trigger, asks the user if they want to run it.


function private_add_depends()

Parameters:

Description

Adds the dependency to the hastable


function want_lazy_update()

Parameters:

Description

Determine if spell should be lazily updated, possible asks the user what to do.


function private_remove_dependees()

Parameters:

Description

Removes a dependency and its dependees from the to_cast list.


function private_discard_spell()

Parameters:

Description

Does the actual removal


function uncommitted_upward_depends()

Parameters:

Description

Find all the spells already processed that depend on the spell given as $1 Unlike private_upward_depends, this one works with the uncommitted info


function run_spell_config()

Parameters:

Globals

SPELL

Description

Sets a spell's aux. config info.


function real_show_up_depends()

Parameters:

Param

spell depth (optional) fast -- if set only show spells, not full depends db entries all - if set returns also runtime dependencies

Description

Output the upward dependencies of the specified spell