=====BACKGROUND===== Continuing with our single-linked list, this week we are expanding our library with 5 new functions for list processing. =====SPECIFICATIONS===== After you ''make upgrade-sll1'', you will find five new **.c** files in the ''/sll1/src/list/'' directory: * append.c (use insert for reference) * cp.c (will have to make use of mklist and maybe cpnode()) * displayb.c (display but backwards) * search.c (similar logic to getpos()) * compare.c (use strcmp() for reference) //It is recommended to work on them in that order.// However, unlike sll0, unit tests for these functions do not rely on each other so the order in which you complete them are up to you. This is just the recommended path. Each file contains its corresponding functions. Another thing to note is that the sll1 project files can only compile with version 9 of gcc. If you are not on lab46 and the project fails to build the library or unit tests, this may be because you are using a newer or older version of gcc. You can use the same version of gcc as lab46 by using the following commands (assuming you are using a Raspberry Pi with it's default OS) in this link: https://gist.github.com/sol-prog/95e4e7e3674ac819179acf33172de8a9 *Our task is to ask questions on Discord or in class and document our findings on this wiki page collaboratively, regarding the functionality of this project. *For anybody interested in editing the wiki page, here is the dokuwiki user guide: https://www.dokuwiki.org/wiki:syntax#basic_text_formatting -Ash =====PROGRAM===== We will be creating more functions for our lists, similar to what we've done for the previous two projects. The functions are as follows: displayb(): displays the contents of a list backwards. append(): Adds a node into a list after the specified place. For example, if our list is (4)->(6)->(8)->NULL, and we append 7 into (6), then our list will be (4)->(6)->(7)->(8)->NULL. Note that append() will not be a simple modification of the insert() function from sll0, it must handle special cases where the user wants to insert a node on a NULL position. compare(): Will read two given lists. At the first node of difference the function will output a < or > sign depending on which node held a higher value. cp(): Will create a copy of a list search(): Will be given a value and a list, after which the function will search through the list until it finds the first node containing the given value. The function will then return a pointer to the node of matching value. =====OUTPUT SPECIFICATIONS===== Besides displayb(), nothing will be displayed from these functions individually. However, the return values and what they do to the list are specified above in the program section. Compare will return a value, uc, specified within the included header files. The return value should be equal to the total amount of differences in the lists. The pos value, if **not null**, should be the position of the first difference in the two lists. For example, if you have two lists with a difference at position 3, 7, and 14, the function should return the value of all of the COMP_L(1 or 2 goes here)_(GREATER or LESS) combined. If pos is null, it should not change from null. {{:notes:data:fall2022:projects:screen_shot_2022-09-28_at_9.31.07_pm.png?direct&400|}} **DEBUG**: If you run into an issue that requires in-depth debugging, consider using gdb. To run gdb type gdb bin/(file to debug), then type run. If you need to do further debugging you can make use of list (lists lines) and break # for the line you want to set a breakpoint on. You can use display to show the values of variables, and you can make use of N (next), S(step), and C(continue-resume the execution to breakpoint). =====UNIT TESTS===== Unit Tests will consist of 58 different tests as to which you are provided to check the functionality of your code. For more specific outputs, you can check the unit tests inside /unit/list/. Remember that the code for these are provided to you and free for you to modify. If you need to add stuff to these unit tests to help you debug your code feel free, just make sure to comment what you added and remove it later once you are done. Including examples of successful runs of these tests would make this page very large, so if you would like examples of successful tests feel free to ask on discord. Also note that some unit tests for sll1 make use of certain functions made in previous projects. So if some of the functions from sll0 aren’t up to par, it’s likely to cause problems trying to pass the unit tests for sll1. Some might find their **unit-compare** test is failing for test #8, where **pos** is checked, but not for test #13 and test #14, where **pos** is also checked. This is likely due to only changing **pos** when CMP_EQUALITY is not the case. As a solution, consider always changing **pos** to reflect the position being checked even if both lists are equal.