PageRenderTime 7ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

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

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