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>
* ctemplate: version 0.96 release

20
trunk/configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh
# 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>.
#
@ -703,8 +703,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='ctemplate'
PACKAGE_TARNAME='ctemplate'
PACKAGE_VERSION='0.96'
PACKAGE_STRING='ctemplate 0.96'
PACKAGE_VERSION='0.97'
PACKAGE_STRING='ctemplate 0.97'
PACKAGE_BUGREPORT='opensource@google.com'
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.
# This message is too long to be a string in the A/UX 3.1 sh.
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]...
@ -1514,7 +1514,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of ctemplate 0.96:";;
short | recursive ) echo "Configuration of ctemplate 0.97:";;
esac
cat <<\_ACEOF
@ -1623,7 +1623,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
ctemplate configure 0.96
ctemplate configure 0.97
generated by GNU Autoconf 2.64
Copyright (C) 2009 Free Software Foundation, Inc.
@ -2253,7 +2253,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
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
$ $0 $@
@ -2986,7 +2986,7 @@ fi
# Define the identity of the package.
PACKAGE='ctemplate'
VERSION='0.96'
VERSION='0.97'
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
# values after options handling.
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
CONFIG_FILES = $CONFIG_FILES
@ -21288,7 +21288,7 @@ Report bugs to <opensource@google.com>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
ctemplate config.status 0.96
ctemplate config.status 0.97
configured by $0, generated by GNU Autoconf 2.64,
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
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
# (for sanity checking)
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
* New upstream release.

View File

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

View File

@ -106,7 +106,7 @@ class CTEMPLATE_DLL_DECL TemplateCache {
// at either the beginning or end of a line. See template constructor
// for more details.
bool LoadTemplate(const TemplateString& filename, Strip strip)
/*LOCKS_EXCLUDED(*mutex_)*/;
/*LOCKS_EXCLUDED(mutex_)*/;
// Parses the string as a template file (e.g. "Hello {{WORLD}}"),
// 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.
bool StringToTemplateCache(const TemplateString& key,
const TemplateString& content,
Strip strip) /*LOCKS_EXCLUDED(*mutex_)*/;
Strip strip) /*LOCKS_EXCLUDED(mutex_)*/;
bool StringToTemplateCache(const TemplateString& key,
const char* content,
size_t content_len,
@ -143,7 +143,7 @@ class CTEMPLATE_DLL_DECL TemplateCache {
bool ExpandWithData(const TemplateString& filename, Strip strip,
const TemplateDictionaryInterface *dictionary,
PerExpandData* per_expand_data,
ExpandEmitter* output) /*LOCKS_EXCLUDED(*mutex_)*/;
ExpandEmitter* output) /*LOCKS_EXCLUDED(mutex_)*/;
bool ExpandWithData(const TemplateString& filename, Strip strip,
const TemplateDictionaryInterface* dictionary,
PerExpandData* per_expand_data,
@ -171,7 +171,7 @@ class CTEMPLATE_DLL_DECL TemplateCache {
const TemplateDictionaryInterface *dictionary,
PerExpandData* per_expand_data,
ExpandEmitter* output) const
/*LOCKS_EXCLUDED(*mutex_)*/;
/*LOCKS_EXCLUDED(mutex_)*/;
bool ExpandNoLoad(const TemplateString& filename, Strip strip,
const TemplateDictionaryInterface* dictionary,
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
// reloading existing templates. During expansion only cached
// included templates will be used, they won't be loaded on-demand.
void Freeze() /*LOCKS_EXCLUDED(*mutex_)*/;
void Freeze() /*LOCKS_EXCLUDED(mutex_)*/;
// Delete
// Deletes one template object from the cache, if it exists.
// This can be used for either file- or string-based templates.
// 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
// 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
// testing for memory leaks. Calling this before exiting the
// program will prevent unnecessary reporting in that case.
void ClearCache() /*LOCKS_EXCLUDED(*mutex_)*/;
void ClearCache() /*LOCKS_EXCLUDED(mutex_)*/;
// ReloadAllIfChanged
// 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
// doubt, LAZY_RELOAD is probably a better choice.
enum ReloadType { LAZY_RELOAD, IMMEDIATE_RELOAD };
void ReloadAllIfChanged(ReloadType reload_tyle) /*LOCKS_EXCLUDED(*mutex_)*/;
void ReloadAllIfChanged(ReloadType reload_tyle) /*LOCKS_EXCLUDED(mutex_)*/;
// Clone
// Returns a copy of the cache. It makes a shallow copy of the
// parsed_template_cache_, incrementing refcount of templates.
// 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 -------
// Dump
@ -285,7 +290,7 @@ class CTEMPLATE_DLL_DECL TemplateCache {
// This method is deprecated. It exists here because it is called by
// Template::GetTemplate. Also this is used in tests.
const Template* GetTemplate(const TemplateString& key, Strip strip)
/*LOCKS_EXCLUDED(*mutex_)*/;
/*LOCKS_EXCLUDED(mutex_)*/;
bool ResolveTemplateFilename(const std::string& unresolved,
std::string* resolved,
@ -298,11 +303,11 @@ class CTEMPLATE_DLL_DECL TemplateCache {
bool ExpandLocked(const TemplateString& filename, Strip strip,
ExpandEmitter* output,
const TemplateDictionaryInterface *dictionary,
PerExpandData* per_expand_data) /*LOCKS_EXCLUDED(*mutex_)*/;
PerExpandData* per_expand_data) /*LOCKS_EXCLUDED(mutex_)*/;
bool AddAlternateTemplateRootDirectoryHelper(
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
// 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,
// via ClearCache().
// TODO(panicker): Consider making this method public.
void DoneWithGetTemplatePtrs() /*LOCKS_EXCLUDED(*mutex_)*/;
void DoneWithGetTemplatePtrs() /*LOCKS_EXCLUDED(mutex_)*/;
// ValidTemplateFilename
// Validates the user provided filename before constructing the template
@ -332,7 +337,7 @@ class CTEMPLATE_DLL_DECL TemplateCache {
const TemplateString& filename,
Strip strip,
const TemplateCacheKey& key)
/*EXCLUSIVE_LOCKS_REQUIRED(*mutex_)*/;
/*EXCLUSIVE_LOCKS_REQUIRED(mutex_)*/;
// Refcount
// 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.
bool TemplateIsCached(const TemplateCacheKey template_cache_key) const;
TemplateMap* parsed_template_cache_ /*GUARDED_BY(*mutex_)*/;
bool is_frozen_ /*GUARDED_BY(*mutex_)*/;
TemplateSearchPath search_path_ /*GUARDED_BY(*search_path_mutex_)*/;
TemplateMap* parsed_template_cache_ /*GUARDED_BY(mutex_)*/;
bool is_frozen_ /*GUARDED_BY(mutex_)*/;
TemplateSearchPath search_path_ /*GUARDED_BY(search_path_mutex_)*/;
// Since GetTemplate() returns a raw pointer, it's impossible for
// 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
// DecRef() on all of them at once, via a DoneWithGetTemplatePtrs()
// (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* search_path_mutex_;