Lines Matching refs:macro

57   this is a macro: name, arguments, contents, location.
61 char *name; /* lower case name of the macro */
62 apr_array_header_t *arguments; /* of char*, macro parameter names */
63 apr_array_header_t *contents; /* of char*, macro body */
64 char *location; /* of macro definition, for error messages */
82 hash type: (char *) name -> (ap_macro_t *) macro
232 generates an error on macro with two arguments of the same name.
233 generates an error if a macro argument name is empty.
238 const ap_macro_t * macro)
240 char **tab = (char **) macro->arguments->elts;
241 int nelts = macro->arguments->nelts;
250 "macro '%s' (%s): empty argument #%d name",
251 macro->name, macro->location, i + 1);
255 "macro '%s' (%s) "
258 macro->name, macro->location,
268 "argument name conflict in macro '%s' (%s): "
271 macro->name, macro->location,
280 "macro '%s' (%s): "
282 "be careful about your macro definition!",
283 macro->name, macro->location,
410 substitute macro arguments by replacements in buf of bufsize.
412 if used is defined, returns the used macro arguments.
417 const ap_macro_t * macro,
422 **atab = (char **) macro->arguments->elts,
431 while ((ptr = next_substitution(ptr, macro->arguments, &whichone))) {
449 perform substitutions in a macro contents and
455 const ap_macro_t * macro,
460 apr_array_header_t *contents = macro->contents;
468 /* for each line of the macro body */
471 /* copy the line and subtitute macro parameters */
474 macro, replacements, used);
477 "while processing line %d of macro '%s' (%s) %s",
478 i + 1, macro->name, macro->location, errmsg);
491 warn if some macro arguments are not used.
494 const ap_macro_t * macro)
496 int nelts = macro->arguments->nelts;
497 char **names = (char **) macro->arguments->elts;
502 if (macro->contents->nelts == 0) {
504 "macro '%s' (%s): empty contents!",
505 macro->name, macro->location);
515 errmsg = process_content(pool, macro, macro->arguments, used, NULL);
524 "macro '%s' (%s): argument '%s' (#%d) never used",
525 macro->name, macro->location, names[i], i + 1);
536 The expanded content of the macro is to be parsed as a ap_configfile_t.
543 being processed and is interrupted by the macro expansion. At the end
544 of processing the macro, the initial data structure will be put back
548 arrays used to insert the expanded macro contents before resuming the real
695 ap_macro_t *macro;
713 return BEGIN_MACRO " macro definition: empty name";
723 /* get lowercase macro name */
726 return BEGIN_MACRO " macro definition: name not found";
730 macro = apr_hash_get(ap_macros, name, APR_HASH_KEY_STRING);
732 if (macro != NULL) {
735 "macro '%s' multiply defined: "
737 macro->name, macro->location,
741 /* allocate a new macro */
742 macro = (ap_macro_t *) apr_palloc(pool, sizeof(ap_macro_t));
743 macro->name = name;
748 /* get macro arguments */
749 macro->location = apr_psprintf(pool,
753 debug(fprintf(stderr, "macro_section: location=%s\n", macro->location));
756 apr_psprintf(pool, "macro '%s' (%s)", macro->name, macro->location);
760 "%s better prefix a macro name with any of '%s'",
764 /* get macro parameters */
765 macro->arguments = get_arguments(pool, arg);
767 errmsg = check_macro_arguments(cmd->temp_pool, macro);
775 where, &macro->contents);
783 errmsg = check_macro_contents(cmd->temp_pool, macro);
791 /* store the new macro */
792 apr_hash_set(ap_macros, name, APR_HASH_KEY_STRING, macro);
804 ap_macro_t *macro;
812 return "no macro defined before " USE_MACRO;
815 /* get lowercase macro name */
820 return "no macro name specified with " USE_MACRO;
823 /* get macro definition */
824 macro = apr_hash_get(ap_macros, name, APR_HASH_KEY_STRING);
826 if (!macro) {
827 return apr_psprintf(cmd->temp_pool, "macro '%s' undefined", name);
831 * which may already contains "macro 'foo'". Ok, it looks like a hack,
836 apr_pstrcat(cmd->temp_pool, "macro '", macro->name, "'", NULL);
840 "recursive use of macro '%s' is invalid",
841 macro->name);
844 /* get macro arguments */
847 if (macro->arguments->nelts != replacements->nelts) {
849 "macro '%s' (%s) used "
851 macro->name, macro->location,
852 replacements->nelts, macro->arguments->nelts);
856 "macro '%s' (%s) used on line %d of \"%s\"",
857 macro->name, macro->location,
863 errmsg = process_content(cmd->temp_pool, macro, replacements,
884 ap_macro_t *macro;
888 return "no macro defined before " UNDEF_MACRO;
892 return "no macro name specified with " UNDEF_MACRO;
895 /* check that the macro is defined */
898 macro = apr_hash_get(ap_macros, name, APR_HASH_KEY_STRING);
899 if (macro == NULL) {
902 "cannot remove undefined macro '%s'", name);
905 /* free macro: cannot do that */
906 /* remove macro from hash table */
921 macro module commands.
922 configuration file macro stuff
927 "Beginning of a macro definition section."),
929 "Use of a macro."),
931 "Remove a macro definition."),
951 AP_DECLARE_MODULE(macro) = {