Uh oh!
There was an error while loading. Please reload this page.
This repository was archived by the owner on Nov 20, 2020. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.c
More file actions
Latest commit
73 lines (64 loc) · 1.8 KB
/
Copy patherrors.c
File metadata and controls
73 lines (64 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/* errors.c
*
* Copyright (C) 2009 Francesco Abbate
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include<lua.h>
#include<lauxlib.h>
#include<gsl/gsl_errno.h>
#include"errors.h"
staticlua_State*sys_wide_lua_state=NULL;
/*
struct error_reg {
int error_code;
const char *id;
const char *long_msg;
};
static const struct error_reg error_codes[] = {
{GSL_EMAXITER, "maxiter"},
{GSL_EROUND, "failed"},
{GSL_ESING, "singular"},
{GSL_EDIVERGE, "diverge"},
{0, NULL}
};
static const char *
integ_get_error_msg (int code)
{
const char *default_msg = "unknown";
const struct error_reg *p;
for (p = error_codes; p->msg; p++)
{
if (p->error_code == code)
return p->msg;
}
return default_msg;
}
*/
void
my_default_handler (constchar*reason,
constchar*file,
intline,
intgsl_errno)
{
luaL_error (sys_wide_lua_state, "GSL error: %s", reason);
}
void
set_gsl_error_handler (lua_State*L)
{
gsl_error_handler_t*old_handler;
sys_wide_lua_state=L;
old_handler=gsl_set_error_handler (&my_default_handler);
}