From cbd04231eb97ce617442bf50badddf357514ffc1 Mon Sep 17 00:00:00 2001 From: Don Pellegrino Date: Thu, 18 Jun 2009 21:19:52 +0000 Subject: Added DB2 precompiler output to the ignore list. --- diff --git a/src/model/exp004base.c b/src/model/exp004base.c index 56a20e5..fb07b2c 100644 --- a/src/model/exp004base.c +++ b/src/model/exp004base.c @@ -1,65 +1,292 @@ +static char sqla_program_id[292] = +{ + 172,0,65,69,65,77,65,73,77,65,105,103,79,83,71,90,48,49,49,49, + 49,32,50,32,32,32,32,32,32,32,32,32,8,0,68,79,78,32,32,32, + 32,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,8,0,69,88,80,48,48,52,66,65,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0 +}; + +#include "sqladef.h" + +static struct sqla_runtime_info sqla_rtinfo = +{{'S','Q','L','A','R','T','I','N'}, sizeof(wchar_t), 0, {' ',' ',' ',' '}}; + + +static const short sqlIsLiteral = SQL_IS_LITERAL; +static const short sqlIsInputHvar = SQL_IS_INPUT_HVAR; + + +#line 1 "exp004base.sqc" /* I seem to need this for glGenBuffers as per http://www.gamedev.net/community/forums/topic.asp?topic_id=422358 */ #define GL_GLEXT_PROTOTYPES #include "exp004base.h" #include "../view/exp004state0.h" +#include "../util/check_error.h" #include #include #include +#include "sqlca.h" +extern struct sqlca sqlca; + +/* + * A simple alias to make the code more readable. + */ +#define S exp004state0 void exp004base (void) { - /* - * A simple alias to make the code more readable. - */ - EXP004STATE* S = &exp004state0; - /* * This implementation can be improved by mapping the video memory * directly rather than loading into system memory and then copying * into video memory. */ - FILE* coords = - fopen ("/home/don/exp004/test/run20090514/run20090514.coords", "r"); - int i = 0; + /* + * db2dclgn -d exp004 -t coordinates + */ + +/* +EXEC SQL BEGIN DECLARE SECTION; +*/ + +#line 31 "exp004base.sqc" + + +/* +EXEC SQL INCLUDE 'model/coordinates.h'; +*/ + +#line 1 "/home/don/projects/Research/Experiments/exp005/src/model/coordinates.h" +struct +{ + sqlint32 coord_id; + struct + { + short length; + char data[50]; + } gi; + double x; + double y; +} coordinates; + + +#line 32 "exp004base.sqc" + + +/* +EXEC SQL END DECLARE SECTION; +*/ + +#line 33 "exp004base.sqc" + + + +/* +EXEC SQL DECLARE c2 CURSOR FOR + SELECT * FROM coordinates; +*/ + +#line 36 "exp004base.sqc" + + + +/* +EXEC SQL OPEN c2; +*/ + +{ +#line 38 "exp004base.sqc" + sqlastrt(sqla_program_id, &sqla_rtinfo, &sqlca); +#line 38 "exp004base.sqc" + sqlacall((unsigned short)26,1,0,0,0L); +#line 38 "exp004base.sqc" + sqlastop(0L); +} + +#line 38 "exp004base.sqc" + /* * Initialize the bounding box of the points. */ - S->bb.min_x = 0.0; - S->bb.max_x = 0.0; - S->bb.min_y = 0.0; - S->bb.max_y = 0.0; + S.bb.min_x = 0.0; + S.bb.max_x = 0.0; + S.bb.min_y = 0.0; + S.bb.max_y = 0.0; + + +/* +EXEC SQL FETCH c2 INTO :coordinates; +*/ + +{ +#line 48 "exp004base.sqc" + sqlastrt(sqla_program_id, &sqla_rtinfo, &sqlca); +#line 48 "exp004base.sqc" + sqlaaloc(3,4,1,0L); + { + struct sqla_setdata_list sql_setdlist[4]; +#line 48 "exp004base.sqc" + sql_setdlist[0].sqltype = 496; sql_setdlist[0].sqllen = 4; +#line 48 "exp004base.sqc" + sql_setdlist[0].sqldata = (void*)&coordinates.coord_id; +#line 48 "exp004base.sqc" + sql_setdlist[0].sqlind = 0L; +#line 48 "exp004base.sqc" + sql_setdlist[1].sqltype = 448; sql_setdlist[1].sqllen = 50; +#line 48 "exp004base.sqc" + sql_setdlist[1].sqldata = (void*)&coordinates.gi; +#line 48 "exp004base.sqc" + sql_setdlist[1].sqlind = 0L; +#line 48 "exp004base.sqc" + sql_setdlist[2].sqltype = 480; sql_setdlist[2].sqllen = 8; +#line 48 "exp004base.sqc" + sql_setdlist[2].sqldata = (void*)&coordinates.x; +#line 48 "exp004base.sqc" + sql_setdlist[2].sqlind = 0L; +#line 48 "exp004base.sqc" + sql_setdlist[3].sqltype = 480; sql_setdlist[3].sqllen = 8; +#line 48 "exp004base.sqc" + sql_setdlist[3].sqldata = (void*)&coordinates.y; +#line 48 "exp004base.sqc" + sql_setdlist[3].sqlind = 0L; +#line 48 "exp004base.sqc" + sqlasetdata(3,0,4,sql_setdlist,0L,0L); + } +#line 48 "exp004base.sqc" + sqlacall((unsigned short)25,1,0,3,0L); +#line 48 "exp004base.sqc" + sqlastop(0L); +} + +#line 48 "exp004base.sqc" - for (i = 0; i < ROWS; i++) + while (sqlca.sqlcode != 100) { - fscanf (coords, "%s %f %f\n", - S->gi_data[i], - &S->base_vertices_data[i][0], - &S->base_vertices_data[i][1]); - - if (S->base_vertices_data[i][0] < S->bb.min_x) - S->bb.min_x = S->base_vertices_data[i][0]; - if (S->base_vertices_data[i][0] > S->bb.max_x) - S->bb.max_x = S->base_vertices_data[i][0]; - if (S->base_vertices_data[i][1] < S->bb.min_y) - S->bb.min_y = S->base_vertices_data[i][1]; - if (S->base_vertices_data[i][1] > S->bb.max_y) - S->bb.max_y = S->base_vertices_data[i][1]; + int i = coordinates.coord_id - 1; + + strncpy(S.gi_data[i], + coordinates.gi.data, + sizeof (S.gi_data[i])); + + S.base_vertices_data[i][0] = coordinates.x; + S.base_vertices_data[i][1] = coordinates.y; + + if (S.base_vertices_data[i][0] < S.bb.min_x) + S.bb.min_x = S.base_vertices_data[i][0]; + if (S.base_vertices_data[i][0] > S.bb.max_x) + S.bb.max_x = S.base_vertices_data[i][0]; + if (S.base_vertices_data[i][1] < S.bb.min_y) + S.bb.min_y = S.base_vertices_data[i][1]; + if (S.base_vertices_data[i][1] > S.bb.max_y) + S.bb.max_y = S.base_vertices_data[i][1]; /* * Deselected by default. */ - S->selection[i] = false; + S.selection.set[i] = false; + + S.base_colors_data[i][0] = DEFAULT_COLOR_R; + S.base_colors_data[i][1] = DEFAULT_COLOR_G; + S.base_colors_data[i][2] = DEFAULT_COLOR_B; + S.base_colors_data[i][3] = DEFAULT_COLOR_A; + + +/* +EXEC SQL FETCH c2 INTO :coordinates; +*/ + +{ +#line 79 "exp004base.sqc" + sqlastrt(sqla_program_id, &sqla_rtinfo, &sqlca); +#line 79 "exp004base.sqc" + sqlaaloc(3,4,2,0L); + { + struct sqla_setdata_list sql_setdlist[4]; +#line 79 "exp004base.sqc" + sql_setdlist[0].sqltype = 496; sql_setdlist[0].sqllen = 4; +#line 79 "exp004base.sqc" + sql_setdlist[0].sqldata = (void*)&coordinates.coord_id; +#line 79 "exp004base.sqc" + sql_setdlist[0].sqlind = 0L; +#line 79 "exp004base.sqc" + sql_setdlist[1].sqltype = 448; sql_setdlist[1].sqllen = 50; +#line 79 "exp004base.sqc" + sql_setdlist[1].sqldata = (void*)&coordinates.gi; +#line 79 "exp004base.sqc" + sql_setdlist[1].sqlind = 0L; +#line 79 "exp004base.sqc" + sql_setdlist[2].sqltype = 480; sql_setdlist[2].sqllen = 8; +#line 79 "exp004base.sqc" + sql_setdlist[2].sqldata = (void*)&coordinates.x; +#line 79 "exp004base.sqc" + sql_setdlist[2].sqlind = 0L; +#line 79 "exp004base.sqc" + sql_setdlist[3].sqltype = 480; sql_setdlist[3].sqllen = 8; +#line 79 "exp004base.sqc" + sql_setdlist[3].sqldata = (void*)&coordinates.y; +#line 79 "exp004base.sqc" + sql_setdlist[3].sqlind = 0L; +#line 79 "exp004base.sqc" + sqlasetdata(3,0,4,sql_setdlist,0L,0L); + } +#line 79 "exp004base.sqc" + sqlacall((unsigned short)25,1,0,3,0L); +#line 79 "exp004base.sqc" + sqlastop(0L); +} + +#line 79 "exp004base.sqc" - S->base_colors_data[i][0] = DEFAULT_COLOR_R; - S->base_colors_data[i][1] = DEFAULT_COLOR_G; - S->base_colors_data[i][2] = DEFAULT_COLOR_B; } - fclose (coords); + + +/* +EXEC SQL CLOSE c2; +*/ + +{ +#line 82 "exp004base.sqc" + sqlastrt(sqla_program_id, &sqla_rtinfo, &sqlca); +#line 82 "exp004base.sqc" + sqlacall((unsigned short)20,1,0,0,0L); +#line 82 "exp004base.sqc" + sqlastop(0L); +} + +#line 82 "exp004base.sqc" + + + +/* +EXEC SQL COMMIT; +*/ + +{ +#line 84 "exp004base.sqc" + sqlastrt(sqla_program_id, &sqla_rtinfo, &sqlca); +#line 84 "exp004base.sqc" + sqlacall((unsigned short)21,0,0,0,0L); +#line 84 "exp004base.sqc" + sqlastop(0L); +} + +#line 84 "exp004base.sqc" + /* * Find the largest axis and use it to setup the projection. This @@ -69,38 +296,63 @@ exp004base (void) */ // Min of min x or min y. - if (S->bb.min_x <= S->bb.min_y) - S->ortho_min = S->bb.min_x; + if (S.bb.min_x <= S.bb.min_y) + S.ortho_min = S.bb.min_x; else - S->ortho_min = S->bb.min_y; - S->ortho_min--; + S.ortho_min = S.bb.min_y; + S.ortho_min--; // Max of max x or max y. - if (S->bb.max_x >= S->bb.max_y) - S->ortho_max = S->bb.max_x; + if (S.bb.max_x >= S.bb.max_y) + S.ortho_max = S.bb.max_x; else - S->ortho_max = S->bb.max_y; - S->ortho_max++; + S.ortho_max = S.bb.max_y; + S.ortho_max++; // Invert the y coordinate to match up with the LGL Java viewer. - for (i = 0; i < ROWS; i++) - S->base_vertices_data[i][1] = - S->ortho_max - S->base_vertices_data[i][1]; + for (int i = 0; i < ROWS; i++) + S.base_vertices_data[i][1] = + S.ortho_max - S.base_vertices_data[i][1]; - S->points = i; + // Move the origin (0,0) to the center of the data. + S.ortho_min = 0.0; + S.ortho_max = 0.0; + + for (int i = 0; i < ROWS; i++) + { + S.base_vertices_data[i][0] = + S.base_vertices_data[i][0] - + (0.5 * (S.bb.max_x - S.bb.min_x)); + + if (S.ortho_min > S.base_vertices_data[i][0]) + S.ortho_min = S.base_vertices_data[i][0]; + + if (S.ortho_max < S.base_vertices_data[i][0]) + S.ortho_max = S.base_vertices_data[i][0]; + + S.base_vertices_data[i][1] = + S.base_vertices_data[i][1] - + (0.5 * (S.bb.max_y - S.bb.min_y)); + + if (S.ortho_min > S.base_vertices_data[i][1]) + S.ortho_min = S.base_vertices_data[i][1]; + + if (S.ortho_max < S.base_vertices_data[i][1]) + S.ortho_max = S.base_vertices_data[i][1]; + } - glGenBuffers (2, S->buffers); + glGenBuffers (2, S.buffers); - glBindBuffer (GL_ARRAY_BUFFER, S->buffers[BASE_VERTICES]); + glBindBuffer (GL_ARRAY_BUFFER, S.buffers[BASE_VERTICES]); glVertexPointer (2, GL_FLOAT, 0, 0); glBufferData (GL_ARRAY_BUFFER, - sizeof (S->base_vertices_data), S->base_vertices_data, + sizeof (S.base_vertices_data), S.base_vertices_data, GL_STATIC_DRAW); - glBindBuffer (GL_ARRAY_BUFFER, S->buffers[BASE_COLORS]); - glColorPointer (3, GL_FLOAT, 0, 0); + glBindBuffer (GL_ARRAY_BUFFER, S.buffers[BASE_COLORS]); + glColorPointer (4, GL_FLOAT, 0, 0); glBufferData (GL_ARRAY_BUFFER, - sizeof (S->base_colors_data), S->base_colors_data, + sizeof (S.base_colors_data), S.base_colors_data, GL_STATIC_DRAW); return; -- cgit v0.8.3.1-22-g547a