Re: Need an other phix explanation please
- Posted by petelomax Feb 28, 2018
- 1970 views
i thought i have to compiler the libraries my self. if so, then i have vs2017.
It is probably better to use the pre-compiled ones.
i downloaded the new dll's and found that the plotting error is gone.
Excellent. (Sigh, yet another task before I can release a new version!)
anyhow, to make things easier, it would be nice if you could introduce in phix a wstring datatype, peek_wstring and poke_wstring. just wishful thinking.
I have in fact just recently implemented peek_wstring() for someone else, though it has not yet hit the repository. And I've just added poke_wstring() to the internal version - next release will be a while yet, though.
You should already have allocate_wstring() as an alternative.
A wstring datatype as part of the core is however completely impractical. (A huge part of Phix's charm is that it has just 5 data tytes.) You can always write your own user defined type though.
Here's a copy of those new routines for use in the meantime:
-- (will be in/add to builtins\peekstr.e) global function peek_wstring(atom addr) atom ptr ptr = addr while peek2u(ptr) do ptr += 2 end while return peek2u({addr, (ptr-addr)/2}) end function -- (will be in/add to builtins\pokestr.e) global function poke_wstring(atom buffaddr, integer buffsize, sequence s) if buffaddr<=0 or buffsize<=length(s)*2 then return 0 end if if not string(s) then for i=1 to length(s) do if not atom(s[i]) then return 0 end if end for end if poke2(buffaddr, s) buffaddr += length(s)*2 poke2(buffaddr, 0) return buffaddr end function
obviously, until the matching auto-include changes to psym.e are shipped you will have to include those files manually, but when it is shipped you won't need to undo anything.
Regards,
Pete