next up previous contents index
Next: Temporarily diverting program flow Up: Subroutines and external files Previous: Defining export channels

Unconditionally switching program flow

 


tex2html_wrap_inline33790 tex2html_wrap_inline33790 Syntax

  1. BD>goto : @L tex2html_wrap_inline33712

  2. BD>goto : @L(C) tex2html_wrap_inline33712

  3. BD>goto : (C) tex2html_wrap_inline33712

where L is the name of a label and tex2html_wrap_inline33870 is a valid input channel number.

tex2html_wrap_inline33806 tex2html_wrap_inline33806

The GOTO:  command is used to switch program flow unconditionally to the address given. This command is thus the memoryless analogue of the M:  command, and is not linked with a RETURN:  command. You should be careful if you want to jump out of FOR:  loops. The GOTO:  command is not associated with a return address: therefore whenever the end-of-file marker is encountered after a GOTO:  command has been issued, the program returns to the address associated with the most recent M:  command or stops otherwise. The same holds when a RETURN:  command is encountered after a GOTO:  command. See the discussion in §2.7 for further details.

If the first form of the command is issued, with no channel number being specified, the channel number is deduced - [B/D] does not allow duplicate labels. In the third form of the syntax, the beginning of the file associated with the input channel is indicated. In common with other macro facilities, the channel number can be zero (meaning the keyboard): a label should not be supplied in this case. The address implied by the channel and label supplied must exist at the time the command is issued.

Commands which might result in diverting program flow (GOTO: , M: , and RETURN: ) must be issued on a separate line; otherwise an error is reported. Hence the following usage is not permitted:

BD>for : i=1,1,2 tex2html_wrap_inline33876 goto : @test[i] tex2html_wrap_inline33712

The following fragments of code show three examples.

BD>goto : @lisbon tex2html_wrap_inline33712

BD>goto : @lisbon(2) tex2html_wrap_inline33712

BD>goto : (2) tex2html_wrap_inline33712

The first example refers explicitly to the label ``@lisbon''. No channel number is given, so [B/D] will search all the input channels for a match. There may be at most one match as [B/D] does not permit duplicate labels. The address thus consists of the given label, on a channel which will be deduced. In the second example, the address consists explicitly of a label and a channel number. In the third example, no label is given, and the top of the external file associated with input channel number 2 will be assumed as the required address.  


next up previous contents index
Next: Temporarily diverting program flow Up: Subroutines and external files Previous: Defining export channels

David Wooff
Wed Oct 21 15:14:31 BST 1998