예제 #1
0
 u"Date": {"value": {u"prototype": {"readonly": True}}},
 u"File": {"value": {u"prototype": {"readonly": True}}},
 u"XML": entity("XML"),
 u"QName": entity("XML"),
 u"Namespace": entity("XML"),
 u"Math": {
     "value": {
         u"PI": {"value": lambda t: JSWrapper(math.pi, traverser=t)},
         u"E": {"value": lambda t: JSWrapper(math.e, traverser=t)},
         u"LN2": {"value": lambda t: JSWrapper(math.log(2), traverser=t)},
         u"LN10": {"value": lambda t: JSWrapper(math.log(10), traverser=t)},
         u"LOG2E": {"value": lambda t: JSWrapper(math.log(math.e, 2), traverser=t)},
         u"LOG10E": {"value": lambda t: JSWrapper(math.log10(math.e), traverser=t)},
         u"SQRT2": {"value": lambda t: JSWrapper(math.sqrt(2), traverser=t)},
         u"SQRT1_2": {"value": lambda t: JSWrapper(math.sqrt(1 / 2), traverser=t)},
         u"abs": {"return": python_wrap(abs, [("num", 0)])},
         u"acos": {"return": python_wrap(math.acos, [("num", 0)])},
         u"asin": {"return": python_wrap(math.asin, [("num", 0)])},
         u"atan": {"return": python_wrap(math.atan, [("num", 0)])},
         u"atan2": {"return": python_wrap(math.atan2, [("num", 0), ("num", 1)])},
         u"ceil": {"return": python_wrap(math.ceil, [("num", 0)])},
         u"cos": {"return": python_wrap(math.cos, [("num", 0)])},
         u"exp": {"return": python_wrap(math.exp, [("num", 0)])},
         u"floor": {"return": python_wrap(math.floor, [("num", 0)])},
         u"log": {"return": call_definitions.math_log},
         u"max": {"return": python_wrap(max, [("num", 0)], nargs=True)},
         u"min": {"return": python_wrap(min, [("num", 0)], nargs=True)},
         u"pow": {"return": python_wrap(math.pow, [("num", 0), ("num", 0)])},
         u"random": {"return": call_definitions.math_random},  # Random always returns 0.5 in our fantasy land.
         u"round": {"return": call_definitions.math_round},
         u"sin": {"return": python_wrap(math.sin, [("num", 0)])},
     'value': lambda t: JSWrapper(math.log(10), traverser=t)
 },
 u'LOG2E': {
     'value': lambda t: JSWrapper(math.log(math.e, 2), traverser=t)
 },
 u'LOG10E': {
     'value': lambda t: JSWrapper(math.log10(math.e), traverser=t)
 },
 u'SQRT2': {
     'value': lambda t: JSWrapper(math.sqrt(2), traverser=t)
 },
 u'SQRT1_2': {
     'value': lambda t: JSWrapper(math.sqrt(1 / 2), traverser=t)
 },
 u'abs': {
     'return': python_wrap(abs, [('num', 0)])
 },
 u'acos': {
     'return': python_wrap(math.acos, [('num', 0)])
 },
 u'asin': {
     'return': python_wrap(math.asin, [('num', 0)])
 },
 u'atan': {
     'return': python_wrap(math.atan, [('num', 0)])
 },
 u'atan2': {
     'return': python_wrap(math.atan2, [('num', 0), ('num', 1)])
 },
 u'ceil': {
     'return': python_wrap(math.ceil, [('num', 0)])
 u'LN2':
     {'value': lambda t: JSWrapper(math.log(2), traverser=t)},
 u'LN10':
     {'value': lambda t: JSWrapper(math.log(10), traverser=t)},
 u'LOG2E':
     {'value': lambda t: JSWrapper(math.log(math.e, 2),
                                   traverser=t)},
 u'LOG10E':
     {'value': lambda t: JSWrapper(math.log10(math.e),
                                   traverser=t)},
 u'SQRT2':
     {'value': lambda t: JSWrapper(math.sqrt(2), traverser=t)},
 u'SQRT1_2':
     {'value': lambda t: JSWrapper(math.sqrt(1/2), traverser=t)},
 u'abs':
     {'return': python_wrap(abs, [('num', 0)])},
 u'acos':
     {'return': python_wrap(math.acos, [('num', 0)])},
 u'asin':
     {'return': python_wrap(math.asin, [('num', 0)])},
 u'atan':
     {'return': python_wrap(math.atan, [('num', 0)])},
 u'atan2':
     {'return': python_wrap(math.atan2, [('num', 0),
                                         ('num', 1)])},
 u'ceil':
     {'return': python_wrap(math.ceil, [('num', 0)])},
 u'cos':
     {'return': python_wrap(math.cos, [('num', 0)])},
 u'exp':
     {'return': python_wrap(math.exp, [('num', 0)])},
예제 #4
0
     "value": lambda t: JSWrapper(math.log(10), traverser=t)
 },
 u"LOG2E": {
     "value": lambda t: JSWrapper(math.log(math.e, 2), traverser=t)
 },
 u"LOG10E": {
     "value": lambda t: JSWrapper(math.log10(math.e), traverser=t)
 },
 u"SQRT2": {
     "value": lambda t: JSWrapper(math.sqrt(2), traverser=t)
 },
 u"SQRT1_2": {
     "value": lambda t: JSWrapper(math.sqrt(1 / 2), traverser=t)
 },
 u"abs": {
     "return": python_wrap(abs, [("num", 0)])
 },
 u"acos": {
     "return": python_wrap(math.acos, [("num", 0)])
 },
 u"asin": {
     "return": python_wrap(math.asin, [("num", 0)])
 },
 u"atan": {
     "return": python_wrap(math.atan, [("num", 0)])
 },
 u"atan2": {
     "return": python_wrap(math.atan2, [("num", 0), ("num", 1)])
 },
 u"ceil": {
     "return": python_wrap(math.ceil, [("num", 0)])
예제 #5
0
 u"LN2":
     {"value": lambda t: JSWrapper(math.log(2), traverser=t)},
 u"LN10":
     {"value": lambda t: JSWrapper(math.log(10), traverser=t)},
 u"LOG2E":
     {"value": lambda t: JSWrapper(math.log(math.e, 2),
                                   traverser=t)},
 u"LOG10E":
     {"value": lambda t: JSWrapper(math.log10(math.e),
                                   traverser=t)},
 u"SQRT2":
     {"value": lambda t: JSWrapper(math.sqrt(2), traverser=t)},
 u"SQRT1_2":
     {"value": lambda t: JSWrapper(math.sqrt(1/2), traverser=t)},
 u"abs":
     {"return": python_wrap(abs, [("num", 0)])},
 u"acos":
     {"return": python_wrap(math.acos, [("num", 0)])},
 u"asin":
     {"return": python_wrap(math.asin, [("num", 0)])},
 u"atan":
     {"return": python_wrap(math.atan, [("num", 0)])},
 u"atan2":
     {"return": python_wrap(math.atan2, [("num", 0),
                                         ("num", 1)])},
 u"ceil":
     {"return": python_wrap(math.ceil, [("num", 0)])},
 u"cos":
     {"return": python_wrap(math.cos, [("num", 0)])},
 u"exp":
     {"return": python_wrap(math.exp, [("num", 0)])},
예제 #6
0
            {u"constructor": {"value": get_global("Function")}}},
    u"File":
        {"value":
            {u"constructor": {"value": get_global("Function")}}},

    u"Math":
        {"value":
             {u"PI": {"literal": math.pi},
              u"E": {"literal": math.e},
              u"LN2": {"literal": math.log(2)},
              u"LN10": {"literal": math.log(10)},
              u"LOG2E": {"literal": math.log(math.e, 2)},
              u"LOG10E": {"literal": math.log10(math.e)},
              u"SQRT2": {"literal": math.sqrt(2)},
              u"SQRT1_2": {"literal": math.sqrt(1/2)},
              u"abs": {"return": python_wrap(abs, [("num", 0)])},
              u"acos": {"return": python_wrap(math.acos, [("num", 0)])},
              u"asin": {"return": python_wrap(math.asin, [("num", 0)])},
              u"atan": {"return": python_wrap(math.atan, [("num", 0)])},
              u"atan2": {"return": python_wrap(math.atan2, [("num", 0),
                                                            ("num", 1)])},
              u"ceil": {"return": python_wrap(math.ceil, [("num", 0)])},
              u"cos": {"return": python_wrap(math.cos, [("num", 0)])},
              u"exp": {"return": python_wrap(math.exp, [("num", 0)])},
              u"floor": {"return": python_wrap(math.floor, [("num", 0)])},
              u"log": {"return": call_definitions.math_log},
              u"max": {"return": python_wrap(max, [("num", 0)], nargs=True)},
              u"min": {"return": python_wrap(min, [("num", 0)], nargs=True)},
              u"pow": {"return": python_wrap(math.pow, [("num", 0),
                                                        ("num", 0)])},
              # Random always returns 0.5 in our fantasy land.