Text Editors
Text Editors
Sachin Veerashetty
DEFINITION OF TEXT EDITOR:A text editor is a type of program used for editing plain text files. Often provided with operating systems.
2.
3. 4. 5.
Line Editors Stream Editor Screen Editor Word Processor Structure Editor
LINE EDITOR
The line is designated positionally, by specifying the serial number in the text. Edit characters like end of line is maintained internally.
Eg-ed is a line editor for the Unix operating system Advantage: Simplicity Disadvantage: Does not display the text in the manner it would appear if printed
CONTD
Line editor is one of the simplest type of editor which uses a buffer to store information: It operates in command mode. User give the command to the editor for any operation. Editor will respond this command. Buffer is in the main memory. That is set aside to store the information which is entered from the keyboard.
CONTD
Merits Simple for read and write. Simple in design and implementation Command and responses are interleaved. Demerits Not user friendly Context of the text is not displayed. Only single line
STREAM EDITOR
Views the entire text as a stream of characters. This permits edit operations to cross line boundaries. Support character,line and context oriented commands based on the current editing context indicated by the position of a text pointer.
SCREEN EDITOR
A screen editor uses the what you see is what you get principle in editor design. It displays a screen full of text at a time. User can move the cursor over the screen, position it on a point, where the editing process is to be performed. Effect of edit operation can be seen on the screen. Advantage: Useful while formatting the text to produce printed documents.
WORD PROCESSORS
Document editors with additional features to produce well formatted hard copy output. Features
Commands
e.g. Wordstar
STRUCTURE EDITORS
Incorporates an awareness of the structure of a document. Structure is specified by the user while creating or modifying the document. Editing requirements are specified using the structure. A special class of structure editors , called syntax directed editors, are used in programming environments.
TEXT EDITORS
Advantages
Text Editor
Simple and places less demands on system. Provides greater control over the application
Disadvantages
Difficult to Visualise output(e.g: to preview a webpage you have to have a suitable browser) Dependant on programming or text-based commands knowledge
EDITING PROCESS
Document-editing process is an interactive user computer dialogue designed to accomplish 4 tasks.
1.
2.
3.
4.
Select the part of the target document to be viewed and manipulated. Determine how to format this view on-line & how to display it. Specify & execute operations that modify the target document. Update the view appropriately.
Travelling
Moving through the editing document to a new position in the text. Done explicitly by the user It specifies where the area of interest is; Adding new text Modifying the existing text Erasing the content Formatting the existing data Viewing & formatting the text desired for the user. Abstract view. Display component maps this abstract view into the physical characteristics of the display device being used & determines where a particular text may appear on user screen.
Editing
EDITOR STRUCTURE
Editing component Editing buffer Editing Filter Main memory Viewing filter
Viewing component
Viewing buffer
Paging routines
Output devices
Display component
File system
It accepts input from the userss input device & analyses the tokens and syntactic structure of the commands. It then produce an intermediate representation of the desired editing operations. Interpreter then decodes this intermediate representation. Start of the area to be edited is determined by the current editing pointer maintained by the editing manager. Current editing pointer can be set or reset explicitly by the user with traveling commands such as next paragraph, or implicitly as a side effect of the previous edit operation as delete paragraph. Setting of the current editing and viewing pointers. Invoked explicitly by the user or implicitly by editing operations.
Editing manager
Traveling manager
Viewing Manager
Start of the area to be viewed is determined by current viewing pointer. It is maintained by viewing manager, which is collection of modules responsible for determining the next view. Current viewing pointer can be set or reset explicitly by the user or implicitly by the system as a result of the previous edit operation.
Makes provision for appropriate display of text. Its function may be combined with viewing manager. To update display, viewing manager invokes the viewing filter. It filters the document to generate a new buffer with content for viewing. Has the content for viewing. This content is passed to the viewing manager, which produces the display by mapping the buffers content to a window.
Display Manager
Viewing Filter
Viewing Buffer
Editing filter
Filtering is the process of selection of contiguous characters beginning from the current position. When the user issues an edit command, the editing manager invokes the editing filter. This filter filters the document to generate a new buffer with content for editing. As editing is performed, editing filter reflects the changes into the internal form & updates the contents of the viewing buffer inorder to make the changes visible on the screen. Support an undo function by storing a stack of previous views. Editing filter creates an editing buffer that contains the portion of document selected by the user, for editing.
Editing buffer
DEBUGGER
points inspecting the values of program variables modifying the values of program variables evaluating arbitrary expressions calling arbitrary routines
Debuggers allow
Controlled
stepping through program Runtime examination of variables Interactive analysis of program No recompile needed each time a possible bug ruled out.
breakpoint is a pseudo instruction that the user insert at any place into the program at debug time. execution is controlled by the debugger and the debugger will interpret the breakpoints. When execution crosses a breakpoint, the debugger will pause program execution The user can then
inspect variables set or clear breakpoints continue execution
Tracing
Used to track the flow of execution logic & data modifications. Control flow can be traced at different levels. Ie; procedure, branch, individual instruction
Trace back
Show the path by which the current statement was reached. Shows which statements have modified a given variable or parameter.
monitors
Provides
Source
Helps
code.
Debugging
It is the process of isolating & correcting the causes of the known errors in a program Debug monitors provides the following facilities for debugging
1. 2.
3. 4. 5.
Setting break points in the program Initiating a debug conversation when control reaches a break point. Displaying values of variables. Assigning new values to variables. Testing user defined programs.
STEPS IN DEBUGGING
1.
2. 3.
User activates the debug monitor & indicates the name of program to be debugged. Debug monitor opens:
1. 2.
Compiled code Debug information file of the program List of break points Action to be performed at break points Statement number Debug action
4.
5.
Steps 4 & 5 are repeated until the end of the debug session.
6.
7.
Program executes up to a break point, and then a software interrupt is generated & control is given to the debug monitor, then consults debug table and performs the debug actions specified for the break point. Control returns to the program