xrpn 1.3.5 → 1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +10 -3
  3. data/bin/xrpn +20 -1
  4. data/xlib/_xrpn_version +1 -1
  5. data/xrpn.gemspec +2 -2
  6. metadata +6 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a270f73ff7966f8a5f28def1881aca7cbccd491fbd17e6f8be18a0a8ad423319
4
- data.tar.gz: e1aa37a38e2ce9b9ebc7561053374fe0ed78b45c2a4e069047a5e96953f0700f
3
+ metadata.gz: 257af776c59f5959ad0f647a818754cb9662a72b66bd9f57fbfd5de5ccd55bb0
4
+ data.tar.gz: 4b2e366317250288ef9adc01a82c45a18547193bc4c07c224166f03a5291e07f
5
5
  SHA512:
6
- metadata.gz: 17429308f52f6dc00b1b2ff7ce2ef8cb4fda18326e8eec0ba902c39b222d6b75792da79f6a5769dc1cd45925982204850ced2e1ccd91afcb6da771ed14a20ef0
7
- data.tar.gz: a65735d8ff489cc55567850697e4d7a9c7748a6de7e9a130886c6d4c858234496370fe5f18accd306df2306972c66bb948889100df9369b74f9f0e4795e04a30
6
+ metadata.gz: 35a01b19ccfd4fdf469345356966205c656b72fff3a82c26c2809fb6938dd9cab7908e2c04976ffd3eb7b608451587d46128707c130b05875beba0caab468444
7
+ data.tar.gz: f1dd342b8f13f72e5540766ed43b7fc2cf48b0b099d3bec56fccff8e9aa745f884bad06dfe3765401d671c472968c4e0c003da4c1bf3b22fec65164270de2bc9
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # XRPN
2
+ ![Ruby](https://img.shields.io/badge/language-Ruby-red) ![Unlicense](https://img.shields.io/badge/license-Unlicense-green) ![Stay Amazing](https://img.shields.io/badge/Stay-Amazing-important)
2
3
 
3
4
  ## Introduction
4
5
 
@@ -25,10 +26,11 @@ To run XRPN, make sure the program file ("bin/xrpn") is copied or linked to a di
25
26
  The full synopsis goes like this:
26
27
  ```
27
28
  Usage: xrpn [options]
28
- -f, --file XRPN-file Specify the file to process
29
- -l, --load XRPN-file Specify a file to load, but not run
29
+ -e, --execute string Interpret string as program and run
30
+ -f, --file program Specify the file to process
31
+ -l, --load program(s) File(s) to load, but not run
30
32
  -s, --state STATE Load a State file
31
- -c, --check program Program file to check for errors
33
+ -c, --check program Program file to check for errors
32
34
  -x, --X X-value Set initial value in the X register
33
35
  -y, --Y Y-value Set initial value in the Y register
34
36
  -z, --Z Z-value Set initial value in the Z register
@@ -38,6 +40,11 @@ Usage: xrpn [options]
38
40
  --help Display LONG help text
39
41
  -v, --version Display the XRPN version number
40
42
  ```
43
+ A program can be run by supplying a program file (option -f), by supplying a string with commands separated by commas (option -e) or by starting xrpn without any options and keying in the program manually.
44
+
45
+ Using the -eoption, you could do e.g. `xrpn -e "43, sin, 1/x, prx"`.
46
+
47
+ You can also pipe a string into xrpn like this: `echo "1,2,+,4,/,prx" | xrpn`.
41
48
 
42
49
  ## FOCAL and the HP-41 system
43
50
 
data/bin/xrpn CHANGED
@@ -1,5 +1,19 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: utf-8
3
+ #
4
+ # SCRIPT INFO
5
+ # Name: XRPN - eXtended Reverse Polish Notation programming language
6
+ # Language: Pure Ruby, best viewed in VIM
7
+ # Author: Geir Isene <g@isene.com>
8
+ # Web_site: http://isene.com/
9
+ # Github: https://github.com/isene/xrpn
10
+ # License: I release all copyright claims. This code is in the public domain.
11
+ # Permission is granted to use, copy modify, distribute, and sell
12
+ # this software for any purpose. I make no guarantee about the
13
+ # suitability of this software for any purpose and I am not liable
14
+ # for any damages resulting from its use. Further, I am under no
15
+ # obligation to maintain or extend this software. It is provided
16
+ # on an 'as is' basis without any expressed or implied warranty.
3
17
 
4
18
  # GET EXTENSIONS
5
19
  require 'optparse'
@@ -33,6 +47,7 @@ optparse = OptionParser.new do |opts|
33
47
  opts.banner = "Usage: xrpn [options]"
34
48
 
35
49
  # Define the options, and what they do
50
+ opts.on('-e', '--execute string', 'Interpret string as program and run') { |e| $exe = e }
36
51
  opts.on('-f', '--file program', 'Specify the file to process') { |f| $rfile = f }
37
52
  opts.on('-l', '--load program(s)', Array, 'File(s) to load, but not run') { |l| $lfile = l }
38
53
  opts.on('-s', '--state STATE', 'Load a State file') { |s| $sfile = s }
@@ -48,6 +63,9 @@ optparse = OptionParser.new do |opts|
48
63
  end
49
64
  optparse.parse!
50
65
 
66
+ input = (STDIN.tty?) ? '' : $stdin.read
67
+ $exe = input unless input == ''
68
+
51
69
  # INITIALIZE CLASS
52
70
  @p = XRPN.new($rfile)
53
71
 
@@ -58,7 +76,8 @@ load(Dir.home+'/.xrpn/conf') if File.exist?(Dir.home+'/.xrpn/conf')
58
76
  @p.x, @p.y, @p.z, @p.t, @p.a = @x, @y, @z, @t, @a
59
77
 
60
78
  # INITIALIZE XRPN PROGRAM
61
- @p.prg[@p.pg] = ["LBL \"XRPN\"", "END"] unless $rfile # Put dummy program in page 0 if no file to run
79
+ @p.prg[@p.pg] = ["LBL \"XRPN\"", "END"] # Put dummy program in page 0 if no file/string to run
80
+ @p.prg[@p.pg] = hp_41($exe.split(",")) if $exe # Read in string as program is supplied by -e/--execute
62
81
  @p.prg[@p.pg] = hp_41(@p.prg[@p.pg]) if $rfile # Substitute HP-41 commands with XRPN commands
63
82
  if $lfile # Read file to load but not run if -l switch is used
64
83
  $lfile.each_with_index do |f, i|
data/xlib/_xrpn_version CHANGED
@@ -1,5 +1,5 @@
1
1
  def xrpn_version
2
- puts "XRPN version: 1.3"
2
+ puts "XRPN version: 1.5"
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.3.5'
3
+ s.version = '1.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.3.5: Removed READ (already had that with GETFILE."
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'"
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.5
4
+ version: '1.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-01-16 00:00:00.000000000 Z
11
+ date: 2023-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tty-prompt
@@ -28,8 +28,10 @@ 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.5: Removed READ
32
- (already had that with GETFILE.'
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'''
33
35
  email: g@isene.com
34
36
  executables:
35
37
  - xrpn