Sam (text editor)

Sam (text editor)

Infobox Software
name = Sam



caption =
collapsible =
author = Rob Pike
developer = Bell Labs
released = early 1980's
latest release version =
latest release date = July 4, 2003
latest preview version =
latest preview date =
frequently updated =
programming language = C
operating system = Unix, Plan 9, Win32
platform =
size =
language = English
status =
genre = Text editor
license = Lucent Public License
website = [http://swtch.com/plan9port/man/man1/sam.html Sam]

Sam is a multi-file text editor originally designed at Bell Labs by Rob Pike (with the help of Ken Thompson and other Unix developers) in the early 1980s for the Blit windowing terminal running on Unix, and later ported to other systems. It follows a classical modular Unix aesthetic; it is internally simple, its power leveraged by the composability of a small command language and extensibility through shell integration.

Sam is designed as two synchronous programs: a command interpreter with a language modeled after the UNIX editor, ed, linked to a mouse-oriented bitmap windowing interface called "samterm". The command interpreter may be independently run in a text-only mode similarly to ed, from a command line terminal; however, running samterm allows use of a Graphical User Interface with operation on text by point-and-click, with Smalltalk-80-style pop-up context menus for simple operations like cut and paste. Samterm provides, in addition to file windows, a persistent "command window" which accepts instructions from the command language; previous commands can be edited and resubmitted (a feature inherited from the DMD 5620 terminal interface). Most common editing operations are very quick and natural with the point-and-click interface. The two-process design also allows sam to access files on networked host systems through remote execution of the file-access process.

While sam's syntax is formally similar to ed's, ed's commands are line-oriented; sam's are "selection"-oriented, where the selection may be "swept" out by dragging the mouse cursor over a region of text, or by searching for a pattern match. Multi-line and sub-line patterns are as naturally handled by the command language as whole-line patterns are by ed's. This is enabled through a model called "structural regular expressions", which recursively apply regular-expression matching to obtain other (sub)selections within a given selection. In this way, sam's command set can be applied to substrings that are identified by arbitrarily complex context.

Sam also allows editing commands to be applied simultaneously to multiple files, which are selected by pattern matching on their names. A sequence of commands may be applied as a unit to each selection. Sam was also one of the first text editors to support "infinite" undo to revert any number of editing errors.

Sam is the preferred text editor of many eminent computer scientists; it replaced ed as Ken Thompson's favorite text editor, and he still uses it to this day. Sam is the text editor used by Bjarne Stroustrup [ [http://www.stifflog.com/2006/10/16/stiff-asks-great-programmers-answer/ Stifflog - Stiff asks, great programmers answer ] ] and Brian Kernighan [ [http://www.cs.cmu.edu/~mihaib/kernighan-interview/ An Interview with Brian Kernighan ] ] . Others, like Dennis Ritchie, have moved on to use acme instead. Sam vs. acme debates occur in the Plan 9 community (both are shipped with Plan 9) although both stem from a very similar aesthetic bias. (Both were written by Rob Pike.)

The latest incarnation of sam was written as part of the Plan 9 operating system, but there are Microsoft Windows and X Window System ports available.

See also

* acme — Rob Pike's other popular text editor and successor of sam.
* ed — The original Unix text editor by Ken Thompson
* Plan 9 from Bell Labs
* List of Unix programs

External links

*man|1|sam|Plan 9|screen editor with structural regular expressions
* [http://www.cs.bell-labs.com/sys/doc/sam/sam.pdf The text editor sam] Rob Pike's "The Text Editor Sam", from November 1987
* [http://doc.cat-v.org/bell_labs/structural_regexps/ Pike's essay on structural regular expressions]
* [http://plan9.bell-labs.com/sources/contrib/uriel/mirror/sam.tut.pdf Pike's tutorial for the sam command language]
* [http://plan9.bell-labs.com/netlib/research/sam.exe A Win32 version of sam]
* [http://plan9.bell-labs.com/plan9/addons.html Another Win32 version of sam (and other Plan 9 utilities)]
* [http://swtch.com/plan9port a new Unix version of sam]
* [http://plan9.bell-labs.com/sources/contrib/steve/doc/sam-refcard.pdf sam quick reference card]

Citations


Wikimedia Foundation. 2010.

Игры ⚽ Нужна курсовая?

Look at other dictionaries:

  • Ed (text editor) — ed is the standard text editor on the Unix operating system. ed was originally written by Ken Thompson and contains one of the first implementations of regular expressions. Prior to that implementation, the concept of regular expressions was only …   Wikipedia

  • Acme (text editor) — Infobox Software name = Acme logo = caption = A screenshot of Acme author = Rob Pike latest release version = latest preview version = operating system = genre = Text editor license = LPL website = [http://plan9.bell labs.com/sys/doc/acme.html… …   Wikipedia

  • QED (text editor) — QED is a line oriented computer text editor that was designed by Butler Lampson and L. Peter Deutsch for the Berkeley Timesharing System running on the SDS 940. It was implemented by L. Peter Deutsch and Dana Angluin between 1965 and 1966. [cite… …   Wikipedia

  • Sam — may be:;Used as a name: * Male given names (U.S. Census Bureau statistics 1990): [U.S. Census Bureau [http://www.census.gov/genealogy/names/dist.male.first U.S. List of male names] , 1990] **Samuel (0.306%) **Sam (0.092%) **Sammy (0.025%)… …   Wikipedia

  • Text user interface — TUI short for: Text User Interface or Textual User Interface (and sometimes Terminal User Interface ), is a retronym that was coined sometime after the invention of graphical user interfaces, to distinguish them from text based user interfaces.… …   Wikipedia

  • Sam Ragan — (December 31, 1915 1996) was a favorite son of North Carolina whose career was spent as a journalist, author, poet and champion of the arts. He was born in Berea, North Carolina and was the son of William Samuel Ragan and Emma Clare (Long) Ragan …   Wikipedia

  • Sam & Max Save the World — Promotional artwork for Sam Max Save the World …   Wikipedia

  • Sam Glanzman — Sam J. Glanzman (born 1924) is an American comic book artist, best known for his Charlton Comics series Hercules , about the mythological Greek demigod, his biographical war stories about his service aboard the U.S.S.Stevens for DC Comics and… …   Wikipedia

  • Sam Raimi — Infobox Actor imagesize = caption = Raimi at the premiere of Spider Man 3 , April 2007 birthdate = birth date and age|1959|10|23 birthplace = Royal Oak, Michigan, U.S. birthname = Samuel Marshall Raimi othername = Celia Abrams R.O.C. Sandstorm… …   Wikipedia

  • List of text editors — The following is a list of text editors. For a list of outliners, see that article s external links. Graphical and Text User Interface The following editors can either be used with a Graphical user interface or a Text user interface. System… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”