File: hello.c

package info (click to toggle)
ecl 21.2.1%2Bds-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 17,604 kB
  • sloc: ansic: 146,375; lisp: 67,950; xml: 8,221; asm: 5,551; sh: 3,239; makefile: 1,968; cpp: 190; java: 116
file content (28 lines) | stat: -rw-r--r-- 703 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <stdio.h>
#include <ecl/ecl.h>

int main (int argc, char **argv) {
  /* Initialize ECL */
  cl_boot(argc, argv);

  /* Initialize the library we linked in. Each library
   * has to be initialized. It is best if all libraries
   * are joined using ASDF:MAKE-BUILD.
   */
  extern void init_lib_HELLO_LISP(cl_object);
  ecl_init_module(NULL, init_lib_HELLO_LISP);

  cl_object result = cl_eval(c_string_to_object("(hello-lisp)"));
  ecl_print(result, ECL_T);

  cl_object my_fun = cl_eval(c_string_to_object("(lambda (x) (1+ x))"));
  ecl_print(my_fun, ECL_T);

  result=cl_funcall(2, my_fun, ecl_make_fixnum(8));
  ecl_print(result, ECL_T);

  ecl_terpri(ECL_T);

  cl_shutdown();
  return 0;
}