• gforth - how to soytware trigger capslock

    From goblinrieur@gmail.com@21:1/5 to All on Thu Sep 7 03:00:07 2023
    hello

    currently I use an externol tool to do this in gforth over gnulinux station.

    : caps ( -- ) s" xdotool key Caps_Lock" system ;
    \ triggers capslock just like pressing the key

    I'm looking for a forth solution to make it more forth & less xdotool dependant & even external applicatin independant.

    so I am looking for a solution to simulate by a word the capslock keypress.

    I ve been guided to https://www.complang.tuwien.ac.at/forth/gforth/Docs-html/386-Assembler.html#g_t386-Assembler and https://gforth.org/manual/AMD64-Assembler.html abi-code solution

    then I tried

    ONLY FORTH ALSO ASSEMBLER
    code toto
    $3A # al mov
    $02 # ah mov
    $80 # int
    ret
    end-code

    that migth be also a solution but I failed as this creates a memory error on execution

    I failed to find more documentation or examples to fix it

    any pure forth idea ?
    any abi-code idea or fix ?
    any documentation about the specific abi-code inside gforth ?

    thanks

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Zbig@21:1/5 to All on Thu Sep 7 03:28:33 2023
    currently I use an externol tool to do this in gforth over gnulinux station.

    : caps ( -- ) s" xdotool key Caps_Lock" system ;
    \ triggers capslock just like pressing the key
    [..]
    ONLY FORTH ALSO ASSEMBLER
    code toto
    $3A # al mov
    $02 # ah mov
    $80 # int
    ret
    end-code

    that migth be also a solution but I failed as this creates a memory error on execution

    I failed to find more documentation or examples to fix it

    Maybe examination — using gdb — what sequence of assembly commands
    'xdotool key Caps_Lock' is sending, could give you the solution?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From minforth@21:1/5 to gobli...@gmail.com on Thu Sep 7 03:19:37 2023
    gobli...@gmail.com schrieb am Donnerstag, 7. September 2023 um 12:00:10 UTC+2:
    hello

    currently I use an externol tool to do this in gforth over gnulinux station.

    : caps ( -- ) s" xdotool key Caps_Lock" system ;
    \ triggers capslock just like pressing the key

    I'm looking for a forth solution to make it more forth & less xdotool dependant & even external applicatin independant.

    so I am looking for a solution to simulate by a word the capslock keypress.

    Querying device status like num-lock or caps-lock is not part of the Forth world
    but depends on your terminal and your OS.

    IOW there is no generic fit-for-all solution.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From goblinrieur@gmail.com@21:1/5 to All on Thu Sep 7 03:43:26 2023
    Le jeudi 7 septembre 2023 à 12:19:40 UTC+2, minforth a écrit :
    gobli...@gmail.com schrieb am Donnerstag, 7. September 2023 um 12:00:10 UTC+2:
    hello

    currently I use an externol tool to do this in gforth over gnulinux station.

    : caps ( -- ) s" xdotool key Caps_Lock" system ;
    \ triggers capslock just like pressing the key

    I'm looking for a forth solution to make it more forth & less xdotool dependant & even external applicatin independant.

    so I am looking for a solution to simulate by a word the capslock keypress.
    Querying device status like num-lock or caps-lock is not part of the Forth world
    but depends on your terminal and your OS.

    Of course so that is why I used a specfic external command


    IOW there is no generic fit-for-all solution.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From goblinrieur@gmail.com@21:1/5 to All on Thu Sep 7 10:39:50 2023
    Le jeudi 7 septembre 2023 à 12:28:36 UTC+2, Zbig a écrit :
    currently I use an externol tool to do this in gforth over gnulinux station.

    : caps ( -- ) s" xdotool key Caps_Lock" system ;
    \ triggers capslock just like pressing the key
    [..]
    ONLY FORTH ALSO ASSEMBLER
    code toto
    $3A # al mov
    $02 # ah mov
    $80 # int
    ret
    end-code

    that migth be also a solution but I failed as this creates a memory error on execution

    I failed to find more documentation or examples to fix it
    Maybe examination — using gdb — what sequence of assembly commands 'xdotool key Caps_Lock' is sending, could give you the solution?

    it is a good idea in concept but it cannot wark gbd run can dipay asm code only from the .o object file :)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Zbig@21:1/5 to All on Thu Sep 7 11:20:03 2023
    it is a good idea in concept but it cannot wark gbd run can dipay asm code only from the .o object file :)

    We're talking about Open Source Software;
    you can create the object file easily. :)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Hugh Aguilar@21:1/5 to All on Fri Sep 8 20:07:03 2023
    I notice that the OP wrote "soytware" rather than "software."
    On the Dvorak keyboard, the Y and F are adjacent, but not on the Qwerty,
    so I assume that a Dvorak keyboard was being used.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From goblinrieur@gmail.com@21:1/5 to All on Sat Sep 9 09:33:49 2023
    Le samedi 9 septembre 2023 à 05:07:06 UTC+2, Hugh Aguilar a écrit :
    I notice that the OP wrote "soytware" rather than "software."
    On the Dvorak keyboard, the Y and F are adjacent, but not on the Qwerty,
    so I assume that a Dvorak keyboard was being used.

    exact :)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From goblinrieur@gmail.com@21:1/5 to All on Sat Sep 9 09:39:00 2023
    Le jeudi 7 septembre 2023 à 12:00:10 UTC+2, gobli...@gmail.com a écrit :
    hello

    currently I use an externol tool to do this in gforth over gnulinux station.

    : caps ( -- ) s" xdotool key Caps_Lock" system ;
    \ triggers capslock just like pressing the key

    I'm looking for a forth solution to make it more forth & less xdotool dependant & even external applicatin independant.

    so I am looking for a solution to simulate by a word the capslock keypress.

    I ve been guided to https://www.complang.tuwien.ac.at/forth/gforth/Docs-html/386-Assembler.html#g_t386-Assembler and https://gforth.org/manual/AMD64-Assembler.html abi-code solution

    then I tried

    ONLY FORTH ALSO ASSEMBLER
    code toto
    $3A # al mov
    $02 # ah mov
    $80 # int
    ret
    end-code

    that migth be also a solution but I failed as this creates a memory error on execution

    I failed to find more documentation or examples to fix it

    any pure forth idea ?
    any abi-code idea or fix ?
    any documentation about the specific abi-code inside gforth ?

    thanks



    I 've been stupid stupid
    of course toupper was not working
    'toupper' ( c1 -- c2 ) gforth-0.2 "toupper"
    'accept' ( c-addr +n1 -- +n2 ) core "accept"

    that is the point
    so I just have to make toupper from another intermediary word addr len compatible

    + 110 \ need a specific input to get capitalized
    + 111 : $INPUT ( -- addr len) PAD DUP 16 ACCEPT ;
    + 112 \ convert a string in place. (not always good)
    + 113 : >UPPER ( addr len -- addr len)
    + 114 2DUP \ dup the string
    + 115 BOUNDS \ convert last-addr 1st-addr
    + 116 DO \ do loop counts from 1st to last char
    + 117 I C@ \ read the char from address 'I'
    + 118 TOUPPER \ convert character to upper case
    + 119 I C! \ store char back into the address
    + 120 LOOP ;
    121 : isnum?
    122 ." next number ? "
    ~ 123 pad dup 16 $INPUT >UPPER \ ask for an user input now works even lower cases
    124 s>number? IF \ already an integer ?
    \ etc etc

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)