From: Ulya Trofimovich Date: Thu, 28 May 2015 17:26:10 +0000 (+0100) Subject: Moved utility class to a separate file in 'src/util/'. X-Git-Tag: 0.15~234 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=27420c7a2728b7b19684b006d31bd3b59d892b44;p=re2c Moved utility class to a separate file in 'src/util/'. --- diff --git a/re2c/Makefile.am b/re2c/Makefile.am index ba935e04..6bebdbca 100644 --- a/re2c/Makefile.am +++ b/re2c/Makefile.am @@ -61,6 +61,7 @@ SRC_HDR = \ $(srcdir)/src/util/c99_stdint.h \ $(srcdir)/src/util/forbid_copy.h \ $(srcdir)/src/util/free_list.h \ + $(srcdir)/src/util/local_increment.h \ $(srcdir)/src/util/range.h \ $(srcdir)/src/util/smart_ptr.h \ $(srcdir)/src/util/substr.h diff --git a/re2c/src/codegen/skeleton/skeleton.h b/re2c/src/codegen/skeleton/skeleton.h index 8ad67877..f0680410 100644 --- a/re2c/src/codegen/skeleton/skeleton.h +++ b/re2c/src/codegen/skeleton/skeleton.h @@ -7,6 +7,7 @@ #include "src/dfa/dfa.h" #include "src/util/c99_stdint.h" #include "src/util/forbid_copy.h" +#include "src/util/local_increment.h" namespace re2c { @@ -30,19 +31,6 @@ struct Path void append (const Path * p); }; -template -struct local_increment_t -{ - counter_t & counter; - inline explicit local_increment_t (counter_t & c) - : counter (++c) - {} - inline ~local_increment_t () - { - --counter; - } -}; - template class wrap_iter_t { diff --git a/re2c/src/util/local_increment.h b/re2c/src/util/local_increment.h new file mode 100644 index 00000000..6435083b --- /dev/null +++ b/re2c/src/util/local_increment.h @@ -0,0 +1,22 @@ +#ifndef __LOCAL_INCREMENT__ +#define __LOCAL_INCREMENT__ + +namespace re2c +{ + +template +struct local_increment_t +{ + counter_t & counter; + inline explicit local_increment_t (counter_t & c) + : counter (++c) + {} + inline ~local_increment_t () + { + --counter; + } +}; + +} // namespace re2c + +#endif // __LOCAL_INCREMENT__