add maskshapes C code (mistakenly left out)