home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / math / pac / help.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-05  |  7.4 KB  |  203 lines

  1. /* help.c */
  2. /**********************************************************************
  3. *    File Name     : help.c
  4. *    Function      : overlay stack window with help list
  5. *    Author        : Istvan Mohos, 1987
  6. ***********************************************************************/
  7.  
  8. #include "defs.h"
  9. #include "toktab.h"
  10.  
  11. char *hlist[] = {
  12. "!         factorial of n: 2*3*4*...n",
  13. "#         comment from here to EOL  ",
  14. "\'         sum ASCII bytes of nextok ",
  15. ";         separator btw. statements ",
  16. "?         abbreviation for help     ",
  17. "X         literal 16                ",
  18. "\\         most recent result        ",
  19. "amass     atomic mass unit, grams   ",
  20. "and       binary bit-wise AND       ",
  21. "arct      a(x) bc arctangent func.  ",
  22. "astro     astronomical unit, km     ",
  23. "at        abbreviation for autotime ",
  24. "atto      * .000 000 000 000 000 001",
  25. "au        abbreviation for autoconv ",
  26. "auto      pac_err: defeat bc keyword",
  27. "autoconv  on/off continuous convert ",
  28. "autotime  turn clock on/off at start",
  29. "avogadro  molecules per gram mole   ",
  30. "boltzmann constant [k] ergs/Kelvin  ",
  31. "break     pac_err: defeat bc keyword",
  32. "bye       exit program; same as TAB ",
  33. "chroma    440 * chroma: Bflat from A",
  34. "clr       clear stack cell nextok   ",
  35. "cm        use comma to format number",
  36. "comma     use comma to format number",
  37. "cos       c(x) bc cosine function   ",
  38. "define    pac_err: defeat bc keyword",
  39. "dontsave  don't write vars to .pacrc",
  40. "dp        same as precision         ",
  41. "ds        abbreviation for dontsave ",
  42. "dup       duplicate stk cell nextok ",
  43. "earthmass mass of earth in kg       ",
  44. "earthrad  radius of earth in meters ",
  45. "echarge   electron charge [e] esu   ",
  46. "emass     electron mass at rest, g  ",
  47. "euler     Euler-Mascheroni constant ",
  48. "exa       *1,000,000,000,000,000,000",
  49. "exit      exit program; same as ^E  ",
  50. "exp       e(x) bc exponential func. ",
  51. "faraday   constant [F] C/kmole      ",
  52. "femto     * .000 000 000 000 001    ",
  53. "fix       show fixed decimal point  ",
  54. "fo        abbreviation for format   ",
  55. "for       pac_err: defeat bc keyword",
  56. "format    commas/spaces in result   ",
  57. "g         acceleration at sea m/s2  ",
  58. "gas       constant [Ro] erg/g mole K",
  59. "giga      * 1,000,000,000           ",
  60. "gravity   constant [G] N m2/kg2     ",
  61. "h         value of stack cell h     ",
  62. "hardform  verbose/terse/xt filedump ",
  63. "heat      mechanical equiv [J] J/cal",
  64. "help      briefly explain next token",
  65. "hf        abbreviation for hardform ",
  66. "i         value of stack cell i     ",
  67. "ib        abbreviation for ibase    ",
  68. "ibase     input radix (2 through 16)",
  69. "if        pac_err: defeat bc keyword",
  70. "init      pac to default parameters ",
  71. "j         value of stack cell j     ",
  72. "ju        abbreviation for justify  ",
  73. "justify   left/right/fix display    ",
  74. "k         value of stack cell k     ",
  75. "kilo      * 1000                    ",
  76. "l         value of stack cell l     ",
  77. "le        abbreviation for left     ",
  78. "left      ju le; print to left side ",
  79. "length    pac_err: defeat bc keyword",
  80. "light     velocity [c] km/s         ",
  81. "lightyear distance covered/year km  ",
  82. "log       l(x) bc log function      ",
  83. "m         value of stack cell m     ",
  84. "mega      * 1,000,000               ",
  85. "micro     * .000 001                ",
  86. "milli     * .001                    ",
  87. "mod       integer mod, unlike bc %  ",
  88. "mohos     clear to nextok, pactrace ",
  89. "moonmass  lunar mass in kg          ",
  90. "moonrad   radius of moon in meters  ",
  91. "n         value of stack cell n     ",
  92. "nano      * .000 000 001            ",
  93. "natural   Naperian log base [e]     ",
  94. "nmass     neutron mass at rest, g   ",
  95. "not       bitwise, field nextok wide",
  96. "o         value of stack cell o     ",
  97. "ob        abbreviation of obase     ",
  98. "obase     output radix (2 thru 16)  ",
  99. "off       disable capability        ",
  100. "on        enable capability         ",
  101. "or        binary, bit-wise OR       ",
  102. "p         value of stack cell p     ",
  103. "parallax  solar, in seconds of arc  ",
  104. "parsec    (parallax + sec2) in km   ",
  105. "pd        percent diff (pdiff)      ",
  106. "pdelta    percent diff (pdiff)      ",
  107. "pdiff     % diff of curtok to nextok",
  108. "pe        percent equal (pequal)    ",
  109. "pequal    curtok% = nextok; total?  ",
  110. "peta      * 1,000,000,000,000,000   ",
  111. "pi        3.1415... (32 hex digits) ",
  112. "pico      * .000 000 000 001        ",
  113. "planck    constant [h] erg sec      ",
  114. "pll       stk cell nextok to curres ",
  115. "pm        percent minus (pminus)    ",
  116. "pmass     proton mass at rest, g    ",
  117. "pminus    subtract nextok percent   ",
  118. "po        percent of (pof)          ",
  119. "pof       what is curtok% of nextok ",
  120. "pop       discard stack cell nextok ",
  121. "pp        percent plus (pplus)      ",
  122. "pplus     add nextok percent        ",
  123. "pr        abbreviation of precision ",
  124. "precision digits used past dp (0-32)",
  125. "psh       curres to stk cell nextok ",
  126. "pv        percent versus (pversus)  ",
  127. "pversus   curtok = 100 %, nextok ? %",
  128. "q         value of stack cell q     ",
  129. "quit      exit program; same as ^E  ",
  130. "r         value of stack cell r     ",
  131. "ri        abbreviation of right     ",
  132. "right     right justify result      ",
  133. "rydberg   constant per meter        ",
  134. "s         value of stack cell s     ",
  135. "sb        abbreviation of staybase  ",
  136. "scale     alias of precision        ",
  137. "sin       s(x) bc sine function     ",
  138. "sound     air speed @ 15 Celsius m/s",
  139. "sp        use space to format number",
  140. "space     use space to format number",
  141. "sqrt      sqrt(x) bc square root    ",
  142. "st        abbreviation of 'stack on'",
  143. "stack     save last 16 results      ",
  144. "staybase  make next radix permanent ",
  145. "stefan    Stefan-Boltzmann J/m2 K4 s",
  146. "sto       store curres in stack cell",
  147. "sunmass   solar mass kg             ",
  148. "sunrad    radius of sun in meters   ",
  149. "swp       swap curres, stack nextok ",
  150. "t         value of stack cell t     ",
  151. "te        abbreviation of terse     ",
  152. "tera      * 1,000,000,000,000       ",
  153. "terse     hardcopy file format      ",
  154. "to        convert curres to nextok  ",
  155. "tomoon    distance from earth, km   ",
  156. "tosun     distance from earth, km   ",
  157. "tw        abbreviation of twoscomp  ",
  158. "twoscomp  bitwise, field nextok wide",
  159. "u         value of stack cell u     ",
  160. "v         value of stack cell v     ",
  161. "ver       abbreviation of verbose   ",
  162. "verbose   hardcopy file format      ",
  163. "w         value of stack cell w     ",
  164. "while     pac_err: defeat bc keyword",
  165. "wien      displacement constant cm K",
  166. "x         the number 16             ",
  167. "xor       curres xor-ed with nextok ",
  168. "xt        abbreviation of xterse    ",
  169. "xterse    hardcopy file format      ",
  170. };
  171.  
  172. #define HCENTER 6
  173. #define TOFIT   (STACKDEEP - HCENTER)
  174.  
  175. show_help(cursel)
  176. int cursel;
  177. {
  178.     register ri;
  179.     static int tophelp;
  180.     static char *fid = "show_help";
  181.  
  182.     _TR
  183.     if (cursel < HCENTER)
  184.         tophelp = 0;
  185.     else if (cursel >= LISTSIZE - TOFIT)
  186.         tophelp = LISTSIZE - STACKDEEP;
  187.     else
  188.         tophelp = cursel - HCENTER + 1;
  189.  
  190.     for (ri = 0; ri < STACKDEEP; ri++) {
  191.         mvaddstr(ri + STACKTOP, STACKLEFT, hlist[ri + tophelp]);
  192.     }
  193.  
  194.     standout();
  195.     for (ri = 0; ri < STACKDEEP; ri++) {
  196.         mvaddch(ri + STACKTOP, LBOUND, ' ');
  197.     }
  198.     mvaddstr(STACKTOP + cursel - tophelp, STACKLEFT, hlist[cursel]);
  199.     standend();
  200. TR_
  201. }
  202.  
  203.