From fc82d9f3a24c7cb3c1e0426baabcbfbb0ffb8b08 Mon Sep 17 00:00:00 2001 From: Francesco Abbate Date: 2009年8月26日 08:22:34 +0000 Subject: Initial repository layout --- matrix_decls_source.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 matrix_decls_source.c (limited to 'matrix_decls_source.c') diff --git a/matrix_decls_source.c b/matrix_decls_source.c new file mode 100644 index 00000000..199ebcdd --- /dev/null +++ b/matrix_decls_source.c @@ -0,0 +1,62 @@ + +/* matrix_decls_source.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. + */ + +static int FUNCTION (matrix, get) (lua_State *L); +static int FUNCTION (matrix, set) (lua_State *L); +static int FUNCTION (matrix, free) (lua_State *L); +static int FUNCTION (matrix, new) (lua_State *L); +static int FUNCTION (matrix, dims) (lua_State *L); +static int FUNCTION (matrix, copy) (lua_State *L); + +static int FUNCTION (matrix, add) (lua_State *L); +static int FUNCTION (matrix, sub) (lua_State *L); +static int FUNCTION (matrix, mul_elements) (lua_State *L); +static int FUNCTION (matrix, div_elements) (lua_State *L); +static int FUNCTION (matrix, unm) (lua_State *L); + +static int FUNCTION (matrix, mul) (lua_State *L); +static int FUNCTION (matrix, inverse) (lua_State *L); +static int FUNCTION (matrix, solve) (lua_State *L); + +static const struct luaL_Reg FUNCTION (matrix, gc_methods)[] = { + {"__gc", FUNCTION (matrix, free)}, + {NULL, NULL} +}; + +static const struct luaL_Reg FUNCTION (matrix, methods)[] = { + {"__add", FUNCTION (matrix, add)}, + {"__sub", FUNCTION (matrix, sub)}, + {"__mul", FUNCTION (matrix, mul_elements)}, + {"__div", FUNCTION (matrix, div_elements)}, + {"__unm", FUNCTION (matrix, unm)}, + {"get", FUNCTION (matrix, get)}, + {"set", FUNCTION (matrix, set)}, + {"dims", FUNCTION (matrix, dims)}, + {"copy", FUNCTION (matrix, copy)}, + {"inverse", FUNCTION (matrix, inverse)}, + {NULL, NULL} +}; + +static const struct luaL_Reg FUNCTION (matrix, functions)[] = { + {PREFIX "matrix", FUNCTION (matrix, new)}, + {PREFIX "mul", FUNCTION (matrix, mul)}, + {PREFIX "solve", FUNCTION (matrix, solve)}, + {NULL, NULL} +}; -- cgit v1.2.3

AltStyle によって変換されたページ (->オリジナル) /