Implement OBLISTs
[muddle-interpreter.git] / src / atom.h
1 /*
2 Copyright (C) 2017-2018 Keziah Wesley
3
4 You can redistribute and/or modify this file under the terms of the
5 GNU Affero General Public License as published by the Free Software
6 Foundation, either version 3 of the License, or (at your option) any
7 later version.
8
9 This file is distributed in the hope that it will be useful, but
10 WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Affero General Public License for more details.
13
14 You should have received a copy of the GNU Affero General Public
15 License along with this file. If not, see
16 <http://www.gnu.org/licenses/>.
17 */
18
19 #ifndef ATOM_H
20 #define ATOM_H
21
22 #include "object.h"
23
24 typedef struct atom_body atom_body;
25
26 // Return an atom with a newly-allocated body.
27 atom_object atom_create (const char *name, uint32_t namelen);
28
29 atom_body *ATOM_BODY (heap_ptr p);
30
31 const char *atom_pname (atom_object o);
32
33 inline static uint32_t
34 atom_namelen (atom_object body)
35 {
36   return body.val.namelen;
37 }
38
39 heap_ptr atom_body_alloc (uint32_t ct);
40
41 #endif