Look at the source codes, it's really simple.