ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Thierry Horsin via ntg-context <ntg-context@ntg.nl>
To: Hans Hagen <j.hagen@xs4all.nl>
Cc: Thierry Horsin <horsin@free.fr>,
	mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: getting line numbers
Date: Fri, 3 Sep 2021 14:20:29 +0200	[thread overview]
Message-ID: <20210903122029.fgi352a2lphs4ll3@thierry-Latitude-5300> (raw)
In-Reply-To: <807e4b7c-97ae-e20e-3207-28393544c5e5@xs4all.nl>

Many thanks Hans.
Thierry

Le Friday 03 Sep 2021 à 14:16:40 (+0200), Hans Hagen a écrit :


> in this case, thinking a bit different is easier ...
> 
> \starttext
> 
> \startbuffer[MyBuffer]
> #include <iostream>
> 
> using namespace std;
> int mysum(int,int);
> int a; int b;
> int main () {
>     a=2; b=9;
>     cout << mysum(a,b) << endl;
>     return 0;
> }
> int mysum(int a, int b) {
>     return a+b;
> }
> \stopbuffer
> 
> We compile and run:
> 
> \typebuffer[MyBuffer][option=C]
> 
> \startluacode
> io.savedata("test.cpp",buffers.getcontent("MyBuffer"))
> --os.execute("g++ -o test test.cpp")
> --os.execute("./test > test.tmp")
> os.execute("echo done > test.tmp")
> buffers.assign("MyBuffer",io.loaddata("test.tmp"))
> \stopluacode
> 
> And get:
> 
> \typebuffer[MyBuffer]
> 
> Or just:
> 
> \typefile{test.tmp}
> 
> \stoptext
> 
> 
> -----------------------------------------------------------------
>                                           Hans Hagen | PRAGMA ADE
>               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________

  reply	other threads:[~2021-09-03 12:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-03 10:58 Thierry Horsin via ntg-context
2021-09-03 12:16 ` Hans Hagen via ntg-context
2021-09-03 12:20   ` Thierry Horsin via ntg-context [this message]
2021-09-03 13:53 ` Aditya Mahajan via ntg-context
2021-09-03 16:26   ` Hans Hagen via ntg-context
2021-09-05 10:26     ` Fabrice Couvreur via ntg-context
     [not found] <mailman.418.1630685069.1197.ntg-context@ntg.nl>
2021-09-04  7:01 ` thierry horsin via ntg-context
2021-09-04  8:35   ` Hans Hagen via ntg-context
2021-09-04 10:18     ` Thierry Horsin via ntg-context

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=20210903122029.fgi352a2lphs4ll3@thierry-Latitude-5300 \
    --to=ntg-context@ntg.nl \
    --cc=horsin@free.fr \
    --cc=j.hagen@xs4all.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).