OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [start/] [insight/] [libgui/] [src/] [tclwinmode.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
/* tclwinmode.c - Tcl access to SetErrorMode function.
2
   Copyright (C) 1998 Cygnus Solutions.
3
   Written by Tom Tromey <tromey@cygnus.com>.  */
4
 
5
#include <tcl.h>
6
#include "guitcl.h"
7
 
8
#ifdef __CYGWIN32__
9
 
10
#include <windows.h>
11
 
12
struct pair
13
{
14
  const char *name;
15
  UINT value;
16
};
17
 
18
static struct pair values[] =
19
{
20
  { "failcriticalerrors", SEM_FAILCRITICALERRORS },
21
  { "noalignmentfaultexcept", SEM_NOALIGNMENTFAULTEXCEPT },
22
  { "nogpfaulterrorbox", SEM_NOGPFAULTERRORBOX },
23
  { "noopenfileerrorbox", SEM_NOOPENFILEERRORBOX },
24
  { NULL, 0 }
25
};
26
 
27
#endif
28
 
29
static int
30
seterrormode_command (ClientData cd, Tcl_Interp *interp,
31
                      int argc, char *argv[])
32
{
33
#ifdef __CYGWIN32__
34
  int len, i;
35
  char **list;
36
  UINT val = 0;
37
 
38
  if (argc != 2)
39
    {
40
      Tcl_AppendResult (interp, "wrong # args: should be \"",
41
                        argv[0], " modelist\"", (char *) NULL);
42
      return TCL_ERROR;
43
    }
44
 
45
  if (Tcl_SplitList (interp, argv[1], &len, &list) != TCL_OK)
46
    return TCL_ERROR;
47
 
48
  for (i = 0; i < len; ++i)
49
    {
50
      int j, found = 0;
51
      for (j = 0; values[j].name; ++j)
52
        {
53
          if (! strcmp (values[j].name, list[i]))
54
            {
55
              found = 1;
56
              val |= values[j].value;
57
              break;
58
            }
59
        }
60
      if (! found)
61
        {
62
          Tcl_AppendResult (interp, "unrecognized key \"", list[i],
63
                            "\"", (char *) NULL);
64
          Tcl_Free ((char *) list);
65
          return TCL_ERROR;
66
        }
67
    }
68
  Tcl_Free ((char *) list);
69
 
70
  val = SetErrorMode (val);
71
 
72
  for (i = 0; values[i].name; ++i)
73
    {
74
      if (val & values[i].value)
75
        Tcl_AppendElement (interp, values[i].name);
76
    }
77
#endif /* __CYGWIN32__ */
78
 
79
  return TCL_OK;
80
}
81
 
82
int
83
ide_create_set_error_mode_command (Tcl_Interp *interp)
84
{
85
  if (Tcl_CreateCommand (interp, "ide_set_error_mode",
86
                         seterrormode_command, NULL, NULL) == NULL)
87
    return TCL_ERROR;
88
  return TCL_OK;
89
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.