[BACK]Return to display.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / mg

Diff for /src/usr.bin/mg/display.c between version 1.22 and 1.23

version 1.22, 2005/06/14 18:14:40 version 1.23, 2005/11/18 20:56:52
Line 43 
Line 43 
  * the longest line possible. v_text is allocated   * the longest line possible. v_text is allocated
  * dynamically to fit the screen width.   * dynamically to fit the screen width.
  */   */
 typedef struct {  struct video {
         short   v_hash;         /* Hash code, for compares.      */          short   v_hash;         /* Hash code, for compares.      */
         short   v_flag;         /* Flag word.                    */          short   v_flag;         /* Flag word.                    */
         short   v_color;        /* Color of the line.            */          short   v_color;        /* Color of the line.            */
         XSHORT  v_cost;         /* Cost of display.              */          XSHORT  v_cost;         /* Cost of display.              */
         char    *v_text;        /* The actual characters.        */          char    *v_text;        /* The actual characters.        */
 } VIDEO;  };
   
 #define VFCHG   0x0001                  /* Changed.                      */  #define VFCHG   0x0001                  /* Changed.                      */
 #define VFHBAD  0x0002                  /* Hash and cost are bad.        */  #define VFHBAD  0x0002                  /* Hash and cost are bad.        */
Line 63 
Line 63 
  * fields can be "char", and the cost a "short", but   * fields can be "char", and the cost a "short", but
  * this makes the code worse on the VAX.   * this makes the code worse on the VAX.
  */   */
 typedef struct {  struct score {
         XCHAR   s_itrace;       /* "i" index for track back.     */          XCHAR   s_itrace;       /* "i" index for track back.     */
         XCHAR   s_jtrace;       /* "j" index for trace back.     */          XCHAR   s_jtrace;       /* "j" index for trace back.     */
         XSHORT  s_cost;         /* Display cost.                 */          XSHORT  s_cost;         /* Display cost.                 */
 } SCORE;  };
   
 void    vtmove(int, int);  void    vtmove(int, int);
 void    vtputc(int);  void    vtputc(int);
Line 75 
Line 75 
 int     vtputs(const char *);  int     vtputs(const char *);
 void    vteeol(void);  void    vteeol(void);
 void    updext(int, int);  void    updext(int, int);
 void    modeline(MGWIN *);  void    modeline(struct mgwin *);
 void    setscores(int, int);  void    setscores(int, int);
 void    traceback(int, int, int, int);  void    traceback(int, int, int, int);
 void    ucopy(VIDEO *, VIDEO *);  void    ucopy(struct video *, struct video *);
 void    uline(int, VIDEO *, VIDEO *);  void    uline(int, struct video *, struct video *);
 void    hash(VIDEO *);  void    hash(struct video *);
   
   
 int     sgarbf = TRUE;          /* TRUE if screen is garbage.    */  int     sgarbf = TRUE;          /* TRUE if screen is garbage.    */
Line 94 
Line 94 
 int     lbound = 0;             /* leftmost bound of the current */  int     lbound = 0;             /* leftmost bound of the current */
                                 /* line being displayed          */                                  /* line being displayed          */
   
 VIDEO   **vscreen;              /* Edge vector, virtual.         */  struct video    **vscreen;              /* Edge vector, virtual.         */
 VIDEO   **pscreen;              /* Edge vector, physical.        */  struct video    **pscreen;              /* Edge vector, physical.        */
 VIDEO    *video;                /* Actual screen data.           */  struct video     *video;                /* Actual screen data.           */
 VIDEO     blanks;               /* Blank line image.             */  struct video      blanks;               /* Blank line image.             */
   
 #ifdef  GOSLING  #ifdef  GOSLING
 /*  /*
Line 107 
Line 107 
  * It would be "SCORE   score[NROW][NROW]" in old speak.   * It would be "SCORE   score[NROW][NROW]" in old speak.
  * Look at "setscores" to understand what is up.   * Look at "setscores" to understand what is up.
  */   */
 SCORE *score;                   /* [NROW * NROW] */  struct score *score;                    /* [NROW * NROW] */
 #endif  #endif
   
 /*  /*
Line 120 
Line 120 
         int      i;          int      i;
         int      rowchanged, colchanged;          int      rowchanged, colchanged;
         static   int first_run = 1;          static   int first_run = 1;
         VIDEO   *vp;          struct video    *vp;
   
         if (newrow < 1 || newcol < 1)          if (newrow < 1 || newcol < 1)
                 return (FALSE);                  return (FALSE);
Line 165 
Line 165 
                 }                  }
   
 #ifdef GOSLING  #ifdef GOSLING
                 TRYREALLOC(score, newrow * newrow * sizeof(SCORE));                  TRYREALLOC(score, newrow * newrow * sizeof(struct score));
 #endif  #endif
                 TRYREALLOC(vscreen, (newrow - 1) * sizeof(VIDEO *));                  TRYREALLOC(vscreen, (newrow - 1) * sizeof(struct video *));
                 TRYREALLOC(pscreen, (newrow - 1) * sizeof(VIDEO *));                  TRYREALLOC(pscreen, (newrow - 1) * sizeof(struct video *));
                 TRYREALLOC(video, (2 * (newrow - 1)) * sizeof(VIDEO));                  TRYREALLOC(video, (2 * (newrow - 1)) * sizeof(struct video));
   
                 /*                  /*
                  * Zero-out the entries we just allocated.                   * Zero-out the entries we just allocated.
                  */                   */
                 for (i = vidstart; i < 2 * (newrow - 1); i++)                  for (i = vidstart; i < 2 * (newrow - 1); i++)
                         memset(&video[i], 0, sizeof(VIDEO));                          memset(&video[i], 0, sizeof(struct video));
   
                 /*                  /*
                  * Reinitialize vscreen and pscreen arrays completely.                   * Reinitialize vscreen and pscreen arrays completely.
Line 285 
Line 285 
 void  void
 vtputc(int c)  vtputc(int c)
 {  {
         VIDEO   *vp;          struct video    *vp;
   
         c &= 0xff;          c &= 0xff;
   
Line 321 
Line 321 
 void  void
 vtpute(int c)  vtpute(int c)
 {  {
         VIDEO *vp;          struct video *vp;
   
         c &= 0xff;          c &= 0xff;
   
Line 354 
Line 354 
 void  void
 vteeol(void)  vteeol(void)
 {  {
         VIDEO *vp;          struct video *vp;
   
         vp = vscreen[vtrow];          vp = vscreen[vtrow];
         while (vtcol < ncol)          while (vtcol < ncol)
Line 373 
Line 373 
 void  void
 update(void)  update(void)
 {  {
         LINE    *lp;          struct line     *lp;
         MGWIN   *wp;          struct mgwin    *wp;
         VIDEO   *vp1;          struct video    *vp1;
         VIDEO   *vp2;          struct video    *vp2;
         int      c, i, j;          int      c, i, j;
         int      hflag;          int      hflag;
         int      currow, curcol;          int      currow, curcol;
Line 609 
Line 609 
   
 /*  /*
  * Update a saved copy of a line,   * Update a saved copy of a line,
  * kept in a VIDEO structure. The "vvp" is   * kept in a video structure. The "vvp" is
  * the one in the "vscreen". The "pvp" is the one   * the one in the "vscreen". The "pvp" is the one
  * in the "pscreen". This is called to make the   * in the "pscreen". This is called to make the
  * virtual and physical screens the same when   * virtual and physical screens the same when
  * display has done an update.   * display has done an update.
  */   */
 void  void
 ucopy(VIDEO *vvp, VIDEO *pvp)  ucopy(struct video *vvp, struct video *pvp)
 {  {
         vvp->v_flag &= ~VFCHG;          /* Changes done.         */          vvp->v_flag &= ~VFCHG;          /* Changes done.         */
         pvp->v_flag = vvp->v_flag;      /* Update model.         */          pvp->v_flag = vvp->v_flag;      /* Update model.         */
Line 634 
Line 634 
 void  void
 updext(int currow, int curcol)  updext(int currow, int curcol)
 {  {
         LINE    *lp;                    /* pointer to current line */          struct line     *lp;                    /* pointer to current line */
         int      j;                     /* index into line */          int      j;                     /* index into line */
   
         if (ncol < 2)          if (ncol < 2)
Line 661 
Line 661 
 /*  /*
  * Update a single line. This routine only   * Update a single line. This routine only
  * uses basic functionality (no insert and delete character,   * uses basic functionality (no insert and delete character,
  * but erase to end of line). The "vvp" points at the VIDEO   * but erase to end of line). The "vvp" points at the video
  * structure for the line on the virtual screen, and the "pvp"   * structure for the line on the virtual screen, and the "pvp"
  * is the same for the physical screen. Avoid erase to end of   * is the same for the physical screen. Avoid erase to end of
  * line when updating CMODE color lines, because of the way that   * line when updating CMODE color lines, because of the way that
  * reverse video works on most terminals.   * reverse video works on most terminals.
  */   */
 void  void
 uline(int row, VIDEO *vvp, VIDEO *pvp)  uline(int row, struct video *vvp, struct video *pvp)
 {  {
         char  *cp1;          char  *cp1;
         char  *cp2;          char  *cp2;
Line 763 
Line 763 
  * characters may never be seen.   * characters may never be seen.
  */   */
 void  void
 modeline(MGWIN *wp)  modeline(struct mgwin *wp)
 {  {
         int     n;          int     n;
         BUFFER *bp;          struct buffer *bp;
         int     mode;          int     mode;
   
         n = wp->w_toprow + wp->w_ntrows;        /* Location.             */          n = wp->w_toprow + wp->w_ntrows;        /* Location.             */
Line 840 
Line 840 
  * just about any machine.   * just about any machine.
  */   */
 void  void
 hash(VIDEO *vp)  hash(struct video *vp)
 {  {
         int     i, n;          int     i, n;
         char   *s;          char   *s;
Line 890 
Line 890 
 void  void
 setscores(int offs, int size)  setscores(int offs, int size)
 {  {
         SCORE    *sp;          struct score     *sp;
         SCORE    *sp1;          struct score     *sp1;
         VIDEO   **vp, **pp;          struct video    **vp, **pp;
         VIDEO   **vbase, **pbase;          struct video    **vbase, **pbase;
         int       tempcost;          int       tempcost;
         int       bestcost;          int       bestcost;
         int       j, i;          int       j, i;

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.23