Monday, November 08, 2010 at 12:04 AM.

system.verbs.builtins.mainResponder.discuss.openRoot

on openRoot (pta=nil) {
	<<Adds another level to mainResponder.discuss.openFile. 
		<<We return the address of the root of the discussion group referenced by rootname. This is the central routine for allowing multiple discussion roots.
		<<1/10/99; 9:50:54 AM by DW
		<<Changes
			<<Wed, 03 Mar 1999 21:19:08 GMT by AR
				<<Fixed scriptError message to use the correct variable name.
			<<Mon, Aug 2, 1999 at 2:14:13 PM by PBS
				<<Optional pta parameter allows us to circumvent the try statement if pta is passed. Try statements should be avoided when possible. (mainResponder profiling showed that this verb was a minor performance bottleneck in its previous state.)
				<<Removed local declaration of f -- it was unused.
				<<Added several comments to the script.
			<<10/2/99; 10:38:00 PM by PBS
				<<Addresses (and strings that can be coerced to addresses) are allowed in discuss.root. These addresses point to discussion group storage. This was implemented to allow for greater portability: a website guest database can contain its discussion group.
	
	local (rootName = config.mainResponder.prefs.defaultDiscussRoot, adr);
	
	if pta == nil { //if the address of the page table wasn't passed...
		try {pta = html.getPageTableAddress ()}}; //...get the address of the page table
	
	if defined (pta^.discussionRoot) { //is the name of dg in the page table?
		rootName = pta^.discussionRoot}; //get the name of the dg from the page table
	
	adr = @[system.temp.mainResponder.discussRootFile].[rootName]; //get the address of the discussion group
	
	on error () {
		scriptError ("There is no discussion root named \"" + rootName + "\".")}; //It doesn't exist: generate a script error
	
	if not defined (adr^) { //does this discussion group exist?
		error ()};
	
	if typeOf (adr^) == addressType or typeOf (adr^) == stringType { //PBS 10/2/99: handle addresses in discuss.root
		if not defined (adr^^) { //make sure this address points somewhere
			error ()};
		adr = adr^}; //de-reference the address
	
	return (adr)} //return the address of the discussion group



This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.