Example #1
0
// function that generalizes the matching and processing of a regular expression, it takes
// the request rec, a pointer to data, the number of regexp groups, the size of an ovector
// group (normally 3), a pointer to the regular expression, and a callback function that 
// can use the request rec, the data passed in and the ovector to process the expression
// it then returns a string of processed data
static char * match_and_process_expression(
				request_rec *r, char *data, int num_groups, int group_size,
				char *reg_exp, char*(process_func)(request_rec *r, char *data, int ovector[])) {
	//initialize values
	pcre *re;
	const char *error;
	int erroffset;
	int ovector[num_groups * group_size];
	int rc;	
	char *regex=reg_exp;
	char *output = NULL;
	apr_status_t rv;

	//compile
	re = pcre_compile(regex, PCRE_DOTALL, &error, &erroffset, NULL);
	rv = check_compile_error(re, erroffset, error);
	if (rv != OK) {
		return NULL;
	}

	//evaluate exp against data
	rc = pcre_exec(re, NULL, data, strlen(data), 0, 0, ovector, num_groups * group_size);
	rv = check_match_error(rc);
	if (rv != OK) {
		return NULL;
	}

	//output latitude and longitude
	output= process_func(r, data, ovector);
	return output;
}
Example #2
0
__forceinline GLuint load_shader
(
	GLenum shader_type, const char* source0, const char* source1
)
{
	GLuint shader = load_shader_wo_cmplchk(shader_type, source0, source1);

	return check_compile_error(shader) ? shader : 0;
}
Example #3
0
inline GLuint load_shader_from_file(
	GLenum shader_type, const std::string& filename0, const std::string& filename1)
{
	GLuint shader = load_shader_from_file_wo_cmplchk(shader_type, filename0, filename1);

	if(!check_compile_error(shader))
	{
		return 0;
	}

	return shader;
}