Initialization and Workspace Files: Difference between revisions

From NARS2000
Jump to navigationJump to search
 
Line 46: Line 46:
Each item in this section is of the form<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><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>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/hyperator is user-defined, and <br />
<b>Undo=<i>undo sequence</i></b> which describes the undo buffer for the user-defined function/operator.
<b>Undo=<i>undo sequence</i></b> which describes the undo buffer for the user-defined function/operator/hyperator.
</li></ul>
</li></ul>



Latest revision as of 09:34, 19 March 2019

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), PR for the Printer, 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.
  • The [Options] section contains settings for User Preferences.
  • The [RangeLimits] section contains settings for whether or not selected System Vars are subject to Range Limiting.
  • The [ResetVars] section contains a list of certain System Vars and their settings which indicate when they are assigned an empty simple vector as to whether the substitution is the CLEAR WS value or the System Default value.
  • The [SameFontAs] section contains settings for which fonts are to be treated as a duplicate of another.
  • The [Colors] section contains settings of the Syntax Colors for various categories

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/hyperator is user-defined, and
      Undo=undo sequence which describes the undo buffer for the user-defined function/operator/hyperator.

    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
    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

    represent how some of the system variables might be stored.
  • 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.