<commit_before>/*!
 * @class  GlCoreHeader
 * @brief  A singleton class holding information about glcorearb.h
 * @credit http://stackoverflow.com/a/6733919/388751
 * @usage  new GlCoreHeader().GetSource() //returns the source string
 */
function GlCoreHeader() {
	if ( arguments.callee._singletonInstance )
		return arguments.callee._singletonInstance;
	arguments.callee._singletonInstance = this;

	Source = (function() {
		return require('fs').readFileSync('glcorearb.h', 'utf8');
	})();
	
	/*!
	 * \fn     GetSource
	 * \brief  returns the glcorearb.h source code as string
	 * \return string
	 */
	this.GetSource = function() {
		return Source;
	}
}

/*!
 * @class Namespace
 * @brief A class containing information about an OpenGL namespace.
 * @note  Based on what is available in current glcorearb.h, everything
 *        is wrapped inside #ifndef's. Therefore this script assumes a
 *        namespace starts with a #ifndef GL_**.
 *
 * @param codename the original name of the namespace (including GL_)
 * @param name     the actual name of the namespace
 * @param vendor   the vendor name of the namespace (ARB for example)
 * @param funptrs  represents all function pointers inside the namespace
 * @param structs  represents all forward declared structs of namespace
 * @param defines  represents all #defines of the namespace
 * @param protos   represents all function prototypes in the namespace
 * @param empty    whether if namespace is nothing but a namespace!
 */
function Namespace(codename) {
	
	this.codename = "";
	this.name     = "";
	this.vendor   = "";
	this.funptrs  = [];
	this.structs  = [];
	this.defines  = [];
	this.protos   = [];
	this.empty    = false;
	
	// Do we have a valid codename ?
	if (codename.indexOf("GL_") < 0) {
		throw "Invalid codename. It should start with GL_ prefix";
	}
	// store the codename
	this.codename = codename.toLowerCase();
	
	if (this.codename.indexOf("version") > 0) {
		// This is not a vendor / extension namespace
		var regex = /gl_version_([0-9])_([0-9])/g;
		var match = regex.exec(this.codename);
		var version_major = match[1];
		var version_minor = match[2];
		this.name = "v" + version_major + version_minor;
	} else {
		// belongs to an extension and has a vendor
		var regex = /gl_([a-z0-9]+)_(.+)/g;
		var match = regex.exec(this.codename);
		var vendor = match[1];
		var extname = match[2];
		this.name = extname;
		this.vendor = vendor;
	}
};<commit_msg>I don't think messing with the original #define is a good idea<commit_after>/*!
 * @class  GlCoreHeader
 * @brief  A singleton class holding information about glcorearb.h
 * @credit http://stackoverflow.com/a/6733919/388751
 * @usage  new GlCoreHeader().GetSource() //returns the source string
 */
function GlCoreHeader() {
	if ( arguments.callee._singletonInstance )
		return arguments.callee._singletonInstance;
	arguments.callee._singletonInstance = this;

	Source = (function() {
		return require('fs').readFileSync('glcorearb.h', 'utf8');
	})();
	
	/*!
	 * \fn     GetSource
	 * \brief  returns the glcorearb.h source code as string
	 * \return string
	 */
	this.GetSource = function() {
		return Source;
	}
}

/*!
 * @class Namespace
 * @brief A class containing information about an OpenGL namespace.
 * @note  Based on what is available in current glcorearb.h, everything
 *        is wrapped inside #ifndef's. Therefore this script assumes a
 *        namespace starts with a #ifndef GL_**.
 *
 * @param codename the original name of the namespace (including GL_)
 * @param name     the actual name of the namespace
 * @param vendor   the vendor name of the namespace (ARB for example)
 * @param funptrs  represents all function pointers inside the namespace
 * @param structs  represents all forward declared structs of namespace
 * @param defines  represents all #defines of the namespace
 * @param protos   represents all function prototypes in the namespace
 * @param empty    whether if namespace is nothing but a namespace!
 */
function Namespace(codename) {
	
	this.codename = "";
	this.name     = "";
	this.vendor   = "";
	this.funptrs  = [];
	this.structs  = [];
	this.defines  = [];
	this.protos   = [];
	this.empty    = false;
	
	// Do we have a valid codename ?
	if (codename.indexOf("GL_") < 0) {
		throw "Invalid codename. It should start with GL_ prefix";
	}
	// store the codename
	this.codename = codename;
	codename = codename.toLowerCase()
	
	if (this.codename.indexOf("version") > 0) {
		// This is not a vendor / extension namespace
		var regex = /gl_version_([0-9])_([0-9])/g;
		var match = regex.exec(codename);
		var version_major = match[1];
		var version_minor = match[2];
		this.name = "v" + version_major + version_minor;
	} else {
		// belongs to an extension and has a vendor
		var regex = /gl_([a-z0-9]+)_(.+)/g;
		var match = regex.exec(codename);
		var vendor = match[1];
		var extname = match[2];
		this.name = extname;
		this.vendor = vendor;
	}
};
{'fraction_non_alphanumeric': 0.11839967506092608, 'fraction_numerical': 0.010560519902518278, 'mean_word_length': 3.477272727272727, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '279048', 'n_tokens_mistral': 1592, 'n_tokens_neox': 1508, 'n_words': 501}