Thread: [pure-lang-svn] SF.net SVN: pure-lang:[496] pure/trunk (Page 2)
Status: Beta
Brought to you by:
agraef
From: <ag...@us...> - 2008-08-14 13:37:07
|
Revision: 496 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=496&view=rev Author: agraef Date: 2008-08-14 13:37:16 +0000 (Thu, 14 Aug 2008) Log Message: ----------- Added ubyte, ushort, uint, ulong routines to convert integers to unsigned quantities, as discussed on the mailing list. Modified Paths: -------------- pure/trunk/ChangeLog pure/trunk/lib/primitives.pure Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-08-14 13:03:22 UTC (rev 495) +++ pure/trunk/ChangeLog 2008-08-14 13:37:16 UTC (rev 496) @@ -1,5 +1,9 @@ 2008-08-14 Albert Graef <Dr....@t-...> + * lib/primitives.pure: Added routines to convert signed integers + to the corresponding unsigned quantities, as discussed on the + mailing list. + * lib/math.pure: Bugfixes, overhaul of number predicates, added missing semantic number predicates. Modified: pure/trunk/lib/primitives.pure =================================================================== --- pure/trunk/lib/primitives.pure 2008-08-14 13:03:22 UTC (rev 495) +++ pure/trunk/lib/primitives.pure 2008-08-14 13:37:16 UTC (rev 496) @@ -91,6 +91,21 @@ pointer x::double | pointer x::string = pure_pointerval x; +/* Convert signed (8/16/32/64) bit integers to the corresponding unsigned + quantities. These functions behave as if the value was "cast" to the + corresponding unsigned C type, and are most useful for dealing with + unsigned integers returned by external C routines. The routines always use + the smallest Pure int type capable of holding the result: int for ubyte and + ushort, bigint for uint and ulong. (Note that in the case of 64 bit values + the C interface returns a bigint, that's why ulong takes a bigint + parameter. The other routines all take an int as input.) */ + +ubyte x::int = if x>=0 then x else x+0x100; +ushort x::int = if x>=0 then x else x+0x10000; +uint x::int = if x>=0 then bigint x else x+0x100000000L; +ulong x::bigint = if x>=0 then x else x+0x10000000000000000L; + + /* Absolute value and sign of a number. */ abs x::int | abs x::bigint | abs x::double This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-08-14 23:31:50
|
Revision: 503 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=503&view=rev Author: agraef Date: 2008-08-14 23:31:59 +0000 (Thu, 14 Aug 2008) Log Message: ----------- Add bigint->int32_t marshalling routine. Modified Paths: -------------- pure/trunk/runtime.cc pure/trunk/runtime.h Modified: pure/trunk/runtime.cc =================================================================== --- pure/trunk/runtime.cc 2008-08-14 23:16:09 UTC (rev 502) +++ pure/trunk/runtime.cc 2008-08-14 23:31:59 UTC (rev 503) @@ -1147,6 +1147,15 @@ } extern "C" +int32_t pure_get_int(pure_expr *x) +{ + uint32_t v = + (sizeof(mp_limb_t) == 8) ? (uint32_t)(uint64_t)mpz_getlimbn(x->data.z, 0) : + mpz_getlimbn(x->data.z, 0); + return (mpz_sgn(x->data.z) < 0) ? -(int32_t)v : (int32_t)v; +} + +extern "C" void *pure_get_bigint(pure_expr *x) { assert(x && x->tag == EXPR::BIGINT); Modified: pure/trunk/runtime.h =================================================================== --- pure/trunk/runtime.h 2008-08-14 23:16:09 UTC (rev 502) +++ pure/trunk/runtime.h 2008-08-14 23:31:59 UTC (rev 503) @@ -318,11 +318,12 @@ char *pure_get_cstring(pure_expr *x); void pure_free_cstrings(); -/* Convert a bigint expression to a pointer (mpz_t) or a long (64 bit) +/* Convert a bigint expression to a pointer (mpz_t) or a 64 or 32 bit integer. This is used to marshall bigint arguments in the C interface. */ void *pure_get_bigint(pure_expr *x); int64_t pure_get_long(pure_expr *x); +int32_t pure_get_int(pure_expr *x); /* Execute a closure. If the given expression x (or x y in the case of pure_apply) is a parameterless closure (or a saturated application of a This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-08-15 07:47:57
|
Revision: 505 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=505&view=rev Author: agraef Date: 2008-08-15 07:48:07 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Allow bigint arguments for all C int parameter types. Modified Paths: -------------- pure/trunk/ChangeLog pure/trunk/interpreter.cc Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-08-14 23:43:27 UTC (rev 504) +++ pure/trunk/ChangeLog 2008-08-15 07:48:07 UTC (rev 505) @@ -1,5 +1,8 @@ 2008-08-15 Albert Graef <Dr....@t-...> + * interpreter.cc (declare_extern): All C int parameter types now + handle bigint arguments. + * lib/primitives.pure: Moved basic rounding functions from math.pure, and fixed some minor glitches in the pow function. Modified: pure/trunk/interpreter.cc =================================================================== --- pure/trunk/interpreter.cc 2008-08-14 23:43:27 UTC (rev 504) +++ pure/trunk/interpreter.cc 2008-08-15 07:48:07 UTC (rev 505) @@ -259,6 +259,8 @@ "pure_get_bigint", "void*", 1, "expr*"); declare_extern((void*)pure_get_long, "pure_get_long", "long", 1, "expr*"); + declare_extern((void*)pure_get_int, + "pure_get_int", "int", 1, "expr*"); declare_extern((void*)pure_catch, "pure_catch", "expr*", 2, "expr*", "expr*"); @@ -2814,41 +2816,84 @@ Value *iv = b.CreateLoad(b.CreateGEP(pv, idx, idx+2), "intval"); unboxed[i] = b.CreateICmpNE(iv, Zero); } else if (argt[i] == Type::Int8Ty) { + /* We allow either ints or bigints to be passed for C integers. */ + BasicBlock *intbb = BasicBlock::Create("int"); + BasicBlock *mpzbb = BasicBlock::Create("mpz"); BasicBlock *okbb = BasicBlock::Create("ok"); Value *idx[2] = { Zero, Zero }; Value *tagv = b.CreateLoad(b.CreateGEP(x, idx, idx+2), "tag"); - b.CreateCondBr - (b.CreateICmpEQ(tagv, SInt(EXPR::INT), "cmp"), okbb, failedbb); + SwitchInst *sw = b.CreateSwitch(tagv, failedbb, 2); + sw->addCase(SInt(EXPR::INT), intbb); + sw->addCase(SInt(EXPR::BIGINT), mpzbb); + f->getBasicBlockList().push_back(intbb); + b.SetInsertPoint(intbb); + Value *pv = b.CreateBitCast(x, IntExprPtrTy, "intexpr"); + idx[1] = ValFldIndex; + Value *intv = b.CreateLoad(b.CreateGEP(pv, idx, idx+2), "intval"); + b.CreateBr(okbb); + f->getBasicBlockList().push_back(mpzbb); + b.SetInsertPoint(mpzbb); + // Handle the case of a bigint (mpz_t -> int). + Value *mpzv = b.CreateCall(module->getFunction("pure_get_int"), x); + b.CreateBr(okbb); f->getBasicBlockList().push_back(okbb); b.SetInsertPoint(okbb); - Value *pv = b.CreateBitCast(x, IntExprPtrTy, "intexpr"); - idx[1] = ValFldIndex; - Value *iv = b.CreateLoad(b.CreateGEP(pv, idx, idx+2), "intval"); - unboxed[i] = b.CreateTrunc(iv, Type::Int8Ty); + PHINode *phi = b.CreatePHI(Type::Int32Ty); + phi->addIncoming(intv, intbb); + phi->addIncoming(mpzv, mpzbb); + unboxed[i] = b.CreateTrunc(phi, Type::Int8Ty); } else if (argt[i] == Type::Int16Ty) { + BasicBlock *intbb = BasicBlock::Create("int"); + BasicBlock *mpzbb = BasicBlock::Create("mpz"); BasicBlock *okbb = BasicBlock::Create("ok"); Value *idx[2] = { Zero, Zero }; Value *tagv = b.CreateLoad(b.CreateGEP(x, idx, idx+2), "tag"); - b.CreateCondBr - (b.CreateICmpEQ(tagv, SInt(EXPR::INT), "cmp"), okbb, failedbb); + SwitchInst *sw = b.CreateSwitch(tagv, failedbb, 2); + sw->addCase(SInt(EXPR::INT), intbb); + sw->addCase(SInt(EXPR::BIGINT), mpzbb); + f->getBasicBlockList().push_back(intbb); + b.SetInsertPoint(intbb); + Value *pv = b.CreateBitCast(x, IntExprPtrTy, "intexpr"); + idx[1] = ValFldIndex; + Value *intv = b.CreateLoad(b.CreateGEP(pv, idx, idx+2), "intval"); + b.CreateBr(okbb); + f->getBasicBlockList().push_back(mpzbb); + b.SetInsertPoint(mpzbb); + // Handle the case of a bigint (mpz_t -> int). + Value *mpzv = b.CreateCall(module->getFunction("pure_get_int"), x); + b.CreateBr(okbb); f->getBasicBlockList().push_back(okbb); b.SetInsertPoint(okbb); - Value *pv = b.CreateBitCast(x, IntExprPtrTy, "intexpr"); - idx[1] = ValFldIndex; - Value *iv = b.CreateLoad(b.CreateGEP(pv, idx, idx+2), "intval"); - unboxed[i] = b.CreateTrunc(iv, Type::Int16Ty); + PHINode *phi = b.CreatePHI(Type::Int32Ty); + phi->addIncoming(intv, intbb); + phi->addIncoming(mpzv, mpzbb); + unboxed[i] = b.CreateTrunc(phi, Type::Int16Ty); } else if (argt[i] == Type::Int32Ty) { + BasicBlock *intbb = BasicBlock::Create("int"); + BasicBlock *mpzbb = BasicBlock::Create("mpz"); BasicBlock *okbb = BasicBlock::Create("ok"); Value *idx[2] = { Zero, Zero }; Value *tagv = b.CreateLoad(b.CreateGEP(x, idx, idx+2), "tag"); - b.CreateCondBr - (b.CreateICmpEQ(tagv, SInt(EXPR::INT), "cmp"), okbb, failedbb); + SwitchInst *sw = b.CreateSwitch(tagv, failedbb, 2); + sw->addCase(SInt(EXPR::INT), intbb); + sw->addCase(SInt(EXPR::BIGINT), mpzbb); + f->getBasicBlockList().push_back(intbb); + b.SetInsertPoint(intbb); + Value *pv = b.CreateBitCast(x, IntExprPtrTy, "intexpr"); + idx[1] = ValFldIndex; + Value *intv = b.CreateLoad(b.CreateGEP(pv, idx, idx+2), "intval"); + b.CreateBr(okbb); + f->getBasicBlockList().push_back(mpzbb); + b.SetInsertPoint(mpzbb); + // Handle the case of a bigint (mpz_t -> int). + Value *mpzv = b.CreateCall(module->getFunction("pure_get_int"), x); + b.CreateBr(okbb); f->getBasicBlockList().push_back(okbb); b.SetInsertPoint(okbb); - Value *pv = b.CreateBitCast(x, IntExprPtrTy, "intexpr"); - idx[1] = ValFldIndex; - Value *iv = b.CreateLoad(b.CreateGEP(pv, idx, idx+2), "intval"); - unboxed[i] = iv; + PHINode *phi = b.CreatePHI(Type::Int32Ty); + phi->addIncoming(intv, intbb); + phi->addIncoming(mpzv, mpzbb); + unboxed[i] = phi; } else if (argt[i] == Type::Int64Ty) { BasicBlock *intbb = BasicBlock::Create("int"); BasicBlock *mpzbb = BasicBlock::Create("mpz"); @@ -2856,15 +2901,14 @@ Value *idx[2] = { Zero, Zero }; Value *tagv = b.CreateLoad(b.CreateGEP(x, idx, idx+2), "tag"); SwitchInst *sw = b.CreateSwitch(tagv, failedbb, 2); - /* We allow either ints or bigints to be passed for a long value. */ sw->addCase(SInt(EXPR::INT), intbb); sw->addCase(SInt(EXPR::BIGINT), mpzbb); f->getBasicBlockList().push_back(intbb); b.SetInsertPoint(intbb); Value *pv = b.CreateBitCast(x, IntExprPtrTy, "intexpr"); idx[1] = ValFldIndex; - Value *iv = b.CreateLoad(b.CreateGEP(pv, idx, idx+2), "intval"); - Value *intv = b.CreateSExt(iv, Type::Int64Ty); + Value *intv = b.CreateLoad(b.CreateGEP(pv, idx, idx+2), "intval"); + intv = b.CreateSExt(intv, Type::Int64Ty); b.CreateBr(okbb); f->getBasicBlockList().push_back(mpzbb); b.SetInsertPoint(mpzbb); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-08-15 10:31:51
|
Revision: 509 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=509&view=rev Author: agraef Date: 2008-08-15 10:31:59 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Fix treatment of negative bigint constants, so that an explicit bigint -0x80000000L doesn't get converted back to an int. Modified Paths: -------------- pure/trunk/expr.hh pure/trunk/interpreter.cc pure/trunk/lexer.ll pure/trunk/parser.yy Modified: pure/trunk/expr.hh =================================================================== --- pure/trunk/expr.hh 2008-08-15 09:15:37 UTC (rev 508) +++ pure/trunk/expr.hh 2008-08-15 10:31:59 UTC (rev 509) @@ -143,6 +143,9 @@ // matching automaton (LAMBDA, CASE; vector for WHEN): matcher *m; + // KLUDGE: overflowed int constant, needed to properly handle -0x8000000 + bool c; + // extra built-in type tag used in code generation: int8_t ttag; @@ -156,54 +159,54 @@ static EXPR *newref(EXPR *x) { return x?x->incref():0; } EXPR(int32_t _tag) : - refc(0), tag(_tag), m(0), ttag(0), astag(0), aspath(0) { } + refc(0), tag(_tag), m(0), c(false), ttag(0), astag(0), aspath(0) { } EXPR(int32_t _tag, int32_t _vtag, uint8_t _idx, int8_t _ttag = 0, const path& _p = path()) : - refc(0), tag(_tag), m(0), ttag(_ttag), astag(0), aspath(0) + refc(0), tag(_tag), m(0), c(false), ttag(_ttag), astag(0), aspath(0) { assert(_tag == VAR || _tag == FVAR); data.v.vtag = _vtag; data.v.idx = _idx; data.v.p = (_tag == VAR)?new path(_p):0; } EXPR(int32_t _tag, int32_t _i) : - refc(0), tag(_tag), m(0), ttag(_tag), astag(0), aspath(0) + refc(0), tag(_tag), m(0), c(false), ttag(_tag), astag(0), aspath(0) { assert(_tag == INT); data.i = _i; } - EXPR(int32_t _tag, mpz_t _z) : - refc(0), tag(_tag), m(0), ttag(_tag), astag(0), aspath(0) + EXPR(int32_t _tag, mpz_t _z, bool _c = false) : + refc(0), tag(_tag), m(0), c(_c), ttag(_tag), astag(0), aspath(0) { assert(_tag == BIGINT); mpz_init_set(data.z, _z); mpz_clear(_z); } EXPR(int32_t _tag, double _d) : - refc(0), tag(_tag), m(0), ttag(_tag), astag(0), aspath(0) + refc(0), tag(_tag), m(0), c(false), ttag(_tag), astag(0), aspath(0) { assert(_tag == DBL); data.d = _d; } explicit EXPR(int32_t _tag, char *_s) : - refc(0), tag(_tag), m(0), ttag(_tag), astag(0), aspath(0) + refc(0), tag(_tag), m(0), c(false), ttag(_tag), astag(0), aspath(0) { assert(_tag == STR); data.s = _s; } explicit EXPR(int32_t _tag, void *_p) : - refc(0), tag(_tag), m(0), ttag(_tag), astag(0), aspath(0) + refc(0), tag(_tag), m(0), c(false), ttag(_tag), astag(0), aspath(0) { assert(_tag == PTR); data.p = _p; } EXPR(int32_t _tag, EXPR *_arg1, EXPR *_arg2, EXPR *_arg3) : - refc(0), tag(_tag), m(0), ttag(0), astag(0), aspath(0) + refc(0), tag(_tag), m(0), c(false), ttag(0), astag(0), aspath(0) { assert(_tag == COND); data.x[0] = newref(_arg1); data.x[1] = newref(_arg2); data.x[2] = newref(_arg3); } EXPR(int32_t _tag, EXPR *_arg, EXPR *_body) : - refc(0), tag(_tag), m(0), ttag(0), astag(0), aspath(0) + refc(0), tag(_tag), m(0), c(false), ttag(0), astag(0), aspath(0) { assert(_tag == LAMBDA); data.x[0] = newref(_arg); data.x[1] = newref(_body); } EXPR(int32_t _tag, EXPR *_arg, rulel *_rules) : - refc(0), tag(_tag), m(0), ttag(0), astag(0), aspath(0) + refc(0), tag(_tag), m(0), c(false), ttag(0), astag(0), aspath(0) { assert(_tag == CASE || _tag == WHEN); data.c.x = newref(_arg); data.c.r = _rules; } EXPR(int32_t _tag, EXPR *_arg, env *_e) : - refc(0), tag(_tag), m(0), ttag(0), astag(0), aspath(0) + refc(0), tag(_tag), m(0), c(false), ttag(0), astag(0), aspath(0) { assert(_tag == WITH); data.c.x = newref(_arg); data.c.e = _e; } EXPR(EXPR *_fun, EXPR *_arg) : - refc(0), tag(APP), m(0), ttag(0), astag(0), aspath(0) + refc(0), tag(APP), m(0), c(false), ttag(0), astag(0), aspath(0) { data.x[0] = newref(_fun); data.x[1] = newref(_arg); } EXPR(EXPR *_fun, EXPR *_arg1, EXPR *_arg2) : - refc(0), tag(APP), m(0), ttag(0), astag(0), aspath(0) + refc(0), tag(APP), m(0), c(false), ttag(0), astag(0), aspath(0) { data.x[0] = new EXPR(_fun, _arg1); data.x[0]->incref(); data.x[1] = newref(_arg2); } EXPR(EXPR *_fun, EXPR *_arg1, EXPR *_arg2, EXPR *_arg3) : - refc(0), tag(APP), m(0), ttag(0), astag(0), aspath(0) + refc(0), tag(APP), m(0), c(false), ttag(0), astag(0), aspath(0) { data.x[0] = new EXPR(_fun, _arg1, _arg2); data.x[0]->incref(); data.x[1] = newref(_arg3); } @@ -253,8 +256,8 @@ p(new EXPR(tag, vtag, idx, ttag, _p)) { p->incref(); } expr(int32_t tag, int32_t i) : p(new EXPR(tag, i)) { p->incref(); } - expr(int32_t tag, mpz_t z) : - p(new EXPR(tag, z)) { p->incref(); } + expr(int32_t tag, mpz_t z, bool c = false) : + p(new EXPR(tag, z, c)) { p->incref(); } expr(int32_t tag, double d) : p(new EXPR(tag, d)) { p->incref(); } explicit expr(int32_t tag, char *s) : @@ -337,6 +340,7 @@ p->tag == EXPR::CASE || p->tag == EXPR::WHEN); return p->m; } + bool cint() const { return p->c; } int32_t astag() const { return p->astag; } path &aspath() const { assert(p->aspath); return *p->aspath; } Modified: pure/trunk/interpreter.cc =================================================================== --- pure/trunk/interpreter.cc 2008-08-15 09:15:37 UTC (rev 508) +++ pure/trunk/interpreter.cc 2008-08-15 10:31:59 UTC (rev 509) @@ -1623,9 +1623,10 @@ } expr *y; // handle special case of a numeric argument - if (x->tag() == EXPR::BIGINT && mpz_cmp_ui(x->zval(), 0x80000000U) == 0) - // The negated bigint 0x80000000 can actually be represented as a machine - // int value, we do that conversion on the fly here. + if (x->tag() == EXPR::BIGINT && x->cint() && + mpz_cmp_ui(x->zval(), 0x80000000U) == 0) + // The negated int 0x80000000 can actually be represented as a machine int + // value, we convert it back on the fly here. y = new expr(EXPR::INT, (int32_t)-0x80000000); else if (x->tag() == EXPR::INT) y = new expr(EXPR::INT, -x->ival()); Modified: pure/trunk/lexer.ll =================================================================== --- pure/trunk/lexer.ll 2008-08-15 09:15:37 UTC (rev 508) +++ pure/trunk/lexer.ll 2008-08-15 10:31:59 UTC (rev 509) @@ -751,7 +751,7 @@ return token::INT; } else { yylval->zval = z; - return token::BIGINT; + return token::CBIGINT; } } {int}L { Modified: pure/trunk/parser.yy =================================================================== --- pure/trunk/parser.yy 2008-08-15 09:15:37 UTC (rev 508) +++ pure/trunk/parser.yy 2008-08-15 10:31:59 UTC (rev 509) @@ -224,6 +224,7 @@ %token <csval> STR "string" %token <ival> INT "integer" %token <zval> BIGINT "bigint" +%token <zval> CBIGINT "converted bigint" %token <dval> DBL "floating point number" %token <ival> TAG "type tag" %type <sval> name optalias ctype @@ -242,7 +243,7 @@ comp_clauses comp_clause_list args lhs qual rules rulel rule pat_rules pat_rulel simple_rules simple_rulel simple_rule ids names name optalias opt_ctypes ctypes ctype -%destructor { mpz_clear(*$$); free($$); } BIGINT +%destructor { mpz_clear(*$$); free($$); } BIGINT CBIGINT %destructor { free($$); } STR %printer { debug_stream() << *$$; } ID name optalias ctype expr cond simple app prim op args lhs qual rule simple_rules simple_rulel simple_rule @@ -250,7 +251,7 @@ %printer { debug_stream() << $$->rl; } pat_rules pat_rulel %printer { debug_stream() << $$; } INT DBL STR %printer { char *s = mpz_get_str(NULL, 10, *$$); - debug_stream() << s; free(s); } BIGINT + debug_stream() << s; free(s); } BIGINT CBIGINT %% @@ -507,6 +508,7 @@ $$ = $3; } } | INT { $$ = new expr(EXPR::INT, $1); } +| CBIGINT { $$ = new expr(EXPR::BIGINT, *$1, true); free($1); } | BIGINT { $$ = new expr(EXPR::BIGINT, *$1); free($1); } | DBL { $$ = new expr(EXPR::DBL, $1); } | STR { $$ = new expr(EXPR::STR, $1); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-08-15 10:41:33
|
Revision: 510 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=510&view=rev Author: agraef Date: 2008-08-15 10:41:43 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Add test for integer marshalling. Modified Paths: -------------- pure/trunk/ChangeLog Added Paths: ----------- pure/trunk/test/test018.log pure/trunk/test/test018.pure Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-08-15 10:31:59 UTC (rev 509) +++ pure/trunk/ChangeLog 2008-08-15 10:41:43 UTC (rev 510) @@ -1,5 +1,7 @@ 2008-08-15 Albert Graef <Dr....@t-...> + * test/test018.pure: Add test for integer marshalling. + * interpreter.cc (declare_extern): All C int parameter types now handle bigint arguments. Added: pure/trunk/test/test018.log =================================================================== --- pure/trunk/test/test018.log (rev 0) +++ pure/trunk/test/test018.log 2008-08-15 10:41:43 UTC (rev 510) @@ -0,0 +1,88 @@ +sprintf "%d" 2147483647; +"2147483647" +sprintf "%d" 2147483648L; +"-2147483648" +sprintf "%d" 4294967295L; +"-1" +sprintf "%d" (-2147483647); +"-2147483647" +sprintf "%d" (-2147483648); +"-2147483648" +sprintf "%d" (-4294967295L); +"1" +sprintf "%d" 2147483647L; +"2147483647" +sprintf "%d" 2147483648L; +"-2147483648" +sprintf "%d" 4294967295L; +"-1" +sprintf "%d" (-2147483647L); +"-2147483647" +sprintf "%d" (-2147483648L); +"-2147483648" +sprintf "%d" (-4294967295L); +"1" +sprintf "%u" 2147483647; +"2147483647" +sprintf "%u" 2147483648L; +"2147483648" +sprintf "%u" 4294967295L; +"4294967295" +sprintf "%u" (-2147483647); +"2147483649" +sprintf "%u" (-2147483648); +"2147483648" +sprintf "%u" (-4294967295L); +"1" +sprintf "%u" 2147483647L; +"2147483647" +sprintf "%u" 2147483648L; +"2147483648" +sprintf "%u" 4294967295L; +"4294967295" +sprintf "%u" (-2147483647L); +"2147483649" +sprintf "%u" (-2147483648L); +"2147483648" +sprintf "%u" (-4294967295L); +"1" +sprintf "%x" 2147483647; +"7fffffff" +sprintf "%x" 2147483648L; +"80000000" +sprintf "%x" 4294967295L; +"ffffffff" +sprintf "%x" (-2147483647); +"80000001" +sprintf "%x" (-2147483648); +"80000000" +sprintf "%x" (-4294967295L); +"1" +sprintf "%x" 2147483647L; +"7fffffff" +sprintf "%x" 2147483648L; +"80000000" +sprintf "%x" 4294967295L; +"ffffffff" +sprintf "%x" (-2147483647L); +"80000001" +sprintf "%x" (-2147483648L); +"80000000" +sprintf "%x" (-4294967295L); +"1" +ord$sprintf "%c" 128; +128 +ord$sprintf "%c" 255; +255 +ord$sprintf "%c" 128L; +128 +ord$sprintf "%c" 255L; +255 +sscanf "ffffffff" "%x"; +-1 +uint$sscanf "ffffffff" "%x"; +4294967295L +sscanf "4294967295" "%u"; +-1 +uint$sscanf "4294967295" "%u"; +4294967295L Added: pure/trunk/test/test018.pure =================================================================== --- pure/trunk/test/test018.pure (rev 0) +++ pure/trunk/test/test018.pure 2008-08-15 10:41:43 UTC (rev 510) @@ -0,0 +1,67 @@ + +// check integer marshalling of the C interface +// (this isn't exhaustive, but should cover the most important cases) + +using system; + +// signed parameters + +sprintf "%d" 0x7fffffff; +sprintf "%d" 0x80000000; +sprintf "%d" 0xffffffff; +sprintf "%d" (-0x7fffffff); +sprintf "%d" (-0x80000000); +sprintf "%d" (-0xffffffff); + +sprintf "%d" 0x7fffffffL; +sprintf "%d" 0x80000000L; +sprintf "%d" 0xffffffffL; +sprintf "%d" (-0x7fffffffL); +sprintf "%d" (-0x80000000L); +sprintf "%d" (-0xffffffffL); + +// unsigned parameters + +sprintf "%u" 0x7fffffff; +sprintf "%u" 0x80000000; +sprintf "%u" 0xffffffff; +sprintf "%u" (-0x7fffffff); +sprintf "%u" (-0x80000000); +sprintf "%u" (-0xffffffff); + +sprintf "%u" 0x7fffffffL; +sprintf "%u" 0x80000000L; +sprintf "%u" 0xffffffffL; +sprintf "%u" (-0x7fffffffL); +sprintf "%u" (-0x80000000L); +sprintf "%u" (-0xffffffffL); + +// unsigned parameters (hex) + +sprintf "%x" 0x7fffffff; +sprintf "%x" 0x80000000; +sprintf "%x" 0xffffffff; +sprintf "%x" (-0x7fffffff); +sprintf "%x" (-0x80000000); +sprintf "%x" (-0xffffffff); + +sprintf "%x" 0x7fffffffL; +sprintf "%x" 0x80000000L; +sprintf "%x" 0xffffffffL; +sprintf "%x" (-0x7fffffffL); +sprintf "%x" (-0x80000000L); +sprintf "%x" (-0xffffffffL); + +// unsigned char + +ord $ sprintf "%c" 0x80; +ord $ sprintf "%c" 0xff; +ord $ sprintf "%c" 0x80L; +ord $ sprintf "%c" 0xffL; + +// unsigned return values + +sscanf "ffffffff" "%x"; +uint $ sscanf "ffffffff" "%x"; +sscanf "4294967295" "%u"; +uint $ sscanf "4294967295" "%u"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-08-16 21:27:32
|
Revision: 512 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=512&view=rev Author: agraef Date: 2008-08-16 21:27:39 +0000 (Sat, 16 Aug 2008) Log Message: ----------- Implement new script search algorithm. Modified Paths: -------------- pure/trunk/ChangeLog pure/trunk/interpreter.cc pure/trunk/interpreter.hh pure/trunk/lexer.ll Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-08-16 00:54:21 UTC (rev 511) +++ pure/trunk/ChangeLog 2008-08-16 21:27:39 UTC (rev 512) @@ -1,3 +1,24 @@ +2008-08-16 Albert Graef <Dr....@t-...> + + * interpreter.cc, lexer.ll: Implemented new script search + algorithm, as discussed on the mailing list. + + Scripts loaded with a 'using' clause are now first searched in the + directory of the script containing the 'using' clause, then in the + PURELIB directory and finally in the current directory. This + allows scripts to be installed in their own directory, along with + any other non-library modules they need. Scripts specified on the + command line or with the 'run' command are searched for in the + current directory and then in the PURELIB directory, as before. + + Script names are now "canonicalized" by following symbolic links + (albeit only one level) and removing '.' and '..' directory + components in the absolute pathname. Also, checking whether a + script has already been loaded now uses the canonicalized pathname + so that, e.g., two scripts foo/baz.pure and bar/baz.pure are + considered distinct modules and can both be used in the same + program (unless they link to the same script file). + 2008-08-15 Albert Graef <Dr....@t-...> * test/test018.pure: Add test for integer marshalling. Modified: pure/trunk/interpreter.cc =================================================================== --- pure/trunk/interpreter.cc 2008-08-16 00:54:21 UTC (rev 511) +++ pure/trunk/interpreter.cc 2008-08-16 21:27:39 UTC (rev 512) @@ -387,6 +387,124 @@ } } +/* Search for a source file. Absolute file names (starting with a slash) are + taken as is. Relative pathnames are resolved using the following algorithm: + If srcdir is nonempty, search it first, then libdir (if nonempty), then the + current working directory. If srcdir is empty, first search the current + directory, then libdir (if nonempty). In either case, if the resulting + absolute pathname is a symbolic link, the destination is used instead, and + finally the pathname is canonicalized. */ + +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> + +static inline string dirname(const string& fname) +{ + size_t pos = fname.rfind('/'); + if (pos == string::npos) + return ""; + else + return fname.substr(0, pos+1); +} + +static inline string basename(const string& fname) +{ + size_t pos = fname.rfind('/'); + if (pos == string::npos) + return fname; + else + return fname.substr(pos+1); +} + +static inline bool chkfile(const string& s) +{ + struct stat st; + return !stat(s.c_str(), &st) && !S_ISDIR(st.st_mode); +} + +#ifndef _WIN32 +static inline bool chklink(const string& s) +{ + struct stat st; + return !lstat(s.c_str(), &st) && S_ISLNK(st.st_mode); +} +#endif + +#define BUFSIZE 1024 + +static string searchdir(const string& srcdir, const string& libdir, + const string& script) +{ + char cwd[BUFSIZE]; + if (script.empty()) + return script; + else if (!getcwd(cwd, BUFSIZE)) { + perror("getcwd"); + return script; + } + string workdir = cwd; + if (!workdir.empty() && workdir[workdir.size()-1] != '/') + workdir += "/"; + string fname; + if (script[0] != '/') { + // resolve relative pathname + if (srcdir.empty()) { + fname = workdir+script; + if (chkfile(fname)) goto found; + if (!libdir.empty()) { + fname = libdir+script; + if (chkfile(fname)) goto found; + } + fname = script; + } else { + fname = srcdir+script; + if (chkfile(fname)) goto found; + if (!libdir.empty()) { + fname = libdir+script; + if (chkfile(fname)) goto found; + } + fname = workdir+script; + if (chkfile(fname)) goto found; + fname = script; + } + } else + fname = script; + found: + if (fname[0] != '/') fname = workdir+fname; + char buf[BUFSIZE]; +#ifndef _WIN32 + if (chklink(fname)) { + // follow symbolic link to its destination + int l = readlink(fname.c_str(), buf, BUFSIZE-1); + if (l >= 0) { + buf[l] = 0; + string basedir = dirname(fname), linkname = buf; + string dir = dirname(linkname), name = basename(linkname); + if (dir.empty()) + dir = basedir; + else if (dir[0] != '/') + dir = basedir+dir; + fname = dir+name; + } else + perror("readlink"); + } +#endif + // canonicalize the pathname + string dir = dirname(fname), name = basename(fname); + if (chdir(dir.c_str())==0 && getcwd(buf, BUFSIZE)) { + string dir = buf; + if (!dir.empty() && dir[dir.size()-1] != '/') + dir += "/"; + fname = dir+name; + } + chdir(cwd); +#if DEBUG>1 + std::cerr << "search '" << script << "', found as '" << fname << "'\n"; +#endif + return fname; +} + // Run the interpreter on a source file, collection of source files, or on // string data. @@ -415,7 +533,8 @@ return 0; } // ordinary source file - if (check && sources.find(s) != sources.end()) + string fname = searchdir(srcdir, lib, s); + if (check && sources.find(fname) != sources.end()) // already loaded, skip return 0; // save local data @@ -424,6 +543,7 @@ int l_nerrs = nerrs; uint8_t l_temp = temp; const char *l_source_s = source_s; + string l_srcdir = srcdir; // save global data uint8_t s_verbose = g_verbose; bool s_interactive = g_interactive; @@ -435,11 +555,12 @@ nerrs = 0; source = s; declare_op = false; source_s = 0; + srcdir = dirname(fname); errmsg.clear(); if (check && !interactive) temp = 0; - bool ok = lex_begin(); + bool ok = lex_begin(fname); if (ok) { - if (temp == 0 && !s.empty()) sources.insert(s); + if (temp == 0 && !s.empty()) sources.insert(fname); yy::parser parser(*this); parser.set_debug_level((verbose&verbosity::parser) != 0); // parse @@ -460,6 +581,7 @@ nerrs = l_nerrs; temp = l_temp; source_s = l_source_s; + srcdir = l_srcdir; // return last computed result, if any return result; } @@ -488,6 +610,7 @@ string l_source = source; int l_nerrs = nerrs; const char *l_source_s = source_s; + string l_srcdir = srcdir; // save global data uint8_t s_verbose = g_verbose; bool s_interactive = g_interactive; @@ -499,6 +622,7 @@ nerrs = 0; source = ""; declare_op = false; source_s = s.c_str(); + srcdir = ""; errmsg.clear(); bool ok = lex_begin(); if (ok) { @@ -519,6 +643,7 @@ source_s = 0; nerrs = l_nerrs; source_s = l_source_s; + srcdir = l_srcdir; // return last computed result, if any return result; } Modified: pure/trunk/interpreter.hh =================================================================== --- pure/trunk/interpreter.hh 2008-08-16 00:54:21 UTC (rev 511) +++ pure/trunk/interpreter.hh 2008-08-16 21:27:39 UTC (rev 512) @@ -618,8 +618,9 @@ // Interface to the lexer. public: bool declare_op; + string srcdir; private: - bool lex_begin(); + bool lex_begin(const string& fname = ""); void lex_end(); }; Modified: pure/trunk/lexer.ll =================================================================== --- pure/trunk/lexer.ll 2008-08-16 00:54:21 UTC (rev 511) +++ pure/trunk/lexer.ll 2008-08-16 21:27:39 UTC (rev 512) @@ -852,19 +852,14 @@ %% bool -interpreter::lex_begin() +interpreter::lex_begin(const string& fname) { yy_flex_debug = (verbose&verbosity::lexer) != 0 && !source_s; if (source_s) yyin = 0; else if (source.empty()) yyin = stdin; - else if (!(yyin = fopen(source.c_str(), "r")) && source[0] != '/') { - string fname = lib+source; - if (!(yyin = fopen(fname.c_str(), "r"))) - perror(source.c_str()); - //error("cannot open '" + source + "'"); - } else if (!yyin) + else if (!(yyin = fopen(fname.c_str(), "r"))) //error("cannot open '" + source + "'"); perror(source.c_str()); if (source_s || yyin) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-08-16 21:44:46
|
Revision: 513 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=513&view=rev Author: agraef Date: 2008-08-16 21:44:56 +0000 (Sat, 16 Aug 2008) Log Message: ----------- More robust test for presence of the prelude. Modified Paths: -------------- pure/trunk/ChangeLog pure/trunk/pure.cc Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-08-16 21:27:39 UTC (rev 512) +++ pure/trunk/ChangeLog 2008-08-16 21:44:56 UTC (rev 513) @@ -1,5 +1,7 @@ 2008-08-16 Albert Graef <Dr....@t-...> + * pure.cc (main): More robust test for presence of the prelude. + * interpreter.cc, lexer.ll: Implemented new script search algorithm, as discussed on the mailing list. Modified: pure/trunk/pure.cc =================================================================== --- pure/trunk/pure.cc 2008-08-16 21:27:39 UTC (rev 512) +++ pure/trunk/pure.cc 2008-08-16 21:44:56 UTC (rev 513) @@ -5,6 +5,8 @@ #include <iostream> #include <stdio.h> #include <stdlib.h> +#include <sys/types.h> +#include <sys/stat.h> #include <unistd.h> #include <locale.h> #include <signal.h> @@ -174,6 +176,12 @@ if (histfile) write_history(histfile); } +static inline bool chkfile(const string& s) +{ + struct stat st; + return !stat(s.c_str(), &st) && !S_ISDIR(st.st_mode); +} + int main(int argc, char *argv[]) { @@ -272,15 +280,12 @@ interp.init_sys_vars(PACKAGE_VERSION, HOST, myargs); if (want_prelude) { // load the prelude if we can find it - FILE *fp = fopen("prelude.pure", "r"); - if (fp) + if (chkfile("prelude.pure")) { prelude = "prelude.pure"; - else - // try again in the PURELIB directory - fp = fopen(prelude.c_str(), "r"); - if (fp) { - fclose(fp); have_prelude = true; + } else if (chkfile(prelude)) // try again in the PURELIB directory + have_prelude = true; + if (have_prelude) { interp.run(prelude); interp.compile(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-08-16 23:13:27
|
Revision: 515 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=515&view=rev Author: agraef Date: 2008-08-16 23:13:37 +0000 (Sat, 16 Aug 2008) Log Message: ----------- Revised 'using' syntax so that script names are now separated with a comma. Modified Paths: -------------- pure/trunk/ChangeLog pure/trunk/lexer.ll pure/trunk/lib/prelude.pure pure/trunk/parser.yy pure/trunk/test/test015.pure Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-08-16 22:46:01 UTC (rev 514) +++ pure/trunk/ChangeLog 2008-08-16 23:13:37 UTC (rev 515) @@ -1,3 +1,9 @@ +2008-08-17 Albert Graef <Dr....@t-...> + + * parser.yy, lexer.ll: Revised 'using' syntax so that script names + are now separated with a comma. Updated library and sample scripts + accordingly. + 2008-08-16 Albert Graef <Dr....@t-...> * pure.cc (main): More robust test for presence of the prelude. Modified: pure/trunk/lexer.ll =================================================================== --- pure/trunk/lexer.ll 2008-08-16 22:46:01 UTC (rev 514) +++ pure/trunk/lexer.ll 2008-08-16 23:13:37 UTC (rev 515) @@ -229,7 +229,7 @@ strtag ::{blank}*string ptrtag ::{blank}*pointer -%x comment xdecl xdecl_comment +%x comment xdecl xdecl_comment xusing xusing_comment %{ # define YY_USER_ACTION yylloc->columns(yyleng); @@ -266,13 +266,42 @@ interp.error(*yylloc, msg); BEGIN(INITIAL); return token::ERRTOK; } - <xdecl_comment>[^*\n]* yylloc->step(); <xdecl_comment>"*"+[^*/\n]* yylloc->step(); <xdecl_comment>[\n]+ yylloc->lines(yyleng); yylloc->step(); <xdecl_comment>"*"+"/" yylloc->step(); BEGIN(xdecl); +<xusing>{id} yylval->sval = new string(yytext); return token::ID; +<xusing>, return yy::parser::token_type(yytext[0]); +<xusing>"//".* yylloc->step(); +<xusing>"/*" BEGIN(xusing_comment); +<xusing>; BEGIN(INITIAL); return yy::parser::token_type(yytext[0]); +<xusing>{blank}+ yylloc->step(); +<xusing>[\n]+ yylloc->lines(yyleng); yylloc->step(); +<xusing>\"{str}\" { + char *msg; + yytext[yyleng-1] = 0; + yylval->csval = parsestr(yytext+1, msg); + yytext[yyleng-1] = '"'; + if (msg) interp.error(*yylloc, msg); + return token::STR; +} +<xusing>\"{str} { + interp.error(*yylloc, "unterminated string constant"); + BEGIN(INITIAL); return token::ERRTOK; +} +<xusing>. { + string msg = "invalid character '"+string(yytext)+"'"; + interp.error(*yylloc, msg); + BEGIN(INITIAL); return token::ERRTOK; +} + +<xusing_comment>[^*\n]* yylloc->step(); +<xusing_comment>"*"+[^*/\n]* yylloc->step(); +<xusing_comment>[\n]+ yylloc->lines(yyleng); yylloc->step(); +<xusing_comment>"*"+"/" yylloc->step(); BEGIN(xusing); + ^!{blank}*.* { // shell escape is only permitted in interactive mode if (!interp.interactive) REJECT; @@ -801,7 +830,7 @@ otherwise return token::OTHERWISE; when return token::WHEN; with return token::WITH; -using return token::USING; +using BEGIN(xusing); return token::USING; {id} { if (interp.declare_op) { yylval->sval = new string(yytext); Modified: pure/trunk/lib/prelude.pure =================================================================== --- pure/trunk/lib/prelude.pure 2008-08-16 22:46:01 UTC (rev 514) +++ pure/trunk/lib/prelude.pure 2008-08-16 23:13:37 UTC (rev 515) @@ -72,7 +72,7 @@ Note that the math and system modules are *not* included here, so you have to do that yourself if your program requires any of those operations. */ -using primitives strings; +using primitives, strings; /* Basic combinators. */ Modified: pure/trunk/parser.yy =================================================================== --- pure/trunk/parser.yy 2008-08-16 22:46:01 UTC (rev 514) +++ pure/trunk/parser.yy 2008-08-16 23:13:37 UTC (rev 515) @@ -313,8 +313,8 @@ names : name { $$ = new list<string>; $$->push_back(*$1); delete $1; } -| names name -{ $$ = $1; $$->push_back(*$2); delete $2; } +| names ',' name +{ $$ = $1; $$->push_back(*$3); delete $3; } ; name Modified: pure/trunk/test/test015.pure =================================================================== --- pure/trunk/test/test015.pure 2008-08-16 22:46:01 UTC (rev 514) +++ pure/trunk/test/test015.pure 2008-08-16 23:13:37 UTC (rev 515) @@ -1,6 +1,6 @@ // Some tests for set and bag data containers -using array dict heap set; +using array, dict, heap, set; // List of 1000 random integers from interval <0; 99> for stress tests let randlist = This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-08-17 09:51:05
|
Revision: 517 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=517&view=rev Author: agraef Date: 2008-08-17 09:51:09 +0000 (Sun, 17 Aug 2008) Log Message: ----------- Add compilation flag values to expr data structure. Modified Paths: -------------- pure/trunk/expr.hh pure/trunk/interpreter.cc Modified: pure/trunk/expr.hh =================================================================== --- pure/trunk/expr.hh 2008-08-16 23:34:50 UTC (rev 516) +++ pure/trunk/expr.hh 2008-08-17 09:51:09 UTC (rev 517) @@ -115,6 +115,11 @@ WITH = -12, // with expression }; + // special flag values used during compilation: + enum { + OVF = 1, // overflowed int constant -> bigint + }; + uint32_t refc; // reference counter int32_t tag; // type tag or nullary symbol @@ -143,8 +148,8 @@ // matching automaton (LAMBDA, CASE; vector for WHEN): matcher *m; - // KLUDGE: overflowed int constant, needed to properly handle -0x8000000 - bool c; + // compilation flags: + uint16_t flags; // extra built-in type tag used in code generation: int8_t ttag; @@ -159,54 +164,54 @@ static EXPR *newref(EXPR *x) { return x?x->incref():0; } EXPR(int32_t _tag) : - refc(0), tag(_tag), m(0), c(false), ttag(0), astag(0), aspath(0) { } + refc(0), tag(_tag), m(0), flags(0), ttag(0), astag(0), aspath(0) { } EXPR(int32_t _tag, int32_t _vtag, uint8_t _idx, int8_t _ttag = 0, const path& _p = path()) : - refc(0), tag(_tag), m(0), c(false), ttag(_ttag), astag(0), aspath(0) + refc(0), tag(_tag), m(0), flags(0), ttag(_ttag), astag(0), aspath(0) { assert(_tag == VAR || _tag == FVAR); data.v.vtag = _vtag; data.v.idx = _idx; data.v.p = (_tag == VAR)?new path(_p):0; } EXPR(int32_t _tag, int32_t _i) : - refc(0), tag(_tag), m(0), c(false), ttag(_tag), astag(0), aspath(0) + refc(0), tag(_tag), m(0), flags(0), ttag(_tag), astag(0), aspath(0) { assert(_tag == INT); data.i = _i; } - EXPR(int32_t _tag, mpz_t _z, bool _c = false) : - refc(0), tag(_tag), m(0), c(_c), ttag(_tag), astag(0), aspath(0) + EXPR(int32_t _tag, mpz_t _z, bool c = false) : + refc(0), tag(_tag), m(0), flags(c?OVF:0), ttag(_tag), astag(0), aspath(0) { assert(_tag == BIGINT); mpz_init_set(data.z, _z); mpz_clear(_z); } EXPR(int32_t _tag, double _d) : - refc(0), tag(_tag), m(0), c(false), ttag(_tag), astag(0), aspath(0) + refc(0), tag(_tag), m(0), flags(0), ttag(_tag), astag(0), aspath(0) { assert(_tag == DBL); data.d = _d; } explicit EXPR(int32_t _tag, char *_s) : - refc(0), tag(_tag), m(0), c(false), ttag(_tag), astag(0), aspath(0) + refc(0), tag(_tag), m(0), flags(0), ttag(_tag), astag(0), aspath(0) { assert(_tag == STR); data.s = _s; } explicit EXPR(int32_t _tag, void *_p) : - refc(0), tag(_tag), m(0), c(false), ttag(_tag), astag(0), aspath(0) + refc(0), tag(_tag), m(0), flags(0), ttag(_tag), astag(0), aspath(0) { assert(_tag == PTR); data.p = _p; } EXPR(int32_t _tag, EXPR *_arg1, EXPR *_arg2, EXPR *_arg3) : - refc(0), tag(_tag), m(0), c(false), ttag(0), astag(0), aspath(0) + refc(0), tag(_tag), m(0), flags(0), ttag(0), astag(0), aspath(0) { assert(_tag == COND); data.x[0] = newref(_arg1); data.x[1] = newref(_arg2); data.x[2] = newref(_arg3); } EXPR(int32_t _tag, EXPR *_arg, EXPR *_body) : - refc(0), tag(_tag), m(0), c(false), ttag(0), astag(0), aspath(0) + refc(0), tag(_tag), m(0), flags(0), ttag(0), astag(0), aspath(0) { assert(_tag == LAMBDA); data.x[0] = newref(_arg); data.x[1] = newref(_body); } EXPR(int32_t _tag, EXPR *_arg, rulel *_rules) : - refc(0), tag(_tag), m(0), c(false), ttag(0), astag(0), aspath(0) + refc(0), tag(_tag), m(0), flags(0), ttag(0), astag(0), aspath(0) { assert(_tag == CASE || _tag == WHEN); data.c.x = newref(_arg); data.c.r = _rules; } EXPR(int32_t _tag, EXPR *_arg, env *_e) : - refc(0), tag(_tag), m(0), c(false), ttag(0), astag(0), aspath(0) + refc(0), tag(_tag), m(0), flags(0), ttag(0), astag(0), aspath(0) { assert(_tag == WITH); data.c.x = newref(_arg); data.c.e = _e; } EXPR(EXPR *_fun, EXPR *_arg) : - refc(0), tag(APP), m(0), c(false), ttag(0), astag(0), aspath(0) + refc(0), tag(APP), m(0), flags(0), ttag(0), astag(0), aspath(0) { data.x[0] = newref(_fun); data.x[1] = newref(_arg); } EXPR(EXPR *_fun, EXPR *_arg1, EXPR *_arg2) : - refc(0), tag(APP), m(0), c(false), ttag(0), astag(0), aspath(0) + refc(0), tag(APP), m(0), flags(0), ttag(0), astag(0), aspath(0) { data.x[0] = new EXPR(_fun, _arg1); data.x[0]->incref(); data.x[1] = newref(_arg2); } EXPR(EXPR *_fun, EXPR *_arg1, EXPR *_arg2, EXPR *_arg3) : - refc(0), tag(APP), m(0), c(false), ttag(0), astag(0), aspath(0) + refc(0), tag(APP), m(0), flags(0), ttag(0), astag(0), aspath(0) { data.x[0] = new EXPR(_fun, _arg1, _arg2); data.x[0]->incref(); data.x[1] = newref(_arg3); } @@ -340,7 +345,7 @@ p->tag == EXPR::CASE || p->tag == EXPR::WHEN); return p->m; } - bool cint() const { return p->c; } + uint16_t&flags() const { return p->flags; } int32_t astag() const { return p->astag; } path &aspath() const { assert(p->aspath); return *p->aspath; } Modified: pure/trunk/interpreter.cc =================================================================== --- pure/trunk/interpreter.cc 2008-08-16 23:34:50 UTC (rev 516) +++ pure/trunk/interpreter.cc 2008-08-17 09:51:09 UTC (rev 517) @@ -1748,7 +1748,7 @@ } expr *y; // handle special case of a numeric argument - if (x->tag() == EXPR::BIGINT && x->cint() && + if (x->tag() == EXPR::BIGINT && (x->flags()&EXPR::OVF) && mpz_cmp_ui(x->zval(), 0x80000000U) == 0) // The negated int 0x80000000 can actually be represented as a machine int // value, we convert it back on the fly here. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-08-17 11:25:25
|
Revision: 518 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=518&view=rev Author: agraef Date: 2008-08-17 11:25:34 +0000 (Sun, 17 Aug 2008) Log Message: ----------- Revised list-of-tuple syntax. Modified Paths: -------------- pure/trunk/ChangeLog pure/trunk/expr.cc pure/trunk/expr.hh pure/trunk/interpreter.cc pure/trunk/parser.yy pure/trunk/printer.cc pure/trunk/test/test015.log Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-08-17 09:51:09 UTC (rev 517) +++ pure/trunk/ChangeLog 2008-08-17 11:25:34 UTC (rev 518) @@ -1,5 +1,9 @@ 2008-08-17 Albert Graef <Dr....@t-...> + * parser.yy, printer.cc et al: Revised list-of-tuples syntax. In + order to include a tuple in a proper list value you can simply put + the tuple inside parentheses now. + * parser.yy, lexer.ll: Revised 'using' syntax so that script names are now separated with a comma. Updated library and sample scripts accordingly. Modified: pure/trunk/expr.cc =================================================================== --- pure/trunk/expr.cc 2008-08-17 09:51:09 UTC (rev 517) +++ pure/trunk/expr.cc 2008-08-17 11:25:34 UTC (rev 518) @@ -175,15 +175,6 @@ return is_nil(); } -bool expr::is_listx() const -{ - expr x, y; - if (is_cons(x, y)) - return !x.is_pair() && y.is_listx(); - else - return is_nil(); -} - bool expr::is_voidx() const { return tag() == interpreter::g_interp->symtab.void_sym().f; @@ -226,25 +217,6 @@ } } -bool expr::is_listx(exprl &xs) const -{ - expr x, y; - if (is_cons(x, y)) { - if (x.is_pair()) { - xs.clear(); - return false; - } else { - xs.push_back(x); - return y.is_listx(xs); - } - } else if (is_nil()) - return true; - else { - xs.clear(); - return false; - } -} - bool expr::is_pair(expr &x, expr &y) const { expr u, v; @@ -280,6 +252,17 @@ } } +bool expr::is_tuplexxx(exprl &xs) const +{ + expr x, y; + if (is_pair(x, y) && !(flags()&EXPR::PAREN)) + return x.is_tuplexxx(xs) && y.is_tuplexxx(xs); + else { + xs.push_back(*this); + return true; + } +} + env_info::env_info(const env_info& e) : t(e.t), temp(e.temp) { switch (t) { case none: Modified: pure/trunk/expr.hh =================================================================== --- pure/trunk/expr.hh 2008-08-17 09:51:09 UTC (rev 517) +++ pure/trunk/expr.hh 2008-08-17 11:25:34 UTC (rev 518) @@ -117,7 +117,8 @@ // special flag values used during compilation: enum { - OVF = 1, // overflowed int constant -> bigint + OVF = 1, // overflowed int constant -> bigint + PAREN = 1<<1, // parenthesized expression }; uint32_t refc; // reference counter @@ -469,9 +470,6 @@ bool is_nil() const; bool is_cons() const; bool is_list() const; - // Check for lists which don't contain tuple elements, so that they can be - // printed in standard list format. - bool is_listx() const; bool is_voidx() const; bool is_pair() const; // This is always true, as we consider a singleton as a tuple, too. Use @@ -481,12 +479,13 @@ bool is_tuplex() const; bool is_cons(expr &x, expr &y) const; bool is_list(exprl &xs) const; - bool is_listx(exprl &xs) const; bool is_pair(expr &x, expr &y) const; // Always true (see note above). Use is_pair() && istuple(xs) to test for a // "real" tuple instead. bool is_tuple(exprl &xs) const; bool is_tuplex(exprl &xs) const; + // Special check for tuples used in list construction. + bool is_tuplexxx(exprl &xs) const; }; /* Rules of the form: lhs -> rhs [if qual]. */ Modified: pure/trunk/interpreter.cc =================================================================== --- pure/trunk/interpreter.cc 2008-08-17 09:51:09 UTC (rev 517) +++ pure/trunk/interpreter.cc 2008-08-17 11:25:34 UTC (rev 518) @@ -1920,7 +1920,7 @@ { expr *u; exprl xs; - if (x->is_pair() && x->is_tuple(xs)) + if (x->is_pair() && x->is_tuplexxx(xs)) u = new expr(expr::list(xs)); else u = new expr(expr::cons(*x, expr::nil())); Modified: pure/trunk/parser.yy =================================================================== --- pure/trunk/parser.yy 2008-08-17 09:51:09 UTC (rev 517) +++ pure/trunk/parser.yy 2008-08-17 11:25:34 UTC (rev 518) @@ -515,7 +515,8 @@ | '[' expr ']' { $$ = interp.mklist_expr($2); } | '[' expr ';' comp_clauses ']' { $$ = interp.mklistcomp_expr($2, $4); } -| '(' expr ')' { $$ = $2; } +| '(' expr ')' { $$ = $2; + if ($$->is_pair()) $$->flags() |= EXPR::PAREN; } | '(' op ')' { $$ = $2; } ; Modified: pure/trunk/printer.cc =================================================================== --- pure/trunk/printer.cc 2008-08-17 09:51:09 UTC (rev 517) +++ pure/trunk/printer.cc 2008-08-17 11:25:34 UTC (rev 518) @@ -84,7 +84,7 @@ case EXPR::APP: { expr u, v, w; prec_t p; - if (x.is_listx()) + if (x.is_list()) return 100; else if (x.is_app(u, v)) if (u.tag() > 0 && (p = sym_nprec(u.tag())) < 100 && p%10 >= 3) @@ -248,11 +248,11 @@ expr u, v, w, y; exprl xs; prec_t p; - if (x.is_listx(xs)) { + if (x.is_list(xs)) { // proper list value size_t n = xs.size(); os << "["; - if (n>1) { + if (n>1 || n==1 && xs.front().is_pair()) { // list elements at a precedence not larger than ',' have to be // parenthesized p = sym_nprec(interpreter::g_interp->symtab.pair_sym().f) + 1; @@ -528,8 +528,7 @@ static bool pure_is_cons(const pure_expr *x) { if (x->tag == EXPR::APP && x->data.x[0]->tag == EXPR::APP) - return - x->data.x[0]->data.x[0]->tag == interpreter::g_interp->symtab.cons_sym().f; + return x->data.x[0]->data.x[0]->tag == interpreter::g_interp->symtab.cons_sym().f; else return false; } @@ -537,8 +536,7 @@ static bool pure_is_pair(const pure_expr *x) { if (x->tag == EXPR::APP && x->data.x[0]->tag == EXPR::APP) - return - x->data.x[0]->data.x[0]->tag == interpreter::g_interp->symtab.pair_sym().f; + return x->data.x[0]->data.x[0]->tag == interpreter::g_interp->symtab.pair_sym().f; else return false; } @@ -546,22 +544,16 @@ static bool pure_is_list(const pure_expr *x) { while (pure_is_cons(x)) - if (pure_is_pair(x->data.x[0]->data.x[1])) - return false; - else - x = x->data.x[1]; + x = x->data.x[1]; return pure_is_nil(x); } static bool pure_is_list(const pure_expr *x, list<const pure_expr*>& xs) { - while (pure_is_cons(x)) - if (pure_is_pair(x->data.x[0]->data.x[1])) - return false; - else { - xs.push_back(x->data.x[0]->data.x[1]); - x = x->data.x[1]; - } + while (pure_is_cons(x)) { + xs.push_back(x->data.x[0]->data.x[1]); + x = x->data.x[1]; + } return pure_is_nil(x); } @@ -681,7 +673,7 @@ // proper list value size_t n = xs.size(); os << "["; - if (n>1) { + if (n>1 || n==1 && pure_is_pair(xs.front())) { // list elements at a precedence not larger than ',' have to be // parenthesized p = sym_nprec(interpreter::g_interp->symtab.pair_sym().f) + 1; Modified: pure/trunk/test/test015.log =================================================================== --- pure/trunk/test/test015.log 2008-08-17 09:51:09 UTC (rev 517) +++ pure/trunk/test/test015.log 2008-08-17 11:25:34 UTC (rev 518) @@ -196,25 +196,25 @@ state 1: #0 }) (11..20)); { - rule #0: c = hdict$zipwith (=>) (catmap (\i -> (i,double i,str i):[]) (1..10)) (1..10) + rule #0: c = hdict$zipwith (=>) (catmap (\i -> [(i,double i,str i)]) (1..10)) (1..10) state 0: #0 <var> state 1 state 1: #0 } -let c = hdict$zipwith (=>) (catmap (\i/*0:*/ -> (i/*0:*/,double i/*0:*/,str i/*0:*/):[] { - rule #0: i = (i,double i,str i):[] +let c = hdict$zipwith (=>) (catmap (\i/*0:*/ -> [(i/*0:*/,double i/*0:*/,str i/*0:*/)] { + rule #0: i = [(i,double i,str i)] state 0: #0 <var> state 1 state 1: #0 }) (1..10)) (1..10); { - rule #0: d = hdict$zipwith (=>) (catmap (\i -> (i,double i,str i):[]) (11..20)) (11..20) + rule #0: d = hdict$zipwith (=>) (catmap (\i -> [(i,double i,str i)]) (11..20)) (11..20) state 0: #0 <var> state 1 state 1: #0 } -let d = hdict$zipwith (=>) (catmap (\i/*0:*/ -> (i/*0:*/,double i/*0:*/,str i/*0:*/):[] { - rule #0: i = (i,double i,str i):[] +let d = hdict$zipwith (=>) (catmap (\i/*0:*/ -> [(i/*0:*/,double i/*0:*/,str i/*0:*/)] { + rule #0: i = [(i,double i,str i)] state 0: #0 <var> state 1 state 1: #0 @@ -238,8 +238,8 @@ Dict (bin "4" "4" 0 (bin "2" "2" 1 (bin "1" "1" (-1) nil (bin "10" "10" 0 nil nil)) (bin "3" "3" 0 nil nil)) (bin "6" "6" (-1) (bin "5" "5" 0 nil nil) (bin "8" "8" 0 (bin "7" "7" 0 nil nil) (bin "9" "9" 0 nil nil)))) mkdict 1000 (1..10); Dict (bin 4 1000 (-1) (bin 2 1000 0 (bin 1 1000 0 nil nil) (bin 3 1000 0 nil nil)) (bin 8 1000 0 (bin 6 1000 0 (bin 5 1000 0 nil nil) (bin 7 1000 0 nil nil)) (bin 9 1000 (-1) nil (bin 10 1000 0 nil nil)))) -mkhdict 1000 (catmap (\i/*0:*/ -> (i/*0:*/,double i/*0:*/,str i/*0:*/):[] { - rule #0: i = (i,double i,str i):[] +mkhdict 1000 (catmap (\i/*0:*/ -> [(i/*0:*/,double i/*0:*/,str i/*0:*/)] { + rule #0: i = [(i,double i,str i)] state 0: #0 <var> state 1 state 1: #0 @@ -297,8 +297,8 @@ <stdin>:166.39-59: unhandled exception 'out_of_bounds' while evaluating 'c!(50,50.0,"50")' a!!(5..15); [5.0,6.0,7.0,8.0,9.0,10.0] -c!!catmap (\i/*0:*/ -> (i/*0:*/,double i/*0:*/,str i/*0:*/):[] { - rule #0: i = (i,double i,str i):[] +c!!catmap (\i/*0:*/ -> [(i/*0:*/,double i/*0:*/,str i/*0:*/)] { + rule #0: i = [(i,double i,str i)] state 0: #0 <var> state 1 state 1: #0 @@ -311,7 +311,7 @@ keys a; [1,2,3,4,5,6,7,8,9,10] keys c; -(1,1.0,"1"):(2,2.0,"2"):(3,3.0,"3"):(4,4.0,"4"):(5,5.0,"5"):(6,6.0,"6"):(7,7.0,"7"):(8,8.0,"8"):(9,9.0,"9"):(10,10.0,"10"):[] +[(1,1.0,"1"),(2,2.0,"2"),(3,3.0,"3"),(4,4.0,"4"),(5,5.0,"5"),(6,6.0,"6"),(7,7.0,"7"),(8,8.0,"8"),(9,9.0,"9"),(10,10.0,"10")] vals a; [1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0] vals c; @@ -328,8 +328,8 @@ Dict nil delete a 5000; Dict (bin 4 4.0 (-1) (bin 2 2.0 0 (bin 1 1.0 0 nil nil) (bin 3 3.0 0 nil nil)) (bin 8 8.0 0 (bin 6 6.0 0 (bin 5 5.0 0 nil nil) (bin 7 7.0 0 nil nil)) (bin 9 9.0 (-1) nil (bin 10 10.0 0 nil nil)))) -foldl delete c (catmap (\i/*0:*/ -> (i/*0:*/,double i/*0:*/,str i/*0:*/):[] { - rule #0: i = (i,double i,str i):[] +foldl delete c (catmap (\i/*0:*/ -> [(i/*0:*/,double i/*0:*/,str i/*0:*/)] { + rule #0: i = [(i,double i,str i)] state 0: #0 <var> state 1 state 1: #0 @@ -519,13 +519,13 @@ <stdin>:292.24-36: unhandled exception 'out_of_bounds' while evaluating 'c!(20,30)' a!!(5..15); [6,7,8,9,10] -c!!catmap (\i/*0:*/ -> catmap (\j/*0:*/ -> (i/*1:*/,j/*0:*/):[] { - rule #0: j = (i,j):[] +c!!catmap (\i/*0:*/ -> catmap (\j/*0:*/ -> [(i/*1:*/,j/*0:*/)] { + rule #0: j = [(i,j)] state 0: #0 <var> state 1 state 1: #0 }) (3..15) { - rule #0: i = catmap (\j -> (i,j):[]) (3..15) + rule #0: i = catmap (\j -> [(i,j)]) (3..15) state 0: #0 <var> state 1 state 1: #0 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-08-17 11:39:51
|
Revision: 519 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=519&view=rev Author: agraef Date: 2008-08-17 11:40:00 +0000 (Sun, 17 Aug 2008) Log Message: ----------- Cosmetic changes. Modified Paths: -------------- pure/trunk/expr.cc pure/trunk/expr.hh pure/trunk/interpreter.cc Modified: pure/trunk/expr.cc =================================================================== --- pure/trunk/expr.cc 2008-08-17 11:25:34 UTC (rev 518) +++ pure/trunk/expr.cc 2008-08-17 11:40:00 UTC (rev 519) @@ -252,11 +252,11 @@ } } -bool expr::is_tuplexxx(exprl &xs) const +bool expr::is_tuplel(exprl &xs) const { expr x, y; if (is_pair(x, y) && !(flags()&EXPR::PAREN)) - return x.is_tuplexxx(xs) && y.is_tuplexxx(xs); + return x.is_tuplel(xs) && y.is_tuplel(xs); else { xs.push_back(*this); return true; Modified: pure/trunk/expr.hh =================================================================== --- pure/trunk/expr.hh 2008-08-17 11:25:34 UTC (rev 518) +++ pure/trunk/expr.hh 2008-08-17 11:40:00 UTC (rev 519) @@ -483,9 +483,10 @@ // Always true (see note above). Use is_pair() && istuple(xs) to test for a // "real" tuple instead. bool is_tuple(exprl &xs) const; + // Check for proper (normalized) tuples. bool is_tuplex(exprl &xs) const; // Special check for tuples used in list construction. - bool is_tuplexxx(exprl &xs) const; + bool is_tuplel(exprl &xs) const; }; /* Rules of the form: lhs -> rhs [if qual]. */ Modified: pure/trunk/interpreter.cc =================================================================== --- pure/trunk/interpreter.cc 2008-08-17 11:25:34 UTC (rev 518) +++ pure/trunk/interpreter.cc 2008-08-17 11:40:00 UTC (rev 519) @@ -1920,7 +1920,7 @@ { expr *u; exprl xs; - if (x->is_pair() && x->is_tuplexxx(xs)) + if (x->is_pair() && x->is_tuplel(xs)) u = new expr(expr::list(xs)); else u = new expr(expr::cons(*x, expr::nil())); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-08-17 21:10:01
|
Revision: 524 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=524&view=rev Author: agraef Date: 2008-08-17 21:10:10 +0000 (Sun, 17 Aug 2008) Log Message: ----------- Overhaul of the script and library search algorithms. Modified Paths: -------------- pure/trunk/ChangeLog pure/trunk/interpreter.cc pure/trunk/interpreter.hh pure/trunk/pure.cc pure/trunk/runtime.cc Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-08-17 20:50:56 UTC (rev 523) +++ pure/trunk/ChangeLog 2008-08-17 21:10:10 UTC (rev 524) @@ -1,5 +1,61 @@ 2008-08-17 Albert Graef <Dr....@t-...> + * pure.cc, interpreter.cc/h, runtime.cc: Overhaul of the script + and library search algorithms. + + The prelude is now *always* searched for in PURELIB only, to + prevent code injection issues. Thus to use a custom prelude you'll + have to set the PURELIB environment variable accordingly, or + employ the '-n' option and explicitly specify the prelude on the + command line. + + Scripts specified on the command line or with the 'run' command + will *only* be searched for in the current directory. + + In addition to the PURELIB environment variable, new -I/-L command + line options and PURE_INCLUDE/PURE_LIBRARY environment variables + are now available to specify additional directories to search for + source files and dynamic libraries specified using relative + pathnames in 'using' clauses. + + For source scripts opened with a 'using' clause, the interpreter + searches the following directories in the given order: + + - the directory of the script containing the 'using' clause (or + the current working directory if the 'using' clause is read from + standard input), + + - directories specified with -I, in the order in which they are + specified on the command line, + + - directories specified in colon-separated format in the + PURE_INCLUDE variable, in the order in which they are specified, + + - the PURELIB directory. + + Similarly, dynamic libraries are searched for in: + + - the directory of the script containing the 'using' clause (or + the current working directory if the 'using' clause is read from + standard input), + + - directories specified with -L, in the order in which they are + specified on the command line, + + - directories specified in colon-separated format in the + PURE_LIBRARY variable, in the order in which they are specified, + + - the PURELIB directory, + + - other platform-specific locations searched by the dynamic + linker, such as system library directories and LD_LIBRARY_PATH on + Linux. + + Note that in either case the current working directory is *not* + searched by default (unless the 'using' clause is read from + standard input), but of course you can force this by adding '.' to + the corresponding search path. + * parser.yy, printer.cc et al: Revised list-of-tuples syntax. In order to include a tuple in a proper list value you can simply put the tuple inside parentheses now. Modified: pure/trunk/interpreter.cc =================================================================== --- pure/trunk/interpreter.cc 2008-08-17 20:50:56 UTC (rev 523) +++ pure/trunk/interpreter.cc 2008-08-17 21:10:10 UTC (rev 524) @@ -58,7 +58,7 @@ interpreter::interpreter() : verbose(0), interactive(false), ttymode(false), override(false), stats(false), temp(0), - ps("> "), lib(""), histfile("/.pure_history"), modname("pure"), + ps("> "), libdir(""), histfile("/.pure_history"), modname("pure"), nerrs(0), source_s(0), result(0), mem(0), exps(0), tmps(0), module(0), JIT(0), FPM(0), fptr(0) { @@ -434,7 +434,8 @@ #define BUFSIZE 1024 static string searchdir(const string& srcdir, const string& libdir, - const string& script) + const list<string>& include_dirs, + const string& script, bool search = true) { char cwd[BUFSIZE]; if (script.empty()) @@ -449,23 +450,23 @@ string fname; if (script[0] != '/') { // resolve relative pathname - if (srcdir.empty()) { + if (!search) { fname = workdir+script; if (chkfile(fname)) goto found; - if (!libdir.empty()) { - fname = libdir+script; - if (chkfile(fname)) goto found; - } fname = script; } else { - fname = srcdir+script; + fname = (srcdir.empty()?workdir:srcdir)+script; if (chkfile(fname)) goto found; + for (list<string>::const_iterator dir = include_dirs.begin(), + end = include_dirs.end(); dir != end; dir++) + if (!dir->empty()) { + fname = *dir+script; + if (chkfile(fname)) goto found; + } if (!libdir.empty()) { fname = libdir+script; if (chkfile(fname)) goto found; } - fname = workdir+script; - if (chkfile(fname)) goto found; fname = script; } } else @@ -505,6 +506,53 @@ return fname; } +/* Library search. */ + +static string searchlib(const string& srcdir, const string& libdir, + const list<string>& library_dirs, + const string& lib, bool search = true) +{ + char cwd[BUFSIZE]; + if (lib.empty()) + return lib; + else if (!getcwd(cwd, BUFSIZE)) { + perror("getcwd"); + return lib; + } + string workdir = cwd; + if (!workdir.empty() && workdir[workdir.size()-1] != '/') + workdir += "/"; + string fname; + if (lib[0] != '/') { + // resolve relative pathname + if (!search) { + fname = workdir+lib; + if (chkfile(fname)) goto found; + fname = lib; + } else { + fname = (srcdir.empty()?workdir:srcdir)+lib; + if (chkfile(fname)) goto found; + for (list<string>::const_iterator dir = library_dirs.begin(), + end = library_dirs.end(); dir != end; dir++) + if (!dir->empty()) { + fname = *dir+lib; + if (chkfile(fname)) goto found; + } + if (!libdir.empty()) { + fname = libdir+lib; + if (chkfile(fname)) goto found; + } + fname = lib; + } + } else + fname = lib; + found: +#if DEBUG>1 + std::cerr << "search '" << lib << "', found as '" << fname << "'\n"; +#endif + return fname; +} + // Run the interpreter on a source file, collection of source files, or on // string data. @@ -523,17 +571,19 @@ if (name.substr(name.size()-strlen(DLLEXT)) != DLLEXT) dllname += DLLEXT; // First try to open the library under the given name. - if (!llvm::sys::DynamicLibrary::LoadLibraryPermanently(name.c_str(), &msg)) + string aname = searchlib(srcdir, libdir, librarydirs, name); + if (!llvm::sys::DynamicLibrary::LoadLibraryPermanently(aname.c_str(), &msg)) return 0; else if (dllname == name) throw err(msg); + aname = searchlib(srcdir, libdir, librarydirs, dllname); // Now try the name with DLLEXT added. - else if (llvm::sys::DynamicLibrary::LoadLibraryPermanently(dllname.c_str(), &msg)) + if (llvm::sys::DynamicLibrary::LoadLibraryPermanently(aname.c_str(), &msg)) throw err(msg); return 0; } // ordinary source file - string fname = searchdir(srcdir, lib, s); + string fname = searchdir(srcdir, libdir, includedirs, s, check); if (check && sources.find(fname) != sources.end()) // already loaded, skip return 0; Modified: pure/trunk/interpreter.hh =================================================================== --- pure/trunk/interpreter.hh 2008-08-17 20:50:56 UTC (rev 523) +++ pure/trunk/interpreter.hh 2008-08-17 21:10:10 UTC (rev 524) @@ -313,10 +313,13 @@ bool stats; // stats mode (print execution times) uint8_t temp; // temporary level (purgable definitions) string ps; // prompt string - string lib; // library dir to search for source files + string libdir; // library dir to search for source files string histfile; // command history file string modname; // name of output (LLVM) module + // Additional directories to search for sources and libraries. + list<string> includedirs, librarydirs; + // Interpreter state. For internal use only. int nerrs; // current error count string errmsg; // last reported error (runstr) @@ -338,12 +341,14 @@ *************************************************************************/ /* Parse and execute the given source file (stdin if empty), or the given - list of files. If check is true (the default), only load the script if it - wasn't included before. Returns the last computed expression (if any). - (This expression is owned by the interpreter and must *not* be freed by - the caller.) This is the main interface function. If interactive is - true, readline is used to get interactive input from the user, using ps - as the prompt string. Please note that due to some global data shared by + list of files. If check is true (the default), a full search is performed + for relative pathnames (checking include directories and PURELIB to + locate the script file) and the script is only loaded if it wasn't + included before. Returns the last computed expression (if any). (This + expression is owned by the interpreter and must *not* be freed by the + caller.) This is the main interface function. If interactive is true, + readline is used to get interactive input from the user, using ps as the + prompt string. Please note that due to some global data shared by different interpreter instances, you can't run two interpreters concurrently right now. (It is possible to run them sequentially, though.) */ Modified: pure/trunk/pure.cc =================================================================== --- pure/trunk/pure.cc 2008-08-17 20:50:56 UTC (rev 523) +++ pure/trunk/pure.cc 2008-08-17 21:10:10 UTC (rev 524) @@ -36,16 +36,20 @@ pure [-h] [-i] [-n] [-q] [-v[level]] -x script [args ...]\n\ -h: Print this message and exit.\n\ -i: Force interactive mode (read commands from stdin).\n\ +-I: Add directory to search for included source files.\n\ +-L: Add directory to search for dynamic libraries.\n\ -n: Suppress automatic inclusion of the prelude.\n\ -q: Quiet startup (suppresses sign-on message).\n\ -v: Set verbosity level (useful for debugging purposes).\n\ -x: Execute script with given command line arguments.\n\ --: Stop option processing, pass remaining args in argv variable.\n\ Environment:\n\ -PURELIB: Directory to search for source scripts including the prelude.\n\ -PURE_MORE: Shell command for paging through output of the 'list' command.\n\ -PURE_PS: Command prompt to be used in the interactive command loop.\n\ -PURE_STACK: Maximum stack size in kilobytes (default: 0 = unlimited).\n" +PURELIB: Directory to search for library scripts and the prelude.\n\ +PURE_INCLUDE: Path to search for included source files.\n\ +PURE_LIBRARY: Path to search for dynamic libraries.\n\ +PURE_MORE: Shell command for paging through output of the 'list' command.\n\ +PURE_PS: Command prompt to be used in the interactive command loop.\n\ +PURE_STACK: Maximum stack size in kilobytes (default: 0 = unlimited).\n" #define LICENSE "This program is free software distributed under the GNU Public License\n(GPL V3 or later). Please see the COPYING file for details.\n" static const char *commands[] = { @@ -182,6 +186,26 @@ return !stat(s.c_str(), &st) && !S_ISDIR(st.st_mode); } +static void add_path(list<string>& dirs, const string& path) +{ + size_t pos = 0; + while (pos != string::npos) { + size_t end = path.find(':', pos); + string s; + if (end == string::npos) { + s = path.substr(pos); + pos = end; + } else { + s = path.substr(pos, end-pos); + pos = end+1; + } + if (!s.empty()) { + if (s[s.size()-1] != '/') s.append("/"); + dirs.push_back(s); + } + } +} + int main(int argc, char *argv[]) { @@ -234,11 +258,13 @@ size_t n = strtoul(env, &end, 0); if (!*end) interpreter::stackmax = n*1024; } - if ((env = getenv("PURELIB"))) - interp.lib = string(env)+"/"; - else - interp.lib = string(PURELIB)+"/"; - string prelude = interp.lib+string("prelude.pure"); + if ((env = getenv("PURELIB"))) { + string s = env; + if (!s.empty() && s[s.size()-1] != '/') s.append("/"); + interp.libdir = s; + } else + interp.libdir = string(PURELIB)+"/"; + string prelude = interp.libdir+string("prelude.pure"); #if USE_FASTCC // This global option is needed to get tail call optimization (you'll also // need to have USE_FASTCC in interpreter.hh enabled). @@ -258,8 +284,34 @@ want_prelude = false; else if (*args == string("-q")) quiet = true; - else if (string(*args).substr(0,2) == "-v") { + else if (string(*args).substr(0,2) == "-I") { string s = string(*args).substr(2); + if (s.empty()) { + if (!*++args) { + interp.error(prog + ": -I lacks directory argument"); + return 1; + } + s = *args; + } + if (!s.empty()) { + if (s[s.size()-1] != '/') s.append("/"); + interp.includedirs.push_back(s); + } + } else if (string(*args).substr(0,2) == "-L") { + string s = string(*args).substr(2); + if (s.empty()) { + if (!*++args) { + interp.error(prog + ": -L lacks directory argument"); + return 1; + } + s = *args; + } + if (!s.empty()) { + if (s[s.size()-1] != '/') s.append("/"); + interp.librarydirs.push_back(s); + } + } else if (string(*args).substr(0,2) == "-v") { + string s = string(*args).substr(2); if (s.empty()) continue; char *end; strtoul(s.c_str(), &end, 0); @@ -277,16 +329,14 @@ interp.error(prog + ": invalid option " + *args); return 1; } + if ((env = getenv("PURE_INCLUDE"))) add_path(interp.includedirs, env); + if ((env = getenv("PURE_LIBRARY"))) add_path(interp.librarydirs, env); interp.init_sys_vars(PACKAGE_VERSION, HOST, myargs); if (want_prelude) { // load the prelude if we can find it - if (chkfile("prelude.pure")) { - prelude = "prelude.pure"; + if (chkfile(prelude)) { have_prelude = true; - } else if (chkfile(prelude)) // try again in the PURELIB directory - have_prelude = true; - if (have_prelude) { - interp.run(prelude); + interp.run(prelude, false); interp.compile(); } } @@ -300,7 +350,7 @@ } else if (*argv == string("-x")) { if (*++argv) { count++; interp.modname = *argv; - interp.run(*argv); + interp.run(*argv, false); } else { interp.error(prog + ": missing script name"); return 1; @@ -308,11 +358,15 @@ break; } else if (*argv == string("--")) break; - else if (**argv == '-') + else if (string(*argv).substr(0,2) == "-I" || + string(*argv).substr(0,2) == "-L") { + string s = string(*argv).substr(2); + if (s.empty()) ++argv; + } else if (**argv == '-') ; else if (**argv) { if (count++ == 0) interp.modname = *argv; - interp.run(*argv); + interp.run(*argv, false); } if (count > 0 && !force_interactive) { if (interp.verbose&verbosity::dump) interp.compile(); @@ -345,7 +399,7 @@ histfile = strdup(interp.histfile.c_str()); } interp.temp = 1; - interp.run(""); + interp.run("", false); if (interp.ttymode) cout << endl; return 0; } Modified: pure/trunk/runtime.cc =================================================================== --- pure/trunk/runtime.cc 2008-08-17 20:50:56 UTC (rev 523) +++ pure/trunk/runtime.cc 2008-08-17 21:10:10 UTC (rev 524) @@ -879,6 +879,35 @@ #include <llvm/Target/TargetOptions.h> +#include <sys/types.h> +#include <sys/stat.h> + +static inline bool chkfile(const string& s) +{ + struct stat st; + return !stat(s.c_str(), &st) && !S_ISDIR(st.st_mode); +} + +static void add_path(list<string>& dirs, const string& path) +{ + size_t pos = 0; + while (pos != string::npos) { + size_t end = path.find(':', pos); + string s; + if (end == string::npos) { + s = path.substr(pos); + pos = end; + } else { + s = path.substr(pos, end-pos); + pos = end+1; + } + if (!s.empty()) { + if (s[s.size()-1] != '/') s.append("/"); + dirs.push_back(s); + } + } +} + extern "C" pure_interp *pure_create_interp(int argc, char *argv[]) { @@ -901,11 +930,13 @@ size_t n = strtoul(env, &end, 0); if (!*end) interpreter::stackmax = n*1024; } - if ((env = getenv("PURELIB"))) - interp.lib = string(env)+"/"; - else - interp.lib = string(PURELIB)+"/"; - string prelude = interp.lib+string("prelude.pure"); + if ((env = getenv("PURELIB"))) { + string s = env; + if (!s.empty() && s[s.size()-1] != '/') s.append("/"); + interp.libdir = s; + } else + interp.libdir = string(PURELIB)+"/"; + string prelude = interp.libdir+string("prelude.pure"); #if USE_FASTCC // This global option is needed to get tail call optimization (you'll also // need to have USE_FASTCC in interpreter.hh enabled). @@ -922,8 +953,36 @@ want_prelude = false; else if (*args == string("-q")) /* ignored */; - else if (string(*args).substr(0,2) == "-v") { + else if (string(*args).substr(0,2) == "-I") { string s = string(*args).substr(2); + if (s.empty()) { + if (!*++args) { + cerr << "pure_create_interp: -I lacks directory argument\n"; + delete _interp; + return 0; + } + s = *args; + } + if (!s.empty()) { + if (s[s.size()-1] != '/') s.append("/"); + interp.includedirs.push_back(s); + } + } else if (string(*args).substr(0,2) == "-L") { + string s = string(*args).substr(2); + if (s.empty()) { + if (!*++args) { + cerr << "pure_create_interp: -L lacks directory argument\n"; + delete _interp; + return 0; + } + s = *args; + } + if (!s.empty()) { + if (s[s.size()-1] != '/') s.append("/"); + interp.librarydirs.push_back(s); + } + } else if (string(*args).substr(0,2) == "-v") { + string s = string(*args).substr(2); if (s.empty()) continue; char *end; strtoul(s.c_str(), &end, 0); @@ -943,19 +1002,14 @@ delete _interp; return 0; } + if ((env = getenv("PURE_INCLUDE"))) add_path(interp.includedirs, env); + if ((env = getenv("PURE_LIBRARY"))) add_path(interp.librarydirs, env); interp.init_sys_vars(PACKAGE_VERSION, HOST, myargs); if (want_prelude) { // load the prelude if we can find it - FILE *fp = fopen("prelude.pure", "r"); - if (fp) - prelude = "prelude.pure"; - else - // try again in the PURELIB directory - fp = fopen(prelude.c_str(), "r"); - if (fp) { - fclose(fp); + if (chkfile(prelude)) { have_prelude = true; - interp.run(prelude); + interp.run(prelude, false); interp.compile(); } } @@ -969,7 +1023,7 @@ } else if (*argv == string("-x")) { if (*++argv) { count++; interp.modname = *argv; - interp.run(*argv); + interp.run(*argv, false); } else { cerr << "pure_create_interp: missing script name\n"; delete _interp; @@ -978,11 +1032,15 @@ break; } else if (*argv == string("--")) break; - else if (**argv == '-') + else if (string(*argv).substr(0,2) == "-I" || + string(*argv).substr(0,2) == "-L") { + string s = string(*argv).substr(2); + if (s.empty()) ++argv; + } else if (**argv == '-') ; else if (**argv) { if (count++ == 0) interp.modname = *argv; - interp.run(*argv); + interp.run(*argv, false); } interp.symtab.init_builtins(); return (pure_interp*)_interp; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-08-18 07:02:34
|
Revision: 527 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=527&view=rev Author: agraef Date: 2008-08-18 07:02:41 +0000 (Mon, 18 Aug 2008) Log Message: ----------- Add tail-recursive sequence operator. Modified Paths: -------------- pure/trunk/ChangeLog pure/trunk/interpreter.cc pure/trunk/lib/prelude.pure pure/trunk/lib/primitives.pure pure/trunk/symtable.cc pure/trunk/symtable.hh Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-08-17 22:56:36 UTC (rev 526) +++ pure/trunk/ChangeLog 2008-08-18 07:02:41 UTC (rev 527) @@ -1,3 +1,11 @@ +2008-08-18 Albert Graef <Dr....@t-...> + + * interpreter.cc (codegen): Generate tail-recursive code for + sequence operator. + + * lib/prelude.pure, lib/primitives.pure: Definition of $$ sequence + operator. + 2008-08-17 Albert Graef <Dr....@t-...> * pure.cc, interpreter.cc/h, runtime.cc: Overhaul of the script Modified: pure/trunk/interpreter.cc =================================================================== --- pure/trunk/interpreter.cc 2008-08-17 22:56:36 UTC (rev 526) +++ pure/trunk/interpreter.cc 2008-08-18 07:02:41 UTC (rev 527) @@ -4233,7 +4233,12 @@ (v = funcall(e, n, x))) // recursive call to a global function return v; - else if (n == 2 && f.tag() == symtab.catch_sym().f) { + else if (n == 2 && f.ftag() == symtab.seq_sym().f) { + // sequence operator + Value *u = codegen(x.xval1().xval2()); + act_builder().CreateCall(module->getFunction("pure_freenew"), u); + return codegen(x.xval2()); + } else if (n == 2 && f.tag() == symtab.catch_sym().f) { // catch an exception; create a little anonymous closure to be called // through pure_catch() expr h = x.xval1().xval2(), y = x.xval2(); Modified: pure/trunk/lib/prelude.pure =================================================================== --- pure/trunk/lib/prelude.pure 2008-08-17 22:56:36 UTC (rev 526) +++ pure/trunk/lib/prelude.pure 2008-08-18 07:02:41 UTC (rev 527) @@ -45,6 +45,7 @@ /* Operators. Note that the parser will automagically give unary minus the same precedence level as the corresponding binary operator. */ +infixl 0 $$ ; // sequence operator infixr 0 $ ; // right-associative application infixr 1 , ; // pair (tuple) infix 2 => ; // mapsto constructor Modified: pure/trunk/lib/primitives.pure =================================================================== --- pure/trunk/lib/primitives.pure 2008-08-17 22:56:36 UTC (rev 526) +++ pure/trunk/lib/primitives.pure 2008-08-18 07:02:41 UTC (rev 527) @@ -201,12 +201,14 @@ x::double==y::int = x==y; x::double!=y::int = x!=y; -/* Logical connectives. Please note that these will be short-circuited only as - explicit calls! But we still want them to work if they are applied - partially, so we add these rules here. */ +/* Logical connectives and sequences. Please note that these enjoy + call-by-name and short-circuit evaluation only as explicit calls! But we + still want them to work if they are applied partially, so we add these + rules here. */ x::int&&y::int = x&&y; x::int||y::int = x||y; +x$$y = y; /* Bigint arithmetic. */ Modified: pure/trunk/symtable.cc =================================================================== --- pure/trunk/symtable.cc 2008-08-17 22:56:36 UTC (rev 526) +++ pure/trunk/symtable.cc 2008-08-18 07:02:41 UTC (rev 527) @@ -120,6 +120,15 @@ return sym(",", 1, infixr); } +symbol& symtable::seq_sym() +{ + symbol *_sym = lookup("$$"); + if (_sym) + return *_sym; + else + return sym("$$", 0, infixl); +} + symbol& symtable::not_sym() { symbol *_sym = lookup("not"); Modified: pure/trunk/symtable.hh =================================================================== --- pure/trunk/symtable.hh 2008-08-17 22:56:36 UTC (rev 526) +++ pure/trunk/symtable.hh 2008-08-18 07:02:41 UTC (rev 527) @@ -49,6 +49,7 @@ symbol& cons_sym(); symbol& void_sym(); symbol& pair_sym(); + symbol& seq_sym(); symbol& neg_sym() { return sym("neg"); } symbol& not_sym(); symbol& bitnot_sym(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-08-19 06:23:42
|
Revision: 536 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=536&view=rev Author: agraef Date: 2008-08-19 06:23:50 +0000 (Tue, 19 Aug 2008) Log Message: ----------- Add a stack check to 'def' constant conversion. Modified Paths: -------------- pure/trunk/interpreter.cc pure/trunk/interpreter.hh Modified: pure/trunk/interpreter.cc =================================================================== --- pure/trunk/interpreter.cc 2008-08-18 23:38:38 UTC (rev 535) +++ pure/trunk/interpreter.cc 2008-08-19 06:23:50 UTC (rev 536) @@ -788,9 +788,11 @@ return res; } -static expr pure_expr_to_expr(pure_expr *x) +expr interpreter::pure_expr_to_expr(pure_expr *x) { - // FIXME: We might want to do stack checks here. + char test; + if (stackmax > 0 && stackdir*(&test - baseptr) >= stackmax) + throw err("expression too deep in constant definition"); switch (x->tag) { case EXPR::APP: return expr(pure_expr_to_expr(x->data.x[0]), Modified: pure/trunk/interpreter.hh =================================================================== --- pure/trunk/interpreter.hh 2008-08-18 23:38:38 UTC (rev 535) +++ pure/trunk/interpreter.hh 2008-08-19 06:23:50 UTC (rev 536) @@ -504,6 +504,7 @@ Builder& act_builder() { return act_env().builder; } pure_expr *const_value(expr x); pure_expr *const_app_value(expr x); + expr pure_expr_to_expr(pure_expr *x); pure_expr *doeval(expr x, pure_expr*& e); pure_expr *dodefn(env vars, expr lhs, expr rhs, pure_expr*& e); llvm::Value *codegen(expr x); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-08-19 07:12:47
|
Revision: 538 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=538&view=rev Author: agraef Date: 2008-08-19 07:12:56 +0000 (Tue, 19 Aug 2008) Log Message: ----------- Renamed the const combinator to cst. Modified Paths: -------------- pure/trunk/lib/prelude.pure pure/trunk/test/prelude.log Modified: pure/trunk/lib/prelude.pure =================================================================== --- pure/trunk/lib/prelude.pure 2008-08-19 06:57:19 UTC (rev 537) +++ pure/trunk/lib/prelude.pure 2008-08-19 07:12:56 UTC (rev 538) @@ -82,7 +82,7 @@ void _ = (); id x = x; -const x y = x; +cst x y = x; flip f x y = f y x; curry f x y = f (x,y); Modified: pure/trunk/test/prelude.log =================================================================== --- pure/trunk/test/prelude.log 2008-08-19 06:57:19 UTC (rev 537) +++ pure/trunk/test/prelude.log 2008-08-19 07:12:56 UTC (rev 538) @@ -4,7 +4,7 @@ (f/*0:001*/.g/*0:01*/) x/*0:1*/ = f/*0:001*/ (g/*0:01*/ x/*0:1*/); void _/*0:1*/ = (); id x/*0:1*/ = x/*0:1*/; -const x/*0:01*/ y/*0:1*/ = x/*0:01*/; +cst x/*0:01*/ y/*0:1*/ = x/*0:01*/; flip f/*0:001*/ x/*0:01*/ y/*0:1*/ = f/*0:001*/ y/*0:1*/ x/*0:01*/; curry f/*0:001*/ x/*0:01*/ y/*0:1*/ = f/*0:001*/ (x/*0:01*/,y/*0:1*/); curry3 f/*0:0001*/ x/*0:001*/ y/*0:01*/ z/*0:1*/ = f/*0:0001*/ (x/*0:001*/,y/*0:01*/,z/*0:1*/); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-08-19 08:01:13
|
Revision: 539 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=539&view=rev Author: agraef Date: 2008-08-19 08:01:20 +0000 (Tue, 19 Aug 2008) Log Message: ----------- Renamed the 'def' keyword to 'const'. Modified Paths: -------------- pure/trunk/ChangeLog pure/trunk/etc/pure-mode.el.in pure/trunk/etc/pure.lang pure/trunk/etc/pure.vim pure/trunk/etc/pure.xml pure/trunk/examples/hello.pure pure/trunk/examples/libor/date.pure pure/trunk/interpreter.cc pure/trunk/lexer.ll pure/trunk/lib/math.pure pure/trunk/lib/prelude.pure pure/trunk/parser.yy pure/trunk/printer.cc pure/trunk/pure.cc pure/trunk/test/prelude.log pure/trunk/test/test013.log pure/trunk/test/test013.pure Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-08-19 07:12:56 UTC (rev 538) +++ pure/trunk/ChangeLog 2008-08-19 08:01:20 UTC (rev 539) @@ -1,3 +1,11 @@ +2008-08-19 Albert Graef <Dr....@t-...> + + * parser.yy, lexer.ll, printer.cc, etc.: Renamed the 'def' keyword + to 'const', as originally proposed by Eddie Rucker. ('def' is + still a reserved keyword, since it's soon going to be used for + macro definitions.) Scripts and syntax highlighting files in the + distribution have been updated accordingly. + 2008-08-18 Albert Graef <Dr....@t-...> * interpreter.cc (codegen): Generate tail-recursive code for Modified: pure/trunk/etc/pure-mode.el.in =================================================================== --- pure/trunk/etc/pure-mode.el.in 2008-08-19 07:12:56 UTC (rev 538) +++ pure/trunk/etc/pure-mode.el.in 2008-08-19 08:01:20 UTC (rev 539) @@ -164,7 +164,7 @@ ; (list "\\<\\(catch\\|throw\\)\\>" 0 'font-lock-builtin-face) (list (concat "\\<\\(" - "def\\|extern\\|infix[lr]?\\|" + "const\\|def\\|extern\\|infix[lr]?\\|" "let\\|nullary\\|p\\(refix\\|ostfix\\)\\|" "using" "\\)\\>") @@ -178,7 +178,7 @@ (list "\\<\\(catch\\|throw\\)\\>" 0 'font-lock-builtin-face) (list (concat "\\<\\(" - "case\\|def\\|e\\(lse\\|nd\\|xtern\\)\\|i\\(f\\|nfix[lr]?\\)\\|" + "case\\|const\\|def\\|e\\(lse\\|nd\\|xtern\\)\\|i\\(f\\|nfix[lr]?\\)\\|" "let\\|nullary\\|o\\(f\\|therwise\\)\\|p\\(refix\\|ostfix\\)\\|" "then\\|using\\|w\\(hen\\|ith\\)" "\\)\\>") Modified: pure/trunk/etc/pure.lang =================================================================== --- pure/trunk/etc/pure.lang 2008-08-19 07:12:56 UTC (rev 538) +++ pure/trunk/etc/pure.lang 2008-08-19 08:01:20 UTC (rev 539) @@ -4,8 +4,8 @@ $DESCRIPTION=Pure # Pure keywords. -$KW_LIST(kwa)=infix infixl infixr prefix postfix nullary case def else end -extern if let of otherwise then using when with +$KW_LIST(kwa)=infix infixl infixr prefix postfix nullary case const def else +end extern if let of otherwise then using when with # These aren't really keywords but we want them to stick out anyway. $KW_LIST(kwb)=catch throw Modified: pure/trunk/etc/pure.vim =================================================================== --- pure/trunk/etc/pure.vim 2008-08-19 07:12:56 UTC (rev 538) +++ pure/trunk/etc/pure.vim 2008-08-19 08:01:20 UTC (rev 539) @@ -33,7 +33,7 @@ " keywords syn keyword pureKeyword infix infixl infixr prefix postfix nullary -syn keyword pureKeyword case def else end extern if let of otherwise then +syn keyword pureKeyword case const def else end extern if let of otherwise then syn keyword pureKeyword using when with syn keyword pureSpecial catch throw syn keyword pureType bigint bool char short int long double Modified: pure/trunk/etc/pure.xml =================================================================== --- pure/trunk/etc/pure.xml 2008-08-19 07:12:56 UTC (rev 538) +++ pure/trunk/etc/pure.xml 2008-08-19 08:01:20 UTC (rev 539) @@ -11,6 +11,7 @@ <item> end </item> </list> <list name="keywords"> + <item> const </item> <item> def </item> <item> else </item> <item> extern </item> Modified: pure/trunk/examples/hello.pure =================================================================== --- pure/trunk/examples/hello.pure 2008-08-19 07:12:56 UTC (rev 538) +++ pure/trunk/examples/hello.pure 2008-08-19 08:01:20 UTC (rev 539) @@ -47,11 +47,11 @@ // Pattern matching definition with 'let'. let x, y = square x, square (x+2); x; y; -// We also have constant definitions using 'def' in lieu of 'let'. These -// cannot be redefined and are substituted directly into other definitions. -// Try something like 'foo x = pi*x;' and then 'list foo' to see the -// difference. -def pi = 3.14159265358979; +// We also have constant definitions using 'const' in lieu of 'let'. These +// symbols cannot be redefined and are substituted directly into other +// definitions. Try something like 'foo x = pi*x;' and then 'list foo' to see +// the difference. +const pi = 3.14159265358979; /* Variations on a theme: The factorial. This illustrates various different ways to define a simple recursive function. */ Modified: pure/trunk/examples/libor/date.pure =================================================================== --- pure/trunk/examples/libor/date.pure 2008-08-19 07:12:56 UTC (rev 538) +++ pure/trunk/examples/libor/date.pure 2008-08-19 08:01:20 UTC (rev 539) @@ -12,18 +12,18 @@ // diytime = c_time (pointer 0); // some constants in whole days -def mdayposix = 1856305;// Mayan day for the posix epoch 1 Jan 1970 -def jdayposix = 2440588;// Julian day (since 1 Jan 4713 BC) for the posix epoch -def cycledays = 1872000;// end of cycle: total days in 13 Baktuns +const mdayposix = 1856305;// Mayan day for the posix epoch 1 Jan 1970 +const jdayposix = 2440588;// Julian day (since 1 Jan 4713 BC) for the posix epoch +const cycledays = 1872000;// end of cycle: total days in 13 Baktuns // some constants in whole seconds -def secsinday = 86400; // number of seconds in a day -def trueyear = 31556941;// current true year (divisible by 13) -def myyear = 31556943;// div by 2277, secsinday compatible, 365.2424 days -def gregyear = 31556952;// div by 40824, mean gregorian year, 365.2425 days -def lunarmonth = 2551443; // duration of the lunar synodic month -def fullmoon = 1213810200;// 18th June 2008, 17:30, full moon in posix seconds -def venussyn = 50450688;// duration of the Venus synodic cycle -def venusinf = 1187409600;// 18th August 2007, 4am Venus inferior conjunction +const secsinday = 86400; // number of seconds in a day +const trueyear = 31556941;// current true year (divisible by 13) +const myyear = 31556943;// div by 2277, secsinday compatible, 365.2424 days +const gregyear = 31556952;// div by 40824, mean gregorian year, 365.2425 days +const lunarmonth = 2551443; // duration of the lunar synodic month +const fullmoon = 1213810200;// 18th June 2008, 17:30, full moon in posix seconds +const venussyn = 50450688;// duration of the Venus synodic cycle +const venusinf = 1187409600;// 18th August 2007, 4am Venus inferior conjunction /******************************************************************************/ // first some functions generally useful in Pure: Modified: pure/trunk/interpreter.cc =================================================================== --- pure/trunk/interpreter.cc 2008-08-19 07:12:56 UTC (rev 538) +++ pure/trunk/interpreter.cc 2008-08-19 08:01:20 UTC (rev 539) @@ -1217,16 +1217,16 @@ last.clear(); pure_expr *e, *res = const_defn(r->lhs, r->rhs, e); if ((verbose&verbosity::defs) != 0) - cout << "def " << r->lhs << " = " << r->rhs << ";\n"; + cout << "const " << r->lhs << " = " << r->rhs << ";\n"; if (!res) { ostringstream msg; if (e) { msg << "unhandled exception '" << e << "' while evaluating '" - << "def " << r->lhs << " = " << r->rhs << "'"; + << "const " << r->lhs << " = " << r->rhs << "'"; pure_free(e); } else msg << "failed match while evaluating '" - << "def " << r->lhs << " = " << r->rhs << "'"; + << "const " << r->lhs << " = " << r->rhs << "'"; throw err(msg.str()); } delete r; Modified: pure/trunk/lexer.ll =================================================================== --- pure/trunk/lexer.ll 2008-08-19 07:12:56 UTC (rev 538) +++ pure/trunk/lexer.ll 2008-08-19 08:01:20 UTC (rev 539) @@ -131,9 +131,9 @@ now. */ static const char *commands[] = { - "cd", "clear", "def", "extern", "help", "infix", "infixl", "infixr", "let", - "list", "ls", "nullary", "override", "postfix", "prefix", "pwd", "quit", - "run", "save", "stats", "underride", "using", 0 + "cd", "clear", "const", "def", "extern", "help", "infix", "infixl", + "infixr", "let", "list", "ls", "nullary", "override", "postfix", "prefix", + "pwd", "quit", "run", "save", "stats", "underride", "using", 0 }; typedef map<string, symbol> symbol_map; @@ -531,7 +531,7 @@ << *jt->second.cval << ";"; sout << endl; } else - sout << "def " << sym.s << " = " << *jt->second.cval + sout << "const " << sym.s << " = " << *jt->second.cval << ";\n"; } else { if (sym.fix == nullary) @@ -819,6 +819,7 @@ prefix yylval->fix = prefix; return token::FIX; postfix yylval->fix = postfix; return token::FIX; nullary return token::NULLARY; +const return token::CONST; def return token::DEF; let return token::LET; case return token::CASE; Modified: pure/trunk/lib/math.pure =================================================================== --- pure/trunk/lib/math.pure 2008-08-19 07:12:56 UTC (rev 538) +++ pure/trunk/lib/math.pure 2008-08-19 08:01:20 UTC (rev 539) @@ -20,7 +20,7 @@ /* IEEE floating point infinities and NaNs. */ -def inf = 1.0e307 * 1.0e307; def nan = inf-inf; +const inf = 1.0e307 * 1.0e307; const nan = inf-inf; /* Random number generator. This uses the Mersenne twister, in order to avoid bad generators present in some C libraries. Returns pseudo random ints in @@ -48,7 +48,7 @@ /* Euler's number. */ -def e = exp 1.0; +const e = exp 1.0; /* Trigonometric functions. */ @@ -71,7 +71,7 @@ /* Ludolph's number. */ -def pi = 4.0*atan 1.0; +const pi = 4.0*atan 1.0; /* Hyperbolic functions. */ @@ -111,7 +111,7 @@ /* The imaginary unit. */ -def i = 0+:1; +const i = 0+:1; /* The following operations all work with both the rectangular and the polar representation, promoting real inputs to complex where appropriate. When Modified: pure/trunk/lib/prelude.pure =================================================================== --- pure/trunk/lib/prelude.pure 2008-08-19 07:12:56 UTC (rev 538) +++ pure/trunk/lib/prelude.pure 2008-08-19 08:01:20 UTC (rev 539) @@ -67,7 +67,7 @@ /* The truth values. These are just integers in Pure, but sometimes it's convenient to refer to them using these symbolic constants. */ -def false = 0; def true = 1; +const false, true = 0, 1; /* Pull in the primitives (arithmetic etc.) and the standard string functions. Note that the math and system modules are *not* included here, so you have Modified: pure/trunk/parser.yy =================================================================== --- pure/trunk/parser.yy 2008-08-19 07:12:56 UTC (rev 538) +++ pure/trunk/parser.yy 2008-08-19 08:01:20 UTC (rev 539) @@ -99,6 +99,7 @@ %token <fix> FIX "fixity" %token DEF "def" +%token CONST "const" %token LET "let" %token CASE "case" %token OF "of" @@ -276,7 +277,7 @@ { action(interp.exec($1), delete $1); } | LET simple_rule { action(interp.define($2), delete $2); } -| DEF simple_rule +| CONST simple_rule { action(interp.define_const($2), delete $2); } | rule { rulel *rl = 0; Modified: pure/trunk/printer.cc =================================================================== --- pure/trunk/printer.cc 2008-08-19 07:12:56 UTC (rev 538) +++ pure/trunk/printer.cc 2008-08-19 08:01:20 UTC (rev 539) @@ -432,7 +432,7 @@ break; } case env_info::cvar: - os << "def " << sym.s << " = " << *info.cval; + os << "const " << sym.s << " = " << *info.cval; break; case env_info::fvar: os << "let " << sym.s << " = " << *(pure_expr**)info.val; Modified: pure/trunk/pure.cc =================================================================== --- pure/trunk/pure.cc 2008-08-19 07:12:56 UTC (rev 538) +++ pure/trunk/pure.cc 2008-08-19 08:01:20 UTC (rev 539) @@ -54,9 +54,9 @@ #define LICENSE "This program is free software distributed under the GNU Public License\n(GPL V3 or later). Please see the COPYING file for details.\n" static const char *commands[] = { - "cd", "clear", "def", "extern", "help", "infix", "infixl", "infixr", "let", - "list", "ls", "nullary", "override", "postfix", "prefix", "pwd", "quit", - "run", "save", "stats", "underride", "using", 0 + "cd", "clear", "const", "def", "extern", "help", "infix", "infixl", + "infixr", "let", "list", "ls", "nullary", "override", "postfix", "prefix", + "pwd", "quit", "run", "save", "stats", "underride", "using", 0 }; /* Generator functions for command completion. */ Modified: pure/trunk/test/prelude.log =================================================================== --- pure/trunk/test/prelude.log 2008-08-19 07:12:56 UTC (rev 538) +++ pure/trunk/test/prelude.log 2008-08-19 08:01:20 UTC (rev 539) @@ -1,5 +1,4 @@ -def false = 0; -def true = 1; +const false,true = 0,1; f/*0:01*/$x/*0:1*/ = f/*0:01*/ x/*0:1*/; (f/*0:001*/.g/*0:01*/) x/*0:1*/ = f/*0:001*/ (g/*0:01*/ x/*0:1*/); void _/*0:1*/ = (); Modified: pure/trunk/test/test013.log =================================================================== --- pure/trunk/test/test013.log 2008-08-19 07:12:56 UTC (rev 538) +++ pure/trunk/test/test013.log 2008-08-19 08:01:20 UTC (rev 539) @@ -1,4 +1,4 @@ -def pi = 4*atan 1.0; +const pi = 4*atan 1.0; foo x/*0:1*/ = 3.14159265358979*x/*0:1*/; { rule #0: foo x = 3.14159265358979*x Modified: pure/trunk/test/test013.pure =================================================================== --- pure/trunk/test/test013.pure 2008-08-19 07:12:56 UTC (rev 538) +++ pure/trunk/test/test013.pure 2008-08-19 08:01:20 UTC (rev 539) @@ -2,7 +2,7 @@ // constant definition example extern double atan(double); -def pi = 4*atan 1.0; +const pi = 4*atan 1.0; foo x = pi*x; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-08-20 06:43:29
|
Revision: 545 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=545&view=rev Author: agraef Date: 2008-08-20 06:43:39 +0000 (Wed, 20 Aug 2008) Log Message: ----------- Windows compatibility fixes. Modified Paths: -------------- pure/trunk/interpreter.cc pure/trunk/pure.cc pure/trunk/runtime.cc Modified: pure/trunk/interpreter.cc =================================================================== --- pure/trunk/interpreter.cc 2008-08-20 01:14:23 UTC (rev 544) +++ pure/trunk/interpreter.cc 2008-08-20 06:43:39 UTC (rev 545) @@ -431,6 +431,29 @@ } #endif +static string unixize(const string& s) +{ + string t = s; +#ifdef _WIN32 + for (size_t i = 0, n = t.size(); i<n; i++) + if (t[i] == '\\') + t[i] = '/'; +#endif + return t; +} + +static bool relname(const string& s) +{ + if (s.empty()) return true; +#ifdef _WIN32 + size_t pos = fname.find('/'); + return pos == string::npos || pos == 0 || + pos == 2 && s[1] == ':'; +#else + return s[0]!='/'; +#endif +} + #define BUFSIZE 1024 static string searchdir(const string& srcdir, const string& libdir, @@ -444,11 +467,11 @@ perror("getcwd"); return script; } - string workdir = cwd; + string workdir = unixize(cwd); if (!workdir.empty() && workdir[workdir.size()-1] != '/') workdir += "/"; string fname; - if (script[0] != '/') { + if (relname(script)) { // resolve relative pathname if (!search) { fname = workdir+script; @@ -472,7 +495,7 @@ } else fname = script; found: - if (fname[0] != '/') fname = workdir+fname; + if (relname(fname)) fname = workdir+fname; char buf[BUFSIZE]; #ifndef _WIN32 if (chklink(fname)) { @@ -494,7 +517,7 @@ // canonicalize the pathname string dir = dirname(fname), name = basename(fname); if (chdir(dir.c_str())==0 && getcwd(buf, BUFSIZE)) { - string dir = buf; + string dir = unixize(buf); if (!dir.empty() && dir[dir.size()-1] != '/') dir += "/"; fname = dir+name; @@ -519,11 +542,11 @@ perror("getcwd"); return lib; } - string workdir = cwd; + string workdir = unixize(cwd); if (!workdir.empty() && workdir[workdir.size()-1] != '/') workdir += "/"; string fname; - if (lib[0] != '/') { + if (relname(lib)) { // resolve relative pathname if (!search) { fname = workdir+lib; @@ -560,8 +583,9 @@ #define DLLEXT ".so" #endif -pure_expr* interpreter::run(const string &s, bool check) +pure_expr* interpreter::run(const string &_s, bool check) { + string s = unixize(_s); // check for library modules size_t p = s.find(":"); if (p != string::npos && s.substr(0, p) == "lib") { Modified: pure/trunk/pure.cc =================================================================== --- pure/trunk/pure.cc 2008-08-20 01:14:23 UTC (rev 544) +++ pure/trunk/pure.cc 2008-08-20 06:43:39 UTC (rev 545) @@ -191,7 +191,11 @@ { size_t pos = 0; while (pos != string::npos) { +#ifdef _WIN32 + size_t end = path.find(';', pos); +#else size_t end = path.find(':', pos); +#endif string s; if (end == string::npos) { s = path.substr(pos); @@ -207,6 +211,17 @@ } } +static string unixize(const string& s) +{ + string t = s; +#ifdef _WIN32 + for (size_t i = 0, n = t.size(); i<n; i++) + if (t[i] == '\\') + t[i] = '/'; +#endif + return t; +} + int main(int argc, char *argv[]) { @@ -260,7 +275,7 @@ if (!*end) interpreter::stackmax = n*1024; } if ((env = getenv("PURELIB"))) { - string s = env; + string s = unixize(env); if (!s.empty() && s[s.size()-1] != '/') s.append("/"); interp.libdir = s; } else @@ -294,6 +309,7 @@ } s = *args; } + s = unixize(s); if (!s.empty()) { if (s[s.size()-1] != '/') s.append("/"); interp.includedirs.push_back(s); @@ -307,6 +323,7 @@ } s = *args; } + s = unixize(s); if (!s.empty()) { if (s[s.size()-1] != '/') s.append("/"); interp.librarydirs.push_back(s); @@ -330,8 +347,10 @@ interp.error(prog + ": invalid option " + *args); return 1; } - if ((env = getenv("PURE_INCLUDE"))) add_path(interp.includedirs, env); - if ((env = getenv("PURE_LIBRARY"))) add_path(interp.librarydirs, env); + if ((env = getenv("PURE_INCLUDE"))) + add_path(interp.includedirs, unixize(env)); + if ((env = getenv("PURE_LIBRARY"))) + add_path(interp.librarydirs, unixize(env)); interp.init_sys_vars(PACKAGE_VERSION, HOST, myargs); if (want_prelude) { // load the prelude if we can find it Modified: pure/trunk/runtime.cc =================================================================== --- pure/trunk/runtime.cc 2008-08-20 01:14:23 UTC (rev 544) +++ pure/trunk/runtime.cc 2008-08-20 06:43:39 UTC (rev 545) @@ -892,7 +892,11 @@ { size_t pos = 0; while (pos != string::npos) { +#ifdef _WIN32 + size_t end = path.find(';', pos); +#else size_t end = path.find(':', pos); +#endif string s; if (end == string::npos) { s = path.substr(pos); @@ -908,6 +912,17 @@ } } +static string unixize(const string& s) +{ + string t = s; +#ifdef _WIN32 + for (size_t i = 0, n = t.size(); i<n; i++) + if (t[i] == '\\') + t[i] = '/'; +#endif + return t; +} + extern "C" pure_interp *pure_create_interp(int argc, char *argv[]) { @@ -931,7 +946,7 @@ if (!*end) interpreter::stackmax = n*1024; } if ((env = getenv("PURELIB"))) { - string s = env; + string s = unixize(env); if (!s.empty() && s[s.size()-1] != '/') s.append("/"); interp.libdir = s; } else @@ -963,6 +978,7 @@ } s = *args; } + s = unixize(s); if (!s.empty()) { if (s[s.size()-1] != '/') s.append("/"); interp.includedirs.push_back(s); @@ -977,6 +993,7 @@ } s = *args; } + s = unixize(s); if (!s.empty()) { if (s[s.size()-1] != '/') s.append("/"); interp.librarydirs.push_back(s); @@ -1002,8 +1019,10 @@ delete _interp; return 0; } - if ((env = getenv("PURE_INCLUDE"))) add_path(interp.includedirs, env); - if ((env = getenv("PURE_LIBRARY"))) add_path(interp.librarydirs, env); + if ((env = getenv("PURE_INCLUDE"))) + add_path(interp.includedirs, unixize(env)); + if ((env = getenv("PURE_LIBRARY"))) + add_path(interp.librarydirs, unixize(env)); interp.init_sys_vars(PACKAGE_VERSION, HOST, myargs); if (want_prelude) { // load the prelude if we can find it This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-08-20 08:07:18
|
Revision: 546 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=546&view=rev Author: agraef Date: 2008-08-20 08:07:27 +0000 (Wed, 20 Aug 2008) Log Message: ----------- Windows compatibility fixes. Modified Paths: -------------- pure/trunk/interpreter.cc pure/trunk/lib/math.pure pure/trunk/lib/primitives.pure pure/trunk/runtime.cc Modified: pure/trunk/interpreter.cc =================================================================== --- pure/trunk/interpreter.cc 2008-08-20 06:43:39 UTC (rev 545) +++ pure/trunk/interpreter.cc 2008-08-20 08:07:27 UTC (rev 546) @@ -442,15 +442,15 @@ return t; } -static bool relname(const string& s) +static bool absname(const string& s) { - if (s.empty()) return true; + if (s.empty()) + return false; + else #ifdef _WIN32 - size_t pos = fname.find('/'); - return pos == string::npos || pos == 0 || - pos == 2 && s[1] == ':'; + return s[0]=='/' || s.size() >= 2 && s[1] == ':'; #else - return s[0]!='/'; + return s[0]=='/'; #endif } @@ -471,7 +471,7 @@ if (!workdir.empty() && workdir[workdir.size()-1] != '/') workdir += "/"; string fname; - if (relname(script)) { + if (!absname(script)) { // resolve relative pathname if (!search) { fname = workdir+script; @@ -495,7 +495,7 @@ } else fname = script; found: - if (relname(fname)) fname = workdir+fname; + if (!absname(fname)) fname = workdir+fname; char buf[BUFSIZE]; #ifndef _WIN32 if (chklink(fname)) { @@ -546,7 +546,7 @@ if (!workdir.empty() && workdir[workdir.size()-1] != '/') workdir += "/"; string fname; - if (relname(lib)) { + if (!absname(lib)) { // resolve relative pathname if (!search) { fname = workdir+lib; Modified: pure/trunk/lib/math.pure =================================================================== --- pure/trunk/lib/math.pure 2008-08-20 06:43:39 UTC (rev 545) +++ pure/trunk/lib/math.pure 2008-08-20 08:07:27 UTC (rev 546) @@ -76,11 +76,11 @@ /* Hyperbolic functions. */ extern double sinh(double), double cosh(double), double tanh(double); -extern double asinh(double); -extern double acosh(double) = c_acosh, double atanh(double) = c_atanh; +extern double __asinh(double), double __acosh(double), double __atanh(double); -acosh x::double = c_acosh x if x>=1.0; -atanh x::double = c_atanh x if abs x<=1.0; +asinh x::double = __asinh x; +acosh x::double = __acosh x if x>=1.0; +atanh x::double = __atanh x if abs x<=1.0; sinh x::int | sinh x::bigint = sinh (double x); cosh x::int | cosh x::bigint = cosh (double x); Modified: pure/trunk/lib/primitives.pure =================================================================== --- pure/trunk/lib/primitives.pure 2008-08-20 06:43:39 UTC (rev 545) +++ pure/trunk/lib/primitives.pure 2008-08-20 08:07:27 UTC (rev 546) @@ -108,7 +108,7 @@ /* Rounding functions. */ extern double floor(double), double ceil(double); -extern double round(double), double trunc(double); +extern double __round(double) = round, double __trunc(double) = trunc; floor x::int | floor x::bigint = x; ceil x::int | ceil x::bigint = x; Modified: pure/trunk/runtime.cc =================================================================== --- pure/trunk/runtime.cc 2008-08-20 06:43:39 UTC (rev 545) +++ pure/trunk/runtime.cc 2008-08-20 08:07:27 UTC (rev 546) @@ -2696,7 +2696,41 @@ } #endif +/* Horrible kludge to get round, trunc and the inverse hyperbolic functions + from libmingwex.a (these are in C99, but not in the Windows system + libraries, and LLVM doesn't know how to get them either). */ + extern "C" +double __round(double x) +{ + return round(x); +} + +extern "C" +double __trunc(double x) +{ + return trunc(x); +} + +extern "C" +double __asinh(double x) +{ + return asinh(x); +} + +extern "C" +double __acosh(double x) +{ + return acosh(x); +} + +extern "C" +double __atanh(double x) +{ + return atanh(x); +} + +extern "C" int pure_fprintf(FILE *fp, const char *format) { return fprintf(fp, format); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-08-20 08:12:56
|
Revision: 547 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=547&view=rev Author: agraef Date: 2008-08-20 08:13:06 +0000 (Wed, 20 Aug 2008) Log Message: ----------- Windows compatibility fixes. Modified Paths: -------------- pure/trunk/configure pure/trunk/configure.ac Modified: pure/trunk/configure =================================================================== --- pure/trunk/configure 2008-08-20 08:07:27 UTC (rev 546) +++ pure/trunk/configure 2008-08-20 08:13:06 UTC (rev 547) @@ -1857,7 +1857,7 @@ LD_LIB_PATH="LD_LIBRARY_PATH" case "$host" in *-*-mingw*) AUXLIBS="-DLIBGLOB='\"libglob.dll\"' -DLIBREGEX='\"libgnurx-0.dll\"'"; - LIBS="$LIBS -limagehlp -lpsapi"; + LIBS="$LIBS -limagehlp -lpsapi -lmingwex"; LDFLAGS="-Wl,--enable-auto-import"; DLLEXT=".dll";; x86_64-*-linux*) PIC="-fPIC";; *-*-darwin*) LD_LIB_PATH="DYLD_LIBRARY_PATH"; Modified: pure/trunk/configure.ac =================================================================== --- pure/trunk/configure.ac 2008-08-20 08:07:27 UTC (rev 546) +++ pure/trunk/configure.ac 2008-08-20 08:13:06 UTC (rev 547) @@ -24,7 +24,7 @@ LD_LIB_PATH="LD_LIBRARY_PATH" case "$host" in *-*-mingw*) AUXLIBS="-DLIBGLOB='\"libglob.dll\"' -DLIBREGEX='\"libgnurx-0.dll\"'"; - LIBS="$LIBS -limagehlp -lpsapi"; + LIBS="$LIBS -limagehlp -lpsapi -lmingwex"; LDFLAGS="-Wl,--enable-auto-import"; DLLEXT=".dll";; x86_64-*-linux*) PIC="-fPIC";; *-*-darwin*) LD_LIB_PATH="DYLD_LIBRARY_PATH"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-08-20 08:44:01
|
Revision: 548 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=548&view=rev Author: agraef Date: 2008-08-20 08:44:09 +0000 (Wed, 20 Aug 2008) Log Message: ----------- Windows compatibility fixes. Modified Paths: -------------- pure/trunk/runtime.cc pure/trunk/runtime.h Modified: pure/trunk/runtime.cc =================================================================== --- pure/trunk/runtime.cc 2008-08-20 08:13:06 UTC (rev 547) +++ pure/trunk/runtime.cc 2008-08-20 08:44:09 UTC (rev 548) @@ -2694,6 +2694,13 @@ { return _pclose(stream); } + +extern "C" +unsigned int sleep(unsigned int secs) +{ + Sleep(secs*1000); + return 0; +} #endif /* Horrible kludge to get round, trunc and the inverse hyperbolic functions Modified: pure/trunk/runtime.h =================================================================== --- pure/trunk/runtime.h 2008-08-20 08:13:06 UTC (rev 547) +++ pure/trunk/runtime.h 2008-08-20 08:44:09 UTC (rev 548) @@ -582,9 +582,9 @@ #ifdef __MINGW32__ /* Windows compatibility. */ - FILE *popen(const char *command, const char *type); int pclose(FILE *stream); +unsigned int sleep(unsigned int secs); #endif /* printf/scanf support. Since we don't support calling C vararg functions This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-08-20 19:00:11
|
Revision: 552 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=552&view=rev Author: agraef Date: 2008-08-20 19:00:20 +0000 (Wed, 20 Aug 2008) Log Message: ----------- Bugfix in updates of temp levels of constants and global variables. Modified Paths: -------------- pure/trunk/ChangeLog pure/trunk/expr.cc Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-08-20 18:58:40 UTC (rev 551) +++ pure/trunk/ChangeLog 2008-08-20 19:00:20 UTC (rev 552) @@ -1,3 +1,9 @@ +2008-08-20 Albert Graef <Dr....@t-...> + + * expr.cc (env::operator=): Bugfix: Only set temporary level of a + constant or free variable if it wasn't defined previously at a + lower level. + 2008-08-19 Albert Graef <Dr....@t-...> * parser.yy, lexer.ll, printer.cc, etc.: Renamed the 'def' keyword Modified: pure/trunk/expr.cc =================================================================== --- pure/trunk/expr.cc 2008-08-20 18:58:40 UTC (rev 551) +++ pure/trunk/expr.cc 2008-08-20 19:00:20 UTC (rev 552) @@ -307,8 +307,9 @@ if (m) delete m; break; } + if ((t != cvar && t != fvar) || temp > e.temp) + temp = e.temp; t = e.t; - temp = e.temp; switch (t) { case none: break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-08-20 20:53:18
|
Revision: 553 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=553&view=rev Author: agraef Date: 2008-08-20 20:53:28 +0000 (Wed, 20 Aug 2008) Log Message: ----------- Final touches (0.5 release). Modified Paths: -------------- pure/trunk/ChangeLog pure/trunk/NEWS Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-08-20 19:00:20 UTC (rev 552) +++ pure/trunk/ChangeLog 2008-08-20 20:53:28 UTC (rev 553) @@ -1,5 +1,7 @@ 2008-08-20 Albert Graef <Dr....@t-...> + * 0.5 release. + * expr.cc (env::operator=): Bugfix: Only set temporary level of a constant or free variable if it wasn't defined previously at a lower level. Modified: pure/trunk/NEWS =================================================================== --- pure/trunk/NEWS 2008-08-20 19:00:20 UTC (rev 552) +++ pure/trunk/NEWS 2008-08-20 20:53:28 UTC (rev 553) @@ -1,4 +1,49 @@ +** Pure 0.5 2008-08-20 + +This release sports LLVM 2.3 support and a bunch of bug fixes and improvements +in the language, the standard library and the code generator. As usual, please +check the ChangeLog for details. Here is a brief rundown of the most important +changes: + +- Language: Haskell-like 'as' patterns. Constant definitions. Revised +list-of-tuples and 'using' syntax, as discussed on the mailing list. New $$ +sequence operator. The XML entity character escapes were updated to the latest +from W3C. + +- Updated syntax highlighting modes. Kate mode now supports folding of +comments and block structure. + +- Improved script and dynamic library search algorithms, as discussed on the +mailing list. + +- Various improvements in the C interface. Also refactored the runtime library +to provide a semantically complete public API for module writers. + +- Improvements and bugfixes in the code generator. + +- Library: Jiri Spitz' port of the Q container types (array.pure, dict.pure, +heap.pure, set.pure). New math.pure module which implements additional +mathematical functions as well as complex and rational numbers. New time- and +signal-related functions in the system module. + +- More examples. In particular, make sure you have a look at Libor Spacek's +cool Mayan calendar and his unbelievingly fast n-queens algorithm. :) + +- Better OSX support. + +- Thanks to Rooslan S. Khayrov's patches, this release now works with LLVM +2.3. Please note that LLVM 2.2 support has been dropped, as we encountered +various issues with the LLVM 2.2 JIT. + +- Toni Graffy has contributed openSUSE packages (available via Packman), +Alvaro Castro Castilla a Gentoo ebuild. Ryan Schmidt continues to maintain the +MacPorts package. + +A big thank you to all who reported bugs and contributed code and patches, in +particular: Alvaro Castro Castilla, Toni Graffy, Rooslan S. Khayrov, Eddie +Rucker, Ryan Schmidt, Libor Spacek and Jiri Spitz. + ** Pure 0.4 2008-06-19 This release features some more bug and portability fixes, a cleanup of the This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-08-21 11:31:01
|
Revision: 555 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=555&view=rev Author: agraef Date: 2008-08-21 11:31:10 +0000 (Thu, 21 Aug 2008) Log Message: ----------- Fix const name capture in expression preprocessing. Modified Paths: -------------- pure/trunk/ChangeLog pure/trunk/interpreter.cc pure/trunk/interpreter.hh Added Paths: ----------- pure/trunk/test/test019.log pure/trunk/test/test019.pure Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-08-20 21:08:37 UTC (rev 554) +++ pure/trunk/ChangeLog 2008-08-21 11:31:10 UTC (rev 555) @@ -1,7 +1,14 @@ -2008-08-20 Albert Graef <Dr....@t-...> +2008-08-21 Albert Graef <Dr....@t-...> * 0.5 release. + * interpreter.cc (subst): Defer const substitutions (and + propagation of type tags) until all variable bindings have been + processed, to prevent name capture in const substitutions. + Reported by Eddie Rucker. + +2008-08-20 Albert Graef <Dr....@t-...> + * expr.cc (env::operator=): Bugfix: Only set temporary level of a constant or free variable if it wasn't defined previously at a lower level. Modified: pure/trunk/interpreter.cc =================================================================== --- pure/trunk/interpreter.cc 2008-08-20 21:08:37 UTC (rev 554) +++ pure/trunk/interpreter.cc 2008-08-21 11:31:10 UTC (rev 555) @@ -740,7 +740,7 @@ save_globals(g); compile(); // promote type tags and substitute constants: - env vars; expr u = subst(vars, x); + env vars; expr u = csubst(subst(vars, x)); compile(u); x = u; pure_expr *res = doeval(u, e); @@ -767,7 +767,7 @@ compile(); env vars; // promote type tags and substitute constants: - expr rhs = subst(vars, x); + expr rhs = csubst(subst(vars, x)); expr lhs = bind(vars, pat); build_env(vars, lhs); for (env::const_iterator it = vars.begin(); it != vars.end(); ++it) { @@ -864,7 +864,7 @@ compile(); env vars; // promote type tags and substitute constants: - expr rhs = subst(vars, x); + expr rhs = csubst(subst(vars, x)); expr lhs = bind(vars, pat); build_env(vars, lhs); for (env::const_iterator it = vars.begin(); it != vars.end(); ++it) { @@ -1368,6 +1368,11 @@ assert(!r.lhs.is_null()); closure(r, false); if (toplevel) { + // substitute constants: + expr u = expr(r.lhs), + v = expr(csubst(r.rhs)), + w = expr(csubst(r.qual)); + r = rule(u, v, w); compile(r.rhs); compile(r.qual); } @@ -1625,14 +1630,7 @@ } else { expr u = subst(vars, x.xval1(), idx), v = subst(vars, x.xval2(), idx); - expr w = expr(u, v); - // promote type tags - expr f; uint32_t n = count_args(w, f); - if (n == 1) - promote_ttags(f, w, w.xval2()); - else if (n == 2) - promote_ttags(f, w, w.xval1().xval2(), w.xval2()); - return w; + return expr(u, v); } // conditionals: case EXPR::COND: { @@ -1705,18 +1703,108 @@ // not a bound variable if (x.ttag() != 0) throw err("error in expression (misplaced type tag)"); - it = globenv.find(sym.f); - if (it != globenv.end() && it->second.t == env_info::cvar) - // substitute constant value - return *it->second.cval; - else - return x; + return x; } const env_info& info = it->second; return expr(EXPR::VAR, sym.f, idx, info.ttag, *info.p); } } +expr interpreter::csubst(expr x) +{ + if (x.is_null()) return x; + switch (x.tag()) { + // constants: + case EXPR::VAR: + case EXPR::FVAR: + case EXPR::INT: + case EXPR::BIGINT: + case EXPR::DBL: + case EXPR::STR: + case EXPR::PTR: + return x; + // application: + case EXPR::APP: + if (x.xval1().tag() == EXPR::APP && + x.xval1().xval1().tag() == symtab.catch_sym().f) { + expr u = csubst(x.xval1().xval2()), + v = csubst(x.xval2()); + return expr(symtab.catch_sym().x, u, v); + } else { + expr u = csubst(x.xval1()), + v = csubst(x.xval2()); + expr w = expr(u, v); + // promote type tags + expr f; uint32_t n = count_args(w, f); + if (n == 1) + promote_ttags(f, w, w.xval2()); + else if (n == 2) + promote_ttags(f, w, w.xval1().xval2(), w.xval2()); + return w; + } + // conditionals: + case EXPR::COND: { + expr u = csubst(x.xval1()), + v = csubst(x.xval2()), + w = csubst(x.xval3()); + return expr::cond(u, v, w); + } + // nested closures: + case EXPR::LAMBDA: { + expr u = x.xval1(), v = csubst(x.xval2()); + return expr::lambda(u, v); + } + case EXPR::CASE: { + expr u = csubst(x.xval()); + const rulel *r = x.rules(); + rulel *s = new rulel; + for (rulel::const_iterator it = r->begin(); it != r->end(); ++it) { + expr u = it->lhs, v = csubst(it->rhs), + w = csubst(it->qual); + s->push_back(rule(u, v, w)); + } + return expr::cases(u, s); + } + case EXPR::WHEN: { + const rulel *r = x.rules(); + rulel *s = new rulel; + for (rulel::const_iterator it = r->begin(); it != r->end(); ++it) { + expr u = it->lhs, v = csubst(it->rhs); + s->push_back(rule(u, v)); + } + expr u = csubst(x.xval()); + return expr::when(u, s); + } + case EXPR::WITH: { + expr u = csubst(x.xval()); + const env *e = x.fenv(); + env *f = new env; + for (env::const_iterator it = e->begin(); it != e->end(); ++it) { + int32_t g = it->first; + const env_info& info = it->second; + const rulel *r = info.rules; + rulel s; + for (rulel::const_iterator jt = r->begin(); jt != r->end(); ++jt) { + expr u = jt->lhs, v = csubst(jt->rhs), + w = csubst(jt->qual); + s.push_back(rule(u, v, w)); + } + (*f)[g] = env_info(info.argc, s, info.temp); + } + return expr::with(u, f); + } + default: + assert(x.tag() > 0); + const symbol& sym = symtab.sym(x.tag()); + env::const_iterator it = globenv.find(sym.f); + if (it != globenv.end() && it->second.t == env_info::cvar) + // substitute constant value + return *it->second.cval; + else + return x; + } +} + expr interpreter::fsubst(const env& funs, expr x, uint8_t idx) { if (x.is_null()) return x; Modified: pure/trunk/interpreter.hh =================================================================== --- pure/trunk/interpreter.hh 2008-08-20 21:08:37 UTC (rev 554) +++ pure/trunk/interpreter.hh 2008-08-21 11:31:10 UTC (rev 555) @@ -448,6 +448,7 @@ void promote_ttags(expr f, expr x, expr u, expr v); expr bind(env& vars, expr x, bool b = true, path p = path()); expr subst(const env& vars, expr x, uint8_t idx = 0); + expr csubst(expr x); expr fsubst(const env& funs, expr x, uint8_t idx = 0); void closure(expr& l, expr& r, bool b = true); void closure(rule& r, bool b = true); Added: pure/trunk/test/test019.log =================================================================== --- pure/trunk/test/test019.log (rev 0) +++ pure/trunk/test/test019.log 2008-08-21 11:31:10 UTC (rev 555) @@ -0,0 +1,13 @@ +const i = -1; +catmap (\i/*0:*/ -> catmap (\j/*0:*/ -> [(i/*1:*/,j/*0:*/)] { + rule #0: j = [(i,j)] + state 0: #0 + <var> state 1 + state 1: #0 +}) (3..4) { + rule #0: i = catmap (\j -> [(i,j)]) (3..4) + state 0: #0 + <var> state 1 + state 1: #0 +}) (1..2); +[(1,3),(1,4),(2,3),(2,4)] Added: pure/trunk/test/test019.pure =================================================================== --- pure/trunk/test/test019.pure (rev 0) +++ pure/trunk/test/test019.pure 2008-08-21 11:31:10 UTC (rev 555) @@ -0,0 +1,3 @@ +// const name capture regression, reported by Eddie Rucker +const i = -1; +[(i,j); i=1..2; j=3..4]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-08-22 08:31:36
|
Revision: 562 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=562&view=rev Author: agraef Date: 2008-08-22 08:31:46 +0000 (Fri, 22 Aug 2008) Log Message: ----------- Bugfix in comparison of global functions. Modified Paths: -------------- pure/trunk/ChangeLog pure/trunk/runtime.cc Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-08-22 00:03:45 UTC (rev 561) +++ pure/trunk/ChangeLog 2008-08-22 08:31:46 UTC (rev 562) @@ -1,7 +1,15 @@ -2008-08-21 Albert Graef <Dr....@t-...> +2008-08-22 Albert Graef <Dr....@t-...> * 0.5 release. + * runtime.cc (same): Bugfix in comparison of global functions. + Handle the case of of an external which may chain to a Pure + definition of the same global. In that case we may safely assume + that the functions are the same anyway if they are represented by + the same global symbol. + +2008-08-21 Albert Graef <Dr....@t-...> + * interpreter.cc (subst): Defer const substitutions (and propagation of type tags) until all variable bindings have been processed, to prevent name capture in const substitutions. Modified: pure/trunk/runtime.cc =================================================================== --- pure/trunk/runtime.cc 2008-08-22 00:03:45 UTC (rev 561) +++ pure/trunk/runtime.cc 2008-08-22 08:31:46 UTC (rev 562) @@ -2428,13 +2428,19 @@ char test; if (x == y) return 1; + else if (x->tag != y->tag) + return 0; else if (x->tag >= 0 && y->tag >= 0) if (x->data.clos && y->data.clos) - return x->tag == y->tag && x->data.clos->fp == y->data.clos->fp; + /* Note that for global functions the function pointers may differ in + some cases (specifically in the case of an external which may chain + to a Pure definition of the same global). However, in that case we + may safely assume that the functions are the same anyway, since they + are referred to by the same global symbol. */ + return !x->data.clos->local && !y->data.clos->local || + x->data.clos->fp == y->data.clos->fp; else - return x->tag == y->tag && x->data.clos == y->data.clos; - else if (x->tag != y->tag) - return 0; + return x->data.clos == y->data.clos; else { switch (x->tag) { case EXPR::APP: { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-08-22 08:47:57
|
Revision: 563 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=563&view=rev Author: agraef Date: 2008-08-22 08:48:07 +0000 (Fri, 22 Aug 2008) Log Message: ----------- Added math.pure tests by Eddie Rucker. Modified Paths: -------------- pure/trunk/ChangeLog Added Paths: ----------- pure/trunk/test/test020.log pure/trunk/test/test020.pure Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-08-22 08:31:46 UTC (rev 562) +++ pure/trunk/ChangeLog 2008-08-22 08:48:07 UTC (rev 563) @@ -2,6 +2,8 @@ * 0.5 release. + * test/test020.pure: Added math.pure tests by Eddie Rucker. + * runtime.cc (same): Bugfix in comparison of global functions. Handle the case of of an external which may chain to a Pure definition of the same global. In that case we may safely assume Added: pure/trunk/test/test020.log =================================================================== --- pure/trunk/test/test020.log (rev 0) +++ pure/trunk/test/test020.log 2008-08-22 08:48:07 UTC (rev 563) @@ -0,0 +1,4697 @@ +{ + rule #0: f = [sqrt,sin,cos,tan,ln,log,exp,atan,asin,acos,sinh,cosh,tanh,asinh,acosh,atanh,abs,re,im,arg,conj,rect,polar,cis,ceil,floor,round,frac,complexp,realp,rationalp,numberp,exactp,inexactp,infp,nanp] + state 0: #0 + <var> state 1 + state 1: #0 +} +let f = [sqrt,sin,cos,tan,ln,log,exp,atan,asin,acos,sinh,cosh,tanh,asinh,acosh,atanh,abs,re,im,arg,conj,rect,polar,cis,ceil,floor,round,frac,complexp,realp,rationalp,numberp,exactp,inexactp,infp,nanp]; +{ + rule #0: x = [1,-1,0,0.0,1.2,-1.2,1%3,-1%4,1+:2,-1+:2,1+:-2,-1.2+:4.3,1.2+:-4.3,1%2+:1,1%2+:3%4,3<:1,-3<:1,3.0<:-3,3.1<:2.5,2%3<:2,1%2<:3%4,-1e+307*1e+307,1e+307*1e+307-1e+307*1e+307] + state 0: #0 + <var> state 1 + state 1: #0 +} +let x = [1,-1,0,0.0,1.2,-1.2,1%3,-1%4,1+:2,-1+:2,1+:-2,-1.2+:4.3,1.2+:-4.3,1%2+:1,1%2+:3%4,3<:1,-3<:1,3.0<:-3,3.1<:2.5,2%3<:2,1%2<:3%4,-1e+307*1e+307,1e+307*1e+307-1e+307*1e+307]; +{ + rule #0: f2 = [(+),(-),(*),(/),(^),atan2,pow] + state 0: #0 + <var> state 1 + state 1: #0 +} +let f2 = [(+),(-),(*),(/),(^),atan2,pow]; +{ + rule #0: x2 = catmap (\i -> catmap (\j -> [(i,j)]) x) x + state 0: #0 + <var> state 1 + state 1: #0 +} +let x2 = catmap (\i/*0:*/ -> catmap (\j/*0:*/ -> [(i/*1:*/,j/*0:*/)] { + rule #0: j = [(i,j)] + state 0: #0 + <var> state 1 + state 1: #0 +}) x { + rule #0: i = catmap (\j -> [(i,j)]) x + state 0: #0 + <var> state 1 + state 1: #0 +}) x; +test f/*0:01*/ (x/*0:101*/,y/*0:11*/) = puts$str (f/*0:01*/,x/*0:101*/,y/*0:11*/,check f/*0:01*/ (x/*0:101*/,y/*0:11*/) (catch __error__ (f/*1:01*/ x/*1:101*/ y/*1:11*/))); +test f/*0:01*/ x/*0:1*/ = puts$str (f/*0:01*/,x/*0:1*/,check f/*0:01*/ x/*0:1*/ (catch __error__ (f/*1:01*/ x/*1:1*/))); +check f/*0:001*/ (x/*0:0101*/,y/*0:011*/) z@(f1@_/*0:100*/ x1/*0:101*/ y1/*0:11*/) = __failed__ z/*0:1*/ if f/*0:001*/===f1/*0:100*/&&x/*0:0101*/===x1/*0:101*/&&y/*0:011*/===y1/*0:11*/; +check f/*0:001*/ x/*0:01*/ z@(f1@_/*0:10*/ x1/*0:11*/) = __failed__ z/*0:1*/ if f/*0:001*/===f1/*0:10*/&&x/*0:01*/===x1/*0:11*/; +check _/*0:001*/ _/*0:01*/ z/*0:1*/ = z/*0:1*/; +{ + rule #0: check f (x,y) z@(f1@_ x1 y1) = __failed__ z if f===f1&&x===x1&&y===y1 + rule #1: check f x z@(f1@_ x1) = __failed__ z if f===f1&&x===x1 + rule #2: check _ _ z = z + state 0: #0 #1 #2 + <var> state 1 + state 1: #0 #1 #2 + <var> state 2 + <app> state 7 + state 2: #1 #2 + <var> state 3 + <app> state 4 + state 3: #2 + state 4: #1 #2 + <var> state 5 + state 5: #1 #2 + <var> state 6 + state 6: #1 #2 + state 7: #0 #1 #2 + <var> state 8 + <app> state 14 + state 8: #1 #2 + <var> state 9 + state 9: #1 #2 + <var> state 10 + <app> state 11 + state 10: #2 + state 11: #1 #2 + <var> state 12 + state 12: #1 #2 + <var> state 13 + state 13: #1 #2 + state 14: #0 #1 #2 + <var> state 15 + , state 22 + state 15: #1 #2 + <var> state 16 + state 16: #1 #2 + <var> state 17 + state 17: #1 #2 + <var> state 18 + <app> state 19 + state 18: #2 + state 19: #1 #2 + <var> state 20 + state 20: #1 #2 + <var> state 21 + state 21: #1 #2 + state 22: #0 #1 #2 + <var> state 23 + state 23: #0 #1 #2 + <var> state 24 + state 24: #0 #1 #2 + <var> state 25 + <app> state 26 + state 25: #2 + state 26: #0 #1 #2 + <var> state 27 + <app> state 29 + state 27: #1 #2 + <var> state 28 + state 28: #1 #2 + state 29: #0 #1 #2 + <var> state 30 + state 30: #0 #1 #2 + <var> state 31 + state 31: #0 #1 #2 + <var> state 32 + state 32: #0 #1 #2 +} +{ + rule #0: test f (x,y) = puts$str (f,x,y,check f (x,y) (catch __error__ (f x y))) + rule #1: test f x = puts$str (f,x,check f x (catch __error__ (f x))) + state 0: #0 #1 + <var> state 1 + state 1: #0 #1 + <var> state 2 + <app> state 3 + state 2: #1 + state 3: #0 #1 + <var> state 4 + <app> state 6 + state 4: #1 + <var> state 5 + state 5: #1 + state 6: #0 #1 + <var> state 7 + , state 10 + state 7: #1 + <var> state 8 + state 8: #1 + <var> state 9 + state 9: #1 + state 10: #0 #1 + <var> state 11 + state 11: #0 #1 + <var> state 12 + state 12: #0 #1 +} +*** UNARY *** +sqrt,1,1.0 +sqrt,-1,0.0+:1.0 +sqrt,0,0.0 +sqrt,0.0,0.0 +sqrt,1.2,1.09544511501033 +sqrt,-1.2,0.0+:1.09544511501033 +sqrt,1L%3L,0.577350269189626 +sqrt,(-1L)%4L,0.0+:0.5 +sqrt,1+:2,1.27201964951407+:0.786151377757423 +sqrt,-1+:2,0.786151377757423+:1.27201964951407 +sqrt,1+:-2,1.27201964951407+:0.786151377757423 +sqrt,-1.2+:4.3,1.27755682008863+:1.68289970840659 +sqrt,1.2+:-4.3,1.68289970840659+:1.27755682008863 +sqrt,1L%2L+:1,0.899453719973934+:0.555892970251421 +sqrt,1L%2L+:3L%4L,0.83707461401777+:0.447988738064919 +sqrt,3<:1,1.73205080756888<:0.5 +sqrt,3<:-2.14159265358979,1.73205080756888<:-1.0707963267949 +sqrt,3.0<:-3,1.73205080756888<:-1.5 +sqrt,3.1<:2.5,1.7606816861659<:1.25 +sqrt,2L%3L<:2,0.816496580927726<:1.0 +sqrt,1L%2L<:3L%4L,0.707106781186548<:0.375 +sqrt,-inf,0.0+:inf +sqrt,nan,nan +sin,1,0.841470984807897 +sin,-1,-0.841470984807897 +sin,0,0.0 +sin,0.0,0.0 +sin,1.2,0.932039085967226 +sin,-1.2,-0.932039085967226 +sin,1L%3L,0.327194696796152 +sin,(-1L)%4L,-0.247403959254523 +sin,1+:2,3.16577851321617+:1.95960104142161 +sin,-1+:2,-3.16577851321617+:1.95960104142161 +sin,1+:-2,3.16577851321617+:-1.95960104142161 +sin,-1.2+:4.3,-34.351867391542+:13.3503875389022 +sin,1.2+:-4.3,34.351867391542+:-13.3503875389022 +sin,1L%2L+:1,0.739792264456014+:1.03133607425455 +sin,1L%2L+:3L%4L,0.620704231078055+:0.721650824297564 +sin,3<:1,6.28163530398568<:-0.0494726344890117 +sin,3<:-2.14159265358979,6.28163530398567<:3.09212001910078 +sin,3.0<:-3,0.468364088212104<:1.97989764678311 +sin,3.1<:2.5,3.17788867786845<:-2.25266146393774 +sin,2L%3L<:2,0.699833695459732<:2.05499060924475 +sin,1L%2L<:3L%4L,0.498700404819053<:0.708394123409847 +sin,-inf,nan +sin,nan,nan +cos,1,0.54030230586814 +cos,-1,0.54030230586814 +cos,0,1.0 +cos,0.0,1.0 +cos,1.2,0.362357754476674 +cos,-1.2,0.362357754476674 +cos,1L%3L,0.944956946314738 +cos,(-1L)%4L,0.968912421710645 +cos,1+:2,2.03272300701967+:-3.0518977991518 +cos,-1+:2,2.03272300701967+:3.0518977991518 +cos,1+:-2,2.03272300701967+:3.0518977991518 +cos,-1.2+:4.3,13.3553042114774+:34.3392209642024 +cos,1.2+:-4.3,13.3553042114774+:34.3392209642024 +cos,1L%2L+:1,1.35418065670458+:-0.563421465230982 +cos,1L%2L+:3L%4L,1.13619147380335+:-0.394239642111583 +cos,3<:1,6.20193195969258<:-1.62155307254104 +cos,3<:-2.14159265358979,6.20193195969257<:-1.62155307254104 +cos,3.0<:-3,1.07751445241005<:-3.07241725532314 +cos,3.1<:2.5,3.21728657985303<:2.50707118166099 +cos,2L%3L<:2,1.15747143172116<:0.152985430170633 +cos,1L%2L<:3L%4L,0.996367993542271<:-0.125077153297551 +cos,-inf,nan +cos,nan,nan +tan,1,1.5574077246549 +tan,-1,-1.5574077246549 +tan,0,0.0 +tan,0.0,0.0 +tan,1.2,2.57215162212632 +tan,-1.2,-2.57215162212632 +tan,1L%3L,0.346253549510575 +tan,(-1L)%4L,-0.255341921221036 +tan,1+:2,0.0338128260798967+:1.01479361614663 +tan,-1+:2,-0.0338128260798967+:1.01479361614663 +tan,1+:-2,0.0338128260798967+:-1.01479361614663 +tan,-1.2+:4.3,-0.000248780909688767+:1.00027152283444 +tan,1.2+:-4.3,0.000248780909688767+:-1.00027152283444 +tan,1L%2L+:1,0.195577310065934+:0.842966204845783 +tan,1L%2L+:3L%4L,0.290893461829618+:0.736084170551191 +tan,3<:1,1.01285137354152<:1.57208043805203 +tan,3<:-2.14159265358979,1.01285137354152<:-1.56951221553776 +tan,3.0<:-3,0.434670817792307<:-1.23087040507334 +tan,3.1<:2.5,0.987754307548699<:1.52345266158086 +tan,2L%3L<:2,0.604622866949795<:1.90200517907412 +tan,1L%2L<:3L%4L,0.500518290482296<:0.833471276707398 +tan,-inf,nan +tan,nan,nan +ln,1,0.0 +ln,-1,0.0+:3.14159265358979 +ln,0,-inf +ln,0.0,-inf +ln,1.2,0.182321556793955 +ln,-1.2,0.182321556793955+:3.14159265358979 +ln,1L%3L,-1.09861228866811 +ln,(-1L)%4L,-1.38629436111989+:3.14159265358979 +ln,1+:2,0.80471895621705+:1.10714871779409 +ln,-1+:2,0.80471895621705+:2.0344439357957 +ln,1+:-2,0.80471895621705+:-1.10714871779409 +ln,-1.2+:4.3,1.49611306711235+:1.84294221732608 +ln,1.2+:-4.3,1.49611306711235+:-1.29865043626371 +ln,1L%2L+:1,0.111571775657105+:1.10714871779409 +ln,1L%2L+:3L%4L,-0.103819682389122+:0.982793723247329 +ln,3<:1,1.48558034478536<:0.738443417734099 +ln,3<:-2.14159265358979,2.40694163924312<:-1.09681203355936 +ln,3.0<:-3,3.19483160132308<:-1.21975934437627 +ln,3.1<:2.5,2.74409743593163<:1.14581484226141 +ln,2L%3L<:2,2.04068663784844<:1.77081795644967 +ln,1L%2L<:3L%4L,1.02125071060842<:2.31681982604851 +ln,-inf,inf+:3.14159265358979 +ln,nan,nan +log,1,0.0 +log,-1,0.0+:1.36437635384184 +log,0,-inf +log,0.0,-inf +log,1.2,0.0791812460476248 +log,-1.2,0.0791812460476248+:1.36437635384184 +log,1L%3L,-0.477121254719662 +log,(-1L)%4L,-0.602059991327962+:1.36437635384184 +log,1+:2,0.349485002168009+:0.480828578784234 +log,-1+:2,0.349485002168009+:0.883547775057607 +log,1+:-2,0.349485002168009+:-0.480828578784234 +log,-1.2+:4.3,0.649753649350244+:0.800379635451262 +log,1.2+:-4.3,0.649753649350244+:-0.56399671839058 +log,1L%2L+:1,0.0484550065040282+:0.480828578784234 +log,1L%2L+:3L%4L,-0.045088315174544+:0.426821890855467 +log,3<:1,0.645179346164211<:0.738443417734099 +log,3<:-2.14159265358979,1.04532147218645<:-1.09681203355936 +log,3.0<:-3,1.38749773506474<:-1.21975934437627 +log,3.1<:2.5,1.19174637422997<:1.14581484226141 +log,2L%3L<:2,0.886258946111277<:1.77081795644967 +log,1L%2L<:3L%4L,0.443523548257011<:2.31681982604851 +log,-inf,inf+:1.36437635384184 +log,nan,nan +exp,1,2.71828182845905 +exp,-1,0.367879441171442 +exp,0,1.0 +exp,0.0,1.0 +exp,1.2,3.32011692273655 +exp,-1.2,0.301194211912202 +exp,1L%3L,1.39561242508609 +exp,(-1L)%4L,0.778800783071405 +exp,1+:2,-1.13120438375681+:2.47172667200482 +exp,-1+:2,-0.153091865674226+:0.334511829239262 +exp,1+:-2,-1.13120438375681+:-2.47172667200482 +exp,-1.2+:4.3,-0.120718390769691+:-0.275943877300056 +exp,1.2+:-4.3,-1.33070011384152+:3.04177803063665 +exp,1L%2L+:1,0.890807904293129+:1.38735111132976 +exp,1L%2L+:3L%4L,1.20635100164679+:1.12383232258413 +exp,3<:1,5.05767513183927<:2.52441295442369 +exp,3<:-2.14159265358979,0.197719302630721<:-2.52441295442369 +exp,3.0<:-3,0.0513044651926248<:-0.423360024179602 +exp,3.1<:2.5,0.0834468640645693<:1.85526364672227 +exp,2L%3L<:2,0.757727676013212<:0.606198284550454 +exp,1L%2L<:3L%4L,1.44173094152246<:0.340819380011667 +exp,-inf,0.0 +exp,nan,nan +atan,1,0.785398163397448 +atan,-1,-0.785398163397448 +atan,0,0.0 +atan,0.0,0.0 +atan,1.2,0.876058050598193 +atan,-1.2,-0.876058050598193 +atan,1L%3L,0.321750554396642 +atan,(-1L)%4L,-0.244978663126864 +atan,1+:2,1.33897252229449+:0.402359478108525 +atan,-1+:2,-1.33897252229449+:0.402359478108525 +atan,1+:-2,1.33897252229449+:-0.402359478108525 +atan,-1.2+:4.3,-1.50774129532113+:0.218342844644895 +atan,1.2+:-4.3,1.50774129532113+:-0.218342844644895 +atan,1L%2L+:1,0.90788749496088+:0.708303336014054 +atan,1L%2L+:3L%4L,0.692724188399601+:0.590213500279505 +atan,3<:1,1.37829430594262+:0.277918809215814 +atan,3<:-2.14159265358979,-1.37829430594262+:-0.277918809215814 +atan,3.0<:-3,-1.2514562387973+:-0.0424376137199477 +atan,3.1<:2.5,-1.30916663257012+:0.182562248419793 +atan,2L%3L<:2,-0.392386988985284+:0.609487349380993 +atan,1L%2L<:3L%4L,0.386520254485461+:0.305841704408549 +atan,-inf,-1.5707963267949 +atan,nan,nan +asin,1,1.5707963267949 +asin,-1,-1.5707963267949 +asin,0,0.0 +asin,0.0,0.0 +asin,1.2,nan +asin,-1.2,nan +asin,1L%3L,0.339836909454122 +asin,(-1L)%4L,-0.252680255142079 +asin,1+:2,1.46783725642233+:-0.652507008444884 +asin,-1+:2,-0.427078586392475+:1.528570919481 +asin,1+:-2,0.427078586392476+:-1.528570919481 +asin,-1.2+:4.3,-0.265853221247092+:2.19988173922994 +asin,1.2+:-4.3,0.26585322124709+:-2.19988173922993 +asin,1L%2L+:1,1.16425299086589+:0.0607070375665663 +asin,1L%2L+:3L%4L,1.07765608825196+:0.0769964640772277 +asin,3<:1,1.52625913130154+:-1.15038039260516 +asin,3<:-2.14159265358979,-0.0164841832973784+:-1.64677129011767 +asin,3.0<:-3,-0.191829829869345+:0.118072277108134 +asin,3.1<:2.5,-0.90374717342567+:1.81806436268745 +asin,2L%3L<:2,-0.23762596948846+:0.589062385533765 +asin,1L%2L<:3L%4L,0.640642731202035+:0.197350122856685 +asin,-inf,nan +asin,nan,nan +acos,1,0.0 +acos,-1,3.14159265358979 +acos,0,1.5707963267949 +acos,0.0,1.5707963267949 +acos,1.2,nan +acos,-1.2,nan +acos,1L%3L,1.23095941734077 +acos,(-1L)%4L,1.82347658193698 +acos,1+:2,1.14371774040242+:-1.528570919481 +acos,-1+:2,1.59219225096909+:-1.43468662650293 +acos,1+:-2,0.102959070372571+:-0.652507008444884 +acos,-1.2+:4.3,1.57414021038985+:-2.16412406339493 +acos,1.2+:-4.3,0.0450678724709049+:-0.864279184310815 +acos,1L%2L+:1,1.22135726393768+:-0.926133031350183 +acos,1L%2L+:3L%4L,1.17251845325659+:-0.743320426325279 +acos,3<:1,1.02436728160651+:-1.80400811392948 +acos,3<:-2.14159265358979,2.11722537198328+:1.80400811392947 +acos,3.0<:-3,2.9915586031129+:1.76406194521987 +acos,3.1<:2.5,1.6042510533514+:-1.33844137461137 +acos,2L%3L<:2,1.64522180739974+:-0.56333169914685 +acos,1L%2L<:3L%4L,1.21973646993134+:-0.355425797099242 +acos,-inf,nan +acos,nan,nan +sinh,1,1.1752011936438 +sinh,-1,-1.1752011936438 +sinh,0,0.0 +sinh,0.0,0.0 +sinh,1.2,1.50946135541217 +sinh,-1.2,-1.50946135541217 +sinh,1L%3L,0.33954055725615 +sinh,(-1L)%4L,-0.252612316808168 +sinh,1+:2,-0.489056259041294+:1.40311925062204 +sinh,-1+:2,0.489056259041294+:1.40311925062204 +sinh,1+:-2,-0.489056259041294+:-1.40311925062204 +sinh,-1.2+:4.3,0.604990861535916+:-1.65886095396835 +sinh,1.2+:-4.3,-0.604990861535916+:1.65886095396835 +sinh,1L%2L+:1,0.281548995135334+:0.948864531437168 +sinh,1L%2L+:3L%4L,0.381279634652178+:0.768633564693393 +sinh,3<:1,2.49794510056597<:2.48704664338341 +sinh,3<:-2.14159265358979,2.49794510056597<:-0.654546010206382 +sinh,3.0<:-3,9.72876623396115<:-2.71625741503569 +sinh,3.1<:2.5,6.02702978942574<:1.29005852510914 +sinh,2L%3L<:2,0.635275606273034<:1.94283855664387 +sinh,1L%2L<:3L%4L,0.501647644053453<:0.791507934297849 +sinh,-inf,-inf +sinh,nan,nan +cosh,1,1.54308063481524 +cosh,-1,1.54308063481524 +cosh,0,1.0 +cosh,0.0,1.0 +cosh,1.2,1.81065556732437 +cosh,-1.2,1.81065556732437 +cosh,1L%3L,1.05607186782994 +cosh,(-1L)%4L,1.03141309987957 +cosh,1+:2,-0.64214812471552+:1.06860742138278 +cosh,-1+:2,-0.64214812471552+:-1.06860742138278 +cosh,1+:-2,-0.64214812471552+:-1.06860742138278 +cosh,-1.2+:4.3,-0.725709252305608+:1.38291707666829 +cosh,1.2+:-4.3,-0.725709252305608+:1.38291707666829 +cosh,1L%2L+:1,0.609258909157794+:0.438486579892595 +cosh,1L%2L+:3L%4L,0.825071366994607+:0.355198757890738 +cosh,3<:1,2.56317295660819<:2.56082793818154 +cosh,3<:-2.14159265358979,2.56317295660819<:2.56082793818154 +cosh,3.0<:-3,9.76275249045336<:0.421391685963163 +cosh,3.1<:2.5,5.95672835395987<:-1.85903718102565 +cosh,2L%3L<:2,0.86853394700555<:-0.185395179123782 +cosh,1L%2L<:3L%4L,1.01399782693401<:0.12362173219921 +cosh,-inf,inf +cosh,nan,nan +tanh,1,0.761594155955765 +tanh,-1,-0.761594155955765 +tanh,0,0.0 +tanh,0.0,0.0 +tanh,1.2,0.833654607012155 +tanh,-1.2,-0.833654607012155 +tanh,1L%3L,0.321512737531634 +tanh,(-1L)%4L,-0.244918662403709 +tanh,1+:2,1.16673625724092+:-0.243458201185725 +tanh,-1+:2,-1.16673625724092+:-0.243458201185725 +tanh,1+:-2,1.16673625724092+:0.243458201185725 +tanh,-1.2+:4.3,-1.12053602253626+:0.150545901177205 +tanh,1.2+:-4.3,1.12053602253626+:-0.150545901177205 +tanh,1L%2L+:1,1.04283072834436+:0.806877412163085 +tanh,1L%2L+:3L%4L,0.728211801280472+:0.618096394806202 +tanh,3<:1,0.974551910016818<:-0.0737812947981276 +tanh,3<:-2.14159265358979,0.974551910016818<:3.06781135879167 +tanh,3.0<:-3,0.996518783352805<:-3.13764910099886 +tanh,3.1<:2.5,1.01180202139302<:-3.1340896010448 +tanh,2L%3L<:2,0.731434399845024<:2.12823373576766 +tanh,1L%2L<:3L%4L,0.494722602680784<:0.667886202098639 +tanh,-inf,-1.0 +tanh,nan,nan +asinh,1,0.881373587019543 +asinh,-1,-0.881373587019543 +asinh,0,0.0 +asinh,0.0,0.0 +asinh,1.2,1.01597313417969 +asinh,-1.2,-1.01597313417969 +asinh,1L%3L,0.327450150237258 +asinh,(-1L)%4L,-0.247466461547263 +asinh,1+:2,1.46935174436819+:1.06344002357775 +asinh,-1+:2,1.33514626150007+:1.54137900229449 +asinh,1+:-2,0.752047373447746+:-0.0949376700463558 +asinh,-1.2+:4.3,2.13903157554736+:1.56712608995557 +asinh,1.2+:-4.3,0.889371672158385+:-0.0447415192265362 +asinh,1L%2L+:1,0.732857675973645+:0.89590748120889 +asinh,1L%2L+:3L%4L,0.606334999887351+:0.682203965583432 +asinh,3<:1,1.78102534527989+:0.973891130816354 +asinh,3<:-2.14159265358979,-1.78102534527989+:-0.973891130816354 +asinh,3.0<:-3,-1.81749921747243+:-0.13440282951171 +asinh,3.1<:2.5,1.28655350979512+:1.53475346270792 +asinh,2L%3L<:2,-0.00714161261602409+:0.938171779746577 +asinh,1L%2L<:3L%4L,0.376884772780086+:0.323585858402972 +asinh,-inf,-inf +asinh,nan,nan +acosh,1,0.0 +acosh,-1,0.0+:3.14159265358979 +acosh,0,0.0+:1.5707963267949 +acosh,0.0,0.0+:1.5707963267949 +acosh,1.2,0.622362503714779 +acosh,-1.2,-0.622362503714779+:3.14159265358979 +acosh,1L%3L,0.0+:1.23095941734077 +acosh,(-1L)%4L,0.0+:1.82347658193698 +acosh,1+:2,1.528570919481+:1.14371774040242 +acosh,-1+:2,1.43468662650293+:1.59219225096909 +acosh,1+:-2,0.652507008444884+:0.102959070372571 +acosh,-1.2+:4.3,2.16412406339493+:1.57414021038985 +acosh,1.2+:-4.3,0.864279184310815+:0.0450678724709049 +acosh,1L%2L+:1,0.926133031350183+:1.22135726393768 +acosh,1L%2L+:3L%4L,0.743320426325279+:1.17251845325659 +acosh,3<:1,1.80400811392948+:1.02436728160651 +acosh,3<:-2.14159265358979,-1.80400811392947+:2.11722537198328 +acosh,3.0<:-3,-1.76406194521987+:2.9915586031129 +acosh,3.1<:2.5,1.33844137461137+:1.6042510533514 +acosh,2L%3L<:2,0.56333169914685+:1.64522180739974 +acosh,1L%2L<:3L%4L,0.355425797099242+:1.21973646993134 +acosh,-inf,nan+:nan +acosh,nan,nan +atanh,1,inf +atanh,-1,-inf +atanh,0,0.0 +atanh,0.0,0.0 +atanh,1.2,1.19894763639919+:-1.5707963267949 +atanh,-1.2,-1.19894763639919+:1.5707963267949 +atanh,1L%3L,0.346573590279973 +atanh,(-1L)%4L,-0.255412811882995 +atanh,1+:2,0.173286795139986+:1.17809724509617 +atanh,-1+:2,-0.173286795139986+:1.17809724509617 +atanh,1+:-2,0.173286795139986+:-1.17809724509617 +atanh,-1.2+:4.3,-0.0575872614340175+:1.35758209063893 +atanh,1.2+:-4.3,0.0575872614340176+:-1.35758209063893 +atanh,1L%2L+:1,0.238877861256859+:0.847575660670829 +atanh,1L%2L+:3L%4L,0.310428283077196+:0.723220666124068 +atanh,3<:1,0.1681562506274+:1.28930826312627 +atanh,3<:-2.14159265358979,-0.168156250627401+:-1.28930826312627 +atanh,3.0<:-3,-0.341908696667975+:-1.518072611328 +atanh,3.1<:2.5,-0.253850363925408+:1.36734421742892 +atanh,2L%3L<:2,-0.202451040350963+:0.570560037832821 +atanh,1L%2L<:3L%4L,0.335282255752869+:0.368842031953307 +atanh,-inf,nan+:nan +atanh,nan,nan +abs,1,1 +abs,-1,1 +abs,0,0 +abs,0.0,0.0 +abs,1.2,1.2 +abs,-1.2,1.2 +abs,1L%3L,1L%3L +abs,(-1L)%4L,1L%4L +abs,1+:2,2.23606797749979 +abs,-1+:2,2.23606797749979 +abs,1+:-2,2.23606797749979 +abs,-1.2+:4.3,4.46430285710994 +abs,1.2+:-4.3,4.46430285710994 +abs,1L%2L+:1,1.11803398874989 +abs,1L%2L+:3L%4L,0.901387818865997 +abs,3<:1,3 +abs,3<:-2.14159265358979,3 +abs,3.0<:-3,3.0 +abs,3.1<:2.5,3.1 +abs,2L%3L<:2,2L%3L +abs,1L%2L<:3L%4L,1L%2L +abs,-inf,inf +abs,nan,nan +re,1,1 +re,-1,-1 +re,0,0 +re,0.0,0.0 +re,1.2,1.2 +re,-1.2,-1.2 +re,1L%3L,1L%3L +re,(-1L)%4L,(-1L)%4L +re,1+:2,1 +re,-1+:2,-1 +re,1+:-2,1 +re,-1.2+:4.3,-1.2 +re,1.2+:-4.3,1.2 +re,1L%2L+:1,1L%2L +re,1L%2L+:3L%4L,1L%2L +re,3<:1,2.52441295442369 +re,3<:-2.14159265358979,-2.52441295442369 +re,3.0<:-3,-0.423360024179602 +re,3.1<:2.5,1.85526364672227 +re,2L%3L<:2,0.606198284550454 +re,1L%2L<:3L%4L,0.340819380011667 +re,-inf,-inf +re,nan,nan +im,1,0 +im,-1,0 +im,0,0 +im,0.0,0.0 +im,1.2,0.0 +im,-1.2,0.0 +im,1L%3L,0L%1L +im,(-1L)%4L,0L%1L +im,1+:2,2 +im,-1+:2,2 +im,1+:-2,-2 +im,-1.2+:4.3,4.3 +im,1.2+:-4.3,-4.3 +im,1L%2L+:1,1 +im,1L%2L+:3L%4L,3L%4L +im,3<:1,1.62090691760442 +im,3<:-2.14159265358979,-1.62090691760442 +im,3.0<:-3,-2.96997748980134 +im,3.1<:2.5,-2.48354520819549 +im,2L%3L<:2,-0.277431224364762 +im,1L%2L<:3L%4L,0.36584443443691 +im,-inf,0.0 +im,nan,0.0 +arg,1,0.0 +arg,-1,3.14159265358979 +arg,0,0.0 +arg,0.0,0.0 +arg,1.2,0.0 +arg,-1.2,3.14159265358979 +arg,1L%3L,0.0 +arg,(-1L)%4L,3.14159265358979 +arg,1+:2,1.10714871779409 +arg,-1+:2,2.0344439357957 +arg,1+:-2,-1.10714871779409 +arg,-1.2+:4.3,1.84294221732608 +arg,1.2+:-4.3,-1.29865043626371 +arg,1L%2L+:1,1.10714871779409 +arg,1L%2L+:3L%4L,0.982793723247329 +arg,3<:1,1 +arg,3<:-2.14159265358979,-2.14159265358979 +arg,3.0<:-3,-3 +arg,3.1<:2.5,2.5 +arg,2L%3L<:2,2 +arg,1L%2L<:3L%4L,3L%4L +arg,-inf,3.14159265358979 +arg,nan,nan +conj,1,1 +conj,-1,-1 +conj,0,0 +conj,0.0,0.0 +conj,1.2,1.2 +conj,-1.2,-1.2 +conj,1L%3L,1L%3L +conj,(-1L)%4L,(-1L)%4L +conj,1+:2,1+:-2 +conj,-1+:2,-1+:-2 +conj,1+:-2,1+:2 +conj,-1.2+:4.3,-1.2+:-4.3 +conj,1.2+:-4.3,1.2+:4.3 +conj,1L%2L+:1,1L%2L+:-1 +conj,1L%2L+:3L%4L,1L%2L+:(-3L)%4L +conj,3<:1,3<:-1 +conj,3<:-2.14159265358979,3<:2.14159265358979 +conj,3.0<:-3,3.0<:3 +conj,3.1<:2.5,3.1<:-2.5 +conj,2L%3L<:2,2L%3L<:-2 +conj,1L%2L<:3L%4L,1L%2L<:(-3L)%4L +conj,-inf,-inf +conj,nan,nan +rect,1,1+:0 +rect,-1,-1+:0 +rect,0,0+:0 +rect,0.0,0.0+:0.0 +rect,1.2,1.2+:0.0 +rect,-1.2,-1.2+:0.0 +rect,1L%3L,1L%3L+:0L%1L +rect,(-1L)%4L,(-1L)%4L+:0L%1L +rect,1+:2,1+:2 +rect,-1+:2,-1+:2 +rect,1+:-2,1+:-2 +rect,-1.2+:4.3,-1.2+:4.3 +rect,1.2+:-4.3,1.2+:-4.3 +rect,1L%2L+:1,1L%2L+:1 +rect,1L%2L+:3L%4L,1L%2L+:3L%4L +rect,3<:1,1.62090691760442+:2.52441295442369 +rect,3<:-2.14159265358979,-1.62090691760442+:-2.52441295442369 +rect,3.0<:-3,-2.96997748980134+:-0.423360024179602 +rect,3.1<:2.5,-2.48354520819549+:1.85526364672227 +rect,2L%3L<:2,-0.277431224364762+:0.606198284550454 +rect,1L%2L<:3L%4L,0.36584443443691+:0.340819380011667 +rect,-inf,-inf+:0.0 +rect,nan,nan+:0.0 +polar,1,1<:0 +polar,-1,1<:3.14159265358979 +polar,0,0<:0 +polar,0.0,0.0<:0.0 +polar,1.2,1.2<:0.0 +polar,-1.2,1.2<:3.14159265358979 +polar,1L%3L,1L%3L<:0L%1L +polar,(-1L)%4L,1L%4L<:3.14159265358979 +polar,1+:2,2.23606797749979<:1.10714871779409 +polar,-1+:2,2.23606797749979<:2.0344439357957 +polar,1+:-2,2.23606797749979<:-1.10714871779409 +polar,-1.2+:4.3,4.46430285710994<:1.84294221732608 +polar,1.2+:-4.3,4.46430285710994<:-1.29865043626371 +polar,1L%2L+:1,1.11803398874989<:1.10714871779409 +polar,1L%2L+:3L%4L,0.901387818865997<:0.982793723247329 +polar,3<:1,3<:1 +polar,3<:-2.14159265358979,3<:-2.14159265358979 +polar,3.0<:-3,3.0<:-3 +polar,3.1<:2.5,3.1<:2.5 +polar,2L%3L<:2,2L%3L<:2 +polar,1L%2L<:3L%4L,1L%2L<:3L%4L +polar,-inf,inf<:3.14159265358979 +polar,nan,nan<:0.0 +cis,1,0.54030230586814+:0.841470984807897 +cis,-1,0.54030230586814+:-0.841470984807897 +cis,0,1.0+:0.0 +cis,0.0,1.0+:0.0 +cis,1.2,0.362357754476674+:0.932039085967226 +cis,-1.2,0.362357754476674+:-0.932039085967226 +cis,1L%3L,0.944956946314738+:0.327194696796152 +cis,(-1L)%4L,0.968912421710645+:-0.247403959254523 +cis,1+:2,__failed__ (cis (1+:2)) +cis,-1+:2,__failed__ (cis (-1+:2)) +cis,1+:-2,__failed__ (cis (1+:-2)) +cis,-1.2+:4.3,__failed__ (cis (-1.2+:4.3)) +cis,1.2+:-4.3,__failed__ (cis (1.2+:-4.3)) +cis,1L%2L+:1,__failed__ (cis (1L%2L+:1)) +cis,1L%2L+:3L%4L,__failed__ (cis (1L%2L+:3L%4L)) +cis,3<:1,__failed__ (cis (3<:1)) +cis,3<:-2.14159265358979,__failed__ (cis (3<:-2.14159265358979)) +cis,3.0<:-3,__failed__ (cis (3.0<:-3)) +cis,3.1<:2.5,__failed__ (cis (3.1<:2.5)) +cis,2L%3L<:2,__failed__ (cis (2L%3L<:2)) +cis,1L%2L<:3L%4L,__failed__ (cis (1L%2L<:3L%4L)) +cis,-inf,nan+:nan +cis,nan,nan+:nan +ceil,1,1 +ceil,-1,-1 +ceil,0,0 +ceil,0.0,0.0 +ceil,1.2,2.0 +ceil,-1.2,-1.0 +ceil,1L%3L,1L +ceil,(-1L)%4L,0L +ceil,1+:2,__failed__ (ceil (1+:2)) +ceil,-1+:2,__failed__ (ceil (-1+:2)) +ceil,1+:-2,__failed__ (ceil (1+:-2)) +ceil,-1.2+:4.3,__failed__ (ceil (-1.2+:4.3)) +ceil,1.2+:-4.3,__failed__ (ceil (1.2+:-4.3)) +ceil,1L%2L+:1,__failed__ (ceil (1L%2L+:1)) +ceil,1L%2L+:3L%4L,__failed__ (ceil (1L%2L+:3L%4L)) +ceil,3<:1,__failed__ (ceil (3<:1)) +ceil,3<:-2.14159265358979,__failed__ (ceil (3<:-2.14159265358979)) +ceil,3.0<:-3,__failed__ (ceil (3.0<:-3)) +ceil,3.1<:2.5,__failed__ (ceil (3.1<:2.5)) +ceil,2L%3L<:2,__failed__ (ceil (2L%3L<:2)) +ceil,1L%2L<:3L%4L,__failed__ (ceil (1L%2L<:3L%4L)) +ceil,-inf,-inf +ceil,nan,nan +floor,1,1 +floor,-1,-1 +floor,0,0 +floor,0.0,0.0 +floor,1.2,1.0 +floor,-1.2,-2.0 +floor,1L%3L,0L +floor,(-1L)%4L,-1L +floor,1+:2,__failed__ (floor (1+:2)) +floor,-1+:2,__failed__ (floor (-1+:2)) +floor,1+:-2,__failed__ (floor (1+:-2)) +floor,-1.2+:4.3,__failed__ (floor (-1.2+:4.3)) +floor,1.2+:-4.3,__failed__ (floor (1.2+:-4.3)) +floor,1L%2L+:1,__failed__ (floor (1L%2L+:1)) +floor,1L%2L+:3L%4L,__failed__ (floor (1L%2L+:3L%4L)) +floor,3<:1,__failed__ (floor (3<:1)) +floor,3<:-2.14159265358979,__failed__ (floor (3<:-2.14159265358979)) +floor,3.0<:-3,__failed__ (floor (3.0<:-3)) +floor,3.1<:2.5,__failed__ (floor (3.1<:2.5)) +floor,2L%3L<:2,__failed__ (floor (2L%3L<:2)) +floor,1L%2L<:3L%4L,__failed__ (floor (1L%2L<:3L%4L)) +floor,-inf,-inf +floor,nan,nan +round,1,1 +round,-1,-1 +round,0,0 +round,0.0,0.0 +round,1.2,1.0 +round,-1.2,-1.0 +round,1L%3L,0L +round,(-1L)%4L,0L +round,1+:2,__failed__ (round (1+:2)) +round,-1+:2,__failed__ (round (-1+:2)) +round,1+:-2,__failed__ (round (1+:-2)) +round,-1.2+:4.3,__failed__ (round (-1.2+:4.3)) +round,1.2+:-4.3,__failed__ (round (1.2+:-4.3)) +round,1L%2L+:1,__failed__ (round (1L%2L+:1)) +round,1L%2L+:3L%4L,__failed__ (round (1L%2L+:3L%4L)) +round,3<:1,__failed__ (round (3<:1)) +round,3<:-2.14159265358979,__failed__ (round (3<:-2.14159265358979)) +round,3.0<:-3,__failed__ (round (3.0<:-3)) +round,3.1<:2.5,__failed__ (round (3.1<:2.5)) +round,2L%3L<:2,__failed__ (round (2L%3L<:2)) +round,1L%2L<:3L%4L,__failed__ (round (1L%2L<:3L%4L)) +round,-inf,-inf +round,nan,nan +frac,1,0 +frac,-1,0 +frac,0,0 +frac,0.0,0.0 +frac,1.2,0.2 +frac,-1.2,-0.2 +frac,1L%3L,1L%3L +frac,(-1L)%4L,(-1L)%4L +frac,1+:2,__failed__ (frac (1+:2)) +frac,-1+:2,__failed__ (frac (-1+:2)) +frac,1+:-2,__failed__ (frac (1+:-2)) +frac,-1.2+:4.3,__failed__ (frac (-1.2+:4.3)) +frac,1.2+:-4.3,__failed__ (frac (1.2+:-4.3)) +frac,1L%2L+:1,__failed__ (frac (1L%2L+:1)) +frac,1L%2L+:3L%4L,__failed__ (frac (1L%2L+:3L%4L)) +frac,3<:1,__failed__ (frac (3<:1)) +frac,3<:-2.14159265358979,__failed__ (frac (3<:-2.14159265358979)) +frac,3.0<:-3,__failed__ (frac (3.0<:-3)) +frac,3.1<:2.5,__failed__ (frac (3.1<:2.5)) +frac,2L%3L<:2,__failed__ (frac (2L%3L<:2)) +frac,1L%2L<:3L%4L,__failed__ (frac (1L%2L<:3L%4L)) +frac,-inf,nan +frac,nan,nan +complexp,1,0 +complexp,-1,0 +complexp,0,0 +complexp,0.0,0 +complexp,1.2,0 +complexp,-1.2,0 +complexp,1L%3L,0 +complexp,(-1L)%4L,0 +complexp,1+:2,1 +complexp,-1+:2,1 +complexp,1+:-2,1 +complexp,-1.2+:4.3,1 +complexp,1.2+:-4.3,1 +complexp,1L%2L+:1,1 +complexp,1L%2L+:3L%4L,1 +complexp,3<:1,1 +complexp,3<:-2.14159265358979,1 +complexp,3.0<:-3,1 +complexp,3.1<:2.5,1 +complexp,2L%3L<:2,1 +complexp,1L%2L<:3L%4L,1 +complexp,-inf,0 +complexp,nan,0 +realp,1,1 +realp,-1,1 +realp,0,1 +realp,0.0,1 +realp,1.2,1 +realp,-1.2,1 +realp,1L%3L,1 +realp,(-1L)%4L,1 +realp,1+:2,0 +realp,-1+:2,0 +realp,1+:-2,0 +realp,-1.2+:4.3,0 +realp,1.2+:-4.3,0 +realp,1L%2L+:1,0 +realp,1L%2L+:3L%4L,0 +realp,3<:1,0 +realp,3<:-2.14159265358979,0 +realp,3.0<:-3,0 +realp,3.1<:2.5,0 +realp,2L%3L<:2,0 +realp,1L%2L<:3L%4L,0 +realp,-inf,1 +realp,nan,1 +rationalp,1,0 +rationalp,-1,0 +rationalp,0,0 +rationalp,0.0,0 +rationalp,1.2,0 +rationalp,-1.2,0 +rationalp,1L%3L,1 +rationalp,(-1L)%4L,1 +rationalp,1+:2,0 +rationalp,-1+:2,0 +rationalp,1+:-2,0 +rationalp,-1.2+:4.3,0 +rationalp,1.2+:-4.3,0 +rationalp,1L%2L+:1,0 +rationalp,1L%2L+:3L%4L,0 +rationalp,3<:1,0 +rationalp,3<:-2.14159265358979,0 +rationalp,3.0<:-3,0 +rationalp,3.1<:2.5,0 +rationalp,2L%3L<:2,0 +rationalp,1L%2L<:3L%4L,0 +rationalp,-inf,0 +rationalp,nan,0 +numberp,1,1 +numberp,-1,1 +numberp,0,1 +numberp,0.0,1 +numberp,1.2,1 +numberp,-1.2,1 +numberp,1L%3L,1 +numberp,(-1L)%4L,1 +numberp,1+:2,1 +numberp,-1+:2,1 +numberp,1+:-2,1 +numberp,-1.2+:4.3,1 +numberp,1.2+:-4.3,1 +numberp,1L%2L+:1,1 +numberp,1L%2L+:3L%4L,1 +numberp,3<:1,1 +numberp,3<:-2.14159265358979,1 +numberp,3.0<:-3,1 +numberp,3.1<:2.5,1 +numberp,2L%3L<:2,1 +numberp,1L%2L<:3L%4L,1 +numberp,-inf,1 +numberp,nan,1 +exactp,1,1 +exactp,-1,1 +exactp,0,1 +exactp,0.0,0 +exactp,1.2,0 +exactp,-1.2,0 +exactp,1L%3L,1 +exactp,(-1L)%4L,1 +exactp,1+:2,1 +exactp,-1+:2,1 +exactp,1+:-2,1 +exactp,-1.2+:4.3,0 +exactp,1.2+:-4.3,0 +exactp,1L%2L+:1,1 +exactp,1L%2L+:3L%4L,1 +exactp,3<:1,0 +exactp,3<:-2.14159265358979,0 +exactp,3.0<:-3,0 +exactp,3.1<:2.5,0 +exactp,2L%3L<:2,0 +exactp,1L%2L<:3L%4L,0 +exactp,-inf,0 +exactp,nan,0 +inexactp,1,0 +inexactp,-1,0 +inexactp,0,0 +inexactp,0.0,1 +inexactp,1.2,1 +inexactp,-1.2,1 +inexactp,1L%3L,0 +inexactp,(-1L)%4L,0 +inexactp,1+:2,0 +inexactp,-1+:2,0 +inexactp,1+:-2,0 +inexactp,-1.2+:4.3,1 +inexactp,1.2+:-4.3,1 +inexactp,1L%2L+:1,0 +inexactp,1L%2L+:3L%4L,0 +inexactp,3<:1,1 +inexactp,3<:-2.14159265358979,1 +inexactp,3.0<:-3,1 +inexactp,3.1<:2.5,1 +inexactp,2L%3L<:2,1 +inexactp,1L%2L<:3L%4L,1 +inexactp,-inf,1 +inexactp,nan,1 +infp,1,0 +infp,-1,0 +infp,0,0 +infp,0.0,0 +infp,1.2,0 +infp,-1.2,0 +infp,1L%3L,0 +infp,(-1L)%4L,0 +infp,1+:2,0 +infp,-1+:2,0 +infp,1+:-2,0 +infp,-1.2+:4.3,0 +infp,1.2+:-4.3,0 +infp,1L%2L+:1,0 +infp,1L%2L+:3L%4L,0 +infp,3<:1,0 +infp,3<:-2.14159265358979,0 +infp,3.0<:-3,0 +infp,3.1<:2.5,0 +infp,2L%3L<:2,0 +infp,1L%2L<:3L%4L,0 +infp,-inf,1 +infp,nan,0 +nanp,1,0 +nanp,-1,0 +nanp,0,0 +nanp,0.0,0 +nanp,1.2,0 +nanp,-1.2,0 +nanp,1L%3L,0 +nanp,(-1L)%4L,0 +nanp,1+:2,0 +nanp,-1+:2,0 +nanp,1+:-2,0 +nanp,-1.2+:4.3,0 +nanp,1.2+:-4.3,0 +nanp,1L%2L+:1,0 +nanp,1L%2L+:3L%4L,0 +nanp,3<:1,0 +nanp,3<:-2.14159265358979,0 +nanp,3.0<:-3,0 +nanp,3.1<:2.5,0 +nanp,2L%3L<:2,0 +nanp,1L%2L<:3L%4L,0 +nanp,-inf,0 +nanp,nan,1 +*** BINARY *** +(+),1,1,2 +(+),1,-1,0 +(+),1,0,1 +(+),1,0.0,1.0 +(+),1,1.2,2.2 +(+),1,-1.2,-0.2 +(+),1,1L%3L,4L%3L +(+),1,(-1L)%4L,3L%4L +(+),1,1+:2,2+:2 +(+),1,-1+:2,0+:2 +(+),1,1+:-2,2+:-2 +(+),1,-1.2+:4.3,-0.2+:4.3 +(+),1,1.2+:-4.3,2.2+:-4.3 +(+),1,1L%2L+:1,3L%2L+:1 +(+),1,1L%2L+:3L%4L,3L%2L+:3L%4L +(+),1,3<:1,2.62090691760442+:2.52441295442369 +(+),1,3<:-2.14159265358979,-0.62090691760442+:-2.52441295442369 +(+),1,3.0<:-3,-1.96997748980134+:-0.423360024179602 +(+),1,3.1<:2.5,-1.48354520819549+:1.85526364672227 +(+),1,2L%3L<:2,0.722568775635238+:0.606198284550454 +(+),1,1L%2L<:3L%4L,1.36584443443691+:0.340819380011667 +(+),1,-inf,-inf +(+),1,nan,nan +(+),-1,1,0 +(+),-1,-1,-2 +(+),-1,0,-1 +(+),-1,0.0,-1.0 +(+),-1,1.2,0.2 +(+),-1,-1.2,-2.2 +(+),-1,1L%3L,(-2L)%3L +(+),-1,(-1L)%4L,(-5L)%4L +(+),-1,1+:2,0+:2 +(+),-1,-1+:2,-2+:2 +(+),-1,1+:-2,0+:-2 +(+),-1,-1.2+:4.3,-2.2+:4.3 +(+),-1,1.2+:-4.3,0.2+:-4.3 +(+),-1,1L%2L+:1,(-1L)%2L+:1 +(+),-1,1L%2L+:3L%4L,(-1L)%2L+:3L%4L +(+),-1,3<:1,0.620906917604419+:2.52441295442369 +(+),-1,3<:-2.14159265358979,-2.62090691760442+:-2.52441295442369 +(+),-1,3.0<:-3,-3.96997748980134+:-0.423360024179602 +(+),-1,3.1<:2.5,-3.48354520819549+:1.85526364672227 +(+),-1,2L%3L<:2,-1.27743122436476+:0.606198284550454 +(+),-1,1L%2L<:3L%4L,-0.634155565563089+:0.340819380011667 +(+),-1,-inf,-inf +(+),-1,nan,nan +(+),0,1,1 +(+),0,-1,-1 +(+),0,0,0 +(+),0,0.0,0.0 +(+),0,1.2,1.2 +(+),0,-1.2,-1.2 +(+),0,1L%3L,1L%3L +(+),0,(-1L)%4L,(-1L)%4L +(+),0,1+:2,1+:2 +(+),0,-1+:2,-1+:2 +(+),0,1+:-2,1+:-2 +(+),0,-1.2+:4.3,-1.2+:4.3 +(+),0,1.2+:-4.3,1.2+:-4.3 +(+),0,1L%2L+:1,1L%2L+:1 +(+),0,1L%2L+:3L%4L,1L%2L+:3L%4L +(+),0,3<:1,1.62090691760442+:2.52441295442369 +(+),0,3<:-2.14159265358979,-1.62090691760442+:-2.52441295442369 +(+),0,3.0<:-3,-2.96997748980134+:-0.423360024179602 +(+),0,3.1<:2.5,-2.48354520819549+:1.85526364672227 +(+),0,2L%3L<:2,-0.277431224364762+:0.606198284550454 +(+),0,1L%2L<:3L%4L,0.36584443443691+:0.340819380011667 +(+),0,-inf,-inf +(+),0,nan,nan +(+),0.0,1,1.0 +(+),0.0,-1,-1.0 +(+),0.0,0,0.0 +(+),0.0,0.0,0.0 +(+),0.0,1.2,1.2 +(+),0.0,-1.2,-1.2 +(+),0.0,1L%3L,0.333333333333333 +(+),0.0,(-1L)%4L,-0.25 +(+),0.0,1+:2,1.0+:2 +(+),0.0,-1+:2,-1.0+:2 +(+),0.0,1+:-2,1.0+:-2 +(+),0.0,-1.2+:4.3,-1.2+:4.3 +(+),0.0,1.2+:-4.3,1.2+:-4.3 +(+),0.0,1L%2L+:1,0.5+:1 +(+),0.0,1L%2L+:3L%4L,0.5+:3L%4L +(+),0.0,3<:1,1.62090691760442+:2.52441295442369 +(+),0.0,3<:-2.14159265358979,-1.62090691760442+:-2.52441295442369 +(+),0.0,3.0<:-3,-2.96997748980134+:-0.423360024179602 +(+),0.0,3.1<:2.5,-2.48354520819549+:1.85526364672227 +(+),0.0,2L%3L<:2,-0.277431224364762+:0.606198284550454 +(+),0.0,1L%2L<:3L%4L,0.36584443443691+:0.340819380011667 +(+),0.0,-inf,-inf +(+),0.0,nan,nan +(+),1.2,1,2.2 +(+),1.2,-1,0.2 +(+),1.2,0,1.2 +(+),1.2,0.0,1.2 +(+),1.2,1.2,2.4 +(+),1.2,-1.2,0.0 +(+),1.2,1L%3L,1.53333333333333 +(+),1.2,(-1L)%4L,0.95 +(+),1.2,1+:2,2.2+:2 +(+),1.2,-1+:2,0.2+:2 +(+),1.2,1+:-2,2.2+:-2 +(+),1.2,-1.2+:4.3,0.0+:4.3 +(+),1.2,1.2+:-4.3,2.4+:-4.3 +(+),1.2,1L%2L+:1,1.7+:1 +(+),1.2,1L%2L+:3L%4L,1.7+:3L%4L +(+),1.2,3<:1,2.82090691760442+:2.52441295442369 +(+),1.2,3<:-2.14159265358979,-0.42090691760442+:-2.52441295442369 +(+),1.2,3.0<:-3,-1.76997748980134+:-0.423360024179602 +(+),1.2,3.1<:2.5,-1.28354520819549+:1.85526364672227 +(+),1.2,2L%3L<:2,0.922568775635238+:0.606198284550454 +(+),1.2,1L%2L<:3L%4L,1.56584443443691+:0.340819380011667 +(+),1.2,-inf,-inf +(+),1.2,nan,nan +(+),-1.2,1,-0.2 +(+),-1.2,-1,-2.2 +(+),-1.2,0,-1.2 +(+),-1.2,0.0,-1.2 +(+),-1.2,1.2,0.0 +(+),-1.2,-1.2,-2.4 +(+),-1.2,1L%3L,-0.866666666666667 +(+),-1.2,(-1L)%4L,-1.45 +(+),-1.2,1+:2,-0.2+:2 +(+),-1.2,-1+:2,-2.2+:2 +(+),-1.2,1+:-2,-0.2+:-2 +(+),-1.2,-1.2+:4.3,-2.4+:4.3 +(+),-1.2,1.2+:-4.3,0.0+:-4.3 +(+),-1.2,1L%2L+:1,-0.7+:1 +(+),-1.2,1L%2L+:3L%4L,-0.7+:3L%4L +(+),-1.2,3<:1,0.420906917604419+:2.52441295442369 +(+),-1.2,3<:-2.14159265358979,-2.82090691760442+:-2.52441295442369 +(+),-1.2,3.0<:-3,-4.16997748980134+:-0.423360024179602 +(+),-1.2,3.1<:2.5,-3.68354520819549+:1.85526364672227 +(+),-1.2,2L%3L<:2,-1.47743122436476+:0.606198284550454 +(+),-1.2,1L%2L<:3L%4L,-0.834155565563089+:0.340819380011667 +(+),-1.2,-inf,-inf +(+),-1.2,nan,nan +(+),1L%3L,1,4L%3L +(+),1L%3L,-1,(-2L)%3L +(+),1L%3L,0,1L%3L +(+),1L%3L,0.0,0.333333333333333 +(+),1L%3L,1.2,1.53333333333333 +(+),1L%3L,-1.2,-0.866666666666667 +(+),1L%3L,1L%3L,2L%3L +(+),1L%3L,(-1L)%4L,1L%12L +(+),1L%3L,1+:2,4L%3L+:2 +(+),1L%3L,-1+:2,(-2L)%3L+:2 +(+),1L%3L,1+:-2,4L%3L+:-2 +(+),1L%3L,-1.2+:4.3,-0.866666666666667+:4.3 +(+),1L%3L,1.2+:-4.3,1.53333333333333+:-4.3 +(+),1L%3L,1L%2L+:1,5L%6L+:1 +(+),1L%3L,1L%2L+:3L%4L,5L%6L+:3L%4L +(+),1L%3L,3<:1,1.95424025093775+:2.52441295442369 +(+),1L%3L,3<:-2.14159265358979,-1.28757358427109+:-2.52441295442369 +(+),1L%3L,3.0<:-3,-2.636644156468+:-0.423360024179602 +(+),1L%3L,3.1<:2.5,-2.15021187486216+:1.85526364672227 +(+),1L%3L,2L%3L<:2,0.0559021089685718+:0.606198284550454 +(+),1L%3L,1L%2L<:3L%4L,0.699177767770244+:0.340819380011667 +(+),1L%3L,-inf,-inf +(+),1L%3L,nan,nan +(+),(-1L)%4L,1,3L%4L +(+),(-1L)%4L,-1,(-5L)%4L +(+),(-1L)%4L,0,(-1L)%4L +(+),(-1L)%4L,0.0,-0.25 +(+),(-1L)%4L,1.2,0.95 +(+),(-1L)%4L,-1.2,-1.45 +(+),(-1L)%4L,1L%3L,1L%12L +(+),(-1L)%4L,(-1L)%4L,(-1L)%2L +(+),(-1L)%4L,1+:2,3L%4L+:2 +(+),(-1L)%4L,-1+:2,(-5L)%4L+:2 +(+),(-1L)%4L,1+:-2,3L%4L+:-2 +(+),(-1L)%4L,-1.2+:4.3,-1.45+:4.3 +(+),(-1L)%4L,1.2+:-4.3,0.95+:-4.3 +(+),(-1L)%4L,1L%2L+:1,1L%4L+:1 +(+),(-1L)%4L,1L%2L+:3L%4L,1L%4L+:3L%4L +(+),(-1L)%4L,3<:1,1.37090691760442+:2.52441295442369 +(+),(-1L)%4L,3<:-2.14159265358979,-1.87090691760442+:-2.52441295442369 +(+),(-1L)%4L,3.0<:-3,-3.21997748980134+:-0.423360024179602 +(+),(-1L)%4L,3.1<:2.5,-2.73354520819549+:1.85526364672227 +(+),(-1L)%4L,2L%3L<:2,-0.527431224364762+:0.606198284550454 +(+),(-1L)%4L,1L%2L<:3L%4L,0.11584443443691+:0.340819380011667 +(+),(-1L)%4L,-inf,-inf +(+),(-1L)%4L,nan,nan +(+),1+:2,1,2+:2 +(+),1+:2,-1,0+:2 +(+),1+:2,0,1+:2 +(+),1+:2,0.0,1.0+:2 +(+),1+:2,1.2,2.2+:2 +(+),1+:2,-1.2,-0.2+:2 +(+),1+:2,1L%3L,4L%3L+:2 +(+),1+:2,(-1L)%4L,3L%4L+:2 +(+),1+:2,1+:2,2+:4 +(+),1+:2,-1+:2,0+:4 +(+),1+:2,1+:-2,2+:0 +(+),1+:2,-1.2+:4.3,-0.2+:6.3 +(+),1+:2,1.2+:-4.3,2.2+:-2.3 +(+),1+:2,1L%2L+:1,3L%2L+:3 +(+),1+:2,1L%2L+:3L%4L,3L%2L+:11L%4L +(+),1+:2,3<:1,2.62090691760442+:4.52441295442369 +(+),1+:2,3<:-2.14159265358979,-0.62090691760442+:-0.524412954423689 +(+),1+:2,3.0<:-3,-1.96997748980134+:1.5766399758204 +(+),1+:2,3.1<:2.5,-1.48354520819549+:3.85526364672227 +(+),1+:2,2L%3L<:2,0.722568775635238+:2.60619828455045 +(+),1+:2,1L%2L<:3L%4L,1.36584443443691+:2.34081938001167 +(+),1+:2,-inf,-inf+:2 +(+),1+:2,nan,nan+:2 +(+),-1+:2,1,0+:2 +(+),-1+:2,-1,-2+:2 +(+),-1+:2,0,-1+:2 +(+),-1+:2,0.0,-1.0+:2 +(+),-1+:2,1.2,0.2+:2 +(+),-1+:2,-1.2,-2.2+:2 +(+),-1+:2,1L%3L,(-2L)%3L+:2 +(+),-1+:2,(-1L)%4L,(-5L)%4L+:2 +(+),-1+:2,1+:2,0+:4 +(+),-1+:2,-1+:2,-2+:4 +(+),-1+:2,1+:-2,0+:0 +(+),-1+:2,-1.2+:4.3,-2.2+:6.3 +(+),-1+:2,1.2+:-4.3,0.2+:-2.3 +(+),-1+:2,1L%2L+:1,(-1L)%2L+:3 +(+),-1+:2,1L%2L+:3L%4L,(-1L)%2L+:11L%4L +(+),-1+:2,3<:1,0.620906917604419+:4.52441295442369 +(+),-1+:2,3<:-2.14159265358979,-2.62090691760442+:-0.524412954423689 +(+),-1+:2,3.0<:-3,-3.96997748980134+:1.5766399758204 +(+),-1+:2,3.1<:2.5,-3.48354520819549+:3.85526364672227 +(+),-1+:2,2L%3L<:2,-1.27743122436476+:2.60619828455045 +(+),-1+:2,1L%2L<:3L%4L,-0.634155565563089+:2.34081938001167 +(+),-1+:2,-inf,-inf+:2 +(+),-1+:2,nan,nan+:2 +(+),1+:-2,1,2+:-2 +(+),1+:-2,-1,0+:-2 +(+),1+:-2,0,1+:-2 +(+),1+:-2,0.0,1.0+:-2 +(+),1+:-2,1.2,2.2+:-2 +(+),1+:-2,-1.2,-0.2+:-2 +(+),1+:-2,1L%3L,4L%3L+:-2 +(+),1+:-2,(-1L)%4L,3L%4L+:-2 +(+),1+:-2,1+:2,2+:0 +(+),1+:-2,-1+:2,0+:0 +(+),1+:-2,1+:-2,2+:-4 +(+),1+:-2,-1.2+:4.3,-0.2+:2.3 +(+),1+:-2,1.2+:-4.3,2.2+:-6.3 +(+),1+:-2,1L%2L+:1,3L%2L+:-1 +(+),1+:-2,1L%2L+:3L%4L,3L%2L+:(-5L)%4L +(+),1+:-2,3<:1,2.62090691760442+:0.524412954423689 +(+),1+:-2,3<:-2.14159265358979,-0.62090691760442+:-4.52441295442369 +(+),1+:-2,3.0<:-3,-1.96997748980134+:-2.4233600241796 +(+),1+:-2,3.1<:2.5,-1.48354520819549+:-0.144736353277735 +(+),1+:-2,2L%3L<:2,0.722568775635238+:-1.39380171544955 +(+),1+:-2,1L%2L<:3L%4L,1.36584443443691+:-1.65918061998833 +(+),1+:-2,-inf,-inf+:-2 +(+),1+:-2,nan,nan+:-2 +(+),-1.2+:4.3,1,-0.2+:4.3 +(+),-1.2+:4.3,-1,-2.2+:4.3 +(+),-1.2+:4.3,0,-1.2+:4.3 +(+),-1.2+:4.3,0.0,-1.2+:4.3 +(+),-1.2+:4.3,1.2,0.0+:4.3 +(+),-1.2+:4.3,-1.2,-2.4+:4.3 +(+),-1.2+:4.3,1L%3L,-0.866666666666667+:4.3 +(+),-1.2+:4.3,(-1L)%4L,-1.45+:4.3 +(+),-1.2+:4.3,1+:2,-0.2+:6.3 +(+),-1.2+:4.3,-1+:2,-2.2+:6.3 +(+),-1.2+:4.3,1+:-2,-0.2+:2.3 +(+),-1.2+:4.3,-1.2+:4.3,-2.4+:8.6 +(+),-1.2+:4.3,1.2+:-4.3,0.0+:0.0 +(+),-1.2+:4.3,1L%2L+:1,-0.7+:5.3 +(+),-1.2+:4.3,1L%2L+:3L%4L,-0.7+:5.05 +(+),-1.2+:4.3,3<:1,0.420906917604419+:6.82441295442369 +(+),-1.2+:4.3,3<:-2.14159265358979,-2.82090691760442+:1.77558704557631 +(+),-1.2+:4.3,3.0<:-3,-4.16997748980134+:3.8766399758204 +(+),-1.2+:4.3,3.1<:2.5,-3.68354520819549+:6.15526364672226 +(+),-1.2+:4.3,2L%3L<:2,-1.47743122436476+:4.90619828455045 +(+),-1.2+:4.3,1L%2L<:3L%4L,-0.834155565563089+:4.64081938001167 +(+),-1.2+:4.3,-inf,-inf+:4.3 +(+),-1.2+:4.3,nan,nan+:4.3 +(+),1.2+:-4.3,1,2.2+:-4.3 +(+),1.2+:-4.3,-1,0.2+:-4.3 +(+),1.2+:-4.3,0,1.2+:-4.3 +(+),1.2+:-4.3,0.0,1.2+:-4.3 +(+),1.2+:-4.3,1.2,2.4+:-4.3 +(+),1.2+:-4.3,-1.2,0.0+:-4.3 +(+),1.2+:-4.3,1L%3L,1.53333333333333+:-4.3 +(+),1.2+:-4.3,(-1L)%4L,0.95+:-4.3 +(+),1.2+:-4.3,1+:2,2.2+:-2.3 +(+),1.2+:-4.3,-1+:2,0.2+:-2.3 +(+),1.2+:-4.3,1+:-2,2.2+:-6.3 +(+),1.2+:-4.3,-1.2+:4.3,0.0+:0.0 +(+),1.2+:-4.3,1.2+:-4.3,2.4+:-8.6 +(+),1.2+:-4.3,1L%2L+:1,1.7+:-3.3 +(+),1.2+:-4.3,1L%2L+:3L%4L,1.7+:-3.55 +(+),1.2+:-4.3,3<:1,2.82090691760442+:-1.77558704557631 +(+),1.2+:-4.3,3<:-2.14159265358979,-0.42090691760442+:-6.82441295442369 +(+),1.2+:-4.3,3.0<:-3,-1.76997748980134+:-4.7233600241796 +(+),1.2+:-4.3,3.1<:2.5,-1.28354520819549+:-2.44473635327773 +(+),1.2+:-4.3,2L%3L<:2,0.922568775635238+:-3.69380171544955 +(+),1.2+:-4.3,1L%2L<:3L%4L,1.56584443443691+:-3.95918061998833 +(+),1.2+:-4.3,-inf,-inf+:-4.3 +(+),1.2+:-4.3,nan,nan+:-4.3 +(+),1L%2L+:1,1,3L%2L+:1 +(+),1L%2L+:1,-1,(-1L)%2L+:1 +(+),1L%2L+:1,0,1L%2L+:1 +(+),1L%2L+:1,0.0,0.5+:1 +(+),1L%2L+:1,1.2,1.7+:1 +(+),1L%2L+:1,-1.2,-0.7+:1 +(+),1L%2L+:1,1L%3L,5L%6L+:1 +(+),1L%2L+:1,(-1L)%4L,1L%4L+:1 +(+),1L%2L+:1,1+:2,3L%2L+:3 +(+),1L%2L+:1,-1+:2,(-1L)%2L+:3 +(+),1L%2L+:1,1+:-2,3L%2L+:-1 +(+),1L%2L+:1,-1.2+:4.3,-0.7+:5.3 +(+),1L%2L+:1,1.2+:-4.3,1.7+:-3.3 +(+),1L%2L+:1,1L%2L+:1,1L%1L+:2 +(+),1L%2L+:1,1L%2L+:3L%4L,1L%1L+:7L%4L +(+),1L%2L+:1,3<:1,2.12090691760442+:3.52441295442369 +(+),1L%2L+:1,3<:-2.14159265358979,-1.12090691760442+:-1.52441295442369 +(+),1L%2L+:1,3.0<:-3,-2.46997748980134+:0.576639975820398 +(+),1L%2L+:1,3.1<:2.5,-1.98354520819549+:2.85526364672227 +(+),1L%2L+:1,2L%3L<:2,0.222568775635238+:1.60619828455045 +(+),1L%2L+:1,1L%2L<:3L%4L,0.865844434436911+:1.34081938001167 +(+),1L%2L+:1,-inf,-inf+:1 +(+),1L%2L+:1,nan,nan+:1 +(+),1L%2L+:3L%4L,1,3L%2L+:3L%4L +(+),1L%2L+:3L%4L,-1,(-1L)%2L+:3L%4L +(+),1L%2L+:3L%4L,0,1L%2L+:3L%4L +(+),1L%2L+:3L%4L,0.0,0.5+:3L%4L +(+),1L%2L+:3L%4L,1.2,1.7+:3L%4L +(+),1L%2L+:3L%4L,-1.2,-0.7+:3L%4L +(+),1L%2L+:3L%4L,1L%3L,5L%6L+:3L%4L +(+),1L%2L+:3L%4L,(-1L)%4L,1L%4L+:3L%4L +(+),1L%2L+:3L%4L,1+:2,3L%2L+:11L%4L +(+),1L%2L+:3L%4L,-1+:2,(-1L)%2L+:11L%4L +(+),1L%2L+:3L%4L,1+:-2,3L%2L+:(-5L)%4L +(+),1L%2L+:3L%4L,-1.2+:4.3,-0.7+:5.05 +(+),1L%2L+:3L%4L,1.2+:-4.3,1.7+:-3.55 +(+),1L%2L+:3L%4L,1L%2L+:1,1L%1L+:7L%4L +(+),1L%2L+:3L%4L,1L%2L+:3L%4L,1L%1L+:3L%2L +(+),1L%2L+:3L%4L,3<:1,2.12090691760442+:3.27441295442369 +(+),1L%2L+:3L%4L,3<:-2.14159265358979,-1.12090691760442+:-1.77441295442369 +(+),1L%2L+:3L%4L,3.0<:-3,-2.46997748980134+:0.326639975820398 +(+),1L%2L+:3L%4L,3.1<:2.5,-1.98354520819549+:2.60526364672227 +(+),1L%2L+:3L%4L,2L%3L<:2,0.222568775635238+:1.35619828455045 +(+),1L%2L+:3L%4L,1L%2L<:3L%4L,0.865844434436911+:1.09081938001167 +(+),1L%2L+:3L%4L,-inf,-inf+:3L%4L +(+),1L%2L+:3L%4L,nan,nan+:3L%4L +(+),3<:1,1,2.62090691760442+:2.52441295442369 +(+),3<:1,-1,0.620906917604419+:2.52441295442369 +(+),3<:1,0,1.62090691760442+:2.52441295442369 +(+),3<:1,0.0,1.62090691760442+:2.52441295442369 +(+),3<:1,1.2,2.82090691760442+:2.52441295442369 +(+),3<:1,-1.2,0.420906917604419+:2.52441295442369 +(+),3<:1,1L%3L,1.95424025093775+:2.52441295442369 +(+),3<:1,(-1L)%4L,1.37090691760442+:2.52441295442369 +(+),3<:1,1+:2,2.62090691760442+:4.52441295442369 +(+),3<:1,-1+:2,0.620906917604419+:4.52441295442369 +(+),3<:1,1+:-2,2.62090691760442+:0.524412954423689 +(+),3<:1,-1.2+:4.3,0.420906917604419+:6.82441295442369 +(+),3<:1,1.2+:-4.3,2.82090691760442+:-1.77558704557631 +(+),3<:1,1L%2L+:1,2.12090691760442+:3.52441295442369 +(+),3<:1,1L%2L+:3L%4L,2.12090691760442+:3.27441295442369 +(+),3<:1,3<:1,6.0<:1.0 +(+),3<:1,3<:-2.14159265358979,8.00593208497344e-16<:2.55359005004223 +(+),3<:1,3.0<:-3,2.49688101928285<:2.14159265358979 +(+),3<:1,3.1<:2.5,4.46382257163289<:1.76527088594645 +(+),3<:1,2L%3L<:2,3.4067071591079<:1.16542289562596 +(+),3<:1,1L%2L<:3L%4L,3.4866512967505<:0.964513817052556 +(+),3<:1,-inf,-inf+:2.52441295442369 +(+),3<:1,nan,nan+:2.52441295442369 +(+),3<:-2.14159265358979,1,-0.62090691760442+:-2.52441295442369 +(+),3<:-2.14159265358979,-1,-2.62090691760442+:-2.52441295442369 +(+),3<:-2.14159265358979,0,-1.62090691760442+:-2.52441295442369 +(+),3<:-2.14159265358979,0.0,-1.62090691760442+:-2.52441295442369 +(+),3<:-2.14159265358979,1.2,-0.42090691760442+:-2.52441295442369 +(+),3<:-2.14159265358979,-1.2,-2.82090691760442+:-2.52441295442369 +(+),3<:-2.14159265358979,1L%3L,-1.28757358427109+:-2.52441295442369 +(+),3<:-2.14159265358979,(-1L)%4L,-1.87090691760442+:-2.52441295442369 +(+),3<:-2.14159265358979,1+:2,-0.62090691760442+:-0.524412954423689 +(+),3<:-2.14159265358979,-1+:2,-2.62090691760442+:-0.524412954423689 +(+),3<:-2.14159265358979,1+:-2,-0.62090691760442+:-4.52441295442369 +(+),3<:-2.14159265358979,-1.2+:4.3,-2.82090691760442+:1.77558704557631 +(+),3<:-2.14159265358979,1.2+:-4.3,-0.42090691760442+:-6.82441295442369 +(+),3<:-2.14159265358979,1L%2L+:1,-1.12090691760442+:-1.52441295442369 +(+),3<:-2.14159265358979,1L%2L+:3L%4L,-1.12090691760442+:-1.77441295442369 +(+),3<:-2.14159265358979,3<:1,8.00593208497344e-16<:2.55359005004223 +(+),3<:-2.14159265358979,3<:-2.14159265358979,6.0<:-2.14159265358979 +(+),3<:-2.14159265358979,3.0<:-3,5.45578456095409<:-2.5707963267949 +(+),3<:-2.14159265358979,3.1<:2.5,4.1586401682498<:-2.97998431432232 +(+),3<:-2.14159265358979,2L%3L<:2,2.69874697238772<:-2.350986558013 +(+),3<:-2.14159265358979,1L%2L<:3L%4L,2.51858347784386<:-2.09245718906053 +(+),3<:-2.14159265358979,-inf,-inf+:-2.52441295442369 +(+),3<:-2.14159265358979,nan,nan+:-2.52441295442369 +(+),3.0<:-3,1,-1.96997748980134+:-0.423360024179602 +(+),3.0<:-3,-1,-3.96997748980134+:-0.423360024179602 +(+),3.0<:-3,0,-2.96997748980134+:-0.423360024179602 +(+),3.0<:-3,0.0,-2.96997748980134+:-0.423360024179602 +(+),3.0<:-3,1.2,-1.76997748980134+:-0.423360024179602 +(+),3.0<:-3,-1.2,-4.16997748980134+:-0.423360024179602 +(+),3.0<:-3,1L%3L,-2.636644156468+:-0.423360024179602 +(+),3.0<:-3,(-1L)%4L,-3.21997748980134+:-0.423360024179602 +(+),3.0<:-3,1+:2,-1.96997748980134+:1.5766399758204 +(+),3.0<:-3,-1+:2,-3.96997748980134+:1.5766399758204 +(+),3.0<:-3,1+:-2,-1.96997748980134+:-2.4233600241796 +(+),3.0<:-3,-1.2+:4.3,-4.16997748980134+:3.8766399758204 +(+),3.0<:-3,1.2+:-4.3,-1.76997748980134+:-4.7233600241796 +(+),3.0<:-3,1L%2L+:1,-2.46997748980134+:0.576639975820398 +(+),3.0<:-3,1L%2L+:3L%4L,-2.46997748980134+:0.326639975820398 +(+),3.0<:-3,3<:1,2.49688101928285<:2.14159265358979 +(+),3.0<:-3,3<:-2.14159265358979,5.45578456095409<:-2.5707963267949 +(+),3.0<:-3,3.0<:-3,6.0<:-3.0 +(+),3.0<:-3,3.1<:2.5,5.63837368412359<:2.88482361116615 +(+),3.0<:-3,2L%3L<:2,3.25255179609754<:3.08534921657721 +(+),3.0<:-3,1L%2L<:3L%4L,2.60544083179437<:-3.10990724507866 +(+),3.0<:-3,-inf,-inf+:-0.423360024179602 +(+),3.0<:-3,nan,nan+:-0.423360024179602 +(+),3.1<:2.5,1,-1.48354520819549+:1.85526364672227 +(+),3.1<:2.5,-1,-3.48354520819549+:1.85526364672227 +(+),3.1<:2.5,0,-2.48354520819549+:1.85526364672227 +(+),3.1<:2.5,0.0,-2.48354520819549+:1.85526364672227 +(+),3.1<:2.5,1.2,-1.28354520819549+:1.85526364672227 +(+),3.1<:2.5,-1.2,-3.68354520819549+:1.85526364672227 +(+),3.1<:2.5,1L%3L,-2.15021187486216+:1.85526364672227 +(+),3.1<:2.5,(-1L)%4L,-2.73354520819549+:1.85526364672227 +(+),3.1<:2.5,1+:2,-1.48354520819549+:3.85526364672227 +(+),3.1<:2.5,-1+:2,-3.48354520819549+:3.85526364672227 +(+),3.1<:2.5,1+:-2,-1.48354520819549+:-0.144736353277735 +(+),3.1<:2.5,-1.2+:4.3,-3.68354520819549+:6.15526364672226 +(+),3.1<:2.5,1.2+:-4.3,-1.28354520819549+:-2.44473635327773 +(+),3.1<:2.5,1L%2L+:1,-1.98354520819549+:2.85526364672227 +(+),3.1<:2.5,1L%2L+:3L%4L,-1.98354520819549+:2.60526364672227 +(+),3.1<:2.5,3<:1,4.46382257163289<:1.76527088594645 +(+),3.1<:2.5,3<:-2.14159265358979,4.1586401682498<:-2.97998431432232 +(+),3.1<:2.5,3.0<:-3,5.63837368412359<:2.88482361116615 +(+),3.1<:2.5,3.1<:2.5,6.2<:2.5 +(+),3.1<:2.5,2L%3L<:2,3.6988897929322<:2.41348320098687 +(+),3.1<:2.5,1L%2L<:3L%4L,3.05080927419047<:2.33802630370136 +(+),3.1<:2.5,-inf,-inf+:1.85526364672227 +(+),3.1<:2.5,nan,nan+:1.85526364672227 +(+),2L%3L<:2,1,0.722568775635238+:0.606198284550454 +(+),2L%3L<:2,-1,-1.27743122436476+:0.606198284550454 +(+),2L%3L<:2,0,-0.277431224364762+:0.606198284550454 +(+),2L%3L<:2,0.0,-0.277431224364762+:0.606198284550454 +(+),2L%3L<:2,1.2,0.922568775635238+:0.606198284550454 +(+),2L%3L<:2,-1.2,-1.47743122436476+:0.606198284550454 +(+),2L%3L<:2,1L%3L,0.0559021089685718+:0.606198284550454 +(+),2L%3L<:2,(-1L)%4L,-0.527431224364762+:0.606198284550454 +(+),2L%3L<:2,1+:2,0.722568775635238+:2.60619828455045 +(+),2L%3L<:2,-1+:2,-1.27743122436476+:2.60619828455045 +(+),2L%3L<:2,1+:-2,0.722568775635238+:-1.39380171544955 +(+),2L%3L<:2,-1.2+:4.3,-1.47743122436476+:4.90619828455045 +(+),2L%3L<:2,1.2+:-4.3,0.922568775635238+:-3.69380171544955 +(+),2L%3L<:2,1L%2L+:1,0.222568775635238+:1.60619828455045 +(+),2L%3L<:2,1L%2L+:3L%4L,0.222568775635238+:1.35619828455045 +(+),2L%3L<:2,3<:1,3.4067071591079<:1.16542289562596 +(+),2L%3L<:2,3<:-2.14159265358979,2.69874697238772<:-2.350986558013 +(+),2L%3L<:2,3.0<:-3,3.25255179609754<:3.08534921657721 +(+),2L%3L<:2,3.1<:2.5,3.6988897929322<:2.41348320098687 +(+),2L%3L<:2,2L%3L<:2,1.33333333333333<:2.0 +(+),2L%3L<:2,1L%2L<:3L%4L,0.95113582242914<:1.47770653766413 +(+),2L%3L<:2,-inf,-inf+:0.606198284550454 +(+),2L%3L<:2,nan,nan+:0.606198284550454 +(+),1L%2L<:3L%4L,1,1.36584443443691+:0.340819380011667 +(+),1L%2L<:3L%4L,-1,-0.634155565563089+:0.340819380011667 +(+),1L%2L<:3L%4L,0,0.36584443443691+:0.340819380011667 +(+),1L%2L<:3L%4L,0.0,0.36584443443691+:0.340819380011667 +(+),1L%2L<:3L%4L,1.2,1.56584443443691+:0.340819380011667 +(+),1L%2L<:3L%4L,-1.2,-0.834155565563089+:0.340819380011667 +(+),1L%2L<:3L%4L,1L%3L,0.699177767770244+:0.340819380011667 +(+),1L%2L<:3L%4L,(-1L)%4L,0.11584443443691+:0.340819380011667 +(+),1L%2L<:3L%4L,1+:2,1.36584443443691+:2.34081938001167 +(+),1L%2L<:3L%4L,-1+:2,-0.634155565563089+:2.34081938001167 +(+),1L%2L<:3L%4L,1+:-2,1.36584443443691+:-1.65918061998833 +(+),1L%2L<:3L%4L,-1.2+:4.3,-0.834155565563089+:4.64081938001167 +(+),1L%2L<:3L%4L,1.2+:-4.3,1.56584443443691+:-3.95918061998833 +(+),1L%2L<:3L%4L,1L%2L+:1,0.865844434436911+:1.34081938001167 +(+),1L%2L<:3L%4L,1L%2L+:3L%4L,0.865844434436911+:1.09081938001167 +(+),1L%2L<:3L%4L,3<:1,3.4866512967505<:0.964513817052556 +(+),1L%2L<:3L%4L,3<:-2.14159265358979,2.51858347784386<:-2.09245718906053 +(+),1L%2L<:3L%4L,3.0<:-3,2.60544083179437<:-3.10990724507866 +(+),1L%2L<:3L%4L,3.1<:2.5,3.05080927419047<:2.33802630370136 +(+),1L%2L<:3L%4L,2L%3L<:2,0.95113582242914<:1.47770653766413 +(+),1L%2L<:3L%4L,1L%2L<:3L%4L,1.0<:0.75 +(+),1L%2L<:3L%4L,-inf,-inf+:0.340819380011667 +(+),1L%2L<:3L%4L,nan,nan+:0.340819380011667 +(+),-inf,1,-inf +(+),-inf,-1,-inf +(+),-inf,0,-inf +(+),-inf,0.0,-inf +(+),-inf,1.2,-inf +(+),-inf,-1.2,-inf +(+),-inf,1L%3L,-inf +(+),-inf,(-1L)%4L,-inf +(+),-inf,1+:2,-inf+:2 +(+),-inf,-1+:2,-inf+:2 +(+),-inf,1+:-2,-inf+:-2 +(+),-inf,-1.2+:4.3,-inf+:4.3 +(+),-inf,1.2+:-4.3,-inf+:-4.3 +(+),-inf,1L%2L+:1,-inf+:1 +(+),-inf,1L%2L+:3L%4L,-inf+:3L%4L +(+),-inf,3<:1,-inf+:2.52441295442369 +(+),-inf,3<:-2.14159265358979,-inf+:-2.52441295442369 +(+),-inf,3.0<:-3,-inf+:-0.423360024179602 +(+),-inf,3.1<:2.5,-inf+:1.85526364672227 +(+),-inf,2L%3L<:2,-inf+:0.606198284550454 +(+),-inf,1L%2L<:3L%4L,-inf+:0.340819380011667 +(+),-inf,-inf,-inf +(+),-inf,nan,nan +(+),nan,1,nan +(+),nan,-1,nan +(+),nan,0,nan +(+),nan,0.0,nan +(+),nan,1.2,nan +(+),nan,-1.2,nan +(+),nan,1L%3L,nan +(+),nan,(-1L)%4L,nan +(+),nan,1+:2,nan+:2 +(+),nan,-1+:2,nan+:2 +(+),nan,1+:-2,nan+:-2 +(+),nan,-1.2+:4.3,nan+:4.3 +(+),nan,1.2+:-4.3,nan+:-4.3 +(+),nan,1L%2L+:1,nan+:1 +(+),nan,1L%2L+:3L%4L,nan+:3L%4L +(+),nan,3<:1,nan+:2.52441295442369 +(+),nan,3<:-2.14159265358979,nan+:-2.52441295442369 +(+),nan,3.0<:-3,nan+:-0.423360024179602 +(+),nan,3.1<:2.5,nan+:1.85526364672227 +(+),nan,2L%3L<:2,nan+:0.606198284550454 +(+),nan,1L%2L<:3L%4L,nan+:0.340819380011667 +(+),nan,-inf,nan +(+),nan,nan,nan +(-),1,1,0 +(-),1,-1,2 +(-),1,0,1 +(-),1,0.0,1.0 +(-),1,1.2,-0.2 +(-),1,-1.2,2.2 +(-),1,1L%3L,2L%3L +(-),1,(-1L)%4L,5L%4L +(-),1,1+:2,0+:-2 +(-),1,-1+:2,2+:-2 +(-),1,1+:-2,0+:2 +(-),1,-1.2+:4.3,2.2+:-4.3 +(-),1,1.2+:-4.3,-0.2+:4.3 +(-),1,1L%2L+:1,1L%2L+:-1 +(-),1,1L%2L+:3L%4L,1L%2L+:(-3L)%4L +(-),1,3<:1,-0.620906917604419+:-2.52441295442369 +(-),1,3<:-2.14159265358979,2.62090691760442+:2.52441295442369 +(-),1,3.0<:-3,3.96997748980134+:0.423360024179602 +(-),1,3.1<:2.5,3.48354520819549+:-1.85526364672227 +(-),1,2L%3L<:2,1.27743122436476+:-0.606198284550454 +(-),1,1L%2L<:3L%4L,0.634155565563089+:-0.340819380011667 +(-),1,-inf,inf +(-),1,nan,nan +(-),-1,1,-2 +(-),-1,-1,0 +(-),-1,0,-1 +(-),-1,0.0,-1.0 +(-),-1,1.2,-2.2 +(-),-1,-1.2,0.2 +(-),-1,1L%3L,(-4L)%3L +(-),-1,(-1L)%4L,(-3L)%4L +(-),-1,1+:2,-2+:-2 +(-),-1,-1+:2,0+:-2 +(-),-1,1+:-2,-2+:2 +(-),-1,-1.2+:4.3,0.2+:-4.3 +(-),-1,1.2+:-4.3,-2.2+:4.3 +(-),-1,1L%2L+:1,(-3L)%2L+:-1 +(-),-1,1L%2L+:3L%4L,(-3L)%2L+:(-3L)%4L +(-),-1,3<:1,-2.62090691760442+:-2.52441295442369 +(-),-1,3<:-2.14159265358979,0.62090691760442+:2.52441295442369 +(-),-1,3.0<:-3,1.96997748980134+:0.423360024179602 +(-),-1,3.1<:2.5,1.48354520819549+:-1.85526364672227 +(-),-1,2L%3L<:2,-0.722568775635238+:-0.606198284550454 +(-),-1,1L%2L<:3L%4L,-1.36584443443691+:-0.340819380011667 +(-),-1,-inf,inf +(-),-1,nan,nan +(-),0,1,-1 +(-),0,-1,1 +(-),0,0,0 +(-),0,0.0,0.0 +(-),0,1.2,-1.2 +(-),0,-1.2,1.2 +(-),0,1L%3L,(-1L)%3L +(-),0,(-1L)%4L,1L%4L +(-),0,1+:2,-1+:-2 +(-),0,-1+:2,1+:-2 +(-),0,1+:-2,-1+:2 +(-),0,-1.2+:4.3,1.2+:-4.3 +(-),0,1.2+:-4.3,-1.2+:4.3 +(-),0,1L%2L+:1,(-1L)%2L+:-1 +(-),0,1L%2L+:3L%4L,(-1L)%2L+:(-3L)%4L +(-),0,3<:1,-1.62090691760442+:-2.52441295442369 +(-),0,3<:-2.14159265358979,1.62090691760442+:2.52441295442369 +(-),0,3.0<:-3,2.96997748980134+:0.423360024179602 +(-),0,3.1<:2.5,2.48354520819549+:-1.85526364672227 +(-),0,2L%3L<:2,0.277431224364762+:-0.606198284550454 +(-),0,1L%2L<:3L%4L,-0.36584443443691+:-0.340819380011667 +(-),0,-inf,inf +(-),0,nan,nan +(-),0.0,1,-1.0 +(-),0.0,-1,1.0 +(-),0.0,0,0.0 +(-),0.0,0.0,0.0 +(-),0.0,1.2,-1.2 +(-),0.0,-1.2,1.2 +(-),0.0,1L%3L,-0.333333333333333 +(-),0.0,(-1L)%4L,0.25 +(-),0.0,1+:2,-1.0+:-2 +(-),0.0,-1+:2,1.0+:-2 +(-),0.0,1+:-2,-1.0+:2 +(-),0.0,-1.2+:4.3,1.2+:-4.3 +(-),0.0,1.2+:-4.3,-1.2+:4.3 +(-),0.0,1L%2L+:1,-0.5+:-1 +(-),0.0,1L%2L+:3L%4L,-0.5+:(-3L)%4L +(-),0.0,3<:1,-1.62090691760442+:-2.52441295442369 +(-),0.0,3<:-2.14159265358979,1.62090691760442+:2.52441295442369 +(-),0.0,3.0<:-3,2.96997748980134+:0.423360024179602 +(-),0.0,3.1<:2.5,2.48354520819549+:-1.85526364672227 +(-),0.0,2L%3L<:2,0.277431224364762+:-0.606198284550454 +(-),0.0,1L%2L<:3L%4L,-0.36584443443691+:-0.340819380011667 +(-),0.0,-inf,inf +(-),0.0,nan,nan +(-),1.2,1,0.2 +(-),1.2,-1,2.2 +(-),1.2,0,1.2 +(-),1.2,0.0,1.2 +(-),1.2,1.2,0.0 +(-),1.2,-1.2,2.4 +(-),1.2,1L%3L,0.866666666666667 +(-),1.2,(-1L)%4L,1.45 +(-),1.2,1+:2,0.2+:-2 +(-),1.2,-1+:2,2.2+:-2 +(-),1.2,1+:-2,0.2+:2 +(-),1.2,-1.2+:4.3,2.4+:-4.3 +(-),1.2,1.2+:-4.3,0.0+:4.3 +(-),1.2,1L%2L+:1,0.7+:-1 +(-),1.2,1L%2L+:3L%4L,0.7+:(-3L)%4L +(-),1.2,3<:1,-0.420906917604419+:-2.52441295442369 +(-),1.2,3<:-2.14159265358979,2.82090691760442+:2.52441295442369 +(-),1.2,3.0<:-3,4.16997748980134+:0.423360024179602 +(-),1.2,3.1<:2.5,3.68354520819549+:-1.85526364672227 +(-),1.2,2L%3L<:2,1.47743122436476+:-0.606198284550454 +(-),1.2,1L%2L<:3L%4L,0.834155565563089+:-0.340819380011667 +(-),1.2,-inf,inf +(-),1.2,nan,nan +(-),-1.2,1,-2.2 +(-),-1.2,-1,-0.2 +(-),-1.2,0,-1.2 +(-),-1.2,0.0,-1.2 +(-),-1.2,1.2,-2.4 +(-),-1.2,-1.2,0.0 +(-),-1.2,1L%3L,-1.53333333333333 +(-),-1.2,(-1L)%4L,-0.95 +(-),-1.2,1+:2,-2.2+:-2 +(-),-1.2,-1+:2,-0.2+:-2 +(-),-1.2,1+:-2,-2.2+:2 +(-),-1.2,-1.2+:4.3,0.0+:-4.3 +(-),-1.2,1.2+:-4.3,-2.4+:4.3 +(-),-1.2,1L%2L+:1,-1.7+:-1 +(-),-1.2,1L%2L+:3L%4L,-1.7+:(-3L)%4L +(-),-1.2,3<:1,-2.82090691760442+:-2.52441295442369 +(-),-1.2,3<:-2.14159265358979,0.42090691760442+:2.52441295442369 +(-),-1.2,3.0<:-3,1.76997748980134+:0.423360024179602 +(-),-1.2,3.1<:2.5,1.28354520819549+:-1.85526364672227 +(-),-1.2,2L%3L<:2,-0.922568775635238+:-0.606198284550454 +(-),-1.2,1L%2L<:3L%4L,-1.56584443443691+:-0.340819380011667 +(-),-1.2,-inf,inf +(-),-1.2,nan,nan +(-),1L%3L,1,(-2L)%3L +(-),1L%3L,-1,4L%3L +(-),1L%3L,0,1L%3L +(-),1L%3L,0.0,0.333333333333333 +(-),1L%3L,1.2,-0.866666666666667 +(-),1L%3L,-1.2,1.53333333333333 +(-),1L%3L,1L%3L,0L%1L +(-),1L%3L,(-1L)%4L,7L%12L +(-),1L%3L,1+:2,(-2L)%3L+:-2 +(-),1L%3L,-1+:2,4L%3L+:-2 +(-),1L%3L,1+:-2,(-2L)%3L+:2 +(-),1L%3L,-1.2+:4.3,1.53333333333333+:-4.3 +(-),1L%3L,1.2+:-4.3,-0.866666666666667+:4.3 +(-),1L%3L,1L%2L+:1,(-1L)%6L+:-1 +(-),1L%3L,1L%2L+:3L%4L,(-1L)%6L+:(-3L)%4L +(-),1L%3L,3<:1,-1.28757358427109+:-2.52441295442369 +(-),1L%3L,3<:-2.14159265358979,1.95424025093775+:2.52441295442369 +(-),1L%3L,3.0<:-3,3.30331082313467+:0.423360024179602 +(-),1L%3L,3.1<:2.5,2.81687854152883+:-1.85526364672227 +(-),1L%3L,2L%3L<:2,0.610764557698095+:-0.606198284550454 +(-),1L%3L,1L%2L<:3L%4L,-0.0325111011035771+:-0.340819380011667 +(-),1L%3L,-inf,inf +(-),1L%3L,nan,nan +(-),(-1L)%4L,1,(-5L)%4L +(-),(-1L)%4L,-1,3L%4L +(-),(-1L)%4L,0,(-1L)%4L +(-),(-1L)%4L,0.0,-0.25 +(-),(-1L)%4L,1.2,-1.45 +(-),(-1L)%4L,-1.2,0.95 +(-),(-1L)%4L,1L%3L,(-7L)%12L +(-),(-1L)%4L,(-1L)%4L,0L%1L +(-),(-1L)%4L,1+:2,(-5L)%4L+:-2 +(-),(-1L)%4L,-1+:2,3L%4L+:-2 +(-),(-1L)%4L,1+:-2,(-5L)%4L+:2 +(-),(-1L)%4L,-1.2+:4.3,0.95+:-4.3 +(-),(-1L)%4L,1.2+:-4.3,-1.45+:4.3 +(-),(-1L)%4L,1L%2L+:1,(-3L)%4L+:-1 +(-),(-1L)%4L,1L%2L+:3L%4L,(-3L)%4L+:(-3L)%4L +(-),(-1L)%4L,3<:1,-1.87090691760442+:-2.52441295442369 +(-),(-1L)%4L,3<:-2.14159265358979,1.37090691760442+:2.52441295442369 +(-),(-1L)%4L,3.0<:-3,2.71997748980134+:0.423360024179602 +(-),(-1L)%4L,3.1<:2.5,2.23354520819549+:-1.85526364672227 +(-),(-1L)%4L,2L%3L<:2,0.0274312243647616+:-0.606198284550454 +(-),(-1L)%4L,1L%2L<:3L%4L,-0.615844434436911+:-0.340819380011667 +(-),(-1L)%4L,-inf,inf +(-),(-1L)%4L,nan,nan +(-),1+:2,1,0+:2 +(-),1+:2,-1,2+:2 +(-),1+:2,0,1+:2 +(-),1+:2,0.0,1.0+:2 +(-),1+:2,1.2,-0.2+:2 +(-),1+:2,-1.2,2.2+:2 +(-),1+:2,1L%3L,2L%3L+:2 +(-),1+:2,(-1L)%4L,5L%4L+:2 +(-),1+:2,1+:2,0+:0 +(-),1+:2,-1+:2,2+:0 +(-),1+:2,1+:-2,0+:4 +(-),1+:2,-1.2+:4.3,2.2+:-2.3 +(-),1+:2,1.2+:-4.3,-0.2+:6.3 +(-),1+:2,1L%2L+:1,1L%2L+:1 +(-),1+:2,1L%2L+:3L%4L,1L%2L+:5L%4L +(-),1+:2,3<:1,-0.620906917604419+:-0.524412954423689 +(-),1+:2,3<:-2.14159265358979,2.62090691760442+:4.52441295442369 +(-),1+:2,3.0<:-3,3.96997748980134+:2.4233600241796 +(-),1+:2,3.1<:2.5,3.48354520819549+:0.144736353277735 +(-),1+:2,2L%3L<:2,1.27743122436476+:1.39380171544955 +(-),1+:2,1L%2L<:3L%4L,0.634155565563089+:1.65918061998833 +(-),1+:2,-inf,inf+:2 +(-),1+:2,nan,nan+:2 +(-),-1+:2,1,-2+:2 +(-),-1+:2,-1,0+:2 +(-),-1+:2,0,-1+:2 +(-),-1+:2,0.0,-1.0+:2 +(-),-1+:2,1.2,-2.2+:2 +(-),-1+:2,-1.2,0.2+:2 +(-),-1+:2,1L%3L,(-4L)%3L+:2 +(-),-1+:2,(-1L)%4L,(-3L)%4L+:2 +(-),-1+:2,1+:2,-2+:0 +(-),-1+:2,-1+:2,0+:0 +(-),-1+:2,1+:-2,-2+:4 +(-),-1+:2,-1.2+:4.3,0.2+:-2.3 +(-),-1+:2,1.2+:-4.3,-2.2+:6.3 +(-),-1+:2,1L%2L+:1,(-3L)%2L+:1 +(-),-1+:2,1L%2L+:3L%4L,(-3L)%2L+:5L%4L +(-),-1+:2,3<:1,-2.62090691760442+:-0.524412954423689 +(-),-1+:2,3<:-2.14159265358979,0.62090691760442+:4.52441295442369 +(-),-1+:2,3.0<:-3,1.96997748980134+:2.4233600241796 +(-),-1+:2,3.1<:2.5,1.48354520819549+:0.144736353277735 +(-),-1+:2,2L%3L<:2,-0.722568775635238+:1.39380171544955 +(-),-1+:2,1L%2L<:3L%4L,-1.36584443443691+:1.65918061998833 +(-),-1+:2,-inf,inf+:2 +(-),-1+:2,nan,nan+:2 +(-),1+:-2,1,0+:-2 +(-),1+:-2,-1,2+:-2 +(-),1+:-2,0,1+:-2 +(-),1+:-2,0.0,1.0+:-2 +(-),1+:-2,1.2,-0.2+:-2 +(-),1+:-2,-1.2,2.2+:-2 +(-),1+:-2,1L%3L,2L%3L+:-2 +(-),1+:-2,(-1L)%4L,5L%4L+:-2 +(-),1+:-2,1+:2,0+:-4 +(-),1+:-2,-1+:2,2+:-4 +(-),1+:-2,1+:-2,0+:0 +(-),1+:-2,-1.2+:4.3,2.2+:-6.3 +(-),1+:-2,1.2+:-4.3,-0.2+:2.3 +(-),1+:-2,1L%2L+:1,1L%2L+:-3 +(-),1+:-2,1L%2L+:3L%4L,1L%2L+:(-11L)%4L +(-),1+:-2,3<:1,-0.620906917604419+:-4.52441295442369 +(-),1+:-2,3<:-2.14159265358979,2.62090691760442+:0.524412954423689 +(-),1+:-2,3.0<:-3,3.96997748980134+:-1.5766399758204 +(-),1+:-2,3.1<:2.5,3.48354520819549+:-3.85526364672227 +(-),1+:-2,2L%3L<:2,1.27743122436476+:-2.60619828455045 +(-),1+:-2,1L%2L<:3L%4L,0.634155565563089+:-2.34081938001167 +(-),1+:-2,-inf,inf+:-2 +(-),1+:-2,nan,nan+:-2 +(-),-1.2+:4.3,1,-2.2+:4.3 +(-),-1.2+:4.3,-1,-0.2+:4.3 +(-),-1.2+:4.3,0,-1.2+:4.3 +(-),-1.2+:4.3,0.0,-1.2+:4.3 +(-),-1.2+:4.3,1.2,-2.4+:4.3 +(-),-1.2+:4.3,-1.2,0.0+:4.3 +(-),-1.2+:4.3,1L%3L,-1.53333333333333+:4.3 +(-),-1.2+:4.3,(-1L)%4L,-0.95+:4.3 +(-),-1.2+:4.3,1+:2,-2.2+:2.3 +(-),-1.2+:4.3,-1+:2,-0.2+:2.3 +(-),-1.2+:4.3,1+:-2,-2.2+:6.3 +(-),-1.2+:4.3,-1.2+:4.3,0.0+:0.0 +(-),-1.2+:4.3,1.2+:-4.3,-2.4+:8.6 +(-),-1.2+:4.3,1L%2L+:1,-1.7+:3.3 +(-),-1.2+:4.3,1L%2L+:3L%4L,-1.7+:3.55 +(-),-1.2+:4.3,3<:1,-2.82090691760442+:1.77558704557631 +(-),-1.2+:4.3,3<:-2.14159265358979,0.42090691760442+:6.82441295442369 +(-),-1.2+:4.3,3.0<:-3,1.76997748980134+:4.7233600241796 +(-),-1.2+:4.3,3.1<:2.5,1.28354520819549+:2.44473635327773 +(-),-1.2+:4.3,2L%3L<:2,-0.922568775635238+:3.69380171544955 +(-),-1.2+:4.3,1L%2L<:3L%4L,-1.56584443443691+:3.95918061998833 +(-),-1.2+:4.3,-inf,inf+:4.3 +(-),-1.2+:4.3,nan,nan+:4.3 +(-),1.2+:-4.3,1,0.2+:-4.3 +(-),1.2+:-4.3,-1,2.2+:-4.3 +(-),1.2+:-4.3,0,1.2+:-4.3 +(-)... [truncated message content] |