1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-02 04:40:29 +02:00
guile/doc/printf.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

38 lines
917 B
C

#include <stdio.h>
#include <lightning.h>
static jit_state_t *_jit;
typedef void (*pvfi)(int); /* Pointer to Void Function of Int */
int main(int argc, char *argv[])
{
pvfi myFunction; /* ptr to generated code */
jit_node_t *start, *end; /* a couple of labels */
jit_node_t *in; /* to get the argument */
init_jit(argv[0]);
_jit = jit_new_state();
start = jit_note(__FILE__, __LINE__);
jit_prolog();
in = jit_arg();
jit_getarg(JIT_R1, in);
jit_pushargi((jit_word_t)"generated %d bytes\n");
jit_ellipsis();
jit_pushargr(JIT_R1);
jit_finishi(printf);
jit_ret();
jit_epilog();
end = jit_note(__FILE__, __LINE__);
myFunction = jit_emit();
/* call the generated code, passing its size as argument */
myFunction((char*)jit_address(end) - (char*)jit_address(start));
jit_disassemble();
finish_jit();
return 0;
}