bootstrap fix

cvs
Slava Pestov 2005-11-15 17:58:44 +00:00
parent 3091f9b20a
commit 036d1f9673
12 changed files with 31 additions and 83 deletions

View File

@ -10,7 +10,7 @@ GENERIC: linearize* ( node -- )
#! Transform dataflow IR into linear IR. This strips out
#! stack flow information, and flattens conditionals into
#! jumps and labels.
[ %prologue , %irq , linearize* ] { } make ;
[ %prologue , linearize* ] { } make ;
: linearize-next node-successor linearize* ;
@ -20,7 +20,6 @@ M: node linearize* ( node -- ) linearize-next ;
M: #label linearize* ( node -- )
<label> [
%irq ,
%return-to ,
dup node-param %label ,
dup node-child linearize*

View File

@ -117,17 +117,3 @@ M: %type generate-node ( vop -- )
M: %tag generate-node ( vop -- )
dup 0 vop-in v>operand swap 0 vop-out v>operand
[ tag-mask ANDI ] keep dup tag-fixnum ;
M: %irq generate-node ( vop -- )
#! Interrupt check.
drop
<label> "end" set
! Load interruption flag
"interrupt" f 3 compile-dlsym
3 3 0 LWZ
! Is it set?
0 3 0 CMPI
"end" get BEQ
! Call the FEP.
"factorbug" f compile-c-call
"end" get save-xt ;

View File

@ -77,11 +77,6 @@ M: vop stack-reserve drop 0 ;
: 2-vop ( in dest) [ 2array ] keep 1array f ;
: 3-vop ( in1 in2 dest) >r 2array r> 1array f ;
! interruption check
TUPLE: %irq ;
C: %irq make-vop ;
: %irq empty-vop <%irq> ;
! miscellanea
TUPLE: %prologue ;
C: %prologue make-vop ;

View File

@ -88,11 +88,3 @@ M: %tag generate-node ( vop -- )
M: %untag generate-node ( vop -- )
0 vop-out v>operand tag-mask bitnot AND ;
M: %irq generate-node ( vop -- )
"end" <label> set
drop
"interrupt" f [ 0 CMP ] compile-dlsym
"end" get JE
"factorbug" f compile-c-call
"end" get save-xt ;

View File

@ -2,22 +2,28 @@
! See http://factor.sf.net/license.txt for BSD license.
IN: gadgets
USING: arrays alien gadgets-layouts generic kernel lists math
namespaces sdl sequences strings ;
GENERIC: handle-event ( event -- )
namespaces sdl sequences strings freetype opengl ;
M: object handle-event ( event -- )
drop ;
M: button-down-event handle-event ( event -- )
button-event-button button/ ;
update-clicked
button-event-button dup
hand get hand-buttons push
[ button-down ] button-gesture ;
M: button-up-event handle-event ( event -- )
button-event-button button\ ;
button-event-button dup
hand get hand-buttons delete
[ button-up ] button-gesture ;
: motion-event-loc ( event -- loc )
dup motion-event-x swap motion-event-y 0 3array ;
M: motion-event handle-event ( event -- )
motion-event-loc move-hand ;
M: key-down-event handle-event ( event -- )
dup keyboard-event>binding
hand get hand-focus handle-gesture [
@ -29,3 +35,11 @@ M: key-down-event handle-event ( event -- )
] [
drop
] if ;
M: quit-event handle-event ( event -- )
drop stop-world ;
M: resize-event handle-event ( event -- )
flush-fonts
gl-resize
width get height get 0 3array world get set-gadget-dim ;

View File

@ -19,15 +19,6 @@ C: hand ( -- hand )
: button-gesture ( button gesture -- )
swap add hand get hand-clicked handle-gesture drop ;
: button/ ( n -- )
update-clicked
dup hand get hand-buttons push
[ button-down ] button-gesture ;
: button\ ( n -- )
dup hand get hand-buttons delete
[ button-up ] button-gesture ;
: drag-gesture ( hand gadget gesture -- )
#! Send a gesture like [ drag 2 ].
rot hand-buttons first add swap handle-gesture drop ;

View File

@ -7,9 +7,9 @@ USING: kernel parser sequences io ;
"/library/ui/gestures.factor"
"/library/ui/theme.factor"
"/library/ui/hand.factor"
"/library/ui/events.factor"
"/library/ui/frames.factor"
"/library/ui/world.factor"
"/library/ui/events.factor"
"/library/ui/borders.factor"
"/library/ui/labels.factor"
"/library/ui/buttons.factor"

View File

@ -72,12 +72,12 @@ M: f set-message 2drop ;
#! the current gadget, with all parents in between.
hand get hand-gadget parents reverse-slice ;
: update-hand-gadget ( -- )
hand-grab hand get set-hand-gadget ;
: hand-grab ( -- gadget )
hand get rect-loc world get pick-up ;
: update-hand-gadget ( -- )
hand-grab hand get set-hand-gadget ;
: move-hand ( loc -- )
under-hand >r hand get set-rect-loc
update-hand-gadget
@ -89,9 +89,6 @@ M: f set-message 2drop ;
dup screen-loc over set-hand-click-loc
dup hand-gadget over relative swap set-hand-click-rel ;
M: motion-event handle-event ( event -- )
motion-event-loc move-hand ;
: update-hand ( -- )
#! Called when a gadget is removed or added.
hand get rect-loc move-hand ;
@ -112,6 +109,8 @@ M: motion-event handle-event ( event -- )
: next-event ( -- event ? ) <event> dup SDL_PollEvent ;
GENERIC: handle-event ( event -- )
: world-loop ( -- )
#! Keep polling for events until there are no more events in
#! the queue; then block for the next event.
@ -124,11 +123,3 @@ M: motion-event handle-event ( event -- )
: run-world ( -- )
[ start-world world-loop ] [ stop-world ] cleanup ;
M: quit-event handle-event ( event -- )
drop stop-world ;
M: resize-event handle-event ( event -- )
flush-fonts
gl-resize
width get height get 0 3array world get set-gadget-dim ;

View File

@ -160,8 +160,6 @@ void dump_generations(void)
void factorbug(void)
{
interrupt = false;
#ifndef WIN32
fcntl(0,F_SETFL,0);
fcntl(1,F_SETFL,0);

View File

@ -14,8 +14,6 @@ void run(void)
if(throwing)
{
interrupt = false;
if(thrown_keep_stacks)
{
ds = thrown_ds;
@ -40,11 +38,6 @@ void run(void)
{
if(callframe == F)
{
if(interrupt)
{
factorbug();
}
callframe = cpop();
executing = cpop();
continue;

View File

@ -20,9 +20,6 @@
/* TAGGED user environment data; see getenv/setenv prims */
DLLEXPORT CELL userenv[USER_ENV];
/* boolean: if true, next interruption check raises exception to user code */
DLLEXPORT bool interrupt;
/* Error handlers restore this */
JMP_BUF toplevel;

View File

@ -12,31 +12,23 @@ void signal_handler(int signal, siginfo_t* siginfo, void* uap)
signal_error(signal);
}
void dump_stack_signal(int signal, siginfo_t* siginfo, void* uap)
{
interrupt = true;
}
void init_signals(void)
{
struct sigaction custom_sigaction;
struct sigaction ign_sigaction;
struct sigaction dump_sigaction;
sigemptyset(&custom_sigaction.sa_mask);
custom_sigaction.sa_sigaction = signal_handler;
custom_sigaction.sa_flags = SA_SIGINFO;
sigemptyset(&dump_sigaction.sa_mask);
dump_sigaction.sa_sigaction = dump_stack_signal;
dump_sigaction.sa_flags = SA_SIGINFO;
sigemptyset(&ign_sigaction.sa_mask);
ign_sigaction.sa_handler = SIG_IGN;
sigaction(SIGABRT,&custom_sigaction,NULL);
sigaction(SIGFPE,&custom_sigaction,NULL);
sigaction(SIGBUS,&custom_sigaction,NULL);
sigaction(SIGQUIT,&custom_sigaction,NULL);
sigaction(SIGINT,&dump_sigaction,NULL);
sigaction(SIGPIPE,&ign_sigaction,NULL);
sigaction(SIGSEGV,&custom_sigaction,NULL);
sigemptyset(&ign_sigaction.sa_mask);
ign_sigaction.sa_handler = SIG_IGN;
sigaction(SIGPIPE,&ign_sigaction,NULL);
#ifdef __APPLE__
mach_initialize();