Rewrite undefined.h

Rename NULL_OR_UNDEFINED to isset and evaluate ptr only once
Add isdef macro