qemacs-commit
[Top][All Lists]
Advanced

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

[Qemacs-commit] qemacs Makefile qe.c tty.c


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs Makefile qe.c tty.c
Date: Mon, 24 Dec 2007 10:22:22 +0000

CVSROOT:        /cvsroot/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        07/12/24 10:22:22

Modified files:
        .              : Makefile qe.c tty.c 

Log message:
        fixed Cygwin compile:
        - fixed clash on FWRITE redefinition
        - fixed crash on do_toggle_control_h(NULL...)
        - fixed some Makefile issues

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/Makefile?cvsroot=qemacs&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.c?cvsroot=qemacs&r1=1.52&r2=1.53
http://cvs.savannah.gnu.org/viewcvs/qemacs/tty.c?cvsroot=qemacs&r1=1.31&r2=1.32

Patches:
Index: Makefile
===================================================================
RCS file: /cvsroot/qemacs/qemacs/Makefile,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- Makefile    21 Dec 2007 14:24:08 -0000      1.25
+++ Makefile    24 Dec 2007 10:22:22 -0000      1.26
@@ -81,7 +81,11 @@
 LIBS+=-lm
 
 TARGETLIBS:=
-TARGETS+=qe$(EXE) qe-doc.html kmaps ligatures
+TARGETS+=qe$(EXE) kmaps ligatures
+
+ifndef CONFIG_CYGWIN
+TARGETS+=qe-doc.html
+endif
 
 OBJS=qe.o charset.o buffer.o \
      input.o unicode_join.o display.o util.o hex.o list.o cutils.o
@@ -163,7 +167,7 @@
        cp $< $@
        $(STRIP) $@
        @ls -l $@
-       echo `size qe` `wc --bytes qe` qe $(OPTIONS) \
+       echo `size address@hidden `wc --bytes address@hidden qe $(OPTIONS) \
                | cut -d ' ' -f 7-10,13,15-40 >> STATS
 
 ffplay$(EXE): qe$(EXE) Makefile

Index: qe.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/qe.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -b -r1.52 -r1.53
--- qe.c        24 Dec 2007 09:31:36 -0000      1.52
+++ qe.c        24 Dec 2007 10:22:22 -0000      1.53
@@ -203,7 +203,10 @@
 
 void do_toggle_control_h(EditState *s, int set)
 {
-    QEmacsState *qs = s->qe_state;
+    /* Achtung Minen! do_toggle_control_h can be called from tty_init
+     * with a NULL EditState.
+     */
+    QEmacsState *qs = s ? s->qe_state : &qe_state;
     KeyDef *p;
     int i;
 
@@ -7224,6 +7227,9 @@
 extern void module_video_init(void); /* video.c(979) */
 extern void module_image_init(void); /* image.c(844) */
 extern void module_mpeg_init(void); /* mpeg.c(181) */
+extern void module_htmlsrc_init(void); /* htmlsrc.c(307) */
+extern void module_makefile_init(void); /* makemode.c(191) */
+extern void module_perl_init(void); /* perl.c(374) */
 
 static inline void init_all_modules(void)
 {
@@ -7255,6 +7261,9 @@
     module_bufed_init(); /* bufed.c(197) */
     module_shell_init(); /* shell.c(922) */
     module_dired_init(); /* dired.c(369) */
+    module_htmlsrc_init(); /* htmlsrc.c(307) */
+    module_makefile_init(); /* makemode.c(191) */
+    module_perl_init(); /* perl.c(374) */
 #endif
 #ifdef CONFIG_WIN32
     module_win32_init(); /* win32.c(504) */

Index: tty.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/tty.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- tty.c       24 Dec 2007 09:31:36 -0000      1.31
+++ tty.c       24 Dec 2007 10:22:22 -0000      1.32
@@ -39,18 +39,18 @@
 #define TTYCHAR_GETBG(cc)   (((cc) >> 24) & 0xFF)
 #define TTYCHAR_DEFAULT     TTYCHAR(' ', 0, 0)
 
-#if defined(__GNUC__)
-#  define PUTC(c,f)         putc_unlocked(c, f)
-#  define FWRITE(b,s,n,f)   fwrite_unlocked(b, s, n, f)
-#  define FPRINTF           fprintf
-static inline void FPUTS(const char *s, FILE *fp) {
-    FWRITE(s, 1, strlen(s), fp);
+#if defined(__GNUC__) && !defined(CONFIG_CYGWIN)
+#  define TTY_PUTC(c,f)         putc_unlocked(c, f)
+#  define TTY_FWRITE(b,s,n,f)   fwrite_unlocked(b, s, n, f)
+#  define TTY_FPRINTF           fprintf
+static inline void TTY_FPUTS(const char *s, FILE *fp) {
+    TTY_FWRITE(s, 1, strlen(s), fp);
 }
 #else
-#  define PUTC(c,f)         putc(c, f)
-#  define FWRITE(b,s,n,f)   fwrite(b, s, n, f)
-#  define FPRINTF           fprintf
-#  define FPUTS             fputs
+#  define TTY_PUTC(c,f)         putc(c, f)
+#  define TTY_FWRITE(b,s,n,f)   fwrite(b, s, n, f)
+#  define TTY_FPRINTF           fprintf
+#  define TTY_FPUTS             fputs
 #endif
 
 enum InputState {
@@ -167,7 +167,7 @@
            "\033)0\033(B"       /* select character sets in block 0 and 1 */
            "\017");             /* shift out */
 #else
-    FPRINTF(s->STDOUT,
+    TTY_FPRINTF(s->STDOUT,
             "\033[?1049h"       /* enter_ca_mode */
             "\033[m\033(B"      /* exit_attribute_mode */
             "\033[4l"          /* exit_insert_mode */
@@ -191,10 +191,10 @@
         /*               ^X  ^Z    ^M   \170101  */
         //printf("%s", "\030\032" "\r\xEF\x81\x81" "\033[6n\033D");
         /* Just print utf-8 encoding for eacute and check cursor position */
-        FPRINTF(s->STDOUT, "%s", "\030\032" "\r\xC3\xA9" "\033[6n\033D");
+        TTY_FPRINTF(s->STDOUT, "%s", "\030\032" "\r\xC3\xA9" "\033[6n\033D");
         fflush(s->STDOUT);
         n = fscanf(s->STDIN, "\033[%u;%u", &y, &x);  /* get cursor position */
-        FPRINTF(s->STDOUT, "\r   \r");            /* go back, erase 3 chars */
+        TTY_FPRINTF(s->STDOUT, "\r   \r");        /* go back, erase 3 chars */
         if (n == 2 && x == 2) {
             s->charset = &charset_utf8;
         }
@@ -233,8 +233,8 @@
            s->height, 1);
 #else
     /* go to last line and clear it */
-    FPRINTF(s->STDOUT, "\033[%d;%dH\033[m\033[K", s->height, 1);
-    FPRINTF(s->STDOUT,
+    TTY_FPRINTF(s->STDOUT, "\033[%d;%dH\033[m\033[K", s->height, 1);
+    TTY_FPRINTF(s->STDOUT,
             "\033[?1049l"        /* exit_ca_mode */
             "\r"                 /* return */
             "\033[?1l\033>"      /* keypad_local */
@@ -751,7 +751,7 @@
             if (ptr1 == ptr2)
                 continue;
 
-            FPRINTF(s->STDOUT, "\033[%d;%dH", y + 1, ptr1 - ptr + 1);
+            TTY_FPRINTF(s->STDOUT, "\033[%d;%dH", y + 1, ptr1 - ptr + 1);
 
             /* CG: should scan for sequences of blanks */
             while (ptr1 < ptr2) {
@@ -765,59 +765,61 @@
                     ||  (bgcolor != (int)TTYCHAR_GETBG(cc))) {
                         fgcolor = TTYCHAR_GETFG(cc);
                         bgcolor = TTYCHAR_GETBG(cc);
-                        FPRINTF(s->STDOUT, "\033[%d;%d;%dm",
-                                (fgcolor > 7) ? 1 : 22,
+                        TTY_FPRINTF(s->STDOUT, "\033[%dm",
+                                (fgcolor > 7) ? 1 : 22);
+                        TTY_FPRINTF(s->STDOUT, "\033[%d;%dm",
+                                //(fgcolor > 7) ? 1 : 22,
                                 30 + (fgcolor & 7), 40 + bgcolor);
                     }
                     /* do not display escape codes or invalid codes */
                     if (ch < 32 || ch == 127) {
                         if (shifted) {
-                            FPUTS("\033(B", s->STDOUT);
+                            TTY_FPUTS("\033(B", s->STDOUT);
                             shifted = 0;
                         }
-                        PUTC('.', s->STDOUT);
+                        TTY_PUTC('.', s->STDOUT);
                     } else
                     if (ch < 127) {
                         if (shifted) {
-                            FPUTS("\033(B", s->STDOUT);
+                            TTY_FPUTS("\033(B", s->STDOUT);
                             shifted = 0;
                         }
-                        PUTC(ch, s->STDOUT);
+                        TTY_PUTC(ch, s->STDOUT);
                     } else
                     if (ch < 128 + 32) {
                         /* Kludge for linedrawing chars */
                         if (!shifted) {
-                            FPUTS("\033(0", s->STDOUT);
+                            TTY_FPUTS("\033(0", s->STDOUT);
                             shifted = 1;
                         }
-                        PUTC(ch - 32, s->STDOUT);
+                        TTY_PUTC(ch - 32, s->STDOUT);
                     } else {
                         // was in qemacs-0.3.1.g2.gw/tty.c:
                         // if (cc == 0x2500)
                         //    printf("\016x\017");
                         /* s->charset is either vt100 or utf-8 */
                         if (shifted) {
-                            FPUTS("\033(B", s->STDOUT);
+                            TTY_FPUTS("\033(B", s->STDOUT);
                             shifted = 0;
                         }
                         nc = unicode_to_charset(buf, cc, s->charset);
                         if (nc == 1) {
-                            PUTC(*(u8 *)buf, s->STDOUT);
+                            TTY_PUTC(*(u8 *)buf, s->STDOUT);
                         } else
                         {
-                            FWRITE(buf, 1, nc, s->STDOUT);
+                            TTY_FWRITE(buf, 1, nc, s->STDOUT);
                         }
                     }
                 }
             }
             if (shifted) {
-                FPUTS("\033(B", s->STDOUT);
+                TTY_FPUTS("\033(B", s->STDOUT);
                 shifted = 0;
             }
         }
     }
 
-    FPRINTF(s->STDOUT, "\033[%d;%dH", ts->cursor_y + 1, ts->cursor_x + 1);
+    TTY_FPRINTF(s->STDOUT, "\033[%d;%dH", ts->cursor_y + 1, ts->cursor_x + 1);
     fflush(s->STDOUT);
 }
 




reply via email to

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