Implement a doubly linked list in C. See the header file doubll.h for specifics.
Implement the code in a file called "doubll.c".
In the gradebot repo put your file "doubll.c" in a folder called "task1". Gradebot will automatically use "doubll.h" and a Makefile in that same folder.
When a function is provided with a pointer to an item by default it is not checked if that item belongs in fact to that list. Only if provided with a precompiler define called "CHECK_LIST" the program should do the (expensive) search if item is in that list.
Note that all C programs of this homework use the C standard C89. Also no warnings are allowed. Compilation is done using:
gcc -Wpedantic -Wall -Wextra -Werror -std=c89
Also, in doubll.c at least every 4th line has to be a comment! The comments have to be in English and meaningful (will be checked by hand by the TAs).
Furthermore, your doubll.c may not have more than 250 non-blank lines (Don't worry - this is plenty). New Notes Feb 28:
The last test of Task 1 is about memory leaks. Since gradebot cannot really tell if there is a memory leak in your program the TAs will go thorugh your submission after gradebot is closed to see if there is a memory leak. So you score might go down.
doubll.h reads: "pointer to the data (owned by the list item)" and also "The data is copied.". That means that you cannot just copy the pointer you get in insert_list - you have to make a copy of the data to your own pointer! This is because you cannot be sure of the scope of the pointer you are getting.
It is very good practice to use re-use code! For example when you do CHECK_LIST you have to search the list in insert_list and remove_item. Write a function for this search and then use it in those two methods. Also it is a very good idea to make use of remove_item in purge_list. You should also consider using insert_list in reverse_list!
Task 2: Libraries
All work is done in the folder "task2".
Assume that there is a file called test.c with a main function in it. The doubll.h will be copied (by the gradebot) to the folder task2 and also your file doubll.c will be copied here from Task 1.
Task 2.1: Static library 15%
Write a script called test_static.sh that, in the first step, compiles a static link library from the files of Task 1 (use the command "ar"). In the second step the script should compile the program test.c as an object file.
In the third step link that object file with your static library to create an executable called "static_test" (use the command "ld").
Task 2.2: Dynamic link library 15%
Write a script called test_dynamic.sh that, in the first step, compiles a dynamic link library from the files of Task 1. In the second step the script should compile the program test.c as output "dynamic_test" using the dynamic link library. Be sure to set the rpath correctly to the folder ".". The library has to be called "libdoubll.so".
Notes
You can check in a file called test.c, but it will be overwritten by our test.c file.
For the static library you have to call ld by hand. There will be lots of libraries that you need to add. You can check which libraries gcc would use by invoking gcc with the option "-v". Gradebot is using Ubuntu 14.04. This string might appear several times : "/usr/lib/gcc/x86_64-linux-gnu/4.8/".
Remember: This homework is due on Monday, March 7, 23:59:59. Gradebot will be open three more days! If you don't want to use a slip day (or worse loose 25% or more of your score) do not commit after the due date! It is your own fault if you accidentally commit (again) after the due date.
The scripts that you write should only compile the code - they should not run the executables (that is done by the gradebot).