Image Demosaicking with Contour Stencils
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Functions
temsub.h File Reference

Template substitution. More...

#include <stdarg.h>
Include dependency graph for temsub.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int FillTemplate (const char *OutputFilename, const char *TemplateFilename, char *Keys[], char *Subs[])
 Fill a template file according to key-substitution pairs. More...
 
char ** AddPair (char **Keys[], char **Subs[], char *Key, char *SubFormat,...)
 Add a key-substitution pair to a key-substitution table. More...
 
void StringAppend (char **Str, const char *Format,...)
 Append to a string with a printf format string. More...
 
void VStringAppend (char **Str, const char *Format, va_list Args)
 Variable argument list (va_list) version of StringAppend() More...
 
void FreeStringArray (char *Strs[])
 Free an array of strings created with AddPair() More...
 

Detailed Description

Template substitution.

Author
Pascal Getreuer getre.nosp@m.uer@.nosp@m.gmail.nosp@m..com

Copyright (c) 2010-2011, Pascal Getreuer All rights reserved.

This program is free software: you can use, modify and/or redistribute it under the terms of the simplified BSD License. You should have received a copy of this license along this program. If not, see http://www.opensource.org/licenses/bsd-license.html.

Definition in file temsub.h.

Function Documentation

char** AddPair ( char **  Keys[],
char **  Subs[],
char *  Key,
char *  SubFormat,
  ... 
)

Add a key-substitution pair to a key-substitution table.

Parameters
Keysthe template keys, an array of strings
Substhe corresponding substitutions, an array of strings
Keythe new key to add
SubFormatformat string for the corresponding substitution
Returns
pointer to the new Subs string

This routine allocates memory for adding the new strings. Use FreeStringArray() to free the memory.

Definition at line 186 of file temsub.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int FillTemplate ( const char *  OutputFilename,
const char *  TemplateFilename,
char *  Keys[],
char *  Subs[] 
)

Fill a template file according to key-substitution pairs.

Parameters
OutputFilenamethe name of the filled output file
TemplateFilenamethe name of the template file
Keysthe template keys, an array of strings
Substhe corresponding substitutions, an array of strings
Returns
1 on success, 0 on failure

Fills a template file by replacing strings of the form "${KEYNAME}" with the substitution specified in Subs. The functions AddPair() and StringAppend() can be used to build the Keys and Subs arrays.

Several key-substitution pairs are provided by default:

  • ${OUTPUT_FILENAME} expands to OutputFilename,
  • ${TEMPLATE_FILENAME} expands to TemplateFilename,
  • ${TIME} expands to the current date and time

Definition at line 44 of file temsub.c.

Here is the caller graph for this function:

void FreeStringArray ( char *  Strs[])

Free an array of strings created with AddPair()

Parameters
Strspointer to the string array

Definition at line 265 of file temsub.c.

Here is the caller graph for this function:

void StringAppend ( char **  Str,
const char *  Format,
  ... 
)

Append to a string with a printf format string.

Parameters
Strthe string on which to append
Formatthe format string for what to append

Definition at line 226 of file temsub.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void VStringAppend ( char **  Str,
const char *  Format,
va_list  Args 
)

Variable argument list (va_list) version of StringAppend()

Definition at line 237 of file temsub.c.

Here is the caller graph for this function: