lib/gen-dot.js
function hash_name_get(elem, names) {
		var fname;
		if (elem.fn !== undefined)
			fname = format_name(helpers.fname(elem, elem.fn.name));
		else
			fname = format_name(elem.name);
		var list = names[fname];

		// First unique instance of a function gets to use its proper name
		if (list === undefined) {
			names[fname] = [{fn : elem, name : fname, count : 0}];
			return fname;
		}

		// Search the linear chain for our element
		for (var i = 0; i < list.length; ++i) {
			if (list[i].fn === elem) {
				list[i].count += 1;
				return list[i].name+'__'+list[i].count;
			}
		}

		// Not in the list yet, add it with a unique name index
		fname = fname+'_'+list.length;
		list.push({fn : elem, name : fname, count : 0});
		return fname;
	}
function hash_name_get(elem, names) {
		var fname;
		if (elem.fn !== undefined)
			fname = format_name(helpers.fname(elem, elem.fn.name));
		else
			fname = format_name(elem.name);
		var list = names[fname];

		// First unique instance of a function gets to use its proper name
		if (list === undefined) {
			names[fname] = [{fn : elem, name : fname, count : 0}];
			return fname;
		}

		// Search the linear chain for our element
		for (var i = 0; i < list.length; ++i) {
			if (list[i].fn === elem) {
				list[i].count += 1;
				return list[i].name+'__'+list[i].count;
			}
		}

		// Not in the list yet, add it with a unique name index
		fname = fname+'_'+list.length;
		list.push({fn : elem, name : fname, count : 0});
		return fname;
	}
function hash_name_get ( elem , names ) { var fname ; if ( elem . fn !== undefined ) fname = format_name ( helpers . fname ( elem , elem . fn . name ) ) ; else fname = format_name ( elem . name ) ; var list = names [ fname ] ; // First unique instance of a function gets to use its proper name if ( list === undefined ) { names [ fname ] = [ { fn : elem , name : fname , count : 0 } ] ; return fname ; } // Search the linear chain for our element for ( var i = 0 ; i < list . length ; ++ i ) { if ( list [ i ] . fn === elem ) { list [ i ] . count += 1 ; return list [ i ] . name + '__' + list [ i ] . count ; } } // Not in the list yet, add it with a unique name index fname = fname + '_' + list . length ; list . push ( { fn : elem , name : fname , count : 0 } ) ; return fname ; }
Retrieve the proper name to use in the graph, for a given element. If it doesn't
exist in the hash table given, then it is added, and its allocated name is returned
@param elem The element (chain or function) to look up in the hash table
@param names The hash table to use to resolve and store names
@return Properly formatted name for the given element
Retrieve the proper name to use in the graph for a given element . If it doesn t exist in the hash table given then it is added and its allocated name is returned