diff --git a/Common/AdaptiveViews.cpp b/Common/AdaptiveViews.cpp index 2c41435b12bc04df20a5863adc8535d563310bf0..d2b1a119d30ed4cc44e395b63f87548a07dbd042 100644 --- a/Common/AdaptiveViews.cpp +++ b/Common/AdaptiveViews.cpp @@ -24,7 +24,7 @@ #include <set> #include "AdaptiveViews.h" #include "Plugin.h" -#include "Timer.h" +#include "OS.h" // A recursive effective implementation diff --git a/Common/CommandLine.cpp b/Common/CommandLine.cpp index ddc5459d9765a81938e53cab4be18e282dbe956d..8f01510c722f22c9dd46fcfb0b5197ef6d72e5ce 100644 --- a/Common/CommandLine.cpp +++ b/Common/CommandLine.cpp @@ -1,4 +1,4 @@ -// $Id: CommandLine.cpp,v 1.68 2006-02-24 03:26:37 geuzaine Exp $ +// $Id: CommandLine.cpp,v 1.69 2006-02-26 16:26:08 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -19,8 +19,6 @@ // // Please report all bugs and problems to <gmsh@geuz.org>. -#include <sys/types.h> -#include <unistd.h> #include "Gmsh.h" #include "GmshUI.h" #include "GmshVersion.h" @@ -33,6 +31,7 @@ #include "Views.h" #include "OpenFile.h" #include "Parser.h" +#include "OS.h" #if !defined(GMSH_EXTRA_VERSION) #error @@ -166,7 +165,7 @@ void Get_Options(int argc, char *argv[]) if(argv[i][0] == '-') { if(!strcmp(argv[i] + 1, "pid")) { - fprintf(stdout, "%d\n", getpid()); + fprintf(stdout, "%d\n", GetProcessId()); fflush(stdout); i++; } diff --git a/Common/Makefile b/Common/Makefile index 4a11e13f31ad95fd7d324e999a1ce061d3b6f44b..a8e39c9aade4c0ecbf227bf07a72db621c3383da 100644 --- a/Common/Makefile +++ b/Common/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.85 2006-02-26 00:53:06 geuzaine Exp $ +# $Id: Makefile,v 1.86 2006-02-26 16:26:08 geuzaine Exp $ # # Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle # @@ -33,7 +33,7 @@ SRC = Context.cpp\ Octree.cpp OctreeInternals.cpp OctreePost.cpp\ Options.cpp\ CommandLine.cpp\ - Timer.cpp\ + OS.cpp\ ColorTable.cpp\ Visibility.cpp\ Trackball.cpp\ @@ -81,7 +81,7 @@ AdaptiveViews.o: AdaptiveViews.cpp AdaptiveViews.h ../DataStr/List.h \ GmshMatrix.h ../Plugin/Plugin.h ../Common/Options.h ../Common/Message.h \ ../Common/Views.h ../Common/ColorTable.h ../Common/VertexArray.h \ ../Common/SmoothNormals.h ../Numeric/Numeric.h ../Common/GmshMatrix.h \ - ../Common/AdaptiveViews.h Timer.h + ../Common/AdaptiveViews.h OS.h # 1 "/Users/geuzaine/.gmsh/Common//" Views.o: Views.cpp Gmsh.h Message.h ../DataStr/Malloc.h ../DataStr/List.h \ ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h ../DataStr/List.h \ @@ -131,9 +131,9 @@ CommandLine.o: CommandLine.cpp Gmsh.h Message.h ../DataStr/Malloc.h \ ../Common/SmoothNormals.h ../Mesh/Metric.h ../Mesh/Vertex.h \ ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h Views.h ColorTable.h \ VertexArray.h SmoothNormals.h GmshMatrix.h AdaptiveViews.h \ - ../Parser/OpenFile.h ../Parser/Parser.h + ../Parser/OpenFile.h ../Parser/Parser.h OS.h # 1 "/Users/geuzaine/.gmsh/Common//" -Timer.o: Timer.cpp +OS.o: OS.cpp Message.h # 1 "/Users/geuzaine/.gmsh/Common//" ColorTable.o: ColorTable.cpp Gmsh.h Message.h ../DataStr/Malloc.h \ ../DataStr/List.h ../DataStr/Tree.h ../DataStr/avl.h ../DataStr/Tools.h \ diff --git a/Common/Timer.cpp b/Common/OS.cpp similarity index 58% rename from Common/Timer.cpp rename to Common/OS.cpp index d8fafadc1ef81406bed7532d94e7367d374b6512..9953b60278f7730931aa9df079b296c2b37ec604 100644 --- a/Common/Timer.cpp +++ b/Common/OS.cpp @@ -1,4 +1,4 @@ -// $Id: Timer.cpp,v 1.23 2006-02-26 00:40:29 geuzaine Exp $ +// $Id: OS.cpp,v 1.1 2006-02-26 16:26:08 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -19,17 +19,22 @@ // // Please report all bugs and problems to <gmsh@geuz.org>. -#if !defined(WIN32) || defined(__CYGWIN__) +// This file contains a bunch of functions that depend on OS-dependent +// features and/or system calls + +// these are available on all OSes +#include <stdlib.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <time.h> +#if !defined(WIN32) || defined(__CYGWIN__) #include <unistd.h> -#include <time.h> // for sgi and maybe others #include <sys/time.h> #include <sys/resource.h> - -#else // pure windows - +#else #include <windows.h> - +#include <process.h> #endif #if defined(__APPLE__) @@ -37,6 +42,8 @@ #define RUSAGE_CHILDREN -1 #endif +#include "Message.h" + double GetTimeInSeconds() { #if !defined(WIN32) || defined(__CYGWIN__) @@ -86,3 +93,66 @@ double Cpu() GetResources(&s, &mem); return s; } + +int GetProcessId() +{ +#if !defined(WIN32) || defined(__CYGWIN__) + return getpid(); +#else + return _getpid(); +#endif +} + +int UnlinkFile(char *filename) +{ +#if !defined(WIN32) || defined(__CYGWIN__) + return unlink(filename); +#else + return _unlink(filename); +#endif +} + +int StatFile(char *filename) +{ +#if !defined(WIN32) || defined(__CYGWIN__) + struct stat buf; + return stat(filename, &buf); +#else + struct _stat buf; + return _stat(filename, &buf); +#endif +} + +int KillProcess(int pid) +{ +#if !defined(WIN32) || defined(__CYGWIN__) + kill(pid, 9); +#else + HANDLE hProc = OpenProcess(PROCESS_TERMINATE, FALSE, pid); + if(!TerminateProcess(hProc, 0)){ + CloseHandle(hProc); + return 0; + } +#endif + return 1; +} + +void SystemCall(char *command) +{ +#if defined(WIN32) + STARTUPINFO suInfo; + PROCESS_INFORMATION prInfo; + memset(&suInfo, 0, sizeof(suInfo)); + suInfo.cb = sizeof(suInfo); + Msg(INFO, "Calling '%s'", command); + CreateProcess(NULL, command, NULL, NULL, FALSE, + NORMAL_PRIORITY_CLASS, NULL, NULL, &suInfo, &prInfo); +#else + if(!system(NULL)) { + Msg(GERROR, "Could not find /bin/sh: aborting system call"); + return; + } + Msg(INFO, "Calling '%s'", command); + system(command); +#endif +} diff --git a/Common/Timer.h b/Common/OS.h similarity index 85% rename from Common/Timer.h rename to Common/OS.h index 55b06f87fd24fa22e2330ba99b886732f1fb3b5d..dcedc34beaea4c4c3e9a236d2f1eb8efd24d66df 100644 --- a/Common/Timer.h +++ b/Common/OS.h @@ -1,5 +1,5 @@ -#ifndef _TIMER_H_ -#define _TIMER_H_ +#ifndef _OS_H_ +#define _OS_H_ // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -24,5 +24,10 @@ double GetTimeInSeconds(); void SleepInSeconds(double s); void GetResources(double *s, long *mem); double Cpu(); +int GetProcessId(); +int UnlinkFile(char *name); +int StatFile(char *filename); +int KillProcess(int pid); +int SystemCall(char *command); #endif diff --git a/DataStr/SafeIO.cpp b/DataStr/SafeIO.cpp index e5f2efadc25c94a1bf541f034277687e17f70cf1..c96ec635ca0c993d5481449dd8e09a7c444eb9c7 100644 --- a/DataStr/SafeIO.cpp +++ b/DataStr/SafeIO.cpp @@ -1,4 +1,4 @@ -// $Id: SafeIO.cpp,v 1.6 2006-01-06 00:34:21 geuzaine Exp $ +// $Id: SafeIO.cpp,v 1.7 2006-02-26 16:26:08 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -22,8 +22,6 @@ #include <stdlib.h> #include <string.h> #include <errno.h> -#include <unistd.h> - #include "SafeIO.h" #include "Message.h" @@ -73,8 +71,6 @@ int safe_fwrite(const void *ptr, size_t size, size_t nmemb, FILE * stream) Msg(GERROR, "Truncating output file"); if(fflush(stream) < 0) Msg(GERROR, "EOF reached"); - if(ftruncate(fileno(stream), 0) < 0) - Msg(GERROR, strerror(errno)); if(fclose(stream) < 0) Msg(GERROR, strerror(errno)); return 1; diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index d2b50e3d9296e869608c94c2d4333e01c8680da1..74252b18213accc09df711f5c2f1aa5dd3e509ca 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -1,4 +1,4 @@ -// $Id: Callbacks.cpp,v 1.411 2006-02-25 07:02:20 geuzaine Exp $ +// $Id: Callbacks.cpp,v 1.412 2006-02-26 16:26:08 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -19,9 +19,6 @@ // // Please report all bugs and problems to <gmsh@geuz.org>. -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> #include <signal.h> #include <time.h> #include <map> @@ -35,7 +32,6 @@ #include "Mesh.h" #include "Draw.h" #include "Views.h" -#include "Timer.h" #include "CreateFile.h" #include "OpenFile.h" #include "CommandLine.h" @@ -49,6 +45,7 @@ #include "Visibility.h" #include "Numeric.h" #include "Solvers.h" +#include "OS.h" using namespace std; @@ -568,11 +565,10 @@ void file_new_cb(CALLBACK_ARGS) test: if(file_chooser(0, 1, "New", "*")) { char *name = file_chooser_get_name(1); - struct stat buf; - if(!stat(name, &buf)){ + if(!StatFile(name)){ if(fl_choice("File '%s' already exists.\n\nDo you want to erase it?", "Cancel", "Erase", NULL, name)) - unlink(name); + UnlinkFile(name); else goto test; } @@ -827,8 +823,7 @@ void file_save_as_cb(CALLBACK_ARGS) if(file_chooser(0, 1, "Save As", pat)) { char *name = file_chooser_get_name(1); if(CTX.confirm_overwrite) { - struct stat buf; - if(!stat(name, &buf)) + if(!StatFile(name)) if(!fl_choice("File '%s' already exists.\n\nDo you want to replace it?", "Cancel", "Replace", NULL, name)) goto test; @@ -849,8 +844,7 @@ void file_rename_cb(CALLBACK_ARGS) if(file_chooser(0, 1, "Rename", "*", CTX.filename)) { char *name = file_chooser_get_name(1); if(CTX.confirm_overwrite) { - struct stat buf; - if(!stat(name, &buf)) + if(!StatFile(name)) if(!fl_choice("File '%s' already exists.\n\nDo you want to replace it?", "Cancel", "Replace", NULL, name)) goto test; @@ -907,8 +901,8 @@ void options_save_cb(CALLBACK_ARGS) void options_restore_defaults_cb(CALLBACK_ARGS) { // not sure if we have to remove the file... - unlink(CTX.session_filename_fullpath); - unlink(CTX.options_filename_fullpath); + UnlinkFile(CTX.session_filename_fullpath); + UnlinkFile(CTX.options_filename_fullpath); ReInit_Options(0); Init_Options_GUI(0); if(WID && WID->get_context() == 3) // hack to refresh the buttons @@ -1326,8 +1320,7 @@ void message_save_cb(CALLBACK_ARGS) if(file_chooser(0, 1, "Save", "*")) { char *name = file_chooser_get_name(1); if(CTX.confirm_overwrite) { - struct stat buf; - if(!stat(name, &buf)) + if(!StatFile(name)) if(!fl_choice("File '%s' already exists.\n\nDo you want to replace it?", "Cancel", "Replace", NULL, name)) goto test; @@ -2862,8 +2855,7 @@ void mesh_save_cb(CALLBACK_ARGS) else GetDefaultMeshFileName(THEM, CTX.mesh.format, name); if(CTX.confirm_overwrite) { - struct stat buf; - if(!stat(name, &buf)) + if(!StatFile(name)) if(!fl_choice("File '%s' already exists.\n\nDo you want to replace it?", "Cancel", "Replace", NULL, name)) return; @@ -3254,18 +3246,8 @@ void solver_kill_cb(CALLBACK_ARGS) { int num = (int)(long)data; if(SINFO[num].pid > 0) { -#if !defined(WIN32) || defined(__CYGWIN__) - kill(SINFO[num].pid, 9); -#else - HANDLE hProc = OpenProcess(PROCESS_TERMINATE, FALSE, SINFO[num].pid); - if(!TerminateProcess(hProc, 0)){ - CloseHandle(hProc); - Msg(WARNING, "Could not kill process %s pid %d", - SINFO[num].name, SINFO[num].pid); - return; - } -#endif - Msg(INFO, "Killed %s pid %d", SINFO[num].name, SINFO[num].pid); + if(KillProcess(SINFO[num].pid)) + Msg(INFO, "Killed %s pid %d", SINFO[num].name, SINFO[num].pid); } SINFO[num].pid = -1; } @@ -3315,8 +3297,7 @@ static void _view_reload(int num) Post_View *v = *(Post_View **) List_Pointer(CTX.post.list, num); - struct stat buf; - if(stat(v->FileName, &buf)){ + if(StatFile(v->FileName)){ Msg(GERROR, "File '%s' does not exist", v->FileName); return; } @@ -3422,8 +3403,7 @@ static void _view_save_as(int view_num, char *title, int type) if(file_chooser(0, 1, title, "*", v->FileName)) { char *name = file_chooser_get_name(1); if(CTX.confirm_overwrite) { - struct stat buf; - if(!stat(name, &buf)) + if(!StatFile(name)) if(!fl_choice("File '%s' already exists.\n\nDo you want to replace it?", "Cancel", "Replace", NULL, name)) goto test; diff --git a/Fltk/Makefile b/Fltk/Makefile index f11b14012758873e90213c8464b4697dbffc8517..e3f5c971fd02bb062531c3fc5dce30b9a38c7e5e 100644 --- a/Fltk/Makefile +++ b/Fltk/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.80 2006-01-28 18:44:19 geuzaine Exp $ +# $Id: Makefile,v 1.81 2006-02-26 16:26:09 geuzaine Exp $ # # Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle # @@ -93,7 +93,7 @@ Message.o: Message.cpp ../Common/Gmsh.h ../Common/Message.h \ ../Geo/ExtrudeParams.h ../Common/VertexArray.h \ ../Common/SmoothNormals.h ../Numeric/Numeric.h ../Mesh/Metric.h \ ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h \ - Colorbar_Window.h ../Common/ColorTable.h GUI_Extras.h + Colorbar_Window.h ../Common/ColorTable.h GUI_Extras.h ../Common/OS.h # 1 "/Users/geuzaine/.gmsh/Fltk//" GUI.o: GUI.cpp ../Plugin/PluginManager.h ../Plugin/Plugin.h \ ../Common/Options.h ../Common/Message.h ../Common/Views.h \ @@ -142,12 +142,12 @@ Callbacks.o: Callbacks.cpp ../Mesh/BDS.h ../Common/Gmsh.h \ ../Geo/ExtrudeParams.h ../Geo/ExtractContour.h ../Graphics/Draw.h \ ../Common/Views.h ../Common/ColorTable.h ../Common/VertexArray.h \ ../Common/SmoothNormals.h ../Common/GmshMatrix.h \ - ../Common/AdaptiveViews.h ../Common/GmshMatrix.h ../Common/Timer.h \ + ../Common/AdaptiveViews.h ../Common/GmshMatrix.h \ ../Graphics/CreateFile.h ../Parser/OpenFile.h ../Common/CommandLine.h \ ../Common/Context.h ../Common/Options.h GUI.h Opengl_Window.h \ Colorbar_Window.h GUI_Extras.h Callbacks.h ../Plugin/Plugin.h \ ../Plugin/PluginManager.h ../Plugin/Plugin.h ../Common/Visibility.h \ - Solvers.h + Solvers.h ../Common/OS.h # 1 "/Users/geuzaine/.gmsh/Fltk//" Opengl.o: Opengl.cpp ../Common/Gmsh.h ../Common/Message.h \ ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \ diff --git a/Fltk/Message.cpp b/Fltk/Message.cpp index 30c5008f09d1255f633661ca724f6166f0cece3f..7ed2e969d4d7447cb5595c8797b2febd9257f090 100644 --- a/Fltk/Message.cpp +++ b/Fltk/Message.cpp @@ -1,4 +1,4 @@ -// $Id: Message.cpp,v 1.71 2006-02-26 00:40:29 geuzaine Exp $ +// $Id: Message.cpp,v 1.72 2006-02-26 16:26:09 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -20,10 +20,6 @@ // Please report all bugs and problems to <gmsh@geuz.org>. #include <signal.h> -#if !defined(WIN32) || defined(__CYGWIN__) -#include <unistd.h> // for unlink -#endif - #include "Gmsh.h" #include "GmshUI.h" #include "GmshVersion.h" @@ -31,6 +27,7 @@ #include "Options.h" #include "GUI.h" #include "GUI_Extras.h" +#include "OS.h" extern GUI *WID; extern Context_T CTX; @@ -204,15 +201,12 @@ void Msg(int level, char *fmt, ...) } } - // Clean exit void Exit(int level) { -#if !defined(WIN32) || defined(__CYGWIN__) // delete the temp file - unlink(CTX.tmp_filename_fullpath); -#endif + UnlinkFile(CTX.tmp_filename_fullpath); if(level){ // in case of an abnormal exit, force the abort directly diff --git a/Mesh/3D_Mesh_Netgen.cpp b/Mesh/3D_Mesh_Netgen.cpp index 3cd69ef09dd3441c7eb0ba0f1e272d6d71e628d0..7e282724f279dd704eb09b5824f40c3f68c8e05b 100644 --- a/Mesh/3D_Mesh_Netgen.cpp +++ b/Mesh/3D_Mesh_Netgen.cpp @@ -1,4 +1,4 @@ -// $Id: 3D_Mesh_Netgen.cpp,v 1.21 2006-02-26 00:40:29 geuzaine Exp $ +// $Id: 3D_Mesh_Netgen.cpp,v 1.22 2006-02-26 16:26:09 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -29,7 +29,7 @@ #include "Create.h" #include "Numeric.h" #include "Context.h" -#include "Timer.h" +#include "OS.h" extern Context_T CTX; extern Mesh *THEM; diff --git a/Mesh/DiscreteSurface.cpp b/Mesh/DiscreteSurface.cpp index 3783ad82df409e14daab793c8531e951f0ff2d5c..1fd66bd64b9e5a931cbdd5c77b55e1cb42827690 100644 --- a/Mesh/DiscreteSurface.cpp +++ b/Mesh/DiscreteSurface.cpp @@ -1,4 +1,4 @@ -// $Id: DiscreteSurface.cpp,v 1.36 2006-02-26 00:40:29 geuzaine Exp $ +// $Id: DiscreteSurface.cpp,v 1.37 2006-02-26 16:26:09 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -29,7 +29,7 @@ #include "Context.h" #include "BDS.h" #include "PartitionMesh.h" -#include "Timer.h" +#include "OS.h" extern Mesh *THEM; extern Context_T CTX; diff --git a/Mesh/Generator.cpp b/Mesh/Generator.cpp index de67222cea5b971cced68f05794d55edbcb1177a..fdd238bdd479e37797e4c299782817c42be33e49 100644 --- a/Mesh/Generator.cpp +++ b/Mesh/Generator.cpp @@ -1,4 +1,4 @@ -// $Id: Generator.cpp,v 1.80 2006-02-26 00:40:30 geuzaine Exp $ +// $Id: Generator.cpp,v 1.81 2006-02-26 16:26:09 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -28,7 +28,7 @@ #include "OpenFile.h" #include "Views.h" #include "PartitionMesh.h" -#include "Timer.h" +#include "OS.h" extern Mesh *THEM; extern Context_T CTX; diff --git a/Mesh/Makefile b/Mesh/Makefile index 5c92be08947f1cc3e77efea52062dc7367de9bd0..c01dda70a75d1a0edbbdd24fdd5464ae0782e817 100644 --- a/Mesh/Makefile +++ b/Mesh/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.105 2006-02-26 00:53:06 geuzaine Exp $ +# $Id: Makefile,v 1.106 2006-02-26 16:26:09 geuzaine Exp $ # # Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle # @@ -329,7 +329,7 @@ depend: ../Geo/Geo.h Mesh.h Vertex.h Element.h Simplex.h Face.h Edge.h \ ../Geo/ExtrudeParams.h ../Common/VertexArray.h \ ../Common/SmoothNormals.h ../Numeric/Numeric.h Metric.h Matrix.h \ - Create.h ../Common/Context.h ../Common/Timer.h + Create.h ../Common/Context.h ../Common/OS.h # 1 "/Users/geuzaine/.gmsh/Mesh//" 3D_Mesh_Tetgen.o: 3D_Mesh_Tetgen.cpp ../Common/Gmsh.h ../Common/Message.h \ ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \ @@ -372,7 +372,7 @@ Generator.o: Generator.cpp BDS.h ../Common/Gmsh.h ../Common/Message.h \ ../Common/ColorTable.h ../Common/VertexArray.h \ ../Common/SmoothNormals.h ../Common/GmshMatrix.h \ ../Common/AdaptiveViews.h ../Common/GmshMatrix.h PartitionMesh.h \ - ../Common/Timer.h + ../Common/OS.h # 1 "/Users/geuzaine/.gmsh/Mesh//" Print_Mesh.o: Print_Mesh.cpp ../Common/Gmsh.h ../Common/Message.h \ ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \ @@ -407,7 +407,7 @@ DiscreteSurface.o: DiscreteSurface.cpp ../Common/Gmsh.h \ ../Common/SmoothNormals.h Metric.h Matrix.h ../Geo/CAD.h ../Mesh/Mesh.h \ ../Mesh/Vertex.h ../Geo/ExtrudeParams.h ../Geo/Geo.h Create.h \ Interpolation.h ../Common/Context.h BDS.h PartitionMesh.h \ - ../Common/Timer.h + ../Common/OS.h # 1 "/Users/geuzaine/.gmsh/Mesh//" SwapEdge.o: SwapEdge.cpp ../Common/Gmsh.h ../Common/Message.h \ ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \ @@ -464,7 +464,7 @@ SecondOrder.o: SecondOrder.cpp ../Common/Gmsh.h ../Common/Message.h \ ../Geo/Geo.h Mesh.h Vertex.h Element.h Simplex.h Face.h Edge.h \ ../Geo/ExtrudeParams.h ../Common/VertexArray.h \ ../Common/SmoothNormals.h ../Numeric/Numeric.h Metric.h Matrix.h \ - Utils.h Interpolation.h ../Common/Timer.h + Utils.h Interpolation.h ../Common/OS.h # 1 "/Users/geuzaine/.gmsh/Mesh//" PartitionMesh.o: PartitionMesh.cpp ../Common/Gmsh.h ../Common/Message.h \ ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \ diff --git a/Mesh/SecondOrder.cpp b/Mesh/SecondOrder.cpp index 3e497c4e28f487e40287da3d0cdd4b89bb33f682..7a557dc7ea5c91368798dcb9bfdf63277ab7178c 100644 --- a/Mesh/SecondOrder.cpp +++ b/Mesh/SecondOrder.cpp @@ -1,4 +1,4 @@ -// $Id: SecondOrder.cpp,v 1.36 2006-02-26 00:40:30 geuzaine Exp $ +// $Id: SecondOrder.cpp,v 1.37 2006-02-26 16:26:09 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -25,7 +25,7 @@ #include "Utils.h" #include "Interpolation.h" #include "Numeric.h" -#include "Timer.h" +#include "OS.h" extern Mesh *THEM; diff --git a/Parallel/Makefile b/Parallel/Makefile index 140ddaa80becf2f80aed9f4616b714355c4a170b..959be5307f85bcba4e53f8215e8b04d83e499895 100644 --- a/Parallel/Makefile +++ b/Parallel/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.26 2006-02-25 07:05:37 geuzaine Exp $ +# $Id: Makefile,v 1.27 2006-02-26 16:26:09 geuzaine Exp $ # # Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle # @@ -54,4 +54,4 @@ depend: ParUtil.o: ParUtil.cpp ../Common/Gmsh.h ../Common/Message.h \ ../DataStr/Malloc.h ../DataStr/List.h ../DataStr/Tree.h \ ../DataStr/avl.h ../DataStr/Tools.h ../DataStr/List.h ../DataStr/Tree.h \ - ../Common/Timer.h ParUtil.h + ../Common/OS.h ParUtil.h diff --git a/Parallel/ParUtil.cpp b/Parallel/ParUtil.cpp index 4dcbce90bd9e3dca509b5c39ad978874ee47f8fc..bd01f1160220a3236c29c5ec19ee414fa603edaf 100644 --- a/Parallel/ParUtil.cpp +++ b/Parallel/ParUtil.cpp @@ -1,4 +1,4 @@ -// $Id: ParUtil.cpp,v 1.15 2006-02-25 07:05:37 geuzaine Exp $ +// $Id: ParUtil.cpp,v 1.16 2006-02-26 16:26:09 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -20,7 +20,7 @@ // Please report all bugs and problems to <gmsh@geuz.org>. #include "Gmsh.h" -#include "Timer.h" +#include "OS.h" #include "ParUtil.h" #if defined(HAVE_PARALLEL) diff --git a/Parser/Gmsh.tab.cpp b/Parser/Gmsh.tab.cpp index 0d97676716139179548b0b8530041dce923ce3f0..5fc8e32c37cd75adc0d5326a995e58966e37a335 100644 --- a/Parser/Gmsh.tab.cpp +++ b/Parser/Gmsh.tab.cpp @@ -125,7 +125,7 @@ #line 1 "Gmsh.y" -// $Id: Gmsh.tab.cpp,v 1.259 2006-02-25 07:02:20 geuzaine Exp $ +// $Id: Gmsh.tab.cpp,v 1.260 2006-02-26 16:26:09 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -168,7 +168,7 @@ #include "CommandLine.h" #include "FunctionManager.h" #include "ColorTable.h" -#include "Timer.h" +#include "OS.h" #include "CreateFile.h" #include "Visibility.h" #include "GmshVersion.h" diff --git a/Parser/Gmsh.y b/Parser/Gmsh.y index 3b0dcbf8abf7a0947c34a5442c609c4a13e370ef..c357164690004b50df77c5d856ddc26d0837ea02 100644 --- a/Parser/Gmsh.y +++ b/Parser/Gmsh.y @@ -1,5 +1,5 @@ %{ -// $Id: Gmsh.y,v 1.222 2006-02-25 07:02:21 geuzaine Exp $ +// $Id: Gmsh.y,v 1.223 2006-02-26 16:26:13 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -42,7 +42,7 @@ #include "CommandLine.h" #include "FunctionManager.h" #include "ColorTable.h" -#include "Timer.h" +#include "OS.h" #include "CreateFile.h" #include "Visibility.h" #include "GmshVersion.h" diff --git a/Parser/Gmsh.yy.cpp b/Parser/Gmsh.yy.cpp index 51efcd24e8c597d91c8090b9ed358d3b02f92f6c..703ea7114692cbae49c225ccc25a30a57d81fc1f 100644 --- a/Parser/Gmsh.yy.cpp +++ b/Parser/Gmsh.yy.cpp @@ -2,7 +2,7 @@ /* A lexical scanner generated by flex */ /* Scanner skeleton version: - * $Header: /cvsroot/gmsh/Parser/Gmsh.yy.cpp,v 1.258 2006-02-25 07:02:21 geuzaine Exp $ + * $Header: /cvsroot/gmsh/Parser/Gmsh.yy.cpp,v 1.259 2006-02-26 16:26:13 geuzaine Exp $ */ #define FLEX_SCANNER @@ -727,7 +727,7 @@ char *yytext; #line 1 "Gmsh.l" #define INITIAL 0 #line 2 "Gmsh.l" -// $Id: Gmsh.yy.cpp,v 1.258 2006-02-25 07:02:21 geuzaine Exp $ +// $Id: Gmsh.yy.cpp,v 1.259 2006-02-26 16:26:13 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // diff --git a/Parser/Makefile b/Parser/Makefile index 0afc388345bd89eed7936ca23eeab8855c3b7020..94bc9b89e31eb6cdf848d32aecda26e9ba988fa8 100644 --- a/Parser/Makefile +++ b/Parser/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.80 2006-01-28 21:13:36 geuzaine Exp $ +# $Id: Makefile,v 1.81 2006-02-26 16:26:14 geuzaine Exp $ # # Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle # @@ -93,7 +93,7 @@ Gmsh.tab.o: Gmsh.tab.cpp ../Plugin/PluginManager.h ../Plugin/Plugin.h \ ../Geo/ExtrudeParams.h ../Graphics/Draw.h ../Mesh/Create.h \ ../Mesh/Vertex.h ../Mesh/Mesh.h ../Common/Colors.h ../Common/Options.h \ Parser.h OpenFile.h ../Common/CommandLine.h FunctionManager.h \ - ../Common/Timer.h ../Graphics/CreateFile.h ../Common/Visibility.h \ + ../Common/OS.h ../Graphics/CreateFile.h ../Common/Visibility.h \ ../Common/GmshVersion.h # 1 "/Users/geuzaine/.gmsh/Parser//" Gmsh.yy.o: Gmsh.yy.cpp ../Common/Gmsh.h ../Common/Message.h \ @@ -123,7 +123,7 @@ OpenFile.o: OpenFile.cpp ../Mesh/BDS.h ../Common/Gmsh.h \ ../Mesh/Simplex.h ../Geo/ExtrudeParams.h ../Mesh/Metric.h \ ../Mesh/Vertex.h ../Mesh/Simplex.h ../Mesh/Mesh.h ../Mesh/Matrix.h \ ../Geo/MinMax.h ../Common/Visibility.h ../Graphics/ReadImg.h \ - ../Common/GmshUI.h ../Graphics/Draw.h ../Fltk/GUI.h \ + ../Common/OS.h ../Common/GmshUI.h ../Graphics/Draw.h ../Fltk/GUI.h \ ../Fltk/Opengl_Window.h ../Fltk/Colorbar_Window.h # 1 "/Users/geuzaine/.gmsh/Parser//" FunctionManager.o: FunctionManager.cpp FunctionManager.h diff --git a/Parser/OpenFile.cpp b/Parser/OpenFile.cpp index 794fc1f0b611b2974fbe5abe8da2f719d1af72b0..331d0905c1b4745eed5300e900de1ee4b217fe50 100644 --- a/Parser/OpenFile.cpp +++ b/Parser/OpenFile.cpp @@ -1,4 +1,4 @@ -// $Id: OpenFile.cpp,v 1.92 2006-02-25 07:32:42 geuzaine Exp $ +// $Id: OpenFile.cpp,v 1.93 2006-02-26 16:26:14 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -37,6 +37,7 @@ #include "MinMax.h" #include "Visibility.h" #include "ReadImg.h" +#include "OS.h" #if defined(HAVE_FLTK) #include "GmshUI.h" @@ -407,22 +408,3 @@ void OpenProblemMacFinder(const char *filename) } } -void SystemCall(char *command) -{ -#if defined(WIN32) - STARTUPINFO suInfo; - PROCESS_INFORMATION prInfo; - memset(&suInfo, 0, sizeof(suInfo)); - suInfo.cb = sizeof(suInfo); - Msg(INFO, "Calling '%s'", command); - CreateProcess(NULL, command, NULL, NULL, FALSE, - NORMAL_PRIORITY_CLASS, NULL, NULL, &suInfo, &prInfo); -#else - if(!system(NULL)) { - Msg(GERROR, "Could not find /bin/sh: aborting system call"); - return; - } - Msg(INFO, "Calling '%s'", command); - system(command); -#endif -} diff --git a/Parser/OpenFile.h b/Parser/OpenFile.h index c044c4bad72d8d7a514fcfee2251e45b6f30011e..6b288eda885ca6b74b405faeb6d94cee755fac2c 100644 --- a/Parser/OpenFile.h +++ b/Parser/OpenFile.h @@ -25,7 +25,6 @@ void ParseString(char *str); void OpenProblem(char *filename); void OpenProblemMacFinder(const char *filename); int MergeProblem(char *filename, int warn_if_missing=0); -void SystemCall(char *command); void FixRelativePath(char *in, char *out); void FixWindowsPath(char *in, char *out); void SetBoundingBox(double xmin, double xmax,