2014-05-03 23:27:38 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the Micro Python project, http://micropython.org/
|
|
|
|
*
|
|
|
|
* The MIT License (MIT)
|
|
|
|
*
|
|
|
|
* Copyright (c) 2013, 2014 Damien P. George
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
* THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2014-04-11 18:50:15 +01:00
|
|
|
#include "mpconfig.h"
|
2014-01-04 15:57:35 +00:00
|
|
|
// All the qstr definitions in this file are available as constants.
|
2014-03-08 15:24:39 +00:00
|
|
|
// That is, they are in ROM and you can reference them simply as MP_QSTR_xxxx.
|
2014-01-04 15:57:35 +00:00
|
|
|
|
2014-04-27 19:23:46 +01:00
|
|
|
Q(*)
|
2014-01-04 15:57:35 +00:00
|
|
|
Q(__build_class__)
|
|
|
|
Q(__class__)
|
|
|
|
Q(__doc__)
|
2014-02-03 22:46:17 +00:00
|
|
|
Q(__import__)
|
2014-01-04 15:57:35 +00:00
|
|
|
Q(__init__)
|
2014-05-18 18:37:18 +01:00
|
|
|
Q(__new__)
|
2014-01-04 15:57:35 +00:00
|
|
|
Q(__locals__)
|
|
|
|
Q(__main__)
|
|
|
|
Q(__module__)
|
|
|
|
Q(__name__)
|
|
|
|
Q(__next__)
|
|
|
|
Q(__qualname__)
|
2014-04-11 21:25:35 +01:00
|
|
|
Q(__path__)
|
2014-01-04 15:57:35 +00:00
|
|
|
Q(__repl_print__)
|
|
|
|
|
2014-01-30 10:05:33 +00:00
|
|
|
Q(__bool__)
|
2014-04-13 08:39:25 +01:00
|
|
|
Q(__contains__)
|
2014-03-29 02:10:11 +00:00
|
|
|
Q(__enter__)
|
|
|
|
Q(__exit__)
|
2014-01-30 10:05:33 +00:00
|
|
|
Q(__len__)
|
2014-03-26 18:37:06 +00:00
|
|
|
Q(__iter__)
|
2014-01-25 00:17:36 +00:00
|
|
|
Q(__getitem__)
|
2014-02-08 19:01:47 +00:00
|
|
|
Q(__setitem__)
|
2014-04-13 21:55:59 +01:00
|
|
|
Q(__delitem__)
|
2014-01-25 00:17:36 +00:00
|
|
|
Q(__add__)
|
|
|
|
Q(__sub__)
|
2014-03-16 13:16:54 +00:00
|
|
|
Q(__repr__)
|
|
|
|
Q(__str__)
|
2014-03-31 22:57:56 +01:00
|
|
|
Q(__getattr__)
|
2014-04-05 14:49:03 +01:00
|
|
|
Q(__del__)
|
2014-04-25 19:15:16 +01:00
|
|
|
Q(__call__)
|
2014-01-25 00:17:36 +00:00
|
|
|
|
2014-01-04 15:57:35 +00:00
|
|
|
Q(micropython)
|
2014-05-10 10:36:38 +01:00
|
|
|
Q(bytecode)
|
2014-01-04 15:57:35 +00:00
|
|
|
Q(native)
|
|
|
|
Q(viper)
|
2014-05-08 16:58:39 +01:00
|
|
|
Q(const)
|
2014-04-21 13:33:15 +01:00
|
|
|
|
|
|
|
#if MICROPY_EMIT_INLINE_THUMB
|
2014-01-04 15:57:35 +00:00
|
|
|
Q(asm_thumb)
|
2014-04-21 13:33:15 +01:00
|
|
|
Q(label)
|
|
|
|
Q(align)
|
|
|
|
Q(data)
|
|
|
|
#endif
|
2014-01-04 15:57:35 +00:00
|
|
|
|
2014-01-04 18:44:46 +00:00
|
|
|
Q(Ellipsis)
|
2014-01-04 15:57:35 +00:00
|
|
|
Q(StopIteration)
|
|
|
|
|
2014-02-15 16:10:44 +00:00
|
|
|
Q(BaseException)
|
2014-03-22 15:28:16 +00:00
|
|
|
Q(ArithmeticError)
|
2014-01-04 20:21:15 +00:00
|
|
|
Q(AssertionError)
|
2014-01-04 15:57:35 +00:00
|
|
|
Q(AttributeError)
|
2014-03-22 15:28:16 +00:00
|
|
|
Q(BufferError)
|
|
|
|
Q(EOFError)
|
|
|
|
Q(Exception)
|
|
|
|
Q(FileExistsError)
|
|
|
|
Q(FileNotFoundError)
|
|
|
|
Q(FloatingPointError)
|
|
|
|
Q(GeneratorExit)
|
|
|
|
Q(IOError)
|
2014-02-04 01:33:55 +00:00
|
|
|
Q(ImportError)
|
2014-01-15 21:23:31 +00:00
|
|
|
Q(IndentationError)
|
2014-01-04 15:57:35 +00:00
|
|
|
Q(IndexError)
|
|
|
|
Q(KeyError)
|
2014-03-22 15:28:16 +00:00
|
|
|
Q(LookupError)
|
|
|
|
Q(MemoryError)
|
2014-01-04 15:57:35 +00:00
|
|
|
Q(NameError)
|
2014-02-09 11:17:36 +00:00
|
|
|
Q(NotImplementedError)
|
2014-01-15 21:23:31 +00:00
|
|
|
Q(OSError)
|
2014-03-22 15:28:16 +00:00
|
|
|
Q(OverflowError)
|
|
|
|
Q(RuntimeError)
|
2014-01-04 15:57:35 +00:00
|
|
|
Q(SyntaxError)
|
2014-03-22 15:28:16 +00:00
|
|
|
Q(SystemError)
|
2014-01-04 20:21:15 +00:00
|
|
|
Q(TypeError)
|
2014-03-22 15:28:16 +00:00
|
|
|
Q(UnboundLocalError)
|
2014-01-04 15:57:35 +00:00
|
|
|
Q(ValueError)
|
2014-03-20 22:40:38 +00:00
|
|
|
Q(ZeroDivisionError)
|
2014-01-04 15:57:35 +00:00
|
|
|
|
2014-03-22 21:31:28 +00:00
|
|
|
Q(None)
|
|
|
|
Q(False)
|
|
|
|
Q(True)
|
|
|
|
Q(object)
|
2014-03-22 15:28:16 +00:00
|
|
|
|
2014-02-15 11:34:50 +00:00
|
|
|
Q(NoneType)
|
|
|
|
|
2014-01-04 15:57:35 +00:00
|
|
|
Q(abs)
|
|
|
|
Q(all)
|
|
|
|
Q(any)
|
2014-03-24 23:29:09 +00:00
|
|
|
Q(args)
|
2014-01-18 17:24:47 +00:00
|
|
|
Q(array)
|
2014-04-15 22:03:55 +01:00
|
|
|
Q(bin)
|
|
|
|
Q({:#b})
|
2014-01-04 15:57:35 +00:00
|
|
|
Q(bool)
|
2014-01-18 17:24:47 +00:00
|
|
|
Q(bytearray)
|
2014-01-20 18:32:50 +00:00
|
|
|
Q(bytes)
|
2014-01-04 15:57:35 +00:00
|
|
|
Q(callable)
|
2014-04-10 01:45:38 +01:00
|
|
|
#if MICROPY_ENABLE_MOD_STRUCT
|
|
|
|
Q(calcsize)
|
|
|
|
#endif
|
2014-01-04 15:57:35 +00:00
|
|
|
Q(chr)
|
2014-02-06 20:31:44 +00:00
|
|
|
Q(classmethod)
|
2014-04-13 08:17:04 +01:00
|
|
|
Q(_collections)
|
2014-01-04 15:57:35 +00:00
|
|
|
Q(complex)
|
|
|
|
Q(dict)
|
2014-02-02 22:07:44 +00:00
|
|
|
Q(dir)
|
2014-01-04 15:57:35 +00:00
|
|
|
Q(divmod)
|
2014-01-14 23:55:01 +00:00
|
|
|
Q(enumerate)
|
2014-01-15 22:14:03 +00:00
|
|
|
Q(eval)
|
2014-02-03 22:44:10 +00:00
|
|
|
Q(exec)
|
2014-01-15 01:37:08 +00:00
|
|
|
Q(filter)
|
2014-01-04 15:57:35 +00:00
|
|
|
Q(float)
|
2014-04-08 22:40:58 +01:00
|
|
|
Q(from_bytes)
|
2014-03-26 21:35:13 +00:00
|
|
|
Q(getattr)
|
2014-04-05 23:00:46 +01:00
|
|
|
Q(globals)
|
2014-05-11 17:05:42 +01:00
|
|
|
Q(hasattr)
|
2014-01-04 15:57:35 +00:00
|
|
|
Q(hash)
|
2014-04-15 12:42:52 +01:00
|
|
|
Q(hex)
|
2014-04-15 12:50:21 +01:00
|
|
|
Q(%#x)
|
2014-02-02 03:00:41 +00:00
|
|
|
Q(id)
|
2014-01-04 15:57:35 +00:00
|
|
|
Q(int)
|
2014-01-09 21:43:51 +00:00
|
|
|
Q(isinstance)
|
|
|
|
Q(issubclass)
|
2014-01-04 15:57:35 +00:00
|
|
|
Q(iter)
|
|
|
|
Q(len)
|
|
|
|
Q(list)
|
2014-04-05 23:00:46 +01:00
|
|
|
Q(locals)
|
2014-01-15 01:10:09 +00:00
|
|
|
Q(map)
|
2014-01-04 15:57:35 +00:00
|
|
|
Q(max)
|
|
|
|
Q(min)
|
2014-02-27 20:22:04 +00:00
|
|
|
Q(namedtuple)
|
2014-01-04 15:57:35 +00:00
|
|
|
Q(next)
|
2014-04-15 22:03:55 +01:00
|
|
|
Q(oct)
|
|
|
|
Q(%#o)
|
2014-04-05 23:02:23 +01:00
|
|
|
Q(open)
|
2014-01-04 15:57:35 +00:00
|
|
|
Q(ord)
|
2014-02-04 22:47:06 +00:00
|
|
|
Q(path)
|
2014-01-04 15:57:35 +00:00
|
|
|
Q(pow)
|
|
|
|
Q(print)
|
|
|
|
Q(range)
|
2014-04-26 19:15:56 +01:00
|
|
|
Q(read)
|
2014-01-15 21:40:48 +00:00
|
|
|
Q(repr)
|
2014-01-04 15:57:35 +00:00
|
|
|
Q(set)
|
2014-01-13 05:12:50 +00:00
|
|
|
Q(sorted)
|
2014-02-06 20:31:44 +00:00
|
|
|
Q(staticmethod)
|
2014-01-04 15:57:35 +00:00
|
|
|
Q(sum)
|
2014-02-05 00:51:47 +00:00
|
|
|
Q(super)
|
2014-01-13 17:20:46 +00:00
|
|
|
Q(str)
|
2014-02-04 05:55:10 +00:00
|
|
|
Q(sys)
|
2014-04-08 22:40:58 +01:00
|
|
|
Q(to_bytes)
|
2014-01-04 20:21:15 +00:00
|
|
|
Q(tuple)
|
2014-01-04 15:57:35 +00:00
|
|
|
Q(type)
|
2014-03-24 23:29:09 +00:00
|
|
|
Q(value)
|
2014-04-26 19:15:56 +01:00
|
|
|
Q(write)
|
2014-01-13 02:31:00 +00:00
|
|
|
Q(zip)
|
2014-01-04 15:57:35 +00:00
|
|
|
|
2014-04-02 10:34:44 +01:00
|
|
|
Q(sep)
|
|
|
|
Q(end)
|
|
|
|
|
2014-03-26 20:15:40 +00:00
|
|
|
Q(clear)
|
|
|
|
Q(copy)
|
|
|
|
Q(fromkeys)
|
|
|
|
Q(get)
|
|
|
|
Q(items)
|
|
|
|
Q(keys)
|
|
|
|
Q(pop)
|
|
|
|
Q(popitem)
|
|
|
|
Q(setdefault)
|
|
|
|
Q(update)
|
|
|
|
Q(values)
|
2014-01-04 15:57:35 +00:00
|
|
|
Q(append)
|
2014-03-26 20:15:40 +00:00
|
|
|
Q(close)
|
|
|
|
Q(send)
|
|
|
|
Q(throw)
|
|
|
|
Q(count)
|
|
|
|
Q(extend)
|
|
|
|
Q(index)
|
|
|
|
Q(remove)
|
|
|
|
Q(insert)
|
2014-01-04 15:57:35 +00:00
|
|
|
Q(pop)
|
|
|
|
Q(sort)
|
|
|
|
Q(join)
|
2014-01-08 22:23:45 +00:00
|
|
|
Q(strip)
|
2014-04-26 04:20:08 +01:00
|
|
|
Q(lstrip)
|
|
|
|
Q(rstrip)
|
2014-01-04 15:57:35 +00:00
|
|
|
Q(format)
|
2014-02-08 19:01:47 +00:00
|
|
|
Q(key)
|
|
|
|
Q(reverse)
|
2014-03-26 20:15:40 +00:00
|
|
|
Q(add)
|
|
|
|
Q(clear)
|
|
|
|
Q(copy)
|
|
|
|
Q(discard)
|
|
|
|
Q(difference)
|
|
|
|
Q(difference_update)
|
|
|
|
Q(intersection)
|
|
|
|
Q(intersection_update)
|
|
|
|
Q(isdisjoint)
|
|
|
|
Q(issubset)
|
|
|
|
Q(issuperset)
|
|
|
|
Q(pop)
|
|
|
|
Q(remove)
|
|
|
|
Q(symmetric_difference)
|
|
|
|
Q(symmetric_difference_update)
|
|
|
|
Q(union)
|
|
|
|
Q(update)
|
|
|
|
Q(find)
|
|
|
|
Q(rfind)
|
2014-04-08 19:42:19 +01:00
|
|
|
Q(rindex)
|
2014-03-26 20:15:40 +00:00
|
|
|
Q(split)
|
2014-05-13 06:07:08 +01:00
|
|
|
Q(rsplit)
|
2014-03-26 20:15:40 +00:00
|
|
|
Q(startswith)
|
|
|
|
Q(replace)
|
|
|
|
Q(partition)
|
|
|
|
Q(rpartition)
|
2014-05-10 17:47:41 +01:00
|
|
|
Q(lower)
|
|
|
|
Q(upper)
|
2014-05-06 17:38:54 +01:00
|
|
|
Q(iterable)
|
|
|
|
Q(start)
|
2014-01-23 22:22:00 +00:00
|
|
|
|
2014-02-15 11:34:50 +00:00
|
|
|
Q(bound_method)
|
|
|
|
Q(closure)
|
|
|
|
Q(dict_view)
|
|
|
|
Q(function)
|
|
|
|
Q(generator)
|
|
|
|
Q(iterator)
|
|
|
|
Q(module)
|
|
|
|
Q(slice)
|
|
|
|
|
2014-05-10 14:02:17 +01:00
|
|
|
#if MICROPY_ENABLE_FROZENSET
|
|
|
|
Q(frozenset)
|
|
|
|
#endif
|
|
|
|
|
2014-04-17 17:11:03 +01:00
|
|
|
#if MICROPY_ENABLE_MOD_MATH || MICROPY_ENABLE_MOD_CMATH
|
2014-03-08 15:24:39 +00:00
|
|
|
Q(math)
|
2014-03-20 16:39:22 +00:00
|
|
|
Q(e)
|
2014-03-08 15:24:39 +00:00
|
|
|
Q(pi)
|
|
|
|
Q(sqrt)
|
|
|
|
Q(pow)
|
|
|
|
Q(exp)
|
2014-03-12 21:31:41 +00:00
|
|
|
Q(expm1)
|
2014-03-08 15:24:39 +00:00
|
|
|
Q(log)
|
|
|
|
Q(log2)
|
|
|
|
Q(log10)
|
|
|
|
Q(cosh)
|
|
|
|
Q(sinh)
|
|
|
|
Q(tanh)
|
|
|
|
Q(acosh)
|
|
|
|
Q(asinh)
|
|
|
|
Q(atanh)
|
|
|
|
Q(cos)
|
|
|
|
Q(sin)
|
|
|
|
Q(tan)
|
|
|
|
Q(acos)
|
|
|
|
Q(asin)
|
|
|
|
Q(atan)
|
|
|
|
Q(atan2)
|
2014-03-20 21:26:51 +00:00
|
|
|
Q(ceil)
|
|
|
|
Q(copysign)
|
|
|
|
Q(fabs)
|
|
|
|
Q(fmod)
|
2014-03-22 14:39:33 +00:00
|
|
|
Q(floor)
|
2014-03-20 21:26:51 +00:00
|
|
|
Q(isfinite)
|
|
|
|
Q(isinf)
|
|
|
|
Q(isnan)
|
|
|
|
Q(trunc)
|
2014-03-22 14:39:33 +00:00
|
|
|
Q(modf)
|
|
|
|
Q(frexp)
|
|
|
|
Q(ldexp)
|
|
|
|
Q(degrees)
|
|
|
|
Q(radians)
|
|
|
|
Q(erf)
|
|
|
|
Q(erfc)
|
|
|
|
Q(gamma)
|
|
|
|
Q(lgamma)
|
2014-04-17 17:11:03 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if MICROPY_ENABLE_MOD_CMATH
|
|
|
|
Q(cmath)
|
|
|
|
Q(phase)
|
|
|
|
Q(polar)
|
|
|
|
Q(rect)
|
|
|
|
#endif
|
2014-03-08 15:24:39 +00:00
|
|
|
|
|
|
|
Q(mem_total)
|
|
|
|
Q(mem_current)
|
|
|
|
Q(mem_peak)
|
|
|
|
|
2014-01-23 22:22:00 +00:00
|
|
|
Q(<module>)
|
|
|
|
Q(<lambda>)
|
|
|
|
Q(<listcomp>)
|
|
|
|
Q(<dictcomp>)
|
|
|
|
Q(<setcomp>)
|
|
|
|
Q(<genexpr>)
|
2014-01-25 13:51:19 +00:00
|
|
|
Q(<string>)
|
2014-01-23 22:22:00 +00:00
|
|
|
Q(<stdin>)
|
2014-04-13 03:28:46 +01:00
|
|
|
|
|
|
|
#if MICROPY_CPYTHON_COMPAT
|
|
|
|
Q(encode)
|
|
|
|
Q(decode)
|
|
|
|
Q(utf-8)
|
|
|
|
#endif
|
2014-04-13 04:55:24 +01:00
|
|
|
|
|
|
|
#if MICROPY_ENABLE_MOD_SYS
|
|
|
|
Q(argv)
|
2014-04-13 07:53:52 +01:00
|
|
|
Q(byteorder)
|
|
|
|
Q(big)
|
2014-05-10 14:50:45 +01:00
|
|
|
Q(exit)
|
2014-04-13 07:53:52 +01:00
|
|
|
Q(little)
|
2014-04-13 04:55:24 +01:00
|
|
|
Q(stdin)
|
|
|
|
Q(stdout)
|
|
|
|
Q(stderr)
|
2014-04-13 23:46:45 +01:00
|
|
|
Q(version)
|
2014-04-13 07:46:58 +01:00
|
|
|
Q(version_info)
|
2014-04-13 04:55:24 +01:00
|
|
|
#endif
|
2014-04-13 18:59:45 +01:00
|
|
|
|
2014-04-19 01:13:15 +01:00
|
|
|
#if MICROPY_ENABLE_MOD_STRUCT
|
|
|
|
Q(struct)
|
|
|
|
Q(pack)
|
|
|
|
Q(unpack)
|
|
|
|
#endif
|
|
|
|
|
2014-04-26 18:26:14 +01:00
|
|
|
#if MICROPY_ENABLE_MOD_IO
|
|
|
|
Q(io)
|
2014-04-26 19:15:56 +01:00
|
|
|
Q(readall)
|
|
|
|
Q(readline)
|
2014-05-03 22:01:32 +01:00
|
|
|
Q(readlines)
|
2014-04-26 18:26:14 +01:00
|
|
|
Q(StringIO)
|
|
|
|
Q(BytesIO)
|
|
|
|
Q(getvalue)
|
|
|
|
#endif
|
|
|
|
|
2014-05-06 00:16:43 +01:00
|
|
|
#if MICROPY_ENABLE_MOD_GC
|
|
|
|
Q(gc)
|
|
|
|
Q(collect)
|
2014-05-08 23:04:49 +01:00
|
|
|
Q(disable)
|
|
|
|
Q(enable)
|
2014-05-06 00:16:43 +01:00
|
|
|
#endif
|
|
|
|
|
2014-04-13 18:59:45 +01:00
|
|
|
#if MICROPY_ENABLE_PROPERTY
|
|
|
|
Q(property)
|
|
|
|
Q(getter)
|
|
|
|
Q(setter)
|
|
|
|
Q(deleter)
|
|
|
|
#endif
|