The Error Message Processor

mvBase permits powerful formatting control when printing error messages. The following are examples:

You may create an error message and display that message on the screen at a specified location. This is done by using @(row,column) and @(column) cursor addressing directives, and @(-n) screen functions. The parameters used to specify the location of the message may have the following formats:

Parameter(s)

n

Where n is a literal numeric value.

A

Where A is the next error message parameter value.

A+n

Where the numeric value n is added to the next error message parameter value A.

A-n

Where the numeric value n is subtracted from the next error message parameter value A.

A*n

Where the next error message parameter value A is multiplied by the numeric value n.

A/n

Where the next error message parameter value A is divided by the numeric value n.

Parameters 5 and 7 are passed to the error message ERROR1A:

ID:

ERROR1A

 

001

@(A,A)

Outputs at position (5,7)

002

H** x=5 y=7 **

Outputs ** x=5 y=7 **

003

S1

Resets pointer to parameter #1

004

@(A+3,A)

Outputs at position (8,7)

005

H** x=8 y=7 **

Outputs ** x=8 y=7 **

006

S1

Resets pointer to parameter #1

007

@(A,A-3)

Outputs at position (5,4)

008

H** x=5 y=4 **

Outputs ** x=5 y=4 **

009

S1

Resets pointer to parameter #1

010

@(A*3,A/1)

Outputs at position (15,7)

011

H** x=15 y=7 **

Outputs ** x=15 y=7 **

The parameters that can be passed to the error message (using mvBASIC STOP, ABORT or PRINTERR statements) may be accessed in any sequence and may be reused if necessary. The advantages of this are:

Parameters 12 and 17 are passed to the error message, ERROR1:

ID:

ERROR1

 

001

@(A,A)

Outputs at position (12,17)

002

H** x=12 y=17 **

Outputs ** x=12 y=17 **

003

S1

Resets pointer to parameter #1

004

@(A+3,A)

Outputs at position (15,17)

005

H** x=15 y=17 **

Outputs ** x=15 y=17 **

The enhanced S command used in the ERROR1 example is now able to use numeric literal parameters without parenthesis ( ). For example, instead of using S(1), S1 may be used.  is a numeric literal. In the previous example, the internal pointer is reset to parameter #1. Use the format:

S{nnn / (nnn)}

Suppose the three parameters X, Y and Z are passed to the following error message, ERROR2:

ID:

ERROR2

 

001

E

Outputs ID:ERROR2

002

A(2)

Outputs X

003

A(2)

Outputs Y

004

A(2)

Outputs Z

005

S2

Resets pointer to parameter #2

006

A(2)

Outputs Y

007

A(2)

Outputs Z

The following message will be displayed: ERROR2, X, Y, Z followed by Y, then Z.

Suppose parameters 10 and 15 are passed to the following error message, ERROR3:

ID:

ERROR3

 

001

@(A,A)

Outputs at position (10,15)

002

H**********

Outputs **********

003

S1

Resets pointer to parameter #1

004

@(A+1,A)

Outputs at position (11,15)

005

H* WINDOW *

Outputs * WINDOW *

006

S1

Resets pointer to parameter #1

007

@(A+2,A)

Outputs at position (12,15)

008

H**********

Outputs **********

The following message will be displayed at the base coordinate @(10,15):

***************

* WINDOW *

***************

 

NOTE

 After parameters are referenced (using the A, R and X commands), the internal pointer advances to the next available parameter. For example, in ERROR2 the A command references parameter X and the internal pointer advances to the next parameter Y. The error message ID is interpreted as parameter 0 (as with PROC). Therefore, specifying S0 within your error message will allow the ID to be used and reused by the next parameter referenced.

You may use ASCII codes in error messages. The Error Message Processor will translate the code from a decimal number to its ASCII equivalent. Functions previously impossible to perform from within an error message can be performed. For example, a peripheral escape sequence can be easily added to an error message as show below.

Format

C(code)

Parameter(s)

code

Decimal ASCII character that the Error Message Processor will translate.

Example

C(27)

The example above outputs the ASCII <ESCAPE> character.

Any command line in the error message beginning with a question mark (?) will require a keystroke from the terminal before allowing the program to continue. This ensures that the user has a chance to see the error message before it is cleared from view by the next output screen.

Any line beginning with an exclamation mark (!) will be interpreted as a comment and will be ignored by the Error Message Processor. This feature allows you to add documentation to your error messages.

See Also

Overview of mvBASIC Statements and Functions

Assignment Statements

Intrinsic Functions

Internal Program Control

External Program Control

Sending Output to the Screen and Printer

Terminal Input

Dynamic Array Processing

Generalized String Processing

Dimensioned Arrays

Reading and Updating File Items

Reading and Writing Tapes or Floppy Disks

Communications

Execution Locks

Compiler Directives

Miscellaneous Statements and Functions