r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!REBOL3 Host Kit]

ssolie
7-Nov-2010
[798]
I just implemented CTRL-C checking in OS event handler and I call 
RL_Escape() when it is detected. Seems to work fine now.


On Amiga, all signals must be explicitly checked for. This is both 
good and bad of course. The control is nice but the code duplication 
for things like CTRL-C is not.
Pekr
7-Nov-2010
[799x3]
Inability to catch window close is a defect in desing, easy as that 
...
I can't imagine my browser does not ask me, if I want to save tonnes 
of opened tabs. Why should we miss that R2 feature?
I think that insert-event-func was good mechanism to use ....
ssolie
7-Nov-2010
[802]
So you mean that the OS should be able to control the closing of 
the window and REBOL should not be able to interrupt that?
Pekr
7-Nov-2010
[803]
exactly the opposite ...
ssolie
7-Nov-2010
[804]
Ah, so REBOL is in control and the OS must obey.
Pekr
7-Nov-2010
[805]
Rebol can be in control, but does not have to be. IIRC in R2, you 
used something like insert-event-func, which inserted your handler 
into an event loop, where you could catch such events ....
ssolie
7-Nov-2010
[806x2]
As it is now, I simply post an EVT_CLOSE event and if successful, 
close the window. There is no opportunity to receive information 
from R3 on whether the EVT_CLOSE was successful or not.
The EVT_CLOSE may fail if out of memory only.
Pekr
7-Nov-2010
[808x2]
I don't understand low level implementations much, but once again 
- I regard eventual non-ability to control such behaviour as windows 
closure from my script, a defect, not a feature :-)
... and R3 should add flexibility in comparison to R2, not to remove 
it ...
ssolie
7-Nov-2010
[810]
As it stands right now, R3 accepts the EVT_CLOSE and can do nothing 
to stop it.
Pekr
7-Nov-2010
[811x2]
I don't know how R2 did it, but IIRC it was possible ...
I don't use it in my scripts. Maybe I used it once. But - I don't 
want to explain to eventual client, that REBOL as a platform can't 
offer such a feature as a dialog box warning before the close of 
the window happens ...
ssolie
7-Nov-2010
[813x2]
In user terms, if I hit the close gadget on my window then it closes. 
The only time it may not close is if the event queue is full. There 
is no "are you sure?" opportunity. This is why I asked about it. 
:)
I suppose I should go file a bug report right now so we don't forget...
Henrik
7-Nov-2010
[815]
If you don't have the ability to intercept the closing of the window, 
then you will cause data loss in apps, and not giving the program 
a chance to clean up (temp files, file locks, etc.) when quitting. 
Tthis deals with more than plain warnings of window closure. This 
is a UI and app specific behavior issue and should really not be 
controlled on a low level.
Gregg
7-Nov-2010
[816]
I'm with Petr and Henrik here. We need to get the event and not have 
our process end before we can clean up. Hard terminating an runaway 
or zombie is a different issue.
ssolie
7-Nov-2010
[817x2]
I am currently doing cleanup in the RDC_QUIT vector of the OS Events 
device.
Filed a bug report.. bbl
Cyphre
7-Nov-2010
[819]
Carl, Andreas: I tried to update the Xcode to 2.5 but the compiled 
result of the test from Andreas is the same as with the older version 
:-/
Andreas
7-Nov-2010
[820x3]
Ha, Cyphre!
I think I figured it out even for older toolchains.
Would you like to help me testing?
Cyphre
7-Nov-2010
[823]
sure, I can..let me boot and login to my old mac mini ;)
Andreas
7-Nov-2010
[824]
Ok, let's use PM to reduce the noise :)
Cyphre
7-Nov-2010
[825]
ok
Andreas
7-Nov-2010
[826x3]
Ok, seems we solved the OS X linking issue even for older toolchains.
The trick is to partially link all objects into an (internally resolved) 
single object and then use this to create the shared library. So, 
for Carl's example, that boils down to:

  ld -r -x -o lib.so a.o b.o
  gcc -dynamiclib -o lib.so lib.o

Here's a full package illustrating this:
http://bolka.at/2010/misc/exports2.tar.gz
Sorry, subtle but critical typo in the above. Should be:

  ld -r -x -o lib.o a.o b.o
  gcc -dynamiclib -o lib.so lib.o
Carl
8-Nov-2010
[829x4]
Ah, very good. This solution looks like it does what is needed!  
I should have the OS X .so out soon.
The link failed...

ld: lib.o malformed object (section (__TEXT,___textcoal_nt) no symbol 
at start of coalesced section)
Using -t ... the above ld failure happens in the system files, not 
the R3 side.
I've confirmed that /core builds and runs... so this is not likely 
to be related to the gcc update.
Andreas
8-Nov-2010
[833]
Hm, does the link succeed if you leave out the -x option to ld?
Carl
8-Nov-2010
[834]
yes
Andreas
8-Nov-2010
[835x2]
Ok. Then try make an unstripped .so from the unstripped .o and strip 
-x the .so afterwards.
I.e.:
  ld -r -o lib.o a.o b.o
  gcc -dynamiclib -o lib.so lib.o
  strip -x lib.so
Carl
8-Nov-2010
[837x3]
Actually... I tried that earlier... 1 min...
I misinterpreted the result... that does actually seem to work.
I'll do some tests, and if they pass, will upload the new .so.
Andreas
8-Nov-2010
[840x3]
Great!
It would also be very neat if you could upload the (stripped) libr3.o 
as well, if that's ok for you. Would allow us to build self-contained 
binaries by statically linking in libr3.
Same for Linux (and FreeBSD, and ...), of course. Not sure if this 
is possible on Windows (I doubt it, actually).
Maxim
8-Nov-2010
[843]
guess it would be a .lib
Andreas
8-Nov-2010
[844x2]
Yes, but no idea if partial linking is possible with COFF.
(I.e. on Win32.)
Carl
8-Nov-2010
[846]
A: yes, can export static lib for OS X and Linux.
Andreas
8-Nov-2010
[847]
Lovely!