This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository eshell.
View the commit online.
commit c182e27cba65a51bed1c4ea5fea670d02efe9472
Author: swagtoy <m...@ow.swag.toys>
AuthorDate: Fri Nov 8 18:05:51 2024 -0500
Add lexer and link Escript to eshell
---
CMakeLists.txt | 2 +-
escript/CMakeLists.txt | 3 +--
escript/include/escript.h | 4 +++-
escript/include/lexer.h | 14 ++++++++++++++
escript/src/escript.c | 5 +++++
escript/src/lexer.c | 13 +++++++++++++
eshell/CMakeLists.txt | 4 ++--
eshell/src/eshell.c | 6 ++++--
eshell/src/eshell.h | 1 +
eshell/src/main.c | 2 +-
10 files changed, 45 insertions(+), 9 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e01dd07..3a79b26 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,6 +3,6 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
project(EscriptRoot)
-add_subdirectory(eshell)
add_subdirectory(escript)
+add_subdirectory(eshell)
diff --git a/escript/CMakeLists.txt b/escript/CMakeLists.txt
index 1382426..73e290e 100644
--- a/escript/CMakeLists.txt
+++ b/escript/CMakeLists.txt
@@ -9,12 +9,11 @@ find_package(PkgConfig)
pkg_check_modules(EFL REQUIRED efl ecore)
add_library(Escript
- src/escript.c)
+ src/escript.c src/lexer.c)
set_target_properties(Escript PROPERTIES PUBLIC_HEADER include/)
target_include_directories(Escript PUBLIC
${EFL_INCLUDE_DIRS}
- PRIVATE
include/)
target_link_libraries(Escript
${EFL_LIBRARIES})
diff --git a/escript/include/escript.h b/escript/include/escript.h
index d6f8688..65d58e0 100644
--- a/escript/include/escript.h
+++ b/escript/include/escript.h
@@ -5,9 +5,11 @@
#ifndef ESCRIPT_ESCRIPT_H
#define ESCRIPT_ESCRIPT_H
+struct Escript_Lexer;
+
struct Escript
{
- int stub;
+ struct Escript_Lexer* lex;
};
int escript_init(struct Escript* env, int argc, char** argv);
diff --git a/escript/include/lexer.h b/escript/include/lexer.h
new file mode 100644
index 0000000..43950c3
--- /dev/null
+++ b/escript/include/lexer.h
@@ -0,0 +1,14 @@
+/* Escript - escript.h
+ * Licensed under BSD 2-Clause
+ */
+
+#ifndef ESCRIPT_LEXER_H
+#define ESCRIPT_LEXER_H
+
+struct Escript_Lexer
+{
+};
+
+int escript_lexer_init(struct Escript_Lexer* lex);
+
+#endif
diff --git a/escript/src/escript.c b/escript/src/escript.c
index cc179bc..7c4bde9 100644
--- a/escript/src/escript.c
+++ b/escript/src/escript.c
@@ -6,9 +6,14 @@
#include <stdio.h>
#include <string.h>
+#include <stdlib.h>
#include "escript.h"
+#include "lexer.h"
int escript_init(struct Escript* escript, int argc, char** argv)
{
+ escript->lex = malloc(sizeof(struct Escript_Lexer)); // TODO free me
+ escript_lexer_init(escript->lex);
+
return 0;
}
diff --git a/escript/src/lexer.c b/escript/src/lexer.c
new file mode 100644
index 0000000..c3511fb
--- /dev/null
+++ b/escript/src/lexer.c
@@ -0,0 +1,13 @@
+/* Eshell - lexer.c
+ * Licensed under BSD 2-Clause
+ * ---
+ * Lexer for Escript.
+ */
+
+#include <stdio.h>
+#include "lexer.h"
+
+int escript_lexer_init(struct Escript_Lexer* lex)
+{
+ puts("Lexer begins!");
+}
diff --git a/eshell/CMakeLists.txt b/eshell/CMakeLists.txt
index f6bd4b1..6ed482e 100644
--- a/eshell/CMakeLists.txt
+++ b/eshell/CMakeLists.txt
@@ -13,6 +13,6 @@ add_executable(Eshell
set_target_properties(Eshell PROPERTIES OUTPUT_NAME "eshell")
target_include_directories(Eshell PUBLIC
- ${EFL_INCLUDE_DIRS})
+ ${EFL_INCLUDE_DIRS} Escript) #hack...
target_link_libraries(Eshell
- ${EFL_LIBRARIES})
+ ${EFL_LIBRARIES} Escript)
diff --git a/eshell/src/eshell.c b/eshell/src/eshell.c
index 36317ce..7b1f055 100644
--- a/eshell/src/eshell.c
+++ b/eshell/src/eshell.c
@@ -7,9 +7,13 @@
#include <stdio.h>
#include <string.h>
#include "eshell.h"
+#include "escript.h"
+#include <stdlib.h>
int eshell_init(struct Eshell* eshell, int argc, char** argv)
{
+ eshell->escript = malloc(sizeof(struct Escript)); // TODO clean me
+ escript_init(eshell->escript, argc, argv);
return 0;
}
@@ -32,8 +36,6 @@ int eshell_io_loop(struct Eshell* eshell)
if (res[res_len-1] == '\n')
res[res_len-1] = '\0';
-
-
puts(res);
}
return 0;
diff --git a/eshell/src/eshell.h b/eshell/src/eshell.h
index df30f0c..5903ddc 100644
--- a/eshell/src/eshell.h
+++ b/eshell/src/eshell.h
@@ -7,6 +7,7 @@
struct Eshell
{
+ struct Escript* escript;
char* prompt;
};
diff --git a/eshell/src/main.c b/eshell/src/main.c
index cf3175e..173ae9f 100644
--- a/eshell/src/main.c
+++ b/eshell/src/main.c
@@ -40,7 +40,7 @@ main(int argc, char** argv)
int args = ecore_getopt_parse(&options, values, argc, argv);
if (args == 1)
{
- struct Eshell* eshell;
+ struct Eshell* eshell = malloc(sizeof(struct Eshell));
eshell_init(eshell, argc, argv);
int ret = eshell_io_loop(eshell);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.