Xref: utzoo comp.misc:5719 comp.editors:632 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!haven!ames!pacbell!att!ihlpb!gregg From: gregg@ihlpb.ATT.COM (Wonderly) Newsgroups: comp.misc,comp.editors Subject: Re: UNIX needs a real text editor Message-ID: <10142@ihlpb.ATT.COM> Date: 5 Apr 89 14:51:52 GMT References: Organization: AT&T Bell Laboratories - Naperville, Illinois Lines: 74 From article , by gaynor@porthos.rutgers.edu (Silver): > I'm convinced, TPU's language _is_ moderately powerful. Got a reference sheet > on the language? Post it, and let's pick at it for a bit. TPU is not a simple language. Nor is it small in specification. I can elaborate a little. TPU variables inherit type information from assignment. The types supported are INTEGER, KEYWORD, STRING, PATTERN, MARKER, RANGE, BUFFER, WINDOW, PROGRAM and ARRAY. A MARKER holds a location. A RANGE is the region between two markers as created in rnge := CREATE_RANGE (mark1, mark2, NONE); The NONE KEYWORD can be replaced with BOLD, BLINK, REVERSE or DIM to cause the range to have that video attribute on the screen. A PROGRAM is something returned by COMPILE which can be passed to EXECUTE to do whatever was programmed in the compiled object e.g. Read keystrokes and execute the 'programs' mapped to them, where key_info() is a procedure that uses the currently active keymap to retrieve the desired info. LOOP key := READ_KEY; prog := key_info (key, PROGRAM); IF prog <> 0 THEN EXECUTE (prog); ELSE MESSAGE ("Undefined key"); ENDIF; ENDLOOP; The rest of the types should be obvious. WINDOWS may or may not have status bars. You compose the text that goes into them. The builtin procedure COPY_TEXT is used to move text between BUFFERS and different locations in the same buffer. The DELETE() builtin removes the object that you pass it. It knows how to handle BUFFERS, WINDOWS, MARKERS and RANGES. The ERASE_CHARACTER() builtin erases the number of characters specified in the specified direction. A simple mapping for the DELETE key would be DEFINE_KEY ("ERASE_CHARACTER (-1)", DEL_KEY, "delete key"); which would cause the DELETE key to erase the character behind the current position in the current buffer. There are other things that you would probably wish to do such as guard against the "Can't move beyond beginning of buffer" MESSAGE that would be spit out whenever you are at the beginning of the buffer and type DELETE. DEFINE_KEY accepts a fourth parameter which optionally specifies a keymap that the key is to be defined in. You must use CREATE_KEYMAP and CREATE_KEYMAP_LIST to establish all of the appropriate resources to store the keymaps. My VI emulator uses 3 keymaps. One for command mode, one for insert/edit mode and one that maps all of the keys to a movement routine for the d, c, <, > and y commands to use. I could go on... -- Gregg Wonderly DOMAIN: gregg@ihlpb.att.com AT&T Bell Laboratories UUCP: att!ihlpb!gregg