, , ,

[SOLVED] Cmsc216 project 3

$25

File Name: Cmsc216_project_3.zip
File Size: 160.14 KB

Categories: , , , Tags: , , ,
5/5 - (1 vote)

For this project you will write a text-based user interface to the document manager system you implemented in project #2. In addition, you will add some extra functionality to your system. There are two deadlines associated with the project. Those deadlines are:Remember that you need to satisfy the good faith attempt for every project in order to pass the class (see syllabus). The good faith attempt information for this project (e.g., requirements and deadline) will be posted on the class web page later on.Make sure you read the class syllabus. Some students are not clear about the rules associated with this course.To practice text parsing and file I/O.To obtain the project files copy the folder project3 available in the 216 public directory to your 216 directory. Keep in mind that the Makefile and document.h files for this project are different from the ones used in project2.After the late deadline for project2 you will be able to see results for release/secret tests in the submit server. ATA during office hours (and only during office hours) will be able to show you any test and why the test failed (if that is the case). You are responsible for fixing your code before submitting this project. Keep in mind that if you passed all the project2 tests that does not mean you don’t have bugs. In this project we will be testing your document functions again so it is in your best interest to test your code thoroughly.You need to add two functions to your document manager system. Remember to use the provided document.h file (not the one from project #2).Your program will be in a file named user_interface.c. A user calls your program in one of two ways (assuming the executable is named user interface):user_interface user_interface filenameThe program should have zero or one arguments (in addition to the executable name) on the command line; if there are more the program prints the following usage message to standard error, and exits with exit code EX_USAGE[1].Usage: user_interfaceUsage: user_interface <filename>If there is no file specified when the program is started, the program should read its data from standard input. The program will display a prompt (represented by >) after which commands will be entered. If a file is named, however, the program reads its data from that file; in this case no prompt will be used.In case of an error opening the file your program should print (to standard error) the message ”FILENAME cannot be opened.” where FILENAME represents the file name. The program will then exit with the exit code EX_OSERR.Upon starting execution your program should initialize a single document with the name ”main document”, and perform operations on that document as instructed by the commands the program reads.Make sure you name the file with your program user interface.c. This program will include document.h (the version provided for this project and not the one from project #2).An input file (or input coming from standard input) contains multiple lines with commands, and the commands are executed in the order they are encountered. No valid line can be more than 1024 characters (including the newline character). A valid line takes one of three forms:# creating a paragraph and inserting some lines add_paragraph_after 0add_line_after 1 0 *first line of the documentadd_line_after 1 1 *second line of the document# let’s print it print_document quitValid commands must follow one of the formats specified in Section 3.4 below.If your program encounters an invalid line it should print the message ”Invalid Command” to the standard output. Make sure you print to the standard output and not to the standard error. An invalid line includes not only an invalid command, but a command without the expected values. For example, the add paragraph after command requires an integer. If the value provided is not an integer the command will be considered invalid. Notice the program will not end when an invalid command is provided.Unless output is associated with a command the successful execution of a command will not generate any confirmation message (similar to successful execution of commands in Unix). If a command cannot be succesfully executed the message ”COMMAND NAME failed”, where COMMAND NAME represents the command, should be printed to standard output (and not to the standard error).Any number of spaces can appear between the different elements of a command, and before and after a command. A blank line (as defined above) and a comment will be ignored (no processing). When a comment or blank line is provided, and standard input is being used, a new prompt will be generated.The quit and exit commands will end/terminate the command processor. The command processor will also terminate when end of file is seen. The commands quit or exit need not be present in a file.This command will add a paragraph to the document. The ”Invalid Command” message will be generated when:If the command cannot be successfully executed the message ”add paragraph after failed” will be generated.This command will add a line after the line with the specified line number. The line to add will appear after the * character. The ”Invalid Command” message will be generated when:If the command cannot be successfully executed the message ”add line after failed” will be generated.This command will print the document information (print document function output). The ”Invalid Command” message will be generated if any data appears after print document.This command will exit the user interface. The ”Invalid Command” message will be generated when any data appears after quit.This command will exit the user interface. The ”Invalid Command” message will be generated when any data appears after exit.This command will append a line to the specified paragraph. The line to add will appear after the * character. The ”Invalid Command” message will be generated when:If the command cannot be successfully executed the message ”append line failed” will be generated.This command will remove the specified line from the paragraph. The ”Invalid Command” message will be generated when:If the command cannot be successfully executed the message ”remove line failed” will be generated.This command will load the specified file into the current document. The ”Invalid Command” message will be generated when:If the command cannot be successfully executed the message ”load file failed” will be generated.This command will replace the string ”TARGET” with ”REPLACEMENT”. The ”Invalid Command” message will be generated when:For this command you can assume that if ”TARGET” and ”REPLACEMENT” are present there is no additional data after ”REPLACEMENT”.If the command cannot be successfully executed the message ”replace text failed” will be generated.This command will highlight the string ”TARGET”. The ”Invalid Command” message will be generated when ”TARGET” is missing.For this command you can assume that if ”TARGET” is present there is no additional data after it. Notice no fail message is associated with this command; either the text was highlighted or not.This command will remove the string ”TARGET”. The ”Invalid Command” message will be generated when ”TARGET” is missing.For this command you can assume that if ”TARGET” is present there is no additional data after it. Notice no fail message is associated with this command; either a deletion took place or not.This command will save the curent document to the specified file. The ”Invalid Command” message will be generated when:If the command cannot be successfully executed the message ”save document failed” will be generated.This command will reset the curent document. The ”Invalid Command” message will be generated when any data appears after reset document. Notice no fail message will be associated with reset document.[,],*,^,-,$,?See your lab TA or instructor if you have doubts as to what represents a regular expression.valgrind user interface public01.in The following is incorrect: valgrind public01http://www.cs.umd.edu/~nelson/classes/resources/cdebugging/cmistakes/http://www.cs.umd.edu/~nelson/classes/resources/cdebugging/[1] This and the other exit codes beginning with EX mentioned here are all obtained by including <sysexits.h> in your C program file.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] Cmsc216 project 3
$25