]> git.mdlowis.com Git - projs/tide.git/commitdiff
added comments to edit.h and cleaned up warnings in exec.c
authorMichael D. Lowis <mike.lowis@gentex.com>
Thu, 10 Nov 2016 21:30:41 +0000 (16:30 -0500)
committerMichael D. Lowis <mike.lowis@gentex.com>
Thu, 10 Nov 2016 21:30:41 +0000 (16:30 -0500)
inc/edit.h
libedit/exec.c

index 169a0aa22b8a039e2ea49768ed6c488dda329b40..06e5a385b030a1530e26a632888088e9e95e9f10 100644 (file)
@@ -16,35 +16,36 @@ char* fdgets(int fd);
 /* Buffer management functions
  *****************************************************************************/
 typedef struct Log {
-    struct Log* next;
-    bool locked;
-    bool insert;
+    struct Log* next;   /* pointer to next operation in the stack */
+    bool locked;        /* whether new operations can be coalesced or not */
+    bool insert;        /* whether this operation was an insert or delete */
     union {
         struct {
-            size_t beg;
-            size_t end;
+            size_t beg; /* offset in the file where insertion started */
+            size_t end; /* offset in the file where insertion ended */
         } ins;
         struct {
-            size_t off;
-            size_t len;
-            Rune* runes;
+            size_t off;  /* offset in the file where the deletion occurred */
+            size_t len;  /* number of runes deleted */
+            Rune* runes; /* array of runes containing deleted content */
         } del;
     } data;
 } Log;
 
 typedef struct buf {
-    char* path;     /* the path to the open file */
-    int charset;    /* the character set of the buffer */
-    int crlf;       /* tracks whether the file uses dos style line endings */
-    bool locked;    /* tracks current mode */
-    bool modified;  /* tracks whether the buffer has been modified */
-    size_t bufsize; /* size of the buffer in runes */
-    Rune* bufstart; /* start of the data buffer */
-    Rune* bufend;   /* end of the data buffer */
-    Rune* gapstart; /* start of the gap */
-    Rune* gapend;   /* end of the gap */
-    Log* undo;      /* undo list */
-    Log* redo;      /* redo list */
+    char* path;       /* the path to the open file */
+    int charset;      /* the character set of the buffer */
+    int crlf;         /* tracks whether the file uses dos style line endings */
+    bool locked;      /* tracks current mode */
+    bool modified;    /* tracks whether the buffer has been modified */
+    size_t bufsize;   /* size of the buffer in runes */
+    Rune* bufstart;   /* start of the data buffer */
+    Rune* bufend;     /* end of the data buffer */
+    Rune* gapstart;   /* start of the gap */
+    Rune* gapend;     /* end of the gap */
+    Log* undo;        /* undo list */
+    Log* redo;        /* redo list */
+    bool expand_tabs; /* tracks current mode */
 } Buf;
 
 typedef struct {
@@ -173,10 +174,10 @@ UGlyph* screen_getglyph(unsigned row, unsigned col, unsigned* scrwidth);
 /* Command Executions
  *****************************************************************************/
 typedef struct {
-    int pid;
-    int in;
-    int out;
-    int err;
+    int pid; /* process id of the child process */
+    int in;  /* file descriptor for the child process's standard input */
+    int out; /* file descriptor for the child process's standard output */
+    int err; /* file descriptor for the child process's standard error */
 } Process;
 
 int execute(char** cmd, Process* proc);
index e90bfda473edeb23f93275a89bdc28884e505831..8f1b6c0a94f644ab15756ef7fa8d1a266fbbe5cd 100644 (file)
@@ -1,12 +1,9 @@
+#define _POSIX_C_SOURCE 200809L
 #include <stdc.h>
 #include <utf.h>
 #include <edit.h>
-
-#define _POSIX_C_SOURCE 200809L
 #include <unistd.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <signal.h>
+#include <sys/wait.h>
 
 #define PIPE_READ 0
 #define PIPE_WRITE 1