bootstrap fix
parent
3091f9b20a
commit
036d1f9673
|
@ -10,7 +10,7 @@ GENERIC: linearize* ( node -- )
|
||||||
#! Transform dataflow IR into linear IR. This strips out
|
#! Transform dataflow IR into linear IR. This strips out
|
||||||
#! stack flow information, and flattens conditionals into
|
#! stack flow information, and flattens conditionals into
|
||||||
#! jumps and labels.
|
#! jumps and labels.
|
||||||
[ %prologue , %irq , linearize* ] { } make ;
|
[ %prologue , linearize* ] { } make ;
|
||||||
|
|
||||||
: linearize-next node-successor linearize* ;
|
: linearize-next node-successor linearize* ;
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ M: node linearize* ( node -- ) linearize-next ;
|
||||||
|
|
||||||
M: #label linearize* ( node -- )
|
M: #label linearize* ( node -- )
|
||||||
<label> [
|
<label> [
|
||||||
%irq ,
|
|
||||||
%return-to ,
|
%return-to ,
|
||||||
dup node-param %label ,
|
dup node-param %label ,
|
||||||
dup node-child linearize*
|
dup node-child linearize*
|
||||||
|
|
|
@ -117,17 +117,3 @@ M: %type generate-node ( vop -- )
|
||||||
M: %tag generate-node ( vop -- )
|
M: %tag generate-node ( vop -- )
|
||||||
dup 0 vop-in v>operand swap 0 vop-out v>operand
|
dup 0 vop-in v>operand swap 0 vop-out v>operand
|
||||||
[ tag-mask ANDI ] keep dup tag-fixnum ;
|
[ 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 ;
|
|
||||||
|
|
|
@ -77,11 +77,6 @@ M: vop stack-reserve drop 0 ;
|
||||||
: 2-vop ( in dest) [ 2array ] keep 1array f ;
|
: 2-vop ( in dest) [ 2array ] keep 1array f ;
|
||||||
: 3-vop ( in1 in2 dest) >r 2array r> 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
|
! miscellanea
|
||||||
TUPLE: %prologue ;
|
TUPLE: %prologue ;
|
||||||
C: %prologue make-vop ;
|
C: %prologue make-vop ;
|
||||||
|
|
|
@ -88,11 +88,3 @@ M: %tag generate-node ( vop -- )
|
||||||
|
|
||||||
M: %untag generate-node ( vop -- )
|
M: %untag generate-node ( vop -- )
|
||||||
0 vop-out v>operand tag-mask bitnot AND ;
|
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 ;
|
|
||||||
|
|
|
@ -2,22 +2,28 @@
|
||||||
! See http://factor.sf.net/license.txt for BSD license.
|
! See http://factor.sf.net/license.txt for BSD license.
|
||||||
IN: gadgets
|
IN: gadgets
|
||||||
USING: arrays alien gadgets-layouts generic kernel lists math
|
USING: arrays alien gadgets-layouts generic kernel lists math
|
||||||
namespaces sdl sequences strings ;
|
namespaces sdl sequences strings freetype opengl ;
|
||||||
|
|
||||||
GENERIC: handle-event ( event -- )
|
|
||||||
|
|
||||||
M: object handle-event ( event -- )
|
M: object handle-event ( event -- )
|
||||||
drop ;
|
drop ;
|
||||||
|
|
||||||
M: button-down-event handle-event ( event -- )
|
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 -- )
|
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 )
|
: motion-event-loc ( event -- loc )
|
||||||
dup motion-event-x swap motion-event-y 0 3array ;
|
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 -- )
|
M: key-down-event handle-event ( event -- )
|
||||||
dup keyboard-event>binding
|
dup keyboard-event>binding
|
||||||
hand get hand-focus handle-gesture [
|
hand get hand-focus handle-gesture [
|
||||||
|
@ -29,3 +35,11 @@ M: key-down-event handle-event ( event -- )
|
||||||
] [
|
] [
|
||||||
drop
|
drop
|
||||||
] if ;
|
] 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 ;
|
||||||
|
|
|
@ -19,15 +19,6 @@ C: hand ( -- hand )
|
||||||
: button-gesture ( button gesture -- )
|
: button-gesture ( button gesture -- )
|
||||||
swap add hand get hand-clicked handle-gesture drop ;
|
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 -- )
|
: drag-gesture ( hand gadget gesture -- )
|
||||||
#! Send a gesture like [ drag 2 ].
|
#! Send a gesture like [ drag 2 ].
|
||||||
rot hand-buttons first add swap handle-gesture drop ;
|
rot hand-buttons first add swap handle-gesture drop ;
|
||||||
|
|
|
@ -7,9 +7,9 @@ USING: kernel parser sequences io ;
|
||||||
"/library/ui/gestures.factor"
|
"/library/ui/gestures.factor"
|
||||||
"/library/ui/theme.factor"
|
"/library/ui/theme.factor"
|
||||||
"/library/ui/hand.factor"
|
"/library/ui/hand.factor"
|
||||||
"/library/ui/events.factor"
|
|
||||||
"/library/ui/frames.factor"
|
"/library/ui/frames.factor"
|
||||||
"/library/ui/world.factor"
|
"/library/ui/world.factor"
|
||||||
|
"/library/ui/events.factor"
|
||||||
"/library/ui/borders.factor"
|
"/library/ui/borders.factor"
|
||||||
"/library/ui/labels.factor"
|
"/library/ui/labels.factor"
|
||||||
"/library/ui/buttons.factor"
|
"/library/ui/buttons.factor"
|
||||||
|
|
|
@ -72,12 +72,12 @@ M: f set-message 2drop ;
|
||||||
#! the current gadget, with all parents in between.
|
#! the current gadget, with all parents in between.
|
||||||
hand get hand-gadget parents reverse-slice ;
|
hand get hand-gadget parents reverse-slice ;
|
||||||
|
|
||||||
: update-hand-gadget ( -- )
|
|
||||||
hand-grab hand get set-hand-gadget ;
|
|
||||||
|
|
||||||
: hand-grab ( -- gadget )
|
: hand-grab ( -- gadget )
|
||||||
hand get rect-loc world get pick-up ;
|
hand get rect-loc world get pick-up ;
|
||||||
|
|
||||||
|
: update-hand-gadget ( -- )
|
||||||
|
hand-grab hand get set-hand-gadget ;
|
||||||
|
|
||||||
: move-hand ( loc -- )
|
: move-hand ( loc -- )
|
||||||
under-hand >r hand get set-rect-loc
|
under-hand >r hand get set-rect-loc
|
||||||
update-hand-gadget
|
update-hand-gadget
|
||||||
|
@ -89,9 +89,6 @@ M: f set-message 2drop ;
|
||||||
dup screen-loc over set-hand-click-loc
|
dup screen-loc over set-hand-click-loc
|
||||||
dup hand-gadget over relative swap set-hand-click-rel ;
|
dup hand-gadget over relative swap set-hand-click-rel ;
|
||||||
|
|
||||||
M: motion-event handle-event ( event -- )
|
|
||||||
motion-event-loc move-hand ;
|
|
||||||
|
|
||||||
: update-hand ( -- )
|
: update-hand ( -- )
|
||||||
#! Called when a gadget is removed or added.
|
#! Called when a gadget is removed or added.
|
||||||
hand get rect-loc move-hand ;
|
hand get rect-loc move-hand ;
|
||||||
|
@ -112,6 +109,8 @@ M: motion-event handle-event ( event -- )
|
||||||
|
|
||||||
: next-event ( -- event ? ) <event> dup SDL_PollEvent ;
|
: next-event ( -- event ? ) <event> dup SDL_PollEvent ;
|
||||||
|
|
||||||
|
GENERIC: handle-event ( event -- )
|
||||||
|
|
||||||
: world-loop ( -- )
|
: world-loop ( -- )
|
||||||
#! Keep polling for events until there are no more events in
|
#! Keep polling for events until there are no more events in
|
||||||
#! the queue; then block for the next event.
|
#! the queue; then block for the next event.
|
||||||
|
@ -124,11 +123,3 @@ M: motion-event handle-event ( event -- )
|
||||||
|
|
||||||
: run-world ( -- )
|
: run-world ( -- )
|
||||||
[ start-world world-loop ] [ stop-world ] cleanup ;
|
[ 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 ;
|
|
||||||
|
|
|
@ -160,8 +160,6 @@ void dump_generations(void)
|
||||||
|
|
||||||
void factorbug(void)
|
void factorbug(void)
|
||||||
{
|
{
|
||||||
interrupt = false;
|
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
fcntl(0,F_SETFL,0);
|
fcntl(0,F_SETFL,0);
|
||||||
fcntl(1,F_SETFL,0);
|
fcntl(1,F_SETFL,0);
|
||||||
|
|
|
@ -14,8 +14,6 @@ void run(void)
|
||||||
|
|
||||||
if(throwing)
|
if(throwing)
|
||||||
{
|
{
|
||||||
interrupt = false;
|
|
||||||
|
|
||||||
if(thrown_keep_stacks)
|
if(thrown_keep_stacks)
|
||||||
{
|
{
|
||||||
ds = thrown_ds;
|
ds = thrown_ds;
|
||||||
|
@ -40,11 +38,6 @@ void run(void)
|
||||||
{
|
{
|
||||||
if(callframe == F)
|
if(callframe == F)
|
||||||
{
|
{
|
||||||
if(interrupt)
|
|
||||||
{
|
|
||||||
factorbug();
|
|
||||||
}
|
|
||||||
|
|
||||||
callframe = cpop();
|
callframe = cpop();
|
||||||
executing = cpop();
|
executing = cpop();
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -20,9 +20,6 @@
|
||||||
/* TAGGED user environment data; see getenv/setenv prims */
|
/* TAGGED user environment data; see getenv/setenv prims */
|
||||||
DLLEXPORT CELL userenv[USER_ENV];
|
DLLEXPORT CELL userenv[USER_ENV];
|
||||||
|
|
||||||
/* boolean: if true, next interruption check raises exception to user code */
|
|
||||||
DLLEXPORT bool interrupt;
|
|
||||||
|
|
||||||
/* Error handlers restore this */
|
/* Error handlers restore this */
|
||||||
JMP_BUF toplevel;
|
JMP_BUF toplevel;
|
||||||
|
|
||||||
|
|
|
@ -12,31 +12,23 @@ void signal_handler(int signal, siginfo_t* siginfo, void* uap)
|
||||||
signal_error(signal);
|
signal_error(signal);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dump_stack_signal(int signal, siginfo_t* siginfo, void* uap)
|
|
||||||
{
|
|
||||||
interrupt = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void init_signals(void)
|
void init_signals(void)
|
||||||
{
|
{
|
||||||
struct sigaction custom_sigaction;
|
struct sigaction custom_sigaction;
|
||||||
struct sigaction ign_sigaction;
|
struct sigaction ign_sigaction;
|
||||||
struct sigaction dump_sigaction;
|
|
||||||
sigemptyset(&custom_sigaction.sa_mask);
|
sigemptyset(&custom_sigaction.sa_mask);
|
||||||
custom_sigaction.sa_sigaction = signal_handler;
|
custom_sigaction.sa_sigaction = signal_handler;
|
||||||
custom_sigaction.sa_flags = SA_SIGINFO;
|
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(SIGABRT,&custom_sigaction,NULL);
|
||||||
sigaction(SIGFPE,&custom_sigaction,NULL);
|
sigaction(SIGFPE,&custom_sigaction,NULL);
|
||||||
sigaction(SIGBUS,&custom_sigaction,NULL);
|
sigaction(SIGBUS,&custom_sigaction,NULL);
|
||||||
sigaction(SIGQUIT,&custom_sigaction,NULL);
|
sigaction(SIGQUIT,&custom_sigaction,NULL);
|
||||||
sigaction(SIGINT,&dump_sigaction,NULL);
|
|
||||||
sigaction(SIGPIPE,&ign_sigaction,NULL);
|
|
||||||
sigaction(SIGSEGV,&custom_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__
|
#ifdef __APPLE__
|
||||||
mach_initialize();
|
mach_initialize();
|
||||||
|
|
Loading…
Reference in New Issue