Notifications
Clear all

[Closed] Refs struct in 2011 & 2012

 JHN

As I’m mostly in 2010, I can’t use it, but in 2011 and 2012 there’s new (undocumented) options to the refs struct.


#Struct:refs(
  getReference:<fn>; Public,
  DependencyLoopTest:<fn>; Public,
  getIndirectReference:<fn>; Public,
  dependentNodes:<fn>; Public,
  getNumRefs:<fn>; Public,
  getNumIndirectRefs:<fn>; Public,
  dependents:<fn>; Public,
  setIndirectReference:<fn>; Public,
  replaceReference:<fn>; Public,
  dependsOn:<fn>; Public)

A snippet to accompany it (provided by Larry Minton on the 2011 beta I was on) :


fn dumpRefHierachy ref indent:"" =
(
	if ref != undefined do
	(
		local nrefs = refs.getnumrefs ref
		if nrefs != 0 do
		(
			format "	%========== Direct References =============
" indent
			local subIndent = indent += "	"
			for i = 1 to nrefs do
			(
				local subRef = refs.getReference ref i
				format "%% : %
" indent i subRef
				dumpRefHierachy subRef indent:subIndent
			)
		)
		local nirefs = refs.getNumIndirectRefs ref
		if nirefs != 0 do
		(
			format "	%========== Indirect References =============
" indent
			local subIndent = indent += "	"
			for i = 1 to nirefs do
			(
				local subRef = refs.getIndirectReference ref i
				format "%% : %
" indent i subRef
				dumpRefHierachy subRef indent:subIndent
			)
		)
	)
)
dumpRefHierachy $

As I haven’t seen it mentioned before, I thought I’d post this here. I have not used this new tools myself and really haven’t taken a good look, but maybe it’s of help to someone on 2011/2012.

-Johan

1 Reply
 PEN

I have yet to use it as well. Thanks for posting as I forgot that this was added so I might need it at some point, could you post it again at that time as I’m sure to forget again:S