updated to the new Pikotools api (new Space struct)

This commit is contained in:
2021-04-09 17:50:58 +02:00
parent 00b980e74b
commit 35e10ed469
52 changed files with 795 additions and 736 deletions

View File

@@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2012-2018, Tomasz Sowa
* Copyright (c) 2012-2021, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -75,12 +75,14 @@ void copy_space(const std::vector<Ezc::Var> & params, std::vector<std::wstring>
PT::Space * find_space(const std::vector<Ezc::Var> & params, PT::Space & space, size_t level = 0)
{
if( level + 1 < params.size() )
if( level + 1 < params.size() && space.child_spaces )
{
for(size_t i=0 ; i<space.spaces.size() ; ++i)
for(size_t i=0 ; i<space.child_spaces->size() ; ++i)
{
if( space.spaces[i]->name == params[level].str )
return find_space(params, *space.spaces[i], level+1);
PT::Space & child = *(*space.child_spaces)[i];
if( child.name && *child.name == params[level].str )
return find_space(params, child, level+1);
}
// there is no such a space
@@ -155,7 +157,7 @@ void space_value(Info & i, PT::Space & space, bool escape)
if( space_info.last_space )
{
const std::wstring & param = i.params.back().str;
const std::wstring * value = space_info.last_space->GetFirstValue(param);
const std::wstring * value = space_info.last_space->get_wstr(param.c_str());
if( value )
{
@@ -193,7 +195,7 @@ void space_list_tab(Info & i, PT::Space & space)
PT::Space * dst_space = find_space(i.params, space);
if( dst_space )
dst_space->ListText(i.params.back().str, stack_item->values);
dst_space->to_list(i.params.back().str, stack_item->values);
i.res = i.iter < stack_item->values.size();
}