.ds [ [\\s-2 .ds ] \\s+2] .ds _ \\v'+0u'\(ru\\v'-0u'\| .ds * \\v'+18u'\s+2*\s0\\v'-18u'\"lower and larger .if t .ds dg \\(dg .if n .ds dg * .if t .ds .3 .4v .if n .ds .3 1v .TH B 1 local .tr ** .SH NAME b \- .I B interpreter & environment .SH SYNOPSIS .TP 12n .B b Starts the .I B interpreter .TP .B "b \-e" Starts the .I B interpreter, using the editor defined in the environment variable \%EDITOR (\fIvi\fP default) .TP .BI "b\ " "file ..." Makes the .I B interpreter execute the .I B commands in the named file or files. Input for .I READ is taken from standard input. .TP .BI "b\ \-i\ " table An empty permanent table .I table is created; standard input is read, and its lines (considered as texts) are successively put in .I "table[1], table[2], ..." .TP .BI "b\ \-o\ " table The associates of the permanent table .I table are written to standard output, one to a line. .TP .B "b \-l" The units in the workspace are listed on the standard output. .TP .B "b \-p" The units in the workspace are printed on the system's printer. .SH DESCRIPTION A .I B `work-space' corresponds to a UNIX directory in which the units and permanent targets are kept as separate files. .PP A call of .I b starts the .I B interpreter; commands can be entered and will be performed immediately. The .I B system takes over control of the screen; it reacts immediately to each key pressed. There is a repertoire of editing operations using function keys and control characters, which may be used to edit the input. A description of all editing operations is given in the User's Guide. The manual entry .IR bterminal (5) tells you how the binding of the operations to your terminal's keys can be changed. Here we describe the basic mechanisms using the default key bindings, as listed in the summary at the end. .PP When the first letter of a command is typed (upper case is not necessary), a possible continuation is .I suggested on the display. The suggestion can be accepted by pressing the \*[TAB\*] key; this moves the cursor to the first .I hole (shown as `?') in the suggestion, or to the end of the line if there is none. The suggestion can also be ignored; when more characters are typed the suggestion is changed to conform to these, or removed if nothing applies. .PP When a command has been completed, it can be executed by pressing \*[RETURN\*]. For control commands such as IF and FOR, \*[RETURN\*] moves the cursor to an indented position on the next line, awaiting entry of the `body' of the control command, which may consist of any number of lines. When \*[RETURN\*] is pressed twice in succession, this reduces the indentation level; the command is executed when the indentation level is back to zero. .PP Corrections can be made by pressing the \*[BACKSPACE\*] key. This cancels the effect of any key pressed, including \*[TAB\*] and the editing operations, as well as \*[RETURN\*] within a control command. Repetition of \*[BACKSPACE\*] cancels more keys, to a maximum of 100 (currently). Once execution of a command has started, it cannot be corrected, though it can be stopped by pressing \*[BREAK\*] at any time. If the copy-buffer is empty (see the Copy command), the last command executed, last input provided or last text deleted is saved in the buffer, and can be retrieved with \*[control-C\*]. It may then be edited using standard editing operations. .PP When the user types the first line of a HOW\(fmTO-, YIELD- or TEST-command, editing of the unit continues in a similar way to editing an IF or FOR command. The user can complete the unit through standard editing operations, and finish by pressing \*[control-X\*] or several \*[RETURN\*]s. Further commands can then be given. .PP An existing unit can be edited by typing, on the command level, a colon .RB ( : ) followed by the unit name. Similarly, an existing target can be edited by typing an equals-sign .RB ( = ) followed by the target name. The name may be left out in subsequent edit requests for the same object, or for the unit that most recently caused an error message. .PP When a unit that is being edited gets longer than the screen size, a scroll bar will be displayed at the bottom of the screen. It shows approximately which part of the unit is visible on the screen. If your terminal has the Goto operation, and you .I goto some place on the scroll bar, the .I B system will reposition the visible part of the unit accordingly. .PP A double colon .RB ( :: ) given at the command level lists the headings of the units in the present workspace. Likewise, a double equals-sign .RB ( == ) gives the names of the permanent targets. .PP A call of .B "b \-e" starts the .I B interpreter, but uses the editor defined by the environment variable \%EDITOR. If this is not set then .I vi is used. The editor is then only used for entering units, or editing existing units; immediate commands cannot be edited. .PP The other calls of .I b do not activate the interpreter, but provide communication between the workspace and UNIX, as described above in the synopsis. .SH FILES .ta 4c .nf \&$HOME/.Bed\*_buf copy buffer (if locked) between sessions \&$HOME/.Bed\*_pos focus position of last 50 edited units \&.b\*_perm table mapping object names to file names \&.b\*_temp scratch file \&.Bed\*_sugg suggestion list for user-defined commands \&\(fm*, <\**, "\**, >\** units in this workspace =\** permanent targets in this workspace .fi .SH SEE ALSO .in +.5i .ti -.5i bterminal(5) .sp .3v .ti -.5i Lambert Meertens, .I "Draft Proposal for the B Programming Language; Semi-formal Definition," Mathematical Centre, 1982. .ti -.5i Lambert Meertens and Steven Pemberton, .I "Description of B," CWI (\%formerly \%Mathematical \%Centre), 1984. Also: SIGPLAN Notices, Vol. .BR 20 , No.2, February 1985. .ti -.5i Steven Pemberton, .I "A User's Guide to the B System," CWI, 1984. .ti -.5i .I "B Quick Reference card." Available from CWI. .ti -.5i Leo Geurts, .I "Computer Programming for Beginners," .I "Introducing the B Language; Part 1," CWI, 1984. (Also available in Dutch.) .ti -.5i Leo Geurts, .I "An Overview of the B Programming Language," .I "or B without Tears," SIGPLAN Notices, Vol. .BR 17 , No. 12, December 1982. .SH AUTHORS Frank van Dijk, Leo Geurts, Timo Krijnen, Lambert Meertens, Steven Pemberton, Guido van Rossum .fi .bp .SH SUMMARY OF EDITING OPERATIONS .ta 2.5c 5.5c .if n .ta 10 27 .nf .sp \*(.3 Name Default Keys\*(dg Short description .sp Accept \*[TAB\*] Accept suggestion, focus to hole or end of line Return \*[RETURN\*] Add line or decrease indentation .sp \*(.3 Widen \fIf1\fP, \*[ESC\*] w Widen focus First \fIf2\fP, \*[ESC\*] f Move focus to first contained item Last \fIf3\fP, \*[ESC\*] l Move focus to last contained item Extend \fIf4\fP, \*[ESC\*] e Extend focus (usually to the right) .sp \*(.3 Upline \fIf5\fP, \*[ESC\*] u Move focus to whole line above Previous \fIf6\fP, \*[ESC\*] p Move focus to previous item Next \fIf7\fP, \*[ESC\*] n Move focus to next item Downline \fIf8\fP, \*[ESC\*] d Move focus to whole line below .sp \*(.3 Up \(ua, \*[ESC\*] U Make new hole, move up Down \(da, \*[ESC\*] D Make new hole, move down Left \(<-, \*[ESC\*] , Make new hole, move left Right \(->, \*[ESC\*] . Make new hole, move right .sp \*(.3 Goto \*[ctrl-G\*] New focus at cursor position .sp \*(.3 Undo \*[BACKSPACE\*] Undo effect of last key pressed (may be repeated) Redo \*[ctrl-U\*] Redo last UNDOne key (may be repeated) .sp \*(.3 Delete \*[ctrl-D\*] Delete contents of focus (to buffer if empty) Copy \*[ctrl-C\*] Copy buffer to hole, or focus to buffer .sp \*(.3 Record \*[ctrl-R\*] Start/stop recording keystrokes Play \*[ctrl-P\*] Play back recorded keystrokes .sp \*(.3 Look \*[ctrl-L\*] Redisplay screen Help \*[ESC\*]? Print summary of editing operations .sp \*(.3 Exit \*[ctrl-X\*] Finish changes or execute command Interrupt \*[BREAK\*], \*[DEL\*] Interrupt command execution .fi .sp 2 \*(dg Notes: .sp \*(.3 The binding of editing operations to keys may be different for your terminal; see .IR bterminal (5) for more information. .sp \*(.3 Keys named .I f1...f8 are .I "function keys." The way to type these is terminal-dependent. The codes they send must be defined by the termcap entry for your terminal. See .IR bterminal (5). .sp \*(.3 If a terminal has arrow keys \(ua, \(<-, \(->, \(da which transmit codes to the computer, these should be used for Up, Down, Left and Right. Again, the termcap entry must define the codes. .br The Goto operation can only be used if the cursor can be moved locally at the terminal; the Goto operation will sense the terminal for the cursor position, using two extra non-standard termcap capabilities; see .IR bterminal (5) for more details. .sp \*(.3 If you have set your interrupt character with .IR stty (1) to something other than \*[DEL\*], you can type \*[ctrl-]\*] for Interrupt. .sp \*(.3 \*[Ctrl-D\*] means: hold the \*[CTRL\*] (or \*[CONTROL\*]) key down while pressing d. .sp \*(.3 \&\*[ESC\*] w means: press the \*[ESC\*] key first, then w.