* main.c
*
* Copyright (C) 2015 Alexander Andrejevic <theflash AT sdf DOT lonestar DOT org>
- * Copyright (C) 2015, 2019 Jason Self <j@jxself.org>
+ * Copyright (C) 2015, 2019, 2020 Jason Self <j@jxself.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
+#include <string>
+#include <list>
+#include <stack>
+using namespace std;
+
+
extern "C"
{
#include <strings.h>
}
#include "parser.h"
-#include <string>
-#include <list>
-using namespace std;
+
const int DEFAULT_ZVERSION = 6;
++m_code_size;
// write instructions' codes
- for (int i = 0; i < g_numberOfInstructions; ++i)
+ for (int i = 0; i < g_number_of_instructions; ++i)
{
for (int j = 0; j < g_codes[i]->used_size; ++j)
{
init_parser ();
- for (int i = optind; i < argc; i++)
- parse_file (argv[i]);
- main.assembly ();
+ //for (int i = optind; i < argc; i++)
+ // parse_file(argv[i]);
+
+ string file_name = argv[optind];
+ Parsing_Context pc;
+
+#ifdef WIN32
+ char delimeter = '\\';
+#else
+ char delimeter = '/';
+#endif
+
+ if (file_name.rfind(delimeter) == string::npos)
+ {
+ pc.current_directory = "";
+ pc.current_file_name = file_name;
+ }
+ else
+ {
+ pc.current_directory = file_name.substr(0, file_name.rfind(delimeter)+1);
+ pc.current_file_name = file_name.substr(file_name.rfind(delimeter)+1);
+ }
+ g_parsing_contexts.push(pc);
+
+ parse_file();// argv[optind]);
+ if ( !g_haveErrors )
+ main.assembly ();
/* TODO! List global symbols */
/* TODO! Find abbreviations */