• eFORTH windows - Extend graphics vocabulary for Windows

    From Marc Petremann@21:1/5 to All on Sat Mar 11 01:46:26 2023
    Hello,
    eFORTH allows access to Windows function libraries using the word dll. https://eforth.arduino-forth.com/article/installation_windows_extendGraphics

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marc Petremann@21:1/5 to All on Sat Mar 11 02:15:52 2023
    eFORTH Words Lexicon v 7.079 web https://eforth.arduino-forth.com/article/lexiqueEFORTHv7079web

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From minforth@arcor.de@21:1/5 to Marc Petremann on Sat Mar 11 02:27:18 2023
    Marc Petremann schrieb am Samstag, 11. März 2023 um 10:46:28 UTC+1:
    Hello,
    eFORTH allows access to Windows function libraries using the word dll. https://eforth.arduino-forth.com/article/installation_windows_extendGraphics

    Do you run your eforth within a text mode console?

    If yes, you have to open another window, right?

    If no, which graphics-enabled terminal emulator do you use?

    I'd like to see some screen shots.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marc Petremann@21:1/5 to All on Sat Mar 11 03:37:29 2023
    Have your a blog or web pages with tutorials, source code....?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marc Petremann@21:1/5 to All on Sat Mar 11 03:30:56 2023
    FORTH files edition: https://eforth.arduino-forth.com/article/installation_windows_instalWindows#toolsDir

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From none) (albert@21:1/5 to minf...@arcor.de on Sat Mar 11 12:21:18 2023
    In article <5a675ef1-2467-4bb6-8179-6b380bac80c9n@googlegroups.com>, minf...@arcor.de <minforth@arcor.de> wrote:
    Marc Petremann schrieb am Samstag, 11. März 2023 um 10:46:28 UTC+1:
    Hello,
    eFORTH allows access to Windows function libraries using the word dll.
    https://eforth.arduino-forth.com/article/installation_windows_extendGraphics

    Do you run your eforth within a text mode console?

    If yes, you have to open another window, right?

    If no, which graphics-enabled terminal emulator do you use?

    Have you stopped beating your wife?
    You command MS-Windows itself to open a window, and you
    talk about an emulator, what??


    I'd like to see some screen shots.

    Show you a source accepted by wina.
    wina is a console Forth opened in a terminal window.
    I give you my word that it opens a graphical window and sports a
    dialogue.
    I think DLL is a bad name for calls to the MS operating
    system. I use `` CALL '' or `` CALL[ ... par# .. par# .. CALL] ''
    CALL accepts parameters in the usual way.
    CALL] allows the parameters to be positioned in place
    using words PAR3, that fills in the third parameter.
    \ ------------------------------------------------
    \ A vd Horst, vrij naar FASM
    \ Beer - example of tiny (one section) Win32 program

    HEX
    20 CONSTANT MB_ICONQUESTION
    4 CONSTANT MB_YESNO
    6 CONSTANT IDYES


    WANT K32
    "USER32.DLL" LOAD-DLL: user32
    "MessageBoxA" 'user32 DLL-ADDRESS: MessageBoxA
    "WINMM.DLL" LOAD-DLL: winmm
    "mciSendStringA" 'winmm DLL-ADDRESS: mciSendStringA

    "open cdaudio" Z CONSTANT _cmd_open
    "set cdaudio door open" Z CONSTANT _cmd_eject
    "close cdaudio" Z CONSTANT _cmd_close


    "Do you need additional place to put the beer?" Z CONSTANT _message
    "Desktop configuration" Z CONSTANT _caption

    : handle-error DUP ?ERROR ;

    : MAKE-PLACE-FOR-BEER
    0 0 0 _cmd_open mciSendStringA .S CALL .S handle-error .S
    0 0 0 _cmd_eject mciSendStringA CALL .S handle-error .S
    0 0 0 _cmd_close mciSendStringA CALL .S handle-error .S
    ;

    : beer[] \ HEX
    MessageBoxA DROP \ preload
    CALL[
    MB_ICONQUESTION MB_YESNO OR PAR4
    _caption PAR3
    _message PAR2
    0 PAR1
    MessageBoxA CALL]
    .S
    IDYES = IF
    MAKE-PLACE-FOR-BEER
    THEN
    ;

    \ --------------------------------

    You can load the source on wina. Then beer[]
    opens a window and asks a question.
    The window remains open after answering the question.
    After that you can go on with Forthing, and you can close
    the graphical window, or not.

    There are subtleties involved. This program can be made
    into beer.exe, and this executable works on other
    machines where wina is not installed (but it requires
    winmm, of course).

    Note that you only need -- besides CALL itself --
    LOAD-DLL and DLL-ADDRESS .
    All the other information, the commands for the cd-player,
    the actual value for IDYES , the name of the multi-media
    DLL etc. can be found in the Microsoft documentation.

    Actually finding the documentation is two order of magnitudes
    more difficult/time consuming than writing a graphical application.

    Groetjes Albert
    --
    Don't praise the day before the evening. One swallow doesn't make spring.
    You must not say "hey" before you have crossed the bridge. Don't sell the
    hide of the bear until you shot it. Better one bird in the hand than ten in
    the air. First gain is a cat spinning. - the Wise from Antrim -

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From minforth@arcor.de@21:1/5 to none albert on Sat Mar 11 06:07:17 2023
    none albert schrieb am Samstag, 11. März 2023 um 12:21:22 UTC+1:
    In article <5a675ef1-2467-4bb6...@googlegroups.com>,
    minf...@arcor.de <minf...@arcor.de> wrote:
    Marc Petremann schrieb am Samstag, 11. März 2023 um 10:46:28 UTC+1:
    Hello,
    eFORTH allows access to Windows function libraries using the word dll.
    https://eforth.arduino-forth.com/article/installation_windows_extendGraphics

    Do you run your eforth within a text mode console?

    If yes, you have to open another window, right?

    If no, which graphics-enabled terminal emulator do you use?
    Have you stopped beating your wife?

    Dutch courtesy is often some somewhat peculiar ...
    perhaps their niveau has adapted to their living below sea level ...

    You command MS-Windows itself to open a window, and you
    talk about an emulator, what??

    Many ways lead to Rome, f.ex.
    - from the Windows command line terminal, open a separate window
    get its handle, and draw on its canvas
    - use Sixel graphics to display bitmaps within the terminal itself
    - use a terminal emulator with graphic support instead of the standard
    Windows command line terminal, or a graphics console like Jupyter
    noteboks can do
    etc

    The question remains: what is the easiest way from Forth's QUIT outer
    text interpreter to do some inline graphics for 2D plotting?
    I'd love to see f.ex. a sine curve
    within the Forth terminal like:

    -10e +10e draw-sine \ hit return
    [sine curve appears] ok

    like shown here
    https://qtconsole.readthedocs.io/en/stable/index.html

    wina is a console Forth opened in a terminal window.
    I give you my word that it opens a graphical window and sports a
    dialogue.

    Dialog boxes are for kids. Draw me a diagonal line in a command line terminal. p.s. then move/resize the terminal window.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From none) (albert@21:1/5 to minf...@arcor.de on Sat Mar 11 15:52:20 2023
    In article <b4a6d6aa-1d7f-4825-bc0e-de5d55a4b784n@googlegroups.com>, minf...@arcor.de <minforth@arcor.de> wrote:
    none albert schrieb am Samstag, 11. März 2023 um 12:21:22 UTC+1:
    In article <5a675ef1-2467-4bb6...@googlegroups.com>,
    minf...@arcor.de <minf...@arcor.de> wrote:
    Marc Petremann schrieb am Samstag, 11. März 2023 um 10:46:28 UTC+1:
    Hello,
    eFORTH allows access to Windows function libraries using the word dll.
    https://eforth.arduino-forth.com/article/installation_windows_extendGraphics

    Do you run your eforth within a text mode console?

    If yes, you have to open another window, right?

    If no, which graphics-enabled terminal emulator do you use?
    Have you stopped beating your wife?

    Dutch courtesy is often some somewhat peculiar ...
    perhaps their niveau has adapted to their living below sea level ...

    You command MS-Windows itself to open a window, and you
    talk about an emulator, what??

    I misunderstood. The question was on the premise that you don't
    open another window. Then you are forced to do graphics in the
    window the console forth runs in and the question is natural.
    Sorry.


    Many ways lead to Rome, f.ex.
    - from the Windows command line terminal, open a separate window
    get its handle, and draw on its canvas

    Probably the way to do it.

    Groetjes Albert
    --
    Don't praise the day before the evening. One swallow doesn't make spring.
    You must not say "hey" before you have crossed the bridge. Don't sell the
    hide of the bear until you shot it. Better one bird in the hand than ten in
    the air. First gain is a cat spinning. - the Wise from Antrim -

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From minforth@arcor.de@21:1/5 to none albert on Sat Mar 11 08:11:47 2023
    none albert schrieb am Samstag, 11. März 2023 um 15:52:24 UTC+1:
    In article <b4a6d6aa-1d7f-4825...@googlegroups.com>,
    minf...@arcor.de <minf...@arcor.de> wrote:
    Many ways lead to Rome, f.ex.
    - from the Windows command line terminal, open a separate window
    get its handle, and draw on its canvas
    Probably the way to do it.

    Not necessarily. There is f.i. the famous Mintty terminal emulator
    that supports fonts, images, sixel and vector graphics: https://mintty.github.io/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Marcel Hendrix@21:1/5 to minf...@arcor.de on Sat Mar 11 08:45:55 2023
    On Saturday, March 11, 2023 at 5:11:49 PM UTC+1, minf...@arcor.de wrote:
    none albert schrieb am Samstag, 11. März 2023 um 15:52:24 UTC+1:
    In article <b4a6d6aa-1d7f-4825...@googlegroups.com>,
    minf...@arcor.de <minf...@arcor.de> wrote:
    Many ways lead to Rome, f.ex.
    - from the Windows command line terminal, open a separate window
    get its handle, and draw on its canvas
    Probably the way to do it.
    Not necessarily. There is f.i. the famous Mintty terminal emulator
    that supports fonts, images, sixel and vector graphics: https://mintty.github.io/

    iForth actually uses a GUI window and emulates a terminal in it.
    This was done because it needs to intercept Windows
    messages that are generated by application windows (like
    the text editor and the graphics console). In hindsight it was
    a bad design decision because it complicated useful things like
    command line parameter parsing and (especially) redirection.

    At the time I didn't know it was possible to install a message
    pump in a terminal window (or maybe that facility didn't exist
    at the time).

    I think there was an iForth version that could do graphics in
    the main window, but I found that inconvenient after a while
    and stopped supporting it. What is more useful is to work as
    usual on the console with all graphic output appearing in a
    GUI window.

    Sometimes one wants a commandline for the graphics
    console, but it was quite an effort to make that work with
    variable-sized justified fonts, color, and cut-and-paste.

    -marcel

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From none) (albert@21:1/5 to minf...@arcor.de on Sat Mar 11 21:37:23 2023
    In article <5b2df9de-dde3-42c2-a2cf-f28f31e331b4n@googlegroups.com>, minf...@arcor.de <minforth@arcor.de> wrote:
    none albert schrieb am Samstag, 11. März 2023 um 15:52:24 UTC+1:
    In article <b4a6d6aa-1d7f-4825...@googlegroups.com>,
    minf...@arcor.de <minf...@arcor.de> wrote:
    Many ways lead to Rome, f.ex.
    - from the Windows command line terminal, open a separate window
    get its handle, and draw on its canvas
    Probably the way to do it.

    Not necessarily. There is f.i. the famous Mintty terminal emulator
    that supports fonts, images, sixel and vector graphics: >https://mintty.github.io/

    Impressive. It is a multimedia package duplicating MS Windows.

    For MS-windows I have written a one person shooter games and a pipe
    organ designer package, and was involved (doing the graphics) for a
    simulation package. These were all in C/C++.
    These highly graphical packages lean heavily on facilities
    MS-Windows provide.
    Doing dll calls from within Forth was a kind of relevation,
    but that didn't entice me doing these projects it in Forth.

    I can see that for a modest requirement (plotting a sine wave,
    allowing the windows to be resized ..) mintty could be the
    fastest solution.

    Groetjes Albert
    --
    Don't praise the day before the evening. One swallow doesn't make spring.
    You must not say "hey" before you have crossed the bridge. Don't sell the
    hide of the bear until you shot it. Better one bird in the hand than ten in
    the air. First gain is a cat spinning. - the Wise from Antrim -

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