refdes_renum: warn of possible number clash with non-conforming values
[geda-gaf/whiteaudio.git] / docs / wiki / geda-ngnutmeg_mp.html
blob73511621eb958f8347d26b8af752b027c0aa6062
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html>
4 <head>
5 <title></title>
6 <link rel="stylesheet" media="screen" type="text/css" href="./style.css" />
7 <link rel="stylesheet" media="screen" type="text/css" href="./design.css" />
8 <link rel="stylesheet" media="print" type="text/css" href="./print.css" />
10 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
11 </head>
12 <body>
15 <h1 class="sectionedit208"><a name="ngnutmeg_man-page" id="ngnutmeg_man-page">ngnutmeg man-page</a></h1>
16 <div class="level1">
17 <pre class="code">NUTMEG(1) NUTMEG(1)
21 NAME
22 nutmeg - spice post-processor
24 SYNOPSIS
25 nutmeg [ - ] [ -n ] [ -t term ] [ datafile ... ]
27 DESCRIPTION
28 Nutmeg is a post processor for SPICE - it takes the raw output file
29 created by spice -r and plots the data on a graphics terminal or a
30 workstation display. Note that the raw output file is different from
31 the data that SPICE writes to the standard output.
33 Arguments are:
35 - Don’t try to load the default data file (&quot;rawspice&quot;) if no other
36 files are given.
38 -n (or --no-spiceinit)
39 Don’t try to source the file &quot;.spiceinit&quot; upon startup. Normally
40 nutmeg tries to find the file in the current directory, and if
41 it is not found then in the user’s home directory.
43 -t term (or --term=term)
44 The program is being run on a terminal with mfb name term.
46 -h (or --help)
47 Display a verbose help on the arguments available to the pro-
48 gram.
50 -v (or --version)
51 Display a version number and copyright information of the pro-
52 gram.
54 Further arguments are taken to be data files in binary or ascii format
55 (see sconvert(1)) which are loaded into nutmeg. If the file is in
56 binary format, it may be only partially completed (useful for examining
57 SPICE ouput before the simulation is finished). One file may contain
58 any number of data sets from different analyses.
60 Nutmeg data is in the form of vectors: time, voltage, etc. Each vector
61 has a type, and vectors can be operated on and combined algebraicly in
62 ways consistent with their types. Vectors are normally created when a
63 data file is read in (see the load command below), and when the initial
64 datafile is loaded. They can also be created with the let command.
66 An expression is an algebraic formula involving vectors and scalars (a
67 scalar is a vector of length 1), and the following operations:
69 +, -, *, %, /, ^, and ,.
71 % is the modulo operator, and the comma operator has two meanings: if
72 it is present in the argument list of a user-definable function, it
73 serves to seperate the arguments. Otherwise, the term x , y is synony-
74 mous with x + j(y).
76 Also available are the logical operations &amp; (and), | (or), ! (not), and
77 the relational operations &lt;, &gt;, &gt;=, &lt;=, =, and &lt;&gt; (not equal). If used
78 in an algebraic expression they work like they would in C, producing
79 values of 0 or 1. The relational operators have the following syn-
80 onyms: &quot;gt&quot; is &gt;, &quot;lt&quot; is &lt;, &quot;ge&quot; is &gt;=, &quot;le&quot; is &lt;=, &quot;ne&quot; is &lt;&gt;, &quot;eq&quot;
81 is =, &quot;and&quot; is &amp;, &quot;or&quot; is |, and &quot;not&quot; is !. These are useful when &lt;
82 and &gt; might be confused with IO redirection (which is almost always).
84 The following functions are available:
86 mag(vector) - The magnitude of vector.
88 ph(vector) - The phase of vector.
90 j(vector) - i (sqrt(-1)) times vector.
92 real(vector) - The real component of vector.
94 imag(vector) - The imaginary part of vector.
96 db(vector) - 20 * log10(mag(vector)).
98 log(vector) - The logarithm (base 10) of the vector.
100 ln(vector) - The natural logarithm (base e) of vector.
102 exp(vector) - e to the vector power.
104 abs(vector) - The absolute value of vector.
106 sqrt(vector) - The square root of vector.
108 sin(vector) - The sin of vector.
110 cos(vector) - The cosine of vector.
112 tan(vector) - The tangent of vector.
114 atan(vector) - The inverse tangent of vector.
116 norm(vector) - The vector normalized to 1 (i.e, the largest mag-
117 nitude of any component will be 1).
119 rnd(vector) - A vector with each component a random integer
120 between 0 and the absolute value of the vectors’s corresponding
121 component.
123 mean(vector) - The result is a scalar (a length 1 vector) that
124 is the mean of the elements of vector.
126 vector(number) - The result is a vector of length number, with
127 elements 0, 1, ... number - 1. If number is a vector then just
128 the first element is taken, and if it isn’t an integer then the
129 floor of the magnitude is used.
131 length(vector) - The length of vector.
133 interpolate(plot.vector) - The result of interpolating the named
134 vector onto the scale of the current plot. This function uses
135 the variable polydegree to determine the degree of interpola-
136 tion.
138 A vector may be either the name of a vector already defined, a float-
139 ing- point number (a scalar), or a list like [elt1 elt2 ... eltn],
140 which is a vector of length n. A number may be written in any format
141 acceptable to SPICE, such as 14.6MEG or -1.231E-4. Note that you can
142 either use scientific notation or one of the abbreviations like MEG or
143 G, but not both. As with SPICE, a number may have trailing alphabetic
144 characters after it.
146 The notation expr [lower upper], where lower and upper are numbers,
147 denotes the range of elements from expr between lower and upper. The
148 notation expr [num] denotes the num’th element of expr. If upper is
149 lower than lower, the order of the elements in the vector is reversed.
150 In all other cases, [ and ] serve to surround literal vectors as
151 described above. (You may have to use a lot of parentheses to make
152 sure that you get what you want. For instance, you have to type print
153 (foo) ([1 2]) to print the two vectors. Otherwise it will be inter-
154 preted as a function call or a vector with an index.) Note that the
155 expression foo[10 20][5] will not yield the 15th element of foo, but
156 rather the 5th. In general only the last index suffix on an expression
157 will take effect.
159 To reference vectors in a plot that is not the current plot (see the
160 setplot command, below), the notation plotname.vecname can be used.
162 Either a plotname or a vector name may be the wildcard all. If the
163 plotname is all, matching vectors from all plots are specified, and if
164 the vector name is all, all vectors in the specified plots are refer-
165 enced. Note that you may not use binary operations on expressions
166 involving wildcards - it is not obvious what all + all should denote,
167 for instance.
169 Thus some (contrived) examples of expressions are:
171 cos(TIME) + db(v(3))
173 sin(cos(log([1 2 3 4 5 6 7 8 9 10])))
175 TIME * rnd(v(9)) - 15 * cos(vin#branch) ^ [7.9e5 8]
177 not ((ac3.FREQ[32] &amp; tran1.TIME[10]) gt 3)
179 Nutmeg commands are as follows:
181 plot exprs [ylimit ylo yhi] [xlimit xlo xhi] [xindices xilo xihi]
182 [xcompress comp] [xdelta xdel] [ydelta ydel] [xlog] [ylog] [vs xname]
183 [xlabel word] [ylabel word] [title word] [samep]
184 Plot the given exprs on the screen (if you are on a graphics
185 terminal). The xlimit and ylimit arguments determine the high
186 and low x- and y-limits of the axes, respectively. The xindices
187 arguments determine what range of points are to be plotted -
188 everything between the xilo’th point and the xihi’th point is
189 plotted. The xcompress argument specifies that only one out of
190 every comp points should be plotted. If an xdelta or a ydelta
191 parameter is present, it specifies the spacing between grid
192 lines on the X- and Y-axis. These parameter names may be abbre-
193 viated to xl, yl, xind, xcomp, xdel, and ydel respectively. The
194 xname argument is an expression to use as the scale on the x-
195 axis. If xlog or ylog are present, the X or Y scale respec-
196 tively will be logarithmic. The xlabel and ylabel arguments
197 cause the specified labels to be used for the X and Y axes,
198 respectively. If samep is given, the values of the other param-
199 eters (other than xname) from the previous plot, hardcopy, or
200 asciiplot command will be used unless re-defined on the command
201 line. Finally, the title argument will be used in the place of
202 the plot name at the bottom of the graph.
204 hardcopy file plotargs
205 Just like plot, except creates a file called file containing the
206 plot. The file is an image in plot(5) format, and can be
207 printed by either the plot(1) program or lpr with the -g flag.
209 asciiplot plotargs
210 Produce a line printer plot of the vectors. The plot is sent to
211 the standard output, so you can put it into a file with asci-
212 iplot args ... &gt; file. The set options width, height, and
213 nobreak determine the width and height of the plot, and whether
214 there are page breaks, respectively. Note that you will have
215 problems if you try to asciiplot something with an X-scale that
216 isn’t monotonic (i.e, something like sin(TIME) ), because asci-
217 iplot uses a simple-minded sort of linear interpolation.
219 define function(arg1, arg2, ...) expression
220 Define the user-definable function with the name function and
221 arguments arg1, arg2, ... to be expression, which may involve
222 the arguments. When the function is later used, the arguments it
223 is given are substituted for the formal arguments when it is
224 parsed. If expression is not present, any definition for func-
225 tion is printed, and if there are no arguments to define then
226 all currently active definitions are printed. Note that you may
227 have different functions defined with the same name but differ-
228 ent arities. Some useful definitions are:
230 define max(x,y) (x &gt; y) * x + (x &lt;= y) * y
231 define min(x,y) (x &lt; y) * x + (x &gt;= y) * y
233 undefine function ...
234 Definitions for the named user-defined functions are deleted.
236 let name = expr
237 Creates a new vector called name with the value specified by
238 expr, an expression as described above. If expr is [] (a zero-
239 length vector) then the vector becomes undefined. If there are
240 no arguments, let is the same as display.
242 print [col] [line] expr ...
243 Prints the vector described by the expression expr. If the col
244 argument is present, print the vectors named side by side. If
245 line is given, the vectors are printed horizontally. col is the
246 default, unless all the vectors named have a length of one, in
247 which case line is the default. The options width, length, and
248 nobreak are effective for this command (see asciiplot). If the
249 expression is all, all of the vectors available are printed.
250 Thus print col all &gt; file will print everything in the file in
251 SPICE2 format. The scale vector (time, frequency) will always
252 be in the first column unless the variable noprintscale is true.
254 load [filename] ...
255 Loads the raw data in either binary or ascii format from the
256 files named. The default filename is rawspice, or the argument
257 to the -r flag if there was one.
259 source filename
260 Reads commands from the file filename. Lines beginning with the
261 character * are considered comments and ignored.
263 help [all] [command ...]
264 Prints help. If the argument all is given, a short description
265 of everything you could possibly type is printed. If commands
266 are given, descriptions of those commands are printed. Other-
267 wise help for only a few major commands is printed.
269 display [varname ...]
270 Prints a summary of currently defined vectors, or of the names
271 specified. The vectors are sorted by name unless the variable
272 nosort is set. The information given is the name of the vector,
273 the length, the type of the vector, and whether it is real or
274 complex data. Additionally, one vector will be labeled [scale].
275 When a command such as plot is given without a vs argument, this
276 scale is used for the X-axis. It is always the first vector in a
277 rawfile, or the first vector defined in a new plot. If you unde-
278 fine the scale (i.e, let TIME = []), a random remaining vector
279 will become the scale.
281 setplot [plotname]
282 Set the current plot to the plot with the given name, or if no
283 name is given, prompt the user with a menu. (Note that the
284 plots are named as they are loaded, with names like tran1 or
285 op2. These names are shown by the setplot and display commands
286 and are used by diff, below.) If the &quot;New plot&quot; item is
287 selected, the current plot will become one with no vectors
288 defined. Note that here the word &quot;plot&quot; refers to a group of
289 vectors that are the result of one SPICE run. When more than
290 one file is loaded in, or more than one plot is present in one
291 file, nutmeg keeps them seperate and only shows you the vectors
292 in the current plot.
294 settype type vector ...
295 Change the type of the named vectors to type. Type names can be
296 found in the manual page for sconvert.
298 diff plot1 plot2 [vec ...]
299 Compare all the vectors in the specified plots, or only the
300 named vectors if any are given. There are different vectors in
301 the two plots, or any values in the vectors differ significantly
302 the difference is reported. The variables abstol, reltol, and
303 vntol are used to determine what &quot;significantly&quot; means (see the
304 SPICE3 User’s Manual).
306 quit Quit nutmeg.
308 bug Send a bug report. (If you have defined BUGADDR, the mail will
309 go there.)
311 write [file] [exprs]
312 Writes out the expr’s to file. First vectors are grouped
313 together by plots, and written out as such. (I.e, if the
314 expression list contained three vectors from one plot and two
315 from another, then two plots will be written, one with three
316 vectors and one with two.) Additionally, if the scale for a
317 vector isn’t present, it is automatically written out as well.
318 The default format is ascii, but this can be changed with the
319 set filetype command. The default filename is rawspice, or the
320 argument to the -r flag on the command line, if there was one,
321 and the default expression list is all.
323 shell [args ...]
324 Fork a shell, or execute the arguments as a command to the
325 shell.
327 alias [word] [text ...]
328 Causes word to be aliased to text. History substitutions may be
329 used, as in C-shell aliases.
331 unalias [word ...]
332 Removes any aliases present for the words.
334 history [number]
335 Print out the history, or the last number commands typed at the
336 keyboard. Note: in version 3a7 and earlier, all commands
337 (including ones read from files) were saved.
339 set [word] [word = value] ...
340 Set the value of word to be value, if it is present. You can
341 set any word to be any value, numeric or string. If no value is
342 given then the value is the boolean ’true’. The value of word
343 may be inserted into a command by writing $word. If a variable
344 is set to a list of values that are enclosed in parentheses
345 (which must be seperated from their values by white space), the
346 value of the variable is the list. The variables meaningful to
347 nutmeg (of which there are too many) are:
349 abstol
350 The absolute tolerance used by the diff command.
352 appendwrite
353 Append to the file when a write command is issued, if
354 one already exists.
356 colorN
357 These variables determine the colors used, if X is
358 being run on a color display. N may be between 0 and
359 15. Color 0 is the background, color 1 is the grid and
360 text color, and colors 2 through 15 are used in order
361 for vectors plotted. The value of the color variables
362 should be names of colors, which may be found in the
363 file /usr/lib/rgb.txt.
365 combplot
366 Plot vectors by drawing a vertical line from each point
367 to the X-axis, as opposed to joining the points. Note
368 that this option is subsumed in the plottype option,
369 below.
371 cpdebug
372 Print cshpar debugging information. (Must be complied
373 with the -DCPDEBUG flag.)
375 debug
376 If set then a lot of debugging information is printed.
377 (Must be compiled with the -DFTEDEBUG flag.)
379 device
380 The name (/dev/tty??) of the graphics device. If this
381 variable isn’t set then the user’s terminal is used. To
382 do plotting on another monitor you will probably have
383 to set both the device and term variables. (If device
384 is set to the name of a file, nutmeg will dump the
385 graphics control codes into this file -- this is useful
386 for saving plots.)
388 echo
389 Print out each command before it is executed.
391 filetype
392 This can be either ascii or binary, and determines what
393 the format of rawfiles will be. The default is ascii.
395 fourgridsize
396 How many points to use for interpolating into when
397 doing fourier analysis.
399 gridsize
400 If this variable is set to an integer, this number will
401 be used as the number of equally spaced points to use
402 for the Y-axis when plotting. Otherwise the current
403 scale will be used (which may not have equally spaced
404 points). If the current scale isn’t strictly mono-
405 tonic, then this option will have no effect.
407 hcopydev
408 If this is set, when the hardcopy command is run the
409 resulting file is automatically printed on the printer
410 named hcopydev with the command lpr -Phcopydev -g file.
412 hcopydevtype
413 This variable specifies the type of the printer output
414 to use in the hardcopy command. If hcopydevtype is not
415 set, plot (5) format is assumed. The standard distri-
416 bution currently recognizes postscript as an alterna-
417 tive output format. When used in conjunction with
418 hcopydev, hcopydevtype should specify a format sup-
419 ported by the printer.
421 height
422 The length of the page for asciiplot and print col.
424 history
425 The number of events to save in the history list.
427 nfreqs
428 The number of frequencies to compute in the fourier
429 command. (Defaults to 10.)
431 nobreak
432 Don’t have asciiplot and print col break between pages.
434 noasciiplotvalue
435 Don’t print the first vector plotted to the left when
436 doing an asciiplot.
438 noclobber
439 Don’t overwrite existing files when doing IO redirec-
440 tion.
442 noglob
443 Don’t expand the global characters ‘*’, ‘?’, ‘[’, and
444 ‘]’. This is the default.
446 nogrid
447 Don’t plot a grid when graphing curves (but do label
448 the axes).
450 nomoremode
451 If nomoremode is not set, whenever a large amount of
452 data is being printed to the screen (e.g, the print or
453 asciiplot commands), the output will be stopped every
454 screenful and will continue when a carriage return is
455 typed. If nomoremode is set then data will scroll off
456 the screen without hesitation.
458 nonomatch
459 If noglob is unset and a global expression cannot be
460 matched, use the global characters literally instead of
461 complaining.
463 nosort
464 Don’t have display sort the variable names.
466 noprintscale
467 Don’t print the scale in the leftmost column when a
468 print col command is given.
470 numdgt
471 The number of digits to print when printing tables of
472 data (fourier, print col). The default precision is 6
473 digits. On the VAX, approximately 16 decimal digits
474 are available using double precision, so numdgt should
475 not be more than 16. If the number is negative, one
476 fewer digit is printed to ensure constant widths in
477 tables.
479 plottype
480 This should be one of normal, comb, or point:chars.
481 normal, the default, causes points to be plotted as
482 parts of connected lines. comb causes a comb plot to
483 be done (see the description of the combplot variable
484 above). point causes each point to be plotted seper-
485 ately - the chars are a list of characters that will be
486 used for each vector plotted. If they are omitted then
487 a default set is used.
489 polydegree
490 The degree of the polynomial that the plot command
491 should fit to the data. If polydegree is N, then nutmeg
492 will fit a degree N polynomial to every set of N points
493 and draw 10 intermediate points in between each end-
494 point. If the points aren’t monotonic, then it will try
495 rotating the curve and reducing the degree until a fit
496 is achieved.
498 polysteps
499 The number of points to interpolate between every pair
500 of points available when doing curve fitting. The
501 default is 10. (This should really be done automati-
502 cally.)
504 program
505 The name of the current program (argv[0]).
507 prompt
508 The prompt, with the character ‘!’ replaced by the cur-
509 rent event number.
511 rawfile
512 The default name for rawfiles created.
514 reltol
515 The relative tolerance used by the diff command.
517 rhost
518 The machine to use for remote SPICE-3 runs, instead of
519 the default one. (See the description of the rspice
520 command, below.)
522 rprogram
523 The name of the remote program to use in the rspice
524 command.
526 slowplot
527 Stop between each graph plotted and wait for the user
528 to type return before continuing.
530 sourcepath
531 A list of the directories to search when a source com-
532 mand is given. The default is the current directory
533 and the standard spice library (/usr/local/lib/spice,
534 or whatever LIBPATH is #defined to in the source.
536 spicepath
537 The program to use for the aspice command. The default
538 is /cad/bin/spice.
540 term
541 The mfb name of the current terminal.
543 units
544 If this is degrees, then all the trig functions will
545 use degrees instead of radians.
547 unixcom
548 If a command isn’t defined, try to execute it as a UNIX
549 command. Setting this option has the effect of giving
550 a rehash command, below. This is useful for people who
551 want to use nutmeg as a login shell.
553 verbose
554 Be verbose. This is midway between echo and debug /
555 cpdebug.
557 vntol
558 The absolute voltage tolerance used by the diff com-
559 mand.
561 width
562 The width of the page for asciiplot and print col.
564 xbrushheight
565 The height of the brush to use if X is being run.
567 xbrushwidth
568 The width of the brush to use if X is being run.
570 xfont
571 The name of the X font to use when plotting data and
572 entering labels. The plot may not look entirely great
573 if this is a variable-width font.
576 unset [word] ...
577 Unset the variables word.
579 shift [varname] [number]
580 If varname is the name of a list variable, it is shifted to the
581 left by number elements. (I.e, the number leftmost elements are
582 removed.) The default varname is argv, and the default number
583 is 1.
585 rusage [resource ...]
586 Print resource usage statistics. If any resources are given,
587 just print the usage of that resource. Currently valid
588 resources are:
590 elapsed
591 The amount of time elapsed since the last rusage elaped
592 call.
594 faults
595 Number of page faults and context switches (BSD only).
597 space
598 Data space used.
600 time
601 CPU time used so far.
603 everything
604 All of the above.
606 cd [directory] Change the current working directory to directory, or
607 to the user’s home directory if none is given.
609 aspice [output-file]
610 Start a SPICE-3 run, and when it is finished load the
611 data. The raw data is kept in a temporary file. If out-
612 put-file is specified then the diagnostic output is
613 directed into that file, otherwise it is thrown away.
615 jobs Report on the asynchronous SPICE-3 jobs currently run-
616 ning. Nutmeg checks to see if the jobs are finished
617 every time you execute a command. If it is done then
618 the data is loaded and becomes available.
620 rspice [input file]
621 Runs a SPICE-3 remotely taking the input file as a
622 SPICE-3 input deck, or the current circuit if no argu-
623 ment is given. Nutmeg waits for the job to complete,
624 and passes output from the remote job to the user’s
625 standard output. When the job is finished the data is
626 loaded in as with aspice. If the variable rhost is set,
627 nutmeg will connect to this host instead of the default
628 remote SPICE-3 server machine. Note that this command
629 will only work if your system administrator is running
630 a SPICE-3 daemon on the remote host. If the variable
631 rprogram is set, then rspice will use this as the path-
632 name to the program to run.
634 echo [stuff...] Echos the arguments.
636 fourier fundamental_frequency [value ...]
637 Does a fourier analysis of each of the given values,
638 using the first 10 multiples of the fundamental fre-
639 quency (or the first nfreqs, if that variable is set -
640 see below). The output is like that of the .four card.
641 The values may be any valid expression. The values are
642 interpolated onto a fixed-space grid with the number of
643 points given by the fourgridsize variable, or 200 if it
644 is not set. The interpolation will be of degree poly-
645 degree if that variable is set, or 1. If polydegree is
646 0, then no interpolation will be done. This is likely
647 to give erroneous results if the time scale is not
648 monotonic, though.
650 version [version id]
651 Print out the version of nutmeg that is running. If
652 there are arguments, it checks to make sure that the
653 arguments match the current version of SPICE. (This is
654 mainly used as a Command: line in rawfiles.)
656 rehash Recalculate the internal hash tables used when looking
657 up UNIX commands, and make all UNIX commands in the
658 user’s PATH available for command completion. This is
659 useless unless you have set unixcom first (see above).
661 The following control structures are available:
663 while condition
664 statement
668 While condition, an arbitrary algebraic expression, is true, execute
669 the statements.
671 repeat [number]
672 statement
676 Execute the statements number times, or forever if no argument is
677 given.
679 dowhile condition
680 statement
684 The same as while, except that the condition is tested after the
685 statements are executed.
687 foreach var value ...
688 statement
692 The statements are executed once for each of the values, each time with
693 the variable var set to the current one. (var can be accessed by the
694 $var notation - see below).
696 if condition
697 statement
699 else
700 statement
704 If the condition is non-zero then the first set of statements are exe-
705 cuted, otherwise the second set. The else and the second set of state-
706 ments may be omitted.
708 label word
710 If a statement of the form goto word is encountered, control is trans-
711 fered to this point, otherwise this is a no-op.
713 goto word
715 If a statement of the form label word is present in the block or an
716 enclosing block, control is transfered there. Note that if the label
717 is at the top level, it must be before the goto statement (i.e, a for-
718 ward goto may occur only within a block).
720 continue
722 If there is a while, dowhile, or foreach block enclosing this state-
723 ment, control passes to the test, or in the case of foreach, the next
724 value is taken. Otherwise an error results.
726 break
728 If there is a while, dowhile, or foreach block enclosing this state-
729 ment, control passes out of the block. Otherwise an error results.
731 Of course, control structures may be nested. When a block is entered
732 and the input is the terminal, the prompt becomes a number of &gt;’s
733 equalling the number of blocks the user has entered. The current con-
734 trol structures may be examined with the debugging command cdump.
736 If a word is typed as a command, and there is no built-in command with
737 that name, the directories in the sourcepath list are searched in order
738 for the file. If it is found, it is read in as a command file (as if
739 it were sourced). Before it is read, however, the variables argc and
740 argv are set to the number of words following the filename on the com-
741 mand line, and a list of those words respectively. After the file is
742 finished, these variables are unset. Note that if a command file calls
743 another, it must save its argv and argc since they will get altered.
744 Also, command files may not be re-entrant since there are no local
745 variables. (Of course, the procedures may explicitly manipulate a
746 stack...) This way one can write scripts analogous to shell scripts
747 for nutmeg and . Note that for the script to work with , it must begin
748 with a blank line (or whatever you like, since it will be thrown away)
749 and then a line with .control on it. This is an unfortunate result of
750 the source command being used for both circuit input and command file
751 execution. Note also that this allows the user to merely type the name
752 of a circuit file as a command, and it will be automatically run.
754 There are various command scripts installed in
755 /usr/local/lib/spice/scripts (or whatever the path is on your machine),
756 and the default sourcepath includes this directory, so you can use
757 these command files (almost) like builtin commands.
759 Nutmeg will use either X or MFB, depending on whether it finds the
760 variable DISPLAY in the environment. If you are using X on a worksta-
761 tion, it should already be present, but if you want to display graphics
762 on a different machine than the one you are running nutmeg on, DISPLAY
763 should be of the form machine:0.
765 If X is being used, the cursor may be positioned at any point on the
766 screen when the window is up and characters typed at the keyboard will
767 be added to the window at that point. The window may then be sent to a
768 printer using the xpr(1) program.
770 There are a number of pre-defined constants in nutmeg. They are:
771 pi pi
772 e The base of natural logarithms
773 c The speed of light
774 i The square root of -1
775 kelvin Absolute 0 in Centigrade
776 echarge The charge on an electron
777 boltz Boltzman’s constant
778 planck Planck’s constant (h)
781 These are all in MKS units. If you have another variable with a name
782 that conflicts with one of these then it takes precedence.
784 Nutmeg occasionally checks to see if it is getting close to running out
785 of space, and warns the user if this is the case. (This is more likely
786 to be useful with the SPICE front end.)
788 C-shell type quoting with &quot;&quot; and ’’, and backquote substitution may be
789 used. Within single quotes, no further substitution (like history sub-
790 stitution) is done, and within double quotes, the words are kept
791 together but further substitution is done. Any text between backquotes
792 is replaced by the result of executing the text as a command to the
793 shell.
795 Tenex-style (’set filec’ in the 4.3 C-shell) command, filename, and
796 keyword completion is possible: If EOF (control-D) is typed after the
797 first character on the line, a list of the commands or possible argu-
798 ments is printed. (If it is alone on the line it will exit nutmeg.) If
799 escape is typed, then nutmeg will try to complete what the user has
800 already typed. To get a list of all commands, the user should type
801 &lt;space&gt; ^D.
803 The values of variables may be used in commands by writing $varname
804 where the value of the variable is to appear. The special variables $$
805 and $&lt; refer to the process ID of the program and a line of input which
806 is read from the terminal when the variable is evaluated, respectively.
807 If a variable has a name of the form $&amp;word, then word is considered a
808 vector (see above), and its value is taken to be the value of the vari-
809 able. If $foo is a valid variable, and is of type list, then the
810 expression $foo[low-high] represents a range of elements. Either the
811 upper index or the lower may be left out, and the reverse of a list may
812 be obtained with $foo[len-0]. Also, the notation $?foo evaluates to 1
813 if the variable foo is defined, 0 otherwise, and $#foo evaluates to the
814 number of elements in foo if it is a list, 1 if it is a number or
815 string, and 0 if it is a boolean variable.
817 History substitutions, similar to C-shell history substitutions, are
818 also available - see the C-shell manual page for all of the details.
820 The characters ~, {, and } have the same effects as they do in the C-
821 Shell, i.e., home directory and alternative expansion. It is possible
822 to use the wildcard characters *, ?, [, and ] also, but only if you
823 unset noglob first. This makes them rather useless for typing algebraic
824 expressions, so you should set noglob again after you are done with
825 wildcard expansion. Note that the pattern [^abc] will match all charac-
826 ters except a, b, and c.
828 IO redirection is available - the symbols &gt;, &gt;&gt;, &gt;&amp;, &gt;&gt;&amp;, and &lt; have
829 the same effects as in the C-shell.
831 You may type multiple commands on one line, seperated by semicolons.
833 If you want to use a different mfbcap file than the default (usually
834 ~cad/lib/mfbcap), you have to set the environment variable MFBCAP
835 before you start nutmeg. The -m option and the mfbcap variable no
836 longer work.
838 VMS NOTES
839 Nutmeg can be run under VAX/VMS. Some features like command, etc com-
840 pletion, expansion of *, ?, and [], backquote substitution, the shell
841 command, and so forth do not work. (In fact command completion only
842 works on 4.2 or 4.3 BSD.)
844 Nutmeg will look for start-up commands in the file spice.rc in the cur-
845 rent directory.
847 The standard suffix for rawspice files in VMS is &quot;.raw&quot;.
849 You will have to respond to the -more- prompt during plot with a car-
850 riage return instead of any key as you can do on UNIX.
852 SEE ALSO
853 sconvert(1), spice(1), mfb(3), writedata(3)
855 AUTHOR
856 Wayne Christopher (faustus@cad.berkeley.edu)
858 BUGS
859 The label entry facilities are very primitive - after all, nutmeg isn’t
860 a graphics editor (yet). You must be careful to type very slowly when
861 entering labels -- nutmeg checks the X event queue once every second,
862 and can get very confused if characters arrive faster than that.
864 If you redefine colors after creating a plot window with X, and then
865 cause the window to be redrawn, it will not to the right thing.
867 When defining aliases like
869 alias pdb plot db( ’!:1’ - ’!:2’ )
871 you must be careful to quote the argument list substitutions in this
872 manner. If you quote the whole argument it might not work properly.
874 In a user-defined function, the arguments cannot be part of a name that
875 uses the plot.vec syntax. I.e,
877 define poke(duck) cos(tran1.duck)
879 won’t do the right thing.
881 If you type plot all all, or otherwise use a wildcard reference for one
882 plot twice in a command, bad things will happen.
884 The asciiplot command doesn’t deal with log scales or the delta key-
885 words.
887 There are probably some features that nutmeg doesn’t have yet.
889 CAVEATS
890 Often the names of terminals recognised by MFB are different from those
891 in /etc/termcap. Thus you may have to reset your terminal type with the
892 command
894 set term = termname
896 where termname is the name in the mfbcap file.
898 The hardcopy command is useless on VMS and other systems without the
899 plot command, unless the user has a program that understands plot(5)
900 format.
905 4th Berkeley Distribution 27 April 1987 NUTMEG(1)</pre>
907 </div>
908 </body>
909 </html>