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


on getDomainName (dottedid) { //turn a dotted id into a domain name
	<<9/24/98; 1:18:46 PM by DW
		<<we cache the domain names in system.temp
		<<sub-items of system.temp don't survive a restart
	<<9/30/98; 4:45:40 PM by DW
		<<If the lookup fails, we return the dotted id.
	local (adrcache = @system.temp.ipCache);
	if not defined (adrcache^) {
		new (tabletype, adrcache)};
	local (adritem = @adrcache^.[dottedid]);
	if defined (adritem^) {
		return (adritem^)}
	else {
		local (s);
		try {
			s = tcp.addressToName (tcp.addressEncode (dottedid))}
		else {
			s = dottedid};
		adritem^ = s;
		return (s)}}
<<bundle //test code
	<<dialog.alert (getDomainName ("")) //doesn't have a DNS record
	<<for i = 1 to 100
		<<s = getDomainName ("")
	<<dialog.alert (s)

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.