home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume7 / crisp1.9 / part05 < prev    next >
Encoding:
Text File  |  1989-06-10  |  49.4 KB  |  1,708 lines

  1. Newsgroups: comp.sources.misc
  2. From: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  3. Subject: v07i025: CRISP release 1.9 part 04/32
  4. Organization: Reuters Ltd PLC, Marlow, England
  5. Reply-To: fox@marlow.UUCP (Paul Fox)
  6.  
  7. Posting-number: Volume 7, Issue 25
  8. Submitted-by: fox@marlow.UUCP (Paul Fox)
  9. Archive-name: crisp1.9/part05
  10.  
  11.  
  12.  
  13. #!/bin/sh
  14. # this is part 4 of a multipart archive
  15. # do not concatenate these parts, unpack them in order with /bin/sh
  16. # file help/crisp/prim/C.cmd continued
  17. #
  18. CurArch=4
  19. if test ! -r s2_seq_.tmp
  20. then echo "Please unpack part 1 first!"
  21.      exit 1; fi
  22. ( read Scheck
  23.   if test "$Scheck" != $CurArch
  24.   then echo "Please unpack part $Scheck next!"
  25.        exit 1;
  26.   else exit 0; fi
  27. ) < s2_seq_.tmp || exit 1
  28. echo "x - Continuing file help/crisp/prim/C.cmd"
  29. sed 's/^X//' << 'SHAR_EOF' >> help/crisp/prim/C.cmd
  30. X    expression list_expr.
  31. X
  32. X    Since  lists  may contain any data type, it is probably wise
  33. X    to  assign  the  result  of a car operation to a polymorphic
  34. X    variable, so that its type can be ascertained.
  35. X
  36. XEXAMPLES:
  37. X
  38. X    The  following  example  prints  a  message saying what type
  39. X    the variable at the head of a list is:
  40. X
  41. X        (list llist)
  42. X        (message "Type is %s." (typeof (car llist)))
  43. X.HU cd
  44. XSYNOPSIS:    (cd [path])
  45. X
  46. XRETURN VALUE:
  47. X
  48. X    0 if unsuccessful; non-zero if path changed.
  49. X
  50. XDESCRIPTION:
  51. X
  52. X    This  macro  changes  the current working directory. If path
  53. X    is  omitted,  then  the  current  path  is  displayed on the
  54. X    status line.
  55. X
  56. XEXAMPLES:
  57. X
  58. X    Display current path on screen:
  59. X
  60. X            (cd)
  61. X
  62. X    Change to users home directory:
  63. X
  64. X            (cd (inq_environment "HOME"))
  65. X.HU cdr
  66. XSYNOPSIS:    (cdr list_expr)
  67. X
  68. XRETURN VALUE:
  69. X
  70. X    Returns  the  list  formed  by deleting the first element of
  71. X    the list, list_expr.
  72. X
  73. XDESCRIPTION:
  74. X
  75. X    The  (cdr)  macro  is  used  to  create a new list out of an
  76. X    existing list by removing the first atom in the list.
  77. X
  78. X    Using   (car)   and  (cdr),  macros  can  be  written  which
  79. X    manipulate  all  elements  on  a  list.  However, it is more
  80. X    efficient  to  use  (nth)  to  extract  individual elements,
  81. X    since internally it avoids having to copy sub-lists.
  82. X.HU change_window
  83. XSYNOPSIS:    (change_window [direction])
  84. X
  85. XRETURN VALUE:
  86. X
  87. X    Returns 0 if unsuccessful; 1 if successful.
  88. X
  89. XDESCRIPTION:
  90. X
  91. X    This  macro  is  used  to  move to another window. direction
  92. X    specifies  in  which  direction  to select the window. If it
  93. X    is  omitted,  then  the  user  is  prompted  to  select  the
  94. X    window, by using the cursor keys.
  95. X
  96. X    If  direction  is  specified,  it  should  have  one  of the
  97. X    following values:
  98. X
  99. X        0    Up
  100. X        1    Right
  101. X        2    Down
  102. X        3    Left.
  103. X.HU color
  104. XSYNOPSIS:    (color [background] [normal] [region] [messages] 
  105. X            [errors] [hilite])
  106. X
  107. XRETURN VALUE:
  108. X
  109. X    Nothing.
  110. X
  111. XDESCRIPTION:
  112. X
  113. X    This  macro  is  used  to control the colors that CRISP uses
  114. X    on  a  color display. (The values are ignored for monochrome
  115. X    displays).
  116. X
  117. X    If any parameter is omitted, then the value is prompted for.
  118. X
  119. X    background  is  the color for the background of normal text.
  120. X    normal  is  the  color  associated  with text in the editing
  121. X    windows.  region  is  the color of text when it is marked in
  122. X    a  region.  messages is the color for normal messages on the
  123. X    status  line.  errors  is  the  colors for error messages on
  124. X    the status line. hilite is used to indicate the relationship
  125. X    between highlited text and its background.
  126. X
  127. X    The colors are integers which are defined below.
  128. X
  129. X        0    Black
  130. X        1    Blue
  131. X        2    Green
  132. X        3    Cyan
  133. X        4    Red
  134. X        5    Magenta
  135. X        6    Brown (or dark yellow)
  136. X        7    White
  137. X        8    Dark Grey
  138. X        9    Light Blue
  139. X        10    Light Green
  140. X        11    Light Cyan
  141. X        12    Light Red
  142. X        13    Light Magenta
  143. X        14    Light Yellow
  144. X        15    Light White.
  145. X.HU command_list
  146. XSYNOPSIS:    (command_list)
  147. X
  148. XRETURN VALUE:
  149. X
  150. X    Returns  a  list  consisting  of a sequence of strings which
  151. X    are  the  names  of  all  the CRISP macro primitives and all
  152. X    currently defined macro names.
  153. X
  154. XDESCRIPTION:
  155. X
  156. X    This  macro  is  used  to  get a list of all the keywords in
  157. X    CRISP.  Its  primary  purpose  is  to support the help macro
  158. X    package,  and  avoids hardcoding the macro primitives into a
  159. X    macro or text file.
  160. X
  161. X    See all (macro_list).
  162. X.HU compress
  163. XSYNOPSIS:    (compress string)
  164. X
  165. XRETURN VALUE:
  166. X
  167. X    Returns  a  copy  of  string with all spaces, tabs and newlines
  168. X    mapped to single spaces.
  169. X
  170. XDESCRIPTION:
  171. X
  172. X    This  macro  takes  a  string  and  removes  all multiple white
  173. X    space characters (spaces, tabs and newlines).
  174. X.HU connect
  175. XSYNOPSIS:    (connect [mode] [shell])
  176. X
  177. XRETURN VALUE:
  178. X
  179. X    Returns  0  if buffer already connected; returns 1 if buffer
  180. X    has been successfully connected.
  181. X
  182. XDESCRIPTION:
  183. X
  184. X    This  macro  is  used  to create a sub-process and associate
  185. X    it with the current buffer.
  186. X
  187. X    mode  specifies  some  flags  which  are  defined  below. By
  188. X    default,  the  process  created  is a shell process, and the
  189. X    shell  is  got from the SHELL environment variable. If shell
  190. X    is  specified,  then  it is taken as the pathname of a shell
  191. X    to execute.
  192. X
  193. X    Output  from  a  sub-process  is automatically inserted into
  194. X    the  buffer,  at  a  position  known as the process position
  195. X    (see  (inq_process_position),  (set_process_position)). This
  196. X    position is analagous to the usual input cursor.
  197. X
  198. X    Any  text  which  would normally be inserted into the buffer
  199. X    via  (self_insert),  (insert)  or  (paste) is also forwarded
  200. X    to the sub-process.
  201. X
  202. X    CRISP   implements  sub-processes  out  of  pipes  or  pty's
  203. X    depending   on  the  availability  of  the  underlying  Unix
  204. X    implementation.  When  using pipes, CRISP samples the output
  205. X    from  the  pipe  on  a  1  second interval. Ptys have better
  206. X    interaction since the select() system call is used.
  207. X
  208. X    mode is a set of flags which have the following meaning:
  209. X
  210. X        0x01    If  this  bit  is set, then the buffer operates in
  211. X            echo  mode,  ie the characters which are typed are
  212. X            inserted  into  the  buffer.  If  this  bit is not
  213. X            set,  then  the  buffer  operates in no-echo mode,
  214. X            and   the   characters  the  user  types  are  not
  215. X            directly  inserted  into  the  buffer, but instead
  216. X            only the output from the sub-process.
  217. X
  218. X        0x8000    This  is  the  wait  mode  of  operation. Normally
  219. X            when  a  buffer  is  created,  the output from the
  220. X            subprocess  is  inserted directly into the buffer.
  221. X            Setting  this  bit  causes  the  output  from  the
  222. X            process  to  be held onto, until the calling macro
  223. X            issues a (wait) or (waitfor) macro call.
  224. X
  225. X    (connect)  may  be  called after a buffer has been connected
  226. X    to change the mode flag.
  227. X.HU continue
  228. XSYNOPSIS:    (continue)
  229. X
  230. XRETURN VALUE:
  231. X
  232. X    Nothing.
  233. X
  234. XDESCRIPTION:
  235. X
  236. X    This  macro  is  used  to  finish the current iteration of a
  237. X    (while)  loop,  and  go back to the top of the loop, causing
  238. X    the while condition to be re-evaluated.
  239. X
  240. X    This works similar to the C continue statement.
  241. X.HU copy
  242. XSYNOPSIS:    (copy [append])
  243. X
  244. XRETURN VALUE:
  245. X
  246. X    Nothing.
  247. X
  248. XDESCRIPTION:
  249. X
  250. X    (copy)  copies  the  currently  marked  region  to the scrap
  251. X    buffer, and un-highlites the currently marked region.
  252. X
  253. X    If  append  is  specified  and is non-zero, then the text is
  254. X    appended  to  the  current  scrap without deleting it first.
  255. X    It is not currently implemented.
  256. X.HU create_buffer
  257. XSYNOPSIS:    (create_buffer buffer-name [file-name] [system])
  258. X
  259. XRETURN VALUE:
  260. X    
  261. X    Returns  the  buffer  identifier  associated  with the newly
  262. X    created buffer.
  263. X    
  264. XDESCRIPTION:
  265. X
  266. X    This  macro  is  used  to create a new buffer. The buffer is
  267. X    given  the  name  "buffer-name" which may be any sequence of
  268. X    ASCII  characters.  This  buffer  name  is used to label the
  269. X    top   of   any  windows  the  buffer  is  attached  to  (see
  270. X    attach_buffer).  Care  should  be chosen in selecting buffer
  271. X    names,  since  the  top title on any displayed window may be
  272. X    truncated  if  the  window  is not wide enough to handle the
  273. X    title.
  274. X
  275. X    "file-name"  is  the  full  or  relative path name of a file
  276. X    which  should  be read into the buffer. If this parameter is
  277. X    omitted,  then  an  initially  empty buffer will be created.
  278. X    The  "file-name"  read  into  the  buffer is saved for later
  279. X    use, if the buffer is saved (via write_buffer).
  280. X
  281. X    [system]  is  an  optional  integer  which indicates whether
  282. X    the  buffer  is  to be a system buffer or user buffer. If it
  283. X    is  0  or  omitted,  then  the  buffer  is  a user buffer; a
  284. X    non-zero  value  indicates  a  system buffer. System buffers
  285. X    are  like  normal  buffers, except for two side-effects - no
  286. X    (undo)   information  is  saved  for  operations  on  system
  287. X    buffers,  and  most  high-level macros tend to ignore system
  288. X    buffers,   eg  the  (buffer_list)  macro  does  not  usually
  289. X    display system buffers.
  290. X
  291. X    System   buffers  are  for  use  by  user  macros  or  CRISP
  292. X    supplied  macros  and  provide  a way of storing information
  293. X    without  getting  in the way of the user. (undo) information
  294. X    is  not  saved  for  these  buffers,  and  thus  means  that
  295. X    operations  on  system  buffers  are  slightly  faster  than
  296. X    normal   buffers.   It   is   not   important   that  (undo)
  297. X    information  is  not  stored  with  these  buffers,  because
  298. X    these  buffers  tend  to  only be manipulated by the various
  299. X    macros - not directly by the user.
  300. X    
  301. XEXAMPLES:
  302. X    
  303. X    The  following  example  shows  how  to  create a buffer and
  304. X    display  it  in  the current window. (edit_file) may be more
  305. X    appropriate  for  this  particular  task, but the example is
  306. X    illustrative.
  307. X    
  308. X            (int newbuf)
  309. X    
  310. X            (= newbuf (create_buffer "My Buffer" "myfile.txt"))
  311. X            (attach_buffer newbuf)
  312. X            //   Refresh screen with buffer contents.
  313. X            (refresh)
  314. X.HU create_edge
  315. XSYNOPSIS:    (create_edge [direction])
  316. X
  317. XRETURN VALUE:
  318. X
  319. X    Returns 0 if unsuccessful; 1 if successful.
  320. X
  321. XDESCRIPTION:
  322. X
  323. X    This  macro  is used to split the current window. The window
  324. X    is  split  in  the  direction specified. If direction is not
  325. X    specified  then  the user is prompted, and can use the arrow
  326. X    keys to indicate the direction of the split.
  327. X
  328. X    If  direction  is  specified,  it  should  have  one  of the
  329. X    following values:
  330. X
  331. X        0    Up
  332. X        1    Right
  333. X        2    Down
  334. X        3    Left.
  335. X.HU create_window
  336. XSYNOPSIS:    (create_window left_x bottom_y right_x top_y [message])
  337. X
  338. XRETURN VALUE:
  339. X
  340. X    Nothing.
  341. X
  342. XDESCRIPTION:
  343. X
  344. X    This   macro  is  used  to  create  a  new  window.  left_x,
  345. X    bottom_y,  right_x  and  top_y specifies the co-ordinates of
  346. X    the window.
  347. X
  348. X    message   is   an   optional  string  expression,  which  if
  349. X    specified  is  a  message  to  appear centered on the bottom
  350. X    line of the window.
  351. X
  352. X    Be  careful  not  to  create windows which do not fit within
  353. X    the physical screen, otherwise CRISP may crash.
  354. X
  355. X    The  new  window created becomes the current window - its id
  356. X    can be inquired via (inq_window).
  357. X.HU cut
  358. XSYNOPSIS:    (cut [append])
  359. X
  360. XRETURN VALUE:
  361. X
  362. X    Nothing.
  363. X
  364. XDESCRIPTION:
  365. X
  366. X    The  currently  highlited  region  is  copied  to  the scrap
  367. X    buffer and the region deleted from the current buffer.
  368. X
  369. X    If  append  is specified and is non-zero, then the highlited
  370. X    region  is  appended to the end of the scrap buffer, without
  371. X    first clearing it. This is not currently implemented.
  372. SHAR_EOF
  373. echo "File help/crisp/prim/C.cmd is complete"
  374. chmod 0644 help/crisp/prim/C.cmd || echo "restore of help/crisp/prim/C.cmd fails"
  375. mkdir help help/crisp help/crisp/prim >/dev/null 2>&1
  376. echo "x - extracting help/crisp/prim/D.cmd (Text)"
  377. sed 's/^X//' << 'SHAR_EOF' > help/crisp/prim/D.cmd &&
  378. X.HU date
  379. XSYNOPSIS:    (date [year] [mon] [day] [month-name] [day-name])
  380. X
  381. XRETURN VALUE:
  382. X
  383. X    Nothing.
  384. X
  385. XDESCRIPTION:
  386. X
  387. X    This  macro  retrieves the  current  date. year, mon and day
  388. X    are  optional  integer  variable  names  which  receive  the
  389. X    current  year,  month  number, and day of month number. Year
  390. X    is  of  the  form  1988; mon is in the range 1-12; day is in
  391. X    the range 1-31.
  392. X
  393. X    month-name  is  an  optional  string  variable, and contains
  394. X    the  name  of the month, in the format: January; day-name is
  395. X    an  optional  string  variable  containing  the  day  of the
  396. X    week, in the form: Saturday.
  397. X
  398. XEXAMPLES:
  399. X
  400. X    The  following  example  can  be  used  to print an american
  401. X    date string:
  402. X
  403. X            (int day mon year)
  404. X            (date year mon day)
  405. X            (message "%02/%02/%02" mon day (- 1900 year))
  406. X.HU debug
  407. XSYNOPSIS:    (debug [n])
  408. X
  409. XRETURN VALUE:
  410. X
  411. X    Nothing.
  412. X
  413. XDESCRIPTION:
  414. X
  415. X    debug  turns  on  or off the macro trace mode. When debug is
  416. X    on,  CRISP  traces  the  execution of every macro statement,
  417. X    and  in  addition  traces  assignments  to  the accumulators
  418. X    (integer, string and list).
  419. X
  420. X    This is the primary means of debugging macros.
  421. X
  422. X    If  n  is  omitted,  then debugging is toggled and a message
  423. X    is  printed  on  the  status line saying whether debug is on
  424. X    or off.
  425. X
  426. X    By  default,  debug toggles between 0 and 1. By specifying a
  427. X    value  for  the  debug  macro,  other events in CRISP can be
  428. X    traced.  The  other  bits  are  mostly  for  debugging CRISP
  429. X    itself, and include the ability to trace the following:
  430. X
  431. X        0x01    Trace macro execution.
  432. X        0x02    Trace regular expression parsing.
  433. X        0x04    Trace buffer (undo) information.
  434. X        0x08    Turns on tracing for the prompt history code.
  435. X
  436. X    When  debug  is  turned  on,  all debug output is put in the
  437. X    file  'crisp.log'.  There  is  no  way to change the name of
  438. X    this  file  at  present.  When  the  debug is turned on, any
  439. X    existing crisp.log file is truncated.
  440. X
  441. X    If  the  user  is trying to debug a macro which causes CRISP
  442. X    to  core  dump,  then  CRISP should be run with the -f flag.
  443. X    This  causes  all  debug  info to be flushed to the log file
  444. X    as  it  is  produced, rather than using the stdio buffering.
  445. X    By  default  this is off, since it significantly slows CRISP
  446. X    down due to the high volume of output.
  447. X
  448. XEXAMPLES:
  449. X
  450. X    The  following  is  a  small trace of debug output caused by
  451. X    reformatting this paragraph with the ^F key.
  452. X
  453. X            KEY_EXEC:    objects format_block
  454. X                 (objects "format_block" )
  455. X            Execute macro: objects
  456. X            02:.......(string ext function macro_name )
  457. X                  (int arg1 )
  458. X                  (get_parm 0 function )
  459. X                    function := 'format_block'
  460. X                  (get_parm 1 arg1 )
  461. X                    ACC = 0
  462. X                  (inq_names NULL ext NULL )
  463. X                  (assign_to_key "^N" "objects next_error" )
  464. X                  (assign_to_key "^P" "objects previous_error" )
  465. X                  (= macro_name (..) )
  466. X                  (+ ext (..) )
  467. X                    lookup ext -> "cmd"
  468. X                  (+ "-" function )
  469. X                    lookup function -> "format_block"
  470. X                    SACC = '-format_block'
  471. X                    SACC = 'cmd-format_block'
  472. X                    macro_name := 'cmd-format_block'
  473. X                    SACC = 'cmd-format_block'
  474. X                  (if (..) (..) )
  475. X                  (! (..) )
  476. X                  (inq_macro macro_name )
  477. X                    lookup macro_name -> "cmd-format_block"
  478. X                    ACC = 0
  479. X                    ACC = 1
  480. X                  (= macro_name (..) )
  481. X                  (+ "default-" function )
  482. X                    lookup function -> "format_block"
  483. X                    SACC = 'default-format_block'
  484. X                    macro_name := 'default-format_block'
  485. X                    SACC = 'default-format_block'
  486. X                    SACC = 'default-format_block'
  487. X                  (execute_macro macro_name arg1 )
  488. X                    lookup macro_name -> "default-format_block"
  489. X.HU declare
  490. XSYNOPSIS:    (declare var1 var2 ..)
  491. X
  492. XRETURN VALUE:
  493. X
  494. X    Nothing.
  495. X
  496. XDESCRIPTION:
  497. X
  498. X    This  macro  is  used  to  define  one  or  more polymorphic
  499. X    variables.  Polymorphic  variables  are  variables  that may
  500. X    take  on  any  of  the  available CRISP data types (integer,
  501. X    string or list), depending on context.
  502. X
  503. X    Polymorphic  variables  are  most  useful  when dealing with
  504. X    lists which contain unknown data types.
  505. X
  506. X    The  variables  declared  are  made  into  local  variables,
  507. X    unless a (global) declaration follows.
  508. X
  509. X    By  default,  polymorphic  variables  are typed as integers,
  510. X    and are given the value zero.
  511. X.HU del
  512. XSYNOPSIS:    (del filename)
  513. X
  514. XRETURN VALUE:
  515. X
  516. X    Zero  or  less  if unsuccessful; greater than zero means the
  517. X    file was successfully deleted.
  518. X
  519. XDESCRIPTION:
  520. X
  521. X    This  macro  is  used  to delete a file, as specified by the
  522. X    string expression 'filename'.
  523. X
  524. X    Wild-cards, etc, are not valid in 'filename'.
  525. X.HU delete_block
  526. XSYNOPSIS:    (delete_block)
  527. X
  528. XRETURN VALUE:
  529. X
  530. X    Nothing.
  531. X
  532. XDESCRIPTION:
  533. X
  534. X    The currently highlited block is deleted.
  535. X.HU delete_buffer
  536. XSYNOPSIS:    (delete_buffer bufnum)
  537. X
  538. XRETURN VALUE:
  539. X    
  540. X    No value is returned.
  541. X    
  542. XDESCRIPTION:
  543. X
  544. X    This  command  deletes  the  buffer specified by bufnum. The
  545. X    entire  buffer  contents  are freed, and any other resources
  546. X    attached  to  that buffer are destroyed as well. In the case
  547. X    of a process buffer, the subprocess is killed.
  548. X
  549. X    Any  attempt  to  (set_buffer)  to  a  buffer which has been
  550. X    deleted will fail.
  551. X
  552. X    Care  should  be  taken  with (delete_buffer) since no tests
  553. X    are  made  to  see  if the buffer being deleted is currently
  554. X    displayed.  If  a  currently  displayed  buffer  is deleted,
  555. X    then  CRISP  may  core-dump.  Macros  using  (delete_buffer)
  556. X    should  be  carefully tested to ensure this does not happen,
  557. X    eg by calling (inq_views).
  558. X
  559. XEXAMPLES:
  560. X    
  561. X    The  following  example  creates a temporary buffer and then
  562. X    deletes  it  after  restoring the current buffer at the time
  563. X    of the macro is invoked.
  564. X    
  565. X            (int newbuf)
  566. X            (int curbuf)
  567. X
  568. X            (= curbuf (inq_buffer))
  569. X            (= newbuf (create_buffer "Example" NULL 1))
  570. X            (set_buffer newbuf)
  571. X                .
  572. X                .
  573. X    
  574. X            (set_buffer curbuf)
  575. X            (delete_buffer newbuf)
  576. X.HU delete_char
  577. XSYNOPSIS:    (delete_char [num])
  578. X
  579. XRETURNS:
  580. X    Nothing.
  581. X
  582. XDESCRIPTION:
  583. X
  584. X    This  macro  deletes one or more characters from the current
  585. X    buffer.  If  num  is  not  specified,  then  1  character is
  586. X    deleted;   if   num   is   specified  then  that  number  of
  587. X    characters  are  deleted.  The deleted characters are on and
  588. X    to the right of the current buffer position.
  589. X
  590. X    This  macro  is  the default assignment for the <Delete> key
  591. X    on the keyboard.
  592. X.HU delete_edge
  593. XSYNOPSIS:    (delete_edge [direction])
  594. X
  595. XRETURN VALUE:
  596. X
  597. X    Returns <= 0 if unsuccessful; >0 otherwise.
  598. X
  599. XDESCRIPTION:
  600. X
  601. X    This  macro  can be used to delete a window on-screen. It is
  602. X    used  by  specifying an edge, and if there is another window
  603. X    which  adjoins  the  edge,  then the edge is deleted and the
  604. X    two windows combined into one.
  605. X
  606. X    direction   specifies   the   edge  to  delete  and  if  not
  607. X    specified,  is  prompted for, and the user can use the arrow
  608. X    keys to specify the edge.
  609. X
  610. X    When  using  this  macro, the edge to be deleted must not be
  611. X    obscured   by  other  edges, ie only tiled window support is
  612. X    allowed for this macro.
  613. X
  614. X    If  direction  is  specified,  it  should  have  one  of the
  615. X    following values:
  616. X
  617. X        0    Up
  618. X        1    Right
  619. X        2    Down
  620. X        3    Left.
  621. X.HU delete_line
  622. XSYNOPSIS:    (delete_line)
  623. X
  624. XRETURNS:
  625. X
  626. X    Nothing.
  627. X
  628. XDESCRIPTION:
  629. X
  630. X    This  macro  deletes  the  line  the cursor is currently on.
  631. X    The  cursor  is  placed  at  the same column position in the
  632. X    line below the one deleted.
  633. X
  634. XEXAMPLES:
  635. X
  636. X    The  following  example  assigns  the (delete_line) macro to
  637. X    the <ALT-D> key (the usual case).
  638. X
  639. X            (assign_to_key "<Alt-D>" "delete_line")
  640. X.HU delete_macro
  641. XSYNOPSIS:    (delete_macro [file])
  642. X
  643. XRETURN VALUE:
  644. X
  645. X    Nothing.
  646. X
  647. XDESCRIPTION:
  648. X
  649. X    This  macro  is  used to delete all macros which were loaded
  650. X    from  a  particular  macro file. file is a string expression
  651. X    and  if  omitted is prompted for, containing the name of the
  652. X    file.
  653. X
  654. X    This  is  currently  a  no-op  in  CRISP  -  macros  are not
  655. X    deleteable  entities.  The  storage allocated for a macro is
  656. X    lost  when  a  macro  by  the  same  name  is  loaded from
  657. X    another file.
  658. X.HU delete_to_eol
  659. XSYNOPSIS:    (delete_to_eol)
  660. X
  661. XRETURNS:
  662. X
  663. X    Nothing.
  664. X
  665. XDESCRIPTION:
  666. X
  667. X    This  macro  deletes  all  characters  up  to the end of the
  668. X    line in the current buffer.
  669. X.HU delete_window
  670. XSYNOPSIS:    (delete_window)
  671. X
  672. XRETURN VALUE:
  673. X
  674. X    Nothing.
  675. X
  676. XDESCRIPTION:
  677. X
  678. X    This  macro  can  be  used  to delete the current window. It
  679. X    can  be  used  on overlapping or tiled windows (unlike BRIEF
  680. X    which limits (delete_window) to overlapped windows only).
  681. X
  682. X    Another   window   should  be  selected  (via  (set_window))
  683. X    before  trying  to  refresh  the screen, otherwise CRISP may
  684. X    crash.
  685. X.HU disconnect
  686. XSYNOPSIS:    (disconnect)
  687. X
  688. XRETURN VALUE:
  689. X
  690. X    Nothing.
  691. X
  692. XDESCRIPTION:
  693. X
  694. X    This  macro  is  used  to  kill  a sub-process attached to a
  695. X    buffer.  The  subprocess  is  sent  a  SIGTERM followed by a
  696. X    SIGKILL signal.
  697. X.HU display_mode
  698. XSYNOPSIS:    (display_mode [mode])
  699. X
  700. XRETURN VALUE:
  701. X
  702. X    Returns previous value of display mode.
  703. X
  704. XDESCRIPTION:
  705. X
  706. X    The  display  mode  is  a  special mode for use on terminals
  707. X    which  cannot  display  characters with the top bit set. The
  708. X    mode  defines  whether  these characters should be displayed
  709. X    in  octal  or  hexadecimal.  Octal  characters  appear  as a
  710. X    backslash  followed  by  three  octal digits. Hex characters
  711. X    appear  as  a  backslash  followed by an 'x' followed by two
  712. X    hex digits.
  713. X
  714. X    The default is hexadecimal.
  715. X
  716. X    If  mode  is  1,  then the mode is set to hexadecimal. If 2,
  717. X    then octal.
  718. X.HU distance_to_tab
  719. XSYNOPSIS:    (distance_to_tab)
  720. X
  721. XRETURNS:
  722. X
  723. X    Number  of  characters  between  current cursor location and
  724. X    next tab stop.
  725. X
  726. XDESCRIPTION:
  727. X
  728. X    This  macro  returns  the  number  of characters between the
  729. X    current  cursor  location  and  the  next  tab stop, even if
  730. X    there  are  no more characters after the cursor. This number
  731. X    will always be > than zero.
  732. X
  733. X    If  the  cursor  is  on  a  tab  stop,  then  the  number of
  734. X    characters to the next tab stop are returned.
  735. X.HU dos
  736. XSYNOPSIS:    (dos [command] [use_shell] [completion])
  737. X
  738. XRETURN VALUE:
  739. X
  740. X    Returns  the  shell exit status (under Unix, 0 means command
  741. X    exited  successfully,  non-zero  means  command  failed  for
  742. X    some reason).
  743. X
  744. XDESCRIPTION:
  745. X
  746. X    This  macro  exists for compatability with BRIEF; please see
  747. X    the (shell) command for further information.
  748. X.HU down
  749. XSYNOPSIS:    (down [lines])
  750. X
  751. XRETURN VALUE:
  752. X
  753. X    Nothing.
  754. X
  755. XDESCRIPTION:
  756. X
  757. X    Moves  the  cursor  to the same column on the line below. If
  758. X    lines  is  specified  then  cursor  is moved to the lines'th
  759. X    line  after  the  current.  lines  may  be negative in which
  760. X    case the cursor moves backwards.
  761. X.HU drop_anchor
  762. XSYNOPSIS:    (drop_anchor [type])
  763. X
  764. XRETURN VALUE:
  765. X
  766. X    Nothing.
  767. X
  768. XDESCRIPTION:
  769. X
  770. X    This  macro  is  used  to define a region within the current
  771. X    buffer.  type  specifies  the type of region, and the values
  772. X    are  given  below.  If  omitted  a  normal  marked region is
  773. X    selected.
  774. X
  775. X    Regions  are  areas  of a buffer upon which some macros have
  776. X    special  effects,  eg  (cut)  and (copy) are used to extract
  777. X    fragments  of  buffers and save them for later re-insertion.
  778. X    The  (search_fwd)  and  (search_back)  macros can be told to
  779. X    limit their searches to the highlited regions, etc.
  780. X
  781. X    Regions  are  displayed  on  screen  either  in  a different
  782. X    color, or in reverse video so that they stand out.
  783. X
  784. X    The following are the different region types:
  785. X
  786. X        1    Normal
  787. X        2    Column
  788. X        3    Line
  789. X        4    Non-inclusive.
  790. X
  791. X    A  normal  mark is a region which encompasses from the place
  792. X    where   the  anchor  was  dropped  upto  and  including  the
  793. X    current  cursor  position.  A non-inclusive mark is the same
  794. X    but does not include the current cursor position.
  795. X
  796. X    A  line  mark  selects  entire  lines,  and  allows for easy
  797. X    movement of text from one part of a buffer to another.
  798. X
  799. X    A  column  mark  is  similar  to  a  normal  mark, except it
  800. X    displays  differently  on  screen,  and  allows  rectangular
  801. X    sections of the current buffer to be marked.
  802. X
  803. X    The  currently  selected  marked  area  can  be  found,  via
  804. X    (inq_marked).  Column  operations are not directly supported
  805. X    by  CRISP  internally,  but  instead  are  supported  by the
  806. X    macros supplied with CRISP.
  807. X
  808. X    Regions  are  nestable,  ie  multiple (drop_anchor)'s can be
  809. X    issued without any intervening (raise_anchor).
  810. X
  811. X    The  marked  region can be cleared by calling (raise_anchor)
  812. X    or performing a (copy) or (cut) operation on the buffer.
  813. X.HU drop_bookmark
  814. XSYNOPSIS:    (drop_bookmark [book_num] [yes] [buf] [line] [col])
  815. X
  816. XRETURN VALUE:
  817. X
  818. X    Nothing.
  819. X
  820. XDESCRIPTION:
  821. X
  822. X    This  macro  is used to set a bookmark. A bookmark is like a
  823. X    normal  bookmark  -  it  is  a  place  holder  in  a buffer.
  824. X    book_num  specifies  the  bookmark  number  1-10;  yes  is a
  825. X    string which is ignored.
  826. X
  827. X    If  buf,  line & col are non-NULL, then bookmark book_num is
  828. X    set  to  the  specified  buffer  at  the designated line and
  829. X    column  position.  If  buf,  line  or  col are NULL then the
  830. X    bookmark  is  set  from  the current buffer, line and column
  831. X    position.
  832. SHAR_EOF
  833. chmod 0644 help/crisp/prim/D.cmd || echo "restore of help/crisp/prim/D.cmd fails"
  834. mkdir help help/crisp help/crisp/prim >/dev/null 2>&1
  835. echo "x - extracting help/crisp/prim/E.cmd (Text)"
  836. sed 's/^X//' << 'SHAR_EOF' > help/crisp/prim/E.cmd &&
  837. X.HU echo_line
  838. XSYNOPSIS:    (echo_line [flags])
  839. X
  840. XRETURN VALUE:
  841. X
  842. X    Previous value of flags.
  843. X
  844. XDESCRIPTION:
  845. X
  846. X    The  (echo_line)  macro  is used to control which fields are
  847. X    visible  in  the  status  line. If flags is omitted then the
  848. X    current setting is returned.
  849. X
  850. X    flags  is  an  integer  expression,  whose  bit  pattern  is
  851. X    interpreted as follows:
  852. X
  853. X        0x01    Line: field enabled.
  854. X        0x02    Col: field enabled.
  855. X        0x04    Percentage through file enabled.
  856. X        0x08    Current time enabled.
  857. X        0x10    REmember/PAuse reminders enabled.
  858. X        0x20    Cursor type displayed.
  859. X
  860. X    The  cursor  type  is  only used if the screen cannot change
  861. X    the    cursor   type   to   indicate   insert/overtype   and
  862. X    normal/virtual space.
  863. X
  864. X.HU edit_file
  865. XSYNOPSIS:    (edit_file [file1] [file2] ..)
  866. X
  867. XRETURN VALUE:
  868. X
  869. X    Nothing.
  870. X
  871. XDESCRIPTION:
  872. X
  873. X    This  macro  is the usual way of editing a file; if a buffer
  874. X    is  already  allocated for the file, then that is set as the
  875. X    current  buffer.  Otherwise  a  new  buffer  is created, the
  876. X    contents  of  the  named  file  are  read into that, and the
  877. X    filename  is  associated  with that buffer (so that later on
  878. X    a  (write_buffer)  can  be  used to save any changes made to
  879. X    the buffer).
  880. X
  881. X    This  macro  supports  wild-cards  and  the  ability to edit
  882. X    multiple  files  at  once.  If  more  than  one  argument is
  883. X    specified,  then  a  separate  (edit_file)  is  performed on
  884. X    each  file,  and  the current buffer is set to the last file
  885. X    read in.
  886. X
  887. X    The normal c-shell wildcards are supported:
  888. X
  889. X            *    wild-card -- matches any number of characters.
  890. X            ?    wild-character -- matches any single character.
  891. X            [l-m]    any character in range at this character.
  892. X            ~/    as first part of filename matches home directory
  893. X            ~user/    matches 'user's home directory.
  894. X
  895. X    If  no  filenames  are specified, the user is prompted for a
  896. X    filename.
  897. X
  898. XEXAMPLES:
  899. X
  900. X    The  following  example  can be used to read in all .c files
  901. X    in the current directory:
  902. X
  903. X            (edit_file "*.c")
  904. X.HU ega
  905. XSYNOPSIS:    (ega [mode])
  906. X
  907. XRETURN VALUE:
  908. X
  909. X    Previous value of EGA mode.
  910. X    
  911. XDESCRIPTION:
  912. X
  913. X    This  macro  can  be used to toggle between EGA 25 line mode
  914. X    and  EGA  43  line  mode  --  only if CRISP is running under
  915. X    Unix V.3.2 or above on an EGA console.
  916. X
  917. X    If  mode  is  not specified, then only the current EGA state
  918. X    is returned.
  919. X.HU enable_display
  920. XSYNOPSIS:    (enable_display [enable])
  921. X
  922. XRETURN VALUE:
  923. X
  924. X    Nothing.
  925. X
  926. XDESCRIPTION:
  927. X
  928. X    This  macro  is  used to enable the display. By default when
  929. X    CRISP  starts  up,  the  code  for  updating  the  screen is
  930. X    disabled.  The  startup  macros  initialise  CRISPs internal
  931. X    character  translation  tables  and  then call this macro to
  932. X    allow CRISP to proceed.
  933. X
  934. X    If  enable  is  not  specified,  then  the  current value is
  935. X    toggled. If it is non-zero, then the display is enabled.
  936. X
  937. X    If  the  display is not enabled, then CRISP can be used as a
  938. X    normal  programming  language,  in the style of awk and sed,
  939. X    using the command line arguments to load and execute a file.
  940. X.HU end_of_buffer
  941. XSYNOPSIS:    (end_of_buffer)
  942. X
  943. XRETURN VALUE:
  944. X
  945. X    Nothing.
  946. X
  947. XDESCRIPTION:
  948. X
  949. X    Moves  the  cursor  to  the  end  of  the  last  line in the
  950. X    current buffer.
  951. X.HU end_of_line
  952. XSYNOPSIS:    (end_of_line)
  953. X
  954. XRETURN VALUE:
  955. X
  956. X    Nothing.
  957. X
  958. XDESCRIPTION:
  959. X
  960. X    Moves  the  cursor  to  the  end  of  the  current line.
  961. X.HU end_of_window
  962. XSYNOPSIS:    (end_of_window)
  963. X
  964. XRETURN VALUE:
  965. X
  966. X    Returns  1  if  cursor moved; 0 if cursor stayed in the same
  967. X    position.
  968. X
  969. XDESCRIPTION:
  970. X
  971. X    Moves  the  cursor  to  the  last  line  of  the window. The
  972. X    cursor stays in the same column position.
  973. X.HU error
  974. XSYNOPSIS:    (error fmt [arg1] [arg2] ..)
  975. X
  976. XRETURN VALUE:
  977. X
  978. X    Nothing.
  979. X
  980. XDESCRIPTION:
  981. X
  982. X    This  macro  is  used  to  print  a  message  on  the status
  983. X    (prompt)  line.  fmt  is  a  string  with  possible embedded
  984. X    printf-like   %   options.   arg1,  arg2,  ..  are  optional
  985. X    arguments  (upto  4  parameters)  which  either  evaluate to
  986. X    strings or integer values.
  987. X
  988. X    The  %  options  are the same as for the underlying printf()
  989. X    which  the  system  supports.  (Internally the string coding
  990. X    is  handled  by  sprintf). Please see the description of the
  991. X    (message)  macro  for a list of the minimum supported set of
  992. X    % options.
  993. X
  994. X    This  macro  is similar to (message) except that the message
  995. X    string  is  classified  as  an  error.  Error  messages  are
  996. X    printed in the error color (see (color)).
  997. X
  998. X    In  addition,  if  the pause_on_error flag has been set (see
  999. X    (pause_on_error))   then  the  error  message  is  displayed
  1000. X    suffixed  with  a  '..' and CRISP waits for the user to type
  1001. X    any key to continue. This is useful in debugging.
  1002. X
  1003. X    Error messages are truncated if they are too long.
  1004. X
  1005. XEXAMPLES:
  1006. X
  1007. X        (string mac)
  1008. X        (= mac "fred")
  1009. X        (error "Macro %s not loaded." mac)
  1010. X        ; displays the message 'Macro fred not loaded.')
  1011. X
  1012. X        (error "%02d/%02d/%02d" 2 25 88)
  1013. X        ; displays '02/25/88'
  1014. X.HU execute_macro
  1015. XSYNOPSIS:    (execute_macro [macro] [args])
  1016. X
  1017. XRETURN VALUE:
  1018. X
  1019. X    Returns the value of (macro args).
  1020. X
  1021. XDESCRIPTION:
  1022. X
  1023. X    This  macro  is  used to execute another macro. It is needed
  1024. X    because  it  is  the  only  way  to execute a macro which is
  1025. X    defined  by  a  string  expression, rather than by virtue of
  1026. X    the CRISP language syntax.
  1027. X
  1028. X    macro  should  be  a  string  expression  and  if omitted is
  1029. X    prompted  for;  args  are  optional  and  are  the arguments
  1030. X    passed to the macro.
  1031. X.HU exist
  1032. XSYNOPSIS:    (exist filename)
  1033. X
  1034. XRETURN VALUE:
  1035. X
  1036. X    Non-zero if filename exists; zero if file does not exist.
  1037. X
  1038. XDESCRIPTION:
  1039. X
  1040. X    Checks  for  existence of file. The existence of the file is
  1041. X    performed  by  doing  a  stat()  call  on  the  named  file.
  1042. X    Therefore  this  can  be  used for all file types (including
  1043. X    character/block devices, etc).
  1044. X.HU exit
  1045. XSYNOPSIS:    (exit)
  1046. X
  1047. XRETURN VALUE:
  1048. X
  1049. X    Nothing.
  1050. X
  1051. XDESCRIPTION:
  1052. X
  1053. X    This  macro  is used to exit from CRISP, or from a recursive
  1054. X    (process) macro invocation.
  1055. X
  1056. X    If  called  at the bottom level of CRISP, CRISP goes through
  1057. X    its  exit  procedure and prompts the user if he/she is sure,
  1058. X    if there are any buffers which have been modified.
  1059. X
  1060. X    If  called  from within a nested invocation of (process), on
  1061. X    the   next  attempt  to  read  keyboard  input  the  calling
  1062. X    (process) macro will return.
  1063. X
  1064. X    Note   that   CRISP   currently   does   not   support   the
  1065. X    [are_you_sure] option which BRIEF supports.
  1066. X.HU extern
  1067. XSYNOPSIS:    (extern var1 var2 ..)
  1068. X
  1069. XRETURN VALUE:
  1070. X
  1071. X    Nothing.
  1072. X
  1073. XDESCRIPTION:
  1074. X
  1075. X    The  extern  macro is provided for compatability with BRIEF.
  1076. X    In CRISP it does not do anything.
  1077. X
  1078. X    In  BRIEF  it  is  used  so that global variables defined in
  1079. X    other   macro   source   files  can  be  referenced  without
  1080. X    resulting in undefined symbol reference errors.
  1081. X
  1082. X    CRISP  does  not  check  for  the  availability  of a symbol
  1083. X    until it is actually referenced at run-time.
  1084. SHAR_EOF
  1085. chmod 0644 help/crisp/prim/E.cmd || echo "restore of help/crisp/prim/E.cmd fails"
  1086. mkdir help help/crisp help/crisp/prim >/dev/null 2>&1
  1087. echo "x - extracting help/crisp/prim/G.cmd (Text)"
  1088. sed 's/^X//' << 'SHAR_EOF' > help/crisp/prim/G.cmd &&
  1089. X.HU get_parm
  1090. XSYNOPSIS:    (get_parm [arg] var [prompt] [length] [default])
  1091. X
  1092. XRETURN VALUE:
  1093. X
  1094. X    Zero  if  user  aborted  prompt, or argument number does not
  1095. X    exist. Greater than zero if successful.
  1096. X
  1097. XDESCRIPTION:
  1098. X
  1099. X    (get_parm)   is   the  mechanism  for  accessing  parameters
  1100. X    passed  to  macros.  (get_parm)  can  also be used to prompt
  1101. X    the user for input, and possibly specify a default value.
  1102. X
  1103. X    Arguments  passed  to  macros are numbered, zero upwards. If
  1104. X    arg  is  specified, then it is evaluated to the value of the
  1105. X    argument  number  to  be  retrieved. If it is NULL, then the
  1106. X    user  is  prompted  for  the  value, in which case prompt is
  1107. X    the  message  to prompt the user, and default (if specified)
  1108. X    is  the  default  value  which the user can then edit, using
  1109. X    the  command  line  editing.  If  length is specified, it is
  1110. X    the  maximum  number  of  characters  in  the  user's  input
  1111. X    (usually  used  only  for string variables). The users input
  1112. X    is terminated by hitting <Enter> or reaching the length.
  1113. X
  1114. X    var  is  the name of an integer, string or list variable. If
  1115. X    the  user  is  being  prompted, then only integer and string
  1116. X    expressions   may   be   input.  List  expressions  are  not
  1117. X    supported.
  1118. X
  1119. X    Arguments  passed  to  macros are passed as call by name, ie
  1120. X    every   time   a   (get_parm)  is  issued  on  a  particular
  1121. X    parameter,  that  parameter  is  re-evaluated.  This  can be
  1122. X    very  useful  sometimes,  and  at  other  times it can cause
  1123. X    anomalous side-effects.
  1124. X
  1125. X.HU get_term_characters
  1126. XSYNOPSIS:    (get_term_characters [top_left] [top_right] 
  1127. X            [bot_left] [bot_right] 
  1128. X            [vertical] [horizontal]
  1129. X            [top_join] [bot_join] [cross] 
  1130. X            [left_join] [right_join])
  1131. X
  1132. XRETURN VALUE:
  1133. X
  1134. X    Nothing.
  1135. X
  1136. XDESCRIPTION:
  1137. X
  1138. X    This  macro  can  be  used  to find out the current settings
  1139. X    for  the  various  characters  which  make  up  the  special
  1140. X    characters  needed  to  display  the  window  borders on the
  1141. X    screen.
  1142. X
  1143. X    Each  parameter  is the name of a string variable to receive
  1144. X    the string expression. Any of the parameters may be omitted.
  1145. X
  1146. X    This  macro  is designed to allow macros to be written which
  1147. X    make it easier for the user to tailor the display.
  1148. X
  1149. X    Refer  to  (set_term_characters)  for  further detail on the
  1150. X    meaning of each of these characters.
  1151. X.HU get_term_features
  1152. XSYNOPSIS:    (get_term_features [space] [char] [icursor]
  1153. X            [ocursor] [vicursor] [vocursor]
  1154. X            [escape] [repeat] [zerom]
  1155. X            [color])
  1156. X
  1157. XRETURN VALUE:
  1158. X
  1159. X    Nothing.
  1160. X
  1161. XDESCRIPTION:
  1162. X
  1163. X    This  macro  is  used to retrieve the terminal options which
  1164. X    the  current  display  supports.  All the parameters are the
  1165. X    names  of  string  variables,  except  for  zerom  and color
  1166. X    which are the names of integer variables.
  1167. X
  1168. X    Refer  to  (set_term_features)  for  a  description  of  the
  1169. X    meaning of each feature.
  1170. X
  1171. X    This  macro  is  designed  to  be used to allow macros to be
  1172. X    written  which  allow  the  user  to  easily  tailor his/her
  1173. X    display environment.
  1174. X.HU get_term_keyboard
  1175. XSYNOPSIS:    (get_term_keyboard ..)
  1176. X
  1177. XRETURN VALUE:
  1178. X
  1179. X    Nothing.
  1180. X
  1181. XDESCRIPTION:
  1182. X
  1183. X    This  macro  is designed to allow the calling macro retrieve
  1184. X    the  assignments  for each key, so that a user interface can
  1185. X    be written to examine and display the key bindings.
  1186. X
  1187. X    See  (set_term_keyboard)  for more details of how this macro
  1188. X    is supposed to work.
  1189. X
  1190. X    This macro has not been currently implemented.
  1191. X.HU getpid
  1192. XSYNOPSIS:    (getpid)
  1193. X
  1194. XRETURN VALUE:
  1195. X
  1196. X    Returns the current process ID (as returned via getpid()).
  1197. X
  1198. XDESCRIPTION:
  1199. X
  1200. X    This  function  exists  to  allow macros to be written which
  1201. X    need  to  generate  unique  filenames. The process ID can be
  1202. X    embedded  in  temporary  filenames to avoid clashes with any
  1203. X    other users running CRISP.
  1204. X
  1205. XEXAMPLES:
  1206. X
  1207. X    The  following  example generates a filename for a temp file
  1208. X    in the /tmp directory.
  1209. X
  1210. X            (string filename)
  1211. X            (sprintf filename "/tmp/gr.xx%05d" (getpid))
  1212. X.HU global
  1213. XSYNOPSIS:    (global var1 var2 ..)
  1214. X
  1215. XRETURN VALUE:
  1216. X
  1217. X    Nothing.
  1218. X
  1219. XDESCRIPTION:
  1220. X
  1221. X    The  global  macro  is  used  to  make  local variables into
  1222. X    global  variables.  Local  variables  are destroyed when the
  1223. X    macro  executing  them terminates. Global variables maintain
  1224. X    their  value  across  macro  invocation and occupy permanent
  1225. X    static storage.
  1226. X
  1227. X    A  variable  must  have  been specified in a previous (int),
  1228. X    (string),  (list)  or  (declare)  statement before it can be
  1229. X    made into a global.
  1230. X.HU goto_bookmark
  1231. XSYNOPSIS:    (goto_bookmark [book_no] [bufnum] [line] [col])
  1232. X
  1233. XRETURNS:
  1234. X
  1235. X    1  if  macro was successful; 0 if bookmark invalid or prompt
  1236. X    was aborted.
  1237. X
  1238. XDESCRIPTION:
  1239. X
  1240. X    book_no  is  an  integer;  bufnum, line & col are (optional)
  1241. X    names of integer variables.
  1242. X
  1243. X    This  macro  is  used  to  move  the  cursor to a previously
  1244. X    saved  bookmark.  If  bufnum,  line  &  col  are all NULL or
  1245. X    omitted,  then  the buffer and cursor information associated
  1246. X    with book_no are selected.
  1247. X
  1248. X    If  any  of  bufnum,  line  or col are specified, then these
  1249. X    variables  are  modified to have that information associated
  1250. X    with the designated bookmark.
  1251. X
  1252. X    If  book_no  is omitted, then the user will be prompted  for
  1253. X    the bookmark number to go to.
  1254. X
  1255. XEXAMPLES:
  1256. X
  1257. X    The   following   example   gets  the  buffer,  line  &  col
  1258. X    associated with bookmark 5.
  1259. X
  1260. X            (int  buf line col)
  1261. X            (goto_bookmark 5 buf line col)
  1262. X
  1263. X    The following example jumps to bookmark 5:
  1264. X
  1265. X            (goto_bookmark 5)
  1266. X.HU getwd
  1267. XSYNOPSIS:    (getwd ignored dir)
  1268. X
  1269. XRETURN VALUE:
  1270. X
  1271. X    Returns 1.
  1272. X
  1273. XDESCRIPTION:
  1274. X
  1275. X    This  function  returns  the current directory in the string
  1276. X    variable    dir.    The   ignored   parameter   exists   for
  1277. X    compatability  with  BRIEF which allows the calling macro to
  1278. X    specify  the  drive for the directory. Unix does not support
  1279. X    the  concept  of  multiple  current  directories,  and so is
  1280. X    ignored.
  1281. X.HU goto_line
  1282. XSYNOPSIS:    (goto_line [line])
  1283. X
  1284. XRETURN VALUE:
  1285. X
  1286. X    Nothing.
  1287. X
  1288. XDESCRIPTION:
  1289. X
  1290. X    Moves  the  cursor  to  the beginning of the specified line.
  1291. X    If line is omitted it is prompted for.
  1292. X.HU goto_old_line
  1293. XSYNOPSIS:    (goto_old_line [line])
  1294. X
  1295. XRETURN VALUE:
  1296. X
  1297. X    Nothing.
  1298. X
  1299. XDESCRIPTION:
  1300. X
  1301. X    When  a  file is read into a buffer, each line is internally
  1302. X    numbered.  These  internal  line numbers are maintained even
  1303. X    if   lines   are  inserted  and  deleted  from  the  buffer.
  1304. X    (goto_old_line)   moves   the   cursor  to  the  line  whose
  1305. X    original  line  number  was  line, or as near as possible if
  1306. X    the original lines have been deleted.
  1307. X
  1308. X    This  macro  gets  over the problem of editing a source file
  1309. X    to  correct  compilation  errors,  and the lines with errors
  1310. X    moving as text is inserted or deleted.
  1311. X
  1312. X    If line is omitted, it is prompted for.
  1313. X
  1314. SHAR_EOF
  1315. chmod 0644 help/crisp/prim/G.cmd || echo "restore of help/crisp/prim/G.cmd fails"
  1316. mkdir help help/crisp help/crisp/prim >/dev/null 2>&1
  1317. echo "x - extracting help/crisp/prim/I.cmd (Text)"
  1318. sed 's/^X//' << 'SHAR_EOF' > help/crisp/prim/I.cmd &&
  1319. X.HU if
  1320. XSYNOPSIS:    (if expr [true-list] [false-list])
  1321. X
  1322. XRETURN VALUE:
  1323. X
  1324. X    Returns  value  of  true-list  if  expr  is  true, otherwise
  1325. X    value of false-list.
  1326. X
  1327. XDESCRIPTION:
  1328. X
  1329. X    The  expression  'expr'  is evaluated, and if it is non-zero
  1330. X    (true),  the  list  expression  'true-list' is evaluated; if
  1331. X    expr  is  false,  then  'false-list' is evaluated. true-list
  1332. X    and  false-list  are  optional,  in which case the result of
  1333. X    the (if) expression is undefined if they are omitted.
  1334. X.HU index
  1335. XSYNOPSIS:    (index search-string pattern)
  1336. X
  1337. XRETURN VALUE:
  1338. X
  1339. X    Returns  0  if  pattern  cannot  be  found in search-string;
  1340. X    otherwise   returns   the  position  pattern  starts  at  in
  1341. X    search-string.
  1342. X
  1343. XDESCRIPTION:
  1344. X
  1345. X    This   function   is   used  to  see  whether  search-string
  1346. X    contains  the  substring  pattern. A literal substring match
  1347. X    is   performed.   This   function   returns   the  place  in
  1348. X    search-string  where  pattern  has  been  located or 0 if it
  1349. X    does not occur in the search-string.
  1350. X
  1351. X    If  the  user  needs to search for regular expressions, then
  1352. X    the function search_string should be used instead.
  1353. X
  1354. XEXAMPLES:
  1355. X
  1356. X    The  following  example checks to see if a string is a lower
  1357. X    case alphabetic character:
  1358. X
  1359. X            (string letter)
  1360. X              .
  1361. X              .
  1362. X            (if (== (index "abcdefghijklmnopqrstuvwxyz" letter) 0)
  1363. X                (message "%c is upper case." letter)
  1364. X            ;else
  1365. X                (message "%c is lower case." letter)
  1366. X.HU inq_assignment
  1367. XSYNOPSIS:    (inq_assignment key [convert])
  1368. X
  1369. XRETURN VALUE:
  1370. X
  1371. X    Returns  the  name of a macro assigned to a keystroke or the
  1372. X    name of a keystroke assigned to a macro.
  1373. X
  1374. XDESCRIPTION:
  1375. X
  1376. X    This  macro  can be used to find out what macro a particular
  1377. X    keyboard  character  is assigned to, or to which key or keys
  1378. X    a particular macro is assigned to.
  1379. X
  1380. X    key  maybe  a string denoting the key sequence to be decoded
  1381. X    or  an  integer  representing  the internal key code. If key
  1382. X    is  a  string  then it should be of the form described under
  1383. X    (assign_to_key).
  1384. X    
  1385. X    convert  is  an integer expression; if omitted or zero, then
  1386. X    key  is  treated  as  a  keyboard  character (as defined for
  1387. X    (assign_to_key)),  and  the  name  of  the macro assigned to
  1388. X    that   keystroke  is  returned.  If  the  character  is  not
  1389. X    assigned  to  a  macro,  and  the character is inserted into
  1390. X    the   buffer   when  the  user  hits  it,  then  the  string
  1391. X    "self_insert"  is  returned.  If  there is no key assignment
  1392. X    for that key, then "nothing" is returned.
  1393. X
  1394. X    If  convert  is  specified  and  is  non-zero, then 'key' is
  1395. X    taken  as  the  name  of  a  macro  and the keys assigned to
  1396. X    invoke   this   macro   are  returned.  The  key  assignment
  1397. X    returned  is  returned  using  the  portable key definitions
  1398. X    defined for "assign_to_key".
  1399. X
  1400. X    If  more  than  one  key  stroke  is assigned the same macro
  1401. X    invocation,  then  the  returned  string  will  contain  the
  1402. X    string "<-also>" separating the key sequences.
  1403. X
  1404. XEXAMPLES:
  1405. X
  1406. X        (message "%s" (inq_assignment "help"))
  1407. X        generates the message "<Alt-H>".
  1408. X.HU inq_borders
  1409. XSYNOPSIS:    (inq_borders)
  1410. X
  1411. XRETURN VALUE:
  1412. X    
  1413. X    Returns zero if borders are off; non-zero if borders are on.
  1414. X
  1415. XDESCRIPTION:
  1416. X
  1417. X    Not currently implemented.
  1418. X.HU inq_brief_level
  1419. XSYNOPSIS:    (inq_brief_level)
  1420. X
  1421. XRETURN VALUE:
  1422. X
  1423. X    Nothing.
  1424. X
  1425. XDESCRIPTION:
  1426. X
  1427. X    This  function  exists  for  compatability  with BRIEF. This
  1428. X    macro  is  supposed  to  return  the  level  of  nesting  of
  1429. X    sub-shells  running  BRIEF/CRISP.  It  is not implemented in
  1430. X    CRISP,  since  the  functionality can be gained by examining
  1431. X    the BLEVEL environment variable.
  1432. X.HU inq_buffer
  1433. XSYNOPSIS:    (inq_buffer)
  1434. X
  1435. XRETURN VALUE:
  1436. X
  1437. X    Returns the identifier associated with the current buffer.
  1438. X
  1439. XDESCRIPTION:
  1440. X
  1441. X    Every   buffer   has   an   identifier  (an  integer  value)
  1442. X    associated  with  it.  These  identifiers are allocated when
  1443. X    the  buffer  is created. (inq_buffer) can be used to get the
  1444. X    identifier  for  the  current  buffer,  e.g. when saving the
  1445. X    current  buffer  in  a  macro,  so  that after the macro has
  1446. X    finished  the  buffer  selected on entry to the macro can be
  1447. X    re-instated.
  1448. X
  1449. XEXAMPLES:
  1450. X
  1451. X    The  following  example is typical of the code sequence used
  1452. X    in the CRISP macros on entry and exit to each macro.
  1453. X
  1454. X            (int    curbuf)
  1455. X            (= curbuf (inq_buffer))
  1456. X                .
  1457. X                .
  1458. X            (set_buffer curbuf)
  1459. X.HU inq_buffer_flags
  1460. XSYNOPSIS:    (inq_buffer_flags [bufnum])
  1461. X
  1462. XRETURN VALUE:
  1463. X
  1464. X    Flags  associated  with  designated  buffer,  or  -1  if the
  1465. X    designated buffer does not exist.
  1466. X
  1467. XDESCRIPTION:
  1468. X
  1469. X    This  macro  returns the flags associated with the status of
  1470. X    the  current  buffer  (if  bufnum  is omitted) or the buffer
  1471. X    whose identifier is bufnum.
  1472. X
  1473. X    The  flags  returned  are  a  set of bits with the following
  1474. X    bits being defined:
  1475. X
  1476. X            0x01 Buffer has been modified.
  1477. X            0x02 Buffer will be backed up when written.
  1478. X            0x04 Buffer is read-only.
  1479. X            0x08 Reserved.
  1480. X            0x10 File permissions in underlying file has
  1481. X                 the 'x' (execute bit) set.
  1482. X            0x20 Buffer has a process associated with it.
  1483. X            0x40 Buffer contains a binary file.
  1484. X        0x80 Buffer in ANSI mode.
  1485. X
  1486. X.HU inq_called
  1487. XSYNOPSIS:    (inq_called)
  1488. X
  1489. XRETURN VALUE:
  1490. X
  1491. X    A  string  containing the name of the macro which called the
  1492. X    current  macro,  or  ""  if  the  macro  was called from the
  1493. X    keyboard.
  1494. X
  1495. XDESCRIPTION:
  1496. X
  1497. X    This  macro  exists so that macros can be written which need
  1498. X    to  differentiate  between  being  called  directly from the
  1499. X    keyboard, or being called from another macro.
  1500. X
  1501. X    This  is  especially  useful  when  writing  a (replacement)
  1502. X    macro.
  1503. X.HU inq_cmd_line
  1504. XSYNOPSIS:    (inq_cmd_line)
  1505. X
  1506. XRETURN VALUE:
  1507. X
  1508. X    Returns  the  field  currently being typed in by user on the
  1509. X    prompt line.
  1510. X
  1511. XDESCRIPTION:
  1512. X
  1513. X    This  macro  returns  the  partially typed in text which the
  1514. X    user  is  typing  on  the prompt line. It is used by various
  1515. X    macros to perform command completion.
  1516. X.HU inq_command
  1517. XSYNOPSIS:    (inq_command)
  1518. X
  1519. XRETURN VALUE:
  1520. X
  1521. X    A  string  containing  the  name of the last macro called by
  1522. X    the user.
  1523. X
  1524. XDESCRIPTION:
  1525. X
  1526. X    This  macro  can  be used to find the name of the last macro
  1527. X    which  was  invoked  by  virtue  of  it  being  bound  to  a
  1528. X    keyboard key.
  1529. X.HU inq_environment
  1530. XSYNOPSIS:    (inq_environment name)
  1531. X
  1532. XRETURN VALUE:
  1533. X
  1534. X    Returns  a  string  which  is  the  contents  of  the  named
  1535. X    environment  variable,  or  the  null string if the variable
  1536. X    does not exist.
  1537. X
  1538. XDESCRIPTION:
  1539. X
  1540. X    This  function  looks  up  'name'  in  the  environment  and
  1541. X    returns  the  value of name. It is similar to the C function
  1542. X    getenv().
  1543. X.HU inq_file_buffer
  1544. XSYNOPSIS:    (inq_file_buffer filename)
  1545. X
  1546. XRETURN VALUE:
  1547. X
  1548. X    Returns   the   buffer   identifier   of  the  buffer  which
  1549. X    currently  has  filename  loaded;  it  returns 0 if the file
  1550. X    filename is not loaded into buffer.
  1551. X
  1552. XDESCRIPTION:
  1553. X
  1554. X    Given  the  filename, this macro examines all buffers to see
  1555. X    if  any  buffer  has the designated filename loaded into it,
  1556. X    and if so returns the buffer identifier.
  1557. X
  1558. X    This  is  much  faster  than  doing  an  (inq_names) on each
  1559. X    buffer to see which buffer contains filename.
  1560. X
  1561. X    This  macro  is  used  by  the  (buffer_list) macro when the
  1562. X    user writes or deletes a selected entry.
  1563. X
  1564. XEXAMPLES:
  1565. X
  1566. X    The   following   example   checks  to  see  if  "fox.m"  is
  1567. X    currently being edited and if not edit's it:
  1568. X
  1569. X            (if (== (inq_file_buffer "fox.m") 0)
  1570. X                (edit_file "fox.m"))
  1571. X.HU inq_idle_default
  1572. XSYNOPSIS:    (inq_idle_default)
  1573. X
  1574. XRETURN VALUE:
  1575. X
  1576. X    Returns the value of the idle keyboard interval timer (in
  1577. X    seconds).
  1578. X
  1579. XDESCRIPTION:
  1580. X
  1581. X    This  function  returns  the  interval for the idle keyboard
  1582. X    interval  timer.  The  idle  keyboard  interval  timer  is a
  1583. X    timer  which  is  started  after  the  last keystroke. If no
  1584. X    keys  are  hit  for (inq_idle_default) seconds then the type
  1585. X    4 registered macros are called.
  1586. X
  1587. X    The  default  idle  timer  is  set  by the '-i' command line
  1588. X    switch.  If  it  is  not set on the command line explicitly,
  1589. X    then CRISP uses a default value of 60 seconds.
  1590. X.HU inq_idle_time
  1591. XSYNOPSIS:    (inq_idle_time)
  1592. X
  1593. XRETURN VALUE:
  1594. X
  1595. X    Returns the number of seconds since the last key was pressed.
  1596. X
  1597. XDESCRIPTION:
  1598. X
  1599. X    This  function  returns the number of seconds since the last
  1600. X    key  was  pressed. This macro is used by the autosave macros
  1601. X    to see if it is time to save the editing buffers.
  1602. X.HU inq_kbd_char
  1603. XSYNOPSIS:    (inq_kbd_char)
  1604. X
  1605. XRETURN VALUE:
  1606. X
  1607. X    Returns  non-zero  if  there  is a character to be read from
  1608. X    the keyboard; 0 if no character is available.
  1609. X
  1610. XDESCRIPTION:
  1611. X
  1612. X    This  macro  provides  a simple way of determining whether a
  1613. X    character   is  available  to  be  read  from  the  keyboard
  1614. X    without actually reading it. (See (read_char)).
  1615. X.HU inq_keyboard
  1616. XSYNOPSIS:    (inq_keyboard)
  1617. X
  1618. XRETURN VALUE:
  1619. X
  1620. X    Returns the identifier associated with the current keyboard.
  1621. X
  1622. XDESCRIPTION:
  1623. X
  1624. X    This  macro  may  be  used  to  find  out  what  the current
  1625. X    keyboard identifier is so that it may be restored later.
  1626. X
  1627. X    See  keyboard_push,  keyboard_pop  for  further  details  on
  1628. X    keyboard identifiers.
  1629. X.HU inq_line_length
  1630. XSYNOPSIS:    (inq_line_length [bufnum])
  1631. X
  1632. XRETURN VALUE:
  1633. X    
  1634. X    (inq_line_length)  returns  the  length of the longest line,
  1635. X    or -1 if the specified buffer does not exist.
  1636. X
  1637. XDESCRIPTION:
  1638. X    
  1639. X    This  command  is  used  returns  the  length of the longest
  1640. X    line  in  the  specified  buffer  (or  the current buffer if
  1641. X    bufnum  is  omitted).  The length corresponds to the  column
  1642. X    position  the  cursor  would  be in if the cursor were to be
  1643. X    placed  at  the  end  of  the longest line, ie it takes into
  1644. X    account any embedded tabs and control characters, etc.
  1645. X
  1646. X    If  the  designated  buffer  has  a marked region, then only
  1647. X    those  lines  within the marked region are looked at to find
  1648. X    the longest line.
  1649. X    
  1650. X    
  1651. XEXAMPLES:
  1652. X    
  1653. X    The  following  example  returns  the  length of the longest
  1654. X    line  in  the current buffer in between the current line and
  1655. X    the end of the buffer.
  1656. X    
  1657. X            # include "crisp.h"
  1658. X              .
  1659. X              .
  1660. X            (int length)
  1661. X    
  1662. X            (drop_anchor MK_LINE)
  1663. X            (save_position)
  1664. X            (= length (inq_line_length))
  1665. X            (restore_position)
  1666. X            (raise_anchor)
  1667. X            (message "Longest line = %d cols" length)
  1668. X.HU inq_lines
  1669. XSYNOPSIS:    (inq_lines)
  1670. X
  1671. XRETURN VALUE:
  1672. X
  1673. X    Number of lines in current buffer.
  1674. X
  1675. XDESCRIPTION:
  1676. X
  1677. X    This  macro  returns  the  number  of  lines  in the current
  1678. X    buffer.  It  is  faster  than going to the end of the buffer
  1679. X    and doing an (inq_position).
  1680. X
  1681. XEXAMPLES:
  1682. X
  1683. X    Following example prints number of lines in buffer:
  1684. X    
  1685. X            (message "Lines = %d" (inq_lines))
  1686. X.HU inq_local_keyboard
  1687. XSYNOPSIS:    (inq_local_keyboard)
  1688. X
  1689. XRETURN VALUE:
  1690. X
  1691. X    The  keyboard  identifier  associated with the current local
  1692. X    keyboard, or 0 if there is no local keyboard.
  1693. X
  1694. XDESCRIPTION:
  1695. X
  1696. X    This  function  returns  the identifier of the current local
  1697. SHAR_EOF
  1698. echo "End of part 4"
  1699. echo "File help/crisp/prim/I.cmd is continued in part 5"
  1700. echo "5" > s2_seq_.tmp
  1701. exit 0
  1702. -- 
  1703. =====================            Reuters Ltd PLC, 
  1704. Tel: +44 628 891313 x. 212         Westthorpe House,
  1705. UUCP:     fox%marlow.uucp@idec.stc.co.uk  Little Marlow,
  1706.                        Bucks, England SL7 3RQ
  1707.  
  1708.