Mortar defined and used parsing words. Refactor this.

db4
Eduardo Cavazos 2008-01-14 05:19:00 -06:00
parent 969901a73d
commit 15e9575cb6
13 changed files with 30 additions and 16 deletions

View File

@ -1,6 +1,6 @@
! -*-factor-*- ! -*-factor-*-
USING: kernel unix vars mortar slot-accessors USING: kernel unix vars mortar mortar.sugar slot-accessors
x.widgets.wm.menu x.widgets.wm.unmapped-frames-menu x.widgets.wm.menu x.widgets.wm.unmapped-frames-menu
factory.commands factory.load ; factory.commands factory.load ;

View File

@ -1,6 +1,6 @@
USING: kernel parser io io.files namespaces sequences editors threads vars USING: kernel parser io io.files namespaces sequences editors threads vars
mortar slot-accessors mortar mortar.sugar slot-accessors
x x
x.widgets.wm.root x.widgets.wm.root
x.widgets.wm.frame x.widgets.wm.frame

View File

@ -128,7 +128,7 @@ over object-class class-methods 1 head* assoc-stack call ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: new* ( class -- object ) <<- create ; ! : new* ( class -- object ) <<- create ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@ -136,13 +136,20 @@ IN: slot-accessors
IN: mortar IN: mortar
! : generate-slot-getter ( name -- )
! "$" over append "slot-accessors" create swap [ slot-value ] curry
! define-compound ;
: generate-slot-getter ( name -- ) : generate-slot-getter ( name -- )
"$" over append "slot-accessors" create swap [ slot-value ] curry "$" over append "slot-accessors" create swap [ slot-value ] curry define ;
define-compound ;
! : generate-slot-setter ( name -- )
! ">>" over append "slot-accessors" create swap [ swap set-slot-value ] curry
! define-compound ;
: generate-slot-setter ( name -- ) : generate-slot-setter ( name -- )
">>" over append "slot-accessors" create swap [ swap set-slot-value ] curry ">>" over append "slot-accessors" create swap [ swap set-slot-value ] curry
define-compound ; define ;
: generate-slot-accessors ( name -- ) : generate-slot-accessors ( name -- )
dup dup

View File

@ -0,0 +1,6 @@
USING: mortar ;
IN: mortar.sugar
: new* ( class -- object ) <<- create ;

View File

@ -1,5 +1,6 @@
USING: kernel namespaces arrays x11.xlib mortar slot-accessors x x.font ; USING: kernel namespaces arrays x11.xlib mortar mortar.sugar
slot-accessors x x.font ;
IN: x.gc IN: x.gc

View File

@ -1,5 +1,5 @@
USING: kernel arrays math.vectors mortar x.gc slot-accessors geom.pos ; USING: kernel arrays math.vectors mortar mortar.sugar x.gc slot-accessors geom.pos ;
IN: x.pen IN: x.pen

View File

@ -1,6 +1,6 @@
USING: kernel combinators math x11.xlib USING: kernel combinators math x11.xlib
mortar slot-accessors x.gc x.widgets.label ; mortar mortar.sugar slot-accessors x.gc x.widgets.label ;
IN: x.widgets.button IN: x.widgets.button
@ -11,7 +11,7 @@ SYMBOL: <button>
{ "action-1" "action-2" "action-3" } accessors { "action-1" "action-2" "action-3" } accessors
define-simple-class define-simple-class
<button> "create" ( <button> -- button ) [ <button> "create" !( <button> -- button ) [
new-empty new-empty
<gc> new* >>gc ExposureMask ButtonPressMask bitor >>mask <- init-widget <gc> new* >>gc ExposureMask ButtonPressMask bitor >>mask <- init-widget
] add-class-method ] add-class-method

View File

@ -1,6 +1,6 @@
USING: kernel strings arrays sequences sequences.lib math x11.xlib USING: kernel strings arrays sequences sequences.lib math x11.xlib
mortar slot-accessors x x.pen x.widgets ; mortar mortar.sugar slot-accessors x x.pen x.widgets ;
IN: x.widgets.keymenu IN: x.widgets.keymenu

View File

@ -1,5 +1,5 @@
USING: kernel x11.xlib mortar slot-accessors x.gc x.widgets ; USING: kernel x11.xlib mortar mortar.sugar slot-accessors x.gc x.widgets ;
IN: x.widgets.label IN: x.widgets.label

View File

@ -1,6 +1,6 @@
USING: kernel combinators namespaces math.vectors x11.xlib x11.constants USING: kernel combinators namespaces math.vectors x11.xlib x11.constants
mortar slot-accessors x x.gc x.widgets.wm.frame.drag ; mortar mortar.sugar slot-accessors x x.gc x.widgets.wm.frame.drag ;
IN: x.widgets.wm.frame.drag.move IN: x.widgets.wm.frame.drag.move

View File

@ -1,6 +1,6 @@
USING: kernel combinators namespaces math.vectors x11.xlib x11.constants USING: kernel combinators namespaces math.vectors x11.xlib x11.constants
mortar slot-accessors geom.rect x x.gc x.widgets.wm.frame.drag ; mortar mortar.sugar slot-accessors geom.rect x x.gc x.widgets.wm.frame.drag ;
IN: x.widgets.wm.frame.drag.size IN: x.widgets.wm.frame.drag.size

View File

@ -2,7 +2,7 @@
USING: kernel io combinators namespaces quotations arrays sequences USING: kernel io combinators namespaces quotations arrays sequences
math math.vectors math math.vectors
x11.xlib x11.constants x11.xlib x11.constants
mortar slot-accessors mortar mortar.sugar slot-accessors
geom.rect geom.rect
x x.gc x.widgets x x.gc x.widgets
x.widgets.button x.widgets.button

View File

@ -1,5 +1,5 @@
USING: kernel x11.constants mortar slot-accessors x.widgets.keymenu ; USING: kernel x11.constants mortar mortar.sugar slot-accessors x.widgets.keymenu ;
IN: x.widgets.wm.menu IN: x.widgets.wm.menu