GraphicsMagick convert utility exit statuses - graphicsmagick

I'm trying to write a partial Java (err... scala) wrapper to ImageMagick convert utility. I was wondering if the exit codes of the command are documented somewhere, or available in a single C / C++ file. I can't go over the entire code base at the moment. I've got a similar error code list for ImageMagick, was wondering if there was an equivalent in GraphicsMagick. Any pointers will be appreciated. Thank you.

The below is quoted verbatim from an email reply from the key maintainer of graphicsmagick, Bob Friesenhahn.
"It returns only the simple values 0 (EXIT_SUCCESS) or 1 (EXIT_FAILURE). Being highly portable software, it does not do anything fancy."

Related

Asking for an input and printing in a C interface for R

I'm trying to modify a CRAN package. From what I understand, they use a C interface using .Call().
So I made changes in the C code (can't do it anywhere else since it's in a loop) but I need to ask the user to input an integer.
I read the "Writing R extension" doc and found out that you need to use specific functions as Rprintf() instead of printf().
But I can't seem to find a way to replace scanf() so how can we ask for an input?
And finally is Rprintf() supposed to print in the R console because it is what I'd want but I can't find where it is printed?
Edit:
I'm unable to try it right now but it may seem that using capture_output() may work to get the Rprintf() output. Therefore the only remaining issue would be the scanf() :)
Thanks a lot!

Export output and command lines in R [duplicate]

Is there an easy way to have R record all input and output from your R session to disk while you are working with R interactively?
In R.app on Mac OS X I can do a File->Save..., but it isn't much help in recovering the commands I had entered when R crashes.
I have tried using sink(...,split=T), but it doesn't seem to do exactly what I am looking for.
Many of us use ESS / Emacs for this very reason. Saving old sessions with extension '.Rt' even gives you mode-specific commands for re-running parts of your session.
Greg Snow wrote recently on the R-help list (a very valuable resource, SO R people!):
"You may also want to look at ?TeachingDemos::txtStart as an alternative to sink, one advantage is that the commands as well as the output can be included. With a little more work you can also include graphical output into a transcript file."
r-help
Check out the savehistory() command
I'm not sure yet how to answer an answer, but there is an updated version of Ranke's vim r-plugin called r-plugin2 available here. It seems more user-friendly and robust than the original.
Emacs is good, but for those of us with a vi preference there's the vim-r plugin at:
http://www.uft.uni-bremen.de/chemie/ranke/index.php?page=vim_R_linux
It works brilliantly and has a tiny memory footprint.

How do you get code of a clisp memory image

I have got a memory image, that i can't find the source for and I want to get the code out of it again. What do i have to do to achieve that? I can obviously load the image, but then i'd need to guess the function names.
You may get "interesting" symbols with (apropos ""), and the function names with WITH-PACKAGE-ITERATOR and FBOUNDP. But the source code is (probably) lost: try DISASSEMBLE on functions and see the information which is there.
In addition to DISASSEMBLE, you might try EXT:UNCOMPILE. Note, however, that it will only work on functions compiled in an interactive session (i.e., from REPL), not on those loaded from a compiled .fas file.
So, the suggested procedure is:
LIST-ALL-PACKAGES - figure out which packages are interesting.
DO-EXTERNAL-SYMBOLS - figure out which symbols in the interesting packages are interesting.
DISASSEMBLE or EXT:UNCOMPILE on those interesting symbols.
However, the easiest way is to contact your vendor. Remember, CLISP is distributed under the GNU GPL.

Sweave syntax highlighting in output

Has anyone managed to get color syntax-highlighting working in the output of Sweave documents? I've been able to customize the output style by adding boxes, etc. in the Sweave.sty file as follows:
\DefineVerbatimEnvironment{Sinput}{Verbatim}{fontseries=bc,frame=single}
\DefineVerbatimEnvironment{Soutput}{Verbatim}{frame=leftline}
\DefineVerbatimEnvironment{Scode}{Verbatim}{fontseries=bc}
And I can get the minted package to do syntax highlighting of verbatim-code blocks in my document like so:
\begin{minted}{perl}
use Foo::Bar;
...
\end{minted}
but I'm not sure how to combine the two for R input sections. I tried the following:
\DefineVerbatimEnvironment{Sinput}{minted}{r}
\DefineVerbatimEnvironment{Scode}{minted}{r}
Any suggestions?
Yes, look at some of the vignettes for Rcpp as for example (to pick just one) the Rcpp-FAQ pdf.
We use the highlight by Romain which itself can farm out to the hightlight binary by Andre Simon. It makes everything a little more involved---Makefiles for the vignettes etc pp---but we get colourful output from R and C/C++ code. Which makes it worth it.
I have a solution that has worked for me, I have not tried it on any other systems though so things may not work out of the box for you. I've posted some code at https://gist.github.com/797478 that is a set of modified Rweave driver functions that make use of minted blocks instead of verbatim blocks.
To use this driver just specify it when calling the Sweave function with the driver=RweaveLatexMinted() option.
Here's how I've ended up solving it, starting from #daroczig's suggestion.
\usepackage{minted}
\renewenvironment{Sinput}{\minted[frame=single]{r}}{\endminted}
\DefineVerbatimEnvironment{Soutput}{Verbatim}{frame=leftline}
\DefineVerbatimEnvironment{Scode}{Verbatim}{}
While I was at it, I needed to get caching working because I'm using large data sets and one chunk was taking around 3 minutes to complete. So I wrote this zsh shell function to process an .Rnw file with caching:
function sweaveCache() {
Rscript -e "library(cacheSweave); setCacheDir(getwd()); Sweave('$1.Rnw', driver = cacheSweaveDriver)" &&
pdflatex --shell-escape $1.tex &&
open $1.pdf
}
Now I just do sweaveCache myFile and I get the result opened in Preview (on OS X).
This topic on tex.StackExchange might be interesting for you, as it suggest loading the SweaveListingUtils package in R for easy solution.

maintaining an input / output log in R

Is there an easy way to have R record all input and output from your R session to disk while you are working with R interactively?
In R.app on Mac OS X I can do a File->Save..., but it isn't much help in recovering the commands I had entered when R crashes.
I have tried using sink(...,split=T), but it doesn't seem to do exactly what I am looking for.
Many of us use ESS / Emacs for this very reason. Saving old sessions with extension '.Rt' even gives you mode-specific commands for re-running parts of your session.
Greg Snow wrote recently on the R-help list (a very valuable resource, SO R people!):
"You may also want to look at ?TeachingDemos::txtStart as an alternative to sink, one advantage is that the commands as well as the output can be included. With a little more work you can also include graphical output into a transcript file."
r-help
Check out the savehistory() command
I'm not sure yet how to answer an answer, but there is an updated version of Ranke's vim r-plugin called r-plugin2 available here. It seems more user-friendly and robust than the original.
Emacs is good, but for those of us with a vi preference there's the vim-r plugin at:
http://www.uft.uni-bremen.de/chemie/ranke/index.php?page=vim_R_linux
It works brilliantly and has a tiny memory footprint.

Resources