1.1 --- a/generator.py Sat Nov 06 17:06:01 2021 +0100 1.2 +++ b/generator.py Sun Nov 07 01:18:51 2021 +0100 1.3 @@ -320,7 +320,11 @@ 1.4 # Signature: __attr <name>(...); 1.5 1.6 parameters = self.importer.function_parameters[path] 1.7 - l = ["__attr"] * (len(parameters) + 1) 1.8 + 1.9 + # Include the stack parameter and context plus the original 1.10 + # parameters. 1.11 + 1.12 + l = ["__attr"] * (len(parameters) + 2) 1.13 print >>f_signatures, "__attr %s(%s);" % (encode_function_pointer(path), ", ".join(l)) 1.14 1.15 # Generate parameter table size data. 1.16 @@ -1244,9 +1248,9 @@ 1.17 1.18 if path == self.int_type: 1.19 print >>f_code, """\ 1.20 -__attr %s(__attr __self, __attr number_or_string, __attr base) 1.21 +__attr %s(__attr __stack, __attr __self, __attr number_or_string, __attr base) 1.22 { 1.23 - return __fn___builtins___int_new_int(__NULL, number_or_string, base); 1.24 + return __fn___builtins___int_new_int(__stack, __NULL, number_or_string, base); 1.25 } 1.26 """ % ( 1.27 encode_instantiator_pointer(path), 1.28 @@ -1259,9 +1263,9 @@ 1.29 1.30 elif path == self.string_type: 1.31 print >>f_code, """\ 1.32 -__attr %s(__attr __self, __attr obj) 1.33 +__attr %s(__attr __stack, __attr __self, __attr obj) 1.34 { 1.35 - return __fn___builtins___str_new_str(__NULL, obj); 1.36 + return __fn___builtins___str_new_str(__stack, __NULL, obj); 1.37 } 1.38 """ % ( 1.39 encode_instantiator_pointer(path), 1.40 @@ -1271,9 +1275,9 @@ 1.41 1.42 else: 1.43 print >>f_code, """\ 1.44 -__attr %s(__attr __self%s) 1.45 +__attr %s(__attr __stack, __attr __self%s) 1.46 { 1.47 - return %s(__NEWINSTANCE(%s)%s); 1.48 + return %s(__stack, __NEWINSTANCE(%s)%s); 1.49 } 1.50 """ % ( 1.51 encode_instantiator_pointer(path), 1.52 @@ -1283,9 +1287,9 @@ 1.53 parameters and ", %s" % ", ".join(parameters) or "" 1.54 ) 1.55 1.56 - # Signature: __new_typename(__attr __self, ...) 1.57 + # Signature: __new_typename(__attr __stack, __attr __self, ...) 1.58 1.59 - print >>f_signatures, "__attr %s(__attr __self%s);" % ( 1.60 + print >>f_signatures, "__attr %s(__attr __stack, __attr __self%s);" % ( 1.61 encode_instantiator_pointer(path), 1.62 l and ", %s" % ", ".join(l) or "" 1.63 ) 1.64 @@ -1302,6 +1306,7 @@ 1.65 print >>f_code, """\ 1.66 int main(int argc, char *argv[]) 1.67 { 1.68 + __attr __stack = (__attr) {.stack=0}; 1.69 __exc __tmp_exc; 1.70 1.71 GC_INIT(); 1.72 @@ -1311,17 +1316,20 @@ 1.73 __Try 1.74 {""" 1.75 1.76 + # Write a main function invocation for all but the native modules. 1.77 + 1.78 for name in self.importer.order_modules(): 1.79 - function_name = "__main_%s" % encode_path(name) 1.80 - print >>f_signatures, "void %s();" % function_name 1.81 - 1.82 - # Omit the native modules. 1.83 - 1.84 parts = name.split(".") 1.85 1.86 - if parts[0] != "native": 1.87 - print >>f_code, """\ 1.88 - %s();""" % function_name 1.89 + if parts[0] == "native": 1.90 + continue 1.91 + 1.92 + function_name = "__main_%s" % encode_path(name) 1.93 + print >>f_signatures, "void %s(__attr __stack);" % function_name 1.94 + print >>f_code, """\ 1.95 + %s(__stack);""" % function_name 1.96 + 1.97 + # Finish the main section with an exception handler. 1.98 1.99 print >>f_code, """\ 1.100 } 1.101 @@ -1332,7 +1340,7 @@ 1.102 1.103 fprintf(stderr, "Program terminated due to exception: %%s.\\n", 1.104 __load_via_object( 1.105 - __VALUE(%s(__NULL, __tmp_exc.arg)), 1.106 + __VALUE(%s(__stack, __NULL, __tmp_exc.arg)), 1.107 __data__).strvalue); 1.108 return 1; 1.109 }
2.1 --- a/templates/native/buffer.c Sat Nov 06 17:06:01 2021 +0100 2.2 +++ b/templates/native/buffer.c Sun Nov 07 01:18:51 2021 +0100 2.3 @@ -26,7 +26,7 @@ 2.4 #include "progtypes.h" 2.5 #include "main.h" 2.6 2.7 -__attr __fn_native_buffer_buffer_str(__attr __self, __attr _data) 2.8 +__attr __fn_native_buffer_buffer_str(__attr __stack, __attr __self, __attr _data) 2.9 { 2.10 /* _data interpreted as buffer.__data__ */ 2.11 __fragment *data = _data.seqvalue;
3.1 --- a/templates/native/buffer.h Sat Nov 06 17:06:01 2021 +0100 3.2 +++ b/templates/native/buffer.h Sun Nov 07 01:18:51 2021 +0100 3.3 @@ -1,6 +1,6 @@ 3.4 /* Native functions for buffer operations. 3.5 3.6 -Copyright (C) 2016, 2017 Paul Boddie <paul@boddie.org.uk> 3.7 +Copyright (C) 2016, 2017, 2021 Paul Boddie <paul@boddie.org.uk> 3.8 3.9 This program is free software; you can redistribute it and/or modify it under 3.10 the terms of the GNU General Public License as published by the Free Software 3.11 @@ -23,7 +23,7 @@ 3.12 3.13 /* Buffer operations. */ 3.14 3.15 -__attr __fn_native_buffer_buffer_str(__attr __self, __attr _data); 3.16 +__attr __fn_native_buffer_buffer_str(__attr __stack, __attr __self, __attr _data); 3.17 3.18 /* Module initialisation. */ 3.19
4.1 --- a/templates/native/common.c Sat Nov 06 17:06:01 2021 +0100 4.2 +++ b/templates/native/common.c Sun Nov 07 01:18:51 2021 +0100 4.3 @@ -26,7 +26,7 @@ 4.4 4.5 /* Utility functions. */ 4.6 4.7 -__attr __new_int(__int n) 4.8 +__attr __new_int(__attr __stack, __int n) 4.9 { 4.10 /* Create a new int and set the trailing data. */ 4.11 __attr attr = __NEWINSTANCEIM(__builtins___int_int); 4.12 @@ -52,7 +52,7 @@ 4.13 return attr; 4.14 } 4.15 4.16 -__attr __new_float(__float n) 4.17 +__attr __new_float(__attr __stack, __float n) 4.18 { 4.19 /* Create a new float and set the trailing data. */ 4.20 __attr attr = __NEWINSTANCEIM(__builtins___float_float);
5.1 --- a/templates/native/common.h Sat Nov 06 17:06:01 2021 +0100 5.2 +++ b/templates/native/common.h Sun Nov 07 01:18:51 2021 +0100 5.3 @@ -23,10 +23,10 @@ 5.4 5.5 /* Utility functions. */ 5.6 5.7 -__attr __new_int(__int n); 5.8 +__attr __new_int(__attr __stack, __int n); 5.9 __attr __new_str(char *s, __int size); 5.10 __attr __new_list(__fragment *f); 5.11 -__attr __new_float(__float n); 5.12 +__attr __new_float(__attr __stack, __float n); 5.13 __fragment *__fragment_append(__fragment *data, __attr value); 5.14 5.15 #endif /* __NATIVE_COMMON_H__ */
6.1 --- a/templates/native/float.c Sat Nov 06 17:06:01 2021 +0100 6.2 +++ b/templates/native/float.c Sun Nov 07 01:18:51 2021 +0100 6.3 @@ -65,54 +65,54 @@ 6.4 6.5 /* Floating point operations. Exceptions are raised in the signal handler. */ 6.6 6.7 -__attr __fn_native_float_float_add(__attr __self, __attr self, __attr other) 6.8 +__attr __fn_native_float_float_add(__attr __stack, __attr __self, __attr self, __attr other) 6.9 { 6.10 /* self and other interpreted as float */ 6.11 __float i = __TOFLOAT(self); 6.12 __float j = __TOFLOAT(other); 6.13 - return __new_float(i + j); 6.14 + return __new_float(__stack, i + j); 6.15 } 6.16 6.17 -__attr __fn_native_float_float_sub(__attr __self, __attr self, __attr other) 6.18 +__attr __fn_native_float_float_sub(__attr __stack, __attr __self, __attr self, __attr other) 6.19 { 6.20 /* self and other interpreted as float */ 6.21 __float i = __TOFLOAT(self); 6.22 __float j = __TOFLOAT(other); 6.23 - return __new_float(i - j); 6.24 + return __new_float(__stack, i - j); 6.25 } 6.26 6.27 -__attr __fn_native_float_float_mul(__attr __self, __attr self, __attr other) 6.28 +__attr __fn_native_float_float_mul(__attr __stack, __attr __self, __attr self, __attr other) 6.29 { 6.30 /* self and other interpreted as float */ 6.31 __float i = __TOFLOAT(self); 6.32 __float j = __TOFLOAT(other); 6.33 - return __new_float(i * j); 6.34 + return __new_float(__stack, i * j); 6.35 } 6.36 6.37 -__attr __fn_native_float_float_div(__attr __self, __attr self, __attr other) 6.38 +__attr __fn_native_float_float_div(__attr __stack, __attr __self, __attr self, __attr other) 6.39 { 6.40 /* self and other interpreted as float */ 6.41 __float i = __TOFLOAT(self); 6.42 __float j = __TOFLOAT(other); 6.43 - return __new_float(i / j); 6.44 + return __new_float(__stack, i / j); 6.45 } 6.46 6.47 -__attr __fn_native_float_float_mod(__attr __self, __attr self, __attr other) 6.48 +__attr __fn_native_float_float_mod(__attr __stack, __attr __self, __attr self, __attr other) 6.49 { 6.50 /* self and other interpreted as float */ 6.51 __float i = __TOFLOAT(self); 6.52 __float j = __TOFLOAT(other); 6.53 - return __new_float(fmod(i, j)); 6.54 + return __new_float(__stack, fmod(i, j)); 6.55 } 6.56 6.57 -__attr __fn_native_float_float_neg(__attr __self, __attr self) 6.58 +__attr __fn_native_float_float_neg(__attr __stack, __attr __self, __attr self) 6.59 { 6.60 /* self interpreted as float */ 6.61 __float i = __TOFLOAT(self); 6.62 - return __new_float(-i); 6.63 + return __new_float(__stack, -i); 6.64 } 6.65 6.66 -__attr __fn_native_float_float_pow(__attr __self, __attr self, __attr other) 6.67 +__attr __fn_native_float_float_pow(__attr __stack, __attr __self, __attr self, __attr other) 6.68 { 6.69 /* self and other interpreted as float */ 6.70 __float i = __TOFLOAT(self); 6.71 @@ -128,10 +128,10 @@ 6.72 __raise_overflow_error(); 6.73 6.74 /* Return the result. */ 6.75 - return __new_float(result); 6.76 + return __new_float(__stack, result); 6.77 } 6.78 6.79 -__attr __fn_native_float_float_le(__attr __self, __attr self, __attr other) 6.80 +__attr __fn_native_float_float_le(__attr __stack, __attr __self, __attr self, __attr other) 6.81 { 6.82 /* self and other interpreted as float */ 6.83 __float i = __TOFLOAT(self); 6.84 @@ -141,7 +141,7 @@ 6.85 return i <= j ? __builtins___boolean_True : __builtins___boolean_False; 6.86 } 6.87 6.88 -__attr __fn_native_float_float_lt(__attr __self, __attr self, __attr other) 6.89 +__attr __fn_native_float_float_lt(__attr __stack, __attr __self, __attr self, __attr other) 6.90 { 6.91 /* self and other interpreted as float */ 6.92 __float i = __TOFLOAT(self); 6.93 @@ -151,7 +151,7 @@ 6.94 return i < j ? __builtins___boolean_True : __builtins___boolean_False; 6.95 } 6.96 6.97 -__attr __fn_native_float_float_ge(__attr __self, __attr self, __attr other) 6.98 +__attr __fn_native_float_float_ge(__attr __stack, __attr __self, __attr self, __attr other) 6.99 { 6.100 /* self and other interpreted as float */ 6.101 __float i = __TOFLOAT(self); 6.102 @@ -161,7 +161,7 @@ 6.103 return i >= j ? __builtins___boolean_True : __builtins___boolean_False; 6.104 } 6.105 6.106 -__attr __fn_native_float_float_gt(__attr __self, __attr self, __attr other) 6.107 +__attr __fn_native_float_float_gt(__attr __stack, __attr __self, __attr self, __attr other) 6.108 { 6.109 /* self and other interpreted as float */ 6.110 __float i = __TOFLOAT(self); 6.111 @@ -171,7 +171,7 @@ 6.112 return i > j ? __builtins___boolean_True : __builtins___boolean_False; 6.113 } 6.114 6.115 -__attr __fn_native_float_float_eq(__attr __self, __attr self, __attr other) 6.116 +__attr __fn_native_float_float_eq(__attr __stack, __attr __self, __attr self, __attr other) 6.117 { 6.118 /* self and other interpreted as float */ 6.119 __float i = __TOFLOAT(self); 6.120 @@ -181,7 +181,7 @@ 6.121 return i == j ? __builtins___boolean_True : __builtins___boolean_False; 6.122 } 6.123 6.124 -__attr __fn_native_float_float_ne(__attr __self, __attr self, __attr other) 6.125 +__attr __fn_native_float_float_ne(__attr __stack, __attr __self, __attr self, __attr other) 6.126 { 6.127 /* self and other interpreted as float */ 6.128 __float i = __TOFLOAT(self); 6.129 @@ -191,7 +191,7 @@ 6.130 return i != j ? __builtins___boolean_True : __builtins___boolean_False; 6.131 } 6.132 6.133 -__attr __fn_native_float_float_str(__attr __self, __attr self) 6.134 +__attr __fn_native_float_float_str(__attr __stack, __attr __self, __attr self) 6.135 { 6.136 /* self interpreted as float */ 6.137 __float i = __TOFLOAT(self); 6.138 @@ -200,13 +200,13 @@ 6.139 return format_number(i, 64); 6.140 } 6.141 6.142 -__attr __fn_native_float_float_int(__attr __self, __attr self) 6.143 +__attr __fn_native_float_float_int(__attr __stack, __attr __self, __attr self) 6.144 { 6.145 /* self interpreted as float */ 6.146 __float i = __TOFLOAT(self); 6.147 6.148 /* NOTE: Test for conversion failure. */ 6.149 - return __new_int((int) i); 6.150 + return __new_int(__stack, (int) i); 6.151 } 6.152 6.153 /* Module initialisation. */
7.1 --- a/templates/native/float.h Sat Nov 06 17:06:01 2021 +0100 7.2 +++ b/templates/native/float.h Sun Nov 07 01:18:51 2021 +0100 7.3 @@ -1,6 +1,6 @@ 7.4 /* Native functions for floating point operations. 7.5 7.6 -Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk> 7.7 +Copyright (C) 2018, 2021 Paul Boddie <paul@boddie.org.uk> 7.8 7.9 This program is free software; you can redistribute it and/or modify it under 7.10 the terms of the GNU General Public License as published by the Free Software 7.11 @@ -23,23 +23,23 @@ 7.12 7.13 /* Floating point operations. */ 7.14 7.15 -__attr __fn_native_float_float_add(__attr __self, __attr self, __attr other); 7.16 -__attr __fn_native_float_float_sub(__attr __self, __attr self, __attr other); 7.17 -__attr __fn_native_float_float_mul(__attr __self, __attr self, __attr other); 7.18 -__attr __fn_native_float_float_div(__attr __self, __attr self, __attr other); 7.19 -__attr __fn_native_float_float_mod(__attr __self, __attr self, __attr other); 7.20 -__attr __fn_native_float_float_neg(__attr __self, __attr self); 7.21 -__attr __fn_native_float_float_pow(__attr __self, __attr self, __attr other); 7.22 +__attr __fn_native_float_float_add(__attr __stack, __attr __self, __attr self, __attr other); 7.23 +__attr __fn_native_float_float_sub(__attr __stack, __attr __self, __attr self, __attr other); 7.24 +__attr __fn_native_float_float_mul(__attr __stack, __attr __self, __attr self, __attr other); 7.25 +__attr __fn_native_float_float_div(__attr __stack, __attr __self, __attr self, __attr other); 7.26 +__attr __fn_native_float_float_mod(__attr __stack, __attr __self, __attr self, __attr other); 7.27 +__attr __fn_native_float_float_neg(__attr __stack, __attr __self, __attr self); 7.28 +__attr __fn_native_float_float_pow(__attr __stack, __attr __self, __attr self, __attr other); 7.29 7.30 -__attr __fn_native_float_float_le(__attr __self, __attr self, __attr other); 7.31 -__attr __fn_native_float_float_lt(__attr __self, __attr self, __attr other); 7.32 -__attr __fn_native_float_float_ge(__attr __self, __attr self, __attr other); 7.33 -__attr __fn_native_float_float_gt(__attr __self, __attr self, __attr other); 7.34 -__attr __fn_native_float_float_eq(__attr __self, __attr self, __attr other); 7.35 -__attr __fn_native_float_float_ne(__attr __self, __attr self, __attr other); 7.36 +__attr __fn_native_float_float_le(__attr __stack, __attr __self, __attr self, __attr other); 7.37 +__attr __fn_native_float_float_lt(__attr __stack, __attr __self, __attr self, __attr other); 7.38 +__attr __fn_native_float_float_ge(__attr __stack, __attr __self, __attr self, __attr other); 7.39 +__attr __fn_native_float_float_gt(__attr __stack, __attr __self, __attr self, __attr other); 7.40 +__attr __fn_native_float_float_eq(__attr __stack, __attr __self, __attr self, __attr other); 7.41 +__attr __fn_native_float_float_ne(__attr __stack, __attr __self, __attr self, __attr other); 7.42 7.43 -__attr __fn_native_float_float_str(__attr __self, __attr self); 7.44 -__attr __fn_native_float_float_int(__attr __self, __attr self); 7.45 +__attr __fn_native_float_float_str(__attr __stack, __attr __self, __attr self); 7.46 +__attr __fn_native_float_float_int(__attr __stack, __attr __self, __attr self); 7.47 7.48 /* Module initialisation. */ 7.49
8.1 --- a/templates/native/iconv.c Sat Nov 06 17:06:01 2021 +0100 8.2 +++ b/templates/native/iconv.c Sun Nov 07 01:18:51 2021 +0100 8.3 @@ -33,20 +33,20 @@ 8.4 static void __raise_incomplete_sequence_error(__attr value, __attr arg) 8.5 { 8.6 #ifdef __HAVE_posix_iconv_IncompleteSequenceError 8.7 - __Raise(__new_posix_iconv_IncompleteSequenceError(__NULL, value, arg)); 8.8 + __Raise(__new_posix_iconv_IncompleteSequenceError(__NULL, __NULL, value, arg)); 8.9 #endif /* __HAVE_posix_iconv_IncompleteSequenceError */ 8.10 } 8.11 8.12 static void __raise_invalid_sequence_error(__attr value, __attr arg) 8.13 { 8.14 #ifdef __HAVE_posix_iconv_InvalidSequenceError 8.15 - __Raise(__new_posix_iconv_InvalidSequenceError(__NULL, value, arg)); 8.16 + __Raise(__new_posix_iconv_InvalidSequenceError(__NULL, __NULL, value, arg)); 8.17 #endif /* __HAVE_posix_iconv_InvalidSequenceError */ 8.18 } 8.19 8.20 /* Character set conversion. */ 8.21 8.22 -__attr __fn_native_iconv_iconv(__attr __self, __attr cd, __attr state) 8.23 +__attr __fn_native_iconv_iconv(__attr __stack, __attr __self, __attr cd, __attr state) 8.24 { 8.25 /* cd interpreted as iconv_t */ 8.26 iconv_t c = (iconv_t) cd.datavalue; 8.27 @@ -87,13 +87,13 @@ 8.28 8.29 /* Mutate the state to indicate the next input buffer position. */ 8.30 8.31 - f->attrs[1] = __new_int(start + remaining - inbytesleft); 8.32 - f->attrs[2] = __new_int(inbytesleft); 8.33 + f->attrs[1] = __new_int(__stack, start + remaining - inbytesleft); 8.34 + f->attrs[2] = __new_int(__stack, inbytesleft); 8.35 8.36 /* Incomplete sequence: raise the string in an OSError instead. */ 8.37 8.38 if (errno == EINVAL) 8.39 - __raise_incomplete_sequence_error(__new_int(errno), __new_str(resultbuf, outbytestotal)); 8.40 + __raise_incomplete_sequence_error(__new_int(__stack, errno), __new_str(resultbuf, outbytestotal)); 8.41 8.42 return __new_str(resultbuf, outbytestotal); 8.43 } 8.44 @@ -104,20 +104,20 @@ 8.45 { 8.46 resultbuf = __ALLOCATE(inbytesleft + 1, sizeof(char)); 8.47 memcpy(resultbuf, inbuf, inbytesleft); 8.48 - __raise_invalid_sequence_error(__new_int(errno), __new_str(resultbuf, inbytesleft)); 8.49 + __raise_invalid_sequence_error(__new_int(__stack, errno), __new_str(resultbuf, inbytesleft)); 8.50 } 8.51 8.52 /* General failure. */ 8.53 8.54 else 8.55 - __raise_os_error(__new_int(errno), __builtins___none_None); 8.56 + __raise_os_error(__new_int(__stack, errno), __builtins___none_None); 8.57 8.58 /* Should never be reached: included to satisfy the compiler. */ 8.59 8.60 return __builtins___none_None; 8.61 } 8.62 8.63 -__attr __fn_native_iconv_iconv_close(__attr __self, __attr cd) 8.64 +__attr __fn_native_iconv_iconv_close(__attr __stack, __attr __self, __attr cd) 8.65 { 8.66 /* cd interpreted as iconv_t */ 8.67 iconv_t c = (iconv_t) cd.datavalue; 8.68 @@ -125,12 +125,12 @@ 8.69 errno = 0; 8.70 8.71 if (iconv_close(c) == -1) 8.72 - __raise_os_error(__new_int(errno), __builtins___none_None); 8.73 + __raise_os_error(__new_int(__stack, errno), __builtins___none_None); 8.74 8.75 return __builtins___none_None; 8.76 } 8.77 8.78 -__attr __fn_native_iconv_iconv_open(__attr __self, __attr tocode, __attr fromcode) 8.79 +__attr __fn_native_iconv_iconv_open(__attr __stack, __attr __self, __attr tocode, __attr fromcode) 8.80 { 8.81 /* tocode.__data__ interpreted as string */ 8.82 char *t = __load_via_object(__VALUE(tocode), __data__).strvalue; 8.83 @@ -143,7 +143,7 @@ 8.84 result = iconv_open(t, f); 8.85 8.86 if (result == (iconv_t) -1) 8.87 - __raise_os_error(__new_int(errno), __builtins___none_None); 8.88 + __raise_os_error(__new_int(__stack, errno), __builtins___none_None); 8.89 8.90 /* Return the descriptor as an opaque value. */ 8.91 8.92 @@ -151,7 +151,7 @@ 8.93 return attr; 8.94 } 8.95 8.96 -__attr __fn_native_iconv_iconv_reset(__attr __self, __attr cd) 8.97 +__attr __fn_native_iconv_iconv_reset(__attr __stack, __attr __self, __attr cd) 8.98 { 8.99 /* cd interpreted as iconv_t */ 8.100 iconv_t c = (iconv_t) cd.datavalue;
9.1 --- a/templates/native/iconv.h Sat Nov 06 17:06:01 2021 +0100 9.2 +++ b/templates/native/iconv.h Sun Nov 07 01:18:51 2021 +0100 9.3 @@ -1,6 +1,6 @@ 9.4 /* Native functions for character set conversion. 9.5 9.6 -Copyright (C) 2016, 2017 Paul Boddie <paul@boddie.org.uk> 9.7 +Copyright (C) 2016, 2017, 2021 Paul Boddie <paul@boddie.org.uk> 9.8 9.9 This program is free software; you can redistribute it and/or modify it under 9.10 the terms of the GNU General Public License as published by the Free Software 9.11 @@ -23,10 +23,10 @@ 9.12 9.13 /* Input/output. */ 9.14 9.15 -__attr __fn_native_iconv_iconv(__attr __self, __attr cd, __attr state); 9.16 -__attr __fn_native_iconv_iconv_close(__attr __self, __attr cd); 9.17 -__attr __fn_native_iconv_iconv_open(__attr __self, __attr tocode, __attr fromcode); 9.18 -__attr __fn_native_iconv_iconv_reset(__attr __self, __attr cd); 9.19 +__attr __fn_native_iconv_iconv(__attr __stack, __attr __self, __attr cd, __attr state); 9.20 +__attr __fn_native_iconv_iconv_close(__attr __stack, __attr __self, __attr cd); 9.21 +__attr __fn_native_iconv_iconv_open(__attr __stack, __attr __self, __attr tocode, __attr fromcode); 9.22 +__attr __fn_native_iconv_iconv_reset(__attr __stack, __attr __self, __attr cd); 9.23 9.24 /* Module initialisation. */ 9.25
10.1 --- a/templates/native/identity.c Sat Nov 06 17:06:01 2021 +0100 10.2 +++ b/templates/native/identity.c Sun Nov 07 01:18:51 2021 +0100 10.3 @@ -26,12 +26,12 @@ 10.4 10.5 /* Identity testing. */ 10.6 10.7 -__attr __fn_native_identity_is_(__attr __self, __attr x, __attr y) 10.8 +__attr __fn_native_identity_is_(__attr __stack, __attr __self, __attr x, __attr y) 10.9 { 10.10 return x.value == y.value ? __builtins___boolean_True : __builtins___boolean_False; 10.11 } 10.12 10.13 -__attr __fn_native_identity_is_not(__attr __self, __attr x, __attr y) 10.14 +__attr __fn_native_identity_is_not(__attr __stack, __attr __self, __attr x, __attr y) 10.15 { 10.16 return x.value != y.value ? __builtins___boolean_True : __builtins___boolean_False; 10.17 }
11.1 --- a/templates/native/identity.h Sat Nov 06 17:06:01 2021 +0100 11.2 +++ b/templates/native/identity.h Sun Nov 07 01:18:51 2021 +0100 11.3 @@ -1,6 +1,6 @@ 11.4 /* Native functions for identity operations. 11.5 11.6 -Copyright (C) 2016, 2017 Paul Boddie <paul@boddie.org.uk> 11.7 +Copyright (C) 2016, 2017, 2021 Paul Boddie <paul@boddie.org.uk> 11.8 11.9 This program is free software; you can redistribute it and/or modify it under 11.10 the terms of the GNU General Public License as published by the Free Software 11.11 @@ -23,8 +23,8 @@ 11.12 11.13 /* Identity testing. */ 11.14 11.15 -__attr __fn_native_identity_is_(__attr __self, __attr x, __attr y); 11.16 -__attr __fn_native_identity_is_not(__attr __self, __attr x, __attr y); 11.17 +__attr __fn_native_identity_is_(__attr __stack, __attr __self, __attr x, __attr y); 11.18 +__attr __fn_native_identity_is_not(__attr __stack, __attr __self, __attr x, __attr y); 11.19 11.20 /* Module initialisation. */ 11.21
12.1 --- a/templates/native/int.c Sat Nov 06 17:06:01 2021 +0100 12.2 +++ b/templates/native/int.c Sun Nov 07 01:18:51 2021 +0100 12.3 @@ -31,12 +31,12 @@ 12.4 12.5 /* Integer operations. */ 12.6 12.7 -__attr __fn_native_int_is_int(__attr __self, __attr obj) 12.8 +__attr __fn_native_int_is_int(__attr __stack, __attr __self, __attr obj) 12.9 { 12.10 return __INTEGER(obj) ? __builtins___boolean_True : __builtins___boolean_False; 12.11 } 12.12 12.13 -__attr __fn_native_int_int_add(__attr __self, __attr self, __attr other) 12.14 +__attr __fn_native_int_int_add(__attr __stack, __attr __self, __attr self, __attr other) 12.15 { 12.16 /* self and other interpreted as int */ 12.17 __int i = __TOINT(self); 12.18 @@ -49,10 +49,10 @@ 12.19 __raise_overflow_error(); 12.20 12.21 /* Return the new integer. */ 12.22 - return __new_int(i + j); 12.23 + return __new_int(__stack, i + j); 12.24 } 12.25 12.26 -__attr __fn_native_int_int_sub(__attr __self, __attr self, __attr other) 12.27 +__attr __fn_native_int_int_sub(__attr __stack, __attr __self, __attr self, __attr other) 12.28 { 12.29 /* self and other interpreted as int */ 12.30 __int i = __TOINT(self); 12.31 @@ -65,10 +65,10 @@ 12.32 __raise_overflow_error(); 12.33 12.34 /* Return the new integer. */ 12.35 - return __new_int(i - j); 12.36 + return __new_int(__stack, i - j); 12.37 } 12.38 12.39 -__attr __fn_native_int_int_mul(__attr __self, __attr self, __attr other) 12.40 +__attr __fn_native_int_int_mul(__attr __stack, __attr __self, __attr self, __attr other) 12.41 { 12.42 /* self and other interpreted as int */ 12.43 __int i = __TOINT(self); 12.44 @@ -83,10 +83,10 @@ 12.45 __raise_overflow_error(); 12.46 12.47 /* Return the new integer. */ 12.48 - return __new_int(i * j); 12.49 + return __new_int(__stack, i * j); 12.50 } 12.51 12.52 -__attr __fn_native_int_int_div(__attr __self, __attr self, __attr other) 12.53 +__attr __fn_native_int_int_div(__attr __stack, __attr __self, __attr self, __attr other) 12.54 { 12.55 /* self and other interpreted as int */ 12.56 __int i = __TOINT(self); 12.57 @@ -99,10 +99,10 @@ 12.58 __raise_overflow_error(); 12.59 12.60 /* Return the new integer. */ 12.61 - return __new_int(i / j); 12.62 + return __new_int(__stack, i / j); 12.63 } 12.64 12.65 -__attr __fn_native_int_int_mod(__attr __self, __attr self, __attr other) 12.66 +__attr __fn_native_int_int_mod(__attr __stack, __attr __self, __attr self, __attr other) 12.67 { 12.68 /* self and other interpreted as int */ 12.69 __int i = __TOINT(self); 12.70 @@ -115,10 +115,10 @@ 12.71 __raise_overflow_error(); 12.72 12.73 /* Return the new integer. */ 12.74 - return __new_int(i % j); 12.75 + return __new_int(__stack, i % j); 12.76 } 12.77 12.78 -__attr __fn_native_int_int_neg(__attr __self, __attr self) 12.79 +__attr __fn_native_int_int_neg(__attr __stack, __attr __self, __attr self) 12.80 { 12.81 /* self interpreted as int */ 12.82 __int i = __TOINT(self); 12.83 @@ -128,10 +128,10 @@ 12.84 __raise_overflow_error(); 12.85 12.86 /* Return the new integer. */ 12.87 - return __new_int(-i); 12.88 + return __new_int(__stack, -i); 12.89 } 12.90 12.91 -__attr __fn_native_int_int_pow(__attr __self, __attr self, __attr other) 12.92 +__attr __fn_native_int_int_pow(__attr __stack, __attr __self, __attr self, __attr other) 12.93 { 12.94 /* self and other interpreted as int */ 12.95 __int i = __TOINT(self); 12.96 @@ -151,10 +151,10 @@ 12.97 __raise_overflow_error(); 12.98 12.99 /* Return the new integer. */ 12.100 - return __new_int(k); 12.101 + return __new_int(__stack, k); 12.102 } 12.103 12.104 -__attr __fn_native_int_int_and(__attr __self, __attr self, __attr other) 12.105 +__attr __fn_native_int_int_and(__attr __stack, __attr __self, __attr self, __attr other) 12.106 { 12.107 /* self and other interpreted as int */ 12.108 __int i = __TOINT(self); 12.109 @@ -162,19 +162,19 @@ 12.110 12.111 /* Return the new integer. */ 12.112 /* NOTE: No overflow test applied. */ 12.113 - return __new_int(i & j); 12.114 + return __new_int(__stack, i & j); 12.115 } 12.116 12.117 -__attr __fn_native_int_int_not(__attr __self, __attr self) 12.118 +__attr __fn_native_int_int_not(__attr __stack, __attr __self, __attr self) 12.119 { 12.120 /* self interpreted as int */ 12.121 __int i = __TOINT(self); 12.122 12.123 /* Return the new integer. */ 12.124 - return __new_int(~i); 12.125 + return __new_int(__stack, ~i); 12.126 } 12.127 12.128 -__attr __fn_native_int_int_or(__attr __self, __attr self, __attr other) 12.129 +__attr __fn_native_int_int_or(__attr __stack, __attr __self, __attr self, __attr other) 12.130 { 12.131 /* self and other interpreted as int */ 12.132 __int i = __TOINT(self); 12.133 @@ -182,10 +182,10 @@ 12.134 12.135 /* Return the new integer. */ 12.136 /* NOTE: No overflow test applied. */ 12.137 - return __new_int(i | j); 12.138 + return __new_int(__stack, i | j); 12.139 } 12.140 12.141 -__attr __fn_native_int_int_xor(__attr __self, __attr self, __attr other) 12.142 +__attr __fn_native_int_int_xor(__attr __stack, __attr __self, __attr self, __attr other) 12.143 { 12.144 /* self and other interpreted as int */ 12.145 __int i = __TOINT(self); 12.146 @@ -193,10 +193,10 @@ 12.147 12.148 /* Return the new integer. */ 12.149 /* NOTE: No overflow test applied. */ 12.150 - return __new_int(i ^ j); 12.151 + return __new_int(__stack, i ^ j); 12.152 } 12.153 12.154 -__attr __fn_native_int_int_lshift(__attr __self, __attr self, __attr other) 12.155 +__attr __fn_native_int_int_lshift(__attr __stack, __attr __self, __attr self, __attr other) 12.156 { 12.157 /* self and other interpreted as int */ 12.158 __int i = __TOINT(self); 12.159 @@ -204,10 +204,10 @@ 12.160 12.161 /* Return the new integer. */ 12.162 /* NOTE: No overflow test applied. */ 12.163 - return __new_int(i << j); 12.164 + return __new_int(__stack, i << j); 12.165 } 12.166 12.167 -__attr __fn_native_int_int_rshift(__attr __self, __attr self, __attr other) 12.168 +__attr __fn_native_int_int_rshift(__attr __stack, __attr __self, __attr self, __attr other) 12.169 { 12.170 /* self and other interpreted as int */ 12.171 __int i = __TOINT(self); 12.172 @@ -215,10 +215,10 @@ 12.173 12.174 /* Return the new integer. */ 12.175 /* NOTE: No overflow test applied. */ 12.176 - return __new_int(i >> j); 12.177 + return __new_int(__stack, i >> j); 12.178 } 12.179 12.180 -__attr __fn_native_int_int_le(__attr __self, __attr self, __attr other) 12.181 +__attr __fn_native_int_int_le(__attr __stack, __attr __self, __attr self, __attr other) 12.182 { 12.183 /* self and other interpreted as int */ 12.184 __int i = __TOINT(self); 12.185 @@ -228,7 +228,7 @@ 12.186 return i <= j ? __builtins___boolean_True : __builtins___boolean_False; 12.187 } 12.188 12.189 -__attr __fn_native_int_int_lt(__attr __self, __attr self, __attr other) 12.190 +__attr __fn_native_int_int_lt(__attr __stack, __attr __self, __attr self, __attr other) 12.191 { 12.192 /* self and other interpreted as int */ 12.193 __int i = __TOINT(self); 12.194 @@ -238,7 +238,7 @@ 12.195 return i < j ? __builtins___boolean_True : __builtins___boolean_False; 12.196 } 12.197 12.198 -__attr __fn_native_int_int_ge(__attr __self, __attr self, __attr other) 12.199 +__attr __fn_native_int_int_ge(__attr __stack, __attr __self, __attr self, __attr other) 12.200 { 12.201 /* self and other interpreted as int */ 12.202 __int i = __TOINT(self); 12.203 @@ -248,7 +248,7 @@ 12.204 return i >= j ? __builtins___boolean_True : __builtins___boolean_False; 12.205 } 12.206 12.207 -__attr __fn_native_int_int_gt(__attr __self, __attr self, __attr other) 12.208 +__attr __fn_native_int_int_gt(__attr __stack, __attr __self, __attr self, __attr other) 12.209 { 12.210 /* self and other interpreted as int */ 12.211 __int i = __TOINT(self); 12.212 @@ -258,7 +258,7 @@ 12.213 return i > j ? __builtins___boolean_True : __builtins___boolean_False; 12.214 } 12.215 12.216 -__attr __fn_native_int_int_eq(__attr __self, __attr self, __attr other) 12.217 +__attr __fn_native_int_int_eq(__attr __stack, __attr __self, __attr self, __attr other) 12.218 { 12.219 /* self and other interpreted as int */ 12.220 __int i = __TOINT(self); 12.221 @@ -268,7 +268,7 @@ 12.222 return i == j ? __builtins___boolean_True : __builtins___boolean_False; 12.223 } 12.224 12.225 -__attr __fn_native_int_int_ne(__attr __self, __attr self, __attr other) 12.226 +__attr __fn_native_int_int_ne(__attr __stack, __attr __self, __attr self, __attr other) 12.227 { 12.228 /* self and other interpreted as int */ 12.229 __int i = __TOINT(self); 12.230 @@ -278,7 +278,7 @@ 12.231 return i != j ? __builtins___boolean_True : __builtins___boolean_False; 12.232 } 12.233 12.234 -__attr __fn_native_int_int_str(__attr __self, __attr self) 12.235 +__attr __fn_native_int_int_str(__attr __stack, __attr __self, __attr self) 12.236 { 12.237 /* self interpreted as int */ 12.238 __int i = __TOINT(self); 12.239 @@ -294,12 +294,12 @@ 12.240 return __new_str(s, strlen(s)); 12.241 } 12.242 12.243 -__attr __fn_native_int_int_float(__attr __self, __attr self) 12.244 +__attr __fn_native_int_int_float(__attr __stack, __attr __self, __attr self) 12.245 { 12.246 /* self interpreted as int */ 12.247 int i = __TOINT(self); 12.248 12.249 - return __new_float((double) i); 12.250 + return __new_float(__stack, (double) i); 12.251 } 12.252 12.253 /* Module initialisation. */
13.1 --- a/templates/native/int.h Sat Nov 06 17:06:01 2021 +0100 13.2 +++ b/templates/native/int.h Sun Nov 07 01:18:51 2021 +0100 13.3 @@ -1,6 +1,6 @@ 13.4 /* Native functions for integer operations. 13.5 13.6 -Copyright (C) 2016, 2017, 2018 Paul Boddie <paul@boddie.org.uk> 13.7 +Copyright (C) 2016, 2017, 2018, 2021 Paul Boddie <paul@boddie.org.uk> 13.8 13.9 This program is free software; you can redistribute it and/or modify it under 13.10 the terms of the GNU General Public License as published by the Free Software 13.11 @@ -23,32 +23,32 @@ 13.12 13.13 /* Integer operations. */ 13.14 13.15 -__attr __fn_native_int_is_int(__attr __self, __attr obj); 13.16 -__attr __fn_native_int_int_add(__attr __self, __attr _data, __attr other); 13.17 -__attr __fn_native_int_int_sub(__attr __self, __attr _data, __attr other); 13.18 -__attr __fn_native_int_int_mul(__attr __self, __attr _data, __attr other); 13.19 -__attr __fn_native_int_int_div(__attr __self, __attr _data, __attr other); 13.20 -__attr __fn_native_int_int_mod(__attr __self, __attr _data, __attr other); 13.21 -__attr __fn_native_int_int_neg(__attr __self, __attr _data); 13.22 -__attr __fn_native_int_int_pow(__attr __self, __attr _data, __attr other); 13.23 +__attr __fn_native_int_is_int(__attr __stack, __attr __self, __attr obj); 13.24 +__attr __fn_native_int_int_add(__attr __stack, __attr __self, __attr _data, __attr other); 13.25 +__attr __fn_native_int_int_sub(__attr __stack, __attr __self, __attr _data, __attr other); 13.26 +__attr __fn_native_int_int_mul(__attr __stack, __attr __self, __attr _data, __attr other); 13.27 +__attr __fn_native_int_int_div(__attr __stack, __attr __self, __attr _data, __attr other); 13.28 +__attr __fn_native_int_int_mod(__attr __stack, __attr __self, __attr _data, __attr other); 13.29 +__attr __fn_native_int_int_neg(__attr __stack, __attr __self, __attr _data); 13.30 +__attr __fn_native_int_int_pow(__attr __stack, __attr __self, __attr _data, __attr other); 13.31 13.32 -__attr __fn_native_int_int_and(__attr __self, __attr _data, __attr other); 13.33 -__attr __fn_native_int_int_not(__attr __self, __attr _data); 13.34 -__attr __fn_native_int_int_or(__attr __self, __attr _data, __attr other); 13.35 -__attr __fn_native_int_int_xor(__attr __self, __attr _data, __attr other); 13.36 +__attr __fn_native_int_int_and(__attr __stack, __attr __self, __attr _data, __attr other); 13.37 +__attr __fn_native_int_int_not(__attr __stack, __attr __self, __attr _data); 13.38 +__attr __fn_native_int_int_or(__attr __stack, __attr __self, __attr _data, __attr other); 13.39 +__attr __fn_native_int_int_xor(__attr __stack, __attr __self, __attr _data, __attr other); 13.40 13.41 -__attr __fn_native_int_int_lshift(__attr __self, __attr _data, __attr other); 13.42 -__attr __fn_native_int_int_rshift(__attr __self, __attr _data, __attr other); 13.43 +__attr __fn_native_int_int_lshift(__attr __stack, __attr __self, __attr _data, __attr other); 13.44 +__attr __fn_native_int_int_rshift(__attr __stack, __attr __self, __attr _data, __attr other); 13.45 13.46 -__attr __fn_native_int_int_eq(__attr __self, __attr _data, __attr other); 13.47 -__attr __fn_native_int_int_ge(__attr __self, __attr _data, __attr other); 13.48 -__attr __fn_native_int_int_gt(__attr __self, __attr _data, __attr other); 13.49 -__attr __fn_native_int_int_le(__attr __self, __attr _data, __attr other); 13.50 -__attr __fn_native_int_int_lt(__attr __self, __attr _data, __attr other); 13.51 -__attr __fn_native_int_int_ne(__attr __self, __attr _data, __attr other); 13.52 +__attr __fn_native_int_int_eq(__attr __stack, __attr __self, __attr _data, __attr other); 13.53 +__attr __fn_native_int_int_ge(__attr __stack, __attr __self, __attr _data, __attr other); 13.54 +__attr __fn_native_int_int_gt(__attr __stack, __attr __self, __attr _data, __attr other); 13.55 +__attr __fn_native_int_int_le(__attr __stack, __attr __self, __attr _data, __attr other); 13.56 +__attr __fn_native_int_int_lt(__attr __stack, __attr __self, __attr _data, __attr other); 13.57 +__attr __fn_native_int_int_ne(__attr __stack, __attr __self, __attr _data, __attr other); 13.58 13.59 -__attr __fn_native_int_int_str(__attr __self, __attr _data); 13.60 -__attr __fn_native_int_int_float(__attr __self, __attr _data); 13.61 +__attr __fn_native_int_int_str(__attr __stack, __attr __self, __attr _data); 13.62 +__attr __fn_native_int_int_float(__attr __stack, __attr __self, __attr _data); 13.63 13.64 /* Module initialisation. */ 13.65
14.1 --- a/templates/native/introspection.c Sat Nov 06 17:06:01 2021 +0100 14.2 +++ b/templates/native/introspection.c Sun Nov 07 01:18:51 2021 +0100 14.3 @@ -1,6 +1,6 @@ 14.4 /* Native functions for introspection operations. 14.5 14.6 -Copyright (C) 2016, 2017 Paul Boddie <paul@boddie.org.uk> 14.7 +Copyright (C) 2016, 2017, 2021 Paul Boddie <paul@boddie.org.uk> 14.8 14.9 This program is free software; you can redistribute it and/or modify it under 14.10 the terms of the GNU General Public License as published by the Free Software 14.11 @@ -26,7 +26,7 @@ 14.12 14.13 /* Introspection. */ 14.14 14.15 -__attr __fn_native_introspection_object_getattr(__attr __self, __attr obj, __attr name, __attr _default) 14.16 +__attr __fn_native_introspection_object_getattr(__attr __stack, __attr __self, __attr obj, __attr name, __attr _default) 14.17 { 14.18 /* name interpreted as string */ 14.19 __attr key = __load_via_object(__VALUE(name), __key__); 14.20 @@ -54,7 +54,7 @@ 14.21 return out; 14.22 } 14.23 14.24 -__attr __fn_native_introspection_isinstance(__attr __self, __attr obj, __attr cls) 14.25 +__attr __fn_native_introspection_isinstance(__attr __stack, __attr __self, __attr obj, __attr cls) 14.26 { 14.27 /* cls must be a class. */ 14.28 if (__is_instance_subclass(__VALUE(obj), cls)) 14.29 @@ -63,7 +63,7 @@ 14.30 return __builtins___boolean_False; 14.31 } 14.32 14.33 -__attr __fn_native_introspection_issubclass(__attr __self, __attr obj, __attr cls) 14.34 +__attr __fn_native_introspection_issubclass(__attr __stack, __attr __self, __attr obj, __attr cls) 14.35 { 14.36 /* obj and cls must be classes. */ 14.37 if (__is_subclass(__VALUE(obj), cls))
15.1 --- a/templates/native/introspection.h Sat Nov 06 17:06:01 2021 +0100 15.2 +++ b/templates/native/introspection.h Sun Nov 07 01:18:51 2021 +0100 15.3 @@ -1,6 +1,6 @@ 15.4 /* Native functions for introspection. 15.5 15.6 -Copyright (C) 2016, 2017 Paul Boddie <paul@boddie.org.uk> 15.7 +Copyright (C) 2016, 2017, 2021 Paul Boddie <paul@boddie.org.uk> 15.8 15.9 This program is free software; you can redistribute it and/or modify it under 15.10 the terms of the GNU General Public License as published by the Free Software 15.11 @@ -23,9 +23,9 @@ 15.12 15.13 /* Introspection. */ 15.14 15.15 -__attr __fn_native_introspection_object_getattr(__attr __self, __attr obj, __attr name, __attr _default); 15.16 -__attr __fn_native_introspection_isinstance(__attr __self, __attr obj, __attr cls); 15.17 -__attr __fn_native_introspection_issubclass(__attr __self, __attr obj, __attr cls); 15.18 +__attr __fn_native_introspection_object_getattr(__attr __stack, __attr __self, __attr obj, __attr name, __attr _default); 15.19 +__attr __fn_native_introspection_isinstance(__attr __stack, __attr __self, __attr obj, __attr cls); 15.20 +__attr __fn_native_introspection_issubclass(__attr __stack, __attr __self, __attr obj, __attr cls); 15.21 15.22 /* Module initialisation. */ 15.23
16.1 --- a/templates/native/io.c Sat Nov 06 17:06:01 2021 +0100 16.2 +++ b/templates/native/io.c Sun Nov 07 01:18:51 2021 +0100 16.3 @@ -31,31 +31,31 @@ 16.4 16.5 /* Input/output. */ 16.6 16.7 -__attr __fn_native_io_fclose(__attr __self, __attr fp) 16.8 +__attr __fn_native_io_fclose(__attr __stack, __attr __self, __attr fp) 16.9 { 16.10 /* fp interpreted as FILE reference */ 16.11 FILE *f = (FILE *) fp.datavalue; 16.12 16.13 errno = 0; 16.14 if (fclose(f)) 16.15 - __raise_io_error(__new_int(errno)); 16.16 + __raise_io_error(__new_int(__stack, errno)); 16.17 16.18 return __builtins___none_None; 16.19 } 16.20 16.21 -__attr __fn_native_io_fflush(__attr __self, __attr fp) 16.22 +__attr __fn_native_io_fflush(__attr __stack, __attr __self, __attr fp) 16.23 { 16.24 /* fp interpreted as FILE reference */ 16.25 FILE *f = (FILE *) fp.datavalue; 16.26 16.27 errno = 0; 16.28 if (fflush(f)) 16.29 - __raise_io_error(__new_int(errno)); 16.30 + __raise_io_error(__new_int(__stack, errno)); 16.31 16.32 return __builtins___none_None; 16.33 } 16.34 16.35 -__attr __fn_native_io_fopen(__attr __self, __attr filename, __attr mode) 16.36 +__attr __fn_native_io_fopen(__attr __stack, __attr __self, __attr filename, __attr mode) 16.37 { 16.38 /* filename.__data__ interpreted as string */ 16.39 char *fn = __load_via_object(__VALUE(filename), __data__).strvalue; 16.40 @@ -70,7 +70,7 @@ 16.41 /* Produce an exception if the operation failed. */ 16.42 16.43 if (f == NULL) 16.44 - __raise_io_error(__new_int(errno)); 16.45 + __raise_io_error(__new_int(__stack, errno)); 16.46 16.47 /* Return the __data__ attribute. */ 16.48 16.49 @@ -85,7 +85,7 @@ 16.50 return __builtins___none_None; 16.51 } 16.52 16.53 -__attr __fn_native_io_fdopen(__attr __self, __attr fd, __attr mode) 16.54 +__attr __fn_native_io_fdopen(__attr __stack, __attr __self, __attr fd, __attr mode) 16.55 { 16.56 /* fd interpreted as int */ 16.57 int i = __TOINT(fd); 16.58 @@ -100,7 +100,7 @@ 16.59 /* Produce an exception if the operation failed. */ 16.60 16.61 if (f == NULL) 16.62 - __raise_io_error(__new_int(errno)); 16.63 + __raise_io_error(__new_int(__stack, errno)); 16.64 16.65 /* Return the __data__ attribute. */ 16.66 16.67 @@ -115,7 +115,7 @@ 16.68 return __builtins___none_None; 16.69 } 16.70 16.71 -__attr __fn_native_io_fread(__attr __self, __attr fp, __attr size) 16.72 +__attr __fn_native_io_fread(__attr __stack, __attr __self, __attr fp, __attr size) 16.73 { 16.74 /* fp interpreted as FILE reference */ 16.75 FILE *f = (FILE *) fp.datavalue; 16.76 @@ -133,7 +133,7 @@ 16.77 if (feof(f) && (have_read == 0)) 16.78 __raise_eof_error(); 16.79 else if ((error = ferror(f))) 16.80 - __raise_io_error(__new_int(error)); 16.81 + __raise_io_error(__new_int(__stack, error)); 16.82 } 16.83 16.84 /* Reserve space for a new string. */ 16.85 @@ -143,7 +143,7 @@ 16.86 return __new_str(s, have_read); 16.87 } 16.88 16.89 -__attr __fn_native_io_fwrite(__attr __self, __attr fp, __attr str) 16.90 +__attr __fn_native_io_fwrite(__attr __stack, __attr __self, __attr fp, __attr str) 16.91 { 16.92 /* fp interpreted as FILE reference */ 16.93 FILE *f = (FILE *) fp.datavalue; 16.94 @@ -159,25 +159,25 @@ 16.95 if (feof(f)) 16.96 __raise_eof_error(); 16.97 else if ((error = ferror(f))) 16.98 - __raise_io_error(__new_int(error)); 16.99 + __raise_io_error(__new_int(__stack, error)); 16.100 } 16.101 16.102 return __builtins___none_None; 16.103 } 16.104 16.105 -__attr __fn_native_io_close(__attr __self, __attr fd) 16.106 +__attr __fn_native_io_close(__attr __stack, __attr __self, __attr fd) 16.107 { 16.108 /* fd interpreted as int */ 16.109 int i = __TOINT(fd); 16.110 16.111 errno = 0; 16.112 if (close(i) == -1) 16.113 - __raise_io_error(__new_int(errno)); 16.114 + __raise_io_error(__new_int(__stack, errno)); 16.115 16.116 return __builtins___none_None; 16.117 } 16.118 16.119 -__attr __fn_native_io_read(__attr __self, __attr fd, __attr n) 16.120 +__attr __fn_native_io_read(__attr __stack, __attr __self, __attr fd, __attr n) 16.121 { 16.122 /* fd interpreted as int */ 16.123 int i = __TOINT(fd); 16.124 @@ -191,7 +191,7 @@ 16.125 have_read = read(i, buf, to_read * sizeof(char)); 16.126 16.127 if (have_read == -1) 16.128 - __raise_io_error(__new_int(errno)); 16.129 + __raise_io_error(__new_int(__stack, errno)); 16.130 16.131 /* Reserve space for a new string. */ 16.132 16.133 @@ -200,7 +200,7 @@ 16.134 return __new_str(s, have_read); 16.135 } 16.136 16.137 -__attr __fn_native_io_write(__attr __self, __attr fd, __attr str) 16.138 +__attr __fn_native_io_write(__attr __stack, __attr __self, __attr fd, __attr str) 16.139 { 16.140 /* fd interpreted as int */ 16.141 int i = __TOINT(fd); 16.142 @@ -214,9 +214,9 @@ 16.143 have_written = write(i, s, sizeof(char) * size); 16.144 16.145 if (have_written == -1) 16.146 - __raise_io_error(__new_int(errno)); 16.147 + __raise_io_error(__new_int(__stack, errno)); 16.148 16.149 - return __new_int(have_written); 16.150 + return __new_int(__stack, have_written); 16.151 } 16.152 16.153 /* Module initialisation. */
17.1 --- a/templates/native/io.h Sat Nov 06 17:06:01 2021 +0100 17.2 +++ b/templates/native/io.h Sun Nov 07 01:18:51 2021 +0100 17.3 @@ -1,6 +1,6 @@ 17.4 /* Native functions for input/output. 17.5 17.6 -Copyright (C) 2016, 2017 Paul Boddie <paul@boddie.org.uk> 17.7 +Copyright (C) 2016, 2017, 2021 Paul Boddie <paul@boddie.org.uk> 17.8 17.9 This program is free software; you can redistribute it and/or modify it under 17.10 the terms of the GNU General Public License as published by the Free Software 17.11 @@ -23,15 +23,15 @@ 17.12 17.13 /* Input/output. */ 17.14 17.15 -__attr __fn_native_io_fclose(__attr __self, __attr fp); 17.16 -__attr __fn_native_io_fflush(__attr __self, __attr fp); 17.17 -__attr __fn_native_io_fopen(__attr __self, __attr filename, __attr mode); 17.18 -__attr __fn_native_io_fdopen(__attr __self, __attr fd, __attr mode); 17.19 -__attr __fn_native_io_fread(__attr __self, __attr fp, __attr size); 17.20 -__attr __fn_native_io_fwrite(__attr __self, __attr fp, __attr str); 17.21 -__attr __fn_native_io_close(__attr __self, __attr fd); 17.22 -__attr __fn_native_io_read(__attr __self, __attr fd, __attr n); 17.23 -__attr __fn_native_io_write(__attr __self, __attr fd, __attr str); 17.24 +__attr __fn_native_io_fclose(__attr __stack, __attr __self, __attr fp); 17.25 +__attr __fn_native_io_fflush(__attr __stack, __attr __self, __attr fp); 17.26 +__attr __fn_native_io_fopen(__attr __stack, __attr __self, __attr filename, __attr mode); 17.27 +__attr __fn_native_io_fdopen(__attr __stack, __attr __self, __attr fd, __attr mode); 17.28 +__attr __fn_native_io_fread(__attr __stack, __attr __self, __attr fp, __attr size); 17.29 +__attr __fn_native_io_fwrite(__attr __stack, __attr __self, __attr fp, __attr str); 17.30 +__attr __fn_native_io_close(__attr __stack, __attr __self, __attr fd); 17.31 +__attr __fn_native_io_read(__attr __stack, __attr __self, __attr fd, __attr n); 17.32 +__attr __fn_native_io_write(__attr __stack, __attr __self, __attr fd, __attr str); 17.33 17.34 /* Module initialisation. */ 17.35
18.1 --- a/templates/native/limits.c Sat Nov 06 17:06:01 2021 +0100 18.2 +++ b/templates/native/limits.c Sun Nov 07 01:18:51 2021 +0100 18.3 @@ -1,6 +1,6 @@ 18.4 /* Native functions for limit definition. 18.5 18.6 -Copyright (C) 2016, 2017 Paul Boddie <paul@boddie.org.uk> 18.7 +Copyright (C) 2016, 2017, 2021 Paul Boddie <paul@boddie.org.uk> 18.8 18.9 This program is free software; you can redistribute it and/or modify it under 18.10 the terms of the GNU General Public License as published by the Free Software 18.11 @@ -27,14 +27,16 @@ 18.12 18.13 /* Limit definition. */ 18.14 18.15 -__attr __fn_native_limits_get_maxint(__attr __self) 18.16 +/* NOTE: Could have statically allocated limits. */ 18.17 + 18.18 +__attr __fn_native_limits_get_maxint(__attr __stack, __attr __self) 18.19 { 18.20 - return __new_int(__MAXINT); 18.21 + return __new_int(__stack, __MAXINT); 18.22 } 18.23 18.24 -__attr __fn_native_limits_get_minint(__attr __self) 18.25 +__attr __fn_native_limits_get_minint(__attr __stack, __attr __self) 18.26 { 18.27 - return __new_int(__MININT); 18.28 + return __new_int(__stack, __MININT); 18.29 } 18.30 18.31 /* Module initialisation. */
19.1 --- a/templates/native/limits.h Sat Nov 06 17:06:01 2021 +0100 19.2 +++ b/templates/native/limits.h Sun Nov 07 01:18:51 2021 +0100 19.3 @@ -1,6 +1,6 @@ 19.4 /* Native functions for limit definition. 19.5 19.6 -Copyright (C) 2016, 2017 Paul Boddie <paul@boddie.org.uk> 19.7 +Copyright (C) 2016, 2017, 2021 Paul Boddie <paul@boddie.org.uk> 19.8 19.9 This program is free software; you can redistribute it and/or modify it under 19.10 the terms of the GNU General Public License as published by the Free Software 19.11 @@ -23,8 +23,8 @@ 19.12 19.13 /* Limit definition. */ 19.14 19.15 -__attr __fn_native_limits_get_maxint(__attr __self); 19.16 -__attr __fn_native_limits_get_minint(__attr __self); 19.17 +__attr __fn_native_limits_get_maxint(__attr __stack, __attr __self); 19.18 +__attr __fn_native_limits_get_minint(__attr __stack, __attr __self); 19.19 19.20 /* Module initialisation. */ 19.21
20.1 --- a/templates/native/list.c Sat Nov 06 17:06:01 2021 +0100 20.2 +++ b/templates/native/list.c Sun Nov 07 01:18:51 2021 +0100 20.3 @@ -27,7 +27,7 @@ 20.4 20.5 /* List operations. */ 20.6 20.7 -__attr __fn_native_list_list_init(__attr __self, __attr size) 20.8 +__attr __fn_native_list_list_init(__attr __stack, __attr __self, __attr size) 20.9 { 20.10 /* size interpreted as int */ 20.11 __int n = __TOINT(size); 20.12 @@ -37,7 +37,7 @@ 20.13 return attr; 20.14 } 20.15 20.16 -__attr __fn_native_list_list_setsize(__attr __self, __attr _data, __attr size) 20.17 +__attr __fn_native_list_list_setsize(__attr __stack, __attr __self, __attr _data, __attr size) 20.18 { 20.19 /* _data interpreted as list.__data__ */ 20.20 __fragment *data = _data.seqvalue; 20.21 @@ -48,7 +48,7 @@ 20.22 return __builtins___none_None; 20.23 } 20.24 20.25 -__attr __fn_native_list_list_append(__attr __self, __attr self, __attr value) 20.26 +__attr __fn_native_list_list_append(__attr __stack, __attr __self, __attr self, __attr value) 20.27 { 20.28 /* self.__data__ interpreted as list */ 20.29 __fragment *data = __load_via_object(__VALUE(self), __data__).seqvalue; 20.30 @@ -60,7 +60,7 @@ 20.31 return __builtins___none_None; 20.32 } 20.33 20.34 -__attr __fn_native_list_list_concat(__attr __self, __attr self, __attr other) 20.35 +__attr __fn_native_list_list_concat(__attr __stack, __attr __self, __attr self, __attr other) 20.36 { 20.37 /* self, interpreted as list, other interpreted as list.__data__ */ 20.38 __fragment *data = __load_via_object(__VALUE(self), __data__).seqvalue; 20.39 @@ -88,21 +88,21 @@ 20.40 return __builtins___none_None; 20.41 } 20.42 20.43 -__attr __fn_native_list_list_len(__attr self, __attr _data) 20.44 +__attr __fn_native_list_list_len(__attr __stack, __attr __self, __attr _data) 20.45 { 20.46 /* _data interpreted as list.__data__ */ 20.47 __int size = _data.seqvalue->size; 20.48 20.49 /* Return the new integer. */ 20.50 - return __new_int(size); 20.51 + return __new_int(__stack, size); 20.52 } 20.53 20.54 -__attr __fn_native_list_list_nonempty(__attr __self, __attr _data) 20.55 +__attr __fn_native_list_list_nonempty(__attr __stack, __attr __self, __attr _data) 20.56 { 20.57 return _data.seqvalue->size ? __builtins___boolean_True : __builtins___boolean_False; 20.58 } 20.59 20.60 -__attr __fn_native_list_list_element(__attr __self, __attr _data, __attr index) 20.61 +__attr __fn_native_list_list_element(__attr __stack, __attr __self, __attr _data, __attr index) 20.62 { 20.63 /* _data interpreted as list.__data__ */ 20.64 __attr *elements = _data.seqvalue->attrs; 20.65 @@ -112,7 +112,7 @@ 20.66 return elements[i]; 20.67 } 20.68 20.69 -__attr __fn_native_list_list_setelement(__attr __self, __attr _data, __attr index, __attr value) 20.70 +__attr __fn_native_list_list_setelement(__attr __stack, __attr __self, __attr _data, __attr index, __attr value) 20.71 { 20.72 /* _data interpreted as list.__data__ */ 20.73 __attr *elements = _data.seqvalue->attrs;
21.1 --- a/templates/native/list.h Sat Nov 06 17:06:01 2021 +0100 21.2 +++ b/templates/native/list.h Sun Nov 07 01:18:51 2021 +0100 21.3 @@ -1,6 +1,6 @@ 21.4 /* Native functions for list operations. 21.5 21.6 -Copyright (C) 2016, 2017 Paul Boddie <paul@boddie.org.uk> 21.7 +Copyright (C) 2016, 2017, 2021 Paul Boddie <paul@boddie.org.uk> 21.8 21.9 This program is free software; you can redistribute it and/or modify it under 21.10 the terms of the GNU General Public License as published by the Free Software 21.11 @@ -23,14 +23,14 @@ 21.12 21.13 /* List operations. */ 21.14 21.15 -__attr __fn_native_list_list_init(__attr __self, __attr size); 21.16 -__attr __fn_native_list_list_setsize(__attr __self, __attr _data, __attr size); 21.17 -__attr __fn_native_list_list_append(__attr __self, __attr self, __attr value); 21.18 -__attr __fn_native_list_list_concat(__attr __self, __attr self, __attr other); 21.19 -__attr __fn_native_list_list_len(__attr self, __attr _data); 21.20 -__attr __fn_native_list_list_nonempty(__attr __self, __attr _data); 21.21 -__attr __fn_native_list_list_element(__attr __self, __attr _data, __attr index); 21.22 -__attr __fn_native_list_list_setelement(__attr __self, __attr _data, __attr index, __attr value); 21.23 +__attr __fn_native_list_list_init(__attr __stack, __attr __self, __attr size); 21.24 +__attr __fn_native_list_list_setsize(__attr __stack, __attr __self, __attr _data, __attr size); 21.25 +__attr __fn_native_list_list_append(__attr __stack, __attr __self, __attr self, __attr value); 21.26 +__attr __fn_native_list_list_concat(__attr __stack, __attr __self, __attr self, __attr other); 21.27 +__attr __fn_native_list_list_len(__attr __stack, __attr __self, __attr _data); 21.28 +__attr __fn_native_list_list_nonempty(__attr __stack, __attr __self, __attr _data); 21.29 +__attr __fn_native_list_list_element(__attr __stack, __attr __self, __attr _data, __attr index); 21.30 +__attr __fn_native_list_list_setelement(__attr __stack, __attr __self, __attr _data, __attr index, __attr value); 21.31 21.32 /* Module initialisation. */ 21.33
22.1 --- a/templates/native/locale.c Sat Nov 06 17:06:01 2021 +0100 22.2 +++ b/templates/native/locale.c Sun Nov 07 01:18:51 2021 +0100 22.3 @@ -29,7 +29,7 @@ 22.4 22.5 /* Locales. */ 22.6 22.7 -__attr __fn_native_locale_getlocale(__attr __self, __attr category) 22.8 +__attr __fn_native_locale_getlocale(__attr __stack, __attr __self, __attr category) 22.9 { 22.10 /* category interpreted as int */ 22.11 int cat = __TOINT(category); 22.12 @@ -48,7 +48,7 @@ 22.13 return __new_str(result, length); 22.14 } 22.15 22.16 -__attr __fn_native_locale_setlocale(__attr __self, __attr category, __attr value) 22.17 +__attr __fn_native_locale_setlocale(__attr __stack, __attr __self, __attr category, __attr value) 22.18 { 22.19 /* category interpreted as int */ 22.20 int cat = __TOINT(category);
23.1 --- a/templates/native/locale.h Sat Nov 06 17:06:01 2021 +0100 23.2 +++ b/templates/native/locale.h Sun Nov 07 01:18:51 2021 +0100 23.3 @@ -1,6 +1,6 @@ 23.4 /* Native functions for locale handling. 23.5 23.6 -Copyright (C) 2016, 2017 Paul Boddie <paul@boddie.org.uk> 23.7 +Copyright (C) 2016, 2017, 2021 Paul Boddie <paul@boddie.org.uk> 23.8 23.9 This program is free software; you can redistribute it and/or modify it under 23.10 the terms of the GNU General Public License as published by the Free Software 23.11 @@ -23,8 +23,8 @@ 23.12 23.13 /* Input/output. */ 23.14 23.15 -__attr __fn_native_locale_getlocale(__attr __self, __attr category); 23.16 -__attr __fn_native_locale_setlocale(__attr __self, __attr category, __attr value); 23.17 +__attr __fn_native_locale_getlocale(__attr __stack, __attr __self, __attr category); 23.18 +__attr __fn_native_locale_setlocale(__attr __stack, __attr __self, __attr category, __attr value); 23.19 23.20 /* Module initialisation. */ 23.21
24.1 --- a/templates/native/program.c Sat Nov 06 17:06:01 2021 +0100 24.2 +++ b/templates/native/program.c Sun Nov 07 01:18:51 2021 +0100 24.3 @@ -1,6 +1,6 @@ 24.4 /* Native functions for program operations. 24.5 24.6 -Copyright (C) 2016, 2017 Paul Boddie <paul@boddie.org.uk> 24.7 +Copyright (C) 2016, 2017, 2021 Paul Boddie <paul@boddie.org.uk> 24.8 24.9 This program is free software; you can redistribute it and/or modify it under 24.10 the terms of the GNU General Public License as published by the Free Software 24.11 @@ -26,7 +26,7 @@ 24.12 24.13 /* Method binding. */ 24.14 24.15 -__attr __fn_native_program_get_using(__attr __self, __attr callable, __attr instance) 24.16 +__attr __fn_native_program_get_using(__attr __stack, __attr __self, __attr callable, __attr instance) 24.17 { 24.18 return __test_context(instance, callable); 24.19 }
25.1 --- a/templates/native/program.h Sat Nov 06 17:06:01 2021 +0100 25.2 +++ b/templates/native/program.h Sun Nov 07 01:18:51 2021 +0100 25.3 @@ -1,6 +1,6 @@ 25.4 /* Native functions for program operations. 25.5 25.6 -Copyright (C) 2016, 2017 Paul Boddie <paul@boddie.org.uk> 25.7 +Copyright (C) 2016, 2017, 2021 Paul Boddie <paul@boddie.org.uk> 25.8 25.9 This program is free software; you can redistribute it and/or modify it under 25.10 the terms of the GNU General Public License as published by the Free Software 25.11 @@ -21,7 +21,7 @@ 25.12 25.13 /* Method binding. */ 25.14 25.15 -__attr __fn_native_program_get_using(__attr __self, __attr callable, __attr instance); 25.16 +__attr __fn_native_program_get_using(__attr __stack, __attr __self, __attr callable, __attr instance); 25.17 25.18 /* Module initialisation. */ 25.19
26.1 --- a/templates/native/str.c Sat Nov 06 17:06:01 2021 +0100 26.2 +++ b/templates/native/str.c Sun Nov 07 01:18:51 2021 +0100 26.3 @@ -28,7 +28,7 @@ 26.4 26.5 /* String operations. */ 26.6 26.7 -__attr __fn_native_str_str_add(__attr __self, __attr _data, __attr other, __attr _size, __attr othersize) 26.8 +__attr __fn_native_str_str_add(__attr __stack, __attr __self, __attr _data, __attr other, __attr _size, __attr othersize) 26.9 { 26.10 /* _data, other interpreted as string.__data__ */ 26.11 char *s = _data.strvalue; 26.12 @@ -45,7 +45,7 @@ 26.13 return __new_str(r, n); 26.14 } 26.15 26.16 -__attr __fn_native_str_str_chr(__attr __self, __attr _data) 26.17 +__attr __fn_native_str_str_chr(__attr __stack, __attr __self, __attr _data) 26.18 { 26.19 /* data interpreted as int */ 26.20 int n = __TOINT(_data); 26.21 @@ -55,7 +55,7 @@ 26.22 return __new_str(s, 1); 26.23 } 26.24 26.25 -__attr __fn_native_str_str_lt(__attr __self, __attr _data, __attr other) 26.26 +__attr __fn_native_str_str_lt(__attr __stack, __attr __self, __attr _data, __attr other) 26.27 { 26.28 /* _data, other interpreted as string.__data__ */ 26.29 char *s = _data.strvalue; 26.30 @@ -65,7 +65,7 @@ 26.31 return strcmp(s, o) < 0 ? __builtins___boolean_True : __builtins___boolean_False; 26.32 } 26.33 26.34 -__attr __fn_native_str_str_gt(__attr __self, __attr _data, __attr other) 26.35 +__attr __fn_native_str_str_gt(__attr __stack, __attr __self, __attr _data, __attr other) 26.36 { 26.37 /* _data, other interpreted as string.__data__ */ 26.38 char *s = _data.strvalue; 26.39 @@ -75,7 +75,7 @@ 26.40 return strcmp(s, o) > 0 ? __builtins___boolean_True : __builtins___boolean_False; 26.41 } 26.42 26.43 -__attr __fn_native_str_str_eq(__attr __self, __attr _data, __attr other) 26.44 +__attr __fn_native_str_str_eq(__attr __stack, __attr __self, __attr _data, __attr other) 26.45 { 26.46 /* _data, other interpreted as string.__data__ */ 26.47 char *s = _data.strvalue; 26.48 @@ -85,20 +85,20 @@ 26.49 return strcmp(s, o) == 0 ? __builtins___boolean_True : __builtins___boolean_False; 26.50 } 26.51 26.52 -__attr __fn_native_str_str_ord(__attr __self, __attr _data) 26.53 +__attr __fn_native_str_str_ord(__attr __stack, __attr __self, __attr _data) 26.54 { 26.55 /* _data interpreted as string.__data__ */ 26.56 char *s = _data.strvalue; 26.57 26.58 - return __new_int((__int) s[0]); 26.59 + return __new_int(__stack, (__int) s[0]); 26.60 } 26.61 26.62 -__attr __fn_native_str_str_size(__attr __self, __attr _size) 26.63 +__attr __fn_native_str_str_size(__attr __stack, __attr __self, __attr _size) 26.64 { 26.65 - return __new_int(_size.sizevalue); 26.66 + return __new_int(__stack, _size.sizevalue); 26.67 } 26.68 26.69 -__attr __fn_native_str_str_substr(__attr __self, __attr _data, __attr start, __attr end, __attr step) 26.70 +__attr __fn_native_str_str_substr(__attr __stack, __attr __self, __attr _data, __attr start, __attr end, __attr step) 26.71 { 26.72 /* _data interpreted as string.__data__ */ 26.73 char *s = _data.strvalue, *sub;
27.1 --- a/templates/native/str.h Sat Nov 06 17:06:01 2021 +0100 27.2 +++ b/templates/native/str.h Sun Nov 07 01:18:51 2021 +0100 27.3 @@ -21,14 +21,14 @@ 27.4 27.5 /* String operations. */ 27.6 27.7 -__attr __fn_native_str_str_add(__attr __self, __attr _data, __attr other, __attr _size, __attr othersize); 27.8 -__attr __fn_native_str_str_chr(__attr __self, __attr _data); 27.9 -__attr __fn_native_str_str_lt(__attr __self, __attr _data, __attr other); 27.10 -__attr __fn_native_str_str_gt(__attr __self, __attr _data, __attr other); 27.11 -__attr __fn_native_str_str_eq(__attr __self, __attr _data, __attr other); 27.12 -__attr __fn_native_str_str_ord(__attr __self, __attr _data); 27.13 -__attr __fn_native_str_str_size(__attr __self); 27.14 -__attr __fn_native_str_str_substr(__attr __self, __attr _data, __attr start, __attr end, __attr step); 27.15 +__attr __fn_native_str_str_add(__attr __stack, __attr __self, __attr _data, __attr other, __attr _size, __attr othersize); 27.16 +__attr __fn_native_str_str_chr(__attr __stack, __attr __self, __attr _data); 27.17 +__attr __fn_native_str_str_lt(__attr __stack, __attr __self, __attr _data, __attr other); 27.18 +__attr __fn_native_str_str_gt(__attr __stack, __attr __self, __attr _data, __attr other); 27.19 +__attr __fn_native_str_str_eq(__attr __stack, __attr __self, __attr _data, __attr other); 27.20 +__attr __fn_native_str_str_ord(__attr __stack, __attr __self, __attr _data); 27.21 +__attr __fn_native_str_str_size(__attr __stack, __attr __self); 27.22 +__attr __fn_native_str_str_substr(__attr __stack, __attr __self, __attr _data, __attr start, __attr end, __attr step); 27.23 27.24 /* Module initialisation. */ 27.25
28.1 --- a/templates/native/system.c Sat Nov 06 17:06:01 2021 +0100 28.2 +++ b/templates/native/system.c Sun Nov 07 01:18:51 2021 +0100 28.3 @@ -27,19 +27,19 @@ 28.4 28.5 /* Environment support. */ 28.6 28.7 -__attr __fn_native_system_exit(__attr __self, __attr status) 28.8 +__attr __fn_native_system_exit(__attr __stack, __attr __self, __attr status) 28.9 { 28.10 exit(__TOINT(status)); 28.11 return __builtins___none_None; 28.12 } 28.13 28.14 -__attr __fn_native_system_get_argv(__attr __self) 28.15 +__attr __fn_native_system_get_argv(__attr __stack, __attr __self) 28.16 { 28.17 /* NOTE: To be written. */ 28.18 return __builtins___none_None; 28.19 } 28.20 28.21 -__attr __fn_native_system_get_path(__attr __self) 28.22 +__attr __fn_native_system_get_path(__attr __stack, __attr __self) 28.23 { 28.24 /* NOTE: To be written. */ 28.25 return __builtins___none_None;
29.1 --- a/templates/native/system.h Sat Nov 06 17:06:01 2021 +0100 29.2 +++ b/templates/native/system.h Sun Nov 07 01:18:51 2021 +0100 29.3 @@ -1,6 +1,6 @@ 29.4 /* Native functions for system operations. 29.5 29.6 -Copyright (C) 2016, 2017 Paul Boddie <paul@boddie.org.uk> 29.7 +Copyright (C) 2016, 2017, 2021 Paul Boddie <paul@boddie.org.uk> 29.8 29.9 This program is free software; you can redistribute it and/or modify it under 29.10 the terms of the GNU General Public License as published by the Free Software 29.11 @@ -23,9 +23,9 @@ 29.12 29.13 /* Environment support. */ 29.14 29.15 -__attr __fn_native_system_exit(__attr __self, __attr status); 29.16 -__attr __fn_native_system_get_argv(__attr __self); 29.17 -__attr __fn_native_system_get_path(__attr __self); 29.18 +__attr __fn_native_system_exit(__attr __stack, __attr __self, __attr status); 29.19 +__attr __fn_native_system_get_argv(__attr __stack, __attr __self); 29.20 +__attr __fn_native_system_get_path(__attr __stack, __attr __self); 29.21 29.22 /* Module initialisation. */ 29.23
30.1 --- a/templates/native/tuple.c Sat Nov 06 17:06:01 2021 +0100 30.2 +++ b/templates/native/tuple.c Sun Nov 07 01:18:51 2021 +0100 30.3 @@ -29,7 +29,7 @@ 30.4 30.5 static __fragment __empty_fragment = {.size=0, .capacity=0}; 30.6 30.7 -__attr __fn_native_tuple_tuple_init(__attr __self, __attr size) 30.8 +__attr __fn_native_tuple_tuple_init(__attr __stack, __attr __self, __attr size) 30.9 { 30.10 /* size interpreted as int */ 30.11 __int n = __TOINT(size);
31.1 --- a/templates/native/tuple.h Sat Nov 06 17:06:01 2021 +0100 31.2 +++ b/templates/native/tuple.h Sun Nov 07 01:18:51 2021 +0100 31.3 @@ -1,6 +1,6 @@ 31.4 /* Native functions for tuple operations. 31.5 31.6 -Copyright (C) 2016, 2017 Paul Boddie <paul@boddie.org.uk> 31.7 +Copyright (C) 2016, 2017, 2021 Paul Boddie <paul@boddie.org.uk> 31.8 31.9 This program is free software; you can redistribute it and/or modify it under 31.10 the terms of the GNU General Public License as published by the Free Software 31.11 @@ -23,7 +23,7 @@ 31.12 31.13 /* List operations. */ 31.14 31.15 -__attr __fn_native_tuple_tuple_init(__attr __self, __attr size); 31.16 +__attr __fn_native_tuple_tuple_init(__attr __stack, __attr __self, __attr size); 31.17 31.18 /* Module initialisation. */ 31.19
32.1 --- a/templates/native/unicode.c Sat Nov 06 17:06:01 2021 +0100 32.2 +++ b/templates/native/unicode.c Sun Nov 07 01:18:51 2021 +0100 32.3 @@ -69,7 +69,7 @@ 32.4 32.5 /* Unicode operations. */ 32.6 32.7 -__attr __fn_native_unicode_unicode_len(__attr __self, __attr _data, __attr _size) 32.8 +__attr __fn_native_unicode_unicode_len(__attr __stack, __attr __self, __attr _data, __attr _size) 32.9 { 32.10 /* _data interpreted as string.__data__ */ 32.11 char *s = _data.strvalue; 32.12 @@ -82,10 +82,10 @@ 32.13 c++; 32.14 32.15 /* Return the new integer. */ 32.16 - return __new_int(c); 32.17 + return __new_int(__stack, c); 32.18 } 32.19 32.20 -__attr __fn_native_unicode_unicode_ord(__attr __self, __attr _data, __attr _size) 32.21 +__attr __fn_native_unicode_unicode_ord(__attr __stack, __attr __self, __attr _data, __attr _size) 32.22 { 32.23 /* _data interpreted as string.__data__ */ 32.24 char *s = _data.strvalue; 32.25 @@ -116,10 +116,10 @@ 32.26 } 32.27 32.28 /* Return the new integer. */ 32.29 - return __new_int(c); 32.30 + return __new_int(__stack, c); 32.31 } 32.32 32.33 -__attr __fn_native_unicode_unicode_substr(__attr __self, __attr _data, __attr _size, __attr start, __attr end, __attr step) 32.34 +__attr __fn_native_unicode_unicode_substr(__attr __stack, __attr __self, __attr _data, __attr _size, __attr start, __attr end, __attr step) 32.35 { 32.36 /* _data interpreted as string.__data__ */ 32.37 char *s = _data.strvalue, *sub; 32.38 @@ -193,7 +193,7 @@ 32.39 return __new_str(sub, resultsize); 32.40 } 32.41 32.42 -__attr __fn_native_unicode_unicode_unichr(__attr __self, __attr value) 32.43 +__attr __fn_native_unicode_unicode_unichr(__attr __stack, __attr __self, __attr value) 32.44 { 32.45 /* value interpreted as int */ 32.46 int i = __TOINT(value);
33.1 --- a/templates/native/unicode.h Sat Nov 06 17:06:01 2021 +0100 33.2 +++ b/templates/native/unicode.h Sun Nov 07 01:18:51 2021 +0100 33.3 @@ -1,6 +1,6 @@ 33.4 /* Native functions for Unicode operations. 33.5 33.6 -Copyright (C) 2016, 2017 Paul Boddie <paul@boddie.org.uk> 33.7 +Copyright (C) 2016, 2017, 2021 Paul Boddie <paul@boddie.org.uk> 33.8 33.9 This program is free software; you can redistribute it and/or modify it under 33.10 the terms of the GNU General Public License as published by the Free Software 33.11 @@ -21,10 +21,10 @@ 33.12 33.13 /* Unicode operations. */ 33.14 33.15 -__attr __fn_native_unicode_unicode_len(__attr __self, __attr _data, __attr _size); 33.16 -__attr __fn_native_unicode_unicode_ord(__attr __self, __attr _data, __attr _size); 33.17 -__attr __fn_native_unicode_unicode_substr(__attr __self, __attr _data, __attr _size, __attr start, __attr end, __attr step); 33.18 -__attr __fn_native_unicode_unicode_unichr(__attr __self, __attr value); 33.19 +__attr __fn_native_unicode_unicode_len(__attr __stack, __attr __self, __attr _data, __attr _size); 33.20 +__attr __fn_native_unicode_unicode_ord(__attr __stack, __attr __self, __attr _data, __attr _size); 33.21 +__attr __fn_native_unicode_unicode_substr(__attr __stack, __attr __self, __attr _data, __attr _size, __attr start, __attr end, __attr step); 33.22 +__attr __fn_native_unicode_unicode_unichr(__attr __stack, __attr __self, __attr value); 33.23 33.24 /* Module initialisation. */ 33.25
34.1 --- a/templates/progops.c Sat Nov 06 17:06:01 2021 +0100 34.2 +++ b/templates/progops.c Sun Nov 07 01:18:51 2021 +0100 34.3 @@ -44,7 +44,7 @@ 34.4 34.5 __attr __new_wrapper(__attr context, __attr attr) 34.6 { 34.7 - return __new___builtins___core_wrapper(__NULL, context, attr); 34.8 + return __new___builtins___core_wrapper(__NULL, __NULL, context, attr); 34.9 } 34.10 34.11 /* Generic internal data allocation. */ 34.12 @@ -113,7 +113,7 @@ 34.13 34.14 /* Call __init__ with the dict object and list argument. */ 34.15 34.16 - __fn___builtins___dict_dict___init__(self, tmp); 34.17 + __fn___builtins___dict_dict___init__(__NULL, self, tmp); 34.18 return self; 34.19 } 34.20 #endif /* __HAVE___builtins___dict_dict */ 34.21 @@ -123,73 +123,73 @@ 34.22 void __raise_eof_error() 34.23 { 34.24 #ifdef __HAVE___builtins___exception_io_EOFError 34.25 - __Raise(__new___builtins___exception_io_EOFError(__NULL)); 34.26 + __Raise(__new___builtins___exception_io_EOFError(__NULL, __NULL)); 34.27 #endif /* __HAVE___builtins___exception_io_EOFError */ 34.28 } 34.29 34.30 void __raise_floating_point_error() 34.31 { 34.32 - __Raise(__new___builtins___core_FloatingPointError(__NULL)); 34.33 + __Raise(__new___builtins___core_FloatingPointError(__NULL, __NULL)); 34.34 } 34.35 34.36 void __raise_io_error(__attr value) 34.37 { 34.38 #ifdef __HAVE___builtins___exception_io_IOError 34.39 - __Raise(__new___builtins___exception_io_IOError(__NULL, value)); 34.40 + __Raise(__new___builtins___exception_io_IOError(__NULL, __NULL, value)); 34.41 #endif /* __HAVE___builtins___exception_io_IOError */ 34.42 } 34.43 34.44 void __raise_memory_error() 34.45 { 34.46 - __Raise(__new___builtins___core_MemoryError(__NULL)); 34.47 + __Raise(__new___builtins___core_MemoryError(__NULL, __NULL)); 34.48 } 34.49 34.50 void __raise_os_error(__attr value, __attr arg) 34.51 { 34.52 #ifdef __HAVE___builtins___exception_system_OSError 34.53 - __Raise(__new___builtins___exception_system_OSError(__NULL, value, arg)); 34.54 + __Raise(__new___builtins___exception_system_OSError(__NULL, __NULL, value, arg)); 34.55 #endif /* __HAVE___builtins___exception_system_OSError */ 34.56 } 34.57 34.58 void __raise_overflow_error() 34.59 { 34.60 - __Raise(__new___builtins___core_OverflowError(__NULL)); 34.61 + __Raise(__new___builtins___core_OverflowError(__NULL, __NULL)); 34.62 } 34.63 34.64 void __raise_unbound_method_error() 34.65 { 34.66 - __Raise(__new___builtins___core_UnboundMethodInvocation(__NULL)); 34.67 + __Raise(__new___builtins___core_UnboundMethodInvocation(__NULL, __NULL)); 34.68 } 34.69 34.70 void __raise_type_error() 34.71 { 34.72 - __Raise(__new___builtins___core_TypeError(__NULL)); 34.73 + __Raise(__new___builtins___core_TypeError(__NULL, __NULL)); 34.74 } 34.75 34.76 void __raise_underflow_error() 34.77 { 34.78 - __Raise(__new___builtins___core_UnderflowError(__NULL)); 34.79 + __Raise(__new___builtins___core_UnderflowError(__NULL, __NULL)); 34.80 } 34.81 34.82 void __raise_value_error(__attr value) 34.83 { 34.84 #ifdef __HAVE___builtins___exception_base_ValueError 34.85 - __Raise(__new___builtins___exception_base_ValueError(__NULL, value)); 34.86 + __Raise(__new___builtins___exception_base_ValueError(__NULL, __NULL, value)); 34.87 #endif /* __HAVE___builtins___exception_base_ValueError */ 34.88 } 34.89 34.90 void __raise_zero_division_error() 34.91 { 34.92 - __Raise(__new___builtins___core_ZeroDivisionError(__NULL)); 34.93 + __Raise(__new___builtins___core_ZeroDivisionError(__NULL, __NULL)); 34.94 } 34.95 34.96 /* Helper for raising exception instances. */ 34.97 34.98 -__attr __ensure_instance(__attr arg) 34.99 +__attr __ensure_instance(__attr __stack, __attr arg) 34.100 { 34.101 - /* Reserve space for the instance. */ 34.102 + /* Reserve space for the stack and instance. */ 34.103 34.104 - __attr args[1] = {__NULL}; 34.105 + __attr args[2] = {__stack, __NULL}; 34.106 34.107 /* Return instances as provided. */ 34.108 34.109 @@ -199,7 +199,7 @@ 34.110 /* Invoke non-instances to produce instances. */ 34.111 34.112 else 34.113 - return __invoke(arg, 0, 0, 0, 0, 1, args); 34.114 + return __invoke(arg, 0, 0, 0, 0, 2, args); 34.115 } 34.116 34.117 /* Generic invocation operations. */ 34.118 @@ -207,8 +207,10 @@ 34.119 /* Invoke the given callable, supplying keyword argument details in the given 34.120 codes and arguments arrays, indicating the number of arguments described. 34.121 The number of positional arguments is specified, and such arguments then 34.122 - follow as conventional function arguments. Typically, at least one argument 34.123 - is specified, starting with any context argument. 34.124 + follow as conventional function arguments. 34.125 + 34.126 + Typically, at least two arguments are specified, starting with the stack 34.127 + argument and any context argument. 34.128 */ 34.129 34.130 __attr __invoke(__attr callable, int always_callable, 34.131 @@ -220,10 +222,13 @@ 34.132 __attr target = __unwrap_callable(callable); 34.133 34.134 /* Obtain the __args__ special member, referencing the parameter table. */ 34.135 - /* Refer to the table and minimum/maximum. */ 34.136 34.137 const __ptable *ptable = __check_and_load_via_object(__VALUE(target), __args__).ptable; 34.138 - const unsigned int min = ptable->min, max = ptable->max; 34.139 + 34.140 + /* Refer to the table and minimum/maximum, adjusting for the stack 34.141 + argument. */ 34.142 + 34.143 + unsigned int min = ptable->min + 1, max = ptable->max + 1; 34.144 34.145 /* Reserve enough space for the arguments. */ 34.146 34.147 @@ -269,15 +274,20 @@ 34.148 34.149 /* Check the table entry against the supplied argument details. 34.150 Set the argument but only if it does not overwrite positional 34.151 - arguments. */ 34.152 - /* NOTE: Should use a more specific exception. */ 34.153 + arguments. Here, the position is adjusted for the stack 34.154 + argument. */ 34.155 34.156 - if ((pos == -1) || (pos < nargs)) 34.157 + if ((pos == -1) || (pos + 1 < nargs)) 34.158 + { 34.159 + /* NOTE: Should use a more specific exception. */ 34.160 + 34.161 __raise_type_error(); 34.162 + } 34.163 34.164 - /* Set the argument using the appropriate position. */ 34.165 + /* Set the argument using the appropriate position, adjusting for 34.166 + the stack argument. */ 34.167 34.168 - allargs[pos] = kwargs[kwpos]; 34.169 + allargs[pos + 1] = kwargs[kwpos]; 34.170 } 34.171 34.172 /* Fill the defaults. */ 34.173 @@ -290,20 +300,21 @@ 34.174 } 34.175 34.176 /* Call with the prepared arguments via a special adaptor function that 34.177 - converts the array to an argument list. */ 34.178 + converts the array to an argument list. The stack argument occupies 34.179 + position #0, with the context occupying position #1. */ 34.180 34.181 return __call_with_args( 34.182 always_callable ? 34.183 - __get_function_unwrapped(allargs[0], target) : 34.184 - __check_and_get_function_unwrapped(allargs[0], target), 34.185 + __get_function_unwrapped(allargs[1], target) : 34.186 + __check_and_get_function_unwrapped(allargs[1], target), 34.187 allargs, max); 34.188 } 34.189 34.190 /* Error routines. */ 34.191 34.192 -__attr __unbound_method(__attr __self) 34.193 +__attr __unbound_method(__attr __stack, __attr __self) 34.194 { 34.195 - __Raise(__new___builtins___core_UnboundMethodInvocation(__NULL)); 34.196 + __Raise(__new___builtins___core_UnboundMethodInvocation(__stack, __NULL)); 34.197 return __builtins___none_None; /* superfluous */ 34.198 } 34.199 34.200 @@ -336,7 +347,8 @@ 34.201 34.202 return value == (__ref) &__predefined___builtins___boolean_True ? 1 : 34.203 value == (__ref) &__predefined___builtins___boolean_False ? 0 : 34.204 - __VALUE(__fn___builtins___boolean_bool(__NULL, attr)) == (__ref) &__predefined___builtins___boolean_True; 34.205 + __VALUE(__fn___builtins___boolean_bool(__NULL, __NULL, attr)) == 34.206 + (__ref) &__predefined___builtins___boolean_True; 34.207 } 34.208 34.209 /* Conversion of trailing data to an integer. */
35.1 --- a/templates/progops.h Sat Nov 06 17:06:01 2021 +0100 35.2 +++ b/templates/progops.h Sun Nov 07 01:18:51 2021 +0100 35.3 @@ -61,7 +61,7 @@ 35.4 35.5 /* Helper for raising exception instances. */ 35.6 35.7 -__attr __ensure_instance(__attr arg); 35.8 +__attr __ensure_instance(__attr __stack, __attr arg); 35.9 35.10 /* Generic invocation operations. */ 35.11 35.12 @@ -71,7 +71,7 @@ 35.13 35.14 /* Error routines. */ 35.15 35.16 -__attr __unbound_method(__attr __self); 35.17 +__attr __unbound_method(__attr __stack, __attr __self); 35.18 35.19 /* Generic operations depending on specific program details. */ 35.20 35.21 @@ -86,7 +86,7 @@ 35.22 #define __INSTANCETABLE(CLS) (__InstanceTable_##CLS) 35.23 #define __NEWINSTANCE(CLS) __new(&__INSTANCETABLE(CLS), &CLS, __INSTANCESIZE(CLS), 0) 35.24 #define __NEWINSTANCEIM(CLS) __new(&__INSTANCETABLE(CLS), &CLS, __INSTANCESIZE(CLS), 1) 35.25 -#define __ISINSTANCE(ATTR, TYPE) __BOOL(__fn_native_introspection_isinstance(__NULL, ATTR, TYPE)) 35.26 +#define __ISINSTANCE(ATTR, TYPE) __BOOL(__fn_native_introspection_isinstance(__NULL, __NULL, ATTR, TYPE)) 35.27 35.28 /* Operations for accessing trailing data. */ 35.29
36.1 --- a/templates/types.h Sat Nov 06 17:06:01 2021 +0100 36.2 +++ b/templates/types.h Sun Nov 07 01:18:51 2021 +0100 36.3 @@ -101,6 +101,11 @@ 36.4 __fragment * seqvalue; /* sequence data */ 36.5 void * datavalue; /* object-specific data */ 36.6 __int sizevalue; /* object-specific size */ 36.7 + 36.8 + /* Value stack pointer for parameter usage. */ 36.9 + 36.10 + __attr **stack; 36.11 + 36.12 } __attr; 36.13 36.14 typedef struct __obj
37.1 --- a/translator.py Sat Nov 06 17:06:01 2021 +0100 37.2 +++ b/translator.py Sun Nov 07 01:18:51 2021 +0100 37.3 @@ -3,7 +3,7 @@ 37.4 """ 37.5 Translate programs. 37.6 37.7 -Copyright (C) 2015, 2016, 2017, 2018 Paul Boddie <paul@boddie.org.uk> 37.8 +Copyright (C) 2015-2018, 2021 Paul Boddie <paul@boddie.org.uk> 37.9 37.10 This program is free software; you can redistribute it and/or modify it under 37.11 the terms of the GNU General Public License as published by the Free Software 37.12 @@ -1281,8 +1281,8 @@ 37.13 self.record_temp("__tmp_values") 37.14 37.15 # Arguments are presented in a temporary frame array with any context 37.16 - # always being the first argument. Where it would be unused, it may be 37.17 - # set to null. 37.18 + # always being the first argument after the value stack. Where the 37.19 + # context would be unused, it may be set to null. 37.20 37.21 if context_required: 37.22 if have_access_context: 37.23 @@ -1292,7 +1292,10 @@ 37.24 else: 37.25 context_arg = "__NULL" 37.26 37.27 - args = [context_arg] 37.28 + # Introduce the value stack and any context. 37.29 + 37.30 + args = ["__stack", context_arg] 37.31 + reserved_args = 2 37.32 37.33 # Complete the array with null values, permitting tests for a complete 37.34 # set of arguments. 37.35 @@ -1337,7 +1340,7 @@ 37.36 except ValueError: 37.37 raise TranslateError("Argument %s is not recognised." % arg.name, 37.38 self.get_namespace_path(), n) 37.39 - args[argnum+1] = str(argexpr) 37.40 + args[argnum + reserved_args] = str(argexpr) 37.41 37.42 # Otherwise, store the details in a separate collection. 37.43 37.44 @@ -1351,7 +1354,7 @@ 37.45 37.46 else: 37.47 try: 37.48 - args[i+1] = str(argexpr) 37.49 + args[i + reserved_args] = str(argexpr) 37.50 except IndexError: 37.51 raise TranslateError("Too many arguments specified.", 37.52 self.get_namespace_path(), n) 37.53 @@ -1375,8 +1378,8 @@ 37.54 37.55 for i, (argname, default) in enumerate(function_defaults): 37.56 argnum = parameters.index(argname) 37.57 - if not args[argnum+1]: 37.58 - args[argnum+1] = "__GETDEFAULT(%s, %d)" % (target_structure, i) 37.59 + if not args[argnum + reserved_args]: 37.60 + args[argnum + reserved_args] = "__GETDEFAULT(%s, %d)" % (target_structure, i) 37.61 37.62 elif known_parameters: 37.63 37.64 @@ -1387,7 +1390,7 @@ 37.65 i = len(n.args) 37.66 pos = i - (num_parameters - num_defaults) 37.67 while i < num_parameters: 37.68 - args[i+1] = "__GETDEFAULT(%s.value, %d)" % (target_var, pos) 37.69 + args[i + reserved_args] = "__GETDEFAULT(%s.value, %d)" % (target_var, pos) 37.70 i += 1 37.71 pos += 1 37.72 37.73 @@ -1400,10 +1403,10 @@ 37.74 # Encode the arguments. 37.75 37.76 # Where literal instantiation is occurring, add an argument indicating 37.77 - # the number of values. The context is excluded. 37.78 + # the number of values. The stack and context are excluded. 37.79 37.80 if literal_instantiation: 37.81 - argstr = "%d, %s" % (len(args) - 1, ", ".join(args[1:])) 37.82 + argstr = "%d, %s" % (len(args) - reserved_args, ", ".join(args[reserved_args:])) 37.83 else: 37.84 argstr = ", ".join(args) 37.85 37.86 @@ -1738,7 +1741,7 @@ 37.87 if isinstance(exc, TrInstanceRef): 37.88 self.writestmt("__Raise(%s);" % exc) 37.89 else: 37.90 - self.writestmt("__Raise(__ensure_instance(%s));" % exc) 37.91 + self.writestmt("__Raise(__ensure_instance(__stack, %s));" % exc) 37.92 else: 37.93 self.writestmt("__Throw(__tmp_exc);") 37.94 37.95 @@ -2049,7 +2052,7 @@ 37.96 37.97 "Write the start of each module's main function." 37.98 37.99 - print >>self.out, "void __main_%s()" % encode_path(self.name) 37.100 + print >>self.out, "void __main_%s(__attr __stack)" % encode_path(self.name) 37.101 print >>self.out, "{" 37.102 self.indent += 1 37.103 37.104 @@ -2142,10 +2145,14 @@ 37.105 parameters found in the arguments array. 37.106 """ 37.107 37.108 + l = [] 37.109 + 37.110 + # Generate the parallel value stack reference. 37.111 + 37.112 + l.append("__attr __stack") 37.113 + 37.114 # Generate any self reference. 37.115 37.116 - l = [] 37.117 - 37.118 if self.is_method(name): 37.119 l.append("__attr self") 37.120 else: