emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jakob Lombacher <Jakob@lombacher.net>
To: emacs-orgmode@gnu.org
Subject: Bugfix ob-C.el mixed input variable
Date: Thu, 27 Mar 2014 19:47:53 +0100	[thread overview]
Message-ID: <CALAc-Bt1vgz6R0fiKpX2E3HJnkc-wrTbHvwiJM9Z8T-seBJ_xg@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 464 bytes --]

 When using org-babel with mixed (double, int) input like below, the c file
was not written correctly. The numbers where left out and only the commas
where written.

I guess it was a typo. Attached is the patch.

Jakob

---

#+RESULTS[8894f01ba8e219bd6cafb49748f4d5cad8bb6fd1]: test-parameter
    | 1 | 2.3 |
    | 3 | 4.2 |



   #+begin_src cpp :var x=test-parameter :includes '("<iostream>")
     using namespace std;
     cout << "hallo" << endl;
   #+end_src

[-- Attachment #1.2: Type: text/html, Size: 783 bytes --]

[-- Attachment #2: 0001-Bugfix-there-was-one-entry-too-much.patch --]
[-- Type: text/x-patch, Size: 978 bytes --]

From baea909dd3e6d7e4c8eaa2c506a3c6f31c472f11 Mon Sep 17 00:00:00 2001
From: Jakob Lombacher <Jakob@Lombacher.net>
Date: Thu, 27 Mar 2014 19:27:03 +0100
Subject: [PATCH] Bugfix, there was one entry too much.

It failed when mixed (int double) table is used as input variable e.g
| 1 | 1.2 |
---
 lisp/ob-C.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/ob-C.el b/lisp/ob-C.el
index 4c2d1ba..bbd0525 100644
--- a/lisp/ob-C.el
+++ b/lisp/ob-C.el
@@ -264,7 +264,7 @@ FORMAT can be either a format string or a function which is called with VAL."
 	   (when (and type (not (string= type-name tmp-type-name)))
 	     (if (and (member type-name '("int" "double" "int32_t"))
 		      (member tmp-type-name '("int" "double" "int32_t")))
-		 (setq tmp-type '("double" "" "%f"))
+		 (setq tmp-type '("double" "%f"))
 	       (error "Only homogeneous lists are supported by C.  You can not mix %s and %s"
 		      type-name
 		      tmp-type-name)))
-- 
1.9.1


             reply	other threads:[~2014-03-27 18:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-27 18:47 Jakob Lombacher [this message]
2014-03-27 21:54 ` Bugfix ob-C.el mixed input variable Eric Schulte

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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to=CALAc-Bt1vgz6R0fiKpX2E3HJnkc-wrTbHvwiJM9Z8T-seBJ_xg@mail.gmail.com \
    --to=jakob@lombacher.net \
    --cc=emacs-orgmode@gnu.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).