Commit bbddcae7 authored by Eric Anholt's avatar Eric Anholt

Move FindLine to shared code instead of cargo-culting it around.

parent 1cffecfe
add_subdirectory (util)
add_subdirectory (bugs)
add_subdirectory (glean)
add_subdirectory (mesa)
......
......@@ -3,10 +3,12 @@ include_directories(
${OPENGL_INCLUDE_PATH}
${GLUT_INCLUDE_DIR}
${piglit_SOURCE_DIR}/tests/mesa/util
${piglit_SOURCE_DIR}/tests/util
)
link_directories (
${piglit_SOURCE_DIR}/tests/mesa/util
${piglit_SOURCE_DIR}/tests/util
)
link_libraries (
......@@ -15,6 +17,7 @@ link_libraries (
${GLUT_glut_LIBRARY}
${TIFF_LIBRARY}
mesautil
piglitutil
)
add_executable (trinity-fp1 trinity-fp1.c)
......
......@@ -31,6 +31,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glut.h>
#include "piglit-util.h"
static void CheckFail(const char* cond);
......@@ -319,18 +320,6 @@ static void Key(unsigned char key, int x, int y)
}
/* A helper for finding errors in program strings */
static int FindLine(const char *program, int position)
{
int i, line = 1;
for (i = 0; i < position; i++) {
if (program[i] == '\n')
line++;
}
return line;
}
static void Init(void)
{
int i, x, y;
......
......@@ -236,18 +236,6 @@ static void Key(unsigned char key, int x, int y)
}
/* A helper for finding errors in program strings */
static int FindLine(const char *program, int position)
{
int i, line = 1;
for (i = 0; i < position; i++) {
if (program[i] == '\n')
line++;
}
return line;
}
static void Init(void)
{
int i, x, y;
......
......@@ -31,6 +31,7 @@
#include <stdlib.h>
#include <math.h>
#include <GL/glut.h>
#include "piglit-util.h"
static void CheckFail(const char* cond);
......@@ -312,18 +313,6 @@ static void Key(unsigned char key, int x, int y)
}
/* A helper for finding errors in program strings */
static int FindLine(const char *program, int position)
{
int i, line = 1;
for (i = 0; i < position; i++) {
if (program[i] == '\n')
line++;
}
return line;
}
static void Init(void)
{
int i, x, y;
......
......@@ -166,18 +166,6 @@ static void Key(unsigned char key, int x, int y)
}
/* A helper for finding errors in program strings */
static int FindLine(const char *program, int position)
{
int i, line = 1;
for (i = 0; i < position; i++) {
if (program[i] == '\n')
line++;
}
return line;
}
static void Init(void)
{
int mask;
......
......@@ -205,18 +205,6 @@ static void Key(unsigned char key, int x, int y)
}
/* A helper for finding errors in program strings */
static int FindLine(const char *program, int position)
{
int i, line = 1;
for (i = 0; i < position; i++) {
if (program[i] == '\n')
line++;
}
return line;
}
static void Init(void)
{
GLint errorPos;
......
add_library (piglitutil
piglit-util.c
)
/*
* Copyright (c) The Piglit project 2007
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* on the rights to use, copy, modify, merge, publish, distribute, sub
* license, and/or sell copies of the Software, and to permit persons to whom
* the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/** Returns the line in the program string given the character position. */
int FindLine(const char *program, int position)
{
int i, line = 1;
for (i = 0; i < position; i++) {
if (program[i] == '\n')
line++;
}
return line;
}
/*
* Copyright (c) The Piglit project 2007
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* on the rights to use, copy, modify, merge, publish, distribute, sub
* license, and/or sell copies of the Software, and to permit persons to whom
* the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
int FindLine(const char *program, int position);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment