Lichen

Changeset

795:345fe332fcf1
2017-03-31 Paul Boddie raw files shortlog changelog graph Added example return values to provide reference details from native functions.
lib/native/buffer.py (file) lib/native/identity.py (file) lib/native/int.py (file) lib/native/introspection.py (file) lib/native/io.py (file) lib/native/limits.py (file) lib/native/list.py (file) lib/native/locale.py (file) lib/native/str.py (file) lib/native/system.py (file) lib/native/unicode.py (file)
     1.1 --- a/lib/native/buffer.py	Fri Mar 31 23:26:47 2017 +0200
     1.2 +++ b/lib/native/buffer.py	Fri Mar 31 23:27:55 2017 +0200
     1.3 @@ -8,7 +8,7 @@
     1.4  non-core exceptions used by the native functions because they need to be
     1.5  identified as being needed by the program.
     1.6  
     1.7 -Copyright (C) 2011, 2015, 2016 Paul Boddie <paul@boddie.org.uk>
     1.8 +Copyright (C) 2011, 2015, 2016, 2017 Paul Boddie <paul@boddie.org.uk>
     1.9  
    1.10  This program is free software; you can redistribute it and/or modify it under
    1.11  the terms of the GNU General Public License as published by the Free Software
    1.12 @@ -24,6 +24,8 @@
    1.13  this program.  If not, see <http://www.gnu.org/licenses/>.
    1.14  """
    1.15  
    1.16 -def buffer_str(self): pass
    1.17 +# NOTE: Example values used to provide type information.
    1.18 +
    1.19 +def buffer_str(self): return ""
    1.20  
    1.21  # vim: tabstop=4 expandtab shiftwidth=4
     2.1 --- a/lib/native/identity.py	Fri Mar 31 23:26:47 2017 +0200
     2.2 +++ b/lib/native/identity.py	Fri Mar 31 23:27:55 2017 +0200
     2.3 @@ -8,7 +8,7 @@
     2.4  non-core exceptions used by the native functions because they need to be
     2.5  identified as being needed by the program.
     2.6  
     2.7 -Copyright (C) 2011, 2015, 2016 Paul Boddie <paul@boddie.org.uk>
     2.8 +Copyright (C) 2011, 2015, 2016, 2017 Paul Boddie <paul@boddie.org.uk>
     2.9  
    2.10  This program is free software; you can redistribute it and/or modify it under
    2.11  the terms of the GNU General Public License as published by the Free Software
    2.12 @@ -24,7 +24,9 @@
    2.13  this program.  If not, see <http://www.gnu.org/licenses/>.
    2.14  """
    2.15  
    2.16 -def is_(x, y): pass
    2.17 -def is_not(x, y): pass
    2.18 +# NOTE: Example values used to provide type information.
    2.19 +
    2.20 +def is_(x, y): return True or False
    2.21 +def is_not(x, y): return True or False
    2.22  
    2.23  # vim: tabstop=4 expandtab shiftwidth=4
     3.1 --- a/lib/native/int.py	Fri Mar 31 23:26:47 2017 +0200
     3.2 +++ b/lib/native/int.py	Fri Mar 31 23:27:55 2017 +0200
     3.3 @@ -24,28 +24,31 @@
     3.4  this program.  If not, see <http://www.gnu.org/licenses/>.
     3.5  """
     3.6  
     3.7 -def is_int(obj): pass
     3.8 +def is_int(obj): return True or False
     3.9 +
    3.10 +# NOTE: Update return types when integers eventually get promoted to longs.
    3.11 +# NOTE: Example values used to provide type information.
    3.12  
    3.13 -def int_add(self, other): pass
    3.14 -def int_div(self, other): pass
    3.15 -def int_mod(self, other): pass
    3.16 -def int_mul(self, other): pass
    3.17 -def int_neg(self): pass
    3.18 -def int_pow(self, other): pass
    3.19 -def int_sub(self, other): pass
    3.20 +def int_add(self, other): return 0
    3.21 +def int_div(self, other): return 0
    3.22 +def int_mod(self, other): return 0
    3.23 +def int_mul(self, other): return 0
    3.24 +def int_neg(self): return 0
    3.25 +def int_pow(self, other): return 0
    3.26 +def int_sub(self, other): return 0
    3.27  
    3.28 -def int_and(self, other): pass
    3.29 -def int_not(self): pass
    3.30 -def int_or(self, other): pass
    3.31 -def int_xor(self, other): pass
    3.32 +def int_and(self, other): return 0
    3.33 +def int_not(self): return True or False
    3.34 +def int_or(self, other): return 0
    3.35 +def int_xor(self, other): return 0
    3.36  
    3.37 -def int_eq(self, other): pass
    3.38 -def int_ge(self, other): pass
    3.39 -def int_gt(self, other): pass
    3.40 -def int_le(self, other): pass
    3.41 -def int_lt(self, other): pass
    3.42 -def int_ne(self, other): pass
    3.43 +def int_eq(self, other): return True or False
    3.44 +def int_ge(self, other): return True or False
    3.45 +def int_gt(self, other): return True or False
    3.46 +def int_le(self, other): return True or False
    3.47 +def int_lt(self, other): return True or False
    3.48 +def int_ne(self, other): return True or False
    3.49  
    3.50 -def int_str(self): pass
    3.51 +def int_str(self): return ""
    3.52  
    3.53  # vim: tabstop=4 expandtab shiftwidth=4
     4.1 --- a/lib/native/introspection.py	Fri Mar 31 23:26:47 2017 +0200
     4.2 +++ b/lib/native/introspection.py	Fri Mar 31 23:27:55 2017 +0200
     4.3 @@ -8,7 +8,7 @@
     4.4  non-core exceptions used by the native functions because they need to be
     4.5  identified as being needed by the program.
     4.6  
     4.7 -Copyright (C) 2011, 2015, 2016 Paul Boddie <paul@boddie.org.uk>
     4.8 +Copyright (C) 2011, 2015, 2016, 2017 Paul Boddie <paul@boddie.org.uk>
     4.9  
    4.10  This program is free software; you can redistribute it and/or modify it under
    4.11  the terms of the GNU General Public License as published by the Free Software
    4.12 @@ -24,8 +24,10 @@
    4.13  this program.  If not, see <http://www.gnu.org/licenses/>.
    4.14  """
    4.15  
    4.16 +# NOTE: Example values used to provide type information.
    4.17 +
    4.18  def object_getattr(obj, name, default): pass
    4.19 -def isinstance(obj, cls): pass
    4.20 -def issubclass(obj, cls): pass
    4.21 +def isinstance(obj, cls): return True or False
    4.22 +def issubclass(obj, cls): return True or False
    4.23  
    4.24  # vim: tabstop=4 expandtab shiftwidth=4
     5.1 --- a/lib/native/io.py	Fri Mar 31 23:26:47 2017 +0200
     5.2 +++ b/lib/native/io.py	Fri Mar 31 23:27:55 2017 +0200
     5.3 @@ -8,7 +8,7 @@
     5.4  non-core exceptions used by the native functions because they need to be
     5.5  identified as being needed by the program.
     5.6  
     5.7 -Copyright (C) 2011, 2015, 2016 Paul Boddie <paul@boddie.org.uk>
     5.8 +Copyright (C) 2011, 2015, 2016, 2017 Paul Boddie <paul@boddie.org.uk>
     5.9  
    5.10  This program is free software; you can redistribute it and/or modify it under
    5.11  the terms of the GNU General Public License as published by the Free Software
    5.12 @@ -24,17 +24,26 @@
    5.13  this program.  If not, see <http://www.gnu.org/licenses/>.
    5.14  """
    5.15  
    5.16 +# NOTE: Example values used to provide type information.
    5.17 +
    5.18  def fclose(fp): IOError
    5.19  def fflush(fp): IOError
    5.20  def fopen(filename, mode): IOError
    5.21  def fdopen(fd, mode): IOError
    5.22  def close(fd): IOError
    5.23 -def read(fd, n): IOError
    5.24 -def write(fd, str): IOError
    5.25 +
    5.26 +def read(fd, n):
    5.27 +    IOError
    5.28 +    return ""
    5.29 +
    5.30 +def write(fd, str):
    5.31 +    IOError
    5.32 +    return 0
    5.33  
    5.34  def fread(fp, n):
    5.35      IOError
    5.36      EOFError
    5.37 +    return ""
    5.38  
    5.39  def fwrite(fp, str):
    5.40      IOError
     6.1 --- a/lib/native/limits.py	Fri Mar 31 23:26:47 2017 +0200
     6.2 +++ b/lib/native/limits.py	Fri Mar 31 23:27:55 2017 +0200
     6.3 @@ -8,7 +8,7 @@
     6.4  non-core exceptions used by the native functions because they need to be
     6.5  identified as being needed by the program.
     6.6  
     6.7 -Copyright (C) 2011, 2015, 2016 Paul Boddie <paul@boddie.org.uk>
     6.8 +Copyright (C) 2011, 2015, 2016, 2017 Paul Boddie <paul@boddie.org.uk>
     6.9  
    6.10  This program is free software; you can redistribute it and/or modify it under
    6.11  the terms of the GNU General Public License as published by the Free Software
    6.12 @@ -24,7 +24,9 @@
    6.13  this program.  If not, see <http://www.gnu.org/licenses/>.
    6.14  """
    6.15  
    6.16 -def get_maxint(): pass
    6.17 -def get_minint(): pass
    6.18 +# NOTE: Example values used to provide type information.
    6.19 +
    6.20 +def get_maxint(): return 0
    6.21 +def get_minint(): return 0
    6.22  
    6.23  # vim: tabstop=4 expandtab shiftwidth=4
     7.1 --- a/lib/native/list.py	Fri Mar 31 23:26:47 2017 +0200
     7.2 +++ b/lib/native/list.py	Fri Mar 31 23:27:55 2017 +0200
     7.3 @@ -8,7 +8,7 @@
     7.4  non-core exceptions used by the native functions because they need to be
     7.5  identified as being needed by the program.
     7.6  
     7.7 -Copyright (C) 2011, 2015, 2016 Paul Boddie <paul@boddie.org.uk>
     7.8 +Copyright (C) 2011, 2015, 2016, 2017 Paul Boddie <paul@boddie.org.uk>
     7.9  
    7.10  This program is free software; you can redistribute it and/or modify it under
    7.11  the terms of the GNU General Public License as published by the Free Software
    7.12 @@ -24,12 +24,14 @@
    7.13  this program.  If not, see <http://www.gnu.org/licenses/>.
    7.14  """
    7.15  
    7.16 +# NOTE: Example values used to provide type information.
    7.17 +
    7.18  def list_init(size): pass
    7.19  def list_setsize(self, size): pass
    7.20  def list_append(self, value): pass
    7.21  def list_concat(self, other): pass
    7.22 -def list_len(self): pass
    7.23 -def list_nonempty(self): pass
    7.24 +def list_len(self): return 0
    7.25 +def list_nonempty(self): return True or False
    7.26  def list_element(self, index): pass
    7.27  def list_setelement(self, index, value): pass
    7.28  
     8.1 --- a/lib/native/locale.py	Fri Mar 31 23:26:47 2017 +0200
     8.2 +++ b/lib/native/locale.py	Fri Mar 31 23:27:55 2017 +0200
     8.3 @@ -8,7 +8,7 @@
     8.4  non-core exceptions used by the native functions because they need to be
     8.5  identified as being needed by the program.
     8.6  
     8.7 -Copyright (C) 2016 Paul Boddie <paul@boddie.org.uk>
     8.8 +Copyright (C) 2016, 2017 Paul Boddie <paul@boddie.org.uk>
     8.9  
    8.10  This program is free software; you can redistribute it and/or modify it under
    8.11  the terms of the GNU General Public License as published by the Free Software
    8.12 @@ -24,7 +24,9 @@
    8.13  this program.  If not, see <http://www.gnu.org/licenses/>.
    8.14  """
    8.15  
    8.16 -def getlocale(category): pass
    8.17 -def setlocale(category, value): pass
    8.18 +# NOTE: Example values used to provide type information.
    8.19 +
    8.20 +def getlocale(category): return "" or None
    8.21 +def setlocale(category, value): return "" or None
    8.22  
    8.23  # vim: tabstop=4 expandtab shiftwidth=4
     9.1 --- a/lib/native/str.py	Fri Mar 31 23:26:47 2017 +0200
     9.2 +++ b/lib/native/str.py	Fri Mar 31 23:27:55 2017 +0200
     9.3 @@ -24,14 +24,14 @@
     9.4  this program.  If not, see <http://www.gnu.org/licenses/>.
     9.5  """
     9.6  
     9.7 -# String operations.
     9.8 +# NOTE: Example values used to provide type information.
     9.9  
    9.10 -def str_add(data, other_data, size, other_size): pass
    9.11 -def str_chr(data): pass
    9.12 -def str_eq(data, other_data): pass
    9.13 -def str_gt(data, other_data): pass
    9.14 -def str_lt(data, other_data): pass
    9.15 -def str_ord(data): pass
    9.16 -def str_substr(data, start, end, step): pass
    9.17 +def str_add(data, other_data, size, other_size): return ""
    9.18 +def str_chr(data): return ""
    9.19 +def str_eq(data, other_data): return True or False
    9.20 +def str_gt(data, other_data): return True or False
    9.21 +def str_lt(data, other_data): return True or False
    9.22 +def str_ord(data): return 0
    9.23 +def str_substr(data, start, end, step): return ""
    9.24  
    9.25  # vim: tabstop=4 expandtab shiftwidth=4
    10.1 --- a/lib/native/system.py	Fri Mar 31 23:26:47 2017 +0200
    10.2 +++ b/lib/native/system.py	Fri Mar 31 23:27:55 2017 +0200
    10.3 @@ -8,7 +8,7 @@
    10.4  non-core exceptions used by the native functions because they need to be
    10.5  identified as being needed by the program.
    10.6  
    10.7 -Copyright (C) 2011, 2015, 2016 Paul Boddie <paul@boddie.org.uk>
    10.8 +Copyright (C) 2011, 2015, 2016, 2017 Paul Boddie <paul@boddie.org.uk>
    10.9  
   10.10  This program is free software; you can redistribute it and/or modify it under
   10.11  the terms of the GNU General Public License as published by the Free Software
   10.12 @@ -24,8 +24,10 @@
   10.13  this program.  If not, see <http://www.gnu.org/licenses/>.
   10.14  """
   10.15  
   10.16 +# NOTE: Example values used to provide type information.
   10.17 +
   10.18  def exit(status): pass
   10.19 -def get_argv(): pass
   10.20 -def get_path(): pass
   10.21 +def get_argv(): return ""
   10.22 +def get_path(): return []
   10.23  
   10.24  # vim: tabstop=4 expandtab shiftwidth=4
    11.1 --- a/lib/native/unicode.py	Fri Mar 31 23:26:47 2017 +0200
    11.2 +++ b/lib/native/unicode.py	Fri Mar 31 23:27:55 2017 +0200
    11.3 @@ -24,11 +24,13 @@
    11.4  this program.  If not, see <http://www.gnu.org/licenses/>.
    11.5  """
    11.6  
    11.7 +# NOTE: Example values used to provide type information.
    11.8 +
    11.9  # Unicode string operations.
   11.10  
   11.11 -def unicode_len(data, size): pass
   11.12 -def unicode_ord(data, size): pass
   11.13 -def unicode_substr(data, size, start, end, step): pass
   11.14 -def unicode_unichr(value): pass
   11.15 +def unicode_len(data, size): return 0
   11.16 +def unicode_ord(data, size): return 0
   11.17 +def unicode_substr(data, size, start, end, step): return ""
   11.18 +def unicode_unichr(value): return ""
   11.19  
   11.20  # vim: tabstop=4 expandtab shiftwidth=4