emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bugfix ob-C.el mixed input variable
@ 2014-03-27 18:47 Jakob Lombacher
  2014-03-27 21:54 ` Eric Schulte
  0 siblings, 1 reply; 2+ messages in thread
From: Jakob Lombacher @ 2014-03-27 18:47 UTC (permalink / raw)
  To: emacs-orgmode


[-- 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: Bugfix ob-C.el mixed input variable
  2014-03-27 18:47 Bugfix ob-C.el mixed input variable Jakob Lombacher
@ 2014-03-27 21:54 ` Eric Schulte
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Schulte @ 2014-03-27 21:54 UTC (permalink / raw)
  To: Jakob Lombacher; +Cc: emacs-orgmode

Applied, Thanks!

Jakob Lombacher <Jakob@lombacher.net> writes:

>  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
>
> 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)))

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-03-27 21:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-27 18:47 Bugfix ob-C.el mixed input variable Jakob Lombacher
2014-03-27 21:54 ` Eric Schulte

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).