line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# This file is part of Language-Befunge |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# This software is copyright (c) 2003 by Jerome Quelin. |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# This is free software; you can redistribute it and/or modify it under |
7
|
|
|
|
|
|
|
# the same terms as the Perl 5 programming language system itself. |
8
|
|
|
|
|
|
|
# |
9
|
3
|
|
|
3
|
|
648
|
use 5.010; |
|
3
|
|
|
|
|
9
|
|
10
|
3
|
|
|
3
|
|
10
|
use strict; |
|
3
|
|
|
|
|
1
|
|
|
3
|
|
|
|
|
48
|
|
11
|
3
|
|
|
3
|
|
6
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
115
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
package Language::Befunge::Ops::Unefunge98; |
14
|
|
|
|
|
|
|
# ABSTRACT: operations supported by a Unefunge-98 interpreter |
15
|
|
|
|
|
|
|
$Language::Befunge::Ops::Unefunge98::VERSION = '5.000'; |
16
|
3
|
|
|
3
|
|
402
|
use Language::Befunge::Ops; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
18
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub get_ops_map { |
19
|
|
|
|
|
|
|
return { |
20
|
7
|
|
|
7
|
1
|
233
|
'0' => \&Language::Befunge::Ops::num_push_number, |
21
|
|
|
|
|
|
|
'1' => \&Language::Befunge::Ops::num_push_number, |
22
|
|
|
|
|
|
|
'2' => \&Language::Befunge::Ops::num_push_number, |
23
|
|
|
|
|
|
|
'3' => \&Language::Befunge::Ops::num_push_number, |
24
|
|
|
|
|
|
|
'4' => \&Language::Befunge::Ops::num_push_number, |
25
|
|
|
|
|
|
|
'5' => \&Language::Befunge::Ops::num_push_number, |
26
|
|
|
|
|
|
|
'6' => \&Language::Befunge::Ops::num_push_number, |
27
|
|
|
|
|
|
|
'7' => \&Language::Befunge::Ops::num_push_number, |
28
|
|
|
|
|
|
|
'8' => \&Language::Befunge::Ops::num_push_number, |
29
|
|
|
|
|
|
|
'9' => \&Language::Befunge::Ops::num_push_number, |
30
|
|
|
|
|
|
|
'a' => \&Language::Befunge::Ops::num_push_number, |
31
|
|
|
|
|
|
|
'b' => \&Language::Befunge::Ops::num_push_number, |
32
|
|
|
|
|
|
|
'c' => \&Language::Befunge::Ops::num_push_number, |
33
|
|
|
|
|
|
|
'd' => \&Language::Befunge::Ops::num_push_number, |
34
|
|
|
|
|
|
|
'e' => \&Language::Befunge::Ops::num_push_number, |
35
|
|
|
|
|
|
|
'f' => \&Language::Befunge::Ops::num_push_number, |
36
|
|
|
|
|
|
|
'"' => \&Language::Befunge::Ops::str_enter_string_mode, |
37
|
|
|
|
|
|
|
"'" => \&Language::Befunge::Ops::str_fetch_char, |
38
|
|
|
|
|
|
|
's' => \&Language::Befunge::Ops::str_store_char, |
39
|
|
|
|
|
|
|
'+' => \&Language::Befunge::Ops::math_addition, |
40
|
|
|
|
|
|
|
'-' => \&Language::Befunge::Ops::math_substraction, |
41
|
|
|
|
|
|
|
'*' => \&Language::Befunge::Ops::math_multiplication, |
42
|
|
|
|
|
|
|
'/' => \&Language::Befunge::Ops::math_division, |
43
|
|
|
|
|
|
|
'%' => \&Language::Befunge::Ops::math_remainder, |
44
|
|
|
|
|
|
|
'>' => \&Language::Befunge::Ops::dir_go_east, |
45
|
|
|
|
|
|
|
'<' => \&Language::Befunge::Ops::dir_go_west, |
46
|
|
|
|
|
|
|
'?' => \&Language::Befunge::Ops::dir_go_away, |
47
|
|
|
|
|
|
|
'[' => \&Language::Befunge::Ops::dir_turn_left, |
48
|
|
|
|
|
|
|
']' => \&Language::Befunge::Ops::dir_turn_right, |
49
|
|
|
|
|
|
|
'r' => \&Language::Befunge::Ops::dir_reverse, |
50
|
|
|
|
|
|
|
'x' => \&Language::Befunge::Ops::dir_set_delta, |
51
|
|
|
|
|
|
|
'!' => \&Language::Befunge::Ops::decis_neg, |
52
|
|
|
|
|
|
|
'`' => \&Language::Befunge::Ops::decis_gt, |
53
|
|
|
|
|
|
|
'_' => \&Language::Befunge::Ops::decis_horiz_if, |
54
|
|
|
|
|
|
|
'|' => \&Language::Befunge::Ops::decis_vert_if, |
55
|
|
|
|
|
|
|
'w' => \&Language::Befunge::Ops::decis_cmp, |
56
|
|
|
|
|
|
|
' ' => \&Language::Befunge::Ops::flow_space, |
57
|
|
|
|
|
|
|
'z' => \&Language::Befunge::Ops::flow_no_op, |
58
|
|
|
|
|
|
|
';' => \&Language::Befunge::Ops::flow_comments, |
59
|
|
|
|
|
|
|
'#' => \&Language::Befunge::Ops::flow_trampoline, |
60
|
|
|
|
|
|
|
'j' => \&Language::Befunge::Ops::flow_jump_to, |
61
|
|
|
|
|
|
|
'k' => \&Language::Befunge::Ops::flow_repeat, |
62
|
|
|
|
|
|
|
'@' => \&Language::Befunge::Ops::flow_kill_thread, |
63
|
|
|
|
|
|
|
'q' => \&Language::Befunge::Ops::flow_quit, |
64
|
|
|
|
|
|
|
'$' => \&Language::Befunge::Ops::stack_pop, |
65
|
|
|
|
|
|
|
':' => \&Language::Befunge::Ops::stack_duplicate, |
66
|
|
|
|
|
|
|
'\\' => \&Language::Befunge::Ops::stack_swap, |
67
|
|
|
|
|
|
|
'n' => \&Language::Befunge::Ops::stack_clear, |
68
|
|
|
|
|
|
|
'{' => \&Language::Befunge::Ops::block_open, |
69
|
|
|
|
|
|
|
'}' => \&Language::Befunge::Ops::block_close, |
70
|
|
|
|
|
|
|
'u' => \&Language::Befunge::Ops::bloc_transfer, |
71
|
|
|
|
|
|
|
'g' => \&Language::Befunge::Ops::store_get, |
72
|
|
|
|
|
|
|
'p' => \&Language::Befunge::Ops::store_put, |
73
|
|
|
|
|
|
|
'.' => \&Language::Befunge::Ops::stdio_out_num, |
74
|
|
|
|
|
|
|
',' => \&Language::Befunge::Ops::stdio_out_ascii, |
75
|
|
|
|
|
|
|
'&' => \&Language::Befunge::Ops::stdio_in_num, |
76
|
|
|
|
|
|
|
'~' => \&Language::Befunge::Ops::stdio_in_ascii, |
77
|
|
|
|
|
|
|
'i' => \&Language::Befunge::Ops::stdio_in_file, |
78
|
|
|
|
|
|
|
'o' => \&Language::Befunge::Ops::stdio_out_file, |
79
|
|
|
|
|
|
|
'=' => \&Language::Befunge::Ops::stdio_sys_exec, |
80
|
|
|
|
|
|
|
'y' => \&Language::Befunge::Ops::sys_info, |
81
|
|
|
|
|
|
|
't' => \&Language::Befunge::Ops::spawn_ip, |
82
|
|
|
|
|
|
|
'(' => \&Language::Befunge::Ops::lib_load, |
83
|
|
|
|
|
|
|
')' => \&Language::Befunge::Ops::lib_unload, |
84
|
|
|
|
|
|
|
'A' => \&Language::Befunge::Ops::lib_run_instruction, |
85
|
|
|
|
|
|
|
'B' => \&Language::Befunge::Ops::lib_run_instruction, |
86
|
|
|
|
|
|
|
'C' => \&Language::Befunge::Ops::lib_run_instruction, |
87
|
|
|
|
|
|
|
'D' => \&Language::Befunge::Ops::lib_run_instruction, |
88
|
|
|
|
|
|
|
'E' => \&Language::Befunge::Ops::lib_run_instruction, |
89
|
|
|
|
|
|
|
'F' => \&Language::Befunge::Ops::lib_run_instruction, |
90
|
|
|
|
|
|
|
'G' => \&Language::Befunge::Ops::lib_run_instruction, |
91
|
|
|
|
|
|
|
'H' => \&Language::Befunge::Ops::lib_run_instruction, |
92
|
|
|
|
|
|
|
'I' => \&Language::Befunge::Ops::lib_run_instruction, |
93
|
|
|
|
|
|
|
'J' => \&Language::Befunge::Ops::lib_run_instruction, |
94
|
|
|
|
|
|
|
'K' => \&Language::Befunge::Ops::lib_run_instruction, |
95
|
|
|
|
|
|
|
'L' => \&Language::Befunge::Ops::lib_run_instruction, |
96
|
|
|
|
|
|
|
'M' => \&Language::Befunge::Ops::lib_run_instruction, |
97
|
|
|
|
|
|
|
'N' => \&Language::Befunge::Ops::lib_run_instruction, |
98
|
|
|
|
|
|
|
'O' => \&Language::Befunge::Ops::lib_run_instruction, |
99
|
|
|
|
|
|
|
'P' => \&Language::Befunge::Ops::lib_run_instruction, |
100
|
|
|
|
|
|
|
'Q' => \&Language::Befunge::Ops::lib_run_instruction, |
101
|
|
|
|
|
|
|
'R' => \&Language::Befunge::Ops::lib_run_instruction, |
102
|
|
|
|
|
|
|
'S' => \&Language::Befunge::Ops::lib_run_instruction, |
103
|
|
|
|
|
|
|
'T' => \&Language::Befunge::Ops::lib_run_instruction, |
104
|
|
|
|
|
|
|
'U' => \&Language::Befunge::Ops::lib_run_instruction, |
105
|
|
|
|
|
|
|
'V' => \&Language::Befunge::Ops::lib_run_instruction, |
106
|
|
|
|
|
|
|
'W' => \&Language::Befunge::Ops::lib_run_instruction, |
107
|
|
|
|
|
|
|
'X' => \&Language::Befunge::Ops::lib_run_instruction, |
108
|
|
|
|
|
|
|
'Y' => \&Language::Befunge::Ops::lib_run_instruction, |
109
|
|
|
|
|
|
|
'Z' => \&Language::Befunge::Ops::lib_run_instruction, |
110
|
|
|
|
|
|
|
}; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
1; |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
__END__ |