/[emacs]/emacs/src/w32xfns.c
ViewVC logotype

Diff of /emacs/src/w32xfns.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.19 by andrewi, Tue Feb 6 22:19:23 2001 UTC revision 1.19.16.1 by miles, Fri Apr 4 06:21:04 2003 UTC
# Line 38  extern HANDLE keyboard_handle; Line 38  extern HANDLE keyboard_handle;
38  HANDLE input_available = NULL;  HANDLE input_available = NULL;
39  HANDLE interrupt_handle = NULL;  HANDLE interrupt_handle = NULL;
40    
41  void  void
42  init_crit ()  init_crit ()
43  {  {
44    InitializeCriticalSection (&critsect);    InitializeCriticalSection (&critsect);
# Line 56  init_crit () Line 56  init_crit ()
56    interrupt_handle = CreateEvent (NULL, TRUE, FALSE, NULL);    interrupt_handle = CreateEvent (NULL, TRUE, FALSE, NULL);
57  }  }
58    
59  void  void
60  delete_crit ()  delete_crit ()
61  {  {
62    DeleteCriticalSection (&critsect);    DeleteCriticalSection (&critsect);
# Line 160  int_msg *lpHead = NULL; Line 160  int_msg *lpHead = NULL;
160  int_msg *lpTail = NULL;  int_msg *lpTail = NULL;
161  int nQueue = 0;  int nQueue = 0;
162    
163  BOOL  BOOL
164  get_next_msg (lpmsg, bWait)  get_next_msg (lpmsg, bWait)
165       W32Msg * lpmsg;       W32Msg * lpmsg;
166       BOOL bWait;       BOOL bWait;
167  {  {
168    BOOL bRet = FALSE;    BOOL bRet = FALSE;
169      
170    enter_crit ();    enter_crit ();
171      
172    /* The while loop takes care of multiple sets */    /* The while loop takes care of multiple sets */
173      
174    while (!nQueue && bWait)    while (!nQueue && bWait)
175      {      {
176        leave_crit ();        leave_crit ();
177        WaitForSingleObject (input_available, INFINITE);        WaitForSingleObject (input_available, INFINITE);
178        enter_crit ();        enter_crit ();
179      }      }
180      
181    if (nQueue)    if (nQueue)
182      {      {
183        bcopy (&(lpHead->w32msg), lpmsg, sizeof (W32Msg));        bcopy (&(lpHead->w32msg), lpmsg, sizeof (W32Msg));
184    
185        {        {
186          int_msg * lpCur = lpHead;          int_msg * lpCur = lpHead;
187                
188          lpHead = lpHead->lpNext;          lpHead = lpHead->lpNext;
189                
190          myfree (lpCur);          myfree (lpCur);
191        }        }
192    
# Line 197  get_next_msg (lpmsg, bWait) Line 197  get_next_msg (lpmsg, bWait)
197    
198    if (nQueue == 0)    if (nQueue == 0)
199      ResetEvent (input_available);      ResetEvent (input_available);
200      
201    leave_crit ();    leave_crit ();
202      
203    return (bRet);    return (bRet);
204  }  }
205    
206  BOOL  BOOL
207  post_msg (lpmsg)  post_msg (lpmsg)
208       W32Msg * lpmsg;       W32Msg * lpmsg;
209  {  {
# Line 221  post_msg (lpmsg) Line 221  post_msg (lpmsg)
221      {      {
222        lpTail->lpNext = lpNew;        lpTail->lpNext = lpNew;
223      }      }
224    else    else
225      {      {
226        lpHead = lpNew;        lpHead = lpNew;
227      }      }
228    
229    lpTail = lpNew;    lpTail = lpNew;
230    SetEvent (input_available);    SetEvent (input_available);
231        
232    leave_crit ();    leave_crit ();
233    
234    return (TRUE);    return (TRUE);
# Line 277  drain_message_queue () Line 277  drain_message_queue ()
277   *   It returns a bitmask that indicates which of the four values   *   It returns a bitmask that indicates which of the four values
278   *   were actually found in the string.  For each value found,   *   were actually found in the string.  For each value found,
279   *   the corresponding argument is updated;  for each value   *   the corresponding argument is updated;  for each value
280   *   not found, the corresponding argument is left unchanged.   *   not found, the corresponding argument is left unchanged.
281   */   */
282    
283  static int  static int
# Line 287  read_integer (string, NextString) Line 287  read_integer (string, NextString)
287  {  {
288    register int Result = 0;    register int Result = 0;
289    int Sign = 1;    int Sign = 1;
290      
291    if (*string == '+')    if (*string == '+')
292      string++;      string++;
293    else if (*string == '-')    else if (*string == '-')
# Line 306  read_integer (string, NextString) Line 306  read_integer (string, NextString)
306      return (-Result);      return (-Result);
307  }  }
308    
309  int  int
310  XParseGeometry (string, x, y, width, height)  XParseGeometry (string, x, y, width, height)
311       char *string;       char *string;
312       int *x, *y;       int *x, *y;
# Line 317  XParseGeometry (string, x, y, width, hei Line 317  XParseGeometry (string, x, y, width, hei
317    unsigned int tempWidth, tempHeight;    unsigned int tempWidth, tempHeight;
318    int tempX, tempY;    int tempX, tempY;
319    char *nextCharacter;    char *nextCharacter;
320      
321    if ((string == NULL) || (*string == '\0')) return (mask);    if ((string == NULL) || (*string == '\0')) return (mask);
322    if (*string == '=')    if (*string == '=')
323      string++;  /* ignore possible '=' at beg of geometry spec */      string++;  /* ignore possible '=' at beg of geometry spec */
324      
325    strind = (char *)string;    strind = (char *)string;
326    if (*strind != '+' && *strind != '-' && *strind != 'x')    if (*strind != '+' && *strind != '-' && *strind != 'x')
327      {      {
328        tempWidth = read_integer (strind, &nextCharacter);        tempWidth = read_integer (strind, &nextCharacter);
329        if (strind == nextCharacter)        if (strind == nextCharacter)
330          return (0);          return (0);
331        strind = nextCharacter;        strind = nextCharacter;
332        mask |= WidthValue;        mask |= WidthValue;
333      }      }
334      
335    if (*strind == 'x' || *strind == 'X')    if (*strind == 'x' || *strind == 'X')
336      {        {
337        strind++;        strind++;
338        tempHeight = read_integer (strind, &nextCharacter);        tempHeight = read_integer (strind, &nextCharacter);
339        if (strind == nextCharacter)        if (strind == nextCharacter)
# Line 341  XParseGeometry (string, x, y, width, hei Line 341  XParseGeometry (string, x, y, width, hei
341        strind = nextCharacter;        strind = nextCharacter;
342        mask |= HeightValue;        mask |= HeightValue;
343      }      }
344      
345    if ((*strind == '+') || (*strind == '-'))    if ((*strind == '+') || (*strind == '-'))
346      {      {
347        if (*strind == '-')        if (*strind == '-')
348          {          {
349            strind++;            strind++;
350            tempX = -read_integer (strind, &nextCharacter);            tempX = -read_integer (strind, &nextCharacter);
# Line 355  XParseGeometry (string, x, y, width, hei Line 355  XParseGeometry (string, x, y, width, hei
355    
356          }          }
357        else        else
358          {                {
359            strind++;            strind++;
360            tempX = read_integer (strind, &nextCharacter);            tempX = read_integer (strind, &nextCharacter);
361            if (strind == nextCharacter)            if (strind == nextCharacter)
# Line 363  XParseGeometry (string, x, y, width, hei Line 363  XParseGeometry (string, x, y, width, hei
363            strind = nextCharacter;            strind = nextCharacter;
364          }          }
365        mask |= XValue;        mask |= XValue;
366        if ((*strind == '+') || (*strind == '-'))        if ((*strind == '+') || (*strind == '-'))
367          {          {
368            if (*strind == '-')            if (*strind == '-')
369              {              {
370                strind++;                strind++;
371                tempY = -read_integer (strind, &nextCharacter);                tempY = -read_integer (strind, &nextCharacter);
# Line 386  XParseGeometry (string, x, y, width, hei Line 386  XParseGeometry (string, x, y, width, hei
386            mask |= YValue;            mask |= YValue;
387          }          }
388      }      }
389      
390    /* If strind isn't at the end of the string the it's an invalid    /* If strind isn't at the end of the string the it's an invalid
391       geometry specification. */       geometry specification. */
392      
393    if (*strind != '\0') return (0);    if (*strind != '\0') return (0);
394      
395    if (mask & XValue)    if (mask & XValue)
396      *x = tempX;      *x = tempX;
397    if (mask & YValue)    if (mask & YValue)

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.19.16.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26