1
0
mirror of https://github.com/OlafvdSpek/ctemplate.git synced 2025-10-12 20:19:04 +08:00

Mon Apr 19 15:55:23 2010 Google Inc. <opensource@google.com>

* ctemplate: version 0.97 release
	* Major API revamp: +TemplateCache, -Template (panicker, csilvers)
	* Major documentation revamp: howto -> guide + reference (csilvers)
	* Protect auto-generated #include files with header guard (dnovillo)
	* Allow ftp:// in ValidateUrl modifier (martone)
	* Speed up template modifiers (turnidge)
	* BUGFIX: Fix a dnagling pointer in template-modifiers (csilvers)
	* PORTING: cygwin/mingw now compile (due to autoconf macros) (csilvers)
	* PORTING: improve generate_fs_test on windows (csilvers)
This commit is contained in:
csilvers 2010-04-20 18:06:46 +00:00
parent 045676c8c2
commit 3346217e27
6 changed files with 54 additions and 30 deletions

View File

@ -1,3 +1,15 @@
Mon Apr 19 15:55:23 2010 Google Inc. <opensource@google.com>
* ctemplate: version 0.97 release
* Major API revamp: +TemplateCache, -Template (panicker, csilvers)
* Major documentation revamp: howto -> guide + reference (csilvers)
* Protect auto-generated #include files with header guard (dnovillo)
* Allow ftp:// in ValidateUrl modifier (martone)
* Speed up template modifiers (turnidge)
* BUGFIX: Fix a dnagling pointer in template-modifiers (csilvers)
* PORTING: cygwin/mingw now compile (due to autoconf macros) (csilvers)
* PORTING: improve generate_fs_test on windows (csilvers)
Mon Oct 19 11:42:57 2009 Google Inc. <opensource@google.com> Mon Oct 19 11:42:57 2009 Google Inc. <opensource@google.com>
* ctemplate: version 0.96 release * ctemplate: version 0.96 release

20
trunk/configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.64 for ctemplate 0.96. # Generated by GNU Autoconf 2.64 for ctemplate 0.97.
# #
# Report bugs to <opensource@google.com>. # Report bugs to <opensource@google.com>.
# #
@ -703,8 +703,8 @@ MAKEFLAGS=
# Identity of this package. # Identity of this package.
PACKAGE_NAME='ctemplate' PACKAGE_NAME='ctemplate'
PACKAGE_TARNAME='ctemplate' PACKAGE_TARNAME='ctemplate'
PACKAGE_VERSION='0.96' PACKAGE_VERSION='0.97'
PACKAGE_STRING='ctemplate 0.96' PACKAGE_STRING='ctemplate 0.97'
PACKAGE_BUGREPORT='opensource@google.com' PACKAGE_BUGREPORT='opensource@google.com'
PACKAGE_URL='' PACKAGE_URL=''
@ -1444,7 +1444,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing. # Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh. # This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF cat <<_ACEOF
\`configure' configures ctemplate 0.96 to adapt to many kinds of systems. \`configure' configures ctemplate 0.97 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]... Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1514,7 +1514,7 @@ fi
if test -n "$ac_init_help"; then if test -n "$ac_init_help"; then
case $ac_init_help in case $ac_init_help in
short | recursive ) echo "Configuration of ctemplate 0.96:";; short | recursive ) echo "Configuration of ctemplate 0.97:";;
esac esac
cat <<\_ACEOF cat <<\_ACEOF
@ -1623,7 +1623,7 @@ fi
test -n "$ac_init_help" && exit $ac_status test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then if $ac_init_version; then
cat <<\_ACEOF cat <<\_ACEOF
ctemplate configure 0.96 ctemplate configure 0.97
generated by GNU Autoconf 2.64 generated by GNU Autoconf 2.64
Copyright (C) 2009 Free Software Foundation, Inc. Copyright (C) 2009 Free Software Foundation, Inc.
@ -2253,7 +2253,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake. running configure, to aid debugging if configure makes a mistake.
It was created by ctemplate $as_me 0.96, which was It was created by ctemplate $as_me 0.97, which was
generated by GNU Autoconf 2.64. Invocation command line was generated by GNU Autoconf 2.64. Invocation command line was
$ $0 $@ $ $0 $@
@ -2986,7 +2986,7 @@ fi
# Define the identity of the package. # Define the identity of the package.
PACKAGE='ctemplate' PACKAGE='ctemplate'
VERSION='0.96' VERSION='0.97'
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
@ -21224,7 +21224,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their # report actual input values of CONFIG_FILES etc. instead of their
# values after options handling. # values after options handling.
ac_log=" ac_log="
This file was extended by ctemplate $as_me 0.96, which was This file was extended by ctemplate $as_me 0.97, which was
generated by GNU Autoconf 2.64. Invocation command line was generated by GNU Autoconf 2.64. Invocation command line was
CONFIG_FILES = $CONFIG_FILES CONFIG_FILES = $CONFIG_FILES
@ -21288,7 +21288,7 @@ Report bugs to <opensource@google.com>."
_ACEOF _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\ ac_cs_version="\\
ctemplate config.status 0.96 ctemplate config.status 0.97
configured by $0, generated by GNU Autoconf 2.64, configured by $0, generated by GNU Autoconf 2.64,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"

View File

@ -4,7 +4,7 @@
# make sure we're interpreted by some minimal autoconf # make sure we're interpreted by some minimal autoconf
AC_PREREQ(2.57) AC_PREREQ(2.57)
AC_INIT(ctemplate, 0.96, opensource@google.com) AC_INIT(ctemplate, 0.97, opensource@google.com)
# The argument here is just something that should be in the current directory # The argument here is just something that should be in the current directory
# (for sanity checking) # (for sanity checking)
AC_CONFIG_SRCDIR(README) AC_CONFIG_SRCDIR(README)

View File

@ -1,3 +1,9 @@
ctemplate (0.97-1) unstable; urgency=low
* New upstream release.
-- Google Inc. <opensource@google.com> Mon, 19 Apr 2010 15:55:23 -0700
ctemplate (0.96-1) unstable; urgency=low ctemplate (0.96-1) unstable; urgency=low
* New upstream release. * New upstream release.

View File

@ -51,6 +51,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <ctype.h> // for toupper(), isalnum()
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
@ -124,7 +125,7 @@ static void Version(FILE* outfile) {
// Removes all non alphanumeric characters from a string to form a // Removes all non alphanumeric characters from a string to form a
// valid C identifier to use as a double-inclusion guard. // valid C identifier to use as a double-inclusion guard.
static void ConvertToIdentifier(string& s) { static void ConvertToIdentifier(string& s) {
for (int i = 0; i < s.size(); i++) { for (string::size_type i = 0; i < s.size(); i++) {
if (!isalnum(s[i])) if (!isalnum(s[i]))
s[i] = '_'; s[i] = '_';
else else

View File

@ -106,7 +106,7 @@ class CTEMPLATE_DLL_DECL TemplateCache {
// at either the beginning or end of a line. See template constructor // at either the beginning or end of a line. See template constructor
// for more details. // for more details.
bool LoadTemplate(const TemplateString& filename, Strip strip) bool LoadTemplate(const TemplateString& filename, Strip strip)
/*LOCKS_EXCLUDED(*mutex_)*/; /*LOCKS_EXCLUDED(mutex_)*/;
// Parses the string as a template file (e.g. "Hello {{WORLD}}"), // Parses the string as a template file (e.g. "Hello {{WORLD}}"),
// and inserts it into the parsed template cache, so it can later be // and inserts it into the parsed template cache, so it can later be
@ -121,7 +121,7 @@ class CTEMPLATE_DLL_DECL TemplateCache {
// the string-template. // the string-template.
bool StringToTemplateCache(const TemplateString& key, bool StringToTemplateCache(const TemplateString& key,
const TemplateString& content, const TemplateString& content,
Strip strip) /*LOCKS_EXCLUDED(*mutex_)*/; Strip strip) /*LOCKS_EXCLUDED(mutex_)*/;
bool StringToTemplateCache(const TemplateString& key, bool StringToTemplateCache(const TemplateString& key,
const char* content, const char* content,
size_t content_len, size_t content_len,
@ -143,7 +143,7 @@ class CTEMPLATE_DLL_DECL TemplateCache {
bool ExpandWithData(const TemplateString& filename, Strip strip, bool ExpandWithData(const TemplateString& filename, Strip strip,
const TemplateDictionaryInterface *dictionary, const TemplateDictionaryInterface *dictionary,
PerExpandData* per_expand_data, PerExpandData* per_expand_data,
ExpandEmitter* output) /*LOCKS_EXCLUDED(*mutex_)*/; ExpandEmitter* output) /*LOCKS_EXCLUDED(mutex_)*/;
bool ExpandWithData(const TemplateString& filename, Strip strip, bool ExpandWithData(const TemplateString& filename, Strip strip,
const TemplateDictionaryInterface* dictionary, const TemplateDictionaryInterface* dictionary,
PerExpandData* per_expand_data, PerExpandData* per_expand_data,
@ -171,7 +171,7 @@ class CTEMPLATE_DLL_DECL TemplateCache {
const TemplateDictionaryInterface *dictionary, const TemplateDictionaryInterface *dictionary,
PerExpandData* per_expand_data, PerExpandData* per_expand_data,
ExpandEmitter* output) const ExpandEmitter* output) const
/*LOCKS_EXCLUDED(*mutex_)*/; /*LOCKS_EXCLUDED(mutex_)*/;
bool ExpandNoLoad(const TemplateString& filename, Strip strip, bool ExpandNoLoad(const TemplateString& filename, Strip strip,
const TemplateDictionaryInterface* dictionary, const TemplateDictionaryInterface* dictionary,
PerExpandData* per_expand_data, PerExpandData* per_expand_data,
@ -214,13 +214,13 @@ class CTEMPLATE_DLL_DECL TemplateCache {
// the cache can no longer be modified by loading new templates or // the cache can no longer be modified by loading new templates or
// reloading existing templates. During expansion only cached // reloading existing templates. During expansion only cached
// included templates will be used, they won't be loaded on-demand. // included templates will be used, they won't be loaded on-demand.
void Freeze() /*LOCKS_EXCLUDED(*mutex_)*/; void Freeze() /*LOCKS_EXCLUDED(mutex_)*/;
// Delete // Delete
// Deletes one template object from the cache, if it exists. // Deletes one template object from the cache, if it exists.
// This can be used for either file- or string-based templates. // This can be used for either file- or string-based templates.
// Returns true if the object was deleted, false otherwise. // Returns true if the object was deleted, false otherwise.
bool Delete(const TemplateString& key) /*LOCKS_EXCLUDED(*mutex_)*/; bool Delete(const TemplateString& key) /*LOCKS_EXCLUDED(mutex_)*/;
// ClearCache // ClearCache
// Deletes all the template objects in the cache and all raw // Deletes all the template objects in the cache and all raw
@ -231,7 +231,7 @@ class CTEMPLATE_DLL_DECL TemplateCache {
// this one.) Note: this method is not necessary unless you are // this one.) Note: this method is not necessary unless you are
// testing for memory leaks. Calling this before exiting the // testing for memory leaks. Calling this before exiting the
// program will prevent unnecessary reporting in that case. // program will prevent unnecessary reporting in that case.
void ClearCache() /*LOCKS_EXCLUDED(*mutex_)*/; void ClearCache() /*LOCKS_EXCLUDED(mutex_)*/;
// ReloadAllIfChanged // ReloadAllIfChanged
// If IMMEDIATE_RELOAD, reloads and parses all templates right away, // If IMMEDIATE_RELOAD, reloads and parses all templates right away,
@ -247,13 +247,18 @@ class CTEMPLATE_DLL_DECL TemplateCache {
// loading lots of templates from disk at the same time. If in // loading lots of templates from disk at the same time. If in
// doubt, LAZY_RELOAD is probably a better choice. // doubt, LAZY_RELOAD is probably a better choice.
enum ReloadType { LAZY_RELOAD, IMMEDIATE_RELOAD }; enum ReloadType { LAZY_RELOAD, IMMEDIATE_RELOAD };
void ReloadAllIfChanged(ReloadType reload_tyle) /*LOCKS_EXCLUDED(*mutex_)*/; void ReloadAllIfChanged(ReloadType reload_tyle) /*LOCKS_EXCLUDED(mutex_)*/;
// Clone // Clone
// Returns a copy of the cache. It makes a shallow copy of the // Returns a copy of the cache. It makes a shallow copy of the
// parsed_template_cache_, incrementing refcount of templates. // parsed_template_cache_, incrementing refcount of templates.
// The caller is responsible for deallocating the returned TemplateCache. // The caller is responsible for deallocating the returned TemplateCache.
TemplateCache* Clone() const /*LOCKS_EXCLUDED(*mutex_)*/; // NOTE(tehmle): Annotalysis expects this method to have a lock for
// a TemplateCache instance local to the method, but we
// know that no other threads will have access to the
// instance, so ignore thread safety errors.
TemplateCache* Clone() const /*LOCKS_EXCLUDED(mutex_)
NO_THREAD_SAFETY_ANALYSIS*/;
// ---- INSPECTING THE CACHE ------- // ---- INSPECTING THE CACHE -------
// Dump // Dump
@ -285,7 +290,7 @@ class CTEMPLATE_DLL_DECL TemplateCache {
// This method is deprecated. It exists here because it is called by // This method is deprecated. It exists here because it is called by
// Template::GetTemplate. Also this is used in tests. // Template::GetTemplate. Also this is used in tests.
const Template* GetTemplate(const TemplateString& key, Strip strip) const Template* GetTemplate(const TemplateString& key, Strip strip)
/*LOCKS_EXCLUDED(*mutex_)*/; /*LOCKS_EXCLUDED(mutex_)*/;
bool ResolveTemplateFilename(const std::string& unresolved, bool ResolveTemplateFilename(const std::string& unresolved,
std::string* resolved, std::string* resolved,
@ -298,11 +303,11 @@ class CTEMPLATE_DLL_DECL TemplateCache {
bool ExpandLocked(const TemplateString& filename, Strip strip, bool ExpandLocked(const TemplateString& filename, Strip strip,
ExpandEmitter* output, ExpandEmitter* output,
const TemplateDictionaryInterface *dictionary, const TemplateDictionaryInterface *dictionary,
PerExpandData* per_expand_data) /*LOCKS_EXCLUDED(*mutex_)*/; PerExpandData* per_expand_data) /*LOCKS_EXCLUDED(mutex_)*/;
bool AddAlternateTemplateRootDirectoryHelper( bool AddAlternateTemplateRootDirectoryHelper(
const std::string& directory, const std::string& directory,
bool clear_template_search_path) /*LOCKS_EXCLUDED(*search_path_mutex_)*/; bool clear_template_search_path) /*LOCKS_EXCLUDED(search_path_mutex_)*/;
// DoneWithGetTemplatePtrs // DoneWithGetTemplatePtrs
// For historical reasons, GetTemplate() returns a raw Template // For historical reasons, GetTemplate() returns a raw Template
@ -315,7 +320,7 @@ class CTEMPLATE_DLL_DECL TemplateCache {
// GetTemplate). Most likely, the user will call this indirectly, // GetTemplate). Most likely, the user will call this indirectly,
// via ClearCache(). // via ClearCache().
// TODO(panicker): Consider making this method public. // TODO(panicker): Consider making this method public.
void DoneWithGetTemplatePtrs() /*LOCKS_EXCLUDED(*mutex_)*/; void DoneWithGetTemplatePtrs() /*LOCKS_EXCLUDED(mutex_)*/;
// ValidTemplateFilename // ValidTemplateFilename
// Validates the user provided filename before constructing the template // Validates the user provided filename before constructing the template
@ -332,7 +337,7 @@ class CTEMPLATE_DLL_DECL TemplateCache {
const TemplateString& filename, const TemplateString& filename,
Strip strip, Strip strip,
const TemplateCacheKey& key) const TemplateCacheKey& key)
/*EXCLUSIVE_LOCKS_REQUIRED(*mutex_)*/; /*EXCLUSIVE_LOCKS_REQUIRED(mutex_)*/;
// Refcount // Refcount
// Testing only. Returns the refcount of a template, given its cache key. // Testing only. Returns the refcount of a template, given its cache key.
@ -342,9 +347,9 @@ class CTEMPLATE_DLL_DECL TemplateCache {
// Debug only. Returns whether the cache key is in the parsed cache. // Debug only. Returns whether the cache key is in the parsed cache.
bool TemplateIsCached(const TemplateCacheKey template_cache_key) const; bool TemplateIsCached(const TemplateCacheKey template_cache_key) const;
TemplateMap* parsed_template_cache_ /*GUARDED_BY(*mutex_)*/; TemplateMap* parsed_template_cache_ /*GUARDED_BY(mutex_)*/;
bool is_frozen_ /*GUARDED_BY(*mutex_)*/; bool is_frozen_ /*GUARDED_BY(mutex_)*/;
TemplateSearchPath search_path_ /*GUARDED_BY(*search_path_mutex_)*/; TemplateSearchPath search_path_ /*GUARDED_BY(search_path_mutex_)*/;
// Since GetTemplate() returns a raw pointer, it's impossible for // Since GetTemplate() returns a raw pointer, it's impossible for
// the caller to call DecRef() on the returned template when it's // the caller to call DecRef() on the returned template when it's
@ -352,7 +357,7 @@ class CTEMPLATE_DLL_DECL TemplateCache {
// GetTemplate in this data structure. Then the user can call // GetTemplate in this data structure. Then the user can call
// DecRef() on all of them at once, via a DoneWithGetTemplatePtrs() // DecRef() on all of them at once, via a DoneWithGetTemplatePtrs()
// (which they will probably get at via a call to ClearCache()). // (which they will probably get at via a call to ClearCache()).
TemplateCallMap* get_template_calls_ /*GUARDED_BY(*mutex_)*/; TemplateCallMap* get_template_calls_ /*GUARDED_BY(mutex_)*/;
mutable class Mutex* mutex_; mutable class Mutex* mutex_;
mutable class Mutex* search_path_mutex_; mutable class Mutex* search_path_mutex_;