Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
f792307b
Commit
f792307b
authored
12 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
use color in terminal
parent
f753aeff
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Common/GmshMessage.cpp
+58
-6
58 additions, 6 deletions
Common/GmshMessage.cpp
README.txt
+37
-43
37 additions, 43 deletions
README.txt
doc/WELCOME.txt
+7
-8
7 additions, 8 deletions
doc/WELCOME.txt
with
102 additions
and
57 deletions
Common/GmshMessage.cpp
+
58
−
6
View file @
f792307b
...
@@ -155,6 +155,42 @@ void Msg::Exit(int level)
...
@@ -155,6 +155,42 @@ void Msg::Exit(int level)
exit
(
_errorCount
);
exit
(
_errorCount
);
}
}
static
int
streamIsFile
(
FILE
*
stream
)
{
// the given stream is definately not interactive if it is a regular file
struct
stat
stream_stat
;
if
(
fstat
(
fileno
(
stream
),
&
stream_stat
)
==
0
){
if
(
stream_stat
.
st_mode
&
S_IFREG
)
return
1
;
}
return
0
;
}
static
int
streamIsVT100
(
FILE
*
stream
)
{
// if running inside emacs the terminal is not VT100
const
char
*
emacs
=
getenv
(
"EMACS"
);
if
(
emacs
&&
*
emacs
==
't'
)
return
0
;
// list of known terminal names (from cmake)
static
const
char
*
names
[]
=
{
"Eterm"
,
"ansi"
,
"color-xterm"
,
"con132x25"
,
"con132x30"
,
"con132x43"
,
"con132x60"
,
"con80x25"
,
"con80x28"
,
"con80x30"
,
"con80x43"
,
"con80x50"
,
"con80x60"
,
"cons25"
,
"console"
,
"cygwin"
,
"dtterm"
,
"eterm-color"
,
"gnome"
,
"gnome-256color"
,
"konsole"
,
"konsole-256color"
,
"kterm"
,
"linux"
,
"msys"
,
"linux-c"
,
"mach-color"
,
"mlterm"
,
"putty"
,
"rxvt"
,
"rxvt-256color"
,
"rxvt-cygwin"
,
"rxvt-cygwin-native"
,
"rxvt-unicode"
,
"rxvt-unicode-256color"
,
"screen"
,
"screen-256color"
,
"screen-256color-bce"
,
"screen-bce"
,
"screen-w"
,
"screen.linux"
,
"vt100"
,
"xterm"
,
"xterm-16color"
,
"xterm-256color"
,
"xterm-88color"
,
"xterm-color"
,
"xterm-debian"
,
0
};
const
char
**
t
=
0
;
const
char
*
term
=
getenv
(
"TERM"
);
if
(
term
){
for
(
t
=
names
;
*
t
&&
strcmp
(
term
,
*
t
)
!=
0
;
++
t
)
{}
}
if
(
!
(
t
&&
*
t
))
return
0
;
return
1
;
}
void
Msg
::
Fatal
(
const
char
*
fmt
,
...)
void
Msg
::
Fatal
(
const
char
*
fmt
,
...)
{
{
_errorCount
++
;
_errorCount
++
;
...
@@ -183,10 +219,14 @@ void Msg::Fatal(const char *fmt, ...)
...
@@ -183,10 +219,14 @@ void Msg::Fatal(const char *fmt, ...)
#endif
#endif
if
(
CTX
::
instance
()
->
terminal
){
if
(
CTX
::
instance
()
->
terminal
){
const
char
*
c0
=
""
,
*
c1
=
""
;
if
(
!
streamIsFile
(
stderr
)
&&
streamIsVT100
(
stderr
)){
c0
=
"
\33
[31m"
;
c1
=
"
\33
[0m"
;
// red
}
if
(
_commSize
>
1
)
if
(
_commSize
>
1
)
fprintf
(
stderr
,
"Fatal : [On processor %d] %s
\n
"
,
_commRank
,
str
);
fprintf
(
stderr
,
"
%s
Fatal : [On processor %d]
%s
%s
\n
"
,
c0
,
_commRank
,
str
,
c1
);
else
else
fprintf
(
stderr
,
"Fatal : %s
\n
"
,
str
);
fprintf
(
stderr
,
"
%s
Fatal :
%s
%s
\n
"
,
c0
,
str
,
c1
);
fflush
(
stderr
);
fflush
(
stderr
);
}
}
...
@@ -219,10 +259,14 @@ void Msg::Error(const char *fmt, ...)
...
@@ -219,10 +259,14 @@ void Msg::Error(const char *fmt, ...)
#endif
#endif
if
(
CTX
::
instance
()
->
terminal
){
if
(
CTX
::
instance
()
->
terminal
){
const
char
*
c0
=
""
,
*
c1
=
""
;
if
(
!
streamIsFile
(
stderr
)
&&
streamIsVT100
(
stderr
)){
c0
=
"
\33
[31m"
;
c1
=
"
\33
[0m"
;
// red
}
if
(
_commSize
>
1
)
if
(
_commSize
>
1
)
fprintf
(
stderr
,
"Error : [On processor %d] %s
\n
"
,
_commRank
,
str
);
fprintf
(
stderr
,
"
%s
Error : [On processor %d]
%s
%s
\n
"
,
c0
,
_commRank
,
str
,
c1
);
else
else
fprintf
(
stderr
,
"Error : %s
\n
"
,
str
);
fprintf
(
stderr
,
"
%s
Error :
%s
%s
\n
"
,
c0
,
str
,
c1
);
fflush
(
stderr
);
fflush
(
stderr
);
}
}
}
}
...
@@ -251,7 +295,11 @@ void Msg::Warning(const char *fmt, ...)
...
@@ -251,7 +295,11 @@ void Msg::Warning(const char *fmt, ...)
#endif
#endif
if
(
CTX
::
instance
()
->
terminal
){
if
(
CTX
::
instance
()
->
terminal
){
fprintf
(
stderr
,
"Warning : %s
\n
"
,
str
);
const
char
*
c0
=
""
,
*
c1
=
""
;
if
(
!
streamIsFile
(
stderr
)
&&
streamIsVT100
(
stderr
)){
c0
=
"
\33
[35m"
;
c1
=
"
\33
[0m"
;
// magenta
}
fprintf
(
stderr
,
"%sWarning : %s%s
\n
"
,
c0
,
str
,
c1
);
fflush
(
stderr
);
fflush
(
stderr
);
}
}
}
}
...
@@ -326,7 +374,11 @@ void Msg::Direct(int level, const char *fmt, ...)
...
@@ -326,7 +374,11 @@ void Msg::Direct(int level, const char *fmt, ...)
#endif
#endif
if
(
CTX
::
instance
()
->
terminal
){
if
(
CTX
::
instance
()
->
terminal
){
fprintf
(
stdout
,
"%s
\n
"
,
str
);
const
char
*
c0
=
""
,
*
c1
=
""
;
if
(
!
streamIsFile
(
stderr
)
&&
streamIsVT100
(
stderr
)){
c0
=
"
\33
[34m"
;
c1
=
"
\33
[0m"
;
// blue
}
fprintf
(
stdout
,
"%s%s%s
\n
"
,
c0
,
str
,
c1
);
fflush
(
stdout
);
fflush
(
stdout
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
README.txt
+
37
−
43
View file @
f792307b
This is Gmsh, an automatic three-dimensional finite element mesh
This is Gmsh, an automatic three-dimensional finite element mesh
generator with
generator with
built-in pre- and post-processing facilities.
built-in pre- and post-processing facilities.
Gmsh is distributed under the terms of the GNU General Public License,
Gmsh is distributed under the terms of the GNU General Public License, Version 2
Version 2 or later, with an exception to allow for easier linking with
or later, with an exception to allow for easier linking with external
external libraries. See doc/LICENSE.txt and doc/CREDITS.txt for more
libraries. See doc/LICENSE.txt and doc/CREDITS.txt for more information.
information.
See the doc/ and tutorial/ directories for documentation. The
See the doc/ and tutorial/ directories for documentation. The
reference manual
reference manual
is located in doc/texinfo/. See the demos/ directory
is located in doc/texinfo/. See the demos/ directory
and the web site
and the web site
http://geuz.org/gmsh for additional examples.
http://geuz.org/gmsh for additional examples.
Building Gmsh from its source code requires a C++ compiler and CMake
Building Gmsh from its source code requires a C++ compiler and CMake
(http://cmake.org). Building the graphical user interface requires
(http://cmake.org). Building the graphical user interface requires FLTK 1.1.7
FLTK 1.1.7 or above (http://fltk.org), configured with OpenGL
or above (http://fltk.org), configured with OpenGL support. Building the 64 bit
support. Building the 64 bit graphical version on MacOS X requires
graphical version on MacOS X requires FLTK 1.3.
FLTK 1.3.
Build Gmsh using CMake's graphical user interface
Build Gmsh using CMake's graphical user interface
-------------------------------------------------
-------------------------------------------------
* Launch CMake and fill-in the two top input fields (telling where the
* Launch CMake and fill-in the two top input fields (telling where the Gmsh
Gmsh source directory is located and where you want the Gmsh binary
source directory is located and where you want the Gmsh binary to be created).
to be created).
* Click on "Add entry" and define the variable CMAKE_PREFIX_PATH, of
* Click on "Add entry" and define the variable CMAKE_PREFIX_PATH, of
type
type
"PATH", pointing to the location(s) of any external package(s)
"PATH", pointing to the location(s) of any external package(s)
(FLTK,
(FLTK,
BLAS/LAPACK, etc.) installed in non-standard directories.
BLAS/LAPACK, etc.) installed in non-standard directories.
(If you are using our pre-compiled "gmsh dependencies" package
(If you are using our pre-compiled "gmsh dependencies" package
(http://geuz.org/gmsh/bin/Windows/gmsh-dep-msvc2008-release.zip)
(http://geuz.org/gmsh/bin/Windows/gmsh-dep-msvc2008-release.zip) with Visual
with Visual Studio on Windows simply point CMAKE_PREFIX_PATH to the
Studio on Windows simply point CMAKE_PREFIX_PATH to the "gmsh-dep" directory.)
"gmsh-dep" directory.)
* Click on "Configure" and choose your compiler (e.g. Visual Studio).
* Click on "Configure" and choose your compiler (e.g. Visual Studio).
* Optionally change some configuration options (re-run "Configure"
* Optionally change some configuration options (re-run "Configure"
every time
every time
you change some options).
you change some options).
* Once you are happy with all the configuration options, click on
* Once you are happy with all the configuration options, click on "Generate".
"Generate".
* Go to the build directory and build Gmsh using your chosen compiler.
* Go to the build directory and build Gmsh using your chosen compiler.
(With Visual Studio double-click on "gmsh.sln". If you are using our
(With Visual Studio double-click on "gmsh.sln". If you are using our
pre-compiled "gmsh dependencies" package you must use the "Release"
pre-compiled "gmsh dependencies" package you must use the "Release"
or
or
"RelWithDebInfo" build type.)
"RelWithDebInfo" build type.)
Build Gmsh from the command line
Build Gmsh from the command line
--------------------------------
--------------------------------
* Create a build directory, for example as a subdirectory of Gmsh's
* Create a build directory, for example as a subdirectory of Gmsh's
source
source
directory:
directory:
mkdir build
mkdir build
* Run cmake from within the build directory, pointing to Gmsh's
* Run cmake from within the build directory, pointing to Gmsh's
source
source
directory:
directory:
cd build
cd build
cmake ..
cmake ..
...
@@ -67,18 +62,17 @@ Build Gmsh from the command line
...
@@ -67,18 +62,17 @@ Build Gmsh from the command line
make
make
make install
make install
* To change build options you can use "ccmake" instead of "cmake",
* To change build options you can use "ccmake" instead of "cmake", e.g.:
e.g.:
ccmake ..
ccmake ..
or you can specify options directly on the command line. For
or you can specify options directly on the command line. For
example, you can
example, you can
use
use
cmake -DCMAKE_PREFIX_PATH=/opt/local ..
cmake -DCMAKE_PREFIX_PATH=/opt/local ..
to specify the location of external packages installed in
to specify the location of external packages installed in
non-standard
non-standard
directories. You can use
directories. You can use
cmake -DCMAKE_INSTALL_PREFIX=/opt
cmake -DCMAKE_INSTALL_PREFIX=/opt
...
@@ -88,17 +82,17 @@ Build Gmsh from the command line
...
@@ -88,17 +82,17 @@ Build Gmsh from the command line
to build a version of Gmsh without the FLTK graphical interface.
to build a version of Gmsh without the FLTK graphical interface.
* You can keep multiple builds with different build options at the
* You can keep multiple builds with different build options at the
same
same
time. For example, you could configure a debug graphical build
time. For example, you could configure a debug graphical build
in a "bin"
in a "bin"
subdirectory with
subdirectory with
cd bin
cd bin
cmake -DCMAKE_BUILD_TYPE=Debug ..
cmake -DCMAKE_BUILD_TYPE=Debug ..
make
make
make install
make install
and static and dynamic non-graphical release libraries in a "lib"
and static and dynamic non-graphical release libraries in a "lib"
subdirectory
subdirectory
with
with
cd lib
cd lib
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_FLTK=0 -DENABLE_OCC=0 ..
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_FLTK=0 -DENABLE_OCC=0 ..
...
...
This diff is collapsed.
Click to expand it.
doc/WELCOME.txt
+
7
−
8
View file @
f792307b
This is Gmsh, an automatic three-dimensional finite element mesh
This is Gmsh, an automatic three-dimensional finite element mesh
generator with
generator with
built-in pre- and post-processing facilities.
built-in pre- and post-processing facilities.
Gmsh is distributed under the terms of the GNU General Public
Gmsh is distributed under the terms of the GNU General Public License. See the
License. See the LICENSE.txt and CREDITS.txt files for more
LICENSE.txt and CREDITS.txt files for more information.
information.
The tutorial/ directory contains the examples from the tutorial
The tutorial/ directory contains the examples from the tutorial
chapter in the
chapter in the
reference manual (http://geuz.org/gmsh/doc/texinfo/).
reference manual (http://geuz.org/gmsh/doc/texinfo/).
The demos/ directory
The demos/ directory
contains additional examples.
contains additional examples.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment