#! /usr/bin/perl -w # # Copyright 2014, General Dynamics C4 Systems # # This software may be distributed and modified according to the terms of # the GNU General Public License version 2. Note that NO WARRANTY is provided. # See "LICENSE_GPLv2.txt" for details. # # @TAG(GD_GPL) # print <; close SRC; $code =~ /> module (SEL4[a-zA-Z0-9.]*)/; $module = $1; next unless defined $module; $moduledepth = 0; $moduledepth++ while($module =~ /\./g); while($code =~ /> import (qualified )?({-# SOURCE #-} )?(SEL4[a-zA-Z0-9.]*)/g) { $import = $3; $is_source = defined $2; @options = (); if($is_source) { @options = (@options, "style=dotted", "dir=back"); } $importdepth = 0; $importdepth++ while($import =~ /\./g); if($moduledepth == $importdepth) { @options = (@options, "constraint=false"); } $options = join ",", @options; if($is_source) { print qq(\t"$import" -> "$module" [$options];\n); } else { print qq(\t"$module" -> "$import" [$options];\n); } } } print "}\n";