From cb29a04fa5a3349c8f14203ec873e861376ce4d8 Mon Sep 17 00:00:00 2001 From: Don Pellegrino Date: Tue, 18 Aug 2009 19:48:41 +0000 Subject: Ran GNU indent. --- diff --git a/Makefile.am b/Makefile.am index 8638119..d54aa2f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,15 +1,26 @@ ACLOCAL_AMFLAGS = -I ax SUBDIRS = src +# Ident formats the source code to conform with GNU style conventions. indent : indent \ src/*.c \ - src/controller/*.c src/controller/*.sqc src/controller/*.h \ + src/controller/actions/*.c src/controller/actions/*.sqc src/controller/actions/*.h \ + src/controller/callbacks/*.c src/controller/callbacks/*.h \ src/db/*.c src/db/*.sqc src/db/*.h \ - src/model/*.c src/model/*.sqc src/model/*.h \ - src/model/geometry/*.c src/mode/geometry/*.h \ + src/model/data/*.c src/model/data/*.sqc src/model/data/*.h \ + src/model/geometry/*.c src/model/geometry/*.h \ + src/model/state/*.c src/model/state/*.h \ src/util/*.c src/util/*.h \ src/util/amd_performance_monitor/*.c \ src/util/amd_performance_monitor/*.h \ src/view/*.c src/view/*.h +# Splint analyzes the code for security vulnerabilities and +# programming mistakes. It would be great to add a target to run +# splint here but as of Splint 3.1.2 it does not yet handle C99 +# variable declarations which are used heavily in this project. This +# is discussed at +# http://www.cs.virginia.edu/pipermail/splint-discuss/2009-March/001288.html. + + diff --git a/src/controller/actions/pan.c b/src/controller/actions/pan.c index 2f856b0..52e5fc1 100644 --- a/src/controller/actions/pan.c +++ b/src/controller/actions/pan.c @@ -10,10 +10,10 @@ pan (int x1, int y1, int x2, int y2) { int dx = x1 - x2; int dy = y1 - x2; - + if (dx == 0 && dy == 0) return; - + /* * Convert the selection boundary from window coordinates to * world coordinates. @@ -26,9 +26,9 @@ pan (int x1, int y1, int x2, int y2) glGetDoublev (GL_PROJECTION_MATRIX, projection); GLint viewport[4]; glGetIntegerv (GL_VIEWPORT, viewport); - + check_error (__FILE__, __LINE__); - + GLdouble start_position[3]; gluUnProject (x1, y1, @@ -36,11 +36,10 @@ pan (int x1, int y1, int x2, int y2) model, projection, viewport, - &start_position[0], - &start_position[1], &start_position[2]); - + &start_position[0], &start_position[1], &start_position[2]); + check_error (__FILE__, __LINE__); - + GLdouble end_position[3]; gluUnProject (x2, y2, @@ -49,13 +48,13 @@ pan (int x1, int y1, int x2, int y2) projection, viewport, &end_position[0], &end_position[1], &end_position[2]); - + check_error (__FILE__, __LINE__); - + S.pan.trans[0] += end_position[0] - start_position[0]; S.pan.trans[1] -= end_position[1] - start_position[1]; - + glutPostRedisplay (); - + return; } diff --git a/src/controller/actions/set_ortho.c b/src/controller/actions/set_ortho.c index ce66f60..e73846c 100644 --- a/src/controller/actions/set_ortho.c +++ b/src/controller/actions/set_ortho.c @@ -7,10 +7,7 @@ void set_ortho (void) { - gluOrtho2D (S.ortho.min_x, - S.ortho.max_x, - S.ortho.min_y, - S.ortho.max_y); + gluOrtho2D (S.ortho.min_x, S.ortho.max_x, S.ortho.min_y, S.ortho.max_y); return; } diff --git a/src/controller/actions/zoom.c b/src/controller/actions/zoom.c index 7209e85..53da49b 100644 --- a/src/controller/actions/zoom.c +++ b/src/controller/actions/zoom.c @@ -14,7 +14,7 @@ void zoom (double x1, double y1, double x2, double y2) { S.zoom.active = true; - + S.zoom.coords[0] = x1; S.zoom.coords[1] = x2; S.zoom.coords[2] = y1; @@ -30,7 +30,7 @@ zoom (double x1, double y1, double x2, double y2) */ double width = S.zoom.coords[1] - S.zoom.coords[0]; double height = S.zoom.coords[3] - S.zoom.coords[2]; - double difference = fabs(width - height); + double difference = fabs (width - height); if (width > height) { @@ -46,8 +46,8 @@ zoom (double x1, double y1, double x2, double y2) GLint viewport[4]; glGetIntegerv (GL_VIEWPORT, viewport); reshape (viewport[2], viewport[3]); - + glutPostRedisplay (); - + return; } diff --git a/src/controller/callbacks/keyboard.c b/src/controller/callbacks/keyboard.c index 9e667d8..a74ac7b 100644 --- a/src/controller/callbacks/keyboard.c +++ b/src/controller/callbacks/keyboard.c @@ -45,7 +45,7 @@ keyboard (unsigned char key, int x, int y) * Reset the view (unzoom, recenter). */ pan_info_init (&S.pan); - zoom_info_init (&S.zoom); + zoom_info_init (&S.zoom); GLint viewport[4]; glGetIntegerv (GL_VIEWPORT, viewport); diff --git a/src/controller/callbacks/mouse.c b/src/controller/callbacks/mouse.c index 34ff290..5f5be43 100644 --- a/src/controller/callbacks/mouse.c +++ b/src/controller/callbacks/mouse.c @@ -25,8 +25,8 @@ mouse (int button, int state, int x, int y) { // Deactive a panning event if one was happening. S.pan.active = false; - - if (S.selection.active && + + if (S.selection.active && S.selection.purpose == ZOOM && glutGetModifiers () == GLUT_ACTIVE_CTRL) { @@ -35,7 +35,7 @@ mouse (int button, int state, int x, int y) */ if (x == S.selection.x || y == S.selection.y) return; - + /* * Convert the selection boundary from window coordinates to * world coordinates. @@ -48,21 +48,21 @@ mouse (int button, int state, int x, int y) glGetDoublev (GL_PROJECTION_MATRIX, projection); GLint viewport[4]; glGetIntegerv (GL_VIEWPORT, viewport); - + check_error (__FILE__, __LINE__); - + GLdouble start_position[3]; gluUnProject (x, - viewport[3] -y, + viewport[3] - y, 0, model, projection, viewport, &start_position[0], &start_position[1], &start_position[2]); - + check_error (__FILE__, __LINE__); - + GLdouble end_position[3]; gluUnProject (S.selection.x, viewport[3] - S.selection.y, @@ -71,9 +71,9 @@ mouse (int button, int state, int x, int y) projection, viewport, &end_position[0], &end_position[1], &end_position[2]); - + check_error (__FILE__, __LINE__); - + zoom (fmin (start_position[0], end_position[0]), fmin (start_position[1], end_position[1]), fmax (start_position[0], end_position[0]), @@ -83,7 +83,7 @@ mouse (int button, int state, int x, int y) /* * Complete a selection if one was started and not cancelled. */ - if (S.selection.active && + if (S.selection.active && S.selection.purpose == SET && glutGetModifiers () == GLUT_ACTIVE_CTRL) { @@ -161,9 +161,8 @@ mouse (int button, int state, int x, int y) } // Begin selection. - if (button == GLUT_LEFT_BUTTON && - state == GLUT_DOWN && - glutGetModifiers () == GLUT_ACTIVE_CTRL) + if (button == GLUT_LEFT_BUTTON && + state == GLUT_DOWN && glutGetModifiers () == GLUT_ACTIVE_CTRL) { S.selection.active = true; S.selection.x = x; @@ -172,8 +171,7 @@ mouse (int button, int state, int x, int y) // Pan. if (button == GLUT_LEFT_BUTTON && - state == GLUT_DOWN && - glutGetModifiers () != GLUT_ACTIVE_CTRL) + state == GLUT_DOWN && glutGetModifiers () != GLUT_ACTIVE_CTRL) { /* * Detection of the first point in a panning event. diff --git a/src/controller/callbacks/mouse_motion.c b/src/controller/callbacks/mouse_motion.c index 3279773..5cdbac7 100644 --- a/src/controller/callbacks/mouse_motion.c +++ b/src/controller/callbacks/mouse_motion.c @@ -14,6 +14,6 @@ mouse_motion (int x, int y) S.pan.begin[0] = x; S.pan.begin[1] = y; } - + return; } diff --git a/src/controller/callbacks/mouse_wheel.c b/src/controller/callbacks/mouse_wheel.c index 9ca73bc..05ce734 100644 --- a/src/controller/callbacks/mouse_wheel.c +++ b/src/controller/callbacks/mouse_wheel.c @@ -6,7 +6,7 @@ #define S state0 -void +void mouse_wheel (int button, int dir, int x, int y) { /* @@ -14,8 +14,8 @@ mouse_wheel (int button, int dir, int x, int y) * start at the position of the mouse. Calculate a bounding box * that will be the selection and zoom to it. */ - double width = fabs(S.ortho.max_x - S.ortho.min_x); - double height = fabs(S.ortho.max_y - S.ortho.min_y); + double width = fabs (S.ortho.max_x - S.ortho.min_x); + double height = fabs (S.ortho.max_y - S.ortho.min_y); /* * Box the smaller of the two dimensions. @@ -60,7 +60,7 @@ mouse_wheel (int button, int dir, int x, int y) } // Zoom in - if (dir > 0) + if (dir > 0) { zoom (x1 + step, y1 + step, x2 - step, y2 - step); } diff --git a/src/controller/callbacks/reshape.c b/src/controller/callbacks/reshape.c index fec5443..0414be6 100644 --- a/src/controller/callbacks/reshape.c +++ b/src/controller/callbacks/reshape.c @@ -21,23 +21,25 @@ reshape (int w, int h) { if (w >= h) { - double scale - = ( ( (S.zoom.coords[1] - S.zoom.coords[0]) * ((double) w / (double) h) ) - - (S.zoom.coords[1] - S.zoom.coords[0]) ) - * 0.5; + double scale + = + (((S.zoom.coords[1] - + S.zoom.coords[0]) * ((double) w / (double) h)) - + (S.zoom.coords[1] - S.zoom.coords[0])) * 0.5; S.ortho.min_x = S.zoom.coords[0] - scale; - S.ortho.max_x = S.zoom.coords[1] + scale; + S.ortho.max_x = S.zoom.coords[1] + scale; S.ortho.min_y = S.zoom.coords[2]; S.ortho.max_y = S.zoom.coords[3]; } else { - double scale - = ( ( (S.zoom.coords[3] - S.zoom.coords[2]) * ((double) h / (double) w) ) - - (S.zoom.coords[3] - S.zoom.coords[2]) ) - * 0.5; - + double scale + = + (((S.zoom.coords[3] - + S.zoom.coords[2]) * ((double) h / (double) w)) - + (S.zoom.coords[3] - S.zoom.coords[2])) * 0.5; + S.ortho.min_x = S.zoom.coords[0]; S.ortho.max_x = S.zoom.coords[1]; S.ortho.min_y = S.zoom.coords[2] - scale; @@ -45,7 +47,7 @@ reshape (int w, int h) } } - else + else { /* * This scaling produces an odd effect when the coordinates are @@ -68,7 +70,7 @@ reshape (int w, int h) S.ortho.min_y = S.ortho_min; S.ortho.max_y = S.ortho_max; } - } + } set_ortho (); diff --git a/src/model/geometry/map_geometry.c b/src/model/geometry/map_geometry.c index 8bc79a3..c4c8db0 100644 --- a/src/model/geometry/map_geometry.c +++ b/src/model/geometry/map_geometry.c @@ -15,10 +15,9 @@ map_geometry (void) glLoadName (i); // Draw the protein geometry. - float* v = S.base_vertices_data + (i * 2); + float *v = S.base_vertices_data + (i * 2); glPushMatrix (); - glTranslatef (*v, - *(v+1), 0.0); + glTranslatef (*v, *(v + 1), 0.0); glColor4fv (S.base_colors_data + (i * 4)); glCallList (S.list_offset + PROTEIN_GEOMETRY); glPopMatrix (); @@ -27,10 +26,9 @@ map_geometry (void) if (S.selection.set[i]) { glPushMatrix (); - glTranslatef (*v, - *(v+1), 0.0); + glTranslatef (*v, *(v + 1), 0.0); glColor4f (0.5, 0.5, 0.5, 1.0); - glCallList (S.list_offset + PROTEIN_SELECTED_GEOMETRY); + glCallList (S.list_offset + PROTEIN_SELECTED_GEOMETRY); glPopMatrix (); } } diff --git a/src/model/state/pan_info_init.h b/src/model/state/pan_info_init.h index f47b790..0d01659 100644 --- a/src/model/state/pan_info_init.h +++ b/src/model/state/pan_info_init.h @@ -3,6 +3,6 @@ #include "pan_info.h" -void pan_info_init (PAN_INFO* p); +void pan_info_init (PAN_INFO * p); #endif // PAN_INFO_INIT_H diff --git a/src/model/state/zoom_info_init.c b/src/model/state/zoom_info_init.c index aa230d8..662c575 100644 --- a/src/model/state/zoom_info_init.c +++ b/src/model/state/zoom_info_init.c @@ -8,6 +8,6 @@ zoom_info_init (ZOOM_INFO * z) z->coords[1] = 0.0; z->coords[2] = 0.0; z->coords[3] = 0.0; - + return; } -- cgit v0.8.3.1-22-g547a