Running Vision

Overview

Before you run Vision, a number of configuration options may need to be set to define your environment. If you have problems starting and executing the examples in this section, you should ask your Vision Administrator to check your configuration.

To connect to your Vision database, you run the batchvision program. Type:

  batchvision
This starts up Vision without a "front-end". You should see the prompt V> . At this point, you can enter a Vision request. A request can be any Vision program ranging from simple calculations to complex procedures. A request must be terminated by the characters ?g on a single line followed by a carriage return. For example:
  V> 2 + 2
  V> ?g
produces:
       4.00
  V> 
Vision requests can span multiple lines. Each time you enter a carriage return character, you will see another V> prompt. The ?g command is your indication to Vision that you are done entering your request. Vision will then execute your request and display any results. You will then see another V> prompt indicating that Vision is ready for another request.

To exit, type Ctrl-D or QUIT followed by a carriage return.


Interactive Vision Sessions

Although you can use the batchvision program interactively, there are no editing tools defined in this mode of operation other than those available via your operating's system command line shell. For interactive program development and execution, it is more useful to interact with Vision via an editor that communicates with the batchvision program.

Insyte provides a vt100-based editor for interacting with the batchvision program. That editor is designed to keep track of your entire session's interactions, enabling you to develop and test your programs incrementally. You can create new programs, recall earlier programs developed during this session, and load prestored programs from files into the Edit Window. The Output Window is used to display the results of running your Vision program.

You can also hook up many common editors such as emacs and vi to a batchvision session via the macro facilities available with these programs.

The vt100-based Editor

The vt100-based editor can be used in environments that house the Vision database on a Unix machine. It can be used to access Vision from Unix or Windows workstations. Your display should be simulating a vt100 style terminal and your TERM environment variable should be set to vt100.

To start Vision with this editor, log into the Unix environment and enter:

  vision
Once the editor is displayed, you can enter any Vision request. To submit the request, press the F2 function key. For example:
  2 + 2       # push the F2 key
You should see the output:
  Output:
       4.00
See the Vision vt100 Editor Summary for more information.


Batch Processing

The batchvision program can also be used to execute non-interactive programs. Requests can be submitted to batchvision by creating command files. A command file is simply a standard text file containing one or more Vision requests. Any number of requests can be included in a command file. Each request is terminated by the ?g command which instructs Vision to begin executing the request.

For example, assume the message displayWeeklyReports has been saved in the Vision database and you want to run this program. You could create the file testfile which contains the following lines:

  displayWeeklyReports
  ?g
To execute this command file, it can be used as standard input to the batchvision program as shown below:
  batchvision < testfile
The requests in a command file can access, create, and manipulate any Vision structures that have been saved in the database or defined in the command file.

The output from non-interactive program execution can be redirected to any device or output file and the execution can be started as a background process. Exact conventions will vary depending on your operating system and "shell". In Unix C-shell for example, the output of this command can be saved in the file testfile.out and the entire process executed in background using the following:

  batchvision < testfile >& testfile.out &


Object Spaces

Your Vision database contains the objects, data, and navigation rules needed to integrate, access, manipulate, and update information. The database consists of a network of interconnected Object Spaces that correspond to directories for storing the data, structures, and protocol associated with a particular portion of the database. Each Object Space consists of a set of Segments that correspond to the actual files that contain information. The object spaces and segments are all related and managed through a single network controller file known as the NDF (Network Directory File). These components of your Vision database are described in detail in the Vision Administration document.

Object spaces are numbered consecutively from 1. A Vision database is minimally configured to contain three object spaces. Space 1 contains kernel Vision structures. Space 2 is used to store the protocol for built-in classes such as Number, List, and TimeSeries . Space 3 is used to store core application classes and their messages. The information in these spaces is directly accessible to all Vision users.

Additional object spaces are created as needed to organize functional components of the Vision network that do not need to be fully visible to all users. New object spaces are assigned the next available number when created. You normally do not need to know which object space houses the specific information being requested, since messages encapsulate these navigations for you.

When a Vision session is started, a Top-Level Object Space can be specified explicitly. If no space is specified, a Temporary Work Space is created as your top-level environment. When you start Vision without any special options, you are accessing this temporary work space.

All Vision object spaces including the temporary work space automatically have access to the information stored in spaces 2 and 3. When a Vision expression is executed, Vision searches the user's top-level space first, followed by object space 3, then object space 2 to locate any top-level messages that have been sent. The message is resolved at the first place it is found. This message search path is illustrated below:

  top-level space  (temporary or explicit object space)
        |
        |
        V
  object space 3   (shared application core)
        |
        |
        V
  object space 2   (shared built-in core)

For example, the selector Company could be defined as a message in object space 3 that returns the default instance of the class Company. When the Vision expression:

  Company
is executed, the default company is returned. If you execute the expression:
  !Company <- 10 ;
the selector Company is temporarily created in your top-level space. When the expression:
  Company
is executed in this session, it will return the number 10, since Vision finds this definition first. To access the original, "shared" definition of Company, you would use the expression:
  super Company

To display all the messages defined in the top-level space, use:

  displayMessages
Note that if you started your session with an explicit object space number, this request displays all the messages that have been defined for that object space, in addition to any new messages that have been defined in this session.

To display all the messages that are defined in object space 3, use the expression:

  super displayMessages
and to display all the messages that are defined in object space 2, use the expression:
  super super displayMessages

The magic word ^global is used to access your top-level from within a Vision program. For example:

  object
  do: [ #---  misc messages to object
        ^global displayMessages;
      ] ;
displays all the messages defined for your top-level space, independent of the object with which you are working. The message CoreWorkspace will always return the top-level of object space 3 independent of your top-level starting point. For example:
  object
  do: [ #---  misc messages to object
        ^global CoreWorkspace displayMessages;
      ] ;
displays all the messages defined for the top-level of object space 3.

More information about resolving messages is available.


Startup Options

There are several command line options that can be used when you start the batchvision program. These options are described in detail in the document Vision Administration. Some of the frequently used options are described below.

To run Vision with a database other than the default database, you must specify the NDF of the database you wish to use. The -n option can be used to specify a different NDF. For example:

  batchvision -n /newvision/network/NDF
This opens up the database managed by the NDF located in the /newvision/network directory. Alternatively, you can set the NDFPathName environment variable to point to this NDF file. In Unix:
  setenv NDFPathName /newvision/network/NDF
  batchvision
is equivalent to starting Vision with the -n option.

To start Vision with a specific top-level space, you can use the -U# to specify the object space number to use as your global environment. For example:

  batchvision -U10
starts Vision with object space 10 as your global environment. Alternatively, you can set the UserOSI environment variable to point to this object space number. In Unix:
  setenv UserOSI 10
  batchvision
is equivalent to starting Vision with the -U10 option.

To run Vision with a startup expression, you can use the -x option to specify a startup string. Vision will execute this expression when your session begins. For example, if you always want Vision to create a new class named MyClass, you can start Vision using:

  batchvision -x 'Entity createSubclass: "MyClass"; '
Note that if your startup expression generates terminal output and you are using a Vision Editor, the output will not be displayed. This technique can be used to read and evaluate a file containing Vision code. For example, if the file include.v contains Vision code, the expression:
  batchvision -x ' "include.v" asFileContents evaluate; '
can be used to read and execute the Vision code in this file at startup. The environment variable VisionStartExpr can be used as an alternative to the -x option.


? Commands

In batchvision, text is collected into a buffer until you type a ? command on its own line. For example, the ?g command indicates that the current text buffer should be executed. When you are using one of the Vision Editors, you do not explicitly need to type this command.

The following ? commands are recognized by batchvision:

? Command Definition
?c Check syntax of current request
?e Toggle echoing of input - off by default
?f Flush any input since the last ?g command.
?g Execute any input since the last ?g command.
?l Rerun the last request.
?r[count] Run current request [count] times
?s Display request in progress.
?S Display last request executed with ?g command.
?t Display timing of last ?g command.
?? filename Read in the file filename. Note that this functionality has been replaced by the asFileContents evaluate expression, but is still used in some scripts.

Note that ? commands must appear on their own line. The first character in the line must be the ? .

Related Topics