<commit_before>#include "SimpleInst.h"
#include "AdvancedInst.h"
#include "File.h"
#include "Exception.h"

using namespace std;

int main(int argc, char* argv[])
{
	//cout << argc << endl; //Number of Params
	//cout << argv[0] << endl; //Path to executable
	//cout << argv[1] << endl; //Any subsequent params

	string usage = "usage: ./myAssembler [--help] <filename-path> [-d <depth>] [-h] [-v] [-o <name>]";

	if (argc < 2)
	{
		cout << usage << endl;
		return -1;
	}

	string inFileName = argv[1];
	string outFileName = "mc.mif";

	string temp;
	string temp2;
	string width = "1";
	string depth = "256";
	string mode = "";

	//Make it so user can do ./myAssembler --help without error about no input file!

	if (inFileName == "--help")
	{
		cout 		<< usage << endl 
					<< endl
					<< "Options:" << endl
					<< "--help\t\tDisplay available options" << endl
					<< "-d <value>\tSet the depth of the .mif file" << endl
					<< "-h\t\tSet the architecture mode to Harvard" << endl
					<< "-o <name>\tSpecify the output file name" << endl
					<< "-v\t\tSet the architecture mode to Von Neumann" << endl;
		return -1;
	}

	for (int i = 2; i < argc; i++)
	{
		temp = argv[i];

		if (temp == "-d")
		{

			if ((i+1) >= argc)
			{
				cout << "myAssembler: error: missing argument for -d" << endl;
				return -1;
			}

			temp2 = argv[i+1];

			if (!isDigits(temp2))
			{
				cout << "myAssembler: error: invalid argument for -d: '" << temp2 << "'" << endl;
				return -1;
			}

			depth = temp2;
		
			i++;
		}

		else if (temp == "-o")
		{
			if ( (i+1) >= argc)
			{
				cout << "myAssembler: error: missing argument for -o" << endl;
				return -1;
			}

			temp2 = argv[i+1];

			outFileName = temp2;
		
			i++;
		}

		else if (temp == "-h")
		{
			if (mode != "")
			{
				cout << "myAssembler: error: cannot use both [-h] and [-v]" << endl;
				return -1;
			}
			mode = "h";
			//cout << "Set mode: " << mode << endl;
		}

		else if (temp == "-v")
		{
			if (mode != "")<commit_msg>Added output file name tag<commit_after>#include "SimpleInst.h"
#include "AdvancedInst.h"
#include "File.h"
#include "Exception.h"

using namespace std;

int main(int argc, char* argv[])
{
	//cout << argc << endl; //Number of Params
	//cout << argv[0] << endl; //Path to executable
	//cout << argv[1] << endl; //Any subsequent params

	string usage = "usage: ./myAssembler [--help] <filename-path> [-d <depth>] [-h] [-v] [-o <name>]";

	if (argc < 2)
	{
		cout << usage << endl;
		return -1;
	}

	string inFileName = argv[1];
	string outFileName = "mc.mif";

	string temp;
	string temp2;
	string width = "1";
	string depth = "256";
	string mode = "";

	//Make it so user can do ./myAssembler --help without error about no input file!

	if (inFileName == "--help")
	{
		cout 		<< usage << endl 
					<< endl
					<< "Options:" << endl
					<< "--help\t\tDisplay available options" << endl
					<< "-d <value>\tSet the depth of the .mif file" << endl
					<< "-h\t\tSet the architecture mode to Harvard" << endl
					<< "-o <name>\tSpecify the output file name" << endl
					<< "-v\t\tSet the architecture mode to Von Neumann" << endl;
		return -1;
	}

	for (int i = 2; i < argc; i++)
	{
		temp = argv[i];

		if (temp == "-d")
		{
			//Checks to see if there is an argument after the -d
			if ((i+1) >= argc)
			{
				cout << "myAssembler: error: missing argument for -d" << endl;
				return -1;
			}

			temp2 = argv[i+1];

			//Checks to see if the argument for -d is purely numbers
			if (!isDigits(temp2))
			{
				cout << "myAssembler: error: invalid argument for -d: '" << temp2 << "'" << endl;
				return -1;
			}

			depth = temp2;
		
			i++;
		}

		else if (temp == "-o")
		{
			//Checks to see if there is a argument after the -o
			if ( (i+1) >= argc)
			{
				cout << "myAssembler: error: missing argument for -o" << endl;
				return -1;
			}

			outFileName = argv[i+1];

			//If filename does not contain .mif, this adds it in.
			if (outFileName.compare(outFileName.size()-4,4,".mif") != 0)
			{
				outFileName.insert(outFileName.size(),".mif");
			}
		
			i++;
		}

		else if (temp == "-h")
		{
			if (mode != "")
			{
				cout << "myAssembler: error: cannot use both [-h] and [-v]" << endl;
				return -1;
			}
			mode = "h";
			//cout << "Set mode: " << mode << endl;
		}

		else if (temp == "-v")
		{
			if (mode != "")
{'fraction_non_alphanumeric': 0.18973884908712735, 'fraction_numerical': 0.012248671134735382, 'mean_word_length': 2.3945098039215686, 'pattern_counts': {'":': 0, '<': 161, '<?xml version=': 0, '>': 17, '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': '4271249', 'n_tokens_mistral': 1880, 'n_tokens_neox': 1579, 'n_words': 507}