Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

everything is really good explain about what to do hope you can help me Texteditor For the following exercises make sure to make enough comments

everything is really good explain about what to do
hope you can help me
image text in transcribed
image text in transcribed
image text in transcribed
Texteditor For the following exercises make sure to make enough comments to explain the important steps of the program that you will programm. Exercise 1 Reading in the user commands Our simple editor is to be controlled via standard input commands. (An example of such an editor is the Unix editor vi). To do this, write a function that reads and checks the next input command and returns the command data as a result. The following commands are intended for oureditor and must be read in and rexcognized: d Delete rowcrow> i/ Add a rowcrow> with the Text in por prow> Print the whole text or the row on the screen 9 Exit editor (quit) Reset data (reset) Implement a function void neil command (char cond_that, int "line_1. char texD): that reads in a command row using fets and returns the command letter, the row specification and the text via the parameters. If there is no row specification or text in a command, zero or an empty string is returned. You can assume that only correct inputs have been made, that means you do not have to check whether the command structure is correct. Examples of commands: The commands should look like this (order is not important for the examples here): d34 11/Hallo Welt! p1 9 r Aufgabe 2 Functionality of the text editor Create and initialize the global data structure A global two-dimensional array of characters is to be created Cent_field). The number of rows LINE_COUNT and characters per line LINE LENGTI are to be defined as preprocessor constants with value 1000 and 256 respectively. Furthermore, you need a variable maltene that stores the number of written lines; this initially has the value 0. The use of muling allows us, for output on the screen (Kommando p) to output the text only up to the last described row. Auxiliary functions for strings Implement the following auxiliary functions for inserting, deleting and copying rows: void copy_line (int to, int from Copies the text of the row from into the line to. void add_line (int line_no): Adds an empty row. To do this, all lines from line to the end of the text Gar_line_) must first be copied down one row at a time. void delete_line (int line_no): To do this, the row line, nor up to the end of the text (nut lineno) must each be copied one row upwards. In addition, an empty row must be inserted at the end of the text. Hints: For the last two functions, the global variahlee_len mest also be updated Input and output Implement the following two output functions: void printet (void): Outputs the entire text on the screen. void print_line (int line_no). Outputs the row line_ro on the screen. In the output, the row number should always be written in front of each row (row number with: positions) Example: aaa 2 bbb CCC Editor functions Now implement the following functions of the editor: void insent Cintlicachur lex): Inserts the text in the row To do this, use the above-mentioned auxiliary functions from the previous task void dolor in line no) Deletes the rowe To do this, use the above-mentioned auxiliary functions from the sub functions module. Global.control Write the main function, which first initialises text_field and then carries out the user interaction. In essence, the main function consists of an endless loop that reads in a command via and calls the corresponding editor function from the lite functie module depending on the command letter returned. The programme is terminated with the commande The variables cal_field and declared globally in main.h are to be defined and initialised in the module main Hints: You can implement the task as an extension of task . Document your programme in detail, ie the purpose of each global variable and each function must be explained . You may use the string library strong for the implementation . Please upload all files for this task (only cand.h files)! Example of an interaction sequence Inpur: 11/Hello 12/World! 13/Programming 14/in i5/C 16/is 17/great! i7/really P d7 P 9 Output: 1 Hello 2 World! 3 Programming 4 in 5 C 6 is 7 great! 1 Hello 2 World! 3 Programming 5 C 6 is 7 really 8 great! 1 Hello 2 World! 3 Programming 4 in 5 C 7 great

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

=+3. Are any provisions in this form potentially unclear?

Answered: 1 week ago

Question

2. Identify issues/causes for the apparent conflict.

Answered: 1 week ago