Origami User Guide Michael Haardt u31b3hs@pool.informatik.rwth-aachen.de Rtscherstrae 155/1703 52072 Aachen Germany _A_B_S_T_R_A_C_T This document describes all the functions of Origami and the syntax and semantics of its con- trol language OCL. The first part describing the Origami commands is intended to be read by new users, who need more than just a description of bindings as given in the reference cards. The second part is intended for OCL programmers. It is very usefull if you would like to create or modify bindings. This document assumes that you are familiar with the folding concept, as described in the introduction manual. Contents 9 1 Using Origami ..................... 4 1.1 Getting Started ................. 4 1.2 The Screen Format ............... 5 1.3 The Special Editor Buffers ...... 6 1.4 Processing Origami Files ........ 7 1.5 Inmos Files ..................... 8 9 2 All Origami functions ............. 9 2.1 Moving around ................... 9 2.2 Folding ......................... 9 2.3 Editing ......................... 12 2.4 Search and replace .............. 14 2.5 Files ........................... 15 2.6 Macros .......................... 18 2.7 Shell commands .................. 19 2.8 Arguments ....................... 19 2.9 Special functions ............... 19 2.10 How to get out ................. 25 9 3 Programming in OCL ................ 25 3.1 Resource files .................. 25 9Origami 1.6.92 - 1 - October 1993 User Guide - 2 - 3.2 OCL syntax and semantics ........ 25 3.2.1 Filed folds and libraries ..... 25 3.2.2 Name and command line options . 25 3.2.3 Binding commands to keys ...... 25 3.2.4 Other marks for folds ......... 25 3.2.5 Functions and macros .......... 25 3.2.6 Control structures ............ 25 3.2.7 Variables Types ............... 25 3.2.7.1 global integer variables .... 25 3.2.7.2 global integer arrays ....... 25 3.2.7.3 parameter variables ......... 25 3.2.8 Variable Initialization ....... 25 3.2.9 Variables Usage ............... 25 3.2.9.1 Terms ....................... 25 3.2.9.2 Variable statements ......... 25 3.2.10 Character sets ............... 25 3.2.11 Boolean expressions .......... 25 3.2.12 The display area ............. 25 3.2.13 User defined modes ........... 25 3.2.14 Multiple keyboard modes ...... 25 3.2.15 Terminals .................... 25 3.2.16 Conditional compilation ...... 25 3.2.17 Special commands ............. 25 3.2.18 References ................... 25 3.3 OCL examples .................... 25 3.3.1 Bindings keys ................. 25 3.3.2 A small function .............. 25 3.3.3 Revision control system ....... 25 3.3.4 MTool-version of top-of-fold .. 25 3.3.5 Fill paragraph ................ 25 3.3.6 Goto matching fence ........... 60 3.3.7 The towers of hanoi ........... 61 3.3.8 Conditional compilation ....... 61 3.3.9 Libraries ..................... 62 3.3.10 Modes and terminals .......... 62 3.3.11 Command line options, hooks .. 64 9 4 Mouse extension ................... 68 4.1 Available implementations ....... 68 4.1.1 X ............................. 68 4.1.2 MGR ........................... 68 4.1.3 X and MGR together ............ 69 4.2 Multiple Mouse supports ......... 69 4.3 Using the mouse in OCL .......... 69 9 5 Miscellaneous ..................... 71 9 6 Copyright appointments ............ 72 9 7 Acknowledgements .................. 73 9 8 Appendixes ........................ 75 8.1 Regular expressions ............. 75 8.1.1 Regular search expressions .... 75 8.1.2 Regular replace expressions ... 77 8.2 Messages ........................ 79 8.3 OCL-assembler ................... 83 9Origami 1.6.92 - 2 - October 1993 User Guide - 3 - 8.3.1 Syntax ........................ 83 8.3.2 Commands ...................... 84 8.4 Command line options ............ 96 8.5 Compiletime Configuration ....... 100 9 9 Index ............................. 102 9 Origami 1.6.92 - 3 - October 1993 User Guide - 4 - Using Origami _1. _U_s_i_n_g _O_r_i_g_a_m_i _1._1. _G_e_t_t_i_n_g _S_t_a_r_t_e_d It is assumed that Origami is installed and ready to use on your system. It is invoked by typing origami at the system prompt. Filenames may be typed after origami - if this is not done a prompt for a filename will be issued. If Origami recognizes filenames, starting with a symbolic home directory (marked with ~[_u_s_e_r_n_a_m_e]), Origami tries to use the corresponding path instead. Therefore the passwd database is read, if _u_s_e_r_n_a_m_e is given or the value of environment variable HOME is used. If you have not installed any resource files yourself, Ori- gami will startup with default files, installed in your Ori- gami directory. The resources files can be changed. Look in chapter Programming in OCL for more details. Origami can handle lines up to 1024 characters. Reading file with longer lines will break these lines. In this case, a warning appears at the bottom of the screen. Control characters will be displayed as ^ followed by the ASCII coding of the character (@ABCDEFGHIJKLM- NOPQRSTUVWXYZ[\]^_ for 0..31). The null character cannot be handled properly for internal reasons (C strings!). Every- thing following the null character will be ignored. newline will cause a line break. It cannot be used as input. Use newline-and-indent instead. The delete character 127 will be displayed ^?. Characters with set highbit can be displayed octal or hex, using command line option -d_m_o_d_e. ctrl-chars can be displayed in the same way. The tab character can be displayed in different ways (default is -t8), depending on the chosen command line option: -t 0: Handle as normal control character. -t _n, _n>0: Display tab as whitespace. Tabs are not allowed in front of fold lines or before inden- tation level of the current fold. Spaces and tabs at end of line will be deleted when editing a line! Trailing spaces and tabs will only remain in the text, if the concerning lines are not changed and the lines are not inside indented folds. otherwise Origami strips all these characters on writing the file. Origami 1.6.92 - 4 - October 1993 User Guide - 5 - Using Origami If you do not have write permission for the specified file, Origami will enter view only mode. Look at the manual page for advanced command line options. If the current file is a directory, Origami will use a list of filed folds for each directory entry as text. Command line options -f and -F can be used, to control, which files will be shown. The corresponding regular expressions can be changed, by changing the values in histories match and no- match. The OCL variable diredit-long can be set to non- zero, to get directory displays in long format. _1._2. _T_h_e _S_c_r_e_e_n _F_o_r_m_a_t On starting an Origami session, a status line appears near the bottom of the screen. This line will probably remain throughout your edit session and any prompts or warnings issued by the editor will appear below this line. If you use multiple buffers you will see several other status lines, one for each open buffer. These status lines tell you which buffer is active (selected) and divide the windows into the buffers from each other. If you started typing a key sequence bound to a command, this sequence will be displayed under the status line, as well. If the second character of the line is a star, your file contains unsaved changes. The current language and the active modes are indicated in parentheses: long short meaning Magic Ma basic regular expressions active XMagic XM extended regular expressions active Folding F creating a fold DefMac D defining a keyboard macro View V Origami is in view only mode. Over O Origami is in overwrite mode. AutoSave S Origami is in auto save mode. # # Origami is in hash shift mode NoParse NP Origami is in no-parse mode. DirView DV Current file is a directory. If the position display mode is active (add-mode-position), the current line and column is displayed in front of the filename. The column is the screen coordinate, not the text coordinate. Values greater than the linelength (1024) are possible, if the current line contains characters, which are displayed with more than one character (tabs or control characters). If the statusline is too long, the short forms are used and in language User, only the first 8 characters are shown (a cut string will be marked with a trailing $). If required, Origami tries to cut the path and displays `...' instead of Origami 1.6.92 - 5 - October 1993 User Guide - 6 - Using Origami the omitted part of the path. If there is a name defined in your keybinding file, it is displayed to the left of the version number (1.6.92) instead of `Origami'. If Origami was started with command line option '-W _s_t_r_i_n_g', _s_t_r_i_n_g will be displayed in front of the filename. Origami can edit more than one file at a time. For this, the screen is split into windows. Each of these windows displays one of the files being edited. Each of the windows has a status line. The active buffer has a normal status- line. The other buffer show only filename and file-change- status. If more than one buffer is used, each statusline starts with the number of the buffer. Prompts and warnings still appear at the bottom of the screen. Various prompts have a history implemented, which can be used with the previous-line and next-line commands. These histories can take up to 128 lines, but Origami can reduce the size of this histories to 8, if the memory is needed. There are different histories for commands concerning: shell, search, replace, files and miscellanous things. Inside prompts only a subset of Origami edit functions is allowed: backward-character beginning-of-line forward-character end-of-line delete-previous-character undo-delete-character filename-completion newline-and-indent|end the input, current text is used any text characters previous-line next-line test-begin-line test-end-line test-char-set test-char-less test-char-greater test-char test-str store-character case-character-toggle _1._3. _T_h_e _S_p_e_c_i_a_l _E_d_i_t_o_r _B_u_f_f_e_r_s There are three special buffers in Origami. The `move buffer' contains one text line, the `kill buffer' in which Origami 1.6.92 - 6 - October 1993 User Guide - 7 - Using Origami several lines can be collected before inserting them back into the file, and the `delete buffer', which holds the last 64 deleted lines (in each case a line can be a closed fold, with all its contents). The behaviour of these buffers in Origami is slightly different from TDS (INMOS Transputer Development System) - move, delete and kill buffers are lost on exit from Origami. These buffers are neither displayed, nor do they have status lines. N.B.: the kill-buffer was named pick-buffer in TDS/Multitool and old versions of Origami. _1._4. _P_r_o_c_e_s_s_i_n_g _O_r_i_g_a_m_i _F_i_l_e_s If a saved file is to pass through a particular compiler, the fold structure must be hidden from the compiler by writ- ing it as comments. Origami hides the fold-markers by adding up to 64 characters to the start and end of the fold-marker. As comments differ from one language to another, it is necessary to choose the language before sav- ing a new file for the first time. When reading a file back into Origami the language type is retained. As a conse- quence you should take care not to include compiler comments within the fold header, as this will lead to nested comments which are not allowed in some languages. The general technique for hiding a fold is: {{{ this is a fold ...F this is a filed fold for file xyz.a }}} appears as /*{{{ this is a fold*/ /*{{{F this is a filed fold for file xyz.a*/ /*:::F xyz.a*/ /*}}} */ /*}}} */ in the text file (language "C"). Origami marks the used comment language with a special line. This line will appear in front of the first fold or at end of file (unless language None is active): /*{{{}}}*/ if language "C" is active. Origami knows the following languages, to hide fold-markers: Origami 1.6.92 - 7 - October 1993 User Guide - 8 - Using Origami Language foldline comments: start end None Occam -- Pascal (* *) C /* */ Lisp ; Roff .\" TeX % Script # User any sequences, up to 64 characters Inmos a binary format, see below _1._5. _I_n_m_o_s _F_i_l_e_s The binary Inmos files can be edited without losing informa- tion. There are some restrictions on editing Inmos files: Lines are limited in length to 152. Filed folds: Origami cannot open filed folds, only entering is pos- sible. 9 Origami does not automatically remove files belonging to deleted filed folds and does not generate unique filenames on filing folds. EXE, LIB, .. : Origami is not able to create special fold-types au- tomatically, but can handle existing ones properly. You can use a OCL-command to set fold-type and fold- contents within a function or macro to integer values. Inmos and ASCII-files: Since version 1.6.31, the ASCII-format (using fold- languages NONE, C, .. ) for Inmos files has changed. The differences concern only the additional fold attri- butes (like EXE, SC, .. ). The new format should be able to save Inmos files with another language without loss of information, but we cannot guarantee this feature! Check this in your environment, before using it widely. 9 Changing the language from Inmos to another one and writing the file only changes the current file. In- cluded filed-folds will not be changed by this! Inmos and trailing spaces or tabs If language Inmos is used, all trailing spaces or tabs are removed while reading/writing files. Origami 1.6.92 - 8 - October 1993 User Guide - 9 - All Origami functions _2. _A_l_l _O_r_i_g_a_m_i _f_u_n_c_t_i_o_n_s This chapter lists all Origami functions with their keybind names. If you want to create a new keybinding, examine the files ???.keys in the bindings directory of your Origami distribution. _2._1. _M_o_v_i_n_g _a_r_o_u_n_d backward-character forward-character previous-line next-line beginning-of-line end-of-line previous-page next-page beginning-of-fold Moves to the beginning of the entered fold. end-of-fold Moves to the end of the entered fold. goto-line Prompts for a line number and moves the cursor to this line. If needed, Origami opens closed folds to reach this line. 9 Warning: the line count begins at beginning of file. Versions older than 1.6.17 used the top of entered fold as the starting point for counting! _2._2. _F_o_l_d_i_n_g open-fold Open fold and show the contents in the context of the current level. 9 Warning: unlike TDS, you can not open file folds, only entering them is allowed. close-fold If the cursor is located within an opened fold, close this fold. Origami 1.6.92 - 9 - October 1993 User Guide - 10 - All Origami functions enter-fold Enter the fold at the current line. That means, show only the contents of this fold such that this fold starts at indentation 0 - the First characters on each line are left at the extreme left of the logical win- dow. If the line is a normal fold the x position of the cursor is preserved. This may mean that a long line upon which the cursor has been placed is scrolled out to the left. 9 Entering a filed fold saves the current file and switches to the new one. The cursor is moved to the top left hand corner of the Logical window. The old file and the line are stored internally. 9 enter-fold adds the file to the list of edited files, if the file is not in this list. 9 Unlike TDS, using this function on normal text lines is allowed. Origami uses the string between the cursor position and the next single quote, double quote, whi- tespace or tab as filename. If Origami cannot open the file, it will prompt for a filename (empty filename uses current file!). The file will be entered as if there was a filed fold for it. 9 Warning: since version 1.6.85, Origami tries to open '_d_i_r_n_a_m_e(_c_u_r_r_e_n_t-_f_i_l_e)/_f_i_l_e_n_a_m_e', if the given filed- fold file cannot be found using the current working directory. exit-fold Exit fold. Show the entered fold as closed fold and the surrounding text again. 9 Exiting a filed fold saves the file, if required. 9 Using this function, without having entered a fold, will edit a list of all command line files and edited files shown as folds. The cursor is moved to the line, containing the entry for the current file. unfold-fold Remove fold at the current line - deletes the fold structure and inserts the contents of the fold instead. Origami 1.6.92 - 10 - October 1993 User Guide - 11 - All Origami functions create-fold Create fold. Use twice - first to indicate the top of a new fold, then to indicate its bottom. Lines to be included within the fold must not be indented less than the fold itself. Tabs are not allowed at the beginning of the folded lines if they appear before the intended indentation of the fold. Several other keys are dis- abled while create-fold is active. The part of the text, which would be highlighted, is displayed inverse. 9 The OCL variable modify-behaviour can be used to modify the semantics of create-fold: 9 modify-behaviour=0 Normal folding, as described above. 9 modify-behaviour=1 Do not fold, but highlight the text, as if fold- ing. Keys, not allowed during folding, are also disabled here. 9 modify-behaviour=2 Do not fold, but highlight all text between cal- ling position for create-fold and cursor position. Keys, not allowed during folding, are also dis- abled here. 9 modify-behaviour=3 Do not fold, but highlight a rectangle text block between calling position for create-fold and cur- sor position. Keys, not allowed during folding, are also disabled here. 9 modify-behaviour=4 Do not fold, set highlighting mode but do not highlight anything. Keys, not allowed during folding, are also disabled here. 9 modify-behaviour=5 Like default create-fold (modify-behaviour=0), but do not highlight anything. 9 modify-behaviour=-_x, 1<=_x<=4 Like modify-behaviour=_x, but the command restric- tions are weaker. The additional allowed commands are slowed down by the screen handling routines. 9 other values The behaviour is undefined. 9 N.B.: the value of modify-behaviour for the second create-fold call is ignored! auto-header When the cursor is on a opened/closed fold this key will copy the first line enclosed by that fold to the fold line. Origami 1.6.92 - 11 - October 1993 User Guide - 12 - All Origami functions toggle-file-fold File (create a new file) or unfile a fold. Creating a file writes the contents of the fold into a new file named by the fold comment (up to the first whitespace or tab). Unlike TDS, Origami does not create a new filename if the chosen one is already used. It does not matter if you change the fold comment after filing a fold, because the filename is stored internally. Un- filing a filed fold replaces the file link with the contents of the file itself. 9 Unlike TDS Origami does not remove the original file included this way. toggle-attach-file-to-fold Attach a file to a fold. This function links an exist- ing file rather than creating a new one (and thus differs from toggle-create-file-fold). The filename is taken from the comment of the empty fold the cursor is placed on. The filename starts behind the foldmark and ends at the first whitespace or tab. The rest of the line is ignored. After attaching files you can change the fold header because the file information is stored internally. 9 If the cursor is on a filed fold line, the file will be detached from the fold. 9 Warning: detaching a file may loose the information about the filename. Fold comment and filename may differ! Type and contents of the fold will be reset to the default values! 9 Warning: since version 1.6.85, Origami tries to attach '_d_i_r_n_a_m_e(_c_u_r_r_e_n_t-_f_i_l_e)/_f_i_l_e_n_a_m_e', if the given file cannot be found using the current working directory. In this case, the filename will also be changed in the fold comment! _2._3. _E_d_i_t_i_n_g delete-line Deletes the current line, pushing it onto the delete buffer. The delete buffer is a stack with depth 64 lines. undo-delete-line Pop a line from the delete buffer and paste it into the current file above the current line. The delete buffer is a stack with depth 64 lines. delete-previous-character Deletes the character to the left of the cursor. If the cursor was at the left margin, this line will be appended to the previous line. Origami 1.6.92 - 12 - October 1993 User Guide - 13 - All Origami functions undo-delete-character Undeletes the last deleted character. This stored character is only changed by the delete-previous- character command. case-character-toggle Changes the case of the character under the cursor. newline-and-indent Opens the line at cursor position and indents the right part like the left part. kill-line Removes a line from the file and adds it to the end of the kill buffer. Note that the `kill buffer' is lost when exiting Origami, unlike TDS. copy-to-kill-buffer Copies a line to the end of the kill buffer without deleting it from the file. Note that the kill buffer is lost when exiting Origami, unlike TDS. Lines con- taining filed folds cannot be copied to the kill buffer, while language Inmos is active. insert-folded-kill-buffer Places the kill buffer before the current line as a fold with no comment. move-line If the move buffer is empty, the current line is moved to the move buffer. Otherwise the move buffer is in- serted before the current line. Note that the move buffer is lost when exiting Origami, unlike TDS. double-line Duplicates the current line in the file. Lines con- taining filed folds cannot be duplicated, while language Inmos is active. Origami 1.6.92 - 13 - October 1993 User Guide - 14 - All Origami functions filter-line Pipes the current line through a filter. If the current line is a closed fold, the contents of this fold is filtered. If the current line is a normal text line, this text will be filtered. This command has no effect on any other sort of line, other than to report its failure with a message. The standard output of the filter will be inserted at the position of the line. The line itself will be deleted. The text read from the filter will be parsed for folds as expected. 99 If command line option -S_s_h_e_l_l is given, _s_h_e_l_l is used (the empty word for _s_h_e_l_l disables this command). Oth- erwise environment variable SHELL (default for SHELL, if empty or not defined is /bin/sh) is used to get the shell name. 9 The exit code of the called command is stored in the OCL-variable ocl-argument (-1, if no correct value can be given). Environment variables ORIGAMIFILE, ORIGAMI- LINE and ORIGAMIWORD are set to current filename, text- line and word. Word is the sequence of a..zA..Z_, where the cursor stands on. Environment variables ORI- GAMIX and ORIGAMIY are set to x position (characters 1,..) and y position (line 1,..) in file. Environment variable PPID is set to Origami's process id. 9 Warning: the line count begins at beginning of file. Versions older than 1.6.17 used the top of entered fold as the starting point for counting! _2._4. _S_e_a_r_c_h _a_n_d _r_e_p_l_a_c_e search-forward Prompts for a search string and moves the cursor to the next occurance. The pattern is searched in the currently entered fold. search-reverse Same as search-forward, but searches backward. replace-string Asks for a search and a replace string and replaces all occurances of the search string with the replace string. The replace will be done in the currently en- tered fold. query-replace-string Same as replace-string, but asks before replacing. Origami 1.6.92 - 14 - October 1993 User Guide - 15 - All Origami functions incremental-search-forward Searches the text for a string. String can be entered incrementally. delete-previous-character jumps to the position where the character was added to the search string. Adding a character tries to find the new string. Aborting this command jumps to the calling po- sition. newline-and-indent ends the search. backward-character, incremental-search-reverse and search-reverse switch the search direction to backwards and search the string. forward-character, incremental-search-forward and search-forward switch the search direction to forward and search the string. previous-line and next-line walk through the search history to get other patterns. The pattern is searched in the currently entered fold. 9 Using backward-character, incremental-search-reverse, search-reverse, next-line, forward-character, incremental-search-forward, search-forward or delete- previous-character as first input inside the incremen- tal search initializes the search pattern with the last used pattern. incremental-search-forward uses goto- line to reach the search position if it is not already on the screen. 9 N.B.: while basic or extended regular expression search is active and the given string is not a valid expres- sion, the cursor will not moved, until the string is a valid regular expression! Origami uses the same posi- tion stack mechanism as without regular expression search. incremental-search-reverse Same as incremental-search-forward, but starts with search direction backwards. Warning: Searching reverse is slower then searching forward! Multiple calls of the pattern matching algorithm are necces- sary, to find a match in front of the cursor position! _2._5. _F_i_l_e_s read-file Reads another file for editing, saving the current one if required. If no filename is given, the current file is reread. 9 read-file adds the file to the list of edited files, if the file is not in this list. 9 Origami 1.6.92 - 15 - October 1993 User Guide - 16 - All Origami functions open-buffer Split the current window and prompt for the file, to be edited in the new buffer. The new buffer will be opened below the old buffer. 9 If OCL variable modify-behaviour is not 0, the new buffer will be opened: 9 modify-behaviour=1 open above the current buffer 9 modify-behaviour=-1 open above the current buffer do not ask for a file but open /dev/null 9 modify-behaviour=-2 do not ask for a file but open /dev/null 9 open-buffer adds the file to the list of edited files, if the file is not in this list. open-adjacent-buffer Split the current window into two adjacent windows and prompt for the file, to be edited in the new buffer. The new buffer will be opened to the right of the old buffer. 9 If OCL variable modify-behaviour is not 0, the new buffer will be opened to the left of the old buffer. 9 open-adjacent-buffer adds the file to the list of edit- ed files, if the file is not in this list. read-list-file Reads another file from list of edited files for edit- ing, saving the current one if required. If the given number to low (high), read-list-file uses the last (first) file in the list. read-list-file tries to reach the same line, you were the last time, you edited this file. 9 If OCL variable multi-edit is set to not null, read- list-file will not ask for the number and use the value -( multi-edit 1). open-list-buffer Split the current window and prompt for the file number to be edited in the new buffer, which will be opened below the current buffer. 9 If OCL variable modify-behaviour is not 0, the new buffer will be opened above the old buffer. 9 Origami 1.6.92 - 16 - October 1993 User Guide - 17 - All Origami functions open-list-adjacent-buffer Split the current window into two adjacent windows and prompt for the file number to be edited in the new buffer. 9 If OCL variable modify-behaviour is not 0, the new buffer will be opened to the left of the old buffer. enter-list-file Like enter-fold, but prompts for a number and enters the given file from list of edited files. save-file Saves the current file with the current name and language. This command will only succeed if you have not entered a fold. 9 N.B.: if Origami is in view mode, the file will not be saved, even if it was changed. write-file Prompts for a filename and listing-mode. If no filename is given, the current filename will be used. Origami writes the text to a new file using the current language. If listing-mode is set, the generated file will be modified in the following way: no heading _c_o_m_m_e_n_t {{{}}} _c_o_m_m_e_n_t line no {{{ in fold headers no _c_o_m_m_e_n_t }}} _c_o_m_m_e_n_t lines If listing-mode is set, the fold structure in the writ- ten file is lost. While using the language Inmos it is impossible to set listing-mode, because the the gen- erated files have an incompatible structure. change-buffername Prompts for a new name for the current file. It will not ask for permission, if the current file has been changed. The file-change mode will not be changed. The stack of entered file folds is only changed for the current file. insert-file Insert File. Prompts for a filename and imports this file into the edited file at the current position. If no filename is given, the current filename is used. Origami 1.6.92 - 17 - October 1993 User Guide - 18 - All Origami functions filter-buffer Filters the current text. Origami prompts for the name of a filter. Origami tries to move the cursor back to the line on which the cursor was placed before execut- ing this command. Entered folds will be left before filtering! 9 filter-buffer uses the same environment, shell and exit handling as filter-line. pipe-from-command Prompts for a command. The command is executed and its standard output inserted in the text at current posi- tion. 9 pipe-from-command uses the same environment, shell and exit handling as filter-line. pipe-to-command Prompts for a command. The current file will be piped to this command as standard input. 9 pipe-to-command uses the same environment, shell and exit handling as filter-line. _2._6. _M_a_c_r_o_s define-macro Records all keys in the keyboard macro buffer until define-macro is pressed again. Calling user defined functions is also allowed during define-macro. define-macro cannot be executed while Origami prompts for information for another function (like read-file). Origami can store up to 512 keys. execute-macro Call keyboard macro. save-keyboard-macro Asks for the number of a fix macro buffer. The con- tents of the keyboard macro buffer is copied to this fix macro buffer. Using (deffun .. ) in keybind makes it impossible to overwrite the fix buffer. Using (defusermacros _x) in your OCL source places _x free mac- ro buffers at places 1.._x. execute-number-macro _n, (_n=1,2,..) Execute fix-macro number _n. This command should be used to call macros defined by save-keyboard-macro. All other macro buffers are used by (deffun _f_o_o (...) ) and (keybind _f_o_o (...) ) in keybind, so that using these operations has the same effect as calling the function/macro keysequence by their name! 9 Origami 1.6.92 - 18 - October 1993 User Guide - 19 - All Origami functions _2._7. _S_h_e_l_l _c_o_m_m_a_n_d_s shell Creates a shell according. Exiting from this shell will return to Origami. 9 shell uses the same environment, shell and exit han- dling as filter-line. shell-command Prompts for a command and starts a shell which executes it. 9 shell-command uses the same environment, shell and exit handling as filter-line. suspend-origami If your system has job control, Origami will be suspended and the calling shell is reactivated. 9 N.B.: suspend-origami is disabled, if command line op- tion -Z is used or the stop signal is disabled by stty. _2._8. _A_r_g_u_m_e_n_t_s Like in Emacs, you can repeat each command by using an numerical argument. The first digit is given by set- argument-_d_i_g_i_t. These functions read more digits of the argument until you type a non digit. This non digit may be a key sequence bound to a command or just a single charac- ter. It will be repeated argument times. Pressing the abort key will abort the repeated execution. set-argument _x stops the definition or execution of a keyboard macro! set-argument-0 ... set-argument-9 If the argument is set to 0, the command will be executed once. _2._9. _S_p_e_c_i_a_l _f_u_n_c_t_i_o_n_s filename-completion If the cursor stands on a whitespace or tab, Origami tries to complete the word left from the cursor as filename. If the given word starts with a ~ and does not contain any path-separator, Origami tries to com- plete the user name. The OCL variable ocl-argument is set to the number of added characters. If the extended filename belongs to a directory, a / will also be ap- pended. quote-character The next character typed in will be inserted in your text, even if it is bound to a command. 9 Origami 1.6.92 - 19 - October 1993 User Guide - 20 - All Origami functions redraw-display Refresh the screen (after using screen-off). center-and-redraw-display Refresh and center screen. Like redraw-display, but also resets the window size. If you are working with a window environment which does not send a window changed signal, you may use this command after resizing a win- dow. 9 If OCL variable modify-behaviour is set to 0, the whole screen will be drawn (useful if the screen was messed up by messages...), otherwise only the changes will be written. grow-buffer Increase the height of the current buffer by 1. shrink-buffer Decrease the height of the current buffer by 1. If open-buffer or If there are no (visible or invisible) height divisions the height of the used part of the screen will be reduced. This is only done, while the current buffer uses more than 5 lines. widen-buffer Increase the width of the current buffer by 1. narrow-buffer if Several buffers are present decrease the width of the buffer by 1. If there are no (visible or invisi- ble) width divisions, the width of the used part of the screen is reduced. This is only done, if the current buffer uses more than 16 columns. 9 Origami 1.6.92 - 20 - October 1993 User Guide - 21 - All Origami functions describe-bindings Displays the binding information stored in $HOME/.origamirc. All currently recognized keyboard inputs will be printed. There are some special keys, which can modify the display of the list: 9 ` ' (space) Move the screen one page up. 9 B or b Show the page before the current one. 9 newline-and-indent Move the screen one line up. 9 F or f prompts for a pattern and starts the list display again. Only lines matching the pattern are displayed. The empty pattern matches all lines. 9 S or s Prompts for a pattern and skips forward to the next line matching the pattern. 9 Q or q Stop the help display. 9 K or k Like Q, but the current help view is copied to the kill buffer. If a pattern for filtering is used, only lines, matching this pattern will be killed. 9 N.B.: lines match a pattern, if the contain the pattern literaly. help Displays the helpfile $HOME/.origamihelp. Since there is no default file for this function, you can create your own helpfile. It may be useful for new and very complicated functions/macros or other things you always forget. If there is no file $HOME/.origamihelp, Ori- gami tries to get the referencedata from rc file. 9 You can use the same control keys as in describe- bindings. 9 If OCL variable modify-behaviour is not set to 0, the corresponding special help entry, generated by @reference-begin-class will be shown. Negative values for modify-behaviour are not allowed and modify- behaviour will be set to 0 in these cases! Origami 1.6.92 - 21 - October 1993 User Guide - 22 - All Origami functions set-language Allows you to select the language for which the code is to be saved - ie the format in which folds are to be saved. This can be done by entering the first charac- ter of the language or by using forward-character, backward-character to move the menu cursor, which starts on the currently used language (ie is displayed inverse.) If you choose User, Origami prompts for the begin comment and end comment strings used for hiding the fold comments. Each string can be up to 64 charac- ters in length. 9 N.B.: if the current language is Inmos, Origami prompts for permission, to prevent destruction of internal In- mos information. describe-fold Displays information on current cursor position in file and the character under the cursor as character and as octal,decimal and hex number. After this, the number of entered folds in current file, indentation of currently entered fold and perhaps information about the closed foldline under the cursor is displayed. The fold information is a pair of numbers. The first number describes the fold type and the second the fold contents (range 0..255). These codings have specific meanings in TDS. The OCL-variable ocl-argument is set to: 256*type+contents if type<128 -(256*(type mod 128)+contents) otherwise 9 Warning: the line count begins at beginning of file. Versions older than 1.6.17 used the top of entered fold as the starting point for counting! set-file-unchanged Marks the file as unchanged. add-mode-position Display current position in front of the filename. delete-mode-position Switch off the display of the current position. add-mode-full-shift Activates full-shift mode. Moving over the right border of a buffer scrolls the whole buffer, not only the current line! Origami 1.6.92 - 22 - October 1993 User Guide - 23 - All Origami functions delete-mode-full-shift Switches full-shift mode off and set OCL variable ocl- argument to 1, if mode full-shift was active, otherwise 0. add-mode-view Sets view only mode. Changing the file is not possi- ble. delete-mode-view Sets edit mode. add-mode-overwrite Sets overwrite mode. Text input will overwrite other text. delete-mode-overwrite Sets insert mode. Text input will be inserted. add-mode-hash-shift Activates hash-shift-mode (like command line option -p). On reading files, leading hashes are moved to fold indentation level and on writing files, they will be moved to column 1. Useful for editing C sources. 9 N.B.: this mode is automatically switched on, if the parsed file contains a leading # in front of the fold indentation level! delete-mode-hash-shift Switches hash-shift mode off. add-mode-basic-regular-expression The search patterns in search-forward, search-reverse, incremental-search-forward, incremental-search-reverse, replace-string and query-replace-string are read as basic regular expressions (like vi). OCL variable ocl-argument is set to 1. add-mode-extended-regular-expression The search patterns in search-forward, search-reverse, incremental-search-forward, incremental-search-reverse, replace-string and query-replace-string are read as ex- tended regular expressions (like egrep). OCL variable ocl-argument is set to 2. 9 Origami 1.6.92 - 23 - October 1993 User Guide - 24 - All Origami functions delete-mode-regular-expression The search patterns in search-forward, search-reverse, incremental-search-forward, incremental-search-reverse, replace-string and query-replace-string are used literaly. OCL variable ocl-argument is set to: Value Active regular expressions 0 none 1 basic 2 extended add-mode-echo Incomplete keysequences are displayed under the status line. delete-mode-echo Do not show unfinished keysequences. add-mode-time Display the time right from the filename. 9 N.B.: while Origami is waiting for a keyboard input, the display will not be updated! delete-mode-time Do not display the time right from the filename. OCL variable ocl-argument is set to 1(0), if time display was switched on(off). add-mode-verbose Switch verbose-mode on. Some commands print error mes- sages. delete-mode-verbose Switch verbose-mode on. Only important messages appear below the status line. This is the default. 9 Origami 1.6.92 - 24 - October 1993 User Guide - 25 - All Origami functions add-mode-autosave Prompts for the auto save interval in minutes. Origami will save your files periodically in auto save mode, unless autosave-macro is used. In this case the given macro will be executed instead. Default time is 8 minutes. Minimum is 1 minutes and maximum is 60 minutes. 9 If OCL variable modify-behaviour is set to a value _x>0, add-mode-autosave will not prompt for a delay, but use _x seconds. Very small values for _x may be dangerous! 9 While Origami is waiting for a keyboard input, the save will be delayed! 9 N.B.: You have checked in the previous version properly into RCS haven't you? delete-mode-autosave auto save is switched off. The OCL-variable ocl- argument is set to the auto save interval in seconds, or 0, if auto save is already switched off. add-mode-no-parse Origami does not parse for folds, whilst reading files (similar to the command line option -n). The OCL- variable ocl-argument is set to 1, if parsing was ac- tiv, otherwise 0. delete-mode-no-parse Origami parses folds during every command where a file is read. The OCL-variable ocl-argument is set to 1, if parsing was activ, otherwise 0. status-line-off Displaying the status line is disabled. status-line-on Displaying the status line is enabled. 9 Origami 1.6.92 - 25 - October 1993 User Guide - 26 - Programming in OCL set-display-mode Show a menu for selecting the text display mode. You can choose: 9 Quit Leave the menu loop. 9 Octal Use the octal format (`\_x_x_x') for characters, displayed as numbers. 9 Decimal Use the decimal format (`\d_x_x_x') for characters, displayed as numbers. 9 Hex Use the hexadecimal format (`\_x_x') for characters, displayed as numbers. 9 Mark Display control characters with ^ followed by one of the coding characters @ABCDEFGHIJKLM- NOPQRSTUVWXYZ[\]^_. 9 Invers Display control characters as invers coding char- acter. 9 Number Display control characters as numbers (octal,decimal or hexadecimal). 9 Tab(_n) Prompts for the width of a tab. _n is the active size. Negative values and 0 will handle the tab as a normal control character. 9 Plain Display normal characters by temselves. 9 8-Bit Display characters with set highbit as numbers (octal,decimal or hexadecimal). 9 Full Display all characters as numbers (octal,decimal or hexadecimal). 9 N.B.: the numbered display for normal characters is only used for the text display window. The display area and the status line are not con- cerned! If OCL variable modify-behaviour is not null, the menu loop will be ended after the first chosen item. 9 ocl-argument is set to a coding of the current display mode: 9 Origami 1.6.92 - 26 - October 1993 User Guide - 27 - Programming in OCL 64*_t_a_b-_w_i_d_t_h+_b_i_t-_c_o_d_e with 9 _b_i_t-_c_o_d_e 0 inverse control characters 1 marked control characters 2 numbered 8-bit characters 3 all characters numbered 4 octal display 5 decmal display 9 no-operation No operation. This command can be used to expli- citly disable keyboard inputs. 9 bell Activates the bell of your terminal. 9 visible-bell Activates the `visible bell' of your terminal. 9 abort Aborts any operation. There are several commands which can be aborted by this key. This operation can only be bound to a single key. This key will even stop a running function/macro, which may be useful to interrupt an endless loop. If you are anxious Origami might be doing something wrong, this key returns you to a safe state. Writing files can also be interrupted. abort can abort the reading of files for the following commands: Command: condition: enter-fold a filed fold exit-fold a filed fold file-fold unfiling a filed fold insert-file filter-buffer pipe-from-command reading startup file edit-file and stdin-pipe In this case, Origami simulates eof for ASCII- reading and end-of-fold for all open folds for TDS-reading. 9 change-fold-mark Prompts for the fold marks and replaces them by the new one. Works like -M. _2._1_0. _H_o_w _t_o _g_e_t _o_u_t 9 save-and-exit-buffer Exits entered folds as needed. Saves the file if changed. If the buffer was the last buffer this command exits from Origami. 9 Origami 1.6.92 - 27 - October 1993 User Guide - 28 - Programming in OCL N.B.: if Origami is in view mode, the file will not be saved. 9 exit-buffer If there are unsaved changes to the file in the current buffer, Origami prompts for permission to close and quit the buffer anyway. _3. _P_r_o_g_r_a_m_m_i_n_g _i_n _O_C_L 9 This chapter describes OCL (Origami control language) and gives some examples to show how powerful it is. OCL is a programming language offering capabilities to use conditional statements, subroutines, loops, vari- ables and recursion. It looks like LISP, but it is closer to an assembly language. The keybind program compiles human readable OCL source code into a token- ized binary form which will be interpreted by Origami. Every binding of functions to keysequences must be done in this binary file. The functions described in the chapter explaining keybindings are very simple OCL statements. _3._1. _R_e_s_o_u_r_c_e _f_i_l_e_s 9 Origami needs some startup resource files to work. They are named .origami_e_n_d_i_n_g. 9 Used endings are: 9 msg This file contains the text strings displayed by Origami during an editing session. This file can be changed by editing it. 9 Warning: The length of the lines must not be changed! 9 rc This file contains the binding of functions to keys, the functions, the macros and all other stuff, explained below. Use keybind to create new rc-files. 9 help This file will be displayed, when calling the function help. Any text file is allowed. 9 The part origami in the filename can be changed by set- ting the command line option -k_n_a_m_e or using links to the binary. The .origamimsg-file must not be renamed, because Origami looks for this file, if it cannot find the msg-file with the new name. 9 You can set the environment variable ORIGAMIPATH (or origamipath) to a : or ^A separated list of directories (Default is .:~:/home/hadig/origami). Uppercase vari- ables with : as delimiter are usually used in sh and csh, whereas rc is able to use real lists in variables Origami 1.6.92 - 28 - October 1993 User Guide - 29 - Programming in OCL (usually written in lowercase letters), which are stored with ^A as delimiter. Origami looks for the resource files in all these directories. If command- line option -k _n_a_m_e is used, and _n_a_m_e is an absolute path, starting from the root directory, origami ignores the resource path to look for the bindings file. _3._2. _O_C_L _s_y_n_t_a_x _a_n_d _s_e_m_a_n_t_i_c_s 9 This section describes all OCL elements. It is assumed you are familiar with other programming languages. You will find OCL examples in a later section. 9 Newlines and comments can be used anywhere in the text between syntactical structures. A comment starts with ; and ends at end of line. 9 Though different machines have different wordlength, we use a 16 bit coding for internal OCL integers. There- fore the only machine dependencies is the character coding (ASCII, ..). 9 Internal integers (addresses in macro code and con- stants in expressions) are limited to -32768..32767. _3._2._1. _F_i_l_e_d _f_o_l_d_s _a_n_d _l_i_b_r_a_r_i_e_s 9 Using language None, keybind will automatically include the contents of filed folds when reading the source file. Entering filed fold is limited in depth to 8. Normally multiple includes of the same file will not work, because redefinition of functions/macros is not allowed. To build a clean library, you can use the conditional compilation explained below. 9 Files can be included without filed folds using: 9 @include _f_i_l_e_n_a_m_e 9 Another way to include library files is: 9 @lib _f_i_l_e_n_a_m_e Keybind looks for the file _f_i_l_e_n_a_m_e in several directories, given in the keybind library path. This path can be set by environment variables KBDLIBPATH or kbdlibpath (Default is .:/home/hadig/origami/bindings/fun:/home/hadig/origami/bindings). Like for resource files, this path is a ':' or '^A' separated list of directories. The first directory, containing _f_i_l_e_n_a_m_e, is used. If _f_i_l_e_n_a_m_e is an absolute path, keybind ignores the library path. _3._2._2. _N_a_m_e _a_n_d _c_o_m_m_a_n_d _l_i_n_e _o_p_t_i_o_n_s 9 (defbinding _n_a_m_e-_o_f-_b_i_n_d_i_n_g [ ( _s_t_r_i_n_g _s_t_r_i_n_g ) ... ] ) Defines a name for the binding which is displayed in the status line of Origami. If none is given, Origami will be displayed. Multiple usage of this Origami 1.6.92 - 29 - October 1993 User Guide - 30 - Programming in OCL command is not allowed. The name is limited to 16 characters. 9 The optional list of string pairs can be used to define command line option aliases. If '( "_a_l_i_a_s "_v_a_l_u_e )' is defined, '-O_a_l_i_a_s' will be replaced by '-O_v_a_l_u_e' at startup. Alias name can use up to 16 characters. The aliased string may not contain other aliases! _n_a_m_e-_o_f-_b_i_n_d_i_n_g and the alias names will appear in the -h output for -O, if the correct rc file is read. 9 N.B.: option aliases are stored in a fixed size field. There is place for 128, using a 16 charac- ter name and a 16 character value. Shorter or longer values are allowed, but the total maximum size cannot be changed! _3._2._3. _B_i_n_d_i_n_g _c_o_m_m_a_n_d_s _t_o _k_e_y_s 99 (keybind _o_p_e_r_a_t_i_o_n _k_e_y_s_e_q_u_e_n_c_e) The Origami operation named _o_p_e_r_a_t_i_o_n is bound to the keyboard input _k_e_y_s_e_q_u_e_n_c_e. The binding help will contain the entry: operation keysequence 9 (keybind "_s_i_n_g_l_e-_c_h_a_r _k_e_y_s_e_q_u_e_n_c_e) The normal character _s_i_n_g_l_e-_c_h_a_r is bound to the keyboard input _k_e_y_s_e_q_u_e_n_c_e. The binding help will contain the entry: single-char keysequence. For example, this form of keybind can be used to map some keys of a keypad to normal characters like + or * while using others as cursor keys. 9 (keybind - _k_e_y_s_e_q_u_e_n_c_e) _k_e_y_s_e_q_u_e_n_c_e triggers the key-not-bound-handling. Complain about the unknown sequence, and if key- not-bound-macro was used, start the corresponding action. This bindings will not be stored in the bindings list. 9 (alias _n_a_m_e _k_e_y_s_e_q_u_e_n_c_e) The keyboard input _k_e_y_s_e_q_u_e_n_c_e can be addressed as $_n_a_m_e in the following definitions. Using $_n_a_m_e places the symbolic reference name in the binding help rather than the key sequence itself. 9 Multiple alias definitions for a single key _n_a_m_e are allowed. In this case, every use of $_n_a_m_e will generate as many sequences, as alias are de- fined. 9 The following alias can be used without declara- 9Origami 1.6.92 - 30 - October 1993 User Guide - 31 - Programming in OCL tion: $esc = escape key = 27 Use autoalias to create your alias declarations. 9 _n_a_m_e _n_a_m_e is a normal identifier not beginning with @. The length is limited to 128. 9 _k_e_y_s_e_q_u_e_n_c_e _k_e_y_s_e_q_u_e_n_c_e is a sequence of _k_e_y enclosed in parentheses. _k_e_y_s_e_q_u_e_n_c_es are limited in length to 64. _k_e_y specifies a single key (or two keys, because M-"a requires two keystrokes). Valid de- clarations for _k_e_y are: 9 "_x the single character _x. ' ' will be named space in the bindinglist. 9 C-_X codes the non printable characters. @A..Z[\]^_ codes the characters 0..31. ? codes 127=delete-key. 9 M-"_x Meta-key (ESC) followed by _x (case sensitive) 9 M-C-_X META-control-_x, that means Meta-key (ESC) followed by non-printable character control- _x. 9 $_n_a_m_e the key sequence defined by ( alias _n_a_m_e ... ). The bindinglist contains _n_a_m_e. 9 0x_h_e_x_d_i_g_i_t_s represents the given number 9 * Matches all characters, not explicitly bound in another statement. 9 The command `unbind-remaining-keys' has been deleted, but you can use `*' in the sequence and `-' as function can be used to replace it: ; old syntax ( unbind-remaining-keys ( mode-name ) ) ; new syntax ( mode mode-name ( keybind - ( * ) ) ) The wildcards (`*') in the keysequences are evaluated, after all bindings are done. The following example shows the evaluation of *: Origami 1.6.92 - 31 - October 1993 User Guide - 32 - Programming in OCL ( alias _f_1 ( $_e_s_c "[ "_2 "_4 "_0 ) ) ( alias _f_2 ( $_e_s_c "[ "_2 "_4 "_1 ) ) ( alias _f_u_n_c_t_i_o_n-_k_e_y-_f_o_r_m_a_t ( $_e_s_c "[ *1 *2 *3 "_z ) ) ; alias does not bind any key, so: ; *1-3 are not evaluated, only stored ( keybind _f_u_n-_1 ( $_f_1 ) ) ( keybind _f_u_n-_2-_1 ( $_f_2 "_1 ) ) ( keybind _f_u_n-_2-_2 ( $_f_2 "_2 ) ) ( keybind - ( *4 ) ) ; only sequences starting with $_e_s_c are used, so: ; *4 matches any character, but the escape character ( keybind - ( $_f_u_n_c_t_i_o_n-_k_e_y-_f_o_r_m_a_t *5 ) ) ; $_f_1 and $_f_2 are used for bindings, so: ; *1 matches all but `2' here ; *2 matches all but `4' here ; *3 matches all but `0' and `1' here ; *5 matches all but `1' and `2' here ( keybind - ( $_e_s_c $_f_u_n_c_t_i_o_n-_k_e_y-_f_o_r_m_a_t ) ) ; there are no bindings for $_e_s_c $_e_s_c, so: ; *1-3 match any character here 9 (overload-prefix ( _p_r_e_f_i_x ... )) Binding functions named _p_r_e_f_i_x???? to keyse- quences, uses ??? as name instead of _p_r_e_f_i_x??? in the binding help. _3._2._4. _O_t_h_e_r _m_a_r_k_s _f_o_r _f_o_l_d_s 9 (defmark _n_a_m_e ( _m_a_r_k_1 _m_a_r_k_2 _m_a_r_k_3 _m_a_r_k_4 )) This option places the definition of alternative fold marks in the rcfile, so that Origami can switch to these marks when invoked with command line option -m_n_a_m_e. _n_a_m_e will be cut, if the length is >_ 9. The format for _m_a_r_k? is: ( _s_i_n_g_l_e-_c_h_a_r _s_i_n_g_l_e-_c_h_a_r _s_i_n_g_l_e-_c_h_a_r ) where _s_i_n_g_l_e-_c_h_a_r is a "_x definition like in (key- bind ... ). The meanings of _m_a_r_k_1 ... _m_a_r_k_4 are: item: used for: default: _m_a_r_k_1 begin of fold {{{ _m_a_r_k_2 closed fold ... _m_a_r_k_3 name of filed fold ::: attributes of fold _m_a_r_k_4 end of fold }}} _3._2._5. _F_u_n_c_t_i_o_n_s _a_n_d _m_a_c_r_o_s Origami 1.6.92 - 32 - October 1993 User Guide - 33 - Programming in OCL (defmac _n_a_m_e (_s_t_a_t_e_m_e_n_t ... )) A macro _n_a_m_e will be defined. Recursive invoca- tions will be detected and handled inside the mac- ro code. The macrocall will be replaced by inline code. If the OCL-assembler code for this macro has a length 1, this macro can also be bound to keys. Longer macros can only be used inside other macro definitions. 9 (deffun [ ( _v_a_r_i_a_b_l_e-_n_a_m_e ... ) ] _n_a_m_e (_s_t_a_t_e_m_e_n_t ... )) The operations in (_s_t_a_t_e_m_e_n_t ... ) are written to the .origamirc file so that Origami can initialize a fix-macro-buffer with the function _n_a_m_e. Recur- sion is allowed. In the OCL text following this definition, you can use _n_a_m_e as function call or for key bindings. You cannot redefine the func- tion (unless you use undeclare). 9 The optional list of variable-names can be used to specify integer arguments, which will be set from the caller. Recursion is also supported (the values are saved on a stack). Inside _s_t_a_t_e_m_e_n_t, the names given in "( _v_a_r_i_a_b_l_e-_n_a_m_e ... )" overwrite variables, defined using "(defvar ... )". After the definition of _s_t_a_t_e_m_e_n_t, the vari- ables cannot be accessed anymore. 9 (defassembler _n_a_m_e (_a_s_s_e_m_b_l_e_r-_s_t_a_t_e_m_e_n_t ... )) Like deffun, but the code is given as a list of assembler statements. An argument list cannot be given here. If you need the assembler function to be called with arguments, use '(forward _a_r_g_u_m_e_n_t- _l_i_s_t _n_a_m_e )' in front of the defassembler state- ment. OCL assembler syntax is explained in the appendix. 9 (initfun _n_a_m_e (_s_t_a_t_e_m_e_n_t ... )) Like defmac. In addition to this, the code is written to the rc-file to enable the use of _n_a_m_e in (keybind ... ) statements. 9 Warning: using save-keyboard-macro x has no effect on functions defined with initfun, when calling them by their name inside a function/macro. If you want to use such an effect you must use execute-number-macro x in the calling function/macro. 9 (undeclare ( _n_a_m_e ... )) Remove functions, macros and variables (explained below) from the symbol table. The objects still exist, but the textually following OCL-source can- not access them. It can be used, to hide local variables/macros. The names can be used again for other purposes without affecting the earlier usage. Forwarded functions have to be declared, Origami 1.6.92 - 33 - October 1993 User Guide - 34 - Programming in OCL before undeclaring them. 9 You can also undeclare the standard Origami func- tions (like enter-fold). This can be used to re- place the default functions by your own: ( defmac enter-fold-orig ( enter-fold ) ) ( undeclare ( enter-fold ) ) ( deffun enter-fold ... your code, using enter-fold-orig ) ( undeclare ( enter-fold-orig ) ) 9 Warning: using undeclare is the only way for rede- fining things in OCL, but this redefiniton has no effect on definitions, made before! 9 (defusermacros _n_u_m_b_e_r) This command must be used before any deffun/initfun statement. The fix-macro-buffers 1.._n_u_m_b_e_r are not used by OCL to store functions. They can be used for save-keyboard-macro. 9 N.B.: Using the commands deffun and initfun uses the fix-macro-buffers 1,2,.. (or _x,_x+1,.., if you have used (defusermacros _x)). 9 ( demand-load ( _o_c_l-_s_o_u_r_c_e ) ) All functions, defined in _o_c_l-_s_o_u_r_c_e using deffun or defassembler are marked as demand-loading. Origami doesn't read them at startup but at first usage. demand-load statements can be nested. The abort-macro or functions called by abort-macro may not be marked as demand-loading. 9 ( demand-load not( _o_c_l-_s_o_u_r_c_e ) ) All functions, defined in _o_c_l-_s_o_u_r_c_e using deffun or defassembler are not marked as demand-loading. Origami reads them at startup. Inside _o_c_l-_s_o_u_r_c_e, no other demand-load or demand-load not statements is allowed. 9 (start-list-editing) Origami starts editing the list of edited files, even if command line option -A is not active or number of files is 1. 9 (status-line-off) Origami starts without displaying the status line. The Origami commands status-line-on and status- line-off can be used during the editing to over- ride this default. 9 (forward [ ( _v_a_r_i_a_b_l_e-_n_a_m_e ... ) ] _n_a_m_e ) _n_a_m_e is declared as a name for a function defined with initfun or deffun. In the following state- ments, _n_a_m_e can be used as function call even be- fore its actual definition with (deffun _n_a_m_e ... 9Origami 1.6.92 - 34 - October 1993 User Guide - 35 - Programming in OCL ). 9 (change-buffer-macro _n_a_m_e) The function named _n_a_m_e is called every time, you switch to another buffer. 9 (read-newfile-macro _n_a_m_e) The function named _n_a_m_e is called every time a new file is edited, either explicitly or by entering or exiting a filed fold. 9 (abort-macro _n_a_m_e) The function named _n_a_m_e is executed each time the abort key is pressed. 9 (view-macro _n_a_m_e) The function named _n_a_m_e is executed at each at- tempt to change the file in view mode. ocl- argument is set to the ignored OCL command. 9 (begin-prompt-macro _n_a_m_e) The function named _n_a_m_e is executed each time prompt mode is entered (except the OCL commands prompt and prompt-counter). The repeat argument function reads its arguments in prompt mode. The function and all called functions/macros may only use the following OCL-elements (some of them are explained in the following chapters): controls: if-fi if-else-fi case-default-esac local while do-while commands: exit message-exit set modes from (defmodes ... ) history get-history set-file-unchanged booleans: not and or < <> > <= = >= test-echo test-file-changed last-message test-view test-autosave in-prompt test-folding test-language test-overwrite test-begin-fold test-fold-line test-end-fold test-filed test-text test-hash-shift terms: set-enter set-space-enter file-type numbers characters + - * 9Origami 1.6.92 - 35 - October 1993 User Guide - 36 - Programming in OCL modulo div 9 Warning: keybind does not check if you only use the allowed commands! Only the valid commands in called functions/macros will be executed. All other commands will be ignored, but do not rely on this feature! 9 (end-prompt-macro _n_a_m_e) The function named _n_a_m_e is executed each time prompt mode is finished (except the OCL commands prompt and prompt-counter). The command restric- tions for the function are the same as in begin- prompt-macro. 9 (key-not-bound-macro _n_a_m_e) The function named _n_a_m_e is executed each time an illegal keysequence was entered. The command res- trictions for the function are the same as in begin-prompt-macro. 9 (autosave-macro _n_a_m_e) If autosave-macro is given, the execution of this macro replaces the saving of all changed files. 9 (sigquit-macro _n_a_m_e) If set, Origami tries to execute _n_a_m_e, if Origami got the signal SIGQUIT. 9 (sigusr1-macro _n_a_m_e) If set, Origami tries to execute _n_a_m_e, if Origami got the signal SIGUSR1. 9 (sigusr2-macro _n_a_m_e) If set, Origami tries to execute _n_a_m_e, if Origami got the signal SIGUSR2. _3._2._6. _C_o_n_t_r_o_l _s_t_r_u_c_t_u_r_e_s 9 A _s_t_a_t_e_m_e_n_t can be one of the following control struc- tures or functions: 9 while _c_o_n_d_i_t_i_o_n (_s_t_a_t_e_m_e_n_t ... ) Prechecked loop, _s_t_a_t_e_m_e_n_t ... is repeated while the condition is true. 9 do (_s_t_a_t_e_m_e_n_t ... ) while _c_o_n_d_i_t_i_o_n Postchecked loop, _s_t_a_t_e_m_e_n_t ... is repeated until the condition is false. 9 if _c_o_n_d_i_t_i_o_n (_s_t_a_t_e_m_e_n_t ... ) [ else (_s_t_a_t_e_m_e_n_t ... ) ] fi Conditional statement. If condition is true, the first statement list is executed. If condition is false, the second statement list, if given, is ex- ecuted. 9 case (_c_o_n_d_i_t_i_o_n (_s_t_a_t_e_m_e_n_t ... )) ... [ default (_s_t_a_t_e- _m_e_n_t ... ) ] esac Origami 1.6.92 - 36 - October 1993 User Guide - 37 - Programming in OCL Conditional statement. The block of statements following the first conditional expression evaluating to TRUE is executed. If none of the conditions is true, the given default statements are executed. 9 repeat _t_e_r_m (_s_t_a_t_e_m_e_n_t ... ) (_s_t_a_t_e_m_e_n_t ... ) is repeated _t_e_r_m times. 9 Warning: old versions of keybind stored the called statements _t_e_r_m times. _t_e_r_m had to be a constant! This new version of keybind generates code, which uses an internal OCL-variable to count the loops. The number of repeats need not be a constant! The repeated statement list is not called via a sub- routine call, so return-from-macro will leave the current function/macro, not only the repeat! 9 prompt _m_e_s_s_a_g_e-_s_t_r_i_n_g Displays _m_e_s_s_a_g_e-_s_t_r_i_n_g below the status line and waits for newline-and-indent. If Origami is in define-macro-mode, the newline-and-indent will not be stored! _m_e_s_s_a_g_e-_s_t_r_i_n_g can be: 9 _s_t_r_i_n_g 9 (_m_e_s_s_a_g_e-_s_t_r_i_n_g-_i_t_e_m ... ) This list of _m_e_s_s_a_g_e-_s_t_r_i_n_g-_i_t_e_ms can contain more complicated entries. They are: 9 _s_t_r_i_n_g 9 counter _n_a_m_e This will be replaced by the ASCII- representation of the value of OCL- variable _n_a_m_e. 9 _n_u_m_b_e_r This will be replaced by the ASCII- representation of _n_u_m_b_e_r. 9 history _h_i_s_t_o_r_y-_n_a_m_e use the text of "get-history _h_i_s_t_o_r_y- _n_a_m_e 0". get-history is explained below. 9 _o_r_i_g_a_m_i-_m_e_s_s_a_g_e where _o_r_i_g_a_m_i-_m_e_s_s_a_g_e can be one of the message names declared in the Origami sources, file msg. Empty strings will be substituted for %s formatting argu- ments. Random values will be used to replace all other formatting arguments. 9 Warning: Origami cuts long _m_e_s_s_a_g_e-_s_t_r_i_n_gs after 1024 characters. 9 Origami displays _m_e_s_s_a_g_e-_s_t_r_i_n_g and waits until you type a newline-and-indent on your keyboard. The given input will not be interpreted. Thus, Origami 1.6.92 - 37 - October 1993 User Guide - 38 - Programming in OCL typing the keysequence of a function not execute it. 9 Warning: if prompt is called during define-macro is active, the given input will not be stored in the macro! This command does not activate the begin- / end-prompt-macro, because you can do it explicitly in the OCL-code. 9 message _m_e_s_s_a_g_e-_s_t_r_i_n_g Like prompt, but does not wait for input. 9 If OCL variable modify-behaviour is not 0, the message will only be printed, if command line op- tion -V is active. 9 exit All running functions are aborted. 9 message-exit _m_e_s_s_a_g_e-_s_t_r_i_n_g Same as exit. _m_e_s_s_a_g_e-_s_t_r_i_n_g is displayed under the status line. 9 return-from-macro The currently executed function/macro ends and the caller (keyboard, function or macro) resumes exe- cution. 9 local (_n_a_m_e ... ) (_s_t_a_t_e_m_e_n_t ... ) The values of the variables _n_a_m_e ... are saved during the execution of (_s_t_a_t_e_m_e_n_t ... ) and re- stored to their original values afterwards. 9 N.B.: (_s_t_a_t_e_m_e_n_t ... ) is executed as a subrou- tine, so that using return-from-macro inside will only leave this block and not the current function/macro. It is allowed to use a empty variable-list inside the local-statement. In this case, the statement can be used, to use return- from-macro as a kind of break! 9 show-cursor _t_e_r_m The text cursor is displayed and Origami sleeps for _t_e_r_m/10 seconds. _t_e_r_m is explained in the following chapter Variables. 9 _o_r_i_g_a_m_i-_c_o_m_m_a_n_d All Origami commands you can use from the keyboard can also be used by their names. abort stops the function/macro execution and calls the abort- macro, if it is defined. 9 _m_a_c_r_o-_n_a_m_e or _f_u_n_c_t_i_o_n-_n_a_m_e All macros defined with defmac and all functions defined with initfun can be used by their name. Functions defined with deffun or forward can be used, if they do not need any arguments. 9 _f_u_n_c_t_i_o_n-_n_a_m_e ( _t_e_r_m ...) All functions defined with deffun or forward can Origami 1.6.92 - 38 - October 1993 User Guide - 39 - Programming in OCL be used, if they need some arguments. The number of terms must fit the definition of _f_u_n_c_t_i_o_n-_n_a_m_e. _t_e_r_ms are explained below in chapter Variables. 9 _h_o_o_k_s If the corresponding hooks are already defined, you can use these names to call them (otherwise the statement has no effect): 9 change-buffer-macro 9 read-newfile-macro 9 abort-macro 9 view-macro 9 begin-prompt-macro 9 end-prompt-macro 9 key-not-bound-macro 9 autosave-macro 9 sigquit-macro 9 sigusr1-macro 9 sigusr2-macro 9 insert-ascii _o_r_i_g_a_m_i-_m_e_s_s_a_g_e Put the string for _o_r_i_g_a_m_i-_m_e_s_s_a_g_e in the text, where _o_r_i_g_a_m_i-_m_e_s_s_a_g_e can be one of the message names declared in the Origami sources, file msg. 9 _s_t_r_i_n_g_s Normal text can be used. The syntax is: 9 "_t_e_x_t _t_e_x_t can be a any string not containing , " or ). 9 " to use 9 ") to use ) 9 "" to use " 9 Warning: if you use Origami to edit an OCL file, " should not be the last statement of a line because Origami deletes all spaces at end of line. The problem can be circumvented by append- ing a comment to the line. _3._2._7. _V_a_r_i_a_b_l_e_s _T_y_p_e_s 9 OCL knows 3 types of variables: _3._2._7._1. _g_l_o_b_a_l _i_n_t_e_g_e_r _v_a_r_i_a_b_l_e_s 9 These variables have to be declared with: 9 (defvar (_v_a_r_i_a_b_l_e_n_a_m_e .. )) 9 The following global integer variables are always 9Origami 1.6.92 - 39 - October 1993 User Guide - 40 - Programming in OCL predefined, their values are set by Origami automati- cally: 9 screen-height, screen-width, cursor-level, screen- width-offset, screen-height-offset The three OCL variables screen-height, screen- width and cursor-level are set to size of the text editing area of the current buffer on the screen and the number of the line, the cursor is in (top of buffer buffer window = 1). The variables screen-width-offset and screen-height-offset con- tain the offsets of the current buffer window on the screen. 9 current-buffer-number, current-buffer-id, used-buffers, multi-edit The variable used-buffers shows the number of used buffers. current-buffer-number shows the number of the ac- tive (current) buffer. This number is not a fixed name, but represents the position of this buffer in the internal list of used buffers. It might change, if new buffers are opened or existing buffers are deleted! The OCL-variable current-buffer-id contains a number, representing the creation time of the buffer. During the editing session, this will not change for a buffer. multi-edit contains the number of buffers, which are used to edit the file in the current buffer. 9 ocl-argument The OCL variable ocl-argument can be set by using the command line option -O_v_a_l_u_e. This variable is also used, to store the exit status for shell- command, shell, filter-buffer, pipe-to-command and pipe-from-command. filename-completion stores the number of added characters in it. delete-mode- time stores the old time mode in it. delete- mode-autosave returns information about the old auto save interval in this variable. ocl-argument is set to the OCL command token, which cannot be executed while view mode is active. 9 modify-behaviour modify-behaviour changes the semantics of Origami/OCL-functions: command modification/effect create-fold switch on highlighting mode open-buffer place/file open-list-buffer place/file open-adjacent-buffer place/file open-list-adjacent-buffer place/file help show @reference-begin-class help message print only in verbose mode Origami 1.6.92 - 40 - October 1993 User Guide - 41 - Programming in OCL center-and-redraw-display screen invalid add-mode-autosave delay in seconds set-display-mode do not stay in menu 9 key-count key-count contains the number of keyboard inputs, Origami read. 9 kill-count kill-count contains the number of lines, killed by kill-line or copy-to-kill-buffer. 9 move-count move-count contains 0 or 1, depending on the usage of the move-buffer. 9 path-separator path-separator is initialized at startup with the operations systems path separator (usually '/'). 9 file-number file-number is set to the position of the current file in the list of edited files. The list of edited files uses 0. 9 diredit-long diredit-long controls, whether directories are displayed using dirfold -l. 9 force-bourne-shell If force-bourne-shell is not 0, /bin/sh is used instead of the value of environment variable SHELL. _3._2._7._2. _g_l_o_b_a_l _i_n_t_e_g_e_r _a_r_r_a_y_s 9 These also have to be declared with defvar: 9 (defvar _d_i_m_e_n_s_i_o_n (_v_a_r_i_a_b_l_e_n_a_m_e ... )) All given _v_a_r_i_a_b_l_e_n_a_m_e are declared as fields of _d_i_m_e_n_s_i_o_n integer variables. _d_i_m_e_n_s_i_o_n is a non negative number constant. 9 The following array is always defined: 9 ocl-arg-field The OCL variable ocl-arg-field is defined with di- mension 16. ocl-arg-field(0) and ocl-argument are the same variable! ocl-arg-field(_x),0<_x<16 are initialized with 0, unless -O>_x is used to overwrite. _3._2._7._3. _p_a_r_a_m_e_t_e_r _v_a_r_i_a_b_l_e_s 9 Variables, declared as arguments for functions, are al- ways local. Each function call will use another set of variables. _3._2._8. _V_a_r_i_a_b_l_e _I_n_i_t_i_a_l_i_z_a_t_i_o_n Origami 1.6.92 - 41 - October 1993 User Guide - 42 - Programming in OCL The variables are known for all functions/macros. They are initialized by 0 at startup. The variable ocl- argument is initialized with -1, if no -O option is given. Otherwise it is set as the -O options deter- mines: 9 -O [>_o_f_f]<_v_a_l_u_e Change the value of OCL variable ocl-argument to the one of ocl-arg-field(_v_a_l_u_e.). If >_o_f_f is used, change ocl-arg-field(_o_f_f) instead. 9 -O [>_o_f_f][=]_v_a_l_u_e Change the value of OCL variable ocl-argument to _v_a_l_u_e. If >_o_f_f is used, change ocl-arg-field(_o_f_f) instead. 9 -O [>_o_f_f]|_v_a_l_u_e Bitwise-Or the value of OCL variable ocl-argument with _v_a_l_u_e. If >_o_f_f is used, change ocl-arg- field(_o_f_f) instead. 9 -O [>_o_f_f]&_v_a_l_u_e Bitwise-And the value of OCL variable ocl-argument with _v_a_l_u_e. If >_o_f_f is used, change ocl-arg- field(_o_f_f) instead. 9 -O [>_o_f_f]^_v_a_l_u_e Bitwise-XOr the value of OCL variable ocl-argument with _v_a_l_u_e. If >_o_f_f is used, change ocl-arg- field(_o_f_f) instead. 9 -O [>_o_f_f]+_v_a_l_u_e Increment the value of OCL variable ocl-argument with _v_a_l_u_e. If >_o_f_f is used, change ocl-arg- field(_o_f_f) instead. 9 -O _n_a_m_e[=]_n_u_m_b_e_r If _n_a_m_e is defined as a command line alias in the current rc file, the corresponding initialization will be done. If =_n_u_m_b_e_r is used, in the above mentioned options ? can be used to replace _v_a_l_u_e by the command line argument. 9 In aliased commands, you can use another command: 9 @ A string given with = will be added to the predefined history argument-list. A empty string will be stored as a single space. 9 Warning: there will be no compile time syntax check for the given aliases! _3._2._9. _V_a_r_i_a_b_l_e_s _U_s_a_g_e _3._2._9._1. _T_e_r_m_s 9 Variables can be used to build expressions. The syntax for these expressions, called _t_e_r_m in this document, is: 9Origami 1.6.92 - 42 - October 1993 User Guide - 43 - Programming in OCL _b_a_s_i_c | -_t_e_r_m | [+|-|*|div|modulo](_t_e_r_m _t_e_r_m [_t_e_r_m .. ] ) A _t_e_r_m can be a _b_a_s_i_c term or a compound term. 9 OCL's _b_a_s_i_c terms are: 9 true evaluates to 1. 9 false evaluates to 0. 9 _n_u_m_b_e_r a signed or unsigned integer constant. 9 "_c_h_a_r C-_x the integer coding of the given character. 9 Warning: the "_c_h_a_r character is read as a string with length 1. So _c_h_a_r must be followed by a space! 9 _n_a_m_e a variable 9 _n_a_m_e ( _t_e_r_m ) the _t_e_r_m's entry in array _n_a_m_e (index: 0,1,.. ) 9 eval (_s_t_a_t_e_m_e_n_t ... ) "(_s_t_a_t_e_m_e_n_t ... )" is called via subroutine call. If it is ended with "return-value-from-macro _t_e_r_m", this value is used. Otherwise a random value is used as result of this expression. 9 pre (_s_t_a_t_e_m_e_n_t ... ) _t_e_r_m execute (_s_t_a_t_e_m_e_n_t ... ) and use the new values in the evaluation of _t_e_r_m. 9 counter _c_o_n_d_i_t_i_o_n is 1, if the boolean expression evaluates to TRUE, otherwise 0. 9 read-repeat Return the value accumulated by set-argument-x. The repeated execution of the command will be stopped. If set-argument-x was not used, -1 will be returned. 9 store-character Return the ASCII value of the character under the cursor. 9 fold-comment-start-length Returns the length of the fold comment start string (2, if language Inmos is active). 9 fold-comment-start _t_e_r_m Returns the _t_e_r_ms character of the fold comment start string (which is replaced by '--', if language Inmos is active). 0 is the first charac- ter. 9Origami 1.6.92 - 43 - October 1993 User Guide - 44 - Programming in OCL fold-comment-end-length Returns the length of the fold comment end string (0, if language Inmos is active). 9 fold-comment-end _t_e_r_m Returns the _t_e_r_ms character of the fold comment end string (which is replaced by '', if language Inmos is active). 0 is the first character. 9 fold-mark-begin _t_e_r_m fold-mark-end _t_e_r_m fold-mark-file _t_e_r_m fold-mark-line _t_e_r_m Like fold-comment-start, but uses the fold mark strings. 9 file-type Return a coding for the type of the current editor file. 9 0 for regular file 9 1 for directory 9 -1 for list of edited files 9 set-enter Return number of entered folds. 9 set-space-enter Return the number of leading spaces hidden by entering folds. 9 store-line Return the current line number. 9 store-pos Return the x-position of the cursor. 1 is first displayed character. This may be not the first character on that text line if you have entered indented folds. 9 buffer-from-position _t_e_r_m-_x _t_e_r_m-_y Return the buffer number, using the screen posi- tion (not buffer position) _t_e_r_m-_x/_t_e_r_m-_y. If the position does not belong to a buffer, 0 is re- turned. 9 store-line-mark Return a coding of the current line. goto-line- mark can use this value to reach the line, even if the line has been moved in the text. 9 origami functions All Origami commands can be used in terms. This is used to set variables with values used in insert-ascii. 9 _o_p(_e_1 _e_2 _e_3 .. ) is evaluated like _o_p(_o_p(_e_1 _e_2) _e_3 .. ). 9 Warning: The code optimizer (option -O) modifies only 9Origami 1.6.92 - 44 - October 1993 User Guide - 45 - Programming in OCL the generated OCL-assembler. It cannot optimize the structure of terms! Play with the expressions and use viewrc if you need fast/short functions/macros. _3._2._9._2. _V_a_r_i_a_b_l_e _s_t_a_t_e_m_e_n_t_s 9 The following functions deal with variables/terms and can be used in the same way like the above mentioned statements: 9 prompt-counter _n_a_m_e _m_e_s_s_a_g_e-_s_t_r_i_n_g Prompts _m_e_s_s_a_g_e-_s_t_r_i_n_g below the status line and reads the new value for _n_a_m_e from keyboard. Input _y sets it to 1, _n sets it to 0. All other inputs have to be decimals or a simple newline-and- indent. 9 N.B.: This command does not support the full edit- ing possibilities, you can use with normal prompts. Only the following commands are allowed: delete-previous-character newline-and-indent normal text characters 9 Warning: if prompt-counter is called during define-macro is active, the given input will not be stored in the macro! This command does not ac- tivate the begin- / end-prompt-macro, because you can do it explicitly in the OCL-code. 9 prompt-char-counter _n_a_m_e _m_e_s_s_a_g_e-_s_t_r_i_n_g Same as prompt-counter, but the counter _n_a_m_e is set to the ASCII-value of the next pressed key. The value is undefined, if the pressed key is bound to a user defined or predefined function. The given input will not be interpreted. So a given function will not be executed! 9 Warning: if prompt-char-counter is called during define-macro is active, the given input will not be stored in the macro! This command does not ac- tivate the begin- / end-prompt-macro, because you can do it explicitly in the OCL-code. 9 menu-counter _n_a_m_e _m_e_s_s_a_g_e-_s_t_r_i_n_g Display _m_e_s_s_a_g_e-_s_t_r_i_n_g as a menu and ask for the whished item. Items are the space separated textparts in _m_e_s_s_a_g_e-_s_t_r_i_n_g. You can choose the items by typing the first character or by moving with backward-character and forward-character. The currently chosen item is displayed inverse (or trailing <, if inverse is not possible). The first chosen item is given by _n_a_m_e (or 0, if _n_a_m_e is not in the correct range). _n_a_m_e is set to the number of the chosen item (0..). 9 Origami 1.6.92 - 45 - October 1993 User Guide - 46 - Programming in OCL Leading spaces in front of the prompt will be cut. _m_e_s_s_a_g_e-_s_t_r_i_n_g may not use characters, which are displayed with more than one character on the screen (ctrl-chars and tab)! If the first charac- ter of an item is #, it will be replaced by space in the menu and the item asks for the space- character. If the menu string is to long for the current screen, it will be cut at the left and/or right end and marked as a long edit line. 9 Warning: if menu-counter is called during define- macro is active, the given input will not be stored in the macro! This command does not ac- tivate the begin- / end-prompt-macro, because you can do it explicitly in the OCL-code. 9 goto-buffer-number _t_e_r_m Switch to buffer _t_e_r_m in the list of used buffers, the first one is 1. Uses the order from current- buffer-number. 9 goto-buffer-id _t_e_r_m Switch to the buffer with current-buffer-id is _t_e_r_m. The first one is 0. 9 goto _t_e_r_m Move the cursor on x-position _t_e_r_m. 1 is the first displayed character. If you enter a indent- ed fold, position 1 is not the first character on that line. 9 goto-counter _t_e_r_m Same as above. 9 goto-line-counter _t_e_r_m Like goto-line. The line number is the value of the expression. 9 Warning: Origami exits entered folds and moves to the given position. 9 Warning: the line count begins at beginning of file. Versions older than 1.6.17 used the top of entered fold as the starting point for counting! 9 goto-line-mark _t_e_r_m Like goto-line-counter, but uses the line coding, given by a store-line-mark statement, to reach the line directly. The line will be found, even if it has been moved inside the text. Invalid codes will be handled as if the last line has been marked. 9 If OCL varoable modify-behaviour is not 0, and the cursor is on the destination line, the command will be ignored! 9 Warning: Origami exits entered folds and moves to the given position. 9 Origami 1.6.92 - 46 - October 1993 User Guide - 47 - Programming in OCL Warning: While a marked line is inside kill-, move- or delete-buffer, the mark is invalid. At the time, these lines appear in the text again, the marks become valid again. 9 Warning: Due to memory management of origami and its reusage of memory, the handling of marks in the following circumstances is not defined (in- valid marks or marks to random lines!): 9 changing the edit file of an buffer 9 deleting more than 64 lines, and creating new text lines 9 Warning: the line count begins at beginning of file. Versions older than 1.6.17 used the top of entered fold as the starting point for counting! 9 counter _t_e_r_m The value of the expression is returned as ASCII- text. 9 insert-ascii _t_e_r_m Insert the character with ASCII-code given by the expression into the input stream. There is no check whether the given value of name is a correct ascii value. Do it yourself! 9 This command can also be used, to put internal OCL-tokens into the token stream. This should only used by experienced OCL programmers! Using invalid tokens can crash Origami! 9 set _n_a_m_e _t_e_r_m The counter-variable _n_a_m_e is set to the value of _t_e_r_m. 9 N.B.: the old name set-counter is also valid for compatibility reasons. 9 set _n_a_m_e ( _t_e_r_m_1 ) _t_e_r_m_2 The entry _t_e_r_m_1 of array _n_a_m_e is set to the value of _t_e_r_m_2. 9 N.B.: the old name set-counter is also valid for compatibility reasons. 9 set-cursor-line _t_e_r_m Like redraw-display, but uses line _t_e_r_m instead of the current line. 9 return-value-from-macro _t_e_r_m Like return-from-macro, but a calling eval state- ment can use _t_e_r_m as result. 9 change-fold-type _t_e_r_m _t_e_r_m Uses the first _t_e_r_m as foldtype and the second as fold contents and changes the attributes of the fold under the cursor. These values have specific meanings in TDS! The values of the _t_e_r_ms are used Origami 1.6.92 - 47 - October 1993 User Guide - 48 - Programming in OCL modulo 255. 9 save-and-exit-buffer-code _n_a_m_e _m_e_s_s_a_g_e-_s_t_r_i_n_g Like save-and-exit-buffer, but uses value of OCL- variable _n_a_m_e as exit code. _m_e_s_s_a_g_e-_s_t_r_i_n_g is displayed as exit-message. _3._2._1_0. _C_h_a_r_a_c_t_e_r _s_e_t_s 9 In OCL you can use character sets to simplify boolean expressions. Predefined character sets are: alpha letters a..z,A..Z upper uppercase letters A..Z lower lowercase letters a..z digit digits 0..9 xdigit digit and letters a..f,A..F alnum alpha and digit blank space or tab space characters generating whitespace print printing character cntrl control keys 0 .. 31 and delete key 127 graph not space character punct punctation character: not alnum, digit or space 9 N.B.: see in your local 'ctype' documentation for de- tailed information. 9 You can define your own sets with: 9 (defset _n_a_m_e ( _e_l_e_m_e_n_t ... )) The character set name is declared. Elements are all characters given in the _e_l_e_m_e_n_t-list. _e_l_e_m_e_n_t can be: _n_a_m_e the name of a known character set "_x a normal character C-_x a control character Inside functions/macros you can use defset as Origami function: 9 defset _d_e_s_t _s_o_u_r_c_e The value of set _d_e_s_t is overwritten by the set _s_o_u_r_c_e. _d_e_s_t has to be a user-defined set. The predefined sets cannot be redefined. _3._2._1_1. _B_o_o_l_e_a_n _e_x_p_r_e_s_s_i_o_n_s 9 The boolean expressions _c_o_n_d_i_t_i_o_n mentioned above can be: 9 true" 9 false" 9 last-message _m_e_s_s_a_g_e-_n_a_m_e Is true if the last message created by a string Origami 1.6.92 - 48 - October 1993 User Guide - 49 - Programming in OCL from file msg in the Origami source directory was _m_e_s_s_a_g_e-_n_a_m_e. A successful test will set the last displayed message to a dummy value, so that last- message _x will be false until a new message is displayed. Using Origami-messages in prompts changes the last displayed message. The appendix contains the list of known messages. 9 test-file-changed Is true if the current file has been changed. 9 test-filed Is true if the current line is a file-folded-line. 9 test-fold-line Is true if the current line is a closed-fold-line. 9 test-begin-fold Is true if the current line is the {{{ line of a open fold. 9 test-end-fold Is true if the current line is the }}} line of a open fold. 9 test-text Is true if the current line is a normal text-line. 9 test-top Is true if the current line is the top of the en- tered fold. 9 test-bottom Is true if the current line is the bottom of the entered fold. 9 test-char _t_e_r_m Is true if the ASCII-value of the character under the cursor is equal to value of the expression. 9 test-char-less _t_e_r_m Is true if the ASCII-value of the character under the cursor is less than the value of the expres- sion. 9 test-char-greater _t_e_r_m Is true if the ASCII-value of the character under the cursor is greater than the value of the ex- pression. 9 test-char-set _n_a_m_e Is true if the character under the cursor is in the given character set _n_a_m_e. 9 test-str _m_e_s_s_a_g_e-_s_t_r_i_n_g Is true if the string, beginning at the cursor and _m_e_s_s_a_g_e-_s_t_r_i_n_g are the same. 9 test-language "_x test-language _l_a_n_g_u_a_g_e-_n_a_m_e Is true if _x is the language used by set-language. Origami 1.6.92 - 49 - October 1993 User Guide - 50 - Programming in OCL Instead of the single character '_x', you can use the language names, like given in chapter Process- ing Origami Files. 9 [<|<=|=|<>|>=|>]( _t_e_r_m_1 .. _t_e_r_m_N ) Is true, if _t_e_r_m_I _O_P _t_e_r_m_I+_1 is true for all I=1..N-1. No term is evaluated more than once. If _t_e_r_m_I _O_P _t_e_r_m_I+_1 is false for I, the following terms are not evaluated. 9 test-begin-line Is true if the cursor is placed on or before the first non-space-character of the current line. 9 test-end-line Is true if the cursor is placed behind the last non-space-character of the current line. 9 in-prompt Is true if Origami is not waiting for a normal edit-character (for example when prompting for a filename). 9 test-folding Is true, if Origami is in create-fold or highlight mode. The OCL variable ocl-argument is set to the value of modify-behaviour at create-fold call. 9 test-overwrite Is true if Origami is in overwrite-mode. 9 test-hash-shift Is true if Origami is in hash-shift mode. 9 test-autosave Is true if Origami is in autosave-mode. 9 test-echo Is true if Origami is in echo-mode. 9 test-view Is true if Origami is in view-mode. 9 test-verbose Is true if Origami is in verbose-mode. 9 test-term [(] _t_e_r_m_i_n_a_l-_n_a_m_e [ ... ) Is true, if environment variable TERM is set to one of the given _t_e_r_m_i_n_a_l-_n_a_m_es. _t_e_r_m_i_n_a_l-_n_a_m_e can be given as identifier or string (with leading ".). If _t_e_r_m_i_n_a_l-_n_a_m_e end with a *, the test is true, if TERM starts with _t_e_r_m_i_n_a_l-_n_a_m_e, without the *. The empty list evaluated to FALSE. 9 _t_e_r_m Is true if the given expression evaluates to non- zero. 9 pre (_s_t_a_t_e_m_e_n_t ... ) _c_o_n_d_i_t_i_o_n The sequence of _s_t_a_t_e_m_e_n_t will be executed before the evaluation of _c_o_n_d_i_t_i_o_n. Origami 1.6.92 - 50 - October 1993 User Guide - 51 - Programming in OCL not(_c_o_n_d_i_t_i_o_n) The value of _c_o_n_d_i_t_i_o_n is logically negated. 9 and(_c_o_n_d_i_t_i_o_n [ _c_o_n_d_i_t_i_o_n ... ] ) Is true if all _c_o_n_d_i_t_i_o_ns are true. 9 or(_c_o_n_d_i_t_i_o_n [ _c_o_n_d_i_t_i_o_n ... ] ) Is true if one of the _c_o_n_d_i_t_i_o_ns is true. 9 N.B.: OCL uses short-circuit evaluation for and and or. When Origami is prompting for information (for example, asking to overwrite an existing file during toggle- create-file-fold), you can just use the part of OCL also allowed in begin-prompt-macro and end-prompt- macro. For historical reasons it is allowed to use delimiters , in the expression lists for and and or. _3._2._1_2. _T_h_e _d_i_s_p_l_a_y _a_r_e_a 9 Origami can use a part of the screen to continuously display a text in the same manner as the status line. This area cannot be edited with the normal editing com- mands. The text appears below the status line if it is enabled, with the last line highlighted. Otherwise the text appears below the editing area. Controlling this text display area is restricted to the following OCL statements: 9 set-area _t_e_r_m The OCL expression is used to set the size of the new area. If its value is 0, no text area will be displayed. Otherwise the value determines the number of lines in the new and empty text area. 9 write-area _v_a_r_i_a_b_l_e _v_a_r_i_a_b_l_e _m_e_s_s_a_g_e-_s_t_r_i_n_g Origami uses the variables as x- / y position where to write the string _m_e_s_s_a_g_e-_s_t_r_i_n_g. _3._2._1_3. _U_s_e_r _d_e_f_i_n_e_d _m_o_d_e_s 9 In addition to the predefined modes you can define up to 64 new pairs of strings which can be displayed as modes in the status line: 9 (defmodestring _n_a_m_e _l_o_n_g_s_t_r_i_n_g _s_h_o_r_t_s_t_r_i_n_g) _n_a_m_e is a new mode. _l_o_n_g_s_t_r_i_n_g is displayed in the status line when the mode is active. If the status line becomes to long, _s_h_o_r_t_s_t_r_i_n_g is used. _l_o_n_g_s_t_r_i_n_g and _s_h_o_r_t_s_t_r_i_n_g are normal strings (length is limited by 16). _n_a_m_e is a normal iden- tifier. 9 Usermodes are controlled by the following Origami com- mands. They can be used as normal Origami commands in every (deffun ... ), (initfun ... ) and (defmac ... ). 9 set-numbered-user-mode _n_a_m_e _t_e_r_m Usermode _n_a_m_e is activated. At this point, _n_a_m_e must be defined as usermode! If _t_e_r_m does not Origami 1.6.92 - 51 - October 1993 User Guide - 52 - Programming in OCL evaluate to 0, this value will be displayed after the mode string. 9 set-user-mode _n_a_m_e Usermode _n_a_m_e is activated. At this point, _n_a_m_e must be defined as user mode! 9 reset-user-mode _n_a_m_e Usermode _n_a_m_e is reset. At this point, _n_a_m_e must be defined as user mode! _3._2._1_4. _M_u_l_t_i_p_l_e _k_e_y_b_o_a_r_d _m_o_d_e_s 9 To create more complex keybindings (for example a vi emulation with modes), OCL offers the possibility to use different keyboard translation tables. To do this, you must declare the used key tables with: 9 (defmodes (_n_a_m_e ... )) where _n_a_m_e is a normal string. This command has two effects: Keybind initializes a key table for each _n_a_m_e. and The macros _n_a_m_e are defined and can be used within other macro definitions to switch to a certain keytab. Like macros, defined with defmac, they are not stored in fixed macro buffers, but you can use them for your one function/macro definitions. 9 N.B.: the definition of keyboard translation tables can be spread over multiple ( defmodes ... ) statements. So the following OCL sources have the same meaning: ( defmodes ( _k_b_d__1 _k_b_d__2 ) ) and ( defmodes _k_b_d__1 ) ( defmodes _k_b_d__2 ) 9 The first defined mode is active when starting Origami. The definition of a declared keyboard can be done with: 9 (mode _n_a_m_e (keybind ... ) ... ) All given bindings are put into the keytable for . (keybind abort ... ) must be declared outside any (mode ... ) statement, which means you can only have one abort key for all modes. If us- ing multiple keyboard modes, no other (keybind ... ) statement is allowed outside (mode ... ) state- ments. 9 Using this statement more than once for a specific keytable adds all given bindings to the given Origami 1.6.92 - 52 - October 1993 User Guide - 53 - Programming in OCL mode. _3._2._1_5. _T_e_r_m_i_n_a_l_s 9 You can configure Origami for different terminals in one rc file by using terminal. Terminal dependent aliases can be declared on toplevel via: 9 (terminal [ ( ] _n_a_m_e [ ... ) ] (alias ... ) ... ) The corresponding alias definitions will be used for the different terminals. Terminal dependent aliases inside the (alias ... ) statements are handled for each terminal. The given aliases are internally stored as _t_e_r_m_n_a_m_e@_a_l_i_a_s_n_a_m_e. Use au- toalias to generate your alias declarations. 9 Terminal dependent bindings can be used inside and out- side of (mode ... ) statements. The declaration has to be made like: 9 (terminal [ ( ] _n_a_m_e [ ... ) ] (keybind ... ) ... ) The (keybind ... ) commands inside this statement are only active if Origami is used on a terminal named _n_a_m_e (value of environment variable ORIGAMI- TERM or TERM). Used aliases have to be declared globally or must be declared as terminal dependent for all named terminals. If a alias is not de- clared for one of the given terminals, the bind- ings will not be done for this terminal and a er- rormessage will be printed. 9 Using default as terminalname in (terminal ... ) state- ments is allowed. The corresponding binding will only be done for the default-table. 9 Warning: Binding sequences to an as yet not used termi- nal copies the currently known part of the default ter- minal. 9 N.B.: This is not the whole story! we are still trying to work out how to express this accurately! 9 Some different terminals use the same character se- quences for their different keys. To prevent multiple keytables for these terminals, you can use: 9 (termalias _t_e_r_m_n_a_m_e ( _a_l_i_a_s_t_e_r_m_n_a_m_e ... )) If $TERM/$ORIGAMITERM is set to one of the _a_l_i_a_s_t_e_r_m_n_a_m_es, the keytable for _t_e_r_m_n_a_m_e is used. If _a_l_i_a_s_t_e_r_m_n_a_m_e ends with *, * matches any text. _3._2._1_6. _C_o_n_d_i_t_i_o_n_a_l _c_o_m_p_i_l_a_t_i_o_n 9 OCL offers the possibility to use the same OCL source for different keybindings by using the commands @if- using and @use to control the compilation of the OCL source. Some parts of the source will be handled like comments (like #if .. #endif in C). 9 @use ( _n_a_m_e ... ) 9Origami 1.6.92 - 53 - October 1993 User Guide - 54 - Programming in OCL From now on the identifiers _n_a_m_e ... are known as set tags. 9 @use not( _n_a_m_e ... ) From now on the identifiers _n_a_m_e ... are not known as set tags. 9 @if-using ( _t_a_g ... ) _s_t_a_t_e_m_e_n_t ... @fi The list of statements will only be compiled if one of the tags is set. 9 @if-using not( _t_a_g ... ) _s_t_a_t_e_m_e_n_t ... @fi The list of statements will only be compiled if none of the tags is set. 9 Warning: if a filed fold appears inside @if-using ( _n_o_t-_d_e_f_i_n_e_d-_t_a_g ), the fold will not be read to speed up compilation. In this way it is impossible to start a @if-using-block in one file and end it in another ! _3._2._1_7. _S_p_e_c_i_a_l _c_o_m_m_a_n_d_s 99 (mode-limiter _c_h_a_r) The character, which is used to limit the modes is replaced by _c_h_a_r. This overwrites changes made in the .origamimsg file. 9 (line-limiter _c_h_a_r) The character, which is used to mark long lines is replaced by _c_h_a_r. This overwrites changes made in the .origamimsg file. This character is also used, to mark cut strings in language User. 9 (shift-mark _c_h_a_r) The character, which is used to mark lines, shift- ed to the left. This overwrites changes made in the .origamimsg file. If shift-mark is set to space, no marks are printed! 9 (os-extension ( _e_l_e_m_e_n_t ... )) Keybind generates a rc-file entry, containing the given text. The standard UN*X Origami will ignore these entries, but special ports to non-UN*X operating-systems may use these entries for their own purposes. _e_l_e_m_e_n_t can be: 9 _s_t_r_i_n_g 9 _f_u_n_c_t_i_o_n-_n_a_m_e will be replaced by the used macro place! 9 history _h_i_s_t_o_r_y-_n_a_m_e will be replaced by the internal history id! 9 mode _n_a_m_e will be replaced by the internal keyboard number (0,1,..)! 9 @rc-comment _t_e_x_t All text following @rc-comment up to the end of Origami 1.6.92 - 54 - October 1993 User Guide - 55 - Programming in OCL line will be put unchanged into the rc-file. Ori- gami always ignores this rc-file entry. 9 @error _t_e_x_t Generate a compilation error. Report all _t_e_x_t following @error up to the end of the line as error-message. 9 @line _l_i_n_e _n_u_m_b_e_r Sets the line position in the current file to _l_i_n_e _n_u_m_b_e_r. Useful for OCL-filters, which add/delete lines in the OCL source. 9 The following functions are special commands, for internal use. Only experienced OCL programmers should use these functions. They can be bound to keysequences (except echo-byte, echo-string, save-buffer-layout, restore-buffer-layout, pop-delete-buffer,history, get- history and history-edit) or used in functions/macros. 9 echo-byte _t_e_r_m echo-byte ignores screen-off,screen-on and send byte _t_e_r_m to stdout (terminal). 9 echo-string _m_e_s_s_a_g_e-_s_t_r_i_n_g Like echo-byte, but send the string _m_e_s_s_a_g_e- _s_t_r_i_n_g. 9 history _h_i_s_t_o_r_y-_n_a_m_e Do not use the default histories for prompting commands. The default history is replaced by the history _h_i_s_t_o_r_y-_n_a_m_e. Predefined are: name: history, used in: search search-forward, .. replace replace-string, .. misc goto-line, .. file read-file, .. shell shell, .. error-list error messages are stored here argument-list list of aliased command line arguments match used for -f in directory edit mode. no-match used for -F in directory edit mode. none no history default use standard histories Other histories are declared outside of functions/macros with: 9 ( history _h_i_s_t_o_r_y-_n_a_m_e ) 9 history-edit _h_i_s_t_o_r_y-_n_a_m_e _m_e_s_s_a_g_e-_s_t_r_i_n_g Prompt for a string and use history _h_i_s_t_o_r_y-_n_a_m_e. 9 history-edit-line _h_i_s_t_o_r_y-_n_a_m_e _m_e_s_s_a_g_e-_s_t_r_i_n_g Like history-edit, but the prompt is initialized with the current line and cursor position. Spaces from entered folds are skipped. 9 Origami 1.6.92 - 55 - October 1993 User Guide - 56 - Programming in OCL history-edit-filename _h_i_s_t_o_r_y-_n_a_m_e _m_e_s_s_a_g_e-_s_t_r_i_n_g Like history-edit, but the prompt is initialized with the current filename. 9 get-history _h_i_s_t_o_r_y-_n_a_m_e _t_e_r_m Insert a string from history list _h_i_s_t_o_r_y-_n_a_m_e into the input stream. _t_e_r_m gives the number of the chosen item (0 is newest, 1 is one before, ...). 9 N.B.: histories can be used as string variables. 9 pop-delete-buffer Remove the last deleted line from the delete buffer. There is no undo for this action. 9 screen-off Turn off the screen display. If keyboard input is expected and the screen is switched off, the abort key is automatically invoked and the display turned on again. 9 screen-on Turn on the screen display. You have to call redraw-display yourself. 9 save-buffer-layout Saves the current window positions. There is no stack, so using this command more than once will overwrite the data. 9 restore-buffer-layout Try to restore the buffer sizes and positions to the ones, saved by the last save-buffer-layout command. The screen will be refreshed. New buffers always set their saved size to 0 lines and 0 columns. However, the minimum size for the current buffer is 5 lines and 16 columns. 9 refresh-line Refresh the current line. screen-off/screen-on can be used for single line operations, without redrawing the complete screen. 9 There are a special OCL commands, which can be used to load/remove demand loaded macros: 9 load-function ( _n_a_m_e .. ) Tries to load all named functions. May be used to speed up libraries, using many demand loaded func- tions. 9 load-function not( _n_a_m_e .. ) Remove the functions _n_a_m_e .., if they are a demand loaded. If one of the functions is needed again, it will be loaded automatically. 9 Warning: there are no test, if the macro is currently in use. Origami may die, if you remove a used macro! Origami 1.6.92 - 56 - October 1993 User Guide - 57 - Programming in OCL _3._2._1_8. _R_e_f_e_r_e_n_c_e_s 9 The following command can be used to generate addition- al text files while compiling new binding: 9 @reference-begin : @reference-end If the command line option -r_r_e_f_e_r_e_n_c_e_f_i_l_e is ac- tive, all comments will be put into _r_e_f_e_r_e_n_c_e_f_i_l_e. The text between the @reference-begin / reference-end marks will not be parsed as OCL code, so that the commands must appear at the be- ginning of a line and must be followed by a new- line. If the command line option -R is active, the data will copied to the rc file. Origami can display it with help, if no other helpfile is given. The lines are cut, if they have more than 256 characters. 9 The next command can be used, to store different help pages in the rc file: 9 @reference-begin-class name : @reference-end All comments will be put into the rc file. The text can be read by using help, if OCL vari- able modify-behaviour is set to _n_a_m_e (keybind creates a constant integer value for _n_a_m_e). In- stead of symbolic names, you can also use integer constants _n_u_m_b_e_r (1<=_n_u_m_b_e_r<=8192). The lines are cut, if they have more than 256 characters. 9 Origami compresses the references or describe- bindings-data, before adding them to the rc-file. There is a default list of words, which will be stored with a 2 byte coding. The following command can be used, to modify this list. 9 ( reference-compress [set] ( _s_t_r_i_n_g .. ) ) All strings _s_t_r_i_n_g will be added to the list of compression words. If set is used, the list will be set to the empty list, before adding the strings. 9 N.B.: there can be more than one reference- compress commands in a OCL source. 9 N.B.: the words are tested in the order of their appearance, so prefixes of longer words should be defined after the definition of their extensions. _3._3. _O_C_L _e_x_a_m_p_l_e_s 9 This section includes some commented OCL examples for you to browse through before starting your own applica- 9Origami 1.6.92 - 57 - October 1993 User Guide - 58 - Programming in OCL tions. It is assumed that you are familiar with Ori- gami before you start programming in OCL. _3._3._1. _B_i_n_d_i_n_g_s _k_e_y_s 9 The following examples show how you can bind commands to (sequences of) keys and how aliases work. ; This is a simple keybind file (keybind newline-and-indent C-M) The operation `newline-and-indent' is activated by pressing the key C-M. The line `newline-and-indent C- M' will be included in the keybinding help screens available to the user. You can achieve the same key- binding by using an alias: ; This keybinding uses alias (alias enter C-M) (keybind newline-and-indent $enter) The operation `newline-and-indent' is activated by C-M as before; the keybinding help will show `newline-and- indent enter'. If your terminal sends an unusual se- quence of characters for the enter key instead of the C-M character (very rare), you would just define your own alias for $enter and leave the comprehensive key- bind command unchanged. _3._3._2. _A _s_m_a_l_l _f_u_n_c_t_i_o_n 9 The first OCL example does not use any control struc- tures. It defines a macro named byebye. You should play a little with such functions/macros to get used to the compilation process and its (error) messages. ; this is an example for a function definition: ( defmac byebye ( end-of-fold beginning-of-line newline-and-indent previous-line "end " "of " "text ) ) (keybind byebye (M-"x "b "y "e)) byebye creates a new line containing end of text at the end of the entered fold. _3._3._3. _R_e_v_i_s_i_o_n _c_o_n_t_r_o_l _s_y_s_t_e_m 9 Two more little functions deal with RCS. Note that the check out function is only for personal use of RCS. If you are working in a group, someone else may have edit- 9Origami 1.6.92 - 58 - October 1993 User Guide - 59 - Programming in OCL ed the file, which will not change your own read only copy. The advantage is that you can visit a file and decide if you want to change it. (deffun check-out ( if not(in-prompt) ( delete-mode-view shell-command "co " "-l " "$ORIGAMIFILE ) fi )) (deffun check-in ( if not(in-prompt) ( save-file add-mode-view shell-command "ci " "-u " "$ORIGAMIFILE ) fi )) _3._3._4. _M_T_o_o_l-_v_e_r_s_i_o_n _o_f _t_o_p-_o_f-_f_o_l_d 9 This a user defined function, simulating the command top-of-fold as it is used in the mtool system. The cursor moves to the begin of the currently opened fold. ; example for a more complex function (deffun mtool-top ( if test-end-fold (previous-line) fi while and(not(test-begin-fold),not(test-top)) ( if test-end-fold (mtool-top) fi previous-line ) )) While the cursor is not being located on top of a fold (entered or opened) the cursor is moved up. If the function finds the end of fold line from another opened fold, this fold is skipped by a recursive call of mtool-top. _3._3._5. _F_i_l_l _p_a_r_a_g_r_a_p_h 9 The next example function is a bit more advanced. It is too lengthy to include it here, but it can be found in the file fill-paragraph. 9 fill-paragraph fills all lines from cursor position to the next line with a blank (or a dot in ``roff-mode'') in the first column. Not text lines and line, starting 9Origami 1.6.92 - 59 - October 1993 User Guide - 60 - Programming in OCL wtih fold-comment-start string stop r filling too. The first column of a line is here the first character in currently entered fold, not opened fold! Filling a line means to add words from the next line if it is too short or to put words to the next line if it is to long. The default right margin is set to column 72. If there are unfillable lines, fill-paragraph stops filling and complains. Fill-column counts from begin- ning of entered fold indentation. 9 The filling can be done in the following 2 ways: block-mode All `` '' are expanded to `` '', till the line reaches the fill margin. shrink-mode All `` '' are replaced by `` '' and the right margin remains unaligned or ragged. If language Roff is ac- tive, ``. '' is replaced by ``. ''. The function set-fill-mode switches between these modes. The function auto-wrap can be used instead of `` ''. If the cursor is at end of line, the currently typed word is automatically wrapped into a new line. The function set-fill-column allows to change the right mar- gin. To do so, you can either use a numeric argument, point to the position of the new right margin with the cursor or make Origami prompt for the new column width by moving the cursor to the left margin. _3._3._6. _G_o_t_o _m_a_t_c_h_i_n_g _f_e_n_c_e If you are writing programs, you often want to know which parentheses match in a complicated expression. goto- matching-fence performs this function. It uses the charac- ter under the cursor to determine if you are looking for a round, square or curly bracket and if you want to jump to the opening or the closing one. If the cursor is not located on a bracket, nothing will happen. Otherwise the function searches the matching fence. If it cannot find it, it will move back to your old position. If necessary, this function opens and closes folds. Do not worry if it does not seem to stop searching. If your text is very long and there is no fitting fence, you will be amazed how many folds you are using and how fast they can be opened and closed, but usually goto-matching-fence will exit gracefully at last. Remember the operation can also be interrupted by the abort character (often bound to C-G). 9 Origami 1.6.92 - 60 - October 1993 User Guide - 61 - Programming in OCL _3._3._7. _T_h_e _t_o_w_e_r_s _o_f _h_a_n_o_i This is a funny function to demonstrate the power of OCL. You should type a string of a few characters without blanks, then start this function and have fun. Warning: If you type more than about eight to ten charac- ters, the game will require a long time. _3._3._8. _C_o_n_d_i_t_i_o_n_a_l _c_o_m_p_i_l_a_t_i_o_n A simple example for the usage of conditional compilation: @if-using (foo) ... block @fi `... block' will only be compiled if the tag _f_o_o is known as used. This can be done by an earlier @use (_f_o_o) or by the commandline option -U_f_o_o. Another example shows the usage of conditional compilation to prevent multiple compilation of a file: @if-using not(FILENAME) @use (FILENAME) ... block @fi This technique is used in the library files in the bindings directory. The following example shows, how different keyboards, func- tion and macro sets etc. can be handled properly with one OCL source. You need only one tag to choose the correct environment. This can be done either by an earlier @use (??) or by the command switch -U??. {{{ choose correct compilation tags @if-using (kbd_1_macros_1) @use ( kbd_1 mac_1 ) @fi @if-using (kbd_2_macros_1) @use ( kbd_2 mac_1 ) @fi ; you can write such statements as well: @if-using (kbd_1_macros_2) @use ( kbd_1 mac_2 ) @fi @if-using (kbd_2_macros_2) @use ( kbd_2 mac_2 ) @fi @if-using ( kbd_2_c ) @use (kbd_2 c_macs mac_1) @fi }}} Origami 1.6.92 - 61 - October 1993 User Guide - 62 - Programming in OCL {{{ macros ... simple macros @if-using (mac_2) ...F special tex macros @fi @if-using (mac_1) ...F text edit helps @fi @if-using (c_macs) ...F c_macros @fi }}} {{{ keyboard mapping ... terminal_keymap (esc,shift,ctrl ... ) @if-using (kbd_1) ...F simple_keys (cursor- and functionkeys) @fi @if-using (kbd_2) ...F more_complex_keys (cursor- and functionkeys) @fi }}} The usage of more descriptive identifiers is left as an exercise for the reader. _3._3._9. _L_i_b_r_a_r_i_e_s To use a library file, you can use the following 3 tech- niques: ; to include the file filename ; in the current directory: ...F filename or ; to include the file filename ; in the current directory: @include filename or ; to include a file filename ; in directory dir (dir is part of ; the keybind library path): @lib filename _3._3._1_0. _M_o_d_e_s _a_n_d _t_e_r_m_i_n_a_l_s A simple example for the usage of multiple keyboards is the Origami 1.6.92 - 62 - October 1993 User Guide - 63 - Programming in OCL following: (defmodes edit shell) ( deffun shell-commands ( add-mode-view shell ) ) ( deffun editing ( delete-mode-view edit ) ) ( abort-macro editing ) (mode edit ... bind all normal edit commands ( keybind shell-commands ( .. ) ) ) (mode shell ... bind commands calling special shell scripts ( keybind editing ( .. ) ) ) ... some other macros (mode shell ; mode is splitted in 2 definitions ... bind commands calling special shell-scripts,part 2 ) This enables you to use all normal characters for your shell commands or predefined system calls. Another example shows the usage of terminal dependent bind- ings. (defmodes keyboard) ... aliases for SUN-keyboard ... aliases for PC-keyboard (mode keyboard ... all normal edit commands ( terminal SUN ... all SUN keyboard function keys ) ( terminal PC ... all PC keyboard function keys ) ) Origami loads only one of the given tables, depending on the value of $ORIGAMITERM or $TERM. The default keyboard uses none of the additional bindings. The following is an example for using terminal dependencies for aliases too: Origami 1.6.92 - 63 - October 1993 User Guide - 64 - Programming in OCL (defmodes keyboard) {{{ aliases for SUN keyboard - autoalias ; created with 'autoalias -tsun' ( terminal sun ( alias up ( ... ) ) ... ) }}} ... aliases for PC keyboard - hand coded (mode keyboard ... all normal edit commands ( terminal ( sun PC ) ( keybind previous-line ( $up ) ) ; instead of $up, $sun@up and $PC@up ; will be used in the two tables ... ) ) _3._3._1_1. _C_o_m_m_a_n_d _l_i_n_e _o_p_t_i_o_n_s, _h_o_o_k_s This example shows, how complex bindings can use their own command line options. It also shows, how the semantics of a predefined command can be changed. The new command line options nohigh, high, stat and nostat are defined to be used with -O to enable, disable the highlighting while creating a fold and the display of the statusline. Origami 1.6.92 - 64 - October 1993 User Guide - 65 - Programming in OCL {{{ names and modes ( defbinding Example ( "high "|1^1 ) ( "nohigh "|1 ) ( "stat "|2^2 ) ( "nostat "|2 ) ; use bits 0,1 for the two modes ; FALSE=default=display on ) }}} {{{ variables ( defvar ( startup no-highlighting ) ) }}} {{{ mode highlighting ( deffun add-mode-highlighting ( set no-highlighting 0 ) ) ( deffun delete-mode-highlighting ( set no-highlighting 1 ) ) }}} {{{ create-fold ( defmac create-fold-orig ( create-fold ) ) ( undeclare ( create-fold ) ) ( deffun create-fold ( local ( modify-behaviour ) ( if and(no-highlighting =(0 modify-behaviour)) ( set modify-behaviour 5 ) fi ; change only, if default ; create-fold should be used! create-fold ) ) ) ( undeclare ( create-fold-orig ) ) }}} {{{ startup macro ( demand-load ( . {{{ startup-fun ( deffun startup-fun ( if <>(ocl-argument -1) ( set startup ocl-argument ) ; ocl-argument set by -O fi . {{{ handle bit 2, 0=statusline on if >=(startup 2) ( set startup -(startup 2) statusline-off ) Origami 1.6.92 - 65 - October 1993 User Guide - 66 - Programming in OCL else ( statusline-on ) fi }}} . . {{{ handle bit 1, 0=highlighting on if >(startup 0) ( add-mode-highlighting ) else ( delete-mode-highlighting ) fi }}} . . if test-term my-old-slow-terminal ( delete-mode-highlighting ) fi . set startup 0 ) ) }}} . ) ) }}} {{{ read-new-file-macro ( deffun read-newfile-hook ( if =(startup 0) ( startup-1 ) fi ... any code for new file handling if =(startup 0) ( set startup 1 load-function not(startup-fun ) fi ) ) ( read-newfile-macro read-newfile-hook ) }}} {{{ abort-macro ( deffun abort-hook ( set modify-behaviour 0 ) ) ; maybe you hit abort, while the modified ; create fold command is active! ( abort-macro abort-hook ) }}} : ; your stuff These examples should give an impression of what can be done using OCL. There are more functions/macros stored in the bindings directory. I am sure that you will invent more useful OCL functions/macros. If you wrote a really new and good one, please post it to the USENET newsgroup Origami 1.6.92 - 66 - October 1993 User Guide - 67 - Programming in OCL comp.editors. Origami 1.6.92 - 67 - October 1993 User Guide - 68 - Mouse extension _4. _M_o_u_s_e _e_x_t_e_n_s_i_o_n On some systems, Origami can be used with a mouse. The rc- file format is independent from mouse-support. If Origami is not able to support the mouse, the corresponding informa- tion in the rc-file is ignored! _4._1. _A_v_a_i_l_a_b_l_e _i_m_p_l_e_m_e_n_t_a_t_i_o_n_s Origami can be used with a mouse in the following window environments: _4._1._1. _X Defining the symbol XTERM at compile time enables the mouse support for X. Running Origami inside a xterm will activate _s_e_n_d _m_o_u_s_e _p_o_s_i_t_i_o_n _o_n _c_l_i_c_k by sending '\033[?9s\033[?9h' to the terminal and resetting afterwards. You can use up to 10 mouse buttons. They are named Button1 .. Button10 in the bindinglist. The mouse will only be activated, if the environment variable TERM is set to xterm or xterm_x_x_x, _x_x_x any text. Pressing the mouse will activate the Origami actions. Cut/Paste function can be reached (on a standard xterm) via shift mouse button. See in your xterm- and X manuals for more details about mapping the mouse keys. Use TERM to con- trol the loading of different keytables for different termi- nals! If Origami is used in an xterm, you can use the command line option -T _t_i_t_l_e to change the window title to the current filename. After exiting Origami, the title is set to _t_i_t_l_e. If _t_i_t_l_e is the empty string, xterm is used. After reading the window size once from termcap/terminfo, Origami uses xterm escape sequences to get the windowsize. _4._1._2. _M_G_R Defining the Symbol MGR at compiletime enables the mouse support for the Bellcore window manager MGR. Running Ori- gami will activate _s_e_n_d _m_o_u_s_e _p_o_s_i_t_i_o_n _o_n _c_l_i_c_k with m_setevent and resetting afterwards. You can use 5 mouse buttons, pressing and releasing the button are dis- tinguished. The buttons are named Button1..Button5, Button1Down..Button5Down in the bindinglist (MGR does not support Button4 and Button5, Button1 is used for window con- trol). The mouse will only be activated, if the environment variable TERM is set to mgr or mgr_x_x_x, _x_x_x any text. See in your local mgr manuals for more information about mouse map- ping. Use ORIGAMITERM to control the loading of different keytables for different terminals! Origami 1.6.92 - 68 - October 1993 User Guide - 69 - Mouse extension _4._1._3. _X _a_n_d _M_G_R _t_o_g_e_t_h_e_r MGR and X support can be used together, because the MGR mouse support uses the escape sequence from the X mouse sup- port to detect a mouse click. Enable both supports by defining XTERM and MGR. The commandline option -T works only, if Origami is used in a xterm. _4._2. _M_u_l_t_i_p_l_e _M_o_u_s_e _s_u_p_p_o_r_t_s Different mouse extensions in Origami and keybind (rc-file) can be used together, if both use the same `escape sequence' to mark a mouse- click or Origami scans the mouse itself. In these cases, the mapping of mouse buttons is defined by Origami. Otherwise the mouse will not work. _4._3. _U_s_i_n_g _t_h_e _m_o_u_s_e _i_n _O_C_L All keytables, not named like a mouse-support use the default mouse-support (xterm). This can be changed with -M _x_x_x. If the mouse-support is not set to no-mouse, the OCL- tags MOUSY and _x_x_x are set and the mouse-variables are defined. Otherwise, only the buttons are mapped to com- mands, but the mouse-variables are not used and no MOUSY is set! The mouse can be used with (mouse-buttons _C_O_M_M_A_N_D-_F_O_R-_1 _C_O_M_M_A_N_D-_F_O_R-_2 .. ) Pressing the mouse button _x (number _x in the above mentioned namelists) will activate _C_O_M_M_A_N_D-_F_O_R-_x, which can be any Origami command or OCL function. If one of the buttons should not be used, bind no-operation to it. Only the but- ton numbers are stored in the rc-file. The names are gen- erated by Origami at runtime, depending on Origami and its runtime environment. If a mouse button is pressed, while set-language or menu- counter is active, the click will not return the above. Instead of the mapped command, a coding for the chosen menu item will be send. This is the first character of the chosen item. Clicks to invalid positions will be ignored. If the chosen mouse-support is not no-mouse, the following OCL variables are defined automatically and set on mouse click before running the command: Origami 1.6.92 - 69 - October 1993 User Guide - 70 - Mouse extension 9 mouse-b number of pressed button 9 mouse-outside code for type of position value position -2 clicked on message-line -1 clicked on area 0 clicked inside text 1 clicked on fold-lines for edited file 2 clicked outside text 9 mouse-buffer-number number of buffer or number of used buffers, if clicked on message line or area 9 mouse-x column number Inside text you can use goto to reach the posi- tion. 9 mouse-y line number of mouse position, if in text or area Inside text you can use goto-line to reach the po- sition. 9 mouse-go-y contains the number of steps up/down, if inside text Use next-line (or previous-line if negative) to reach the position. Origami 1.6.92 - 70 - October 1993 User Guide - 71 - Miscellaneous _5. _M_i_s_c_e_l_l_a_n_e_o_u_s If a document is to be loaded for the first time you should verify that it does not contain strings which could be misinterpreted as fold marks by Origami. The following sim- ple shell script looks for such strings. fgrep '{{{' fgrep '}}}' fgrep ':::' Origami 1.6.92 - 71 - October 1993 User Guide - 72 - Copyright appointments _6. _C_o_p_y_r_i_g_h_t _a_p_p_o_i_n_t_m_e_n_t_s This chapter was not included in earlier versions, but a discussion on USENET convinced me to write it. Please read it carefully. Each part of this software can and must be copied free. If you copy binaries, you must not prevent people from also copying sources. You must not remove my name from this pro- gram. If you want to use parts of it for your own purposes, point out what is your code and what is mine. You use this software completely at your own risk. No part of this software may be used for military purposes. No exceptions will be made to this clause. If someone wants to use this software even in part for com- mercial purposes, a written non exclusive license is needed. There are no long remarks in the other files of this package about copyright because program code and comments about it are two different things, but the above conditions are valid for the whole package! Origami 1.6.92 - 72 - October 1993 User Guide - 73 - Acknowledgements _7. _A_c_k_n_o_w_l_e_d_g_e_m_e_n_t_s Most of this manual was written by me, but the original was written by someone else, who did not leave his name in it. The concept of the folding editor was originally implemented as part of the Transputer development system at INMOS Ltd., Bristol, UK. The editor was a part of the TDS D700, and was written in Occam. It first ran on a 68000 based Sage/Stride development system, and later was Transputer resident on the PC development system. Origami was rewritten from scratch in Turbo Pascal by Martin Green while at Ferranti Ltd, Cheadle Heath, Stockport, Eng- land, and used the same key mappings and editor functions as the TDS editor. It was then converted from Turbo Pascal by p2c and ported by Charlie Lawrence, while at Eastman Kodak Co. He added lex/yacc based keyfiles, and did the considerable work needed to get it running in C. I fixed some bugs in memory management and elsewhere, ported it to MINIX and later to Linux, changed its user interface to look more Emacs-like and added new features. Wolfgang Stumvoll (stumvoll@pool.informatik.rwth-aachen.de) wrote the OCL code and the keybind compiler. He also made beta tests of all my new versions by using them for his daily work, which helped a lot to find existing and new bugs. Last but not least, he wrote the OCL fill-paragraph, goto-matching- fence and towers-of-hanoi functions. Both of us made a gen- eral code clean up, which was much overdue. Michael Schwingen (michaels@pool.informatik.rwth-aachen.de) ported Origami to Atari TOS and fixed a few minor bugs. He decided against his port being archived on the ftp server mentioned below, so only he knows about the available ver- sion and where to get it. Thomas Hadig (hadig@pool.informatik.rwth-aachen.de) ported Origami to Amiga DOS. His port is available on the below mentioned ftp server. Usually, it is up to date with the current official release. Robert Blum (blum@pool.informatik.rwth-aachen.de) once ported an early version back to MS/PC DOS. Andrew Miller (windy@pool.informatik.rwth-aachen.de) spent much time proofreading the documentation and is still writ- ing the vi Emulation. He tested most new versions on his MINIX machine as well. Stephen R. van den Berg (berg@pool.informatik.rwth- aachen.de) provided the POSIX compatible `Better/BuGless/Berg Regular Expression' library (bregex). Origami 1.6.92 - 73 - October 1993 User Guide - 74 - Acknowledgements There are too many other people in different nets all around the world, who helped with small tips, bug reports etc. to improve Origami. Thanks to all of you. I maintain the whole Origami source code, which means that I will answer or forward mail concerning Origami, decide if and how extensions should be made, give advices for people who are porting it, post new UN*X versions and update the documentation. I put new releases of Origami on the ftp archive ftp.thp.uni-koeln.de [134.95.64.1], path pub/linux/origami. If you can not reach that server, try [134.95.80.1], path pub/thp/linux/origami. Origami 1.6.92 - 74 - October 1993 User Guide - 75 - Appendixes _8. _A_p_p_e_n_d_i_x_e_s _8._1. _R_e_g_u_l_a_r _e_x_p_r_e_s_s_i_o_n_s This version of Origami supports regular expression search and replace. Origamis regular expressions widely conform POSIX extended/basic regular expressions. _8._1._1. _R_e_g_u_l_a_r _s_e_a_r_c_h _e_x_p_r_e_s_s_i_o_n_s Due to the internal text representation, it is impossible to use regular expressions matching strings, containing newline characters. Origami does not support backreference expressions in basic regular search expressions. The following is a table of known operators in basic/extended regular expressions. Refer to your local regular expression documentation for more details. basic (extended) regular subexpressions are marked with _B_R_e_g_E_x_p(_E_x_R_e_g_E_x_p). basic extended _c _c 7 Each character, not used for special purpose, matches itself. . . 7 Matches any single character. [_c_l_a_s_s] [_c_l_a_s_s] [^_c_l_a_s_s] [^_c_l_a_s_s] 7 Matches a character [not] given in the brackets. _c_l_a_s_s can be a list of: _c_h_a_r - a single character character range - marked with _c_h_a_r-_c_h_a_r or [:_s_e_t:] - _s_e_t=alpha, .. _s_e_t is a predefined character set user defined sets cannot be used The following expressions are currently not support: Collating symbols [. .] Equivalence class expressions [= =] ^ ^ Origami 1.6.92 - 75 - October 1993 User Guide - 76 - Appendixes 7 Matches the start of the line, if used at the start of an expression. $ $ 7 Matches the end of the line, if used at the end of an expression. _B_R_e_g_E_x_p _B_R_e_g_E_x_p _E_x_R_e_g_E_x_p _E_x_R_e_g_E_x_p 7 Matches the concatenation of strings, matching the first/second regular expressions. \(_B_R_e_g_E_x_p\) (_E_x_R_e_g_E_x_p) 7 Group the enclosed regular expression, which can be accessed by \_x in the replace pattern. _B_R_e_g_E_x_p\|_B_R_e_g_E_x_p _E_x_R_e_g_E_x_p|_E_x_R_e_g_E_x_p 7 Matches a string, matching one of the given regular expressions. N.B.: \| is an extension in basic regu- lar expressions. _B_R_e_g_E_x_p\+ _E_x_R_e_g_E_x_p+ 7 Matches one or more occurances of the given regular expression. N.B.: \+ is an extension in basic regu- lar expressions. _B_R_e_g_E_x_p\? _E_x_R_e_g_E_x_p? 7 Matches zero or one occurances of the given regular expression. N.B.: \? is an extension in basic regu- lar expressions. _B_R_e_g_E_x_p* _E_x_R_e_g_E_x_p* 7 Matches zero or more occurances of the given regular expression. _B_R_e_g_E_x_p\{_n\} _E_x_R_e_g_E_x_p{_n} _B_R_e_g_E_x_p\{_n,_m\} _E_x_R_e_g_E_x_p{_n,_m} 7 Repeats the regular expression _n [to _m] times. _n[,_m] have to be decimals, 0<=_n[<=_m]. Origami 1.6.92 - 76 - October 1993 User Guide - 77 - Appendixes \!_B_R_e_g_E_x_p !_E_x_R_e_g_E_x_p 7 Match the next line, not containing the following regular expression. [\]! is only allowed at the beginning of a regu- lar expression. N.B.: [\]! is an extension in basic and extended regular expressions. _8._1._2. _R_e_g_u_l_a_r _r_e_p_l_a_c_e _e_x_p_r_e_s_s_i_o_n_s Inside regular expression search and replace, the replace pattern may contain the following subexpressions: basic extended _c_h_a_r_a_c_t_e_r _c_h_a_r_a_c_t_e_r 7 Each character, not used for special purpose. \_N \_N 7 Is the text, matched by the _N-th group. This can only be used, if there is a corresponding (..) pair in the search expression! _N is [g_d_i_g_i_t]*_d_i_g_i_t (g is used, to mark numbers >9!). \u_N \u_N 7 Is the text, matched by the _N-th group with lowercase letters converted to uppercase. This can only be used, if there is a corresponding (..) pair in the search expression! _N is [g_d_i_g_i_t]*_d_i_g_i_t (g is used, to mark numbers >9!). \l_N \l_N 7 Is the text, matched by the _N-th group with uppercase letters converted to lowercase. This can only be used, if there is a corresponding (..) pair in the search expression! _N is [g_d_i_g_i_t]*_d_i_g_i_t (g is used, to mark numbers >9!). Origami 1.6.92 - 77 - October 1993 User Guide - 78 - Appendixes \{_N_e_x_p_r} \{_N_e_x_p_r} 7 Use the first characters of _e_x_p_r, up to the length of the _N-th group in the search string. If _e_x_p_r is not long enough, the last character will be repeated up to the needed length. If _f_I_e_x_p_r is the empty string, space will be used for padding. \0 can be used as last character in _e_x_p_r to suppress pad- ding. This can only be used, if there is a corresponding (..) pair in the search expression! _N is [g_d_i_g_i_t]*_d_i_g_i_t (g is used, to mark numbers >9!). \?_N_e_x_p_r} \?_N_e_x_p_r} 7 If the _n-th group matched, add _e_x_p_r, otherwise the empty string. _N is [g_d_i_g_i_t]*_d_i_g_i_t (g is used, to mark numbers >9!). \!_N_e_x_p_r} \!_N_e_x_p_r} 7 If the _n-th group did not match, add _e_x_p_r, otherwise the empty string. _N is [g_d_i_g_i_t]*_d_i_g_i_t (g is used, to mark numbers >9!). \} \} 7 Use inside of complex replace expres- sions to generate a single }. \\ \\ 7 Represent \. Origami 1.6.92 - 78 - October 1993 User Guide - 79 - Appendixes _8._2. _M_e_s_s_a_g_e_s The following is the list of all messages, Origami can display and which can be used in OCL-commands using the Ori- gami messages. They are stored in the file .origamimsg and can be changed by editing this file. If you are doing this, do not change the length of the lines, the type and order of the used formats. Different messages are used in different ways. The first character of the message-name indicates the usage: D display-characters: specifying some display-details F format strings: should only used with last-message I prompt strings: first character is used for yes,.. M strings to be displayed If F__x_x_x messages are used inside OCL-prompts, string argu- ments are replaced by empty strings, integer and character arguments are replaced by undefined numbers/characters. The known messages are: D_COMMA limiter for modes in statusline D_EOLN marker for long lines D_SOLN mark for shifted lines F_ADD_PATH warning about extended enter-fold filename F_DEMAND error on demand load F_F_FAILED opening a filed fold failed F_INFO_1 first format for describe-fold F_INFO_2 second format for describe-fold F_INT_OCL internal OCL-crash F_LOADING displayed while loading a file F_NO_DEFINE save-keyboard-macro impossible adress F_NO_OPEN trying to open a non-text fold F_NO_TERMCAP cannot open terminal F_SIZE_FILE read/wrote lines/characters F_SUBSTITUTIONS number of replaces by replace-string F_TCFF toggle-file-fold overwrite a file? F_TCG_F keyboard problems (tcgetattr) F_TCS_F keyboard problems (tcsetattr) F_TERMA keyboard problems (missing capability) F_TERMB keyboard problems (not in termcap) F_VM_FAIL virtual text handling crashed F_WRITING displayed while writing a file I_YES yes-key I_NO no-key M_DSP menu for command set-display-mode I_QUIT Quit I_8BIT 8-Bit Origami 1.6.92 - 79 - October 1993 User Guide - 80 - Appendixes I_OCTAL Octal I_DECIMAL Decimal I_HEX Hex I_MARK Mark I_INVERS Invers I_NUMBER Number I_TAB Tab I_PLAIN Plain I_ALL All M_ANY_Q prompt for help/describe bindings I_NEXT_PAGE (next-page) I_NEWLINE newline(next-line) I_BACK Back I_FILTER Filter I_SEARCH Search I_KILL Kill M_Q_R_PROMPT prompt for query-replace-string I_DO_REST do-rest key for query-replace-string I_AB abort key for query-replace-string I_DO_AB do-and-abort key for query-replace-string M_ABORTED displayed, if a macro was aborted M_ACF_LINE read ASCII-file, }}} lines missing line M_ACF_MSG read ASCII-file, }}} lines missing msg M_ARG arg: for repeat-argument-_x M_AUTO_SAVED files has been auto-saved M_BOTTOM no move behind of entered fold M_BYE Bye M_CANTOPEN complain about failed file-open M_CANTWRITE complain about failed file-write M_CHANGED_LEAVE prompt, if leave a changed file M_CHANGED_SAVE prompt, if save a changed file M_CLOSE_FAILED complain about a failed file-close M_CO_END set-language asks for end-comment M_CO_START set-language asks for start-comment M_DIRTY_FOLD ASCII reading crashed, handle as text M_DIR_EDIT warning, editing directory! M_END End M_ERR_PO trying to edit at invalid place M_EXE_EXE no execute-macro while define-macro M_FAILED failed M_FAILED_TERMINAL cannot open keyboard/terminal M_FF_COPY copy of filed folds copies links M_FILENAME prompt for a filename M_FILEPO prompt for number of next file M_FIX_EXE no save-keyboard-macro while define-macro M_FI_FAILED find failed M_FOLDERR cannot fold M_FORKFAIL fork failed M_GOTO prompt for a line-number M_HF help-file M_INDENT_CRASH reading ASCII changed indentation M_KBD_PIPE_FAILED more than one keyboard-pipe M_KEY_BUFF_FULL keyboard macrobuffer is full M_KILLING report killing the help Origami 1.6.92 - 80 - October 1993 User Guide - 81 - Appendixes M_LEAVE_INMOS really leave language Inmos? M_LIST listing-mode for write-file? M_LONG_LINE complain about long line M_LONG_LINE_SPLIT complain about splitted long line M_MAIL_1 dump-mail, part 1 M_MAIL_2 dump-mail, part 2 M_MAIL_3 dump-mail, part 3 M_MAIL_S dump-mail, subject M_MARK_PATTERN replace at invalid position M_MULT_EDIT warn file edited in several buffers M_NEW_FILE read a new file message M_B_NO_MEMORY no memory M_NOFOLDKEY key disabled during create fold M_NOT_BOUND key not bound M_NOT_IF_TDS Inmos: some commands not allowed M_NO_AREA incorrect area-address M_NO_BACK_FOLDING complain: cannot fold backwards M_NO_BUFFERS no more buffers available M_NO_CHANGE save-file not done, file unchanged! M_NO_ENTER_LIST_FF cannot enter listing of filed fold M_NO_FF_COPY no copy of filed folds M_NO_JOB Origami cannot handle job-control M_NO_KTAB rc-file corrupted M_NO_OUTFILE filter-buffer cannot open the pipe M_NO_PICK nothing for insert-folded-kill-buffer M_NO_SAVE_CANCEL if cancel changes after failed save? M_NO_SIMPLE_FOLD normal fold required M_NO_TERM environment variable TERM not set M_NO_TEXT only text filed-folds can be entered M_NO_TOP action needs to be on toplevel M_NO_TOP_AUTO_SAVE cannot auto-save, entered a fold! M_NO_UNDEL undo-delete-line has nothing to do M_NULL_CRASH ASCII read: or no newline M_READ Read M_READING Reading... M_REG_EXP Prompt for correction of regexp M_REG_PAT error: not defined replace pattern M_REPLACE Prompt for replace-pattern M_RF rc-file M_SEARCH prompt for search-pattern M_SHELL_CREATED sub-shell created M_SH_COMMAND prompt for a shell-command M_STACK_OVER complain about OCL-stack-crash M_SUSPEND suspended M_TABSIZE prompt for tab-size M_TDS_CRASH reading corrupted Inmos-file M_TDS_LONG_LINE complain about long Inmos-line M_TOP no move above entered fold M_TRAIL_SPACE trailing whitespace found M_USE_EXIT trying to close a entered fold M_VIEW view mode! M_WHICH_FIX prompt for a macro-buffer M_WIN_CHANGED window changed M_WRITING Writing... Origami 1.6.92 - 81 - October 1993 User Guide - 82 - Appendixes M_WRITTEN Written M_XY_LONG long position for statusline M_XYS_LONG long position with shift for statusline M_XY_SHORT short position for statusline M_XYS_SHORT short position with shift for statusline M_Y line position for complain Origami 1.6.92 - 82 - October 1993 User Guide - 83 - Appendixes _8._3. _O_C_L-_a_s_s_e_m_b_l_e_r _8._3._1. _S_y_n_t_a_x There are commands with different kinds of arguments. The following command-types are known: COM without arguments COM_I with variable/integer argument COM_C with character argument COM_A with address argument COM_II with 2 variable/integer arguments COM_P with message-string argument COM_IP with variable/integer and message-string arguments COM_IIP with 2 variable/integer and message-string arguments OCL-assembler statements are (OCL-assembler programs are not handled by the optimizer!): ._l_a_b_e_l Each unused identifier can be used as a label. No code will be generated, but _l_a_b_e_l can be used for jump- commands. The definition of a label has to be marked with a leading .. Origami functions and macros All Origami functions and OCL-macros with length 1 (deffuns or single command defmacs or init_funs). eval ( _s_t_a_t_e_m_e_n_t ... ) Compile the OCL program '_s_t_a_t_e_m_e_n_t ...'. The assembler program calls it as subroutine. The compiled list of OCL-statements might be optimized. number "_t_e_x_t Origami 1.6.92 - 83 - October 1993 User Guide - 84 - Appendixes _c_o_m_m_a_n_d [_a_r_g_u_m_e_n_t [_a_r_g_u_m_e_n_t [_a_r_g_u_m_e_n_t]]] _c_o_m_m_a_n_d is one of the OCL-assembler statements, ex- plained below. _a_r_g_u_m_e_n_ts are (depending on commandtype of _s_t_a_t_e_m_e_n_t): 9 integer argument: 9 [+ _n_u_m_b_e_r] ... _v_a_r_i_a_b_l_e-_n_a_m_e The following variable names are hidden vari- ables, used by keybind to code the OCL- statements. These variables can be used only in OCL-assembler code directly! (dummy_x),_x=0,1,... term evaluation (arg_x),_x=0,1,... argument passing (loc_x),_x=0,1,... save arguments (repeat) used for repeat (return) return value for functions/macros (rel_op) <,.. #arguments > 2 9 [+ _n_u_m_b_e_r] ... _v_a_r-_a_d_d_r_e_s_s _v_a_r-_a_d_d_r_e_s_s is a non negative integer con- stant. 9 [+ _n_u_m_b_e_r] ... _m_e_s_s_a_g_e-_n_a_m_e The coding of _m_e_s_s_a_g_e-_n_a_m_e, which is one of the above listed messages, stored in .origam- imsg. 9 character argument: 9 _n_u_m_b_e_r, _n_u_m_b_e_r>=0 9 "_c_h_a_r_a_c_t_e_r 9 address argument: 9 [+ _n_u_m_b_e_r] ... _l_a_b_e_l Use address _l_a_b_e_l with given offset as target address. 9 [+ _n_u_m_b_e_r] ... _j_u_m_p-_o_f_f_s_e_t Use the sum of given values as relative jump offset. 9 message-string argument _m_e_s_s_a_g_e-_s_t_r_i_n_g uses the same syntax as in normal OCL-statements. You have to add a M_END_MACRO yourself, to mark the end of the message-string! 9 For example: 9 M_PROMPT 2 ( M_ABORTED counter x ) M_END_MACRO _8._3._2. _C_o_m_m_a_n_d_s The permission tags, used in the following table mean: 9 Origami 1.6.92 - 84 - October 1993 User Guide - 85 - Appendixes * Always allowed, handled in innermost OCL-automat. - Allowed, if no view-mode, folding or other restrictions are active. V Allowed during view. P Allowed in prompts. F Allowed during create fold. f Not allow during create fold, but can be used, while the extended highlighting is active. The known assembler statements are: O_NOP 256 COM no operation * 9 M_BEGIN_OF_LINE 257 COM at beginning of line? PFV 9 M_BOT_OF_FOLD 258 COM at bottom of entered fold? FV 9 M_CHANGE_FOLD 259 COM_II change fold type f 9 M_EDIT_HISTORY 260 COM_IIP edit inside a history list FV 9 M_END_OF_LINE 261 COM behind end of line? PFV 9 M_FINISH 262 COM_IP exit Origami return=var[arg] show prompt PFV 9 M_GOTO_MARK 263 COM_I goto-line-mark var[arg] fV 9 M_GO_BUFFER 264 COM_II go to buffer var[arg] FV 9 M_GO_COUNTER_X_POS 265 COM_I go to position var[arg] FV 9 M_LAYOUT 266 COM_I handle screen layout FV 9 M_POS_TO_COUNTER 267 COM_I var[arg]=x-position FV 9 M_SHOW_HELP 268 COM_I show the help file FV Origami 1.6.92 - 85 - October 1993 User Guide - 86 - Appendixes M_STORE_C 269 COM var[arg]=current char PFV 9 M_TEST_CC 270 COM_I current char==var[arg]? PFV 9 M_TEST_CHAR 271 COM_I current char==arg? PFV 9 M_TEST_CHAR_HIGH 272 COM_I current char>arg? PFV 9 M_TEST_CHAR_LOW 273 COM_I current charvar[arg]? PFV 9 M_TEST_L_CC 276 COM_I current char buffer-id * 9 M_GET_HISTORY 464 COM_II get-history * 9 M_HISTORY 465 COM_I change active history * 9 M_INT_STRING 466 COM_I var[arg] as string * 9 M_INV_COUNTER 467 COM_I var[arg]*= -1 * 9 M_JMP_M_x 484-_x,0<_x<=16 COM jump relativ -_x * M_JMP__x 484+_x,0<=_x<=16 COM jump relativ _x * M_JMP 501 COM_A jump relativ +arg * 9 M_JMP_FALSE_M_x 518-_x,0<_x<=16 COM if tag is false, jump relativ -_x * M_JMP_FALSE__x 518+_x,0<=_x<=16 COM if tag is false, jump relativ _x * M_JMP_FALSE 535 COM_A if tag is false, jump relativ +arg * 9 M_JMP_TRUE_M_x 552-_x,0<_x<=16 COM if tag is true, jump relativ -_x * M_JMP_TRUE__x 552+_x,0<=_x<=16 COM if tag is true, jump relativ _x * M_JMP_TRUE 569 COM_A if tag is true, jump relativ +arg * 9 M_LANGUAGE 570 COM_A language==arg? +arg * 9 M_LASTMES 571 COM_I last message==arg? * 9 M_LOAD_MAC 572 COM_II load function arg * 9 M_MENU 573 COM_IP menu for var[arg],prompt * 9 M_MOD 574 COM_II var[arg1]%=var[arg2] * 9 M_MULT 575 COM_II var[arg1]*=var[arg2] * 9 M_NOT 576 COM tag=!tag * 9 M_NULL_COUNTER 577 COM_I var[arg]==0? * 9 M_POP_DELBUF 578 COM pop-delete-buffer * 9 M_POP_INT 579 COM_I 9Origami 1.6.92 - 92 - October 1993 User Guide - 93 - Appendixes get var[arg] from stack * 9 M_POP_INT_X 580 COM_II get var[arg1+var[arg2]] from stack * 9 M_POSITIV_COUNTER 581 COM_I var[arg]>0? * 9 M_PROMPT 582 COM_IP prompt for var[arg]-value * 9 M_PROMPT_C 583 COM_IP prompt for var[arg]-char * 9 M_PUSH_INT 584 COM_I push var[arg] on stack * 9 M_PUSH_INT_X 585 COM_II push var[arg1+var[arg2]] on stack * 9 M_READ_REPEAT 586 COM_I reset repeat-mode * 9 M_RESET_USER_MODE 587 COM_I no user-mode arg * 9 M_SCREEN_OFF 588 COM don't write on screen * 9 M_SCREEN_ON 589 COM write on screen * 9 M_SET_COPY 590 COM_II copy set2 to set1 * 9 M_SET_COUNTER_M_x 607-_x,0<_x<=16 COM_I var[arg1]= -_x * M_SET_COUNTER__x 607+_x,0<=_x<=16 COM_I var[arg1]= _x * M_SET_COUNTER 624 COM_II var[arg1]=arg1 * 9 M_SET_USER_MODE 625 COM_I user-mode arg * 9 M_SET_USER_MODE_NUMB 626 COM_II user-number-mode arg arg * 9 M_SHOW_CURSOR 627 COM_I show cursor var[arg]/10 sec * 9 M_STORE_LINE_NO 628 COM_I var[arg]=line-number * 9 M_STORE_MARK 629 COM_I var[arg]=line-mark * 9 M_SUM_COUNTER 630 COM_II var[arg1]+=var[arg2] * 9 M_SW_KBD 631 COM_I switch to keyboard arg * 9 M_S_ENTERED 632 COM_I Origami 1.6.92 - 93 - October 1993 User Guide - 94 - Appendixes var[arg]= #entered spaces * 9 M_TEST_AUTO 633 COM in auto-save-mode? * 9 M_TEST_ECHO 634 COM in echo-mode? * 9 M_TEST_FOLD 635 COM creating a fold? * 9 M_TEST_HASH 636 COM test-hash-shift * 9 M_TEST_OVER 637 COM in overwrite-mode? * 9 M_TEST_VERBOSE 638 COM test, if verbose is active * 9 M_TEST_VIEW 639 COM in view-mode? * 9 M_TEXTLINE 640 COM normal textline? * 9 O_BELL 641 COM bell * 9 O_BELL_VISIBLE 642 COM visible-bell * 9 O_DEF_FIX 643 COM save-keyboard-macro * 9 O_DEF_MACRO 644 COM define-macro * 9 O_REP_0 645 COM set-argument-0 * 9 O_REP_1 646 COM set-argument-1 * 9 O_REP_2 647 COM set-argument-2 * 9 O_REP_3 648 COM set-argument-3 * 9 O_REP_4 649 COM set-argument-4 * 9 O_REP_5 650 COM set-argument-5 * 9 O_REP_6 651 COM set-argument-6 * 9 O_REP_7 652 COM set-argument-7 * 9 O_REP_8 653 COM set-argument-8 * 9 Origami 1.6.92 - 94 - October 1993 User Guide - 95 - Appendixes O_REP_9 654 COM set-argument-9 * 9 O_UNCHANGE 655 COM set-file-unchanged * 9 O_UNDEL_CHAR 656 COM undo-delete-character * 9 O_CALL_FIX 657 COM dummy, used during compilation * 9 O_EXE_MACRO 658 COM execute-macro * 9 O_CALL_FIX _x _x+658,_x>=0 COM call the OCL-macro _x * Tokens lower than 256 represent the corresponding charac- ters. 9 Origami 1.6.92 - 95 - October 1993 User Guide - 96 - Appendixes _8._4. _C_o_m_m_a_n_d _l_i_n_e _o_p_t_i_o_n_s The following is part of the online help. Origamis usage is origami [_o_p_t_i_o_n ...] [_f_i_l_e ...] where _o_p_t_i_o_n_s can be: -a _d_e_l_a_y, 1<=_d_e_l_a_y<=60 Origami will start in auto-save-mode with _d_e_l_a_y minutes (-a 0, no auto-save). Multiple usage of this option is allowed. The last given value is used. Default value is 8. 9-d _d_i_s_p_l_a_y-_m_o_d_e Specify the character display mode. _f_I_d_i_s_p_l_a_y-_m_o_d_e is a list of code (like in set-display-mode). o - octal display d - decimal display h - hexadecimal display m - mark control characters i - invers control characters n - numbered control characters p - normal character display 8 - numbered display of 8-bit characters a - numbered display of all characters t_n_u_m_b_e_r - tab width is set to _n_u_m_b_e_r 9-e Origami does not echo the entered keys under the statusline. 9-f _m_a_t_c_h Origami will pass '-f _m_a_t_c_h' to dirfold. Can be used to specify the files, which will be shown in diredit mode. 9-h Origami prints its usage. 9-i Like -di. 9-k _n_a_m_e_b_a_s_e Origami reads the keybinding and the bindinglist from file .origamirc, the help from .origamihelp. This op- tion sets the files to _n_a_m_e_b_a_s_erc and _n_a_m_e_b_a_s_ehelp. If Origami cannot find the files in the current directory, Origami tries to find the files in the directories $HOME or ORIGAMI_PATH (set at compiletime). Origami searches only in the resource path, if the given argu- ment _n_a_m_e_b_a_s_e is not an absolute path. This option is not allowed, if -O has been used before! 9-l _l_i_n_e Goto _l_i_n_e after setting up. Multiple usage of -l .. is not allowed. 9 Origami 1.6.92 - 96 - October 1993 User Guide - 97 - Appendixes 9-m _m_a_r_k_n_a_m_e Origami searches in the rcfile for a set of foldmarks named _m_a_r_k_n_a_m_e. If there is no such markset given, Origami will stop. Otherwise the marks for folds are switched to the new ones. Multiple usage of -m .. is not allowed. 9-n Every time a file is read this will take place without the {{{, }}} or ::: sequences being parsed. Folds can be used when editing, but there is no folding-structure in the read file. This allows the editing of files which contain these strings without confusing Origami. The Inmos format will not be decoded if this option is active. This `non-folding' mode concerns only reading files. Creating new folds or writing files using language Inmos is possible. 9-o Origami starts in overwrite-mode. 9-p Preprocessormode is on. Leading hashes are moved to first character in lines. Reading such files moves hashes to indentation of surrounding folds. 9-t _t_a_b-_w_i_d_t_h Like -dt<_t_a_b-_w_i_d_t_h>. 9-v Origami starts in view-mode. 9-A Origami starts not with the first file in command line, but with the list of given files. This option is ig- nored, if there are not more than 1 command line file or if Origami is started within a pipe. 9-C Do not display the copyright message at startup. 9-D Dump core on crash. 9-F _n_o_m_a_t_c_h Origami will pass '-F _n_o_m_a_t_c_h' to dirfold. Can be used to specify the files, which will not be shown in diredit mode. 9-K_A,-K_N Origami changes the mode of the keypad to application (_A) or numerical (_N) mode at startup, if the terminal supports this. Default is application (_A). 9 Origami 1.6.92 - 97 - October 1993 User Guide - 98 - Appendixes 9-M_m_a_r_k_s Folder replaces the foldmarks by the characters given with _m_a_r_k_s. aaabbbcccddd is evaluated: aaa for start of fold bbb for filed fold name ccc for closed fold ddd for end of fold None of these strings may start with a space or a tab! 9-N _n_u_m_b_e_r If Origami is compiled with support for storing lines on backing store, this options sets the number of buf- fered lines. 9-O _o_c_l-_v_a_l_u_e Change the value of OCL integer variable ocl-argument to _o_c_l-_v_a_l_u_e. If the current bindings supports it, you can use literals. origami [-k_b_i_n_d_i_n_g] -h will show all known literals. See in the User Manual for more ad- vanced options. Multiple usage of this option is al- lowed. If this option is not used, ocl-argument is in- itialized with -1. 9-P Don't open the controlling terminal, if called in a pipe. 9-R _r_c-_p_a_t_h Specify the path list for origami resource files. 9-S _s_h_e_l_l Secure mode is activated. Pipe-commands are disabled and shell-commands use _s_h_e_l_l. If _s_h_e_l_l is the empty word, shell-commands are also disabled. If -S_s_h_e_l_l is used, the only pipe, called by Origami, is 'dirfold ...', to handle the editing of directories. 9-T _d_e_f_a_u_l_t-_n_a_m_e This option is only available, if Origami is compiled to support xterms. In this case, this option enables Origami to set the xterm window name to the name of the current file. After Origami has finished, the window name is changed to _d_e_f_a_u_l_t-_n_a_m_e. Multiple usage of this option is allowed. The last given value is used. If the given value is the empty string, xterm is used. 9-X _o_s _s_p_e_c_i_f_i_c _o_p_t_i_o_n Some special versions of Origami use this option to handle additional features. See the OS-specific docu- ments for more information. 9-V Origami starts in verbose-mode. 9 Origami 1.6.92 - 98 - October 1993 User Guide - 99 - Appendixes 9-W _w_i_n_d_o_w _n_a_m_e _w_i_n_d_o_w _n_a_m_e will be displayed in the statusline, in front of the filename. _w_i_n_d_o_w _n_a_m_e will also appear in the title of xterms, if -T is used. This is intended for users of Virtual Terminal environments such as Screen, where the Terminal Name can be stored in an en- vironment variable. This means one can distinguish between several sessions on several terminals. 9-Z Origami cannot be stopped via suspend-origami. Origami 1.6.92 - 99 - October 1993 User Guide - 100 - Appendixes _8._5. _C_o_m_p_i_l_e_t_i_m_e _C_o_n_f_i_g_u_r_a_t_i_o_n 9There are many parameters, which can be changed at compile- time. More details about changings these constants are given in the source of this distribution. A short list of the possible changes follows. 9Warning: Changing these constants may produce incompatible rc-files! 9Languages The predefined languages for fold hiding can be changed. 9Constants Some constants describing table sizes and string length: 9 linelength (1024) 9 length of TDS lines (152) 9 length of user comment strings (64) 9 cut length for user comment strings in statusline(8) 9 size of delete-buffer (64) 9 length of keyboard macros (512) 9 identifier length (128) 9 length of binding names and command line aliases (16) 9 length of mark names (9) 9 length of keysequences (64) 9 line length in help (256) 9 OCL statement length (8192) 9 OCL filed-fold stack depth (8) 9 number of user modes (64) 9 minimum auto-save time (1) 9 maximum auto-save time (60) 9 default auto-save time (8) 9 history minimum size (8) 9 history maximum size (128) 9 number of command line aliases (128) 9 dimension of ocl-arg-field (16) 9 regular replace patterns (16) Origami 1.6.92 - 100 - October 1993 User Guide - 101 - Appendixes 9Environment variables The names for the environment variables: 9 HOME 9 TERM 9 SHELL 9Strings You can change the following strings: 9 .origamimsg All formats, given in .origamimsg can be changed by changing the default file. 9 default resource path the default value for the environment variable ORIGAMIPATH (.:~:/home/hadig/origami) 9 default keybind library path the default value for environment variable KBDLIB- PATH (.:/home/hadig/origami/bindings/fun:/home/hadig/origami/bindings) 9 View/V 9 DirView/DV 9 DefMac/D 9 Folding/F 9 Over/O 9 AutoSave/S 9 NoParse/NP 9 # 9 ... 9 Origami 1.6.92 - 101 - October 1993 User Guide - 102 - Appendixes _9. _I_n_d_e_x 9There are 3 types of indices: line marks a definition. _l_i_n_e marks an example. line marks a normal reference. 25 25 ! 75 77 # 5 $ 25 25 _2_5 75 $esc 25 ( 75 ) 75 * 25 75 + 25 75 &. 75 &.origamihelp 21 25 100 &.origamimsg 25 25 79 101 &.origamirc 20 21 25 100 0x 25 < 25 <= 25 <> 25 &= 25 > 25 >= 25 ? 75 77 [ 75 \ 77 77 \! 77 \0 77 \? 77 \l 77 \u 77 \{ 77 9Origami 1.6.92 - 102 - October 1993 User Guide - 103 - Index ] 75 ^ 75 { 75 77 | 75 } 75 77 @: @ 25 @error 25 @fi 25 _6_1 _6_2 @if-using 25 _6_1 _6_2 @include 25 _6_2 @lib 25 _6_2 @line 25 @rc-comment 25 @reference-begin 25 @reference-begin-class 21 25 @reference-end 25 @use 25 _6_1 A small function 25 abort 25 25 abort-macro 25 25 _6_3 _6_4 Acknowledgements 73 add-mode-autosave 24 25 100 101 add-mode-basic-regular-expression 23 add-mode-echo 5 24 add-mode-extended-regular-expression 23 add-mode-full-shift 22 add-mode-hash-shift 23 add-mode-no-parse 25 101 add-mode-overwrite 23 101 add-mode-position 5 22 add-mode-time 24 add-mode-verbose 24 add-mode-view 23 101 alias 25 25 _2_5 _6_3 100 All Origami functions 9 and 25 Appendixes 75 area 25 argument 19 25 argument-list 25 25 Arguments 19 auto-header 11 autoalias 25 _6_3 AutoSave 5 101 autosave-macro 24 25 25 autosave-mode 5 24 25 100 Origami 1.6.92 - 103 - October 1993 User Guide - 104 - Index 101 Available implementations 68 backward-character 6 9 14 begin-prompt-macro 25 25 beginning-of-fold 9 beginning-of-line 6 9 bell 25 Binding commands to keys 25 Bindings keys 25 Boolean expressions 25 boolean 25 buffer 6 15 16 20 25 buffer-from-position 25 C 7 _7 C- 25 _2_5 case 25 case-character-toggle 6 13 center-and-redraw-display 20 25 change-buffer-macro 25 25 change-buffername 17 change-fold-mark 25 change-fold-type 25 character set 25 75 Character sets 25 close-fold 9 Command line options 25 _6_4 96 100 Command line options, hooks 64 Commands 84 comment 7 _7 17 21 25 100 Compiletime Configuration 100 Conditional compilation 25 61 _6_1 Contents 1 Control structures 25 copy-to-kill-buffer 13 Copyright appointments 72 counter 25 create-fold 5 10 25 _6_4 85 101 ctrl-char 4 current-buffer-id 25 25 current-buffer-number 25 25 cursor-level 25 D 5 101 defassembler 25 default 25 25 defbinding 25 _6_4 100 deffun 25 25 _2_5 define-macro 18 100 101 defmac 5 25 _2_5 101 Origami 1.6.92 - 104 - October 1993 User Guide - 105 - Index defmark 25 100 defmodes 25 _6_3 defmodestring 25 100 defset 25 defvar 25 25 delete buffer 6 100 delete 25 delete-line 12 100 delete-mode-autosave 25 25 100 101 delete-mode-echo 24 delete-mode-full-shift 22 delete-mode-hash-shift 23 delete-mode-no-parse 25 101 delete-mode-overwrite 23 101 delete-mode-position 22 delete-mode-regular-expression 23 delete-mode-time 24 25 delete-mode-verbose 24 delete-mode-view 23 101 delete-previous-character 6 12 14 25 demand-load not 25 demand-load 25 25 _6_4 describe-bindings 20 describe-fold 22 directory 5 101 diredit-long 25 DirView 5 101 display area 25 69 display 4 25 div 25 do 25 double-line 13 DV 5 101 echo-byte 25 echo-string 25 Editing 12 editor files 9 10 15 16 else 25 end-of-fold 9 end-of-line 6 9 end-prompt-macro 25 25 enter-fold 9 enter-list-file 17 error 25 error-list 25 esac 25 eval 25 25 execute-macro 18 execute-number-macro 18 exit 25 exit-buffer 25 exit-fold 10 Origami 1.6.92 - 105 - October 1993 User Guide - 106 - Index F 5 101 false 25 25 fi 25 _6_1 _6_2 file 6 25 file-number 25 file-type 25 filed fold 25 _6_2 Filed folds and libraries 25 filename-completion 6 19 25 Files 15 Fill paragraph 25 filter-buffer 17 25 filter-line 13 fold-comment-end 25 fold-comment-end-length 25 fold-comment-start 25 fold-comment-start-length 25 fold-mark-begin 25 fold-mark-end 25 fold-mark-file 25 fold-mark-line 25 folding 5 7 _7 9 100 101 force-bourne-shell 25 forward 25 25 forward-character 6 9 14 full-shift-mode 22 22 function 25 25 _2_5 100 Functions and macros 25 get-history 25 25 Getting Started 4 global integer arrays 25 global integer variables 25 Goto matching fence 60 goto 25 goto-buffer-id 25 goto-buffer-number 25 goto-counter 25 goto-line 9 goto-line-counter 25 25 goto-line-mark 25 25 grow-buffer 20 hash-shift-mode 5 23 23 25 help 21 25 hex 4 high-bit 4 history 6 25 25 100 history-edit 25 25 history-edit-filename 25 history-edit-line 25 history-name 25 HOME 20 21 100 Origami 1.6.92 - 106 - October 1993 User Guide - 107 - Index How to get out 25 if 25 if-using 25 _6_1 _6_2 in-prompt 25 include 25 25 _6_2 incremental-search 14 incremental-search-forward 14 incremental-search-reverse 14 15 Index 102 initfun 25 Inmos Files 8 Inmos 7 8 _2_5 insert-ascii 25 insert-file 17 insert-folded-kill-buffer 13 integer 25 kbdlibpath 25 101 key-count 25 key-not-bound-macro 25 25 keybind 25 25 _2_5 _6_3 100 keyboards 25 keysequence 25 100 kill buffer 6 kill-count 25 kill-line 13 KNBM 25 language 5 21 25 100 last-message 25 lib 25 _6_2 libraries 25 _6_1 62 _6_2 line 25 line-limiter 25 linelength 4 5 Lisp 7 load-function not 25 _6_4 load-function 25 25 local 25 long status line 5 long statusline 25 M- 25 _2_5 M-C- 25 Ma 5 macro 18 25 25 _2_5 100 101 Macros 18 Magic 5 mark 7 17 25 _7_1 match 5 25 menu-counter 25 69 Origami 1.6.92 - 107 - October 1993 User Guide - 108 - Index message 25 25 message-exit 25 message-string 25 25 Messages 79 MGR 68 69 misc 6 25 Miscellaneous 71 mode 25 _6_3 mode-limiter 25 Modes and terminals 62 modes 5 22 25 modify-behaviour 10 15 16 20 21 25 25 _6_4 modulo 25 Mouse extension 68 mouse 68 mouse-b 69 mouse-buffer-number 69 mouse-buttons 69 mouse-go-y 69 mouse-outside 69 mouse-x 69 mouse-y 69 move buffer 6 move-count 25 move-line 13 Moving around 9 MTool-version of top-of-fold 25 multi-edit 16 25 Multiple keyboard modes 25 Multiple Mouse supports 69 Name and command line options 25 name 25 100 narrow-buffer 20 newline-and-indent 6 13 14 20 25 next-line 6 9 14 next-page 9 no-match 5 25 no-mouse 69 no-operation 25 no-parse-mode 5 25 101 none 7 25 NoParse 5 101 not 25 25 _6_1 NP 5 101 null character 4 O 5 101 Occam 7 OCL examples 25 OCL syntax and semantics 25 OCL 25 Origami 1.6.92 - 108 - October 1993 User Guide - 109 - Index ocl-arg-field 25 100 ocl-argument 19 22 23 24 25 25 _6_4 OCL-assembler 83 octal 4 open-adjacent-buffer 16 25 open-buffer 15 25 open-fold 9 open-list-adjacent-buffer 16 25 open-list-buffer 16 25 or 25 origami functions 9 origami-message 25 ORIGAMIFILE 13 17 18 19 origamihelp 21 25 100 ORIGAMILINE 13 17 18 19 origamimsg 25 25 79 101 origamipath 25 101 origamirc 20 21 25 100 ORIGAMIWORD 13 17 18 19 ORIGAMIX 13 17 18 19 ORIGAMIY 13 17 18 19 os-extension 25 Other marks for folds 25 Over 5 101 overload-prefix 25 overwrite-mode 5 23 25 101 parameter variables 25 Pascal 7 path 25 path-separator 25 pick buffer 6 pipe-from-command 18 25 pipe-to-command 18 25 pop-delete-buffer 25 PPID 13 17 18 19 pre 25 prefix 25 previous-line 6 9 14 previous-page 9 Processing Origami Files 7 25 Programming in OCL 25 prompt 6 25 prompt-char-counter 25 prompt-counter 25 query-replace-string 14 quote-character 19 rc-comment 25 RCS _2_5 read-file 15 read-list-file 16 Origami 1.6.92 - 109 - October 1993 User Guide - 110 - Index read-newfile--macro _6_4 read-newfile-macro 25 25 read-repeat 25 redraw-display 19 25 reference-begin 25 reference-begin-class 21 25 reference-end 25 references 25 refresh-line 25 Regular expressions 75 Regular replace expressions 77 Regular search expressions 75 regular 5 14 23 100 repeat 25 replace 6 25 replace-string 14 reset-user-mode 25 Resource files 25 restore-buffer-layout 25 return-from-macro 25 25 return-value-from-macro 25 25 Revision control system 25 Roff 7 S 5 101 save-and-exit-buffer 25 save-and-exit-buffer-code 25 save-buffer-layout 25 25 save-file 17 save-keyboard-macro 18 screen 5 screen-height 25 screen-height-offset 25 screen-off 25 25 screen-on 25 25 screen-width 25 screen-width-offset 25 Script 7 Search and replace 14 search 6 25 search-forward 14 14 search-reverse 14 14 set 25 75 set-area 25 set-argument 19 25 set-counter 25 set-cursor-line 25 set-display-mode 25 25 set-enter 25 set-file-unchanged 22 set-language 21 69 100 set-numbered-user-mode 25 set-space-enter 25 set-user-mode 25 Origami 1.6.92 - 110 - October 1993 User Guide - 111 - Index Shell commands 19 shell 6 19 19 25 25 100 shell-command 19 25 _2_5 shift-mark 25 show-cursor 25 shrink-buffer 20 sigquit-macro 25 25 sigusr1-macro 25 25 sigusr2-macro 25 25 space 4 8 Special commands 25 Special functions 19 start-list-editing 25 status line 5 6 25 100 101 status-line-off 25 status-line-on 25 25 statusline 25 store-character 6 25 store-line 25 store-line-mark 25 25 store-pos 25 suspend-origami 19 Syntax 83 tab 4 25 TDS 6 8 9 11 13 25 _2_5 100 term 25 25 100 termalias 25 terminal 25 25 _6_3 Terminals 25 Terms 25 test-autosave 25 test-begin-fold 25 test-begin-line 6 25 test-bottom 25 test-char 6 25 test-char-greater 6 25 test-char-less 6 25 test-char-set 6 25 test-echo 25 test-end-fold 25 test-end-line 6 25 test-file-changed 25 test-filed 25 test-fold-line 25 test-folding 25 test-hash-shift 25 test-language 25 test-overwrite 25 test-str 6 25 test-term 25 _6_4 Origami 1.6.92 - 111 - October 1993 User Guide - 112 - Index test-text 25 test-top 25 test-verbose 25 test-view 25 TeX 7 The display area 25 The Screen Format 5 The Special Editor Buffers 6 The towers of hanoi 61 toggle-attach-file-to-fold 12 toggle-file-fold 11 transputer 8 true 25 25 undeclare 25 25 _2_5 undo-delete-character 6 13 undo-delete-line 12 unfold-fold 10 use 25 _6_1 used-buffers 25 User defined modes 25 User 7 25 usermacros 25 Using Origami 4 Using the mouse in OCL 69 V 5 101 Variable Initialization 25 Variable statements 25 variable 25 25 Variables Types 25 Variables Usage 25 verbose 24 25 View 5 101 view-macro 25 25 view-mode 5 23 25 _2_5 85 101 visible-bell 25 while 25 widen-buffer 20 write-area 25 write-file 17 X and MGR together 69 X 68 69 XM 5 XMagic 5 xterm 68 69 Origami 1.6.92 - 112 - October 1993