# HG changeset patch # User Paul Boddie # Date 1693599757 -7200 # Node ID ab30a18f95865c91ce16129df750b371db4b3c5e # Parent 1fde2e291f5f411cfc2fc5d5ccccfb7150a1cb97# Parent 560f520d8446f6ea4df20a4d1e314342d4d04830 Merged changes from the default branch. diff -r 1fde2e291f5f -r ab30a18f9586 docs/tools/sign_releases.sh --- a/docs/tools/sign_releases.sh Tue Aug 29 19:29:31 2023 +0200 +++ b/docs/tools/sign_releases.sh Fri Sep 01 22:22:37 2023 +0200 @@ -31,9 +31,18 @@ fi for FILENAME in "$OUTDIR/"*".tar.bz2" ; do + + # Handle an absence of archives. + + if [ ! -e "$FILENAME" ] ; then + break + fi + OUTFILE="$FILENAME.asc" if [ ! -e "$OUTFILE" ] || [ "$FORCE" ]; then gpg --sign -a -b "$FILENAME" echo "$OUTFILE" fi done + +# vim: tabstop=4 expandtab shiftwidth=4 diff -r 1fde2e291f5f -r ab30a18f9586 docs/wiki/Downloads diff -r 1fde2e291f5f -r ab30a18f9586 templates/native/limits.c --- a/templates/native/limits.c Tue Aug 29 19:29:31 2023 +0200 +++ b/templates/native/limits.c Fri Sep 01 22:22:37 2023 +0200 @@ -1,6 +1,6 @@ /* Native functions for limit definition. -Copyright (C) 2016, 2017 Paul Boddie +Copyright (C) 2016, 2017, 2021 Paul Boddie This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -27,6 +27,8 @@ /* Limit definition. */ +/* NOTE: Could have statically allocated limits. */ + __attr __fn_native_limits_get_maxint(__attr __self) { return __new_int(__MAXINT); diff -r 1fde2e291f5f -r ab30a18f9586 templates/native/list.c --- a/templates/native/list.c Tue Aug 29 19:29:31 2023 +0200 +++ b/templates/native/list.c Fri Sep 01 22:22:37 2023 +0200 @@ -88,7 +88,7 @@ return __builtins___none_None; } -__attr __fn_native_list_list_len(__attr self, __attr _data) +__attr __fn_native_list_list_len(__attr __self, __attr _data) { /* _data interpreted as list.__data__ */ __int size = _data.seqvalue->size; diff -r 1fde2e291f5f -r ab30a18f9586 templates/native/list.h --- a/templates/native/list.h Tue Aug 29 19:29:31 2023 +0200 +++ b/templates/native/list.h Fri Sep 01 22:22:37 2023 +0200 @@ -1,6 +1,6 @@ /* Native functions for list operations. -Copyright (C) 2016, 2017 Paul Boddie +Copyright (C) 2016, 2017, 2021 Paul Boddie This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -27,7 +27,7 @@ __attr __fn_native_list_list_setsize(__attr __self, __attr _data, __attr size); __attr __fn_native_list_list_append(__attr __self, __attr self, __attr value); __attr __fn_native_list_list_concat(__attr __self, __attr self, __attr other); -__attr __fn_native_list_list_len(__attr self, __attr _data); +__attr __fn_native_list_list_len(__attr __self, __attr _data); __attr __fn_native_list_list_nonempty(__attr __self, __attr _data); __attr __fn_native_list_list_element(__attr __self, __attr _data, __attr index); __attr __fn_native_list_list_setelement(__attr __self, __attr _data, __attr index, __attr value); diff -r 1fde2e291f5f -r ab30a18f9586 translator.py --- a/translator.py Tue Aug 29 19:29:31 2023 +0200 +++ b/translator.py Fri Sep 01 22:22:37 2023 +0200 @@ -1293,6 +1293,7 @@ context_arg = "__NULL" args = [context_arg] + reserved_args = 1 # Complete the array with null values, permitting tests for a complete # set of arguments. @@ -1337,7 +1338,7 @@ except ValueError: raise TranslateError("Argument %s is not recognised." % arg.name, self.get_namespace_path(), n) - args[argnum+1] = str(argexpr) + args[argnum + reserved_args] = str(argexpr) # Otherwise, store the details in a separate collection. @@ -1351,7 +1352,7 @@ else: try: - args[i+1] = str(argexpr) + args[i + reserved_args] = str(argexpr) except IndexError: raise TranslateError("Too many arguments specified.", self.get_namespace_path(), n) @@ -1375,8 +1376,8 @@ for i, (argname, default) in enumerate(function_defaults): argnum = parameters.index(argname) - if not args[argnum+1]: - args[argnum+1] = "__GETDEFAULT(%s, %d)" % (target_structure, i) + if not args[argnum + reserved_args]: + args[argnum + reserved_args] = "__GETDEFAULT(%s, %d)" % (target_structure, i) elif known_parameters: @@ -1387,7 +1388,7 @@ i = len(n.args) pos = i - (num_parameters - num_defaults) while i < num_parameters: - args[i+1] = "__GETDEFAULT(%s.value, %d)" % (target_var, pos) + args[i + reserved_args] = "__GETDEFAULT(%s.value, %d)" % (target_var, pos) i += 1 pos += 1 @@ -1403,7 +1404,7 @@ # the number of values. The context is excluded. if literal_instantiation: - argstr = "%d, %s" % (len(args) - 1, ", ".join(args[1:])) + argstr = "%d, %s" % (len(args) - reserved_args, ", ".join(args[reserved_args:])) else: argstr = ", ".join(args) diff -r 1fde2e291f5f -r ab30a18f9586 transresults.py --- a/transresults.py Tue Aug 29 19:29:31 2023 +0200 +++ b/transresults.py Fri Sep 01 22:22:37 2023 +0200 @@ -3,7 +3,7 @@ """ Translation result abstractions. -Copyright (C) 2016, 2017, 2018 Paul Boddie +Copyright (C) 2016, 2017, 2018, 2021 Paul Boddie This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -67,6 +67,20 @@ ResolvedNameRef.__init__(self, name, ref, expr, is_global) self.location = location + # For sources, any identified static origin will be constant and thus + # usable directly. For targets, no constant should be assigned and thus + # the alias (or any plain name) will be used. + + self.static_ref = self.static() + origin = self.static_ref and self.get_origin() + self.static_name = origin and encode_path(origin) + + # Determine whether a qualified name is involved. + + t = (not self.is_constant_alias() and self.get_name() or self.name).rsplit(".", 1) + self.parent = len(t) > 1 and t[0] or None + self.attrname = t[-1] and encode_path(t[-1]) + def access_location(self): return self.location @@ -82,57 +96,41 @@ else: return encode_path(self.name) - # For sources, any identified static origin will be constant and thus - # usable directly. For targets, no constant should be assigned and thus - # the alias (or any plain name) will be used. - - ref = self.static() - origin = ref and self.get_origin() - static_name = origin and encode_path(origin) - - # Determine whether a qualified name is involved. - - t = (not self.is_constant_alias() and self.get_name() or self.name).rsplit(".", 1) - parent = len(t) > 1 and t[0] or None - attrname = t[-1] and encode_path(t[-1]) - # Assignments. if self.expr: # Eliminate assignments between constants. - if ref and self.expr.static(): + if self.static_ref and self.expr.static(): return "" # Qualified names must be converted into parent-relative assignments. - elif parent: + elif self.parent: return "__store_via_object(&%s, %s, %s)" % ( - encode_path(parent), attrname, self.expr) + encode_path(self.parent), self.attrname, self.expr) # All other assignments involve the names as they were given. else: - return "%s = %s" % (attrname, self.expr) + return "%s = %s" % (self.attrname, self.expr) # Expressions. - elif static_name: - parent = ref.parent() - context = ref.has_kind("") and encode_path(parent) or None - return "__ATTRVALUE(&%s)" % static_name + elif self.static_name: + return "__ATTRVALUE(&%s)" % self.static_name # Qualified names must be converted into parent-relative accesses. - elif parent: + elif self.parent: return "__load_via_object(&%s, %s)" % ( - encode_path(parent), attrname) + encode_path(self.parent), self.attrname) # All other accesses involve the names as they were given. else: - return "(%s)" % attrname + return "(%s)" % self.attrname class TrConstantValueRef(ConstantValueRef):