Assignment 3 - Bits and Character Encodings
Due: Thursday, September 28, at 10:00pm
Starter code: bits-package.tar
Upload solutions via Moodle as: bits.tar
(see below)
Goals
This assignment is designed to help you with the following:
- practice with bit operations (
~
,|
,&
,^
,<<
,>>
) in C - dig into the details of the UTF-8 character encoding
- practice with writing your own tests
Rubric
This assignment is worth a total of 15 points. They are allocated as follows:
1 - author name (and collaborators) in a comment at the top of bits.c
2 - to_upper correctness
2 - to_lower correctness
3 - middle_bits correctness
3 - to_utf8 correctness
2 - from_utf8 correctness
2 - code quality
Note that “correctness” in this rubric includes “meets all documented specifications”. So, for example, if you don’t follow the requirement that to_upper
may only use bitwise operations on the char
s in s
, as described in the documentation for to_upper
, that will detract from your “to_upper
correctness” score.
Your assignment
In this assignment, your job is to implement the five functions described in bits.h
; all of your coding will be done in bits.c
.
The only file you are required to submit is bits.c
. You may include your own main.c
and Makefile
(starter versions of which are included in bits-package.tar
), but we will use our own main.c
and Makefile
to do our testing and grading.
Keep the following in mind as you do your work:
- You should only write code in
bits.c
(the starter version is provided for you). - Do not change
bits.h
. - You will submit your file(s) as
bits.tar
via Moodle.
Getting started
Download the file bits-package.tar
and extract it while ssh’ed into mantis
. Then, take a look at the readme.txt
file to get an idea for how to build and/or test your code.
Finally, read the descriptions of the functions in bits.h
. After that, you’re ready to start!
Handing it in
You should build a bits.tar
file as your submission. This is provided for you using the make build-tar
option in the Makefile:
build-tar: bits
tar cf bits.tar bits.c
If you want to add extra files in your submission (main.c
and Makefile
, as mentioned above), you can change the Makefile as follows:
build-tar: bits
tar cf bits.tar bits.c main.c Makefile
To submit this assignment, you should upload your bits.tar
to the Bits and Character Encoding assignment on Moodle.