summaryrefslogtreecommitdiffhomepage
path: root/CompilerFrontend/cl
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-09 21:47:33 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-09 21:47:33 +0100
commit9cef856478cebe4bfe00e1d39c9e2d49015dd0e4 (patch)
treef04c6b6b1156057748c7044a766120485c45c885 /CompilerFrontend/cl
parenta8a55bc93e06cd8f75f7d397c013f7a312ea29a4 (diff)
MP-UX/hCore Assembler for 64x0, Release I.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'CompilerFrontend/cl')
-rw-r--r--CompilerFrontend/cl/.gitignore17
-rw-r--r--CompilerFrontend/cl/.gitkeep0
-rw-r--r--CompilerFrontend/cl/bin/.gitkeep0
-rw-r--r--CompilerFrontend/cl/compiler.d137
-rw-r--r--CompilerFrontend/cl/main.d112
-rw-r--r--CompilerFrontend/cl/makefile13
-rw-r--r--CompilerFrontend/cl/man/mpcc.811
-rw-r--r--CompilerFrontend/cl/test/.gitkeep0
8 files changed, 0 insertions, 290 deletions
diff --git a/CompilerFrontend/cl/.gitignore b/CompilerFrontend/cl/.gitignore
deleted file mode 100644
index b8f5db3..0000000
--- a/CompilerFrontend/cl/.gitignore
+++ /dev/null
@@ -1,17 +0,0 @@
-bin/elf2pef
-bin/ld
-bin/cpp
-bin/cc
-bin/masm
-bin/mkcdfs
-bin/ccplus
-bin/cppfront
-bin/bccl
-bin/bpp
-test/*.cc
-test/*.64x
-*.c.pp
-*.cxx.pp
-test/*.c
-test/*.masm
-*.pp \ No newline at end of file
diff --git a/CompilerFrontend/cl/.gitkeep b/CompilerFrontend/cl/.gitkeep
deleted file mode 100644
index e69de29..0000000
--- a/CompilerFrontend/cl/.gitkeep
+++ /dev/null
diff --git a/CompilerFrontend/cl/bin/.gitkeep b/CompilerFrontend/cl/bin/.gitkeep
deleted file mode 100644
index e69de29..0000000
--- a/CompilerFrontend/cl/bin/.gitkeep
+++ /dev/null
diff --git a/CompilerFrontend/cl/compiler.d b/CompilerFrontend/cl/compiler.d
deleted file mode 100644
index e9d2cc8..0000000
--- a/CompilerFrontend/cl/compiler.d
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * ========================================================
- *
- * MP-UX C Compiler
- * Copyright Mahrouss Logic, all rights reserved.
- *
- * ========================================================
- */
-
-module mpcc.compiler;
-
-///Authors: amlel
-///Bugs: None
-///Compiler Frontend
-
-import std.stdio;
-
-public void mpcc_summon_executable(string path)
-{
- import core.stdc.stdlib;
- import std.string;
-
- system(toStringz(path));
-}
-
-public class Platform
-{
- public static string getIncludePath()
- {
- import core.stdc.stdlib;
- import std.string;
- import std.conv;
- import std.path;
-
- string pathHome = expandTilde("~");
- pathHome ~= "/mp-ux/libc/";
-
- return pathHome;
- }
-
- public static string getKernelPath()
- {
- import core.stdc.stdlib;
- import std.string;
- import std.conv;
- import std.path;
-
- string pathHome = expandTilde("~");
- pathHome ~= "/mp-ux/mp-ux/";
-
- return pathHome;
- }
-}
-
-public class CompileCommand
-{
- public void compile(string includePath, string[] files, bool is_lib, string output, bool compile_only)
- {
- import std.string;
- import std.algorithm;
-
- foreach (file; files)
- {
- if (file.length == 0)
- continue;
-
- import std.datetime;
-
- mpcc_summon_executable("/usr/local/bin/bin/cpp --define __64x0__ 1 --define __LP64__ 1 --define __64000__ 1 --define __BCCL__ 1 " ~
- "--define __FILE__ " ~ file ~ " --define __DATE__ " ~ Clock.currTime(UTC()).toString()
- ~ " " ~
- " --working-dir ./ --include-dir " ~ includePath ~ " " ~ file);
-
- string changed;
- string ext;
- bool ext_now = false;
-
- foreach (ch; file)
- {
- if (ch == '.')
- {
- ext_now = true;
- break;
- }
-
- if (!ext_now)
- changed ~= ch;
- else
- ext ~= ch;
- }
-
- mpcc_summon_executable("/usr/local/bin/bin/bccl --asm=masm -fmax-exceptions 20 --compiler=dolvik " ~
- file ~ ".pp");
-
- changed ~= ".64x";
-
- mpcc_summon_executable("/usr/local/bin/bin/masm -m64000 " ~ changed);
- }
-
- if (compile_only)
- return;
-
- string obj;
-
- foreach (file; files)
- {
- if (file.length == 0)
- continue;
-
- string changed;
-
- foreach (ch; file)
- {
- if (ch == '.')
- break;
-
- changed ~= ch;
- }
-
- changed ~= ".o ";
-
- obj ~= changed;
- }
-
- string shlib_enable = "";
-
- if (is_lib)
- shlib_enable = " -shared ";
-
- string output_object = shlib_enable;
- output_object ~= " -o ";
- output_object ~= output;
-
- mpcc_summon_executable("/usr/local/bin/bin/ld -m64000 " ~
- obj ~ output_object);
- }
-} \ No newline at end of file
diff --git a/CompilerFrontend/cl/main.d b/CompilerFrontend/cl/main.d
deleted file mode 100644
index aabc0ff..0000000
--- a/CompilerFrontend/cl/main.d
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * ========================================================
- *
- * MP-UX C Compiler
- * Copyright Mahrouss Logic, all rights reserved.
- *
- * ========================================================
- */
-
-// @file main.d
-// @brief CLI of the X64000 C/C++ compiler
-
-module mpcc.main;
-
-import mpcc.compiler;
-import std.container.dlist;
-
-///Authors: Amlal EL Mahrouss
-///Examples: mpcc_summon_manual("foo");
-void mpcc_summon_manual(string path)
-{
- import core.stdc.stdlib;
- import std.string;
- import std.file;
-
- string base = "man ";
- base ~= "/usr/local/bin/man/";
-
- string extension = ".8";
-
- core.stdc.stdlib.system(toStringz(base ~ path ~ extension));
-}
-
-void main(string[] args)
-{
- import std.range, std.stdio;
-
- bool shared_library = false;
- bool compile_only = false;
- bool kernel_driver = false;
- string output_file = "a.out";
- size_t index = 0UL;
-
- string[255] args_list;
-
- foreach (arg ; args)
- {
- if (arg[0] == '-')
- {
- if (arg == "--version" ||
- arg == "-v")
- {
- writeln("mpcc: version 1.01, (c) Mahrouss Logic all rights reserved.");
- return;
- }
- else if (arg == "--dialect")
- {
- mpcc_summon_executable("/usr/local/bin/bin/cc --asm=masm --compiler=dolvik --dialect");
- return;
- }
- else if (arg == "--help" ||
- arg == "-h")
- {
- writeln("mpcc: summoning manual entry for mpcc...");
- mpcc_summon_manual("mpcc");
-
- return;
- }
- else if (arg == "-c")
- {
- compile_only = true;
- continue;
- }
- else if (arg == "-kernel")
- {
- kernel_driver = true;
- continue;
- }
- else if (arg == "-shared")
- {
- output_file = "a.lib";
- shared_library = true;
- continue;
- }
-
- writeln("mpcc: unknown argument " ~ arg);
- return;
- }
-
- if (index == 0)
- {
- ++index;
- continue;
- }
-
- args_list[index] = arg;
- ++index;
- }
-
- if (args_list[1] == null)
- {
- writeln("mpcc: no input files.");
- return;
- }
-
- auto compiler = new CompileCommand();
-
- if (kernel_driver)
- compiler.compile(Platform.getKernelPath(), args_list, shared_library, output_file, compile_only);
- else
- compiler.compile(Platform.getIncludePath(), args_list, shared_library, output_file, compile_only);
-} \ No newline at end of file
diff --git a/CompilerFrontend/cl/makefile b/CompilerFrontend/cl/makefile
deleted file mode 100644
index a2bc3d1..0000000
--- a/CompilerFrontend/cl/makefile
+++ /dev/null
@@ -1,13 +0,0 @@
- #
- # ========================================================
- #
- # MP-UX C Compiler
- # Copyright Mahrouss Logic, all rights reserved.
- #
- # ========================================================
- #
-
-# build mpcc
-.PHONY: mpcc-build
-mpcc-build:
- dmd -I../ $(wildcard *.d) -ofmpcc \ No newline at end of file
diff --git a/CompilerFrontend/cl/man/mpcc.8 b/CompilerFrontend/cl/man/mpcc.8
deleted file mode 100644
index d362e5a..0000000
--- a/CompilerFrontend/cl/man/mpcc.8
+++ /dev/null
@@ -1,11 +0,0 @@
-.Dd Dec 16, 2023
-.Dt mpcc 1.11
-.Os MP-UX
-
-.Sh NAME
-.Nm mcc
-.Nd Mahrouss Logic BCCL/C++ Compiler
-
-.Sh DESCRIPTION
-
-This program compiles BCCL/C++ sources into MP-UX Preferred Executable Format. \ No newline at end of file
diff --git a/CompilerFrontend/cl/test/.gitkeep b/CompilerFrontend/cl/test/.gitkeep
deleted file mode 100644
index e69de29..0000000
--- a/CompilerFrontend/cl/test/.gitkeep
+++ /dev/null