The Origami editor has an Arexx Port (it did take a long time, but now it is ready ... in a small version). This part of the manual describes the arexx features for the amiga port. It is the first time Arexx is supported, so there may be some bugs in it. Please report them !!! The port has not all the features i would like to have, but i am working on it. See the coming features in the last section of this manual. {{{ Definition of the Arexx features 1. Definition of the Arexx features The port has only some predefined Arexx commands, so you have to define all features you need in the binding files. To add an additional command, you have to do two things : - add the macro defining all commands that shall be executed (take the macro definitions in the /bindings/fun/* files as examples) - add a os-extension line with the following syntax : (os-extension ("AREXX " ", )) You have to replace the with the name, that you have to send to execute the macro named defined in the first step. REMEMBER : You have to use the EXACT syntax as specified above, including : - the " characters - exactly one space between the " and the - at least two spaces between the ", sequence and the REMEMBER : You have to declare a macro before(!) you use it in the os-extension line. See the example of the letsbeep command in the amiga.keys file. See the OSamiga.awk script for an easier use of the AREXX port using the AWK language. }}} {{{ Starting Origami with Arexx Port 2. Starting Origami with Arexx Port If you want to use the AREXX features of the origami, you have to - define AREXX during compilation (the version in src/amiga/bin has been compiled that way !) - start origami with the option -XA[REXX][=] (the parts in brackets [] can be specified, but are not needed) If you just use -XA or -XAREXX origami will use ORIGAMI as basename; if you specify a portname (behind a = character), origami will use this name as basename. Origami will try to open a port with the basename as portname. If this is impossible, origami will try 1, 2 ... 9 }}} {{{ Calling a arexx command 3. Calling a arexx command You can call an origami arexx command with the address arexx command. See your Arexx description or the src/amiga/rexx/test.rexx example for more information. }}} {{{ Passing arguments 4. Passing arguments If you want to use arguments in your macros (see next section), you have two possible ways to pass them : a) One argument can be passed be specifying it directly behind the command address b) If you need more arguments you must use another way of passing : You can put one argument on the stack by calling the PUTARG command address PUTARG Example : You have a command --- named "message" --- that needs one argument : address ORIGAMI message "This is a testmessage" or address ORIGAMI putarg "This is a testmessage" address ORIGAMI message See examples test2.rexx and test3.rexx Example : You have a command --- named "saserror" --- that needs three arguments : address ORIGAMI putarg filename address ORIGAMI putarg linenumber address ORIGAMI saserror message or address ORIGAMI putarg filename address ORIGAMI putarg linenumber address ORIGAMI putarg message address ORIGAMI saserror REMEMBER : arguments will not be deleted from the stack, so if you would call message without argument, the last argument from the stack will be used. REMEMBER : the results returned by a command will be put on the stack too. }}} {{{ Using arguments in macros 5. Using arguments in macros If you want to write your own macros, that need arguments, you have to use the history names "arexx" for receiving the arguments. Each argument send to origami (e.g. by PUTARG) will be put in the "arexx" history, so you can get the arguments by the "history arexx" or the "get-history arexx " commands (see examples). REMEMBER : To use this method of argument passing, origami needs to know which history number (OCL-intern) the "arexx" history uses. There is no usual way defined in OCL to do this. I have changed the source of the amiga keybind binary, so all .rc-files compiled on an amiga will contain that number and automaticaly define that history. These files will work on all other computer systems. If you use a .rc-file from another computer system, origami will work, but you can not use the argument passing function. Note : keybind passes the history number by using a os-extension of the type : (os-extension ("AREXXHIST )) this line will automatically inserted. If you specify a line with the same syntax, origami can use the argument passing function even with .rc-files compiled on other systems, but you have to know the number (look into the viewrc output ... or guess :-)) }}} {{{ Returning arguments 6. Returning arguments If you want to return data from inside origami to arexx you have to put the data on top of the arexx history. Origami will ALWAYS return the top-most argument. (See example test6.rexx) }}} {{{ Predefined commands 7. Predefined commands There are two predefined commands in the current port : - PUTARG : use this to put an argument on the history stack - ISDEF : use this function, to determine, if the function used as argument is defined. }}} {{{ What this port can not do. What will be possible in the future ? 8. What this port can not do. What will be possible in the future ? This is the first release, so there are not many possibilities now. You also can not call any OCL-commands directly. This feature will never be possible, cause that would result in a much bigger editor (i would have to include almost the whole keybind executable in the editor). I will add a command calling exact one OCL-token. This feature should be handled with care (when ready) due to problems : - the token code may change in each release ! - arexx sources with tokens are very complicated to read and debug ! - the tokens can only be used to call the lowest functions of OCL (call it the OCL-assembler-code). There are only a few checks (origami thinks keybinds codes are checked and stored correctly !), so your code may crash origami or your machine very easily. This shows the problems with that feature, so it will not be used much (i hope). The last feature i want to include in future releases concerns some build-in commands like PORTNAME (returning the portname), COMMAND (returning a list of all commands) and maybe some other features. }}} At the end a last warning : The arexx port is still experimental and may have some serious bugs (e.g. i didn't try, what happens, when origami executes a long arexx command and you use the arexx port a second time :-)) Be careful ... thanks Have fun trying Thomas