2 Copyright (C) 2017-2018 Keziah Wesley
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
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.
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/>.
24 typedef struct atom_body
26 evaltype type; // UNBOUND/LOCI
35 atom_create (const char *name, uint32_t namelen)
37 // C-compatible strings for simplicity
39 heap_ptr body = atom_body_alloc (namelen);
40 atom_body *content = (atom_body *) HEAP_OBJECT (body);
41 memcpy (&content->pname, name, namelen - 1);
42 content->pname[namelen - 1] = '\0';
43 atom_object new = new_atom (body, namelen);
48 atom_body_alloc (uint32_t namelen)
50 return heap_alloc_uv ((sizeof (atom_body) + namelen + 63) / 64);
54 atom_pname (atom_object o)
56 return ATOM_BODY (o.val.body)->pname;