1 /*
2     $Id: mfuncobj.h 2537 2021-03-19 06:41:48Z soci $
3 
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8 
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13 
14     You should have received a copy of the GNU General Public License along
15     with this program; if not, write to the Free Software Foundation, Inc.,
16     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 
18 */
19 #ifndef MFUNCOBJ_H
20 #define MFUNCOBJ_H
21 #include "obj.h"
22 #include "str.h"
23 #include "stdbool.h"
24 
25 extern struct Type *const MFUNC_OBJ;
26 extern struct Type *const SFUNC_OBJ;
27 
28 struct mfunc_param_s {
29     str_t name;
30     str_t cfname;
31     Obj *init;
32     struct linepos_s epoint;
33 };
34 
35 typedef struct Mfunc {
36     Obj v;
37     argcount_t argc;
38     struct mfunc_param_s *param;
39     const struct file_list_s *file_list;
40     struct linepos_s epoint;
41     bool retval;
42     uint8_t recursion_pass;
43     size_t nslen;
44     struct Namespace **namespaces, *names;
45     size_t ipoint;
46     struct List *inamespaces;
47     const uint8_t *line;
48 } Mfunc;
49 typedef struct Mfunc Sfunc;
50 
51 #define Mfunc(a) ((Mfunc *)(1 ? (a) : (Obj *)(Mfunc *)(a)))
52 #define Sfunc(a) ((Sfunc *)(1 ? (a) : (Obj *)(Sfunc *)(a)))
53 
54 extern void mfuncobj_init(void);
55 #endif
56