ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Mikael P. Sundqvist" <mickep@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: graphics
Date: Wed, 12 Dec 2018 21:13:36 +0100	[thread overview]
Message-ID: <CAHy-LL-iuQPs9Tz_2=BJPXQv4oS-GPCDPFWtY+dWiU=VUu2tGA@mail.gmail.com> (raw)
In-Reply-To: <31d8842b-1260-e254-eeed-be84aef0aa9d@gmail.com>

On Wed, Dec 12, 2018 at 9:02 PM Henri Menke <henrimenke@gmail.com> wrote:
>
> On 13/12/18 8:56 AM, Alan Braslau wrote:
> > On Wed, 12 Dec 2018 20:42:56 +0100
> > "Mikael P. Sundqvist" <mickep@gmail.com> wrote:
> >>
> >> Thanks, Alan! That looks very promising. I could not make it work,
> >> though, and I guess that is because I use linux and do not know what
> >> to change for what. I installed libcerf but I assume something else is
> >> missing. In any case, this is one of the things it would be nice to
> >> have, at least as a module. I have no idea on how to realize that,
> >> though.
> >>
> >> /Mikael
> >
> > You likely also need to install libffi - I do not know what package
> > this is on your flavor of linux - Luigi is the ffi specialist!
>
> FFI is integrated in LuaTeX >= 1.03
>
> In you example you load libcerf but you are not using it.  What you are
> actually using are the Bessel function from the C Standard library.  GCC
> includes them as a GNU extension.
> https://www.gnu.org/software/libc/manual/html_node/Special-Functions.html#index-j0
> Your example also works if you remove libcerf (at least for me on Linux).
>

Thanks Henri! Indeed it worked now. The following example (just in
case someone else did not get what to change) compiles here, and shows
the expected graph. This is very good news!

\startluacode

ffi = require("ffi")
ffi.cdef[[
double j0(double x);
double j1(double x);
double jn(double x);
]]

\stopluacode

\startMPdefinitions{doublefun}
  vardef jzero primary x = scantokens(lua("mp.quoted( ffi.C.j0(" &
decimal x & "))")) enddef ;
  vardef jone  primary x = scantokens(lua("mp.quoted( ffi.C.j1(" &
decimal x & "))")) enddef ;
  vardef jn    primary x = scantokens(lua("mp.quoted( ffi.C.jn(" &
decimal x & "))")) enddef ;
\stopMPdefinitions


\starttext
\startMPpage[instance=doublefun]
draw function(1,"x","jone(x)",epsed(0),epsed(10),1/10) scaled 1cm;
\stopMPpage
\stoptext

/Mikael
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  parent reply	other threads:[~2018-12-12 20:13 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-04 17:03 graphics Hans Hagen
2018-12-04 18:54 ` graphics Alan Braslau
2018-12-05  9:02   ` graphics Taco Hoekwater
2018-12-05 12:59     ` graphics Hans Hagen
2018-12-05 15:24       ` graphics Alan Braslau
2018-12-06  7:31   ` graphics Procházka Lukáš Ing.
2018-12-05  9:14 ` graphics Henri Menke
2018-12-05  9:22   ` graphics luigi scarso
2018-12-05 12:37   ` graphics Hans Hagen
2018-12-05 12:55     ` graphics luigi scarso
2018-12-07  8:06 ` graphics Mikael P. Sundqvist
2018-12-07 12:20   ` graphics luigi scarso
2018-12-07 15:15   ` graphics Alan Braslau
2018-12-08  8:31     ` graphics Mikael P. Sundqvist
2018-12-08 15:15       ` graphics Alan Braslau
2018-12-12 19:42         ` graphics Mikael P. Sundqvist
2018-12-12 19:56           ` graphics Alan Braslau
2018-12-12 20:02             ` graphics Henri Menke
2018-12-12 20:12               ` graphics Alan Braslau
2018-12-12 21:03                 ` graphics Henri Menke
2018-12-12 21:39                   ` graphics Alan Braslau
2018-12-12 23:56                     ` graphics Henri Menke
2018-12-12 20:13               ` Mikael P. Sundqvist [this message]
2018-12-13 13:32                 ` graphics Otared Kavian
2018-12-13 15:44                   ` graphics Alan Braslau
2018-12-13 16:07                     ` graphics luigi scarso
2018-12-13 20:33                       ` graphics Henri Menke
2018-12-12 13:51 ` graphics Mathias Schickel
2018-12-12 18:36   ` graphics Alan Braslau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHy-LL-iuQPs9Tz_2=BJPXQv4oS-GPCDPFWtY+dWiU=VUu2tGA@mail.gmail.com' \
    --to=mickep@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).