xrpn 1.5 → 1.7

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: 257af776c59f5959ad0f647a818754cb9662a72b66bd9f57fbfd5de5ccd55bb0
4
- data.tar.gz: 4b2e366317250288ef9adc01a82c45a18547193bc4c07c224166f03a5291e07f
3
+ metadata.gz: a81afb93ab5528746ee3506675542ce31b85a1fe513f7bdda71e7b1702b95f09
4
+ data.tar.gz: c22adf280fd778f57ff9beb6fa49afa03e408c8b688105ef5b7cf89529c7fe16
5
5
  SHA512:
6
- metadata.gz: 35a01b19ccfd4fdf469345356966205c656b72fff3a82c26c2809fb6938dd9cab7908e2c04976ffd3eb7b608451587d46128707c130b05875beba0caab468444
7
- data.tar.gz: f1dd342b8f13f72e5540766ed43b7fc2cf48b0b099d3bec56fccff8e9aa745f884bad06dfe3765401d671c472968c4e0c003da4c1bf3b22fec65164270de2bc9
6
+ metadata.gz: a0cee89c7e30519538ef273f2714c8e877cdbe393b1bcbbd504439946b7704f25f3c457a04163e54ff84c74cd61cf3c783db28ac907d9cfc6ffb33d4ad59fcb1
7
+ data.tar.gz: f23b8a11dd7245316d9c433306d114a8faba605bb2a9f226fdfc2e26390ebbbee0bed5ade3c2f8a200010fe6016f9c5bd440e8bd0d3d17210b078a6c10387a5b
data/bin/xrpn CHANGED
@@ -63,6 +63,7 @@ optparse = OptionParser.new do |opts|
63
63
  end
64
64
  optparse.parse!
65
65
 
66
+ # HANDLE INPUT FROM STDIN (PIPE) OR STRING VIA -e
66
67
  input = (STDIN.tty?) ? '' : $stdin.read
67
68
  $exe = input unless input == ''
68
69
 
@@ -85,6 +86,8 @@ if $lfile # Read file to load but
85
86
  @p.prg[i] = hp_41(@p.prg[i])
86
87
  end
87
88
  end
89
+ @p.prg[@p.pg].push("END") unless @p.prg[@p.pg].last.upcase == "END"
90
+
88
91
  read_state($sfile) if $sfile # Read state file in ~.xrpn/ if -s switch is used
89
92
  $debug = true if $lfile or $sfile # Do not run loaded program or program in state file
90
93
 
@@ -107,13 +110,13 @@ until @p.pc == @p.prg[@p.pg].length do
107
110
  @p.x = @line.to_f
108
111
  @p.flg["22"] = true # Number has been entered
109
112
  @p.flg["23"] = false
110
- elsif @line.match(/^>?".*"/) # If an Alpha string is supplied
111
- if @line.match(/^"\|/)
113
+ elsif @line.match(/^>?["'].*["']/) # If an Alpha string is supplied
114
+ if @line.match(/^["']\|/)
112
115
  @p.a += @line.sub(/\|-?/, '').gsub(/\"/, '') # Append to Alpha if "|abc", "|-abc"
113
- elsif @line.match(/^>"/)
116
+ elsif @line.match(/^>["']/)
114
117
  @p.a += @line.sub(/>/, '').gsub(/\"/, '') # Append to Alpha if >"abc"
115
118
  else
116
- @p.a = @line.gsub(/\"/, '') # ...or set Alpha to the supplied string
119
+ @p.a = @line.gsub(/["']/, '') # ...or set Alpha to the supplied string
117
120
  end
118
121
  @p.flg["22"] = false
119
122
  @p.flg["23"] = true # String has been entered
@@ -125,6 +128,7 @@ until @p.pc == @p.prg[@p.pg].length do
125
128
  l1 = "" if l1 == nil
126
129
  if not $cmd.include?(l1.downcase) # Catch unknown command
127
130
  puts "No such command: #{l1}"
131
+ exit if $exe
128
132
  @p.stop
129
133
  elsif XRPN.method_defined?(l1.downcase) # Or execute the command with either 1 or 2 parts
130
134
  begin
data/xcmd/stdout ADDED
@@ -0,0 +1,8 @@
1
+ class XRPN
2
+ # Send content of X to STDOUT
3
+ def stdout
4
+ $stdout.write @x
5
+ end
6
+ end
7
+
8
+ # vim:ft=ruby:
data/xlib/_xrpn_version CHANGED
@@ -1,5 +1,5 @@
1
1
  def xrpn_version
2
- puts "XRPN version: 1.5"
2
+ puts "XRPN version: 1.6"
3
3
  end
4
4
 
5
5
  # vim:ft=ruby:
data/xrpn.gemspec CHANGED
@@ -1,9 +1,9 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'xrpn'
3
- s.version = '1.5'
3
+ s.version = '1.7'
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.5: You can now pipe commands into xrpn or run xrpn with the -e option to supply a program from the command line. Such string must have commands separated by a comma like this: '1, 2, +, sin, 1/x, prx'"
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.7: Added function 'stdout' that writes content of X to STDOUT."
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.5'
4
+ version: '1.7'
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-05-29 00:00:00.000000000 Z
11
+ date: 2023-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tty-prompt
@@ -28,10 +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.5: You can now
32
- pipe commands into xrpn or run xrpn with the -e option to supply a program from
33
- the command line. Such string must have commands separated by a comma like this:
34
- ''1, 2, +, sin, 1/x, prx'''
31
+ programs and opens the possibilities to many, many more. New in 1.7: Added function
32
+ ''stdout'' that writes content of X to STDOUT.'
35
33
  email: g@isene.com
36
34
  executables:
37
35
  - xrpn
@@ -262,6 +260,7 @@ files:
262
260
  - xcmd/sreg
263
261
  - xcmd/sregq
264
262
  - xcmd/stdivide
263
+ - xcmd/stdout
265
264
  - xcmd/stmultiply
266
265
  - xcmd/sto
267
266
  - xcmd/stoflag