Convert frame.cpp to C