home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mentor
- Path: sparky!uunet!europa.asd.contel.com!darwin.sura.net!zaphod.mps.ohio-state.edu!rpi!psinntp!psinntp!news.mentorg.com!gumby!mike
- From: mike@rtp-nc.mentorg.com (Mike Walsh)
- Subject: da_batch
- Sender: news@news.mentorg.com (News User)
- Message-ID: <1992Nov08.160329.4245@news.mentorg.com>
- Date: Sun, 08 Nov 1992 16:03:29 GMT
- Reply-To: mike@rtp-nc.mentorg.com
- Nntp-Posting-Host: rtp-nc.mentorg.com
- Organization: Mentor Graphics Corporation
- Keywords:
- Followup-To:
- Lines: 561
-
- There was a problem with "da_batch" running on the HP/Apollo. The
- Unix utility "cut" is located in /usr/ucb and not in /bin. This problem
- has been fixed so attached is a new and imporved version (v8.1_1.18)
- of "da_batch".
-
- Mike
- ---
- +--------------------------------------------------------------+
- | Michael P. Walsh mike@rtp-nc.mentorg.com |
- | mike_walsh@mentorg.com |
- | Application Engineer |
- | Mentor Graphics Corporation (919) 544-0200 |
- | 2525 Meridian Parkway, Suite 260 |
- | Research Triangle Park, North Carolina 27713 |
- +--------------------------------------------------------------+
- ========================== CUT HERE ===========================
- #! /bin/sh
- # This is a shell archive, meaning:
- # 1. Remove everything above the #! /bin/sh line.
- # 2. Save the resulting text in a file.
- # 3. Execute the file with /bin/sh (not csh) to create:
- # da_batch
- # This archive created: Sun Nov 8 11:01:24 1992
- # By: Mike Walsh ()
- export PATH; PATH=/bin:/usr/bin:$PATH
- if test -f 'da_batch'
- then
- echo shar: "will not over-write existing file 'da_batch'"
- else
- cat << \SHAR_EOF > 'da_batch'
- #!/bin/sh
- #
- # da_batch v8.1_1.18
- #
- # Batch edit schematics, cables, viewpoints, etc with a "dofile".
- #
- #
- # (c) October 1992 Mentor Graphics Corporation
- #
- #
- # Mike Walsh - Application Engineer
- # mike@rtp-nc.mentorg.com, mike_walsh@mentorg.com
- #
- # Mentor Graphics Corporation
- # 2525 Meridian Parkway, Suite 260
- # Research Triangle Park, NC 27713
- #
- # (919) 544-0200
- #
- # This Shell/Ampleware is NOT officially supported by Mentor Graphics!
- #
- ####################################################################
- ####################################################################
- ## The following software is "freeware" which Mentor Graphics ##
- ## Corporation provides as a courtesy to our users. "freeware" ##
- ## is provided "as is" and Mentor Graphics makes no warranties ##
- ## with respect to "freeware", either expressed or implied, ##
- ## including any implied warranties of merchantability or fitness ##
- ## for a particular purpose. ##
- ####################################################################
- ####################################################################
- #
-
- # Support for uprooted idea tree!
-
- MGC_HOME=${MGC_HOME-"/idea"}
-
- PATH="$MGC_HOME/bin:/bin:/usr/bin:/etc:/usr/ucb"
-
- TMP="$MGC_HOME/tmp"
-
- USAGE="Usage:: `basename $0` [-help] [-usage] [-version] [-lms] [-update_auto | -update_clear | -update_instance | -update_symbol | [-update_none | -noupdate]] [-follow | -nofollow] [-preview] [-readonly] [-cable | -component | -defvpt | -schematic | -symbol | -vhdl | -vpt vpt_name] -dofile do_file_name [-args do_file_args] design_name [design_name [...]]"
-
- # Defaults
-
- CABLE=""
- DA="da"
- DISCLAIMER=""
- DOFILE=""
- DOFILEARGS=""
- EXIT=""
- FOLLOW=""
- HELP=""
- OPENMODE="@editable"
- READONLY=""
- REVDATE="da_batch,v
- # Revision 1.18 1992/11/08 15:08:05 mike
- # Sun Nov 8 10:08:05 EST 1992
- #"
- REVDATE=`echo $REVDATE | sed -e 's/\#/@/' -e 's/^.*# //' -e 's/ #.*$//`
- UPDATE="@auto"
- SCHEMATIC=""
- SYMBOL=""
- USE=""
- VERSION="v8.1_1.18"
- VHDL=""
- VPT=""
-
- # Parse through command line
-
- while [ $# -gt 0 ]
- do
- case $1 in
- -*)
- case $1 in
- -args)
- shift
- DOFILEARGS=",$1" ;;
- -args*)
- DOFILEARGS=",`echo $1 | sed -e 's/.....//'`" ;;
- -cable)
- CABLE=$1 ;;
- -defvpt)
- VPT="default" ;;
- -disclaimer)
- DISCLAIMER="" ;;
- -dofile)
- shift
- DOFILE=$1 ;;
- -dofile*)
- DOFILE=`echo $1 | sed -e 's/.......//'` ;;
- -follow)
- FOLLOW="" ;;
- -help|-h)
- EXIT="$1"
- HELP="$1" ;;
- -lms)
- DA="da_lms" ;;
- -nodisclaimer)
- DISCLAIMER="$1" ;;
- -nofollow)
- FOLLOW="$1" ;;
- -noupdate)
- UPDATE="@noupdate" ;;
- -preview)
- PREVIEW="preview" ;;
- -readonly)
- READONLY=$1
- OPENMODE="@readonly" ;;
- -schematic)
- SCHEMATIC="$1" ;;
- -symbol)
- SYMBOL="`echo $1 | sed -e 's/.//'`" ;;
- -update_auto)
- UPDATE="@auto" ;;
- -update_clear)
- UPDATE="@clear" ;;
- -update_instance)
- UPDATE="@instance" ;;
- -update_none)
- UPDATE="@noupdate" ;;
- -update_symbol)
- UPDATE="@symbol" ;;
- -usage)
- EXIT="$1"
- USE="$1" ;;
- -version|-v)
- EXIT="$1" ;;
- -vhdl)
- VHDL="$1" ;;
- -vpt)
- shift
- VPT="$1" ;;
- -vpt*)
- VPT=`echo $1 | sed -e 's/....//'` ;;
- -*)
- echo "`basename $0`: unknown option $1"
- exit 1 ;;
- esac ;;
- *)
- DESIGNS="$DESIGNS $1" ;;
- esac
- shift
- done
-
- # Display the Mentor Graphics "freeware" disclaimer.
- # The display of this message can be disabled the the
- # "-nodisclaimer" switch.
-
- echo "// `basename $0` (DA Batch Edit Utility) $VERSION $REVDATE"
- if [ -z "$DISCLAIMER" ]
- then
- echo "// ##############################################################"
- echo "// The following software is \"freeware\" which Mentor Graphics"
- echo "// Corporation provides as a courtesy to our users. \"freeware\""
- echo "// is provided \"as is\" and Mentor Graphics makes no warranties"
- echo "// with respect to \"freeware\", either expressed or implied,"
- echo "// including any implied warranties of merchantability or fitness"
- echo "// for a particular purpose."
- echo "// ##############################################################"
- fi
-
- if [ ! -z "$USE" ]
- then
- echo "$USAGE"
- fi
-
- if [ ! -z "$HELP" ]
- then
- cat << EOF
-
- $USAGE
-
- "`basename $0`" will batch edit schematic sheets, cable sheets, design
- sheets, or vhdl source using the supplied "do file" as the set of
- edit operations.
-
- All objects in the database of the specified type are edited and it
- is important to note that the "dofile" is NOT responsible for opening,
- checking, saving, or closing design objects as all of these operations
- are handled automatically by "`basename $0`".
-
-
- Description of command line switches. Defaults are noted with (D).
-
- -args A[,A[,...]] Arguments to be suppled to the do file.
- Note that quotes charcters (",') may need
- to be escaped to avoid being interpreted by
- the shell.
-
- -cable Opens schematic sheets using the Logical
- Cabling interface.
-
- -defvpt Opens the schematic sheet objects through
- the default viewpoint.
-
- -dofile File Specify the "do file" that is to be used
- to batch edit the design database.
-
- -follow (D) Try to follow design hierarchy.
-
- -help This help text.
-
- -lms Design Architect with the LMS user module
- is used to execute the "do file" as opposed
- the standard load of DA. This allows global
- LMS operations to be accomplished.
-
- -noupdate Forces Design Architect to open schematic
- sheets in "noupdate" mode.
-
- -nofollow Do not try to follow design hierarchy.
-
- -readonly Forces Design Architect to open schematic
- sheets as "read only" objects. The "do file"
- should not have any commands that cause edits
- to the objects as no attempt to save the objects
- is made.
-
- -preview Preview the generated AMPLE function to standard
- output without actually executing the generated
- AMPLE function on the design database.
-
- -schematic (D) Open and operate on schematic sheet objects.
-
- -symbol Open and operate on symbol objects.
-
- -update_auto (D) Forces Design Architect to open schematic
- sheets in "auto update" mode.
-
- -update_clear Forces Design Architect to open schematic
- sheets in "update clear" mode.
-
- -update_instance Forces Design Architect to open schematic
- sheets in "update instance" mode.
-
- -update_none Forces Design Architect to open schematic
- sheets in "noupdate" mode.
-
- -update_symbol Forces Design Architect to open schematic
- sheets in "update symbol" mode.
-
- -usage Display brief synopsis of switches.
-
- -version Print the version of `basename $0` to the
- standard output.
-
- -vhdl Open and operate on VHDL design objects.
-
- -vpt vpt_name Opens the schematic sheets through the
- named viewpoint.
-
- Examples:
-
- % `basename $0` -dofile my_do_file -doargs \"ARG-1\",2 mux_board
-
- % `basename $0` -readonly -defvpt -dofile your_do_file mux_board
-
-
- EOF
- fi
-
- # Exit if "-version" switch or "-help" was specified
-
- if [ ! -z "$EXIT" ]
- then
- exit 0
- fi
-
- # Make sure design arguments were supplied
- if [ -z "$DESIGNS" ]
- then
- echo $USAGE
- exit 1
- fi
-
- # Make sure a valid do file was passed in
-
- if [ -z "$DOFILE" ]
- then
- echo "`basename $0`: \"do file\" was not specified"
- exit 1
- elif [ ! -f "$DOFILE" ]
- then
- echo "`basename $0`: \"do file\" $DOFILE does not exist"
- exit 1
- fi
-
- # Make sure user did not specify bogus switch combinations
-
- ARGS="$CABLE$SCHEMATIC$SYMBOL$VHDL$VPT"
- if [ "$ARGS" != "$CABLE" -a "$ARGS" != "$SCHEMATIC" -a "$ARGS" != "$SYMBOL" -a "$ARGS" != "$VHDL" -a "$ARGS" != "$VPT" ]
- then
- echo "`basename $0`: only one of [-cable | -defvpt | -schematic | -symbol | -vhdl | -vpt] may be specified."
- exit 1
- fi
-
- if [ -z "$DESIGNS" ]
- then
- echo $USAGE
- exit 1
- fi
-
- # Create temporary file for holding generated AMPLE code
- # that will be submitted to DA to execute the do file against
- # all of the sheets with.
-
- TMP_AMPLE="$TMP/`basename $0`.$$.ample"
-
- if [ -f "$TMP_AMPLE" ]
- then
- rm -f "$TMP_AMPLE"
- if [ $? -ne 0 ]
- then
- echo "`basename $0`: trouble creating temporary file ... aborting"
- exit 1
- fi
- fi
-
- touch "$TMP_AMPLE"
-
- if [ $? -ne 0 ]
- then
- echo "`basename $0`: trouble creating temporary file ... aborting"
- exit 1
- fi
-
- echo "function \$mgcrtp_`basename $0`(), indirect {" >> $TMP_AMPLE
- if [ -z "$VHDL" -a -z "$SYMBOL" ]
- then
- echo "local schem_window, check_window ;" >> $TMP_AMPLE
- elif [ ! -z "$VHDL" ]
- then
- echo "local vhdl_window ;" >> $TMP_AMPLE
- elif [ ! -z "$SYMBOL" ]
- then
- echo "local symbol_window, check_window ;" >> $TMP_AMPLE
- else
- echo "`basename $0`: massive confusion ... aborting!"
- exit 1
- fi
- echo "local session_window = \$get_active_window() ;" >> $TMP_AMPLE
-
- for DESIGN in $DESIGNS
- do
-
- # Make sure that operations are being
- # performed on a Mentor Graphics database.
-
- if [ ! -d $DESIGN -o ! -f $DESIGN.mgc_component.attr ]
- then
- echo "`basename $0`: mgc_component \"$DESIGN\" does not exist!"
- rm -f $TMP_AMPLE
- exit 1
- else
- if [ -z "$VHDL" -a -z "$SYMBOL" ]
- then
-
- # Need to figure out where and what are all of the schematic
- # objects and where and what are all of sheet objects within
- # those encountered schematic objects.
-
- if [ -z "$FOLLOW" ]
- then
- SCHEM_OBJS=`find $DESIGN -type d -print | list_contents -c -t mgc_schematic`
- else
- SCHEM_OBJS=`list_contents -c -t mgc_schematic $DESIGN`
- fi
-
- if [ -z "$SCHEM_OBJS" ]
- then
- echo "`basename $0`: $DESIGN is void of objects of type mgc_schematic"
- rm -f $TMP_AMPLE
- exit 1
- fi
-
- # Loop through all the schematic objects
-
- for i in $SCHEM_OBJS
- do
- i=`echo $i | cut -f1 -d':'`
- SHEET_OBJS=`list_contents -c -t mgc_sheet $i`
- if [ -z "$SHEET_OBJS" ]
- then
- echo "`basename $0`: $i is void of objects of type mgc_sheet"
- else
-
- # Loop though the sheet objects generating AMPLE code that will
- # open each sheet, run the do file, check and save the sheet if
- # appropriate, close the sheet, and move on.
-
- for j in $SHEET_OBJS
- do
- j=`echo $j | cut -f1 -d':'`
- echo "\$set_active_window(session_window) ;" >> $TMP_AMPLE
- if [ ! -z "$CABLE" ]
- then
- echo "\$\$open_cable_sheet(\"`dirname $i`\", \"`basename $i`\", \"`basename $j`\", $OPENMODE, @void, \"\", $UPDATE) ;" >> $TMP_AMPLE
- elif [ ! -z "$VPT" ]
- then
- echo "\$set_viewpoint(\"`dirname $i`\", \"$VPT\") ;" >> $TMP_AMPLE
- echo "\$\$open_design_sheet(\"`dirname $i`\", \"$VPT\", \"/\", \"`basename $j`\", $OPENMODE, @void, \"\", $UPDATE) ;" >> $TMP_AMPLE
- else
- echo "\$\$open_sheet(\"`dirname $i`\", \"`basename $i`\", \"`basename $j`\", $OPENMODE, @void, \"\", $UPDATE) ;" >> $TMP_AMPLE
- fi
- echo "schem_window = \$get_active_window() ;" >> $TMP_AMPLE
- echo "\$set_active_window(schem_window) ;" >> $TMP_AMPLE
- echo "\$dofile(\"$DOFILE\"$DOFILEARGS) ;" >> $TMP_AMPLE
- if [ -z "$READONLY" ]
- then
- echo "\$check() ;" >> $TMP_AMPLE
- echo "check_window = \$get_active_window() ;" >> $TMP_AMPLE
- echo "\$set_active_window(check_window) ;" >> $TMP_AMPLE
- echo "\$close_window(@discard) ;" >> $TMP_AMPLE
- echo "\$set_active_window(schem_window) ;" >> $TMP_AMPLE
- echo "\$save_sheet() ;" >> $TMP_AMPLE
- fi
- echo "\$close_window(@discard) ;" >> $TMP_AMPLE
- done
- fi
- done
-
- elif [ ! -z "$VHDL" ]
- then
-
- # Find the VHDL objects
-
- if [ -z "$FOLLOW" ]
- then
- VHDL_OBJS=`find $DESIGN -type d -print | list_contents -c -t vhdl`
- else
- VHDL_OBJS=`list_contents -c -t vhdl $DESIGN`
- fi
-
- if [ -z "$VHDL_OBJS" ]
- then
- echo "`basename $0`: $DESIGN is void of objects of type \"vhdl\""
- else
-
- # Loop through all VHDL objects generating AMPLE
- # code to edit the contents of each VHDL container.
-
- for i in $VHDL_OBJS
- do
- i=`echo $i | cut -f1 -d':'`
- echo "\$set_active_window(session_window) ;" >> $TMP_AMPLE
- echo "\$\$open_vhdl(\"`basename $i`\", \"`dirname $i`\", $OPENMODE, 0, \"\", \"\") ;" >> $TMP_AMPLE
- echo "vhdl_window = \$get_active_window() ;" >> $TMP_AMPLE
- echo "\$set_active_window(vhdl_window) ;" >> $TMP_AMPLE
- echo "\$dofile(\"$DOFILE\") ;" >> $TMP_AMPLE
- if [ -z "$READONLY" ]
- then
- echo "\$save_document() ;" >> $TMP_AMPLE
- fi
- echo "\$close_window(@discard) ;" >> $TMP_AMPLE
- done
- fi
-
- elif [ ! -z "$SYMBOL" ]
- then
-
- # Find the symbol objects
-
- if [ -z "$FOLLOW" ]
- then
- SYMBOL_OBJS=`find $DESIGN -type d -print | list_contents -c -t mgc_symbol`
- else
- SYMBOL_OBJS=`list_contents -c -t mgc_symbol $DESIGN`
- fi
-
- if [ -z "$SYMBOL_OBJS" ]
- then
- echo "`basename $0`: $DESIGN is void of objects of type \"vhdl\""
- else
-
- # Loop through all symbol objects generating AMPLE
- # code to edit the contents of each symbol container.
-
- for i in $SYMBOL_OBJS
- do
- i=`echo $i | cut -f1 -d':'`
- echo "\$set_active_window(session_window) ;" >> $TMP_AMPLE
- echo "\$\$open_symbol(\"`dirname $i`\", \"`basename $i`\", $OPENMODE, \"\") ;" >> $TMP_AMPLE
- echo "symbol_window = \$get_active_window() ;" >> $TMP_AMPLE
- echo "\$set_active_window(symbol_window) ;" >> $TMP_AMPLE
- echo "\$dofile(\"$DOFILE\") ;" >> $TMP_AMPLE
- if [ -z "$READONLY" ]
- then
- echo "\$check() ;" >> $TMP_AMPLE
- echo "check_window = \$get_active_window() ;" >> $TMP_AMPLE
- echo "\$set_active_window(check_window) ;" >> $TMP_AMPLE
- echo "\$close_window(@discard) ;" >> $TMP_AMPLE
- echo "\$set_active_window(symbol_window) ;" >> $TMP_AMPLE
- echo "\$save_symbol() ;" >> $TMP_AMPLE
- fi
- echo "\$close_window(@discard) ;" >> $TMP_AMPLE
- done
- fi
- else
- echo "`basename $0`: mass confusion ... aborting!"
- exit 1
- fi
- fi
- done
-
- echo "}" >> $TMP_AMPLE
-
- # Invoke Design Architect and submit the generated
- # AMPLE macro as batch input to Design Architect.
-
- if [ -z "$PREVIEW" ]
- then
- $MGC_HOME/bin/$DA -nodisplay <<!
- \$load_userware("$TMP_AMPLE", \$window_scope_name()) ;
- \$mgcrtp_`basename $0`() ;
- \$\$close_session(@void) ;
- !
- else
- cat $TMP_AMPLE
- fi
-
- rm -f $TMP_AMPLE
-
- exit 0
-
- SHAR_EOF
- chmod +x 'da_batch'
- fi
- exit 0
- # End of shell archive
-
-