From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jarmo Hurri Subject: Babel: filtering code to produce another block Date: Wed, 13 Sep 2017 11:34:17 +0300 Message-ID: <87fubr80ae.fsf@iki.fi> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43198) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ds382-0003Fp-2c for emacs-orgmode@gnu.org; Wed, 13 Sep 2017 04:34:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ds37y-00051W-1w for emacs-orgmode@gnu.org; Wed, 13 Sep 2017 04:34:38 -0400 Received: from [195.159.176.226] (port=56418 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ds37x-00050n-R2 for emacs-orgmode@gnu.org; Wed, 13 Sep 2017 04:34:33 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1ds37j-0006JI-LX for emacs-orgmode@gnu.org; Wed, 13 Sep 2017 10:34:19 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org Greetings. This question can again be described shortly and in more detail. 1. Short form: what would be a convenient way to filter the source code in a Babel source code block so that the output would be the source code in another block? 2. Then the long form. I need to emulate the very basics of one programming language, namely Processing https://processing.org/ with another, namely Asymptote http://asymptote.sourceforge.net/ This is to be done within Org. I need to do this to illustrate on paper the visual output of simple, static (no animation) Processing programs. Making this work roughly isn't too difficult, because these two languages have very similar syntaxes. For example, provided that a function rect() has been implemented in Asymptote, the following code is legit in both Processing and Asymptote: #+name: pic #+BEGIN_SRC asymptote size (800, 600); for (int i = 0; i < 10; i += 2) rect (i * 10, i * 20, 30, 10); #+END_SRC After this block has been defined I can show it as "Processing code" and draw a picture with Asymptote, using noweb if need be. It is also easy to use transforms so that the coordinate systems of the two languages match. Furthermore, typedef can be used to align some variable type differences. However, my current issue is dealing with 'final' in Asymptote. The following is not legit Asymptote code: #+BEGIN_SRC asymptote size (800, 600); final int S = 20; rect (100, 100, S, S); #+END_SRC It would be legit if the word 'final' were simply removed. Which brings me to the question: what would be an easy way to filter this block to produce another block? The header arguments of the two blocks would be different from each other. Thanks in advance, Jarmo