xrpn 1.3.2 → 1.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b45b0ae323940d1e746c3e7e506aa99b8bfcfe7b2150b3da8c0b52fa300d636b
4
- data.tar.gz: bf536a88ea59513dab40118fa6e33f3fcb8613dd766864ac34d2b65c5286ab01
3
+ metadata.gz: 1fd6c24bf0ae1e16e943aaf138b71c12d3fb91f96a76db8c4177ab4ff4a0a5f5
4
+ data.tar.gz: 38e57e229c8d739f5967de726866f87b309b1e74be3e42ca65d4807ea4768ea2
5
5
  SHA512:
6
- metadata.gz: 5ce4089504e5db07a0178a8bfb81739f6ce01b3ec45d747fd7e7f1a9de9ebdec6806d467794870d26be1eac060af5cc6971706105e7cdc07837c59686bf2ec49
7
- data.tar.gz: e877789013f4b27f7ec0cff1f2ecbad7044871ebed1418615e825aa112036d333617c0c526511204123da180d8965dea943ed4e299251971e5b2f13729aa040d
6
+ metadata.gz: 8fda5beedc920d94a7711ad6d78908b785cd08ece3909a3e79583045300faf784c1b762640fd79fb1c9a178404b0da8199c4af9f50531a356f455fcb07b38107
7
+ data.tar.gz: 678af3b283e0970dca83f62c8ad85a26a3a4902b59aa0832edbf37308fd1a7dbd25dcd4fd9e250c6ff0f6eb48b4c8ec34cf9bde22f10ad7f2b1d1f855b3e0f10
data/README.md CHANGED
@@ -16,7 +16,7 @@ XRPN implements indirect addressing, self-modification and features well beyond
16
16
 
17
17
  You need Ruby installed to get XRPN to work.
18
18
 
19
- To install XRPN, you can do `gem install 'xrpn'` or by cloning this repository and run the script `INSTALL.sh`. It is only tested on Linux but should work well on Mac OS and BSD systems. If you are on Windows, please tell me if it works in that environment. The install script will put create a symbolic link in your home directory - named ".xrpn" to make it a hidden directory - pointing to the cloned repo. It will also attempt to add a symlink to "~/bin" to make it easy to run XRPN. If you install XRPN by cloning this repo, you also need to install the Ruby Gem tty-prompt: `gem install tty-prompt`. If you install via `gem install 'xrpn'`, then this dependency is automatically taken care of. The gem is slower on startup than running XRPN from this repo.
19
+ To install XRPN, you can do `gem install 'xrpn'` or by cloning this repository and run the script `INSTALL.sh`. It is only tested on Linux but should work well on Mac OS and BSD systems. If you are on Windows, please tell me if it works in that environment. The install script will put create a symbolic link in your home directory - named ".xrpn" to make it a hidden directory - pointing to the cloned repo. It will also attempt to add a symlink to "~/bin" to make it easy to run XRPN. If you install XRPN by cloning this repo, you also need to install the Ruby Gem tty-prompt: `gem install tty-prompt`. If you install via `gem install 'xrpn'`, then this dependency is automatically taken care of. The gem is slower on startup than running XRPN from this repo. Also, `speaker-test` must be installed to play tones, but this is preinstalled on most Lunux/BSD systems.
20
20
 
21
21
  ## Run
22
22
 
data/xcmd/beep CHANGED
@@ -1,7 +1,15 @@
1
1
  class XRPN
2
2
  # Sound the legendary HP-41 BEEP
3
3
  def beep
4
- `xdg-open ~/.xrpn/extra/beep41.wav`
4
+ t = [175, 197, 225, 263, 315, 394, 525, 629, 788, 1051]
5
+ begin
6
+ %x|speaker-test -t sine -f #{t[7]} -l 1 1> /dev/null 2>& 1 & sleep .28 && kill -9 $!|
7
+ %x|speaker-test -t sine -f #{t[5]} -l 1 1> /dev/null 2>& 1 & sleep .28 && kill -9 $!|
8
+ %x|speaker-test -t sine -f #{t[8]} -l 1 1> /dev/null 2>& 1 & sleep .28 && kill -9 $!|
9
+ %x|speaker-test -t sine -f #{t[7]} -l 1 1> /dev/null 2>& 1 & sleep .28 && kill -9 $!|
10
+ rescue
11
+ puts "speaker-test must be installed to play tones"
12
+ end
5
13
  end
6
14
  end
7
15
 
data/xcmd/copy ADDED
@@ -0,0 +1,23 @@
1
+ class XRPN
2
+ # Copy file named in Alpha to filename in X
3
+ def copy
4
+ begin
5
+ require 'fileutils'
6
+ rescue
7
+ puts "Ruby FileUtils needs to be installed."
8
+ return
9
+ end
10
+ item = @a
11
+ dest = @x
12
+ while File.exist?(dest)
13
+ dest = dest.chop + (dest[-1].to_i + 1).to_s
14
+ end
15
+ begin
16
+ FileUtils.cp_r(item, dest)
17
+ rescue StandardError => err
18
+ puts err.to_s
19
+ end
20
+ end
21
+ end
22
+
23
+ # vim:ft=ruby:
data/xcmd/move ADDED
@@ -0,0 +1,23 @@
1
+ class XRPN
2
+ # Move file named in Alpha to filename in X
3
+ def move
4
+ begin
5
+ require 'fileutils'
6
+ rescue
7
+ puts "Ruby FileUtils needs to be installed."
8
+ return
9
+ end
10
+ item = @a
11
+ dest = @x
12
+ while File.exist?(dest)
13
+ dest = dest.chop + (dest[-1].to_i + 1).to_s
14
+ end
15
+ begin
16
+ FileUtils.mv(item, dest)
17
+ rescue StandardError => err
18
+ puts err.to_s
19
+ end
20
+ end
21
+ end
22
+
23
+ # vim:ft=ruby:
data/xcmd/open ADDED
@@ -0,0 +1,24 @@
1
+ class XRPN
2
+ # Open a file system file or make directory the current directory
3
+ def open
4
+ if File.directory?(@a) # Rescue for permission error
5
+ begin
6
+ Dir.chdir(@a)
7
+ rescue
8
+ puts "Cannot move to directory \"#{@a}\""
9
+ end
10
+ else
11
+ begin
12
+ if File.read(@a).force_encoding("UTF-8").valid_encoding?
13
+ system("exec $EDITOR #{@a}")
14
+ else
15
+ Thread.new { system("xdg-open #{@a} 2>/dev/null") }
16
+ end
17
+ rescue
18
+ puts "Cannot open file \"#{@a}\""
19
+ end
20
+ end
21
+ end
22
+ end
23
+
24
+ # vim:ft=ruby:
data/xcmd/pprg1 ADDED
@@ -0,0 +1,28 @@
1
+ class XRPN
2
+ # Print program
3
+ def pprg
4
+ page = @pg
5
+ pos = 0
6
+ if @a != ""
7
+ pr = "\"#{@a}\""
8
+ page, pos, prgm = locate_prg (pr)
9
+ if pos == nil
10
+ puts "No such program to print #{pr}"
11
+ return
12
+ end
13
+ end
14
+ @prg[page].each_index do |i|
15
+ next if i < pos
16
+ print "#{format('%02d', i + 1)}"
17
+ if @prg[page][i].downcase.match(/lbl/)
18
+ print "◆"
19
+ else
20
+ print " "
21
+ end
22
+ puts "#{@prg[page][i]}"
23
+ break if @prg[page][i] == "END"
24
+ end
25
+ end
26
+ end
27
+
28
+ # vim:ft=ruby:
data/xcmd/read ADDED
@@ -0,0 +1,12 @@
1
+ class XRPN
2
+ # Reads content of file named in Alpha into X
3
+ def read
4
+ begin
5
+ @x = File.read(@a).chomp
6
+ rescue
7
+ puts "Cannot read file \"#{@a}\""
8
+ end
9
+ end
10
+ end
11
+
12
+ # vim:ft=ruby:
data/xcmd/tone ADDED
@@ -0,0 +1,15 @@
1
+ class XRPN
2
+ # Sound a tone (0-9)
3
+ def tone (r)
4
+ r = r.to_i
5
+ return unless (0..9).include?(r)
6
+ t = [175, 197, 225, 263, 315, 394, 525, 629, 788, 1051]
7
+ begin
8
+ %x|speaker-test -t sine -f #{t[r]} -l 1 1> /dev/null 2>& 1 & sleep .28 && kill -9 $!|
9
+ rescue
10
+ puts "speaker-test must be installed to play tones"
11
+ end
12
+ end
13
+ end
14
+
15
+ # vim:ft=ruby:
data/xcmd/tonexy ADDED
@@ -0,0 +1,14 @@
1
+ class XRPN
2
+ # Sound a tone with frequency in X and length (in sec) in Y
3
+ def tonexy
4
+ f = @x.to_f
5
+ l = @y.to_f
6
+ begin
7
+ %x|speaker-test -t sine -f #{f} -l 1 1> /dev/null 2>& 1 & sleep #{l} && kill -9 $!|
8
+ rescue
9
+ puts "speaker-test must be installed to play tones"
10
+ end
11
+ end
12
+ end
13
+
14
+ # vim:ft=ruby:
data/xlib/debug_mode CHANGED
@@ -44,7 +44,7 @@ def debug_mode
44
44
  @p.flg = {}
45
45
  system("clear")
46
46
  when "R" # Reload all commands from the cmd directory
47
- read_cmd
47
+ read_xcmd
48
48
  puts "Commands reloaded."
49
49
  when "l" # Show current line
50
50
  @line = @p.prg[@p.pg][@p.pc]
data/xrpn.gemspec CHANGED
@@ -1,9 +1,9 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'xrpn'
3
- s.version = '1.3.2'
3
+ s.version = '1.3.4'
4
4
  s.licenses = ['Unlicense']
5
5
  s.summary = "XRPN - The eXtended RPN (Reverse Polish Notation) programming language"
6
- s.description = "A full programming language and environment extending the features of the venerable HP calculator programmable calculators. With XRPN you can accomplish a wide range of modern programming tasks as well as running existing HP-41 FOCAL programs directly. XRPN gives modern life to tens of thousands of old HP calculator programs and opens the possibilities to many, many more. New in 1.3.2: Bug fixes."
6
+ s.description = "A full programming language and environment extending the features of the venerable HP calculator programmable calculators. With XRPN you can accomplish a wide range of modern programming tasks as well as running existing HP-41 FOCAL programs directly. XRPN gives modern life to tens of thousands of old HP calculator programs and opens the possibilities to many, many more. New in 1.3.4: Added file system commands READ, OPEN, COPY, MOVE."
7
7
 
8
8
  s.authors = ["Geir Isene"]
9
9
  s.email = 'g@isene.com'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xrpn
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-21 00:00:00.000000000 Z
11
+ date: 2023-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tty-prompt
@@ -28,7 +28,8 @@ description: 'A full programming language and environment extending the features
28
28
  the venerable HP calculator programmable calculators. With XRPN you can accomplish
29
29
  a wide range of modern programming tasks as well as running existing HP-41 FOCAL
30
30
  programs directly. XRPN gives modern life to tens of thousands of old HP calculator
31
- programs and opens the possibilities to many, many more. New in 1.3.2: Bug fixes.'
31
+ programs and opens the possibilities to many, many more. New in 1.3.4: Added file
32
+ system commands READ, OPEN, COPY, MOVE.'
32
33
  email: g@isene.com
33
34
  executables:
34
35
  - xrpn
@@ -94,6 +95,7 @@ files:
94
95
  - xcmd/cmdadd
95
96
  - xcmd/cmddel
96
97
  - xcmd/cmdhelp
98
+ - xcmd/copy
97
99
  - xcmd/correct
98
100
  - xcmd/cos
99
101
  - xcmd/crflas
@@ -174,11 +176,13 @@ files:
174
176
  - xcmd/mdy
175
177
  - xcmd/mean
176
178
  - xcmd/mod
179
+ - xcmd/move
177
180
  - xcmd/multiply
178
181
  - xcmd/oct
179
182
  - xcmd/octdec
180
183
  - xcmd/off
181
184
  - xcmd/on
185
+ - xcmd/open
182
186
  - xcmd/p_r
183
187
  - xcmd/pack
184
188
  - xcmd/page
@@ -195,6 +199,7 @@ files:
195
199
  - xcmd/posfl
196
200
  - xcmd/pow
197
201
  - xcmd/pprg
202
+ - xcmd/pprg1
198
203
  - xcmd/pprgx
199
204
  - xcmd/pra
200
205
  - xcmd/prflags
@@ -218,6 +223,7 @@ files:
218
223
  - xcmd/rclpta
219
224
  - xcmd/rclsw
220
225
  - xcmd/rdn
226
+ - xcmd/read
221
227
  - xcmd/recip
222
228
  - xcmd/regmove
223
229
  - xcmd/regswap
@@ -269,6 +275,8 @@ files:
269
275
  - xcmd/tan
270
276
  - xcmd/tenx
271
277
  - xcmd/time
278
+ - xcmd/tone
279
+ - xcmd/tonexy
272
280
  - xcmd/tx
273
281
  - xcmd/version
274
282
  - xcmd/view