Compare commits
130 Commits
Author | SHA1 | Date |
---|---|---|
Tomasz Sowa | d6ca791fbc | |
Tomasz Sowa | 3001707c69 | |
Tomasz Sowa | 5814bfca0d | |
Tomasz Sowa | 369cefacdf | |
Tomasz Sowa | 43fbf3b56c | |
Tomasz Sowa | d023abce74 | |
Tomasz Sowa | 3095d2d31f | |
Tomasz Sowa | 08da4a56b8 | |
Tomasz Sowa | cd4d8e025d | |
Tomasz Sowa | a03e3f5d21 | |
Tomasz Sowa | c31c7dfb63 | |
Tomasz Sowa | 0c058d4313 | |
Tomasz Sowa | d8692f6ed5 | |
Tomasz Sowa | b047a10e8d | |
Tomasz Sowa | a983698e3d | |
Tomasz Sowa | 6a8cb019f5 | |
Tomasz Sowa | b0afdf7f0f | |
Tomasz Sowa | b956f1c401 | |
Tomasz Sowa | 5e47313af8 | |
Tomasz Sowa | 44407c2a4b | |
Tomasz Sowa | ae6a5c52a1 | |
Tomasz Sowa | 9f416d31de | |
Tomasz Sowa | b9b9a881e0 | |
Tomasz Sowa | 995cccdace | |
Tomasz Sowa | 849b3e9ecc | |
Tomasz Sowa | acb42f453c | |
Tomasz Sowa | c2283f70d4 | |
Tomasz Sowa | 3926793a17 | |
Tomasz Sowa | 5bd8eef3f2 | |
Tomasz Sowa | 16bce07c75 | |
Tomasz Sowa | 87ee461dd1 | |
Tomasz Sowa | 526d57b72e | |
Tomasz Sowa | eda276356f | |
Tomasz Sowa | e442ee4720 | |
Tomasz Sowa | 615bad7372 | |
Tomasz Sowa | 9c4fe51790 | |
Tomasz Sowa | d76bb9349b | |
Tomasz Sowa | 4a64336864 | |
Tomasz Sowa | abb60def6e | |
Tomasz Sowa | 9022d4a5fc | |
Tomasz Sowa | e6fd9aad37 | |
Tomasz Sowa | 3b858650f2 | |
Tomasz Sowa | 052f803eac | |
Tomasz Sowa | 0bcaca4770 | |
Tomasz Sowa | 0ac8e05c04 | |
Tomasz Sowa | 6f6df9524c | |
Tomasz Sowa | cd1c24d0a5 | |
Tomasz Sowa | d1a15ad153 | |
Tomasz Sowa | 29c7163d9b | |
Tomasz Sowa | b289aa7f0a | |
Tomasz Sowa | 9e82aa9bcf | |
Tomasz Sowa | 632c81812f | |
Tomasz Sowa | 1e85922d4e | |
Tomasz Sowa | bf62d44346 | |
Tomasz Sowa | a6b767a223 | |
Tomasz Sowa | c825c85878 | |
Tomasz Sowa | 54387e43bb | |
Tomasz Sowa | eace4d41cc | |
Tomasz Sowa | 363605bde5 | |
Tomasz Sowa | 18696d412b | |
Tomasz Sowa | 2190fae789 | |
Tomasz Sowa | 0e99ded5b8 | |
Tomasz Sowa | a1ea2e3ccd | |
Tomasz Sowa | 0dc807dbff | |
Tomasz Sowa | c3deb960c5 | |
Tomasz Sowa | 7b6f7ad328 | |
Tomasz Sowa | 76490d4c19 | |
Tomasz Sowa | 6b42cdf76e | |
Tomasz Sowa | b519c79a3e | |
Tomasz Sowa | 6f1e2eb518 | |
Tomasz Sowa | ad50c01b15 | |
Tomasz Sowa | 0a7bd3159a | |
Tomasz Sowa | 6bd8889456 | |
Tomasz Sowa | 03fe124ad9 | |
Tomasz Sowa | 6f9f274e08 | |
Tomasz Sowa | 2fca5f3492 | |
Tomasz Sowa | ad2fb11a5c | |
Tomasz Sowa | 00f8af232b | |
Tomasz Sowa | 429021f687 | |
Tomasz Sowa | 71c5bd11d5 | |
Tomasz Sowa | b5faf171e3 | |
Tomasz Sowa | fd75a1f119 | |
Tomasz Sowa | d9a8426ebc | |
Tomasz Sowa | 759be64379 | |
Tomasz Sowa | ef16ae4ebd | |
Tomasz Sowa | 417e52a5a1 | |
Tomasz Sowa | 5de31cfe41 | |
Tomasz Sowa | 9215130b9d | |
Tomasz Sowa | 23ce3e83df | |
Tomasz Sowa | ac37982ee7 | |
Tomasz Sowa | 68c1fb8ef8 | |
Tomasz Sowa | 787b5e99b2 | |
Tomasz Sowa | 4fc842ad91 | |
Tomasz Sowa | 8e85a398d6 | |
Tomasz Sowa | 4480268172 | |
Tomasz Sowa | 71bec1049b | |
Tomasz Sowa | a728f86e05 | |
Tomasz Sowa | 2c3a2160af | |
Tomasz Sowa | faaac0de8a | |
Tomasz Sowa | c6b4db0aa9 | |
Tomasz Sowa | b4f7d4b8de | |
Tomasz Sowa | 542587e5e8 | |
Tomasz Sowa | fb05eb6860 | |
Tomasz Sowa | 8df9aa86a0 | |
Tomasz Sowa | 2d304a9714 | |
Tomasz Sowa | 861269383e | |
Tomasz Sowa | 542e50d757 | |
Tomasz Sowa | 3c85fa1a75 | |
Tomasz Sowa | fd2194623a | |
Tomasz Sowa | c4f5f79218 | |
Tomasz Sowa | 0b09b5454f | |
Tomasz Sowa | 5108495540 | |
Tomasz Sowa | 33c86d494b | |
Tomasz Sowa | 8f94937ed1 | |
Tomasz Sowa | b5ea2514e2 | |
Tomasz Sowa | 376fe414f8 | |
Tomasz Sowa | 7554630395 | |
Tomasz Sowa | 573d241dc1 | |
Tomasz Sowa | c807d1c9b3 | |
Tomasz Sowa | b89c6daa7d | |
Tomasz Sowa | f65178dd0e | |
Tomasz Sowa | bb00f23f29 | |
Tomasz Sowa | 31156d33f3 | |
Tomasz Sowa | e71c213ad1 | |
Tomasz Sowa | b2aacc2da3 | |
Tomasz Sowa | dbe91a6d91 | |
Tomasz Sowa | 9b4586d7be | |
Tomasz Sowa | 141e1f67b3 | |
Tomasz Sowa | f8f55eae77 | |
Tomasz Sowa | 0b88257e08 |
|
@ -0,0 +1,21 @@
|
||||||
|
# EditorConfig
|
||||||
|
# https://editorconfig.org/
|
||||||
|
# https://editorconfig-specification.readthedocs.io/
|
||||||
|
|
||||||
|
# top-most EditorConfig file
|
||||||
|
root = true
|
||||||
|
|
||||||
|
# Unix-style newlines with a newline ending every file
|
||||||
|
[*]
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
# 4 space indentation
|
||||||
|
[*.{h,cpp,html,css,js,conf,txt}]
|
||||||
|
indent_style = tab
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
|
# Tab indentation (no size specified)
|
||||||
|
[Makefile]
|
||||||
|
indent_style = tab
|
||||||
|
indent_size = 4
|
|
@ -0,0 +1,14 @@
|
||||||
|
.cproject
|
||||||
|
.project
|
||||||
|
.settings/
|
||||||
|
*.o
|
||||||
|
*.a
|
||||||
|
.clangd
|
||||||
|
.qtc_clangd/
|
||||||
|
ezc.cflags
|
||||||
|
ezc.config
|
||||||
|
ezc.creator
|
||||||
|
ezc.creator.user
|
||||||
|
ezc.cxxflags
|
||||||
|
ezc.files
|
||||||
|
ezc.includes
|
|
@ -1,28 +1,24 @@
|
||||||
Copyright (c) 2007, Tomasz Sowa
|
Copyright (c) 2007-2022, Tomasz Sowa
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions are met:
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright notice,
|
1. Redistributions of source code must retain the above copyright notice,
|
||||||
this list of conditions and the following disclaimer.
|
this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
* Redistributions in binary form must reproduce the above copyright
|
2. Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
* Neither the name Tomasz Sowa nor the names of contributors to this
|
|
||||||
project may be used to endorse or promote products derived
|
|
||||||
from this software without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
THE POSSIBILITY OF SUCH DAMAGE.
|
POSSIBILITY OF SUCH DAMAGE.
|
|
@ -0,0 +1,25 @@
|
||||||
|
|
||||||
|
|
||||||
|
export CXX
|
||||||
|
export CXXFLAGS
|
||||||
|
export AR
|
||||||
|
|
||||||
|
|
||||||
|
all: src
|
||||||
|
|
||||||
|
|
||||||
|
src: FORCE
|
||||||
|
$(MAKE) -C src
|
||||||
|
|
||||||
|
|
||||||
|
clean: FORCE
|
||||||
|
$(MAKE) -C src clean
|
||||||
|
|
||||||
|
|
||||||
|
depend: FORCE
|
||||||
|
$(MAKE) -C src depend
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
FORCE:
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
sourcefiles:=$(shell find . -name "*.cpp")
|
||||||
|
objfiles:=$(patsubst %.cpp,%.o,$(sourcefiles))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ifndef CXX
|
||||||
|
CXX = g++
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef CXXFLAGS
|
||||||
|
CXXFLAGS = -Wall -pedantic -O2 -std=c++20 -I../../pikotools/src -I/usr/local/include
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef AR
|
||||||
|
AR = ar
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
libname = ezc.a
|
||||||
|
|
||||||
|
|
||||||
|
all: $(libname)
|
||||||
|
|
||||||
|
|
||||||
|
$(libname): $(objfiles)
|
||||||
|
$(AR) rcs $(libname) $(objfiles)
|
||||||
|
|
||||||
|
|
||||||
|
%.o: %.cpp
|
||||||
|
$(CXX) -c $(CXXFLAGS) -o $@ $<
|
||||||
|
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(objfiles)
|
||||||
|
rm -f $(libname)
|
||||||
|
|
||||||
|
|
||||||
|
depend:
|
||||||
|
makedepend -Y. -I../../pikotools/src -f- $(sourcefiles) > Makefile.dep
|
||||||
|
|
||||||
|
|
||||||
|
-include Makefile.dep
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
# DO NOT DELETE
|
||||||
|
|
||||||
|
./blocks.o: blocks.h item.h cache.h functions.h
|
||||||
|
./blocks.o: ../../pikotools/src/utf8/utf8.h
|
||||||
|
./blocks.o: ../../pikotools/src/textstream/stream.h funinfo.h objects.h
|
||||||
|
./cache.o: cache.h item.h functions.h ../../pikotools/src/utf8/utf8.h
|
||||||
|
./cache.o: ../../pikotools/src/textstream/stream.h funinfo.h objects.h
|
||||||
|
./cache.o: blocks.h
|
||||||
|
./item.o: item.h
|
||||||
|
./pattern.o: pattern.h item.h cache.h functions.h
|
||||||
|
./pattern.o: ../../pikotools/src/utf8/utf8.h
|
||||||
|
./pattern.o: ../../pikotools/src/textstream/stream.h funinfo.h objects.h
|
||||||
|
./pattern.o: blocks.h
|
||||||
|
./patternparser.o: patternparser.h blocks.h item.h cache.h functions.h
|
||||||
|
./patternparser.o: ../../pikotools/src/utf8/utf8.h
|
||||||
|
./patternparser.o: ../../pikotools/src/textstream/stream.h funinfo.h
|
||||||
|
./patternparser.o: objects.h pattern.h ../../pikotools/src/log/log.h
|
||||||
|
./patternparser.o: ../../pikotools/src/textstream/textstream.h
|
||||||
|
./patternparser.o: ../../pikotools/src/textstream/stream.h
|
||||||
|
./patternparser.o: ../../pikotools/src/space/space.h
|
||||||
|
./patternparser.o: ../../pikotools/src/convert/inttostr.h
|
||||||
|
./patternparser.o: ../../pikotools/src/date/date.h
|
||||||
|
./patternparser.o: ../../pikotools/src/membuffer/membuffer.h
|
||||||
|
./patternparser.o: ../../pikotools/src/textstream/types.h
|
||||||
|
./patternparser.o: ../../pikotools/src/textstream/stream_private.h
|
||||||
|
./patternparser.o: ../../pikotools/src/log/filelog.h
|
||||||
|
./patternparser.o: ../../pikotools/src/convert/convert.h
|
||||||
|
./patternparser.o: ../../pikotools/src/convert/inttostr.h
|
||||||
|
./patternparser.o: ../../pikotools/src/convert/patternreplacer.h
|
||||||
|
./patternparser.o: ../../pikotools/src/convert/strtoint.h
|
||||||
|
./patternparser.o: ../../pikotools/src/convert/text.h
|
||||||
|
./patternparser.o: ../../pikotools/src/convert/misc.h
|
||||||
|
./patternparser.o: ../../pikotools/src/textstream/types.h
|
||||||
|
./patternparser.o: ../../pikotools/src/convert/double.h
|
||||||
|
./models.o: models.h
|
|
@ -0,0 +1,98 @@
|
||||||
|
/*
|
||||||
|
* This file is a part of EZC -- Easy templating in C++ library
|
||||||
|
* and is distributed under the 2-Clause BSD licence.
|
||||||
|
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2014, Tomasz Sowa
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "blocks.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Ezc
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
void Blocks::Insert(const std::wstring & name, const Item & item)
|
||||||
|
{
|
||||||
|
blocks_tab[name] = item;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Blocks::Iterator Blocks::Find(const std::wstring & name)
|
||||||
|
{
|
||||||
|
return blocks_tab.find(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Blocks::Iterator Blocks::Begin()
|
||||||
|
{
|
||||||
|
return blocks_tab.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Blocks::Iterator Blocks::End()
|
||||||
|
{
|
||||||
|
return blocks_tab.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
size_t Blocks::Size() const
|
||||||
|
{
|
||||||
|
return blocks_tab.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Blocks::Clear()
|
||||||
|
{
|
||||||
|
blocks_tab.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Blocks::ClearCache()
|
||||||
|
{
|
||||||
|
BlocksTable::iterator i = blocks_tab.begin();
|
||||||
|
|
||||||
|
for( ; i != blocks_tab.end() ; ++i)
|
||||||
|
i->second.ClearCache();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void Blocks::CacheBlocks(Blocks & blocks)
|
||||||
|
{
|
||||||
|
BlocksTable::iterator i = blocks_tab.begin();
|
||||||
|
|
||||||
|
for( ; i != blocks_tab.end() ; ++i)
|
||||||
|
Cache(blocks, i->second);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace
|
|
@ -0,0 +1,101 @@
|
||||||
|
/*
|
||||||
|
* This file is a part of EZC -- Easy templating in C++ library
|
||||||
|
* and is distributed under the 2-Clause BSD licence.
|
||||||
|
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2014-2015, Tomasz Sowa
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef headerfile_ezc_blocks
|
||||||
|
#define headerfile_ezc_blocks
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <map>
|
||||||
|
#include "item.h"
|
||||||
|
#include "cache.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Ezc
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Blocks
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
typedef std::map<std::wstring, Item> BlocksTable;
|
||||||
|
typedef BlocksTable::iterator Iterator;
|
||||||
|
|
||||||
|
void Insert(const std::wstring & name, const Item & item);
|
||||||
|
|
||||||
|
Iterator Find(const std::wstring & name);
|
||||||
|
|
||||||
|
Iterator Begin();
|
||||||
|
Iterator End();
|
||||||
|
size_t Size() const;
|
||||||
|
void Clear();
|
||||||
|
|
||||||
|
template<class StreamType> void CacheObjects(Objects<StreamType> & obj);
|
||||||
|
template<class StreamType> void CacheFunctions(Functions<StreamType> & fun);
|
||||||
|
|
||||||
|
void CacheBlocks(Blocks & blocks);
|
||||||
|
void ClearCache();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
BlocksTable blocks_tab;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template<class StreamType>
|
||||||
|
void Blocks::CacheObjects(Objects<StreamType> & obj)
|
||||||
|
{
|
||||||
|
BlocksTable::iterator i = blocks_tab.begin();
|
||||||
|
|
||||||
|
for( ; i != blocks_tab.end() ; ++i)
|
||||||
|
Cache(obj, i->second);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class StreamType>
|
||||||
|
void Blocks::CacheFunctions(Functions<StreamType> & fun)
|
||||||
|
{
|
||||||
|
BlocksTable::iterator i = blocks_tab.begin();
|
||||||
|
|
||||||
|
for( ; i != blocks_tab.end() ; ++i)
|
||||||
|
Cache(fun, i->second);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,80 @@
|
||||||
|
/*
|
||||||
|
* This file is a part of EZC -- Easy templating in C++ library
|
||||||
|
* and is distributed under the 2-Clause BSD licence.
|
||||||
|
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2014-2015, Tomasz Sowa
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "cache.h"
|
||||||
|
#include "blocks.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
namespace Ezc
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
void Cache(Blocks & blocks, Item::Function & function)
|
||||||
|
{
|
||||||
|
function.item_block = 0;
|
||||||
|
|
||||||
|
if( !function.name.empty() && function.arg < 0 )
|
||||||
|
{
|
||||||
|
Blocks::Iterator i = blocks.Find(function.name);
|
||||||
|
|
||||||
|
if( i != blocks.End() )
|
||||||
|
function.item_block = &i->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(size_t i=0 ; i < function.parameters.size() ; ++i)
|
||||||
|
Cache(blocks, *function.parameters[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void Cache(Blocks & blocks, Item & item)
|
||||||
|
{
|
||||||
|
Cache(blocks, item.function);
|
||||||
|
|
||||||
|
for(size_t i=0; i < item.item_tab.size() ; ++i)
|
||||||
|
Cache(blocks, *item.item_tab[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Ezc
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,121 @@
|
||||||
|
/*
|
||||||
|
* This file is a part of EZC -- Easy templating in C++ library
|
||||||
|
* and is distributed under the 2-Clause BSD licence.
|
||||||
|
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2014-2015, Tomasz Sowa
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef headerfile_ezc_cache
|
||||||
|
#define headerfile_ezc_cache
|
||||||
|
|
||||||
|
#include "item.h"
|
||||||
|
#include "functions.h"
|
||||||
|
#include "objects.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
namespace Ezc
|
||||||
|
{
|
||||||
|
|
||||||
|
class Blocks;
|
||||||
|
|
||||||
|
|
||||||
|
template<class StreamType>
|
||||||
|
void Cache(Functions<StreamType> & fun, Item::Function & function)
|
||||||
|
{
|
||||||
|
function.fun_cache = 0;
|
||||||
|
|
||||||
|
if( !function.name.empty() && function.arg < 0 )
|
||||||
|
{
|
||||||
|
typename Functions<StreamType>::Iterator i = fun.Find(function.name);
|
||||||
|
|
||||||
|
if( i != fun.End() )
|
||||||
|
function.fun_cache = &i->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(size_t i=0 ; i < function.parameters.size() ; ++i)
|
||||||
|
Cache(fun, *function.parameters[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class StreamType>
|
||||||
|
void Cache(Functions<StreamType> & fun, Item & item)
|
||||||
|
{
|
||||||
|
Cache(fun, item.function);
|
||||||
|
|
||||||
|
for(size_t i=0; i < item.item_tab.size() ; ++i)
|
||||||
|
Cache(fun, *item.item_tab[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void Cache(Blocks & blocks, Item & item);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
template<class StreamType>
|
||||||
|
void Cache(Objects<StreamType> & objects, Item::Function & function)
|
||||||
|
{
|
||||||
|
function.base_obj = 0;
|
||||||
|
function.method_index = -1;
|
||||||
|
|
||||||
|
if( !function.name.empty() && function.arg < 0 )
|
||||||
|
{
|
||||||
|
typename Objects<StreamType>::Iterator i = objects.Find(function.name, function.method_index);
|
||||||
|
|
||||||
|
if( i != objects.End() )
|
||||||
|
function.base_obj = *i;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(size_t i=0 ; i < function.parameters.size() ; ++i)
|
||||||
|
Cache(objects, *function.parameters[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
template<class StreamType>
|
||||||
|
void Cache(Objects<StreamType> & objects, Item & item)
|
||||||
|
{
|
||||||
|
Cache(objects, item.function);
|
||||||
|
|
||||||
|
for(size_t i=0; i < item.item_tab.size() ; ++i)
|
||||||
|
Cache(objects, *item.item_tab[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Ezc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,66 @@
|
||||||
|
/*
|
||||||
|
* This file is a part of EZC -- Easy templating in C++ library
|
||||||
|
* and is distributed under the 2-Clause BSD licence.
|
||||||
|
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018, Tomasz Sowa
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef headerfile_ezc_expressionparser
|
||||||
|
#define headerfile_ezc_expressionparser
|
||||||
|
|
||||||
|
|
||||||
|
namespace Ezc
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class ExpressionParser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
ExpressionParser() {};
|
||||||
|
virtual ~ExpressionParser() {};
|
||||||
|
|
||||||
|
// temporarily
|
||||||
|
|
||||||
|
|
||||||
|
virtual bool Parse(const std::wstring & str) = 0;
|
||||||
|
virtual bool LastResultToBool() = 0;
|
||||||
|
virtual std::wstring LastResult() = 0;
|
||||||
|
virtual int LastError() = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
1191
src/ezc.cpp
1191
src/ezc.cpp
File diff suppressed because it is too large
Load Diff
255
src/ezc.h
255
src/ezc.h
|
@ -1,260 +1,43 @@
|
||||||
/*
|
/*
|
||||||
* This file is a part of EZC -- Easy templating in C++
|
* This file is a part of EZC -- Easy templating in C++ library
|
||||||
* and is distributed under the (new) BSD licence.
|
* and is distributed under the 2-Clause BSD licence.
|
||||||
* Author: Tomasz Sowa <t.sowa@slimaczek.pl>
|
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007-2008, Tomasz Sowa
|
* Copyright (c) 2007-2022, Tomasz Sowa
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
*
|
*
|
||||||
* * Redistributions of source code must retain the above copyright notice,
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
*
|
*
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
*
|
|
||||||
* * Neither the name Tomasz Sowa nor the names of contributors to this
|
|
||||||
* project may be used to endorse or promote products derived
|
|
||||||
* from this software without specific prior written permission.
|
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* version 0.9.1
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef headerfileezc
|
#ifndef headerfile_ezc_ezc
|
||||||
#define headerfileezc
|
#define headerfile_ezc_ezc
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <sstream>
|
|
||||||
#include <fstream>
|
|
||||||
#include <vector>
|
|
||||||
#include <map>
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <cstring>
|
|
||||||
|
|
||||||
|
|
||||||
namespace Ezc
|
|
||||||
{
|
|
||||||
|
|
||||||
void CreateMsg(std::ostringstream & o, const char * type, const char * arg = 0);
|
|
||||||
std::string CreateMsg(const char * type, const char * arg = 0);
|
|
||||||
void SplitUnixDirectory(const char * name, std::string & dir, std::string & file);
|
|
||||||
void SplitUnixDirectory(const std::string & name, std::string & dir, std::string & file);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Pattern
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
void ParseFile(const std::string & file_name);
|
|
||||||
void ParseFile(const char * file_name);
|
|
||||||
void Directory(const char * d);
|
|
||||||
void Directory(const std::string & d);
|
|
||||||
|
|
||||||
struct Item
|
|
||||||
{
|
|
||||||
// change the name to 'Type'
|
|
||||||
enum ItemType
|
|
||||||
{
|
|
||||||
item_none, item_container, item_text, item_ifany, item_for,
|
|
||||||
item_else, item_end, item_err, item_normal, item_ifindex,
|
|
||||||
item_include, item_is, item_ifone, item_comment, item_def
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ItemType type;
|
|
||||||
std::string text;
|
|
||||||
std::vector<Item*> item_table;
|
|
||||||
std::vector<std::string> directives;
|
|
||||||
|
|
||||||
Item();
|
|
||||||
Item(const Item & i);
|
|
||||||
Item & operator=(const Item & i);
|
|
||||||
void CopyItemTable(const Item & i);
|
|
||||||
~Item();
|
|
||||||
|
|
||||||
Item * AddItem(const Item * porg = 0);
|
|
||||||
Item * AddItem(const Item & porg);
|
|
||||||
void ClearItems();
|
|
||||||
ItemType LastItemType();
|
|
||||||
void DeleteLastItem();
|
|
||||||
void Clear();
|
|
||||||
};
|
|
||||||
|
|
||||||
Item item_root;
|
|
||||||
|
|
||||||
private:
|
|
||||||
const char * itext;
|
|
||||||
std::string directory;
|
|
||||||
|
|
||||||
|
|
||||||
bool CheckFileName(const char * name);
|
|
||||||
std::string ReadFile(const char * name);
|
|
||||||
|
|
||||||
int ReadCharInText();
|
|
||||||
void SkipWhiteCharacters();
|
|
||||||
|
|
||||||
std::string ReadDirective();
|
|
||||||
std::string ReadString(bool skip_first_quote = false);
|
|
||||||
std::string ReadDirectiveOrString();
|
|
||||||
|
|
||||||
void CreateTreeReadItemDirectiveCheckEnding(Item & item);
|
|
||||||
|
|
||||||
void ReadDirectiveIfany(Item & item);
|
|
||||||
void ReadDirectiveIfone(Item & item);
|
|
||||||
void ReadDirectiveIs(Item & item);
|
|
||||||
void ReadDirectiveIfindex(Item & item);
|
|
||||||
void ReadDirectiveFor(Item & item);
|
|
||||||
void ReadDirectiveComment(Item & item);
|
|
||||||
void ReadDirectiveInclude(Item & item);
|
|
||||||
void ReadDirectiveDef(Item & item);
|
|
||||||
|
|
||||||
void CreateTreeReadItemDirective(Item & item);
|
|
||||||
|
|
||||||
void CreateTreeReadItemText(Item & item);
|
|
||||||
bool CreateTreeReadItem(Item & item);
|
|
||||||
|
|
||||||
void CreateTreeReadIf(Item & item);
|
|
||||||
void CreateTreeReadFor(Item & item);
|
|
||||||
void CreateTree(Item & item);
|
|
||||||
|
|
||||||
void CreateTreeReadInclude(Item & item);
|
|
||||||
|
|
||||||
}; // Pattern
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct Info
|
|
||||||
{
|
|
||||||
// this variables you can set in your function
|
|
||||||
std::ostringstream & out;
|
|
||||||
std::string out_string;
|
|
||||||
bool result;
|
|
||||||
|
|
||||||
// this is set by Generator
|
|
||||||
// normally is 0
|
|
||||||
// in a [for] statement it indicates the number of the current iteration (the first is 0)
|
|
||||||
int iter;
|
|
||||||
|
|
||||||
|
|
||||||
Info(std::ostringstream & o);
|
|
||||||
void Clear();
|
|
||||||
|
|
||||||
bool IsTrue() const;
|
|
||||||
bool IsFalse() const;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Functions
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
typedef void (*UserFunction)(Info &);
|
|
||||||
enum Type { function, variable };
|
|
||||||
|
|
||||||
struct Function
|
|
||||||
{
|
|
||||||
Type type;
|
|
||||||
|
|
||||||
UserFunction user_function;
|
|
||||||
std::string variable;
|
|
||||||
|
|
||||||
int iter;
|
|
||||||
bool is_for; // true if is used by a [for] statement
|
|
||||||
bool is_running; // true if this function (if is) is currently running
|
|
||||||
|
|
||||||
Function();
|
|
||||||
};
|
|
||||||
|
|
||||||
void Insert(const std::string & key, UserFunction ufunction); // inserting a function
|
|
||||||
void Insert(const std::string & key, const char * var); // inserting a variable
|
|
||||||
void Insert(const std::string & key, const std::string & var); // inserting a variable
|
|
||||||
|
|
||||||
bool Find(const std::string & key, Function ** fun);
|
|
||||||
void Clear();
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
typedef std::map<std::string, Function> FunctionsTable;
|
|
||||||
FunctionsTable functions_table;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Generator
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
Generator(std::ostringstream &, Pattern & data, Functions & functions);
|
|
||||||
void Generate();
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
std::ostringstream & output_stream;
|
|
||||||
Pattern & pattern;
|
|
||||||
Functions & functions;
|
|
||||||
|
|
||||||
Info info1, info2;
|
|
||||||
int loop;
|
|
||||||
|
|
||||||
bool Find(const std::string & key, Functions::Function ** function);
|
|
||||||
|
|
||||||
|
|
||||||
bool Call(const std::string & name, Info & info, Functions::Function ** pfun = 0);
|
|
||||||
void Call(Functions::Function * function, Info & info);
|
|
||||||
|
|
||||||
void CallUserFunction(Functions::Function * function, Info & info);
|
|
||||||
void CallVariable(Functions::Function * function, Info & info);
|
|
||||||
|
|
||||||
void MakeTextIf_go(Pattern::Item & item, bool result);
|
|
||||||
bool MakeTextIfindexnumber(Pattern::Item & item, Functions::Function * function, bool & result);
|
|
||||||
void MakeTextIfany(Pattern::Item & item);
|
|
||||||
void MakeTextIfone(Pattern::Item & item);
|
|
||||||
void MakeTextIfindex(Pattern::Item & item);
|
|
||||||
void MakeTextFor(Pattern::Item & item);
|
|
||||||
void MakeTextContainer(Pattern::Item & item);
|
|
||||||
void MakeTextNormal(Pattern::Item & item);
|
|
||||||
void MakeTextIs(Pattern::Item & item);
|
|
||||||
void MakeTextDefine(Pattern::Item & item);
|
|
||||||
void MakeText(Pattern::Item & item);
|
|
||||||
|
|
||||||
}; // Generator
|
|
||||||
|
|
||||||
} // namespace Ezc
|
|
||||||
|
|
||||||
|
#include "version.h"
|
||||||
|
#include "generator.h"
|
||||||
|
#include "patternparser.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -0,0 +1,163 @@
|
||||||
|
/*
|
||||||
|
* This file is a part of EZC -- Easy templating in C++ library
|
||||||
|
* and is distributed under the 2-Clause BSD licence.
|
||||||
|
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2007-2015, Tomasz Sowa
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef headerfile_ezc_functions
|
||||||
|
#define headerfile_ezc_functions
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
#include "utf8/utf8.h"
|
||||||
|
#include "funinfo.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
namespace Ezc
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// functions or variables
|
||||||
|
template<class StreamType>
|
||||||
|
class Functions
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
typedef void (*UserFunction)(FunInfo<StreamType> &);
|
||||||
|
typedef std::map<std::wstring, UserFunction> FunctionsTable;
|
||||||
|
typedef typename FunctionsTable::iterator Iterator;
|
||||||
|
|
||||||
|
void Insert(const char * key, UserFunction ufunction);
|
||||||
|
void Insert(const std::string & key, UserFunction ufunction);
|
||||||
|
void Insert(const wchar_t * key, UserFunction ufunction);
|
||||||
|
void Insert(const std::wstring & key, UserFunction ufunction);
|
||||||
|
|
||||||
|
Iterator Find(const std::wstring & key);
|
||||||
|
|
||||||
|
Iterator Begin();
|
||||||
|
Iterator End();
|
||||||
|
size_t Size() const;
|
||||||
|
void Clear();
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
FunctionsTable functions_tab;
|
||||||
|
std::wstring temp_key;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
template<class StreamType>
|
||||||
|
void Functions<StreamType>::Insert(const char * key, UserFunction ufunction)
|
||||||
|
{
|
||||||
|
pt::utf8_to_wide(key, temp_key);
|
||||||
|
functions_tab[temp_key] = ufunction;
|
||||||
|
temp_key.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class StreamType>
|
||||||
|
void Functions<StreamType>::Insert(const std::string & key, UserFunction ufunction)
|
||||||
|
{
|
||||||
|
Insert(key.c_str(), ufunction);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class StreamType>
|
||||||
|
void Functions<StreamType>::Insert(const wchar_t * key, UserFunction ufunction)
|
||||||
|
{
|
||||||
|
temp_key = key;
|
||||||
|
functions_tab[temp_key] = ufunction;
|
||||||
|
temp_key.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class StreamType>
|
||||||
|
void Functions<StreamType>::Insert(const std::wstring & key, UserFunction ufunction)
|
||||||
|
{
|
||||||
|
functions_tab[key] = ufunction;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
template<class StreamType>
|
||||||
|
typename Functions<StreamType>::Iterator Functions<StreamType>::Find(const std::wstring & key)
|
||||||
|
{
|
||||||
|
return functions_tab.find(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
template<class StreamType>
|
||||||
|
void Functions<StreamType>::Clear()
|
||||||
|
{
|
||||||
|
functions_tab.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class StreamType>
|
||||||
|
typename Functions<StreamType>::Iterator Functions<StreamType>::Begin()
|
||||||
|
{
|
||||||
|
return functions_tab.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class StreamType>
|
||||||
|
typename Functions<StreamType>::Iterator Functions<StreamType>::End()
|
||||||
|
{
|
||||||
|
return functions_tab.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class StreamType>
|
||||||
|
size_t Functions<StreamType>::Size() const
|
||||||
|
{
|
||||||
|
return functions_tab.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Ezc
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,304 @@
|
||||||
|
/*
|
||||||
|
* This file is a part of EZC -- Easy templating in C++ library
|
||||||
|
* and is distributed under the 2-Clause BSD licence.
|
||||||
|
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2007-2023, Tomasz Sowa
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef headerfile_ezc_funinfo
|
||||||
|
#define headerfile_ezc_funinfo
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <map>
|
||||||
|
#include "item.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
namespace Ezc
|
||||||
|
{
|
||||||
|
|
||||||
|
/*
|
||||||
|
a variable
|
||||||
|
*/
|
||||||
|
struct Var
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* if true then means 'str' is a function name and should be called (res is ignored)
|
||||||
|
*
|
||||||
|
* if false then means 'str' is a string value and res is a boolean value
|
||||||
|
*/
|
||||||
|
bool is_function;
|
||||||
|
|
||||||
|
std::wstring str; // a string value
|
||||||
|
bool res; // a boolean value
|
||||||
|
|
||||||
|
Var()
|
||||||
|
{
|
||||||
|
res = false;
|
||||||
|
is_function = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
typedef std::map<std::wstring, Var> Vars;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
a base class for your own function data class
|
||||||
|
*/
|
||||||
|
struct FunData
|
||||||
|
{
|
||||||
|
FunData()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual ~FunData()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
a generator's stack item
|
||||||
|
each statement ([if ...] [for ...] [normal_funcion]) have its own stack item
|
||||||
|
iter - is used only in [for...] - it is the current iteration (start from zero)
|
||||||
|
for other statements it is always zero
|
||||||
|
fun_data - by default this is null pointer, you can set it to a pointer
|
||||||
|
to an object derived from FunData
|
||||||
|
(this have sense only in [for...] statement because in other statements
|
||||||
|
this object would be immediately removed)
|
||||||
|
auto_remove - when true it means that object pointing by fun_data and for_name should be automatically
|
||||||
|
removed -- (by using delete fun_data and delete for_name)
|
||||||
|
is_for - true if the item is from [for] statement
|
||||||
|
currently used only in [if-index]
|
||||||
|
(it has to look for the last [for] item)
|
||||||
|
*/
|
||||||
|
struct Stack
|
||||||
|
{
|
||||||
|
size_t iter;
|
||||||
|
FunData * fun_data;
|
||||||
|
bool auto_remove;
|
||||||
|
bool is_for;
|
||||||
|
const Item * item;
|
||||||
|
|
||||||
|
|
||||||
|
Stack()
|
||||||
|
{
|
||||||
|
Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
~Stack()
|
||||||
|
{
|
||||||
|
if( auto_remove )
|
||||||
|
{
|
||||||
|
if( fun_data )
|
||||||
|
{
|
||||||
|
delete fun_data;
|
||||||
|
fun_data = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Clear()
|
||||||
|
{
|
||||||
|
iter = 0;
|
||||||
|
fun_data = 0;
|
||||||
|
auto_remove = true;
|
||||||
|
is_for = false;
|
||||||
|
item = 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// !! IMPROVE ME
|
||||||
|
// the name is bad
|
||||||
|
// may it should be called Env (environment) or FunEnv
|
||||||
|
template<class StreamType>
|
||||||
|
struct FunInfo
|
||||||
|
{
|
||||||
|
// a result consists of a string and a boolean value
|
||||||
|
// output stream
|
||||||
|
StreamType & out;
|
||||||
|
// return value from a user's function (default false if not set directly by the function)
|
||||||
|
bool res;
|
||||||
|
|
||||||
|
// table of parameters
|
||||||
|
// the table can be empty
|
||||||
|
std::vector<Var> & params;
|
||||||
|
|
||||||
|
// the first parameter
|
||||||
|
// you can always use it even if there are not any parameters (params is empty)
|
||||||
|
// in such a way the reference points to an empty string
|
||||||
|
const std::wstring & par;
|
||||||
|
|
||||||
|
// an input stream used in [filter] statement
|
||||||
|
// if there is other statement than [filter] then this is an empty stream
|
||||||
|
const StreamType & in;
|
||||||
|
|
||||||
|
// indicates that this function is from [for ...] statement
|
||||||
|
bool is_for;
|
||||||
|
|
||||||
|
// indicates that this function is from [if ...] statement
|
||||||
|
bool is_if;
|
||||||
|
|
||||||
|
// indicates that this function is from [if-def ...] statement
|
||||||
|
bool is_if_def;
|
||||||
|
|
||||||
|
// indicates that this function is from [if-not-def ...] statement
|
||||||
|
bool is_if_not_def;
|
||||||
|
|
||||||
|
// indicates that this funcion is a normal statement e.g.: [funcion_name]
|
||||||
|
bool is_normal;
|
||||||
|
|
||||||
|
// indicates that this function is from a filter statement [filter ...]
|
||||||
|
bool is_filter;
|
||||||
|
|
||||||
|
// a pointer to the stack
|
||||||
|
Stack * stack_tab;
|
||||||
|
|
||||||
|
// current stack item
|
||||||
|
size_t stack_index;
|
||||||
|
|
||||||
|
// a stack's item from generator's stack
|
||||||
|
// each function has a new stack item
|
||||||
|
// on this stack you have iter (description below) and fun_data pointer
|
||||||
|
// you can assign to it your own object derived from FunData
|
||||||
|
// 'stack' is a reference to stack_tab[stack_index]
|
||||||
|
Stack & stack;
|
||||||
|
|
||||||
|
// the same as stack.iter (this is mainly for backward compatibility)
|
||||||
|
// it indicates the number of a current iteration for the [for] statement (the first iteration is 0)
|
||||||
|
// for other statements than [for] this is always zero
|
||||||
|
size_t iter;
|
||||||
|
|
||||||
|
// an item from the tree
|
||||||
|
const Item & item;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// arguments: output_stream, table_of_parameters, the_first_parameter
|
||||||
|
FunInfo(StreamType & o,
|
||||||
|
std::vector<Var> & pars,
|
||||||
|
const std::wstring & first_par,
|
||||||
|
const StreamType & input_stream,
|
||||||
|
Stack & s,
|
||||||
|
const Item & item_) : out(o), params(pars), par(first_par), in(input_stream), stack(s), item(item_)
|
||||||
|
{
|
||||||
|
Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Clear()
|
||||||
|
{
|
||||||
|
res = false; // result is false by default
|
||||||
|
is_for = false;
|
||||||
|
is_if = false;
|
||||||
|
is_if_def = false;
|
||||||
|
is_if_not_def = false;
|
||||||
|
is_normal = false;
|
||||||
|
is_filter = false;
|
||||||
|
iter = 0;
|
||||||
|
stack_tab = 0;
|
||||||
|
stack_index = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CHECK ME can it be done only for [for] statements?
|
||||||
|
*
|
||||||
|
* can return a null pointer if there is no such an item on the stack
|
||||||
|
*
|
||||||
|
* add a function with const wchar_t *
|
||||||
|
*/
|
||||||
|
Stack * FindLastFor(const std::wstring & name)
|
||||||
|
{
|
||||||
|
for(size_t i = stack_index ; i > 0 ; --i)
|
||||||
|
{
|
||||||
|
if( stack_tab[i-1].is_for && stack_tab[i-1].item->has_function )
|
||||||
|
{
|
||||||
|
if( stack_tab[i-1].item->function.name == name )
|
||||||
|
{
|
||||||
|
return &stack_tab[i-1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Stack * FindLastFor(const std::wstring & name, const std::wstring & postfix)
|
||||||
|
{
|
||||||
|
for(size_t i = stack_index ; i > 0 ; --i)
|
||||||
|
{
|
||||||
|
if( stack_tab[i-1].is_for && stack_tab[i-1].item->has_function )
|
||||||
|
{
|
||||||
|
if( stack_tab[i-1].item->function.name == name && stack_tab[i-1].item->function.postfix == postfix )
|
||||||
|
{
|
||||||
|
return &stack_tab[i-1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class FunUserObject>
|
||||||
|
FunUserObject * FindUserObject(const std::wstring & function_name, Stack ** ezc_stack = 0)
|
||||||
|
{
|
||||||
|
Stack * stack;
|
||||||
|
|
||||||
|
if( item.has_function && item.function.is_function )
|
||||||
|
stack = FindLastFor(function_name, item.function.postfix);
|
||||||
|
else
|
||||||
|
stack = FindLastFor(function_name);
|
||||||
|
|
||||||
|
if( ezc_stack )
|
||||||
|
*ezc_stack = stack;
|
||||||
|
|
||||||
|
if( stack && stack->fun_data )
|
||||||
|
return dynamic_cast<FunUserObject*>(stack->fun_data);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Ezc
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,190 @@
|
||||||
|
/*
|
||||||
|
* This file is a part of EZC -- Easy templating in C++ library
|
||||||
|
* and is distributed under the 2-Clause BSD licence.
|
||||||
|
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2007-2018, Tomasz Sowa
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "item.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
namespace Ezc
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Item * Item::AddItem(const Item * porg)
|
||||||
|
{
|
||||||
|
Item * pitem;
|
||||||
|
|
||||||
|
if( porg )
|
||||||
|
pitem = new Item(*porg);
|
||||||
|
else
|
||||||
|
pitem = new Item();
|
||||||
|
|
||||||
|
item_tab.push_back(pitem);
|
||||||
|
|
||||||
|
return pitem;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Item * Item::AddItem(const Item & porg)
|
||||||
|
{
|
||||||
|
return AddItem(&porg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void Item::ClearItems()
|
||||||
|
{
|
||||||
|
std::vector<Item*>::iterator i = item_tab.begin();
|
||||||
|
|
||||||
|
for( ; i != item_tab.end() ; ++i )
|
||||||
|
delete *i;
|
||||||
|
|
||||||
|
item_tab.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void Item::Clear()
|
||||||
|
{
|
||||||
|
ClearItems();
|
||||||
|
|
||||||
|
text.clear();
|
||||||
|
file_name.clear();
|
||||||
|
has_function = false;
|
||||||
|
function.Clear();
|
||||||
|
type = item_none;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Item::Type Item::LastItemType()
|
||||||
|
{
|
||||||
|
if( item_tab.empty() )
|
||||||
|
return item_none;
|
||||||
|
|
||||||
|
return item_tab.back()->type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void Item::DeleteLastItem()
|
||||||
|
{
|
||||||
|
if( item_tab.empty() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
delete item_tab.back();
|
||||||
|
item_tab.pop_back();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Item::Item()
|
||||||
|
{
|
||||||
|
type = item_none;
|
||||||
|
has_function = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Item::Item(const Item & i) : text(i.text), file_name(i.file_name), function(i.function)
|
||||||
|
{
|
||||||
|
type = i.type;
|
||||||
|
has_function = i.has_function;
|
||||||
|
CopyItemTable(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Item & Item::operator=(const Item & i)
|
||||||
|
{
|
||||||
|
type = i.type;
|
||||||
|
text = i.text;
|
||||||
|
file_name = i.file_name;
|
||||||
|
has_function = i.has_function;
|
||||||
|
function = i.function;
|
||||||
|
|
||||||
|
ClearItems();
|
||||||
|
CopyItemTable(i);
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void Item::CopyItemTable(const Item & item)
|
||||||
|
{
|
||||||
|
std::vector<Item*>::const_iterator i = item.item_tab.begin();
|
||||||
|
|
||||||
|
for( ; i != item.item_tab.end() ; ++i)
|
||||||
|
AddItem(*i);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Item::~Item()
|
||||||
|
{
|
||||||
|
ClearItems();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Item::ClearCache(Item::Function & function)
|
||||||
|
{
|
||||||
|
function.base_obj = 0;
|
||||||
|
function.method_index = -1;
|
||||||
|
function.fun_cache = 0;
|
||||||
|
function.item_block = 0;
|
||||||
|
|
||||||
|
for(size_t i=0 ; i<function.parameters.size() ; ++i)
|
||||||
|
ClearCache(*function.parameters[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Item::ClearCache()
|
||||||
|
{
|
||||||
|
ClearCache(function);
|
||||||
|
|
||||||
|
for(size_t i = 0; i < item_tab.size() ; ++i)
|
||||||
|
item_tab[i]->ClearCache();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Ezc
|
||||||
|
|
|
@ -0,0 +1,176 @@
|
||||||
|
/*
|
||||||
|
* This file is a part of EZC -- Easy templating in C++ library
|
||||||
|
* and is distributed under the 2-Clause BSD licence.
|
||||||
|
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2007-2021, Tomasz Sowa
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef headerfile_ezc_item
|
||||||
|
#define headerfile_ezc_item
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
namespace Ezc
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
struct Item
|
||||||
|
{
|
||||||
|
enum Type
|
||||||
|
{
|
||||||
|
item_none, item_container, item_text, item_function, item_if, item_if_def, item_if_not_def,
|
||||||
|
item_for, item_else, item_end, item_err, item_include, item_comment,
|
||||||
|
item_def, item_def_if_not_set, item_let, item_let_if_not_set,
|
||||||
|
item_filter, item_ezc, item_block, item_return
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct Function
|
||||||
|
{
|
||||||
|
bool is_function; // if true then we have a function parameter, if false then we have a string parameter
|
||||||
|
std::wstring name; // a function or parameter name
|
||||||
|
std::vector<std::wstring> fields; // any number of additional fields after a dot e.g. [name.field1.field2]
|
||||||
|
std::wstring postfix; // a function can have an additional postfix in its name
|
||||||
|
// e.g. [my_function:my_postfix]
|
||||||
|
std::vector<Function*> parameters; // if is_function is true then it is a function and can have 'parameters'
|
||||||
|
// if is_function is empty then 'parameters' is empty too
|
||||||
|
void * fun_cache; // only valid if is_function is true
|
||||||
|
Item * item_block;
|
||||||
|
void * base_obj;
|
||||||
|
int method_index;
|
||||||
|
int arg; // used if name is numeric (if no then is equal -1)
|
||||||
|
|
||||||
|
|
||||||
|
Function()
|
||||||
|
{
|
||||||
|
is_function = false;
|
||||||
|
fun_cache = 0;
|
||||||
|
item_block = 0;
|
||||||
|
base_obj = 0;
|
||||||
|
method_index = -1;
|
||||||
|
arg = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
~Function()
|
||||||
|
{
|
||||||
|
Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
Function(const Function & f)
|
||||||
|
{
|
||||||
|
operator=(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
Function & operator=(const Function & f)
|
||||||
|
{
|
||||||
|
is_function = f.is_function;
|
||||||
|
name = f.name;
|
||||||
|
fields = f.fields;
|
||||||
|
postfix = f.postfix;
|
||||||
|
fun_cache = f.fun_cache;
|
||||||
|
item_block = f.item_block;
|
||||||
|
base_obj = f.base_obj;
|
||||||
|
method_index = f.method_index;
|
||||||
|
arg = f.arg;
|
||||||
|
|
||||||
|
for(size_t i=0 ; i<f.parameters.size() ; ++i)
|
||||||
|
parameters.push_back(new Function(*f.parameters[i]));
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
Function & AddNewParam()
|
||||||
|
{
|
||||||
|
parameters.push_back(new Function());
|
||||||
|
|
||||||
|
return *parameters.back();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Clear()
|
||||||
|
{
|
||||||
|
for(size_t i=0 ; i<parameters.size() ; ++i)
|
||||||
|
delete parameters[i];
|
||||||
|
|
||||||
|
fields.clear();
|
||||||
|
parameters.clear();
|
||||||
|
name.clear();
|
||||||
|
postfix.clear();
|
||||||
|
fun_cache = 0;
|
||||||
|
item_block = 0;
|
||||||
|
base_obj = 0;
|
||||||
|
method_index = -1;
|
||||||
|
arg = -1;
|
||||||
|
is_function = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Type type;
|
||||||
|
std::wstring text; // used in: item_text
|
||||||
|
std::wstring file_name; // used in: item_include (as a file name)
|
||||||
|
std::vector<Item*> item_tab; // childs
|
||||||
|
bool has_function; // the [return] statement can be without a function
|
||||||
|
Function function;
|
||||||
|
|
||||||
|
Item();
|
||||||
|
Item(const Item & i);
|
||||||
|
Item & operator=(const Item & i);
|
||||||
|
void CopyItemTable(const Item & i);
|
||||||
|
~Item();
|
||||||
|
|
||||||
|
Item * AddItem(const Item * porg = 0);
|
||||||
|
Item * AddItem(const Item & porg);
|
||||||
|
void ClearItems();
|
||||||
|
Type LastItemType();
|
||||||
|
void DeleteLastItem();
|
||||||
|
void Clear();
|
||||||
|
void ClearCache();
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
void ClearCache(Item::Function & function);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Ezc
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,136 @@
|
||||||
|
/*
|
||||||
|
* This file is a part of EZC -- Easy templating in C++ library
|
||||||
|
* and is distributed under the 2-Clause BSD licence.
|
||||||
|
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2021, Tomasz Sowa
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "models.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef EZC_HAS_MORM_LIBRARY
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
namespace Ezc
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
Models::Models()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Models::~Models()
|
||||||
|
{
|
||||||
|
Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Models::Clear()
|
||||||
|
{
|
||||||
|
models_map.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void Models::Add(const std::wstring & name, morm::Model & model)
|
||||||
|
{
|
||||||
|
morm::Wrapper wrapper;
|
||||||
|
wrapper.model = &model;
|
||||||
|
models_map[name] = wrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Models::Add(const std::wstring & name, morm::Model * model)
|
||||||
|
{
|
||||||
|
morm::Wrapper wrapper;
|
||||||
|
wrapper.model = model;
|
||||||
|
models_map[name] = wrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Models::Add(const std::wstring & name, pt::Space & space)
|
||||||
|
{
|
||||||
|
morm::Wrapper wrapper;
|
||||||
|
wrapper.space_wrapper = new morm::SpaceWrapper(&space);
|
||||||
|
models_map[name] = wrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Models::Add(const std::wstring & name, pt::Space * space)
|
||||||
|
{
|
||||||
|
morm::Wrapper wrapper;
|
||||||
|
wrapper.space_wrapper = new morm::SpaceWrapper(space);
|
||||||
|
models_map[name] = wrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Models::Add(const std::wstring & name, pt::Date & date)
|
||||||
|
{
|
||||||
|
morm::Wrapper wrapper;
|
||||||
|
wrapper.date = &date;
|
||||||
|
models_map[name] = wrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Models::Add(const std::wstring & name, pt::Date * date)
|
||||||
|
{
|
||||||
|
morm::Wrapper wrapper;
|
||||||
|
wrapper.date = date;
|
||||||
|
models_map[name] = wrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
morm::Wrapper * Models::Find(const std::wstring & name)
|
||||||
|
{
|
||||||
|
auto iterator = models_map.find(name);
|
||||||
|
|
||||||
|
if( iterator != models_map.end() )
|
||||||
|
{
|
||||||
|
return &iterator->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Models::ModelsMap & Models::GetMap()
|
||||||
|
{
|
||||||
|
return models_map;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -0,0 +1,148 @@
|
||||||
|
/*
|
||||||
|
* This file is a part of EZC -- Easy templating in C++ library
|
||||||
|
* and is distributed under the 2-Clause BSD licence.
|
||||||
|
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2021, Tomasz Sowa
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef headerfile_ezc_models
|
||||||
|
#define headerfile_ezc_models
|
||||||
|
|
||||||
|
#ifdef EZC_HAS_MORM_LIBRARY
|
||||||
|
|
||||||
|
#include "wrapper.h"
|
||||||
|
#include "funinfo.h"
|
||||||
|
#include "space/space.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Ezc
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
class Models
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
typedef std::map<std::wstring, morm::Wrapper> ModelsMap;
|
||||||
|
|
||||||
|
Models();
|
||||||
|
~Models();
|
||||||
|
|
||||||
|
void Add(const std::wstring & name, morm::Model & model);
|
||||||
|
void Add(const std::wstring & name, morm::Model * model);
|
||||||
|
|
||||||
|
void Add(const std::wstring & name, pt::Space & space);
|
||||||
|
void Add(const std::wstring & name, pt::Space * space);
|
||||||
|
|
||||||
|
void Add(const std::wstring & name, pt::Date & space);
|
||||||
|
void Add(const std::wstring & name, pt::Date * space);
|
||||||
|
|
||||||
|
template<typename VectorType>
|
||||||
|
void Add(const std::wstring & name, std::vector<VectorType> & container)
|
||||||
|
{
|
||||||
|
morm::Wrapper wrapper;
|
||||||
|
wrapper.model_container_wrapper = new morm::ModelWrapperVector<VectorType>(&container);
|
||||||
|
models_map[name] = wrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename VectorType>
|
||||||
|
void Add(const std::wstring & name, std::vector<VectorType> * container)
|
||||||
|
{
|
||||||
|
morm::Wrapper wrapper;
|
||||||
|
wrapper.model_container_wrapper = new morm::ModelWrapperVector<VectorType>(container);
|
||||||
|
models_map[name] = wrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename VectorType>
|
||||||
|
void Add(const std::wstring & name, std::vector<VectorType*> & container)
|
||||||
|
{
|
||||||
|
morm::Wrapper wrapper;
|
||||||
|
wrapper.model_container_wrapper = new morm::ModelWrapperVectorPointer<VectorType>(&container);
|
||||||
|
models_map[name] = wrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename VectorType>
|
||||||
|
void Add(const std::wstring & name, std::vector<VectorType*> * container)
|
||||||
|
{
|
||||||
|
morm::Wrapper wrapper;
|
||||||
|
wrapper.model_container_wrapper = new morm::ModelWrapperVectorPointer<VectorType>(container);
|
||||||
|
models_map[name] = wrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename ListType>
|
||||||
|
void Add(const std::wstring & name, std::list<ListType> & container)
|
||||||
|
{
|
||||||
|
morm::Wrapper wrapper;
|
||||||
|
wrapper.model_container_wrapper = new morm::ModelWrapperList<ListType>(&container);
|
||||||
|
models_map[name] = wrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename ListType>
|
||||||
|
void Add(const std::wstring & name, std::list<ListType> * container)
|
||||||
|
{
|
||||||
|
morm::Wrapper wrapper;
|
||||||
|
wrapper.model_container_wrapper = new morm::ModelWrapperList<ListType>(container);
|
||||||
|
models_map[name] = wrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename ListType>
|
||||||
|
void Add(const std::wstring & name, std::list<ListType*> & container)
|
||||||
|
{
|
||||||
|
morm::Wrapper wrapper;
|
||||||
|
wrapper.model_container_wrapper = new morm::ModelWrapperListPointer<ListType>(&container);
|
||||||
|
models_map[name] = wrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename ListType>
|
||||||
|
void Add(const std::wstring & name, std::list<ListType*> * container)
|
||||||
|
{
|
||||||
|
morm::Wrapper wrapper;
|
||||||
|
wrapper.model_container_wrapper = new morm::ModelWrapperListPointer<ListType>(container);
|
||||||
|
models_map[name] = wrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
morm::Wrapper * Find(const std::wstring & name);
|
||||||
|
ModelsMap & GetMap();
|
||||||
|
void Clear();
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
ModelsMap models_map;
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -0,0 +1,303 @@
|
||||||
|
/*
|
||||||
|
* This file is a part of EZC -- Easy templating in C++ library
|
||||||
|
* and is distributed under the 2-Clause BSD licence.
|
||||||
|
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2015, Tomasz Sowa
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef headerfile_ezc_objects
|
||||||
|
#define headerfile_ezc_objects
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
#include "utf8/utf8.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
namespace Ezc
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
template<class StreamType>
|
||||||
|
class BaseObj
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual ~BaseObj() {}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
virtual std::wstring & GetObjectName() = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
virtual int FindFun(const std::wstring & fun_name) = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
virtual void CallFun(int fun_index, FunInfo<StreamType> &) = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
virtual void ClearFunctions() = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
virtual size_t FunctionsSize() = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
virtual void AddFunctions() {};
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define EZC_DEFINE_OBJECT_METHODS(classname) \
|
||||||
|
\
|
||||||
|
\
|
||||||
|
protected: \
|
||||||
|
\
|
||||||
|
struct EzcTemplateMethod \
|
||||||
|
{ \
|
||||||
|
std::wstring fun_name; \
|
||||||
|
void (classname::*fun)(Info &); \
|
||||||
|
}; \
|
||||||
|
\
|
||||||
|
public: \
|
||||||
|
\
|
||||||
|
virtual std::wstring & GetObjectName() \
|
||||||
|
{ \
|
||||||
|
return ezc_object_name; \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
virtual void CallFun(int fun_index, Info & info) \
|
||||||
|
{ \
|
||||||
|
if( fun_index >=0 && (size_t)fun_index < ezc_template_method_tab.size() ) \
|
||||||
|
{ \
|
||||||
|
(this->*(ezc_template_method_tab[fun_index].fun))(info); \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
virtual int FindFun(const std::wstring & fun_name) \
|
||||||
|
{ \
|
||||||
|
for(size_t i=0 ; i<ezc_template_method_tab.size() ; ++i) \
|
||||||
|
{ \
|
||||||
|
if( ezc_template_method_tab[i].fun_name == fun_name ) \
|
||||||
|
{ \
|
||||||
|
return (int)i; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
return -1; \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
\
|
||||||
|
protected: \
|
||||||
|
\
|
||||||
|
virtual void ClearFunctions() \
|
||||||
|
{ \
|
||||||
|
ezc_template_method_tab.clear(); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
virtual size_t FunctionsSize() \
|
||||||
|
{ \
|
||||||
|
return ezc_template_method_tab.size(); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
void Insert(const char * name, void (classname::*fun)(Info &)) \
|
||||||
|
{ \
|
||||||
|
EzcTemplateMethod item; \
|
||||||
|
\
|
||||||
|
pt::utf8_to_wide(name, item.fun_name); \
|
||||||
|
item.fun = fun; \
|
||||||
|
\
|
||||||
|
ezc_template_method_tab.push_back(item); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
void Insert(const std::string & name, void (classname::*fun)(Info &)) \
|
||||||
|
{ \
|
||||||
|
EzcTemplateMethod item; \
|
||||||
|
\
|
||||||
|
pt::utf8_to_wide(name, item.fun_name); \
|
||||||
|
item.fun = fun; \
|
||||||
|
\
|
||||||
|
ezc_template_method_tab.push_back(item); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
void Insert(const wchar_t * name, void (classname::*fun)(Info &)) \
|
||||||
|
{ \
|
||||||
|
EzcTemplateMethod item; \
|
||||||
|
\
|
||||||
|
item.fun_name = name; \
|
||||||
|
item.fun = fun; \
|
||||||
|
\
|
||||||
|
ezc_template_method_tab.push_back(item); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
void Insert(const std::wstring & name, void (classname::*fun)(Info &)) \
|
||||||
|
{ \
|
||||||
|
EzcTemplateMethod item; \
|
||||||
|
\
|
||||||
|
item.fun_name = name; \
|
||||||
|
item.fun = fun; \
|
||||||
|
\
|
||||||
|
ezc_template_method_tab.push_back(item); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
std::vector<EzcTemplateMethod> ezc_template_method_tab; \
|
||||||
|
std::wstring ezc_object_name; \
|
||||||
|
\
|
||||||
|
private:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
template<class StreamType>
|
||||||
|
class Objects
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
typedef std::vector<BaseObj<StreamType> * > ObjectsTable;
|
||||||
|
typedef typename ObjectsTable::iterator Iterator;
|
||||||
|
|
||||||
|
void Insert(BaseObj<StreamType> * base_fun);
|
||||||
|
void Insert(BaseObj<StreamType> & base_fun);
|
||||||
|
|
||||||
|
Iterator Begin();
|
||||||
|
Iterator End();
|
||||||
|
size_t Size() const;
|
||||||
|
void Clear();
|
||||||
|
|
||||||
|
Iterator Find(const std::wstring & key, int & method_index);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
ObjectsTable obj_tab;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
template<class StreamType>
|
||||||
|
typename Objects<StreamType>::Iterator Objects<StreamType>::Find(const std::wstring & key, int & method_index)
|
||||||
|
{
|
||||||
|
Iterator i = obj_tab.begin();
|
||||||
|
method_index = -1;
|
||||||
|
|
||||||
|
for( ; i != obj_tab.end() ; ++i)
|
||||||
|
{
|
||||||
|
int index = (*i)->FindFun(key);
|
||||||
|
|
||||||
|
if( index != -1 )
|
||||||
|
{
|
||||||
|
method_index = index;
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj_tab.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
template<class StreamType>
|
||||||
|
void Objects<StreamType>::Insert(BaseObj<StreamType> * base_fun)
|
||||||
|
{
|
||||||
|
obj_tab.push_back(base_fun);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class StreamType>
|
||||||
|
void Objects<StreamType>::Insert(BaseObj<StreamType> & base_fun)
|
||||||
|
{
|
||||||
|
obj_tab.push_back(&base_fun);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
template<class StreamType>
|
||||||
|
typename Objects<StreamType>::Iterator Objects<StreamType>::Begin()
|
||||||
|
{
|
||||||
|
return obj_tab.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class StreamType>
|
||||||
|
typename Objects<StreamType>::Iterator Objects<StreamType>::End()
|
||||||
|
{
|
||||||
|
return obj_tab.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class StreamType>
|
||||||
|
size_t Objects<StreamType>::Size() const
|
||||||
|
{
|
||||||
|
return obj_tab.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class StreamType>
|
||||||
|
void Objects<StreamType>::Clear()
|
||||||
|
{
|
||||||
|
obj_tab.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Ezc
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,169 @@
|
||||||
|
/*
|
||||||
|
* This file is a part of EZC -- Easy templating in C++ library
|
||||||
|
* and is distributed under the 2-Clause BSD licence.
|
||||||
|
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2015-2021, Tomasz Sowa
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef headerfile_ezc_outstreams
|
||||||
|
#define headerfile_ezc_outstreams
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
|
||||||
|
namespace Ezc
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
template<class StreamType, bool is_pikotools_stream = false>
|
||||||
|
class OutStreams
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
typedef std::map<std::wstring, StreamType*> StreamsMap;
|
||||||
|
typedef std::vector<StreamType*> StreamsTab;
|
||||||
|
|
||||||
|
StreamsMap streams_map;
|
||||||
|
StreamsTab streams_tab;
|
||||||
|
|
||||||
|
void ResizeTab(size_t len);
|
||||||
|
|
||||||
|
void ClearMap();
|
||||||
|
void ClearTab();
|
||||||
|
|
||||||
|
~OutStreams();
|
||||||
|
OutStreams();
|
||||||
|
OutStreams(const OutStreams & o);
|
||||||
|
OutStreams & operator=(const OutStreams & o);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template<class StreamType, bool is_pikotools_stream>
|
||||||
|
OutStreams<StreamType, is_pikotools_stream>::~OutStreams()
|
||||||
|
{
|
||||||
|
ClearTab();
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class StreamType, bool is_pikotools_stream>
|
||||||
|
OutStreams<StreamType, is_pikotools_stream>::OutStreams()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
template<class StreamType, bool is_pikotools_stream>
|
||||||
|
OutStreams<StreamType, is_pikotools_stream>::OutStreams(const OutStreams<StreamType, is_pikotools_stream> & o)
|
||||||
|
{
|
||||||
|
// we do not copy streams but creating new ones
|
||||||
|
ResizeTab(o.streams_tab.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class StreamType, bool is_pikotools_stream>
|
||||||
|
OutStreams<StreamType, is_pikotools_stream> & OutStreams<StreamType, is_pikotools_stream>::operator=(const OutStreams<StreamType, is_pikotools_stream> & o)
|
||||||
|
{
|
||||||
|
// we do not copy streams but creating new ones
|
||||||
|
streams_map.clear();
|
||||||
|
ResizeTab(o.streams_tab.size());
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class StreamType, bool is_pikotools_stream>
|
||||||
|
void OutStreams<StreamType, is_pikotools_stream>::ClearTab()
|
||||||
|
{
|
||||||
|
for(size_t i=0 ; i<streams_tab.size() ; ++i)
|
||||||
|
delete streams_tab[i];
|
||||||
|
|
||||||
|
streams_tab.clear();
|
||||||
|
streams_map.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class StreamType, bool is_pikotools_stream>
|
||||||
|
void OutStreams<StreamType, is_pikotools_stream>::ResizeTab(size_t len)
|
||||||
|
{
|
||||||
|
if( streams_tab.size() != len )
|
||||||
|
{
|
||||||
|
if( streams_tab.size() < len )
|
||||||
|
{
|
||||||
|
size_t i = streams_tab.size();
|
||||||
|
streams_tab.resize(len);
|
||||||
|
|
||||||
|
for( ; i<streams_tab.size() ; ++i)
|
||||||
|
streams_tab[i] = new StreamType();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
streams_map.clear();
|
||||||
|
|
||||||
|
for(size_t i=len ; i<streams_tab.size() ; ++i)
|
||||||
|
delete streams_tab[i];
|
||||||
|
|
||||||
|
streams_tab.resize(len);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class StreamType, bool is_pikotools_stream>
|
||||||
|
void OutStreams<StreamType, is_pikotools_stream>::ClearMap()
|
||||||
|
{
|
||||||
|
typename StreamsMap::iterator i;
|
||||||
|
|
||||||
|
for(i=streams_map.begin() ; i != streams_map.end() ; ++i)
|
||||||
|
{
|
||||||
|
StreamType & str = *(i->second);
|
||||||
|
|
||||||
|
if constexpr(is_pikotools_stream)
|
||||||
|
{
|
||||||
|
str.clear();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
str.str(L"");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
streams_map.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,74 @@
|
||||||
|
/*
|
||||||
|
* This file is a part of EZC -- Easy templating in C++ library
|
||||||
|
* and is distributed under the 2-Clause BSD licence.
|
||||||
|
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2007-2012, Tomasz Sowa
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "pattern.h"
|
||||||
|
#include "utf8/utf8.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Ezc
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
Pattern::Pattern()
|
||||||
|
{
|
||||||
|
Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void Pattern::Clear()
|
||||||
|
{
|
||||||
|
item_root.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void Pattern::CacheBlocks(Blocks & blocks)
|
||||||
|
{
|
||||||
|
Cache(blocks, item_root);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Pattern::ClearCache()
|
||||||
|
{
|
||||||
|
item_root.ClearCache();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Ezc
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,91 @@
|
||||||
|
/*
|
||||||
|
* This file is a part of EZC -- Easy templating in C++ library
|
||||||
|
* and is distributed under the 2-Clause BSD licence.
|
||||||
|
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2007-2015, Tomasz Sowa
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef headerfile_ezc_pattern
|
||||||
|
#define headerfile_ezc_pattern
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include "item.h"
|
||||||
|
#include "cache.h"
|
||||||
|
#include "blocks.h"
|
||||||
|
#include "functions.h"
|
||||||
|
#include "objects.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Ezc
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
class Pattern
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
Pattern();
|
||||||
|
|
||||||
|
void Clear();
|
||||||
|
|
||||||
|
template<class StreamType> void CacheFunctions(Functions<StreamType> & fun);
|
||||||
|
void CacheBlocks(Blocks & blocks);
|
||||||
|
template<class StreamType> void CacheObjects(Objects<StreamType> & obj);
|
||||||
|
void ClearCache();
|
||||||
|
|
||||||
|
|
||||||
|
Item item_root;
|
||||||
|
|
||||||
|
|
||||||
|
}; // class Pattern
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
template<class StreamType>
|
||||||
|
void Pattern::CacheFunctions(Functions<StreamType> & fun)
|
||||||
|
{
|
||||||
|
Cache(fun, item_root);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class StreamType>
|
||||||
|
void Pattern::CacheObjects(Objects<StreamType> & obj)
|
||||||
|
{
|
||||||
|
Cache(obj, item_root);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Ezc
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,227 @@
|
||||||
|
/*
|
||||||
|
* This file is a part of EZC -- Easy templating in C++ library
|
||||||
|
* and is distributed under the 2-Clause BSD licence.
|
||||||
|
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2007-2021, Tomasz Sowa
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef headerfile_ezc_patternparser
|
||||||
|
#define headerfile_ezc_patternparser
|
||||||
|
|
||||||
|
#include "blocks.h"
|
||||||
|
#include "pattern.h"
|
||||||
|
#include "utf8/utf8.h"
|
||||||
|
#include "log/log.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Ezc
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
class PatternParser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
PatternParser();
|
||||||
|
|
||||||
|
// first we're trying to read a file from directory dir
|
||||||
|
// if there is no such a file there then we try read from dir2
|
||||||
|
// (the second dir2 can be empty - it will not be used)
|
||||||
|
void Directory(const char * dir, const char * dir2 = 0);
|
||||||
|
void Directory(const std::string & dir);
|
||||||
|
void Directory(const std::string & dir, const std::string & dir2);
|
||||||
|
|
||||||
|
void Directory(const wchar_t * dir, const wchar_t * dir2 = 0);
|
||||||
|
void Directory(const std::wstring & dir);
|
||||||
|
void Directory(const std::wstring & dir, const std::wstring & dir2);
|
||||||
|
|
||||||
|
void ParseFile(const char * file_name, Pattern & pattern);
|
||||||
|
void ParseFile(const std::string & file_name, Pattern & pattern);
|
||||||
|
void ParseFile(const wchar_t * file_name, Pattern & pattern);
|
||||||
|
void ParseFile(const std::wstring & file_name, Pattern & pattern);
|
||||||
|
|
||||||
|
void ParseString(const char * str, Pattern & pattern);
|
||||||
|
void ParseString(const std::string & str, Pattern & pattern);
|
||||||
|
void ParseString(const wchar_t * str, Pattern & pattern);
|
||||||
|
void ParseString(const std::wstring & str, Pattern & pattern);
|
||||||
|
|
||||||
|
void AllowInclude(bool allow);
|
||||||
|
void DeleteWhiteTextItems(bool del);
|
||||||
|
void SetIncludeMax(int include_max);
|
||||||
|
void SetBlocks(Blocks & blocks);
|
||||||
|
void SetProgramMode(bool program_mode);
|
||||||
|
void SetLogger(pt::Log * log);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
struct Env
|
||||||
|
{
|
||||||
|
bool clear_all_white_nodes;
|
||||||
|
bool trim_text_nodes;
|
||||||
|
|
||||||
|
Env()
|
||||||
|
{
|
||||||
|
clear_all_white_nodes = false;
|
||||||
|
trim_text_nodes = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
std::vector<Env> env_tab;
|
||||||
|
|
||||||
|
// the output object
|
||||||
|
Pattern * pat;
|
||||||
|
|
||||||
|
// the main pointer to the parsed text
|
||||||
|
const wchar_t * itext;
|
||||||
|
|
||||||
|
|
||||||
|
// allowing include tag
|
||||||
|
// default: true
|
||||||
|
bool allow_include;
|
||||||
|
|
||||||
|
// if true all text-items which have only white characters (with new lines as well)
|
||||||
|
// will be deleted - useful in *.txt templates
|
||||||
|
// this not actually delete the whole item but only the string
|
||||||
|
// the item will be present with an empty string
|
||||||
|
// default: false
|
||||||
|
bool delete_white_text_items;
|
||||||
|
|
||||||
|
// first we're trying to read a file from 'directory'
|
||||||
|
// if there is no such a file there then we try read from 'directory2'
|
||||||
|
// we read from these directories only if they are not empty
|
||||||
|
std::wstring directory, directory2;
|
||||||
|
|
||||||
|
|
||||||
|
int include_level, include_level_max;
|
||||||
|
|
||||||
|
|
||||||
|
// temporary content for ParseString(const char*) method
|
||||||
|
std::wstring string_content;
|
||||||
|
|
||||||
|
// temporary object for a file name
|
||||||
|
std::wstring file_name;
|
||||||
|
|
||||||
|
// temporary object for a file name
|
||||||
|
std::string afile_name;
|
||||||
|
|
||||||
|
// temporary object for a EZC function
|
||||||
|
Item::Function temp_function;
|
||||||
|
|
||||||
|
Blocks * pblocks;
|
||||||
|
|
||||||
|
bool program_mode;
|
||||||
|
|
||||||
|
pt::Log * log;
|
||||||
|
|
||||||
|
void InitializeEnvTab();
|
||||||
|
void IncreaseEnvTab();
|
||||||
|
|
||||||
|
void ReadFile(const std::wstring & name, std::wstring & result);
|
||||||
|
void ReadFile(const wchar_t * name, std::wstring & result);
|
||||||
|
bool HasFileAtBeginning(const wchar_t * path, const wchar_t * file);
|
||||||
|
bool IsFileCorrect(const wchar_t * name);
|
||||||
|
bool ReadFileFromDir(const std::wstring & dir, const wchar_t * name, std::wstring & result);
|
||||||
|
void ReadFile(std::ifstream & file, std::wstring & result);
|
||||||
|
|
||||||
|
int ReadCharInText();
|
||||||
|
bool IsWhite(wchar_t c);
|
||||||
|
void SkipWhite();
|
||||||
|
void SkipOneStatement();
|
||||||
|
void CheckWhiteAndDelete(std::wstring & s);
|
||||||
|
void CheckFunctionIsNumber(Item::Function & function);
|
||||||
|
|
||||||
|
bool IsNameChar(wchar_t c);
|
||||||
|
bool IsDigit(wchar_t c);
|
||||||
|
bool IsPositiveNumber(const std::wstring & str);
|
||||||
|
|
||||||
|
bool ReadName(std::wstring & name);
|
||||||
|
bool ReadFunctionName(std::wstring & name, std::wstring & postfix);
|
||||||
|
bool ReadString(std::wstring & str);
|
||||||
|
bool ReadParamString(Item::Function & function);
|
||||||
|
bool ReadParams(Item::Function & function);
|
||||||
|
void ReadFunctionFields(Item::Function & function);
|
||||||
|
bool ReadFunction(Item::Function & function, bool with_params);
|
||||||
|
bool ReadFunction(Item & item);
|
||||||
|
|
||||||
|
void ReadDirectiveIf(Item & item);
|
||||||
|
void ReadDirectiveIfDef(Item & item);
|
||||||
|
void ReadDirectiveIfNotDef(Item & item);
|
||||||
|
void ReadDirectiveEnd(Item & item);
|
||||||
|
void ReadDirectiveElse(Item & item);
|
||||||
|
void ReadDirectiveFor(Item & item);
|
||||||
|
void ReadDirectiveComment(Item & item);
|
||||||
|
void ReadDirectiveInclude(Item & item);
|
||||||
|
void ReadDirectiveDef(Item & item);
|
||||||
|
void ReadDirectiveDefIfNotSet(Item & item);
|
||||||
|
void ReadDirectiveLet(Item & item);
|
||||||
|
void ReadDirectiveLetIfNotSet(Item & item);
|
||||||
|
void ReadDirectiveFilter(Item & item);
|
||||||
|
void ReadDirectiveEzc(Item & item);
|
||||||
|
void ReadDirectiveFrame(Item & item);
|
||||||
|
void ReadDirectiveBlock(Item & item);
|
||||||
|
void ReadDirectiveReturn(Item & item);
|
||||||
|
void ReadNormalStatement(Item & item);
|
||||||
|
|
||||||
|
bool CheckEnv(Item & item);
|
||||||
|
bool CheckEnvIsYesParameter(Item & item);
|
||||||
|
|
||||||
|
void CreateTreeReadDirectiveExpression(Item & item, bool is_statement);
|
||||||
|
bool CreateTreeCheckProgramDirective(Item & item);
|
||||||
|
bool CreateTreeReadExpression(Item & item);
|
||||||
|
|
||||||
|
void CreateTreeReadItemDirectiveCheckEnding(Item & item);
|
||||||
|
void CreateTreeReadItemDirective(Item & item);
|
||||||
|
void CreateTreeReadItemText(Item & item);
|
||||||
|
bool CreateTreeReadItem(Item & item);
|
||||||
|
void CreateTreeReadIf(Item & item);
|
||||||
|
void CreateTreeReadBlock(Item & item);
|
||||||
|
void CreateTreeReadOneChild(Item & item);
|
||||||
|
bool CreateTree(Item & item);
|
||||||
|
void CreateTreeContainer(Item & item);
|
||||||
|
void CreateTreeReadInclude(Item & item);
|
||||||
|
void CreateTreeReadIncludeSkipAllowFlag(Item & item);
|
||||||
|
|
||||||
|
|
||||||
|
}; // class PatternParser
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Ezc
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,44 @@
|
||||||
|
/*
|
||||||
|
* This file is a part of EZC -- Easy templating in C++ library
|
||||||
|
* and is distributed under the 2-Clause BSD licence.
|
||||||
|
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2022, Tomasz Sowa
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef headerfile_ezc_version
|
||||||
|
#define headerfile_ezc_version
|
||||||
|
|
||||||
|
|
||||||
|
#define EZC_VERSION_MAJOR 0
|
||||||
|
#define EZC_VERSION_MINOR 9
|
||||||
|
#define EZC_VERSION_PATCH 5
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue