lynx-dev
[Top][All Lists]
Advanced

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

Re: lynx-dev Forms based options (patch)


From: Leonid Pauzner
Subject: Re: lynx-dev Forms based options (patch)
Date: Fri, 31 Jul 1998 01:39:21 +0400 (MSD)

I just learning the new code, I tweak a couple of lines
and ifdef the old stuff in options.c to made it easier maintainable
in future. My patch against dev18+(patch by Mike Castle) below.

One note:

> +       /*
> +        * assume_char_set
> +        */
> +       if (!strcmp(data[i].tag, assume_char_set_string)) {
> +           int newval;
> +
> +           newval = UCGetLYhndl_byMIME(data[i].value);
> +           /*
> +            *  Set the raw 8-bit or CJK mode defaults and
> +            *  character set if changed. - FM
> +            */
> +           /*
> +            * FIXME: I have no clue if I got this right.  Since this is
> +            * forms based, we should probably flag that we may have
> +            * changed something here, then when we're done, check to see
> +            * if the user also changed RAW mode.  If they did, take what
> +            * they set, even if it doesn't make sense.  Otherwise, use
> +            * what we calculate here.
> +            */
> +           if (newval != UCLYhndl_for_unspec) {
> +               UCLYhndl_for_unspec = newval;
> +               StrAllocCopy(UCAssume_MIMEcharset, data[i].value);
> +               LYRawMode = (UCLYhndl_for_unspec == current_char_set);
>              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> +               HTMLSetUseDefaultRawMode(current_char_set, LYRawMode);
> +               HTMLUseCharacterSet(current_char_set);
> +           }
>

Mike, your patch at this point differs from plain 'dev18' behavior.
It comes from history that RawMode works too complicated: it uses
~~5 functions from LYCharSets.c.
Not beeng involved in general code rewriting
(we may got CJK support broken, few of us can test it...)
we need to follow existing rules.

Brefly speaking, if we change assume_char_set
so that assume_char_set == display_char_set
we should get LYRawMode automatically ON,
but this is not appears from your code in fact.

Another note: we need to add some logic
for reloading with HTuncache_current_document()
to take options changes in effect for current document.


LP.


--- old\lyoption.c      Thu Jul 30 16:00:54 1998
+++ lyoption.c  Fri Jul 31 01:00:40 1998
@@ -23,6 +23,9 @@
 #include <LYLeaks.h>

 #define FREE(x) if (x) {free(x); x = NULL;}
+BOOLEAN term_options;
+
+#ifndef NEW_OPTIONS

 #ifdef VMS
 #define DISPLAY "DECW$DISPLAY"
@@ -32,7 +35,6 @@

 #define COL_OPTION_VALUES 36  /* display column where option values start */

-BOOLEAN term_options;
 PRIVATE void terminate_options PARAMS((int sig));
 PRIVATE int boolean_choice PARAMS((
        int             status,
@@ -61,6 +63,8 @@
 #define L_User_Mode (use_assume_charset ? L_USER_MODE + 1 : L_USER_MODE)
 #define L_User_Agent (use_assume_charset ? L_USER_AGENT + 1 : L_USER_AGENT)

+#endif /* !NEW_OPTIONS */
+
 PRIVATE void option_statusline ARGS1(
        CONST char *,           text)
 {
@@ -108,6 +112,8 @@
     LYStatusLine = -1;
 }

+#ifndef NEW_OPTIONS
+
 PUBLIC void options NOARGS
 {
 #ifdef ALLOW_USERS_TO_CHANGE_EXEC_WITHIN_OPTIONS
@@ -841,7 +847,7 @@
                        }
                        LYRawMode = (UCLYhndl_for_unspec == current_char_set);
                        HTMLSetUseDefaultRawMode(current_char_set, LYRawMode);
-                       HTMLUseCharacterSet(current_char_set);
+                       HTMLSetCharacterHandling(current_char_set);
                        CurrentAssumeCharSet = UCLYhndl_for_unspec;
                        CurrentAssumeLocalCharSet = UCLYhndl_HTFile_for_unspec;
                        CurrentRawMode = LYRawMode;
@@ -3106,6 +3112,9 @@
     }
 }

+
+#else /* NEW_OPTIONS code begins here */
+
 /*
  * I'm paranoid about mistyping strings.  Also, this way they get combined
  * so we don't have to worry about the intelligence of the compiler.
@@ -3331,7 +3340,7 @@
        /*
         * prefered_doc_char
         */
-       if (!strcmp(data[i].tag, prefered_doc_lang_string)) {
+       if (!strcmp(data[i].tag, prefered_doc_char_string)) {
            FREE(pref_charset);
            StrAllocCopy(pref_charset, data[i].value);
        }
@@ -3360,7 +3369,7 @@
                StrAllocCopy(UCAssume_MIMEcharset, data[i].value);
                LYRawMode = (UCLYhndl_for_unspec == current_char_set);
                HTMLSetUseDefaultRawMode(current_char_set, LYRawMode);
-               HTMLUseCharacterSet(current_char_set);
+               HTMLSetCharacterHandling(current_char_set);
            }
        }

@@ -3387,6 +3396,19 @@
        }

        /*
+        * raw_mode
+        */
+       if (!strcmp(data[i].tag, raw_mode_string)) {
+           BOOLEAN newmode;
+           newmode = (!strcmp(data[i].value, on_string));
+           if (newmode != LYRawMode) {
+               LYRawMode = newmode;
+               HTMLSetUseDefaultRawMode(current_char_set, LYRawMode);
+               HTMLSetCharacterHandling(current_char_set);
+           }
+       }
+
+       /*
         * show_color
         */
        if (!strcmp(data[i].tag, show_color_string)) {
@@ -3403,19 +3425,6 @@
        }

        /*
-        * raw_mode
-        */
-       if (!strcmp(data[i].tag, raw_mode_string)) {
-           BOOLEAN newmode;
-           newmode = (!strcmp(data[i].value, on_string));
-           if (newmode != LYRawMode) {
-               LYRawMode = newmode;
-               HTMLSetUseDefaultRawMode(current_char_set, LYRawMode);
-               HTMLSetCharacterHandling(current_char_set);
-           }
-       }
-
-       /*
         * vi_keys
         */
        if (!strcmp(data[i].tag, vi_keys_string)) {
@@ -3920,3 +3929,4 @@
     fclose(fp0);
     return(0);
 }
+#endif /* NEW_OPTIONS */

--- old\lyoption.h      Thu Jul 30 16:00:54 1998
+++ lyoption.h  Fri Jul 31 00:29:08 1998
@@ -3,11 +3,16 @@

 extern BOOLEAN term_options;

-extern void options NOPARAMS;
-extern void edit_bookmarks NOPARAMS;
+#ifdef NEW_OPTIONS
+
 extern int postoptions PARAMS((document *newdoc));
 extern int gen_options PARAMS((char **newfile));

+#else /* !NEW_OPTIONS */
+
+extern void options NOPARAMS;
+extern void edit_bookmarks NOPARAMS;
+
 /*
  *  Values for the options menu. - FM
  *
@@ -63,6 +68,9 @@
 #define L_USER_AGENT   17
 #define L_EXEC         18
 #endif /* DIRED_SUPPORT */
+
+#endif  /!NEW_OPTIONS */
+

 #define OPTIONS_TITLE "Lynx Options Configuration"



reply via email to

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