home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / s1 / spice / doc / Nutmeg_STD < prev    next >
Text File  |  1993-01-03  |  92KB  |  2,296 lines

  1. === ARCHIMEDES NUTMEG MANUAL VERSION 1.00 (03 Jan 1993) ===
  2.  
  3. written by F.K.W. van de Pol and E.T.J. van de Pol.
  4.  
  5. Note:
  6.  
  7. This is a development version of the Nutmeg manual. This manual has 
  8. not yet been finished, a few chapters are not present. If you wish 
  9. you could send us a corrected version of this document.
  10.  
  11. This document has been generated by a text compiler, so don't bother 
  12. converting this document to !Impression; we can easily generate an 
  13. !Impression text story.
  14.  
  15. ** Please report any stylistic or grammatical faults! **
  16.  
  17. 0       RELEASE NOTES
  18. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  19. Berkeley SPICE 3A6 - Archimedes version by FKW and ETJ van de Pol.
  20.  
  21. This product is public domain, which means that you can give these 
  22. programs to anyone you like, if and only if it is distributed with 
  23. all original files, and with no changes made to it. If you want to 
  24. put it on a bulletin board or include it in your public domain 
  25. library, you can do so, taking this notice in account. You may not 
  26. charge any money for it, apart from duplication and postage costs. 
  27. This should not exceed 10 dutch guilders.
  28.  
  29. If you find this program useful to you in any way, and you wish to 
  30. express your feelings of gratitude towards us, a small fee (say 50 
  31. dutch guilders, or £20) would very much be appreciated. If you want 
  32. to transfer some money, you can do so:
  33.  
  34.       * using the giro account (5944516) of ETJ van de Pol
  35.  
  36.       * using the giro account (5826066) of FKW van de Pol
  37.  
  38.       * sending a stamp and (self-addressed) envelope containing a 
  39.         3.5 inch floppy disc and a giro cheque to us (the address is 
  40.         listed below). Please state which version of BSpice, Nutmeg 
  41.         or any other application you are using. If you are smart, you 
  42.         include your list of bugs, notes, wishes and complaints as 
  43.         well. (Wonders never cease!). A newer version of Spice will 
  44.         be sent to you (as soon as it is available).
  45.  
  46. CONTACT US AT THE FOLLOWING ADDRESS:
  47.  
  48.                 Frank & Erik van de Pol
  49.                 Mgr.Nelislaan 10
  50.                 4741 AB Hoeven
  51.                 The Netherlands
  52.                 (tel. 01659-4625)
  53.                 email: erikp@stack.urc.tue.nl or 
  54.                 frankp@stack.urc.tue.nl
  55.  
  56.  
  57. ======================================================================
  58. 1       INTRODUCTION
  59. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  60. This chapter explains the basics of Nutmeg in conjunction with Spice. 
  61. If you are familiar with Spice, Nutmeg and the use of rawfiles, you 
  62. can skip this chapter.
  63.  
  64. 1.1 What is it?
  65. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  66. Nutmeg is a so called graphic post-processor. It is part of the Spice 
  67. 3A6 distribution. This chapter will provide some global information 
  68. concerning Spice in general and Nutmeg in particular.
  69.  
  70. 1.1.1 History of Spice and Nutmeg
  71.  
  72. Spice was first released in May 1972 at the University of California, 
  73. Berkeley. It became a very popular program among students, but they 
  74. were not the only users: manufacturers of semi conductor devices used 
  75. it a lot.
  76.  
  77. Three years later, Spice 2 was released, with numerous enhancements 
  78. to the first version. It became the standard for analog electronic 
  79. circuit simulation. You can say that many semiconductors owe their 
  80. existence and success to Spice.
  81.  
  82. In october 1985, this version of Spice was released. We have enhanced 
  83. and debugged this release in many ways, and it is a much more 
  84. reliable product than the original Spice 3A6 distribution. However, 
  85. as we have used the original Berkeley Spice sources, we will continue 
  86. to call it Spice 3A6.
  87.  
  88. Nutmeg was part of this Spice 3A6 distribution. It is a fully 
  89. interactive graphic post-processor. The distribution consisted of 
  90. basically two programs: BSpice (the analog simulator) and Nutmeg.
  91.  
  92. 1.1.2 What Nutmeg is good at
  93.  
  94. Nutmeg is, as you may have read, used to create diagrams. It uses the 
  95. data that has been calculated by the simulator BSpice and creates 
  96. diagrams using this data.
  97.  
  98. In order to do so, Nutmeg has a useful set of functions that can 
  99. operate on the calculated results. You could for instance plot the 
  100. difference of two voltages versus time, or you could plot 20 times 
  101. the log of a voltage (db(voltage)) versus frequency, in logarithmic 
  102. or linear grid. Nutmeg allows you to create very fancy graphics that 
  103. are compatible with most Archimedes programs.
  104.  
  105. You may have noticed that these examples concern electronic circuits, 
  106. and that is basically what Spice has been designed for. Therefore 
  107. most operations and functions in Nutmeg have an electrical 
  108. engineering background.
  109.  
  110. 1.1.3 Main objectives
  111.  
  112. The main objectives of Nutmeg are:
  113.  
  114.       * Cooperation with BSpice.
  115.       * Easy operation for users (electrical engineers).
  116.       * Nice front-end.
  117.       * Ability to use scripts for automating purposes.
  118.       * full control over plotting.
  119.       * Extended set of operations and functions.
  120.       * Fancy output in Archimedes Draw format.
  121.       * Extendibility.
  122.       * Reasonable memory usage.
  123.       * As bug free as possible.
  124.  
  125. 1.1.4 Port information
  126.  
  127. The port of this package was done by Frank KW van de Pol and Erik TJ 
  128. van de Pol. If you want to redistribute it, you should read chapter 0 
  129. first.
  130.  
  131. We have to admit that the original (public) version of this program 
  132. is written at the Berkeley University of Technology. All authors are 
  133. credited for their program. The things we have done are numerous, 
  134. though. To mention a few: We restyled it to allow it to be used in 
  135. the desktop, added Draw diagrams, rewrote all plot routines, 
  136. eliminated numerous bugs and added several commands new to this Spice 
  137. 3A6. You can imagine that this is a hell of a job, as this project 
  138. currently consists of over 2500 files in over 250 directories. This 
  139. includes all sources, documentation, object files, executables etc. 
  140. Anyway, this project chews up a massive 25 Megabytes of valuable hard 
  141. disk space. Since we are poor, you may send us a bigger SCSI hard 
  142. disk too if you like (this is serious).
  143.  
  144. Commercial versions of this program are available (most of them are 
  145. very expensive), so try to forgive us when you are frustrated in some 
  146. way by it. This project is done entirely in the spare time of two 
  147. students, and as you can imagine, rewriting and testing such a large 
  148. program with so few people in so little time, will almost inevitably 
  149. result in bugs or small irritating things we didn't get to. If you 
  150. notice them, you are strongly recommended to take a pencil, 
  151. typewriter or word-processor and write them down to report, as this 
  152. is the only way we can possibly eliminate all bugs.
  153.  
  154. We advise to use the following scheme:
  155.  
  156.         COMMENT NO.     a continuously numbered field, for references
  157.         RECORD DATE     the date when you recorded this in the list
  158.         RECORD INITIAL  the name of the person that recorded it
  159.         STATUS          comment type: bug/improvement/cosmetic/etc.
  160.         DESCRIPTION     the comment itself
  161.         HINT            a hint that may lead to a solution
  162.  
  163. We can merge comments in our data base in a simple way if you do so. 
  164. Bug reports like 'my machine sometimes crashes when I run Spice' are 
  165. not very useful. At least include:
  166.  
  167.       * Your machine's configuration.
  168.       * Installed software/modules.
  169.       * Version numbers of the Spice applications.
  170.       * What did you do to cause the problem.
  171.       * Anything that you think is relevant.
  172.  
  173. Please remember:
  174.  
  175.       * A lot of effort has gone into this (very time consuming) 
  176.         project so far, so don't try to abuse it in any way, and 
  177.         please respect the people who wrote it, and that includes us 
  178.         too!
  179.  
  180.       * If you don't like it at all, don't use it.
  181.  
  182.       * If you have some complaints or wishes, find out what you 
  183.         would like to have added or changed in order to make these 
  184.         programs useful to you, and maybe we can sort it out.
  185.  
  186.       * If you like it a lot, we would very much like to hear that 
  187.         from you too. Humans do like compliments (like dogs do), so 
  188.         if you want to, you can send a nice colourful post card to 
  189.         our home address.
  190.  
  191.       * If you use it regularly or professionally, send us some money 
  192.         to encourage further development. The amount of money donated 
  193.         should be proportional with the size of your wallet.
  194.  
  195.       * If you don't like our english, send us an english dictionary! 
  196.         (You are also welcome to send us a corrected/ rewritten 
  197.         version of this manual.)
  198.  
  199. Our address has been included in chapter 0.
  200.  
  201. 1.2 Limitations and Hardware Requirements
  202. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  203. Read this if you want to find out if your system meets the minimal 
  204. operating system and hardware requirements.
  205.  
  206. 1.2.1 Operating system
  207.  
  208. Nutmeg and BSpice have been developed and tested under RISC OS 2.00. 
  209. Both programs should work under RISC OS 3.00 and RISC OS 3.10, but it 
  210. has not been altered to inhibit all special RISC OS 3 features. 
  211. However, these programs should operate without a problem with any 
  212. version of RISC OS higher than 2.00.
  213.  
  214. 1.2.2 Hardware
  215.  
  216. Nutmeg and BSpice have been developed on an Archimedes 310 with an 
  217. Oak SCSI host adapter, a Seagate ST-177N hard disk and 4 megabytes of 
  218. memory. Our machine still has a standard ARM2 processor and original 
  219. MEMC1 memory controller.
  220.  
  221. Spice and Nutmeg have been tested on newer machines (Acorn A3000, 
  222. Acorn A5000, Archimedes 540 and Acorn R260) with positive results.
  223.  
  224. The following is an absolute minimum when you want to use this 
  225. product, so don't blame us when things get slow:
  226.  
  227.       * 2 megabytes of main memory.
  228.       * 1 floppy disk with double density (800k archimedes).
  229.       * any kind of monitor.
  230.       * ARM2 processor.
  231.  
  232. For average use, the following outfit is recommended:
  233.  
  234.       * 4 megabytes of memory.
  235.       * a hard disk with enough storage left on it.
  236.       * any kind of monitor.
  237.       * an ARM2 processor.
  238.  
  239. For extensive use, the following system configuration is recommended:
  240.  
  241.       * more than 4 megabytes of memory.
  242.       * a hard disk with enough storage left on it.
  243.       * a multisync or monochrome hires monitor.
  244.       * an ARM3 processor.
  245.       * a floating point coprocessor.
  246.  
  247. As Spice and Nutmeg have to perform lots of floating point operations 
  248. the addition of a floating point coprocessor will give you a 
  249. significant (read: amazing) improvement of processing and simulation 
  250. speed.
  251.  
  252. 1.3 Where does Nutmeg fit in?
  253. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  254. Nutmeg is the part that reads in and operates on the raw files 
  255. created by BSpice. Nutmeg and BSpice are a couple that can't be 
  256. split. Using BSpice without using Nutmeg isn't very likely to be 
  257. useful, and using Nutmeg without using BSpice isn't very handy 
  258. either. Therefore, Nutmeg and BSpice can't be separated.
  259.  
  260. It is possible to create your own raw files (the format is described 
  261. in appendix C), thus allowing you to use Nutmeg for other purposes, 
  262. but Nutmeg should be considered to be used for electronic purposes 
  263. only because of the specialised set of commands and functions.
  264.  
  265. 1.3.1 Accompanying tools
  266.  
  267. The Spice package has some extra tools. These are not essential when 
  268. you want to work with Spice, but they allow you to do more.
  269.  
  270. 1.3.1.1 Manager
  271.  
  272. The Manager can be used to create work directories. If you follow 
  273. this approach, you can have several work directories, depending on 
  274. your needs. You could, for instance, have a work directory for each 
  275. project you are working on, allowing you to keep things separate and 
  276. store them on separate floppies.
  277.  
  278. 1.3.1.2 Resources
  279.  
  280. The Resources application does not have an executable. It is more or 
  281. less comparable with the !System application that has been provided 
  282. by Acorn. The resources directory should be a central place in your 
  283. Spice system. It is meant to be the place where you can store include 
  284. files for in Spice circuit sources (for the simulator), universal or 
  285. common script files (for Nutmeg) and universal or common Query box 
  286. definitions (for use with Nutmeg).
  287.  
  288. The last two are probably superfluous, but the first purpose is 
  289. essential when you have models describing several different standard 
  290. components.
  291.  
  292. 1.3.2 Schematic overview
  293.  
  294. The set-up is globally as follows:
  295.  
  296. (fig. 1-1)
  297.  
  298.  
  299. ======================================================================
  300. 2       OPERATING NUTMEG
  301. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  302. 2.1 Installation
  303. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  304. This chapter describes how to install Nutmeg and Spice on your 
  305. system.
  306.  
  307. 2.1.1 Nutmeg on a hard disk system
  308.  
  309. Running Nutmeg from a hard disk system should not cause any problems. 
  310. Just place it somewhere in your directory structure. You are 
  311. recommended to place Nutmeg, BSpice, Resource and your work directory 
  312. in the same directory level. You can place the work directories in a 
  313. different directory if you like, but remember to explicitely select 
  314. the work directory you would like to use.
  315.  
  316. 2.1.2 Nutmeg on a floppy system
  317.  
  318. You should create a fresh floppy containing Nutmeg and BSpice, and 
  319. another floppy disk that holds the work directory. This really is a 
  320. must, as BSpice is very good at creating large rawfiles. Place the 
  321. Resources on a separate floppy too as this directory will grow in 
  322. size when you add resource files. If the size of your resource 
  323. directory is small enough, you can put it together with BSpice on one 
  324. floppy.
  325.  
  326. 2.2 Resources
  327. ¯¯¯¯¯¯¯¯¯¯¯¯¯
  328. This section is meant to give you an idea of the resources Nutmeg 
  329. uses. Simple examples are provided, and you are recommended to 
  330. experiment with some settings. For more information read the 
  331. appropriate sections in the chapter 'Advanced Operation'.
  332.  
  333. 2.2.1 SpiceInit file
  334.  
  335. The SpiceInit is behind directory !Nutmeg.Script, and it contains a 
  336. set of commands (as you would type them on the input line of the 
  337. window) that set up the behaviour of Nutmeg on start-up. You can set 
  338. various variables and preferences in order to customize Nutmeg. In 
  339. fact, SpiceInit is a normal script file that can be run with Nutmeg's 
  340. script command.
  341.  
  342. When Nutmeg is started, each line in this file is treated as if it 
  343. had been typed in from the window's input line. After that, Nutmeg 
  344. returns control to you, and you can enter commands yourself. Start 
  345. make changes to the existing SpiceInit file and study the results.
  346.  
  347. Due to this approach, you are highly recommended to edit the 
  348. SpiceInit file and make it as short as possible. This prevents long 
  349. parsing times of the script file.
  350.  
  351. 2.2.2 Query boxes
  352.  
  353. Query boxes are created from description files and can perform 
  354. various actions. Their basic use is communication with the user in a 
  355. natural (RISC OS compliant) way. On start up, there are several 
  356. query-boxes available.
  357.  
  358. Try for example clicking on the 'plot' icon beneath the input line. 
  359. As you can see, a dialogue box will be opened that has the look and 
  360. feel of a normal dialogue box. The power of query boxes is, that you 
  361. can provide them yourselves for various actions: you could have some 
  362. for setting different variables, executing different commands or 
  363. launching applications.
  364.  
  365. 2.2.3 Smart icons
  366.  
  367. Smart Icons are meant for quick access to regularly used commands. 
  368. The order in which they appear is described in a configuration file, 
  369. and the icons associated with them reside in a separate sprite file.
  370.  
  371. Clicking on them can have different effects, but they basically send 
  372. a command to Nutmeg. This can be any valid Nutmeg command.
  373.  
  374. 2.2.4 System paths
  375.  
  376. There are several system and program paths you can reference to. Here 
  377. is a list of the available paths:
  378.  
  379. BSpice3A6$Dir   points to the directory where the actual Spice 
  380.                 simulator can be found. When you want to call BSpice, 
  381.                 run <BSpice3A6$Dir>.BSpice <input> [-q] [-b]. Note 
  382.                 that omitting a run command in front of the 
  383.                 environment variable may cause problems, especially 
  384.                 when you have selected an other filing system than 
  385.                 the one Spice has been put on. This run command 
  386.                 refers to the RISC OS operating system command.
  387.  
  388. Nutmeg$Dir      is the application directory of the post processor. 
  389.                 Do not explicitely use this variable unless you 
  390.                 really need to.
  391.  
  392. SpiceResource:  contains various models for use in Spice netlists and 
  393.                 may be used to store scripts and query boxes too.
  394.  
  395. SpiceWork$Dir   points to the current work directory. It contains 
  396.                 several sub directories, for example 'In', 'Raw', 
  397.                 'Script' and 'Query'.
  398.  
  399. 2.2.5 !Resources directory
  400.  
  401. This directory contains models and sub circuits for inclusion in 
  402. Spice simulation files, but is also a central place where Scripts and 
  403. Query boxes can be stored.
  404.  
  405. 2.2.6 Work directories
  406.  
  407. Work directories enable you to keep things separate. For example, 
  408. when you are working on several projects, you can have several sub 
  409. directories where you store all things that are specific for this 
  410. project (eg. scripts and query boxes). You select a work directory by 
  411. double-clicking on it.
  412.  
  413. 2.3 Starting up
  414. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  415. Starting Nutmeg is just like starting any RISC OS application: you 
  416. double click on the !Nutmeg icon in a directory viewer, and Nutmeg 
  417. will install on the icon bar, with one window opened. This window is 
  418. the central input and output window. There are several items of 
  419. interest:
  420.  
  421. (fig. 2-1)
  422.  
  423. The window behaves just like any other RISC OS window. You can type 
  424. any command on the input line and press return to pass it to the 
  425. command parser.
  426.  
  427. After you press return, a fresh line appears and you can enter a new 
  428. command while the command you just entered is being executed.
  429.  
  430. The icon that contains 'Zzz' is called the sleep icon. You can click 
  431. on it to pause the currently executing Nutmeg command. Nutmeg 
  432. multitasks happily with other RISC OS applications, and has been 
  433. designed to execute all commands without having long delays. If 
  434. execution is paused, the icon on the icon bar will change. The key 
  435. short-cut for this function is CTRL-S (if the Nutmeg window has the 
  436. input focus).
  437.  
  438. 2.4 Nutmeg Terminology
  439. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  440. When you load in a simulation result file (a rawfile), you will 
  441. notice that Nutmeg orders them in a hierarchical manner, as follows:
  442.  
  443.       * The type of simulation in which the data vectors are stored 
  444.         is called a plot.
  445.  
  446.       * The simulation values of the nodes in a plot are called 
  447.         vectors.
  448.  
  449. Vectors are the key to manipulate your results. If you want to 
  450. calculate with the data, you can work on an entire vector in stead of 
  451. making calculations for each point in the vector. This provides a 
  452. very quick and flexible way of working.
  453.  
  454. Card            This is a Spice term. It is a word in a Spice circuit 
  455.                 file that starts with a dot. It tells BSpice what to 
  456.                 do.
  457.  
  458. Circuit         This is a Spice term. It is part of a simulation file 
  459.                 and describes what the circuit looks like and what 
  460.                 components are used.
  461.  
  462. CLI window      This is the main Nutmeg window.
  463.  
  464. Commands        tell Nutmeg what to do next.
  465.  
  466. Constants       can be used as constants in calculations, just like 
  467.                 any number you typed in. Standard constants include 
  468.                 pi, planck's constant and the speed of light.
  469.  
  470. Deck            
  471.  
  472. Diagrams        are the Draw graphics that Nutmeg produces. There are 
  473.                 sometimes referred to as plots, but that should not 
  474.                 be confused with the plots described above.
  475.  
  476. Diagram viewer  is the window that contains the generated Draw 
  477.                 graphics. A viewer is a standard way of dealing with 
  478.                 Diagrams.
  479.  
  480. Expression      is an algebraic formula involving vectors and scalars 
  481.                 (a scalar is a vector of length 1), and several 
  482.                 operations.
  483.  
  484. Functions       have one or more vector or scalars as input, operate 
  485.                 on them and return the result of the calculation.
  486.  
  487. History         is the list of commands that has been typed in since 
  488.                 program start-up. You can save this list to replay a 
  489.                 session.
  490.  
  491. Input line      is this icon in the CLI window that you can use to 
  492.                 enter text in.
  493.  
  494. Operations      Basic arithmetic operations to operate on vectors and 
  495.                 scalars.
  496.  
  497. Plot            is a structure in the Nutmeg database where the 
  498.                 results of a certain simulation are stored. A plot 
  499.                 contains vectors.
  500.  
  501. Preferences     allow you to fully control the behaviour of Nutmeg.
  502.  
  503. Query box       is a dialogue box that allow you to set variables and 
  504.                 execute commands. Query boxes are constructed using 
  505.                 description files.
  506.  
  507. Scripts         are files that contain sequences of valid Nutmeg 
  508.                 commands.
  509.  
  510. Smart Icons     provide a nice way of interfacing with the user. You 
  511.                 can found them under the input line.
  512.  
  513. Variables       control the behaviour of various commands and are of 
  514.                 help when interfacing to scripts and saving states.
  515.  
  516. Vector          is an array in plot that contains simulation results. 
  517.                 Voltage versus time is an example of a vector.
  518.  
  519. Work directory  Is a directory where you store circuits, scripts, 
  520.                 models and query boxes. You can have several 
  521.                 different projects, but you have to choose one. This 
  522.                 is called the current work directory.
  523.  
  524. 2.5 CLI input
  525. ¯¯¯¯¯¯¯¯¯¯¯¯¯
  526. When a command is given, it is interpreted as one of several things. 
  527. First, it may be an alias, in which case the line is replaced with 
  528. the result after alias substitution, and the line is parsed again. 
  529. Second, it may be a predefined command, in which case it is executed 
  530. (see chapter 9 for a list of available commands). Third, it may be an 
  531. assignment statement, which consists of a vector name, an = symbol, 
  532. and an expression (see the syntax for the let command in section 
  533. 9.1.10), in which case it is executed as if it were preceded by the 
  534. word let. Finally, it may be a RISC OS * command (not the comment 
  535. card used in Spice simulation files), in which case (if the variable 
  536. unixcom is set) it is executed as if it were entered in the input 
  537. line.
  538.  
  539. There are a number of ways in which you can tell Nutmeg what to do. 
  540. Here follows a short description of the two most commonly used:
  541.  
  542. 2.5.1 Typing
  543.  
  544. The simplest way to give commands to Nutmeg is typing a line in the 
  545. input line in the CLI window. You can edit the line and page through 
  546. previous commands using the up and down arrow keys. When you press 
  547. return, the command will be parsed.
  548.  
  549. 2.5.2 Drag
  550.  
  551. Another way to execute commands is dragging files to the command line 
  552. window. Nutmeg will look at the parent name of the file, and decide 
  553. what to do depending on that name.
  554.  
  555.       * If the name is 'Script', Nutmeg will load the script in, as 
  556.         if you typed script <name>, and execute the script file.
  557.  
  558.       * If the name is 'Raw', Nutmeg will issue a load command, and 
  559.         thus tries to load in the rawfile.
  560.  
  561.       * If the name is 'In', and the BSpice shell has been started, 
  562.         then Nutmeg will issue a BSpice command. This command sends a 
  563.         message to BSpice with instructions to read the circuit and 
  564.         simulate it. Output will go to the currently selected work 
  565.         directory.
  566.  
  567. 2.6 Diagram viewers
  568. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  569. 2.6.1 Purpose
  570.  
  571. Nutmeg has extensive abilities to create Draw figures from vectors. 
  572. In fact, this is what Nutmeg has been designed for (although not for 
  573. Draw figures).
  574.  
  575. When Nutmeg creates a diagram, a window will be opened containing 
  576. that diagram. These so called diagram viewers provide a uniform way 
  577. of dealing with generated draw figures. You can save the draw file or 
  578. discard it, whatever you want. They also provided information on the 
  579. created diagram, and allow you to zoom in or out.
  580.  
  581. 2.6.2 The menu
  582.  
  583. Open a diagram menu as follows: position the mouse over the diagram 
  584. viewer and press the menu button of your mouse. A menu will open, 
  585. which is as simple as it looks:
  586.  
  587.       * Follow the info arrow to get some information about the 
  588.         diagram.
  589.  
  590.       * Follow the zoom arrow to set zoom factors using a standard 
  591.         dialogue box.
  592.  
  593.       * Follow the save arrow to put you diagram somewhere safe or 
  594.         insert it in any other program.
  595.  
  596. Clicking on the close box of the window will prompt you if you 
  597. haven't saved the diagram yet, and will then remove the picture from 
  598. memory.
  599.  
  600. 2.7 Scripts
  601. ¯¯¯¯¯¯¯¯¯¯¯
  602. 2.7.1 Introduction
  603.  
  604. Scripts are the key to flexible and automated operation. They can 
  605. contain all valid Nutmeg commands, even conditionally. Scripts can 
  606. also call other scripts (only limited). Writing a script file can be 
  607. tricky: read the special 'advanced' chapter below for more 
  608. information.
  609.  
  610. 2.7.2 Usage
  611.  
  612. Scripts can be executed using script <name>, where Nutmeg tries to 
  613. load them in, looking in various directories in a specified order 
  614. allowing you to override certain script files when you want something 
  615. a little different for a project:
  616.  
  617.       * It scans <SpiceWork$Dir>.Script first (to add project 
  618.         specific scripts), then SpiceResource:Script (for general and 
  619.         standard scripts), and finally <Nutmeg$Dir>.Script, which 
  620.         contains default and system scripts.
  621.  
  622. This approach gives you full control over what script should be 
  623. executed, as you can supersede a 'standard' script when you need to.
  624.  
  625. 2.8 Smart icons
  626. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  627. 2.8.1 Introduction
  628.  
  629. Smart icons have been designed for those commands that are used very 
  630. frequently. Each smart icon can have a neat icon, that will be 
  631. positioned below the input line. Definitions (which are very simple) 
  632. are stored inside a description file.
  633.  
  634. 2.8.2 Operating them
  635.  
  636. Clicking on such an icon will cause the command that is associated 
  637. with an icon to be passed to the command interpreter, where it is 
  638. treated as just any other command.
  639.  
  640. 2.8.3 Adding yourself
  641.  
  642. Open the !Nutmeg directory by clicking on it while holding shift. 
  643. Locate the file called 'Icons' and load it into a text editor (eg. 
  644. !Edit). You can add lines to add new icons or to create some space:
  645.  
  646.       * 'command' followed by the name of the sprite you want to use, 
  647.         and finally the command itself, which could be any number of 
  648.         words.
  649.  
  650.       * A special keyword 'gap' is provided to add some distance 
  651.         between two icons.
  652.  
  653. See appendix C for more information about this file format.
  654.  
  655. Save the file and edit the sprite file called 'IconPicts'. This 
  656. contains the sprites Nutmeg uses when displaying the smart icon. 
  657. Define a nice sprite matching the name you typed in, and save the 
  658. sprite file.
  659.  
  660. Note that the new smart icons will not be in effect until you start 
  661. Nutmeg again.
  662.  
  663. 2.9 Query boxes
  664. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  665. 2.9.1 Introduction
  666.  
  667. Query boxes are designed to make Nutmeg look real nice, and to 
  668. communicate with the user in an intuitive way. Query boxes basically 
  669. consist of a number of objects in order to do so. They are:
  670.  
  671. Static text     for accompanying text.
  672.  
  673. Static pictures for descriptive graphics.
  674.  
  675. Booleans        for switching options on and off.
  676.  
  677. Writable icons  for entering values and names.
  678.  
  679. Hotbuttons      for action buttons.
  680.  
  681. Query boxes have a number of commands to control them. You can use 
  682. querylist, queryclose, queryopen, querykill and queryload, each of 
  683. which has it's straightforward meaning. See chapters 3 and 9 for more 
  684. information.
  685.  
  686. You can define query boxes by providing a description file containing 
  687. the box definitions.
  688.  
  689. 2.9.2 Examining a query box definition
  690.  
  691. Writing query boxes can be tricky. If you want to have some examples, 
  692. you can have a look on the definitions of the currently available 
  693. (and standard) query boxes.
  694.  
  695. In order to do so, open the Nutmeg directory, locate directory 
  696. 'Query' and open it. Inside will be a file named 'Std'. This file 
  697. contains various box descriptions. Somewhere at the top will be a 
  698. line beginning with 'defbox'. This tells Nutmeg that this is the 
  699. start of a new definition. it has two arguments: the identifier you 
  700. use for reference purposes and the name of the box (notice the 
  701. quotes!) that should appear as the title of the box.
  702.  
  703. Underneath are lines starting with 'static' followed by the 
  704. coordinates of the bottom left corner of the text and the (quoted) 
  705. text itself. Notice that you cannot have text containing quotes.
  706.  
  707. There are several lines starting with 'staticpict'. This defines a 
  708. static picture. Most of them are used to stress key short-cuts.
  709.  
  710. Then, some lines appear starting with 'string' and followed by (in 
  711. that order) the variable identifier to store the names in, the type 
  712. of the string, the two coordinates making up the left corner of the 
  713. box, and finally the width and height of the box.
  714.  
  715. After this section appears a number of lines starting with 'boolean', 
  716. followed by the variable identifier it is associated with, the 
  717. coordinates of the left corner of the button, and the keycode that 
  718. toggles the command.
  719.  
  720. Finally, the text 'hotbutton' appears with the command to execute, 
  721. coordinate pairs, the keycode that causes this button to be hit, and 
  722. the text inside the button. The last word of a definition is 
  723. 'endbox', which concludes the definition of the query box.
  724.  
  725. 2.10 Preferences
  726. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  727. 2.10.1 Introduction
  728.  
  729. Preferences are the key to customize most features of Nutmeg. Those 
  730. most used can, in many cases, be controlled by Nutmeg environment 
  731. variables. However, there is a number of options you are not likely 
  732. to alter much, so these are not controlled by a variable. Instead, a 
  733. special keyword has been included: pref. With this keyword you can 
  734. set your preferences to tell Nutmeg to operate the way you want 
  735. Nutmeg to behave.
  736.  
  737. 2.10.2 Preference window
  738.  
  739. Setting preferences from a script file can be a tedious job, 
  740. involving lots of looking up keywords and more of that. There is an 
  741. alternative to that, and it is the preferences window.
  742.  
  743. You can open it by clicking on the item 'Preferences...' on the icon 
  744. bar menu of Nutmeg. It contains all options you can set in a RISC OS 
  745. compliant way. You can alter options easily to match your taste. You 
  746. can then save those preferences to an editor to customize them and 
  747. make it into a start-up script for Nutmeg. You are highly recommended 
  748. to delete all lines that contain the default values, as this will 
  749. speed up loading.
  750.  
  751. 2.10.3 Editing you prefs
  752.  
  753. If you are satisfied with the current settings, you will have to save 
  754. them. The best thing you can do is save them somewhere in a 
  755. directory, and then delete all lines from the saved preferences file 
  756. that you did not edit. Omitting these lines will force Nutmeg to take 
  757. some default value for it, and since you didn't edit it, the result 
  758. will be the same. An extra advantage is that the preferences file 
  759. will be a lot shorter and as a consequent will be parsed a lot 
  760. faster.
  761.  
  762. You are recommended to save the preferences with a different name and 
  763. compare each line carefully to corresponding lines in 
  764. <Nutmeg$Dir>.Script.SpiceInit. Only alter or add the lines that have 
  765. been changed to the SpiceInit file.
  766.  
  767.  
  768. ======================================================================
  769. 3       ADVANCED OPERATION
  770. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  771. This chapter contains more detailed information of what is mentioned 
  772. in chapter 2. It is therefore possible that some of the information 
  773. has been included in other sections of this manual too. This chapter 
  774. tries to explain things in full. For normal use you should not need 
  775. this chapter, but if you want to customize Nutmeg, you will 
  776. inevitably need to.
  777.  
  778. 3.1 Internal database
  779. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  780. Nutmeg has an internal database where it keeps track of vectors and 
  781. plots. There are many commands that need information from this 
  782. database. For example, if you want to plot something, you have to 
  783. specify what vectors you want to appear on the screen.
  784.  
  785. 3.1.1 Referencing
  786.  
  787. Each vector is contained in a plot. Normally you will select a plot 
  788. using setplot, and if you need to reference a vector, you will use 
  789. that name directly.
  790.  
  791. Now imagine that you want to plot vectors from several different 
  792. plots. You would have to specify the name of the plot that is 
  793. associated with each vector. Fortunately, Nutmeg allows you to do so: 
  794. if you want to refer to a vector that is not in the currently 
  795. selected plot, you can refer to it with plotname.vecname.
  796.  
  797. 3.1.2 Maintenance
  798.  
  799. It is easy to maintain the database: Nutmeg does it for you. You may 
  800. however find it useful to destroy vectors and plots that are not 
  801. needed in case memory is low. You can use the killvect and destroy 
  802. commands for that purpose.
  803.  
  804. Just remember that:
  805.  
  806.       * vectors are stored inside plots,
  807.  
  808.       * you can list the vectors of the currently selected plot with 
  809.         display,
  810.  
  811.       * that you can list all plots using listplots,
  812.  
  813.       * you set the currently selected plot using setplot.
  814.  
  815. 3.1.3 Summary
  816.  
  817. Refer to vectors in an other then the currently selected plot 
  818. explicitely using plotname.vecname. listplots will list all plots, 
  819. setplot is used to set the current plot, and display will list all 
  820. vectors in the current plot. destroy and killvect will destroy plots 
  821. and vectors. Use with care.
  822.  
  823. 3.2 Writing Scripts
  824. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  825. If you use start using scripts you can automate some simple 
  826. operations in Nutmeg that would otherwise involve lots of typing 
  827. standard commands. A script file can take action depending on 
  828. variables or on the evaluation of expressions.
  829.  
  830. 3.2.1 Advanced Scripts
  831.  
  832. 3.2.2 Script writing Hints
  833.  
  834. Try loading in an existing script. You can find several in 
  835. !Nutmeg.Script. Try to predict what the script should do and why.
  836.  
  837. 3.2.3 Quotation
  838.  
  839. 3.2.4 Variable substitution
  840.  
  841. If you want to substitute a variable in an expression, you have to 
  842. specify it explicitely. If you have a variable named offset, you can 
  843. add it to the contents of a vector and output the result in columns 
  844. using:
  845.  
  846.         print col V(1) + $(offset)
  847.  
  848. The $() construct substitutes the value of the variable for the name 
  849. of the variable on the command line, and tries again. A substitution 
  850. could result in other $() sequences to appear. Nutmeg will continue 
  851. with substitution until all $() have disappeared. Nutmeg will trap 
  852. infinite substitutions. If no more substitution needs to be done, 
  853. then Nutmeg will try to evaluate the expression.
  854.  
  855. You can 'construct' a command line depending on certain variables and 
  856. substitute appropriate values in order to construct a command string. 
  857. The default query boxes that can be accessed by clicking on the smart 
  858. icons below the input line have several writable icons where you can 
  859. enter strings. In most cases, such a query box will start a script 
  860. (because each action button can have only one command associated with 
  861. it) which will test several variables and will construct a command 
  862. line for a specific command. When construction has been finished, a 
  863. command will be executed with this constructed tail using plain 
  864. variable substitution.
  865.  
  866. 3.2.5 Summary
  867.  
  868. 3.3 Advanced CLI input
  869. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  870. 3.3.1 Wimp messages
  871.  
  872. Please notice that this Wimp message is not allocated by Acorn.
  873.  
  874. 3.3.2 Example program
  875.  
  876. 3.3.3 Summary
  877.  
  878. 3.4 Advanced query boxes
  879. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  880. 3.4.1 Key short cuts
  881.  
  882. The hotbuttons and booleans allow you to assign a key short-cut to 
  883. them. Pressing the key will simulate a click on the button. The key 
  884. code should be the standard wimp code.
  885.  
  886. 3.4.2 Writing scripts
  887.  
  888. 3.4.3 Standard constructions
  889.  
  890. 3.4.4 Box layout tips
  891.  
  892. Make sure that you design the box so that using it is intuitive and 
  893. logical. If you want to make it real professional, create a box with 
  894. a template editor and use it to create a similar box with. You can 
  895. then easily figure out what the layout of your query box will be. 
  896. Alternatively, you can draw the layout on a piece of paper, and build 
  897. the description of the query box using that piece of paper.
  898.  
  899. Try not to include too much options in one single query box. If you 
  900. want to build a very large box it will probably be too large to fit 
  901. on the screen, or it may be confusing and hard to use.
  902.  
  903. There is a trick to make large boxes: they can be hierarchically 
  904. ordered by making a 'top level' menu with a number of action buttons 
  905. and descriptive text. Clicking on an action button can then open a 
  906. second query box (and close the first) to contain the interface to 
  907. the user for that 'menu' item. Such a submenu can contain a special 
  908. action button to open the root box again.
  909.  
  910. Make sure you use a grid which you use to align your items on in 
  911. order to make the appearance neat. You will have to know the size of 
  912. the different items. They are as follows (in OS units):
  913.  
  914. boolean         width is 44, height is 48.
  915.  
  916. hotbutton       width is 20 + (16 * the length of the text), height 
  917.                 is 48.
  918.  
  919. static          width is 16 * the length of the text, height is 48.
  920.  
  921. staticpict      width and height depend on the size of the sprite and 
  922.                 the screen mode it has been designed for.
  923.  
  924. string          width has been include in the definition, height is 
  925.                 48.
  926.  
  927. Do not put your own boxes in 'Query.Std'. Instead use your own file 
  928. (eg. 'Query.Custom' or 'Query.MyBox') and load them in with queryload
  929. . You can put that command in the SpiceInit script file that is 
  930. executed each time Nutmeg is started.
  931.  
  932. Each action button and each Boolean button can have a special key 
  933. code associated with it. Generating this keycode (by pressing the 
  934. key) will simulate a click on the button. Choose logical 
  935. abbreviations for these keycodes and, if possible, show it using some 
  936. descriptive text and/or using static pictures to underline 
  937. appropriate letters in descriptive text. You can for example use text 
  938. in lower case for each boolean or hotbutton, and highlight one 
  939. character (using upper case) that represents the key that responds to 
  940. this button.
  941.  
  942. To make things real clear, the standard query boxes use a static 
  943. picture (a small grey line) to underline the appropriate letter, and 
  944. place a small 'return' symbol next to the hot button that reacts on 
  945. the return key.
  946.  
  947. 3.4.5 Summary
  948.  
  949. 3.5 Directory structures
  950. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  951. 3.5.1 What paths are available
  952.  
  953. 3.5.1 Where to put what?
  954.  
  955. 3.5.2 Search path order
  956.  
  957. The order in which various Nutmeg commands try to open resource files 
  958. are:
  959.  
  960.       *         The current work directory. Access explicitely with 
  961.         <SpiceWork$Dir>.
  962.  
  963.       *         The resources directory. Access explicitely with 
  964.         SpiceResource:.
  965.  
  966.       *         The Nutmeg home directory. Access explicitely with 
  967.         <Nutmeg$Dir>.
  968.  
  969.       3.5.3 Making use of search paths
  970.  
  971.       Place standard resources in the Resources directory. Try not to 
  972.         put too many things in the Nutmeg application directory: this 
  973.         directory should contain 'system' resources only.
  974.  
  975.       Use the sub-directories in the work directories for project 
  976.         specific resources. These should contain all scripts and 
  977.         query boxes that are not likely to be useful for other 
  978.         projects. You can keeps things separate in this way.
  979.  
  980.       You can make use of search paths in an other way. If you are 
  981.         not satisfied with some 'standard' query box (eg. it is too 
  982.         extended or not extended enough), you can easily copy and 
  983.         alter it, and save it in the Resources or work directory to 
  984.         overrule the default definitions. The same goes for script 
  985.         files.
  986.  
  987.       3.5.4 Summary
  988.  
  989.       3.6 Customization
  990.       ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  991.       This section tries to give some hints where you can start when 
  992.         you want to customize Nutmeg.
  993.  
  994.       3.6.1 Change prefs
  995.  
  996.       The preferences are used for settings that are not likely to be 
  997.         altered much. To obtain maximum flexibility, you can save and 
  998.         edit these preferences. Chapter 8 provides a list of 
  999.         preference keywords that you can alter.
  1000.  
  1001.       3.6.2 Change smart icons
  1002.  
  1003.       There is only one way you can edit the smart icons. In order to 
  1004.         do so you will have to load the file !Nutmeg.Icons in a text 
  1005.         editor. Then edit the description of the icons, following the 
  1006.         format rules that are laid out in appendix C.
  1007.  
  1008.       Note that if you want to add a smart icon, you will have to 
  1009.         create a sprite too with the same name as you used to 
  1010.         reference to the icon. These icons are in file 
  1011.         !Nutmeg.IconPicts and can be loaded in and edited with Paint.
  1012.  
  1013.       Changes to the smart icons description file will not take 
  1014.         effect until you start Nutmeg again.
  1015.  
  1016.       3.6.3 Aliases
  1017.  
  1018.       If you use some commands or sequences of command regularly, you 
  1019.         might consider defining an alias for them. This alias can 
  1020.         abbreviate a longer command with various options, or it can 
  1021.         be used to start a command script. The last method allows you 
  1022.         to define an alias for sequences of more than one command.
  1023.  
  1024.       Modify the Init script file you can find in directory 
  1025.         !Nutmeg.Script. Place your own alias definitions in this 
  1026.         script file or call a script file from Init that contains 
  1027.         your custom settings. You can even place this custom script 
  1028.         file in a work directory, and have Nutmeg configured 
  1029.         differently depending on what project directory you selected 
  1030.         before starting Nutmeg.
  1031.  
  1032.       3.6.4 System variables
  1033.  
  1034.       There is a number of system variables that influence the 
  1035.         behaviour of Nutmeg. You can alter, set or unset these 
  1036.         variables inside some start-up script to set certain 
  1037.         defaults. See chapter 4 for more information. Note that some 
  1038.         of the standard query boxes make use of system variables too, 
  1039.         and enable you to alter the setting of these variables by 
  1040.         clicking on them.
  1041.  
  1042.       3.6.5 Summary
  1043.  
  1044.       You can customize Nutmeg in several ways. The smart icons 
  1045.         should be altered before you start-up Nutmeg. They allow you 
  1046.         to make Nutmeg friendly and nice to deal with. Aliases can be 
  1047.         used to abbreviate long commands or make new ones. System 
  1048.         variables allow you to manipulate commonly altered features. 
  1049.         Prefs are useful if you want to alter system specific 
  1050.         features. Note that smart use of a query box and accompanying 
  1051.         script file can eliminate the difference between these two 
  1052.         when dealing with them.
  1053.  
  1054.  
  1055. ======================================================================
  1056. 4       NUTMEG ENVIRONMENT VARIABLES
  1057. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  1058. Variables in Nutmeg differ from vectors. A variable can be used to 
  1059. set or disable a specific feature, or to pass parameters to other 
  1060. functions. This chapter is meant to shed light on what variables are 
  1061. available and what they are used for. Below is a list of variable 
  1062. names who are reserved for use in Nutmeg, so if you want to make use 
  1063. of variables for your own purposes, make sure you don't get any name 
  1064. clashes with these predefined variables.
  1065.  
  1066. 4.1 Variables for CLI handling
  1067. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  1068. abstol          The absolute tolerance used by the diff command.
  1069.  
  1070. cpdebug         Print cshellparse debugging information.
  1071.  
  1072. debug           If set then a lot of debugging information printed.
  1073.  
  1074. echo            Echo each command to the screen before it is 
  1075.                 executed.
  1076.  
  1077. filetype        Can be ascii (default) or binary. It is the rawfile 
  1078.                 format. Rawfiles in ascii format are in a readable 
  1079.                 form, but rawfiles in binary form will take up less 
  1080.                 memory. BSpice produces ascii format rawfiles.
  1081.  
  1082. height          The length of the page for asciiplot and print col.
  1083.  
  1084. history         The number of events to save in the history list.
  1085.  
  1086. nfreqs          The number of frequencies for fourier. The default is 
  1087.                 10, but higher values will result in more accurate 
  1088.                 fourier transforms.
  1089.  
  1090. noaskquit       Don't ask the user if he really wants to quit when he 
  1091.                 has unsaved data.
  1092.  
  1093. nobreak         Don't have asciiplot and print col break between 
  1094.                 pages.
  1095.  
  1096. noclobber       Don't overwrite existing files when doing IO 
  1097.                 redirection.
  1098.  
  1099. noglob          Don't expand the global characters '*', '?', '[', and 
  1100.                 ']'.
  1101.  
  1102. nonomatch       If an expression can't be matched, use global chars 
  1103.                 literally.
  1104.  
  1105. nosort          Don't have display sort the variable names.
  1106.  
  1107. polydegree      The degree of the polynomial used for curve fitting.
  1108.  
  1109. polysteps       The number of points to interpolate when doing curve 
  1110.                 fitting.
  1111.  
  1112. program         The name of the current program.
  1113.  
  1114. rawfile         The default name for rawfiles created.
  1115.  
  1116. reltol          The relative tolerance used by the diff command.
  1117.  
  1118. showtype        Display the variable type when all variables are 
  1119.                 listed.
  1120.  
  1121. units           If this is 'deg' (degrees), then all trigonometric 
  1122.                 functions will use degrees.
  1123.  
  1124. unixcom         Send unrecognised commands to the operating system, 
  1125.                 who will try to execute them. If you enter an unknown 
  1126.                 command and this variable has not been set, then 
  1127.                 Nutmeg will report an error.
  1128.  
  1129. verbose         Be verbose. This is midway between echo and debug/
  1130.                 cpdebug.
  1131.  
  1132. vntol           The absolute voltage tolerance used by the diff 
  1133.                 command.
  1134.  
  1135. width           The width of the page for asciiplot and print col.
  1136.  
  1137. 4.2 Variables dealing with plots
  1138. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  1139. combplot        Plot vectors by drawing a line from the point to the 
  1140.                 X-axis. If you use it with large datasets, plotting 
  1141.                 and displaying the diagram will be slow.
  1142.  
  1143. dontplot        No graphics control codes are actually sent, so no 
  1144.                 diagram will be build.
  1145.  
  1146. monochrome      Create monochrome diagrams when plotting. Useful if 
  1147.                 you want to output the diagram to a printer.
  1148.  
  1149. nogrid          Don't plot a grid when graphing curves (but do label 
  1150.                 the axes).
  1151.  
  1152. nologscale      Force not to use log scale when plotting. Note that 
  1153.                 this differs from the subgrid variable. The subgrid 
  1154.                 instructs Nutmeg to create a logarithmic grid in a 
  1155.                 diagram if appropriate, and nologscale tells nutmeg 
  1156.                 not to map the data points on a logarithmic grid.
  1157.  
  1158. redrawplot      Redraw the plot each time a vector has been added.
  1159.  
  1160. subgrid         Plot a logarithmic sub division grid if appropriate.
  1161.  
  1162. xprecision      The decimal precision when labelling the x axis. If 
  1163.                 you create a diagram and the resolution of the x axis 
  1164.                 labelling is not high enough, increase this value.
  1165.  
  1166. yprecision      The decimal precision for the y axis. If you omit 
  1167.                 this value, Nutmeg assumes that you want to use the 
  1168.                 same resolution as used for x axis labelling.
  1169.  
  1170. 4.3 Default query box variables
  1171. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  1172. There are 6 standard query boxes defined that use nutmeg variables to 
  1173. pass results and store temporary values. For more information about 
  1174. how to create a query box see chapter 2 and 3 in the appropriate 
  1175. sections.
  1176.  
  1177. These variables are defined for use by the qb_plot box ('Plot 
  1178. Options'):
  1179.  
  1180.                 plot_vecs
  1181.                 plot_vecvs
  1182.                 plot_xmin
  1183.                 plot_xmax
  1184.                 plot_ymin
  1185.                 plot_ymax
  1186.                 plot_indlo
  1187.                 plot_indhi
  1188.                 plot_xprec
  1189.                 plot_yprec
  1190.                 plot_dash
  1191.                 plot_cols
  1192.                 plot_xrang
  1193.                 plot_yrang
  1194.                 plot_indic
  1195.                 plot_vs
  1196.  
  1197. The following are defined in query box qb_help ('Help items'):
  1198.  
  1199.                 qbhelp_comm
  1200.                 qbhelp_func
  1201.                 qbhelp_oper
  1202.                 qbhelp_vars
  1203.                 qbhelp_cons
  1204.                 qbhelp_auth
  1205.                 qbhelp_anyc
  1206.                 qbhelp_hstr
  1207.  
  1208. These variable are defined in query box qb_fourier ('Fourier 
  1209. analysis'):
  1210.  
  1211.                 four_vecs
  1212.                 four_freq
  1213.                 four_tovect
  1214.                 four_all
  1215.  
  1216. The following variables are reserved for use in three other boxes 
  1217. ('Shell command', 'Batch Spice', 'Type file'):
  1218.  
  1219.                 qbsh_comm
  1220.                 qbbspice_in
  1221.                 qbtype_in
  1222.  
  1223.  
  1224. ======================================================================
  1225. 5       NUTMEG OPERATIONS
  1226. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  1227. Nutmeg has a set of arithmetic operations like addition and division. 
  1228. These operations can be used to calculate with vectors and scalars. A 
  1229. scalar is a vector of length 1, and can be a scale factor, for 
  1230. example.
  1231.  
  1232. You can mix operations and functions in an algebraic expression. For 
  1233. a full description of available functions, see chapter 6.
  1234.  
  1235. There are 6 basic arithmetic operations available in Nutmeg. These 
  1236. operations work on real data and complex data, either vector or 
  1237. scalar. If vectors of different types are used, for example real and 
  1238. complex, then the values will be converted so that the types match. 
  1239. In this example, the output will contain complex results. Output can 
  1240. be converted back to real using appropriate functions.
  1241.  
  1242. 5.1 List of operations
  1243. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  1244. Here is a list of arithmetic operations on vectors and scalars:
  1245.  
  1246. +               Addition of two terms.
  1247.  
  1248. -               Subtraction of two terms.
  1249.  
  1250. *               Multiplication of two terms
  1251.  
  1252. /               Division of two terms.
  1253.  
  1254. %               This is the modulo operator. This represents the rest 
  1255.                 term when doing a division.
  1256.  
  1257. ^               The term 'a ^ b' represents 'a to the power of b'.
  1258.  
  1259. ,               This operator has two meanings: it can be part of an 
  1260.                 argument list of a user-definable function where it 
  1261.                 separates the arguments, or it separates the real and 
  1262.                 complex argument of a complex number. The term 'x , 
  1263.                 y' is synonymous with 'x + j(y)'.
  1264.  
  1265. There is a number of logical operations available in Nutmeg. They can 
  1266. be used in various plot commands, where they return the values 0 (if 
  1267. the expression was false) and 1 (if the expression was true). Logical 
  1268. operators use zero or non-zero. You can also use the set of 
  1269. conditional commands (notably 'if') to make decisions in scripts. See 
  1270. chapter 9 for more information.
  1271.  
  1272. Here is a list of logical operations:
  1273.  
  1274. Sym Synonym     Description.
  1275.  
  1276. &   and         Logical and. The result of a and b is 1 if both a and 
  1277.                 b are 1.
  1278.  
  1279. |   or          Logical or. The result of a or b is 1 if either a or 
  1280.                 b is 1.
  1281.  
  1282. !   not         Logical not. The result of not a is 1 if a was 0 and 
  1283.                 vice versa.
  1284.  
  1285. There is a number of relational operations. They belong to the group 
  1286. of logical operations because they return either zero or non-zero, 
  1287. depending on the validation of the relation. For example, 5 < 8 is 
  1288. true, and therefore returns 1. Here is a list of operators with their 
  1289. textual synonyms:
  1290.  
  1291. <   lt          Lower than.
  1292.  
  1293. <=  le          Lower or equal.
  1294.  
  1295. >   gt          Greater than.
  1296.  
  1297. >=  ge          Greater or equal.
  1298.  
  1299. =   eq          Equal.
  1300.  
  1301. <>  ne          Not equal.
  1302.  
  1303. Note that it is not possible to compare two complex numbers (either 
  1304. vector or scalar). Nutmeg will return strange values if you try to do 
  1305. so. If you want to compare the real or imaginary part of complex 
  1306. scalars or vectors, use the real() or imag() functions described in 
  1307. chapter 6.
  1308.  
  1309. Textual synonyms are useful if you don't want an expression 
  1310. containing '<' and '>' characters to be confused with I/O redirection 
  1311. (which is almost always).
  1312.  
  1313.  
  1314. ======================================================================
  1315. 6       NUTMEG FUNCTIONS
  1316. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  1317. 6.1 List of functions
  1318. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  1319. This section describes the functions available in nutmeg. You can use 
  1320. functions in expressions for calculations on plots, so they are very 
  1321. important in this respect. These functions have been designed to 
  1322. operate on vectors of values (data structures containing more values) 
  1323. and will, in most cases, return a vector of the same length 
  1324. containing the result.
  1325.  
  1326. Here is the list:
  1327.  
  1328. mag(vect)       This function returns a vector containing the 
  1329.                 magnitude of each of it's complex values. The 
  1330.                 magnitude is sometimes called the modulus of a 
  1331.                 vector, or in other words, the length of a complex 
  1332.                 vector.
  1333.  
  1334. ph(vect)        This function returns the phase for for each element 
  1335.                 of the input vector. The returned argument can be in 
  1336.                 degrees or in radians, depending on the value of 
  1337.                 variable 'units'.
  1338.  
  1339. j(vect)         This function multiplies the input vector with i 
  1340.                 (where i has been defined as the number for which i^2 
  1341.                 equals -1).
  1342.  
  1343. real(vect)      This function returns the real component of a complex 
  1344.                 vector.
  1345.  
  1346. imag(vect)      This function returns the imaginary part of a complex 
  1347.                 vector.
  1348.  
  1349. db(vect)        20 * log10(mag(vect)).
  1350.  
  1351. log(vect)       The logarithm (base 10) of the vect.
  1352.  
  1353. ln(vect)        The natural logarithm (base e) of vect.
  1354.  
  1355. exp(vect)       e to the vect power.
  1356.  
  1357. abs(vect)       The absolute value of vect.
  1358.  
  1359. sqrt(vect)      The square root of vect.
  1360.  
  1361. sin(vect)       The sin of vect.
  1362.  
  1363. cos(vect)       The cosine of vect.
  1364.  
  1365. tan(vect)       The tangent of vect.
  1366.  
  1367. atan(vect)      The inverse tangent of vect.
  1368.  
  1369. rnd(vect)       Random integer between 0 and the abs(elements) of 
  1370.                 vect.
  1371.  
  1372. mean(vect)      The result is the mean of the elements of vect.
  1373.  
  1374. vmin(vect)      Returns the minimum of the elements of vect. If the 
  1375.                 input is a complex vector, the results cannot be 
  1376.                 relied upon (as complex vectors cannot be ordered 
  1377.                 like real numbers).
  1378.  
  1379. vmax(vect)      Returns the maximum of the elements of vect. If the 
  1380.                 input is a complex vector, the same comment is made 
  1381.                 as for vmin().
  1382.  
  1383. vector(num)     This generates a vector of length num. The elements 
  1384.                 of this vector have value 0 to num-1.
  1385.  
  1386. length(vect)    The length of a vector is the number of elements that 
  1387.                 is contained in a vector.
  1388.  
  1389. timer(dummy)    Returns the number of centiseconds passed since 
  1390.                 program start. It can be used for timing purposes: 
  1391.                 measure the starting time, do what you have to do and 
  1392.                 calculate and output the difference in time.
  1393.  
  1394.  
  1395. ======================================================================
  1396. 7       NUTMEG CONSTANTS
  1397. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  1398. 7.1 List of constants
  1399. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  1400. pi              pi.
  1401. e               The base of natural logarithms.
  1402. c               The speed of light.
  1403. kelvin          Absolute 0 in centigrade.
  1404. echarge         The charge of an electron.
  1405. boltz           Boltzman's constant.
  1406. planck          Planck's constant (h).
  1407. true            Logical true. This is defined as 1.
  1408. false           Logical false. This is defined as 0.
  1409.  
  1410. 7.2 Using constants
  1411. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  1412. You can use constants in any place where you would normally type a 
  1413. numeric value. Nutmeg will replace the name of the constant with it's 
  1414. value. Be careful if you want to use true or false in expression. 
  1415. Minor calculation errors that occur when rounding down numbers can 
  1416. cause problems when comparing these with true or false.
  1417.  
  1418.  
  1419. ======================================================================
  1420. 8       PREFERENCE KEYWORDS
  1421. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  1422. These are the keywords that the Nutmeg command pref recognizes.
  1423.  
  1424. 8.1 List of keywords
  1425. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  1426. Nutmeg provides a number of text styles when creating diagrams. You 
  1427. can control font name, horizontal and vertical size, shift horizontal 
  1428. or vertical, and foreground and background colour.
  1429.  
  1430. You can control the text appearance of the text styles used in Nutmeg 
  1431. diagrams. The text styles you can edit are legend, label and unit. 
  1432. There are several item for each style you can edit. The style items 
  1433. can be recognized by the last part of the keyword, and are obvious.
  1434.  
  1435. Colour information must be given as three numerical values: one for 
  1436. red, one for blue and one for green (in that order). Each of them 
  1437. must be in the range 0 to 255. If you want to calculate the colour 
  1438. values, use a program like Draw or Paint to find out what colour you 
  1439. like.
  1440.  
  1441. 8.1.1 Text styles
  1442.  
  1443. Shift factors are in millimetres. They allow you to shift all items 
  1444. that are created using that style in either x or y direction.
  1445.  
  1446. The colour information for text styles can be supplied for either 
  1447. background or foreground colour.
  1448.  
  1449. Font names must not be included in brackets, and parsing is not case 
  1450. sensitive.
  1451.  
  1452.                 pref text_legend_fontname fontname
  1453.                 pref text_legend_sizex pts
  1454.                 pref text_legend_sizey pts
  1455.                 pref text_legend_shiftx mm
  1456.                 pref text_legend_shifty mm
  1457.                 pref text_legend_fore R G B
  1458.                 pref text_legend_back R G B
  1459.                 pref text_label_fontname fontname
  1460.                 pref text_label_sizex pts
  1461.                 pref text_label_sizey pts
  1462.                 pref text_label_shiftx mm
  1463.                 pref text_label_shifty mm
  1464.                 pref text_label_fore R G B
  1465.                 pref text_label_back R G B
  1466.                 pref text_units_fontname fontname
  1467.                 pref text_units_sizex pts
  1468.                 pref text_units_sizey pts
  1469.                 pref text_units_shiftx mm
  1470.                 pref text_units_shifty mm
  1471.                 pref text_units_fore R G B
  1472.                 pref text_units_back R G B
  1473.  
  1474. 8.1.2 Grid appearance
  1475.  
  1476. You can supply colour information for either the grid, the 
  1477. subdivision grid and the axes of the plot. You can alter the line 
  1478. thickness for the axes, the grid and the vectors that are plot on the 
  1479. grid.
  1480.  
  1481.                 pref line_grid_width pts
  1482.                 pref line_axes_width pts
  1483.                 pref line_plot_width pts
  1484.                 pref line_grid_col R G B
  1485.                 pref line_subgrid_col R G B
  1486.                 pref line_axes_col R G B
  1487.  
  1488. 8.1.3 Line style information
  1489.  
  1490. The line styles are used for vectors. There are only used if pref 
  1491. nodash is not defined. you must supply 4 values for each dash style. 
  1492. The first is the style number in the range 0 to 11 (there are 12 
  1493. styles). The second is the so called 'used' flag which can be 
  1494. non-zero or zero, depending on if you would like to use the style or 
  1495. not. The last two items are the multiplication and division factors. 
  1496. They are currently unimplemented, and should therefore be set to 1.
  1497.  
  1498.                 pref dash_style stylenum usedflg mul div
  1499.  
  1500. 8.1.4 Line colour information
  1501.  
  1502. The line colour information is used for vectors. It only has effect 
  1503. if variable monochrome is not defined. The format is pretty much the 
  1504. same as for dash styles. You have to supply the style number in the 
  1505. range 0 to 13, a 'used' flag, and the Red Green and Blue factors for 
  1506. the colour. You can customize the set of colours you would like to 
  1507. use if the default values don't match your taste.
  1508.  
  1509.                 pref cols_style stylenum usedflg R G B
  1510.  
  1511. 8.1.5 Miscellaneous preferences.
  1512.  
  1513. This list contains a number of preferences that control the size of 
  1514. the time slices, the number of poll cycles per time slice, 
  1515. information whether or not the nutmeg window should force itself on 
  1516. top, whether or not to read the news file, whether or not the window 
  1517. should open on start-up, the size and position of the nutmeg window, 
  1518. whether or not to use dash patterns, and the size of the diagrams.
  1519.  
  1520.                 pref timeslice centisecs
  1521.                 pref cycles cyclenum
  1522.                 pref keepontop flag
  1523.                 pref readnews flag
  1524.                 pref autoopen flag
  1525.                 pref clipos xpos ypos
  1526.                 pref clisize xsize ysize
  1527.                 pref nodash flag
  1528.                 pref graphsize xmm ymm
  1529.  
  1530.  
  1531. ======================================================================
  1532. 9       NUTMEG COMMANDS
  1533. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  1534. 9.1 List of commands
  1535. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  1536. 9.1.1 Input commands
  1537.  
  1538. load filename ...
  1539.  
  1540.                 This command loads the raw data in either binary or 
  1541.                 ascii format into the internal Nutmeg database. 
  1542.                 Simulation results will be stored in plots, and the 
  1543.                 simulated results for each node in the circuit will 
  1544.                 be stored in vectors. You can supply more than one 
  1545.                 filename, which will cause Nutmeg to load in all 
  1546.                 named files. Files should be stored in 
  1547.                 <Spicework$Dir>.raw.
  1548.  
  1549. source filename
  1550.  
  1551.                 Reads commands from the file filename. Lines 
  1552.                 beginning with the character * are considered 
  1553.                 comments and are ignored. This command is a remainder 
  1554.                 of ASpice, and should be considered redundant in 
  1555.                 Nutmeg. Instead, use the load and script commands to 
  1556.                 either load in raw files or execute a script.
  1557.  
  1558. script file     Run a Nutmeg script file. Script files should be 
  1559.                 located in one of the script directories mentioned in 
  1560.                 chapter 2.7.2. Script files can contain any valid 
  1561.                 Nutmeg command, so you can use them to automate 
  1562.                 certain operations or change the settings of some 
  1563.                 variables.
  1564.  
  1565. 9.1.2 Output commands
  1566.  
  1567. 9.1.2.1 File
  1568.  
  1569. write file exprs
  1570.  
  1571.                 Writes out the expressions to the file. The plot name 
  1572.                 and title will be that associated with the first 
  1573.                 expression given. The default format is ascii, but 
  1574.                 this can be changed with the set filetype command.
  1575.  
  1576. 9.1.2.2 Tables
  1577.  
  1578. print [col | csv] expr ...
  1579.  
  1580.                 Prints the vector described by the expression expr.
  1581.  
  1582.                 If the col argument is present, print the vectors 
  1583.                 named side by side. The options width, length, and 
  1584.                 nobreak are effective for this command (see asciiplot
  1585.                 ). If the expression is all, all of the vectors 
  1586.                 available are printed. Thus print col all > file will 
  1587.                 print everything in the file in SPICE2 format.
  1588.  
  1589.                 If the csv argument is present, data is output in 
  1590.                 comma separated values format. The first value will 
  1591.                 be de index into the vector. Complex data will be 
  1592.                 output as 'real , imag'. This output mode enables you 
  1593.                 to export Spice data to foreign data analysis 
  1594.                 packages, spreadsheets and graphics software.
  1595.  
  1596. 9.1.2.3 Draw graphics
  1597.  
  1598. plot exprs [ylimit ylo yhi] [xlimit xlo xhi] [xindices xilo xihi] 
  1599.                 [xcompress comp] [vs xname]
  1600.  
  1601.                 Plot the given exprs on the screen (if you are on a 
  1602.                 graphics terminal). The xlimit and ylimit arguments 
  1603.                 determine the high and low x and y limits of the 
  1604.                 axes, respectively. The xindices arguments determine 
  1605.                 what range of points are to be plotted - everything 
  1606.                 between the xilo'th point and the xihi'th point is 
  1607.                 plotted. The xcompress argument specifies that only 
  1608.                 one out of every comp points should be plotted. These 
  1609.                 parameter names may be abbreviated to xl, yl, xind, 
  1610.                 and xcomp. The xname argument is an expression to use 
  1611.                 as the scale on the x-axis.
  1612.  
  1613. 9.1.2.4 Ascii graphics
  1614.  
  1615. asciiplot plotargs
  1616.  
  1617.                 Produce a line printer plot of the vectors. The plot 
  1618.                 is sent to the standard output, so you can put it 
  1619.                 into a file or output device with output redirection 
  1620.                 i.e, asciiplot args ... > file. The set options width
  1621.                 , height, and nobreak determine the width and height 
  1622.                 of the plot, and whether there are page breaks, 
  1623.                 respectively. Note that you will have problems if you 
  1624.                 try to asciiplot something with an x scale that isn't 
  1625.                 monotonic (i.e, something like sin(TIME) ), because 
  1626.                 asciiplot uses a simpleminded sort of linear 
  1627.                 interpolation.
  1628.  
  1629. 9.1.3 Database manipulation commands
  1630.  
  1631. display [varname ...]
  1632.  
  1633.                 Prints a summary of currently defined vectors, or of 
  1634.                 the names specified. The vectors are sorted by name 
  1635.                 unless the variable nosort is set. The information 
  1636.                 given is the name of the vector, the length, the type 
  1637.                 of the vector, and whether it is real or complex 
  1638.                 data. In addition, one vector will be labelled 
  1639.                 '[scale]'. When a command such as plot is given 
  1640.                 without a vs argument, this scale is used for the 
  1641.                 X-axis. It is always the first vector in a rawfile, 
  1642.                 or the first vector defined in a new plot. If you 
  1643.                 undefine the scale (i.e let TIME) a random remaining 
  1644.                 vector will become the scale.
  1645.  
  1646. setplot [plotname]
  1647.  
  1648.                 Set the current plot to the plot with the given name, 
  1649.                 or if no name is given, prompt the user with a menu. 
  1650.                 Note that the plots are named as they are loaded, 
  1651.                 with names like 'tran1' or 'op2'. These names are 
  1652.                 shown by the setplot and display commands and are 
  1653.                 used by diff, below.) If the "New plot" item is 
  1654.                 selected, the current plot will become one with no 
  1655.                 vectors defined. Note that here the word 'plot' 
  1656.                 refers to a group of vectors that are the result of 
  1657.                 one SPICE run. When more than one file is loaded in, 
  1658.                 or more than one plot is present in one file, nutmeg 
  1659.                 keeps them separate and only shows you the vectors in 
  1660.                 the currently selected plot.
  1661.  
  1662. destroy[plotname ... ] [ all ]
  1663.  
  1664.                 Throw away the data in the named plot and reclaim the 
  1665.                 storage space. This can be necessary if a lot of 
  1666.                 large simulations are being done. If the argument to 
  1667.                 destroy is all, all plots except the constant plot 
  1668.                 will be thrown away. It is not possible to destroy 
  1669.                 the constant plot. If no argument is given the 
  1670.                 current plot is destroyed. Use with care.
  1671.  
  1672. killvect vector [ ... ]
  1673.  
  1674.                 Kill the specified vector. You should type the name 
  1675.                 of the vector explicitely. It is possible to specify 
  1676.                 more than 1 vector. You cannot use the 
  1677.                 plotname.vecname construction, and Nutmeg will not 
  1678.                 complain if a vector does not exist. Use with care.
  1679.  
  1680. 9.1.4 Environment commands
  1681.  
  1682. echo [stuff]    Print stuff directly to the output window. It is 
  1683.                 useful if you want to output descriptive text in a 
  1684.                 nutmeg script.
  1685.  
  1686. cd [directory]  This command changes the working directory. You will 
  1687.                 probably never need it, as almost everything in 
  1688.                 Nutmeg works with the currently selected working 
  1689.                 directory.
  1690.  
  1691. cat [leaf name] Catalogue the contents of the current work dir. If 
  1692.                 you do not specify a leaf name, Nutmeg will display 
  1693.                 all files in the .In directory together with 
  1694.                 information on similar named files in the .Raw 
  1695.                 directory. You can enter any leaf name after the cat 
  1696.                 command. For example, cat Script will cause Nutmeg to 
  1697.                 display all files behind directory 
  1698.                 <SpiceWork$Dir>.Script, provided that one exists.
  1699.  
  1700. shell [args]    Fork a shell, or execute the command. It will simply 
  1701.                 call the supervisor using *Gos. If you want to know 
  1702.                 more about he *Gos command, then see the RISC OS user 
  1703.                 guide.
  1704.  
  1705. type file       Type the specified file. If you want to include a 
  1706.                 RISC OS variable containing a path (e.g. type 
  1707.                 <SpiceWork$Dir>.In.RTLinv) you should use single 
  1708.                 quotes around the file specification to avoid 
  1709.                 confusion with I/O redirection.
  1710.  
  1711. 9.1.5 Calculation commands
  1712.  
  1713. diff plot1 plot2 [vector ...]
  1714.  
  1715.                 Compare all the vectors in the specified plots, or 
  1716.                 only the named vectors if any are given. There are 
  1717.                 different vectors in the two plots, or any values in 
  1718.                 the vectors differ significantly the difference is 
  1719.                 reported. The variables abstol, reltol, and vntol are 
  1720.                 used to determine what "significantly" means (see the 
  1721.                 SPICE3 User's Manual).
  1722.  
  1723. fourier [vect] fund_freq 'all' | vector ...
  1724.  
  1725.                 Do a fourier analysis of each of the given values, 
  1726.                 using the first 10 multiples of the fundamental 
  1727.                 frequency (or the first nfreqs, if that variable is 
  1728.                 set - see variables). The output is like that of the 
  1729.                 .four card. The values may be any valid expression. 
  1730.                 If the keyword vect is supplied, output will be 
  1731.                 stored in a plot. This allows you to do calculations 
  1732.                 on it, and plot it.
  1733.  
  1734. 9.1.6 Conditional commands
  1735.  
  1736. if <expression> then <command>
  1737.  
  1738.                 execute a command if the result of the expression is 
  1739.                 greater than 0. In other words, this expression is 
  1740.                 true. If you want to execute more than 1 command 
  1741.                 depending on the result, you can either repeat the if 
  1742.                 command several times, or execute a script that 
  1743.                 contains the commands.
  1744.  
  1745. ifdef '<var>' '<command> [tail ...]'
  1746.  
  1747.                 execute command if var has been defined. Note that 
  1748.                 the quotes must be actually typed to avoid problems 
  1749.                 with non-existing variables.
  1750.  
  1751. ifundef '<var>' '<command> [tail ...]'
  1752.  
  1753.                 execute command if var has not been defined. Note 
  1754.                 that the quotes must be actually typed to avoid 
  1755.                 problems with non-existing variables.
  1756.  
  1757. 9.1.7 Query commands
  1758.  
  1759. queryload file
  1760.  
  1761.                 This command parses a query file. Queries can be used 
  1762.                 to alleviate interacting with the user and to provide 
  1763.                 a nice looking front end for nutmeg commands. A query 
  1764.                 description file contains the query box identifier 
  1765.                 and a number of definitions for static text, boolean 
  1766.                 buttons, writable icons and hot buttons (action 
  1767.                 buttons). When an identifier is found that already is 
  1768.                 being used, the old definition is killed and the new 
  1769.                 box loaded.
  1770.  
  1771.                 The file is first searched for in 
  1772.                 <SpiceWork$Dir>.Query, then in SpiceResource:Query 
  1773.                 and finally in <Nutmeg$Dir>.Query.
  1774.  
  1775. queryopen id
  1776.  
  1777.                 Open the specified query box at the current mouse 
  1778.                 pointer position. This will also close all other 
  1779.                 query boxes. The id is the name found in the header 
  1780.                 of the query box definition (e.g. 'query_plot').
  1781.  
  1782. querykill id
  1783.  
  1784.                 Remove the specified query box from memory. If you 
  1785.                 reference a query box that has previously been 
  1786.                 deleted from memory or that never has been defined 
  1787.                 before, nothing will happen.
  1788.  
  1789. querylist
  1790.  
  1791.                 Output a list of currently loaded query boxes. The 
  1792.                 information includes the identifier of the query box, 
  1793.                 whether it has been opened or close, and the text 
  1794.                 that would appear in the title bar of the window.
  1795.  
  1796. queryclose
  1797.  
  1798.                 Close the opened query box. If no query box is open, 
  1799.                 nothing will happen.
  1800.  
  1801. 9.1.8 'Set' command
  1802.  
  1803. set [option] [option = value] ...
  1804.  
  1805.                 Set a variable. There are several possible variable 
  1806.                 types, each of which can be set using a different 
  1807.                 syntax. Typing just plain set without any parameters 
  1808.                 will output a list of all defined options to the 
  1809.                 screen. If you would like to set a boolean variable, 
  1810.                 then use the set option syntax. This will create a 
  1811.                 variable of type bool with name option. If you use 
  1812.                 the set option = value syntax, then Nutmeg will 
  1813.                 create a string or real variable with value value. 
  1814.                 You will have to use single quotes in order to assign 
  1815.                 a string value to a variable. If a variable does not 
  1816.                 exist, then the variable will be created. If the 
  1817.                 variable does exist, then the old value and type will 
  1818.                 be discarded and set to the new value.
  1819.  
  1820. unset varname ...
  1821.  
  1822.                 Unset a variable. You can unset more than one 
  1823.                 variable using one single command. Variables can be 
  1824.                 of any type.
  1825.  
  1826. 9.1.9 'Pref' command
  1827.  
  1828. pref item <opt1> [opt2 .. opt5]
  1829.  
  1830.                 Set various nutmeg preferences that cannot be set 
  1831.                 with the set command, typically settings that are not 
  1832.                 likely to change very often. See chapter 8 for 
  1833.                 further information.
  1834.  
  1835. 9.1.10 Miscellaneous commands
  1836.  
  1837. bspice [input file]
  1838.  
  1839.                 Start a remote batch Spice job. !BSpice must be 
  1840.                 active, or nothing will happen at all. The generated 
  1841.                 raw file will not be loaded in automatically, so you 
  1842.                 will have to do so yourself using the load command.
  1843.  
  1844. help [item] ...
  1845.  
  1846.                 Print help on a subject. The subject can be any valid 
  1847.                 command, or one of the following keywords: commands, 
  1848.                 functions, operations, variables, constants, authors. 
  1849.                 These special keywords will give you short 
  1850.                 information, just to remind you of their syntax or 
  1851.                 functional use. For full documentation you should 
  1852.                 refer to this document.
  1853.  
  1854. history [number]
  1855.  
  1856.                 This will print the history of commands (last number 
  1857.                 events).
  1858.  
  1859. version [number]
  1860.  
  1861.                 With no arguments, this command prints out the 
  1862.                 current version of spice. If there are arguments, it 
  1863.                 compares the current version with the given version 
  1864.                 and prints a warning if they differ. A version 
  1865.                 command is usually included in the rawfile.
  1866.  
  1867. define function(arg, ...) expression
  1868.  
  1869.                 Define the macro with the name function and with 
  1870.                 arguments arg, ... to be expression, which may 
  1871.                 involve the arguments. When the function is later 
  1872.                 used, the arguments it is given are substituted for 
  1873.                 the formal arguments when it is parsed. If expression 
  1874.                 is not present, any definitions for function are 
  1875.                 printed, and if there are arguments to define then 
  1876.                 all currently active definitions are printed.Note 
  1877.                 that you may have different functions defined with 
  1878.                 the same name but different arities. Some useful 
  1879.                 definitions are:
  1880.  
  1881.                 define max(x,y) (x gt y) * x + (x le y) * y
  1882.  
  1883.                 define min(x,y) (x lt y) * x + (x ge y) * y
  1884.  
  1885. undefine [word ...]
  1886.  
  1887.                 Remove all the macro functions defined for the words. 
  1888.                 If the argument is "*", then all macro functions are 
  1889.                 deleted. Note that all functions with the given names 
  1890.                 are removed, so there is no way to delete a function 
  1891.                 with a particular arity without deleting all 
  1892.                 functions with that name.
  1893.  
  1894. let vecname = expr
  1895.  
  1896.                 Create a vector with name vecname and value given by 
  1897.                 the expression expr. None of the vector options such 
  1898.                 as default scale and colour that are read from the 
  1899.                 rawfile are preserved when a vector is created in 
  1900.                 this manner.
  1901.  
  1902. quit            This command quits Nutmeg. Note that you will not be 
  1903.                 asked for confirmation, so use it only if you are 
  1904.                 certain you saved all diagrams.
  1905.  
  1906. rusage          Print current resource usage. This includes memory 
  1907.                 available and execution time.
  1908.  
  1909. 9.2 Aliases
  1910. ¯¯¯¯¯¯¯¯¯¯¯
  1911. You can set up an alias for a command if you are not happy with the 
  1912. name of the present command or if you want to include some default 
  1913. parameters. You could for example introduce an alias 'ff' for the 
  1914. fourier command, and an alias 'ffv' for the fourier command with 
  1915. redirection to a vector. All this can be done using the 'alias' 
  1916. command:
  1917.  
  1918. alias [[word] alias]
  1919.  
  1920.                 Define an alias. If you given no arguments to alias, 
  1921.                 a list of currently defined aliases will be output. 
  1922.                 If you specify one argument, then Nutmeg will look up 
  1923.                 that argument in the alias list, and if it exists, 
  1924.                 the alias definition will be printed. If more than 1 
  1925.                 arguments are specified, the first one is treated as 
  1926.                 the name of the new alias that is being defined. 
  1927.                 Every time you enter a command that is known as an 
  1928.                 alias, the rest of the arguments you have given is 
  1929.                 substituted, and normal command parsing of the 
  1930.                 command execution continues. Note that you can use 
  1931.                 another alias inside an alias definition. If your 
  1932.                 alias definition is badly formed, you can get 
  1933.                 infinite loops. Nutmeg catches these and reports an 
  1934.                 error if this happens.
  1935.  
  1936. unalias word
  1937.  
  1938.                 undefines the alias that can be identified using the 
  1939.                 specified argument. If no such alias exists, nothing 
  1940.                 happens.
  1941.  
  1942.  
  1943. ======================================================================
  1944. 10      'HOW TO..' SECTION
  1945. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  1946. This chapter contains various tips and suggestions for dealing with 
  1947. standard problems.
  1948.  
  1949. 10.1 Scripts
  1950. ¯¯¯¯¯¯¯¯¯¯¯¯
  1951. 10.2 Query boxes
  1952. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  1953. 10.3 Calculation
  1954. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  1955. 10.4 Conditional execution
  1956. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  1957.  
  1958. ======================================================================
  1959. A       KNOWN PROBLEMS AND BUGS
  1960. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  1961. A.1 Limitations
  1962. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  1963. Nutmeg does not feature a full programming language. You can create 
  1964. simple command scripts using the internal commands, but you can not 
  1965. create repeating constructions.
  1966.  
  1967. Nutmeg can not print directly. We will include this facility in the 
  1968. future (using some routines written by Peter Roozemaal).
  1969.  
  1970. A.2 Annoyances
  1971. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  1972. Nutmeg does not complain if you have unsaved data and you want to 
  1973. quit. You will simply lose all unsaved results and diagrams. However, 
  1974. you can reconstruct a session using the file !Nutmeg.Script.Logfile. 
  1975. Rename this log file and start Nutmeg. Then execute the log file 
  1976. using the script command. Note that this will not work properly if 
  1977. you have changed the current work directory during a Nutmeg session.
  1978.  
  1979. A.3 Real bugs
  1980. ¯¯¯¯¯¯¯¯¯¯¯¯¯
  1981. Sometimes, when you mix complex and real vectors, Nutmeg will crash 
  1982. displaying the error 'free failed'. This is a real bug.
  1983.  
  1984. Loading binary raw files does not work reliable. Do not use it for 
  1985. the moment.
  1986.  
  1987. The 'insert' item in the CLI window menu tree has been shaded due to 
  1988. dome serious problems with the RISC OS libraries.
  1989.  
  1990.  
  1991. ======================================================================
  1992. B       WORK DIRECTORIES
  1993. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  1994. B.1 Usage
  1995. ¯¯¯¯¯¯¯¯¯
  1996. B.2 Creating
  1997. ¯¯¯¯¯¯¯¯¯¯¯¯
  1998. B.3 Maintenance
  1999. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  2000.  
  2001. ======================================================================
  2002. C       FILE FORMATS
  2003. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  2004. C.1 Ascii raw files
  2005. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  2006. The ascii output file format is provided to make it easy to modify 
  2007. data files and transfer them between machines with different 
  2008. floating-point formats ie. other than the Archimedes' floating point 
  2009. format. You can transfer raw files in ascii format from one 
  2010. architecture to another without any trouble.
  2011.  
  2012. The format is as follows:
  2013.  
  2014.         Title: Title Card String
  2015.         Date: Date
  2016.         [ Plotname: Plot Name
  2017.             Flags: complex or real
  2018.             No. Variables: numoutputs
  2019.             No. Points: numpoints
  2020.             Command: nutmeg command
  2021.             Variables:  0 varname1 typename1
  2022.                         1 varname2 typename2
  2023.                         etc...
  2024.             Values:
  2025.                 0 n n n n ...
  2026.                 1 n n n n ...
  2027.             And so forth...
  2028.         ] repeated one or more times
  2029.  
  2030. If one of the flags is complex, the points look like r,i where r and 
  2031. i are floating point (in %e format, that is, in scientific notation). 
  2032. Otherwise they are in %e format. Only one of real and complex should 
  2033. appear.
  2034.  
  2035. The lines are guaranteed to be less than 80 columns wide (unless the 
  2036. plot title or variable names are very long), so this format is safe 
  2037. to transfer between systems like VAX/VMS, IBM OS/2, UNIX etc. using 
  2038. ftp, e-mail, kermit or simply swapping floppies or streamer tapes.
  2039.  
  2040. Any number of Command: lines may appear between the No. Points: and 
  2041. the Variables: lines, and whenever the plot is loaded into nutmeg 
  2042. they will be executed.
  2043.  
  2044. C.2 Binary raw files
  2045. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  2046. Binary format is the preferred output format for general use, as it 
  2047. is the most economical in terms of space and speed of access. The 
  2048. format is as follows:
  2049.  
  2050.         Title Card                      (a NULL terminated string)
  2051.         Date, Time                      (a NULL terminated string)
  2052.         [
  2053.             Plot title                  (a NULL terminated string)
  2054.             Number of variables         (an integer)
  2055.             Number of data points       (an integer)
  2056.             flags                       (a short integer)
  2057.             variable header struct      (repeated numoutputs times)
  2058.                 variable name           (a NULL terminated string)
  2059.                 variable type           (an integer)
  2060.             set of outputs              (repeated numpoints times)
  2061.         ] repeated one or more times.
  2062.  
  2063. A set of outputs is a vector of doubles of length numoutputs, or a 
  2064. vector of real and imaginary pairs of doubles if the data is complex.
  2065.  
  2066. Note that such files can hardly be created them using a text editor. 
  2067. Format is very strict and can best be handled by specialised 
  2068. programs.
  2069.  
  2070. C.3 Scripts
  2071. ¯¯¯¯¯¯¯¯¯¯¯
  2072. Scripts are normal text files. You can enter valid Nutmeg commands 
  2073. (on separate lines) or use the comment character * or |. Blank lines 
  2074. are stripped. Any command that you can enter from the Nutmeg command 
  2075. line may be used inside Nutmeg script files. You can execute a script 
  2076. using the script command.
  2077.  
  2078. C.4 Query boxes
  2079. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  2080. Query boxes can be created using a normal text file. There is a set 
  2081. of 6 keywords that control the creation of query boxes. Note that all 
  2082. keywords should start in column 1. This means that you should not 
  2083. leave any spaces in front of a keyword.
  2084.  
  2085. C.4.1 Box definition
  2086.  
  2087. You can define several query boxes in one file. Each query box 
  2088. consists of a box definition and number of items inside the body of 
  2089. the box definition. A box definition is as follows:
  2090.  
  2091.         defbox box_identifier 'Title string'
  2092.  
  2093.         item description
  2094.  
  2095.         endbox
  2096.  
  2097. C.4.2 Box items
  2098.  
  2099. Inside a box definition can be a number of items. The query box is 
  2100. created using these items. In fact, each items will represent an icon 
  2101. in the query box.
  2102.  
  2103. All identifiers are case sensitive.
  2104.  
  2105. The items are:
  2106.  
  2107. boolean varname xpos ypos keycode
  2108.  
  2109.                 Create on/off switches. varname is the name of the 
  2110.                 variable that will be set or unset depending on the 
  2111.                 state of the button. xpos and ypos are the 
  2112.                 coordinates of the bottom left corner of the button. 
  2113.                 keycode is the wimp keycode that can be used to 
  2114.                 toggle this switch. If you do not want to use any key 
  2115.                 short-cut, you should supply -1 as a value.
  2116.  
  2117. hotbutton 'command string' xpos ypos keycode 'text'
  2118.  
  2119.                 Create action buttons, that will cause a command to 
  2120.                 be executed and the box to be closed. 'command 
  2121.                 string' is the string of the command that should be 
  2122.                 executed when this button is activated, enclosed in 
  2123.                 single quotes. xpos and ypos are the coordinates of 
  2124.                 the bottom left corner of the button. keycode is the 
  2125.                 wimp keycode that can be used to activate this 
  2126.                 button. If you do not want to use any key short-cut, 
  2127.                 you should supply -1 as a value. 'text' is the Text 
  2128.                 you would like to appear in the icon, enclosed in 
  2129.                 single quotes. The length of this text should not 
  2130.                 exceed 11 characters!
  2131.  
  2132. static xpos ypos 'text'
  2133.  
  2134.                 Create static text for informational purpose only. 
  2135.                 xpos and ypos are the coordinates of the bottom left 
  2136.                 corner of the text field. 'text' is the text you 
  2137.                 would like to display on screen. The length of this 
  2138.                 text is restricted to 250 characters, which should be 
  2139.                 more than enough.
  2140.  
  2141. staticpict xpos ypos 'name'
  2142.  
  2143.                 This will put a sprite (that should be in the 
  2144.                 'IconPicts' sprite file) with it's left bottom corner 
  2145.                 at position xpos,ypos. It can be used to make the 
  2146.                 query box look nicer, or to underline the character 
  2147.                 that corresponds to a hot key. See the standard query 
  2148.                 box description file for more information.
  2149.  
  2150. string varname R/C/P/V/S/I xpos ypos width length
  2151.  
  2152.                 Create a writable icon where you can enter text. 
  2153.                 varname is the name of the variable where you would 
  2154.                 like to keep the contents of the icon in. xpos and 
  2155.                 ypos are the coordinates of the bottom left corner of 
  2156.                 the writable icon. width is the width of the writable 
  2157.                 icon. length is the size of the buffer. The meaning 
  2158.                 of the characters after varname is as follows:
  2159.  
  2160.                 R   This writable icon can contain a real number.
  2161.  
  2162.                 C   This writable icon can contain a complex number.
  2163.  
  2164.                 P   The writable icon can contain the name of a plot.
  2165.  
  2166.                 V   The writable icon can contain the name of vector.
  2167.  
  2168.                 S   The writable number can contain any string.
  2169.  
  2170.                 I   The writable icon can contain an integer.
  2171.  
  2172. C.5 Smart Icon description file
  2173. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  2174. This file format is very straightforward. There can at most be one 
  2175. Smart Icon description file, which is read in when Nutmeg starts. 
  2176. This is the !Nutmeg.Icons file.
  2177.  
  2178. There is a number of keywords that you can use to describe the icon 
  2179. bar. Here is the list:
  2180.  
  2181.         |   comment
  2182.         command spritename commandstring
  2183.         gap distance
  2184.  
  2185. The order in which the icons are created is the order in which they 
  2186. appear in the description file. The special keyword gap allows you to 
  2187. create some space between groups of icons that belong to each other. 
  2188. The distance units are OS units.
  2189.  
  2190. Note that all keywords are case sensitive.
  2191.  
  2192.  
  2193. ======================================================================
  2194. D       TUTORIAL
  2195. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  2196. This is a simple tutorial, which should be seen as an introduction to 
  2197. working with the Spice environment we have made for the Archimedes.
  2198.  
  2199. The reader is assumed to be familiar with the Spice netlist format, 
  2200. and the process of generating this netlist.
  2201.  
  2202. It will be shown how to generate plots and do calculations from 
  2203. within Nutmeg. We will use some example circuits that can be found in 
  2204. the !General work directory.
  2205.  
  2206. D.1 Starting up
  2207. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  2208. Double-click on the !BSpice and !Nutmeg icon in the filer window to 
  2209. start these applications. The Nutmeg window will open. Make sure the 
  2210. !Resources application has been seen by the filer. If !Resources 
  2211. resides in the same directory as !BSpice and/or !Nutmeg this is not a 
  2212. problem.
  2213.  
  2214. Activate the work directory, in our case !General, by double-clicking 
  2215. on it. A window with the directory contents of the in directory 
  2216. together with a information box will be opened.
  2217.  
  2218. If you want a hardcopy of a generated plot on you printer: a RISC OS 
  2219. printer driver must be installed, and Draw should have been seen by 
  2220. the filer.
  2221.  
  2222. D.2.1 Example 1:MOS output characteristics
  2223.  
  2224. In this example will make a plot of the output characteristics of a 
  2225. MOS-FET device. We will use the 'MOSoutput' file in the !General work 
  2226. directory.
  2227.  
  2228. If you type 'cat' or click on the floppy icon in the !Nutmeg window, 
  2229. a directory catalogue will be printed. As we expected, out circuit is 
  2230. present.
  2231.  
  2232. Start now the simulation. There are multiple methods for starting the 
  2233. simulation.
  2234.  
  2235.       * Type 'bspice MOSoutput' in the Nutmeg input line
  2236.  
  2237.       * Click on the 'S' icon in Nutmeg. A query box will be opened. 
  2238.         Type 'MOSoutput' in the 'Input file' field. Click 'Go!' or 
  2239.         press return to start the simulation.
  2240.  
  2241.       * Drag the MOSoutput file onto the !BSpice icon on the icon 
  2242.         bar.
  2243.  
  2244.       * Click on the !BSpice icon on the icon bar, a dialog box will 
  2245.         open. Type 'MOSoutput' in the 'Input file' field, or drag the 
  2246.         MOSoutput file onto the dialog box. You can also set runtime 
  2247.         options for BSpice in this box. Toggle the 'Log file' button 
  2248.         to enable or disable saving of runtime messages to the log 
  2249.         directory (which resides in the work directory). Toggle the 
  2250.         'Quiet' button to disable status display while running.
  2251.  
  2252. The results of the simulation are stored in the raw directory behind 
  2253. the work directory. After the simulation is finished you are prompted 
  2254. to press space to continue.
  2255.  
  2256. If you type 'cat', you will see that Nutmeg has detected the presence 
  2257. of the simulation results.
  2258.  
  2259. Type 'load MOSoutput' to load the results.
  2260.  
  2261. Type 'display' to find out what vectors are available for further 
  2262. processing.
  2263.  
  2264. We will use vector 'vids#branch' (current flowing through 'vids') for 
  2265. our output characteristic.
  2266.  
  2267. Generate the plot of the output characteristic: type 'plot 
  2268. vids#branch', or click on the plot icon (the pencil) and substitute 
  2269. the desired vector, 'vids#branch' in the vectors field. Click on the 
  2270. 'plot' button start plotting.
  2271.  
  2272. A window with a draw diagram within it will open. In it are 6 curves, 
  2273. the one at the bottom displays the drain source current versus drain 
  2274. source voltage, with a gate source voltage of 0 volt. The one at the 
  2275. top displays the drain source current versus drain source voltage, 
  2276. with a gate source voltage of 6 volt.
  2277.  
  2278. You can magnify the trace with the zoom box in the viewer menu. Use 
  2279. the save box to save the diagram to ArcDraw, DrawPlus or Vector for 
  2280. further placing annotations. You can also drag it into your DTP 
  2281. program, a filer window to save it, or the printer driver to print 
  2282. it.
  2283.  
  2284. Type or click quit to exit nutmeg of you want to exit.
  2285.  
  2286. Enjoy!
  2287.  
  2288.  
  2289. ======================================================================
  2290. E       Table of figures
  2291. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  2292. fig.    Name    Description
  2293.  
  2294. 1-1     ?       schematic overview Spice and Nutmeg environment
  2295. 2-1     ?       picture of Nutmeg main window
  2296.