summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--Makefile23
-rw-r--r--README.html45
-rw-r--r--changelog.html32
-rw-r--r--examples/example0.luma29
-rw-r--r--include/luma.hh10
-rw-r--r--old/include/luma/main.hh (renamed from include/luma/main.hh)4
-rw-r--r--old/initgfx.cc52
-rw-r--r--old/isvkphysdevvalid.cc5
-rw-r--r--old/setdispsrvproto.cc35
-rw-r--r--old/src/luma/app_t/app_t.cc (renamed from src/luma/app_t/app_t.cc)18
-rw-r--r--old/src/luma/app_t/archstr.cc (renamed from src/luma/app_t/archstr.cc)0
-rw-r--r--old/src/luma/app_t/arghandl.cc (renamed from src/luma/app_t/arghandl.cc)0
-rw-r--r--old/src/luma/app_t/dbgmsgf.cc (renamed from src/luma/app_t/dbgmsgf.cc)0
-rw-r--r--old/src/luma/app_t/exit.cc (renamed from src/luma/app_t/exit.cc)0
-rw-r--r--old/src/luma/app_t/getenv.cc (renamed from src/luma/app_t/getenv.cc)0
-rw-r--r--old/src/luma/app_t/kernelstr.cc (renamed from src/luma/app_t/kernelstr.cc)0
-rw-r--r--old/src/luma/app_t/msgf.cc8
-rw-r--r--old/src/luma/app_t/msgferr.cc (renamed from src/luma/app_t/msgferr.cc)2
-rw-r--r--old/src/luma/app_t/msgfout.cc (renamed from src/luma/app_t/msgfout.cc)2
-rw-r--r--old/src/luma/app_t/strcmp.cc (renamed from src/luma/app_t/strcmp.cc)0
-rw-r--r--old/src/luma/app_t/strcut.cc (renamed from src/luma/app_t/strcut.cc)0
-rw-r--r--old/src/luma/app_t/strlen.cc (renamed from src/luma/app_t/strlen.cc)0
-rw-r--r--old/src/main.cc6
-rw-r--r--old/stdlibsock__gfx__crtwin.cc30
-rw-r--r--old/stdlibsock__gfx__destwin.cc4
-rw-r--r--old/termgfx.cc13
-rw-r--r--src/luma/app_t/msgf.cc7
-rw-r--r--src/luma/arghandl.cc14
-rw-r--r--src/luma/luma.cc36
-rw-r--r--src/main.cc6
-rw-r--r--stdlib/std/fopen.luma1
-rw-r--r--stdlib/std/fwrite.luma1
-rw-r--r--stdlib/std/msgfout.luma2
-rw-r--r--test.luma5
35 files changed, 157 insertions, 235 deletions
diff --git a/.gitignore b/.gitignore
index e494714..98f5968 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,2 @@
-*.elf
+*.bin
*.o
diff --git a/Makefile b/Makefile
index 24f0be4..70a334a 100644
--- a/Makefile
+++ b/Makefile
@@ -8,27 +8,16 @@ CXXFLAGS += -DLUMA__X=true
endif
CXXFLAGS += -std=c++20 -Wall -Wextra -Wpedantic
CXXFLAGS += -march=native -mtune=native -O3
-LDFLAGS = -lgmp -lmpfr -lpthread -lvulkan -lwayland-client -lxcb
+LDFLAGS = -lfmt -lgmp -lmpfr -lpthread -lvulkan -lwayland-client -lxcb
HDRS_CXX = \
- include/luma/main.hh
+ include/luma.hh
SRCS_CXX = \
- src/luma/app_t/app_t.cc \
- src/luma/app_t/archstr.cc \
- src/luma/app_t/arghandl.cc \
- src/luma/app_t/dbgmsgf.cc \
- src/luma/app_t/exit.cc \
- src/luma/app_t/getenv.cc \
- src/luma/app_t/msgf.cc \
- src/luma/app_t/msgferr.cc \
- src/luma/app_t/msgfout.cc \
- src/luma/app_t/kernelstr.cc \
- src/luma/app_t/strcmp.cc \
- src/luma/app_t/strcut.cc \
- src/luma/app_t/strlen.cc \
- src/main.cc
+ src/main.cc \
+ src/luma/luma.cc \
+ src/luma/arghandl.cc
SRCS=$(SRCS_CXX)
OBJS=$(SRCS:.cc=.o)
-luma.elf: $(OBJS)
+luma.bin: $(OBJS)
$(CXX) $(LDFLAGS) -o $@ $(OBJS)
$(OBJS): $(HDRS_CXX) $(SRCS_CXX)
.PHONY: clean
diff --git a/README.html b/README.html
index 1d544e5..ffbd9fb 100644
--- a/README.html
+++ b/README.html
@@ -2,20 +2,6 @@
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
- <style type="text/css">
- body {
- margin: 0vw auto;
- padding: 0vw;
- text-align: center;
- width: 75vw;
- }
- h1 {
- font-size: 1.5em;
- }
- h2 {
- font-size: 1.25em;
- }
- </style>
</head>
<body>
<p style="font-size:0.75em;">Copyright 2021 Gabriel Jensen</p>
@@ -25,36 +11,5 @@
See the GNU Affero General Public License for more details.</p>
<p>You should have received a copy of the GNU Affero General Public License along with this program.</p>
<p>If not, see <a href="https://www.gnu.org/licenses/">https://www.gnu.org/licenses/</a>.</p>
- <h1>INTRODUCTION</h1>
- <p>TO-DO: Write short introduction to the programming language and the reasons it was made.</p>
- <h2>CODING PRINCIPLES</h2>
- <p>Luma has the following coding principles:</p>
- <p>TO-DO: Write down the principles.</p>
- <h2>IMPORTANT FORMATING INFORMATION ABOUT LITERALS</h2>
- <p>Luma is morden in the sense it breaks free of traditions which, more often than not, are from the beginning of the age of the computer.</p>
- <p>To begin with, integral literals are written in base-twelve.</p>
- <p>The number 10 would be written as ↊ (U+218A ↊ Turned Digit Two), and the number 11 would be written as ↋ (U+218B ↋ Turned Digit Three).</p>
- <p>They are also written as little-endian, so numbers increment to the right instead of the left.</p>
- <p>Down below is a short conversion table for how integral literals must be written:</p>
- <p>TO-DO: Create conversion table.</p>
- 8 -> 8
- 9 -> 9
- 10 -> ↊
- 11 -> ↋
- 12 -> 01
- 13 -> 11
- 14 -> 21
- 15 -> 31
- 16 -> 41
- 100 -> 48
- 120 -> 0↊
- 132 -> 0↋
- 144 -> 001
- 156 -> 011
- 168 -> 021
- 1000 -> 4↋6
- 1728 -> 0001
- <p>And lastly integral literals must have the '#' (U+0023 # NUMBER SIGN) prefix.</p>
-
</body>
</html>
diff --git a/changelog.html b/changelog.html
new file mode 100644
index 0000000..50acfd2
--- /dev/null
+++ b/changelog.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ </head>
+ <body>
+ <h1>12</h1>
+ <ul>
+ <li>Add "changelog.html" to keep track of changes.</li>
+ <li>Remove deprecated gfx library files.</li>
+ <li>Fix PGKBUILD version not considering version 0.</li>
+ <li>Add new language example.</li>
+ <li>Begin rewrite of entire codebase.<\li>
+ <li>Move old codebase into the "old" folder.</li>
+ <li>Begin creation Luma stdlib API.</li>
+ <li>Build "luma.bin" file instead of "luma.elf".</li>
+ </ul>
+ <h1>11</h1>
+ <h1>↋</h1>
+ <h1>↊</h1>
+ <h1>9</h1>
+ <h1>8</h1>
+ <h1>7</h1>
+ <h1>6</h1>
+ <h1>5</h1>
+ <h1>4</h1>
+ <h1>3</h1>
+ <h1>2</h1>
+ <h1>1</h1>
+ <h1>0</h1>
+ </body>
+</html>
diff --git a/examples/example0.luma b/examples/example0.luma
index 8a7f9c8..4e72a9a 100644
--- a/examples/example0.luma
+++ b/examples/example0.luma
@@ -1,17 +1,12 @@
-\ '\' defines single-line comments.
-\<
- '\<' followed by '\>' defines multi-line comments.
- The contents of multi-line comments must be indented.
- Indentation is always a tab in Luma.
-\>
-\ Modules are automaticly imported by the interpreter.
-\ Modules are folders with source code. Each source file contains the definition of the name of the file.
-\ /gfx/win_t (example module) will be defined in the file win_t.luma which itself is inside the gfx folder.
-\ This makes is easy for the interpreter to find the definitions. Therefore, each file in a module must only contain one definition.
-\ This has the drawback of making single-file programs impossible if they want to utilize non-centralized modules.
-\ A fix to this is to put the source files in an archive (like a Tarball), which is already a standard thing to do.
-\ Define variable main of type void_t as function that doesn't return.
-void_t:main -fn [] -noret
- // Use '$' followed by a dozenal number to
- /std/fout "1 + 1 = $0" (#1 + #1)
- exit
+def fn /std/void [/std/int28 argc | /std/arr /std/str args] -noret main
+ ifeq argc #3 args.#1 “Hello” args.#2 “there!”
+ call /std/fout [“General Kenobi?” | $000A]
+ else
+ def var /std/int28 iter
+ loop @iter
+ ifeq iter #10
+ brk
+ call /std/fout [“Luma FTW!” | $000A]
+ call /std/fout [“"Luma FTW!" should have been written 10 times.” | $000A]
+ exit #0
+X
diff --git a/include/luma.hh b/include/luma.hh
new file mode 100644
index 0000000..2378e82
--- /dev/null
+++ b/include/luma.hh
@@ -0,0 +1,10 @@
+#if !defined(LUMA__HEADER)
+# define LUMA__HEADER
+class luma {
+public:
+ [[noreturn]] luma(int const argc,char const * * argv);
+ ~luma();
+private:
+ void arghandl(int const argc, char const * * argv);
+};
+# endif
diff --git a/include/luma/main.hh b/old/include/luma/main.hh
index a3f196d..1061e10 100644
--- a/include/luma/main.hh
+++ b/old/include/luma/main.hh
@@ -1,6 +1,6 @@
# if !defined(LUMA__HEADER__MAIN)
# define LUMA__HEADER__MAIN
-# include <vector>
+# include <cstddef>
// constexpr -> const -> normal
// typedef -> enum class -> class -> operator -> variable -> function
namespace luma {
@@ -79,7 +79,7 @@ namespace luma {
[[noreturn]] void exit() noexcept;
//template<typename T,typename ... Args>
//void msgf(char const * msg, Args const & ... args);
- void msgf(int pipe,char const * buf);
+ void msgf(int pipe,char const * buf,std::size_t count);
void msgferr(char const * buf);
void msgfout(char const * buf);
};
diff --git a/old/initgfx.cc b/old/initgfx.cc
deleted file mode 100644
index ffaf1e5..0000000
--- a/old/initgfx.cc
+++ /dev/null
@@ -1,52 +0,0 @@
-# include <luma/main.hh>
-# include <vulkan/vulkan.h>
-# include <wayland-client.h>
-# include <xcb/xcb.h>
-void luma::app_t::initgfx() {
- this->gfxisinit = true;
- // Determine if X should be used or if Wayland is da way.
- this->setdispsrvproto();
- if(this->dispsrvproto == this->dispsrvproto_t::x) {
- this->dbgmsg("Creating X connection... ");
- this->xconn = xcb_connect(nullptr,nullptr);
- this->xscrn = xcb_setup_roots_iterator(xcb_get_setup(this->xconn)).data;
- this->xwin = xcb_generate_id(this->xconn);
- this->dbgmsg("O.K.\n");
- }
- else {
- this->dbgmsg("Creating Wayland connection... ");
- this->wldisp = wl_display_connect(nullptr);
- if(this->wldisp == nullptr) {
- this->dbgmsg("Error\n");
- }
- else {
- this->dbgmsg("O.K.\n");
- }
- }
- // Set data required by Vulkan.
- this->vkappinf.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
- this->vkappinf.pApplicationName = "Luma Standard Library";
- this->vkappinf.pEngineName = "Luma Standard Library";
- this->vkinstcrtinf.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
- this->vkinstcrtinf.pApplicationInfo = &this->vkappinf;
- this->vkinstcrtinf.enabledLayerCount = 0x0;
- this->dbgmsg("Creating Vulkan instance... ");
- this->vkreslt = vkCreateInstance(&this->vkinstcrtinf,nullptr,&this->vkinst);
- if(this->vkreslt == VK_SUCCESS) {
- this->dbgmsg("O.K.\n");
- }
- else {
- this->dbgmsg("Error\n");
- }
- int extcount = 0x0;
- this->vkexts = std::vector<VkExtensionProperties>(extcount);
- ::vkEnumerateInstanceExtensionProperties(nullptr,&extcount,this->vkexts.data());
- //this->dbgmsg(std::basic_string<char_t> {std::to_string(extcount) + " Vulkan extensions supported.\n"}.c_str());
- this->dbgmsg("The following Vulkan extensions are supported:\n");
- for(auto const & ext : this->vkexts) {
- this->dbgmsg(ext.extensionName);
- }
- int devcount = 0x0;
- ::vkEnumeratePhysicalDevices(this->vkinst,&devcount,this->vkphysdevs.data());
- //this->dbgmsg(std::basic_string<char> {std::to_string(devcount) + " Vulkan-compatible device(s) found.\n"}.c_str());
-}
diff --git a/old/isvkphysdevvalid.cc b/old/isvkphysdevvalid.cc
deleted file mode 100644
index 27a169b..0000000
--- a/old/isvkphysdevvalid.cc
+++ /dev/null
@@ -1,5 +0,0 @@
-# include <luma/main.hh>
-# include <vulkan/vulkan.h>
-//isVulkanPhysicalDeviceValid
-void luma::app_t::isvkphysdevvalid(VkPhysicalDevice & dev) {
-}
diff --git a/old/setdispsrvproto.cc b/old/setdispsrvproto.cc
deleted file mode 100644
index a423ccc..0000000
--- a/old/setdispsrvproto.cc
+++ /dev/null
@@ -1,35 +0,0 @@
-# include <luma/main.hh>
-void luma::app_t::setdispsrvproto() {
- this->dispsrvproto = this->dispsrvproto_t::wayland;
-# if 0
- char const * envval = this->getenv("LUMA__DISPSRVPROTO");
- if(envval != "") {
- if(envval == "x") {
- this->dbgmsg("Setting the display server protocol to X.\n");
- this->dispsrvproto = this->dispsrvproto_t::x;
- }
- else if(envval == "wayland") {
- this->dbgmsg("Setting the display server protocol to Wayland.\n");
- this->dispsrvproto = this->dispsrvproto_t::wayland;
- }
- else {
- //std::cerr << "$LUMA__DISPSRVPROTO is set to \"" + envval + "\", which is an unrecognized display server protocol.\n";
- }
- }
- else {
- this->dbgmsg("Getting current display server protocol.\n");
- std::string xdgsesstype = std::getenv("XDG_SESSION_TYPE");
- if(xdgsesstype == "wayland") {
- this->dbgmsg("It appears to be Wayland.\n");
- this->dispsrvproto = this->dispsrvproto_t::wayland;
- }
- else if(xdgsesstype == "x11") {
- this->dbgmsg("It appears to be X.\n");
- this->dispsrvproto = this->dispsrvproto_t::x;
- }
- else {
- this->dbgmsg("Error\n");
- }
- }
-# endif
-}
diff --git a/src/luma/app_t/app_t.cc b/old/src/luma/app_t/app_t.cc
index 0c311d6..c650071 100644
--- a/src/luma/app_t/app_t.cc
+++ b/old/src/luma/app_t/app_t.cc
@@ -1,4 +1,5 @@
# include <fcntl.h>
+# include <iostream>
# include <luma/main.hh>
# include <unistd.h>
luma::app_t::app_t(int const argc,char const * * argv) {
@@ -18,7 +19,21 @@ luma::app_t::app_t(int const argc,char const * * argv) {
this->msgfout(this->kernelstr(this->kernel));
if(!::access(argv[0x1],R_OK)) {
int lumafile = ::open(argv[0x1],O_RDONLY);
-//char8_t const * validtoks = "\t 2abcdefghijklmnopqrstuvwxyz0123456789#()*+<=>×÷↊↋−≠⋜⋝\n";
+ for(int line = 0x0,pos = 0x0;;++pos) {
+ char * tok;
+ ::read(lumafile,&tok,0x1);
+ this->msgfout("Here?\n");
+ std::cout << line << ":" << pos << "=" << "\u000A";
+ int pipe = ::open("/dev/stdout",O_WRONLY);
+ this->msgf(pipe,tok,0x4);
+ if(this->strcmp(tok,"\u000A") == 0x0) {
+ ++line;
+ }
+ else if(this->strcmp(tok,"\u0061") == 0x0) {
+ this->msgfout("\'a\' detected!");
+ }
+ }
+ /*
char const * toks[] = {
"\u0009", // Horizontal Tabulation
"\u000A", // New Line (Nl)
@@ -68,6 +83,7 @@ luma::app_t::app_t(int const argc,char const * * argv) {
"\u2264", // Less-Than or Equal To
"\u2265", // Greater-Than or Equal To
};
+ */
}
else {
this->msgferr("The file doesn\'t exist.\n");
diff --git a/src/luma/app_t/archstr.cc b/old/src/luma/app_t/archstr.cc
index 57b32dc..57b32dc 100644
--- a/src/luma/app_t/archstr.cc
+++ b/old/src/luma/app_t/archstr.cc
diff --git a/src/luma/app_t/arghandl.cc b/old/src/luma/app_t/arghandl.cc
index 74a63ed..74a63ed 100644
--- a/src/luma/app_t/arghandl.cc
+++ b/old/src/luma/app_t/arghandl.cc
diff --git a/src/luma/app_t/dbgmsgf.cc b/old/src/luma/app_t/dbgmsgf.cc
index fe0631c..fe0631c 100644
--- a/src/luma/app_t/dbgmsgf.cc
+++ b/old/src/luma/app_t/dbgmsgf.cc
diff --git a/src/luma/app_t/exit.cc b/old/src/luma/app_t/exit.cc
index 8a975e6..8a975e6 100644
--- a/src/luma/app_t/exit.cc
+++ b/old/src/luma/app_t/exit.cc
diff --git a/src/luma/app_t/getenv.cc b/old/src/luma/app_t/getenv.cc
index 2c1b3f4..2c1b3f4 100644
--- a/src/luma/app_t/getenv.cc
+++ b/old/src/luma/app_t/getenv.cc
diff --git a/src/luma/app_t/kernelstr.cc b/old/src/luma/app_t/kernelstr.cc
index 9b326bd..9b326bd 100644
--- a/src/luma/app_t/kernelstr.cc
+++ b/old/src/luma/app_t/kernelstr.cc
diff --git a/old/src/luma/app_t/msgf.cc b/old/src/luma/app_t/msgf.cc
new file mode 100644
index 0000000..cf61c98
--- /dev/null
+++ b/old/src/luma/app_t/msgf.cc
@@ -0,0 +1,8 @@
+# include <cstddef>
+# include <luma/main.hh>
+# include <unistd.h>
+void luma::app_t::msgf(int pipe,char const * msg,std::size_t count) {
+ if(::write(pipe,msg,count) < 0x0) {
+ // ???
+ }
+}
diff --git a/src/luma/app_t/msgferr.cc b/old/src/luma/app_t/msgferr.cc
index 4feb608..f5bf60c 100644
--- a/src/luma/app_t/msgferr.cc
+++ b/old/src/luma/app_t/msgferr.cc
@@ -1,4 +1,4 @@
# include <luma/main.hh>
void luma::app_t::msgferr(char const * msg) {
- this->msgf(this->stderr,msg);
+ this->msgf(this->stderr,msg,this->strlen(msg));
}
diff --git a/src/luma/app_t/msgfout.cc b/old/src/luma/app_t/msgfout.cc
index 92556ce..3373d51 100644
--- a/src/luma/app_t/msgfout.cc
+++ b/old/src/luma/app_t/msgfout.cc
@@ -1,4 +1,4 @@
# include <luma/main.hh>
void luma::app_t::msgfout(char const * msg) {
- this->msgf(this->stdout,msg);
+ this->msgf(this->stdout,msg,this->strlen(msg));
}
diff --git a/src/luma/app_t/strcmp.cc b/old/src/luma/app_t/strcmp.cc
index ce8e082..ce8e082 100644
--- a/src/luma/app_t/strcmp.cc
+++ b/old/src/luma/app_t/strcmp.cc
diff --git a/src/luma/app_t/strcut.cc b/old/src/luma/app_t/strcut.cc
index 233c47f..233c47f 100644
--- a/src/luma/app_t/strcut.cc
+++ b/old/src/luma/app_t/strcut.cc
diff --git a/src/luma/app_t/strlen.cc b/old/src/luma/app_t/strlen.cc
index a4c9ba6..a4c9ba6 100644
--- a/src/luma/app_t/strlen.cc
+++ b/old/src/luma/app_t/strlen.cc
diff --git a/old/src/main.cc b/old/src/main.cc
new file mode 100644
index 0000000..7bca331
--- /dev/null
+++ b/old/src/main.cc
@@ -0,0 +1,6 @@
+# include <fcntl.h>
+# include <luma/main.hh>
+# include <unistd.h>
+int main(int const argc,char const * * argv) {
+ luma::app_t app(argc,argv);
+}
diff --git a/old/stdlibsock__gfx__crtwin.cc b/old/stdlibsock__gfx__crtwin.cc
deleted file mode 100644
index 8ef4325..0000000
--- a/old/stdlibsock__gfx__crtwin.cc
+++ /dev/null
@@ -1,30 +0,0 @@
-# include <cstring>
-# include <iostream>
-# include <luma/main.hh>
-# include <string>
-# include <unistd.h>
-# include <vulkan/vulkan.h>
-# include <wayland-client.h>
-# include <xcb/xcb.h>
-# include <xcb/xcb_atom.h>
-int luma::app_t::stdlibsock__gfx__crtwin(char const * nm, int pos_x, int pos_y, int res_x, int res_y, bool flscrn) {
- if(!this->gfxisinit) {
- this->initgfx();
- }
- if(flscrn) {
- std::cerr << "Fullscreen is not supported yet!\n";
- }
- if(this->dispsrvproto == luma::dispsrvproto_t::wayland) {
- }
- else if(this->dispsrvproto == luma::dispsrvproto_t::x) {
- this->dbgmsg("Creating X window... ");
- ::xcb_create_window(this->xconn,XCB_COPY_FROM_PARENT,this->xwin,this->xscrn->root,pos_y,pos_x,res_x,res_y,0xa,XCB_WINDOW_CLASS_INPUT_OUTPUT,this->xscrn->root_visual,0x0,nullptr);
- ::xcb_change_property(this->xconn,XCB_PROP_MODE_REPLACE,this->xwin,XCB_ATOM_WM_NAME,XCB_ATOM_STRING,0x8,nm.size(),nm.c_str());
- ::xcb_map_window(this->xconn,this->xwin);
- ::xcb_flush(this->xconn);
- this->dbgmsg("O.K.\n");
- }
- ::sleep(0x6);
- this->termgfx();
- return 0x0;
-}
diff --git a/old/stdlibsock__gfx__destwin.cc b/old/stdlibsock__gfx__destwin.cc
deleted file mode 100644
index c2445e4..0000000
--- a/old/stdlibsock__gfx__destwin.cc
+++ /dev/null
@@ -1,4 +0,0 @@
-# include <luma/main.hh>
-void luma::app_t::stdlibsock__gfx__destwin() {
-
-}
diff --git a/old/termgfx.cc b/old/termgfx.cc
deleted file mode 100644
index 2897b13..0000000
--- a/old/termgfx.cc
+++ /dev/null
@@ -1,13 +0,0 @@
-# include <luma/main.hh>
-# include <vulkan/vulkan.h>
-# include <wayland-client.h>
-# include <xcb/xcb.h>
-void luma::app_t::termgfx() {
- ::vkDestroyInstance(this->vkinst,nullptr);
- if(this->dispsrvproto == this->dispsrvproto_t::x) {
- ::xcb_disconnect(this->xconn);
- }
- else if(this->dispsrvproto == this->dispsrvproto_t::wayland) {
- ::wl_display_disconnect(this->wldisp);
- }
-}
diff --git a/src/luma/app_t/msgf.cc b/src/luma/app_t/msgf.cc
deleted file mode 100644
index 5cb6828..0000000
--- a/src/luma/app_t/msgf.cc
+++ /dev/null
@@ -1,7 +0,0 @@
-# include <luma/main.hh>
-# include <unistd.h>
-void luma::app_t::msgf(int pipe,char const * msg) {
- if(::write(pipe,msg,this->strlen(msg)) < 0x0) {
- // ???
- }
-}
diff --git a/src/luma/arghandl.cc b/src/luma/arghandl.cc
new file mode 100644
index 0000000..70b9ae6
--- /dev/null
+++ b/src/luma/arghandl.cc
@@ -0,0 +1,14 @@
+# include <cstdio>
+# include <luma.hh>
+# include <string>
+# include <vector>
+using namespace std::literals::string_literals;
+void luma::arghandl(int const argc,char const * * argv) {
+ std::vector<std::basic_string<char>> args;
+ for(int pos = 0x1;pos < argc; ++pos) {
+ args.push_back(argv[pos]);
+ }
+ for(std::basic_string<char> arg : args) {
+ std::printf("Got argument \"%s\".\u000A",arg.c_str());
+ }
+}
diff --git a/src/luma/luma.cc b/src/luma/luma.cc
new file mode 100644
index 0000000..18fcdb7
--- /dev/null
+++ b/src/luma/luma.cc
@@ -0,0 +1,36 @@
+# include <cstdio>
+# include <cstdlib>
+# include <luma.hh>
+# include <fcntl.h>
+# include <sys/stat.h>
+# include <unistd.h>
+[[noreturn]] luma::luma(int const argc,char const * * argv) {
+ this->arghandl(argc,argv);
+ int file = ::open("test.luma",O_RDONLY);
+ char tok = '\0';
+ char word[0x1000];
+ int wordpos = 0x0;
+ struct ::stat fst;
+ ::fstat(file,&fst);
+ printf("Size of file is %ld characters.\u000A",fst.st_size);
+ ::sleep(0x1);
+ for(int filepos = 0x0;filepos < fst.st_size;++filepos) {
+ if(::read(file,&tok,0x1) < 0x0) {
+ std::printf("Error reading file.\u000A");
+ ::_exit(EXIT_FAILURE);
+ }
+ if(tok == '\u000A' || tok == '\u0020') {
+ if(wordpos == 0x0) continue;
+ word[wordpos] = '\0';
+ std::printf("The word is \"%s\".\u000A",word);
+ word[0x0] = '\0';
+ wordpos = 0x0;
+ }
+ else {
+ word[wordpos] = tok;
+ std::printf("Got character '%c' and set word[%d] to it.\u000A",tok,wordpos);
+ ++wordpos;
+ }
+ }
+ ::_exit(EXIT_SUCCESS);
+}
diff --git a/src/main.cc b/src/main.cc
index 7bca331..5de90c4 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -1,6 +1,4 @@
-# include <fcntl.h>
-# include <luma/main.hh>
-# include <unistd.h>
+# include <luma.hh>
int main(int const argc,char const * * argv) {
- luma::app_t app(argc,argv);
+ ::luma luma(argc,argv);
}
diff --git a/stdlib/std/fopen.luma b/stdlib/std/fopen.luma
new file mode 100644
index 0000000..18079c6
--- /dev/null
+++ b/stdlib/std/fopen.luma
@@ -0,0 +1 @@
+def fn /std/file_t [/std/str_t | /std/fmode_t] fopen
diff --git a/stdlib/std/fwrite.luma b/stdlib/std/fwrite.luma
new file mode 100644
index 0000000..53df1ec
--- /dev/null
+++ b/stdlib/std/fwrite.luma
@@ -0,0 +1 @@
+def fn /std/void_t [/std/file_t | /std/str_t] fwrite
diff --git a/stdlib/std/msgfout.luma b/stdlib/std/msgfout.luma
new file mode 100644
index 0000000..7491677
--- /dev/null
+++ b/stdlib/std/msgfout.luma
@@ -0,0 +1,2 @@
+def fn /std/void_t [/str_t msg] /std/msgfout
+ call /std/fopen []
diff --git a/test.luma b/test.luma
new file mode 100644
index 0000000..da5ef03
--- /dev/null
+++ b/test.luma
@@ -0,0 +1,5 @@
+def var ./std/int num
+cpy #0 .num
+inc .num
+mult .num #2
+pow .num #4