Source

LIME / lib / incarnator.awk

Full commit
#!/usr/bin/awk -f
##################################################################
# Lower the graph by deriving node instances from edge instances
#
#Copyright (C) 2008 NXP Semiconductors B.V.
#
#This file is part of LIME.
#
#LIME is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License version 2
#as published by the Free Software Foundation; either version 2
#of the License, or (at your option) any later version.
#
#LIME is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with LIME.  If not, see <http://www.gnu.org/licenses/>.
##################################################################
BEGIN { strict=0 }

@include gxfproc.awk

func postprocess(f, i,fr,to,nf,nt,a) 
{
  for (i=1; i<=nedges[f]; i++)
  {
	derive_from(f,i)
	derive_to(f,i)

	if (!is_anyinstance(f,fn)) {
	  nf=fn "_" stream_ninstances[fpar,fn]+0
	  if ((f,nf) in node_idx); else instantiate(f,nf,fpar,fn)
	  edge_from[f,i]=nf SUBSEP fp
	}

	if (!is_anyinstance(f,tn)) {
	  nt=tn "_" stream_ninstances[tpar,tn]+0
	  if ((f,nt) in node_idx); else instantiate(f,nt,tpar,tn)
	  edge_to[f,i]=nt SUBSEP tp
	}
  }
}

END { postprocess(f)
      dump_all(f) }

@include gxf-parser.awk