Skip to content

Commit bbb4a35

Browse files
committed
Add Unix command-line option to print short version number.
Specifying `--generation` as a command-line parameter will cause POV-Ray for Unix to print its "generation" and beta status (if applicable) to standard output, then exit. For example, for v3.8.1 this would be `3.8`; for a beta version of that release, it would be `3.8-beta`.
1 parent 8bc4881 commit bbb4a35

File tree

8 files changed

+70
-38
lines changed

8 files changed

+70
-38
lines changed

changes.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ Other Noteworthy
5353
----------------
5454

5555
- The source code now requires a C++11-compliant compiler.
56+
- Added `--generation` command-line switch to POV-Ray for Unix, which will
57+
cause POV-Ray to print its abbreviated version number to standard output.
5658

5759

5860
Changes between 3.7.1-beta.9 and 3.7.1-rc.1

unix/scripts/allanim.sh

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#!/bin/sh
22
# ==============================================================================
3-
# POV-Ray 3.7
3+
# POV-Ray v3.8
44
# allanim.sh - render all POV-Ray sample animations
55
# ==============================================================================
66
# written November 2003 - January 2004 by Christoph Hormann
7+
# updated 2017-09-10 for POV-Ray v3.8 by Christoph Lipka
78
# This file is part of POV-Ray and subject to the POV-Ray licence
89
# see POVLEGAL.DOC for details.
910
# ------------------------------------------------------------------------------
@@ -18,15 +19,17 @@
1819
# log: log all text output of POV-Ray to a file (log.txt)
1920
# scene_directory: if specified the sample scene in this directory are rendered,
2021
# otherwise the scene directory is determined form the main
21-
# povray ini file (usually /usr/local/share/povray-3.7/scenes).
22+
# povray ini file (usually /usr/local/share/povray-X.Y/scenes,
23+
# where X.Y represents the first two fields of the version
24+
# number, e.g. for v3.8.1 this would be 3.8).
2225
# html_file: if specified a HTML file with links to the rendered
2326
# animations is written.
2427
# ==============================================================================
2528

2629
# test mode
2730
#SCENE_DIR=.
2831

29-
VERSION=3.7
32+
VERSION=`povray --generation`
3033
VER_DIR=povray-$VERSION
3134
DEFAULT_DIR=/usr/local
3235
SYSCONFDIR=$DEFAULT_DIR/etc
@@ -53,7 +56,7 @@ case "$OPTIONS" in
5356
*log* | *LOG* | *Log* )
5457
DATE=`date`
5558
LOG_FILE="log.txt"
56-
echo "log file for POV-Ray $VERSION sample scene render $DATE" > "$LOG_FILE"
59+
echo "log file for POV-Ray v$VERSION sample scene render $DATE" > "$LOG_FILE"
5760
;;
5861
esac
5962

@@ -70,7 +73,7 @@ if [ -z "$SCENE_DIR" ] ; then
7073
echo "------------------------------------------------------"
7174
echo " the sample scene render script could not determine"
7275
echo " the location where POV-Ray is installed. Make sure"
73-
echo " POV-Ray $VERSION has been correctly installed on this"
76+
echo " POV-Ray v$VERSION has been correctly installed on this"
7477
echo " computer. If you continue the script will try to"
7578
echo " the scenes from the current directory."
7679
echo ""
@@ -141,7 +144,7 @@ echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
141144
<html>
142145
143146
<head>
144-
<title>POV-Ray $VERSION sample scenes - animations</title>
147+
<title>POV-Ray v$VERSION sample scenes - animations</title>
145148
<style type=\"text/css\">
146149
<!--
147150
body
@@ -165,9 +168,9 @@ th { background-color: #ffcc99 ; }
165168
166169
<body>
167170
168-
<h2>POV-Ray $VERSION sample scenes - animations</h2>
171+
<h2>POV-Ray v$VERSION sample scenes - animations</h2>
169172
170-
<p><em>written `date` by POV-Ray $VERSION sample animations render script (allanim.sh)</em></p>
173+
<p><em>written `date` by POV-Ray v$VERSION sample animations render script (allanim.sh)</em></p>
171174
172175
<hr>
173176

unix/scripts/allscene.sh

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#!/bin/sh
22
# ==============================================================================
3-
# POV-Ray 3.7
3+
# POV-Ray v3.8
44
# allscene.sh - render all POV-Ray sample scenes
55
# ==============================================================================
66
# written November 2003 - January 2004 by Christoph Hormann
7+
# updated 2017-09-10 for POV-Ray v3.8 by Christoph Lipka
78
# This file is part of POV-Ray and subject to the POV-Ray licence
89
# see POVLEGAL.DOC for details.
910
# ------------------------------------------------------------------------------
@@ -20,7 +21,9 @@
2021
# options for running
2122
# scene_directory: if specified the sample scene in this directory are rendered,
2223
# otherwise the scene directory is determined form the main
23-
# povray ini file (usually /usr/local/share/povray-3.7/scenes).
24+
# povray ini file (usually /usr/local/share/povray-X.Y/scenes,
25+
# where X.Y represents the first two fields of the version
26+
# number, e.g. for v3.8.1 this would be 3.8).
2427
# html_file: if specified a HTML file with links to the rendered
2528
# images is written. If Imagemagick 'convert' is installed
2629
# thumbnails for the images are generated as well.
@@ -30,7 +33,7 @@
3033
# test mode
3134
#SCENE_DIR=.
3235

33-
VERSION=3.7
36+
VERSION=`povray --generation`
3437
VER_DIR=povray-$VERSION
3538
DEFAULT_DIR=/usr/local
3639
SYSCONFDIR=$DEFAULT_DIR/etc
@@ -57,7 +60,7 @@ case "$OPTIONS" in
5760
*log* | *LOG* | *Log* )
5861
DATE=`date`
5962
LOG_FILE="log.txt"
60-
echo "log file for POV-Ray $VERSION sample scene render $DATE" > "$LOG_FILE"
63+
echo "log file for POV-Ray v$VERSION sample scene render $DATE" > "$LOG_FILE"
6164
;;
6265
*all* | *ALL* | *All* )
6366
RENDER_ALL=--all
@@ -76,7 +79,7 @@ if [ -z "$SCENE_DIR" ] ; then
7679
echo "------------------------------------------------------"
7780
echo " the sample scene render script could not determine"
7881
echo " the location where POV-Ray is installed. Make sure"
79-
echo " POV-Ray $VERSION has been correctly installed on this"
82+
echo " POV-Ray v$VERSION has been correctly installed on this"
8083
echo " computer. If you continue the script will try to"
8184
echo " the scenes from the current directory."
8285
echo ""
@@ -150,7 +153,7 @@ echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
150153
<html>
151154
152155
<head>
153-
<title>POV-Ray $VERSION sample scenes - stills</title>
156+
<title>POV-Ray v$VERSION sample scenes - stills</title>
154157
<style type=\"text/css\">
155158
<!--
156159
body
@@ -174,9 +177,9 @@ th { background-color: #ffcc99 ; }
174177
175178
<body>
176179
177-
<h2>POV-Ray $VERSION sample scenes - stills</h2>
180+
<h2>POV-Ray v$VERSION sample scenes - stills</h2>
178181
179-
<p><em>written `date` by POV-Ray $VERSION sample scenes render script (allscene.sh)</em></p>
182+
<p><em>written `date` by POV-Ray v$VERSION sample scenes render script (allscene.sh)</em></p>
180183
181184
<hr>
182185

unix/scripts/portfolio.sh

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#!/bin/sh
22
# ==============================================================================
3-
# POV-Ray 3.7
3+
# POV-Ray v3.8
44
# portfolio.sh - render the POV-Ray portfolio
55
# ==============================================================================
66
# written November 2003 by Christoph Hormann
7+
# updated 2017-09-10 for POV-Ray v3.8 by Christoph Lipka
78
# This file is part of POV-Ray and subject to the POV-Ray licence
89
# see POVLEGAL.DOC for details
910
# ------------------------------------------------------------------------------
@@ -18,14 +19,16 @@
1819
# log: log all text output of POV-Ray to a file (log.txt)
1920
# scene_directory: if specified the portfolio scene in this directory are
2021
# rendered, otherwise the scene directory is determined form
21-
# the main povray ini file.
22-
# (usually /usr/local/share/povray-3.7/scenes/portfolio).
22+
# the main povray ini file
23+
# (usually /usr/local/share/povray-X.Y/scenes/portfolio,
24+
# where X.Y represents the first two fields of the version
25+
# number, e.g. for v3.8.1 this would be 3.8).
2326
# ==============================================================================
2427

2528
# test mode
2629
#SCENE_DIR=.
2730

28-
VERSION=3.7
31+
VERSION=`povray --generation`
2932
VER_DIR=povray-$VERSION
3033
DEFAULT_DIR=/usr/local
3134
SYSCONFDIR=$DEFAULT_DIR/etc
@@ -52,7 +55,7 @@ case "$OPTIONS" in
5255
*log* | *LOG* | *Log* )
5356
DATE=`date`
5457
LOG_FILE="log.txt"
55-
echo "log file for POV-Ray $VERSION sample scene render $DATE" > "$LOG_FILE"
58+
echo "log file for POV-Ray v$VERSION sample scene render $DATE" > "$LOG_FILE"
5659
;;
5760
esac
5861

@@ -67,7 +70,7 @@ if [ -z "$SCENE_DIR" ] ; then
6770
echo "------------------------------------------------------"
6871
echo " the sample scene render script could not determine"
6972
echo " the location where POV-Ray is installed. Make sure"
70-
echo " POV-Ray $VERSION has been correctly installed on this"
73+
echo " POV-Ray v$VERSION has been correctly installed on this"
7174
echo " computer. If you continue the script will try to"
7275
echo " the scenes from the current directory."
7376
echo ""

unix/scripts/render_anim.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22
# ==============================================================================
3-
# POV-Ray 3.7
3+
# POV-Ray v3.8
44
# render_anim.sh - render a scene scene as animation
55
# ==============================================================================
66
# written November 2003 by Christoph Hormann

unix/scripts/render_scene.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22
# ==============================================================================
3-
# POV-Ray 3.7
3+
# POV-Ray v3.8
44
# render_scene.sh - render a scene with options given in a scene file comment
55
# ==============================================================================
66
# written November 2003 by Christoph Hormann

vfe/unix/unixconsole.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ static vfeDisplay *UnixDisplayCreator (unsigned int width, unsigned int height,
173173

174174
static void PrintStatus (vfeSession *session)
175175
{
176+
// TODO -- when invoked while processing "--help" command-line switch,
177+
// GNU/Linux customs would be to print to stdout (among other differences).
178+
176179
string str;
177180
vfeSession::MessageType type;
178181
static vfeSession::MessageType lastType = vfeSession::mUnclassified;
@@ -233,6 +236,8 @@ static void PrintStatusChanged (vfeSession *session, State force = kUnknown)
233236

234237
static void PrintVersion(void)
235238
{
239+
// TODO -- GNU/Linux customs would be to print to stdout (among other differences).
240+
236241
fprintf(stderr,
237242
"%s %s\n\n"
238243
"%s\n%s\n%s\n"
@@ -260,6 +265,11 @@ static void PrintVersion(void)
260265
);
261266
}
262267

268+
static void PrintGeneration(void)
269+
{
270+
fprintf(stdout, "%s\n", POV_RAY_GENERATION POV_RAY_BETA_SUFFIX);
271+
}
272+
263273
static void ErrorExit(vfeSession *session)
264274
{
265275
fprintf(stderr, "%s\n", session->GetErrorString());
@@ -475,6 +485,14 @@ int main (int argc, char **argv)
475485
delete session;
476486
return RETURN_OK;
477487
}
488+
else if (session->GetUnixOptions()->isOptionSet("general", "generation"))
489+
{
490+
session->Shutdown();
491+
PrintGeneration();
492+
delete sigthread;
493+
delete session;
494+
return RETURN_OK;
495+
}
478496
else if (session->GetUnixOptions()->isOptionSet("general", "benchmark"))
479497
{
480498
retval = PrepareBenchmark(session, opts, bench_ini_name, bench_pov_name, argc, argv);

0 commit comments

Comments
 (0)