qemacs-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemacs-commit] qemacs buffer.c extras.c qe.c qe.h


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs buffer.c extras.c qe.c qe.h
Date: Mon, 26 May 2014 14:35:38 +0000

CVSROOT:        /sources/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        14/05/26 14:35:38

Modified files:
        .              : buffer.c extras.c qe.c qe.h 

Log message:
        clean up header, rename some fields

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/buffer.c?cvsroot=qemacs&r1=1.80&r2=1.81
http://cvs.savannah.gnu.org/viewcvs/qemacs/extras.c?cvsroot=qemacs&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.c?cvsroot=qemacs&r1=1.171&r2=1.172
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.h?cvsroot=qemacs&r1=1.174&r2=1.175

Patches:
Index: buffer.c
===================================================================
RCS file: /sources/qemacs/qemacs/buffer.c,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -b -r1.80 -r1.81
--- buffer.c    18 May 2014 11:01:55 -0000      1.80
+++ buffer.c    26 May 2014 14:35:37 -0000      1.81
@@ -550,10 +550,10 @@
     eb_munmap_buffer(b);
 
     /* close and reset file handle */
-    if (b->file_handle > 0) {
-        close(b->file_handle);
+    if (b->map_handle > 0) {
+        close(b->map_handle);
     }
-    b->file_handle = 0;
+    b->map_handle = 0;
 
     /* TODO: clear buffer structure */
     //memset(b, 0, offsetof(EditBuffer, remanent_area));
@@ -1678,7 +1678,7 @@
         p++;
     }
     // XXX: not needed
-    b->file_handle = fd;
+    b->map_handle = fd;
     //put_status(NULL, "");
     return 0;
 }

Index: extras.c
===================================================================
RCS file: /sources/qemacs/qemacs/extras.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- extras.c    18 May 2014 10:49:58 -0000      1.29
+++ extras.c    26 May 2014 14:35:38 -0000      1.30
@@ -961,11 +961,12 @@
         buf_printf(desc, " STYLES");
 
     eb_printf(b1, "       flags: 0x%02x %s\n", b->flags, buf);
+#if 0
     eb_printf(b1, "      probed: %d\n", b->probed);
-
+#endif
     eb_printf(b1, "   data_type: %s\n", b->data_type->name);
     eb_printf(b1, "       pages: %d\n", b->nb_pages);
-    eb_printf(b1, " file_handle: %d\n", b->file_handle);
+    eb_printf(b1, "  map_handle: %d\n", b->map_handle);
 
     eb_printf(b1, "    save_log: %d (new_index=%d, current=%d, nb_logs=%d)\n",
               b->save_log, b->log_new_index, b->log_current, b->nb_logs);

Index: qe.c
===================================================================
RCS file: /sources/qemacs/qemacs/qe.c,v
retrieving revision 1.171
retrieving revision 1.172
diff -u -b -r1.171 -r1.172
--- qe.c        14 May 2014 17:40:53 -0000      1.171
+++ qe.c        26 May 2014 14:35:38 -0000      1.172
@@ -146,9 +146,9 @@
 
     for (m = qs->first_mode; m != NULL; m = m->next) {
         if (strequal(m->name, name))
-            return m;
+            break;
     }
-    return NULL;
+    return m;
 }
 
 /* commands handling */
@@ -1764,7 +1764,7 @@
                always redundant if it was not modified */
             if (b->data_type != &raw_data_type) {
                 b->data_type->buffer_close(b);
-                b->data = NULL;
+                b->data_data = NULL;
                 b->data_type = &raw_data_type;
                 eb_delete(b, 0, b->total_size);
                 b->modified = 0;

Index: qe.h
===================================================================
RCS file: /sources/qemacs/qemacs/qe.h,v
retrieving revision 1.174
retrieving revision 1.175
diff -u -b -r1.174 -r1.175
--- qe.h        20 May 2014 04:48:36 -0000      1.174
+++ qe.h        26 May 2014 14:35:38 -0000      1.175
@@ -129,6 +129,12 @@
 typedef struct EditState EditState;
 typedef struct EditBuffer EditBuffer;
 typedef struct QEmacsState QEmacsState;
+typedef struct DisplayState DisplayState;
+typedef struct ModeProbeData ModeProbeData;
+typedef struct ModeSavedData ModeSavedData;
+typedef struct ModeDef ModeDef;
+typedef struct QETimer QETimer;
+typedef struct QEColorizeContext QEColorizeContext;
 
 static inline char *s8(u8 *p) { return (char*)p; }
 static inline const char *cs8(const u8 *p) { return (const char*)p; }
@@ -158,7 +164,6 @@
 void register_bottom_half(void (*cb)(void *opaque), void *opaque);
 void unregister_bottom_half(void (*cb)(void *opaque), void *opaque);
 
-typedef struct QETimer QETimer;
 QETimer *qe_add_timer(int delay, void *opaque, void (*cb)(void *opaque));
 void qe_kill_timer(QETimer **tip);
 
@@ -733,6 +738,26 @@
 void qe_ungrab_keys(void);
 struct KeyDef *qe_find_binding(unsigned int *keys, int nb_keys, int nroots, 
...);
 
+#define COLORED_MAX_LINE_SIZE  4096
+
+/* colorize & transform a line, lower level then ColorizeFunc */
+typedef int (*GetColorizedLineFunc)(EditState *s,
+                                    unsigned int *buf, int buf_size,
+                                    int *offset1, int line_num);
+
+struct QEColorizeContext {
+    EditState *s;
+    EditBuffer *b;
+    int colorize_state;
+    int state_only;
+};
+
+/* colorize a line: this function modifies buf to set the char
+ * styles. 'buf' is guaranted to have one more '\0' char after its len.
+ */
+typedef void (*ColorizeFunc)(QEColorizeContext *cp,
+                             unsigned int *buf, int n, int mode_flags);
+
 /* buffer.c */
 
 /* begin to mmap files from this size */
@@ -783,6 +808,15 @@
     struct EditBufferCallbackList *next;
 } EditBufferCallbackList;
 
+/* high level buffer type handling */
+typedef struct EditBufferDataType {
+    const char *name; /* name of buffer data type (text, image, ...) */
+    int (*buffer_load)(EditBuffer *b, FILE *f);
+    int (*buffer_save)(EditBuffer *b, int start, int end, const char 
*filename);
+    void (*buffer_close)(EditBuffer *b);
+    struct EditBufferDataType *next;
+} EditBufferDataType;
+
 /* buffer flags */
 #define BF_SAVELOG   0x0001  /* activate buffer logging */
 #define BF_SYSTEM    0x0002  /* buffer system, cannot be seen by the user */
@@ -809,16 +843,18 @@
     /* page cache */
     Page *cur_page;
     int cur_offset;
-    int file_handle; /* if the file is kept open because it is mapped,
-                        its handle is there */
     int flags;
 
+    /* mmap data, including file handle if kept open */
     void *map_address;
     int map_length;
+    int map_handle;
 
     /* buffer data type (default is raw) */
-    struct EditBufferDataType *data_type;
-    void *data; /* associated buffer data, used if data_type != raw_data */
+    EditBufferDataType *data_type;
+    void *data_data;    /* associated buffer data, used if data_type != 
raw_data */
+    void *priv_data;    /* buffer polling & private data */
+    void (*close)(EditBuffer *);    /* called when deleting the buffer */
 
     /* charset handling */
     CharsetDecodeState charset_state;
@@ -830,8 +866,8 @@
     int log_new_index, log_current;
     enum LogOperation last_log;
     int last_log_char;
-    EditBuffer *log_buffer;
     int nb_logs;
+    EditBuffer *log_buffer;
 
     /* style system */
     EditBuffer *b_styles;
@@ -842,16 +878,12 @@
     /* modification callbacks */
     EditBufferCallbackList *first_callback;
 
+#if 0
     /* asynchronous loading/saving support */
     struct BufferIOState *io_state;
-
     /* used during loading */
     int probed;
-
-    /* buffer polling & private data */
-    void *priv_data;
-    /* called when deleting the buffer */
-    void (*close)(EditBuffer *);
+#endif
 
     /* saved data from the last opened mode, needed to restore mode */
     /* CG: should instead keep a pointer to last window using this
@@ -862,7 +894,7 @@
     struct ModeSavedData *saved_data;
 
     /* default mode stuff when buffer is detached from window */
-    int offset;         /* used in eval.c */
+    int offset;
 
     int tab_width;
     int fill_column;
@@ -879,15 +911,6 @@
      */
 };
 
-/* high level buffer type handling */
-typedef struct EditBufferDataType {
-    const char *name; /* name of buffer data type (text, image, ...) */
-    int (*buffer_load)(EditBuffer *b, FILE *f);
-    int (*buffer_save)(EditBuffer *b, int start, int end, const char 
*filename);
-    void (*buffer_close)(EditBuffer *b);
-    struct EditBufferDataType *next;
-} EditBufferDataType;
-
 /* the log buffer is used for the undo operation */
 /* header of log operation */
 typedef struct LogBuffer {
@@ -1049,25 +1072,6 @@
 
 /* qe.c */
 
-#define COLORED_MAX_LINE_SIZE  4096
-
-/* colorize & transform a line, lower level then ColorizeFunc */
-typedef int (*GetColorizedLineFunc)(EditState *s,
-                                    unsigned int *buf, int buf_size,
-                                    int *offset1, int line_num);
-
-typedef struct QEColorizeContext {
-    EditState *s;
-    int colorize_state;
-    int state_only;
-} QEColorizeContext;
-
-/* colorize a line: this function modifies buf to set the char
- * styles. 'buf' is guaranted to have one more '\0' char after its len.
- */
-typedef void (*ColorizeFunc)(QEColorizeContext *cp,
-                             unsigned int *buf, int n, int mode_flags);
-
 /* contains all the information necessary to uniquely identify a line,
    to avoid displaying it */
 typedef struct QELineShadow {
@@ -1113,6 +1117,7 @@
                                   (list mode only) */
     /* low level colorization function */
     GetColorizedLineFunc get_colorized_line;
+
     /* colorization function */
     ColorizeFunc colorize_func;
     /* default text style */
@@ -1181,11 +1186,6 @@
 /* Ugly patch for saving/restoring window data upon switching buffer */
 #define SAVED_DATA_SIZE  offsetof(EditState, end_of_saved_data)
 
-typedef struct DisplayState DisplayState;
-typedef struct ModeProbeData ModeProbeData;
-typedef struct ModeSavedData ModeSavedData;
-typedef struct ModeDef ModeDef;
-
 struct ModeProbeData {
     const char *real_filename;
     const char *filename;  /* reduced filename for mode matching purposes */
@@ -1214,6 +1214,7 @@
     const char *extensions;
     //const char *mode_line;
     int instance_size; /* size of malloced instance */
+
     /* return the percentage of confidence */
     int (*mode_probe)(ModeDef *, ModeProbeData *);
     int (*mode_init)(EditState *, ModeSavedData *);
@@ -1230,6 +1231,7 @@
     /* text related functions */
     int (*text_display)(EditState *, DisplayState *, int);
     int (*text_backward_offset)(EditState *, int);
+
     ColorizeFunc colorize_func;
 
     /* common functions are defined here */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]