/* * New C++ File starts here. * This file should be named nml_test_format.cc */ // Include all NML, CMS, and RCS classes and functions #include "rcs.hh" // Include command and status message definitions #include "nml_test_format.hh" // Include externally supplied prototypes #include "nml_test_format_n_codegen_protos.hh" #ifndef MAX_NML_TEST_NAME_LENGTH #define MAX_NML_TEST_NAME_LENGTH 13 #endif #ifndef NML_TEST_NAME_LIST_LENGTH #define NML_TEST_NAME_LIST_LENGTH 5 #endif /* This list must be in alphabetical order and the three lists must correspond. */ const char nml_test_name_list[NML_TEST_NAME_LIST_LENGTH][MAX_NML_TEST_NAME_LENGTH]= { "BOP_MSG", /* 0,104 */ "QTEST_MSG", /* 1,103 */ "SIMPLER_MSG", /* 2,102 */ "TEST_MESSAGE", /* 3,101 */ ""}; const NMLTYPE nml_test_id_list[NML_TEST_NAME_LIST_LENGTH]= { BOP_MSG_TYPE, /* 0,104 */ QTEST_MSG_TYPE, /* 1,103 */ SIMPLER_MSG_TYPE, /* 2,102 */ TEST_MESSAGE_TYPE, /* 3,101 */ -1}; const size_t nml_test_size_list[NML_TEST_NAME_LIST_LENGTH]= { sizeof(BOP_MSG), sizeof(QTEST_MSG), sizeof(SIMPLER_MSG), sizeof(TEST_MESSAGE), 0}; const char *nml_test_symbol_lookup(long type); // Enumerated Type Constants // enumtest #ifndef MAX_ENUM_ENUMTEST_STRING_LENGTH #define MAX_ENUM_ENUMTEST_STRING_LENGTH 2 #endif #ifndef ENUM_ENUMTEST_LENGTH #define ENUM_ENUMTEST_LENGTH 3 #endif const char enum_enumtest_string_list[ENUM_ENUMTEST_LENGTH][MAX_ENUM_ENUMTEST_STRING_LENGTH]= { "a", /* 0,0 */ "b", /* 1,1 */ ""}; const int enum_enumtest_int_list[ENUM_ENUMTEST_LENGTH]= { a, /* 0,0 */ b, /* 1,1 */ }; const char *nml_test_enum_enumtest_symbol_lookup(long v) { switch(v) { case a: return("a"); /* 0 */ case b: return("b"); /* 1 */ default:break; } return(NULL); } const struct cms_enum_info enum_enumtest_info_struct={ "enumtest", (const char **)enum_enumtest_string_list, enum_enumtest_int_list, MAX_ENUM_ENUMTEST_STRING_LENGTH, ENUM_ENUMTEST_LENGTH, (cms_symbol_lookup_function_t)nml_test_enum_enumtest_symbol_lookup }; /* * NML/CMS Format function : nml_test_format * Automatically generated by NML CodeGen Java Applet. * on Sun Mar 21 10:40:14 EST 2004 */ int nml_test_format(NMLTYPE type, void *buffer, CMS *cms) { type = cms->check_type_info(type,buffer,"nml_test", (cms_symbol_lookup_function_t) nml_test_symbol_lookup, (const char **)nml_test_name_list, nml_test_id_list,nml_test_size_list, NML_TEST_NAME_LIST_LENGTH, MAX_NML_TEST_NAME_LENGTH); switch(type) { case BOP_MSG_TYPE: ((BOP_MSG *) buffer)->update(cms); break; case QTEST_MSG_TYPE: ((QTEST_MSG *) buffer)->update(cms); break; case SIMPLER_MSG_TYPE: ((SIMPLER_MSG *) buffer)->update(cms); break; case TEST_MESSAGE_TYPE: ((TEST_MESSAGE *) buffer)->update(cms); break; default: return(0); } return 1; } // NML Symbol Lookup Function const char *nml_test_symbol_lookup(long type) { switch(type) { case BOP_MSG_TYPE: return "BOP_MSG"; case QTEST_MSG_TYPE: return "QTEST_MSG"; case SIMPLER_MSG_TYPE: return "SIMPLER_MSG"; case TEST_MESSAGE_TYPE: return "TEST_MESSAGE"; default: return"UNKNOWN"; break; } return(NULL); } /* * NML/CMS Update function for QTEST_MSG * Automatically generated by NML CodeGen Java Applet. * on Sun Mar 21 10:40:14 EST 2004 */ void QTEST_MSG::update(CMS *cms) { cms->beginClass("QTEST_MSG","NMLmsg"); cms->update_with_name("priority",priority); cms->update_with_name("pchanges_count",pchanges_count); cms->update_with_name("count",count); cms->update_with_name("pid",pid); cms->update_with_name("line",line,105); cms->update_with_name("time",time); cms->endClass("QTEST_MSG","NMLmsg"); } /* * NML/CMS Update function for TEST_MESSAGE * Automatically generated by NML CodeGen Java Applet. * on Sun Mar 21 10:40:14 EST 2004 */ void TEST_MESSAGE::update(CMS *cms) { cms->beginClass("TEST_MESSAGE","NMLmsg"); cms->update_with_name("b",b); cms->update_with_name("c",c); cms->update_with_name("d",d); cms->update_with_name("i",i); cms->update_with_name("f",f); cms->update_with_name("bool_array",bool_array,4); cms->update_with_name("ia",ia,4); cms->update_with_name("ca",ca,4); cms->update_with_name("fa",fa,4); cms->update_with_name("da",da,4); cms->update_with_name("two_d_array",(double *) two_d_array,16); cms->update_with_name("three_d_array",(double *) three_d_array,64); cms->update_dla_length_with_name("cda_length",cda_length); cms->update_dla_with_name("cda",cda,cda_length,8); cms->update_dla_length_with_name("ida_length",ida_length); cms->update_dla_with_name("ida",ida,ida_length,8); cms->update_dla_length_with_name("fda_length",fda_length); cms->update_dla_with_name("fda",fda,fda_length,8); cms->update_dla_length_with_name("dda_length",dda_length); cms->update_dla_with_name("dda",dda,dda_length,8); cms->beginClassVar("s"); teststruct_update(cms,&s); cms->endClassVar("s"); for(int i_sa = 0;i_sa < 4 ;i_sa++) { cms->beginStructArrayElem("sa",i_sa); teststruct_update(cms,&(sa[i_sa])); cms->endStructArrayElem("sa",i_sa); } cms->update_dla_length_with_name("sda_length",sda_length); cms->beginStructDynamicArray("sda",sda_length,4); for(int i_sda = 0;i_sda < sda_length ;i_sda++) { cms->beginStructArrayElem("sda",i_sda); teststruct_update(cms,&(sda[i_sda])); cms->endStructArrayElem("sda",i_sda); } cms->endStructDynamicArray("sda",sda_length,4); enumtestvar= (enum enumtest) cms->update_enumeration_with_name("enumtestvar", (int)enumtestvar,(void*)&enumtestvar,&enum_enumtest_info_struct); cms->update_with_name("lastvar",lastvar); cms->endClass("TEST_MESSAGE","NMLmsg"); } /* * NML/CMS Update function for teststruct * Automatically generated by NML CodeGen Java Applet. * on Sun Mar 21 10:40:14 EST 2004 */ void teststruct_update(CMS *cms,teststruct *x) { cms->beginClass("teststruct",0); cms->update_with_name("b",x->b); cms->update_with_name("i",x->i); cms->update_with_name("c",x->c); cms->update_with_name("f",x->f); cms->update_with_name("d",x->d); cms->update_with_name("bool_array",x->bool_array,4); cms->update_with_name("ia",x->ia,4); cms->update_with_name("ca",x->ca,4); cms->update_with_name("fa",x->fa,4); cms->update_with_name("da",x->da,4); cms->update_with_name("two_d_array",(double *) x->two_d_array,16); cms->update_with_name("three_d_array",(double *) x->three_d_array,64); cms->update_dla_length_with_name("cda_length",x->cda_length); cms->update_dla_with_name("cda",x->cda, x->cda_length,8); cms->update_dla_length_with_name("ida_length",x->ida_length); cms->update_dla_with_name("ida",x->ida, x->ida_length,8); cms->update_dla_length_with_name("fda_length",x->fda_length); cms->update_dla_with_name("fda",x->fda, x->fda_length,8); cms->update_dla_length_with_name("dda_length",x->dda_length); cms->update_dla_with_name("dda",x->dda, x->dda_length,8); cms->endClass("teststruct",0); } /* * NML/CMS Update function for BOP_MSG * Automatically generated by NML CodeGen Java Applet. * on Sun Mar 21 10:40:14 EST 2004 */ void BOP_MSG::update(CMS *cms) { cms->beginClass("BOP_MSG","NMLmsg"); cms->update_with_name("ula",ula,4); cms->endClass("BOP_MSG","NMLmsg"); } /* * NML/CMS Update function for SIMPLER_MSG * Automatically generated by NML CodeGen Java Applet. * on Sun Mar 21 10:40:14 EST 2004 */ void SIMPLER_MSG::update(CMS *cms) { cms->beginClass("SIMPLER_MSG","NMLmsg"); cms->update_with_name("i",i); cms->update_with_name("cbuf",cbuf,80); cms->endClass("SIMPLER_MSG","NMLmsg"); } /* * Constructor for QTEST_MSG * Automatically generated by NML CodeGen Java Applet. * on Sun Mar 21 10:40:14 EST 2004 */ QTEST_MSG::QTEST_MSG() : NMLmsg(QTEST_MSG_TYPE,sizeof(QTEST_MSG)) { priority = (int) 0; pchanges_count = (int) 0; count = (int) 0; pid = (int) 0; for(int i_line=0; i_line< 105; i_line++) { ((char*)line)[i_line] = (char) 0; } time = (double) 0; } /* * Constructor for TEST_MESSAGE * Automatically generated by NML CodeGen Java Applet. * on Sun Mar 21 10:40:14 EST 2004 */ TEST_MESSAGE::TEST_MESSAGE() : NMLmsg(TEST_MESSAGE_TYPE,sizeof(TEST_MESSAGE)) { b = (bool) 0; c = (char) 0; d = (double) 0; i = (int) 0; f = (float) 0; for(int i_bool_array=0; i_bool_array< 4; i_bool_array++) { ((bool*)bool_array)[i_bool_array] = (bool) 0; } for(int i_ia=0; i_ia< 4; i_ia++) { ((int*)ia)[i_ia] = (int) 0; } for(int i_ca=0; i_ca< 4; i_ca++) { ((char*)ca)[i_ca] = (char) 0; } for(int i_fa=0; i_fa< 4; i_fa++) { ((float*)fa)[i_fa] = (float) 0; } for(int i_da=0; i_da< 4; i_da++) { ((double*)da)[i_da] = (double) 0; } for(int i_two_d_array=0; i_two_d_array< 16; i_two_d_array++) { ((double*)two_d_array)[i_two_d_array] = (double) 0; } for(int i_three_d_array=0; i_three_d_array< 64; i_three_d_array++) { ((double*)three_d_array)[i_three_d_array] = (double) 0; } cda_length = (int) 0; for(int i_cda=0; i_cda< 8; i_cda++) { ((char*)cda)[i_cda] = (char) 0; } ida_length = (int) 0; for(int i_ida=0; i_ida< 8; i_ida++) { ((int*)ida)[i_ida] = (int) 0; } fda_length = (int) 0; for(int i_fda=0; i_fda< 8; i_fda++) { ((float*)fda)[i_fda] = (float) 0; } dda_length = (int) 0; for(int i_dda=0; i_dda< 8; i_dda++) { ((double*)dda)[i_dda] = (double) 0; } initialize_teststruct( &(s)); for(int i_sa=0; i_sa< 4; i_sa++) { initialize_teststruct( &(sa[i_sa])); } sda_length = (int) 0; for(int i_sda=0; i_sda< 4; i_sda++) { initialize_teststruct( &(sda[i_sda])); } enumtestvar = (enum enumtest) b; /*1*/ lastvar = (long) 0; } /* * Initializer for teststruct * Automatically generated by NML CodeGen Java Applet. * on Sun Mar 21 10:40:14 EST 2004 */ void initialize_teststruct(teststruct* x) { x->b = (bool) 0; x->i = (int) 0; x->c = (char) 0; x->f = (float) 0; x->d = (double) 0; for(int i_bool_array=0; i_bool_array< 4; i_bool_array++) { ((bool*) x->bool_array)[i_bool_array] = (bool) 0; } for(int i_ia=0; i_ia< 4; i_ia++) { ((int*) x->ia)[i_ia] = (int) 0; } for(int i_ca=0; i_ca< 4; i_ca++) { ((char*) x->ca)[i_ca] = (char) 0; } for(int i_fa=0; i_fa< 4; i_fa++) { ((float*) x->fa)[i_fa] = (float) 0; } for(int i_da=0; i_da< 4; i_da++) { ((double*) x->da)[i_da] = (double) 0; } for(int i_two_d_array=0; i_two_d_array< 16; i_two_d_array++) { ((double*) x->two_d_array)[i_two_d_array] = (double) 0; } for(int i_three_d_array=0; i_three_d_array< 64; i_three_d_array++) { ((double*) x->three_d_array)[i_three_d_array] = (double) 0; } x->cda_length = (int) 0; for(int i_cda=0; i_cda< 8; i_cda++) { ((char*) x->cda)[i_cda] = (char) 0; } x->ida_length = (int) 0; for(int i_ida=0; i_ida< 8; i_ida++) { ((int*) x->ida)[i_ida] = (int) 0; } x->fda_length = (int) 0; for(int i_fda=0; i_fda< 8; i_fda++) { ((float*) x->fda)[i_fda] = (float) 0; } x->dda_length = (int) 0; for(int i_dda=0; i_dda< 8; i_dda++) { ((double*) x->dda)[i_dda] = (double) 0; } } /* * Constructor for BOP_MSG * Automatically generated by NML CodeGen Java Applet. * on Sun Mar 21 10:40:15 EST 2004 */ BOP_MSG::BOP_MSG() : NMLmsg(BOP_MSG_TYPE,sizeof(BOP_MSG)) { for(int i_ula=0; i_ula< 4; i_ula++) { ((unsigned long*)ula)[i_ula] = (unsigned long) 0; } } /* * Constructor for SIMPLER_MSG * Automatically generated by NML CodeGen Java Applet. * on Sun Mar 21 10:40:15 EST 2004 */ SIMPLER_MSG::SIMPLER_MSG() : NMLmsg(SIMPLER_MSG_TYPE,sizeof(SIMPLER_MSG)) { i = (int) 0; for(int i_cbuf=0; i_cbuf< 80; i_cbuf++) { ((char*)cbuf)[i_cbuf] = (char) 0; } }