include Update

This commit is contained in:
mmichlol
2026-02-07 11:57:44 +01:00
parent e250b2f5fb
commit 9bbf8435c6
4 changed files with 26 additions and 30 deletions

View File

@@ -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";