run_directive (pfile, T_DEFINE, buf, count);
}
+
+/* Use to build macros to be run through cpp_define() as
+ described above.
+ Example: cpp_define_formatted (pfile, "MACRO=%d", value); */
+
+void
+cpp_define_formatted (cpp_reader *pfile, const char *fmt, ...)
+{
+ char *ptr = NULL;
+
+ va_list ap;
+ va_start (ap, fmt);
+ vasprintf (&ptr, fmt, ap);
+ va_end (ap);
+
+ cpp_define (pfile, ptr);
+ free (ptr);
+}
+
+
/* Slight variant of the above for use by initialize_builtins. */
void
_cpp_define_builtin (cpp_reader *pfile, const char *str)
/* Used to register macros and assertions, perhaps from the command line.
The text is the same as the command line argument. */
extern void cpp_define (cpp_reader *, const char *);
+extern void cpp_define_formatted (cpp_reader *pfile,
+ const char *fmt, ...) ATTRIBUTE_PRINTF_2;
extern void cpp_assert (cpp_reader *, const char *);
extern void cpp_undef (cpp_reader *, const char *);
extern void cpp_unassert (cpp_reader *, const char *);
extern void cpp_error_with_line (cpp_reader *, int, source_location, unsigned,
const char *msgid, ...) ATTRIBUTE_PRINTF_5;
-/* In cpplex.c */
+/* In lex.c */
extern int cpp_ideq (const cpp_token *, const char *);
extern void cpp_output_line (cpp_reader *, FILE *);
extern void cpp_output_token (const cpp_token *, FILE *);
extern cppchar_t cpp_parse_escape (cpp_reader *, const unsigned char ** pstr,
const unsigned char *limit, int wide);
-/* In cpphash.c */
+/* In hash.c */
/* Lookup an identifier in the hashtable. Puts the identifier in the
table if it is not already there. */
typedef int (*cpp_cb) (cpp_reader *, cpp_hashnode *, void *);
extern void cpp_forall_identifiers (cpp_reader *, cpp_cb, void *);
-/* In cppmacro.c */
+/* In macro.c */
extern void cpp_scan_nooutput (cpp_reader *);
extern int cpp_sys_macro_p (cpp_reader *);
extern unsigned char *cpp_quote_string (unsigned char *, const unsigned char *,
unsigned int);
-/* In cppfiles.c */
+/* In files.c */
extern bool cpp_included (cpp_reader *, const char *);
extern bool cpp_included_before (cpp_reader *, const char *, source_location);
extern void cpp_make_system_header (cpp_reader *, int, int);
extern cpp_buffer *cpp_get_prev (cpp_buffer *);
extern void cpp_clear_file_cache (cpp_reader *);
-/* In cpppch.c */
+/* In pch.c */
struct save_macro_data;
extern int cpp_save_state (cpp_reader *, FILE *);
extern int cpp_write_pch_deps (cpp_reader *, FILE *);