(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
torture/
pr51801.c
       1  /* { dg-do compile } */
       2  
       3  typedef struct { char Vshow; } TScreen;
       4  typedef struct _Misc { char Tshow; } Misc;
       5  typedef struct _XtermWidgetRec { TScreen screen; Misc misc; } XtermWidgetRec, *XtermWidget;
       6  extern XtermWidget term;
       7  void Bell (XtermWidget, int, int);
       8  void set_tek_visibility (int);
       9  
      10  void
      11  handle_tekshow (void *gw, int allowswitch)
      12  {
      13    XtermWidget xw = term;
      14    if (!((xw)->misc.Tshow))
      15      set_tek_visibility (1);
      16  }
      17  
      18  void
      19  do_tekonoff (void *gw, void *closure, void *data)
      20  {
      21    handle_tekshow (gw, 0);
      22  }
      23  
      24  void
      25  do_vtonoff (void *gw, void *closure, void *data)
      26  {
      27  }
      28  
      29  void
      30  handle_toggle (void (*proc) (void *gw, void *closure, void *data),
      31  	       int var, char **params, unsigned int nparams, void *w,
      32  	       void *closure, void *data)
      33  {
      34    XtermWidget xw = term;
      35    int dir = -2;
      36    switch (nparams)
      37      {
      38      case 0:
      39        dir = -1;
      40      }
      41    switch (dir)
      42      {
      43      case 1:
      44        (*proc) (w, closure, data);
      45        Bell (xw, 2, 0);
      46      }
      47  }
      48  
      49  void
      50  HandleVisibility (void *w, char **params, unsigned int *param_count)
      51  {
      52    XtermWidget xw = term;
      53    if (*param_count == 2)
      54      switch (params[0][0])
      55        {
      56        case 'v':
      57  	handle_toggle (do_vtonoff, (int) ((int) (&(xw)->screen)->Vshow),
      58  		       params + 1, (*param_count) - 1, w, (void *) 0,
      59  		       (void *) 0);
      60  	handle_toggle (do_tekonoff, (int) ((int) ((xw)->misc.Tshow)),
      61  		       params + 1, (*param_count) - 1, w, (void *) 0,
      62  		       (void *) 0);
      63        }
      64  }