Almost finished common.c,h for 0.29 (only sample support is missing)