lynx-dev
[Top][All Lists]
Advanced

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

lynx-dev (patch) simplify ifdefing with new USE_MOUSE symbol


From: Leonid Pauzner
Subject: lynx-dev (patch) simplify ifdefing with new USE_MOUSE symbol
Date: Sun, 2 Apr 2000 16:26:12 +0400 (MSD)

> not really.  send a patch - but bear in mind that it can lead to the same
> sort of problems as did my cleanup of getbkgd().

> --
> Thomas E. Dickey

Well, I made a patch


* Add USE_MOUSE simbol: cleanup/simplify ifdefing of mouse code,
  replace USE_SLANG_MOUSE / NCURSES_MOUSE_VERSION / PDCURSES_MOUSE_VERSION
  with USE_MOUSE (and modifier when neccessary).
* Revise windows makefiles: there was _both_ NCURSES and PDCURSES
  symbols defined - leave only PDCURSES for now; add new symbols
  - SOURCE_CACHE and USE_PRETTYSRC, remove obsolete EXP_CHARTRANS.


There should not be any problem but please test,
Windows people in particular.
At least I do not understand this DOSPATH
in LYStrings.c fragment below:

> @@ -1464,7 +1478,7 @@
>
>  #if defined(IGNORE_CTRL_C) || defined(USE_GETCHAR) || !defined(NCURSES) || \
>      (HAVE_KEYPAD && defined(KEY_RESIZE)) || \
> -    (defined(NCURSES_MOUSE_VERSION) && !defined(DOSPATH))
> +    (defined(NCURSES) && defined(USE_MOUSE) && !defined(DOSPATH))
>  re_read:
>  #endif /* IGNORE_CTRL_C || USE_GETCHAR etc. */
>  #if !defined(UCX) || !defined(VAXC) /* errno not modifiable ? */



diff -u -r LYNX2-8-.P1/makefile.bcb LYNX2-8-/makefile.bcb
--- LYNX2-8-.P1/makefile.bcb    Sun Mar 26 19:14:00 2000
+++ LYNX2-8-/makefile.bcb       Sun Apr  2 15:35:52 2000
@@ -47,19 +47,15 @@
 -DNOSIGHUP \
 -DDOSPATH \
 -DNOUSERS \
--DEXP_CHARTRANS \
--DNCURSES \
+-DPDCURSES \
 -DFANCY_CURSES \
 -DCOLOR_CURSES \
 -DUSE_COLOR_TABLE \
 -DHAVE_KEYPAD \
--DNCURSES_VERSION \
 -DUSE_EXTERNALS \
 -DUSE_ZLIB \
--DPDCURSES \
 -DSUPPORT_MULTIBYTE_EDIT \
 -DUSE_MULTIBYTE_CURSES \
--DNCURSES_MOUSE_VERSION \
 -DLONG_LIST \
 -DDISP_PARTIAL \
 -DHAVE_DIRENT_H=1 \
@@ -67,7 +63,7 @@
 -DNO_CONFIG_INFO \
 -DEXP_ALT_BINDINGS \
 -DSOURCE_CACHE \
--DUSE_PSRC \
+-DUSE_PRETTYSRC \
 ### Add by Hiroyuki
 -DLY_MAXPATH=1024 \
 -D_WIN_CC=1 \
diff -u -r LYNX2-8-.P1/makefile.msc LYNX2-8-/makefile.msc
--- LYNX2-8-.P1/makefile.msc    Fri Mar 31 16:33:40 2000
+++ LYNX2-8-/makefile.msc       Sun Apr  2 15:32:34 2000
@@ -34,13 +34,10 @@
  /D "DISP_PARTIAL" \
  /D "DOSPATH" \
  /D "EXP_ALT_BINDINGS" \
- /D "EXP_CHARTRANS" \
  /D "EXP_PERSISTENT_COOKIES" \
  /D "FANCY_CURSES" \
  /D "HAVE_KEYPAD" \
  /D "LONG_LIST" \
- /D "NCURSES" \
- /D "NCURSES_VERSION" \
  /D "NDEBUG" \
  /D "NO_CONFIG_INFO" \
  /D "NO_CUSERID" \
@@ -52,10 +49,12 @@
  /D "NOUSERS" \
  /D "PDCURSES" \
  /D "SH_EX" \
+ /D "SOURCE_CACHE" \
  /D "SUPPORT_MULTIBYTE_EDIT" \
  /D "USE_COLOR_TABLE" \
  /D "USE_EXTERNALS" \
  /D "USE_MULTIBYTE_CURSES" \
+ /D "USE_PRETTYSRC" \
  /D "USE_ZLIB" \
  /D "WIN_EX" \
  /D "WIN32" \
@@ -148,6 +147,7 @@
        "LYTraversal.obj" \
        "LYUpload.obj" \
        "LYUtils.obj" \
+       "LYPrettySrc.obj" \
        "SGML.obj" \
        "TRSTable.obj" \
        "UCAuto.obj" \
@@ -294,6 +294,9 @@

 LYUtils.obj : $(SRC_DIR)\LYUtils.c
        $(COMPILE) $(SRC_DIR)\LYUtils.c
+
+LYPrettySrc.obj : $(SRC_DIR)\LYPrettySrc.c
+       $(COMPILE) $(SRC_DIR)\LYPrettySrc.c

 TRSTable.obj : $(SRC_DIR)\TRSTable.c
        $(COMPILE) $(SRC_DIR)\TRSTable.c
diff -u -r LYNX2-8-.P1/makelynx.bat LYNX2-8-/makelynx.bat
--- LYNX2-8-.P1/makelynx.bat    Wed Nov 17 20:08:08 1999
+++ LYNX2-8-/makelynx.bat       Sun Apr  2 15:33:50 2000
@@ -40,20 +40,19 @@
 SET DEFINES=%DEFINES% -DNOUSERS
 SET DEFINES=%DEFINES% -DLONG_LIST
 SET DEFINES=%DEFINES% -DDISP_PARTIAL
+SET DEFINES=%DEFINES% -DSOURCE_CACHE
+SET DEFINES=%DEFINES% -DUSE_PRETTYSRC
 SET DEFINES=%DEFINES% -DVC="2.14FM"
 if "%LIBRARY%" == "PDCURSES" goto else1
 SET DEFINES=%DEFINES% -DUSE_SLANG
 goto endif1
 :else1
-SET DEFINES=%DEFINES% -DNCURSES
+SET DEFINES=%DEFINES% -DPDCURSES
 SET DEFINES=%DEFINES% -DFANCY_CURSES
 SET DEFINES=%DEFINES% -DCOLOR_CURSES
 SET DEFINES=%DEFINES% -DUSE_COLOR_TABLE
-SET DEFINES=%DEFINES% -DNCURSES_VERSION
-SET DEFINES=%DEFINES% -DPDCURSES
 SET DEFINES=%DEFINES% -DSUPPORT_MULTIBYTE_EDIT
 SET DEFINES=%DEFINES% -DUSE_MULTIBYTE_CURSES
-SET DEFINES=%DEFINES% -DNCURSES_MOUSE_VERSION
 :endif1
 SET DEFINES=%DEFINES% -DUSE_EXTERNALS

diff -u -r LYNX2-8-.P1/src/lycurses.c LYNX2-8-/src/lycurses.c
--- LYNX2-8-.P1/src/lycurses.c  Fri Mar 31 16:33:40 2000
+++ LYNX2-8-/src/lycurses.c     Sun Apr  2 13:56:42 2000
@@ -920,6 +920,8 @@

 PUBLIC void lynx_enable_mouse ARGS1(int,state)
 {
+#ifdef USE_MOUSE
+/***********************************************************************/

 #if defined(WIN_EX)
 /* modify lynx_enable_mouse() for pdcurses configuration so that mouse support
@@ -939,19 +941,20 @@
     if (LYUseMouse == 0)
        return;

-#ifdef USE_SLANG_MOUSE
+
+#if defined(USE_SLANG)
     SLtt_set_mouse_mode (state, 0);
     SLtt_flush_output ();
 #else

-#if defined(WIN_EX) && defined(PDCURSES_MOUSE_VERSION)
+#if defined(WIN_EX) && defined(PDCURSES)
     if (state)
     {
        SetConsoleMode(hConIn, ENABLE_MOUSE_INPUT | ENABLE_WINDOW_INPUT);
        FlushConsoleInputBuffer(hConIn);
     }
 #else
-#ifdef NCURSES_MOUSE_VERSION
+#if defined(NCURSES)
     if (state) {
        /* Compensate for small value of maxclick in ncurses.  */
        static int was = 0;
@@ -983,17 +986,20 @@
                  NULL);
     } else
        mousemask(0, NULL);
-#endif /* NCURSES_MOUSE_VERSION */
-#endif /* WIN_EX and PDCURSES_MOUSE_VERSION */
+#endif /* NCURSES */
+#endif /* WIN_EX and PDCURSES */

-#if defined(PDCURSES_MOUSE_VERSION)
+#if defined(PDCURSES)
     if (state)
        mouse_set(
                BUTTON1_CLICKED | BUTTON1_PRESSED | BUTTON1_RELEASED |
                BUTTON2_CLICKED | BUTTON2_PRESSED | BUTTON2_RELEASED |
                BUTTON3_CLICKED | BUTTON3_PRESSED | BUTTON3_RELEASED);
 #endif
-#endif                         /* NOT USE_SLANG_MOUSE */
+#endif      /* NOT USE_SLANG */
+
+/***********************************************************************/
+#endif /* USE_MOUSE */
 }

 PUBLIC void stop_curses NOARGS
diff -u -r LYNX2-8-.P1/src/lycurses.h LYNX2-8-/src/lycurses.h
--- LYNX2-8-.P1/src/lycurses.h  Fri Mar 31 16:33:40 2000
+++ LYNX2-8-/src/lycurses.h     Sun Apr  2 15:43:58 2000
@@ -125,7 +125,14 @@
  * PDCurses' mouse code does nothing in the DJGPP configuration.
  */
 #if defined(PDCURSES) && !defined(__DJGPP__)
-#define PDCURSES_MOUSE_VERSION 1
+#define USE_MOUSE 1
+#endif
+
+/*
+ * Pick up the native ncurses name:
+ */
+#if defined(NCURSES_MOUSE_VERSION)
+#define USE_MOUSE 1
 #endif

 #ifdef VMS
@@ -228,7 +235,7 @@
 #define SHOW_WHEREIS_TARGETS 1

 #if !defined(VMS) && !defined(DJGPP)
-#define USE_SLANG_MOUSE                1
+#define USE_MOUSE              1
 #endif

 #if !defined(__DJGPP__) && !defined(__CYGWIN__)
diff -u -r LYNX2-8-.P1/src/lyforms.c LYNX2-8-/src/lyforms.c
--- LYNX2-8-.P1/src/lyforms.c   Fri Mar 31 16:33:40 2000
+++ LYNX2-8-/src/lyforms.c      Sun Apr  2 16:11:50 2000
@@ -462,11 +462,13 @@
            ch = 7;
        }
 #endif /* VMS */
-#  if defined(NCURSES_MOUSE_VERSION) || defined(PDCURSES_MOUSE_VERSION)
+
+#ifdef USE_MOUSE
+#  if defined(NCURSES) || defined(PDCURSES)
        if (ch != -1 && (ch & LKC_ISLAC) && !(ch & LKC_ISLECLAC)) /* already 
lynxactioncode? */
            break;      /* @@@ maybe move these 2 lines outside ifdef -kw */
        if (ch == MOUSE_KEY) {          /* Need to process ourselves */
-#if defined(PDCURSES_MOUSE_VERSION)
+#if defined(PDCURSES)
            int curx, cury;

            request_mouse_pos();
@@ -493,7 +495,7 @@
                } else
                    ch = RTARROW;
            }
-#endif /* PDCURSES_MOUSE_VERSION */
+#endif /* PDCURSES */
            else {
                /*  Mouse event passed to us as MOUSE_KEY, and apparently
                 *  not on this field's line?  Something is not as it
@@ -506,7 +508,9 @@
            }
            last_xlkc = -1;
        } else
-#  endif       /* defined NCURSES_MOUSE_VERSION || PDCURSES_MOUSE_VERSION */
+#  endif     /* NCURSES || PDCURSES */
+#endif /* USE_MOUSE */
+
        {
            if (!(ch & LKC_ISLECLAC))
                ch |= MyEdit.current_modifiers;
diff -u -r LYNX2-8-.P1/src/lymain.c LYNX2-8-/src/lymain.c
--- LYNX2-8-.P1/src/lymain.c    Fri Mar 31 16:33:40 2000
+++ LYNX2-8-/src/lymain.c       Sun Apr  2 13:27:54 2000
@@ -3617,7 +3617,7 @@
       "underscore",    TOGGLE_ARG,             &use_underscore,
       "toggles use of _underline_ format in dumps"
    ),
-#if defined(NCURSES_MOUSE_VERSION) || defined(PDCURSES_MOUSE_VERSION) || 
defined(USE_SLANG_MOUSE)
+#if defined(USE_MOUSE)
    PARSE_SET(
       "use_mouse",     SET_ARG,                &LYUseMouse,
       "turn on mouse support"
diff -u -r LYNX2-8-.P1/src/lymainlo.c LYNX2-8-/src/lymainlo.c
--- LYNX2-8-.P1/src/lymainlo.c  Sun Mar 26 19:14:00 2000
+++ LYNX2-8-/src/lymainlo.c     Sun Apr  2 14:53:02 2000
@@ -452,6 +452,7 @@

 PRIVATE int do_change_link NOARGS
 {
+#ifdef USE_MOUSE
     /* Is there a mouse-clicked link waiting? */
     int mouse_tmp = get_mouse_link();
     /* If yes, use it as the link */
@@ -467,6 +468,7 @@
        }
        set_curdoc_link(mouse_tmp);
     }
+#endif /* USE_MOUSE */
     return(0);                 /* indicates OK */
 }

diff -u -r LYNX2-8-.P1/src/lyoption.c LYNX2-8-/src/lyoption.c
--- LYNX2-8-.P1/src/lyoption.c  Fri Mar 31 16:33:40 2000
+++ LYNX2-8-/src/lyoption.c     Sun Apr  2 13:33:02 2000
@@ -28,7 +28,7 @@

 PRIVATE void terminate_options PARAMS((int sig));

-#if !defined(NO_OPTION_MENU) || (defined(NCURSES_MOUSE_VERSION) || 
defined(PDCURSES_MOUSE_VERSION))
+#if !defined(NO_OPTION_MENU) || (defined(USE_MOUSE) && (defined(NCURSES) || 
defined(PDCURSES)))
 #define COL_OPTION_VALUES 36  /* display column where option values start */
 #endif

@@ -2138,7 +2138,7 @@
     signal(SIGINT, cleanup_sig);
 }

-#if !defined(NO_OPTION_MENU) || (defined(NCURSES_MOUSE_VERSION) || 
defined(PDCURSES_MOUSE_VERSION))
+#if !defined(NO_OPTION_MENU) || (defined(USE_MOUSE) && (defined(NCURSES) || 
defined(PDCURSES)))
 /*
 **  This function prompts for a choice or page number.
 **  If a 'g' or 'p' suffix is included, that will be
@@ -2384,7 +2384,7 @@
        StrAllocCopy(popup_status_msg, CHOICE_LIST_UNM_MSG);
     } else if (!for_mouse) {
        StrAllocCopy(popup_status_msg, CHOICE_LIST_MESSAGE);
-#if defined(NCURSES_MOUSE_VERSION) || defined(PDCURSES_MOUSE_VERSION)
+#if defined(USE_MOUSE) && (defined(NCURSES) || defined(PDCURSES))
     } else {
        StrAllocCopy(popup_status_msg, gettext(
                "Left mouse button or return to select, arrow keys to 
scroll."));
diff -u -r LYNX2-8-.P1/src/lyreadcf.c LYNX2-8-/src/lyreadcf.c
--- LYNX2-8-.P1/src/lyreadcf.c  Fri Mar 31 16:33:40 2000
+++ LYNX2-8-/src/lyreadcf.c     Sun Apr  2 13:28:24 2000
@@ -1563,7 +1563,7 @@
 #ifdef VMS
      PARSE_SET("use_fixed_records", CONF_BOOL, &UseFixedRecords),
 #endif
-#if defined(NCURSES_MOUSE_VERSION) || defined(PDCURSES_MOUSE_VERSION) || 
defined(USE_SLANG_MOUSE)
+#if defined(USE_MOUSE)
      PARSE_SET("use_mouse", CONF_BOOL, &LYUseMouse),
 #endif
      PARSE_SET("use_select_popups", CONF_BOOL, &LYSelectPopups),
diff -u -r LYNX2-8-.P1/src/lystring.c LYNX2-8-/src/lystring.c
--- LYNX2-8-.P1/src/lystring.c  Fri Mar 31 16:33:40 2000
+++ LYNX2-8-/src/lystring.c     Sun Apr  2 14:46:10 2000
@@ -15,7 +15,7 @@
 #include <HTString.h>
 #include <LYCharUtils.h>
 #include <HTParse.h>
-#if defined(NCURSES_MOUSE_VERSION) || defined(PDCURSES_MOUSE_VERSION) || 
defined(USE_SLANG_MOUSE)
+#ifdef USE_MOUSE
 #include <LYMainLoop.h>
 #endif

@@ -74,14 +74,14 @@

 static int have_levent;

-#if defined(NCURSES_MOUSE_VERSION)
+#if defined(USE_MOUSE) && defined(NCURSES)
 static MEVENT levent;
 #endif

 /* Return the value of mouse_link */
 PUBLIC int peek_mouse_levent NOARGS
 {
-#if defined(NCURSES_MOUSE_VERSION)
+#if defined(USE_MOUSE) && defined(NCURSES)
     if (have_levent > 0) {
        ungetmouse(&levent);
        have_levent--;
@@ -108,14 +108,17 @@
     return mouse_link;
 }

+
 PUBLIC int fancy_mouse ARGS3(
     WINDOW *,  win,
     int,       row,
     int *,     position)
 {
     int cmd = LYK_DO_NOTHING;
+#ifdef USE_MOUSE
+/*********************************************************************/

-#if defined(WIN_EX) && defined(PDCURSES_MOUSE_VERSION)
+#if defined(WIN_EX) && defined(PDCURSES)

     request_mouse_pos();

@@ -171,7 +174,7 @@
        cmd = LYK_QUIT;
     }
 #else
-#if defined(NCURSES_MOUSE_VERSION)
+#if defined(NCURSES)
     MEVENT     event;

     getmouse(&event);
@@ -252,11 +255,15 @@
     } else if (event.bstate & (BUTTON3_CLICKED | BUTTON3_DOUBLE_CLICKED | 
BUTTON3_TRIPLE_CLICKED)) {
        cmd = LYK_QUIT;
     }
-#endif /* defined(NCURSES_MOUSE_VERSION) */
+#endif /* NCURSES */
 #endif /* _WINDOWS */
+
+/************************************************************************/
+#endif  /* USE_MOUSE */
     return cmd;
 }

+
 PRIVATE int XYdist ARGS5(
     int,       x1,
     int,       y1,
@@ -661,7 +668,8 @@
 }
 #endif

-#ifdef USE_SLANG_MOUSE
+
+#if defined(USE_SLANG) && defined(USE_MOUSE)
 PRIVATE int sl_parse_mouse_event ARGS3(int *, x, int *, y, int *, button)
 {
     /* "ESC [ M" has already been processed.  There more characters are
@@ -719,7 +727,8 @@
    else
        return -1;
 }
-#endif
+#endif  /* USE_SLANG and USE_MOUSE */
+

 PRIVATE BOOLEAN csi_is_csi = TRUE;
 PUBLIC void ena_csi ARGS1(
@@ -1263,7 +1272,8 @@

 #endif                                /* USE_KEYMAPS */

-#if defined(NCURSES_MOUSE_VERSION) || defined(PDCURSES_MOUSE_VERSION)
+
+#if defined(USE_MOUSE) && (defined(NCURSES) || defined(PDCURSES))
 PRIVATE int LYmouse_menu ARGS4(int, x, int, y, int, atlink, int, code)
 {
     static char *choices[] = {
@@ -1395,9 +1405,11 @@
     }
     return retlac;
 }
-#endif /* NCURSES_MOUSE_VERSION */
+#endif /* USE_MOUSE && (NCURSES || PDCURSES) */
+

 #if defined(USE_KEYMAPS) && defined(USE_SLANG)
+/************************************************************************/

 PRIVATE int current_sl_modifier = 0;

@@ -1423,7 +1435,7 @@

    keysym = key->f.keysym;

-#if defined (USE_SLANG_MOUSE)
+#if defined (USE_MOUSE)
    if (keysym == MOUSE_KEYSYM)
      return sl_read_mouse_event (code);
 #endif
@@ -1446,8 +1458,10 @@
    return (keysym|current_sl_modifier);
 }

+/************************************************************************/
 #else  /* NOT  defined(USE_KEYMAPS) && defined(USE_SLANG) */

+
 /*
  *  LYgetch() translates some escape sequences and may fake noecho.
  */
@@ -1464,7 +1478,7 @@

 #if defined(IGNORE_CTRL_C) || defined(USE_GETCHAR) || !defined(NCURSES) || \
     (HAVE_KEYPAD && defined(KEY_RESIZE)) || \
-    (defined(NCURSES_MOUSE_VERSION) && !defined(DOSPATH))
+    (defined(NCURSES) && defined(USE_MOUSE) && !defined(DOSPATH))
 re_read:
 #endif /* IGNORE_CTRL_C || USE_GETCHAR etc. */
 #if !defined(UCX) || !defined(VAXC) /* errno not modifiable ? */
@@ -1616,7 +1630,7 @@
        case 'w': c = HOME;    break;  /* keypad on pc ncsa telnet */
        case 'q': c = END_KEY; break;  /* keypad on pc ncsa telnet */
        case 'M':
-#ifdef USE_SLANG_MOUSE
+#if defined(USE_SLANG) && defined(USE_MOUSE)
           if (found_CSI(c,b))
             {
                c = sl_read_mouse_event (code);
@@ -1954,13 +1968,17 @@
           c = 0x218;
           break;
 #endif /* PDCurses */
-#if defined(NCURSES_MOUSE_VERSION) || defined(PDCURSES_MOUSE_VERSION)
+
+#if defined(USE_MOUSE)
+/********************************************************************/
+
+#if defined(NCURSES) || defined(PDCURSES)
        case KEY_MOUSE:
            CTRACE((tfp, "KEY_MOUSE\n"));
            if (code == FOR_CHOICE) {
                c = MOUSE_KEY;          /* Will be processed by the caller */
            }
-#if defined(NCURSES_MOUSE_VERSION)
+#if defined(NCURSES)
            else if (code == FOR_SINGLEKEY) {
                MEVENT event;
                getmouse(&event);       /* Completely ignore event - kw */
@@ -1968,7 +1986,7 @@
            }
 #endif
            else {
-#if defined(NCURSES_MOUSE_VERSION)
+#if defined(NCURSES)
                MEVENT event;
                int err;
                int lac = LYK_UNKNOWN;
@@ -2150,7 +2168,11 @@
                    return(c);
            }
            break;
-#endif /* NCURSES_MOUSE_VERSION */
+#endif /* NCURSES || PDCURSES */
+
+/********************************************************************/
+#endif  /* USE_MOUSE */
+
        }
 #endif /* HAVE_KEYPAD */
 #ifdef DJGPP_KEYHANDLER
@@ -2269,7 +2291,9 @@
     }
 }

+/************************************************************************/
 #endif /* NOT  defined(USE_KEYMAPS) && defined(USE_SLANG) */
+

 PUBLIC int LYgetch NOARGS
 {



reply via email to

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