xrpn 1.9.1 → 2.0

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: a506c2229e1ac07680bb7885f8ee929e6fe24208070b1f6be31b13974796cb17
4
- data.tar.gz: cc2e596c179dc3b2fe86c434d9545d71b21f505059920359e8ebf7d0f548d213
3
+ metadata.gz: b9008be323da1eee11b22525fc7a1ca512a7682a12cbe03f8a7cb0964a5a80d5
4
+ data.tar.gz: 2e70c297fd2e010fdb85c7b078ffa79da3bff4b06aab3154de79c083a12430be
5
5
  SHA512:
6
- metadata.gz: 8231b1b1bd0d11121da97380a52c944c932532ce67348a3587f699add4d094465cd778bfb903cccc7080c0c4e63982893c9a0e50b5ddb415f78502338975754f
7
- data.tar.gz: 8815fa3fca80c8cf7e7210952162167d6e4ca8ed2ecbac09e6a7ca47b76d3fb57fc045d6358fb64071a80d6549bd2f0fd2fbf1e284e7325fdc49936bcb625024
6
+ metadata.gz: '093cf06d45e2db7c771acde846fe23119aa040bc0a13b4f509bed71371750e0cfbcfee0563cc3e01d72d7f36acb0bbd7dd80521a419ba1749e5cf447ec7a59b3'
7
+ data.tar.gz: 8041978530c6fb78fb50a8f63efb662513a588e1b4b047ac620432789b1a364c92426cb7135575e217cac198eb1d0276572ddaec0fefab3d0850a7b3aa9abfe8
data/bin/xrpn CHANGED
@@ -23,12 +23,8 @@ require 'bigdecimal'
23
23
  require 'open-uri'
24
24
  require 'json'
25
25
  require 'tty-prompt'
26
+ require 'timeout'
26
27
 
27
- $gem = nil
28
- begin
29
- $gem = Gem.latest_spec_for("xrpn").gem_dir
30
- rescue
31
- end
32
28
 
33
29
  # ENSURE DIRs
34
30
  Dir.mkdir(Dir.home + "/.xrpn") unless File.exist?(Dir.home + "/.xrpn")
@@ -37,8 +33,11 @@ Dir.mkdir(Dir.home + "/.xrpn") unless File.exist?(Dir.home + "/.xrpn")
37
33
  end
38
34
 
39
35
  # READ LIBRARY AND COMMANDS
36
+ $gem = `VISUAL=echo gem open xrpn`.chomp
37
+ $gem = nil if $gem =~ /^Unable/
38
+ $cmd = []
40
39
  Dir[$gem+"/xlib/*"].each { |file| load file } if $gem # Read xlib directory from the Gem
41
- Dir[Dir.home+"/.xrpn/xlib/*"].each { |file| load file } # Read xlib directory from home dir
40
+ Dir[Dir.home+"/.xrpn/xlib/*"].each { |file| load file unless $cmd.include?(file) } # Read xlib directory from home dir
42
41
  read_xcmd # Read XRPN commands (both from Gem and home dir)
43
42
 
44
43
  # INITIALIZE VARIABLES
@@ -134,6 +133,8 @@ until @p.pc == @p.prg[@p.pg].length do
134
133
  puts "No such command: #{l1}"
135
134
  exit if $exe
136
135
  @p.stop
136
+ elsif l1.downcase == "reload"
137
+ read_xcmd
137
138
  elsif XRPN.method_defined?(l1.downcase) # Or execute the command with either 1 or 2 parts
138
139
  begin
139
140
  l2 ? ret = @p.send(l1.downcase, l2) : ret = @p.send(l1.downcase)
data/xcmd/cmds ADDED
@@ -0,0 +1,8 @@
1
+ class XRPN
2
+ # Print all available commands
3
+ def cmds
4
+ p $cmd
5
+ end
6
+ end
7
+
8
+ # vim:ft=ruby:
data/xlib/_xrpn_version CHANGED
@@ -1,5 +1,6 @@
1
1
  def xrpn_version
2
- puts "XRPN version: 1.9"
2
+ puts "XRPN version: 2.0"
3
+ puts "RubyGem version: " + Gem.latest_spec_for("xrpn").version.to_s
3
4
  end
4
5
 
5
6
  # vim:ft=ruby:
data/xlib/hp_41 CHANGED
@@ -1,6 +1,7 @@
1
1
  def hp_41 (a)
2
2
  a.map!{|x| x.sub( /^\s+/, "" )} # Remove spaces at start of line
3
3
  a.map!{|x| x.sub( /^\d\d+[^0-9.]/, "" )} # Remove line numbers from program
4
+ a.map!{|x| x.sub( /\t+; .*/, "" )} # Remove comments
4
5
  a.map!{|x| x.sub( /\s+$/, "" )} # Remove trailing spaces
5
6
  a.map!{|x| x.sub( /\s\s+/, "" )} # Remove multiple spaces
6
7
  a.map!{|x| x.sub( /([a-zA-Z ]*)/, &:downcase)} # Downcase everything (use the /i below here)
@@ -8,15 +9,17 @@ def hp_41 (a)
8
9
  a.map!{|x| x.sub( /R\^/i, "rup" )}
9
10
  a.map!{|x| x.sub( /X\^2/i, "sqr" )}
10
11
  a.map!{|x| x.sub( /X\*\*2/i, "sqr" )}
11
- a.map!{|x| x.sub( /^E(\d+)/i, '1e\1' )}
12
+ a.map!{|x| x.sub( /^1*E(\d+)/i,'1e\1' )}
12
13
  a.map!{|x| x.sub( /1\/X/i, "recip" )}
13
14
  a.map!{|x| x.sub( /HMS\+/i, "hmsplus" )}
14
15
  a.map!{|x| x.sub( /HMS-/i, "hmsminus" )}
15
16
  a.map!{|x| x.sub( /DATE\+/i, "dateplus" )}
16
17
  a.map!{|x| x.sub( /Σ\+/i, "splus" )}
17
18
  a.map!{|x| x.sub( /Σ-/i, "sminus" )}
19
+ a.map!{|x| x.sub( /ΣREG/i, "sreg" )}
18
20
  a.map!{|x| x.sub( /S\+/i, "splus" )}
19
21
  a.map!{|x| x.sub( /S-/i, "sminus" )}
22
+ a.map!{|x| x.sub( /SREG/i, "sreg" )}
20
23
  a.map!{|x| x.sub( /SIGMA\+/i, "splus" )}
21
24
  a.map!{|x| x.sub( /SIGMA-/i, "sminus" )}
22
25
  a.map!{|x| x.sub( /SIGMAREG/, "sreg" )}
data/xrpn.gemspec CHANGED
@@ -1,9 +1,9 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'xrpn'
3
- s.version = '1.9.1'
3
+ s.version = '2.0'
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.9: Added functions 'lastpage' and 'load' and also added 'pprgtofile' in version 1.9.1 (see GitHub wiki)"
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 2.0: Startup speed 4X. Added command 'cmds'."
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.9.1
4
+ version: '2.0'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-21 00:00:00.000000000 Z
11
+ date: 2024-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tty-prompt
@@ -28,9 +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.9: Added functions
32
- ''lastpage'' and ''load'' and also added ''pprgtofile'' in version 1.9.1 (see GitHub
33
- wiki)'
31
+ programs and opens the possibilities to many, many more. New in 2.0: Startup speed
32
+ 4X. Added command ''cmds''.'
34
33
  email: g@isene.com
35
34
  executables:
36
35
  - xrpn
@@ -96,6 +95,7 @@ files:
96
95
  - xcmd/cmdadd
97
96
  - xcmd/cmddel
98
97
  - xcmd/cmdhelp
98
+ - xcmd/cmds
99
99
  - xcmd/copy
100
100
  - xcmd/correct
101
101
  - xcmd/cos
@@ -341,7 +341,7 @@ homepage: https://github.com/isene/XRPN
341
341
  licenses:
342
342
  - Unlicense
343
343
  metadata: {}
344
- post_install_message:
344
+ post_install_message:
345
345
  rdoc_options: []
346
346
  require_paths:
347
347
  - lib
@@ -356,8 +356,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
356
356
  - !ruby/object:Gem::Version
357
357
  version: '0'
358
358
  requirements: []
359
- rubygems_version: 3.3.5
360
- signing_key:
359
+ rubygems_version: 3.4.20
360
+ signing_key:
361
361
  specification_version: 4
362
362
  summary: XRPN - The eXtended RPN (Reverse Polish Notation) programming language
363
363
  test_files: []