Phix 1.0.2 uploaded

new topic     » topic index » view thread      » older message » newer message

Obviously overdue, usual place: http://phix.x10.mx/download.php (1.0.1 notes: https://openeuphoria.org/forum/m/136518.wc )

Should you find this useful, please consider contributing the cost of a can of beans on a monthly basis.

missing eval.e and XPM_ICON.E added to distro, opengl.e now only once 
builtins\bigatom.e added a couple more deep_copy() bugfixes 
builtins\opengl.e added glDetachShader 
builtins\mpfr.e added mpfr_const_euler, mpfr_get_d_2exp 
demo\arwen\dll_links.ew removed C_PTR (fixes the p -c edita issue) 
IupCanvas/ACTION (aka redraw_cb) no longer attempts/allows posx/y params (easy alt). 
 - 72 demos updated, most if not all of which would have crashed when run on 64bit. 
call_back() docs updated to note it cannot handle C float/double callbacks. 
100% on rosettacode, now with over 1,100 examples marked as javascript compatible. 
(s)printf: new %n for true:"\n", false:"". 
Limit of base 36 => 62 in both p2js/printf(%A), and [desktop too] to_number(). 
Added some extra "unexpected end block comment" error checking, see readme. 
Added mpz_get_short_str() as a faster shorten(mpz_get_str()), alas no gain under pwa/p2js. 
Added traditional stack and queue handling to builtins/pqueue.e (for convenience not speed). 
Since pad("X",4,"BOTH",'.') gives ".X..", added "BLOTH" for "..X." if/when needed. 
While Phix uses "exit" to quit loops and "break" to quit switch statements, JavaScript uses  
"break" for both, hence additional checking has been added under "with js" to prohibit any 
attempt to directly "exit" a loop from within a switch, or "break" a case clause from within 
a loop, and only allowing such statements when they are adequately and properly nested. 
Bugfix: file mode error attempting to get_text() a file opened in update mode. 
The global builtin constant E has been renamed as EULER, also 2dp more accurate on 64 bit. 
(Slightly oddly, small change to the outcome of rc/gamma on 32 bit as well, who'da thunk it: 
 A tip has been added to the documentation's "floats are not exact" page, and PI was also  
 given a couple of extra digits that I had previously assumed could never be helpful.) 
map:get() renamed as map_get() - maybe I should also rename get.e's get() as get_get(). 
for in - as discussed, maybe kept simpler, see docs [and perhaps test/t68forin.exw] 
mpfr_addmul_si() added to match mpz_addmul_si() 
rmdr() is now an alias of remainder(), and sq_remainder() an alias of sq_rmdr(), ditto hll_rmdr(). 
Added #[ and #] multiline comments, for use in multiline shebangs. 
Added Ctrl J (with nowt selected) popup to Edita/Edix/p2js to set "with javascript_semantics" etc. 
Documented class constructors (Core Language/Declarations/Structs and Classes/class/constructors) 
Added optional fmt parameter to apply(), shorten(), join(), and join_by(). 
Added base to mpfr_get_fixed(), and made non-decimal fractions work properly. 
Added comma_fill to mpfr_get_str(), mpfr_get_fixed(), and mpfr_[s]printf(). 
New algorithm for permute(prev still available) and new permutes() routine. 
puts(fn,x,false): New optional 3rd parameter of false allows p2js.js to output html w/o substitution. 
Added a simplistic version of command_line() to p2js.js, ditto get_proper_dir|path(). 
Moved get_file_(base|extension|name[_and_path]|path[_and_name]) to builtins\file_utils.e, for p2js. 
Added optional lo, hi and partition function parameters to binary_search(). 
Added clear_screen(), text_color(), and bk_color() to p2js.js 
Added write_lines(), and moved read_lines() onto it's own help page 
New builtins/url.e (so-so stuff) split from pfile.e and lightly documented 
New builtins/speak.e for 32-bit Windows and matching speak() in p2js.js 
Made odd() [and even()] map directly to [%opNot] %opAndBits(,1) in pmain.e 
Added tagstart() as a simple complimentary wrapper of tagset(). 
makephix.exw now also checks version() in p2js.js matches pglobals.e 
"wait_key()" now treated as "{} = wait_key()", ie no longer forcing the explicit discard. 
(A specific T_wait_key thing in pmain.e, rather than a dumb blanket auto-discard) 
Removed an unnecessary incref in s[i] &= x (and friends), making it p2js compatible. 
integer {ch} = "1" now generates the required and correct p2js violation under with js. 
Bugfix: mpz_init("0x1e") crashed because of (eg) mpz_init("1e200") handling, it now 
        checks for leading '#', or '0' followed by "x|X|(" and skips all that stuff. 
Bugfix: a >> n didn't work for negative a under pwa/p2js (humphff, JavaScript, grr). 
Switched to display:flex for dialog-body, much better, and space-evenly for v/hbox. 
The wholly unnecessary aliases WEB and JAVASCRIPT removed, please use JS instead. 
Major trawl through the docs marking everything thing as p2js compatible or not. 
assert() is now the trivial wrapper to crash() it should be. +nFrames,->pCrashN.e 
Added (optional) MODE=BAR/MARK/LINE to IupGraph() [was just BARMODE/not before] 
Finally managed to get MINSIZE attribute to work in pGUI.js, or at least seem to. 
Added atom_to_float32/64 and float32/64_to_atom to p2js.js (but 80s not do-able), 
which also means that serialise() and deserialise() are now p2js compatible (mostly). 
Added IupToggleInt(), a trivial but fairly handy IupSetInt(not IupGetInt()) wrapper. 
Added IupImage[RGB[A]]() to pGUI.js 
repeat() now has an optional third parameter to stop it creating (binary) strings. 
New [trivial] ordinant() routine, yields "never"/"once"/"twice"/"three times", etc. 
do..until loop added, see while loop docs, until is now a reserved word. 
Bugfix: switch <atom> failing with swecode 14. 
find_any(), head(), tail(), pad(), shift_bits(), vlookup(), and begins() promoted 
from "Compatiblity with Euphoria" to full/official standard builtin status. 
Allowed eg add[eq|gt|le|lt|ne][s] in .syn, Phix.txt, and index.txt help files. 
Bugfix: paste of utf8 text in Edix. It now applies utf8_to_utf32 to clipboard  
        content, and automatically saves the file with a UTF8 BOM if needed. 
Added %F for printf, blanks trailing 0/dp, eg "1.1 " not "1.10", and "1   "  
         not "1.00" (all being 4 chars), and obviously "1000" as-is. 
Minor bugfixes to mpz_get_short_str(), eg 1e80+1 -> "1000..1" not "1000..0001", 
                                    and comma_fill no longer overruns 2*ml check. 
Added mpfr_ceil(), and mpfr_floor(), mpfr_get_si(), mpfr_cmp(), mpfr_cmp_si() to js. 
Bugfix: mpz_get_str(comma_fill) broken in js [when adding that to mpfr_get_str()] 
Replaced several jmp :%opRetf with jmp :!opCallOnceYeNot (26/8/22 spotted in passing) 
Bugfix: demo\enumfont.exw now also works on (Windows) 64 bit. 
Bugfix[maybe]: c_func returns on 64 bit of C_ULONG, C_PTR, etc were trying to check the 
               reconstruction of (unsigned/2)*2+carry was correct, using code that was 
               pretty much guaranteed to fail, as demo/winwire.exw was. Removing that 
               offensive code fixed winwire, but I can't recall why it was ever there. 
Phix now has a pygments lexer (in master, releases seem to be around every 3 months) 
Added ln() as a simple alias of log(), to emphasize the use of a natural logarithm, 
           along with matching (sq|hll|complex)_ln(), however there is no mpfr_ln() 
           since it would not be a valid gmp/mpfr name, whereas I coined the others. 
Added if {} shorthand: no elsif/else, and no equivalent end for/while/switch/etc. 
            Should be considerd experimental, liable to removal if any issues raised. 
Added mpz_factors(), which constructs the full list of factors from the prime_powers 
                     list. At the same time, I discovered that approach was quite a 
                     bit faster for native factors(n) when n>1e7 (>3000 trial divs), 
                     so have added the appropriate code to that as well. 
Added mpfr_gamma_inc(), needed some replacement/renamed dlls [all done, in distro]. 
Added mpfr_zeta[_ui](), and marked them, "", and mpfr_const_euler as js-incompatible. 
Added mpfr_abs(), mpfr_add_d(), mpfr_sub_d(), mpfr_mul_d(), and mpfr_div_d(). 
Made mpfr_get_fixed() honour -ve d.p. on desktop (like mpfr.js), and added a maxlen. 
New optional parameter bKeys=true on getd_all_keys(), to obtain data instead of keys. 
Added new factor_count/sum(n) builtins, return length/sum(factors(n,1)) but way faster. 
Bugfix: constant n = 9_007_199_254_740_991 was creating the wrong constant, ending 
        in 92 not 91. The tokeniser was performing TokN = TokN*10 + Ch-'0', but 
        the (TokN*10 + Ch) part was exceeding available precision (temporarily), 
        which no longer happens with the corrected TokN = TokN*10 + (Ch-'0'). 
        Amazing these things still occasionally crop up after all this time, to 
        think that every number ever parsed by Phix was being handled wrongly! 
        Tell you what though, not exactly very hard to track down and fix blink 
        Took twenty times as long to trawl round for other troublesome -'0's. 
Allowed reinstate() to replace a single item with an integer indexes parameter. 
Bugfix: is_prime(<0) now returns false, rather than crashing for no good reason. 
Bugfix/local constant restrictions: While you can still have a locally scoped  
        constant x = "one two three", attempting something more complex such as  
        constant y = split(x) was generating some rather whacky compiler errors. 
        On analysis, I realised that if the routine was the target of a forward 
        call, there would be (even more than usual) difficulties, and nowhere to 
        put the split() call, therefore I decided to limit local constants to 
        literals only, spit out "not supported (sorry)", and update the docs. 
        Ho hum, it seems the whole statics and local constants thing has all been  
        a bit of a complete and utter humiliating whitewash wipeout, n'er mind. 
Bugfix: 64-bit crashed trying to compile eg assert(res=23514624000) when it found 
        the literal does not fit in a dword. It now stashes it in r14 and compares 
        against that (there simply isn't a cmp reg,imm64 instruction). 32-bit got 
        away with things because it stored such literals in a 64-bit float anyway. 
        [Two cases were found and fixed, other similar problems may yet arise.] 
Added powmod(), == rmdr(power(base,exponent),modulus) only faster/more accurate, 
  and mulmod(), == rmdr(a*b,modulus) only (sometimes slower and) more accurate. 
Merged is_prime() and is_prime2() into a single routine, note isprime(n,false)  
        is (explictly) required to match the is_prime2() performance profile. 
Added count_bits(), a simple implementation of kernigans bit counter, and at the 
        same time documented mpz_popcount() and added a version of it to mpfr.js. 
Bugfix: p2js/integer() now uses "i!=~~i" instead of "!Number.isSafeInteger(i)", 
        so that numbers which pass integer() can be used with and_bits(), etc. 
        I also ended up completely rewriting that test (performance issues). 
Added "notbits" to filter(), eg filter({#1,#2,#4,#8},"notbits",#5) ==> {2,8}. 
Bugfix: sprintf("%+g") rounded eg "-9.999" correctly, but "+9.999" as ",1.000" 
        ** DEV ^^ and below, need porting to/checking in p2js.js *** 
Removed some of the precision limitations in printf(%f) after discovering that 
it was introducing quite unnecessary inacurracies with but could actually cope  
fine with 2^-17 and smaller exact-negative-power-of-2 fractions. After some 
thought, and self-doubt, reinstated the limits for count_bits()!=1. If there 
is a call for it, I could add a printf(0,"",{"precision",flag})-style setting. 
Made (s)printf() print powers of 2 exactly, from 2^-1074 to 2^1024 [on 32 bit, 
                    and at least that but not sure how much further on 64 bit]. 
                     [%d and some %f only, %xob should already have been fine, 
                      however some %a (ie other bases 2..63) probably not yet]. 
Added hcf() as an alias of gcd(), and at the same time (at long last) made p2js  
            understand/copy all of the aliases as defined in psym.e properly. 
Bugfix: $conCat() in p2js now has an optional clone arg, for performance. 
Bugfix: Added 1/5/22, so never actually released, but lain undetected for six 
        months and 4 days, phi[k] -= floor(phi[k]/i) was clobbering the phi[k] 
        to 0 on the lhs and therefore always subtracting 0. In other words a 
        significant performance boost for (esp) s[i] &= x was (deliberately) 
        knobbling a refcount but failing to check for further use on the rhs. 
        It now checks for isCmpndLHS all over pmain.e, note that quite a few  
        of those asserts should really be proper[ly tested] error messages. 
Added phi() builtin/autoinclude, a simple memoised Euler's totient function. 
Added combinations() and combinations_with_repetitions() builtins. 
Added is_nan() and is_inf() builtins. 
Bugfix: tokeniser accepted 0b02 as valid, >base shd've been >=base. 
Made p2js auto-transpile builtins/pFilter.e, and added filter_count(). 
Allowed is_leap_year(), day_of_year(), days_in_month(), and day_of_week() to 
        accept a single [time]date() parameter [extract DT_YEAR/MONTH/DAY]. 
        Also took the opportunity to add a cheeky little week_number() routine. 
Added optional bCrash=true parameter to open_dll(), it now crashes by default. 
    The same thing was also applied to define_c_func() and define_c_proc(). 
    Legacy code that actually tests the result from open_dll(), eg tries in 
    several directories, will need a ",false" added, whereas "explicit crash" 
    statements can simply be deleted, as can eg link_c_func() whose only real 
    job was to provide such explicit crashes, and ditto with the ",false". 
    Got rid of as many link_c_func-style functions in the distro as I could. 
    Note that was a bit painful, but worth it in the long run, I think/hope. 
    It will spanner any "look elsewhere/download" code, being the main risk, 
    and some much less frequent "only use the function when it is present". 
    A safe and fairly easy option is just to blat ",false" on everything, 
    and a quicker option is to replace three "= true" in builtins/pcfunc.e. 
Disallowed "abstract global", which was treated the same as "global abstract", 
    since it was at odds with the more obviously incorrect "atom global",  
    "procedure global", "constant global" etc, which could never possibly  
    be allowed anyway. Note that "global forward" === "forward global" is 
    still allowed, not that I&rsquo;m strongly opposed to banning that too. 
Bugfix: "type error (storing atom in sequence)" on s = {}&1, internal crash 
    on s = {}&{}. When optimising [multiple] & into a single opConcat[N],  
    it "assumed opApnd (alone) occurred", which makes no sense, and in the 
    second case tried to opConcatN 0 items, which ain't ever gonna fly. It  
    now pushes an opMkSq operation for <=1 items, as it always should have. 
Allowed the use of "local" as an optional logical counterpart to "global". 
    (A very minor issue, with absolutely zero impact on any legacy code, 
     apart from some uses of the identifier "local" now being prohibited.) 
Bugfix: p2asm.e was not handling 64bit jump tables correctly, it now uses 
        "if machine=64" instead of "if X64", for reasons that escape me. 
Added asserteq(), which is just a trivial >=2 param variant of assert(), 
        that in one case made the error far more immediately apparent. 
Completed some more (semi-experimental) dealings with nested routines. 
    Not overly happy with the results, or the documentation, but at least 
    they now work properly, and on both desktop/Phix and under pwa/p2js. 
    However debug & appearance in ex.err duff, deferred until Phix 2.0.0. 
Resolved/removed "sorry, p2js cannot name the required temp for that". 
Bugfix: regex:gsub() now uses \0..\9 as it always should have, instead of &. 
        The old version remains available as gsub0(), should you need that 
        for a (hopefully temporary) quick fix, but may be removed in 1.0.3+. 
        Note that regex:gmatch() was not altered, but I noted that it might 
        also benefit from using the new [local/private] breakdown() routine. 
Docs: reorganised other libraries into five ad-hoc subcategories. 
Bugfix: made begins() a proper auto-include (it was missing from psym.e) 
Bugfix: upper/lower() p2js violation on nested sequences (trivial mod). 
Bugfix: segfault on Linux kernels after Aug 2022. 6 months => 12 byte patch.. 
Bugfix: added a missing mpfr_ui_pow_ui() to mpfr.js, also mpfr_mul_d() was  
        just an alias of mpfr_mul_si(), and fairly obviously fell over in a 
        heap when passed 2.5 since you cannot just convert that to a BigInt.  
        Now sep rtn, as always shd have been, ditto mpfr_(add/sub/div)_d(). 

Star feature: for x in s do - I will admit I was a little sceptical when I put it in and slightly concerned I'd made it too simple, now find I just can't stop using it!

I now have a clear plan for Phix 2.0: get it working on a Raspberry Pi - while of itself not a particularly prime target, the ARM chipset certainly is. Wish me luck, I'll need it. At the same time I'll continue my efforts to get p2js working in a web browser, which means largely abandoning the 1.0 sources and starting a new set, based on the tokeniser and parse tree code of p2js, and obviously bulk-copying whatever parts of 1.0 sources that still fit. Transpiling to C remains an open option, but I refuse to even start that without any help. So, I am looking at a new parse tree, a total rewrite of all the binary emit routines, and I plan to throw in a proper (linear scan) register allocator, completely rewrite localtype handling, and (via the new parse tree) preserve scope into the debugger stage properly. Should easily get all of that and more done by two weeks on Tuesday, no problem, innit?

It is likely to have significant breaking changes, in particular I am thinking of totally deprecating routine_id(), c_func(), c_proc(), and call_back() - but of course there would be 500+ working examples, and docs that fully explain what said need to be replaced with. In either case there will be a new way, whether compatibility can be maintained as well..

So far: added some ARM docs, tests & filedump.exw done, started work on xpGUI (ongoing). It suprises even me that a new GUI has become the most critical of blocking components, but targetting an ARM chip is pointless without a GUI, and I have nothing else suitable.

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu