1.1 --- a/templates/progops.h Thu Dec 08 23:50:56 2016 +0100
1.2 +++ b/templates/progops.h Fri Dec 09 00:09:01 2016 +0100
1.3 @@ -1,12 +1,33 @@
1.4 -/* Program type definitions. */
1.5 +/* Operations depending on program specifics.
1.6 +
1.7 +Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk>
1.8 +
1.9 +This program is free software; you can redistribute it and/or modify it under
1.10 +the terms of the GNU General Public License as published by the Free Software
1.11 +Foundation; either version 3 of the License, or (at your option) any later
1.12 +version.
1.13 +
1.14 +This program is distributed in the hope that it will be useful, but WITHOUT
1.15 +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1.16 +FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
1.17 +details.
1.18 +
1.19 +You should have received a copy of the GNU General Public License along with
1.20 +this program. If not, see <http://www.gnu.org/licenses/>.
1.21 +*/
1.22 +
1.23 +#ifndef __PROGOPS_H__
1.24 +#define __PROGOPS_H__
1.25
1.26 #include <stdlib.h>
1.27 #include "types.h"
1.28
1.29 -/* Common operations. */
1.30 +/* Generic instantiation operations, defining common members. */
1.31
1.32 __attr __new(const __table *table, __ref cls, size_t size);
1.33
1.34 +/* Generic internal data allocation. */
1.35 +
1.36 __fragment *__new_fragment(unsigned int n);
1.37
1.38 void __newdata_sequence(__attr args[], unsigned int number);
1.39 @@ -15,7 +36,7 @@
1.40 void __newdata_mapping(__attr args[], unsigned int number);
1.41 #endif /* __HAVE___builtins___dict_dict */
1.42
1.43 -/* Exception raising. */
1.44 +/* Helpers for raising errors within common operations. */
1.45
1.46 #ifdef __HAVE___builtins___exception_io_EOFError
1.47 void __raise_eof_error();
1.48 @@ -29,6 +50,9 @@
1.49 void __raise_overflow_error();
1.50 void __raise_zero_division_error();
1.51 void __raise_type_error();
1.52 +
1.53 +/* Helper for raising exception instances. */
1.54 +
1.55 __attr __ensure_instance(__attr arg);
1.56
1.57 /* Generic invocation operations. */
1.58 @@ -48,3 +72,5 @@
1.59 __attr __GETDEFAULT(__ref obj, int pos);
1.60
1.61 int __BOOL(__attr attr);
1.62 +
1.63 +#endif /* __PROGOPS_H__ */