File: libprm

package info (click to toggle)
ngspice 24-1
  • links: PTS, VCS
  • area: non-free
  • in suites: wheezy
  • size: 46,840 kB
  • sloc: ansic: 456,450; xml: 13,667; sh: 10,075; makefile: 3,407; perl: 1,590; yacc: 1,486; tcl: 823; pascal: 702; lex: 319
file content (70 lines) | stat: -rwxr-xr-x 1,260 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
#set -x -v 

# MW. Lip / Param parsing program for spice

# -n normal, -f full (keep everything), -r replace original file
# -e new addition start with editor, then like normal

export TMPLP=/tmp/LibPrm.$$-

function trapper()
    {
     echo User break! 
     echo Exiting . . .
     rm -f -v ${TMPLP}*
     unset TMPLP 
     exit 1
    }
    
trap trapper SIGINT SIGQUIT 

function operror()
    {
     echo Incorrect parameters: $*, $#
     unset TMPLP 
     exit 2
    }

function repnormpl()
    {
     mslib $1 ${TMPLP}1
     sed -n -e 'p' -e "1r ${TMPLP}1" $1 >${TMPLP}2
     spiceprm ${TMPLP}2 $2
    }

function keepall()
    {
     mslib $1
     sed -n -e 'p' -e "1r $1.lib" $1 >${TMPLP}2
     spiceprm ${TMPLP}2 $2
    }
    
function withedit()
    {
     joe $1
     mslib $1 ${TMPLP}1
     sed -n -e 'p' -e "1r ${TMPLP}1" $1 >${TMPLP}2
     spiceprm ${TMPLP}2 $2
    }


# Main body
if test $# -lt 2 -o $# -gt 3; then operror $*; fi
if !(test -f $2); then operror $*; fi

case $1$# in
-r3) operror $*;;
-n2) repnormpl $2 ${2%.cir}.ckt;;
-n3) repnormpl $2 $3;;
-r2) repnormpl $2 $2;;
-f2) keepall $2 ${2%.cir}.ckt;;
-f3) keepall $2 $3;;
-e2) withedit $2 ${2%.cir}.ckt;;
-e3) withedit $2 $3;;
esac

rm -f ${TMPLP}*
unset TMPLP 
exit 0