Repository navigation
Some notes for developers new to Sumatra
So you want to add code to Sumatra but don't know where to start?
To set expectation: there is no documentation to guide you and there will never be.
There's code. We like to think that we pick sensible names for functions and that we have a reasonable amount of comments. But Sumatra is a large program, even I don't remember 80% of the code at any given time. You have to figure things out. Use search function in your editor to find promising parts of the code and a debugger to set breakpoints and trace the code.
There are few high-level things to know.
We use win32 calls directly, with no additional wrappers (other than those that we wrote). You need to know how win32 works, all the apis are documented on msdn (e.g. CreateWindowEx)
If you need win32 refresher:
- http://zetcode.com/gui/winapi/
- http://www.winprog.org/tutorial/
- http://www.relisoft.com/win32/
- http://www.catch22.net/tuts
We use C++, but in a very conservative way (the opposite of e.g. boost).
We don't use STL. We have our own data structures for basics like strings (StrUtil.h), vectors (Vec.h), hash-tables (Dict.h) etc.
We don't use exceptions.
Read https://github.com/sumatrapdfreader/sumatrapdf/blob/master/docs/codingstyle.txt and in general follow the style of existing code.
We care about security. One of the things we're fanatical about is eliminating as much as possible unsafe ways of operating on memory, like using strcpy() or strcat() functions.
Code that generates compilation warnings is not acceptable. We use a higher than default warning level (/W4) and we use /WX to treat warnings as errors. That's by design, to keep code quality high. That being said, that only applies to sumatra code (under src), we don't modify third-party code (under ext).