EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  <20012002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  <20012002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Capfast Rules in 3.13.4 RULES.Host
From: Brian Bevins <[email protected]>
To: Ralph Lange <[email protected]>
Cc: Rozelle Wright <[email protected]>, [email protected], [email protected]
Date: Wed, 04 Apr 2001 11:17:00 -0400
Attached is the script we use at Jefferson Lab for this purpose. Feed it
the name of a top level schematic and it creates a list of dependencies
for inclusion in Makefiles.

--Brian Bevins
  Accelerator Controls Group
  Jefferson Lab

Ralph Lange wrote:
> 
> Andy,
> 
> I just checked the CVS: the change you are referring to was introduced
> to RULES.Host in September 1997, between 3.13.0.beta11 and beta12, so
> please excuse us if we don't instantly remember all the details...
> 
> Rozelle is right: at that time all the database generation rules were
> shifted into a local $TOP/config/RULES.Db file that had additional
> features over the "standard" rules in base. The document that Rozelle
> pointed you to describes the details. Any newly generated application
> would of course contain these rules.
> 
> At that point the "standard" rules in base were cleaned up, which led to
> the $(DEPSCHS) dependency being thrown out of RULES.Host - a change that
> probably only shows up when converting old applications without creating
> a new $TOP with the new rules.
> 
> Please note also that at the APS, where the Makefile system development
> is done, CapFast is not used. At BESSY, where the DB rules originate
> from, CapFast is used, but without hierarchical structures. At LANL
> hierarchical CapFast schematics are used, but not with $(DEPSCHS).
> 
> IMHO the best way to handle the hierarchical CapFast drawings would be
> writing a perl script that analyzes the schematics files and extracts
> the dependencies into a file that can be included by the Makefile ...
> whoever speaks the .sch language well enough may volunteer for that.
> 
> Until then, use a local RULES.Db that still has the $(DEPSCHS).
> 
> Hope this helps,
> Ralph
#! /bin/csh -f

# MAKE CAPFAST SCHEMATIC DEPENDENCIES:
# CAPFAST USER SYMBOL HIERARCHY VIEWER & SYMBOLIC LINK MAKER
# ----------------------------------------------------------
# File:      mkDepends
# Author:    George Lahti
# Date:      30 March 1995
#
# This sch shell script starts with a root CAPFAST schematic (.sch file) and
# determines all symbols and related schematics in the symbol hierarchy.  To
# get these symbols, it can search user defined directories to find the .sym
# and .sch files.  If these files are found in other directories, then a
# symbolic link will be made to them.  This script also creates a schematic
# depedency file (.depends file) to be used by the makefile.  Standard out
# shows the symbol hierarchy, using various indents for each level.
# Summary of actions:
#   1. Symbol hierarchy to standard-out.
#   2. Creates a hierarchical .sym/.csh dependency file (.depends).
#   3. Creates symbolic links for .sym/.sch files not in this directory.
#   4. Creates a .noSym log file for unfound symbols and failed links.
#
# Usage:  mkDepends ROOT_SCHEMATIC [SEARCH_PATH_FILE]
#   where ROOT_SCEMATIC is the root (base) .sch file name (with or
#   without the .sch file suffix), and SEARCH_PATH_FILE is the name
#   of the file that lists the firectory paths to search if the
#   .sym and .sch files are not found in the present directory.
#
# SEARCH_PATH_FILE Format:  This is an ascii file, with one directory
#   path per line.  This file can be empty.  But usually the file
#   name is not even given to the command if there are no search paths.
#   It is usually best to give relative paths, since the whole
#   directory tree could be place anywhere.  Caution, do not use
#   "nO_sEaRcH" as the name of the file; it is for internal use only.
#   Example:  ..
#             ../templates
#             ../other
#
# Search order:
#   1. Present directory.
#   2. User supplied search path file (the same order as in the file).
#   3. System directory.
#
# CAUTION:  This is a recursive shell script file.  The third and
# fourth arguments are used only for the recursion calls.  The
# user should not enter more than 2 arguments.

# Help and error message.
if ($1 == "") then
    echo "CAPFAST USER SYMBOL HIERARCHY VIEWER & SYMBOLIC LINK MAKER"
    echo "Error: Missing some arguments."
    echo "Usage: mkDepends SCH_FILE SEARCH_PATHS_FILE"
    echo "Example: mkDepends rfn02 schPaths"
    echo "Caution: do NOT enter more than 2 arguments."
    exit 0
endif

# Present command name with path.
set thisCmd = $0

# User command inputs.
set fileBase = $1:r
if ($2 == "") then
    set searchFile = "nO_sEaRcH"
else
    set searchFile = $2
endif
set symFile = $fileBase.sym
set schFile = $fileBase.sch

# Path to the Epics system symbols.
set sysPath = $P3/library/epics

# Determine the search path.
if ($searchFile == "nO_sEaRcH") then
    set searchPath = ""   
else
    if (-r $searchFile) then
	set searchPath = `cat -v $searchFile`
    else
	echo "mkDepends:  ERROR  cannot open search file ($searchFile)"
	exit 1
    endif
endif

# Dependency output file (argument #3 of the recursive call).
if ($3 == "") then
    # First time through, create a new dependency file with header text.
    set dependsFile = $fileBase.depends
    rm -f $dependsFile
    echo "# CAPFAST Schematic User Symbol Hierarchy." > $dependsFile
    echo "# The base schematic is:  $schFile" >> $dependsFile
    echo -n "SCH_OBJS = " >> $dependsFile
    # First time through, remove the .noSym file.
    set noSymLogFile = $dependsFile:r.noSym
    rm -f $noSymLogFile
else
    set dependsFile = $3
    set noSymLogFile = $dependsFile:r.noSym
endif

# Hierarchy level (argument #4 of the recursive call)
if ($4 == "") then
    # First time through, set the hierarchy level to 1.
    set recursionLevel = 1
    echo "CAPFAST USER SYMBOL HIERARCHY FOR $schFile.sch"
    echo "DEPENDENCY FILE IS $dependsFile"
else
    @ recursionLevel = $4 + 1
endif

# Search for the .sch file.
set schFound = 0
if (-r ./$schFile) then
    set schFound = 1
else
    foreach onePath ($searchPath)
	if (-r $onePath/$schFile) then
	    echo "ln -s $onePath/$schFile $schFile"
	    ln -s $onePath/$schFile $schFile
	    if (-r $schFile) then
		set schFound = 1
	    else
		echo "mkDepends: ERROR link failed ($schFile)"
		echo "$schFile --- link failed" >> $noSymLogFile
	    endif
	break
	endif
    end
endif

# Send symbol name information to standard out and the .depends file.
if ($recursionLevel != 1) then
    @ lev = $recursionLevel
    @ lev--
    while ($lev)
	echo -n "    "
	echo -n "    " >> $dependsFile
	@ lev--
    end
    if ($schFound == 1) then
	echo "$fileBase"
	echo "$symFile $schFile \" >> $dependsFile
    else
	echo "$fileBase (no .sch file)"
	echo "$symFile \" >> $dependsFile
    endif
else
    if ($schFound == 1) then
	echo "$fileBase"
	echo "$schFile \" >> $dependsFile
    endif
endif

# Process all symbols in this .sch file.
if ($schFound == 1) then
    # Make  list of all symbol references in this .sch file.
    set symbolList = `awk '/^use/ { if ($7 != "frame") print $2 }' \
	$schFile | sort -u`
    # For each symbol reference, check if the symbol file (.sym) exists.
    # If it doesn't exist, then append this symbol name to the symbol-
    # not-found log file.  If the symbol exists and it is a user symbol,
    # then execute a recursive call of this script file to read the
    # associated .sch file.
    foreach symbol ($symbolList)
	if ($symbol == "inhier" || $symbol == "outhier") then
	    continue
	endif
	# Search for the .sch file.
	set symFile = $symbol.sym
	if (-r ./$symFile) then
	    $thisCmd $symbol.sch $searchFile $dependsFile $recursionLevel
	    continue
	endif
	foreach onePath ($searchPath)
	    if (-r $onePath/$symFile) then
		echo "ln -s $onePath/$symFile $symFile"
		ln -s $onePath/$symFile $symFile
		if (-r $symFile) then
		    $thisCmd $symbol.sch $searchFile $dependsFile $recursionLevel
		else
		    echo "mkDepends: ERROR link failed ($symFile)"
		    echo "$symFile --- link failed" >> $noSymLogFile
		endif
		# Break out of this foreach, but continue with the outer foreach.
		break; continue
	    endif
	end
	if (-r $sysPath/$symFile) then
	    continue
	endif
	echo $symbol >> $noSymLogFile
    end
endif

# Top level completion actions.
if ($recursionLevel == 1) then
    if ($schFound == 0) then
	echo "ERROR  root .sch file does not exist ($schFile)"
    endif
    # Append a blank line to the end of the .depends file, so that
    # the trailing \ character does not cause any problems.
    echo "\n" >> $dependsFile
    # Clean up the .noSym file.
    if (-r $noSymLogFile) then
	sort -u $noSymLogFile > mkDepends.tmp
	mv mkDepends.tmp $noSymLogFile
    endif
endif    


References:
Re: Capfast Rules in 3.13.4 RULES.Host Rozelle Wright
Re: Capfast Rules in 3.13.4 RULES.Host Ralph Lange

Navigate by Date:
Prev: [no subject] Mohan Ramanathan
Next: Sequencer 2.0.0 Mythili Srinivasan
Index: 1994  1995  1996  1997  1998  1999  2000  <20012002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Capfast Rules in 3.13.4 RULES.Host Ralph Lange
Next: Re: Capfast Rules in 3.13.4 RULES.Host Nick Rees
Index: 1994  1995  1996  1997  1998  1999  2000  <20012002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Aug 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·