ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/x11twind.c
(Generate patch)

Comparing ray/src/rt/x11twind.c (file contents):
Revision 2.6 by greg, Tue Feb 25 02:47:23 2003 UTC vs.
Revision 2.9 by schorsch, Mon Jun 30 14:59:13 2003 UTC

# Line 14 | Line 14 | static const char      RCSid[] = "$Id$";
14   #include "copyright.h"
15  
16   #include  <stdio.h>
17
17   #include  <stdlib.h>
18 <
18 > #include  <string.h>
19   #include  <X11/Xlib.h>
20  
21   #include  "x11twind.h"
22  
24 #ifndef  BSD
25 #define  bzero(d,n)             (void)memset(d,0,n)
26 #endif
27
23   #define checkcurs(t)            if ((t)->cursor) togglecurs(t)
24  
25   #define restorecurs             checkcurs
# Line 89 | Line 84 | char  *fontname;
84  
85  
86   void
92 xt_puts(s, t)                           /* output a string */
93 register char  *s;
94 TEXTWIND  *t;
95 {
96        int     oldcurs;
97
98        oldcurs = xt_cursor(t, TNOCURS);        /* for efficiency */
99        while (*s)
100                xt_putc(*s++, t);
101        xt_cursor(t, oldcurs);
102 }
103
104
105 void
87   xt_putc(c, t)                           /* output a character */
88 < char  c;
88 > int  c;
89   register TEXTWIND  *t;
90   {
91 +        char    ch[2];
92 +
93          checkcurs(t);
94          switch (c) {
95          case '\n':
# Line 127 | Line 110 | register TEXTWIND  *t;
110          default:
111                  if (t->c >= t->nc)
112                          xt_putc('\n', t);
113 +                ch[0] = c; ch[1] = '\0';
114                  XDrawImageString(t->dpy, t->w, t->gc, LEFTMAR+t->c*Width(t->f),
115 <                        YStart(t->f)+t->r*Height(t->f), &c, 1);
115 >                        YStart(t->f)+t->r*Height(t->f), ch, 1);
116                  t->lp[t->r][t->c++] = c;
117                  break;
118          }
# Line 137 | Line 121 | register TEXTWIND  *t;
121  
122  
123   void
124 + xt_puts(s, t)                           /* output a string */
125 + register char  *s;
126 + TEXTWIND  *t;
127 + {
128 +        int     oldcurs;
129 +
130 +        oldcurs = xt_cursor(t, TNOCURS);        /* for efficiency */
131 +        while (*s)
132 +                xt_putc(*s++, t);
133 +        xt_cursor(t, oldcurs);
134 + }
135 +
136 +
137 + void
138   xt_delete(t, r)                         /* delete a line */
139   register TEXTWIND  *t;
140   int  r;
# Line 159 | Line 157 | int  r;
157          XClearArea(t->dpy, t->w, LEFTMAR, (t->nr-1)*Height(t->f),
158                          t->nc*Width(t->f), Height(t->f),(Bool) 0);
159  
160 <        bzero(cp, t->nc);
160 >        memset(cp, '\0', t->nc);
161          restorecurs(t);                 /* should we reposition cursor? */
162   }
163  
# Line 186 | Line 184 | int  r;
184                                          /* clear new line */
185          XClearArea(t->dpy, t->w, LEFTMAR, r*Height(t->f),
186                          t->nc*Width(t->f), Height(t->f), (Bool) 0);
187 <        bzero(cp, t->nc);
187 >        memset(cp, '\0', t->nc);
188          restorecurs(t);                 /* should we reposition cursor? */
189   }
190  
# Line 215 | Line 213 | register TEXTWIND  *t;
213  
214          XClearWindow(t->dpy, t->w);
215          for (i = 0; i < t->nr; i++)
216 <                bzero(t->lp[i], t->nc);
216 >                memset(t->lp[i], '\0', t->nc);
217          t->r = t->c = 0;
218          restorecurs(t);
219   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines