2022/10/28: Difference between revisions

From Woozle Writes Code
Jump to navigation Jump to search
(Created page with "{{page/date}} category:PHP I really need a way to have multiple rewriteable status lines in CLI, and it looks like the way to do that is via ncurses, but connecting PHP wi...")
 
No edit summary
Line 1: Line 1:
{{page/date}}
{{page/date}}
[[category:PHP]]
[[category:PHP]]
I really need a way to have multiple rewriteable status lines in CLI, and it looks like the way to do that is via ncurses, but connecting PHP with ncurses looks complicated and fragile... plus I kinda feel like it should just be implemented natively in PHP, because doing terminal escape codes is not super-complicated (I did it in frickin' FORTRAN IV) and I don't need fancy windowing stuff that ncurses does. I've tried to find the source code for ncurses, to see what the escape codes are (mainly the magic it uses to determine which terminal is being emulated), but so far no luck.
I really need a way to have multiple rewriteable status lines in CLI, and it looks like the way to do that is via {{l/wp|ncurses}}, but connecting PHP with ncurses looks complicated and fragile... plus I kinda feel like it should just be implemented natively in PHP, because doing terminal escape codes is not super-complicated (I did it in frickin' FORTRAN IV) and I don't need fancy windowing stuff that ncurses does. I've tried to find the source code for ncurses, to see what the escape codes are (mainly the magic it uses to determine which terminal is being emulated), but so far no luck.


This feels like a simple problem that has somehow been made unmanageably difficult.
This feels like a simple problem that has somehow been made unmanageably difficult.


{{l/wp|ANSI escape code}}s seem like they may offer a solution. It's probably not as universally-compatible as using some library based on {{l/wp|Terminfo}} (which, trivia, was first written by a trans woman), but I can wrap it in a class-family that will make it relatively easy to add support for other terminal code-sets later.
{{l/wp|ANSI escape code}}s seem like they may offer a solution. It's probably not as universally-compatible as using some library based on {{l/wp|Terminfo}}<ref name=terminfo />, as ncurses seems to be, but I can wrap it in a class-family that will make it relatively easy to add support for other terminal code-sets later.


'''Query''': Why isn't there a universal interface for PHP to talk to arbitrary .so libraries, the way [[Visual Basic]] does with ActiveX DLLs? How do .so libraries even work?
'''Query''': Why isn't there a universal interface for PHP to talk to arbitrary .so libraries, the way [[Visual Basic]] does with ActiveX DLLs? How do .so libraries even work?
==Footnote==
<references>
<ref name=terminfo>...which, trivia, was first written by {{l/wp|Mary Ann Horton|a trans woman}}</ref>
</references>

Revision as of 16:51, 28 October 2022

Friday, October 28, 2022 (#301)
Thursday Friday Saturday

I really need a way to have multiple rewriteable status lines in CLI, and it looks like the way to do that is via ncurses, but connecting PHP with ncurses looks complicated and fragile... plus I kinda feel like it should just be implemented natively in PHP, because doing terminal escape codes is not super-complicated (I did it in frickin' FORTRAN IV) and I don't need fancy windowing stuff that ncurses does. I've tried to find the source code for ncurses, to see what the escape codes are (mainly the magic it uses to determine which terminal is being emulated), but so far no luck.

This feels like a simple problem that has somehow been made unmanageably difficult.

ANSI escape codes seem like they may offer a solution. It's probably not as universally-compatible as using some library based on Terminfo[1], as ncurses seems to be, but I can wrap it in a class-family that will make it relatively easy to add support for other terminal code-sets later.

Query: Why isn't there a universal interface for PHP to talk to arbitrary .so libraries, the way Visual Basic does with ActiveX DLLs? How do .so libraries even work?

Footnote

  1. ...which, trivia, was first written by a trans woman