Loading MBsysC/mbs_common/mbs_load_xml/mbs_load_xml.c +10 −25 Original line number Diff line number Diff line Loading @@ -31,13 +31,7 @@ MbsData* mbs_load(const char* mbs_filename, const char* build_path) MbsLoader *loader; loader = mbs_new_loader(); int err = 0; mbs_data = mbs_load_with_loader(mbs_filename, build_path, loader, &err); if (err < 0) { mbs_msg(">>LOAD>> Check your file names and paths \n"); mbs_error_msg(" [-0%d] in mbs_run_part !! \n", -err); } mbs_data = mbs_load_with_loader(mbs_filename, build_path, loader); mbs_delete_loader(loader); return mbs_data; Loading @@ -45,7 +39,7 @@ MbsData* mbs_load(const char* mbs_filename, const char* build_path) /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ MbsData* mbs_load_with_loader(const char* mbs_filename, const char* build_path, MbsLoader *mbs_loader, int *err) MbsData* mbs_load_with_loader(const char* mbs_filename, const char* build_path, MbsLoader *mbs_loader) { MDS_gen_strct *mds; MbsData *mbs_data; Loading @@ -58,12 +52,7 @@ MbsData* mbs_load_with_loader(const char* mbs_filename, const char* build_path, if (mbs_loader->mds == NULL) { custom_mds = 0; mds = MDS_mbs_reader(mbs_filename, err); if (*err < 0) { *err -= 90; return NULL; } mds= MDS_mbs_reader(mbs_filename); } else { Loading @@ -81,9 +70,7 @@ MbsData* mbs_load_with_loader(const char* mbs_filename, const char* build_path, // 0. build if (build_path == NULL) { mbs_msg(">>LOAD>> build_path is not defined \n"); *err = -80; return NULL; mbs_error_msg(">>LOAD>> build_path is not defined \n"); } // 1. symbolic Library name (without extension) Loading Loading @@ -142,13 +129,8 @@ MbsData* mbs_load_with_loader(const char* mbs_filename, const char* build_path, mbs_data = (MbsData*)malloc(sizeof(MbsData)); mbs_data->project_path = (char*)malloc(sizeof(char)*(strlen(mbs_filename) + 100)); *err = find_project_path(mbs_filename, mbs_data->project_path); if (err < 0) { mbs_msg(">>LOAD>> project path not found \n"); *err = -89; return NULL; } find_project_path(mbs_filename, mbs_data->project_path); // if we call project and user function pointer, init them #ifdef PRJ_FCT_PTR mbs_load_symbolic_functions(mbs_data,symbolicLib_path,symbolicLib_name); Loading @@ -169,6 +151,7 @@ MbsData* mbs_load_with_loader(const char* mbs_filename, const char* build_path, free(userfctLib_name); free(userfctLib_path); if (custom_mds == 0) { free_MDS_gen_strct(mds); Loading @@ -178,6 +161,8 @@ MbsData* mbs_load_with_loader(const char* mbs_filename, const char* build_path, // do nothing as the loader->mds memory could be re-used. } return mbs_data; } Loading MBsysC/mbs_common/mbs_load_xml/mbs_load_xml.h +1 −2 Original line number Diff line number Diff line Loading @@ -24,9 +24,8 @@ MbsData* mbs_load(const char* mbs_filename, const char* build_name); * \param mbs_filename, path to the file to load including filename and extension. * \param build_path, path to the build folder (including build) of MBsysC libraries * \param mbs_load_opts, options for loading (mainly a collection of paths and names) * \param err return error code if problem during loading */ MbsData* mbs_load_with_loader(const char* mbs_filename, const char* build_path, MbsLoader *mbs_loader, int *err); MbsData* mbs_load_with_loader(const char* mbs_filename, const char* build_path, MbsLoader *mbs_loader); /** * \brief Create a new structure with options for the loading. Loading MBsysC/mbs_common/mbs_load_xml/mbs_xml_reader.c +3 −5 Original line number Diff line number Diff line Loading @@ -1512,7 +1512,7 @@ void MDS_structurer(MDS_gen_strct* mds_gen_strct) } MDS_gen_strct* MDS_mbs_reader(const char* mbs_xml_name, int *err) MDS_gen_strct* MDS_mbs_reader(const char* mbs_xml_name) { xmlDocPtr doc; xmlNodePtr root; Loading @@ -1523,15 +1523,13 @@ MDS_gen_strct* MDS_mbs_reader(const char* mbs_xml_name, int *err) doc = xmlParseFile(mbs_xml_name); if (doc == NULL) { //fprintf(stderr, "MDS_mbs_reader : Invalid XML document\n"); mbs_msg("\n>>LOAD>> MDS_mbs_reader : Impossible to read file %s \n", mbs_xml_name); *err = -9; mbs_error_msg("MDS_mbs_reader : Impossible to read file %s\n", mbs_xml_name); return NULL; } // getting the root root = xmlDocGetRootElement(doc); if (root == NULL) { mbs_msg(">>LOAD>> MDS_mbs_reader : Empty XML document\n"); *err = -9; fprintf(stderr, "MDS_mbs_reader : Empty XML document\n"); xmlFreeDoc(doc); return NULL; } Loading MBsysC/mbs_common/mbs_load_xml/mbs_xml_reader.h +3 −1 Original line number Diff line number Diff line Loading @@ -427,7 +427,9 @@ MDS_gen_strct* init_MDS_gen_strct(void); void free_MDS_gen_strct(MDS_gen_strct *mds_gen_strct); MDS_gen_strct* MDS_mbs_reader(const char* mbs_xml_name, int *err); MDS_gen_strct* MDS_mbs_reader(const char* mbs_xml_name); #ifdef GEN_MDS Loading MBsysC/mbs_common/mbs_utilities/mbs_path.c +3 −4 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ char* find_user_path(const char* mbsfile){ return userpath; } int find_project_path(const char* mbsfile, char* prjpath){ void find_project_path(const char* mbsfile, char* prjpath){ char *ptr; char* c; Loading Loading @@ -55,8 +55,7 @@ int find_project_path(const char* mbsfile, char* prjpath){ } else{ mbs_msg("\n >>LOAD>> the *.mbs file must be in the dataR folder. \n"); return -9; mbs_error_msg("the *.mbs file must be in the dataR folder. \n"); exit(1); } return 0; } Loading
MBsysC/mbs_common/mbs_load_xml/mbs_load_xml.c +10 −25 Original line number Diff line number Diff line Loading @@ -31,13 +31,7 @@ MbsData* mbs_load(const char* mbs_filename, const char* build_path) MbsLoader *loader; loader = mbs_new_loader(); int err = 0; mbs_data = mbs_load_with_loader(mbs_filename, build_path, loader, &err); if (err < 0) { mbs_msg(">>LOAD>> Check your file names and paths \n"); mbs_error_msg(" [-0%d] in mbs_run_part !! \n", -err); } mbs_data = mbs_load_with_loader(mbs_filename, build_path, loader); mbs_delete_loader(loader); return mbs_data; Loading @@ -45,7 +39,7 @@ MbsData* mbs_load(const char* mbs_filename, const char* build_path) /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ MbsData* mbs_load_with_loader(const char* mbs_filename, const char* build_path, MbsLoader *mbs_loader, int *err) MbsData* mbs_load_with_loader(const char* mbs_filename, const char* build_path, MbsLoader *mbs_loader) { MDS_gen_strct *mds; MbsData *mbs_data; Loading @@ -58,12 +52,7 @@ MbsData* mbs_load_with_loader(const char* mbs_filename, const char* build_path, if (mbs_loader->mds == NULL) { custom_mds = 0; mds = MDS_mbs_reader(mbs_filename, err); if (*err < 0) { *err -= 90; return NULL; } mds= MDS_mbs_reader(mbs_filename); } else { Loading @@ -81,9 +70,7 @@ MbsData* mbs_load_with_loader(const char* mbs_filename, const char* build_path, // 0. build if (build_path == NULL) { mbs_msg(">>LOAD>> build_path is not defined \n"); *err = -80; return NULL; mbs_error_msg(">>LOAD>> build_path is not defined \n"); } // 1. symbolic Library name (without extension) Loading Loading @@ -142,13 +129,8 @@ MbsData* mbs_load_with_loader(const char* mbs_filename, const char* build_path, mbs_data = (MbsData*)malloc(sizeof(MbsData)); mbs_data->project_path = (char*)malloc(sizeof(char)*(strlen(mbs_filename) + 100)); *err = find_project_path(mbs_filename, mbs_data->project_path); if (err < 0) { mbs_msg(">>LOAD>> project path not found \n"); *err = -89; return NULL; } find_project_path(mbs_filename, mbs_data->project_path); // if we call project and user function pointer, init them #ifdef PRJ_FCT_PTR mbs_load_symbolic_functions(mbs_data,symbolicLib_path,symbolicLib_name); Loading @@ -169,6 +151,7 @@ MbsData* mbs_load_with_loader(const char* mbs_filename, const char* build_path, free(userfctLib_name); free(userfctLib_path); if (custom_mds == 0) { free_MDS_gen_strct(mds); Loading @@ -178,6 +161,8 @@ MbsData* mbs_load_with_loader(const char* mbs_filename, const char* build_path, // do nothing as the loader->mds memory could be re-used. } return mbs_data; } Loading
MBsysC/mbs_common/mbs_load_xml/mbs_load_xml.h +1 −2 Original line number Diff line number Diff line Loading @@ -24,9 +24,8 @@ MbsData* mbs_load(const char* mbs_filename, const char* build_name); * \param mbs_filename, path to the file to load including filename and extension. * \param build_path, path to the build folder (including build) of MBsysC libraries * \param mbs_load_opts, options for loading (mainly a collection of paths and names) * \param err return error code if problem during loading */ MbsData* mbs_load_with_loader(const char* mbs_filename, const char* build_path, MbsLoader *mbs_loader, int *err); MbsData* mbs_load_with_loader(const char* mbs_filename, const char* build_path, MbsLoader *mbs_loader); /** * \brief Create a new structure with options for the loading. Loading
MBsysC/mbs_common/mbs_load_xml/mbs_xml_reader.c +3 −5 Original line number Diff line number Diff line Loading @@ -1512,7 +1512,7 @@ void MDS_structurer(MDS_gen_strct* mds_gen_strct) } MDS_gen_strct* MDS_mbs_reader(const char* mbs_xml_name, int *err) MDS_gen_strct* MDS_mbs_reader(const char* mbs_xml_name) { xmlDocPtr doc; xmlNodePtr root; Loading @@ -1523,15 +1523,13 @@ MDS_gen_strct* MDS_mbs_reader(const char* mbs_xml_name, int *err) doc = xmlParseFile(mbs_xml_name); if (doc == NULL) { //fprintf(stderr, "MDS_mbs_reader : Invalid XML document\n"); mbs_msg("\n>>LOAD>> MDS_mbs_reader : Impossible to read file %s \n", mbs_xml_name); *err = -9; mbs_error_msg("MDS_mbs_reader : Impossible to read file %s\n", mbs_xml_name); return NULL; } // getting the root root = xmlDocGetRootElement(doc); if (root == NULL) { mbs_msg(">>LOAD>> MDS_mbs_reader : Empty XML document\n"); *err = -9; fprintf(stderr, "MDS_mbs_reader : Empty XML document\n"); xmlFreeDoc(doc); return NULL; } Loading
MBsysC/mbs_common/mbs_load_xml/mbs_xml_reader.h +3 −1 Original line number Diff line number Diff line Loading @@ -427,7 +427,9 @@ MDS_gen_strct* init_MDS_gen_strct(void); void free_MDS_gen_strct(MDS_gen_strct *mds_gen_strct); MDS_gen_strct* MDS_mbs_reader(const char* mbs_xml_name, int *err); MDS_gen_strct* MDS_mbs_reader(const char* mbs_xml_name); #ifdef GEN_MDS Loading
MBsysC/mbs_common/mbs_utilities/mbs_path.c +3 −4 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ char* find_user_path(const char* mbsfile){ return userpath; } int find_project_path(const char* mbsfile, char* prjpath){ void find_project_path(const char* mbsfile, char* prjpath){ char *ptr; char* c; Loading Loading @@ -55,8 +55,7 @@ int find_project_path(const char* mbsfile, char* prjpath){ } else{ mbs_msg("\n >>LOAD>> the *.mbs file must be in the dataR folder. \n"); return -9; mbs_error_msg("the *.mbs file must be in the dataR folder. \n"); exit(1); } return 0; }