home *** CD-ROM | disk | FTP | other *** search
-
-
- Resource Banks
- --------------
-
- You must call TclaInitResources() to access the resource bank and use
- the resource bank management routines.
-
- The model of easily intercommunicating programs provided by Tcl made
- clear that it was necessary to provide a way for tasks to formally
- share named data entities. For example, a SMUS loader might handle
- the loading and unloading of SMUS files, but a SMUS player would need
- to be able to locate them in order to play them.
-
- Resource banks were created by Hackercorp to address needs such as this,
- and the resulting code is placed into the public domain.
-
- Resource banks work like the Amiga resources accessed by AddResource,
- OpenResource, etc, but they maintain a number of named lists to which
- the actual data is a subordinate named entry to.
-
- For example,
-
- ResourceBankList --> SMUS --> 8SVX --> ILBM --> null
- | | |
- introsong strat1 pic1
- | | |
- highscore organ null
- | |
- null ahhvoice
- |
- null
-
-
-
- The resource bank master list entry is located by doing an Amiga
- OpenResource looking for resourcebank.resource. The first program
- to look for the resource and not find it creates it. The
- resourcebank.resource entry and the top level entries in the list
- are not expected to be removed for an entire run (i.e. til the
- next reboot) This should only amount to a few dozen bytes.
-
- To the resource handler, a resource is just a blob pointed to by
- a 32-bit pointer that's specified when you connect something to
- an entry in the resource bank. That is to say that the resource
- bank handling routines don't know anything about and don't care
- about anything at the other end of that pointer.
-
-
- The user-callable routines are:
-
- void *LocateResource(char *groupname, char *itemname)
-
- given group name and entry name, locate a resource entry within
- the resource bank and return it's data pointer. Returns NULL
- if it can't find the specified resource entry.
-
-
- int ConnectResource(char *groupname, char *resourcename, void *data)
-
- given the name of an entry and the name of a group for it to go in,
- locate the group, creating it if it doesn't exist, and find or
- create the named entry, then set the data pointer to the passed
- data pointer.
-
-
- void *DisconnectResource(char *groupname, char *resourcename)
-
- given a the name of a group and a resource entry, locat the
- entry, remove it from the list and return the pointer to
- the data attached to that resource. Returns NULL if it couldn't
- find it.
-
-
-
-
-
- Tcl-callable resource routines
- ------------------------------
-
- There is a routine callable from Tcl that does a couple things with resource
- banks.
-
- resource list banks
-
- will return a list containing the names of all the banks, and
-
- resource list entries foo
-
- will return a list containing the names of all the entries in bank foo.
-