Initialization and Workspace Files: Difference between revisions
(New page: =Initialization File= Global program settings saved and restored for the next time the program is started are saved in a file named <b>NARS2000.ini</b>. By default, this file is saved in...) |
|||
Line 16: | Line 16: | ||
The format of this file follows that of all other <b>.ini</b> files. The sections are named as follows: | The format of this file follows that of all other <b>.ini</b> files. The sections are named as follows: | ||
<ul> | |||
<li>The <b>[General]</b> section contains version, SI Level, and Creation Time information about the workspace.</li> | |||
<li>The <b>[Globals]</b> section contains definitions of all global (as opposed to immediate) objects in the workspace.<br /> | |||
* The <b>[Vars.<i>sss</i>]</b> section, where <i>sss</i> is an SI Level, contains definitions of all variables at this SI Level (note that multiple SI Levels are not supported as yet). | Each item in this section is of the form<br /> | ||
<b><i>KeyName</i></b>=<b>V</b> <b><i>DataType</i> <i>NELM</i> <i>Rank</i> <i>Shape</i> <i>Values</i></b> for variables, or<br /> | |||
<b><i>KeyName</i></b>=<b>F</b> <b><i>nnn</i>.<i>FcnName</i></b> for functions. | |||
<ul><li>The <i>KeyName</i> is of the form <b>:<i>ggg</i></b> where <i>ggg</i> is a sequential non-negative integer. These items are referenced elsewhere in the workspace file, possibly multiple times, thus allowing reference counts to be preserved over a <apll>)SAVE</apll> and <apll>)LOAD</apll>.</li> | |||
<li>The <i>DataType</i> is <b>A</b> for an Arithmetic Progression Array, <b>B</b> for a Boolean, <b>C</b> for a character, <b>F</b> for a double-precision float, <b>I</b> for a 64-bit integer, <b>H</b> for a heterogeneous array, and <b>N</b> for a nested array.</li> | |||
<li>The <i>NELM</i> (Number of Elements), <i>Rank</i>, and <i>Shape</i> are all non-negative integers where the <i>Shape</i> has <i>Rank</i> number of values.</li> | |||
<li>The <i>Values</i> consist of numbers (e.g., <b>18.2</b>), characters (e.g., <b>'Boldface'</b>), or globals (e.g. <b>:3</b>, referring to another entry in the <b>[Globals]</b> section).</li> | |||
<li>The <i>nnn</i> for functions is a non-negative sequential number.</li> | |||
<li>The <i>FcnName</i> is the name of the function.</li> | |||
<li>Together, <i>nnn</i>.<i>FcnName</i> forms a section name which contains the definition of the function.<br /> | |||
Each item in this section is of the form<br /> | |||
<b><i>iii</i>=<i>Header/LineText</i></b> where <i>iii</i> is the function line number (<b>0</b> for the function header), along with<br /> | |||
<b>UserDefined=<i>n</i></b> to indicate whether (<i>n</i>=<b>1</b>) or not (<i>n</i>=<b>0</b>) the function/operator is user-defined, and <br /> | |||
<b>Undo=<i>undo sequence</i></b> which describes the undo buffer for the user-defined function/operator. | |||
</li></ul> | |||
For example, the entries in <b>[Globals]</b> | |||
<b>:0=V C 3 1 3 '{leftbrace}quad{rightbrace}DM'</b><br /> | |||
<b>:1=V C 6 1 6 '.,*0_{leftbrace}overbar{rightbrace}'</b><br /> | |||
<b>:2=V I 13 1 13 3 4 2 2 2 1 2 2 1 2 2 2 1</b><br /> | |||
<b>:3=V C 0 1 0 {'}{'}</b><br /> | |||
<b>:4=F 4.foo</b><br /> | |||
represent the default values for <apll>⎕ALX/⎕ELX</apll>, <apll>⎕FC</apll>, <apll>⎕IC</apll>, and <apll>⎕LX</apll> along with a function named <b>foo</b> whose entries in in the section <b>[4.foo]</b> might look like<br /><br /> | |||
<b>0=foo type;apa1;apa2;a</b><br /> | |||
<b>1=apa1{leftbrace}leftarrow{rightbrace}2 64{leftbrace}rho{rightbrace}1</b><br /> | |||
<b>2=a{leftbrace}leftarrow{rightbrace}type {leftbrace}quad{rightbrace}dr apa1</b><br /> | |||
<b>UserDefined=1</b><br /> | |||
<b>CreationTime=01C8B14AA09E3C00</b><br /> | |||
<b>LastModTime=01C8B14AC949C390</b><br /> | |||
</li> | |||
<li>The <b>[Vars.<i>sss</i>]</b> section, where <i>sss</i> is an SI Level, contains the definitions of all variables at this SI Level (note that multiple SI Levels are not supported as yet).<br /> | |||
Each item in this section is of the form<br /> | |||
<b><i>KeyName</i>=<i>VarName</i>=<i>VarValue</i></b><br /> | |||
<ul><li>The <i>KeyName</i> is of the form <i>nnn</i> which is a sequential non-negative integer.</li> | |||
<li>The <i>VarName</i> is the name of the variable (with non-ASCII characters translated to <b>{leftbrace}symbol{rightbrace}</b> form).</li> | |||
<li>The <i>VarValue</i> is of the form <b>:<i>ggg</i></b> if the variable is global (referring to an entry in the <b>[Globals]</b> section), or <b><i>DataType</i> <i>NELM</i> <i>Rank</i> <i>Shape</i> <i>Values</i></b> if immediate.<br />Immediate values have a <i>DataType</i>, <i>NELM</i>, <i>Rank</i>, <i>Shape</i>, and <i>Values</i> the same as described in the <b>[Globals]</b> section above.</li> | |||
</ul> | |||
For example, the entries | |||
<b>0={leftbrace}quad{rightbrace}alx=:0</b><br /> | |||
<b>1={leftbrace}quad{rightbrace}ct=F 1 0 2.9999999999999998E-15</b><br /> | |||
<b>2={leftbrace}quad{rightbrace}elx=:0</b><br /> | |||
<b>3={leftbrace}quad{rightbrace}fc=:1</b><br /> | |||
<b>4={leftbrace}quad{rightbrace}ic=:2</b><br /> | |||
<b>5={leftbrace}quad{rightbrace}io=B 1 0 1</b><br /> | |||
<b>6={leftbrace}quad{rightbrace}lx=:3</b><br /> | |||
<b>7={leftbrace}quad{rightbrace}pp=I 1 0 10</b><br /> | |||
<b>8={leftbrace}quad{rightbrace}pr=C 1 0 ' '</b><br /> | |||
<b>9={leftbrace}quad{rightbrace}pw=I 1 0 126</b><br /> | |||
<b>10={leftbrace}quad{rightbrace}rl=I 1 0 16807</b><br /> | |||
represent how some of the system variables might be stored.</li> | |||
<li>The <b>[Fcns.<i>sss</i>]</b> section, where <i>sss</i> is an SI Level, contains the definitions of all named functions at this SI Level (note that multiple SI Levels are not supported as yet). These functions may be function assignments (e.g., <apll>f{is}+.{times}</apll>, or user-defined functions/operators. | |||
</li> | |||
</ul> |
Revision as of 02:15, 23 May 2008
Initialization File
Global program settings saved and restored for the next time the program is started are saved in a file named NARS2000.ini. By default, this file is saved in the current user's Windows Application Data directory in a subdirectory named (what else) NARS2000.
The format of this file follows that of all other .ini files. The sections are named as follows:
- The [General] section contains version, size, position, and state information about the program window.
- The [Fonts] section contains information about the fonts assigned to each type of window under the program window: FE for the Function Editor window, ME for the Matrix Editor window (when implemented), SM for the Session Manager window, TC for the Tab Control window, and VE for the Vector Editor window (when implemented).
- The [SysVars] section contains the values for each of the system variables to be used when a Clear WS is loaded.
Edit this file at your own risk.
Workspace Files
When a workspace is saved, a plain text version of it is saved on disk in a file named WorkspaceName.ws.nars. By default, this file is saved in the user's Application Data\NARS2000 directory in a subdirectory named workspaces, although you may choose to save it anywhere else by including the full path to the workspace in the )WSID or )SAVE commands.
The format of this file follows that of all other .ini files. The sections are named as follows:
- The [General] section contains version, SI Level, and Creation Time information about the workspace.
- The [Globals] section contains definitions of all global (as opposed to immediate) objects in the workspace.
Each item in this section is of the form
KeyName=V DataType NELM Rank Shape Values for variables, or
KeyName=F nnn.FcnName for functions.- The KeyName is of the form :ggg where ggg is a sequential non-negative integer. These items are referenced elsewhere in the workspace file, possibly multiple times, thus allowing reference counts to be preserved over a )SAVE and )LOAD.
- The DataType is A for an Arithmetic Progression Array, B for a Boolean, C for a character, F for a double-precision float, I for a 64-bit integer, H for a heterogeneous array, and N for a nested array.
- The NELM (Number of Elements), Rank, and Shape are all non-negative integers where the Shape has Rank number of values.
- The Values consist of numbers (e.g., 18.2), characters (e.g., 'Boldface'), or globals (e.g. :3, referring to another entry in the [Globals] section).
- The nnn for functions is a non-negative sequential number.
- The FcnName is the name of the function.
- Together, nnn.FcnName forms a section name which contains the definition of the function.
Each item in this section is of the form
iii=Header/LineText where iii is the function line number (0 for the function header), along with
UserDefined=n to indicate whether (n=1) or not (n=0) the function/operator is user-defined, and
Undo=undo sequence which describes the undo buffer for the user-defined function/operator.
For example, the entries in [Globals]
:0=V C 3 1 3 '{quad}DM'
:1=V C 6 1 6 '.,*0_{overbar}'
:2=V I 13 1 13 3 4 2 2 2 1 2 2 1 2 2 2 1
:3=V C 0 1 0 ''
:4=F 4.foo
represent the default values for ⎕ALX/⎕ELX, ⎕FC, ⎕IC, and ⎕LX along with a function named foo whose entries in in the section [4.foo] might look like
0=foo type;apa1;apa2;a
1=apa1{leftarrow}2 64{rho}1
2=a{leftarrow}type {quad}dr apa1
UserDefined=1
CreationTime=01C8B14AA09E3C00
LastModTime=01C8B14AC949C390
- The [Vars.sss] section, where sss is an SI Level, contains the definitions of all variables at this SI Level (note that multiple SI Levels are not supported as yet).
Each item in this section is of the form
KeyName=VarName=VarValue
- The KeyName is of the form nnn which is a sequential non-negative integer.
- The VarName is the name of the variable (with non-ASCII characters translated to {symbol} form).
- The VarValue is of the form :ggg if the variable is global (referring to an entry in the [Globals] section), or DataType NELM Rank Shape Values if immediate.
Immediate values have a DataType, NELM, Rank, Shape, and Values the same as described in the [Globals] section above.
For example, the entries
0={quad}alx=:0
represent how some of the system variables might be stored.
1={quad}ct=F 1 0 2.9999999999999998E-15
2={quad}elx=:0
3={quad}fc=:1
4={quad}ic=:2
5={quad}io=B 1 0 1
6={quad}lx=:3
7={quad}pp=I 1 0 10
8={quad}pr=C 1 0 ' '
9={quad}pw=I 1 0 126
10={quad}rl=I 1 0 16807
- The [Fcns.sss] section, where sss is an SI Level, contains the definitions of all named functions at this SI Level (note that multiple SI Levels are not supported as yet). These functions may be function assignments (e.g., f←+.×, or user-defined functions/operators.