-- Leo's gemini proxy

-- Connecting to git.thebackupbox.net:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

repo: rxvt-unicode-sixel
action: commit
revision:
path_from:
revision_from: b644115a2b96f4ae7866ca3996994ba8bb92b18e:
path_to:
revision_to:

git.thebackupbox.net

rxvt-unicode-sixel

git://git.thebackupbox.net/rxvt-unicode-sixel

commit b644115a2b96f4ae7866ca3996994ba8bb92b18e
Author: Marc Lehmann <schmorp@schmorp.de>
Date:   Wed Dec 21 14:19:19 2005 +0000

    *** empty log message ***

diff --git a/src/command.C b/src/command.C

index 5b37711b69cd16b24e2c519cfacaf75dfaad496c..

index ..e5b831505f87be4426c5338dedac3c62eeacb7b6 100644

--- a/src/command.C
+++ b/src/command.C
@@ -1602,7 +1602,7 @@ rxvt_term::x_cb (XEvent &ev)
                         scroll_selection_lines = Pixel2Height (dist)
                                                  / SELECTION_SCROLL_LINE_SPEEDUP
                                                  + 1;
-                        MIN_IT (scroll_selection_lines,
+                        min_it (scroll_selection_lines,
                                 SELECTION_SCROLL_MAX_LINES);
                       }
                     else
@@ -2453,8 +2453,8 @@ rxvt_term::check_our_parents ()
           sy = 0;
         }

-      MIN_IT (nw, (unsigned int) (wrootattr.width - sx));
-      MIN_IT (nh, (unsigned int) (wrootattr.height - sy));
+      min_it (nw, (unsigned int) (wrootattr.width - sx));
+      min_it (nh, (unsigned int) (wrootattr.height - sy));

       XSync (disp, False);
       allowedxerror = -1;
diff --git a/src/init.C b/src/init.C

index e4acca9a4597b441bbb7b1167be868f5059db1f8..

index ..0e2d998baabbea7cf3a198f513220b7598af6b7b 100644

--- a/src/init.C
+++ b/src/init.C
@@ -371,15 +371,17 @@ rxvt_term::init_resources (int argc, const char *const *argv)
     }

   if (rs[Rs_saveLines] && (i = atoi (rs[Rs_saveLines])) >= 0)
-    saveLines = BOUND_POSITIVE_INT16 (i);
+    saveLines = min (i, MAX_POSITIVE_INT16);

 #if ENABLE_FRILLS
   if (rs[Rs_int_bwidth] && (i = atoi (rs[Rs_int_bwidth])) >= 0)
-    int_bwidth = min (i, 100);    /* arbitrary limit */
+    int_bwidth = min (i, MAX_POSITIVE_INT16);
+
   if (rs[Rs_ext_bwidth] && (i = atoi (rs[Rs_ext_bwidth])) >= 0)
-    ext_bwidth = min (i, 100);    /* arbitrary limit */
+    ext_bwidth = min (i, MAX_POSITIVE_INT16);
+
   if (rs[Rs_lineSpace] && (i = atoi (rs[Rs_lineSpace])) >= 0)
-    lineSpace = min (i, 100);     /* arbitrary limit */
+    lineSpace = min (i, MAX_POSITIVE_INT16);
 #endif

 #ifdef POINTER_BLANK
@@ -523,7 +525,7 @@ rxvt_term::init_env ()
    * i = (int) (ceil (log10 ((unsigned int)parent[0]))) */
   for (i = 0, u = (unsigned int)parent[0]; u; u /= 10, i++)
     ;
-  MAX_IT (i, 1);
+  max_it (i, 1);
   env_windowid = (char *)rxvt_malloc ((i + 10) * sizeof (char));

   sprintf (env_windowid, "WINDOWID=%u",
diff --git a/src/main.C b/src/main.C

index fb221f4462221429c0dfc5bf266fed56cae5bf49..

index ..1af3feb8ef91ff30068c049d6dc608c145904f16 100644

--- a/src/main.C
+++ b/src/main.C
@@ -720,13 +720,13 @@ rxvt_term::window_calc (unsigned int newwidth, unsigned int newheight)

       if (flags & WidthValue)
         {
-          ncol = BOUND_POSITIVE_INT16 (w);
+          ncol = clamp (w, 0, MAX_POSITIVE_INT16);
           szHint.flags |= USSize;
         }

       if (flags & HeightValue)
         {
-          nrow = BOUND_POSITIVE_INT16 (h);
+          nrow = clamp (h, 0, MAX_POSITIVE_INT16);
           szHint.flags |= USSize;
         }

@@ -797,7 +797,7 @@ rxvt_term::window_calc (unsigned int newwidth, unsigned int newheight)
     }
   else
     {
-      MIN_IT (width, max_width);
+      min_it (width, max_width);
       szHint.width = szHint.base_width + width;
     }

@@ -808,7 +808,7 @@ rxvt_term::window_calc (unsigned int newwidth, unsigned int newheight)
     }
   else
     {
-      MIN_IT (height, max_height);
+      min_it (height, max_height);
       szHint.height = szHint.base_height + height;
     }

diff --git a/src/menubar.C b/src/menubar.C

index 9de7f33fa81b9789089dadc95bc7865b9c183d86..

index ..babf7c7f08f4fcbe968c564950429310a981d443 100644

--- a/src/menubar.C
+++ b/src/menubar.C
@@ -1969,7 +1969,7 @@ rxvt_term::menubar_dispatch (char *str)
                             {
                               short           l = item->len + item->len2;

-                              MAX_IT (BuildMenu->width, l);
+                              max_it (BuildMenu->width, l);
                             }
                         }
                     }
diff --git a/src/rxvt.h b/src/rxvt.h

index e2e46866ac721e993cf0f400f683956afd468062..

index ..af5ee86cd6839000a823cce6b88eb5553bb6c104 100644

--- a/src/rxvt.h
+++ b/src/rxvt.h
@@ -164,17 +164,7 @@ struct mouse_event {
   unsigned int button;   /* detail */
 };

-#define MAX_IT(current, other)  if ((other) > (current)) (current) = (other)
-#define MIN_IT(current, other)  if ((other) < (current)) (current) = (other)
-#define SWAP_IT(one, two, typeof)                                       \
-    do {                                                                \
-        typeof          swapittmp;                                      \
-        (swapittmp) = (one); (one) = (two); (two) = (swapittmp);        \
-    } while (/* CONSTCOND */ 0)
-#define BOUND_POSITIVE_INT16(val)                       \
-    (int16_t) ((val) <= 0                                \
-              ? 0                                       \
-              : min ((val), (((uint16_t)-1)>>1)))
+#define MAX_POSITIVE_INT16 (((uint16_t)-1)>>1)  // TODO: configure/limits

 #if ENABLE_FRILLS
 typedef struct _mwmhints {
@@ -1493,7 +1483,7 @@ struct rxvt_term : zero_initialized, rxvt_vars {
     l.t = (text_t *)talloc->alloc (l.t, prev_ncol * sizeof (text_t));
     l.r = (rend_t *)ralloc->alloc (l.r, prev_ncol * sizeof (rend_t));

-    MIN_IT (l.l, (int16_t)ncol);
+    l.l = min (l.l, ncol);

     if (ncol > prev_ncol)
       scr_blank_line (l, prev_ncol, ncol - prev_ncol, DEFAULT_RSTYLE);
diff --git a/src/rxvtutil.h b/src/rxvtutil.h

index a7361d316f18d8d4c0e332f8eda4443c77b5c763..

index ..6be9bf6dd38bfa12798b6b06b2ef7caef6791d45 100644

--- a/src/rxvtutil.h
+++ b/src/rxvtutil.h
@@ -14,12 +14,14 @@ public:
   static bool vax           () { return e == 0x44332211; };
 } byteorder;

-template<typename T, typename U>
-static inline T min (T a, U b) { return a < (T)b ? a : (T)b; }
-template<typename T, typename U>
-static inline T max (T a, U b) { return a > (T)b ? a : (T)b; }
-template<typename T, typename U, typename V>
-static inline T clamp (T v, U a, V b) { return v < (T)a ? a : v >(T)b ? b : v; }
+template<typename T, typename U> static inline T    min    (T  a, U b) { return a < (T)b ? a : (T)b; }
+template<typename T, typename U> static inline void min_it (T &a, U b) {    a = a < (T)b ? a : (T)b; }
+template<typename T, typename U> static inline T    max    (T  a, U b) { return a > (T)b ? a : (T)b; }
+template<typename T, typename U> static inline void max_it (T &a, U b) {    a = a > (T)b ? a : (T)b; }
+
+template<typename T, typename U, typename V> static inline T    clamp    (T  v, U a, V b) { return v < (T)a ? a : v >(T)b ? b : v; }
+template<typename T, typename U, typename V> static inline void clamp_it (T &v, U a, V b) {    v = v < (T)a ? a : v >(T)b ? b : v; }
+
 template<typename T, typename U>
 static inline void swap (T& a, U& b) { T t=a; a=(T)b; b=(U)t; }

diff --git a/src/screen.C b/src/screen.C

index b1458bcca73fd5436f4ee6b0f526ece5615ef875..

index ..45b57d1f97f34bc0eb1ddf0853d3c2d596986e85 100644

--- a/src/screen.C
+++ b/src/screen.C
@@ -260,7 +260,7 @@ rxvt_term::scr_reset ()
             }

           /* we have fewer rows so fix up cursor position */
-          MIN_IT (screen.cur.row, (int32_t)nrow - 1);
+          min_it (screen.cur.row, (int32_t)nrow - 1);

           scr_reset_realloc (); /* realloc _last_ */
         }
@@ -297,7 +297,7 @@ rxvt_term::scr_reset ()
 #ifdef DEBUG_STRICT
           assert (screen.cur.row < nrow);
 #else                           /* drive with your eyes closed */
-          MIN_IT (screen.cur.row, nrow - 1);
+          min_it (screen.cur.row, nrow - 1);
 #endif
           ncol =  ocol; // save b/c scr_blank_screen_mem uses this
         }
@@ -317,7 +317,7 @@ rxvt_term::scr_reset ()
               lresize (swap_save[p]);
             }

-          MIN_IT (screen.cur.col, (int16_t)ncol - 1);
+          min_it (screen.cur.col, (int16_t)ncol - 1);

           delete old_ta;
           delete old_ra;
@@ -517,14 +517,14 @@ rxvt_term::scr_cursor (int mode)
     }

   /* boundary check in case screen size changed between SAVE and RESTORE */
-  MIN_IT (s->cur.row, nrow - 1);
-  MIN_IT (s->cur.col, ncol - 1);
+  min_it (s->cur.row, nrow - 1);
+  min_it (s->cur.col, ncol - 1);
 #ifdef DEBUG_STRICT
   assert (s->cur.row >= 0);
   assert (s->cur.col >= 0);
 #else                           /* drive with your eyes closed */
-  MAX_IT (s->cur.row, 0);
-  MAX_IT (s->cur.col, 0);
+  max_it (s->cur.row, 0);
+  max_it (s->cur.col, 0);
 #endif
 }

@@ -747,9 +747,9 @@ rxvt_term::scr_add_lines (const unicode_t *str, int nlines, int len)
   assert ((screen.cur.row < nrow)
           && (screen.cur.row >= - (int32_t)nsaved));
 #else                           /* drive with your eyes closed */
-  MIN_IT (screen.cur.col, last_col - 1);
-  MIN_IT (screen.cur.row, (int32_t)nrow - 1);
-  MAX_IT (screen.cur.row, - (int32_t)nsaved);
+  min_it (screen.cur.col, last_col - 1);
+  min_it (screen.cur.row, (int32_t)nrow - 1);
+  max_it (screen.cur.row, - (int32_t)nsaved);
 #endif
   row = screen.cur.row;

@@ -765,7 +765,7 @@ rxvt_term::scr_add_lines (const unicode_t *str, int nlines, int len)
         if (c == C0_LF)
           {
             if (!line->is_longer ())      /* XXX: think about this */
-              MAX_IT (line->l, screen.cur.col);
+              max_it (line->l, screen.cur.col);

             screen.flags &= ~Screen_WrapNext;

@@ -780,7 +780,7 @@ rxvt_term::scr_add_lines (const unicode_t *str, int nlines, int len)
         else if (c == C0_CR)
           {
             if (!line->is_longer ())      /* XXX: think about this */
-              MAX_IT (line->l, screen.cur.col);
+              max_it (line->l, screen.cur.col);

             screen.flags &= ~Screen_WrapNext;
             screen.cur.col = 0;
@@ -966,12 +966,12 @@ rxvt_term::scr_add_lines (const unicode_t *str, int nlines, int len)
     }

   if (!line->is_longer ())      /* XXX: think about this */
-    MAX_IT (line->l, screen.cur.col);
+    max_it (line->l, screen.cur.col);

 #ifdef DEBUG_STRICT
   assert (screen.cur.row >= 0);
 #else                           /* drive with your eyes closed */
-  MAX_IT (screen.cur.row, 0);
+  max_it (screen.cur.row, 0);
 #endif
 }

@@ -1047,7 +1047,7 @@ rxvt_term::scr_tab (int count, bool ht)
           base_rend = SET_FONT (base_rend, 0);

           if (!l.is_longer ())      /* XXX: think about this */
-            MAX_IT (l.l, x);
+            max_it (l.l, x);

           i = screen.cur.col;

@@ -1136,8 +1136,8 @@ rxvt_term::scr_gotorc (int row, int col, int relative)
   ZERO_SCROLLBACK ();

   screen.cur.col = relative & C_RELATIVE ? screen.cur.col + col : col;
-  MAX_IT (screen.cur.col, 0);
-  MIN_IT (screen.cur.col, (int32_t)ncol - 1);
+  max_it (screen.cur.col, 0);
+  min_it (screen.cur.col, (int32_t)ncol - 1);

   screen.flags &= ~Screen_WrapNext;

@@ -1165,14 +1165,14 @@ rxvt_term::scr_gotorc (int row, int col, int relative)
       if (screen.flags & Screen_Relative)
         {        /* relative origin mode */
           screen.cur.row = row + screen.tscroll;
-          MIN_IT (screen.cur.row, screen.bscroll);
+          min_it (screen.cur.row, screen.bscroll);
         }
       else
         screen.cur.row = row;
     }

-  MAX_IT (screen.cur.row, 0);
-  MIN_IT (screen.cur.row, (int32_t)nrow - 1);
+  max_it (screen.cur.row, 0);
+  min_it (screen.cur.row, (int32_t)nrow - 1);
 }

 /* ------------------------------------------------------------------------- */
@@ -1197,8 +1197,8 @@ rxvt_term::scr_index (enum page_dirn direction)
   else
     screen.cur.row += dirn;

-  MAX_IT (screen.cur.row, 0);
-  MIN_IT (screen.cur.row, (int32_t)nrow - 1);
+  max_it (screen.cur.row, 0);
+  min_it (screen.cur.row, (int32_t)nrow - 1);
   selection_check (0);
 }

@@ -1226,7 +1226,7 @@ rxvt_term::scr_erase_line (int mode)
       case 0:                     /* erase to end of line */
         col = screen.cur.col;
         num = ncol - col;
-        MIN_IT (ROW(row).l, (int16_t)col);
+        min_it (ROW(row).l, (int16_t)col);
         if (ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur)
             || ROWCOL_IN_ROW_AT_OR_AFTER (selection.end, screen.cur))
           CLEAR_SELECTION ();
@@ -1303,7 +1303,7 @@ rxvt_term::scr_erase_screen (int mode)
   if (row >= nrow) /* Out Of Bounds */
     return;

-  MIN_IT (num, (nrow - row));
+  min_it (num, (nrow - row));

   if (rstyle & (RS_RVid | RS_Uline))
     ren = (rend_t) ~RS_None;
@@ -1421,7 +1421,7 @@ rxvt_term::scr_insdel_chars (int count, int insdel)
   scr_do_wrap ();

   selection_check (1);
-  MIN_IT (count, (ncol - screen.cur.col));
+  min_it (count, (ncol - screen.cur.col));

   row = screen.cur.row;

@@ -1439,7 +1439,7 @@ rxvt_term::scr_insdel_chars (int count, int insdel)
         if (!line->is_longer ())
           {
             line->l += count;
-            MIN_IT (line->l, ncol);
+            min_it (line->l, ncol);
           }

         if (selection.op && current_screen == selection.screen
@@ -1510,8 +1510,8 @@ rxvt_term::scr_insdel_chars (int count, int insdel)
 void
 rxvt_term::scr_scroll_region (int top, int bot)
 {
-  MAX_IT (top, 0);
-  MIN_IT (bot, (int)nrow - 1);
+  max_it (top, 0);
+  min_it (bot, (int)nrow - 1);

   if (top > bot)
     return;
@@ -1781,8 +1781,8 @@ rxvt_term::scr_expose (int x, int y, int ewidth, int eheight, bool refresh)
   /* sanity checks */
   for (i = PART_BEG; i < RC_COUNT; i++)
     {
-      MIN_IT (rc[i].col, ncol - 1);
-      MIN_IT (rc[i].row, nrow - 1);
+      min_it (rc[i].col, ncol - 1);
+      min_it (rc[i].row, nrow - 1);
     }

   for (i = rc[PART_BEG].row; i <= rc[PART_END].row; i++)
@@ -3574,9 +3574,9 @@ void
 rxvt_term::pixel_position (int *x, int *y)
 {
   *x = Pixel2Col (*x);
-  /* MAX_IT (*x, 0); MIN_IT (*x, (int)ncol - 1); */
+  /* max_it (*x, 0); min_it (*x, (int)ncol - 1); */
   *y = Pixel2Row (*y);
-  /* MAX_IT (*y, 0); MIN_IT (*y, (int)nrow - 1); */
+  /* max_it (*y, 0); min_it (*y, (int)nrow - 1); */
 }

 /* ------------------------------------------------------------------------- */
@@ -3608,14 +3608,14 @@ rxvt_term::scr_overlay_new (int x, int y, int w, int h)
   if (y < 0) y = nrow - h;

   // make space for border
-  w += 2; MIN_IT (w, ncol);
-  h += 2; MIN_IT (h, nrow);
+  w += 2; min_it (w, ncol);
+  h += 2; min_it (h, nrow);

-  x -= 1; MAX_IT (x, 0);
-  y -= 1; MAX_IT (y, 0);
+  x -= 1; max_it (x, 0);
+  y -= 1; max_it (y, 0);

-  MIN_IT (x, ncol - w);
-  MIN_IT (y, nrow - h);
+  min_it (x, ncol - w);
+  min_it (y, nrow - h);

   ov_x = x; ov_y = y;
   ov_w = w; ov_h = h;
diff --git a/src/xpm.C b/src/xpm.C

index f59771d8140ddf6a29582ff095de4d2d8d026228..

index ..b9f881569818444efd527cad32fbe433dafdc2c3 100644

--- a/src/xpm.C
+++ b/src/xpm.C
@@ -138,10 +138,10 @@ rxvt_term::scale_pixmap (const char *geom)
           if (flags & YNegative)
             y += 100;
         }
-      MIN_IT (x, 100);
-      MIN_IT (y, 100);
-      MAX_IT (x, 0);
-      MAX_IT (y, 0);
+      min_it (x, 100);
+      min_it (y, 100);
+      max_it (x, 0);
+      max_it (y, 0);
       if (bgpixmap->x != x)
         {
           bgpixmap->x = x;

-----END OF PAGE-----

-- Response ended

-- Page fetched on Sun Jun 2 11:54:43 2024