* gtkutil.c (xg_check_special_colors, xg_set_geometry):
[bpt/emacs.git] / src / cm.h
index d179d4e..8f23990 100644 (file)
--- a/src/cm.h
+++ b/src/cm.h
@@ -1,13 +1,12 @@
 /* Cursor motion calculation definitions for GNU Emacs
-   Copyright (C) 1985, 1989, 2001, 2002, 2003, 2004,
-                 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+   Copyright (C) 1985, 1989, 2001-2011  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
-GNU Emacs is free software; you can redistribute it and/or modify
+GNU Emacs is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3, or (at your option)
-any later version.
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -15,9 +14,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with GNU Emacs; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA.  */
+along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* Holds the minimum and maximum costs for the parametrized capabilities.  */
 struct parmcap
@@ -38,25 +35,25 @@ struct cm
     int cm_curX;                       /* Current column */
 
     /* Capabilities from termcap */
-    char *cm_up;               /* up (up) */
-    char *cm_down;             /* down (do) */
-    char *cm_left;             /* left (le) */
-    char *cm_right;            /* right (nd) */
-    char *cm_home;             /* home (ho) */
-    char *cm_cr;               /* carriage return (cr) */
-    char *cm_ll;               /* last line (ll) */
-    char *cm_tab;              /* tab (ta) */
-    char *cm_backtab;          /* backtab (bt) */
+    const char *cm_up;         /* up (up) */
+    const char *cm_down;       /* down (do) */
+    const char *cm_left;       /* left (le) */
+    const char *cm_right;      /* right (nd) */
+    const char *cm_home;       /* home (ho) */
+    const char *cm_cr;         /* carriage return (cr) */
+    const char *cm_ll;         /* last line (ll) */
+    const char *cm_tab;                /* tab (ta) */
+    const char *cm_backtab;    /* backtab (bt) */
     char *cm_abs;              /* absolute (cm) */
-    char *cm_habs;             /* horizontal absolute (ch) */
-    char *cm_vabs;             /* vertical absolute (cv) */
+    const char *cm_habs;       /* horizontal absolute (ch) */
+    const char *cm_vabs;       /* vertical absolute (cv) */
 #if 0
-    char *cm_ds;               /* "don't send" string (ds) */
+    const char *cm_ds;         /* "don't send" string (ds) */
 #endif
-    char *cm_multiup;          /* multiple up (UP) */
-    char *cm_multidown;                /* multiple down (DO) */
-    char *cm_multileft;                /* multiple left (LE) */
-    char *cm_multiright;       /* multiple right (RI) */
+    const char *cm_multiup;    /* multiple up (UP) */
+    const char *cm_multidown;  /* multiple down (DO) */
+    const char *cm_multileft;  /* multiple left (LE) */
+    const char *cm_multiright; /* multiple right (RI) */
     int cm_cols;               /* number of cols on screen (co) */
     int cm_rows;               /* number of rows on screen (li) */
     int cm_tabwidth;           /* tab width (it) */
@@ -99,76 +96,73 @@ struct cm
     int cc_vabs;
   };
 
-extern struct cm Wcm;          /* Terminal capabilities */
-extern char PC;                        /* Pad character */
-
 /* Shorthand */
 #ifndef NoCMShortHand
-#define curY           Wcm.cm_curY
-#define curX           Wcm.cm_curX
-#define Up             Wcm.cm_up
-#define Down           Wcm.cm_down
-#define Left           Wcm.cm_left
-#define Right          Wcm.cm_right
-#define Tab            Wcm.cm_tab
-#define BackTab                Wcm.cm_backtab
-#define TabWidth       Wcm.cm_tabwidth
-#define CR             Wcm.cm_cr
-#define Home           Wcm.cm_home
-#define LastLine       Wcm.cm_ll
-#define AbsPosition    Wcm.cm_abs
-#define ColPosition    Wcm.cm_habs
-#define RowPosition    Wcm.cm_vabs
-#define MultiUp                Wcm.cm_multiup
-#define MultiDown      Wcm.cm_multidown
-#define MultiLeft      Wcm.cm_multileft
-#define MultiRight     Wcm.cm_multiright
-#define AutoWrap       Wcm.cm_autowrap
-#define MagicWrap      Wcm.cm_magicwrap
-#define UseTabs                Wcm.cm_usetabs
-#define FrameRows      Wcm.cm_rows
-#define FrameCols      Wcm.cm_cols
-
-#define UpCost         Wcm.cc_up
-#define DownCost       Wcm.cc_down
-#define LeftCost       Wcm.cc_left
-#define RightCost      Wcm.cc_right
-#define HomeCost       Wcm.cc_home
-#define CRCost         Wcm.cc_cr
-#define LastLineCost   Wcm.cc_ll
-#define TabCost                Wcm.cc_tab
-#define BackTabCost    Wcm.cc_backtab
-#define AbsPositionCost        Wcm.cc_abs
-#define ColPositionCost        Wcm.cc_habs
-#define RowPositionCost        Wcm.cc_vabs
-#define MultiUpCost    Wcm.cc_multiup
-#define MultiDownCost  Wcm.cc_multidown
-#define MultiLeftCost  Wcm.cc_multileft
-#define MultiRightCost Wcm.cc_multiright
+#define curY(tty)              (tty)->Wcm->cm_curY
+#define curX(tty)              (tty)->Wcm->cm_curX
+#define Up(tty)                        (tty)->Wcm->cm_up
+#define Down(tty)              (tty)->Wcm->cm_down
+#define Left(tty)              (tty)->Wcm->cm_left
+#define Right(tty)             (tty)->Wcm->cm_right
+#define Tab(tty)               (tty)->Wcm->cm_tab
+#define BackTab(tty)           (tty)->Wcm->cm_backtab
+#define TabWidth(tty)          (tty)->Wcm->cm_tabwidth
+#define CR(tty)                        (tty)->Wcm->cm_cr
+#define Home(tty)              (tty)->Wcm->cm_home
+#define LastLine(tty)          (tty)->Wcm->cm_ll
+#define AbsPosition(tty)       (tty)->Wcm->cm_abs
+#define ColPosition(tty)       (tty)->Wcm->cm_habs
+#define RowPosition(tty)       (tty)->Wcm->cm_vabs
+#define MultiUp(tty)           (tty)->Wcm->cm_multiup
+#define MultiDown(tty)         (tty)->Wcm->cm_multidown
+#define MultiLeft(tty)         (tty)->Wcm->cm_multileft
+#define MultiRight(tty)                (tty)->Wcm->cm_multiright
+#define AutoWrap(tty)          (tty)->Wcm->cm_autowrap
+#define MagicWrap(tty)         (tty)->Wcm->cm_magicwrap
+#define UseTabs(tty)           (tty)->Wcm->cm_usetabs
+#define FrameRows(tty)         (tty)->Wcm->cm_rows
+#define FrameCols(tty)         (tty)->Wcm->cm_cols
+
+#define UpCost(tty)            (tty)->Wcm->cc_up
+#define DownCost(tty)          (tty)->Wcm->cc_down
+#define LeftCost(tty)          (tty)->Wcm->cc_left
+#define RightCost(tty)         (tty)->Wcm->cc_right
+#define HomeCost(tty)          (tty)->Wcm->cc_home
+#define CRCost(tty)            (tty)->Wcm->cc_cr
+#define LastLineCost(tty)      (tty)->Wcm->cc_ll
+#define TabCost(tty)           (tty)->Wcm->cc_tab
+#define BackTabCost(tty)       (tty)->Wcm->cc_backtab
+#define AbsPositionCost(tty)   (tty)->Wcm->cc_abs
+#define ColPositionCost(tty)   (tty)->Wcm->cc_habs
+#define RowPositionCost(tty)   (tty)->Wcm->cc_vabs
+#define MultiUpCost(tty)       (tty)->Wcm->cc_multiup
+#define MultiDownCost(tty)     (tty)->Wcm->cc_multidown
+#define MultiLeftCost(tty)     (tty)->Wcm->cc_multileft
+#define MultiRightCost(tty)    (tty)->Wcm->cc_multiright
 #endif
 
-#define cmat(row,col)  (curY = (row), curX = (col))
-#define cmplus(n)                                      \
-  {                                                    \
-    if ((curX += (n)) >= FrameCols && !MagicWrap)      \
-      {                                                        \
-       if (Wcm.cm_losewrap) losecursor ();             \
-       else if (AutoWrap) curX = 0, curY++;            \
-       else curX--;                                    \
-      }                                                        \
+#define cmat(tty,row,col)      (curY(tty) = (row), curX(tty) = (col))
+#define cmplus(tty,n)                                              \
+  {                                                                 \
+    if ((curX (tty) += (n)) >= FrameCols (tty) && !MagicWrap (tty)) \
+      {                                                             \
+       if ((tty)->Wcm->cm_losewrap) losecursor (tty);              \
+       else if (AutoWrap (tty)) curX (tty) = 0, curY (tty)++;      \
+       else curX (tty)--;                                          \
+      }                                                             \
   }
 
-#define losecursor()   (curX = -1, curY = -1)
+#define losecursor(tty)         (curX(tty) = -1, curY(tty) = -1)
 
 extern int cost;
-extern int evalcost ();
+extern int evalcost (int c);
 
-extern void cmcheckmagic ();
-extern int cmputc ();
-extern void cmcostinit ();
-extern void cmgoto ();
-extern void Wcm_clear ();
-extern int Wcm_init ();
+#define emacs_tputs(tty, str, affcnt, putc) (current_tty = (tty), tputs (str, affcnt, putc))
 
-/* arch-tag: acc1535a-7136-49d6-b22d-9bc85702251b
-   (do not change this comment) */
+extern struct tty_display_info *current_tty;
+extern void cmcheckmagic (struct tty_display_info *);
+extern int cmputc (int);
+extern void cmcostinit (struct tty_display_info *);
+extern void cmgoto (struct tty_display_info *, int, int);
+extern void Wcm_clear (struct tty_display_info *);
+extern int Wcm_init (struct tty_display_info *);