Apache HTTPD
Classes | Macros | Functions | Variables
mod_macro.c File Reference
#include "httpd.h"
#include "http_config.h"
#include "http_log.h"
#include "apr.h"
#include "apr_strings.h"
#include "apr_hash.h"

Go to the source code of this file.

Classes

struct  ap_macro_t
 
struct  array_contents_t
 

Macros

#define debug(stmt)
 
#define BEGIN_MACRO   "<Macro"
 
#define END_MACRO   "</Macro>"
 
#define USE_MACRO   "Use"
 
#define UNDEF_MACRO   "UndefMacro"
 
#define empty_string_p(p)   (!(p) || *(p) == '\0')
 
#define trim(line)   while (*(line) == ' ' || *(line) == '\t') (line)++
 
#define ESCAPE_ARG   '@'
 
#define ARG_PREFIX   "$%@"
 
#define ARG_CONTENT
 
#define DELIM   '"'
 
#define ESCAPE   '\\'
 

Functions

static apr_array_header_tget_arguments (apr_pool_t *pool, const char *line)
 
static void warn_if_non_blank (const char *what, char *ptr, ap_configfile_t *cfg)
 
static charget_lines_till_end_token (apr_pool_t *pool, ap_configfile_t *config_file, const char *end_token, const char *begin_token, const char *where, apr_array_header_t **plines)
 
static int looks_like_an_argument (const char *word)
 
static const charcheck_macro_arguments (apr_pool_t *pool, const ap_macro_t *macro)
 
static void check_macro_use_arguments (const char *where, const apr_array_header_t *array)
 
static int number_of_escapes (const char delim, const char *str)
 
static charsubstitute (char *buf, const int bufsize, const char *name, const char *replacement, const int do_esc)
 
static charnext_substitution (const char *buf, const apr_array_header_t *args, int *whichone)
 
static const charsubstitute_macro_args (char *buf, int bufsize, const ap_macro_t *macro, const apr_array_header_t *replacements, apr_array_header_t *used)
 
static const charprocess_content (apr_pool_t *pool, const ap_macro_t *macro, const apr_array_header_t *replacements, apr_array_header_t *used, apr_array_header_t **result)
 
static const charcheck_macro_contents (apr_pool_t *pool, const ap_macro_t *macro)
 
static int next_one (array_contents_t *ml)
 
static apr_status_t array_getch (char *ch, void *param)
 
static apr_status_t array_getstr (void *buf, size_t bufsize, void *param)
 
static apr_status_t array_close (void *param)
 
static ap_configfile_tmake_array_config (apr_pool_t *pool, apr_array_header_t *contents, const char *where, ap_configfile_t *cfg, ap_configfile_t **upper)
 
static const charmacro_section (cmd_parms *cmd, void *dummy, const char *arg)
 
static const charuse_macro (cmd_parms *cmd, void *dummy, const char *arg)
 
static const charundef_macro (cmd_parms *cmd, void *dummy, const char *arg)
 

Variables

static apr_hash_tap_macros = NULL
 
static const command_rec macro_cmds []
 
static int *const aplog_module_index = &( macro_module.module_index)
 

Macro Definition Documentation

◆ ARG_CONTENT

#define ARG_CONTENT
Value:
"abcdefghijklmnopqrstuvwxyz" \
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
"0123456789_" ARG_PREFIX
#define ARG_PREFIX
Definition mod_macro.c:208

Definition at line 214 of file mod_macro.c.

◆ ARG_PREFIX

#define ARG_PREFIX   "$%@"

Definition at line 208 of file mod_macro.c.

◆ BEGIN_MACRO

#define BEGIN_MACRO   "<Macro"

Definition at line 65 of file mod_macro.c.

◆ debug

#define debug (   stmt)

Definition at line 43 of file mod_macro.c.

◆ DELIM

#define DELIM   '"'

Definition at line 307 of file mod_macro.c.

◆ empty_string_p

#define empty_string_p (   p)    (!(p) || *(p) == '\0')

Definition at line 84 of file mod_macro.c.

◆ END_MACRO

#define END_MACRO   "</Macro>"

Definition at line 66 of file mod_macro.c.

◆ ESCAPE

#define ESCAPE   '\\'

Definition at line 308 of file mod_macro.c.

◆ ESCAPE_ARG

#define ESCAPE_ARG   '@'

Definition at line 205 of file mod_macro.c.

◆ trim

#define trim (   line)    while (*(line) == ' ' || *(line) == '\t') (line)++

Definition at line 85 of file mod_macro.c.

◆ UNDEF_MACRO

#define UNDEF_MACRO   "UndefMacro"

Definition at line 68 of file mod_macro.c.

◆ USE_MACRO

#define USE_MACRO   "Use"

Definition at line 67 of file mod_macro.c.

Function Documentation

◆ array_close()

static apr_status_t array_close ( void *  param)
static

Definition at line 644 of file mod_macro.c.

◆ array_getch()

static apr_status_t array_getch ( char ch,
void *  param 
)
static

Definition at line 578 of file mod_macro.c.

◆ array_getstr()

static apr_status_t array_getstr ( void *  buf,
size_t  bufsize,
void *  param 
)
static

Definition at line 609 of file mod_macro.c.

◆ check_macro_arguments()

static const char * check_macro_arguments ( apr_pool_t pool,
const ap_macro_t macro 
)
static

Definition at line 233 of file mod_macro.c.

◆ check_macro_contents()

static const char * check_macro_contents ( apr_pool_t pool,
const ap_macro_t macro 
)
static

Definition at line 489 of file mod_macro.c.

◆ check_macro_use_arguments()

static void check_macro_use_arguments ( const char where,
const apr_array_header_t array 
)
static

Definition at line 291 of file mod_macro.c.

◆ get_arguments()

static apr_array_header_t * get_arguments ( apr_pool_t pool,
const char line 
)
static

Definition at line 91 of file mod_macro.c.

◆ get_lines_till_end_token()

static char * get_lines_till_end_token ( apr_pool_t pool,
ap_configfile_t config_file,
const char end_token,
const char begin_token,
const char where,
apr_array_header_t **  plines 
)
static

Definition at line 133 of file mod_macro.c.

◆ looks_like_an_argument()

static int looks_like_an_argument ( const char word)
static

Definition at line 222 of file mod_macro.c.

◆ macro_section()

static const char * macro_section ( cmd_parms cmd,
void *  dummy,
const char arg 
)
static

Definition at line 685 of file mod_macro.c.

◆ make_array_config()

static ap_configfile_t * make_array_config ( apr_pool_t pool,
apr_array_header_t contents,
const char where,
ap_configfile_t cfg,
ap_configfile_t **  upper 
)
static

Definition at line 657 of file mod_macro.c.

◆ next_one()

static int next_one ( array_contents_t ml)
static

Definition at line 564 of file mod_macro.c.

◆ next_substitution()

static char * next_substitution ( const char buf,
const apr_array_header_t args,
int whichone 
)
static

Definition at line 384 of file mod_macro.c.

◆ number_of_escapes()

static int number_of_escapes ( const char  delim,
const char str 
)
static

Definition at line 313 of file mod_macro.c.

◆ process_content()

static const char * process_content ( apr_pool_t pool,
const ap_macro_t macro,
const apr_array_header_t replacements,
apr_array_header_t used,
apr_array_header_t **  result 
)
static

Definition at line 450 of file mod_macro.c.

◆ substitute()

static char * substitute ( char buf,
const int  bufsize,
const char name,
const char replacement,
const int  do_esc 
)
static

Definition at line 331 of file mod_macro.c.

◆ substitute_macro_args()

static const char * substitute_macro_args ( char buf,
int  bufsize,
const ap_macro_t macro,
const apr_array_header_t replacements,
apr_array_header_t used 
)
static

Definition at line 410 of file mod_macro.c.

◆ undef_macro()

static const char * undef_macro ( cmd_parms cmd,
void *  dummy,
const char arg 
)
static

Definition at line 883 of file mod_macro.c.

◆ use_macro()

static const char * use_macro ( cmd_parms cmd,
void *  dummy,
const char arg 
)
static

Definition at line 802 of file mod_macro.c.

◆ warn_if_non_blank()

static void warn_if_non_blank ( const char what,
char ptr,
ap_configfile_t cfg 
)
static

Definition at line 109 of file mod_macro.c.

Variable Documentation

◆ ap_macros

apr_hash_t* ap_macros = NULL
static

Definition at line 80 of file mod_macro.c.

◆ aplog_module_index

int* const aplog_module_index = &( macro_module.module_index)
static

Definition at line 942 of file mod_macro.c.

◆ macro_cmds

const command_rec macro_cmds[]
static
Initial value:
= {
{ "<Macro" , macro_section , NULL , 256 | ( 1 | 2 | 4 | 8 | 16 ) , RAW_ARGS, "Beginning of a macro definition section." },
{ "Use" , use_macro , NULL , 256 | ( 1 | 2 | 4 | 8 | 16 ) , RAW_ARGS, "Use of a macro." },
{ "UndefMacro" , undef_macro , NULL , 256 | ( 1 | 2 | 4 | 8 | 16 ) , TAKE1, "Remove a macro definition." },
{NULL}
}
@ RAW_ARGS
Definition http_config.h:50
@ TAKE1
Definition http_config.h:51
static const char * use_macro(cmd_parms *cmd, void *dummy, const char *arg)
Definition mod_macro.c:802
static const char * macro_section(cmd_parms *cmd, void *dummy, const char *arg)
Definition mod_macro.c:685
static const char * undef_macro(cmd_parms *cmd, void *dummy, const char *arg)
Definition mod_macro.c:883
return NULL
Definition mod_so.c:359

Definition at line 921 of file mod_macro.c.