/samples/accept-keys/ask.cob

https://gitlab.com/iladin/open-cobol-contrib · COBOL · 697 lines · 505 code · 70 blank · 122 comment · 7 complexity · 126ed25d115e0f5f9cb90a62a00734f3 MD5 · raw file

  1. >> source format is free
  2. identification division.
  3. program-id. ask.
  4. *> ask * Accept Special Keys.
  5. *>
  6. *> This program shows how the extended ACCEPT special keys are used.
  7. *>
  8. *> The program starts with a help screen.
  9. *> Simply run the program and follow the directions.
  10. *> An ncurses package is required to be in the runtime.
  11. *>
  12. *> To compile and run under Linux,
  13. *>
  14. *> cobc -x ask.cob
  15. *> ./ask
  16. *>
  17. *> Enter "debug" in the first demo to enter debug mode. For experts.
  18. *>
  19. *> Published under GNU General Public License.
  20. data division.
  21. working-storage section.
  22. *> GNU Cobol function keys.
  23. copy screenio.
  24. *> Accept field.
  25. 01 af-auto-skip pic x(01).
  26. 88 af-auto-skip-no value low-value.
  27. 88 af-auto-skip-yes value high-value.
  28. 01 af-column pic 9(04) binary.
  29. 01 af-crt-status pic 9(04).
  30. 01 af-field pic x(40).
  31. 01 af-line pic 9(04) binary.
  32. 01 af-on-exception pic x(01).
  33. 88 af-on-exception-no value low-value.
  34. 88 af-on-exception-yes value high-value.
  35. 01 af-size pic 9(04) binary.
  36. *> Program control.
  37. 01 flag-debug pic x(01) value low-value.
  38. 88 flag-debug-no value low-value.
  39. 88 flag-debug-yes value high-value.
  40. 01 flag-done pic x(01).
  41. 88 flag-done-no value low-value.
  42. 88 flag-done-yes value high-value.
  43. *> Demonstration descriptions.
  44. 01 tabl-demos.
  45. 02 tabl-demo pic x(40)
  46. occurs 23 times.
  47. 01 max-demo pic 9(04) binary value 23.
  48. 01 sub-demo pic 9(04) binary.
  49. *> Other.
  50. 01 ws-accept-enter pic x(01).
  51. 01 ws-field-number pic 9(02) binary value 1.
  52. 01 ws-x-30 pic x(30).
  53. 01 ws-number pic 9(05) binary.
  54. procedure division.
  55. *>
  56. *> Program root.
  57. *>
  58. Perform 0-prepare thru 0-exit.
  59. Perform 1-main thru 1-exit.
  60. Perform 9-finish thru 9-exit.
  61. *>
  62. *> Program main.
  63. *>
  64. 1-main.
  65. *> Insert key.
  66. Set flag-done-no to true.
  67. Perform 10-insert-key thru 10-exit
  68. until flag-done-yes.
  69. *> Home and End keys.
  70. Set flag-done-no to true.
  71. Perform 11-home-end-key thru 11-exit
  72. until flag-done-yes.
  73. *> Backspace and Delete keys.
  74. Set flag-done-no to true.
  75. Perform 12-backspace-delete-key thru 12-exit
  76. until flag-done-yes.
  77. *> Tab and Back Tab keys.
  78. Set flag-done-no to true.
  79. Perform 13-tab-back-tab-key thru 13-exit
  80. until flag-done-yes.
  81. *> Auto-skip, left arrow, and right arrow.
  82. Move 1 to ws-field-number.
  83. Set flag-done-no to true.
  84. Perform 14-auto-skip thru 14-exit
  85. until flag-done-yes.
  86. 1-exit.
  87. Exit.
  88. *>
  89. *> Insert key.
  90. *>
  91. 10-insert-key.
  92. *> Describe demo.
  93. Move " ** INSERT key ** " to tabl-demo (1).
  94. Move " " to tabl-demo (2).
  95. Move "The default for the INSERT key is set " to tabl-demo (3).
  96. Move "by the COB_INSERT_MODE environment " to tabl-demo (4).
  97. Move "variable. " to tabl-demo (5).
  98. Move "If COB_INSERT_MODE is YES or Y (either " to tabl-demo (6).
  99. Move "case) then the program starts with " to tabl-demo (7).
  100. Move "insert mode on. If it is set to NO, N, " to tabl-demo (8).
  101. Move "or is not set at all, then the program " to tabl-demo (9).
  102. Move "starts with insert mode off. " to tabl-demo (10).
  103. Move "Type some characters to see if the " to tabl-demo (11).
  104. Move "insert mode is on or off. " to tabl-demo (12).
  105. Move " " to tabl-demo (13).
  106. Move "Press the Insert key once and type more." to tabl-demo (14).
  107. Move " " to tabl-demo (15).
  108. Move "The last press of the Insert key is used" to tabl-demo (16).
  109. Move "in all following ACCEPT statements while" to tabl-demo (17).
  110. Move "the program is running. " to tabl-demo (18).
  111. Move " " to tabl-demo (19).
  112. Move "Press function keys and the escape key " to tabl-demo (20).
  113. Move "to see those results. Press F1 last " to tabl-demo (21).
  114. Move "since it exits. " to tabl-demo (22).
  115. *> Display demo on the screen.
  116. Perform swd-show-which-demo thru swd-exit.
  117. *> Accept field.
  118. Move "ABCD" to af-field.
  119. Move 2 to af-line.
  120. Move 42 to af-column.
  121. Move 15 to af-size.
  122. Set af-auto-skip-no to true.
  123. Perform af-accept-field thru af-exit.
  124. *> F1 finish demo.
  125. If af-crt-status is equal to cob-scr-f1
  126. Set flag-done-yes to true
  127. Perform er-erase-results thru er-exit
  128. end-if.
  129. *> Turn on debug mode.
  130. If af-field is equal to "debug"
  131. Set flag-debug-yes to true
  132. end-if.
  133. 10-exit.
  134. Exit.
  135. *>
  136. *> Home and End keys.
  137. *>
  138. 11-home-end-key.
  139. *> Describe demo.
  140. Move " ** HOME and END keys ** " to tabl-demo (1).
  141. Move " " to tabl-demo (2).
  142. Move "The HOME key goes to the beginning of " to tabl-demo (3).
  143. Move "the text. Press HOME. " to tabl-demo (4).
  144. Move " " to tabl-demo (5).
  145. Move "The Alt-HOME key goes to the beginning " to tabl-demo (6).
  146. Move "of the field. Press Alt-HOME. " to tabl-demo (7).
  147. Move " " to tabl-demo (8).
  148. Move "The END key goes to the end of the text." to tabl-demo (9).
  149. Move "Press END. " to tabl-demo (10).
  150. Move " " to tabl-demo (11).
  151. Move "The Alt-END key goes to the end of the " to tabl-demo (12).
  152. Move "field. Press Alt-END. " to tabl-demo (13).
  153. Move " " to tabl-demo (14).
  154. Move "Press these keys in any sequence, and " to tabl-demo (15).
  155. Move "enter some characters, to get a feel for" to tabl-demo (16).
  156. Move "how to use them. " to tabl-demo (17).
  157. *> Display demo on the screen.
  158. Perform swd-show-which-demo thru swd-exit.
  159. *> Accept field.
  160. Move " ABCD" to af-field.
  161. Move 2 to af-line.
  162. Move 42 to af-column.
  163. Move 15 to af-size.
  164. Set af-auto-skip-no to true.
  165. Perform af-accept-field thru af-exit.
  166. *> F1 finish demo.
  167. If af-crt-status is equal to cob-scr-f1
  168. Set flag-done-yes to true
  169. Perform er-erase-results thru er-exit
  170. end-if.
  171. 11-exit.
  172. Exit.
  173. *>
  174. *> Backspace and Delete keys.
  175. *>
  176. 12-backspace-delete-key.
  177. *> Describe demo.
  178. Move " ** BACKSPACE and DELETE keys ** " to tabl-demo (1).
  179. Move " " to tabl-demo (2).
  180. Move "The BACKSPACE key backspaces the data " to tabl-demo (3).
  181. Move "from the cursor. " to tabl-demo (4).
  182. Move "Move the cursor to the letter 'C' and " to tabl-demo (5).
  183. Move "press BACKSPACE. " to tabl-demo (6).
  184. Move " " to tabl-demo (7).
  185. Move "The DELETE key deletes the character " to tabl-demo (8).
  186. Move "and moves the remainder left. " to tabl-demo (9).
  187. Move "Move the cursor to the letter 'E' and " to tabl-demo (10).
  188. Move "press DELETE. " to tabl-demo (11).
  189. Move " " to tabl-demo (12).
  190. Move "The Alt-DELETE key deletes all " to tabl-demo (13).
  191. Move "characters from the cursor to the end of" to tabl-demo (14).
  192. Move "the field. " to tabl-demo (15).
  193. Move "Move the cursor to the letter 'D' and " to tabl-demo (16).
  194. Move "press Alt-DELETE. " to tabl-demo (17).
  195. *> Display demo on the screen.
  196. Perform swd-show-which-demo thru swd-exit.
  197. *> Accept field.
  198. Move "ABCDEFGHI" to af-field.
  199. Move 2 to af-line.
  200. Move 42 to af-column.
  201. Move 15 to af-size.
  202. Set af-auto-skip-no to true.
  203. Perform af-accept-field thru af-exit.
  204. *> F1 finish demo.
  205. If af-crt-status is equal to cob-scr-f1
  206. Set flag-done-yes to true
  207. Perform er-erase-results thru er-exit
  208. end-if.
  209. 12-exit.
  210. Exit.
  211. *>
  212. *> Tab and Back Tab keys.
  213. *>
  214. 13-tab-back-tab-key.
  215. *> Describe demo.
  216. Move " ** TAB and BACK TAB keys ** " to tabl-demo (1).
  217. Move " " to tabl-demo (2).
  218. Move "The TAB key returns a status code that " to tabl-demo (3).
  219. Move "is typically used to jump to the next " to tabl-demo (4).
  220. Move "field. " to tabl-demo (5).
  221. Move "In the first field, press TAB. " to tabl-demo (6).
  222. Move " " to tabl-demo (7).
  223. Move "The BACK TAB (Shift-TAB) key is " to tabl-demo (8).
  224. Move "typically used to jump to the previous " to tabl-demo (9).
  225. Move "field. " to tabl-demo (10).
  226. Move "In the second field, press Shift-TAB. " to tabl-demo (11).
  227. Move " " to tabl-demo (12).
  228. Move "The Up-Arrow and Down-Arrow keys may be " to tabl-demo (13).
  229. Move "used for the same purpose. Try them. " to tabl-demo (14).
  230. *> Display demo on the screen.
  231. Perform swd-show-which-demo thru swd-exit.
  232. *> Accept fields.
  233. Set af-auto-skip-no to true.
  234. Move cob-scr-max-field to af-crt-status. *> Prevent infinite loop.
  235. If ws-field-number is equal to 1 *> Switch left and right fields.
  236. Perform 131-accept-field-1 thru 131-exit
  237. until flag-done-yes
  238. or af-crt-status is equal to cob-scr-ok *> Enter.
  239. or af-crt-status is equal to cob-scr-tab *> TAB.
  240. or af-crt-status is equal to cob-scr-key-down *> Down-Arrow.
  241. Move 2 to ws-field-number
  242. else
  243. Perform 132-accept-field-2 thru 132-exit
  244. until flag-done-yes
  245. or af-crt-status is equal to cob-scr-back-tab *> Shift-TAB.
  246. or af-crt-status is equal to cob-scr-key-up *> Up-Arrow.
  247. Move 1 to ws-field-number
  248. end-if.
  249. 13-exit.
  250. Exit.
  251. *> Accept field 1.
  252. 131-accept-field-1.
  253. *> Accept field.
  254. Move "ABC" to af-field.
  255. Move 2 to af-line.
  256. Move 42 to af-column.
  257. Move 5 to af-size.
  258. Perform af-accept-field thru af-exit.
  259. *> F1 finish demo.
  260. If af-crt-status is equal to cob-scr-f1
  261. Set flag-done-yes to true
  262. Perform er-erase-results thru er-exit
  263. end-if.
  264. 131-exit.
  265. Exit.
  266. *> Accept field 2.
  267. 132-accept-field-2.
  268. *> Accept field.
  269. Move "DEF" to af-field.
  270. Move 2 to af-line.
  271. Move 48 to af-column.
  272. Move 5 to af-size.
  273. Perform af-accept-field thru af-exit.
  274. *> F1 finish demo.
  275. If af-crt-status is equal to cob-scr-f1
  276. Set flag-done-yes to true
  277. Perform er-erase-results thru er-exit
  278. end-if.
  279. 132-exit.
  280. Exit.
  281. *> Auto-skip, left arrow, and right arrow.
  282. 14-auto-skip.
  283. *> Describe demo.
  284. Move " ** Arrow keys with AUTO-SKIP ** " to tabl-demo (1).
  285. Move " " to tabl-demo (2).
  286. Move "These ACCEPT statements use the auto " to tabl-demo (3).
  287. Move "skip feature. When a character is " to tabl-demo (4).
  288. Move "entered in the last position, it is as " to tabl-demo (5).
  289. Move "if the ENTER key is pressed. " to tabl-demo (6).
  290. Move "Type 5 characters in the first field. " to tabl-demo (7).
  291. Move " " to tabl-demo (8).
  292. Move "The left arrow auto-skips at the " to tabl-demo (9).
  293. Move "beginning. Press the left arrow at the " to tabl-demo (10).
  294. Move "beginning of the second field. " to tabl-demo (11).
  295. Move " " to tabl-demo (12).
  296. Move "The right arrow auto-skips at the end. " to tabl-demo (13).
  297. Move "Press the right arrow past then end of " to tabl-demo (14).
  298. Move "the first field. " to tabl-demo (15).
  299. Move " " to tabl-demo (16).
  300. Move "The Alt-left-arrow and Alt-right-arrow " to tabl-demo (17).
  301. Move "keys do not auto skip. Try them. " to tabl-demo (18).
  302. *> Display demo on the screen.
  303. Perform swd-show-which-demo thru swd-exit.
  304. *> Accept fields.
  305. Set af-auto-skip-yes to true.
  306. Move cob-scr-max-field to af-crt-status. *> Prevent infinite loop.
  307. If ws-field-number is equal to 1 *> Switch left and right fields.
  308. Perform 131-accept-field-1 thru 131-exit
  309. until flag-done-yes
  310. or af-crt-status is equal to cob-scr-ok *> Enter.
  311. or af-crt-status is equal to cob-scr-key-right *> Right-Arrow.
  312. or af-crt-status is equal to cob-scr-tab *> TAB.
  313. or af-crt-status is equal to cob-scr-key-down *> Down-Arrow.
  314. Move 2 to ws-field-number
  315. else
  316. Perform 132-accept-field-2 thru 132-exit
  317. until flag-done-yes
  318. or af-crt-status is equal to cob-scr-key-left *> Left-Arrow.
  319. or af-crt-status is equal to cob-scr-back-tab *> Shift-TAB.
  320. or af-crt-status is equal to cob-scr-key-up *> Up-Arrow.
  321. Move 1 to ws-field-number
  322. end-if.
  323. 14-exit.
  324. Exit.
  325. *>
  326. *> Program common.
  327. *>
  328. *>
  329. *> Accept field.
  330. *>
  331. *> To use:
  332. *>
  333. *> Move "my text (or spaces)" to af-field. *> Field to accept.
  334. *> Move 10 to af-line. *> Line.
  335. *> Move 20 to af-column. *> Column.
  336. *> Move 15 to af-size. *> Field size.
  337. *> Set af-auto-skip-no to true. *> Auto skip yes or no.
  338. *> Perform af-accept-field thru af-exit.
  339. *> Move af-field to my-text-field.
  340. *>
  341. af-accept-field.
  342. *> Debug: Put all X to show where the field ends.
  343. If flag-debug-yes
  344. Move all "X" to ws-x-30
  345. Display ws-x-30
  346. line af-line
  347. column af-column
  348. end-display
  349. end-if.
  350. *> Accept the field.
  351. If af-auto-skip-yes
  352. Accept af-field *> Auto skip on.
  353. line af-line
  354. column af-column
  355. with update
  356. size af-size
  357. auto-skip
  358. on exception
  359. Set af-on-exception-yes to true
  360. not on exception
  361. Set af-on-exception-no to true
  362. end-accept
  363. else
  364. Accept af-field *> Auto skip off.
  365. line af-line
  366. column af-column
  367. with update
  368. size af-size
  369. on exception
  370. Set af-on-exception-yes to true
  371. not on exception
  372. Set af-on-exception-no to true
  373. end-accept
  374. end-if.
  375. Move cob-crt-status to af-crt-status.
  376. *> Display the results.
  377. Perform dr-display-results thru dr-exit.
  378. af-exit.
  379. Exit.
  380. *>
  381. *> Display the results of the accept.
  382. *>
  383. dr-display-results.
  384. *> The accepted field.
  385. Display af-field
  386. line 21
  387. column 42
  388. end-display.
  389. *> The cob-crt-status.
  390. Move space to ws-x-30.
  391. String
  392. "COB-CRT-STATUS: "
  393. delimited by size
  394. af-crt-status
  395. delimited by size
  396. into ws-x-30
  397. end-string.
  398. Display ws-x-30
  399. line 22
  400. column 42
  401. end-display.
  402. *> The interpretation of the status.
  403. Evaluate af-crt-status
  404. when cob-scr-ok Move space to ws-x-30
  405. when cob-scr-f1 Move "F1 " to ws-x-30
  406. when cob-scr-f2 Move "F2 " to ws-x-30
  407. when cob-scr-f3 Move "F3 " to ws-x-30
  408. when cob-scr-f4 Move "F4 " to ws-x-30
  409. when cob-scr-f5 Move "F5 " to ws-x-30
  410. when cob-scr-f6 Move "F6 " to ws-x-30
  411. when cob-scr-f7 Move "F7 " to ws-x-30
  412. when cob-scr-f8 Move "F8 " to ws-x-30
  413. when cob-scr-f9 Move "F9 " to ws-x-30
  414. when cob-scr-f10 Move "F10" to ws-x-30
  415. when cob-scr-f11 Move "F11" to ws-x-30
  416. when cob-scr-f12 Move "F12" to ws-x-30
  417. when cob-scr-f13 Move "F13" to ws-x-30
  418. when cob-scr-f14 Move "F14" to ws-x-30
  419. when cob-scr-f15 Move "F15" to ws-x-30
  420. when cob-scr-f16 Move "F16" to ws-x-30
  421. when cob-scr-f17 Move "F17" to ws-x-30
  422. when cob-scr-f18 Move "F18" to ws-x-30
  423. when cob-scr-f19 Move "F19" to ws-x-30
  424. when cob-scr-f20 Move "F20" to ws-x-30
  425. when cob-scr-f21 Move "F21" to ws-x-30
  426. when cob-scr-f22 Move "F22" to ws-x-30
  427. when cob-scr-f23 Move "F23" to ws-x-30
  428. when cob-scr-f24 Move "F24" to ws-x-30
  429. when cob-scr-f25 Move "F25" to ws-x-30
  430. when cob-scr-f26 Move "F26" to ws-x-30
  431. when cob-scr-f27 Move "F27" to ws-x-30
  432. when cob-scr-f28 Move "F28" to ws-x-30
  433. when cob-scr-f29 Move "F29" to ws-x-30
  434. when cob-scr-f30 Move "F30" to ws-x-30
  435. when cob-scr-f31 Move "F31" to ws-x-30
  436. when cob-scr-f32 Move "F32" to ws-x-30
  437. when cob-scr-f33 Move "F33" to ws-x-30
  438. when cob-scr-f34 Move "F34" to ws-x-30
  439. when cob-scr-f35 Move "F35" to ws-x-30
  440. when cob-scr-f36 Move "F36" to ws-x-30
  441. when cob-scr-f37 Move "F37" to ws-x-30
  442. when cob-scr-f38 Move "F38" to ws-x-30
  443. when cob-scr-f39 Move "F39" to ws-x-30
  444. when cob-scr-f40 Move "F40" to ws-x-30
  445. when cob-scr-f41 Move "F41" to ws-x-30
  446. when cob-scr-f42 Move "F42" to ws-x-30
  447. when cob-scr-f43 Move "F43" to ws-x-30
  448. when cob-scr-f44 Move "F44" to ws-x-30
  449. when cob-scr-f45 Move "F45" to ws-x-30
  450. when cob-scr-f46 Move "F46" to ws-x-30
  451. when cob-scr-f47 Move "F47" to ws-x-30
  452. when cob-scr-f48 Move "F48" to ws-x-30
  453. when cob-scr-f49 Move "F49" to ws-x-30
  454. when cob-scr-f50 Move "F50" to ws-x-30
  455. when cob-scr-f51 Move "F51" to ws-x-30
  456. when cob-scr-f52 Move "F52" to ws-x-30
  457. when cob-scr-f53 Move "F53" to ws-x-30
  458. when cob-scr-f54 Move "F54" to ws-x-30
  459. when cob-scr-f55 Move "F55" to ws-x-30
  460. when cob-scr-f56 Move "F56" to ws-x-30
  461. when cob-scr-f57 Move "F57" to ws-x-30
  462. when cob-scr-f58 Move "F58" to ws-x-30
  463. when cob-scr-f59 Move "F59" to ws-x-30
  464. when cob-scr-f60 Move "F60" to ws-x-30
  465. when cob-scr-f61 Move "F61" to ws-x-30
  466. when cob-scr-f62 Move "F62" to ws-x-30
  467. when cob-scr-f63 Move "F63" to ws-x-30
  468. when cob-scr-f64 Move "F64" to ws-x-30
  469. when cob-scr-page_up Move "Page Up" to ws-x-30
  470. when cob-scr-page_down Move "Page Down" to ws-x-30
  471. when cob-scr-key-up Move "Up Arrow" to ws-x-30
  472. when cob-scr-key-down Move "Down Arrow" to ws-x-30
  473. when cob-scr-esc Move "Escape" to ws-x-30
  474. when cob-scr-print Move "Print" to ws-x-30
  475. when cob-scr-tab Move "Tab" to ws-x-30
  476. when cob-scr-back-tab Move "Shift-Tab" to ws-x-30
  477. when cob-scr-key-left Move "Left Arrow" to ws-x-30
  478. when cob-scr-key-right Move "Right Arrow" to ws-x-30
  479. when cob-scr-no-field Move "No Field" to ws-x-30
  480. when cob-scr-time-out Move "Time Out" to ws-x-30
  481. when cob-scr-fatal Move "Fatal" to ws-x-30
  482. when cob-scr-max-field Move "Max Field" to ws-x-30
  483. when other Move "(unknown)" to ws-x-30
  484. end-evaluate.
  485. Display ws-x-30
  486. line 23
  487. column 42
  488. end-display.
  489. *> On exception.
  490. If af-on-exception-yes
  491. Display "on exception"
  492. line 24
  493. column 42
  494. end-display
  495. else
  496. Display space
  497. line 24
  498. column 42
  499. with size 12
  500. end-display
  501. end-if.
  502. dr-exit.
  503. Exit.
  504. *> Blank the accept line for the next demo.
  505. er-erase-results.
  506. *> The accept line.
  507. Display space
  508. line af-line
  509. column 42
  510. with size 30
  511. end-display.
  512. *> The result lines.
  513. Display space
  514. line 21
  515. column 42
  516. with size 30
  517. end-display.
  518. Display space
  519. line 22
  520. column 42
  521. with size 30
  522. end-display.
  523. Display space
  524. line 23
  525. column 42
  526. with size 30
  527. end-display.
  528. Display space
  529. line 24
  530. column 42
  531. with size 30
  532. end-display.
  533. er-exit.
  534. Exit.
  535. *>
  536. *> Display demo on the screen.
  537. *>
  538. swd-show-which-demo.
  539. *> Display demo on the left side.
  540. Perform
  541. varying sub-demo
  542. from 1
  543. by 1
  544. until sub-demo is greater than max-demo
  545. Display tabl-demo (sub-demo)
  546. line sub-demo
  547. column 1
  548. end-display
  549. end-perform.
  550. *> Erase for next demo.
  551. Initialize tabl-demos.
  552. swd-exit.
  553. Exit.
  554. *>
  555. *> Program prepare.
  556. *>
  557. 0-prepare.
  558. *> Turn on function keys.
  559. Set environment "COB_SCREEN_EXCEPTIONS" to "Y".
  560. *> Turn on the escape key.
  561. Set environment "COB_SCREEN_ESC" to "Y".
  562. *> No delay for the escape key.
  563. Set environment "ESCDELAY" to "25".
  564. *> Exit if screen size is too small.
  565. Accept ws-x-30
  566. from lines
  567. end-accept.
  568. Move function numval (ws-x-30) to ws-number.
  569. If ws-number is less than 24
  570. Move "Screen size less than 24 lines." to ws-x-30
  571. Perform 01-error-exit thru 01-exit
  572. end-if.
  573. Accept ws-x-30
  574. from columns
  575. end-accept.
  576. Move function numval (ws-x-30) to ws-number.
  577. If ws-number is less than 80
  578. Move "Screen size less than 80 columns." to ws-x-30
  579. Perform 01-error-exit thru 01-exit
  580. end-if.
  581. *> Clear the screen.
  582. Display space
  583. line 1 column 1
  584. with blank screen
  585. end-display.
  586. *> Display instructions.
  587. Initialize tabl-demos.
  588. Move " ask * Accept Special Keys " to tabl-demo (1).
  589. Move " " to tabl-demo (2).
  590. Move "This shows how special keys are used " to tabl-demo (3).
  591. Move "with the extended ACCEPT statement. " to tabl-demo (4).
  592. Move " " to tabl-demo (5).
  593. Move "The description appears on the left. " to tabl-demo (6).
  594. Move "The ACCEPT is on the upper right. And " to tabl-demo (7).
  595. Move "the results are on the bottom right. " to tabl-demo (8).
  596. Move " " to tabl-demo (9).
  597. Move "Press the F1 key on any field to exit " to tabl-demo (10).
  598. Move "the demo and go to the next. " to tabl-demo (11).
  599. *> Display demo on the screen.
  600. Perform swd-show-which-demo thru swd-exit.
  601. *> Wait for the user to press enter.
  602. Accept ws-accept-enter
  603. line 24 column 1
  604. end-accept.
  605. 0-exit.
  606. Exit.
  607. 01-error-exit.
  608. *> Display error.
  609. Display ws-x-30
  610. end-display.
  611. Display "Press enter."
  612. end-display.
  613. *> Wait for enter to be pressed.
  614. Accept ws-accept-enter
  615. end-accept.
  616. *> Stop.
  617. Stop run.
  618. 01-exit.
  619. Exit.
  620. *>
  621. *> Program finish.
  622. *>
  623. 9-finish.
  624. *> Stop.
  625. Stop run.
  626. 9-exit.
  627. Exit.