Skip to content

Commit

Permalink
Fixed some return value and GLint conversion 'warnings' (ifort).
Browse files Browse the repository at this point in the history
  • Loading branch information
t.youngs committed Feb 22, 2008
1 parent 8f2d4bd commit d4fc141
Show file tree
Hide file tree
Showing 18 changed files with 75 additions and 44 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
Version 0.94
------------

2008-02-21
* removed GTK gui and interface configure options

2008-02-06
* added new gui commands and fixed trajectory loading

Expand Down
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SUBDIRS = src

EXTRA_DIST = scripts/*.txt doc/manual.pdf src/gui-qt/icons/*.svg src/gui-gtk/icons/*/*.xpm data/spgrp.dat data/filters/*
EXTRA_DIST = scripts/*.txt doc/manual.pdf src/gui/icons/*.svg data/spgrp.dat data/filters/*

#filterdir = $(datadir)/aten/filters
#filter_DATA = data/filters/*
Expand Down
41 changes: 31 additions & 10 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,27 @@ else
AC_CHECK_HEADERS([GLUT/glut.h], ,[AC_MSG_ERROR([Could not find GLUT header. Is GLUT installed?])])
fi

#
# Additional Configuration Options
#

# MEMDEBUG
AC_ARG_WITH([memdebug],[AC_HELP_STRING([--with-memdebug],
[Enable manual constructor / destructor counts.])], ,
[memdebug=])
if test "x$with_memdebug" != "x"; then
AC_DEFINE([MEMDEBUG], [], [Enable manual constructor / destructor counts.])
fi

# SPEEDTEST
AC_ARG_WITH([speedtest],[AC_HELP_STRING([--with-speedtest],
[Enable rendering speedtest (warning - makes compiled code otherwise unusable).])], ,
[speedtest=])
if test "x$with_speedtest" != "x"; then
AC_DEFINE([SPEEDTEST], [], [Enable rendering speedtest (warning - makes compiled code otherwise unusable).])
fi

# Checks for GL, GLU, and GLUT headers
# Provide --with options to specify the include locations
# GL-INCLUDEDIR
GL_CFLAGS=""
AC_ARG_WITH([gl-includedir],[AC_HELP_STRING([--with-gl-includedir=DIR],
[Set location of OpenGL and GLUT headers to DIR [default=auto]])], ,
Expand All @@ -48,8 +66,7 @@ if test "x$with_gl_includedir" != "xauto"; then
GL_CFLAGS="-I$with_gl_includedir"
fi


# Allow Qt bin directory to be specified (to avoid version conflicts for moc, rcc, and uic)
# QTDIR
QTDIR=""
AC_ARG_WITH([qtdir],[AC_HELP_STRING([--with-qtdir=<dir>],
[Specify location of Qt4 developer tools (moc, uic, and rcc) [default=""]])], ,
Expand All @@ -58,22 +75,23 @@ if test "x$with_qtdir" != "x"; then
QTDIR="$with_qtdir/"
fi


# Add in Apple Qt configuration arguments
# QT-FRAMEWORK (Mac only)
AC_ARG_WITH([qt],[AC_HELP_STRING([--with-qt=framework|fink|<none>],
[Determines which installation of Qt4 to use on OS X (should not be set for Linux)[default=<none>]])], ,
[with_qt=])

# GLUT (Mac only)
AC_ARG_WITH([glut],[AC_HELP_STRING([--with-glut=framework|<none>],
[Determines which installation of GLUT to use on OS X (should not be set for Linux)[default=<none>]])], ,
[with_glut=])


# Pre-initialise pkg-config since we don't know where the first PKG_CHECK_MODULES will occur
# Pre-initialise pkg-config
PKG_PROG_PKG_CONFIG


# Set up compilation for qt GUI
AC_DEFINE([WITH_QTGUI], [], [Compile with the Qt4 GUI interface])
# Set up compilation for Qt GUI
#AC_DEFINE([WITH_QTGUI], [], [Compile with the Qt4 GUI interface])
AC_DEFINE([HAS_GUI], [], [Whether a GUI has been specified])
if test "$with_qt" = "framework"; then
QTGUI_LIBS="-framework QtGui -framework QtOpenGL -framework QtCore"
Expand Down Expand Up @@ -102,6 +120,7 @@ else
fi


# Perform Makefile substitutions
AC_SUBST(GUI_LDLIBS)
AC_SUBST(GUI_CFLAGS)
AC_SUBST(QTDIR)
Expand All @@ -113,12 +132,14 @@ AC_C_CONST
AC_C_INLINE
AC_STRUCT_TM


# Checks for library functions.
AC_FUNC_SELECT_ARGTYPES
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([floor pow select sqrt strchr strrchr strstr])

# Define AC_OUTPUT

# Define Makefiles in AC_OUTPUT
AC_OUTPUT(Makefile
src/Makefile
src/base/Makefile
Expand Down
21 changes: 9 additions & 12 deletions src/base/debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ void print_memdebuginfo()
*/

#ifdef SPEEDTEST
int speedtest_numrenders, speedtest_totalrenders;
clock_t speedtest_start, speedtest_finish;
int speedtest_numrenders = 0, speedtest_totalrenders = 100;
clock_t speedtest_start, speedtest_finish;
#endif

/*
Expand All @@ -159,27 +159,24 @@ clock_t speedtest_start, speedtest_finish;
void prepare_debug()
{
#ifdef MEMDEBUG
for (int i=0; i<MD_NITEMS; i++) memdbg.create[i] = 0;
for (int i=0; i<MD_NITEMS; i++) memdbg.destroy[i] = 0;
for (int i=0; i<MD_NITEMS; i++) memdbg.create[i] = 0;
for (int i=0; i<MD_NITEMS; i++) memdbg.destroy[i] = 0;
#endif
#ifdef SPEEDTEST
// Turn on idle events with a period of every second (for printout)
master.use_timer = TRUE;
master.set_timer_period(1);
speedtest_start = clock();
speedtest_start = clock();
#endif
}

// Output
void print_debuginfo()
{
#ifdef MEMDEBUG
print_memdebuginfo();
print_memdebuginfo();
#endif
#ifdef SPEEDTEST
speedtest_finish = clock();
double nsec = double(speedtest_finish-speedtest_start) / CLOCKS_PER_SEC;
printf("SPEEDTEST : Performed %i renders over %8.2f seconds (%8.2f/sec).\n",speedtest_totalrenders,nsec,speedtest_totalrenders/nsec);
speedtest_finish = clock();
double nsec = double(speedtest_finish-speedtest_start) / CLOCKS_PER_SEC;
printf("SPEEDTEST : Performed %i renders over %8.2f seconds (%8.2f/sec).\n",speedtest_totalrenders,nsec,speedtest_totalrenders/nsec);
#endif
}

6 changes: 3 additions & 3 deletions src/base/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ extern memdbg_data memdbg;
*/

#ifdef SPEEDTEST
#include <time.h>
extern int speedtest_numrenders, speedtest_totalrenders;
extern clock_t speedtest_start, speedtest_finish;
#include <time.h>
extern int speedtest_numrenders, speedtest_totalrenders;
extern clock_t speedtest_start, speedtest_finish;
#endif

#endif
3 changes: 2 additions & 1 deletion src/base/prefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,9 @@ void prefs_data::load(const char *filename)
if (!prefcmds.cache_command()) break;
}
// Check the flowstack - it should contain just the BC_ROOTNODE branch
if (prefcmds.get_branchstack_size() != 0)
if (prefcmds.get_branchstack_size() != 1)
{
printf("%i unterminated blocks in prefs file.\n",prefcmds.get_branchstack_size());
dbg_end(DM_CALLS,"prefs::load");
return;
}
Expand Down
7 changes: 5 additions & 2 deletions src/base/sysfunc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,11 @@ const char *evaluate(const char *s, variable_list *vars)
}
}
// Look for non-blank argument and set it as result
for (n=0; n<parser.get_nargs(); n++)
if (!parser.is_blank(n)) return parser.argc(n);
for (n=0; n<parser.get_nargs(); n++) if (!parser.is_blank(n)) break;
if (n < parser.get_nargs()) return parser.argc(n);
// Failed to find a return value!
printf("evaluate - failed to find return argument.\n");
return ".0";
}

// Strip trailing whitespace from string
Expand Down
4 changes: 2 additions & 2 deletions src/classes/dnchar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ dnchar::dnchar()
size = 0;
endpos = -1;
#ifdef MEMDEBUG
memdbg.create[MD_DCHAR] ++;
memdbg.create[MD_DNCHAR] ++;
#endif
}

Expand All @@ -43,7 +43,7 @@ dnchar::~dnchar()
{
if (data != NULL) delete[] data;
#ifdef MEMDEBUG
memdbg.destroy[MD_DCHAR] ++;
memdbg.destroy[MD_DNCHAR] ++;
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion src/classes/grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ grid::grid()
cutoff = 0.0;
log = -1;
style = SS_GRID;
displaylist = -1;
displaylist = 0;
colour[0] = INT_MAX;
colour[1] = 0;
colour[2] = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/classes/pattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ patatom::~patatom()
patbound::~patbound()
{
#ifdef MEMDEBUG
memdbg.destroy[MD_PATTERN_BOND] ++;
memdbg.destroy[MD_PATTERN_BOUND] ++;
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion src/classes/spacegroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void symmop::set(const char *xyzstr)
rotation.set(n,v.x,v.y,v.z);
break;
default:
printf("Unrecognised character '%c' found in symmop spec.\n",c);
printf("Unrecognised character '%c' found in symmop spec.\n",*c);
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/classes/variables.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class variable
// Get value of variable as double
double get_as_double();
// Get value of variable as float
float get_as_float() { float(get_as_double()); }
float get_as_float() { return float(get_as_double()); }
// Get value of variable as a boolean
bool get_as_bool();
// Get value of variable as pointer
Expand Down
2 changes: 1 addition & 1 deletion src/command/commandlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ bool command::add_variables(const char *cmd, const char *v, variable_list &vars)
// Are there arguments in the parser that we shouldn't have been given.
if ((parser.get_nargs() - 1) > strlen(v))
{
printf("Too many arguments (%i) given to command '%s' (which expects %i at most).\n", (parser.get_nargs()-1), cmd, strlen(v));
printf("Too many arguments (%i) given to command '%s' (which expects %li at most).\n", (parser.get_nargs()-1), cmd, strlen(v));
dbg_end(DM_CALLS,"command::add_variables");
return FALSE;
}
Expand Down
2 changes: 2 additions & 0 deletions src/command/flow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ int commanddata::function_CA_ELSEIF(command *&c, bundle &obj)

int commanddata::function_CA_END(command *&c, bundle &obj)
{
// This should never be called....
return CR_SUCCESS;
}

// Loop over atoms
Expand Down
11 changes: 8 additions & 3 deletions src/gui/canvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,13 @@ void canvas::init_gl()
dbg_begin(DM_CALLS,"canvas::init_gl");
if (begin_gl())
{
// Create lists for globs
if (list[0] == 0) list[GLOB_STICKATOM] = glGenLists(GLOB_NITEMS);
for (int n=1; n<GLOB_NITEMS; n++) list[n] = list[GLOB_STICKATOM]+n;
// Create lists for globs if this is the first call to init_gl()
if (list[0] == 0)
{
list[GLOB_STICKATOM] = glGenLists(GLOB_NITEMS);
for (int n=1; n<GLOB_NITEMS; n++) list[n] = list[GLOB_STICKATOM]+n;
}

// Fill display lists
create_lists();

Expand Down Expand Up @@ -215,6 +219,7 @@ void canvas::init_gl()
// Create display lists
void canvas::create_lists()
{
if (!is_valid()) return;
dbg_begin(DM_CALLS,"canvas::create_lists");
// Generate quadric objects for subsequent use
quadric1 = gluNewQuadric(); // Creates a quadric object for use.
Expand Down
3 changes: 1 addition & 2 deletions src/gui/canvas.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ enum user_action { UA_NONE,
enum key_code { KC_OTHER, KC_ESCAPE, KC_SHIFT_L, KC_SHIFT_R, KC_CONTROL_L, KC_CONTROL_R, KC_ALT_L, KC_ALT_R, KC_LEFT, KC_RIGHT, KC_UP, KC_DOWN, KC_NITEMS };

// GL Objects
enum glob_list { GLOB_STICKATOM, GLOB_TUBEATOM, GLOB_SPHEREATOM, GLOB_UNITATOM, GLOB_WIRETUBEATOM, GLOB_WIRESPHEREATOM, GLOB_WIREUNITATOM, GLOB_CYLINDER, GLOB_WIRECYLINDER, GLOB_SELWIRECYLINDER,
GLOB_GLOBE, GLOB_GUIDE, GLOB_CIRCLE, GLOB_CELLAXES, GLOB_SELTUBEATOM, GLOB_SELSPHEREATOM, GLOB_SELUNITATOM, GLOB_WIREUNITCUBE, GLOB_UNITCUBE, GLOB_MODEL, GLOB_NITEMS };
enum glob_list { GLOB_STICKATOM, GLOB_TUBEATOM, GLOB_SPHEREATOM, GLOB_UNITATOM, GLOB_WIRETUBEATOM, GLOB_WIRESPHEREATOM, GLOB_WIREUNITATOM, GLOB_CYLINDER, GLOB_WIRECYLINDER, GLOB_SELWIRECYLINDER, GLOB_GLOBE, GLOB_GUIDE, GLOB_CIRCLE, GLOB_CELLAXES, GLOB_SELTUBEATOM, GLOB_SELSPHEREATOM, GLOB_SELUNITATOM, GLOB_WIREUNITCUBE, GLOB_UNITCUBE, GLOB_MODEL, GLOB_NITEMS };

// Forward declarations
class atom;
Expand Down
4 changes: 2 additions & 2 deletions src/render/render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@ void canvas::render_scene(model *source)

// Set the initial state of lighting in the model
prefs.render_style == DS_STICK ? glDisable(GL_LIGHTING) : glEnable(GL_LIGHTING);

printf("Rendering\n");
// Draw the main model parts
// If render_point matches the model's total change point (from get_point()) then just re-render the stored display list. If not, create the display list.
glPushMatrix();
if (render_point == displaymodel->get_log(LOG_TOTAL)) glCallList(list[GLOB_MODEL]);
else
{
msg(DM_VERBOSE,"Recreating display list for model '%s'...", displaymodel->get_name());
glDeleteLists(list[GLOB_MODEL],1);
//glDeleteLists(list[GLOB_MODEL],1);
glNewList(list[GLOB_MODEL],GL_COMPILE_AND_EXECUTE);
// Draw the model cell (this also translates our drawing position to the -half cell point.
render_model_cell();
Expand Down
2 changes: 1 addition & 1 deletion src/render/surface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ void canvas::render_surfaces()

if (g->should_rerender())
{
if (list != -1) glDeleteLists(list,1);
//if (list != 0) glDeleteLists(list,1);
glNewList(list,GL_COMPILE);
switch (g->get_style())
{
Expand Down

0 comments on commit d4fc141

Please sign in to comment.