home *** CD-ROM | disk | FTP | other *** search
/ pc.louisiana.edu/pub/unix/ / Louisiana_UNIX.tar / Louisiana_UNIX / xspread3.0.zoo / help.c < prev    next >
C/C++ Source or Header  |  1994-03-31  |  25KB  |  774 lines

  1. /*
  2.  * Help functions for sc 
  3.  * R. Bond, 1988
  4.  * J. Buhrt 1990
  5.  * $Revision: 6.21 A $
  6.  */
  7.  
  8. #include "config.h"
  9.  
  10. #ifdef QREF
  11. #include <stdio.h>
  12. char    *header = " Quick Reference";
  13. #include "version.c"
  14. #else
  15. #ifdef DOINGX
  16. #include <stdio.h>
  17. #include <X11/Xlib.h>
  18. #include <X11/Xutil.h>
  19. #else
  20. #include <curses.h>
  21. #endif
  22. #include "sc.h"
  23. #ifdef DOINGX
  24. #include "scXstuff.h"
  25. #endif
  26. #endif /* QREF */
  27.  
  28. #ifndef __STDC__
  29. extern int    printf();
  30. extern int    puts();
  31. #endif    /* __STDC__ */
  32.  
  33. char *intro[] = {
  34. " ",
  35. #if defined(QREF) && defined(TROFF)
  36. ".SH",
  37. #endif
  38. " Overview:",
  39. " ",
  40. #if defined(QREF) && defined(TROFF)
  41. ".Lp",
  42. #endif
  43. " A:   This overview",
  44. " B:   Toggle Options",
  45. " C:   Set Options",
  46. " D:   Cursor movement commands",
  47. " E:   Cell entry and editing commands",
  48. " F:   Line Editing",
  49. " G:   File commands",
  50. " H:   Row and column commands",
  51. " I:   Range commands",
  52. " J:   Miscellaneous commands",
  53. " K:   Variable names/Expressions",
  54. " L:   Range functions",
  55. " M:   Numeric functions",
  56. " N:   String functions",
  57. " O:   Financial functions",
  58. " P:   Time and date functions",
  59. " ",
  60. " Q:   Return to main spreadsheet",
  61. #ifdef QREF
  62. " Shell Options:",
  63. #endif
  64. (char *)0
  65. };
  66.  
  67. char *toggleoptions[] = {
  68. " ",
  69. #if defined(QREF) && defined(TROFF)
  70. ".SH",
  71. #endif
  72. " B: Toggle Options",
  73. " ",
  74. #if defined(QREF) && defined(TROFF)
  75. ".Lp",
  76. #endif
  77. "     ^To  Toggle options. Toggle one option selected by o:",
  78. "          a    Recalculate automatically or on ``@'' commands.",
  79. "          c    Current cell highlighting enable/disable.",  
  80. "          e    External function execution enable/disable.",
  81. "          l    Autolabeling defined cells enable/disable.",
  82. "          n    If enabled, a digit starts a numeric value.",
  83. "          t    Top line display enable/disable.",
  84. #if !defined(VMS) && !defined(MSDOS) && defined(CRYPT_PATH)
  85. "          x    Encrypt/decrypt database and listing files.",
  86. #else
  87. "          x    Encrypt/decrypt database and listing files (Not available).",
  88. #endif
  89. "          $    Dollar prescale.  If enabled, all numeric constants",
  90. "               (not expressions) entered are multiplied by 0.01.",
  91. "          r    Newline action.  Toggle between no action, move down",
  92. "               after entry and move right after entry.",
  93. "          z    Set the newline action limits to the current row and column",
  94. "            (for r && z see also set rowlimit=n, collimit=n)",
  95. (char *)0
  96. };
  97.  
  98. char *setoptions[] = {
  99. " ",
  100. #if defined(QREF) && defined(TROFF)
  101. ".SH",
  102. #endif
  103. " C: Set Options",
  104. " ",
  105. #if defined(QREF) && defined(TROFF)
  106. ".Lp",
  107. #endif
  108. "     S  Set options.  Options include:",
  109. "          byrows        Recalculate in row order. (default)",
  110. "          bycols        Recalculate in column order.",
  111. "          iterations=n  Set the number of iterations allowed. (10)",
  112. "          tblstyle=xx   Set ``T'' output style to:",
  113. "                        0 (none), tex, latex, slatex, or tbl.",
  114. "          rndinfinity   Round to infinity (round .5 up vs to nearest even).",
  115. "          rowlimit=n    Set the remembered row limit for newline action.",
  116. "          collimit=n    Set the remembered column limit for newline action.",
  117. "                     (rowlimit and collimit can both be set by ^Tz)",
  118. (char *)0
  119. };
  120.  
  121. char *cursor[] = {
  122. " ",
  123. #if defined(QREF) && defined(TROFF)
  124. ".SH",
  125. #endif
  126. " D: Cell cursor movement (always OK):",
  127. " ",
  128. #if defined(QREF) && defined(TROFF)
  129. ".Lp",
  130. #endif
  131. "     ^N ^P ^B ^F Down, up, back, forward",
  132. "     ^Ed         Go to end of range.  Follow ^E by a direction indicator",
  133. "                 such as ^P or j.",
  134. "     Arrow keys (if the terminal and termcap support them.)",
  135. " ",
  136. " Cell cursor movement if no prompt active:",
  137. "     j,k,l,h    Down, up, right, left",
  138. "     J,K,L,H    Down, up, right, left by 1/2 pages",
  139. "     SPACE      Forward",
  140. "     ^H         Back",
  141. "     TAB        Forward, otherwise starts/ends a range",
  142. "     ^          Up to row 0 of the current column.",
  143. "     #          Down to the last valid row of the current column.",
  144. "     0          Back to column A.  Preface with ^U if numeric mode.",
  145. "     $          Forward to the last valid column of the current row.",
  146. "     b          Back then up to the previous valid cell.",
  147. "     w          Forward then down to the next valid cell.",
  148. "     g          Go to a cell.  Cell name, range name, quoted string,",
  149. "                a number, 'error', or 'invalid' to specify which cell.",
  150. (char *)0
  151. };
  152.  
  153.  
  154. char *cell[] = {
  155. " ",
  156. #if defined(QREF) && defined(TROFF)
  157. ".SH",
  158. #endif
  159. " E: Cell entry and editing commands:",
  160. " ",
  161. #if defined(QREF) && defined(TROFF)
  162. ".Lp",
  163. #endif
  164. "     =    Enter a numeric constant or expression.",
  165. "     <    Enter a left justified string or string expression.",
  166. "     \"    Enter a centered label.",
  167. "     >    Enter a right justified string or string expression.",
  168. "     e    Edit the current cell's numeric value.",
  169. "     E    Edit the current cell's string part.",
  170. "     F    Assign a format to the current cell's numeric value.",
  171. "     x    Clear the current cell.",
  172. "     c    Copy the last marked cell to the current cell.",
  173. "     m    Mark a cell to be used as the source for ``c''",
  174. "     +    Increment numeric part",
  175. "     -    Decrement numeric part",
  176. "  RETURN  Enter insert mode if the input line was empty (ESC to edit)",
  177. " ",
  178. "     In numeric mode, a decimal digit, ``+'', ``-'', and ``.'' all start",
  179. "     a new numeric constant or expression.",
  180. (char *)0
  181. };
  182.  
  183.  
  184. char *vi[] = {
  185. #if defined(QREF) && defined(TROFF)
  186. " ",
  187. ".SH",
  188. #endif
  189. " F: Line Editor",
  190. " ",
  191. #if defined(QREF) && defined(TROFF)
  192. ".Lp",
  193. #endif
  194. "     Hitting the ESC key while entering any command on the top line",
  195. "     will start a one-line vi-style editor.  Supported commands:",
  196. " ",
  197. "     ESC q        Abort command entry.",
  198. "     h l          Move cursor forward, backward.",
  199. "     0 $          Move cursor to the beginning, end of the line.",
  200. "     b w          Move cursor forward/back one word.",
  201. "     fc           Move cursor to character c.",
  202. "     tc           Move the cursor the the character before c.",
  203. "     D            Delete to end of line",
  204. "     i a          Enter insert mode before/after the cursor.",
  205. "     I A          Move to column 0/end of line and enter insert mode.",
  206. "     x X          Delete the character under/before the cursor.",
  207. "     rc           Replace the character under the cursor with c.",
  208. "     cm           Change - m = b,f,h,l,t or w.",
  209. "     dm           Delete - m = b,f,h,l,t or w.",
  210. "     R            Enter replace (overstrike) mode.",
  211. "     + j - k /    Forward/backward/search the command history.",
  212. "     n            Repeat last history search.",
  213. "     . u          Repeat/undo the last command.",
  214. "     <RETURN>     Save",
  215. (char *)0
  216. };
  217.  
  218. char *file[] = {
  219. " ",
  220. #if defined(QREF) && defined(TROFF)
  221. ".SH",
  222. #endif
  223. " G: File commands:",
  224. " ",
  225. #if defined(QREF) && defined(TROFF)
  226. ".Lp",
  227. #endif
  228. "     D    Define a path for run command.",
  229. "     G    Get a new database from a file. ",
  230. "     M    Merge a new file into the current database.",
  231. "     P    Put the current database into a file.",
  232. "     W    Write a listing of the current database into a file in",
  233. "          a form that matches its appearance on the screen.",
  234. "     R    Run a macro.",
  235. "     T    Write a listing of the current database to a file, but",
  236. "          put delimiters between each pair of fields.",
  237. "          Optionally brackets output with control lines for ``tbl'',",
  238. "          ``LaTeX'', ``SLaTex'', or ``TeX''.",
  239. " ",
  240. #if !defined(VMS) && !defined(MSDOS) && defined(CRYPT_PATH)
  241. "     If encryption mode is set, file I/O will be encrypted/decrypted.",
  242. "     ``\"| program\"'' for a file name will pipe (unencrypted) output to",
  243. #else
  244. "     ``\"| program\"'' for a file name will pipe output to",
  245. #endif
  246. "     a program for Put, Write and Table.  If a cell name is used",
  247. "     as the file name, the cell's string part will be used as the",
  248. "     file name.",
  249. (char *)0
  250. };
  251.  
  252.  
  253. char *row[] = {
  254. " ",
  255. #if defined(QREF) && defined(TROFF)
  256. ".SH",
  257. #endif
  258. " H: Row and column commands:",
  259. " ",
  260. #if defined(QREF) && defined(TROFF)
  261. ".Lp",
  262. #endif
  263. "     ir, ic      Insert a new, empty row (column)",
  264. "     ar, ac      Append a new copy of the current row (column)",
  265. "     dr, dc      Delete the current row (column)",
  266. "     pr, pc, pm  Pull deleted cells back into the spreadsheet",
  267. "                 Insert rows, columns or merge the cells.",
  268. "     vr, vc      Remove expressions from the affected rows (columns),",
  269. "                 leaving only the values.",
  270. "     zr, zc      Hide (``zap'') the current row (column)",
  271. "     sr, sc      Show hidden rows (columns)",
  272. "     f           Set the output format to be used with the values of",
  273. "                 each cell in this column.  Enter field width, number of",
  274. "                 significant digits, and format (0-4).  A preceding",
  275. "                 count can be used to change more than one column.",
  276. " FIXME....           0: fixed point, 1: scientific, 2: engineering",
  277. " ",
  278. "     Commands which move or copy cells also modify the row and column ",
  279. "     references in the new cell expressions.  Use ``fixed'' or the",
  280. "     ``$'' style cell reference to suppress the change.",
  281. " ",
  282. "     @myrow, @mycol    return the row or column of the current cell",
  283. (char *)0
  284. };
  285.  
  286.  
  287. char *range[] = {
  288. " ",
  289. #if defined(QREF) && defined(TROFF)
  290. ".SH",
  291. #endif
  292. " I: Range commands:",
  293. #if defined(QREF) && defined(TROFF)
  294. ".Lp",
  295. #endif
  296. "     /x   Clear a range. ",
  297. "     /v   Remove the expressions from a range of cells, leaving ",
  298. "          just the values.",
  299. "     /c   Copy a source range to a destination range.",
  300. "     /f   Fill a range with constant values starting with a given",
  301. "          value and increasing by a given increment.",
  302. "     /d   Assign a name to a cell or a range of cells.  Give the",
  303. "          the name, surrounded by quotes, and either a cell name such",
  304. "          as ``A10'' or a range such as ``a1:b20''.",
  305. "     /l   Locks a cell or a range of cells, i.e makes it unchangeable.",
  306. "     /U   Unlocks a locked cell, i.e makes it changeable.",
  307. "     /s   Shows the currently defined range names.  Pipe output to",
  308. "          sort, then to less.",
  309. "     /u   Use this command to undefine a previously defined range name.",
  310. "     /F   Assign a format string to a range of cells.",
  311. " ",
  312. "     Range operations affect a rectangular region on the screen",
  313. "     defined by the upper left and lower right cells in the region.",
  314. "     A range is specified by giving the cell names separated by ``:'',",
  315. "     such as ``a20:k52''.  Another way to refer to a range is to use",
  316. "     a name previously defined using ``/d''.",
  317. (char *)0
  318. };
  319.  
  320.  
  321. char *misc[] = {
  322. " ",
  323. #if defined(QREF) && defined(TROFF)
  324. ".SH",
  325. #endif
  326. " J: Miscellaneous commands:",
  327. " ",
  328. #if defined(QREF) && defined(TROFF)
  329. ".Lp",
  330. #endif
  331. "     Q q ^C   Exit from the program.",
  332. "     ^G ESC   Abort entry of the current command.",
  333. "     ?        Help",
  334. "     !        Shell escape.  Enter a command to run.  ``!!'' repeats",
  335. "              the last command.  Just ``!'' starts an interactive shell.",
  336. "     ^L       Redraw the screen.",
  337. "     ^R       Redraw the screen.  Highlight cells with values but no",
  338. "              expressions.",
  339. "     ^X       Redraw the screen.  Show formulas, not values.",
  340. "     @        Recalculate the spreadsheet.",
  341. "     ^V       Type, in the command line, the name of the current cell.",
  342. "     ^W       Type, in the command line, the current cell's expression.",
  343. "     ^A       Type, in the command line, the current cell's numeric value.",
  344. "     TAB      When the character cursor is on the top line TAB can be used",
  345. "              to start or stop the display of the default range.",
  346. (char *)0
  347. };
  348.  
  349. char *var[] = {
  350. " ",
  351. #if defined(QREF) && defined(TROFF)
  352. ".SH",
  353. #endif
  354. " K: Variable names:",
  355. " ",
  356. #if defined(QREF) && defined(TROFF)
  357. ".Lp",
  358. #endif
  359. "     K20    Row and column can vary on copies.",
  360. "     $K$20  Row and column stay fixed on copies.",
  361. "     $K20   Row can vary; column stays fixed on copies.",
  362. "     K$20   Row stays fixed; column can vary on copies.",
  363. "     fixed  holds following expression fixed on copies.",
  364. "     Cells and ranges can be given a symbolic name via ``/d''.",
  365. " ",
  366. " Expressions:",
  367. "     -e      Negation                e<=e  Less than or equal",
  368. "     e+e     Addition                e=e   Equal",
  369. "     e-e     Subtraction             e!=e  Not Equal",
  370. "     e*e     Multiplication          e>=e  Greater than or equal",
  371. "     e/e     Division                e>e  Greater than",
  372. "     e%e     Modulo                  e<e  Less than",
  373. "     e^e     Exponentiation          e&e  Boolean operator AND.",
  374. "     ~e      Boolean operator NOT    e|e  Boolean operator OR",
  375. "     e?e1:e2  or @if(e,e1,e2)",
  376. "             Conditional: If e is non zero then then e1, else e2.",
  377. "     Terms may be constants, variables, and parenthesized expressions.",
  378. (char *)0
  379. };
  380.  
  381. char *rangef[] = {
  382. " ",
  383. #if defined(QREF) && defined(TROFF)
  384. ".SH",
  385. #endif
  386. " L: Range functions:",
  387. " ",
  388. #if defined(QREF) && defined(TROFF)
  389. ".Lp",
  390. #endif
  391. "     @sum(r)           Sum all valid cells in the range.",
  392. "     @prod(r)          Multiply together all valid cells in the range.",
  393. "     @avg(r)           Average all valid cells in the range.",
  394. "     @count(r)         Count all valid cells in the range.",
  395. "     @max(r)           Return the maximum value in the range.",
  396. "     @min(r)           Return the minimum value in the range.",
  397. "     @stddev(r)        Return the sample standard deviation of ",
  398. "                       the cells in the range.",
  399. "     @index(e,r) @stindex(e,r)",
  400. "                       Return the numeric (string) value of the cell at",
  401. "                       index e into range r.",
  402. "     @lookup(e,r) @hlookup(e,r,n) @vlookup(e,r,n)",
  403. "                       Search through the range r for a value that",
  404. "                       matches e.  If e is numeric, the last value <= e",
  405. "                       matches; if string, an exact match is required.",
  406. "                       @lookup searches a single row (column) and returns",
  407. "                       the value from the next column (row); @hlookup",
  408. "                       (@vlookup) searches the first row (column) in r and",
  409. "                       returns the value n columns (rows) from the match.",
  410. (char *)0
  411. };
  412.  
  413. char *numericf[] = {
  414. " ",
  415. #if defined(QREF) && defined(TROFF)
  416. ".SH",
  417. #endif
  418. " M: Numeric functions:",
  419. " ",
  420. #if defined(QREF) && defined(TROFF)
  421. ".Lp",
  422. #endif
  423. "     @atan2(e1,e2)     Arc tangent of e1/e2.",
  424. "     @ceil(e)          Smallest integer not less than e.",
  425. "     @eqs(se1,se2)     1 if string expr se1 has the same value as se2.",
  426. "     @exp(e)           Exponential function of e.",
  427. "     @abs(e) @fabs(e)  Absolute value of e.",
  428. "     @floor(e)         The largest integer not greater than e.",
  429. "     @hypot(x,y)       Sqrt(x*x+y*y).",
  430. "     @max(e1,e2,...)   The maximum of the values of the e's.",
  431. "     @min(e1,e2,...)   The minimum of the values of the e's",
  432. "     @nval(se,e)       The numeric value of a named cell.",
  433. "     pi       @pi      A constant quite close to pi.",
  434. "     @pow(e1,e2)       e1 raised to the power of e2.",
  435. "     @rnd(e)           Round e to the nearest integer.",
  436. "     @round(e,n)       Round e to n decimal places.",
  437. "     @sqrt(e)          Square root of e.",
  438. "     @ston(se)         Convert string expr se to a numeric",
  439. "     @ln(e)   @log(e)           Natural/base 10 logarithm of e.",
  440. "     @dtr(e)  @rtd(e)           Convert degrees to/from radians.",
  441. "     @cos(e)  @sin(e)  @tan(e)  Trig functions of radian arguments.",
  442. "     @asin(e) @acos(e) @atan(e) Inverse trig function.",
  443. (char *)0
  444. };
  445.  
  446. char *stringf[] = {
  447. " ",
  448. #if defined(QREF) && defined(TROFF)
  449. ".SH",
  450. #endif
  451. " N: String functions:",
  452. #if defined(QREF) && defined(TROFF)
  453. ".Lp",
  454. #endif
  455. "     #                 Concatenate strings.  For example, the",
  456. "                       string expression ``A0 # \"zy dog\"'' yields",
  457. "                       ``the lazy dog'' if A0 is ``the la''.",
  458. "     @substr(se,e1,e2) Extract characters e1 through e2 from the",
  459. "                       string expression se.  For example,",
  460. "                       ``@substr(\"Nice jacket\" 4, 7)'' yields ",
  461. "                       ``e ja''.",
  462. "     @fmt(se,e)        Convert a number to a string using sprintf(3).",
  463. "                       For example,  ``@fmt(\"*%6.3f*\",10.5)'' yields",
  464. "                       ``*10.500*''.  Use formats are e, E, f, g, and G.", 
  465. "     @sval(se,e)       Return the string value of a cell selected by name.",
  466. "     @ext(se,e)        Call an external function (program or",
  467. "                       script).  Convert e to a string and append it",
  468. "                       to the command line as an argument.  @ext yields",
  469. "                       a string: the first line printed to standard",
  470. "                       output by the command.",
  471. "     @coltoa(e)        Return the column letter(s) from the passed number",
  472. "     @upper(e) @lower(e)   Return the string in upper/lower case",
  473. "     @capital(e)       Return the string with words in upper case",
  474. "     String expressions are made up of constant strings (characters",
  475. "     surrounded by quotes), variables, and string functions.",
  476. (char *)0
  477. };
  478.  
  479.  
  480. char *finf[] = {
  481. " ",
  482. #if defined(QREF) && defined(TROFF)
  483. ".SH",
  484. #endif
  485. " O: Financial functions:",
  486. " ",
  487. #if defined(QREF) && defined(TROFF)
  488. ".Lp",
  489. #endif
  490. "     @pmt(e1,e2,e3)    @pmt(60000,.01,360) computes the monthly",
  491. "                       payments for a $60000 mortgage at 12%",
  492. "                       annual interest (.01 per month) for 30",
  493. "                       years (360 months).",
  494. " ",
  495. "     @fv(e1,e2,e3)     @fv(100,.005,36) computes the future value",
  496. "                       of 36 monthly payments of $100 at 6%",
  497. "                       interest (.005 per month).  It answers the",
  498. "                       question:  ``How much will I have in 36",
  499. "                       months if I deposit $100 per month in a",
  500. "                       savings account paying 6% interest com-",
  501. "                       pounded monthly?''",
  502. " ",
  503. "     @pv(e1,e2,e3)     @pv(1000,.015,36) computes the present",
  504. "                       value of an ordinary annuity of 36",
  505. "                       monthly payments of $1000 at 18% annual",
  506. "                       interest.  It answers the question: ``How",
  507. "                       much can I borrow at 18% for 30 years if I",
  508. "                       pay $1000 per month?''",
  509. (char *)0
  510. };
  511.  
  512.  
  513. char *timef[] = {
  514. " ",
  515. #if defined(QREF) && defined(TROFF)
  516. ".SH",
  517. #endif
  518. " P: Time and date functions:",
  519. " ",
  520. #if defined(QREF) && defined(TROFF)
  521. ".Lp",
  522. #endif
  523. "     @now              Return the time encoded in seconds since 1970.",
  524. "     @dts(m,d,y)       Return m/d/y encoded in seconds since 1970.",
  525. "     @tts(h,m,s)       Return h:m:s encoded in seconds since midnight.",
  526. " ",
  527. "     All of the following take an argument expressed in seconds:",
  528. " ",
  529. "     @date(e)          Convert the time in seconds to a date",
  530. "                       string 24 characters long in the following",
  531. "                       form: ``Sun Sep 16 01:03:52 1973''.  Note",
  532. "                       that you can extract pieces of this fixed format",
  533. "                       string with @substr.",
  534. "     @year(e)          Return the year.  Valid years begin with 1970.",
  535. "     @month(e)         Return the month: 1 (Jan) to 12 (Dec).",
  536. "     @day(e)           Return the day of the month: 1 to 31.",
  537. "     @hour(e)          Return the number of hours since midnight: 0 to 23.",
  538. "     @minute(e)        Return the number of minutes since the",
  539. "                       last full hour: 0 to 59.",
  540. "     @second(e)        Return the number of seconds since the",
  541. "                       last full minute: 0 to 59.",
  542. (char *)0
  543. };
  544.  
  545. #ifdef QREF
  546. char *shellu[] = {
  547. " ",
  548. #ifdef TROFF
  549. ".SH",
  550. #endif
  551. " Shell Options:",
  552. " ",
  553. #ifdef TROFF
  554. ".Lp",
  555. #endif
  556. "    Usage: sc [-c] [-m] [-n] [-r] [-x] [-C] [-N] [-R] [file]",
  557. "      -c  Start with recalculation being done in column order.",
  558. "              {Set: S byrows}",
  559. "      -m  Start with automatic recalculation disabled. The",
  560. "          spreadsheet will be recalculated only when the @",
  561. "          command is used.  {Toggle: ^Ta}",
  562. "      -n  Start in quick numeric entry mode.  {Toggle: ^Tn}",
  563. "      -r  Start with recalculation being done in row order (default).",
  564. "              {Set: S bycols}",
  565. #if !defined(VMS) && !defined(MSDOS) && defined(CRYPT_PATH)
  566. "      -x  Cause the Get and Put commands to encrypt and decrypt",
  567. "          data files.  {Toggle: ^Tx}",
  568. #else
  569. "      -x  Cause the Get and Put commands to encrypt and decrypt",
  570. "          data files (Not available).",
  571. #endif
  572. "      -C  Start with automatic newline action set to increment the column",
  573. "              {Toggle: ^Tr}",
  574. "      -N  This flag allows you to turn the arrow cursor on or off.",
  575. "          Normally the cursor is on, but this flag will change it to",
  576. "          the opposite.",
  577. "      -R  Start with automatic newline action set to increment the row.",
  578. "              {Toggle: ^Tr}",
  579. "",
  580. "      {See also for runtime option}",
  581. (char *)0
  582. };
  583. #endif
  584.  
  585. #ifndef QREF
  586.  
  587. #ifndef DOINGX
  588. #ifdef __STDC__
  589. static int    pscreen(char **);
  590. #else    /* __STDC__ */
  591. static int    pscreen();
  592. #endif    /* __STDC__ */
  593. #endif
  594.  
  595. void
  596. help()
  597. {
  598.     int option;
  599.     char **ns = intro;
  600.  
  601.     while((option = pscreen(ns)) != 'q' && option != 'Q') {
  602.         switch (option) {
  603.     case 'a': case 'A': ns = intro; break;
  604.     case 'b': case 'B': ns = toggleoptions; break;
  605.     case 'c': case 'C': ns = setoptions; break;
  606.     case 'd': case 'D': ns = cursor; break;
  607.     case 'e': case 'E': ns = cell; break;
  608.     case 'f': case 'F': ns = vi; break;
  609.     case 'g': case 'G': ns = file; break;
  610.     case 'h': case 'H': ns = row; break;
  611.     case 'i': case 'I': ns = range; break;
  612.     case 'j': case 'J': ns = misc; break;
  613.     case 'k': case 'K': ns = var; break;
  614.     case 'l': case 'L': ns = rangef; break;
  615.     case 'm': case 'M': ns = numericf; break;
  616.     case 'n': case 'N': ns = stringf; break;
  617.     case 'o': case 'O': ns = finf; break;
  618.     case 'p': case 'P': ns = timef; break;
  619.     default: ns = intro; break;
  620.     }
  621.     }
  622.     FullUpdate++;
  623. #ifdef DOINGX
  624.     cleardownfrom(1);
  625. #else
  626.     (void) move(1,0);
  627.     (void) clrtobot();
  628. #endif
  629. }
  630.  
  631. #ifdef DOINGX
  632. pscreen(screen)
  633. char *screen[];
  634. {
  635.     int line;
  636.     int dbline;
  637.     int show_string;
  638.  
  639.     XEvent event;
  640.     char buffer[8];
  641.     int count, done;
  642.     char c;
  643.  
  644.  
  645.     show_string = 1;
  646.     done = 0;
  647.      
  648.     while( done == 0)
  649.     {
  650.         if (show_string)
  651.         {
  652.             cleardownfrom(1);
  653.             dbline = 1;
  654.             for (line = 0; screen[line]; line++)
  655.             {    dbline++;
  656.             XDrawImageString (dpy,mainwin,maingc,
  657.                       textcol(4),textrow(dbline),
  658.                       screen[line],strlen(screen[line])) ;
  659.             }
  660.             XDrawImageString(dpy,mainwin,maingc,
  661.                      textcol(0),textrow(0),
  662.                     "Which Screen? [a-p, q]",
  663.                      strlen("Which Screen? [a-p, q]"));
  664.         };
  665.  
  666.         show_string = 0;
  667.  
  668.         XNextEvent(dpy,&event);
  669.         switch(event.type)
  670.         {        case Expose:
  671.             show_string = 1;
  672.             break;
  673.  
  674.             case MappingNotify:
  675.             XRefreshKeyboardMapping(&(event.xmapping));
  676.             break;
  677.  
  678.             case ConfigureNotify:
  679.             sc_handleresize(&event);
  680.             break;
  681.  
  682.             case KeyPress:
  683.             if (XLookupString(&(event.xkey), buffer,8,0,0))
  684.             {
  685.                 c = buffer[0];
  686.                 done = 1;
  687.             };
  688.             break;
  689.         };
  690.     };
  691.     return (c);
  692. }
  693. #else /* DOINGX */
  694. static    int
  695. pscreen(screen)
  696. char *screen[];
  697. {
  698.     int lineno;
  699.     int dbline;
  700.  
  701.     (void) move(1,0);
  702.     (void) clrtobot();
  703.     dbline = 1;
  704.     for (lineno = 0; screen[lineno]; lineno++) {
  705.     (void) move(dbline++, 4);
  706.     (void) addstr (screen[lineno]);
  707.     (void) clrtoeol();
  708.     }
  709.     (void) move(0,0);
  710.     (void) printw("Which Screen? [a-p, q]");
  711.     (void) clrtoeol();
  712.     (void) refresh();
  713.     return(nmgetch());
  714. }
  715. #endif
  716.  
  717. #else
  718. char    ** pages[] = { intro, toggleoptions, setoptions, cursor, cell, vi,
  719.             file, row, range, misc, var, rangef, numericf, stringf,
  720.             finf, timef, shellu, NULL};
  721.  
  722. void
  723. main()
  724. {   int    lineno;
  725.     char    ***pagep = pages;
  726. #ifdef TROFF
  727.     int    pageno = 0;
  728. #endif
  729.  
  730. #ifdef TROFF
  731. puts(".nr PS 12");
  732. puts(".nr VS 14");
  733. puts(".nr HM 1i");
  734. puts(".nr FM 1i");
  735. puts(".nr PO 0.5i");
  736. printf(".EH '%s%s''%s'\n", SCNAME, header, rev);
  737. printf(".OH '%s%s''%s'\n", SCNAME, header, rev);
  738. puts(".EF ''%''");
  739. puts(".OF ''%''");
  740. puts(".de Lp");
  741. puts(".LP");
  742. puts(".ft CW");
  743. puts(".na");
  744. puts(".nf");
  745. puts("..");
  746. puts(".P1");
  747. puts(".LP");
  748. #endif
  749.  
  750.     while (*pagep)
  751.     {
  752. #ifndef TROFF
  753.     (void) fputs(SCNAME, stdout);
  754.     (void) fputs(header, stdout);
  755.     (void) printf("\n");
  756.     (void) puts(rev);
  757. #endif
  758.  
  759.     for (lineno = 0; (*pagep)[lineno]; lineno++) {
  760.         (void) puts((*pagep)[lineno]);
  761.     }
  762. #if !defined(TROFF)
  763.     (void) putchar('\f');
  764. #endif
  765.     pagep++;
  766. #ifdef TROFF
  767.     pageno++;
  768.     if (!(pageno%2)) puts(".bp");
  769. #endif
  770.     }
  771.     (void) exit(0);
  772. }
  773. #endif /* QREF */
  774.