xrpn 1.3.5 → 1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +10 -3
- data/bin/xrpn +20 -1
- data/xlib/_xrpn_version +1 -1
- data/xrpn.gemspec +2 -2
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 257af776c59f5959ad0f647a818754cb9662a72b66bd9f57fbfd5de5ccd55bb0
|
4
|
+
data.tar.gz: 4b2e366317250288ef9adc01a82c45a18547193bc4c07c224166f03a5291e07f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35a01b19ccfd4fdf469345356966205c656b72fff3a82c26c2809fb6938dd9cab7908e2c04976ffd3eb7b608451587d46128707c130b05875beba0caab468444
|
7
|
+
data.tar.gz: f1dd342b8f13f72e5540766ed43b7fc2cf48b0b099d3bec56fccff8e9aa745f884bad06dfe3765401d671c472968c4e0c003da4c1bf3b22fec65164270de2bc9
|
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# XRPN
|
2
|
+
  
|
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
|
-
-
|
29
|
-
-
|
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
|
-
|
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"]
|
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
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
|
+
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.
|
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.
|
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-
|
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.
|
32
|
-
|
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
|