📄 mkmoddir.sh
字号:
#! /bin/sh## $Id: mkmoddir.sh,v 1.3 92/12/09 18:41:41 bill Exp $## MKMODDIR - create a Code Model directory and install default template files## usage: mkmoddir [directory][-m spice-model-name][-c c-function-name]## If the names are not given on the command line, they are read# interactively.## Steve Tynor - March 1991### Copyright 1992# Georgia Tech Research Corporation# All Rights Reserved.# This material may be reproduced by or for the U.S. Government# pursuant to the copyright license under the clause at DFARS# 252.227-7013 (Oct. 1988)### Note: not using shell functions for error messages since older# versions of sh (such as the one in Apollo's Domain/OS 10.3) do not# support them.# Include global XSPICE definitions. /usr/local/xspice-1-0/include/shell.includetemplate_dir=$ROOT/lib/cmt/mkmoddirtempl_mf=$template_dir/Makefile.tpltempl_ifs=$template_dir/ifspec.tpltempl_mod=$template_dir/cfunc.tplprog=$0usage="usage: mkmoddir [directory][-m spice-model-name][-c c-function-name]"dirname=modname=funcname=# Get arguments from command line, if anyechowhile [ -n "$1" ]do case $1 in -m) if [ -n "$modname" ] then echo echo ERROR: SPICE Model name already set. echo $usage exit 1 echo fi shift modname=$1 ;; -c) if [ -n "$funcname" ] then echo echo ERROR: C Function name already set. echo $usage echo exit 1 fi shift funcname=$1 ;; ?*) if [ -n "$dirname" ] then echo echo ERROR: Directory name already set. echo $usage echo exit 1 fi dirname=$1 ;; esac shiftdone# Prompt for any needed names not given on command lineif [ -z "$dirname" ]then echo -n "Directory name: " read dirnamefiif [ -z "$modname" ]then modname=`basename $dirname` echo -n "SPICE model name ["$modname"]: " read tmp if [ -n "$tmp" ] then modname=$tmp fifiif [ -z "$funcname" ]then funcname=ucm_$modname echo -n "C function name ["$funcname"]: " read tmp if [ -n "$tmp" ] then funcname=$tmp fifi# Check for valid dirname, modname, and funcnameif [ -z "$dirname" -o -z "$modname" -o -z "$funcname" ]then echo echo ERROR: invalid directory, SPICE model, or C function name. echo exit 1fi# Create the directoryechomkdir $dirnameif [ 0 != $? ]then echo echo ERROR: mkdir failed - unable to create model directory: $dirname. echo exit 1fi# Copy in the file templates and run "sed" to set the modname# and funcname in the files.cp $templ_mf $dirname/Makefileif [ 0 != $? ]then echo echo ERROR: Makefile template copy failed. echo exit 1fised -e "s/C_FUNC_NAME/$funcname/g" -e "s/MODEL_NAME/$modname/g" \ $templ_ifs > $dirname/ifspec.ifsif [ 0 != $? ]then echo echo ERROR: ifspec.ifs template copy failed. echo exit 1fised -e "s/C_FUNC_NAME/$funcname/g" -e "s/MODEL_NAME/$modname/g" \ $templ_mod > $dirname/cfunc.modif [ 0 != $? ]then echo echo ERROR: cfunc.mod template copy failed. echo exit 1fi# Report success.echoecho Model Directory \"$dirname\" created.echoecho Edit files \"ifspec.ifs\" and \"cfunc.mod\"echo to define your model. Then run \"make\" toecho preprocess and compile it.echoexit 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -