~ Office Supplies ~~ Buy Posters ~~ A-Z Products ~~ Website Advertising


TECO - Wikipedia

<<Up     Contents

TECO

Redirected from TECO/Example

TECO (pronounced /tee'koh/; originally an acronym for '[paper] Tape Editor and COrrector', but later 'Text Editor and COrrector') was a text editor developed at MIT and modified by just about everybody. With all the dialects included, TECO may have been the most prolific editor in use before Emacs, to which it was directly ancestral.

TECO, noted for its unspeakably hairy syntax, can be considered a general-purpose, interpreted programming language targeted for text manipulation. Almost every character is a command -- a 1- or 2-character sequence replaces the usual keywords of more verbose languages -- thus any character string is a TECO program, although not necessarily a useful one. One common game used to be mentally working out what the TECO commands corresponding to human names did.

Richard Stallman's original Emacs was implemented in TECO. Later versions of Emacs, first Multics Emacs and then GNU Emacs, however, were implemented in LISP.

TECO was available for several operating systems, including ITS[?] on the PDP-6 and PDP-10, and TOPS-10[?] and TOPS-20 on the PDP-10. A descendant of the version DEC distributed for the PDP-10 is still available on the Internet, along with several partial implementations for the MS-DOS/Windows environment. A version of TECO was provided with all DEC operating systems; Compaq still provides TECO with VMS.

Example TECO code

Example TECO program

This is a simple interchange sort of the current text buffer, based on 1st character of each line, taken from the PDP-11 TECO User's Guide. A "goto" and "structured" version are shown. Note that TECO ignores case and whitespace (except tab, which is an insertion command).

Example 1

  !START! j 0aua               ! jump to beginning, load 1st char in register A !

  !CONT! l 0aub                ! load first char of next line in register B !

  qa-qb"g xa k -l ga 1uz '     ! if A>B, switch lines and set flag in register Z !

  qbua                         ! load B into A !
  l z-."g -l @o/CONT/ '        ! loop back if another line in buffer !

  qz"g 0uz @o/START/ '         ! repeat if a switch was made on last pass !

Example 2

  0uz                             ! clear repeat flag !
  <j 0aua l                       ! load 1st char into register A !

  <0aub                           ! load 1st char of next line into B !

  qa-qb"g xa k -l ga -1uz '       ! if A>B, switch lines and set flag !

  qbua                            ! load B into A !
  l .-z;>                         ! loop back if another line in buffer !

  qz;>                            ! repeat if a switch was made last pass !


This article is based on an entry in the jargon file, which is in the public domain.

wikipedia.org dumped 2003-03-17 with terodump




 
 
62 carat LABRADORITE feldspar gemstone Blue gold large hand polished gem stone jewelry 12 gr PRETTY
 62 carat LABRADORITE feldspar Blue gold large hand polished jewelry 12 gr PRETTY 
 
6 carats Pink TOURMALINE gem stone Tumble polished cabbing rough bi colored gemstone jewel 1 grams
 6 carats Pink TOURMALINE Tumble polished cabbing bi colored jewel 1 grams 
 
65 carats maroon red Leopardskin Jasper gem Tumble polished Cabbing Leopard skin rough 13 grams Nice
 65 carats maroon red Leopardskin Jasper Tumble polished Cabbing Leopard skin 13 grams Nice 
 
13 gr Arizona pink red yellow PETRIFIED WOOD gem Cab lapidary rough tumble polished cabbing gemstone
 13 gr Arizona pink red yellow PETRIFIED WOOD Cab lapidary tumble polished cabbing  
 
Orange Mexican Potch OPAL gem stone jewel Loose faceted cut jewelry gemstone 8x6 mm single 8x6mm ov
 Orange Mexican Potch OPAL jewel Loose ed cut jewelry 8x6 mm single 8x6mm ov