Finish C version of DOT

- Finish DOT related functions
- Change comments and definition of some DOT related functions
- Cosmetic changes