xrpn 1.9 → 1.9.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/xcmd/pprgtofile +30 -0
  3. data/xlib/hp_41 +4 -1
  4. data/xrpn.gemspec +2 -2
  5. metadata +6 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1af3ec05af142258d3a307d379c116cd097e76cc6d78d8952ea5eb3c91ad9e5f
4
- data.tar.gz: 54cbf3e384d18e4aa66db8fc52e8c315bc4911d25541559a144c71420749dcef
3
+ metadata.gz: 751d07df684dda975c02987fa4b1988a898e90ca38cee59c43599afa70839461
4
+ data.tar.gz: 0b35a364703da952c89c3a4a4dd544437e838ec5806f4a60ad93702bce2a43c8
5
5
  SHA512:
6
- metadata.gz: a7b6fb839bd6d486a999b97b8b7826deb72aaac9bcd4988a4f619e12fb8c4625b20505f8b870e40a7d5d806ac5106f804982f3259a7b6aa0411b60157ba2a65c
7
- data.tar.gz: '05718632faa6cd186110379e1383eea04cdb842684df717a253312a150680fcc3b69de0062b0eb8fc6ac9ab116ff0ee1e67e6b215fa4c24f62f287bec9ddf44f'
6
+ metadata.gz: 4ac219252e205fb60271a60b5e5f9a8e6bb7f19c3dfe7e0ce8f2dce60ca1d1a8ffb83645ee664601a7a1a09ddd150c0c5275950ca1fd6bf5599443530023deae
7
+ data.tar.gz: 9506c918f3173955a7112c45e5d19c194a58c0579f797f6cfef605fdf65a71321da052b828c77b3246da4efd9b9868d8d35af4b02b9d3bba17c29af03b9bcca8
data/xcmd/pprgtofile ADDED
@@ -0,0 +1,30 @@
1
+ class XRPN
2
+ # Print program
3
+ def pprgtofile
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
+ prog = ""
15
+ @prg[page].each_index do |i|
16
+ next if i < pos
17
+ prog += "#{format('%02d', i + 1)}"
18
+ if @prg[page][i].downcase.match(/lbl/)
19
+ prog += "◆"
20
+ else
21
+ prog += " "
22
+ end
23
+ prog += "#{@prg[page][i]}\n"
24
+ break if @prg[page][i] == "END"
25
+ end
26
+ File.write(@x, prog)
27
+ end
28
+ end
29
+
30
+ # 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'
3
+ s.version = '1.9.5'
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' (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 1.9: Added functions 'lastpage' and 'load' and also added 'pprgtofile' in version 1.9.1 (see GitHub wiki). 1.9.5: Comments are now removed when loading programs (comments start with a tab and a semicolon and a space and whatever)"
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'
4
+ version: 1.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-19 00:00:00.000000000 Z
11
+ date: 2023-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tty-prompt
@@ -29,7 +29,9 @@ description: 'A full programming language and environment extending the features
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
31
  programs and opens the possibilities to many, many more. New in 1.9: Added functions
32
- ''lastpage'' and ''load'' (see GitHub wiki)'
32
+ ''lastpage'' and ''load'' and also added ''pprgtofile'' in version 1.9.1 (see GitHub
33
+ wiki). 1.9.5: Comments are now removed when loading programs (comments start with
34
+ a tab and a semicolon and a space and whatever)'
33
35
  email: g@isene.com
34
36
  executables:
35
37
  - xrpn
@@ -202,6 +204,7 @@ files:
202
204
  - xcmd/pow
203
205
  - xcmd/pprg
204
206
  - xcmd/pprg1
207
+ - xcmd/pprgtofile
205
208
  - xcmd/pprgx
206
209
  - xcmd/pra
207
210
  - xcmd/prflags