Add better precompiler control

This commit is contained in:
2025-12-08 19:16:18 +00:00
parent 8fc6d63748
commit 136c546c1f
5 changed files with 23 additions and 6 deletions

View File

@@ -1,4 +1,6 @@
#pragma once #ifndef EDITOR_H
#define EDITOR_H
#include "../libs/tree-sitter/lib/include/tree_sitter/api.h" #include "../libs/tree-sitter/lib/include/tree_sitter/api.h"
#include "./rope.h" #include "./rope.h"
#include "./ui.h" #include "./ui.h"
@@ -143,3 +145,5 @@ void cursor_down(Editor *editor, uint32_t number);
void cursor_left(Editor *editor, uint32_t number); void cursor_left(Editor *editor, uint32_t number);
void cursor_right(Editor *editor, uint32_t number); void cursor_right(Editor *editor, uint32_t number);
void ensure_scroll(Editor *editor); void ensure_scroll(Editor *editor);
#endif

View File

@@ -1,5 +1,5 @@
#ifndef ROPE_HPP #ifndef ROPE_H
#define ROPE_HPP #define ROPE_H
#include <cstdint> #include <cstdint>
#include <vector> #include <vector>
@@ -154,4 +154,4 @@ std::vector<std::pair<size_t, size_t>> search_rope(Knot *root,
// This must be called only once when the rope is no longer needed // This must be called only once when the rope is no longer needed
void free_rope(Knot *root); void free_rope(Knot *root);
#endif // ROPE_HPP #endif // ROPE_H

View File

@@ -1,7 +1,11 @@
#pragma once #ifndef TS_H
#define TS_H
#include "./editor.h" #include "./editor.h"
#define HEX(s) (static_cast<uint32_t>(std::stoul(s, nullptr, 16))) #define HEX(s) (static_cast<uint32_t>(std::stoul(s, nullptr, 16)))
TSQuery *load_query(const char *query_path, Editor *editor); TSQuery *load_query(const char *query_path, Editor *editor);
void ts_collect_spans(Editor *editor); void ts_collect_spans(Editor *editor);
#endif

View File

@@ -1,4 +1,6 @@
#pragma once #ifndef UI_H
#define UI_H
#include <atomic> #include <atomic>
#include <cstdint> #include <cstdint>
#include <mutex> #include <mutex>
@@ -104,3 +106,5 @@ int read_input(char *buf, size_t buflen);
KeyEvent read_key(); KeyEvent read_key();
int display_width(const char *str); int display_width(const char *str);
#endif

View File

@@ -1,3 +1,6 @@
#ifndef UTILS_H
#define UTILS_H
#include <mutex> #include <mutex>
#include <queue> #include <queue>
#include <string> #include <string>
@@ -30,3 +33,5 @@ uint32_t get_bytes_from_visual_col(const char *line,
uint32_t target_visual_col); uint32_t target_visual_col);
void log(const char *fmt, ...); void log(const char *fmt, ...);
std::string get_exe_dir(); std::string get_exe_dir();
#endif