add cmp ezc function

This commit is contained in:
Tomasz Sowa 2022-01-22 04:35:42 +01:00
parent 944560dd2b
commit b615dc7e6e
1 changed files with 17 additions and 2 deletions

View File

@ -115,8 +115,6 @@ void esc_tex(wchar_t c, pt::WTextStream & str)
} }
void fil_tex(Ezc::FunInfo<MyStream> & env) void fil_tex(Ezc::FunInfo<MyStream> & env)
{ {
auto i = env.in.begin(); auto i = env.in.begin();
@ -127,6 +125,22 @@ void fil_tex(Ezc::FunInfo<MyStream> & env)
} }
} }
void cmp(Ezc::FunInfo<MyStream> & env)
{
if( env.params.size() >= 2 )
{
env.res = true;
for(size_t a=0 ; a < env.params.size() - 1 ; ++a)
{
if( env.params[a].str != env.params[a+1].str )
{
env.res = false;
break;
}
}
}
}
bool generate(const pt::Space & input_options, pt::Space & schema) bool generate(const pt::Space & input_options, pt::Space & schema)
@ -161,6 +175,7 @@ bool generate(const pt::Space & input_options, pt::Space & schema)
} }
functions.Insert("fil_tex", fil_tex); functions.Insert("fil_tex", fil_tex);
functions.Insert("cmp", cmp);
parser.Directory(dir); parser.Directory(dir);
parser.SetBlocks(blocks); parser.SetBlocks(blocks);