1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-01 20:30:28 +02:00
guile/doc/incr.c
pcpa 16d18f11d3 Update texinfo documentation to match current implementation.
* check/Makefile.am: "make debug" target should pass only
	the main test tool program as argument for running gdb

	* configure.ac: Add the --enable-assertions options.

	* doc/Makefile.am, doc/body.texi, doc/lightning.texi:
	Major rewrite of the documentation to match the current
	implementation.

	* doc/version.texi: Automatic date update.

	* doc/ifib.c, doc/incr.c, doc/printf.c, doc/rfib.c, doc/rpn.c:
	Implementation of the documentation examples, that are also
	compiled during a normal build.

	* doc/p-lightning.texi, doc/porting.texi, doc/toc.texi,
	doc/u-lightning.texi, doc/using.texi: These files were
	renamed in the documentation rewrite, as the documentation
	was significantly trimmed due to full removal of the porting
	chapters. Better porting documentation should be added but
	for the moment it was just removed the documentation not
	matching the implementation.
2013-01-24 19:41:35 -02:00

29 lines
763 B
C

#include <stdio.h>
#include <lightning.h>
static jit_state_t *_jit;
typedef int (*pifi)(int); /* Pointer to Int Function of Int */
int main(int argc, char *argv[])
{
jit_node_t *in;
pifi incr;
init_jit(argv[0]);
_jit = jit_new_state();
jit_prolog(); /* @t{ prolog } */
in = jit_arg(); /* @t{ in = arg } */
jit_getarg(JIT_R0, in); /* @t{ getarg R0 } */
jit_addi(JIT_R0, JIT_R0, 1); /* @t{ addi R0\, R0\, 1 } */
jit_retr(JIT_R0); /* @t{ retr R0 } */
incr = jit_emit();
/* call the generated code\, passing 5 as an argument */
printf("%d + 1 = %d\n", 5, incr(5));
finish_jit();
return 0;
}