/trunk/Examples/guile/matrix/main.c

# · C · 24 lines · 16 code · 7 blank · 1 comment · 4 complexity · b5d4a70ac11e322bcca4ddfef0e0c1b5 MD5 · raw file

  1. #include <tcl.h>
  2. extern int matrix_init(Tcl_Interp *); /* Init function from matrix.i */
  3. int main() {
  4. int code;
  5. char input[1024];
  6. Tcl_Interp *interp;
  7. interp = Tcl_CreateInterp();
  8. /* Initialize the wrappers */
  9. if (matrix_init(interp) == TCL_ERROR)
  10. exit(0);
  11. fprintf(stdout,"matrix > ");
  12. while(fgets(input, 1024, stdin) != NULL) {
  13. code = Tcl_Eval(interp, input);
  14. fprintf(stdout,"%s\n",interp->result);
  15. fprintf(stdout,"matrix > ");
  16. }
  17. }