Comments (36)
Hi, Sergey!
Since you mention PowerPC, the most likely reason is that PowerPC is a big-endian architecture, but the Turbo Vision library has some code assuming a little-endian system.
I'll look into it.
from turbo.
I have no idea, that's certainly not something that I added manually.
from turbo.
No issues, I will find what added it. Will update on the matter tomorrow though, work on folly
took too long and the next plan is sleep :)
from turbo.
Okay, thanks.
Do you know if there is any way for me to run this pre-release macOS version you are using in a VM?
from turbo.
@magiblot Yes, this sounds like a very plausible cause.
If you could look into that, it will be awesome. Thanks!
from turbo.
@magiblot Thank you! I will test it today.
from turbo.
@magiblot Ok, I rebuilt it from the master. Here are the results:
-
TUI now starts, but does not react to anything. I cannot even quit it, only close the terminal window externally. I.e., even Control+C does nothing.
-
All tests pass fine as before (expected, but just in case).
-
I noticed one non-breaking error in the very end of the build:
osascript -e use\ framework\ \"Cocoa\" -e set\ sourcePath\ to\ \"/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_editors_turbo/turbo/work/turbo-782df70b97a355e332bbe37e12b5e4975bf730c0/source/turbo/icon.icns\" -e set\ destPath\ to\ \"/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_editors_turbo/turbo/work/build/turbo\" -e set\ imageData\ to\ \(current\ application\'s\ NSImage\'s\ alloc\(\)\'s\ initWithContentsOfFile:sourcePath\) -e \(current\ application\'s\ NSWorkspace\'s\ sharedWorkspace\(\)\'s\ setIcon:imageData\ forFile:destPath\ options:0\) >/dev/null || echo Warning:\ failed\ to\ set\ application\ icon
0:13: syntax error: A identifier can’t go after this identifier. (-2740)
Warning: failed to set application icon
from turbo.
TUI looks like this now on PowerPC:
from turbo.
Hi Sergey!
Could you also run the tvision tests with the -DTV_BUILD_TESTS=ON
option?
from turbo.
@magiblot How to do it? If I just pass -DTV_BUILD_TESTS=ON
to CMake when building turbo
, it does not seem to build anything for testing tvision
(only turbo
and turbo-test
binaries are produced), and the same 20 tests are ran at the end of the build:
[100%] Generating turbo-test-passed
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_editors_turbo/turbo/work/build/turbo-test
Running main() from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_gtest/gtest/work/googletest-1.14.0/googletest/src/gtest_main.cc
[==========] Running 20 tests from 3 test suites.
[----------] Global test environment set-up.
[----------] 9 tests from Search
[ RUN ] Search.ShouldSearchForwardOnce
[ OK ] Search.ShouldSearchForwardOnce (10 ms)
[ RUN ] Search.ShouldSearchForwardOnceAndAgain
[ OK ] Search.ShouldSearchForwardOnceAndAgain (8 ms)
[ RUN ] Search.ShouldSearchBackwardsOnce
[ OK ] Search.ShouldSearchBackwardsOnce (8 ms)
[ RUN ] Search.ShouldSearchBackwardsOnceAndAgain
[ OK ] Search.ShouldSearchBackwardsOnceAndAgain (5 ms)
[ RUN ] Search.ShouldSearchCaseSensitive
[ OK ] Search.ShouldSearchCaseSensitive (2 ms)
[ RUN ] Search.ShouldSearchWholeWords
[ OK ] Search.ShouldSearchWholeWords (2 ms)
[ RUN ] Search.ShouldSearchWithRegex
[ OK ] Search.ShouldSearchWithRegex (1 ms)
[ RUN ] Search.ShouldSearchWithRegexOnceAndAgain
[ OK ] Search.ShouldSearchWithRegexOnceAndAgain (1 ms)
[ RUN ] Search.ShouldSearchIncremental
[ OK ] Search.ShouldSearchIncremental (7 ms)
[----------] 9 tests from Search (48 ms total)
[----------] 2 tests from Replace
[ RUN ] Replace.ShouldReplaceOne
[ OK ] Replace.ShouldReplaceOne (7 ms)
[ RUN ] Replace.ShouldReplaceAll
[ OK ] Replace.ShouldReplaceAll (5 ms)
[----------] 2 tests from Replace (13 ms total)
[----------] 9 tests from ToggleComment
[ RUN ] ToggleComment.ShouldRemoveHtmlBlockComments
[ OK ] ToggleComment.ShouldRemoveHtmlBlockComments (3 ms)
[ RUN ] ToggleComment.ShouldRemoveCppBlockComments
[ OK ] ToggleComment.ShouldRemoveCppBlockComments (1 ms)
[ RUN ] ToggleComment.ShouldRemoveBashLineComments
[ OK ] ToggleComment.ShouldRemoveBashLineComments (1 ms)
[ RUN ] ToggleComment.ShouldRemoveBatchLineComments
[ OK ] ToggleComment.ShouldRemoveBatchLineComments (0 ms)
[ RUN ] ToggleComment.ShouldRemoveCppLineComments
[ OK ] ToggleComment.ShouldRemoveCppLineComments (1 ms)
[ RUN ] ToggleComment.ShouldInsertHtmlBlockComments
[ OK ] ToggleComment.ShouldInsertHtmlBlockComments (2 ms)
[ RUN ] ToggleComment.ShouldInsertCppBlockComments
[ OK ] ToggleComment.ShouldInsertCppBlockComments (2 ms)
[ RUN ] ToggleComment.ShouldInsertCppLineComments
[ OK ] ToggleComment.ShouldInsertCppLineComments (6 ms)
[ RUN ] ToggleComment.ShouldInsertBatchLineComments
[ OK ] ToggleComment.ShouldInsertBatchLineComments (0 ms)
[----------] 9 tests from ToggleComment (21 ms total)
[----------] Global test environment tear-down
[==========] 20 tests from 3 test suites ran. (85 ms total)
[ PASSED ] 20 tests.
from turbo.
Mhm, you are right 😅.
Then, can you please cd
into deps/tvision
(where Turbo Vision is located) and run CMake there with -DTV_BUILD_TESTS=ON
(to build Turbo Vision separately)?
from turbo.
Where does this flag come from?
cd /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_editors_turbo/turbo/work/build/source && /opt/local/bin/g++-mp-13 -DHAVE_NCURSES -DTVISION_NO_STL -DTV_BIG_ENDIAN -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_editors_turbo/turbo/work/turbo-782df70b97a355e332bbe37e12b5e4975bf730c0/deps/tvision/include -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_editors_turbo/turbo/work/turbo-782df70b97a355e332bbe37e12b5e4975bf730c0/deps/tvision/include/tvision -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_editors_turbo/turbo/work/turbo-782df70b97a355e332bbe37e12b5e4975bf730c0/deps/tvision/include/tvision/compat/borland -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_editors_turbo/turbo/work/turbo-782df70b97a355e332bbe37e12b5e4975bf730c0/deps/tvision/include/tvision/compat/windows -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_editors_turbo/turbo/work/turbo-782df70b97a355e332bbe37e12b5e4975bf730c0/deps/tvision/include/tvision/compat/malloc -I/opt/local/include -pipe -Os -DNDEBUG -I/opt/local/include -D_GLIBCXX_USE_CXX11_ABI=0 -arch ppc -mmacosx-version-min=10.6 -Wall -Wno-deprecated -Wno-unknown-pragmas -Wno-pragmas -Winvalid-pch -Xarch_ppc -include/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_editors_turbo/turbo/work/build/source/CMakeFiles/tvision.dir/cmake_pch_ppc.hxx -MD -MT source/CMakeFiles/tvision.dir/platform/colors.cpp.o -MF CMakeFiles/tvision.dir/platform/colors.cpp.o.d -o CMakeFiles/tvision.dir/platform/colors.cpp.o -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_editors_turbo/turbo/work/turbo-782df70b97a355e332bbe37e12b5e4975bf730c0/deps/tvision/source/platform/colors.cpp
g++-mp-13: error: unrecognized command-line option '-Xarch_ppc'
[ 2%] Building CXX object source/CMakeFiles/tvision.dir/platform/ansidisp.cpp.o
make[2]: *** [source/CMakeFiles/tvision.dir/platform/codepage.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
It is perhaps Clang-specific, we should get rid of it.
from turbo.
@magiblot Test results for tvision
:
[100%] Generating tvision-test-passed
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_textproc_tvision/tvision/work/build/test/tvision-test
Running main() from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_gtest/gtest/work/googletest-1.14.0/googletest/src/gtest_main.cc
[==========] Running 29 tests from 10 test suites.
[----------] Global test environment set-up.
[----------] 2 tests from Base64
[ RUN ] Base64.ShouldDecodeProperly
[ OK ] Base64.ShouldDecodeProperly (0 ms)
[ RUN ] Base64.ShouldEncodeProperly
[ OK ] Base64.ShouldEncodeProperly (0 ms)
[----------] 2 tests from Base64 (0 ms total)
[----------] 5 tests from Endianess
[ RUN ] Endianess.AliasingInKeyDownEventShouldWorkCorrectly
[ OK ] Endianess.AliasingInKeyDownEventShouldWorkCorrectly (0 ms)
[ RUN ] Endianess.AliasingInMessageEventShouldWorkCorrectly
[ OK ] Endianess.AliasingInMessageEventShouldWorkCorrectly (0 ms)
[ RUN ] Endianess.TWindowShouldHandleSelectCommand
[ OK ] Endianess.TWindowShouldHandleSelectCommand (0 ms)
[ RUN ] Endianess.ColorsWithBitFieldsShouldBehaveAsExpected
[ OK ] Endianess.ColorsWithBitFieldsShouldBehaveAsExpected (0 ms)
[ RUN ] Endianess.TermColorShouldBehaveAsExpected
[ OK ] Endianess.TermColorShouldBehaveAsExpected (0 ms)
[----------] 5 tests from Endianess (0 ms total)
[----------] 1 test from Far2l
[ RUN ] Far2l.ShouldReadFar2lInput
[ OK ] Far2l.ShouldReadFar2lInput (9 ms)
[----------] 1 test from Far2l (10 ms total)
[----------] 1 test from Scrncell
[ RUN ] Scrncell.StructsShouldBeTrivialAndHaveTheExpectedAlignmentAndSize
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_textproc_tvision/tvision/work/tvision-f933af5e18c2bc7b3ead2778447d5b1b171d1df4/test/platform/scrncell.test.cpp:16: Failure
Expected equality of these values:
alignof(TColorAttr)
Which is: 4
8
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_textproc_tvision/tvision/work/tvision-f933af5e18c2bc7b3ead2778447d5b1b171d1df4/test/platform/scrncell.test.cpp:17: Failure
Expected equality of these values:
alignof(TAttrPair)
Which is: 4
8
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_textproc_tvision/tvision/work/tvision-f933af5e18c2bc7b3ead2778447d5b1b171d1df4/test/platform/scrncell.test.cpp:19: Failure
Expected equality of these values:
alignof(TScreenCell)
Which is: 4
8
[ FAILED ] Scrncell.StructsShouldBeTrivialAndHaveTheExpectedAlignmentAndSize (0 ms)
[----------] 1 test from Scrncell (0 ms total)
[----------] 2 tests from TermIO
[ RUN ] TermIO.ShouldNormalizeKeys
[ OK ] TermIO.ShouldNormalizeKeys (0 ms)
[ RUN ] TermIO.ShouldReadWin32InputModeKeys
[ OK ] TermIO.ShouldReadWin32InputModeKeys (0 ms)
[----------] 2 tests from TermIO (0 ms total)
[----------] 2 tests from TText
[ RUN ] TText.ShouldConvertUtf8ControlCharacters
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_textproc_tvision/tvision/work/tvision-f933af5e18c2bc7b3ead2778447d5b1b171d1df4/test/test.h:17: Failure
Expected equality of these values:
actual
Which is: ♥
expected
Which is: ♥͛
With test input:
͛
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_textproc_tvision/tvision/work/tvision-f933af5e18c2bc7b3ead2778447d5b1b171d1df4/test/test.h:17: Failure
Expected equality of these values:
actual
Which is: ñ
expected
Which is: ñ͛
With test input:
ñ͛
[ FAILED ] TText.ShouldConvertUtf8ControlCharacters (1 ms)
[ RUN ] TText.ShouldConvertUtf32ControlCharacters
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_textproc_tvision/tvision/work/tvision-f933af5e18c2bc7b3ead2778447d5b1b171d1df4/test/test.h:17: Failure
Expected equality of these values:
actual
Which is: �
expected
Which is: �͛
With test input:
\x03\u035B
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_textproc_tvision/tvision/work/tvision-f933af5e18c2bc7b3ead2778447d5b1b171d1df4/test/test.h:17: Failure
Expected equality of these values:
actual
Which is: ñ
expected
Which is: ñ͛
With test input:
\xF1\u035B
[ FAILED ] TText.ShouldConvertUtf32ControlCharacters (0 ms)
[----------] 2 tests from TText (1 ms total)
[----------] 1 test from Utf8
[ RUN ] Utf8.ShouldConvertUtf16StringToUtf8
[ OK ] Utf8.ShouldConvertUtf16StringToUtf8 (0 ms)
[----------] 1 test from Utf8 (0 ms total)
[----------] 1 test from TTerminal
[ RUN ] TTerminal.prevLinesShouldWorkProperly
[ OK ] TTerminal.prevLinesShouldWorkProperly (0 ms)
[----------] 1 test from TTerminal (0 ms total)
[----------] 1 test from TKey
[ RUN ] TKey.ShouldConstructProperly
[ OK ] TKey.ShouldConstructProperly (0 ms)
[----------] 1 test from TKey (0 ms total)
[----------] 13 tests from TTimerQueue
[ RUN ] TTimerQueue.EmptyQueueShouldReturnNoTimeouts
[ OK ] TTimerQueue.EmptyQueueShouldReturnNoTimeouts (0 ms)
[ RUN ] TTimerQueue.ShouldCollectExpiredTimeout
[ OK ] TTimerQueue.ShouldCollectExpiredTimeout (0 ms)
[ RUN ] TTimerQueue.ShouldMeasureNextTimeoutProperly
[ OK ] TTimerQueue.ShouldMeasureNextTimeoutProperly (0 ms)
[ RUN ] TTimerQueue.ShouldUnqueueSingleShotTimer
[ OK ] TTimerQueue.ShouldUnqueueSingleShotTimer (0 ms)
[ RUN ] TTimerQueue.ShouldRequeuePeriodicTimer
[ OK ] TTimerQueue.ShouldRequeuePeriodicTimer (0 ms)
[ RUN ] TTimerQueue.ShouldCollectOnlyExpiredTimeouts
[ OK ] TTimerQueue.ShouldCollectOnlyExpiredTimeouts (0 ms)
[ RUN ] TTimerQueue.ShouldMeasureNextTimeoutProperlyWithSeveralTimers
[ OK ] TTimerQueue.ShouldMeasureNextTimeoutProperlyWithSeveralTimers (0 ms)
[ RUN ] TTimerQueue.ShouldCollectSeveralExpiredTimers
[ OK ] TTimerQueue.ShouldCollectSeveralExpiredTimers (0 ms)
[ RUN ] TTimerQueue.ShouldRemoveTimer
[ OK ] TTimerQueue.ShouldRemoveTimer (0 ms)
[ RUN ] TTimerQueue.RemovingInvalidTimersShouldNotProduceErrors
[ OK ] TTimerQueue.RemovingInvalidTimersShouldNotProduceErrors (0 ms)
[ RUN ] TTimerQueue.ShouldHandleZeroTimedTimersProperly
[ OK ] TTimerQueue.ShouldHandleZeroTimedTimersProperly (0 ms)
[ RUN ] TTimerQueue.ShouldCollectTimeoutsWithNestedInvocation
[ OK ] TTimerQueue.ShouldCollectTimeoutsWithNestedInvocation (0 ms)
[ RUN ] TTimerQueue.ShouldNotRequestCurrentTimeIfThereAreNoTimers
[ OK ] TTimerQueue.ShouldNotRequestCurrentTimeIfThereAreNoTimers (0 ms)
[----------] 13 tests from TTimerQueue (0 ms total)
[----------] Global test environment tear-down
[==========] 29 tests from 10 test suites ran. (15 ms total)
[ PASSED ] 26 tests.
[ FAILED ] 3 tests, listed below:
[ FAILED ] Scrncell.StructsShouldBeTrivialAndHaveTheExpectedAlignmentAndSize
[ FAILED ] TText.ShouldConvertUtf8ControlCharacters
[ FAILED ] TText.ShouldConvertUtf32ControlCharacters
3 FAILED TESTS
from turbo.
@magiblot And what adds -Xarch_ppc
flag breaking the build is -DTV_OPTIMIZE_BUILD=ON
. Passing -DTV_OPTIMIZE_BUILD=OFF
fixes everything.
A bug in CMake or where this comes from?
from turbo.
Okay. I wasn't expecting the alignof
tests to fail, but from the failed UTF-8/32 tests it can be deduced that there's likely a problem with your terminal locale settings. See #46 (comment).
Then, given that no other tests failed, I wonder if "the TUI not reacting to anything" isn't just an issue with the terminal's keyboard settings. See magiblot/tvision#100 (comment).
@magiblot And what adds
-Xarch_ppc
flag breaking the build is-DTV_OPTIMIZE_BUILD=ON
. Passing-DTV_OPTIMIZE_BUILD=OFF
fixes everything.A bug in CMake or where this comes from?
In your case, -DTV_OPTIMIZE_BUILD=ON
only leads to enabling precompiled headers via target_precompile_headers
, so I guess that's what originates the issue, but I have no idea why.
from turbo.
@magiblot I will try your suggestions, thank you.
For alignments: it is not an untypical issue, I think. Darwin ppc has 4-byte bools and spinlocks, it has some specifics with structs packing.
For the flags, looks like a CMake bug, from a quick search. See, for instance: https://android.googlesource.com/platform/external/deqp-deps/glslang/+/refs/heads/main/CMakeLists.txt#99
from turbo.
Turned out locale was already set to Unicode (via Terminal app):
36-246% locale
LANG="en_US.utf-8"
LC_COLLATE="en_US.utf-8"
LC_CTYPE="en_US.utf-8"
LC_MESSAGES="en_US.utf-8"
LC_MONETARY="en_US.utf-8"
LC_NUMERIC="en_US.utf-8"
LC_TIME="en_US.utf-8"
LC_ALL=
I have activated the setting for Option key now, but apparently turbo
interface is still unresponsive.
from turbo.
Okay, then this is something I hadn't seen before.
Could you please check:
- Does the application respond to mouse events?
- Does the application redraw itself properly if you resize the terminal?
- Does defining the environment variable
TVISION_USE_STDIO=1
make any difference?
from turbo.
I will be back to the PowerMac in a couple of hours, but I have built turbo
now on 10.6 i368 (same pre-release build which I have on ppc) and 10.6.8 x86_64 (in VM), and it seems that on i386 I have the same issue as on ppc: interface does not respond to keyboard commands.
So this problem is not related to Big-endian arch, but either to 32-bitness or, less likely perhaps, to something with 10.6 SDK (pre-release version is closer to 10.5 in some respects).
Resizing window works fine on 10.6 i386 at least.
from turbo.
Hi, thanks for the information.
It is not so unlikely that this is related to the OS version. Turbo Vision uses the poll
syscall to wait for input in the terminal device (/dev/tty*
). However, poll
on macOS has not always worked well. That's why I suggested to set TVISION_USE_STDIO=1
, since that will result in standard input being used instead, which may make a difference if this is the problem.
from turbo.
@magiblot I tried now to export TVISION_USE_STDIO=1
prior to launching turbo
on the PowerMac, but it made no difference. Neither Control+smth works, nor mouse clicks on the menu items.
(On aarch64 laptop both work fine.)
from turbo.
Do you know if there is any way for me to run this pre-release macOS version you are using in a VM?
Technically yes, but that may not be very trivial. If you could get 10.5.8 i386 (or 10.6.8 Rosetta) running, that will probably serve a functional substitute, since a) this particular issue seems not be specific to ppc
and b) while there are a few exotic cases when something will work on 10.5.8 and 10.6.8 but not on 10.6 pre-release, almost always 10.5.8 or 10.6.8 Rosetta exhibit same issues. In the worst case, we can always build against 10.5 SDK on 10.6 pre-release, and that will be identical to building on 10.5.
10.6.8 x86 may not be helpful, since SDK is substantially different, while the same 10.6.8 for ppc
(via Rosetta) is still pretty close.
@catap has a set-up to bootstrap Macports on various macOS versions, including 10.5.8 and 10.6.8 Rosetta, with support for Parallels: https://github.com/catap/macos-ansible-playbooks
Will this be helpful?
P. S. If you will actually want to install 10.6 pre-release in VM, here is what I personally followed: https://ivanexpert.com/2020/06/snow-leopard-in-parallels-desktop
I can confirm it is installable and works, however Parallels somehow resets the hack once in a while, so I keep the alternative boot image to repeat the trick. This may not be specific to the OS version but rather to the fact that it is a non-server version which Parallels does not officially support (for 10.5–10.6).
Install images are available here: https://macintoshgarden.org/apps/mac-os-x-snow-leopard-powerpc-the-early-106-developer-builds
The relevant one is 10A190 (the last one to run natively on PowerPC).
It is also possible to install 10A190 on an old-enough Intel Mac. It gonna support building and running ppc
binaries (no need for Rosetta, it gonna work out of the box). 10.6.8 (with Rosetta) can be installed perhaps up to 2012 gen MacMini, however those will require a custom kernel. (If that is easier, I will fix a link to the procedure.)
Finally, it might be possible to install PowerPC macOS via Qemu or UTM, but I could not make it work from the get-go, and had no time to dig into fixing that.
However I mention all this just in a context of replying to your question. While I do think there is worth in using 10A190 on PowerPC natively, it may be unnecessary pain to use it in VM. Especially when the use case is to debug one specific app.
from turbo.
Hi Sergey,
I appreciate the effort you put into explaining all this to me.
Unfortunately, even though I had already managed to get other macOS versions to run on my Linux system in VirtualBox, I was unable to do the same with this one. I do not own Apple hardware, so there's not much more I can try to reproduce the issue locally.
However, if you are still interested in helping investigate this further, I suggest you try to compile and run the following program in the system where Turbo is unresponsive, and report on the result. I am suspicious about poll()
, so I want to check whether it's behaving as expected.
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <poll.h>
int main()
{
int fd = 0;
FILE *file = stdin;
struct pollfd pollfds[1];
pollfds[0].fd = fd;
pollfds[0].events = POLLIN;
while (true) {
if (poll(pollfds, 1, 50) < 0) {
fprintf(stderr, "'poll' error: %s\n", strerror(errno));
break;
}
if (pollfds[0].revents & POLLERR) {
fprintf(stderr, "fd %d error: POLLERR\n", fd);
break;
}
if (pollfds[0].revents & POLLHUP) {
fprintf(stderr, "fd %d error: POLLHUP\n", fd);
break;
}
if (pollfds[0].revents & POLLIN) {
fprintf(stderr, "fd %d success: POLLIN\n", fd);
char s[256];
fgets(s, sizeof(s), file);
}
}
}
For example, the expected output of the program if you press Enter three times is:
fd 0 success: POLLIN
fd 0 success: POLLIN
fd 0 success: POLLIN
If on your system the program prints something else, then the problem is actually related to poll()
and can probably be solved by using select()
instead. Otherwise, I'm definitely out of clues.
Cheers.
from turbo.
Unfortunately, even though I had already managed to get other macOS versions to run on my Linux system in VirtualBox, I was unable to do the same with this one.
Just for the record, if the standard 10.6.8 installs in your setup, then choosing to install Rosetta along (it is in optional installs or something pretty obvious during installation) will enable building and running ppc
binaries. Parallels normally needs a Server version of 10.6.8. Other VM may be indifferent. Rosetta is available in either.
(I do not expect anyone installing specifically pre-release build of 10.6, it hardly makes sense and is considerably more problematic both to install and maintain.)
I am suspicious about poll(), so I want to check whether it's behaving as expected.
Let me try.
from turbo.
@magiblot Apparently it does not work :)
After adding stdbool.h
(otherwise true
undeclared), I built the test binary, but when I run it and press Enter, I do not get anything printed at all, just a new line.
The same program with the same header added produces expected output on on Sonoma.
from turbo.
Oh well:
https://trac.macports.org/ticket/66397
https://trac.macports.org/ticket/63650
macports/macports-ports@a80002d
So yes, poll is known to be broken.
And from looks of things, it is a sheer luck that it appeared to be working on 10.6.8, it fact it may still be broken.
Could we have a fallback?
from turbo.
@magiblot If you could help with the fallback code that does not rely on poll()
, I will test it. Looks like this indeed was the breaking issue.
from turbo.
Hi Sergey!
Sorry for the delay. Could you please try with the following changes in the tvision
source code?
In source/platform/stdioctl.cpp
:
--- a/source/platform/stdioctl.cpp
+++ b/source/platform/stdioctl.cpp
@@ -40,16 +40,7 @@ namespace tvision
StdioCtl::StdioCtl() noexcept
{
if (getEnv<TStringView>("TVISION_USE_STDIO").empty())
- {
- for (int fd : {0, 1, 2})
- if (auto *name = ::ttyname(fd))
- if ((ttyfd = ::open(name, O_RDWR)) != -1)
- break;
- // Last resort, although this may lead to 100% CPU usage because
- // /dev/tty is not supported by macOS's poll(),
- if (ttyfd == -1)
- ttyfd = ::open("/dev/tty", O_RDWR);
- }
+ ttyfd = ::open("/dev/tty", O_RDWR);
if (ttyfd != -1)
{
In source/platform/events.cpp
:
--- a/source/platform/events.cpp
+++ b/source/platform/events.cpp
@@ -10,6 +10,7 @@ using std::chrono::steady_clock;
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
+#include <sys/select.h>
#endif
namespace tvision
@@ -135,17 +136,35 @@ static void pollHandles(PollData &pd, int ms) noexcept
{
auto &fds = pd.items;
auto &states = pd.states;
- if (poll(fds.data(), fds.size(), ms) > 0)
- for (size_t i = 0; i < fds.size(); ++i)
+ fd_set readFds;
+ FD_ZERO(&readFds);
+ int maxFd = -1;
+ for (size_t i = 0; i < fds.size(); ++i)
+ if (fds[i].fd < FD_SETSIZE)
{
- if ( (fds[i].revents & POLLHUP) ||
- ((fds[i].revents & POLLIN) && fdEmpty(fds[i].fd)) )
- // Broken pipe or EOF will cause poll to return immediately,
- // so remove it from the list.
- states[i] = psDisconnect;
- else if (fds[i].revents & POLLIN)
- states[i] = psReady;
+ FD_SET(fds[i].fd, &readFds);
+ if (fds[i].fd > maxFd)
+ maxFd = fds[i].fd;
}
+ if (maxFd >= 0)
+ {
+ struct timeval timeout;
+ timeout.tv_sec = 0;
+ timeout.tv_usec = ms*1000;
+
+ if ( select( maxFd + 1, &readFds, nullptr, nullptr,
+ (ms < 0 ? nullptr : &timeout) ) >= 0 )
+ {
+ for (size_t i = 0; i < fds.size(); ++i)
+ if (fds[i].fd < FD_SETSIZE && FD_ISSET(fds[i].fd, &readFds))
+ {
+ if (fdEmpty(fds[i].fd))
+ states[i] = psDisconnect;
+ else
+ states[i] = psReady;
+ }
+ }
+ }
}
#else
Cheers.
from turbo.
@magiblot I rebuilt turbo
with the patch, and now graphics is gone, but those sliders on the right are clickable, I can create subsections of empty screen :)
from turbo.
from turbo.
@magiblot I rebuilt
turbo
with the patch, and now graphics is gone, but those sliders on the right are clickable, I can create subsections of empty screen :)
Does the same happen if you undo the patch in stdioctl.cpp
?
from turbo.
@magiblot Looks like I have used an outdated source this time, sorry. (I forgot that I did not update it yet in Macports, and overwritten my local portfile.)
Will redo the build now, picking the correct version from 782df70 and adding your patch.
from turbo.
@magiblot It works now! Using source from 782df70 and applying the patch above #65 (comment)
from turbo.
GUI is responsive. I don’t know if everything is rendered correctly, but it works now:
from turbo.
Great.
Some of the block-drawing characters are not displayed properly, but that's most likely the fault of the terminal emulator or the font it's using. You may try using a different font or copying the font from a more recent of macOS.
So I think the only thing that remains broken is:
3. I noticed one non-breaking error in the very end of the build:
osascript -e use\ framework\ \"Cocoa\" -e set\ sourcePath\ to\ \"/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_editors_turbo/turbo/work/turbo-782df70b97a355e332bbe37e12b5e4975bf730c0/source/turbo/icon.icns\" -e set\ destPath\ to\ \"/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_editors_turbo/turbo/work/build/turbo\" -e set\ imageData\ to\ \(current\ application\'s\ NSImage\'s\ alloc\(\)\'s\ initWithContentsOfFile:sourcePath\) -e \(current\ application\'s\ NSWorkspace\'s\ sharedWorkspace\(\)\'s\ setIcon:imageData\ forFile:destPath\ options:0\) >/dev/null || echo Warning:\ failed\ to\ set\ application\ icon 0:13: syntax error: A identifier can’t go after this identifier. (-2740) Warning: failed to set application icon
But I have no knowledge on whether that script can be made to work in the macOS version you are using. I do not wish to spend time on it, so I do not mind if it stays broken. It's not that important.
from turbo.
@magiblot Thank you very much for helping to fix this!
For icon thing, I will take a look, if it is an easy fix, I will make a PR, otherwise indeed it is not something important.
from turbo.
Related Issues (20)
- System clipboard integration HOT 2
- icon HOT 6
- Feature Request: Load a specific directory tree in the document tree. HOT 2
- Scrolling down using mouse wheel problem HOT 2
- install TARGETS given target "fmt" which does not exist. HOT 1
- Feature request: highlighting for text files
- consider switching from Alt-X to Ctrl-X as exit hotkey HOT 7
- Make the first release. HOT 2
- segfault HOT 2
- Can't change tab size. HOT 4
- Run on docker HOT 2
- Store and load settings HOT 1
- Line numbers / OCD issue HOT 1
- [Feature request] LSP support? HOT 1
- artifacts during window resize HOT 4
- [Feature request] Remember last state for visibility of "Open Editors" and "Show line numbers". HOT 3
- Turbo removes trailing spaces on save HOT 4
- Binaries in action artifacts expiring HOT 1
- use `text-editor` as a topic HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from turbo.