# HG changeset patch # User telesto # Date 1681153388 -7200 # Mon Apr 10 21:03:08 2023 +0200 # Node ID 27f6fd67a444fbd6c838d354a776d4b46bcbe1b6 # Parent e1745529d3ce032f877b19ebd7bfc26623d7059a small improvements here and there diff --git a/buf.fox b/buf.fox --- a/buf.fox +++ b/buf.fox @@ -1,4 +1,4 @@ - ( saves the current buffer, to which all buf actions apply ) + \ saves the current buffer, to which all buf actions apply 0 var bufstore @@ -16,20 +16,20 @@ 32 ,, ) - ( keep in sync with bootstrab.asm/sysbuf ) - ( usage: cap buf name ) + \ keep in sync with bootstrab.asm/sysbuf + \ usage: cap buf name ( cap -- ) : buf fcreate valign - ( create word to execute when the buffer is used. - it save the buf to the buf store. ) + \ create word to execute when the buffer is used + \ it saves the buf to the buf store. vhere ^ vpush bufstore ^ vpush ^ ! ^ ;; - ( build buffer in memory ) + \ build buffer in memory ( cap ) - 0 v, ( buf-curr ) + 0 v, \ buf-curr ( cap ) - dup v, ( capacity ) - fdp @ nfa v, ( link to buf name ) - ( and allocate buffer ) + dup v, \ capacity + fdp @ nfa v, \ link to buf name + \ ... and allocate buffer valloc ; @@ -44,7 +44,7 @@ : buf-reset () 0 buf_ ! ; : buf-end? ( addr -- zf ) buf-curr - drop ; - ( print name of buffer ) + \ print name of buffer : .buf () buf-name ". ; : buf-free ( -- free ) buf-cap buf-len - ; @@ -52,11 +52,12 @@ ( bytes -- ) : ,,panic-msg .buf ." : not enough space for " . space ." bytes" \n ; - ( panic if there is not enough space for appending n bytes ) + \ panic if there is not enough space for appending n bytes ( n -- ) : ,,panic dup buf-free - neg drop -if ,,panic-msg bye ;; then drop ; : ,,1 ( byte -- ) 1 dup ,,panic swap buf-curr !1 buf-adv ; : ,,2 ( int16 -- ) 2 dup ,,panic swap buf-curr !2 buf-adv ; -: ,,4 ( int32 -- ) 4 dup ,,panic swap buf-curr ! buf-adv ; +: ,,4 ( int32 -- ) 4 dup ,,panic swap buf-curr !4 buf-adv ; +: ,,8 ( int32 -- ) 8 dup ,,panic swap buf-curr ! buf-adv ; diff --git a/swapwm.fox b/swapwm.fox --- a/swapwm.fox +++ b/swapwm.fox @@ -259,8 +259,7 @@ 8 ,,2 \ length of name 0 ,,2 \ unused \ "XINERAMA", 8 bytes - 58 ,,1 49 ,,1 4e ,,1 45 ,,1 52 ,,1 41 dup ,,1 4d ,,1 ,,1 - x11write ; + 414d4152454e4958 ,,8 x11write ; : ext.opcode # 9 field.b @@ -411,7 +410,7 @@ ( win value-mask #values -- req-len(bytes) ) : cfg-win c init-req dodbg 0 ,,1 \ unused - 3 + dup rpush ,,2 \ request lenght + 3 + dup rpush ,,2 \ request length swap ,,4 \ window ,,4 \ value-mask rpop units ; @@ -723,7 +722,7 @@ : keypress () dodbg key-warp @ ev-key? 0if kpev.ev warp-win ;; then - key-max @ ev-key? 0if kpev.ev dup win-scr# max-win ;; then + key-max @ ev-key? 0if kpev.ev dup win-scr# max-win ;; then key-pull @ ev-key? 0if pull-up ;; then ." keypress: got key " kpev.key . ." , you are not supposed to be here." \n ;