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
GitLab 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
Show 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)
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
,
...)
{
_errorCount
++
;
...
...
@@ -183,10 +219,14 @@ void Msg::Fatal(const char *fmt, ...)
#endif
if
(
CTX
::
instance
()
->
terminal
){
const
char
*
c0
=
""
,
*
c1
=
""
;
if
(
!
streamIsFile
(
stderr
)
&&
streamIsVT100
(
stderr
)){
c0
=
"
\33
[31m"
;
c1
=
"
\33
[0m"
;
// red
}
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
fprintf
(
stderr
,
"Fatal : %s
\n
"
,
str
);
fprintf
(
stderr
,
"
%s
Fatal :
%s
%s
\n
"
,
c0
,
str
,
c1
);
fflush
(
stderr
);
}
...
...
@@ -219,10 +259,14 @@ void Msg::Error(const char *fmt, ...)
#endif
if
(
CTX
::
instance
()
->
terminal
){
const
char
*
c0
=
""
,
*
c1
=
""
;
if
(
!
streamIsFile
(
stderr
)
&&
streamIsVT100
(
stderr
)){
c0
=
"
\33
[31m"
;
c1
=
"
\33
[0m"
;
// red
}
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
fprintf
(
stderr
,
"Error : %s
\n
"
,
str
);
fprintf
(
stderr
,
"
%s
Error :
%s
%s
\n
"
,
c0
,
str
,
c1
);
fflush
(
stderr
);
}
}
...
...
@@ -251,7 +295,11 @@ void Msg::Warning(const char *fmt, ...)
#endif
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
);
}
}
...
...
@@ -326,7 +374,11 @@ void Msg::Direct(int level, const char *fmt, ...)
#endif
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
);
}
}
...
...
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
generator with
built-in pre- and post-processing facilities.
This is Gmsh, an automatic three-dimensional finite element mesh
generator with
built-in pre- and post-processing facilities.
Gmsh is distributed under the terms of the GNU General Public License,
Version 2 or later, with an exception to allow for easier linking with
external libraries. See doc/LICENSE.txt and doc/CREDITS.txt for more
information.
Gmsh is distributed under the terms of the GNU General Public License, Version 2
or later, with an exception to allow for easier linking with external
libraries. See doc/LICENSE.txt and doc/CREDITS.txt for more information.
See the doc/ and tutorial/ directories for documentation. The
reference manual
is located in doc/texinfo/. See the demos/ directory
and the web site
http://geuz.org/gmsh for additional examples.
See the doc/ and tutorial/ directories for documentation. The
reference manual
is located in doc/texinfo/. See the demos/ directory
and the web site
http://geuz.org/gmsh for additional examples.
Building Gmsh from its source code requires a C++ compiler and CMake
(http://cmake.org). Building the graphical user interface requires
FLTK 1.1.7 or above (http://fltk.org), configured with OpenGL
support. Building the 64 bit graphical version on MacOS X requires
FLTK 1.3.
(http://cmake.org). Building the graphical user interface requires FLTK 1.1.7
or above (http://fltk.org), configured with OpenGL support. Building the 64 bit
graphical version on MacOS X requires FLTK 1.3.
Build Gmsh using CMake's graphical user interface
-------------------------------------------------
* Launch CMake and fill-in the two top input fields (telling where the
Gmsh source directory is located and where you want the Gmsh binary
to be created).
* Launch CMake and fill-in the two top input fields (telling where the Gmsh
source directory is located and where you want the Gmsh binary to be created).
* Click on "Add entry" and define the variable CMAKE_PREFIX_PATH, of
type
"PATH", pointing to the location(s) of any external package(s)
(FLTK,
BLAS/LAPACK, etc.) installed in non-standard directories.
* Click on "Add entry" and define the variable CMAKE_PREFIX_PATH, of
type
"PATH", pointing to the location(s) of any external package(s)
(FLTK,
BLAS/LAPACK, etc.) installed in non-standard directories.
(If you are using our pre-compiled "gmsh dependencies" package
(http://geuz.org/gmsh/bin/Windows/gmsh-dep-msvc2008-release.zip)
with Visual Studio on Windows simply point CMAKE_PREFIX_PATH to the
"gmsh-dep" directory.)
(http://geuz.org/gmsh/bin/Windows/gmsh-dep-msvc2008-release.zip) with Visual
Studio on Windows simply point CMAKE_PREFIX_PATH to the "gmsh-dep" directory.)
* Click on "Configure" and choose your compiler (e.g. Visual Studio).
* Optionally change some configuration options (re-run "Configure"
every time
you change some options).
* Optionally change some configuration options (re-run "Configure"
every time
you change some options).
* Once you are happy with all the configuration options, click on
"Generate".
* Once you are happy with all the configuration options, click on "Generate".
* 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
pre-compiled "gmsh dependencies" package you must use the "Release"
or
"RelWithDebInfo" build type.)
pre-compiled "gmsh dependencies" package you must use the "Release"
or
"RelWithDebInfo" build type.)
Build Gmsh from the command line
--------------------------------
* Create a build directory, for example as a subdirectory of Gmsh's
source
directory:
* Create a build directory, for example as a subdirectory of Gmsh's
source
directory:
mkdir build
* Run cmake from within the build directory, pointing to Gmsh's
source
directory:
* Run cmake from within the build directory, pointing to Gmsh's
source
directory:
cd build
cmake ..
...
...
@@ -67,18 +62,17 @@ Build Gmsh from the command line
make
make install
* To change build options you can use "ccmake" instead of "cmake",
e.g.:
* To change build options you can use "ccmake" instead of "cmake", e.g.:
ccmake ..
or you can specify options directly on the command line. For
example, you can
use
or you can specify options directly on the command line. For
example, you can
use
cmake -DCMAKE_PREFIX_PATH=/opt/local ..
to specify the location of external packages installed in
non-standard
directories. You can use
to specify the location of external packages installed in
non-standard
directories. You can use
cmake -DCMAKE_INSTALL_PREFIX=/opt
...
...
@@ -88,17 +82,17 @@ Build Gmsh from the command line
to build a version of Gmsh without the FLTK graphical interface.
* You can keep multiple builds with different build options at the
same
time. For example, you could configure a debug graphical build
in a "bin"
subdirectory with
* You can keep multiple builds with different build options at the
same
time. For example, you could configure a debug graphical build
in a "bin"
subdirectory with
cd bin
cmake -DCMAKE_BUILD_TYPE=Debug ..
make
make install
and static and dynamic non-graphical release libraries in a "lib"
subdirectory
with
and static and dynamic non-graphical release libraries in a "lib"
subdirectory
with
cd lib
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
generator with
built-in pre- and post-processing facilities.
This is Gmsh, an automatic three-dimensional finite element mesh
generator with
built-in pre- and post-processing facilities.
Gmsh is distributed under the terms of the GNU General Public
License. See the LICENSE.txt and CREDITS.txt files for more
information.
Gmsh is distributed under the terms of the GNU General Public License. See the
LICENSE.txt and CREDITS.txt files for more information.
The tutorial/ directory contains the examples from the tutorial
chapter in the
reference manual (http://geuz.org/gmsh/doc/texinfo/).
The demos/ directory
contains additional examples.
The tutorial/ directory contains the examples from the tutorial
chapter in the
reference manual (http://geuz.org/gmsh/doc/texinfo/).
The demos/ directory
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