A grimoire is a book containing one or more spells. A codex
is a collection of one or more grimoires. There are functions
for listing the available grimiores, listing spells in a grimoire,
listing sections in a grimoire, etc.
Note: Each of the functions that returns a spell, section, or
grimoire returns the full path. Functions that explicitly return
a spell I
grimoires
This section contains some notes on grimoires.
Grimoire Layout
The codex functions expect each grimoire to be a directory.
Each directory entry in a grimoire directory is considered
to be a section. All directory entries in a section are
considered to be a spell if they included an executable file
named F
Multiple grimoires
Multiple grimoires are specified by setting entries in the
I
GRIMOIRE_DIR[1]=/path/to/alternate/grimoire
GRIMOIRE_DIR[2]=/path/to/other/alternate/grimoire
Grimoires are processed/searched in increasing order starting
at index 0. The SMGL configuration file provides the value for
the default grimoire as I
GRIMOIRE_DIR[1]=$GRIMOIRE
GRIMOIRE_DIR[0]=/path/to/grimoire/to/search/first
There is no limitation on the number of grimoires that can be
specified.
It is also possible to add and remove grimoires using the
codex_add_grimoire and codex_remove_grimoire functions.
Copyright 2002 by the Source Mage Team
Set of functions for dealing with a library of grimoires (spell books).
Outputs a grimoire in canonical form (full path) if lookup equal to "lookup" look up the grimoire name else build the grimoire name from $CODEX_ROOT/$grimoire CODEX_ROOT is the default grimoire location NOTE: one can specify partial paths
the grimoire's path
NOTE: one can specify partial paths such as codex/stable
example1: codex_find_grimoire test; echo "returned $?" /var/lib/sorcery/codex/test returned 0 example2: codex_find_grimoire sorcery/codex/stable; echo "returned $?" /var/lib/sorcery/codex/stable returned 0
Adds the specified grimoire to the list of grimoires. If no
position is given, the grimoire is added to the end of the list.
Position is 0 based. Adding a grimoire to position 0 places it as
the first grimoire in the list, and moves all other grimoires down
one spot, unless [
Removes the specified grimoire from the list of grimoires.
Removes duplicate entries from the GRIMOIRE_LIST. This parses from 0 on up, and leaves only the first instance of a grimoire found. All others are removed. Then reloads the list
Unsets the list of grimoires that existed before the call, then sets the lists of grimoires to be equal to the list of grimoires in the argument list. Grimoire names need not be canonicalized
all grimoires in the codex.
returns true if the grimoire is set local, false otherwise.
full path to the section
Given a valid section name, this function lists the full path to the section. If an invalid section name is provided, nothing is listed.
all section names from all grimoires.
all sections from all grimoires or only from the specified grimoires.
Lists all section names in the specified grimoire.
Relies on a wider-scope function codex_get_sections.
Lists all sections in the specified grimoire directories.
spell name
Given a valid spell name, this function lists the full path to the spell. If an invalid spell name is provided, nothing is listed.
spells
Lists full paths to spells in the specified section. Nothing is listed if the section doesn't include any spells.
spells
Lists all spell names in the specified section. Nothing is listed if the section doesn't include any spells.
This should be fixed so only the first of duplicate spells are listed.
spells
Lists all spells in all grimoires or only from the specified grimoires. Nothing is listed if no spells exist in any of grimoires.
spell name
Lists the section of the given spell name. Nothing is listed if there are no spells with the given name.
section name
Given a spell name, this function lists the section name. If there are no spells with the given name, nothing is listed.
GRIMOIRE SECTION SECTION_DIRECTORY SPELL SPELL_DIRECTORY SCRIPT_DIRECTORY SPELL_DESCRIPTION VERSION SHORT UPDATED SOURCE WEB_SITE ENTERED MAINTAINER MD5 LICENSE
Unets all these global variables.
All vars set in a spell
Sets the GRIMOIRE, SECTION, SECTION_DIRECTORY, SPELL_DIRECTORY, SCRIPT_DIRECTORY global variables for the given spell directory. Assumes the directory passed in is a valid spell directory.
Load just the very basics for a spell, skip build api, libcompat and other debug stuff. Intended for use in tight loops.
Setup the various spell paths associated with a spell without loading it.
Sets the GRIMOIRE, SECTION, SECTION_DIRECTORY, SPELL_DIRECTORY, SCRIPT_DIRECTORY global variables for the given spell name.
Returns the features a spell is a provider off. Example, firefox: GECKO, GRAPHICAL-WEB-BROWSER, WEB-BROWSER, NS-PLUGIN-COMPATIBLE
spelllist
First argument is a category of spell. Returns a list of spells
that match that category. For example,
C
Searches the indicies of the specified grimories for a spell. This will return only the first match found.
error if cache doesn't exist after creation
Checks that the cache exists. if it doesn't exist, make it. If it still doesn't exist, the barf an error
Creates the cache/index for the specified grimoire, or all if none is asked for.
Create in-memory spell lookup table for named grimoires.
Creae in-memory spell lookup table for all known grimoires.
file names
Prints every file matching file-name in grimoire
provides spell
Lists all providers in grimoire in the form of "provides spell"
for instance:
shell /home/martin/p4/grimoire/shell-term-fm/sash
Creates keyword index
Creates the version index, which additionally includes the other queuing factors - patchlevels and UPDATED. Multiversioned spells will a dummy entry. Persistent variables are ignored.
checks if servicename exists.
CODEX_FOUND_SECTION CODEX_FOUND_SPELL
CODEX_FOUND_SECTION is set if section was found CODEX_FOUND_SPELL is set if a spell was found
spell description
Echos the long description of the given spell. Returns an empty string if the directory is not a valid spell.