z_status zp_parser::parse_item(void*& p_item, ctext item_entry_name ) { //ZTF; z_status status; const zp_factory* ie=find_item(item_entry_name); if(ie==0) return zs_no_entry_for_item; void* obj=ie->create_obj(); context_set_root(obj,ie,0); reset_results(); status=_process_template(zp_mode_parse_input); if(status==zs_matched) { ZT("==========ITEM[%s] MATCHED, CREATING=====\n",item_entry_name); index_reset(); context_get_current_template_parser().index_reset(); reset_results(); status=_process_template(zp_mode_parse_create); p_item=obj; } return status; }
z_status zb_ds_metakit::commit() { if (_status==status_opened_need_commit) //wait this aint gonna work { if (_pStore) { ZT("commiting %s", _filename.c_str() ); _pStore->Commit(true); _status=status_opened_write; } } else { ZT("file=%x, %s commit not needed ",this, _filename.c_str() ); } return zs_ok; }
z_status zb_ds_metakit::_get_view_for_table(c4_View& view,zb_table_base* tbl) { bool metakit_blocked_view=false; //TODO: metakit blocked views z_string str="T"; str+=tbl->get_key(); if(metakit_blocked_view) str+="[_B"; str+="["; z_map_iter i; zb_field* f=0; bool comma=false; while(f=tbl->get_desc().get_next(i)) { if(comma) str+=","; zb_ds_field_mk * mkf=(zb_ds_field_mk*)f->get_ds_field(); mkf->MakeDesc(str); comma=true; } str+="]"; if(metakit_blocked_view) str+="]"; ZT("Table# %x, %s, viewstr=%s", tbl->get_key(),tbl->get_name(),str.c_str()); c4_View temp_view; try { #if BLOCKED temp_view=GetFile()->_pStore->GetAs(str); //get_mk_view(str); //TODO catch assertions HERE, for corrupt databases. if(_use_blocked_view) { view=temp_view.Blocked(); } #else view=_pStore->GetAs(str); //TODO catch assertions HERE, for corrupt databases. #endif } catch(...) { _status=status_corrupt; //Z_ASSERT(0); return Z_ERROR_MSG( zs_data_error,"Error accessing %s",tbl->get_name()); } return zs_ok; }
int main(int argc, char** argv) { ZT_ENABLE(); ZTF; ZT("Testing trace %s %d...\n","duds",4); //dummy.add_features(); z_debug_load_save_args(&argc,&argv); testA A; z_factory_T<testA>::self.dump_static(zout); z_factory* f=zf_get_factory("testA"); f->dump_obj_static(zout,&A); f= zf_get_factory_T<testA>(); z_parser p; if(argc>1) { if(p.parse_obj_d(&A,argv[1],"{_str}ident:'=':{_i}ident")) p.report_error(); } f->dump_obj_static(zout,&A); A._i=27; A._str="go run!"; f->dump_obj_static(zout,&A); f->set_var_as_string(&A,"_str","ok ok"); f->set_var_as_string(&A,"_i","1"); f->execute_act(&A,"func"); f->dump_obj_static(zout,&A); /* testc c; c.execute_act(&c,"func"); c.dump_obj_static(zout,&c); */ return 0;//ZS_RET(base,feature_not_found); }
z_status zp_parser::output_default_template(z_file* fp,ctext tmpl) { z_status status; //_append_mode=false; ZT("==========TEMPLATE[%s] OUTPUT DEFAULT=====\n",tmpl); _file_out=fp; reset_results(); context_set_root(0,0,tmpl); status=_process_template(zp_mode_output_default); if(status<zs_fatal_error) status=zs_ok; return status; }
z_status zp_parser::parse_obj(void* p_obj,const zp_factory* factory,ctext data) { z_status status; Z_ASSERT(p_obj); set_source(data,strlen(data)); reset_results(); factory->clear_all_vars(p_obj); context_set_root(p_obj,factory,0); status=_process_template(zp_mode_parse_input); if(status==zs_matched) { ZT("==========ITEM[%s] MATCHED, CREATING=====\n",factory->get_name()); index_reset(); context_get_current_template_parser().index_reset(); reset_results(); status=_process_template(zp_mode_parse_create); } return status; }
z_status zp_parser::output_obj(z_file* fp,const zp_factory* factory,void* obj) { if(!factory) return -1; ZT("==========TEMPLATE[%s] OUTPUT OBJ=====\n",factory->get_name()); _file_out=fp; //ZTF; z_status status; context_set_root(obj,factory,0); zp_mode mode=zp_mode_output_obj; status=_process_template(mode); //*fp<< "\n\n"; return status; }
z_status zp_parser::test_white_space(zp_mode mode) { z_status status=test_cset(*cset_white_space); if (status==zs_matched) { ctext match; size_t len; get_match(match,len); if(mode.create) { /* zp_text* item=new zp_text("ws"); item->set_text(match,len); _ctx_current->_obj->add_child(item); */ ZT("adding whitespace"); } } return status; }
z_status zf_create_obj_from_text_stream_dyn(zp_text_parser &parser, z_factory* &factory,void* &objpointer,zf_feature_flags oper) { parser.skip_ws(); z_status status=parser.test_any_identifier(); if(status==zs_no_match) return status; if(status) return Z_ERROR_MSG(status,"Error loading obj type"); z_string s; parser.get_match(s); factory=zf_get_factory(s); if(!factory) return Z_ERROR_MSG(zs_cannot_create_virtual_obj,"Unknown obj type \"%s\"",s.c_str()); ZT("create obj name=%s oper=%llx\n",s.c_str(),oper); if(!(oper&ZFF_SKIP)) if(objpointer==0)//we need to create it { objpointer=factory->create_default_obj(); } parser.skip_ws(); status=parser.test_char('{'); if(status) return Z_ERROR_MSG(status,"Expected '{' "); status=factory->load_obj_contents(parser,objpointer,oper); if(status) return status; parser.skip_ws(); status=parser.test_char('}'); if(status) return Z_ERROR_MSG(status,"Expected '}' "); return zs_ok; }
z_status z_factory::load_obj_contents(zp_text_parser &parser,void* pObj,zf_feature_flags oper) { z_string s; init_dynamic(); z_status status=zs_ok; zf_obj fobj(this,pObj); while(status==zs_ok) { parser.skip_ws(); status=parser.test_any_identifier(); if(status==zs_no_match) return zs_ok; if(status) break; parser.get_match(s); zf_feature *f=_dynamic->features.get_by_name(s); if(!f) { return Z_ERROR_MSG(zs_feature_not_found,"Feature \"%s\" in not found in class \"%s\"",s.c_str(),get_name()); continue; } z_status status=parser.test_char('='); if(status) return Z_ERROR_MSG(status,"Expected '=' "); ZT("load feature=%s oper=%llx\n",s.c_str(),oper); status=f->load(parser,fobj,oper); if(status) { if(zs_skipped!=status) break; } } if(status==zs_eof) return zs_ok; return status;//Don't log error, should already be logged. }
float RandomNoise::operator()(SmoothType smooth,int subseed,float xf,float yf,float tf,int loop)const { int x((int)floor(xf)); int y((int)floor(yf)); int t((int)floor(tf)); int t_1, t0, t1, t2; if (loop) { t0 = t % loop; if (t0 < 0 ) t0 += loop; t_1 = t0 - 1; if (t_1 < 0 ) t_1 += loop; t1 = t0 + 1; if (t1 >= loop) t1 -= loop; t2 = t1 + 1; if (t2 >= loop) t2 -= loop; } else { t0 = t; t_1 = t - 1; t1 = t + 1; t2 = t + 2; } // synfig::info("%s:%d tf %.2f loop %d fraction %.2f ( -1,0,1,2 : %2d %2d %2d %2d)", __FILE__, __LINE__, tf, loop, tf-t, t_1, t0, t1, t2); switch(smooth) { case SMOOTH_CUBIC: // cubic { #define f(j,i,k) ((*this)(subseed,i,j,k)) //Using catmull rom interpolation because it doesn't blur at all // ( http://www.gamedev.net/reference/articles/article1497.asp ) //bezier curve with intermediate ctrl pts: 0.5/3(p(i+1) - p(i-1)) and similar float xfa [4], tfa[4]; //precalculate indices (all clamped) and offset const int xa[] = {x-1,x,x+1,x+2}; const int ya[] = {y-1,y,y+1,y+2}; const int ta[] = {t_1,t0,t1,t2}; const float dx(xf-x); const float dy(yf-y); const float dt(tf-t); //figure polynomials for each point const float txf[] = { 0.5f*dx*(dx*(dx*(-1.f) + 2.f) - 1.f), //-t + 2t^2 -t^3 0.5f*(dx*(dx*(3.f*dx - 5.f)) + 2.f), //2 - 5t^2 + 3t^3 0.5f*dx*(dx*(-3.f*dx + 4.f) + 1.f), //t + 4t^2 - 3t^3 0.5f*dx*dx*(dx-1.f) //-t^2 + t^3 }; const float tyf[] = { 0.5f*dy*(dy*(dy*(-1.f) + 2.f) - 1.f), //-t + 2t^2 -t^3 0.5f*(dy*(dy*(3.f*dy - 5.f)) + 2.f), //2 - 5t^2 + 3t^3 0.5f*dy*(dy*(-3.f*dy + 4.f) + 1.f), //t + 4t^2 - 3t^3 0.5f*dy*dy*(dy-1.f) //-t^2 + t^3 }; const float ttf[] = { 0.5f*dt*(dt*(dt*(-1.f) + 2.f) - 1.f), //-t + 2t^2 -t^3 0.5f*(dt*(dt*(3.f*dt - 5.f)) + 2.f), //2 - 5t^2 + 3t^3 0.5f*dt*(dt*(-3.f*dt + 4.f) + 1.f), //t + 4t^2 - 3t^3 0.5f*dt*dt*(dt-1.f) //-t^2 + t^3 }; //evaluate polynomial for each row for(int i = 0; i < 4; ++i) { for(int j = 0; j < 4; ++j) { tfa[j] = f(ya[i],xa[j],ta[0])*ttf[0] + f(ya[i],xa[j],ta[1])*ttf[1] + f(ya[i],xa[j],ta[2])*ttf[2] + f(ya[i],xa[j],ta[3])*ttf[3]; } xfa[i] = tfa[0]*txf[0] + tfa[1]*txf[1] + tfa[2]*txf[2] + tfa[3]*txf[3]; } //return the cumulative column evaluation return xfa[0]*tyf[0] + xfa[1]*tyf[1] + xfa[2]*tyf[2] + xfa[3]*tyf[3]; #undef f } break; case SMOOTH_FAST_SPLINE: // Fast Spline (non-animated) { #define P(x) (((x)>0)?((x)*(x)*(x)):0.0f) #define R(x) ( P(x+2) - 4.0f*P(x+1) + 6.0f*P(x) - 4.0f*P(x-1) )*(1.0f/6.0f) #define F(i,j) ((*this)(subseed,i+x,j+y)*(R((i)-a)*R(b-(j)))) #define FT(i,j,k,l) ((*this)(subseed,i+x,j+y,l)*(R((i)-a)*R(b-(j))*R((k)-c))) #define Z(i,j) ret+=F(i,j) #define ZT(i,j,k,l) ret+=FT(i,j,k,l) #define X(i,j) // placeholder... To make box more symmetric #define XT(i,j,k,l) // placeholder... To make box more symmetric float a(xf-x), b(yf-y); // Interpolate float ret(F(0,0)); Z(-1,-1); Z(-1, 0); Z(-1, 1); Z(-1, 2); Z( 0,-1); X( 0, 0); Z( 0, 1); Z( 0, 2); Z( 1,-1); Z( 1, 0); Z( 1, 1); Z( 1, 2); Z( 2,-1); Z( 2, 0); Z( 2, 1); Z( 2, 2); return ret; } case SMOOTH_SPLINE: // Spline (animated) { float a(xf-x), b(yf-y), c(tf-t); // Interpolate float ret(FT(0,0,0,t0)); ZT(-1,-1,-1,t_1); ZT(-1, 0,-1,t_1); ZT(-1, 1,-1,t_1); ZT(-1, 2,-1,t_1); ZT( 0,-1,-1,t_1); ZT( 0, 0,-1,t_1); ZT( 0, 1,-1,t_1); ZT( 0, 2,-1,t_1); ZT( 1,-1,-1,t_1); ZT( 1, 0,-1,t_1); ZT( 1, 1,-1,t_1); ZT( 1, 2,-1,t_1); ZT( 2,-1,-1,t_1); ZT( 2, 0,-1,t_1); ZT( 2, 1,-1,t_1); ZT( 2, 2,-1,t_1); ZT(-1,-1, 0,t0 ); ZT(-1, 0, 0,t0 ); ZT(-1, 1, 0,t0 ); ZT(-1, 2, 0,t0 ); ZT( 0,-1, 0,t0 ); XT( 0, 0, 0,t0 ); ZT( 0, 1, 0,t0 ); ZT( 0, 2, 0,t0 ); ZT( 1,-1, 0,t0 ); ZT( 1, 0, 0,t0 ); ZT( 1, 1, 0,t0 ); ZT( 1, 2, 0,t0 ); ZT( 2,-1, 0,t0 ); ZT( 2, 0, 0,t0 ); ZT( 2, 1, 0,t0 ); ZT( 2, 2, 0,t0 ); ZT(-1,-1, 1,t1 ); ZT(-1, 0, 1,t1 ); ZT(-1, 1, 1,t1 ); ZT(-1, 2, 1,t1 ); ZT( 0,-1, 1,t1 ); ZT( 0, 0, 1,t1 ); ZT( 0, 1, 1,t1 ); ZT( 0, 2, 1,t1 ); ZT( 1,-1, 1,t1 ); ZT( 1, 0, 1,t1 ); ZT( 1, 1, 1,t1 ); ZT( 1, 2, 1,t1 ); ZT( 2,-1, 1,t1 ); ZT( 2, 0, 1,t1 ); ZT( 2, 1, 1,t1 ); ZT( 2, 2, 1,t1 ); ZT(-1,-1, 2,t2 ); ZT(-1, 0, 2,t2 ); ZT(-1, 1, 2,t2 ); ZT(-1, 2, 2,t2 ); ZT( 0,-1, 2,t2 ); ZT( 0, 0, 2,t2 ); ZT( 0, 1, 2,t2 ); ZT( 0, 2, 2,t2 ); ZT( 1,-1, 2,t2 ); ZT( 1, 0, 2,t2 ); ZT( 1, 1, 2,t2 ); ZT( 1, 2, 2,t2 ); ZT( 2,-1, 2,t2 ); ZT( 2, 0, 2,t2 ); ZT( 2, 1, 2,t2 ); ZT( 2, 2, 2,t2 ); return ret; /* float dx=xf-x; float dy=yf-y; float dt=tf-t; float ret=0; int i,j,h; for(h=-1;h<=2;h++) for(i=-1;i<=2;i++) for(j=-1;j<=2;j++) ret+=(*this)(subseed,i+x,j+y,h+t)*(R(i-dx)*R(j-dy)*R(h-dt)); return ret; */ } break; #undef X #undef Z #undef F #undef P #undef R case SMOOTH_COSINE: if((float)t==tf) { int x((int)floor(xf)); int y((int)floor(yf)); float a=xf-x; float b=yf-y; a=(1.0f-cos(a*PI))*0.5f; b=(1.0f-cos(b*PI))*0.5f; float c=1.0-a; float d=1.0-b; int x2=x+1,y2=y+1; return (*this)(subseed,x,y,t0)*(c*d)+ (*this)(subseed,x2,y,t0)*(a*d)+ (*this)(subseed,x,y2,t0)*(c*b)+ (*this)(subseed,x2,y2,t0)*(a*b); } else { float a=xf-x; float b=yf-y; float c=tf-t; a=(1.0f-cos(a*PI))*0.5f; b=(1.0f-cos(b*PI))*0.5f; // We don't perform this on the time axis, otherwise we won't // get smooth motion //c=(1.0f-cos(c*PI))*0.5f; float d=1.0-a; float e=1.0-b; float f=1.0-c; int x2=x+1,y2=y+1; return (*this)(subseed,x,y,t0)*(d*e*f)+ (*this)(subseed,x2,y,t0)*(a*e*f)+ (*this)(subseed,x,y2,t0)*(d*b*f)+ (*this)(subseed,x2,y2,t0)*(a*b*f)+ (*this)(subseed,x,y,t1)*(d*e*c)+ (*this)(subseed,x2,y,t1)*(a*e*c)+ (*this)(subseed,x,y2,t1)*(d*b*c)+ (*this)(subseed,x2,y2,t1)*(a*b*c); } case SMOOTH_LINEAR: if((float)t==tf) { int x((int)floor(xf)); int y((int)floor(yf)); float a=xf-x; float b=yf-y; float c=1.0-a; float d=1.0-b; int x2=x+1,y2=y+1; return (*this)(subseed,x,y,t0)*(c*d)+ (*this)(subseed,x2,y,t0)*(a*d)+ (*this)(subseed,x,y2,t0)*(c*b)+ (*this)(subseed,x2,y2,t0)*(a*b); } else { float a=xf-x; float b=yf-y; float c=tf-t; float d=1.0-a; float e=1.0-b; float f=1.0-c; int x2=x+1,y2=y+1; return (*this)(subseed,x,y,t0)*(d*e*f)+ (*this)(subseed,x2,y,t0)*(a*e*f)+ (*this)(subseed,x,y2,t0)*(d*b*f)+ (*this)(subseed,x2,y2,t0)*(a*b*f)+ (*this)(subseed,x,y,t1)*(d*e*c)+ (*this)(subseed,x2,y,t1)*(a*e*c)+ (*this)(subseed,x,y2,t1)*(d*b*c)+ (*this)(subseed,x2,y2,t1)*(a*b*c); } default: case SMOOTH_DEFAULT: return (*this)(subseed,x,y,t0); } }
z_status zp_parser::_process_stage(zp_mode mode,zp_flags* pflags) { //ZTF; z_status status; zp_flags flags; status=get_flags(flags); if(status) return status; if(pflags) *pflags=flags; //return flags to caller zp_text_parser& tmpl=context_get_current_template_parser(); ctext tpl_start=tmpl.get_index(); if(mode.skip_test) { status=_process_single_item(mode,flags); Z_ASSERT(( status==zs_skipped)); return status; } if(mode.output) { int sanity_check_count=0; bool satified=false; while(1) { Z_ASSERT(sanity_check_count++<100); ctext data_start=get_index(); if(satified) flags.required=0; status=_process_single_item(mode,flags); if(status==zs_matched) { if(flags.multi) { tmpl.set_index(tpl_start); satified=true; continue; } } if(status==zs_skipped) status=zs_matched; if((status==zs_no_match)||(status==zs_eof)) { if(satified) status=zs_matched; } break; } return status; }//End of output if(mode.input_text) { U32 result_index_multi_success_mark=0; U32 testnum=_test_result_current_index; Z_ASSERT((_results)); _test_result_current_index++; if(!mode.create) { U32 result=0; U32 quanity_matched=0; ZT("TEST#%d START>>",testnum); _results->set_result(testnum,zp_result_unknown); SANITY_CHECK( _results->_test_result_tmpl[testnum]=tpl_start; ctext sanity_check_data_index=0; U32 sanity_check_loop_count=0; );
/* ** ** Find ISA operator and its target classname; Take following query for example, ** Select * from CIM_InstCreation where SourceInstance isa "Win32_process" ** (1) It's a lifecycle indication query ** (2) It's target class is Win32_process ** ** Following query is invalid since OR operator makes the target class ambiguous, ** Select * from CIM_InstCreation where SourceInstance isa "Win32_process" OR (2>1) ** This query targets to all classes under the namespace, which is NOT a valid scenario ** to support; This function is to find whether an given query is a valid lifecycle ** indication query; If yes return 0 and output the target class name; otherwise return non 0; ** ** */ static MI_Result _FindLifecycleClass( _In_ SubscriptionTargetType stt, _In_ const WQL* wql, _Outptr_result_maybenull_z_ const ZChar** targetClassname, _Outptr_result_maybenull_z_ const MI_Char** errormessage) { static const ZChar* sSourceInstanceProperty = ZT("SourceInstance"); static const ZChar* sPreviousInstanceProperty = ZT("PreviousInstance"); size_t i; WQL_SymbolEx symbols[WQL_MAX_SYMBOLS]; size_t nsymbols = 0; MI_Boolean foundISA = MI_FALSE; MI_Result r = MI_RESULT_NOT_SUPPORTED; DEBUG_ASSERT (wql && wql->className && targetClassname && errormessage); *targetClassname = NULL; *errormessage = NULL; /* Fail if there is no WHERE clause */ if (wql->nsymbols == 0) return MI_RESULT_OK; /* Perform postfix evaluation */ for (i = 0; i < wql->nsymbols; i++) { const WQL_Symbol* sym = &wql->symbols[i]; WQL_Type type = sym->type; if (nsymbols >= WQL_MAX_SYMBOLS) return r; switch (type) { case WQL_TYPE_AND: case WQL_TYPE_OR: { if (nsymbols < 2) return r; { WQL_SymbolEx s2 = symbols[--nsymbols]; WQL_SymbolEx s1 = symbols[--nsymbols]; WQL_SymbolEx s; memset(&s, 0, sizeof(WQL_SymbolEx)); if (type == WQL_TYPE_OR) { if (s1.isa || s2.isa) { *errormessage = STR_LIFECYCLE_INDICATION_QUERY_ISA_OPERATOR_WITHIN_OR; trace_FindLifecycleClass_InvalidLifecycleQuery(); return r; } } if (s1.base.type != WQL_TYPE_BOOLEAN) return r; if (s2.base.type != WQL_TYPE_BOOLEAN) return r; s.base.type = WQL_TYPE_BOOLEAN; s.base.value.boolean = 0; s.isa = s1.isa || s2.isa; symbols[nsymbols++] = s; } break; } case WQL_TYPE_NOT: { if (nsymbols < 1) return r; { WQL_SymbolEx s1 = symbols[--nsymbols]; WQL_SymbolEx s; memset(&s, 0, sizeof(WQL_SymbolEx)); if (s1.base.type != WQL_TYPE_BOOLEAN) return r; s.base.type = WQL_TYPE_BOOLEAN; s.base.value.boolean = 0; s.isa = s1.isa; symbols[nsymbols++] = s; } break; } case WQL_TYPE_EQ: case WQL_TYPE_NE: case WQL_TYPE_LT: case WQL_TYPE_LE: case WQL_TYPE_GT: case WQL_TYPE_GE: case WQL_TYPE_LIKE: { if (nsymbols < 2) return r; { WQL_SymbolEx s2 = symbols[--nsymbols]; WQL_SymbolEx s1 = symbols[--nsymbols]; WQL_SymbolEx s; memset(&s, 0, sizeof(WQL_SymbolEx)); s.base.type = WQL_TYPE_BOOLEAN; s.base.value.boolean = 0; s.isa = s1.isa || s2.isa; symbols[nsymbols++] = s; } break; } case WQL_TYPE_IDENTIFIER: { WQL_SymbolEx s; memset(&s, 0, sizeof(WQL_SymbolEx)); s.base.type = WQL_TYPE_BOOLEAN; s.base.value.boolean = 0; s.isa = MI_FALSE; symbols[nsymbols++] = s; break; } case WQL_TYPE_BOOLEAN: case WQL_TYPE_INTEGER: case WQL_TYPE_REAL: case WQL_TYPE_STRING: case WQL_TYPE_NULL: case WQL_TYPE_ANY: { WQL_SymbolEx s; memcpy(&s.base, sym, sizeof(WQL_Symbol)); s.isa = MI_FALSE; symbols[nsymbols++] = s; break; } case WQL_TYPE_ISA: { WQL_SymbolEx s2; WQL_SymbolEx s1; if (foundISA == MI_TRUE) { *errormessage = STR_LIFECYCLE_INDICATION_QUERY_MORETHANONE_ISA_OPERATOR; trace_FindLifecycleClass_UnsupportedLifecycleQuery(); return r; } if (nsymbols < 2) { trace_FindLifecycleClass_TooFewOperandsISA(); return r; } s2 = symbols[--nsymbols]; s1 = symbols[--nsymbols]; if (s1.base.type != WQL_TYPE_STRING) { trace_FindLifecycleClass_InvalidTokenType(); return r; } if (s2.base.type != WQL_TYPE_STRING) { trace_FindLifecycleClass_InvalidTokenType(); return r; } /* Check Embedded property name is valid or not */ { int cmpresult = Tcscasecmp(sSourceInstanceProperty, s1.base.value.string); if (cmpresult != 0) { if (stt == SUBSCRIP_TARGET_LIFECYCLE_MODIFY) { cmpresult = Tcscasecmp(sPreviousInstanceProperty, s1.base.value.string); } } if (cmpresult != 0) { *errormessage = STR_LIFECYCLE_INDICATION_QUERY_ISA_HAS_WRONG_PROPERTYNAME; r = MI_RESULT_INVALID_QUERY; trace_FindLifecycleClass_InvalidEmbeddedProperty(s1.base.value.string); return r; } } /* Put ISA result symbol into stack */ { WQL_SymbolEx s; memset(&s, 0, sizeof(WQL_SymbolEx)); s.base.type = WQL_TYPE_BOOLEAN; s.base.value.boolean = MI_FALSE; s.isa = MI_TRUE; symbols[nsymbols++] = s; *targetClassname = s2.base.value.string; foundISA = MI_TRUE; trace_FindLifecycleClass_FoundISAOperator(s1.base.value.string, s2.base.value.string); } break; } } } /* There should be exactly 1 symbol left on stack */ if (nsymbols != 1) { trace_FindLifecycleClass_EvalHasMoreThanOneSymbol(nsymbols); return r; } /* There should be exactly 1 symbol left on stack */ /* Final token on stack should be boolean */ if (symbols[0].base.type != WQL_TYPE_BOOLEAN) { trace_FindLifecycleClass_EvalResultIsNotBool(); return r; } if ( MI_FALSE == foundISA ) { *errormessage = STR_LIFECYCLE_INDICATION_QUERY_NO_ISA_OPERATOR; return r; } else return MI_RESULT_OK; }
z_status z_factory_controller:: EvaluatePath(ctext text_path, zf_obj& selected, z_fact_obj_path& out_obj_path, z_string & out_feature, z_string& out_feature_index) { ZT("%s",text_path); z_status status=zs_ok; out_feature.clear(); out_feature_index.clear(); _tparser.set_source(text_path); if(_tparser.test_char('/')==zs_matched) { selected=_root; out_obj_path.clear(); } while (1) { //This just gets next word in path status=parse_feature_and_index(out_feature,out_feature_index); if(status) { return status; } zf_feature *f; f=selected._fact->get_feature(out_feature); if(!f) { /* not our feature. could be a console feature. all we care about here is that it is not an object. deal with unknown features later*/ return zs_unparsed_data; // } status= f->get_zf_obj(selected,out_feature_index,selected); if(status) { /*It is our feature, but it is not an object so we are done. */ return zs_unparsed_data; } out_obj_path.emplace_back(f,out_feature_index); if(_tparser.eob()) return zs_ok;//we are done! if(_tparser.test_char('/') && _tparser.test_char('.')) { //if it is not a path char, stop return Z_ERROR_MSG(zs_parse_error,"Expected '.' or '/'\n"); } out_feature.clear(); out_feature_index.clear(); } /* if(!_tparser.eob()) return Z_ERROR_DBG(zs_unparsed_data); */ //should never get here return status; }