]> git.mdlowis.com Git - projs/tide.git/commitdiff
reorganized and consolidated tide specific headers testing
authorMichael D. Lowis <mike.lowis@gentex.com>
Tue, 22 Mar 2022 16:26:20 +0000 (12:26 -0400)
committerMichael D. Lowis <mike.lowis@gentex.com>
Tue, 22 Mar 2022 16:26:20 +0000 (12:26 -0400)
20 files changed:
inc/draw.h [deleted file]
inc/win.h [deleted file]
inc/xpty.h [deleted file]
src/lib/utf8/utf8.c
src/tide/buf.c
src/tide/draw.c
src/tide/editlog.c
src/tide/exec.c
src/tide/gapbuf.c
src/tide/job.c
src/tide/main.c
src/tide/mouse.c
src/tide/range.c
src/tide/shortcuts.c
src/tide/tide.h [moved from inc/edit.h with 79% similarity]
src/tide/view.c
src/tide/xpty.c
tests/lib/buf.c
tests/lib/utf8.c
tests/libedit.c

diff --git a/inc/draw.h b/inc/draw.h
deleted file mode 100644 (file)
index d7354bf..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-/** @file */
-typedef struct {
-    int x, y;
-    int h, w;
-} drawcsr;
-
-void draw_rect(XConf* x, int color, int posx, int posy, int width, int height);
-void draw_statbox(XConf* x, int status);
-int draw_hrule(XConf* x, drawcsr* csr);
-void draw_view(XConf* x, View* view, XftFont* font, size_t nrows, drawcsr* csr, int bg, int fg, int sel, bool csrsync);
-bool draw_csr(XConf* x, View* view, int fg, size_t fheight, int posx, int posy, bool csrdrawn);
-void draw_scroll(XConf* x, drawcsr* csr, View* view, int divider);
diff --git a/inc/win.h b/inc/win.h
deleted file mode 100644 (file)
index 1ddb23c..0000000
--- a/inc/win.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/** @file */
-typedef struct XFont XFont;
-
-typedef struct {
-    uint32_t attr; /* attributes applied to this cell */
-    uint32_t rune; /* rune value for the cell */
-} XGlyph;
-
-typedef struct {
-    void* font;
-    uint32_t glyph;
-    short x;
-    short y;
-} XGlyphSpec;
-
-enum {
-    MouseLeft    = 1,
-    MouseMiddle  = 2,
-    MouseRight   = 3,
-    MouseWheelUp = 4,
-    MouseWheelDn = 5
-};
-
-typedef enum {
-    TAGS     = 0,
-    EDIT     = 1,
-    NREGIONS = 2,
-    FOCUSED  = 2
-} WinRegion;
-
-void win_init(void);
-void win_title(char* path);
-void win_font(char* font);
-void win_prop_set(char* xname, char* ename, char* value);
-void win_loop(void);
-void win_quit(void);
-void win_togglefocus(void);
-View* win_view(WinRegion id);
-Buf* win_buf(WinRegion id);
-bool win_keymodsset(int mask);
-void win_setln(int line_num);
diff --git a/inc/xpty.h b/inc/xpty.h
deleted file mode 100644 (file)
index ab20594..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-/** @file */
-bool xpty_active(void);
-void xpty_togglescroll(void);
-int xpty_run(View* view, char** cmd);
-void xpty_send(char* cmd);
-void xpty_rawsend(char* cmd);
index 622dc67e5b5287256d44ef70c572f4b1b7805837..cb2ea5d5a01de23a378cbb6b72e1e5a518980a65 100644 (file)
@@ -1,8 +1,8 @@
 #include <stdc.h>
 #include <utf.h>
-#include <edit.h>
 #include <wchar.h>
 #include <ctype.h>
+
 #include "config.h"
 
 static const uint8_t UTF8_SeqBits[] = { 0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE };
index 3bae4fb4b405ee24b538a4c6261441b251e32985..cfe040dda704661a1c71a72659c91d9d7d9c66ab 100644 (file)
@@ -1,11 +1,12 @@
 #include <stdc.h>
 #include <dbc.h>
 #include <utf.h>
-#include <edit.h>
 #include <ctype.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <sys/stat.h>
+
+#include "tide.h"
 #include "config.h"
 
 #ifndef NDEBUG
index abe9c24da1094b47957ab6c567a7f8bda5097843..fdcbea6f3b0d83b064c9036fcf88a953538c1fa5 100644 (file)
@@ -1,8 +1,7 @@
 #include <stdc.h>
 #include <utf.h>
-#include <x11.h>
-#include <edit.h>
-#include <draw.h>
+
+#include "tide.h"
 #include "config.h"
 
 void draw_rect(XConf* x, int color, int posx, int posy, int width, int height)
index 023edcead1d2b065b3ae090d4d8d411750650154..747f87ccddd5ffd04b27a96f7b3b63871c257460 100644 (file)
@@ -1,7 +1,8 @@
 #include <stdc.h>
 #include <dbc.h>
 #include <utf.h>
-#include <edit.h>
+
+#include "tide.h"
 #include "config.h"
 
 static Log* mklog(Buf* buf, size_t beg, size_t end, char* data, Log* next)
index a12876ebcf703f63433ef54b6b3e6e89e199a612..f6ac77177cf2d59d2fe5d1038a7f47d4e3b405d5 100644 (file)
@@ -1,15 +1,9 @@
 #include <stdc.h>
 #include <utf.h>
-#include <edit.h>
-#include <win.h>
-#include <xpty.h>
 #include <dbc.h>
-#include "config.h"
 
-typedef struct {
-    char* tag;
-    void (*action)(char*);
-} Tag;
+#include "tide.h"
+#include "config.h"
 
 static Tag* Builtins = NULL;
 
index e66b0ff08c75f27dda9fffef992324441c2f293c..68ca32a576cde8d907249f356571810a6f70ffc8 100644 (file)
@@ -1,7 +1,6 @@
 #include <stdc.h>
 #include <dbc.h>
 #include <utf.h>
-#include <edit.h>
 #include <io.h>
 #include <ctype.h>
 #include <unistd.h>
@@ -9,6 +8,8 @@
 #include <sys/stat.h>
 #include <dirent.h>
 #include <vec.h>
+
+#include "tide.h"
 #include "config.h"
 
 size_t gapbuf_end(GapBuf* buf)
index 08f1c8c4f9891a1a94d57a39e2a5c6ea97af7932..27a6efe8b9525e0a1009aabe47eb8d8489831055 100644 (file)
@@ -1,7 +1,5 @@
 #include <stdc.h>
 #include <utf.h>
-#include <edit.h>
-#include <win.h>
 #include <io.h>
 #include <unistd.h>
 #include <sys/wait.h>
@@ -10,6 +8,8 @@
 #include <poll.h>
 #include <fcntl.h>
 
+#include "tide.h"
+
 struct PipeData {
     char* data;
     ssize_t ndata;
index f385cccbdbba618af7ace486c3180431acdb6916..f4f630cd17ca513cb67749f5dfaa356ad7e4f6d3 100644 (file)
@@ -1,24 +1,11 @@
 #include <stdc.h>
 #include <dbc.h>
 #include <utf.h>
-#include <edit.h>
-#include <win.h>
-#include <x11.h>
 #include <io.h>
-#include <xpty.h>
-#include <draw.h>
 #include <locale.h>
 #include <sys/wait.h>
 
-typedef struct {
-    char* tag;
-    void (*action)(char*);
-} Tag;
-
-void exec_init(Tag* p_tags);
-void exec_cmd(char* cmd);
-void exec_cmdwarg(char* cmd, char* arg);
-void exec_rawwarg(char* cmd, char* arg);
+#include "tide.h"
 
 #define INCLUDE_DEFS
 #include "config.h"
index db022b1a4d8679f49339c656c9d005b6bae582ac..9e252ee4d7e0a61f53f58fbaf3dd85f8e26c8205 100644 (file)
@@ -1,9 +1,8 @@
 #include <stdc.h>
 #include <utf.h>
-#include <x11.h>
-#include <edit.h>
-#include <win.h>
 #include <dbc.h>
+
+#include "tide.h"
 #include "config.h"
 
 static inline int PRESSED(int mods, int btn)
index 7eecc44e2d42060aa48cfea30eb162481cbcac74..6b6a517d9a98689a4f98ee7c6a14da98f3e72791 100644 (file)
@@ -1,6 +1,7 @@
 #include <stdc.h>
 #include <utf.h>
-#include <edit.h>
+
+#include "tide.h"
 
 void range_add(Sel* p_range, size_t off)
 {
index aee183224cef7df90b684f8acf24b4474e4b29ad..55c37b460433cc1e539f4e03e7100e9e66abfcfd 100644 (file)
@@ -1,8 +1,7 @@
 #include <stdc.h>
 #include <utf.h>
-#include <edit.h>
-#include <win.h>
-#include <x11.h>
+
+#include "tide.h"
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wunused-parameter"
similarity index 79%
rename from inc/edit.h
rename to src/tide/tide.h
index b28eaedbdc61b29a3ed0f7676d6dea7369dc560e..1b9d4e96d7a5e6b6eacdad029e00a377af2315fa 100644 (file)
@@ -1,6 +1,5 @@
-/** @file */
-/* Buffer management functions
- *****************************************************************************/
+#include <x11.h>
+
 /* undo/redo list item */
 typedef struct Log {
     struct Log* next; /* pointer to next operation in the stack */
@@ -198,6 +197,8 @@ void view_selectobj(View* view, bool (*istype)(Rune));
 
 /* Command Executions
  *****************************************************************************/
+/* src/tide/job.c */
+
 typedef struct Job Job;
 
 typedef void (*jobfn_t)(Job* job);
@@ -220,6 +221,8 @@ void job_readfd(int fd, View* view);
 
 /* Common Shortcuts
  *****************************************************************************/
+/* src/tide/shortcuts.c */
+
 void select_line(char* arg);
 void join_lines(char* arg);
 void delete(char* arg);
@@ -263,3 +266,84 @@ enum {
 };
 
 int process_mouse(int btn, bool pressed);
+
+/* Command and Tag Exectuion
+ *****************************************************************************/
+/* src/tide/exec.c */
+
+typedef struct {
+    char* tag;
+    void (*action)(char*);
+} Tag;
+
+void exec_init(Tag* p_tags);
+void exec_cmd(char* cmd);
+void exec_cmdwarg(char* cmd, char* arg);
+void exec_rawwarg(char* cmd, char* arg);
+
+/* UI Window Control
+ *****************************************************************************/
+/* src/tide/main.c */
+
+typedef struct XFont XFont;
+
+typedef struct {
+    uint32_t attr; /* attributes applied to this cell */
+    uint32_t rune; /* rune value for the cell */
+} XGlyph;
+
+typedef struct {
+    void* font;
+    uint32_t glyph;
+    short x;
+    short y;
+} XGlyphSpec;
+
+enum {
+    MouseLeft    = 1,
+    MouseMiddle  = 2,
+    MouseRight   = 3,
+    MouseWheelUp = 4,
+    MouseWheelDn = 5
+};
+
+typedef enum {
+    TAGS     = 0,
+    EDIT     = 1,
+    NREGIONS = 2,
+    FOCUSED  = 2
+} WinRegion;
+
+void win_init(void);
+void win_title(char* path);
+void win_font(char* font);
+void win_prop_set(char* xname, char* ename, char* value);
+void win_loop(void);
+void win_quit(void);
+void win_togglefocus(void);
+View* win_view(WinRegion id);
+Buf* win_buf(WinRegion id);
+bool win_keymodsset(int mask);
+void win_setln(int line_num);
+
+typedef struct {
+    int x, y;
+    int h, w;
+} drawcsr;
+
+/* UI Drawing Routines
+ *****************************************************************************/
+void draw_rect(XConf* x, int color, int posx, int posy, int width, int height);
+void draw_statbox(XConf* x, int status);
+int draw_hrule(XConf* x, drawcsr* csr);
+void draw_view(XConf* x, View* view, XftFont* font, size_t nrows, drawcsr* csr, int bg, int fg, int sel, bool csrsync);
+bool draw_csr(XConf* x, View* view, int fg, size_t fheight, int posx, int posy, bool csrdrawn);
+void draw_scroll(XConf* x, drawcsr* csr, View* view, int divider);
+
+/* Pseudo Terminal Routines
+ *****************************************************************************/
+bool xpty_active(void);
+void xpty_togglescroll(void);
+int xpty_run(View* view, char** cmd);
+void xpty_send(char* cmd);
+void xpty_rawsend(char* cmd);
index 87e24e107b7fdc2143de4cef5862e86c59d83db5..90fd6ceccedc0407604ed3cdf31694cc8a1331b7 100644 (file)
@@ -1,8 +1,9 @@
 #include <stdc.h>
 #include <dbc.h>
 #include <utf.h>
-#include <edit.h>
 #include <ctype.h>
+
+#include "tide.h"
 #include "config.h"
 
 #ifndef NDEBUG
index 2907e3e989276f6f33361ff35e37cfcd43c47fa0..1ac4e04df753484d951b66340b2435dd41104e02 100644 (file)
@@ -1,6 +1,5 @@
 #include <stdc.h>
 #include <utf.h>
-#include <edit.h>
 #include <io.h>
 #include <sys/socket.h>
 #ifdef __linux__
@@ -8,6 +7,7 @@
 #else
     #include <util.h>
 #endif
+#include "tide.h"
 
 #define BUFFERSZ 16384
 
index b372a8799ab46c20c86801bd559cdfa45ef30386..3639fa94a4d911103a19916e93385ce21482a5c3 100644 (file)
@@ -2,7 +2,8 @@
 #include <test/atf.h>
 #include <test/qcheck.h>
 #include <utf.h>
-#include <edit.h>
+
+#include "src/tide/tide.h"
 #include "config.h"
 
 #pragma GCC diagnostic ignored "-Wunused-function"
index 493223dfd03370730ed2af9308e64369d60d2076..a1624a476f25ecec89e2a293083829b5fbeb0f91 100644 (file)
@@ -1,7 +1,6 @@
 #include <test/atf.h>
 #include <stdc.h>
 #include <utf.h>
-#include <edit.h>
 
 TEST_SUITE(Utf8Tests)
 {
index fe324a22721b0d89cfe16c24b3cbc73421042fdb..ef919639bf1732ec8531a56653d6c152a55e849f 100644 (file)
@@ -1,6 +1,5 @@
 #include <stdc.h>
 #include <utf.h>
-#include <edit.h>
 
 #define INCLUDE_DEFS
 #include <test/atf.h>