include Update
This commit is contained in:
@@ -4,14 +4,22 @@
|
||||
#include <vector>
|
||||
#include <cstdlib>
|
||||
#include <filesystem>
|
||||
#include <windows.h>
|
||||
#include "compiler_types.h"
|
||||
#include "parser.h"
|
||||
#include "codegen.h"
|
||||
#include "preprocessor.h"
|
||||
|
||||
std::string getExecutablePath() {
|
||||
char buffer[MAX_PATH];
|
||||
GetModuleFileNameA(NULL, buffer, MAX_PATH);
|
||||
std::string::size_type pos = std::string(buffer).find_last_of("\\/");
|
||||
return std::string(buffer).substr(0, pos);
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
std::string inputFile, outputName;
|
||||
std::string Version = "v0.0.3-beta"; // Zaktualizowałem wersję :)
|
||||
std::string Version = "v0.0.5-beta";
|
||||
bool showHelp = false, showVersion = false, showCredits = false;
|
||||
|
||||
// --- PARSOWANIE ARGUMENTÓW ---
|
||||
@@ -77,17 +85,15 @@ int main(int argc, char* argv[]) {
|
||||
// --- PREPROCESSOR START ---
|
||||
std::cout << "[INFO] Preprocessing...\n";
|
||||
|
||||
// 1. Ścieżka projektu (tam gdzie plik wejściowy)
|
||||
std::filesystem::path p(inputFile);
|
||||
std::string basePath = p.parent_path().string();
|
||||
std::string projectDir = p.parent_path().string();
|
||||
|
||||
// Uruchamiamy preprocesor - podmieni #include na kod
|
||||
src = preprocessSource(src, basePath);
|
||||
// 2. Ścieżka kompilatora (tam gdzie PCC.exe i folder std)
|
||||
std::string compilerDir = getExecutablePath();
|
||||
|
||||
// Opcjonalnie: pokaż kod po złączeniu (do debugowania)
|
||||
// std::cout << "--- FINAL CODE ---\n" << src << "\n------------------\n";
|
||||
// --- PREPROCESSOR END ---
|
||||
|
||||
// --- LOGIKA KOMPILATORA (DALEJ BEZ ZMIAN) ---
|
||||
// Uruchamiamy z obiema ścieżkami
|
||||
src = preprocessSource(src, projectDir, compilerDir);
|
||||
CompilerState state;
|
||||
|
||||
std::cout << "[INFO] Parsing code...\n";
|
||||
|
||||
Reference in New Issue
Block a user