qemacs-commit
[Top][All Lists]
Advanced

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

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


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs buffer.c qe.h
Date: Sat, 11 Jan 2014 15:07:14 +0000

CVSROOT:        /sources/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        14/01/11 15:07:14

Modified files:
        .              : buffer.c qe.h 

Log message:
        extend eb_match_xxx APIs to update end offset

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/buffer.c?cvsroot=qemacs&r1=1.55&r2=1.56
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.h?cvsroot=qemacs&r1=1.114&r2=1.115

Patches:
Index: buffer.c
===================================================================
RCS file: /sources/qemacs/qemacs/buffer.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -b -r1.55 -r1.56
--- buffer.c    11 Jan 2014 14:38:30 -0000      1.55
+++ buffer.c    11 Jan 2014 15:07:14 -0000      1.56
@@ -1497,12 +1497,16 @@
     return eb_insert_utf8_buf(b, offset, str, strlen(str));
 }
 
-int eb_match_uchar(EditBuffer *b, int offset, int c)
+int eb_match_uchar(EditBuffer *b, int offset, int c, int *offsetp)
 {
-    return eb_nextc(b, offset, &offset) == c;
+    if (eb_nextc(b, offset, &offset) != c)
+        return 0;
+    if (offsetp)
+        *offsetp = offset;
+    return 1;
 }
 
-int eb_match_str(EditBuffer *b, int offset, const char *str)
+int eb_match_str(EditBuffer *b, int offset, const char *str, int *offsetp)
 {
     const char *p = str;
 
@@ -1511,10 +1515,12 @@
         if (eb_nextc(b, offset, &offset) != c)
             return 0;
     }
+    if (offsetp)
+        *offsetp = offset;
     return 1;
 }
 
-int eb_match_istr(EditBuffer *b, int offset, const char *str)
+int eb_match_istr(EditBuffer *b, int offset, const char *str, int *offsetp)
 {
     const char *p = str;
 
@@ -1523,6 +1529,8 @@
         if (qe_toupper(eb_nextc(b, offset, &offset)) != qe_toupper(c))
             return 0;
     }
+    if (offsetp)
+        *offsetp = offset;
     return 1;
 }
 

Index: qe.h
===================================================================
RCS file: /sources/qemacs/qemacs/qe.h,v
retrieving revision 1.114
retrieving revision 1.115
diff -u -b -r1.114 -r1.115
--- qe.h        11 Jan 2014 14:38:30 -0000      1.114
+++ qe.h        11 Jan 2014 15:07:14 -0000      1.115
@@ -850,9 +850,9 @@
 int eb_insert_uchar(EditBuffer *b, int offset, int c);
 int eb_insert_utf8_buf(EditBuffer *b, int offset, const char *buf, int len);
 int eb_insert_str(EditBuffer *b, int offset, const char *str);
-int eb_match_uchar(EditBuffer *b, int offset, int c);
-int eb_match_str(EditBuffer *b, int offset, const char *str);
-int eb_match_istr(EditBuffer *b, int offset, const char *str);
+int eb_match_uchar(EditBuffer *b, int offset, int c, int *offsetp);
+int eb_match_str(EditBuffer *b, int offset, const char *str, int *offsetp);
+int eb_match_istr(EditBuffer *b, int offset, const char *str, int *offsetp);
 int eb_printf(EditBuffer *b, const char *fmt, ...) __attr_printf(2,3);
 void eb_line_pad(EditBuffer *b, int n);
 int eb_get_contents(EditBuffer *b, char *buf, int buf_size);



reply via email to

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