# 幸运飞艇超稳计划群

MacSpice > Inter-Process Communication

# Inter-Process Communication

### Introduction

macspice (v2.10 onwards) offers several mechanisms for communicating with other applications. these greatly expand the range of problems it can tackle; other applications can compensate for macspice's weaknesses, or exploit its strengths.

For example, the result of a noise analysis is often a very long list of values. This is difficult to convert into a designer-friendly form within MacSpice, but the results can easily be passed to the shell for processing by (1), (1), (1), etc., which were designed for this type of task.

Another example is a program that reads several user-supplied parameters then calculates a result. Finding an optimum combination of parameter values manually is a tedious process. However, the MacSpice optimize command can be used to automate the task via幸运飞艇超稳计划群 the inter-process communication mechanisms described below.

### Shell (Backquote) Evaluation

The m2wx85.cnmand interpreter handles quoted text as described in the User's Guide (§5.6). Text between backquote characters '' is expanded in several stages (alias substitution, history substitution, variable evaluation, etc.幸运飞艇超稳计划群) before being passed to (1) for evaluation.

This example stores the text "date" in the variable 'com', so the command 'date' is evaluated by bash(1)


MacSpice 1 -> set com = "date"
MacSpice 2 -> echo "It is now $com" It is now Sun Jun 17 23:43:05 BST 2007 MacSpice 3 ->  quote characters to be passed to bash(1) need protecting from the m2wx85.cnmand interpreter, normally by using backslash quoting. quote characters in results returned by bash(1) also need protecting, so things can get ugly:  MacSpice 3 -> echo echo \\\"hello world\\\" "hello world" MacSpice 4 ->  ### Sending Apple Events to MacSpice MacSpice has handlers for the basic set of Apple Events described in its dictionary. The most interesting of these is the 'misc/dosc' event handler which allows AppleScript to send commands for interpretation by MacSpice e.g.  tell application "MacSpice" do script "let j = 0" do script { "repeat 10", "let j = j + 1", "end" } end tell  幸运飞艇超稳计划群 this example shows how a set of lines that blocks when sent one at a time can be sent as a list. 幸运飞艇超稳计划群 in normal circumstances, events are acknowledged immediately, but are held in a queue until macspice is ready to process them. ### MacSpice and Applescript As described in the User's Guide (§5.3.ap), MacSpice can compile and run AppleScripts, and assign the results to MacSpice variables. ### Unix-Style Invocation 幸运飞艇超稳计划群 it is possible to use macspice as a tool within the standard shells provided by os x. for convenience, create a symbolic link from a$path directory to the executable in the application bundle:


ln -s /Applications/MacSpice.app/Contents/MacOS/MacSpice macspice


Command Synopsis

     macspice [ -n ] [ -r rawfile ] [ -b ] [ -s ] [ -i ] [ inpfile ... ]
`

Options:

-n (or -N)
Don't try to source the file '.spiceinit' upon startup. Normally MacSpice tries to find the file in the current directory and, if it is not found, then in the user's home directory and then 'spiceinit' in the Applications Support directory.

-b (or -B)
Run in batch mode. MacSpice reads the default input source (e.g. keyboard) or reads the given input file and performs the analyses specified; output is either Spice2-like line-printer plots ('ascii plots') or a Spice rawfile. See the following section for details. Note that if the input source is not a terminal (e.g. using the IO redirection notation of '<') MacSpice defaults to batch mode (-i overrides).

-s (or -S)
Run in server mode. This is like batch mode, except that a temporary rawfile is used and then written to the standard output, preceded by a line with a single '@', after the simulation is done. This mode is used by the MacSpice daemon. This option is valid for MacSpice.

-i (or -I)
Run in interactive mode. This is useful if the standard input is not a terminal but interactive mode is desired. Command completion is not currently available, however.

-r rawfile (or -P rawfile)
Use rawfile as the default file into which the simulation results are saved.

Further arguments to Spice are taken to be MacSpice input files, which are read and saved (if running in batch mode then they are run immediately). MacSpice accepts most Spice2 input file, and output ascii plots, Fourier analyses, and node printouts as specified in .PLOT, .FOUR, and .PRINT control lines. If an out parameter is given on a .WIDTH control line, the effect is the same as set width = .... Since MacSpice ascii plots do not use multiple ranges, however, if vectors together on a .PLOT control line have different ranges they are not provide as much information as they would in Spice2. The output of MacSpice is also much less verbose than Spice2, in that the only data printed is that requested by the above control lines.