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

system.verbs.builtins.html.runDirective

on runDirective (linetext, adrPageTable=@websites.["#data"]) { <<4.2 -- extracted from renderObject macro
	if html.getPref ("useKernelCode", adrPageTable) {
		on kernelcall (linetext, adrPageTable) {
			kernel (html.runDirective)};
		return (kernelcall (linetext, adrPageTable))}
	else {
		<<linetext contains a #directive line
			<<Process the directive and return the name of the directive
		<<11/12/97 at 8:44:54 AM by DW -- adrPageTable is an optional param
			<<Had to change the implementation.
			<<Old method: build a script that's an assignment statement.
			<<New method: evaluate the expression and assign into the pagetable field.
			<<The old method for constructing an address won't work for non-global tables.
			<<I don't believe this will break anything.
		
		local (s = string.commentDelete (linetext));
		local (fieldname = string.nthField (s, ' ', 1));
		s = string.delete (s, 1, sizeof (fieldname) + 1); <<delete name and space
		try {delete (@adrPageTable^.[fieldname])}; <<avoid Can't Assign Over error
		
		try {
			adrPageTable^.[fieldname] = evaluate (s)}
		else {
			scriptError ("Error evaluating #" + linetext + ": " + tryError)};
		
		local (lastdirective = string.lower (fieldname)); <<4.2
		if lastdirective == "template" { <<4.0.2
			adrPageTable^.indirectTemplate = true};
		return (lastdirective)}}



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.