Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucbvax!VIOLET.BERKELEY.EDU!mwm From: mwm@VIOLET.BERKELEY.EDU (Mike Meyer, I'll think of something yet) Newsgroups: comp.sys.amiga.tech Subject: ARexx interface for mg3a Message-ID: <8905240716.AA25867@violet.berkeley.edu> Date: 24 May 89 07:16:37 GMT Sender: usenet@ucbvax.BERKELEY.EDU Lines: 316 The following is the documentation for the ARexx interface I'm planning on building into mg3. I'm sending this to two groups, hoping for comments & suggestions, on the hopes of improving things. The first group is the BITNET Rexx list - 'cause thats where the real Rexx gurus live. For them, there's a brief introduction to emacs & mg. The second group is comp.sys.amiga.tech, 'cause that's where I expect to find those who'll actually wind up the thing. For them, I'd like to point out that I haven't been able to keep up with the group, so could they please _mail_ me their comments. Addresses are: mwm@berkeley.edu -or- ucbvax!mwm Some of you may have seen earlier versions of this interface. It's changed since then, but just slightly. This also looks more like a user manual and less like a reference manual. Thanx, "rexx-point point2" creates two compound variables, point1 and point2, each holding data about a point. rexx-point: stem.1 is the line number the point is on, stem.2 is the points offset into the line, stem.3 is the text of the line the point is on. rexx-mark: identical to rexx-point, except that it returns data about the mark instead of the point. If no mark exists in the current buffer, rexx.0 is set to 0, and an error is returned. rexx-buffer: stem.1 is the buffer name, stem.2 is the file name associated with the buffer, stem.3 is the number of lines in the buffer, stem.4 is the number of characters in the buffer, stem.5 is the line # the point is on, stem.6 is the line # the mark is on. If no mark exists, stem.6 is not set, stem.0 will be 5, and an error will be returned. If no file is associated with the buffer, the stem.2 will be "", and no error will be signaled. rexx-window: stem.1 is the height of the current window in characters, stem.2 is it's width, stem.3 is the name of the displayed buffer, stem.4 is the name of the file in that buffer. If there is no buffer name (which should never happen), then stem.0 will be 2. If there is no file, stem.0 will be 3. In either case, an error will be returned. rexx-region returns the text of the region. If no mark is set (hence no region), stem.0 is set to 0, and an error is returned. The text of each line is returned in stem.#, with the newline (unlike rexx-line). The last line may not have a newline, if the region does not end after a newline character. rexx-buffer-list is the exception mentioned above. Instead of returning data in stem.#, these contain another level of compound variable. Stem.# contains data about a specific buffer, like so: stem.#.NAME is the name of buffer #, stem.#.FILE is the file it's editing, and stem.#.STATUS is either "" or "CHANGED " if it's been changed, with "CURRENT" appended if this is the current buffer. Finally, there are rexx-lock and rexx-unlock. They are used by ARexx macros not started from mg to use it as an edit server. These are not yet implemented because I'm still thinking about the edit server interface. 4) Some examples Here are some short examples that do little except exercise the various commands, and show what they do. /* Exercise the rexx-buffer command */ options failat 2 'rexx-buffer' buffer 'end-of-buffer' 'rexx-insert "We got' buffer.0 'items\^M"' 'rexx-insert "buffer' buffer.1 'is editing file' buffer.2'.\^M"' 'rexx-insert "with' buffer.3 'lines,' buffer.4 'characters.\^M"' 'rexx-insert "point is on line' buffer.5'"' if buffer.0 > 5 then 'rexx-insert " and mark on line' buffer.6'.\^M"' else 'rexx-insert " and no mark.\^M"' exit 0 /* Exercise the rexx-buffer-list command */ options failat 2 'rexx-buffer-list' buffers 'rexx-insert "We got' buffers.0 'buffers\^M"' do i = 1 to buffers.0 'rexx-insert "' buffers.i.name 'file:' buffers.i.file buffers.i.status '\^M"' end exit 0 /* exercise the rexx-line command */ options results options failat 2 'rexx-line' save = result 'end-of-buffer' 'rexx-insert' '"'save'"' exit 0 /* exercise the rexx-point & rexx-mark commands */ options failat 2 'rexx-point' point 'rexx-mark' mark 'end-of-buffer' 'rexx-insert "*** point ***\^M"' 'rexx-insert' """we got" point.0 "items\^M""" 'rexx-insert' """point is on line" point.1 "like so\^M""" 'rexx-insert' '"'point.3'\^M"' if point.2 = 1 then 'rexx-insert "|\^M"' else 'rexx-insert' '"' || copies(" ", point.2 - 1) || '|\^M"' if mark.0 = 0 then 'rexx-insert' """There is no mark\^M" else do 'rexx-insert "*** mark ***\^M"' 'rexx-insert' """we got" mark.0 "items\^M""" 'rexx-insert' """mark is on line" mark.1 "like so\^M""" 'rexx-insert' '"'mark.3'\^M"' if mark.2 = 1 then 'rexx-insert "|\^M"' else 'rexx-insert' '"' || copies(" ", mark.2 - 1) || '|\^M"' end exit 0 /* Exercise the rexx-region command */ options failat 2 'rexx-region' region /* Now, change to an alternate buffer, and delete all text in it */ 'switch-to-buffer-other-window region-test-output' 'end-of-buffer' 'beginning-of-buffer' 'kill-region' /* Put the region from the other buffer into the current buffer */ 'rexx-insert "We got' region.0 'lines!\^M"' do i = 1 to region.0 'rexx-insert "'region.i'"' end exit 0 /* Exercise the rexx-region command */ options failat 2 'end-of-buffer' 'rexx-window' window 'rexx-insert "'we got" window.0 "items\^M""" 'rexx-insert "'window height is:" window.1"\^M""" 'rexx-insert "'window width is:" window.2"\^M""" 'rexx-insert "'buffer name is:" window.3"\^M""" 'rexx-insert "'buffer file is:" window.4"\^M""" 'rexx-insert "==========\^M"' exit 0