--- /dev/null
+#include <stdio.h>
+
+#assign ()(Number)(0x2d9)
+
+#assign ()(NAME)(ONE)
+#assign ()[ NAME() ](1)
+
+#undef NAME
+#define NAME TwentySeven
+#assign ()[NAME](
+ Number / 27
+)
+
+int main(void){
+#if 1
+ printf("forty-two: %x\n" ,Number);
+ printf("ONE: %x\n" ,ONE);
+ printf("TwentySeven: %x\n" ,TwentySeven);
+#endif
+ printf("And thus begins the dance.\n");
+ return 0;
+}
#include <stdio.h>
-#assign (Number)(0x2d9)
+#assign ()(Number)(0x2d9)
-#assign (NAME)(ONE)
-#assign [NAME]( 1 )
+#assign ()(NAME)(ONE)
+#assign ()[NAME]( 1 )
#undef NAME
#define NAME TwentySeven
-#assign [NAME](
+#assign ()[NAME](
Number / 27
)
/*--------------------------------------------------------------------------------
RT extention, directive `#assign`
- cmd ::= "#assign" name body ;
-
- name ::= clause ;
- body ::= clause ;
-
- clause ::= "(" literal? ")" | "[" expr? "]" ;
-
- literal ::= ; sequence parsed into tokens
- expr ::= ; sequence parsed into tokens with recursive expansion of each token
-
- ; white space, including new lines, is ignored.
-
-will be deprecate `#macro` and modify `#assign` like this:
-
cmd ::= "#assign" params name body ;
params ::= "(" param_list? ")" ;
_cpp_create_assign(pfile);
-#if 0
-
-
- cpp_hashnode *node = lex_macro_node(pfile, true);
-
- if(node)
- {
- /* If we have been requested to expand comments into macros,
- then re-enable saving of comments. */
- pfile->state.save_comments =
- ! CPP_OPTION (pfile, discard_comments_in_macro_exp);
-
- if(pfile->cb.before_define)
- pfile->cb.before_define (pfile);
-
- if( _cpp_create_assign(pfile, node) )
- if (pfile->cb.define)
- pfile->cb.define (pfile, pfile->directive_line, node);
-
- node->flags &= ~NODE_USED;
- }
-#endif
-
}
unsigned int param_count;
bool is_variadic;
- if(!make_parameter_list(pfile ,¶ms ,¶m_count ,&is_variadic)
+ if (!make_parameter_list(pfile, ¶ms, ¶m_count, &is_variadic)) {
return false;
-
+ }
/* Parse name clause into a temporary macro.
,_cpp_reserve_room( pfile, 0, sizeof(cpp_macro) )
);
name_macro->variadic = is_variadic;
- name_macro->paramc = param_count;
name_macro->parm.params = params;
+ name_macro->paramc = param_count;
name_macro->fun_like = true;
unsigned int num_extra_tokens = 0;
,body_macro->exp.tokens
,sizeof(cpp_token) * body_macro->count
);
+ assign_macro->variadic = body_macro->variadic;
+ assign_macro->parm.params = body_macro->parm.params;
+ assign_macro->paramc = body_macro->paramc;
+ assign_macro->fun_like = true;
+
/* Install the assign macro under name_node.
,NODE_NAME(name_node)
);
#endif
+
return true;
}
+
+
+
+
+
+
+
+
+