<commit_before>/*
* Vool - gnuplot interface using popen/ _popen to pipe data to gnuplot
*
* Copyright (C) 2016 by <NAME> - www.lukas-bergdoll.net
*
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
*/

#include "GNP.h"

#ifdef _WIN32
#define PIPE_OPEN _popen
#define PIPE_CLOSE _pclose
#else
#define PIPE_OPEN popen
#define PIPE_CLOSE pclose
#endif

namespace vool
{

gnuplot::gnuplot(std::string gnuplot_path, const bool persist)
{
	gnuplot_path += persist ? "\\gnuplot -persist" : "\\gnuplot";
	_gnuplot_pipe = PIPE_OPEN(gnuplot_path.c_str(), "w");

	if (_gnuplot_pipe == NULL) // PIPE_OPEN itself failed
		throw std::exception("PIPE_OPEN failed");

	int ret_val = PIPE_CLOSE(_gnuplot_pipe);
	if (ret_val != 0) // command failed
		throw std::exception("gnuplot filepath not found");

	_gnuplot_pipe = PIPE_OPEN(gnuplot_path.c_str(), "w");
}

gnuplot::gnuplot(gnuplot&& other) :
	_gnuplot_pipe(std::move(other._gnuplot_pipe))
{
	other._gnuplot_pipe = nullptr; // indicate that it was moved
}
<commit_msg>Removed unnecessary variable in gnuplot constructor<commit_after>/*
* Vool - gnuplot interface using popen/ _popen to pipe data to gnuplot
*
* Copyright (C) 2016 by <NAME> - www.lukas-bergdoll.net
*
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
*/

#include "GNP.h"

#ifdef _WIN32
#define PIPE_OPEN _popen
#define PIPE_CLOSE _pclose
#else
#define PIPE_OPEN popen
#define PIPE_CLOSE pclose
#endif

namespace vool
{

gnuplot::gnuplot(std::string gnuplot_path, const bool persist)
{
	gnuplot_path += persist ? "\\gnuplot -persist" : "\\gnuplot";
	_gnuplot_pipe = PIPE_OPEN(gnuplot_path.c_str(), "w");

	if (_gnuplot_pipe == NULL) // PIPE_OPEN itself failed
		throw std::exception("PIPE_OPEN failed");

	if (PIPE_CLOSE(_gnuplot_pipe) != 0) // command failed
		throw std::exception("gnuplot filepath not found");

	_gnuplot_pipe = PIPE_OPEN(gnuplot_path.c_str(), "w");
}

gnuplot::gnuplot(gnuplot&& other) :
	_gnuplot_pipe(std::move(other._gnuplot_pipe))
{
	other._gnuplot_pipe = nullptr; // indicate that it was moved
}

{'fraction_non_alphanumeric': 0.13022813688212928, 'fraction_numerical': 0.006653992395437262, 'mean_word_length': 5.137026239067056, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4830458', 'n_tokens_mistral': 795, 'n_tokens_neox': 762, 'n_words': 194}