1 /*
2     $Id: registerobj.h 2475 2021-03-07 01:34:55Z 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 REGISTEROBJ_H
20 #define REGISTEROBJ_H
21 #include "obj.h"
22 #include "stdbool.h"
23 
24 extern struct Type *const REGISTER_OBJ;
25 
26 typedef struct Register {
27     Obj v;
28     size_t len;
29     size_t chars;
30     uint8_t *data;
31     uint8_t val[4];
32 } Register;
33 
34 #define Register(a) ((Register *)(1 ? (a) : (Obj *)(Register *)(a)))
35 
36 extern void registerobj_init(void);
37 extern void registerobj_names(void);
38 extern bool registerobj_createnames(uint32_t);
39 
ref_register(Register * v1)40 static inline Register *ref_register(Register *v1) {
41     v1->v.refcount++; return v1;
42 }
43 #endif
44