CMSI 284 Computer System Organization/Systems Programming, Spring 2020
Finally, the moment many of you have been waiting for—consolidating the functions written for “Oh Say Can You C” into a single file, to be shared with all of the programs that you wrote!
There shouldn’t be any new code to write for this section; just some rearranging (and a lot of deleting!):
- Move your
split_string_at_index
implementation to string-plus.c (joiningis_non_negative_numeral
as an addition to our own collection of reusable string functions) - Move all chord-related implementations to notes.c
- All of your programs should be left with just the
main
and any helper functions written specifically for those programs (i.e., not needed by the chord-related “public” functions)
The notes.h file has been revised in this assignment to accommodate this move, so keep that untouched. In addition, a string-plus.h file has been created to accompany the new string-plus.c file.
After these changes, your split-string-at-index.c program should now compile this way:
gcc string-plus.c split-string-at-index.c
All chord-related programs should now compile this way:
gcc string-plus.c notes.c <file-with-main-function.c>
The resulting a.out’s should then behave exactly like your current implementations.
Note that this assignment is solely about correct code consolidation. If your implementations have bugs, then those bugs will not result in deductions in this assignment. You are being graded on correct restructuring for this one; the previous assignment covers actual functionality.
This portion of the assignment is scored according to outcomes 3a, 4a, and 4b in the syllabus. For this particular assignment, graded categories are as follows:
Category | Points | Outcomes |
---|---|---|
Consolidated code compiles and runs as specified | 6 | 3a, 4a |
All shared/“public” functions are defined only once across all files | 4 | 4b |
Total | 10 |
Note that inability to compile and run to begin with will negatively affect the correctness of program output and proper handling of invalid user input.