poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Co-developing C and Poke: a practical session tonight


From: Jose E. Marchesi
Subject: Co-developing C and Poke: a practical session tonight
Date: Sat, 03 Apr 2021 21:04:40 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Hi people!

Tonight I will be adding support for a new kind of terminal hyperlink to
poke.  Right now, we support two kinds:

- 'e' (execute) commands execute a given string as a poke command, and
  shows the result on the terminal:

    Click here
          ----
    (poke)

  Where `here' is an hyperlink with an associated command "2 + 2".  When
  you click `here', you see this:

    Click here
          ----
    (poke) 2 + 2
    4
    (poke)

- 'i' (insert) commands insert a given string in the poke prompt, at the
  pointers location:

    Click here
          ----
    (poke) 1 + _

  Where `here' is an hyperlink with an associated command "2 + 2", and _
  is the current pointer.  When you click `here', you see this:

    Click here
          ----
    (poke) 1 + 2 + 2_

The goal for tonight is to add a new kind of command 'c' (closure) that
will execute a given Poke function (of type ()void) associated with the
hyperlink, i.e. it is similar to 'e', but instead of a string to be
evaluated and executed by the poke compiler, it is an already compiled
Poke function.

An application of this kind of hyperlinks is for example allowing the
user to use a "modeline" in poke with her own buttons executing her own
defined functions:

[exit | info ios | whatever action]
 ----   --------   ---------------
(poke)

And there are many more exciting use cases :)

Now, it happens that the implementation of the hyperserver in poke is
splitted between C and Poke.  Some parts (like the select loop) are
written in C, other parts (like the table of hyperlinks and the code
that constructs the hyperlinks themselves and prints them) are written
in Poke.

We will be using this C-Poke co-strategy more and more in the future, as
more parts of the application gets written in Poke, so I thought this
'c' hyperlinks business could be a good excuse to show how this is done.

Therefore I will be hacking this live in http://meet.jit.si/poke
starting at 21:45 CEST (in 45 minutes).

If you are bored or have insomnia, feel welcome to join :D



reply via email to

[Prev in Thread] Current Thread [Next in Thread]