xrpn 1.2 → 1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (268) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -5
  3. data/bin/xrpn +2 -1
  4. data/xcmd/abs +1 -0
  5. data/xcmd/acos +1 -0
  6. data/xcmd/adate +1 -0
  7. data/xcmd/adateiso +1 -0
  8. data/xcmd/add +1 -0
  9. data/xcmd/adv +1 -0
  10. data/xcmd/agsub +1 -0
  11. data/xcmd/aleng +1 -0
  12. data/xcmd/almcat +1 -0
  13. data/xcmd/almnow +1 -0
  14. data/xcmd/anum +1 -0
  15. data/xcmd/aoff +1 -0
  16. data/xcmd/aon +1 -0
  17. data/xcmd/appchr +1 -0
  18. data/xcmd/apprec +1 -0
  19. data/xcmd/arcl +1 -0
  20. data/xcmd/arcli +1 -0
  21. data/xcmd/arclrec +1 -0
  22. data/xcmd/arot +1 -0
  23. data/xcmd/ashf +1 -0
  24. data/xcmd/asin +1 -0
  25. data/xcmd/asroom +1 -0
  26. data/xcmd/asto +1 -0
  27. data/xcmd/asub +1 -0
  28. data/xcmd/atan +1 -0
  29. data/xcmd/atime +1 -0
  30. data/xcmd/atime24 +1 -0
  31. data/xcmd/atox +1 -0
  32. data/xcmd/aview +1 -0
  33. data/xcmd/aviewc +1 -0
  34. data/xcmd/beep +1 -0
  35. data/xcmd/bindec +1 -0
  36. data/xcmd/cat +1 -0
  37. data/xcmd/cf +1 -0
  38. data/xcmd/chs +2 -1
  39. data/xcmd/cla +2 -1
  40. data/xcmd/clalma +1 -0
  41. data/xcmd/clalmx +1 -0
  42. data/xcmd/cld +1 -0
  43. data/xcmd/clear +1 -0
  44. data/xcmd/clfl +2 -1
  45. data/xcmd/clk12 +2 -1
  46. data/xcmd/clk24 +2 -1
  47. data/xcmd/clkeys +1 -0
  48. data/xcmd/clock +1 -0
  49. data/xcmd/clp +1 -0
  50. data/xcmd/clralms +1 -0
  51. data/xcmd/clrg +2 -1
  52. data/xcmd/clrgx +2 -1
  53. data/xcmd/cls +2 -1
  54. data/xcmd/clst +2 -1
  55. data/xcmd/clx +2 -1
  56. data/xcmd/cmdadd +2 -1
  57. data/xcmd/cmddel +2 -1
  58. data/xcmd/cmdhelp +23 -0
  59. data/xcmd/correct +1 -0
  60. data/xcmd/cos +1 -0
  61. data/xcmd/crflas +2 -1
  62. data/xcmd/crfld +2 -1
  63. data/xcmd/cube +2 -1
  64. data/xcmd/d_r +2 -1
  65. data/xcmd/date +2 -1
  66. data/xcmd/dateplus +2 -1
  67. data/xcmd/ddate +2 -1
  68. data/xcmd/dec +2 -1
  69. data/xcmd/decbin +2 -1
  70. data/xcmd/dechex +2 -1
  71. data/xcmd/decoct +2 -1
  72. data/xcmd/deg +2 -1
  73. data/xcmd/degq +2 -1
  74. data/xcmd/delchr +2 -1
  75. data/xcmd/delrec +2 -1
  76. data/xcmd/divide +2 -1
  77. data/xcmd/dmy +2 -1
  78. data/xcmd/dot +1 -0
  79. data/xcmd/dow +2 -1
  80. data/xcmd/drop +2 -1
  81. data/xcmd/dropy +2 -1
  82. data/xcmd/dse +1 -0
  83. data/xcmd/ed +1 -0
  84. data/xcmd/emdir +2 -1
  85. data/xcmd/emdirx +2 -1
  86. data/xcmd/emroom +1 -0
  87. data/xcmd/end +1 -0
  88. data/xcmd/eng +1 -0
  89. data/xcmd/enter +2 -1
  90. data/xcmd/exp +2 -1
  91. data/xcmd/expx1 +2 -1
  92. data/xcmd/fact +2 -1
  93. data/xcmd/fc +1 -0
  94. data/xcmd/fcc +1 -0
  95. data/xcmd/fcs +1 -0
  96. data/xcmd/fix +1 -0
  97. data/xcmd/fixq +2 -1
  98. data/xcmd/flsize +1 -0
  99. data/xcmd/frc +2 -1
  100. data/xcmd/fs +1 -0
  101. data/xcmd/fsc +1 -0
  102. data/xcmd/fss +1 -0
  103. data/xcmd/geir +2 -1
  104. data/xcmd/getas +2 -1
  105. data/xcmd/getfile +2 -1
  106. data/xcmd/getfilea +2 -1
  107. data/xcmd/getkey +2 -1
  108. data/xcmd/getkeyx +2 -1
  109. data/xcmd/getp +2 -1
  110. data/xcmd/getr +2 -1
  111. data/xcmd/getrec +2 -1
  112. data/xcmd/getrx +2 -1
  113. data/xcmd/getsub +1 -0
  114. data/xcmd/getweb +2 -1
  115. data/xcmd/getx +2 -1
  116. data/xcmd/grad +2 -1
  117. data/xcmd/gsb +1 -0
  118. data/xcmd/gto +1 -0
  119. data/xcmd/help +2 -1
  120. data/xcmd/hexdec +2 -1
  121. data/xcmd/hms +2 -1
  122. data/xcmd/hmsminus +2 -1
  123. data/xcmd/hmsplus +2 -1
  124. data/xcmd/hr +2 -1
  125. data/xcmd/inschr +2 -1
  126. data/xcmd/insrec +2 -1
  127. data/xcmd/int +2 -1
  128. data/xcmd/invf +1 -0
  129. data/xcmd/isg +1 -0
  130. data/xcmd/lastx +2 -1
  131. data/xcmd/lbl +1 -0
  132. data/xcmd/lift +2 -1
  133. data/xcmd/ln +2 -1
  134. data/xcmd/ln1x +2 -1
  135. data/xcmd/log +1 -0
  136. data/xcmd/mdy +2 -1
  137. data/xcmd/mean +2 -1
  138. data/xcmd/mod +1 -0
  139. data/xcmd/multiply +1 -0
  140. data/xcmd/oct +2 -1
  141. data/xcmd/octdec +2 -1
  142. data/xcmd/off +2 -1
  143. data/xcmd/on +1 -0
  144. data/xcmd/p_r +2 -1
  145. data/xcmd/pack +1 -0
  146. data/xcmd/page +1 -0
  147. data/xcmd/pagedel +1 -0
  148. data/xcmd/pageq +2 -1
  149. data/xcmd/pageswap +2 -1
  150. data/xcmd/pasn +1 -0
  151. data/xcmd/pcat +2 -1
  152. data/xcmd/pclps +2 -1
  153. data/xcmd/percent +1 -0
  154. data/xcmd/percentch +1 -0
  155. data/xcmd/pi +2 -1
  156. data/xcmd/posa +2 -1
  157. data/xcmd/posfl +2 -1
  158. data/xcmd/pow +2 -1
  159. data/xcmd/pprg +2 -1
  160. data/xcmd/pprgx +1 -1
  161. data/xcmd/pra +2 -1
  162. data/xcmd/prflags +2 -1
  163. data/xcmd/prompt +2 -1
  164. data/xcmd/prp +2 -1
  165. data/xcmd/prregs +2 -1
  166. data/xcmd/prstk +2 -1
  167. data/xcmd/prx +2 -1
  168. data/xcmd/prxm +2 -1
  169. data/xcmd/pse +2 -1
  170. data/xcmd/psize +1 -0
  171. data/xcmd/purfl +2 -1
  172. data/xcmd/r_d +1 -0
  173. data/xcmd/r_p +2 -1
  174. data/xcmd/rad +2 -1
  175. data/xcmd/rand +2 -1
  176. data/xcmd/rcl +1 -0
  177. data/xcmd/rclaf +1 -0
  178. data/xcmd/rclflag +2 -1
  179. data/xcmd/rclpt +2 -1
  180. data/xcmd/rclpta +2 -1
  181. data/xcmd/rclsw +1 -0
  182. data/xcmd/rdn +2 -1
  183. data/xcmd/recip +1 -0
  184. data/xcmd/regmove +2 -1
  185. data/xcmd/regswap +2 -1
  186. data/xcmd/reload +2 -1
  187. data/xcmd/reszfl +1 -0
  188. data/xcmd/rnd +2 -1
  189. data/xcmd/root +2 -1
  190. data/xcmd/rtn +2 -1
  191. data/xcmd/rubycmd +2 -1
  192. data/xcmd/runsw +1 -0
  193. data/xcmd/rup +2 -1
  194. data/xcmd/saveas +2 -1
  195. data/xcmd/savep +2 -1
  196. data/xcmd/saver +2 -1
  197. data/xcmd/saverx +2 -1
  198. data/xcmd/savex +2 -1
  199. data/xcmd/savexm +2 -1
  200. data/xcmd/sci +1 -0
  201. data/xcmd/sdev +2 -1
  202. data/xcmd/seekpt +2 -1
  203. data/xcmd/seekpta +2 -1
  204. data/xcmd/sep +1 -0
  205. data/xcmd/setaf +1 -0
  206. data/xcmd/setsw +1 -0
  207. data/xcmd/sf +1 -0
  208. data/xcmd/shellcmd +2 -1
  209. data/xcmd/sign +2 -1
  210. data/xcmd/sin +1 -0
  211. data/xcmd/size +1 -0
  212. data/xcmd/sizeq +1 -0
  213. data/xcmd/sminus +1 -0
  214. data/xcmd/splus +1 -0
  215. data/xcmd/sqr +2 -1
  216. data/xcmd/sqrt +2 -1
  217. data/xcmd/sreg +1 -0
  218. data/xcmd/sregq +2 -1
  219. data/xcmd/stdivide +1 -0
  220. data/xcmd/stmultiply +1 -0
  221. data/xcmd/sto +1 -0
  222. data/xcmd/stoflag +2 -1
  223. data/xcmd/stop +2 -1
  224. data/xcmd/stopsw +1 -0
  225. data/xcmd/stplus +1 -0
  226. data/xcmd/stsubtract +1 -0
  227. data/xcmd/subtract +1 -0
  228. data/xcmd/sw +1 -0
  229. data/xcmd/swap +2 -1
  230. data/xcmd/swpt +1 -0
  231. data/xcmd/tan +1 -0
  232. data/xcmd/tenx +2 -1
  233. data/xcmd/time +2 -1
  234. data/xcmd/tx +1 -0
  235. data/xcmd/version +1 -0
  236. data/xcmd/view +1 -0
  237. data/xcmd/writefile +2 -1
  238. data/xcmd/xeq +1 -0
  239. data/xcmd/xeq0 +2 -1
  240. data/xcmd/xeqnn +2 -1
  241. data/xcmd/xeqy +2 -1
  242. data/xcmd/xf +1 -0
  243. data/xcmd/xgt0 +2 -1
  244. data/xcmd/xgteq0 +2 -1
  245. data/xcmd/xgteqnn +2 -1
  246. data/xcmd/xgteqy +2 -1
  247. data/xcmd/xgtnn +2 -1
  248. data/xcmd/xgty +2 -1
  249. data/xcmd/xlt0 +2 -1
  250. data/xcmd/xlteq0 +2 -1
  251. data/xcmd/xlteqnn +2 -1
  252. data/xcmd/xlteqy +2 -1
  253. data/xcmd/xltnn +2 -1
  254. data/xcmd/xlty +2 -1
  255. data/xcmd/xmexistq +2 -1
  256. data/xcmd/xmfileq +2 -1
  257. data/xcmd/xneq0 +2 -1
  258. data/xcmd/xneqnn +2 -1
  259. data/xcmd/xneqy +2 -1
  260. data/xcmd/xnn +1 -0
  261. data/xcmd/xtoa +2 -1
  262. data/xcmd/xy +2 -1
  263. data/xcmd/xyzalm +1 -0
  264. data/xlib/_xrpn_version +1 -1
  265. data/xlib/debug_mode +2 -18
  266. data/xlib/read_xcmd +4 -4
  267. data/xrpn.gemspec +1 -1
  268. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4c4ea1cc27787e1898612bac796dc5331524da5053c84fce79ad7edb25bb011b
4
- data.tar.gz: 9c1605ed8cb190188ed604eca2fc4b6b7eb284f4aab5d7f6e65daef461cd41f3
3
+ metadata.gz: dde19bba9fcbbbce58e8447c363ceff212510f83d86d5b8bfa62f9156e3876e5
4
+ data.tar.gz: c06bdf45c23fcebfa983205fc4af530c28492e35a32bbe45a0008c8e1145aca9
5
5
  SHA512:
6
- metadata.gz: '04318bc2509ce3c5afdaf464f982ce3ecb9e9e5d101f3b8ceba58be24118fd0136ab9dedd2b2507d815ef989fdf07d379e6082e866dd9435257af8b389943249'
7
- data.tar.gz: a8e8cf8965a48cbb882afba983b10c86537eed2bc804f19f19672a2479db96678ebdb8b9533374da9eac7211306458d135e916471d31f42eecce7ce6f870ae02
6
+ metadata.gz: 487924f70e9fd85bc45b18521fd153d764ea1f94327f175411441886ef986e398154be889976784dbf53b356cdef7074d1462cf95e10d6971158fce6a331ce58
7
+ data.tar.gz: 34997709120a14cbd8759bfa9c99d91054b7bf5df752951e29540af9d13476e2b9b0d34f68ddae2051fdc80a28d589944ee9f30c95a874e6d97fb2630438a747
data/README.md CHANGED
@@ -16,11 +16,7 @@ XRPN implements indirect addressing, self-modification and features well beyond
16
16
 
17
17
  You need Ruby installed to get XRPN to work.
18
18
 
19
- You also need to install the Ruby Gem tty-prompt: `gem install tty-prompt`
20
-
21
- To install XRPN, simply clone this repository and run the script `INSTALL.sh`. It is only tested on Linux but should work well on Mac OS and BSD systems. If you are on Windows, please tell me if it works in that environment. The install script will put create a symbolic link in your home directory - named ".xrpn" to make it a hidden directory - pointing to the cloned repo. It will also attempt to add a symlink to "~/bin" to make it easy to run XRPN.
22
-
23
- A Ruby Gemfile will be created soon that will make all this a lot easier.
19
+ To install XRPN, you can do `gem install 'xrpn'` or by cloning this repository and run the script `INSTALL.sh`. It is only tested on Linux but should work well on Mac OS and BSD systems. If you are on Windows, please tell me if it works in that environment. The install script will put create a symbolic link in your home directory - named ".xrpn" to make it a hidden directory - pointing to the cloned repo. It will also attempt to add a symlink to "~/bin" to make it easy to run XRPN. If you install XRPN by cloning this repo, you also need to install the Ruby Gem tty-prompt: `gem install tty-prompt`. If you install via `gem install 'xrpn'`, then this dependency is automatically taken care of. The gem is slower on startup than running XRPN from this repo.
24
20
 
25
21
  ## Run
26
22
 
data/bin/xrpn CHANGED
@@ -10,7 +10,7 @@ require 'open-uri'
10
10
  require 'json'
11
11
  require 'tty-prompt'
12
12
 
13
- $gem = Gem.latest_spec_for("xrpn").gem_dir if `gem list -i "^xrpn$"`
13
+ $gem = Gem.latest_spec_for("xrpn").gem_dir
14
14
 
15
15
  # ENSURE DIRs
16
16
  Dir.mkdir(Dir.home + "/.xrpn") unless File.exist?(Dir.home + "/.xrpn")
@@ -77,6 +77,7 @@ load(Dir.home+'/.xrpn/theme') if File.exist?(Dir.home+'/.xrpn/theme') # Override
77
77
  # THE CORE OF THE RPN PROGRAM
78
78
  @nl = false # Nolift set to false
79
79
  @i = 0 # Counter to prevent infinite loops
80
+ @debugprompt = TTY::Prompt.new
80
81
  until @p.pc == @p.prg[@p.pg].length do
81
82
  # Enter debug mode if $debug or $prompt is set, else read next program line
82
83
  ($debug or $prompt) ? debug_mode : @line = @p.prg[@p.pg][@p.pc]
data/xcmd/abs CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Return absolute value of X to X
2
3
  def abs
3
4
  @x = @x.abs
4
5
  end
data/xcmd/acos CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Return Arc COS of X to X
2
3
  def acos
3
4
  @l = @x
4
5
  @x = Math::acos(@x)
data/xcmd/adate CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Return a formatted date in X to Alpha
2
3
  def adate
3
4
  d = @x.to_s
4
5
  if @flg["31"] # DMY
data/xcmd/adateiso CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Return date in X (DD.MMYYYY or MM.DDYYYY) as YYYY-MM-DD in Alpha
2
3
  def adateiso
3
4
  d = @x.to_s
4
5
  d = "0" + d if d.match(/^\d\./)
data/xcmd/add CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Return X + Y to X
2
3
  def +
3
4
  @l = @x
4
5
  @x = @y + @x
data/xcmd/adv CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Add a line in the printout
2
3
  def adv
3
4
  puts "\n"
4
5
  end
data/xcmd/agsub CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Substitute all instances in Alpha matching the regexp in X by the content in Y
2
3
  def agsub
3
4
  return unless (@x.is_a? String and @y.is_a? String)
4
5
  @a.gsub!(Regexp.new(@x), @y)
data/xcmd/aleng CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Return length of Alpha string to X
2
3
  def aleng
3
4
  lift
4
5
  @x = @a.length
data/xcmd/almcat CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Alarm catalog (no alarm functions implemented)
2
3
  def almcat
3
4
  return "ALMCAT: No clock, alarm or stopwatch functions are implemented"
4
5
  end
data/xcmd/almnow CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Fire alarm now (no alarm functions implemented)
2
3
  def almnow
3
4
  return "ALMNOW: No clock, alarm or stopwatch functions are implemented"
4
5
  end
data/xcmd/anum CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Return first number in Alpha to X
2
3
  def anum
3
4
  lift
4
5
  n = @a.scan(/[\d.,e]+/).first
data/xcmd/aoff CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Alpha OFF (no need, just enclose all Alpha entries in double quotes)
2
3
  def aoff
3
4
  return "AOFF: As with AON, no real need for that function"
4
5
  end
data/xcmd/aon CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Alpha ON (no need, just enclose all Alpha entries in double quotes)
2
3
  def aon
3
4
  return "AON: No real need for that function"
4
5
  end
data/xcmd/appchr CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Append Alpha to current XM file at pointer
2
3
  def appchr
3
4
  if @xmcont[0][0] == ""
4
5
  return
data/xcmd/apprec CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Append Alpha as next record in XM file
2
3
  def apprec
3
4
  if @xmcont[0][0] == ""
4
5
  return
data/xcmd/arcl CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Recall content of register named to Alpha
2
3
  def arcl (r)
3
4
  a = false
4
5
  case r.downcase
data/xcmd/arcli CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Recall the integer part of X to Alpha
2
3
  def arcli
3
4
  @a += @x.to_i.to_s
4
5
  end
data/xcmd/arclrec CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Add to Alpha the next record in current XM file
2
3
  def arclrec
3
4
  if @xmcont[0][0] == ""
4
5
  return
data/xcmd/arot CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Rotate Alpha at character number given in X
2
3
  def arot
3
4
  if @x > 0
4
5
  r = (@x - 1).to_i
data/xcmd/ashf CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Remove the 6 left-most characters from Alpha
2
3
  def ashf
3
4
  @a = @a[6..]
4
5
  end
data/xcmd/asin CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Return Arc SIN of X to X
2
3
  def asin
3
4
  @l = @x
4
5
  @x = Math::asin(@x)
data/xcmd/asroom CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # How much room is left in XM file? (always plenty of space)
2
3
  def asroom
3
4
  return "ASROOM: There's always plenty of room"
4
5
  end
data/xcmd/asto CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Store Alpha to named register
2
3
  def asto (r)
3
4
  case r.downcase
4
5
  when "x"
data/xcmd/asub CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Substitute the first instance in Alpha matching the regexp in X by the content in Y
2
3
  def asub
3
4
  return unless (@x.is_a? String and @y.is_a? String)
4
5
  @a.sub!(Regexp.new(@x), @y)
data/xcmd/atan CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Return Arc TAN of X to X
2
3
  def atan
3
4
  @l = @x
4
5
  @x = Math::atan(@x)
data/xcmd/atime CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Return a formatted time in X to Alpha
2
3
  def atime
3
4
  t = @x.to_f
4
5
  am = true
data/xcmd/atime24 CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Return a formatted time (as 24h time) in X to Alpha
2
3
  def atime24
3
4
  t = @x.to_f
4
5
  case t
data/xcmd/atox CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Return character code of first character in Alpha and remove that character
2
3
  def atox
3
4
  lift
4
5
  @x = @a[0].ord
data/xcmd/aview CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Print out (show) content of Alpha register
2
3
  def aview
3
4
  puts @a.c_a(1)
4
5
  end
data/xcmd/aviewc CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Print out (show) content of Alpha register in the 256-color-code specified in X
2
3
  def aviewc
3
4
  puts @a.color(@x.to_i)
4
5
  end
data/xcmd/beep CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Sound the legendary HP-41 BEEP
2
3
  def beep
3
4
  `xdg-open ~/.xrpn/extra/beep41.wav`
4
5
  end
data/xcmd/bindec CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Take X as a binary number and convert to decimal number in X
2
3
  def bindec
3
4
  @l = @x
4
5
  @x = @x.to_s.convert_base(2, 10).to_f
data/xcmd/cat CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Catalog. Only CAT 1, 3 and 4 implemented
2
3
  def cat (c)
3
4
  case c.to_i
4
5
  when 1
data/xcmd/cf CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Clear named flag
2
3
  def cf (r)
3
4
  @flg[r] = false
4
5
  end
data/xcmd/chs CHANGED
@@ -1,7 +1,8 @@
1
1
  class XRPN
2
+ # Swap sign of X (X becomes -X and -X becomes X)
2
3
  def chs
3
4
  @x = -@x
4
5
  end
5
6
  end
6
7
 
7
- # vim:ft=ruby:
8
+ # vim:ft=ruby:
data/xcmd/cla CHANGED
@@ -1,7 +1,8 @@
1
1
  class XRPN
2
+ # Clear Alpha register
2
3
  def cla
3
4
  @a = ""
4
5
  end
5
6
  end
6
7
 
7
- # vim:ft=ruby:
8
+ # vim:ft=ruby:
data/xcmd/clalma CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Clear alarm by Alpha (no alarm functions implemented)
2
3
  def clalma
3
4
  return "CLALMA: No clock, alarm or stopwatch functions are implemented"
4
5
  end
data/xcmd/clalmx CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Clear alarm by X (no alarm functions implemented)
2
3
  def clalmx
3
4
  return "CLALMX: No clock, alarm or stopwatch functions are implemented"
4
5
  end
data/xcmd/cld CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Clear display (no need)
2
3
  def cld
3
4
  end
4
5
  end
data/xcmd/clear CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Clear terminal display
2
3
  def clear
3
4
  system("clear")
4
5
  end
data/xcmd/clfl CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Clear content of XM file
2
3
  def clfl
3
4
  if @xmcont[0][0] == ""
4
5
  return
@@ -10,4 +11,4 @@ class XRPN
10
11
  end
11
12
  end
12
13
 
13
- # vim:ft=ruby:
14
+ # vim:ft=ruby:
data/xcmd/clk12 CHANGED
@@ -1,7 +1,8 @@
1
1
  class XRPN
2
+ # Make time into 12h format
2
3
  def clk12
3
4
  @clk24 = false
4
5
  end
5
6
  end
6
7
 
7
- # vim:ft=ruby:
8
+ # vim:ft=ruby:
data/xcmd/clk24 CHANGED
@@ -1,7 +1,8 @@
1
1
  class XRPN
2
+ # Make time into 24h format
2
3
  def clk24
3
4
  @clk24 = true
4
5
  end
5
6
  end
6
7
 
7
- # vim:ft=ruby:
8
+ # vim:ft=ruby:
data/xcmd/clkeys CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Clear key assignments (no keys to clear)
2
3
  def clkeys
3
4
  return "CLKEYS: No need for this function as there is no calculator keyboard here."
4
5
  end
data/xcmd/clock CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Show clock (no clock function)
2
3
  def clock
3
4
  return "CLOCK: Tick, tock... not implemented."
4
5
  end
data/xcmd/clp CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Clear named program
2
3
  def clp (p)
3
4
  page, pos, prgm = locate_prg (p)
4
5
  @prg[page] -= prgm
data/xcmd/clralms CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Clear all alarms (no alarm functions implemented)
2
3
  def clralms
3
4
  return "CLRALMS: No clock, alarm or stopwatch functions are implemented"
4
5
  end
data/xcmd/clrg CHANGED
@@ -1,7 +1,8 @@
1
1
  class XRPN
2
+ # Clear all registers
2
3
  def clrg
3
4
  @reg.each_key {|key| @reg[key] = 0 }
4
5
  end
5
6
  end
6
7
 
7
- # vim:ft=ruby:
8
+ # vim:ft=ruby:
data/xcmd/clrgx CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Clear a specific number of registers
2
3
  def clrgx
3
4
  b, e, i = x2bei(@x)
4
5
  j = b
@@ -9,4 +10,4 @@ class XRPN
9
10
  end
10
11
  end
11
12
 
12
- # vim:ft=ruby:
13
+ # vim:ft=ruby:
data/xcmd/cls CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Clear statistical data registers
2
3
  def cls
3
4
  @reg[@srg + 0] = 0.0
4
5
  @reg[@srg + 1] = 0.0
@@ -9,4 +10,4 @@ class XRPN
9
10
  end
10
11
  end
11
12
 
12
- # vim:ft=ruby:
13
+ # vim:ft=ruby:
data/xcmd/clst CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Clear the stack (but not L)
2
3
  def clst
3
4
  @x = 0.0
4
5
  @y = 0.0
@@ -7,4 +8,4 @@ class XRPN
7
8
  end
8
9
  end
9
10
 
10
- # vim:ft=ruby:
11
+ # vim:ft=ruby:
data/xcmd/clx CHANGED
@@ -1,8 +1,9 @@
1
1
  class XRPN
2
+ # Clear X
2
3
  def clx
3
4
  @x = 0.0
4
5
  @nolift = true
5
6
  end
6
7
  end
7
8
 
8
- # vim:ft=ruby:
9
+ # vim:ft=ruby:
data/xcmd/cmdadd CHANGED
@@ -1,7 +1,8 @@
1
1
  class XRPN
2
+ # Add command in Alpha to the current program at line number in X (makes it possible to write self-modifying programs)
2
3
  def cmdadd
3
4
  @prg.insert(@x.to_i, @a)
4
5
  end
5
6
  end
6
7
 
7
- # vim:ft=ruby:
8
+ # vim:ft=ruby:
data/xcmd/cmddel CHANGED
@@ -1,7 +1,8 @@
1
1
  class XRPN
2
+ # Delete line number in X from the current program (makes it possible to write self-modifying programs)
2
3
  def cmddel
3
4
  @prg.delete_at(@x.to_i)
4
5
  end
5
6
  end
6
7
 
7
- # vim:ft=ruby:
8
+ # vim:ft=ruby:
data/xcmd/cmdhelp ADDED
@@ -0,0 +1,23 @@
1
+ class XRPN
2
+ # Show help text for the command in Alpha
3
+ def cmdhelp
4
+ if $gem
5
+ c_gem = $gem + "/xcmd/" + @a
6
+ c = File.read(c_gem) if File.exist?(c_gem)
7
+ end
8
+ c_loc = Dir.home + "/.xrpn/xcmd/" + @a
9
+ c = File.read(c_loc) if File.exist?(c_loc)
10
+ if c
11
+ c = c[/.*#.*\n/][2..-2]
12
+ c = nil if c["vim:"]
13
+ end
14
+ if not $cmd.include?(@a.downcase)
15
+ puts "No such command: #{@a}"
16
+ else
17
+ puts c if c
18
+ puts "No help for the command \"#{@a}\"" unless c
19
+ end
20
+ end
21
+ end
22
+
23
+ # vim:ft=ruby:
data/xcmd/correct CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Correct clock drift (no clock function)
2
3
  def correct
3
4
  return "CORRECT: No clock, alarm or stopwatch functions are implemented"
4
5
  end
data/xcmd/cos CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Return COS of X to X
2
3
  def cos
3
4
  @l = @x
4
5
  @x = @x.to_rad if @deg == "deg"
data/xcmd/crflas CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Create ASCII file. No need to supply any file size.
2
3
  def crflas
3
4
  f = Dir.home + "/.xrpn/data/" + @a + ".as"
4
5
  File.write(f, [[f, "AS", 0, 0.0]])
@@ -6,4 +7,4 @@ class XRPN
6
7
  end
7
8
  end
8
9
 
9
- # vim:ft=ruby:
10
+ # vim:ft=ruby:
data/xcmd/crfld CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Create data file. No need to supply any file size.
2
3
  def crfld
3
4
  f = Dir.home + "/.xrpn/data/" + @a + ".da"
4
5
  File.write(f, [[f, "DA", 0, 0.0]])
@@ -6,4 +7,4 @@ class XRPN
6
7
  end
7
8
  end
8
9
 
9
- # vim:ft=ruby:
10
+ # vim:ft=ruby:
data/xcmd/cube CHANGED
@@ -1,8 +1,9 @@
1
1
  class XRPN
2
+ # Return X^3 to X
2
3
  def cube
3
4
  @l = @x
4
5
  @x = @x ** 3
5
6
  end
6
7
  end
7
8
 
8
- # vim:ft=ruby:
9
+ # vim:ft=ruby:
data/xcmd/d_r CHANGED
@@ -1,8 +1,9 @@
1
1
  class XRPN
2
+ # Degrees to Radians conversion
2
3
  def d_r
3
4
  @l = @x
4
5
  @x = @x * Math::PI / 180
5
6
  end
6
7
  end
7
8
 
8
- # vim:ft=ruby:
9
+ # vim:ft=ruby:
data/xcmd/date CHANGED
@@ -1,8 +1,9 @@
1
1
  class XRPN
2
+ # Return a formatted date in X to Alpha
2
3
  def date
3
4
  lift
4
5
  @flg["31"] ? @x = Time.now.strftime("%d.%m%Y").to_f : @x = Time.now.strftime("%m.%d%Y").to_f
5
6
  end
6
7
  end
7
8
 
8
- # vim:ft=ruby:
9
+ # vim:ft=ruby:
data/xcmd/dateplus CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Add the date in Y and number of days in X and return result to X
2
3
  def dateplus
3
4
  @l = @x
4
5
  date = dtparse(@y)
@@ -9,4 +10,4 @@ class XRPN
9
10
  end
10
11
  end
11
12
 
12
- # vim:ft=ruby:
13
+ # vim:ft=ruby:
data/xcmd/ddate CHANGED
@@ -1,4 +1,5 @@
1
1
  class XRPN
2
+ # Return the number of days between dates in X and Y to X
2
3
  def ddate
3
4
  @l = @x
4
5
  dt1 = dtparse(@y)
@@ -8,4 +9,4 @@ class XRPN
8
9
  end
9
10
  end
10
11
 
11
- # vim:ft=ruby:
12
+ # vim:ft=ruby:
data/xcmd/dec CHANGED
@@ -1,7 +1,8 @@
1
1
  class XRPN
2
+ # Return the Decimal value of the Octal value in X
2
3
  def dec
3
4
  octdec
4
5
  end
5
6
  end
6
7
 
7
- # vim:ft=ruby:
8
+ # vim:ft=ruby:
data/xcmd/decbin CHANGED
@@ -1,8 +1,9 @@
1
1
  class XRPN
2
+ # Take X as a decimal number and convert to binary number in X
2
3
  def decbin
3
4
  @l = @x
4
5
  @x = @x.to_s.convert_base(10, 2).to_f
5
6
  end
6
7
  end
7
8
 
8
- # vim:ft=ruby:
9
+ # vim:ft=ruby:
data/xcmd/dechex CHANGED
@@ -1,8 +1,9 @@
1
1
  class XRPN
2
+ # Take X as a decimal number and convert to hexadecimal number in X
2
3
  def dechex
3
4
  @l = @x
4
5
  @x = @x.to_s.convert_base(10, 16)
5
6
  end
6
7
  end
7
8
 
8
- # vim:ft=ruby:
9
+ # vim:ft=ruby: