t-rex 2.2.1 → 2.3.1

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 +29 -17
  3. metadata +6 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8bb66e44a6d6ca2542d5b57317928a405cd354ec66907a7d2cec7b54364b50cf
4
- data.tar.gz: 2caa942557bd74fdd067fb1e59f771aac855fea587ffa0ad10633a9d09aaffa5
3
+ metadata.gz: 87c1cf1867149f5f0539efc3566add36b3a9b122e4f9f05e6005c598dfd6dc9b
4
+ data.tar.gz: 87af678a8fcfabcbdebbb2fd528b9285546edc557167db73b6f09d1862ccd3d9
5
5
  SHA512:
6
- metadata.gz: 32f4dcebc2cac923aee7bc0d9bd21dc0f84b8ad89d37684dec77af21d452e0b06692d474eef590de553410cd69d82a5bba41de400beb9b107d8846d9e84db941
7
- data.tar.gz: d39f5b2dfc0852179038b8a27cf7fad12942bc19c60bbecae52babd8a8b30a7f65b50e57b9c111da9841d74dd8f9241fab11bc091c992ebfe6e5e93114e39611
6
+ metadata.gz: 9fc784fd4312c539f2188805053a8a5424920652becbf105c66e6b8a18ceaccfb352ee75c04afba72e40bb6a1d49c4d35852f23ca9f7d2ec80529221811ece7e
7
+ data.tar.gz: 36552d11bfe4dfd185d7447e2c20209e4f964dadfc74d40ba8147d595b5163b97a9780205753f908211f8bf24df14fce97c0aab1ff552d48b09151d2012b4f0e
data/bin/t-rex CHANGED
@@ -12,11 +12,19 @@
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.2.1" # Clear screen upon exit
15
+ @version = "2.3.1" # Upgraded to new version of rcurses
16
16
 
17
17
  require 'rcurses'
18
18
  include Rcurses::Input
19
19
 
20
+ class Rcurses::Pane
21
+ def clear
22
+ @text = ""
23
+ @ix = 0
24
+ full_refresh
25
+ end
26
+ end
27
+
20
28
  def help # HELP text
21
29
  help = <<HELPTEXT
22
30
 
@@ -64,7 +72,7 @@ HELPTEXT
64
72
  if @hlp
65
73
  @p_hlp.fg = 239
66
74
  @p_hlp.ix = 0
67
- @p_hlp.puts(help)
75
+ @p_hlp.say(help)
68
76
  else
69
77
  @p_hlp.ix = @history.length - @h + 3
70
78
  histprint
@@ -353,7 +361,7 @@ def histprint
353
361
  print = @history.join("\n ")
354
362
  @p_hlp.ix = 0 if @p_hlp.ix < 0
355
363
  @p_hlp.fg = 145
356
- @p_hlp.puts(print)
364
+ @p_hlp.say(print)
357
365
  return print
358
366
  end
359
367
  def num_format(n) # THE NUMBER FORMAT FUNCTION
@@ -511,14 +519,14 @@ def main_getkey(c) # GET KEY FROM USER
511
519
  when 'M'
512
520
  @reg = %w[0 0 0 0 0 0 0 0 0 0]
513
521
  when 'S' # Store to Reg
514
- @p_x.puts(" Store x in Reg #(0-9)")
522
+ @p_x.say(" Store x in Reg #(0-9)")
515
523
  r = getchr
516
524
  if r =~ /[0-9]/
517
525
  @reg[r.to_i] = @stk.x
518
526
  end
519
527
  history("STO #{r}")
520
528
  when 'R' # Recall from Reg
521
- @p_x.puts(" Recall from Reg #(0-9)")
529
+ @p_x.say(" Recall from Reg #(0-9)")
522
530
  r = getchr
523
531
  if r =~ /[0-9]/
524
532
  @stk.lift
@@ -526,14 +534,14 @@ def main_getkey(c) # GET KEY FROM USER
526
534
  end
527
535
  history("RCL #{r}")
528
536
  when 's' # Set Sci size/limit
529
- @p_x.puts(" Sci notation limit (2-9)")
537
+ @p_x.say(" Sci notation limit (2-9)")
530
538
  s = getchr
531
539
  if s =~ /[2-9]/
532
540
  @sci = s.to_i
533
541
  end
534
542
  history("Sci #{s}")
535
543
  when 'f' # Set Fix size
536
- @p_x.puts(" Fixed decimals (0-9)")
544
+ @p_x.say(" Fixed decimals (0-9)")
537
545
  f = getchr
538
546
  if f =~ /[0-9]/
539
547
  @fix = f.to_i
@@ -594,7 +602,7 @@ def main_getkey(c) # GET KEY FROM USER
594
602
  when '@' # Ruby console
595
603
  @p_hlp.fg = 168
596
604
  loop do
597
- @p_hlp.puts("")
605
+ @p_hlp.say("")
598
606
  @p_hlp.prompt = " Ruby: "
599
607
  @p_hlp.editline
600
608
  Rcurses::Cursor.set(4,36)
@@ -611,9 +619,10 @@ def main_getkey(c) # GET KEY FROM USER
611
619
  end
612
620
  @p_hlp.fg = 239
613
621
  getchr
614
- @hlp ? help : @p_hlp.puts("")
622
+ @hlp ? help : @p_hlp.say("")
615
623
  when 'Q' # QUIT
616
624
  Rcurses.clear_screen
625
+ Rcurses::Cursor.show
617
626
  exit 0
618
627
  when /[0-9.,]/ # Go to entry mode for x
619
628
  @stk.lift
@@ -638,7 +647,9 @@ def entry(chr) # X REGISTER ENTRY
638
647
  Rcurses::Cursor.set(7,33)
639
648
  Rcurses::Cursor.show
640
649
  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)
641
- @p_x.puts(num)
650
+ @p_x.clear
651
+ @p_x.say(num)
652
+ Rcurses::Cursor.show
642
653
  chr = getchr
643
654
  case chr
644
655
  when 'RIGHT'
@@ -690,6 +701,7 @@ def entry(chr) # X REGISTER ENTRY
690
701
  when /[0-9.,]/
691
702
  num.insert(pos,chr)
692
703
  pos += 1
704
+ @p_x.say(num)
693
705
  end
694
706
  Rcurses::Cursor.col(33 - num.length + pos)
695
707
  end
@@ -717,11 +729,11 @@ def refresh # REFRESH ALL PANES
717
729
  @p_x.refresh
718
730
  end
719
731
  def pstack # PRINT STACK (XYZTL)
720
- @p_l.puts(num_format(@stk.l))
721
- @p_t.puts(num_format(@stk.t))
722
- @p_z.puts(num_format(@stk.z))
723
- @p_y.puts(num_format(@stk.y))
724
- @p_x.puts(num_format(@stk.x).b)
732
+ @p_l.say(num_format(@stk.l))
733
+ @p_t.say(num_format(@stk.t))
734
+ @p_z.say(num_format(@stk.z))
735
+ @p_y.say(num_format(@stk.y))
736
+ @p_x.say(num_format(@stk.x).b)
725
737
  end
726
738
  def pregs # PRINT CONTENT OF REGS (0-9)
727
739
  @p_reg.text = "\n"
@@ -732,7 +744,7 @@ def pregs # PRINT CONTENT OF REGS (0-9)
732
744
  @p_reg.refresh
733
745
  end
734
746
  def error(err) # PRINT ERRORS TO X
735
- @p_x.puts(err)
747
+ @p_x.say(err)
736
748
  @history.insert(-2, err)
737
749
  getchr
738
750
  end
@@ -754,7 +766,7 @@ refresh
754
766
  Rcurses::Cursor.hide
755
767
  begin # Capture main loop
756
768
  loop do # Main loop
757
- @p_inf.puts(" #{@mod} Sci=#{@sci} Fix=#{@fix}".i)
769
+ @p_inf.say(" #{@mod} Sci=#{@sci} Fix=#{@fix}".i)
758
770
  pstack
759
771
  pregs
760
772
  @t = @stk.dup
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: t-rex
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.3.1
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-29 00:00:00.000000000 Z
11
+ date: 2025-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rcurses
@@ -16,17 +16,18 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.9'
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.9'
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.2.1: Clear screen upon exit.'
29
+ on RPN (Reverse Polish Notation). New in 2.3: Upgraded to new version of rcurses.
30
+ 2.3.1: Fix for rcurses.'
30
31
  email: g@isene.com
31
32
  executables:
32
33
  - t-rex