We have CiSE macros corresponds to c preprocessor directives, e.g. .define, .include, or .error. They expand into #define, #include, and #error, respectively. These macros can appear in stub files, and we delegate its expansion to CiSE renderers.
However, conditional directives such as .if or .when require special treatment if they appear at the toplevel of stub files---the condition may affect multiple parts of the code (e.g. declaration, definition, and initialization) so that the simple CiSE expansion isn't enough. So gauche.cgen.stub intercepts these forms when they appear in toplevel.
However, it is confusing for users, since these directives appear inside CiSE forms are handled by CiSE expander. It is not immediately obvious that the apparently same forms can be handled differently.
Not sure what's the best way to address this yet, but it'll be nicer if we can consolidate the handler definitions of those toplevel cpp conditions.
We have CiSE macros corresponds to c preprocessor directives, e.g.
.define
,.include
, or.error
. They expand into#define
,#include
, and#error
, respectively. These macros can appear in stub files, and we delegate its expansion to CiSE renderers.However, conditional directives such as
.if
or.when
require special treatment if they appear at the toplevel of stub files---the condition may affect multiple parts of the code (e.g. declaration, definition, and initialization) so that the simple CiSE expansion isn't enough. Sogauche.cgen.stub
intercepts these forms when they appear in toplevel.However, it is confusing for users, since these directives appear inside CiSE forms are handled by CiSE expander. It is not immediately obvious that the apparently same forms can be handled differently.
Not sure what's the best way to address this yet, but it'll be nicer if we can consolidate the handler definitions of those toplevel cpp conditions.