image

Venue Medley for the Novice

image


Release 2.0

February, 1992


image


Address comments to:

Venue

User Documentation 1549 Industrial Road

San Carlos, CA 94070 415-508-9672

image

Medley for the Novice Release 2.0

February 1992

Copyright 1992 by Venue. All rights reserved.

Medley is a trademark of Venue.

Xerox is a registered trademark and InterPress is a trademark of Xerox Corporation.

UNIX is a registered trademark of UNIX System Laboratories. Post Script is a registered trademark of Adobe Systems Inc.

Copyright protection includes material generated from the

software programs displayed on the screen, such as icons, screen display looks, and the like.


image

The information in this document is subject to change without notice and should not be construed as a commitment by Venue. While every effort has been made to ensure the accuracy of this document, Venue assumes no responsibility for any errors that may appear.


Text was written and produced with Venue text formatting tools; Xerox printers were used to produce text masters. The typeface is Classic.

  1. BRIEF GLOSSARY

    image


    The following definitions will acquaint you with general terms used throughout this primer. You will probably want to read through them now, and use this chapter as a reference while you read through the rest of the primer.


    advising A Medley facility for specifying function modifications without necessarily knowing how a particular function works or even what it does. Even system functions can be changed with

    advising.

    argument A piece of information given to a Lisp function so that it can execute successfully. When a function is explained in the

    primer, the arguments that it requires will also be given. Arguments are also called Parameters.

    atom The smallest structure in Lisp; like a variable in other

    programming languages, but can also have a property list and a function definition.

    Background Menu The menu that appears when the mouse is not in any window and the right mouse button is pressed.

    binding The value of a variable. It could be either a local or a global variable. See unbound.

    bitmap A rectangular array of "pixels," each of which is on or off representing one point in the bitmap image.

    BREAK An Lisp function that causes a function to stop executing, open a Break window, and allows you to find out what is happening while the function is halted.

    Break Window A window that opens when an error is encountered while

    running your program (i.e., when your program has broken).

    There are tools to help you debug your program from this window. This is explained further in Chapter 14.

    browse To examine a data structure by use of a display that allows you to "move" around within the data structure.

    button (1) (n.) A key on a mouse.

    (2) (v.t.) To press one of the mouse keys when making a selection.

    CAR A function that returns the head or first element of a list. See

    CDR.

    caret The small blinking arrowhead that marks where text will appear when it is typed in from the keyboard.

    CDR A function that returns the tail (that is, everything but the first element) of a list. See CAR.


    CLlSP A mechanism for augmenting the standard Lisp syntax. One such augmentation included in Interlisp is the iterative

    statement. See Chapter 9. cr Press your Return key.

    datatype (1) The kind of a datum. In Interlisp, there are many system- defined datatypes, e.g., Floating-Point, Integer, Atom, etc.

    (2) A datatype can also be user-defined. In this case, it is like a record made up from system types and other user-defined datatypes.

    DWIM "Do-what-I-mean." Many errors made by Medley users could be corrected without any information about the purpose of the program or expression in question (e.g., misspellings, certain kinds of parenthesis errors). The DWIM facility is called

    automatically whenever an error occurs in the evaluation of an Interlisp expression. If DWIM is able to make a correction, the computation continues as though no error had occurred; otherwise, the standard error mechanism is invoked.

    error Occasionally, while a program is running, an error may occur which will stop the computation. Interlisp provides extensive facilities for detecting and handling error conditions, to

    enable the testing, debugging, and revising of imperfect programs.

    evaluate or EVAL To find the value of a form. For example, if the variable X is bound to 5, we get 5 by evaluating X. Evaluation of a Lisp function involves evaluating the arguments and then

    applying the function.

    Executive Window This is your main window, where you will run functions and

    develop your programs. This is the window that the caret is in when you turn on your machine and load Medley.

    file package A set of functions and conventions that facilitate the bookkeeping involved with working in a large system consisting of many source code files and their compiled counterparts. Essentially, the file package keeps track of

    where things are and what things have changed. It also keeps track of which files have been modified and need to be

    updated and recompiled.

    form Another way of saying s-expression. A Lisp expression that can be evaluated.

    function A piece of Lisp code that executes and returns a value. history The programmer’s assistant is built around a memory

    structure called the history list. The history functions (e.g.

    FIX, UNDO, REDO) are part of this assistant. These operations allow you to conveniently rework previously specified

    operations.

    History List As you type on the screen, you will notice a number followed by a slash, followed by another number. The first number is the exec number, the second is the event number. Each

    number, and the information on that line, is stored

    sequentially as the History List Using the History List, you


    can easily reexecute lines typed earlier in a work session. See Chapter 2.

    icon A pictorial representation, usually of a shrunken window.

    inspector An interactive display program for examining and changing the parts of a data structure. Medley has inspectors for lists and other data types.

    iterative statement (also called i.s.) A statement in Interlisp that repetitively

    executes a body of code For example, (for x from l to 5 do (PRlNT x)) is an i.s.

    iterative variable (also called i.v.) Usually, an iterative statement is controlled by the value that the i.v. takes on. In the iterative statement

    example above, x is the iterative variable because its value is being changed by each cycle through the loop. All iterative

    variables are local to the iterative statement where they are defined.

    Lisp Family of languages invented for "list processing." These languages have in common a set of basic primitives for

    creating and manipulating symbol structures. Interlisp-D is an implementation of the Lisp language together with an

    environment (set of tools) for programming, and a set of packages that extend the functionality of the system.

    list A collection of atoms and lists; a list is denoted by surrounding its contents with a pair of parentheses.

    Masterscope A program analysis tool. When told to analyze a program,

    Masterscope creates a database of information about the

    program. In particular, Masterscope knows which functions call other functions and which functions use which variables.

    Masterscope can then answer questions about the program and display the information with a browser.

    menu A way of graphically presenting you with a set of options.

    There are two kinds of menus: pop-up menus are created

    when needed and disappear after an item has been selected; permanent menus remain on the screen after use until

    deliberately closed.

    mouse The mouse is the box attached to your keyboard. It controls the movement of the cursor on your screen. As you become

    familiar with the mouse, you will find it much quicker to use the mouse than the keyboard.

    Mouse Cursor The small arrow on the screen that points to the northwest.

    Mouse Cursor Icons Four types of mouse cursor icons are shown below.

    image Wait. The processor is busy.

    image The Mouse Confirm Cursor. It appears when you have to confirm that the choice you just made was correct. If it was, press the left button. If the choice was not correct, press the right button to abort.


    image

    This means "sweep out" the shape of the window. To do this, move the mouse to a position where you want a corner. Press the left mouse button, and hold it down. Move the mouse

    diagonally to sketch a rectangle. When the rectangle is the desired size and shape, release the left button.


    image

    This is the "move window" prompt. Move the mouse so that the large "ghost" rectangle is in the position where you want the window. When you click the left mouse button, the

    window will appear at this new location.

    NIL NIL is the Lisp symbol for the empty list. It can also be represented by a left parenthesis followed by a right

    parenthesis ( ). It is the only expression in Lisp that is both an atom and a list.

    pixel Pixel stands for "picture element." The computer monitor

    screen is made up of a rectangular array of pixels. Each pixel corresponds to one bit. When a bit is turned on (i.e., set to 1), the pixel on the screen represented by this bit is black.

    pretty printing Pretty printing refers to the way Lisp functions are printed with special indentation, to make them easier to read.

    Functions are pretty printed in the structure editor, SEdit

    (see Chapter 7). You can pretty print uncompiled functions by calling the function PP with the function you would like to

    see as an argument, i.e. (PP function-name). For an example of this, see Figure 1.5.


    image

    Figure 1.5. Example of Pretty Printing Function PP


    Programmer’s

    Assistant The programmer’s assistant accesses the History List to allow you to FIX, UNDO, and/or REDO your previous expressions

    typed to the executive window (see Chapter 2).

    Prompt Window The narrow black window at the top of the screen. It displays system prompts, or prompts you have developed (see Figure 1.6).


    image

    Figure 1.6. Prompt Window

    property list A list of the form ( <property-namel> <property-value1>

    <property-name2> <property-value2> ....) associated with an atom. It accessed by the functions GETPROP and PUTPROP.

    record A record is a data structure that consists of named "fields".

    Accessing elements of a record can be separated from the details of how the data structure is actually stored. This

    eliminates many programming details. A record definition

    establishes a record template, describing the form of a record. A record instance is an actual record storing data according to a particular record template. (See datatype, second

    definition.)

    Right Button Default

    Window Menu This is the menu that appears when the mouse is in a

    window, and the right mouse button is pressed. It looks like the menu in Figure 1.7. If this menu does not appear when you press the right button of the mouse and the mouse is in

    the window, move the mouse so that it is pointing to the title bar of the window, and press the right button.


    image


    Figure 1.7. Right Button Default Window Menu


    s-expression Short for "symbolic expression". In Lisp, this refers to any well-formed collection of left parentheses, atoms, and right parentheses.


    stack A pushdown list. Whenever a function is entered, information about that specific function call is pushed onto (i.e., added to

    the front of) the stack. This information includes the variable names and their values associated with the function call.

    When the function is exitted, that data is popped off the stack.


    sysout A flle containing a whole Lisp environment: namely,

    everything you defined or loaded into the environment, the windows that appeared on the screen, the amount of memory

    used, and so on. Everything is stored in the sysout file exactly as it was when the function SYSOUT was called.


    TRACE A function that creates a trace of the execution of another

    function. Each time the traced function is called, it prints out the values of the arguments it was called with, and prints out the value it returns upon completion.


    unbound Without value; an atom is unbound if a value has never been assigned to it.


    window A rectangular area of the screen that acts as the main display area for some Lisp process,

    PREFACE

    image


    It was dawn and the local told him it was down the road a piece, left at the first fishing bridge in the country, right at the appletree stump, and onto the dirt road just before the hill. At midnight he knew he was lost. -Anonymous


    Welcome to the Medley Lisp Development Environment, a collection of powerful tools for assisting you in programming in Lisp, developing sophisticated user interfaces, and creating prototypes of your ideas in a quick and easy manner. Unfortunately, along

    with the power comes mind-numbing complexity. The Medley documentation set

    describes all the tools in detail, but it would be unreasonable for us to expect a new user to wade through all of it, so this primer is intended as an introduction, to give you a

    taste of some of the features.

    We developed this primer to provide a starting point for new Medley users, to enhance your excitement and challenge you with the potential before you. We’re going to make some assumptions about you. For starters, we’re going to assume that you’re sitting at a workstation that can run Medley. All of the examples in the book figure that you’re

    going to want to try things out. We’re also going to assume that you’ve had some exposure to Lisp, hopefully Common Lisp.

    Medley actually consists of two complete Lisp implementations, Common Lisp and InterLisp. All the screen I/O and some of the system functions are in InterLisp.

    However, thanks to the package system, you can call back and forth between the two languages by simply including a package delimiter in front of a symbol name. This sounds complicated, but it will become clearer once we do some examples.

    Throughout we make reference to the lnterlisp-D Reference Manual by section and page number. The material in the primer is just an introduction. When you need more depth, use the detailed treatment provided in the manual.

    While only you can plot your ultimate destination, you will flnd this primer

    indispensable for clearly defining and guiding you to the first landmarks on your way.


    Acknowledgements

    The early inspiration and model for this primer came from the Intelligent Tutoring

    Systems group and the Learning Research and Development Center at the University of Pittsburgh. We gratefully acknowledge their pioneering contribution to more effective

    artificial intelligence.

    This primer was originally developed by Computer Possibilities, a company committed to making Al technology available. Primary development and writing was done by

    Cynthia Cosic, with technical writing support provided by Sam Zordich. It has been re- done by Venue staff to reflect changes in the environment since the original publication.

    At Xerox Artificial Intelligence Systems, John Vittal managed and directed the project. Substantial assistance was provided by many members of the AlS staff who provided both editorial and systems support.



    image

    Medley for the Novice, Release 2.0

    vii

    PREFACE



    [This page intentionally left blank]



    image

    viii Medley for the Novice, Release 2.0

  2. TYPING SHORTCUTS

image


Once you have logged in to Medley, you are in Lisp. The functions you type into the

Executive Window will now execute, that is, perform the designated task. Lisp is case-

sensitive; it often matters whether text is typed in upper- or lowercase letters. Use the Shift-Lock key on your keyboard to ensure that everything typed is in capital letters.

You must type all Lisp functions in parentheses. The Lisp interpreter will read from the left parenthesis to the closing right parenthesis to determine both the function you want to execute and the arguments to that function. Executing this function is called

"evaluation." When the function is evaluated, it returns a value, which is then printed in the Executive Window. This entire process is called the read-eval-print loop, and is how most Lisp interpreters, including the one for Lisp, run.

The prompt in is a number followed by a left-pointing arrow (see Figure 2.3). This number is the function’s position on the History List—a list that stores your

interactions with the Lisp interpreter. Type the function (PLUS 3 4) , and notice the History List assigns to the function (the number immediately to the left of the arrow).

Lisp reads in the function and its arguments, evaluates the function, and then prints the number 7.


Programmer’s Assistant

In addition to this read-eval-print loop, there is also a "programmer’s assistant." It is the programmer’s assistant that prints the number as part of the prompt in the

executive window, and uses these numbers to reference the function calls typed after them.

When you issue commands to the programmer’s assistant, you will not use parentheses as you do with ordinary functiion calls. You simply type the command, and some

specification that indicates which item on the history list the command refers to. Some programmer’s assistant commands are FIX, REDO, and UNDO. They are explained in

detail below.

Programmer’s assistant commands are useful only at the Lisp top level, that is, when you are typing into the Executive Window. They do not work in user-defined functions.

As an example use of the programmer’s assistant, use REDO to redo your function call

(PLUS 3 4). Type REDO at the prompt (programmer’s assistant commands can be

typed in either upper- or lowercase) , then specify the previous expression in one of the following ways:

Figure 2-3 shows a few more examples of how to use the programmer’s assistant.


image


Figure 2-3. Some Applications of the Programmer’s Assistant


If You Make a Mistake

Editing in the Executive Window is explained in detail in Chapter 7. In the following section, only a few of the most useful commands are repeated.

To move the caret to a new place in the command being typed, point the mouse cursor at the appropriate position. Then press the left mouse button.


To move the caret back to the end of the command being typed, press Control-X (hold the Control key down, and type X).


To delete:

Character behind the caret Press the Backspace key

Word behind the caret Press Control-W (hold the Control key down and type

W)

Any part of the command Move the caret to the appropriate place in the

command. Hold the right mouse button down and move the the mouse cursor over the text. All of the

blackened text between the caret and mouse cursor is deleted when you release the right mouse button.

Entire command Press Control-U (hold the Control key down and type

U)

Deletions can be undone. J ust press the UNDO key.

To add more text to the line, move the carent to the appropriate position and start to type. Whatever you type will appear at the caret.



[This page intentionally left blank]

image

TABLE of CONTENTS

Preface vii

  1. Brief Glossary 1-1

  2. Typing Shortcuts

    Programmer’s Assistant 2-1

    If You Make a Mistake 2-2

  3. Using Menus

    Making a Selection from a Menu 3-1

    Explanations of Menu Items 3-2

    Submenus 3-2

    Summary 3-3

  4. How to Use Files

    Types of Files 4-1

    Directories 4-1

    Directory Options 4-2

    Subdirectories 4-2

    To See What Files Are Loaded 4-3

    Simple Commands for Manipulating Files 4-3

    Connecting to a Directory 4-3

    File Version Numbers 4-4

  5. FileBrowser

    Calling the FileBrowser 5-1

    FileBrowser Commands 5-3

  6. Those Wondertul Windows!

    Windows Provided by Medley 6-1

    Creating a Window 6-2

    Right Button Default Window Menu 6-2

    Explanation of Each Menu Item 6-3

    Scrollable Windows 6-4

    Other Window Functions 6-5

    PROMPTPRlNT 6-5

    WHlCHW 6-6

  7. Editing and Saving

    Defining Functions 7-1

    Simple Editing in the Executive Window 7-2

    Using the List Structure Editor 7-3

    Commenting Functions 7-4

    File Functions and Variables: How to See and Save Them 7-5

    File Variables 7-5

    Saving Interlisp-D on Files 7-5

  8. Your Init File

    Using the USERGREETFILES Variable 8-1

    Making an Init File 8-1

  9. Medley Forgiveness: DWIM 9-1

  10. Break Package

    Break Windows 10-1

    Break Package Examples 10-1

    Ways to Stop Execution from the Keyboard (Breaking Lisp) 10-3

    Break Menu 10-3

    Returning to Top Level 10-4

  11. WhatTo Do lf 11-1

  12. Window and Regions

    Windows 12-1

    CREATEW 12-1

    WlNDOWPROP 12-2

    Getting Windows to Do Things 12-3

    BUTTONEVENTFN 12-5

    Looking at a Window’s Properties 12-5

    Regions 12-5

  13. What Are Menus?

    Displaying Menus 13-1

    Getting Menus to Do Stuff 13-2

    WHENHELDFN and WHENSELECTEDFN Fields of a Menu 13-3

    Looking at a Menu’s Fields 13-5

  14. Bitmaps 14-1

  15. Displaystreams

    Drawing on a Displaystream 15-1

    DRAWUNE 15-1

    DRAWTO 15-2

    DRAWCIRCLE 15-3

    FILLCIRCLE 15-1

    Locating and Changing Your Position in a Displaystream 15-4

    DSPXP0SITION 15-5

    DSPYPOSlTION 15-5

    MOVETO 15-5

  16. Fonts

    What Makes Up a Font 16-1

    Fontdescriptors and FONTCREATE 16-2

    Display Fonts 16-3

    InterPress Fonts 16-3

    Functions for Using Fonts 16-4

    FONTPROP - Looking at Font Properties 16-4

    STRINGWlDTH 16-5

    DSPFONT- Changing the Font in One Window 16-5

    Personalizing Your Font Profile 16-6

  17. The Inspector

    Calling the Inspector 17-1

    Using the Inspector 17-2

    Inspector Example 17-2

  18. Masterscope

    SHOW DATA Command and GRAPHER 18-2

  19. Where Does All the Time Go? SPY

    How to Use Spy with the SPY Window 19-1

    How to Use SPY from the Lisp Top Level 19-2

    Interpreting SPY’s Results 19-2

  20. Free Menus

    Free Menu Example 20-1

    Parts of a Free Menu Item 20-2

    Types of Free Menu Items 20-3

  21. The Grapher

    Say it with Graphs 21-1

    Add a Node 21-2

    Add a Link 21-2

    Delete a Link 21-2

    Delete a Node 21-2

    Move a Node 21-2

    Making a Graph from a List 21-2

    Incorporating Grapher into Your Program 21-2

    More of Grapher 21-2

  22. Resource Management

    Naming Variables and Records 22-1

    Some Space and Time Considerations 22-2

    Global Variables 22-3

    Circular Lists 22-3

    When You Run Out of Space 22-4

  23. Simple Interactions with the Cursor, a Bitmap, and a Window

    GETMOUSESTATE Example Function 23-1

    Advising GETMOUSESTATE 23-2

    Changing the Cursor 23-2

    Functions for Tracing the Cursor 23-3

    Running the Functions 23-6

  24. Glossary of Global System Variables

    Directories 24-1

    Flags 24-2

    History Lists 24-3

    System Menus 24-3

    Windows 24-4

    Miscellaneous 24-4

  25. Other Useful References 25.1

Index.............................................................................................................................................. INDEX-1


[This page intentionally left blank]

  1. USING MENUS

    image


    The purpose of this chapter is to show you how to use menus. Many things can be done more easily using menus, and there are many different menus provided in the Medley

    environment. Some are "pop-up" menus that are only available until a selection is made, then disappear until they are needed again. An example of one of these is the Background Menu that appears when the mouse is not in any window and the right

    mouse button is pressed. A background menu is shown in Figure 3-1. Your background menu may have different items on it.


    image

    Figure 3-1. Background Menu

    Another common pop-up menu is the right button default window menu. This menu is explained more in Chapter 6.

    Other menus are more permanent, such as the menu that is always available for use with the Filebrowser. This menu is shown in Figure 3-2., and the specifics of its use with the filebrowser are explained in Chapter 5.


    image

    Figure 3-2. Filebrowser Menu


    Making a Selection from a Menu

    To make a selection from a menu, point with the mouse to the item you would like to select. If one of the mouse buttons is already pressed, the menu item should be

    highlighted in reverse video. If it is a permanent menu, you must press the left mouse button to highlight the item. When you release the button,m the item will be selected. Figure 3-3 shows a menu with the item "Undo" chosen.


    image

    Figure 3-3. Menu with the Item "Undo" Chosen


    Explanation of Menu Items

    Many menu items have explanations associated with the. If you are not sure what the consequences of choosing a particular menu iem will be, highlight the menu item but do not releast the left mouse button. If the menu item has an explanation associated with it, the explanation will be printed in the prompt window. Figure 3-4 shows the

    explanation associated with the item "Snap" from the background menu.


    image


    image


    Figure 3-4. Explanation Associated with Selected Menu Item


    Submenus

    Some menu items have submenus associated with them. This means that, for these items, you can make even more precise choices if you would like to.

    A submenu can also be foun d as described below.

    As shown in Figure 3-5, a submenu can be indicated by a gray arrow to the right of the menu item. To see the submenu, highlight the menu item and move the mose to the

    right to follow the arrow. Choosing an item from a submenu is done the same way you make a choice from the menu. Any submenus that might be associated with the items in the submenu are indicated in the same way as the submenus associated with the

    items in the menu.

    3. USING MENUS

    image


    image


    Figure 3-5. Edit Submenu Displayed with Right Arrow


    Summary

    In summary, here are a few rules of thumb to remember about the interactions of the mouse and system menus:

  2. HOW TO USE FILES

    image


    Types of Files

    A program file, or Lisp file, contains a series of expressions that can be read and

    evaluated by the Lisp interpreter. These expressions can include function or macro

    definitions, variables and their values, properties of variables, and so on. How to save Interlisp-D expressions on these files is explained in Chapter 7. Loading a file is

    explained in the Simple Commands for Manipulating Files section below.

    Not all files, however, have Lisp expressions stored on them. For example, TEdit files store text; sketches are stored on files made with the package Sketch , or can be

    incorporated into TEdit files. These files are not loaded directly into the environment, but are accessed with the package used to create them, such as TEdit or Sketch.

    When you name a file, there are conventions that you should follow. These conventions allow you to tell the type of file by the extension to its name.

    If a file contains: Then:

    Lisp expressions It should not have an extension or have the extension

    .LISP. For example, a file called MYCODE should contain Lisp expressions.

    Compiled Code It should have the extension .LCOM or .DFASL. For

    example, a file called MYCODE.DFASL should contain compiled code.

    A Sketch Its extension should be .SKETCH. For example, a file called MOUNTAINS.SKETCH should contain a Sketch.

    Text It should have the extension .TEDIT. For example, a file called REPORT.TEDIT should contain text that can be edited with the editor TEDIT.


    Directories

    This section focu ses on how you can find files, and how you can easily manipulate files. To see all the files listed on a device, use the function DIR. For example, to see what files are stored in your current directory, type:

    (DIR *.*)

    Partial directory listings can be gotten by specifying a file name, rather than just a

    device name. The wildcard character * can be used to match any number of unknown characters. For example, the command (DIR T*) will list the names of all files that begin with the letter T. An example using the wildcard is shown in Figure 4-1.


    image


    Figure 4-1. Using DIR with a Wildcard


    Directory Options

    Various words can appear as extra arguments to the DIR command. these words give you extra information about the files.

    SIZE displays the size of each file in the directory. For example, type:

    (DIR {DSK} SIZE)

    DATE displays the creation date of each file in the directory. An example of this is shown in Figure 4-2.


    image

    Figure 4-2. Example Using DATE DEL deletes all the files foun d by the directory command.


    Subdirectories

    Sudirectories are very helpful for organizing files. A set of files that have a single

    purpose (for example, all the external documentation files for a system) can be grouped together into a subdirectory.

    To associate a subdirectory with a filename, simply include the desired subdirectory as part of the name of the file. Subdirectories are specified after the device name and

    before the simple filename. The first subdirectory should be between less-than and

    greater-than signs (angle brackets) < >, with nested subdirectory names only followed by a greater than sign >. For example:

    {DSK}<Directory>SubDirectory>SubSubDirectory>...>filename

    or use the UNIX convention:

    {DSK}/Directory/Subdirectory/Subsubdirectory/filename


    To See What Files Are Loaded

    If you type FILELST<CR>, the names of all the files you loaded will be displayed. Type SYSFILES<CR> to see what files are loaded to create the sysout.


    Simple Commands for Manipulating Files

    When using these functions, always be sure to specify the full filename, including subfile directories if appropriate.

    To have the conents of a file displayed in a window:

    (SEE ’filename)

    To copy a file (see Figure 4-3):

    (COPYFILE ’oldfilename newfilename)


    image

    Figure 4-3. Example Use of COPYFILE

    To delete a file (see Figure 4-4):

    (DELFILE ’filename)


    image

    Figure 4-4. Example Use of DELFILE

    To rename a file:

    (RENAMEFILE ’oldfilename newfilename)

    Files that contain Lisp expressions can be loaded into the environment. That means that the information on them is read, evaluated, and incorporated into the Medley

    environment. To load a file, type:

    (LOAD ’filename)


    Connecting to a Directory

    Often, each person or project has a subdirectory where files are stored. If this is your situation, you will want any files you create to be put into this directory automatically. This means you should "connect" to the directory.


    CONN is the Medley command that connects you to a directory. For example, CONN in Figure 4-5 connects you to the subsubdirectory IM, in the subdirectory PRIMER , the directory LISPFILES, on the device DSK. This information—the device and the

    directory names down to the subdirectory to which you want to be connected—is called the "path" to that subdirectory. CONN expects the path to a directory as an argument.


    image


    Figure 4-5. CONNecting to Subdirectory Primer Subsubdirectory IM

    Once you are connected to a directory, the command DIR will assume you want to see the files in that directory, or any of its subdirectories.

    Other commands that require a filename as an argument (e.g., SEE, above) will assume that the file is in the connecteds directory if there is no path specified with the filename. This will often save you typing.


    File Version Numbers

    When stored, each filename is fillowed by a semicolon and a number, as shown in this example:

    MYFILE.TEDIT;1

    The number is the version number of the file. This is the system’s way of protecting your files from being overwritten. Each time the file is written, a new file is created with a version number one greater than the last. This new file will have everything from your previous file, plus all of your changes.

    In most cases, you can exclude the version number when referencing the file. When the version is not specified, and there is more than one version of the file on that particular directory, the system generally uses your most recent version. An exception is the

    function DELFILE, which deletes the oldest version (the one with the lowest version number) if none is specified.



    [This page intentionally left blank]

  3. FILEBROWSER

image


The FileBrowser is a Lisp Library Package that works with files stored on disk and floppy devices, and can be used as a file directory editor. If it is not loaded into your sysout, you need to load it first by typing:

(LOAD ’FILEBROWSER.LCOM)


Calling the FileBrowser


Calling the FileBrowser with the directory calls up the files stored in that directory:

(FB ’<usr>local>lde>)


Another way to call a FileBrowser is to choose "FileBrowser" from the background

menu. You will be prompted for a description of the files to be included (see Figure 5-1). Type an asterisk (*), then press Return to see all the files in the connected directory.


image


Figure 5-1. Prompt for Files to Include in FileBrowser


These show a directory of the device in a window you can leave on the screen at all times. The parts of the FileBrowser window are shown below.



image

Prompt Window

Command Menu

File List

Figure 5-2. Parts of a FileBrowser Window Now you do not need to continually type the directory command.

To use the FileBrowser, choose a file by pointing to the file with the mouse and pressing the left or middle mouse button. A small dark arrow appears to the left of the file

name. Choose a command from the menu at the right. In Figure 5-3, the files

OCH1.TEDIT;1, OCH10.TEDIT;1, and OCH11.TEDIT;1 have been selected.


The left mouse button only allows you to choose one file at a time. Even if you choose other files, only the last file you selected with the left mouse button will remain

marked as chosen. When you use the middle mouse button to select a file, the file is added to those already chosen.


To unpick an already chosen file, hold the Control key down while pressing the middle mouse button.


image


Figure 5-3. Files Chosen

  1. FILEBROWSER

    image


    The next section contains a summary of the FileBrowser commands.


    FileBrowser Commands


    Delete In the FileBrowser, this command marks a file, or files, for deletion (see Figure 5-4). These files are marked by a black line crossing through

    them. You may select and mark any number of files for deletion. Delete does not actually remove these files from the device. The Expunge command actually wipes out the files previously marked for deletion.


    image


    Figure 5-4. Files Marked for Deletion


    Undelete Undoes the delete command for one or more files. Undelete erases the black line through a file marked for deletion.

    Copy This command copies the chosen file. The destination filename should

    be typed at a prompt that appears in the window above the FileBrowser.

    Wildcards do not work for this prompt. You must type the whole

    unquoted filename. If more than one file is chosen to be copied, you will be prompted for a directory name. The files will be copied into the

    directory you give, but with the same filenames as the ones they have in their original location.


    Rename This command works much like the Copy command, but does not leave the original file. The chosen file will be renamed to the destination

    filename. You will be prompted, in the prompt window, for the

    destination filename. Give the complete unquoted filename. If more

    than one file is chose to be renamed, you will be prompted for a directory name. The files will be moved into the directory you give.


    Hardcopy If you do not have a hardcopy device, using this command causes an error. Otherwise, it gives a hardcopy of the file.

    See Shows you a file in a window. To use this command, choose a single filename, then the See command. You are prompted for a window.

    Each time the See command is chosen, a new window is opened to display the file.

    Edit Calls the editor with the file as input. If the file is an executable one (i.e., Lisp code as opposed to a documentation file), only the FILECOMS list is edited. The FILECOMS list is the list of variables, lists, and


    functions that are contained on that file. FileBrowser loads it and then allows you to edit the FILECOMS .

    Load Choose a file with the left mouse button, or a group of files with the

    middle mouse button. Once the filenames have been blackened, choose the Load command to load them all into Medley.


    Compile This command calls the file compiler with the chosen filename(s) as arguments. The compiler compiles a file foun d on a storage device

    ({DSK}), not the functions defined in the Medley image. If any functions on a loaded file have been changed, run the function (MAKEFILE ’filename) to write the current version before compiling it. Files do not have to be loaded to use the Compile command.

    Expunge This command completely deletes all the marked files from the

    directory. This allows you to remove unwanted files from your storage device.


    Recompute Choose this command when you know that the directory has been

    changed and should be reread (e.g., after creating new versions of a file).

  2. THOSE WONDERFUL WINDOWS!

    image


    A window is a designated area on the screen. Every rectangular box on the screen is a window. While Medley supplies many of the windows (such as the Executive Window), you may also create your own. Among other things, you will type, draw pictures, and

    save portions of your screen with windows.


    Windows Provided by Medley


    Two important windows are available as soon as you enter the Medley environment.

    One is the Executive Window, the main window where you will run your functions. It is the window that the caret is in when you turn on your machine, and load Medley. It is

    shown in Figure 6-1.

    image


    Figure 6-1. Medley Executive Window


    The other window that is open when you enter Medley is the "Prompt Window". It is the long thin black window at the top of the screen. It displays system prompts, or prompts you have associated with your programs. (See Figure 6-2.)

    image


    Figure 6-2. Prompt Window


    Other programs, such as the editors, also use windows. These windows appear when

    the program starts to run, and close (no longer appear on the screen) when the program is done running.


    Creating a Window


    To create a new window, type: (CREATEW). The mouse cursor will change, and have a small square attached to it. (See Figure 6-3.)



    image


    Figure 6-3. Mouse Cursor Asking You to Sweep Out Window


    There may be a prompt in the prompt window to create a window. Press and hold the left mouse button. Move the mouse around, and notice that it sweeps out a rectangle. When the rectangle is the size that you’d like your window to be, release the left mouse button. More specific information about the creation of windows, such as giving them

    titles and specifying their size and position on the screen when they are created, is given in the WINDOWPROP section of Chapter 12.


    Right Button Default Window Menu

    Position the cursor inside the window you just created, and press and hold the right mouse button. A menu of commands should appear (do not release the right button!), like the one in Figure 6-4. To execute one of the commands on this menu, choose the item. Making a choice from a menu is explained in Chapter 3.



    image


    Figure 6-4 Right Button Default Window Menu


    As an example, select "Move" from this menu. The mouse cursor will become a ghost window (ju st an outline of a window, the same size as the one you are moving), with a square attached to one corner, like the one shown in Figure 6-5.


    image


    Figure 6-5 Mouse Cursor for Moving a Window


    Move the mouse around. The ghost window will follow. Click the left mouse button to place tho window in a new location.


    Choose "Shape", and notice that you are prompted to sweep out another window. Your original window will have the shape of the window you sketch out.


    Explanation of Each Menu Item

    The meaning of each right button default window menu item is explained below:


    Close Removes the window from the screen

    Snap Copies a portion of the screen into a new window Paint Allows drawing in a window

    Clear Clears the window by erasing everything within the window boundaries Bury Puts the window beneath all other windows that overlap it

    Redisplay Redisplays the window contents

    Hardcopy Sends the contents of the window to a printer or to a flle Move Allows the wi ndow to be moved to a new spot on the screen Shape Repositions and/or reshapes the window

    Shrink Reduces the window to a small black rectangle called an icon, or, if appropriate, to the shape for that window type (see Figure 6-6).

    image


    Figure 6-6 Example Icon


    Expand Changes an icon back to its original window. Position the mouse cursor on the icon, depress the right button, and select Expand. Or, just button the icon with the middle mouse button.


    These right-button default window menu selections are available in most windows, including the Executive Window. When the right button has other functions in a

    window (as in an editor window), the right button default window menu should be accessible by pressing the Right button in the black border at the top of the window.


    Scrollable Windows


    Some windows in Medley are "scrollable". This means that you can move the contents of the window up and down, or side to side, to see anything that doesn’t fit in the

    window.


    Point the mouse cursor to the left or bottom border of a window. If the window is scrollable, a "scroll bar" will appear. The mouse cursor will change to a double headed arrow. (See Figure 6-7.)


    image


    Figure 6-7. Scroll Bar of Scrollable Window


    The scroll bar represents the full contents of the window. The example scroll bar is completely white because the window has nothing in it When a part of the scroll bar is shaded, the amount shaded represents the amount of the window’s contents currently

    shown. If everything is showing, the scroll bar will be fully shaded. (See Figure 6-8.)

    The position of the shading is also important. It represents the relationship of the

    section currently diplayed to the the full contents of the window. For example, if the shaded section is at the bottom of the scroll bar, you are looking at the end of the file.


    image


    Figure 6-8 Top of File When Shading at Top of Scroll Bar


    When the scroll bar is visible, you can control the section of the window’s contents displayed:


  3. EDITING AND SAVING

    image


    This chapter explains how to define functions, how to edit them, and how to save your work.


    Defining Functions


    DEFUN can be used to define new functions. The syntax for it is:

    (DEFUN (<functionname> (<parameter-list><body-of-function>))

    New functions can be created with DEFUN by typing directly into the Executive Window. Once defined, a function is a part of the Medley environment. For example, the function EXAMPLE-ADDER is defined in Figure 7-1.


    image


    Figure 7-1. Defining the Function EXAMPLE-ADDER


    Now that the function is defined, it can be called from the Executive Window:


    image


    Figure 7-2.. After EXAMPLE-ADDER is defined, it can he executed The function returns 6, after printing out the message.

    Functions can also be defined using the editor DEdit described above. To do this, simply type

    (ED function-name ’FUNCTIONS)

    You will be told that no definition exists for the function, and a menu will pop up asking you what type of function you would like to create:


    image


    Figure 7-3 Selecting a Function Template

    Selecting the appropriate type will pop up an editor window with a function template. The use of the editor is explained in the Using the List Structure Editor section below.


    Simple Editing in the Executive Window

    First, type in an example function to edit:


    3/41> (defun your-first-function (a b) (if (> a b)

    ’(the first is greater) ’(the second is greater)))

    To run the function, type:

    3/42> (YOUR-FIRST-FUNCTION 3 5) (THE SECOND IS GREATER)

    Now, let’s alter this. Type:

    3/43> FIX 41

    Note that your original function is redisplayed, and ready to edit. (See Figure 7-4.)


    image


    Figure 7-4. Using FIX to Edit a Fundion


    Move the text cursor to the appropriate place in the function by positioning the mouse cursor and pressing the left mouse button.

    Delete text by moving the caret to the beginning of the section to be deleted. Hold the right mouse button down and move the mouse cursor over the text. All of the

    highlighted text between the caret and mouse cursor is deleted when you release the right mouse button.

    If you make a mistake, deletions can be undone. Press the UNDO key on the keypad to the left of the keyboard.

    Now change GREATER to BIGGER:


    1. Position the mouse cursor on the G of GREATER , and click the left mouse button. The text cursor is now where the mouse cursor is.

    2. Next, press the right mouse button and hold it down. Notice that if you move the mouse cursor around, it will blacken the characters from the text cursor to the mouse cursor. Move the mouse so that the word "GREATER " is highlighted.

    3. Release the right mouse button and GREATER is deleted.

    4. Without moving the cursor, type in BIGGER .

    5. There are two ways to end the editing session and run the function. One is to type Control-X. (Hold the Control key down, and type X.) Another is to move the text

      cursor to the end of the line and crø In both cases, the function has been edited!

      Try the new version of the function by typing:

      3/48> (YOUR-FIRST-FUNCTION 8 9) (THE SECOND IS BIGGER)

      and get the new result, or you can type:

      3/49> REDO 42

      (THE SECOND IS BIGGER)


      Using the List Structure Editor


      If the function you want to edit is not readily available (i.e. the function is not in the

      Executive Window, and you can’t remember the history list number, or you simply have a lot of editing), use the List Structure Editor, often called SEdit. This editor is evoked with a call to ED:

      81(ED ’YOUR-FIRST-FUNCTION ’FUNCTIONS)


      Your function will be displayed in an edit window, as in Figure 7-5.

      If there is no edit window on the screen, you will be prompted to create a window. As

      before, hold the leff mouse button down, move the mouse until it form s a rectangle of an acceptable size and shape, then release the button. Your function definition will

      automatically appear in this edit window.



      image


      Figure 7-5. An Edit Window


      Many changes are easily done with the structure editor. Notice that by pressing the left mouse button you can place the caret in position, and by pressing the middle mouse

      button you can select atoms or s-expressions. Repeated pressing of the middle button selects bigger pieces of text.


      To add an expression that does not appear in the edit window (i.e., it cannot simply be underlined), place the caret at the insertion point and type it in.. For example, to

      replace the first GREATER with LARGER, place the caret to the left of GREATER , as shown in Figure 7-6.


      image


      Figure 7-6. Caret Placement Prior to Changing GREATER with LARGER

      Now press the DELETE key seven times, and type in LARGER . The window now looks like this:


      image

      Figure 7-7. GREATER Changed to LARGER

      Notice the asterisk in the left edge of the title bar of the window. This designates that the function has be changed. Now exit the edit session by typing Control-X, and the function will be redifined.


      Commenting Functions


      Text can be marked as a comment by typing a semi-colon before the text of the comment.

      ; This is the form of a comment

      Inside an editor window, the comment will be printed in a different font and may be moved to the far right of the code. SEdit is familiar with the Common Lisp convention of single comments being on the far right, double comments being justified with the

      function level, and triple comments being on the far left, as is shown in Figure 7-8.


      image


      Figure 7-8. Placement of Comments

      There are other editor commands which can be very useful. To learn about them, read Appendix B of the Release Notes.


      File Functions and Variables: How to See and Save Them

      With Medley, all work is done inside the Lisp environment. There is no operating system or command level other than the Executive Window. All functions and data

      structures are defined and edited using normal Lisp commands. This sertion describes tools in the Medley environment that will keep track of any changes that you make in the environment that you have not yet saved on files, such as defining new functions,

      changing the values of variables, or adding new variables. And it then has you save the changes in a file you specify. All of these functions are in the INTERLISP (IL:) package.


      File Variables


      Certain system-defined global variables are used by the file package to keep track of the environment as it stands. You can get system information by checking the values of

      these variables. Two important variables follow.

      • FILELST evaluates to a list, all files that yoU have loaded into the Medley environment.

      • filenameCOMS (Each file loaded into the Lisp environment has associated with it a global variable, whose name is formed by appending COMS to the end of the filename.) This variable evaluates to a list of all the functions, variables, bitmaps, windows, and soon, that are stored on that particular file.

      For example, if you type:

      MYFILECOMS

      the system will respond with something like:

      ((FNS YOUR-FIRST-FUNCTION ) VARS))


      Saving Interlisp-D on Files

      The functions (FILES?) and (MAKEFILE filename) are useful when it is time to save function, variables, windows, bitmaps, records and whatever else to files.

      (FILES?) displays a list of variables that have values and are not already a part of any file, and then the functions that are not already part of any file.

      Type:

      (FILES?)

      the system will respond with something like:

      the variables: MY.VARIABLE CURRENT.TURTLE...to be dumped


      the functions: RIGHT LEFT FORWARD BACKWARD CLEAR-SCREEN...to be dumped

      want to say where the above go?


      If you type Y, the system will prompt with each item. There are three options:

      1. To save the item, type the filename (unquoted) of the file where the item should be placed. (This can be a brand new file or an existing file.)

      2. To skip the item, without removing it from consideration the next

        time (FILES?) is called, type crø This will allow you to postpone the decision about where to save the item.

      3. If the item should not be saved at all, type ]. Nowhere will appear after the item.

        Part of an example interaction is shown in the following figure:



        image

        Figure 7-9. Part of an interaction using the function FILES?

        (FILES?) assembles the items by adding them to the appropriate file’s

        COMS variable (see the File Variables section above). (FILES?) does NOT write the file to secondary storage (disks or floppies). It only

        upclates the global variables discussed in the File Variables section above.


        (MAKEFILE ’filename)

        actually writes the file to secondary storage. Type:

        (MAKEFILE ’MY.FILE.NAME)

        and the system will create the file. The function returns the full name of the file created. (i.e. {DSK}MY.FlLE.NAME.; 1 ).


        Files written to (DSK) are permanent files. They can be removed only by the user deleting them or by reformatting the disk.


        Other file manipulation functions can be foun d in Chapter 4.

  4. YOUR INIT FILE

    image


    Lisp has a number of global variables that control the environment. Global variables make it easy to customize the environment to fit your needs. One way to do this is to

    develop an INIT file. This is a file that is loaded when you start an image. You can use it to set variables, load files, define functions, and any other things that you want to do to make the Medley environment suit you.


    Using the USERGREETFILES Variable


    As described in File Variables section of Chapter 11, each program file has a global Your INIT file could be called INIT, INIT.LISP, INIT.USER, or whatever the

    convention is at your site. There is no default name preferred by the system, it just

    looks for the files listed in the variable USERGREETFILES (see below). Check to see what the preference is at your site. Put this file in your directory. Your directory name should be the same as your login name. The INIT file is loaded by the function GREET. GREET is normally run when Medley is started. If this is not the case at your site, or you want

    to use the machine and Medley has already been started, you can run the function

    GREET yourself. If your user name was, for example, TURING , then you would type:

    (GREET ’TURING)

    This does a number of things, including undoing any previous greeting operation,

    loading the site init file, and loading your init file. Where GREET looks for your INIT file depends on the value of the variable USERGREETFILES. The value of this variable is set when the system’s SYSOUT file is made, so check its value at your site! For example, its value could be:


    image

    Figure 8-1. Possible Value of USERGREETFILES

    In each place you see >USER>, the argument passed to GREET is substituted into the path. This is your login name if you are just starting Medley. For example, the first value in the list would have the system check to see whether there was a

    {DSK}<LISPFlLES>TURING>INIT.LISP file. No error is generated if you do not have an INIT file, and none of the files in USERGREETFILES are foun d.


    Making an Init File


    As described in File Variables section of Chapter 11, each program file has a global

    variable associated with it, whose name is formed by appending COMS to the end of the root filename. For any of the standard INIT file names, the variable INITCOMS is used. To set up an init file, begin by editing this variable. Type:

    (DV INITCOMS)

    8. YOUR INIT FILE


    An SEdit window wiil appear. This window is the same as the one called with the

    function DF, and described in the Using the List Structure Editor section in Chapter 7. This chapter assumes that you know how to use the SEdit structure editor .

    The COMS variable is a list of lists. The first atom in each internal list specifies for the file package what types of items are in the list, and what it is to do with them. This

    section will deal with three types of lists: VARS, FILES, and P. Please read about others in Chapter 17 of the IRM.

    Notice that inside the vars list, there is yet another list. The first item in the list is the name of the variable. It is bound to the value of the second item. There are many other variables that you can set by adding them to the VARS list. Some of these variables are described in Chapter 24, and many others can be foun d in the IRM.

    If you want to automatically load files, that can be done in your init file also. For

    example, if you always want to load tho Library file SPY.LCOM , you can load it by editing tho INITCOMS variable to list the appropriate file in the list starting with FILES:

    .

    .

    .

    (FILES SPY)

    .

    .

    .

    Figure 8-2. INITCOMS Changed to Load SPY.LCOM File

    Other files can also be added by simply adding their names to this FILES list.

    Another list that can appear in a COMS list begins with P. This list contains Lisp

    expressions that are evaluated when the file is loaded. Do not put DEFINEQ expressions in this list. Define the function in the environment, and then save it on the file in the

    usual way (see Chapter 7).

    One type of expression you might want to see here, however, is a FONTCREATE function (see Chapter 16). For example, of you want to use a Helvetica 12 BOLD font, and there is not a font descriptor for it normally in your environment, the appropriate call to FONTCREATE should be in the "P" list. The INITCOMS would look like this:

    .

    .

    .

    (FILES SPY)

    (P (FONTCREATE ’HELVETICA 12 ’BOLD))

    .

    .

    .


    Figure 8-3. INITCOMS Edited to Include a call to FONTCREATE

    To quit, exit from SEdit in the usual way. When you run the function MAKEFILES (see Chapter 7), be sure that you are connected to the directory (see Chapter 4) where the INIT file should appear. Now when GREET is run, your Init file will be loaded.



    image

    8-2 Medley for the Novice, Release 2.0

  5. MEDLEY FORGIVENESS: DWIM

    image


    DWIM (Do What I Mean) is an Interlisp utility that makes life easier.


    DWIM tries to match unrecognized variable and function names to known ones. This allows Lisp to interpret minor typing errors or misspellings in a function, without

    causing a break. Line 152 of Figure 9-1 illustrates how the misspelled BANNANNA was replaced by BANANA before the expression was evaluated.



    image


    Figure 9-1. Examples of DWIM Features


    Sometimes DWIM may alter an expression you didn’t want it to. This may occur if, for

    example, a hyphenated function name (e.g., (MY-FUNCTION) ) is misused. If the system does not recognize the function name, it may think you are trying to subtract "FUNCTION" from "MY". DWIM also takes the liberty of updating the function, so it will

    have to be fixed. However, this is as much a blessing as a curse, since it points out the misused expression!

  6. BREAKPACKAGE

image


The Break Package is a part of Interlisp that makes debugging your programs much easier.


Break Windows

A break is a function either called by the programmer or by the system when an error has occurred. A separate window opens for each break. This window works much like the Executive Window, except for extra menus unique to a break window. Inside a

break window, you can examine variables, look at the call stack at the time of the

break, or call the editor. Each successive break opens a new window, where you can execute functions without disturbing the original system stack. These windows

disappear when you resolve the break and return to a higher level.


Break Package Example


This example illustrates the basic break package functions. A more complete explanation of the breaking functions, and the break package will follow.


The correct definition of FACTORIAL is:

(defun factorial (x) (if (zerop x)

1

(* x (factorial (1- x)))))


To demonstrate the break package, we have edited in an error: DUMMY in the IF statement is an unbound atom, it lacks a value.

((defun factorial (x) (if (zerop x)

dummy

(* x (factorial (1- x)))))

The evaluated function


(FACTORIAL 4)

should return 24, but the above function has an error. DUMMY is an unbound atom, an atom without an assigned value, so Lisp will "break". A break window appears (Figure 10-1), that has all the functionality of the typing lisp expressions into the Executive

Window (The top level), in addition to the break menu functions. Each consecutive break will move to another level "down".


image


Figure 10-1. Break Window


Move the mouse cursor into the break window and hold down the middle mouse button.

The Break Menu will appear. Choose BT. Another menu, called the stack menu, will appear beside the break window. Choosing stack items from this menu will display

another window. This window displays the function’s local variable bindings, or values (see Figure 10-2). This new window, titled FACTORlAL Frame, is an inspector window (see inspector Chapter 17).


image


Figure 10-2. Back Trace of the System Stack


From the break window, you can call the editor for the function FACTORIAL by middle- buttoning on the word FACTORIAL and selecting DisplayEdit from the menu that pops up.

Replace the unbound atom DUMMY with 1. Exit the editor .

The function is fixed, and you can restart it from the last call on the stack. (It does not have to be started again from the Top Level.) To begin again from the last call on the stack, choose the last (top) FACTORIAL call in the BT menu. Select REVERT from the middle button break window, or type it into the window. The break window will close, and a new one will appear with the message: Breakpoint at FACTORIAL

To start execution with this last call to FACTORIAL , choose OK from the middle button break menu. The break window will disappear, and the correct answer, 24, will be

returned to the top level.

  1. BREAKPACKAGE

    image


    Ways to Stop Execution from the Keyboard (Breaking Lisp)


    There are ways you can stop execution from the keyboard. They differ in terms of how much of the current operating state is saved:


    Control-G Provides you with a menu of processes to interrupt. Your process will

    usually be "EXEC". Choose it to break your process. A break window will then appear.

    Control-B Causes your function to break, saves the stack, then displays a break window with all the usual break functions. For information on other interrupt characcers, see Chapter 30 in the IRM.


    Break Menu


    Move the mouse cursor into the break window. Hold the middle button down, and a new menu will pop up, like the one in Figure 10-3.


    image


    Figure 10-3. Middle Button Menu in Break window

    Five of the selections are particularly important when just starting to use Medley:

    BT Back Trace displays the stack in a menu beside the break window. Back

    Trace is a very powerful debugging tool. Each function call is placed on the

    stack and removed when the execution of that function is complete. Choosing an item on the stack will open another window displaying that item’s local

    variables and their bindings. This is an inspector window that offers all the power of the inspector. (For details, see the section on the Inspector, Chapter 17.)

    ? = Before you use this menu option, display the stack by choosing BT from this menu, and choose a function from it. Now, choose ?=. It will display the

    current values of the arguments to the function that has been chosen from the stack.

    Move back to the previous break window, or if there is no other break window, back to the top level, the Executive Window.

    REVERT Move the point of execution back to a specified function call before the error. The function to revert back to is, by default, the last function call before the break. If, however, a different function call is chosen on the BT menu, revert will go back to the start of this function and open a new break window. The

    items on the stack above the new starting place will no longer exist. This is used in the tutorial example (see the Break Package Example section above).


    OK Continue execution from the point of the break. This is useful if you have a simple error, i.e., an unbound variable or a nonnumeric argument to an

    arithmetic function. Reset the variable in the break window, then select OK. (see the Break Package Example section above).

    In addition to being available on the middle button menu of the break window, all of these functions can be typed directly into the window. Only BT behaves differently

    when typed. It types the stack into the trace window instead of opening a new window.)


    Returning to Top Level

    Typing Control-D will immediately take you to the top level from any break window.

    The functions called before the break will stop, but any side effect s of the function that occurred before the break remain. For example, if a function set a global variable before it broke, the variable will still be set after typing Control-D.

  2. WHAT TO DO IF ...

    image


    The purpose of this chapter is to explain what to do in some of the problems commonly experienced by Medley users.


    Executive Window turns black

    An example is shown in Figure 11-1.

    Press any key to unfreeze the window and continue. This pause happens when the command you just typed causes enough information to be printed to fill the window. It gives you a chance to read that one window of text before moving on.


    image


    Figure 11-1. Blackened Executive Window


    You closed the Executive Window

    Open another from the Background Menu.


    Mouse disappears

    Type (CURSOR T) in the Executive Window. The cursor will reappear.


    Second window appears

    This probably happens because you made a typing mistake, as in Figure 11-2.


    image


    Figure 11-2. Second Window Appears (Break Window) after Typing Error Made

    Type a Control-D by simultaneously pressing the Control key and the "D". This aborts the error condition, returning control to the Executive Window.


    You keep getting beeped at

    Usually the beeping means that Medley want input from you. Look for the flashing

    caret. It will usually be preceeded by some kind of prompt, indicating what you should type.


    You cannot delete the first letter

    of the filename you are typing to (FILES?) . Type Control-E (error) You will get a linefeed and  printed to the window. Now type the correct filename.

    Your function is just sitting there

    It is not returning a value, and you think that your program may be in an infinite loop or is having some other major problem. You can see what process is currently running by typing Control-T, or you could interrupt the process by typing Control-E.


    A Break Window appears

    If the Break Window look something like that shown in Figure 11-3, you are trying to save a file, but there is not enough space on the hard disk.


    image


    Figure 11-3. Break Window Caused by Insufficient Space in Save File

    Exit from the Break Window by typing an up arrow followed by a Return. Delete old versions of files, and any other files you do not need. Then try again to save the file


    You have run out of space

    Generally, a Break Window has appeared. The GAINSPACE function allows you to delete non-essential data structures. To use it, type:

    (GAINSPACE)

    into the Executive Window. Answer N to all questions except the following:

image


The Inspector is a window-oriented tool designed to examine data structures. Because Medley is such a powerful programming environment, many types of data structures would be difficult to see in any other way.


Calling the Inspector


Take as an example an object defined through a sequence of pointers (i.e., a bitmap on the property list of a window on the property list of an atom inaprogram.)

To inspect an object named NAME, type:

(INSPECT ’NAME)

If NAME has many possible interpretations, an option menu will appear. For example, in Interlisp-D, a litatom can refer to both an atom and a function. For example, if NAME

was a record, had a function definition, and had properties on its property list, then the menu would appear as in Figure 17-1.



image


Figure 17-1. Option Window for Inspection of NAME

If NAME were a list, then the option menu shown in Figure 17.2 would appear. The options include:

will be prompted for the new value, and the item will be changed. The sequence of steps is shown in Figure 17-3.


The item in the lefl column is selected, and the middle mouse button pressed. Select the

SET option from the menu that pops up.

You will then be prompted for the new value. Type it in.

The item in the right column is updated to the value of what you typed in.

image


image


image

Figure 17-3. Steps Involved in Changing Value in Right Column of Inspector Window


Inspector Example


This example will use ideas discussed in Chapter 21. An example, ANlMALGRAPH , is created in that section. You do not need to know the details of how it was created, but the structure is examined in this chapter.

If you type

(INSPECT ANIMAL.GRAPH)

and then choose the Inspect option from the menu, a display appears as shown in

Figure 17-4. ANlMAL.GRAPH is being inspected as a list. Note the numbers in the left column of the inspectorwindow.

image

  1. THE INSPECTOR

    image


    Figure 17-4. Inspector Window For ANIMAL.GRAPH , Inspected as List If you choose the "As A Record" option, and choose "GRAPH" from the menu that

    appears, the inspector window looks like Figure 17-5. Note the fieldnames in the left column of the inspector window.

    image


    Figure 17-5. Inspector Window for ANlMAL.GRAPH , Inspected as Instance of GRAPH

    Record


    The remaining examples will use ANlMAL.GRAPH inspected as a list. When the first item in the Inspector window is chosen with the leff mouse button, the Inspector

    window looks like Figure 17-6.


    image


    Figure 17-6. Inspector Window for ANlMAL.GRAPH With First Element Selected

    When you use the middle mouse button to inspect the selected list element, the display looks like Figure 17-7.


    image

    Figure 17-7. Inspector Window for ANlMAL.GRAPH and for First Element of

    ANIMAL.GRAPH


    How you can see that six items make up the list, and you can further choose to inspect one of these items. Notice that this is also inspected as a list. As usual, it could also

    have been inspected as a record.

    Select item 5 - MAMMAL DOG CAT - with the left mouse button. Press the middle mouse button. Choose "Inspect" to inspect your choice as a list. The Inspector now displays the values of the structure that makes up MAMMAL DOG CAT . (See Figure 17-8.)


    image

    Figure 17-8. Inspector Window for Element S From Figure 17.7 That Begins ((MAMMAL DOG CAT).

  2. MASTERSCOPE

    image


    Masterscope is a tool that allows you to quickly examine the structure of complex

    programs. As your programs enlarge, you may forget what variables are global, what functions call other functions, and so forth. Masterscope keeps track of this for you.

    To use Masterscope, first load MASTERSCOPE.DFASL and EXPORTS.ALL.

    Suppose that JVTO is the name of a file that contains many of the functions involved in a complex system and that LINTRANS is the file containing the remaining functions. The first step is to ask Masterscope to analyze these files. These files must be loaded.

    All Masterscope queries and commands begin with a period followed by a space, as in

    . ANALYZE FNS ON MSCOPEDEMO

    The ANALYZE process takes a while, so the system prints a period on the screen for each function it has analyzed. (See Figure 18-1)


    image


    Figure 18-1. Executive Window After Analyzing Files

    If you are not quite sure what functions were just analyzed, type the file’s COMS variable (see the File Variables section in Chapter 7) into the Executive Window. The names of

    the functions stored on the file will be a part of the value of this variable.

    A variety of commands are now possible, all referring to individual functions within the analyzed files. Substantial variation in exact wording is permitted. Some commands

    are:

    . SHOW PATHS FROM ANY TO ANY

    . EDIT WHERE ANY CALLS functionname

    . EDIT WHERE ANY USES variablename

    . WHO CALLS WHOM

    . WHO CALLS functionname

    . BY WHOM IS functionname CALLED

    . WHO USES variablename AS FIELD


    Note that the function is being called to invoke each command. Refer to the IRM for commands not listed here.

    Figure 18-2 shows the Executive Window after the commands . WHO CALLS GobbleDump and . WHO DOES JVL inScan CALL.


    image


    Figure 18-2. Sample Masterscope Output

    18. MASTERSCOPE


    SHOW DATA Command and GRAPHER


    When the library package GRAPHER is loaded (to load this package, type (FILESLOAD GRAPHER)), Masterscope’s SHOWPATHS command is modified. The command will be

    changed to generate a tree structure showi ng how the program’s functions interact instead of a tabular printout into the Executive window. For example, typing:

    . SHOW PATHS FROM ProcessEND


    produced the display shown in Figure 18-3.


    image


    Figure 18-3. SHOW PATHS Display Example


    All the functions in the display are part of this analyzed file or a previously analyzed file. Boxed functions indicate that the function name has been duplicated in another place on the display.


    Selecting any function name on the display will pretty print the function in a window (see Figure 18-4).


    image



    image


    Figure 18-4. Browser Printout Example


    Selecting it again with the left mouse button will produce a desription of the function’s role in the overall system (see Figure 18-5).

    1. MASTERSCOPE

      image


      image


      image


      Figure 18-5. Browser Description Example

    2. WHERE DOES ALL THE TIME GO? SPY

      image


      SPY is an Lisp library package that shows you where you spend your time when you run your system. It is easy to learn, and very useful when trying to make programs run

      faster.


      How to Use Spy with the SPY Window


      The function SPY.BUTTON brings up a small window which you will be prompted to position. Using the mouse buttons in this window controls the action of the SPY

      program. When you are not using SPY, the window appears as in Figure 19.1.

      image

      Figure 19.1. SPY Window When SPY is Not Being Used


      To use SPY, click either the left or middle mouse button with the mouse cursor in the

      SPY window. The window will appear as in Figure 19.2, and means that SPY is accumulating data about your program.


      image


      Figure 19.2. SPY Window When SPY is Being Used


      To turn off SPY after the program has run, again click a mouse button in the SPY

      window. The eye closes, and you are asked to position another window. This window contains SPY’s results. An example of the resulting window is shown in Figure 19.3.

      19. WHERE DOES ALL THE TIME GO? SPY


      image


      Figure 19.3. Window Produced After Running SPY


      This window is scrollable horizontally and vertically. This is useful, since the whole tree does not fit in the window. If a part that you want to see is not shown, you can scroll the window to show the part you want to see.


      How to Use SPY from the Lisp Top Level


      SPY can also be run while a specific function or system is being used. To do this, type the function WITH.SPY:

      (WITH.SPY form)

      The expression used for form should be the call to begin running the function or system that SPY is to watch. If you watch the SPY window, the eye will blink! To see your

      results, run the function SPY.TREE. To do this, type:

      (SPY.TREE)

      The results of the last running of SPY will be displayed. If you do this, and SPY.TREE returns (no SPY samples have been gathered), your function ran too fast for SPY to follow.


      Interpreting SPY’s Results

      Each node in the tree is a box that contains, first, the percentage of time spent running that particular function, and second, the function name. There are two modes that can be used to display this tree.

      The default mode is cumulative. In this mode, each percentage is the amount of time

      that function spent on top of the stack, plus the amount of time spent by the functions it calls. The second mode is individual. To change the mode to individual, point to the title bar of the window, and press the middle mouse button. Choose Individual from the menu that appears. In this mode, the percentage shown is the amount of time the

      function spent on the top of the stack.

      To look at a single branch of the tree, point with the mouse cursor at one of the nodes of the tree, and press the right mouse button. From the menu that appears, choose the


      image

      19-2 Medley for the Novice, Release 2.0

      19. WHERE DOES ALL THE TIME GO? SPY


      option SubTree. Another SPY window will appear, with just this branch of the tree in it.

      Another way to focu s within the tree is to remove branches from the tree. To do this, point to the node at the top of the branch you would like to delete. Press the middle mouse button, and choose Delete from the menu that appears.

      There are also different amounts of "merging" of functions that can be done in the

      window. A function can be called by another function more than once. The amount of merging determines where the subfunction, and the functions that it calls, appear in the tree, and how often. (For a detailed explanation of merging, see the Lisp Library Packages Manual.)

    3. FREE MENUS

      image


      Free Menu is a library package that is even more flexible than the regular menu package. It allows you to create menus with different types of items in them, and

      format s them as you require. Free menus are particularly useful when you want a "fill in the form" type interaction with the user.

      Each menu item is described with a list of properties and values. The following example will give you an idea of the structure of the description list, and some of your options.

      The most commonly used properties, and each type of menu item will be described in the Parts of a Free Menu Item and Types of Free Menu Items section below.


      Free Menu Example

      Free menus can be created and formatted automatically! It is done with the function

      FM.FORMATMENU. This function takes one argument, a description of the menu. The

      description is a list of lists; each internal list describes one row of the free menu. A free menu row can have more than one item in it, so there are really lists of lists of lists! It really isn’t hard, though, as you can see from the following example:

      (SETQ ExampleMenu (FM.FORMATMENU

      ’(((TYPE TITLE LABEL TitlesDoNothing) TYPE 3STATE LABEL Example3State))

      ((TYPE EDITSTART LABEL PressToStartEditing

      ITEMS (EDITEM)) (TYPE EDIT ID EDITEM LABEL ""))

      (WINDOWPROPS TITLE "Example Does Nothing"))))

      The first row has two items in it: one is a TITLE, and the second is a 3STATE item. The second row also has two items. The second, the EDIT item, is invisible, because its label is an empty string. The caret will appear for editing, however, if the EDITSTART item is chosen. Windowprops can appear as part of the description of the menu, because a

      menu is, affer all, just a special window. You can specify not only the title with

      WINDOWPROPS, but also the position of the free menu, using the "left" and "bottom"

      properties, and the width of the border in pixels, with the "border" property. Evaluating this expression will return a window. You can see the menu by using the function OPENW. The following example illustrates this:


      Figure 20.1. Example Free Menu


      The next example shows you what the menu looks like after the EDITSTART item,

      PressToStartEditing, has been chosen.


      Figure 20.2. Free menu after EDITSTART Item Chosen

      The following example shows the menu with the 3STATE item in its T state, with the item highlighted. (In the previous bitmaps, it was in its neutral state.)

      .


      Figure 20.3. Free menu with 3STATE Item in its T State


      Finally, Figure 20.4 shows the 3STATE item in its NIL state, with a diagonal line through the item


      Figure 20.4 Free menu with the 3STATE item in its NIL State

      If you would like to specify the layout yourself, you can do that too. See the Lisp Library Packages Manual for more information.


      Parts of a Free Menu Item

      There are eight different types of items that you can use in a free menu. No matter

      what type, the menu item is easily described by a list of properties, and values. Some of the properties you will use most often are listed below:


      LABEL Required for every type of menu item. It is the atom, string, or bitmap that appears as a menu selection.

      TYPE One of eight types of menu items. Each of these are described in the section below.

      MESSAGE The message that appears in the prompt window if a mouse button is held down over the item.

      ID An item’s unique identifier. An ID is needed for certain types of menu items.

      ITEMS Used to list a series of choices for an NCHOOSE item, and to list the ID’s of the editable items for an EDITSTART item.

      SELECTEDFN The name of the function to be called if the item is chosen.


      Types of Free Menu Items

      Each type of menu item is described in the following list, including an example description list for each one.


      MOMENTARY This is the familiar sort of menu item. When it is selected, the

      function stored with it is called. A description for the function that creates and format s the menu looks like this:

      (TYPE MOMENTARY

      LABEL Blink-N-Ring

      MESSAGE "Blinks the screen and rings bells" SELECTEDFN RINGBELLS)

      TOGGLE This menu item has two states, T and NIL. The default state is NIL, but choosing the item toggles its state. The following is an example description list, without code for the SELECTEDFN function, for this type of item:

      (TYPE TOGGLE

      LABEL DwimDisable SELECTEDFN ChangeDwimState)

      1. FREE MENUS

        image


        3STATE This type of menu item has three states, NEUTRAL , T, and NIL. NEUTRAL is the default state. T is shown by highlighting the item, and NIL is shown with diagonal lines. The following is an example

        description list, without code for the SELECTEDFN function, for this type of item:

        (TYPE 3STATE

        LABEL CorrectProgramAllOrNoSpelling SELECTEDFN ToggleSpellingCorrection)

        TITLE This menu item appears on the menu as dummy text. It does nothing when chosen. An example of its description:

        (TYPE TITLE LABEL "Choices:")

        NWAY A group of items, nnly one of which can be chosen at a time. The items in the NWAY group should all have an ID field, and the ID’s

        should be the same. For example, to set up a menu that would allow the user to choose between Helvetica, Gacha, Modern, and Classic font s, the descriptions might look like this (once again, without the code for the SELECTEDFN):

        (TYPE NWAY ID FONTCHOICE

        LABEL Helvetica SELECTEDFN ChangeFont)

        (TYPE NWAY ID FONTCHOICE

        LABEL Gacha

        SELECTEDFN ChangeFont) (TYPE NWAY ID FONTCHOICE)

        LABEL Modern SELECTEDFN ChangeFont)

        (TYPE NWAY ID FONTCHOICE

        LABEL Classic SELECTEDFN Changefont)


        NCHOOSE This type of menu item is like NWAY except that the choices are given to the user in a submenu. The list to specify an NCHOOSE menu item that is analogous to the NWAY item above might look like this:

        (TYPE NCHOOSE

        LABEL FontChoices

        ITEMS Helvetica Gacha Modern Classic) SELECTDFN Changefont)

        EDITSTART When this type of menu itein is chosen, it activates another type of item, an EDIT item. The EDIT item or items associated with an EDITSTART item have their lD’s listed on the EDITSTART ’s ITEMS property. An example description list is:

        (TYPE EDITSTART LABEL "Function to add?" ITEMS (Fn))

        EDIT This type of menu item can actually be edited by you. It is often

        associated with an EDITSTART item (see above), but the caret that prompts for input will also appear if the item itself is chosen. An EDIT item follows the same editing conventions as editing in

        Executive Window:

        Add characters by typing them at the caret.

        Move the caret by pointing the mouse at the new position, and clicking the left button.


        Delete characters from the caret to the mouse by pressing the right button of the mouse. Delete a character behind the caret by pressing the backspace key.

        Stop editing by typing a carriage return, a Control-X, or by choosing another item from the menu.

        An example description list for this type of item is:

        (TYPE EDIT ID Fn LABEL **)

      2. THE GRAPHER

        image


        Say it with Graphs


        Grapher is a collection of functions for creating and displaying graphs, networks of nodes and links. Grapher also allows you to associate program behavior with mouse selection of graph nodes. To load this package, type

        (FILESLOAD GRAPHER)

        Figure 21-1 shows a simple graph.

        image


        Figure 21-1. Simple Graph


        In Figure 21-1 there are six nodes (ANIMAL , MAMMAL, DOG, CAT, FISH, and BIRD)

        connected by five links. A GRAPH is a record containing several fields. Perhaps the most

        important field is GRAPHNODES —which is itself a list of GRAPHNODE records. Figure 21-2 illustrates these data structures. The window on top contains the fields from the simple

        graph. The window on the bottoms an inspection of the node, DOG.


        image

        Figure 21-2. Inspecting a Graph and a Node


        The GRAPHNODE data structure is described by its text (NODEID ), what goes into it (FROMNODES), what leaves it (TONODES ), and other fields that specify its looks. The basic model of graph building is to create a bunch of nodes, then layout the nodes into a

        graph, and finally display the resultant graph. This can be done in a number of ways.

        One is to use the function NODECREATE to create the nodes, LAYOUTGRAPH to lay out the nodes, and SHOWGRAPH to display the graph. The primer shows you two simpler ways,

        but please see the Library Packages Manual for more information about these other functions. The primer’s first method is to use SHOWGRAPH to display a graph with no nodes or links, then interactively add them. The second is to use the function

        LAYOUTSEXPR, which does the appropriate NODECREATES and a LAYOUTGRAPH, with a list.

        The function SHOWGRAPH displays graphs and allows you to edit them. The syntax of

        SHOWGRAPH is

        (SHOWGRAPH graph window lefibuttonfn middlebuttonfn topjustifyflg alloweditflg copybuttoneventfn)

        Obviously the graph structure is very complex. Here’s the easiest way to create a graph.

        (SETQ MY.GRAPH NIL)

        (SHOWGRAPH MY.GRAPH "My Graph" NIL NIL NIL T)


        image


        Figure 21-3. My Graph


        You will be prompted to create a small window as in Figure 21-3. This graph has the title My Graph. Hold down the right mouse button in the window. A menu of graph

        editing operations will appear as in Figure 21-4.

        image


        Figure 21-4. Menu of Graph Editing Operations

        Here’s how to use this menu. The commands in this menu are easy to learn. Experiment with them!


        Add a Node

        Start by selecting Add Node . Grapher will prompt you for the name of the node (see Figure 21-5.) and then its position.

        image


        Figure 21-5. Grapher Prompts for Name of Node to add after Add Node is Chosen from Graph Editing Menu.


        Position the node by moving the mouse cursor to the desired location and clicking a mouse button. Figure 21-6 shows the graph with two nodes added using this menu.


        image


        Figure 21-6. Two Nodes Added to MY GRAPH Using GraphEditing Menu


        Add a Link

        Select Add Link from the graph editing menu. The Prompt window will prompt you to select the two nodes to be linked. (See Figure 21-7.) Do this, and the link will be added.


        image


        image


        Figure 21-7. Prompt Window Requesting Selection of Two Nodes to Link, and Result


        Delete a Link

        Select Delete Link from the graph editing menu. ThePrompt window will prompt you to select the two nodes that should no longer be linked. (See Figure 21-8.) Do this, and

        the link will be deleted.


        image


        image


        Figure 21-8. Prompt Window Requesting Selection of Link to Delete, and Result


        Delete a Node

        Select Delete Node from the graph editing menu. The Prompt window will prompt you to select the node to be aeleted. (See Figure 21-9.) Do this, and the node will be deletea.


        image

        Figure 21.-9. Prompt to Delete a Node


        Move a Node

        Select Delete Node from the graph editng menu. Choose a node pointing to the it with the mouse cursor, and pressing and holding the leff mouse button. When you move the mouse cursor, the node will be dragged along. When the node is at the new position,

        release the mouse button to deposit the node.


        Making a Graph from a List


        Typically, a graph is used to display one of your program’s data structures. Here is how that is done.


        LAYOUTSEXPR takes a list and returns a GRAPH record. The syntax of the function is

        (LAYOUTSEXPR sexpr format boxing font motherd personald famlyd)

        For example:

        (SETQ ANIMAL.TREE ’(ANIMAL (MAMMAL DOG CAT) BIRD FISH)) (SETQ ANIMAL.GRAPH

        (LAYOUTSEXPR ANIMAL.TREE ’HORIZONTAL)) (SHOWGRAPH ANIMAL.GRAPH "My Graph" NIL NIL NIL T)

        This is how Figure 21.1 was produced.


        Incorporating Grapher into Your Program

        The Grapher is designed to be built into other programs. It can call functions when, for example, a mouse button is clicked on a node. The function SHOWGRAPH does this:

        (SHOWGRAPH graph window lefibuttonfn middlebuttonfn topjustifyflg alloweditflg copybuttoneventfn)

        For example, the third argument to SHOWGRAPH , leftbuttonfn, is a function that is called when the left mouse button is pressed in the graph window. Try this:

        (DEFINEQ (My.LEFT.BUTT0N.FUNCTION (THE.GRAPHNODE THE.GRAPH.WINDOW)

        (INSPECT THE.GRAPHNODE)))


        (SHOWGRAPH FAMILY.GRAPH "Inspectable family" (FUNCTION MY.LEFT.BUTTON.FUNCTION)

        NIL NIL T)


        In the example above, MY.LEFT.BUTTON.FUNCTION simply calls the inspector. The

        function should be written assuming it will be passed a graphnode and the window that holds the graph. Try adding a function of your own.


        More of Grapher

        Some other Library packages make use of the Grapher. (Grapher needs to be loaded with the packages to use these functions.)


        • MASTERSCOPE: The Browser package modifies the Masterscope command, . SHOW PATHS, so that its output is displayed as a graph (using Grapher) instead of simply printed.

        • GRAPHZOOM: allows a graph to be redisplayed larger or smaller automatically.

      3. RESOURCE MANAGEMENT

        image


        Naming Variables and Records

        You will find times when one environment simultaneously hosts a number of different programs. Running a demo of several programs, or reloading the entire Medley

        environment from floppies when it contains several different programs, are two

        examples that could, if you aren’t careful, provide a few problems. Here are a few tips on how to prevent problems:


        • If you change the value of a system variable, MENUHELDWAIT for example, or connect to a directory other than {DSK}<LISPFILES> , write a function to reset the variable or directory to its original value. Run this function when you are finished working.

          This is especially important if you change any of the system menus.


        • Do not redefine Medley functions or CLISP words. Remember, if you reset an atom’s value or function definition at the top level (in the Executive Window), the message (Some.Crucial.Function.Or.Variable redefined) , appears. If this is not what you wanted, type UNDO immediately!

          If, however, you reset the value or function definition of an atom inside your program, a warning message will not be printed.


        • Make the atom names in your programs as unique as possible. To do this without filling your program with unreadable names that noone, including you, can

          remember, prefix your variable names with the initials of your program. Even then, check to see that they are not already being used with the function BOUNDP . For

          example, type:

          (BOUNDP ’BackgroundMenu)


          This atom is bound to the menu that appears when you press the leff mouse button

          when the mouse cursor is not in any window. BOUNDP returns T. BOUNDP returns NIL

          if its argument does not currently have a value.


        • Make your function names as unique as possible. Once again, prefixing function

          names with the initials of your program can be helpful in making them unique, but even so, check to see that they are not already being used. GETD is the Interlisp-D function that returns the function definition of an atom, if it has one. If an atom has no function definition, GETD returns NIL. For example, type:

          (GETD ’CAR)

          A non-NIL value is returned. The atom CAR already has a function definition.


        • Use complete record field names in record FETCHes and REPLACE s when your code is not compiled. A complete record field name is a list consisting of the record

          declaration name and the field name. Consider the following example:

          (REC0RD NAME (FIRST LAST))

          (SETQ MyName (create Name FIRST ’John LAST ’Smith)) (FETCH (NAME FIRST) OF MyName)

        • Avoid reusing names that are field names of Lisp system records. A few examples of system records follow. Do not reuse these names.

          (RECORD REGION (LEFT BOTTOM WIDTH HEIGHT)) (RECORD POSITION (XCOORD YCOORD))


          (RECORD IMAGEOBJ (- BITMAP -)))


        • When you select a record name and field names for a new record, check to see whether those names have already been used.


          Call the function RECLOOK, with your record name as an argument, in the Executive Window (see Figure 22-1). If your record name is already a record, the record

          definition will be returned; otherwise the function will return NIL.


          image


          Figure 22-1. Response to RECLOCK


          Call the function FIELDLOOK with your new field name in the Executive Window (see Figure 22-2). If your field name is already a field name in another record, the record definition will be returned; otherwise the function will return NIL.


          image

          Figure 22-2. Response to FIELDLOOK


          Some Space and Time Considerations

          In order for your program to run at maximum speed, you must efficiently use the space available on the system. The following section points out areas that you may not know are wasting valuable space, and tips on how to prevent this waste.

          Often programs are written so that new data structures are created each time the

          program is run. This is wasteful. Write your programs so that they only create new variables and other data structures conditionally. If a structure has already been

          created, use it instead of creating a new one.

          Some time and space can be saved by changing your RECORD and TYPERECORD

          declarations to DATATYPE . DATATYPE is used the same way as the functions RECORD and TYPERECORD. In addition, the same FETCH and REPLACE commands can be used with the data structure DATATYPE creates. The difference is that the data structure

          DATATYPE creates cannot be treated as a list the way RECORD s and TYPERECORDs can.

          1. RESOURCE MANAGEMENT

            image


            Global Variables

            Once defined, global variables remain until Lisp is reloaded. Avoid using global

            variables if at all possible! One specific problem arises when programs use the function

            GENSYM. In program development, many atoms are created that may no longer be useful. Hints:

        • Use

          (DELDEF atomname ’PROP)

          to delete property lists, and

          (DELDEF atomname ’VARS)

          to have the atom act like it is not defined.

          These not only remove the definition from memory, but also change the appropriate fileCOMS that the deleted object was associated with so that the file package will not attempt to save the object (function, variable, record definition, and so forth) the next time the file is made. J ust doing something like

          (SETQ (arg atomname) ’NOBIND)

          looks like it will have the same effect as the second DELDEF above, but the SETQ does not update the file package.

        • If you are generating atom names with GENSYM , try to keep a list of the atom names that are no longer needed. Reuse these atom names, before generating new ones.

          There is a (fairly large) maximum to the number of atoms you can have, but things slow down considerably when you create lots of atoms.

        • When possible, use a data structure such as a list or an array, instead of many

          individual atoms. Such a structure has only one pointer to it. Once this pointer is

          removed, the whole structure will be garbage-collected and space will be reclaimed.


          Circular Lists

          If your program is creating circular lists, a lot of space may be wasted. (Many

          crosslinked data structures end up having circularities.) Hints when using circular lists:

        • Write a function to remove pointers that make lists circular when you are through with the circular list.

        • If you are working with circular lists of windows, bind your main window to a unique global variable. Write window creation conditionally so that if the binding of that

          variable is already a window, use it, and only create a new window if that variable is unbound or NIL.

          Here is an example that illustrates the problem. When several auxilIary windows are built, pointers to these windows are usually kept on the main window’s property list.

          Each auxilIary window also typically keeps a pointer to the main window on its

          property list If the top level function creates windows rather than reusing existing ones, there will be many lists of useless windows cluttering the work space. Or, if such a main window is closed and will not be used again, you will have to break the links by deleting the relevant properties from both the main window and all of the auxiliary windows

          first. This is usually done by putting a special CLOSEFN on the main window and all of its auxiliary windows.


          When You Run Out of Space

          Typically, if you generato a lot of structure! that won’t get garbage collected, you will eventually run out of space. The important part ii being aNe to track down those

          structures and the code that generates them to become more space efficient.

          Use the Lisp Library Package GCHAX.DCOM to track down pointers to data structures. The basic idea is that GCHAX will return the number of references to a particular data structure.

          A special function exists that allows you to get a little extra space so that you can try to save your work when you get toward the edge (usually noted by a message indicating

          that you should save your work and load a new Medley environment). The GAINSPACE

          function allows you to delete non-essential data structures. To use it, type:

          (GAINSPACE)

          into the Executive Window. Answer N to all questions except the followi ng.

        • Delete edit history

        • Delete history list.

        • Delete values of old variables.

        • Delete your MASTERSCOPE database

        • Delete information for undoing your greeting.

          Save your work and reload Lisp as soon as possible.

          1. SIMPLE INTERACTIONS WITH THE CURSOR, A BITMAP, AND A WINDOW

            image


            The purpose of this chapter is to show you how to build a moderately tricky interactive interface with the various Medley display facilities. In particular how to move a large

            bitmap (larger than 16 x 16 pixels) around inside a window. To do this, you will change the CURSORINFN and CURSOROUTFN properties of the window. If you would also like to then set the bitmap in place in the window, you must reset the BUTTONEVENTFN . This chapter explains how to create the mobile bitmap.


            GETMOUSESTATE Example Function

            One function that you will use to "trace the cursor" (have a bitmap follow the cursor around in a window) is GETMOUSESTATE. This function finds the current state of the. mouse, and resets global system variables, such as LASTMOUSEX and LASTMOUSEY.

            As an example of how this function works, create a window by typing

            (SETQ EXAMPLE.WINDOW (CREATEW))

            into the Executive Window, and sweeping out a window. Now, type in the function

            (DEFINEQ (PRINTCOORDS (W)

            (PROMPTPRINT "(" LASTMOUSEX ", "LASTMOUSEY ")") (BLOCK)

            (GETMOUSESTATE)))


            This function calls GETMOUSESTATE and then prints the new values of LASTMOUSEX and

            LASTMOUSEY in the promptwindow. To use it, type

            (WINDOWPROP EXAMPLE.WINDOW ’CURSORMOVEDFN ’PRINTCOORDS)

            The window property CURSORMOVEDFN, used in this example, will evaluate the function PRINTCOORDS each time the cursor is moved when it is inside the window. The position coordinates of the mouse cursor will appear in the prompt window. (See Figure 23.1.)


            Figure 23.1. Current Position Coordinates of Mouse Cursor in Prompt Window


            Advising GETMOUSESTATE

            For the bitmap to follow the moving mouse cursor, the function GETMOUSESTATE is advised. When you advise a function, you can add new commands to the function

            without knowing how it is actually implemented. The syntax for advise is

            (ADVISE fn when where what)

            fn is the name of the function to be augmented. when and where are optional

            arguments. when specifies whether the change should be made before, after, or around the body of the function. The values expected are BEFORE , AFTER, or AROUND.

            what specifies the additional code.


            In the example, the additional code, what, moves the bitmap to the position of the

            mouse cursor. The function GETNOUSESTATE will be ADVISEd when the mouse moves

            into the window. This will cause the bitmap to follow the mouse cursor. ADVISE will be undone when the mouse leaves the window or when a mouse button is pushed. The ADVISEing will be done and undone by changing the CURSORINFN , CURSOROUTFN, and BUTTONEVENTFN for the window.


            Changing the Cursor


            One last part of the example, to give the impression that a bitmap is dragged around a window, the original cursor should disappear. Try typing:

            (CURSOR (CURSORCREATE (BITMAPCREATE 1 l) 1 1]

            into the Executive Window. This causes the original cursor to disappear. It reappears when you type

            (CURSOR T)

            When the cursor is invisible, and the bitmap moves as the cursor moves, the illusion is given that the bitmap is dragged around the window.


            Functions for Tracing the Cursor


            To actually have a bitmap trace (follow) the cursor, the environment must be set up so that when the cursor enters the tracing region the trace is turned on, and when the

            cursor leaves the tracing region the trace is turned off. The function Establish/Trace/Data will do this. Type it in as it appears (include comments that will help you remember what the function does).


            (DEFINEQ (Establish/Trace/Data

            [LAMBDA (wnd tracebitmap cursor/rightoffset cursor/heightoffset GCGAGP)


            (* * This function is called to establish the data to trace the desired bitmap. "wnd" is the window in which the tracing is to take place, "tracebitmap" is the tracing bitmap, "cursor/rightoffset" and "cursor/heightoffset" are integers which detemine the hotspot of the tracing bitmap.

            As "cursor/heightoffset and "cursor/rightoffset" increase the cursor hotspot moves up and to the right.

            If GCGAGP is non-NIL, GCGAG will be disabled.)


            (PROG NIL

            (if (OR (NULL wnd)

            (NULL tracebitmap))

            then (PLAYTUNE (LIST (CONS 1000 4000))) (RETURN))

            (if GCGAGP

            then (GCGAG))

            (* * Create a blank cursor.)

            (SETQ *BLANKCURSOR*(BITMAPCREATE 16 16))

            (SETQ *BLANKTRACECURSOR*(CURSORCREATE *BLANKCURSOR*))


            (* * Set the CURSOR IN and OUT FNS for wnd to the following:)

            (WINDOWPROP wnd (QUOTE CURSORINFN)

            (FUNCTION SETUP/TRACE)) (WINDOWPROP wnd (QUOTE CURSOROUTFN)

            (FUNCTION UNTRACE/CURSOR))

            (* * To allow the bitmap to be set down in the window by pressing a mouse button, include this line.

            Otherwise, it is not needed)

            (WINDOWPROP wnd (QUOTE BUTTONEVENTFN)

            (FUNCTION PLACE/BITMAP/IN/WINDOW)) (WINDOWPROP wnd (QUOTE CURSOROUTFN)

            (* * Set up Global Variables for the tracing operation) (SETQ *TRACEBITMAP* tracebitmap

            (SETQ *RIGHTTRACE/OFFSET*(OR cursor/rightoffset 0)) (SETQ *HEIGHTTRACE/OFFSET*(OR cxursor heightoffset 0)) (SETQ *OLDBITMAPPOSITION*(BITMAPCREATE (BITMAPWIDTH

            tracebitmap)

            tracebitmap)))

            (SETQ *TRACEWINDOW* wnd]))

            (BITMAPHEIGHT


            When the function Establish/Trace/Data is called, the functions SETUP/TRACE and

            UNTRACE/CURSOR will be installed as the values of the window’s WlNDOWPROPS , and will be used to turn the trace on and off. Those functions should be typed in, then:


            (DEFINEQ (SETUP/TRACE [LAMBDA (wnd)

            (* * This function is wnd’s CURSORINFN.

            It simply resets the last trace position and the current tracing region. It also readvises GETMOUSESTATE to perform the trace function after each call.)

            (if *TRACEBITMAP*

            then (SETQ *LAST-TRACE-XPOS* -2000) (SETQ *LAST-TRACE-YPOS* -2000)

            (SETQ *WNDREGION* (WINDOWPROP wnd (QUOTE REGION))) (WINDOWPROP wnd (QUOTE TRACING)

            T)

            (* * make the cursor disappear)

            (CURSOR *BLANKTRACECURSOR*) (ADVISE (QUOTE GETMOUSESTATE)

            (QUOTE AFTER) NIL

            (QUOTE (TRACE/CURSOR]))

            (DEFINEQ (UNTRACE/CURSOR [LAMBDA (wnd)


            (* * This function is wnd’s CURSOROUTFN. The function first checks if the cursor is currently being traced; if so, it replaces the tracing bitmap with what is under it and then turns tracing off by unadvising GETMOUSESTATE and setting the TRACING window property of *TRACEWINDOW* to NIL.)

            (if (WINDOWPROP *TRACEWINDOW*(QUOTE TRACING))


            then (BITBLT *OLDBITMAPPOSITION* 0 0 (SCREENBITMAP) (IPLUS (CAR *WNDREGION*)*LAST-TRACE-XPOS*) (IPLUS (CADR *WNDREGION*)*LAST-TRACE-YPOS*))

            (WINDOWPROP *TRACEWINDOW*(QUOTE TRACING)

            NIL))

            (* * replace the original cursor shape) (CURSOR T)

            (* * unadvise GETMOUSESTATE) (UNADVISE (QUOTE GETMOUSESTATE]))

            The function SETUP/TRACE has a helper function that you must also type in. It is

            TRACE/CURSOR:

            (DEFINEQ (TRACE/CURSOR [LAMBDA NIL


            (* * This function does the actual BITBLTing of the tracing bitmap. This function is called after a GETMOUSESTATE, while tracing.)

            (PROG ((xpos (IDIFFERENCE (LASTMOUSEX *TRACEWINDOW*)

            *RIGHTTRACE/OFFSET*))

            (ypos (IDIFFERENCE (LASTMOUSEY *TRACEWINDOW*)

            *HEIGHTTRACE/OFFSET*))

            (* * If there is an error in the function, press the right button to unadvise the function. This will keep the machine from locking up.)

            (if (LASTMOUSESTATE RIGHT)

            then (UNADVISE (QUOTE GETMOUSESTATE))) (if (AND (NEQ xpos *LAST-TRACE-XPOS*)

            (NEQ ypos *LAST-TRACE-YPOS*))

            then

            (* * Restore what was under the old position of the trace bitmap)

            (BITBLT *OLDBITMAPPOSITION* 0 0 (SCREENBITMAP) (IPLUS (CAR *WNDREGION*)*LAST-TRACE-XPOS*) (IPLUS (CADR *WNDREGION*)*LAST-TRACE-YPOS*))

            (* * Save what will be under the position of the new trace bitmap)

            (BITBLT (SCREENBITMAP) (IPLUS (CAR *WNDREGION*)

            xpos)

            (IPLUS (CADR *WNDREGION*) ypos)*OLDBITMAPPOSITION* 0 0)

            (* * BITBLT the trace bitmap onto the new position of the mouse)

            (BITBLT *TRACEBITMAP* 0 0 (SCREENBITMAP) (IPLUS (CAR *WNDREGION*)

            xpos)

            (IPLUS (CADR *WNDREGION*)

            ypos)

            NIL NIL (QUOTE INPUT) (QUOTE PAINT))

            (* * Save the current position as the last trace position.) (SETQ *LAST-TRACE-XPOS* xpos)


            (SETQ *LAST-TRACE-YPOS* ypos]))


            The helper function for UNTRACE/CURSOR , called UNDO/TRACE/DATA, must also be added to the environment:


            (DEFINEQ (UNDO/TRACE/DATA [LAMBDA NIL


            (* * The purpose of this function is to turn tracing off and to free up the global variables used to trace the bitmap so that they can be garbage collected.)


            (* * Check if the cursor is currently being traced. It so, turn it off.)

            (UNTRACE/CURSOR)

            (WINDOWPROP *TRACEWINDOW*(QUOTE CURSORINFN) NIL)

            (WINDOWPROP *TRACEWINDOW*(QUOTE CURSOROUTFN) NIL)

            (SETQ *TRACEBITMAP* NIL)

            (SETQ *RIGHTTRACE/OFFSET* NIL) (SETQ *HEIGHTTRACE/OFFSET* NIL) (SETQ *OLDBITMAPPOSITION* NIL) (SETQ *TRACEWINDOW* NIL)

            (* * Turn GCGAG on) (GCGAG T]))

            Finally, if you included the WlNDOWPROP to allow the user to place the bitmap in the window by pressing a mouse button, you must also type this function:


            (DEFINEQ (PLACE/BITMAP/IN/WINDOW [LAMBDA (wnd)

            (UNADVISE (GETMOUSESTATE))

            (BITBLT *TRACEBITMAP* 0 0 (SCREENBITMAP) (IPLUS (CAR *WNDREGION*)

            xpos)

            (IPLUS (CADR *WNDREGION*)

            ypos)

            NIL NIL (QUOTE INPUT) (QUOTE PAINT]

            That’s all the functions!


            Running the Functions


            To run the functions you just typed in, first set a variable to a window by typing something like

            (SETQ EXAMPLE.WINDOW (CREATEW))

            into the Executive Window, and sweeping out a new window. Now, set a variable to a bitmap, by typing, perhaps,

            (SETQ EXAMPLE.BTM (EDITBM))


            Type

            (Estab1ish/Trace/Data EXAMPLE.WINDOW EXAMPLE.BTM))

            When you move the cursor into the window, the cursor will drag the bitmap.

            (If you want to be able to make menu selections while tracing the cursor, make sure

            that the hotspot of the cursor is set to the extreme right of the bitmap. Otherwise, the menu will be destroyed by the BITBLT s of the trace functions.)

            To stop tracing, do one of the following:

        • Move the mouse cursor out of the window

        • Press the right mouse button

        • Call the function UNTRACE/CURSOR

          1. GLOSSARY OF GLOBAL SYSTEM VARIABLES

            image


            As you can tell by now, there are many system variables in Medley that are useful to know. The following sections gather many of the important variables together into

            groups relating to directory searching, system flags, history lists, system menus, windows, and, of course, the catchall miscellaneous category.


            Directories


            DISPLAYFONTDIRECTORIES

            Its value is a list of directories to search for the bitmap files for display font s. Usually, it contains the FONT directory where you copies the bitmap files (see Chapter 16), and the current connected directory. The current connected

            directory is specified by the atom NIL. Here is an example value of

            DISPLAYFONTDIRECTORIES.


            image

            Figure 24.1. Value for the Atom DISPLAYFONTDIRECTORIES INTERPRESSFONTDIRECTORIES

            Is set to a list of directories to search for the font width files for InterPress font s.


            DIRECTORIES

            This variable is bound to a list of the directories you will be using (see Figure 24-2). The system uses this variable when it is trying to find a file to load. It checks each directory in the list, until the file is foun d. NIL in list means to check the current connected directory.

            LISPUSERSDIRECTORIES

            Its value is a list of directories to search for library package files.


            Flags


            DWIMIFYCOMPFLG

            This flag, if set to T, will cause all expressions to be completely dwinified before the expression is compiled (see Chapter 9). In this state, when the system does not recognize a function of keyword, it will compare the word to a system

            maintained list to determine whether the word is a macro, CLISP word, or misspelled user-defined variable.

            An example of swinifying before compilation is to convert an IF call to a COND. before they are compiled. Undwimified expressions can cause inaccurate

            compilation. This flag is set by the system to NIL. Normally, you want this set to T. For more information on DWIM, refer to the IRM.

            SYSPRETTYFLAG

            When set to T, all lists returned to the executive window are pretty printed. This flag is originally set by the system to NIL.

            CLISPIFTRANFLG

            When set to T, keeps the IF expression, rather than the COND translation in your code.

            PRETTYTABFLG

            When set to T, the pretty printer puts out a tab character rather than several spaces to try to make code align. If NIL, it uses space characters instead.

            FONTCHANGEFLG

            If NIL, then when pretty printing no font changes will happen (e.g., a smaller font for comments, bold for clip words, and so forth). The default is the atom ALL, so different font s are used where appropriate.


            AUTOBACKTRACEFLG

            There are many possible values for this variable. They affect when the back

            trace window appears with the break window, and how much detail is included in it. The values of this variable include:

            • NIL, its initial value. The back trace window is not brought up when an error is generated, until you open it yourself.

            • T, which means that the back trace BT window is opened for error breaks

            • BT! brings up a back trace window with more detail, BT!, window for error breaks

            • ALWAYS brings up a backtrace BT window for both error breaks, and breaks caused by calling the function BREAK

            • ALWAYS! brings up a backtrace window with more detail, BT!, for both error breaks and breaks caused by calling the function


              NOSPELLFLG

              Is initially bound to NIL, so that DWIM tries to correct all spelling errors,

              whether they are in a form you just typed in or within a function being run. If the variable is T, then no spelling correction is performed. This variable is

              automatically reset to T when you are compiling a file. If it has some other non-

              NIL value, then spelling correction is only performed on type-in.


              History Lists

              LISPXHISTORY

              Originally set to the list (NIL 0 30 100) , with the following argument

              interpretation. The NIL is the list (implemented as a circular queue) to which the top level commands append. 0 is the current prompt number. 30 is the

              maximum length of the history list. 100 is the highest number used as a

              prompt. This is a system maintained list used by the programmers assistant commands REDO, UNDO, FIX, and ?? use to retrieve past function calls.

              To delete the history list, reset the variable LISPXHISTORY to its original value of (NIL 0 30 100).

              Setting this variable to NIL disables all the programmers assistant features.

              EDITHISTORY

              This is also set to (NIL 0 30 100), and has the same description as LISPXHISTORY. This list allows you to UNDO edits. You reset this the same way as LISPXHISTORY.


              System Menus


              System menus are all bound to global varieables and are easy to modyfy. If the menu name is set to the NIL value, the menu will be recreated using an items list bound to a global variable.

              To change a system menu, edit the items list bound to the appropriate global variable (system menus use this items list with the default WHENSELECTEDFN ), then set the

              value of the name to NIL. The next time you need the menu, it will be created from the items list you just edited. The names of system menus and the items lists follow.


              BackgroundMenu

              This is the variable bound to the menu this displays when you press the right button in the grey background area of the screen.


              BackgroundMenuCommands

              This list is used for the list of ITEMS for the background menu when it is created.

              WindowMenu

              This is the variable bound to the default window menu displayed when the right mouse button is pressed inside of a window.


              WindowMenuCommands

              This is the list of ITEMS for the WindowMenu.


              BreakMenu

              The menu displayed when the middle mouse button is pressed in a break

              window.


              BreakMenuCommands

              The list of ITEM for the BreakMenu.


              Windows


              PROMPTWINDOW

              Global name of the prompt window.


              T

              Although the value T has several meanings (such as universal TRUE), it also

              stands for the standard output stream. As this is usually the executive window, it may be used as the name for the TTY Window at the top level. Mouse

              processes have their own TTY Windows. A reference to the window T in a mouse driven function (e.g., a WHENSELECTEFN, Chapter 12) will open a TTY Window for Mouse.


              Miscellaneous

              CLEANUPOPTION

              This is a list of options that you set to automate clean-up after a work session. Example options are listing files, or recompilation. You will want to keep this set to NIL until you become comfortable with the machine.


              FILELST

              The list of all the files you loaded.


              SYSFILES

              The list of all the files you loaded for the SYSOUT file.

              INITIALS

              An atom you can bind to your name. If bound, the editor will add your name, in addition to the date, in the editor comment at the beginning of each function.

              FIRSTNAME

              If this variable is set, the system will use it to greet you personally when you log on to your machine.


              INITIALSLST

              A list of elements of the form (USERNAME . INITIALS) or (USERNAME FIRSTNAME INITIALS). This list is used by the function GREET to set your INITIALS , and your FIRSTNAME when you log in.

              #CAREFULCOLUMNS

              An integer. PRETTYPRINT estimates the number of characters in an atom,

              instead of computing it, for efficiency. Unfortunately, for very long atom names, errors can occur. #CAREFULCOLUMNS is the number of columns from the right within which PRETTYPRINT should compute the number of characters in each

              atom, to prevent these errors. Initially this is set to zero. PRETTYPRINT never computes the number of characters in an atom. If you set it to 20 or 30, when PRETTYPRINT comes within 20 or 30 columns of the right of the window, it will begin computing exactly how many characters are in each atom. This will

              prevent errors.


              DWIMWAIT

              Bound to the number of seconds DWIM should wait before it uses the default response, FIXSPELLDEFAULT , to answer its question.

              FIXSPELLDEFAULT

              Bound to either Y or N. Its value is used as the default answer to questions

              asked by DWIM that you don’t answer in DWIMWAIT seconds. It is initially bound to Y, but is rebound to N when DWIMIFYing.

              \TimeZoneComp

              This is the global variable set to the absolute value of the time offset from Greenwich. For EST, \TimeZoneComp should be set to 5.

          2. OTHER USEFUL REFERENCES

image


Here are some references to works that will be useful to you in addition to this primer. Some of these you have already been referred to, such as:

Sandewall. It appeared in March, 1978, in the ACM Computing Surveys, Volume 10:1, pages 35 - 71.


Each of these articles was reprinted in the book Inter active Prog r amming

Environ ments by David R. Barstow, Howard E. Shrobe, and Erik Sandewail. This

book was published in 1984 by McGraw Hill, NY. The first article can be foun d on pages 19 - 30, the second on pages 83 - 96, and the third on pages 31 - 80.


image

Medley for the Novice, Release 2.0

25-1