xrpn 1.2.1 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (267) hide show
  1. checksums.yaml +4 -4
  2. data/bin/xrpn +1 -0
  3. data/xcmd/abs +1 -0
  4. data/xcmd/acos +1 -0
  5. data/xcmd/adate +1 -0
  6. data/xcmd/adateiso +1 -0
  7. data/xcmd/add +1 -0
  8. data/xcmd/adv +1 -0
  9. data/xcmd/agsub +1 -0
  10. data/xcmd/aleng +1 -0
  11. data/xcmd/almcat +1 -0
  12. data/xcmd/almnow +1 -0
  13. data/xcmd/anum +1 -0
  14. data/xcmd/aoff +1 -0
  15. data/xcmd/aon +1 -0
  16. data/xcmd/appchr +1 -0
  17. data/xcmd/apprec +1 -0
  18. data/xcmd/arcl +1 -0
  19. data/xcmd/arcli +1 -0
  20. data/xcmd/arclrec +1 -0
  21. data/xcmd/arot +1 -0
  22. data/xcmd/ashf +1 -0
  23. data/xcmd/asin +1 -0
  24. data/xcmd/asroom +1 -0
  25. data/xcmd/asto +1 -0
  26. data/xcmd/asub +1 -0
  27. data/xcmd/atan +1 -0
  28. data/xcmd/atime +1 -0
  29. data/xcmd/atime24 +1 -0
  30. data/xcmd/atox +1 -0
  31. data/xcmd/aview +1 -0
  32. data/xcmd/aviewc +1 -0
  33. data/xcmd/beep +1 -0
  34. data/xcmd/bindec +1 -0
  35. data/xcmd/cat +1 -0
  36. data/xcmd/cf +1 -0
  37. data/xcmd/chs +2 -1
  38. data/xcmd/cla +2 -1
  39. data/xcmd/clalma +1 -0
  40. data/xcmd/clalmx +1 -0
  41. data/xcmd/cld +1 -0
  42. data/xcmd/clear +1 -0
  43. data/xcmd/clfl +2 -1
  44. data/xcmd/clk12 +2 -1
  45. data/xcmd/clk24 +2 -1
  46. data/xcmd/clkeys +1 -0
  47. data/xcmd/clock +1 -0
  48. data/xcmd/clp +1 -0
  49. data/xcmd/clralms +1 -0
  50. data/xcmd/clrg +2 -1
  51. data/xcmd/clrgx +2 -1
  52. data/xcmd/cls +2 -1
  53. data/xcmd/clst +2 -1
  54. data/xcmd/clx +2 -1
  55. data/xcmd/cmdadd +2 -1
  56. data/xcmd/cmddel +2 -1
  57. data/xcmd/cmdhelp +23 -0
  58. data/xcmd/correct +1 -0
  59. data/xcmd/cos +1 -0
  60. data/xcmd/crflas +2 -1
  61. data/xcmd/crfld +2 -1
  62. data/xcmd/cube +2 -1
  63. data/xcmd/d_r +2 -1
  64. data/xcmd/date +2 -1
  65. data/xcmd/dateplus +2 -1
  66. data/xcmd/ddate +2 -1
  67. data/xcmd/dec +2 -1
  68. data/xcmd/decbin +2 -1
  69. data/xcmd/dechex +2 -1
  70. data/xcmd/decoct +2 -1
  71. data/xcmd/deg +2 -1
  72. data/xcmd/degq +2 -1
  73. data/xcmd/delchr +2 -1
  74. data/xcmd/delrec +2 -1
  75. data/xcmd/divide +2 -1
  76. data/xcmd/dmy +2 -1
  77. data/xcmd/dot +1 -0
  78. data/xcmd/dow +2 -1
  79. data/xcmd/drop +2 -1
  80. data/xcmd/dropy +2 -1
  81. data/xcmd/dse +1 -0
  82. data/xcmd/ed +1 -0
  83. data/xcmd/emdir +2 -1
  84. data/xcmd/emdirx +2 -1
  85. data/xcmd/emroom +1 -0
  86. data/xcmd/end +1 -0
  87. data/xcmd/eng +1 -0
  88. data/xcmd/enter +2 -1
  89. data/xcmd/exp +2 -1
  90. data/xcmd/expx1 +2 -1
  91. data/xcmd/fact +2 -1
  92. data/xcmd/fc +1 -0
  93. data/xcmd/fcc +1 -0
  94. data/xcmd/fcs +1 -0
  95. data/xcmd/fix +1 -0
  96. data/xcmd/fixq +2 -1
  97. data/xcmd/flsize +1 -0
  98. data/xcmd/frc +2 -1
  99. data/xcmd/fs +1 -0
  100. data/xcmd/fsc +1 -0
  101. data/xcmd/fss +1 -0
  102. data/xcmd/geir +2 -1
  103. data/xcmd/getas +2 -1
  104. data/xcmd/getfile +2 -1
  105. data/xcmd/getfilea +2 -1
  106. data/xcmd/getkey +2 -1
  107. data/xcmd/getkeyx +2 -1
  108. data/xcmd/getp +2 -1
  109. data/xcmd/getr +2 -1
  110. data/xcmd/getrec +2 -1
  111. data/xcmd/getrx +2 -1
  112. data/xcmd/getsub +1 -0
  113. data/xcmd/getweb +2 -1
  114. data/xcmd/getx +2 -1
  115. data/xcmd/grad +2 -1
  116. data/xcmd/gsb +1 -0
  117. data/xcmd/gto +1 -0
  118. data/xcmd/help +2 -1
  119. data/xcmd/hexdec +2 -1
  120. data/xcmd/hms +2 -1
  121. data/xcmd/hmsminus +2 -1
  122. data/xcmd/hmsplus +2 -1
  123. data/xcmd/hr +2 -1
  124. data/xcmd/inschr +2 -1
  125. data/xcmd/insrec +2 -1
  126. data/xcmd/int +2 -1
  127. data/xcmd/invf +1 -0
  128. data/xcmd/isg +1 -0
  129. data/xcmd/lastx +2 -1
  130. data/xcmd/lbl +1 -0
  131. data/xcmd/lift +2 -1
  132. data/xcmd/ln +2 -1
  133. data/xcmd/ln1x +2 -1
  134. data/xcmd/log +1 -0
  135. data/xcmd/mdy +2 -1
  136. data/xcmd/mean +2 -1
  137. data/xcmd/mod +1 -0
  138. data/xcmd/multiply +1 -0
  139. data/xcmd/oct +2 -1
  140. data/xcmd/octdec +2 -1
  141. data/xcmd/off +2 -1
  142. data/xcmd/on +1 -0
  143. data/xcmd/p_r +2 -1
  144. data/xcmd/pack +1 -0
  145. data/xcmd/page +1 -0
  146. data/xcmd/pagedel +1 -0
  147. data/xcmd/pageq +2 -1
  148. data/xcmd/pageswap +2 -1
  149. data/xcmd/pasn +1 -0
  150. data/xcmd/pcat +2 -1
  151. data/xcmd/pclps +2 -1
  152. data/xcmd/percent +1 -0
  153. data/xcmd/percentch +1 -0
  154. data/xcmd/pi +2 -1
  155. data/xcmd/posa +2 -1
  156. data/xcmd/posfl +2 -1
  157. data/xcmd/pow +2 -1
  158. data/xcmd/pprg +2 -1
  159. data/xcmd/pprgx +1 -1
  160. data/xcmd/pra +2 -1
  161. data/xcmd/prflags +2 -1
  162. data/xcmd/prompt +2 -1
  163. data/xcmd/prp +2 -1
  164. data/xcmd/prregs +2 -1
  165. data/xcmd/prstk +2 -1
  166. data/xcmd/prx +2 -1
  167. data/xcmd/prxm +2 -1
  168. data/xcmd/pse +2 -1
  169. data/xcmd/psize +1 -0
  170. data/xcmd/purfl +2 -1
  171. data/xcmd/r_d +1 -0
  172. data/xcmd/r_p +2 -1
  173. data/xcmd/rad +2 -1
  174. data/xcmd/rand +2 -1
  175. data/xcmd/rcl +1 -0
  176. data/xcmd/rclaf +1 -0
  177. data/xcmd/rclflag +2 -1
  178. data/xcmd/rclpt +2 -1
  179. data/xcmd/rclpta +2 -1
  180. data/xcmd/rclsw +1 -0
  181. data/xcmd/rdn +2 -1
  182. data/xcmd/recip +1 -0
  183. data/xcmd/regmove +2 -1
  184. data/xcmd/regswap +2 -1
  185. data/xcmd/reload +2 -1
  186. data/xcmd/reszfl +1 -0
  187. data/xcmd/rnd +2 -1
  188. data/xcmd/root +2 -1
  189. data/xcmd/rtn +2 -1
  190. data/xcmd/rubycmd +2 -1
  191. data/xcmd/runsw +1 -0
  192. data/xcmd/rup +2 -1
  193. data/xcmd/saveas +2 -1
  194. data/xcmd/savep +2 -1
  195. data/xcmd/saver +2 -1
  196. data/xcmd/saverx +2 -1
  197. data/xcmd/savex +2 -1
  198. data/xcmd/savexm +2 -1
  199. data/xcmd/sci +1 -0
  200. data/xcmd/sdev +2 -1
  201. data/xcmd/seekpt +2 -1
  202. data/xcmd/seekpta +2 -1
  203. data/xcmd/sep +1 -0
  204. data/xcmd/setaf +1 -0
  205. data/xcmd/setsw +1 -0
  206. data/xcmd/sf +1 -0
  207. data/xcmd/shellcmd +2 -1
  208. data/xcmd/sign +2 -1
  209. data/xcmd/sin +1 -0
  210. data/xcmd/size +1 -0
  211. data/xcmd/sizeq +1 -0
  212. data/xcmd/sminus +1 -0
  213. data/xcmd/splus +1 -0
  214. data/xcmd/sqr +2 -1
  215. data/xcmd/sqrt +2 -1
  216. data/xcmd/sreg +1 -0
  217. data/xcmd/sregq +2 -1
  218. data/xcmd/stdivide +1 -0
  219. data/xcmd/stmultiply +1 -0
  220. data/xcmd/sto +1 -0
  221. data/xcmd/stoflag +2 -1
  222. data/xcmd/stop +2 -1
  223. data/xcmd/stopsw +1 -0
  224. data/xcmd/stplus +1 -0
  225. data/xcmd/stsubtract +1 -0
  226. data/xcmd/subtract +1 -0
  227. data/xcmd/sw +1 -0
  228. data/xcmd/swap +2 -1
  229. data/xcmd/swpt +1 -0
  230. data/xcmd/tan +1 -0
  231. data/xcmd/tenx +2 -1
  232. data/xcmd/time +2 -1
  233. data/xcmd/tx +1 -0
  234. data/xcmd/version +1 -0
  235. data/xcmd/view +1 -0
  236. data/xcmd/writefile +2 -1
  237. data/xcmd/xeq +1 -0
  238. data/xcmd/xeq0 +2 -1
  239. data/xcmd/xeqnn +2 -1
  240. data/xcmd/xeqy +2 -1
  241. data/xcmd/xf +1 -0
  242. data/xcmd/xgt0 +2 -1
  243. data/xcmd/xgteq0 +2 -1
  244. data/xcmd/xgteqnn +2 -1
  245. data/xcmd/xgteqy +2 -1
  246. data/xcmd/xgtnn +2 -1
  247. data/xcmd/xgty +2 -1
  248. data/xcmd/xlt0 +2 -1
  249. data/xcmd/xlteq0 +2 -1
  250. data/xcmd/xlteqnn +2 -1
  251. data/xcmd/xlteqy +2 -1
  252. data/xcmd/xltnn +2 -1
  253. data/xcmd/xlty +2 -1
  254. data/xcmd/xmexistq +2 -1
  255. data/xcmd/xmfileq +2 -1
  256. data/xcmd/xneq0 +2 -1
  257. data/xcmd/xneqnn +2 -1
  258. data/xcmd/xneqy +2 -1
  259. data/xcmd/xnn +1 -0
  260. data/xcmd/xtoa +2 -1
  261. data/xcmd/xy +2 -1
  262. data/xcmd/xyzalm +1 -0
  263. data/xlib/_xrpn_version +1 -1
  264. data/xlib/debug_mode +2 -18
  265. data/xlib/read_xcmd +4 -4
  266. data/xrpn.gemspec +2 -2
  267. metadata +6 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 930a6568e44e033e5ccbab14c67855c753fb97878d75eb617a0d9b4ba965c59f
4
- data.tar.gz: 1f8a39559af29010508de54200d1549b417b819791d234d68e1402a665648041
3
+ metadata.gz: 27231c4e65a8d95a2f08952c27e6f3795d621418fae26002178bf5b737a305cf
4
+ data.tar.gz: 784580f3199a29aff75747c2a468882894e1e266312977fe281ee761e0ae7d4c
5
5
  SHA512:
6
- metadata.gz: 630500030e9f7c524233b86303893c9bcc9e3226f166810773180b03437f8e58de03dd1f985826904dc5b56dcbfa59c2d275bcddf367595bb65c2e20915c4426
7
- data.tar.gz: dacb690f4ab7a2d1fcf7594b6c1dc67b0e856e736bbd2641608ecbf69bc55482183eefe4cd3c63523d6df614a2b454d46d58ee3e6bd82c6727a2568c3ec886b2
6
+ metadata.gz: 0f8162216e88fe3da2a43efc8c1678329352c3eb41d6acd3d7aa1fde7b0b3a1961e910284f954225831da5d8fb370aea6b4463d7797324c9ea316852910afe4d
7
+ data.tar.gz: 1b100677cf5e626497f18ac44c42f2f857c5ea0e202a07f06253cd69b9ab71b35e6cb11cd7019aa502ef230250e85e73d1a736bc0482958f835e45d9d3496e9d
data/bin/xrpn CHANGED
@@ -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.downcase
6
+ c = File.read(c_gem) if File.exist?(c_gem)
7
+ end
8
+ c_loc = Dir.home + "/.xrpn/xcmd/" + @a.downcase
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:
data/xcmd/decoct CHANGED
@@ -1,8 +1,9 @@
1
1
  class XRPN
2
+ # Take X as a decimal number and convert to octal number in X
2
3
  def decoct
3
4
  @l = @x
4
5
  @x = @x.to_s.convert_base(10, 8).to_f
5
6
  end
6
7
  end
7
8
 
8
- # vim:ft=ruby:
9
+ # vim:ft=ruby:
data/xcmd/deg CHANGED
@@ -1,7 +1,8 @@
1
1
  class XRPN
2
+ # Set degree mode to "deg" (360 degrees in a circle)
2
3
  def deg
3
4
  @deg = "deg"
4
5
  end
5
6
  end
6
7
 
7
- # vim:ft=ruby:
8
+ # vim:ft=ruby:
data/xcmd/degq CHANGED
@@ -1,7 +1,8 @@
1
1
  class XRPN
2
+ # Prints the current degrees mode
2
3
  def deg?
3
4
  p @deg
4
5
  end
5
6
  end
6
7
 
7
- # vim:ft=ruby:
8
+ # vim:ft=ruby: