<commit_before>--
-- project.lua
-- Premake project object API
-- Copyright (c) 2011-2013 <NAME> and the Premake project
--

	premake.project = {}
	local project = premake.project
	local configset = premake.configset
	local context = premake.context
	local tree = premake.tree


--
-- Create a new project object.
--
-- @param sln
--    The solution object to contain the new project.
-- @param name
--    The new project's name.
-- @return
--    A new project object, contained by the specified solution.
--

	function project.new(sln, name)
		local prj = {}

		prj.name = name
		prj.solution = sln
		prj.script = _SCRIPT

		-- Start a new configuration set to hold this project's info. For
		-- convenience and backward compatibility with the old Premake 3.x
		-- way of doing things, allow the project to be treated like a
		-- regular table.

		local cset = configset.new(sln.configset)
		prj.configset = cset
		setmetatable(prj, configset.metatable(cset))

		-- And set defaults for some of the fields
		prj.basedir = os.getcwd()
		prj.filename = name
		prj.uuid = os.uuid(name)

		return prj
	end


--
-- Returns an iterator function for the configuration objects contained by
-- the project. Each configuration corresponds to a build configuration/
-- platform pair (i.e. "Debug|x32") as specified in the solution.
--
-- @param prj
--    The project object to query.
-- @return
--    An iterator function returning configuration objects.
--

	function project.eachconfig(prj)
		local configs = prj._cfglist
		local count = #configs

		local i = 0
		return function ()
			i = i + 1
			if i <= count then
				return project.getconfig(prj, configs[i][1], configs[i][2])
			end
		end
	end

<commit_msg>Prevent project.eachconfig() from returning duplicate configurations (caused by config maps)<commit_after>--
-- project.lua
-- Premake project object API
-- Copyright (c) 2011-2013 <NAME> and the Premake project
--

	premake.project = {}
	local project = premake.project
	local configset = premake.configset
	local context = premake.context
	local tree = premake.tree


--
-- Create a new project object.
--
-- @param sln
--    The solution object to contain the new project.
-- @param name
--    The new project's name.
-- @return
--    A new project object, contained by the specified solution.
--

	function project.new(sln, name)
		local prj = {}

		prj.name = name
		prj.solution = sln
		prj.script = _SCRIPT

		-- Start a new configuration set to hold this project's info. For
		-- convenience and backward compatibility with the old Premake 3.x
		-- way of doing things, allow the project to be treated like a
		-- regular table.

		local cset = configset.new(sln.configset)
		prj.configset = cset
		setmetatable(prj, configset.metatable(cset))

		-- And set defaults for some of the fields
		prj.basedir = os.getcwd()
		prj.filename = name
		prj.uuid = os.uuid(name)

		return prj
	end


--
-- Returns an iterator function for the configuration objects contained by
-- the project. Each configuration corresponds to a build configuration/
-- platform pair (i.e. "Debug|x32") as specified in the solution.
--
-- @param prj
--    The project object to query.
-- @return
--    An iterator function returning configuration objects.
--

	function project.eachconfig(prj)
		local configs = prj._cfglist
		local count = #configs

		-- Once the configurations are mapped into the solution I could get
		-- the same one multiple times. Make sure that doesn't happen.
		local seen = {}

		local i = 0
		return function ()
			i = i + 1
			if i <= count then
				local cfg = project.getconfig(prj, configs[i][1], configs[i][2])
				if not seen[cfg] then
					seen[cfg] = true
					return cfg
				else
					i = i + 1
				end
			end
		end
	end


{'fraction_non_alphanumeric': 0.09909188034188034, 'fraction_numerical': 0.00827991452991453, 'mean_word_length': 2.852880658436214, 'pattern_counts': {'":': 0, '<': 7, '<?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': '1835811', 'n_tokens_mistral': 1276, 'n_tokens_neox': 1133, 'n_words': 438}