This is an old revision of the document!
Corning Community College
CSCS2320 Data Structures
~~TOC~~
This section will document any updates applied to the project since original release:
To continue getting acclimated to this whole 'node' thing, and to further familiarize ourselves with the project directory tree.
If you haven't done so yet, you absolutely, positively, MUST watch this video: http://www.youtube.com/watch?v=5VnDaHBi8dM
On Lab46, change into your node0 directory (I'll use ~/src/data/node0/ in my examples):
lab46:~$ cd src lab46:~/src$ cd data lab46:~/src/data$ cd node0 lab46:~/src/data/node0$
At this point you should be completed with the node0 project.
If you are done, and a make help shows an upgrade-node1 option being available, we can proceed with bootstrapping the node1 project:
lab46:~/src/data/node0$ make upgrade-node1 make[1]: Entering directory '/home/username/src/data/node0/src' make[2]: Entering directory '/home/username/src/data/node0/src/node' rm -f *.swp *.o core make[2]: Leaving directory '/home/username/src/data/node0/src/node' make[1]: Leaving directory '/home/username/src/data/node0/src' make[1]: Entering directory '/home/username/src/data/node0/testing' make[2]: Entering directory '/home/username/src/data/node0/testing/node' make[3]: Entering directory '/home/username/src/data/node0/testing/node/app' rm -f *.swp *.o ../../../bin/node-app-display node-app-test2 node-app-test core make[3]: Leaving directory '/home/username/src/data/node0/testing/node/app' make[2]: Leaving directory '/home/username/src/data/node0/testing/node' make[1]: Leaving directory '/home/username/src/data/node0/testing' Archiving the project ... Compressing the archive ... Setting Permissions ... You may now switch to the ../node1 directory lab46:~/src/data/node0$
As you can see from the last line: You may now switch to the ../node1 directory
So let's do it:
lab46:~/src/data/node0$ cd ../node1 lab46:~/src/data/node1$
Just as before, you'll see various files and directories located here (one regular file, Makefile, and 5 directories). The directory structure (note, not all these directories may yet be present, although a few more are here than were in the node0 project) for the project is as follows:
The project is driven by a fleet of optimized Makefiles, which will facilitate the compiling process for us.
Each Makefile plays a unique role (the closer the Makefile is to the source code, the more specialized it becomes).
The base-level Makefile is used to enact whole-project actions, such as initiating a compile, cleaning the project directory tree of compiled and object code, submitting projects, or applying bug-fixes or upgrading to other projects.
Running make help will give you a list of available options:
lab46:~/src/data/node1$ make help ****************[ Data Structures List Implementation ]***************** ** make - build everything (libs and testing) ** ** make debug - build everything with debug symbols ** ** ** ** make libs - build all supporting libraries ** ** make libs-debug - build all libraries with debug symbols ** ** make testing - build unit tests ** ** make testing-debug - build unit tests with debugging symbols ** ** ** ** make save - create a backup archive ** ** make submit - submit assignment (based on dirname) ** ** make update - check for and apply updates ** ** ** ** make clean - clean; remove all objects/compiled code ** ** make help - this information ** ************************************************************************ lab46:~/src/data/node1$
In general, you will likely make the most frequent use of these options:
Most of what you do will be some combination of those 3 options.
When you are done with the project and are ready to submit it, you simply run make submit:
lab46:~/src/data/node1$ make submit ...
Sometimes, a typo or other issue will be uncovered in the provided code you have. I will endeavor to release updates which will enable you to bring your code up-to-date with my copy.
When a new update is available, you will start seeing the following appear as you go about using make:
lab46:~/src/data/node1$ make ********************************************************* *** NEW UPDATE AVAILABLE: Type 'make update' to apply *** ********************************************************* ... lab46:~/src/data/node1$
When this occurs, you may want to perform a backup (and/or commit/push any changes to your repository)– certain files may be replaced, and you do not want to lose any modifications you have made:
lab46:~/src/data/node1$ make save Archiving the project ... Compressing the archive ... Setting Permissions ... lab46:~/src/data/node1$
Once you have done that, go ahead and apply the update (note this output is from the node0 project update, so you will not see the exact same output):
lab46:~/src/data/node1$ make update Update 1 COMMENCING Update 1 CHANGE SUMMARY: Fixed base and other Makefile typos Please reference errata section on project page for more information Update 1 COMPLETE Updated from revision 0 to revision 1 lab46:~/src/data/node1$
At this point your code is up to date (obviously the above output will reflect whatever the current revision is).
As the semester progresses, additional projects will be made available. When this occurs, you may notice new entries appear on the make help display. For example, as the deadline for the node1 project approaches, you will see the following appear:
... ** make update - check for and apply updates ** ** make upgrade-sll0 - upgrade to next project (sll0) ** ** ** ** make clean - clean; remove all objects/compiled code ** ...
By typing make upgrade-sll0, your current work on node1 will be copied into a new sll0 directory (peer to node1), and any new files will be copied in from its project directory in /var/public/data/fall2014/sll0/
As such, it is most advisable to have completed work on node1 before upgrading to the sll0 project, so any work you've done will be immediately available to build upon in the next project (the projects will be comprehensive to one another– sll0 will rely on work completed in node1, sll1 (the project after sll0) will rely on the work done in sll0, etc.).
In testing/node/app/, you will find a file called: node-app-display.c
Take a look at the code already there. Figure out what is going on, make sure you understand it. It builds a list of nodes based on user input.
If you look at the bottom of the program, you'll see the following comment:
// Display list from start to end
It is here I would like for you to add code that will display the contents of this arbitrary list of nodes, from beginning to end.
You've made changes to node-app-display.c, and are ready to see your results. What do we do?
First, change back to the base of the project:
lab46:~/src/data/node1/testing/node/app$ cd .. lab46:~/src/data/node1/testing/node$ cd .. lab46:~/src/data/node1/testing$ cd .. lab46:~/src/data/node1$
OR: You may want to have two terminals open- in one you are situated in ~/src/data/node1/testing/node/app/ editing away, and in the other you are in ~/src/data/node1/; this way you can take care of development activities AND easily check your results, without constantly navigating back and forth between various locations.
If you've already done this a few times, you may want to clean things out and do a fresh compile (never hurts, and might actually fix some problems):
lab46:~/src/data/node1$ make clean
Next, compile the whole project
lab46:~/src/data/node1$ make
Compiled executables go in the bin directory, so if we change into there and take a look around we see:
lab46:~/src/data/node1$ cd bin lab46:~/src/data/node1/bin$ ls node-app-display node-app-test node-app-test2 lab46:~/src/data/node1/bin$
To run node-app-display, we'd do the following (specify a relative path to the executable):
lab46:~/src/data/node1/bin$ ./node-app-display
The program will now run, and do whatever it was programmed to do.
For example, let's say we ran the program and put the values 6, 17, 23, 4, 56, and 2 in the list. Your completed program would look like this when run:
lab46:~/src/data/node1/bin$ ./node-app-display Enter a value (-1 to quit): 6 Enter a value (-1 to quit): 17 Enter a value (-1 to quit): 23 Enter a value (-1 to quit): 4 Enter a value (-1 to quit): 56 Enter a value (-1 to quit): 2 Enter a value (-1 to quit): -1 6 -> 17 -> 23 -> 4 -> 56 -> 2 -> NULL lab46:~/src/data/node1/bin$
NOTE: This is just example input. Not only should your program work with this, but lists of any length, containing any arrangement of valid values.
You are specifically responsible for creating this line of output:
6 -> 17 -> 23 -> 4 -> 56 -> 2 -> NULL
It needs to work for whatever values are put in the list (which can range from 0 to infinite values).
You need to display the node's contents, and separate that from the next bit of information with a space separated “→”, to help show the continuity of nodes we've joined together.
Finally, when you have exhausted your list, display a terminating “NULL” to visually signify the completion of the task.
To be successful in this project, the following criteria must be met: