functional lisp config files
Build and Deploy Docs / build (push) Successful in 47s

This commit is contained in:
Arthur Barraux
2025-10-02 11:26:18 +02:00
parent 53d6572c8c
commit 3b6c60a49e
16 changed files with 482 additions and 209 deletions
+22
View File
@@ -0,0 +1,22 @@
#ifndef BUILTINS_H_
#define BUILTINS_H_
#include "../lisp-interpreter/dist/lisp.h"
Lisp moveCursor(Lisp args, LispError *e, LispContext ctx);
Lisp mapKey(Lisp args, LispError *e, LispContext ctx);
void registerBuiltin(char * key_sequence, LispCFunc f);
Lisp editorQuit(Lisp args, LispError *e, LispContext ctx);
Lisp l_editorSave(Lisp args, LispError *e, LispContext ctx);
Lisp l_editorInsertNewLine(Lisp args, LispError* e, LispContext ctx);
Lisp moveCursorBeginLine(Lisp args, LispError *e, LispContext ctx);
Lisp moveCursorEndLine(Lisp args, LispError* e, LispContext ctx);
#endif
+27 -4
View File
@@ -1,10 +1,12 @@
#ifndef DATA_H_
#define DATA_H_
#include "../lisp-interpreter/dist/lisp.h"
#include <stdio.h>
#include <termios.h>
#include <time.h>
#include "../lisp-interpreter/dist/lisp.h"
/**
* \struct erow
* \brief Store one editor row
@@ -18,6 +20,18 @@ typedef struct erow {
char *render; /**< The actual line we will print */
} erow;
struct const_t {
int TAB_LENGTH;
int QUIT_TIMES;
};
struct keyBind_t {
char *key_sequence;
Lisp command;
};
/**
* \struct editorConfig
* \brief Containing our editor state.
@@ -36,9 +50,18 @@ struct editorConfig {
char status_msg[80];
time_t status_msg_time;
struct termios orig_termios; /**< Terminal communication interface */
LispContext ctx; /** Lisp context */
Lisp ctx_data; /** Lisp data context */
LispError ctx_error; /** Lisp ctx error */
struct const_t constantes;
int quit_times_buffer;
FILE *fd_init_file;
Lisp env;
LispContext ctx; /** Lisp context */
Lisp ctx_data; /** Lisp data context */
LispError ctx_error; /** Lisp ctx error */
struct keyBind_t* key_binds;
int number_of_keybinds;
};
/**
-2
View File
@@ -25,7 +25,5 @@ enum editorKey {
#define ABUF_INIT {NULL, 0}
#define BELUGA_VERSION "1.0"
#define TAB_LENGTH 4
#define QUIT_TIMES 1
#endif // DEFINE_H_
+2
View File
@@ -10,6 +10,8 @@
* \brief Job's function is to initialize all the fields of editorConfig.
* */
void initBuiltins();
void initEditor();
#endif // INIT_H_
+4
View File
@@ -21,8 +21,12 @@
char *editorPrompt(char *prompt);
char *key_to_string(int key);
void editorMoveCursor(int key);
int executeKeyBind(char *key_sequence);
/**
* \fn void editorProcessKeypress()
* \brief Get the last key input and do the proper action.