From mboxrd@z Thu Jan 1 00:00:00 1970 From: Roger Mason Subject: Re: C code block: no return values Date: Tue, 16 Apr 2013 16:27:10 -0230 Message-ID: <516D9F06.2030904@mun.ca> References: <516D73FD.8000206@mun.ca> <878v4ico1k.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:38012) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1USB4A-0001QW-4L for emacs-orgmode@gnu.org; Tue, 16 Apr 2013 14:57:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1USB45-0005Wa-Cy for emacs-orgmode@gnu.org; Tue, 16 Apr 2013 14:57:18 -0400 Received: from nina.ucs.mun.ca ([134.153.232.76]:48018) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1USB45-0005WN-6w for emacs-orgmode@gnu.org; Tue, 16 Apr 2013 14:57:13 -0400 In-Reply-To: <878v4ico1k.fsf@gmail.com> 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eric Schulte Cc: emacs-orgmode@gnu.org Hello Eric, On 04/16/2013 04:15 PM, Eric Schulte wrote: > Roger Mason writes: > >> Hello, >> >> I'm working through examples in "A Multi-Language Computing Environment for >> Literate Programming and Reproducible Research" by Shulte et al. J. >> Stat. Software, 46/3, 2012. >> >> This example compiles but results are not returned to the Org-mode buffer: >> >> Hi Roger, >> >> Since the publication of that paper, the code block execution engine has >> begun checking the return value of the invoked program to ensure it >> exits with success before parsing the output. The C program in this >> example actually returns the value of the final printf, which is >> non-zero and looks like a return. >> >> To get this example working with the latest version of Org-mode, one >> needs to added a "return 0;" to the end of the last code block, yielding >> the following. >> >> #+name: main >> #+begin_src C >> int main(int argc, char *argv[]) { >> int lst[argc-1]; >> int i; >> for(i=1;i> lst[i-1] = atoi(argv[i]); >> sort(lst, argc-1); >> for(i=1;i> printf("%d ", lst[i-1]); >> printf("\n"); >> return 0; >> } >> #+end_src >> >> With this change the example works as expected on my system. >> >> Org-mode should do a better job of alerting the user to the reason why >> it is not returning a result. >> >> Cheers, >> Thank you. It works here too. Best wishes, Roger This electronic communication is governed by the terms and conditions at http://www.mun.ca/cc/policies/electronic_communications_disclaimer_2012.php