begain integration code from perl parsing script into C code