Tag Archives: coursework

Coursework finished!

I've finally finished my A2 computing coursework, and I'll be handing in the writeup tomorrow! The program itself was finished (as far as the coursework was concerned; I've since added to it) a month or so ago, but the writeup itself has dragged on until now. I'll try and remember to release the source for the program in the hope somebody will find it useful, but I can't do that until it's all been marked and moderated, for fear of our Microsoft-centric exam board picking me up on it.

Unfortunately, my school have got worse as regards IT in that time. Previously, we only had a print quota system, where each user was limited to printing a certain number of pages — any more and the IT staff would have to extend their quota. Now, we've been told that we're not allowed to use school printers for our coursework, and instead have to print it out at home, as the school's running out of money. I find this a little far-fetched.

Regardless, I've spent half an hour this evening waiting for our slow colour printer to chug out the pages, and I'll be handing them the bill^W^W^Wit in first thing tomorrow, before browsing Wikipedia before lessons. Oh, wait, they've blocked it.

Auto-generated class hierarchy diagrams

Unfortunately still working on that coursework, I've just added support in the API documentation makefile to automatically generate a class hierarchy diagram using the GObject hierarchy file created by gtk-doc and marshalling it to GraphViz. It basically analyses the depth of each line in the hierarchy file and creates relationships in the dot file as appropriate. It doesn't sound complex, but it took a heck of a lot of fiddling to get automake happy with my syntax.

graph-build.stamp:
	echo "digraph class_hierarchy" > $(DOC_MODULE).dot
	echo "{" >> $(DOC_MODULE).dot
	(IFS=$$'\n'; \
	for current_line in `cat $(DOC_MODULE).hierarchy`; do \
		depth_colours=( red green blue yellow ); \
		depth=`echo $$current_line | grep -o "  " | wc -l | sed s/\ //g`; \
		echo "$$current_line [shape=box, color=$${depth_colours[$$depth]}]" >> $(DOC_MODULE).dot; \
		last_line[$$depth]=$$current_line; \
		if [ $$depth -gt 0 ]; then \
			echo "$${last_line[`expr $$depth - 1`]} -> $$current_line" >> $(DOC_MODULE).dot; \
		fi; \
	done)
	echo "}" >> $(DOC_MODULE).dot
	dot -Tpng $(DOC_MODULE).dot > $(DOC_MODULE).png
	touch graph-build.stamp