From 4b5759104ab2472bd3b65a682a5b2a3b4fc24742 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Tue, 11 Mar 2008 20:24:30 +0000 Subject: [PATCH] cleanup CTX.files --- Box/Box.cpp | 6 +++--- Common/CommandLine.cpp | 8 ++++---- Common/Context.h | 5 +++-- Common/Options.cpp | 3 +-- Fltk/Main.cpp | 10 +++++----- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Box/Box.cpp b/Box/Box.cpp index 69998dd2a0..cd20782561 100644 --- a/Box/Box.cpp +++ b/Box/Box.cpp @@ -1,4 +1,4 @@ -// $Id: Box.cpp,v 1.44 2008-03-11 20:03:09 geuzaine Exp $ +// $Id: Box.cpp,v 1.45 2008-03-11 20:24:30 geuzaine Exp $ // // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle // @@ -83,8 +83,8 @@ int GMSHBOX(int argc, char *argv[]) if(gmsh_yyerrorstate) ParUtil::Instance()->Abort(); else { - for(int i = 1; i < List_Nbr(CTX.files); i++) - MergeFile(*(char**)List_Pointer(CTX.files, i)); + for(unsigned int i = 1; i < CTX.files.size(); i++) + MergeFile(CTX.files[i].c_str()); if(CTX.bgm_filename) { MergeFile(CTX.bgm_filename); if(PView::list.size()){ diff --git a/Common/CommandLine.cpp b/Common/CommandLine.cpp index 25ac353882..a3ddcdb35c 100644 --- a/Common/CommandLine.cpp +++ b/Common/CommandLine.cpp @@ -1,4 +1,4 @@ -// $Id: CommandLine.cpp,v 1.120 2008-02-23 19:49:35 geuzaine Exp $ +// $Id: CommandLine.cpp,v 1.121 2008-03-11 20:24:30 geuzaine Exp $ // // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle // @@ -668,13 +668,13 @@ void Get_Options(int argc, char *argv[]) } else { - List_Add(CTX.files, &argv[i++]); + CTX.files.push_back(argv[i++]); } } - if(!List_Nbr(CTX.files)) + if(CTX.files.empty()) strncpy(CTX.filename, CTX.default_filename_fullpath, 255); else - strncpy(CTX.filename, *(char**)List_Pointer(CTX.files, 0), 255); + strncpy(CTX.filename, CTX.files[0].c_str(), 255); } diff --git a/Common/Context.h b/Common/Context.h index 1f43f81291..f607e15cec 100644 --- a/Common/Context.h +++ b/Common/Context.h @@ -20,7 +20,8 @@ // // Please report all bugs and problems to <gmsh@geuz.org>. -#include "List.h" +#include <vector> +#include <string> // Interface-independent context @@ -33,7 +34,7 @@ class Context_T { char no_ext_filename[256]; // the same without the extension char base_filename[256]; // the base filename (no path, no extension) const char *bgm_filename; // background mesh - List_T *files; // all the files on the command line + std::vector<std::string> files; // all the files on the command line const char *output_filename; // output file specified with command line option '-o' const char *default_filename; char default_filename_fullpath[256]; // the name of the default file diff --git a/Common/Options.cpp b/Common/Options.cpp index f4ceecc363..0e1ff24473 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -1,4 +1,4 @@ -// $Id: Options.cpp,v 1.386 2008-03-11 20:03:09 geuzaine Exp $ +// $Id: Options.cpp,v 1.387 2008-03-11 20:24:30 geuzaine Exp $ // // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle // @@ -120,7 +120,6 @@ void Init_Options(int num) CTX.batch = 0; CTX.output_filename = NULL; CTX.bgm_filename = NULL; - CTX.files = List_Create(10, 10, sizeof(char*)); CTX.lc = 1.0; CTX.viewport[0] = CTX.viewport[1] = 0; CTX.min[0] = CTX.min[1] = CTX.min[2] = 0.0; diff --git a/Fltk/Main.cpp b/Fltk/Main.cpp index b3dbbe446b..d28ceb1886 100644 --- a/Fltk/Main.cpp +++ b/Fltk/Main.cpp @@ -1,4 +1,4 @@ -// $Id: Main.cpp,v 1.118 2008-03-11 20:03:09 geuzaine Exp $ +// $Id: Main.cpp,v 1.119 2008-03-11 20:24:30 geuzaine Exp $ // // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle // @@ -80,8 +80,8 @@ int main(int argc, char *argv[]) if(gmsh_yyerrorstate) exit(1); else { - for(int i = 1; i < List_Nbr(CTX.files); i++) - MergeFile(*(char**)List_Pointer(CTX.files, i)); + for(unsigned int i = 1; i < CTX.files.size(); i++) + MergeFile(CTX.files[i].c_str()); if(CTX.post.combine_time) PView::combine(true, 2, CTX.post.combine_remove_orig); if(CTX.bgm_filename) { @@ -144,8 +144,8 @@ int main(int argc, char *argv[]) // Open project file and merge all other input files OpenProject(CTX.filename); - for(int i = 1; i < List_Nbr(CTX.files); i++) - MergeFile(*(char**)List_Pointer(CTX.files, i)); + for(unsigned int i = 1; i < CTX.files.size(); i++) + MergeFile(CTX.files[i].c_str()); if(CTX.post.combine_time){ PView::combine(true, 2, CTX.post.combine_remove_orig); WID->update_views(); -- GitLab