| 1 | # Stuff used by all the Language::Basic packages | ||
| 2 | package Language::Basic::Common; | ||
| 3 | |||
| 4 | 16 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 16 | ▶ | use vars qw(@ISA @EXPORT @EXPORT_OK); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 16 | ▶ | BEGIN{ |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 16 | ▶ | use Exporter (); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 16 | @ISA = qw(Exporter); | |
| 10 | 16 | @EXPORT = qw( | |
| 11 | &Exit_Error | ||
| 12 | ); | ||
| 13 | } | ||
| 14 | |||
| 15 | # Declare some "type" packages, String, Boolean, Numeric. | ||
| 16 | # Need to declare them here because several sets of classes inherit | ||
| 17 | # from them. E.g., LB::Variables and LB::Expressions | ||
| 18 | { | ||
| 19 | 16 | package Language::Basic::String; | |
| 20 | package Language::Basic::Boolean; | ||
| 21 | package Language::Basic::Numeric; | ||
| 22 | } | ||
| 23 | |||
| 24 | # THis sub prints out an error and exits the program. | ||
| 25 | 0 | ▶ | sub Exit_Error { |
|
Subroutine
Exit_Error: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 26 | 0 | my $err = shift; | |
| 27 | 0 | my $prog = &Language::Basic::Program::current_program; | |
| 28 | 0 | my $error_line = $prog->current_line_number; | |
| 29 | |||
| 30 | 0 | STDOUT->flush; # in case we're in the middle of a PRINT statement... | |
| 31 | 0 | warn "\nError in line $error_line: $err\n"; | |
| 32 | # TODO change to "set_goto_line(undef)" so we can continue on | ||
| 33 | # another program if we're running two simultaneously! | ||
| 34 | 0 | exit (1); | |
| 35 | } | ||
| 36 | |||
| 37 | 16 | 1; | |