| 1 | package Language::Zcode::Runtime::Text; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | =head1 NAME | ||
| 7 | |||
| 8 | Language::Zcode::Runtime::Text | ||
| 9 | |||
| 10 | =head1 DESCRIPTION | ||
| 11 | |||
| 12 | This class handles different kinds of text: input, output, etc. | ||
| 13 | |||
| 14 | Actually, it holds a bunch of subclasses, so that a piece of text | ||
| 15 | knows what kind of text it is: text that was input with a keyboard | ||
| 16 | or a file, text that was read a line at a time vs. char by char, etc. | ||
| 17 | |||
| 18 | =cut | ||
| 19 | |||
| 20 | |||
| 21 | sub new { | ||
| 22 | my ($class, $str) = @_; | ||
| 23 | bless \$str, $class; | ||
| 24 | } | ||
| 25 | |||
| 26 | |||
| 27 | =head2 Language::Zcode::Runtime::Text::Output | ||
| 28 | |||
| 29 | Text that's being output | ||
| 30 | |||
| 31 | =cut | ||
| 32 | |||
| 33 | package Language::Zcode::Runtime::Text::Output; | ||
| 34 | @Language::Zcode::Runtime::Text::Output::ISA = qw(Language::Zcode::Runtime::Text); | ||
| 35 | |||
| 36 | =head2 Language::Zcode::Runtime::Text::Input | ||
| 37 | |||
| 38 | Text that was input (line or char, from a file or the screen) | ||
| 39 | |||
| 40 | =cut | ||
| 41 | |||
| 42 | package Language::Zcode::Runtime::Text::Input; | ||
| 43 | @Language::Zcode::Runtime::Text::Input::ISA = qw(Language::Zcode::Runtime::Text); | ||
| 44 | |||
| 45 | =head2 Language::Zcode::Runtime::Text::Input::Keypress | ||
| 46 | |||
| 47 | One keypress (read_char, mouse button). | ||
| 48 | |||
| 49 | =cut | ||
| 50 | |||
| 51 | package Language::Zcode::Runtime::Text::Input::Keypress; | ||
| 52 | @Language::Zcode::Runtime::Text::Input::Keypress::ISA = qw(Language::Zcode::Runtime::Text::Input); | ||
| 53 | |||
| 54 | =head2 Language::Zcode::Runtime::Text::Input::Line | ||
| 55 | |||
| 56 | One full line ('read' opcode). | ||
| 57 | |||
| 58 | =cut | ||
| 59 | |||
| 60 | package Language::Zcode::Runtime::Text::Input::Line; | ||
| 61 | @Language::Zcode::Runtime::Text::Input::Line::ISA = qw(Language::Zcode::Runtime::Text::Input); | ||
| 62 | |||
| 63 | =head2 Language::Zcode::Runtime::Text::Input::Screen | ||
| 64 | |||
| 65 | Thing read from the screen (keyboard, mouse, etc.) | ||
| 66 | |||
| 67 | =cut | ||
| 68 | |||
| 69 | package Language::Zcode::Runtime::Text::Input::Screen; | ||
| 70 | @Language::Zcode::Runtime::Text::Input::Screen::ISA = qw(Language::Zcode::Runtime::Text::Input); | ||
| 71 | |||
| 72 | =head2 Language::Zcode::Runtime::Text::Input::Screen::Line | ||
| 73 | |||
| 74 | Full line command read from the screen, not from a file | ||
| 75 | |||
| 76 | =cut | ||
| 77 | |||
| 78 | package Language::Zcode::Runtime::Text::Input::Screen::Line; | ||
| 79 | @Language::Zcode::Runtime::Text::Input::Screen::Line::ISA = | ||
| 80 | qw(Language::Zcode::Runtime::Text::Input::Screen Language::Zcode::Runtime::Text::Input::Line); | ||
| 81 | |||
| 82 | =head2 Language::Zcode::Runtime::Text::Input::Screen::Keypress | ||
| 83 | |||
| 84 | Single key read from the screen, not from a file | ||
| 85 | |||
| 86 | =cut | ||
| 87 | |||
| 88 | package Language::Zcode::Runtime::Text::Input::Screen::Keypress; | ||
| 89 | @Language::Zcode::Runtime::Text::Input::Screen::Keypress::ISA = | ||
| 90 | qw(Language::Zcode::Runtime::Text::Input::Screen Language::Zcode::Runtime::Text::Input::Keypress); | ||
| 91 | |||
| 92 | ############################### | ||
| 93 | |||
| 94 | =head2 Language::Zcode::Runtime::Text::Input::File | ||
| 95 | |||
| 96 | Thing read from a file | ||
| 97 | |||
| 98 | =cut | ||
| 99 | |||
| 100 | package Language::Zcode::Runtime::Text::Input::File; | ||
| 101 | @Language::Zcode::Runtime::Text::Input::File::ISA = qw(Language::Zcode::Runtime::Text::Input); | ||
| 102 | |||
| 103 | =head2 Language::Zcode::Runtime::Text::Input::File::Line | ||
| 104 | |||
| 105 | Full line command read from a file | ||
| 106 | |||
| 107 | =cut | ||
| 108 | |||
| 109 | package Language::Zcode::Runtime::Text::Input::File::Line; | ||
| 110 | @Language::Zcode::Runtime::Text::Input::File::Line::ISA = | ||
| 111 | qw(Language::Zcode::Runtime::Text::Input::File Language::Zcode::Runtime::Text::Input::Line); | ||
| 112 | |||
| 113 | =head2 Language::Zcode::Runtime::Text::Input::File::Keypress | ||
| 114 | |||
| 115 | Single key read from a file | ||
| 116 | |||
| 117 | =cut | ||
| 118 | |||
| 119 | package Language::Zcode::Runtime::Text::Input::File::Keypress; | ||
| 120 | @Language::Zcode::Runtime::Text::Input::File::Keypress::ISA = | ||
| 121 | qw(Language::Zcode::Runtime::Text::Input::File Language::Zcode::Runtime::Text::Input::Keypress); | ||
| 122 | |||
| 123 | 1; # End package Language::Zcode::Runtime::Text |