c-hash-eval(3)c-hash-eval - Evaluate C/C++ #defines
c-hash-undo - Remove C/C++ #define evaluation
c-hash-define - Set a C/C++ #define
c-hash-undef - Unset a C/C++ #define
n c-hash-eval
c-hash-undo
c-hash-define "variable" "value"
c-hash-undef "variable"
c-hash-eval evaluates C/C++ '#' lines, hiding sections of code which have been 'hashed' out. c-hash-eval evaluates the following '#' lines:-
#define <variable> ....
#ifdef <variable>
#if ...
#else
#endif
For #defines c-hash-eval creates a user variable "%chd-<variable>", setting it to the value found. For #ifdef a simple check for the existence of variable "%chd-<variable>" is made. If defined then code between the #ifdef and either its matching #else or #endif is displayed and code between the #else and #endif is hidden. If it is not defined then the reverse happens.
The state of #if's are evaluated using calc(3), the following code is then displayed as for #ifdef.
Code is hidden by setting the $line-scheme(5) to a color similar to the back-ground. If an argument is given to the command the code is also narrowed out using narrow-buffer(2).
c-hash-undo undoes the effect of c-hash-eval by restores hidden code.
c-hash-define and c-hash-undef can be used to manually set and unset #define variables.
c-hash-eval, c-hash-undo, c-hash-define and c-hash-undef are macros defined in cmacros.emf.
Executing c-hash-eval in a project header file (h file) which contains all used #define definitions will set up all #define variables ready for the main C files.
(c) Copyright JASSPA 2025
Last Modified: 2022/06/12
Generated On: 2025/09/29