t-rex 2.2 → 2.3

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/t-rex +22 -17
  3. metadata +7 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc55f9485a29e3fbe0c29a51086e83ac0381fc221a1edb186a6282f3a56a03d4
4
- data.tar.gz: d3e0ed8a6f61edcbfaa9228c765c545c209cbaa1714151cd5bb8ff6d6dddc262
3
+ metadata.gz: 908c9816e08cc351d020a90fd6c570e891eb8495b705cf54ce8d7d9016844147
4
+ data.tar.gz: ebe6556bec04b4673b087619df540d20b776cb502523addf6b871d4de9c5ba80
5
5
  SHA512:
6
- metadata.gz: bae00939e5215a19d75cfcfa152129785f20e47558c717236c35ca39d67e342d78033618836c2d608d351d9db2fc09f4fe9813cca7fea1a93ac954b3818178ec
7
- data.tar.gz: 85005f785b9889b259e56d5061791c2219bc3e4c95bf9ecce60e7ed2ae69bbbdfc4723e1673e1f5284e8670d4315aa6984bb04a8819b532bce916d5aa0e2e013
6
+ metadata.gz: 9af9e67bd471cde02e77a3e64e010464aed7d1b6cf19f4f8e3189c762ff71a1c8bad59b37e8fb4024a19c99123fb6eb46a0be6b2420c88ef27d413f93466d477
7
+ data.tar.gz: 24196220301e501ff97845ded3639d3f959dc95e0b7072091e3c39ea453e8dc783b09f6117f14a260c1504899ecad9abd237cbc406bf23c9f26d47242374366c
data/bin/t-rex CHANGED
@@ -12,7 +12,7 @@
12
12
  # for any damages resulting from its use. Further, I am under no
13
13
  # obligation to maintain or extend this software. It is provided
14
14
  # on an 'as is' basis without any expressed or implied warranty.
15
- @version = "2.0" # Full rewrite with rcurses, face lift, new functionality, bug fixes
15
+ @version = "2.3" # Upgraded to new version of rcurses
16
16
 
17
17
  require 'rcurses'
18
18
  include Rcurses::Input
@@ -64,7 +64,7 @@ HELPTEXT
64
64
  if @hlp
65
65
  @p_hlp.fg = 239
66
66
  @p_hlp.ix = 0
67
- @p_hlp.puts(help)
67
+ @p_hlp.say(help)
68
68
  else
69
69
  @p_hlp.ix = @history.length - @h + 3
70
70
  histprint
@@ -353,7 +353,7 @@ def histprint
353
353
  print = @history.join("\n ")
354
354
  @p_hlp.ix = 0 if @p_hlp.ix < 0
355
355
  @p_hlp.fg = 145
356
- @p_hlp.puts(print)
356
+ @p_hlp.say(print)
357
357
  return print
358
358
  end
359
359
  def num_format(n) # THE NUMBER FORMAT FUNCTION
@@ -511,14 +511,14 @@ def main_getkey(c) # GET KEY FROM USER
511
511
  when 'M'
512
512
  @reg = %w[0 0 0 0 0 0 0 0 0 0]
513
513
  when 'S' # Store to Reg
514
- @p_x.puts(" Store x in Reg #(0-9)")
514
+ @p_x.say(" Store x in Reg #(0-9)")
515
515
  r = getchr
516
516
  if r =~ /[0-9]/
517
517
  @reg[r.to_i] = @stk.x
518
518
  end
519
519
  history("STO #{r}")
520
520
  when 'R' # Recall from Reg
521
- @p_x.puts(" Recall from Reg #(0-9)")
521
+ @p_x.say(" Recall from Reg #(0-9)")
522
522
  r = getchr
523
523
  if r =~ /[0-9]/
524
524
  @stk.lift
@@ -526,14 +526,14 @@ def main_getkey(c) # GET KEY FROM USER
526
526
  end
527
527
  history("RCL #{r}")
528
528
  when 's' # Set Sci size/limit
529
- @p_x.puts(" Sci notation limit (2-9)")
529
+ @p_x.say(" Sci notation limit (2-9)")
530
530
  s = getchr
531
531
  if s =~ /[2-9]/
532
532
  @sci = s.to_i
533
533
  end
534
534
  history("Sci #{s}")
535
535
  when 'f' # Set Fix size
536
- @p_x.puts(" Fixed decimals (0-9)")
536
+ @p_x.say(" Fixed decimals (0-9)")
537
537
  f = getchr
538
538
  if f =~ /[0-9]/
539
539
  @fix = f.to_i
@@ -594,7 +594,7 @@ def main_getkey(c) # GET KEY FROM USER
594
594
  when '@' # Ruby console
595
595
  @p_hlp.fg = 168
596
596
  loop do
597
- @p_hlp.puts("")
597
+ @p_hlp.say("")
598
598
  @p_hlp.prompt = " Ruby: "
599
599
  @p_hlp.editline
600
600
  Rcurses::Cursor.set(4,36)
@@ -611,8 +611,10 @@ def main_getkey(c) # GET KEY FROM USER
611
611
  end
612
612
  @p_hlp.fg = 239
613
613
  getchr
614
- @hlp ? help : @p_hlp.puts("")
614
+ @hlp ? help : @p_hlp.say("")
615
615
  when 'Q' # QUIT
616
+ Rcurses.clear_screen
617
+ Rcurses::Cursor.show
616
618
  exit 0
617
619
  when /[0-9.,]/ # Go to entry mode for x
618
620
  @stk.lift
@@ -637,7 +639,9 @@ def entry(chr) # X REGISTER ENTRY
637
639
  Rcurses::Cursor.set(7,33)
638
640
  Rcurses::Cursor.show
639
641
  while %w[0 1 2 3 4 5 6 7 8 9 . , h H e RIGHT LEFT HOME END DEL BACK WBACK LDEL].include?(chr)
640
- @p_x.puts(num)
642
+ @p_x.clear
643
+ @p_x.say(num)
644
+ Rcurses::Cursor.show
641
645
  chr = getchr
642
646
  case chr
643
647
  when 'RIGHT'
@@ -689,6 +693,7 @@ def entry(chr) # X REGISTER ENTRY
689
693
  when /[0-9.,]/
690
694
  num.insert(pos,chr)
691
695
  pos += 1
696
+ @p_x.say(num)
692
697
  end
693
698
  Rcurses::Cursor.col(33 - num.length + pos)
694
699
  end
@@ -716,11 +721,11 @@ def refresh # REFRESH ALL PANES
716
721
  @p_x.refresh
717
722
  end
718
723
  def pstack # PRINT STACK (XYZTL)
719
- @p_l.puts(num_format(@stk.l))
720
- @p_t.puts(num_format(@stk.t))
721
- @p_z.puts(num_format(@stk.z))
722
- @p_y.puts(num_format(@stk.y))
723
- @p_x.puts(num_format(@stk.x).b)
724
+ @p_l.say(num_format(@stk.l))
725
+ @p_t.say(num_format(@stk.t))
726
+ @p_z.say(num_format(@stk.z))
727
+ @p_y.say(num_format(@stk.y))
728
+ @p_x.say(num_format(@stk.x).b)
724
729
  end
725
730
  def pregs # PRINT CONTENT OF REGS (0-9)
726
731
  @p_reg.text = "\n"
@@ -731,7 +736,7 @@ def pregs # PRINT CONTENT OF REGS (0-9)
731
736
  @p_reg.refresh
732
737
  end
733
738
  def error(err) # PRINT ERRORS TO X
734
- @p_x.puts(err)
739
+ @p_x.say(err)
735
740
  @history.insert(-2, err)
736
741
  getchr
737
742
  end
@@ -753,7 +758,7 @@ refresh
753
758
  Rcurses::Cursor.hide
754
759
  begin # Capture main loop
755
760
  loop do # Main loop
756
- @p_inf.puts(" #{@mod} Sci=#{@sci} Fix=#{@fix}".i)
761
+ @p_inf.say(" #{@mod} Sci=#{@sci} Fix=#{@fix}".i)
757
762
  pstack
758
763
  pregs
759
764
  @t = @stk.dup
metadata CHANGED
@@ -1,34 +1,32 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: t-rex
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.2'
4
+ version: '2.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-03-27 00:00:00.000000000 Z
11
+ date: 2025-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rcurses
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.4'
19
+ version: '3.5'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.4'
26
+ version: '3.5'
27
27
  description: 'This is a terminal curses RPN calculator similar to the traditional
28
28
  calculators from Hewlett Packard. See https://www.hpmuseum.org/rpn.htm for info
29
- on RPN (Reverse Polish Notation). New in 2.1: Added ''e'' for entering exponents
30
- directly into X. 2.2: Allowing for negative exponents (use ''H'' to enter a minus
31
- sign).'
29
+ on RPN (Reverse Polish Notation). New in 2.3: Upgraded to new version of rcurses.'
32
30
  email: g@isene.com
33
31
  executables:
34
32
  - t-rex