X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=inline;f=src%2Fftacmp%2Fparse_schema.cc;h=7931b8467293af8e9fd0b1e8a1674b68d85ad330;hb=804ea15b01566ac0de58781ca61870b4824d0e02;hp=a9bc60cf0dbcc9895c25dcdb5f475a1965f88d87;hpb=c9783d8ea8b85d810483559e50dbf2297109e349;p=com%2Fgs-lite.git diff --git a/src/ftacmp/parse_schema.cc b/src/ftacmp/parse_schema.cc index a9bc60c..7931b84 100644 --- a/src/ftacmp/parse_schema.cc +++ b/src/ftacmp/parse_schema.cc @@ -259,11 +259,29 @@ int table_list::get_table_ref(string t){ // and verify that all field unpacking functions // are listed in the schema. int table_list::unroll_tables(string &err){ + int f, tref, p, t, ret=0, retval=0; + // First, verify there are no repeat field names in any // of the tables. + set found_names; + set dup_names; + for(t=0;tget_tbl_name()) != found_names.end()){ + dup_names.insert(tbl_list[t]->get_tbl_name()); + }else{ + found_names.insert(tbl_list[t]->get_tbl_name()); + } + } + if(dup_names.size()>0){ + fprintf(stderr, "Error, the schema has duplicate names:"); + for(auto dit=dup_names.begin();dit!=dup_names.end(); ++dit) + fprintf(stderr, " %s",(*dit).c_str()); + fprintf(stderr, "\n"); + retval = 1; + } - int f, tref, p, t, ret, retval; +// extrack unpack functions for(t=0;tget_schema_type() == UNPACK_FCNS_SCHEMA){ for(f=0;fufcn_list.size();f++){ @@ -282,7 +300,7 @@ int table_list::unroll_tables(string &err){ // every field has an access function if(tbl_list[t]->get_schema_type() == PROTOCOL_SCHEMA){ - retval = tbl_list[t]->verify_access_fcns(err); + ret = tbl_list[t]->verify_access_fcns(err); if(ret) retval = ret; } @@ -405,6 +423,11 @@ int table_list::unroll_tables(string &err){ err.append(").\n"); } } +// and insert schema_ids + set s_schema_ids = tbl_list[root]->get_all_schema_ids(); + for(auto sit=s_schema_ids.begin(); sit!=s_schema_ids.end(); ++sit){ + tbl_list[s]->add_to_all_schema_ids((*sit)); + } // s has one less predecessor. n_pred[s]--;