xrpn 1.1.4 → 1.1.7

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 (291) hide show
  1. checksums.yaml +4 -4
  2. data/bin/xrpn +5 -5
  3. data/lib/{xrpn_load.rb → xrpn.rb} +1 -0
  4. data/xcmd/abs +7 -0
  5. data/xcmd/acos +10 -0
  6. data/xcmd/adate +12 -0
  7. data/xcmd/adateiso +13 -0
  8. data/xcmd/add +9 -0
  9. data/xcmd/adv +7 -0
  10. data/xcmd/agsub +8 -0
  11. data/xcmd/aleng +8 -0
  12. data/xcmd/almcat +7 -0
  13. data/xcmd/almnow +7 -0
  14. data/xcmd/anum +10 -0
  15. data/xcmd/aoff +7 -0
  16. data/xcmd/aon +7 -0
  17. data/xcmd/appchr +13 -0
  18. data/xcmd/apprec +13 -0
  19. data/xcmd/arcl +22 -0
  20. data/xcmd/arcli +7 -0
  21. data/xcmd/arclrec +30 -0
  22. data/xcmd/arot +13 -0
  23. data/xcmd/ashf +7 -0
  24. data/xcmd/asin +10 -0
  25. data/xcmd/asroom +7 -0
  26. data/xcmd/asto +21 -0
  27. data/xcmd/asub +8 -0
  28. data/xcmd/atan +10 -0
  29. data/xcmd/atime +26 -0
  30. data/xcmd/atime24 +21 -0
  31. data/xcmd/atox +9 -0
  32. data/xcmd/aview +7 -0
  33. data/xcmd/aviewc +7 -0
  34. data/xcmd/beep +7 -0
  35. data/xcmd/bindec +8 -0
  36. data/xcmd/cat +26 -0
  37. data/xcmd/cf +7 -0
  38. data/xcmd/chs +7 -0
  39. data/xcmd/cla +7 -0
  40. data/xcmd/clalma +7 -0
  41. data/xcmd/clalmx +7 -0
  42. data/xcmd/cld +6 -0
  43. data/xcmd/clear +7 -0
  44. data/xcmd/clfl +13 -0
  45. data/xcmd/clk12 +7 -0
  46. data/xcmd/clk24 +7 -0
  47. data/xcmd/clkeys +7 -0
  48. data/xcmd/clock +7 -0
  49. data/xcmd/clp +8 -0
  50. data/xcmd/clralms +7 -0
  51. data/xcmd/clrg +7 -0
  52. data/xcmd/clrgx +12 -0
  53. data/xcmd/cls +12 -0
  54. data/xcmd/clst +10 -0
  55. data/xcmd/clx +8 -0
  56. data/xcmd/cmdadd +7 -0
  57. data/xcmd/cmddel +7 -0
  58. data/xcmd/correct +7 -0
  59. data/xcmd/cos +10 -0
  60. data/xcmd/crflas +9 -0
  61. data/xcmd/crfld +9 -0
  62. data/xcmd/cube +8 -0
  63. data/xcmd/d_r +8 -0
  64. data/xcmd/date +8 -0
  65. data/xcmd/dateplus +12 -0
  66. data/xcmd/ddate +11 -0
  67. data/xcmd/dec +7 -0
  68. data/xcmd/decbin +8 -0
  69. data/xcmd/dechex +8 -0
  70. data/xcmd/decoct +8 -0
  71. data/xcmd/deg +7 -0
  72. data/xcmd/degq +7 -0
  73. data/xcmd/delchr +14 -0
  74. data/xcmd/delrec +12 -0
  75. data/xcmd/divide +9 -0
  76. data/xcmd/dmy +7 -0
  77. data/xcmd/dot +7 -0
  78. data/xcmd/dow +9 -0
  79. data/xcmd/drop +7 -0
  80. data/xcmd/dropy +7 -0
  81. data/xcmd/dse +40 -0
  82. data/xcmd/ed +7 -0
  83. data/xcmd/emdir +7 -0
  84. data/xcmd/emdirx +14 -0
  85. data/xcmd/emroom +7 -0
  86. data/xcmd/end +9 -0
  87. data/xcmd/eng +9 -0
  88. data/xcmd/enter +8 -0
  89. data/xcmd/exp +9 -0
  90. data/xcmd/expx1 +9 -0
  91. data/xcmd/fact +9 -0
  92. data/xcmd/fc +7 -0
  93. data/xcmd/fcc +8 -0
  94. data/xcmd/fcs +8 -0
  95. data/xcmd/fix +9 -0
  96. data/xcmd/fixq +7 -0
  97. data/xcmd/flsize +7 -0
  98. data/xcmd/frc +8 -0
  99. data/xcmd/fs +7 -0
  100. data/xcmd/fsc +8 -0
  101. data/xcmd/fss +8 -0
  102. data/xcmd/geir +11 -0
  103. data/xcmd/getas +7 -0
  104. data/xcmd/getfile +12 -0
  105. data/xcmd/getfilea +11 -0
  106. data/xcmd/getkey +9 -0
  107. data/xcmd/getkeyx +10 -0
  108. data/xcmd/getp +13 -0
  109. data/xcmd/getr +13 -0
  110. data/xcmd/getrec +8 -0
  111. data/xcmd/getrx +17 -0
  112. data/xcmd/getsub +7 -0
  113. data/xcmd/getweb +12 -0
  114. data/xcmd/getx +12 -0
  115. data/xcmd/grad +7 -0
  116. data/xcmd/gsb +7 -0
  117. data/xcmd/gto +23 -0
  118. data/xcmd/help +14 -0
  119. data/xcmd/hexdec +8 -0
  120. data/xcmd/hms +12 -0
  121. data/xcmd/hmsminus +14 -0
  122. data/xcmd/hmsplus +13 -0
  123. data/xcmd/hr +11 -0
  124. data/xcmd/inschr +14 -0
  125. data/xcmd/insrec +12 -0
  126. data/xcmd/int +8 -0
  127. data/xcmd/invf +7 -0
  128. data/xcmd/isg +40 -0
  129. data/xcmd/lastx +8 -0
  130. data/xcmd/lbl +6 -0
  131. data/xcmd/lift +8 -0
  132. data/xcmd/ln +8 -0
  133. data/xcmd/ln1x +8 -0
  134. data/xcmd/log +8 -0
  135. data/xcmd/mdy +7 -0
  136. data/xcmd/mean +11 -0
  137. data/xcmd/mod +13 -0
  138. data/xcmd/multiply +9 -0
  139. data/xcmd/oct +7 -0
  140. data/xcmd/octdec +8 -0
  141. data/xcmd/off +8 -0
  142. data/xcmd/on +7 -0
  143. data/xcmd/p_r +13 -0
  144. data/xcmd/pack +7 -0
  145. data/xcmd/page +13 -0
  146. data/xcmd/pagedel +8 -0
  147. data/xcmd/pageq +7 -0
  148. data/xcmd/pageswap +8 -0
  149. data/xcmd/pasn +7 -0
  150. data/xcmd/pcat +14 -0
  151. data/xcmd/pclps +12 -0
  152. data/xcmd/percent +9 -0
  153. data/xcmd/percentch +9 -0
  154. data/xcmd/pi +8 -0
  155. data/xcmd/posa +23 -0
  156. data/xcmd/posfl +26 -0
  157. data/xcmd/pow +9 -0
  158. data/xcmd/pprg +27 -0
  159. data/xcmd/pprgx +33 -0
  160. data/xcmd/pra +7 -0
  161. data/xcmd/prflags +8 -0
  162. data/xcmd/prompt +8 -0
  163. data/xcmd/prp +7 -0
  164. data/xcmd/prregs +8 -0
  165. data/xcmd/prstk +10 -0
  166. data/xcmd/prx +7 -0
  167. data/xcmd/prxm +21 -0
  168. data/xcmd/pse +7 -0
  169. data/xcmd/psize +7 -0
  170. data/xcmd/purfl +14 -0
  171. data/xcmd/r_d +8 -0
  172. data/xcmd/r_p +18 -0
  173. data/xcmd/rad +7 -0
  174. data/xcmd/rand +10 -0
  175. data/xcmd/rcl +23 -0
  176. data/xcmd/rclaf +7 -0
  177. data/xcmd/rclflag +16 -0
  178. data/xcmd/rclpt +8 -0
  179. data/xcmd/rclpta +16 -0
  180. data/xcmd/rclsw +7 -0
  181. data/xcmd/rdn +7 -0
  182. data/xcmd/recip +8 -0
  183. data/xcmd/regmove +18 -0
  184. data/xcmd/regswap +19 -0
  185. data/xcmd/reload +7 -0
  186. data/xcmd/reszfl +7 -0
  187. data/xcmd/rnd +8 -0
  188. data/xcmd/root +9 -0
  189. data/xcmd/rtn +12 -0
  190. data/xcmd/rubycmd +7 -0
  191. data/xcmd/runsw +7 -0
  192. data/xcmd/rup +7 -0
  193. data/xcmd/saveas +7 -0
  194. data/xcmd/savep +7 -0
  195. data/xcmd/saver +24 -0
  196. data/xcmd/saverx +31 -0
  197. data/xcmd/savex +10 -0
  198. data/xcmd/savexm +7 -0
  199. data/xcmd/sci +9 -0
  200. data/xcmd/sdev +11 -0
  201. data/xcmd/seekpt +10 -0
  202. data/xcmd/seekpta +7 -0
  203. data/xcmd/sep +7 -0
  204. data/xcmd/setaf +7 -0
  205. data/xcmd/setsw +7 -0
  206. data/xcmd/sf +7 -0
  207. data/xcmd/shellcmd +7 -0
  208. data/xcmd/sign +19 -0
  209. data/xcmd/sin +10 -0
  210. data/xcmd/size +7 -0
  211. data/xcmd/sizeq +7 -0
  212. data/xcmd/sminus +20 -0
  213. data/xcmd/splus +20 -0
  214. data/xcmd/sqr +8 -0
  215. data/xcmd/sqrt +8 -0
  216. data/xcmd/sreg +7 -0
  217. data/xcmd/sregq +7 -0
  218. data/xcmd/stdivide +22 -0
  219. data/xcmd/stmultiply +22 -0
  220. data/xcmd/sto +21 -0
  221. data/xcmd/stoflag +13 -0
  222. data/xcmd/stop +7 -0
  223. data/xcmd/stopsw +7 -0
  224. data/xcmd/stplus +22 -0
  225. data/xcmd/stsubtract +22 -0
  226. data/xcmd/subtract +9 -0
  227. data/xcmd/sw +7 -0
  228. data/xcmd/swap +7 -0
  229. data/xcmd/swpt +7 -0
  230. data/xcmd/tan +10 -0
  231. data/xcmd/tenx +8 -0
  232. data/xcmd/time +8 -0
  233. data/xcmd/tx +7 -0
  234. data/xcmd/version +7 -0
  235. data/xcmd/view +7 -0
  236. data/xcmd/writefile +12 -0
  237. data/xcmd/xeq +21 -0
  238. data/xcmd/xeq0 +7 -0
  239. data/xcmd/xeqnn +9 -0
  240. data/xcmd/xeqy +7 -0
  241. data/xcmd/xf +20 -0
  242. data/xcmd/xgt0 +7 -0
  243. data/xcmd/xgteq0 +7 -0
  244. data/xcmd/xgteqnn +9 -0
  245. data/xcmd/xgteqy +7 -0
  246. data/xcmd/xgtnn +9 -0
  247. data/xcmd/xgty +7 -0
  248. data/xcmd/xlt0 +7 -0
  249. data/xcmd/xlteq0 +7 -0
  250. data/xcmd/xlteqnn +9 -0
  251. data/xcmd/xlteqy +7 -0
  252. data/xcmd/xltnn +9 -0
  253. data/xcmd/xlty +7 -0
  254. data/xcmd/xmexistq +15 -0
  255. data/xcmd/xmfileq +7 -0
  256. data/xcmd/xneq0 +7 -0
  257. data/xcmd/xneqnn +9 -0
  258. data/xcmd/xneqy +7 -0
  259. data/xcmd/xnn +21 -0
  260. data/xcmd/xtoa +7 -0
  261. data/xcmd/xy +7 -0
  262. data/xcmd/xyzalm +7 -0
  263. data/xlib/_xrpn_version +5 -0
  264. data/xlib/bei +18 -0
  265. data/xlib/check +26 -0
  266. data/xlib/conditional +10 -0
  267. data/xlib/convert_base +8 -0
  268. data/xlib/debug_mode +124 -0
  269. data/xlib/dtparse +10 -0
  270. data/xlib/error +10 -0
  271. data/xlib/fact +7 -0
  272. data/xlib/getpt +7 -0
  273. data/xlib/help +12 -0
  274. data/xlib/hp_41 +83 -0
  275. data/xlib/ind +21 -0
  276. data/xlib/load_xm +28 -0
  277. data/xlib/locate_prg +32 -0
  278. data/xlib/numeric +62 -0
  279. data/xlib/numformat +12 -0
  280. data/xlib/optparse +23 -0
  281. data/xlib/read_cmd +12 -0
  282. data/xlib/read_state +6 -0
  283. data/xlib/save_state +18 -0
  284. data/xlib/save_xm +5 -0
  285. data/xlib/setpt +5 -0
  286. data/xlib/string +28 -0
  287. data/xlib/theme_dark +10 -0
  288. data/xlib/theme_light +10 -0
  289. data/xlib/xrpn_class +34 -0
  290. data/xrpn.gemspec +2 -2
  291. metadata +289 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6c5391ee8849b22f558676040acf0db029c86f29561273158993f0d27f582020
4
- data.tar.gz: 9112bbb8560e9703cc2a4524d1a1556ba24b31022b767c4bc3a566ddfd057275
3
+ metadata.gz: 3bc359eaf9eff213e3dc7ff0050fdaec73ccbf89990312534e425e6c2f11fb7d
4
+ data.tar.gz: f7dfcb8196f206f0636c9bfbde3b77d0939190a86ff9c8b253af9140beaf48fc
5
5
  SHA512:
6
- metadata.gz: '0326418721cc8e91b93b05003f146f94f22dcaf7e503d0e768c30890f089ee10c486f25d228538d78bec5a7d0a0a0c7fc93f40145757c429ae37b8ce52d27333'
7
- data.tar.gz: 2caeba8dded77c1e56812a9b3dd9de074fc90a2aab737561bc2dfefa1f534f453dad46c0aecb00000d2ef8bd5e94f35fe545cbc547b3772ee2cb29a7dd3ff91f
6
+ metadata.gz: 7d9d3802c169f108379c88652c44be78b26930f94c6d3d5447f945983307bfd639daa2944c4df4b4b2a008c197d10d7f1df9b3cdfb7cedcbea251db725253e07
7
+ data.tar.gz: a5539c1057a057e1023f5ab742bfc71055027b1acf3d61818f2c3c75bbaf3fd47f8b7b851b1061f1a6455a0d22b38288e2785d6500d7cdb4569421e2154163a1
data/bin/xrpn CHANGED
@@ -2,11 +2,6 @@
2
2
  # encoding: utf-8
3
3
 
4
4
  # GET EXTENSIONS
5
- begin
6
- require 'xrpn'
7
- rescue LoadError
8
- puts "You may want to install xrpn via `gem install xrpn`"
9
- end
10
5
  require 'optparse'
11
6
  require 'io/console'
12
7
  require 'date'
@@ -14,6 +9,11 @@ require 'bigdecimal'
14
9
  require 'open-uri'
15
10
  require 'json'
16
11
  require 'tty-prompt'
12
+ begin
13
+ require 'xrpn'
14
+ rescue LoadError
15
+ puts "You may want to install xrpn via `gem install xrpn`"
16
+ end
17
17
 
18
18
  # ENSURE DIRs
19
19
  Dir.mkdir(Dir.home + "/.xrpn") unless File.exist?(Dir.home + "/.xrpn")
@@ -1,2 +1,3 @@
1
+ puts "Loading..."
1
2
  Dir[__dir__ + "/../xlib/*"].each { |file| load file }
2
3
  Dir[__dir__ + "/../xcmd/*"].each { |file| load file }
data/xcmd/abs ADDED
@@ -0,0 +1,7 @@
1
+ class XRPN
2
+ def abs
3
+ @x = @x.abs
4
+ end
5
+ end
6
+
7
+ # vim:ft=ruby:
data/xcmd/acos ADDED
@@ -0,0 +1,10 @@
1
+ class XRPN
2
+ def acos
3
+ @l = @x
4
+ @x = Math::acos(@x)
5
+ @x = @x.to_deg if @deg == "deg"
6
+ @x = @x.to_grad if @deg == "grad"
7
+ end
8
+ end
9
+
10
+ # vim:ft=ruby:
data/xcmd/adate ADDED
@@ -0,0 +1,12 @@
1
+ class XRPN
2
+ def adate
3
+ d = @x.to_s
4
+ if @flg["31"] # DMY
5
+ @a += d.sub(/(\d*)\.(\d\d)\d\d(\d\d)\d*/, '\1.\2.\3')
6
+ else # MDY
7
+ @a += d.sub(/(\d*)\.(\d\d)\d\d(\d\d)\d*/, '\1/\2/\3')
8
+ end
9
+ end
10
+ end
11
+
12
+ # vim:ft=ruby:
data/xcmd/adateiso ADDED
@@ -0,0 +1,13 @@
1
+ class XRPN
2
+ def adateiso
3
+ d = @x.to_s
4
+ d = "0" + d if d.match(/^\d\./)
5
+ if @flg["31"] # DMY
6
+ @a += d.sub(/(\d*)\.(\d\d)(\d\d\d\d)\d*/, '\3-\2-\1')
7
+ else # MDY
8
+ @a += d.sub(/(\d*)\.(\d\d)(\d\d\d\d)\d*/, '\3-\1-\2')
9
+ end
10
+ end
11
+ end
12
+
13
+ # vim:ft=ruby:
data/xcmd/add ADDED
@@ -0,0 +1,9 @@
1
+ class XRPN
2
+ def +
3
+ @l = @x
4
+ @x = @y + @x
5
+ dropy
6
+ end
7
+ end
8
+
9
+ # vim:ft=ruby:
data/xcmd/adv ADDED
@@ -0,0 +1,7 @@
1
+ class XRPN
2
+ def adv
3
+ puts "\n"
4
+ end
5
+ end
6
+
7
+ # vim:ft=ruby:
data/xcmd/agsub ADDED
@@ -0,0 +1,8 @@
1
+ class XRPN
2
+ def agsub
3
+ return unless (@x.is_a? String and @y.is_a? String)
4
+ @a.gsub!(Regexp.new(@x), @y)
5
+ end
6
+ end
7
+
8
+ # vim:ft=ruby:
data/xcmd/aleng ADDED
@@ -0,0 +1,8 @@
1
+ class XRPN
2
+ def aleng
3
+ lift
4
+ @x = @a.length
5
+ end
6
+ end
7
+
8
+ # vim:ft=ruby:
data/xcmd/almcat ADDED
@@ -0,0 +1,7 @@
1
+ class XRPN
2
+ def almcat
3
+ return "ALMCAT: No clock, alarm or stopwatch functions are implemented"
4
+ end
5
+ end
6
+
7
+ # vim:ft=ruby:
data/xcmd/almnow ADDED
@@ -0,0 +1,7 @@
1
+ class XRPN
2
+ def almnow
3
+ return "ALMNOW: No clock, alarm or stopwatch functions are implemented"
4
+ end
5
+ end
6
+
7
+ # vim:ft=ruby:
data/xcmd/anum ADDED
@@ -0,0 +1,10 @@
1
+ class XRPN
2
+ def anum
3
+ lift
4
+ n = @a.scan(/[\d.,e]+/).first
5
+ n.sub!(/,/, '.') unless @dot
6
+ @x = n.to_f
7
+ end
8
+ end
9
+
10
+ # vim:ft=ruby:
data/xcmd/aoff ADDED
@@ -0,0 +1,7 @@
1
+ class XRPN
2
+ def aoff
3
+ return "AOFF: As with AON, no real need for that function"
4
+ end
5
+ end
6
+
7
+ # vim:ft=ruby:
data/xcmd/aon ADDED
@@ -0,0 +1,7 @@
1
+ class XRPN
2
+ def aon
3
+ return "AON: No real need for that function"
4
+ end
5
+ end
6
+
7
+ # vim:ft=ruby:
data/xcmd/appchr ADDED
@@ -0,0 +1,13 @@
1
+ class XRPN
2
+ def appchr
3
+ if @xmcont[0][0] == ""
4
+ return
5
+ else
6
+ r = @xmcont[0][3].to_i + 1
7
+ @xmcont[r] += @a
8
+ savexm
9
+ end
10
+ end
11
+ end
12
+
13
+ # vim:ft=ruby:
data/xcmd/apprec ADDED
@@ -0,0 +1,13 @@
1
+ class XRPN
2
+ def apprec
3
+ if @xmcont[0][0] == ""
4
+ return
5
+ else
6
+ @xmcont[0][3] = @xmcont[0][3].to_i + 1.0
7
+ @xmcont.insert(@xmcont[0][3].to_i + 1, @a)
8
+ savexm
9
+ end
10
+ end
11
+ end
12
+
13
+ # vim:ft=ruby:
data/xcmd/arcl ADDED
@@ -0,0 +1,22 @@
1
+ class XRPN
2
+ def arcl (r)
3
+ a = false
4
+ case r.downcase
5
+ when "x"
6
+ a = @x
7
+ when "y"
8
+ a = @y
9
+ when "z"
10
+ a = @z
11
+ when "t"
12
+ a = @t
13
+ end
14
+ a ? @a += numformat(a) : @a += numformat(@reg[r])
15
+ if @a == nil
16
+ @reg[r] = ""
17
+ @a = ""
18
+ end
19
+ end
20
+ end
21
+
22
+ # vim:ft=ruby:
data/xcmd/arcli ADDED
@@ -0,0 +1,7 @@
1
+ class XRPN
2
+ def arcli
3
+ @a += @x.to_i.to_s
4
+ end
5
+ end
6
+
7
+ # vim:ft=ruby:
data/xcmd/arclrec ADDED
@@ -0,0 +1,30 @@
1
+ class XRPN
2
+ def arclrec
3
+ if @xmcont[0][0] == ""
4
+ return
5
+ else
6
+ if @xmcont[0][3] > @xmcont.length - 2
7
+ @xmcont[0][3] = 0.0
8
+ return "END OF FILE"
9
+ end
10
+ r, c = getpt
11
+ n = 24 - @a.length
12
+ n = 0 if n < 0
13
+ e = c + n
14
+ n > 0 ? s = @xmcont[r][c..e - 1] : s = ""
15
+ @a += s
16
+ if e > @xmcont[r].length - 2
17
+ setpt(r + 1, 0)
18
+ @flg["17"] = true
19
+ elsif n > 0
20
+ p c, n, @xmcont[0][3]
21
+ setpt(r, e + 1)
22
+ p "After", @xmcont[0][3]
23
+ @flg["17"] = false
24
+ end
25
+ savexm
26
+ end
27
+ end
28
+ end
29
+
30
+ # vim:ft=ruby:
data/xcmd/arot ADDED
@@ -0,0 +1,13 @@
1
+ class XRPN
2
+ def arot
3
+ if @x > 0
4
+ r = (@x - 1).to_i
5
+ @a = @a[(r + 1)..] + @a[0..r]
6
+ elsif @x < 0
7
+ r = (@x - 1).abs.to_i
8
+ @a = @a[(r - 1)..] + @a[0..(r - 2)]
9
+ end
10
+ end
11
+ end
12
+
13
+ # vim:ft=ruby:
data/xcmd/ashf ADDED
@@ -0,0 +1,7 @@
1
+ class XRPN
2
+ def ashf
3
+ @a = @a[6..]
4
+ end
5
+ end
6
+
7
+ # vim:ft=ruby:
data/xcmd/asin ADDED
@@ -0,0 +1,10 @@
1
+ class XRPN
2
+ def asin
3
+ @l = @x
4
+ @x = Math::asin(@x)
5
+ @x = @x.to_deg if @deg == "deg"
6
+ @x = @x.to_grad if @deg == "grad"
7
+ end
8
+ end
9
+
10
+ # vim:ft=ruby:
data/xcmd/asroom ADDED
@@ -0,0 +1,7 @@
1
+ class XRPN
2
+ def asroom
3
+ return "ASROOM: There's always plenty of room"
4
+ end
5
+ end
6
+
7
+ # vim:ft=ruby:
data/xcmd/asto ADDED
@@ -0,0 +1,21 @@
1
+ class XRPN
2
+ def asto (r)
3
+ case r.downcase
4
+ when "x"
5
+ @l = @x
6
+ @x = @a
7
+ when "y"
8
+ @y = @a
9
+ when "z"
10
+ @z = @a
11
+ when "t"
12
+ @t = @a
13
+ when "l"
14
+ @l = @a
15
+ else
16
+ @reg[r] = @a
17
+ end
18
+ end
19
+ end
20
+
21
+ # vim:ft=ruby:
data/xcmd/asub ADDED
@@ -0,0 +1,8 @@
1
+ class XRPN
2
+ def asub
3
+ return unless (@x.is_a? String and @y.is_a? String)
4
+ @a.sub!(Regexp.new(@x), @y)
5
+ end
6
+ end
7
+
8
+ # vim:ft=ruby:
data/xcmd/atan ADDED
@@ -0,0 +1,10 @@
1
+ class XRPN
2
+ def atan
3
+ @l = @x
4
+ @x = Math::atan(@x)
5
+ @x = @x.to_deg if @deg == "deg"
6
+ @x = @x.to_grad if @deg == "grad"
7
+ end
8
+ end
9
+
10
+ # vim:ft=ruby:
data/xcmd/atime ADDED
@@ -0,0 +1,26 @@
1
+ class XRPN
2
+ def atime
3
+ t = @x.to_f
4
+ am = true
5
+ case t
6
+ when ..-12
7
+ t = t.abs
8
+ when -12..-1
9
+ t = t.abs
10
+ am = false
11
+ t += 12 if @clk24
12
+ when -1..0
13
+ t = t.abs
14
+ end
15
+ t = BigDecimal(t.to_s).truncate(@i).to_f
16
+ h = t.to_i
17
+ m = (100 * (t - h)).to_i
18
+ s = (100 * (100 * (t -h) - m)).round(@i)
19
+ @a += "#{h}:#{m}:#{s}"
20
+ if @clk24 == false
21
+ am ? @a += " AM" : @a += " PM"
22
+ end
23
+ end
24
+ end
25
+
26
+ # vim:ft=ruby:
data/xcmd/atime24 ADDED
@@ -0,0 +1,21 @@
1
+ class XRPN
2
+ def atime24
3
+ t = @x.to_f
4
+ case t
5
+ when ..-12
6
+ t = t.abs
7
+ when -12..-1
8
+ t = t.abs
9
+ t += 12
10
+ when -1..0
11
+ t = t.abs
12
+ end
13
+ t = BigDecimal(t.to_s).truncate(@i).to_f
14
+ h = t.to_i
15
+ m = (100 * (t - h)).to_i
16
+ s = (100 * (100 * (t -h) - m)).round(@i)
17
+ @a += "#{h}:#{m}:#{s}"
18
+ end
19
+ end
20
+
21
+ # vim:ft=ruby:
data/xcmd/atox ADDED
@@ -0,0 +1,9 @@
1
+ class XRPN
2
+ def atox
3
+ lift
4
+ @x = @a[0].ord
5
+ @a = @a[1..]
6
+ end
7
+ end
8
+
9
+ # vim:ft=ruby:
data/xcmd/aview ADDED
@@ -0,0 +1,7 @@
1
+ class XRPN
2
+ def aview
3
+ puts @a.c_a(1)
4
+ end
5
+ end
6
+
7
+ # vim:ft=ruby:
data/xcmd/aviewc ADDED
@@ -0,0 +1,7 @@
1
+ class XRPN
2
+ def aviewc
3
+ puts @a.color(@x.to_i)
4
+ end
5
+ end
6
+
7
+ # vim:ft=ruby:
data/xcmd/beep ADDED
@@ -0,0 +1,7 @@
1
+ class XRPN
2
+ def beep
3
+ `xdg-open ~/.xrpn/extra/beep41.wav`
4
+ end
5
+ end
6
+
7
+ # vim:ft=ruby:
data/xcmd/bindec ADDED
@@ -0,0 +1,8 @@
1
+ class XRPN
2
+ def bindec
3
+ @l = @x
4
+ @x = @x.to_s.convert_base(2, 10).to_f
5
+ end
6
+ end
7
+
8
+ # vim:ft=ruby:
data/xcmd/cat ADDED
@@ -0,0 +1,26 @@
1
+ class XRPN
2
+ def cat (c)
3
+ case c.to_i
4
+ when 1
5
+ pcat
6
+ when 3
7
+ puts "Commands:"
8
+ i = 1
9
+ $cmd.each do |cm|
10
+ print cm.ljust(12)
11
+ print "\n" if i % 7 == 0
12
+ i += 1
13
+ end
14
+ print "\n"
15
+ when 4
16
+ Dir[Dir.home+"/.xrpn/data/*"].each do |file|
17
+ f = file.sub(/.*\/(.*)\...$/, '\1')
18
+ t = file.sub(/.*\.(..)$/, '\1').upcase
19
+ l = File.size(file) / 7
20
+ puts "#{f.ljust(12)} #{t} #{l.to_s.rjust(4)}"
21
+ end
22
+ end
23
+ end
24
+ end
25
+
26
+ # vim:ft=ruby:
data/xcmd/cf ADDED
@@ -0,0 +1,7 @@
1
+ class XRPN
2
+ def cf (r)
3
+ @flg[r] = false
4
+ end
5
+ end
6
+
7
+ # vim:ft=ruby:
data/xcmd/chs ADDED
@@ -0,0 +1,7 @@
1
+ class XRPN
2
+ def chs
3
+ @x = -@x
4
+ end
5
+ end
6
+
7
+ # vim:ft=ruby:
data/xcmd/cla ADDED
@@ -0,0 +1,7 @@
1
+ class XRPN
2
+ def cla
3
+ @a = ""
4
+ end
5
+ end
6
+
7
+ # vim:ft=ruby:
data/xcmd/clalma ADDED
@@ -0,0 +1,7 @@
1
+ class XRPN
2
+ def clalma
3
+ return "CLALMA: No clock, alarm or stopwatch functions are implemented"
4
+ end
5
+ end
6
+
7
+ # vim:ft=ruby:
data/xcmd/clalmx ADDED
@@ -0,0 +1,7 @@
1
+ class XRPN
2
+ def clalmx
3
+ return "CLALMX: No clock, alarm or stopwatch functions are implemented"
4
+ end
5
+ end
6
+
7
+ # vim:ft=ruby:
data/xcmd/cld ADDED
@@ -0,0 +1,6 @@
1
+ class XRPN
2
+ def cld
3
+ end
4
+ end
5
+
6
+ # vim:ft=ruby:
data/xcmd/clear ADDED
@@ -0,0 +1,7 @@
1
+ class XRPN
2
+ def clear
3
+ system("clear")
4
+ end
5
+ end
6
+
7
+ # vim:ft=ruby:
data/xcmd/clfl ADDED
@@ -0,0 +1,13 @@
1
+ class XRPN
2
+ def clfl
3
+ if @xmcont[0][0] == ""
4
+ return
5
+ else
6
+ @xmcont = [@xmcont[0]]
7
+ @xmcont[0][3] = 0.0
8
+ savexm
9
+ end
10
+ end
11
+ end
12
+
13
+ # vim:ft=ruby:
data/xcmd/clk12 ADDED
@@ -0,0 +1,7 @@
1
+ class XRPN
2
+ def clk12
3
+ @clk24 = false
4
+ end
5
+ end
6
+
7
+ # vim:ft=ruby:
data/xcmd/clk24 ADDED
@@ -0,0 +1,7 @@
1
+ class XRPN
2
+ def clk24
3
+ @clk24 = true
4
+ end
5
+ end
6
+
7
+ # vim:ft=ruby:
data/xcmd/clkeys ADDED
@@ -0,0 +1,7 @@
1
+ class XRPN
2
+ def clkeys
3
+ return "CLKEYS: No need for this function as there is no calculator keyboard here."
4
+ end
5
+ end
6
+
7
+ # vim:ft=ruby:
data/xcmd/clock ADDED
@@ -0,0 +1,7 @@
1
+ class XRPN
2
+ def clock
3
+ return "CLOCK: Tick, tock... not implemented."
4
+ end
5
+ end
6
+
7
+ # vim:ft=ruby:
data/xcmd/clp ADDED
@@ -0,0 +1,8 @@
1
+ class XRPN
2
+ def clp (p)
3
+ page, pos, prgm = locate_prg (p)
4
+ @prg[page] -= prgm
5
+ end
6
+ end
7
+
8
+ # vim:ft=ruby:
data/xcmd/clralms ADDED
@@ -0,0 +1,7 @@
1
+ class XRPN
2
+ def clralms
3
+ return "CLRALMS: No clock, alarm or stopwatch functions are implemented"
4
+ end
5
+ end
6
+
7
+ # vim:ft=ruby:
data/xcmd/clrg ADDED
@@ -0,0 +1,7 @@
1
+ class XRPN
2
+ def clrg
3
+ @reg.each_key {|key| @reg[key] = 0 }
4
+ end
5
+ end
6
+
7
+ # vim:ft=ruby:
data/xcmd/clrgx ADDED
@@ -0,0 +1,12 @@
1
+ class XRPN
2
+ def clrgx
3
+ b, e, i = x2bei(@x)
4
+ j = b
5
+ until j > e do
6
+ @reg[j] = 0
7
+ j += i
8
+ end
9
+ end
10
+ end
11
+
12
+ # vim:ft=ruby:
data/xcmd/cls ADDED
@@ -0,0 +1,12 @@
1
+ class XRPN
2
+ def cls
3
+ @reg[@srg + 0] = 0.0
4
+ @reg[@srg + 1] = 0.0
5
+ @reg[@srg + 2] = 0.0
6
+ @reg[@srg + 3] = 0.0
7
+ @reg[@srg + 4] = 0.0
8
+ @reg[@srg + 5] = 0.0
9
+ end
10
+ end
11
+
12
+ # vim:ft=ruby:
data/xcmd/clst ADDED
@@ -0,0 +1,10 @@
1
+ class XRPN
2
+ def clst
3
+ @x = 0.0
4
+ @y = 0.0
5
+ @z = 0.0
6
+ @t = 0.0
7
+ end
8
+ end
9
+
10
+ # vim:ft=ruby:
data/xcmd/clx ADDED
@@ -0,0 +1,8 @@
1
+ class XRPN
2
+ def clx
3
+ @x = 0.0
4
+ @nolift = true
5
+ end
6
+ end
7
+
8
+ # vim:ft=ruby: