Re: Phix, numbers, printf, log10

new topic     » goto parent     » topic index » view thread      » older message » newer message
jimcbrown said...
RobertS said...

Doesn't work with Linux, at least not for now. The input editor needs video_config() for the screen width, but even more important are get_position() and position() for the cursor, and since they don't work under Linux,

Must be Phix specific? get_position() and position() work fine under OE iirc - though if memory serves correctly this is tied to ncurses (which Phix is not likely using).

I suspect that this is what ncurses does internally - on startup (before any user input has happened) set the position by writing to stdout. That way the position is at some known fixed value.

Use a state machine of some kind, so with every write to the screen, a variable gets updated with the current position.

When writing to the screen, prefix each write with the escape sequence to set the position - this minimizes sides from other processes writing on the terminal and changing the position behind our backs.

Finally, when getting the current position, consult the variable instead of asking the terminal. That way there's no issue of reading from stdin and losing data.

I think the latest docs say everything that needs to be said: http://phix.x10.mx/docs/html/get_position.htm

The correct/easier way to properly solve this would be to write a test harness with (nb 1st upper) Print(), Printf(), Qu(), and Clear_Screen(), Position(), Put_Screen_Char(), and Display_Text_Image() shims, (that obviously pre-process their inputs to update some central position vars, with no real need for any low-level grubbiness, before invoking the real thing) with a Get_Position() that checks it would yield the same values as get_position(). It makes much more sense for someone working on Linux to write that on Linux (just as it makes much more sense for the person actually dealing with all that to actually care), and of course in Euphoria rather than Phix, since the whole point is to craft/test the code that would need to be added to the Phix builtins. Candidates with no formal qualifications in unicode and ncurses need not bother applying.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu