Opened 14 years ago
Closed 14 years ago
#1029 closed task (fixed)
API para CINT, el intérprete de C y C++
Reported by: | Víctor de Buen Remiro | Owned by: | Víctor de Buen Remiro |
---|---|---|---|
Priority: | highest | Milestone: | TOL Extensions |
Component: | Kernel | Version: | head |
Severity: | critical | Keywords: | |
Cc: |
Description (last modified by )
CINT es un intérprete de C y C++ open source que permite ejecutar código sin tener que compilar ni crear un fichero ejecutable. El resultado es más lento que el código compilado pero aún así es mucho más rápido que TOL y que la mayoría de los intérpretes de lenguajes de alto nivel.
Mediante la API de CINT con C sería posible desde TOL cargar y descargar ficheros con funciones C y C++ y ejecutar sentencias que las usaran. Esta API sería especialmente útil a la hora de programar ciclos de cálculo largos que en TOL resultan demasiado lentos y que no precisan el uso de los tipos abstractos, sino que pueden expresarse mediante los tipos más simples Real, Text, Date y Matrix
Existen dos funciones para la carga y descarga de funciones en el ámbito global.
int G__loadfile(const char *file); /* G__loadfile() incrementally loads source file. */ int G__unloadfile(const char *file); /* G__unloadfile() unloads source file. If any of the func- tions included in the file is busy, G__unloadfile() returns error code (-1) and won't unload it. */
Existen otras dos funciones para la llamada a código interpretado desde C/C++.
[anytype] G__calc(char *expression); /* G__calc() evaluates C expression. It returns the type of object the argument expression returns. Variables and function calls can be used in the expression. Declara- tion, loop and conditional statement can not be used in the expression. */ int i; double a; i = G__calc("1+2+3"); // returns int a = G__calc("3.14*i"); // returns double [anytype] G__exec_tempfile(char *file); /* G__exec_tempfile() opens temporal source file and execute it in the current context. The tempfile can contain, variable declaration, struct,union,enum definition. expression, loop and control statement and cannot contain function definition. G__exec_tempfile() executes a state- ment or statement list surrounded by '{' , '}' and returns the last evaluated value. */ { // example of tempfile int i; double ary[100]; for(i=0;i<100;i++) ary[i] = i; } /* Then in the main program, you can execute above statement by G__exec_tempfile. */
Change History (46)
comment:1 Changed 14 years ago by
Description: | modified (diff) |
---|---|
Summary: | API para el intérprete de C y C++ CINT → API para CINT, el intérprete de C y C++ |
comment:2 Changed 14 years ago by
comment:6 Changed 14 years ago by
comment:7 Changed 14 years ago by
comment:9 Changed 14 years ago by
comment:10 Changed 14 years ago by
comment:15 Changed 14 years ago by
comment:19 Changed 14 years ago by
comment:21 Changed 14 years ago by
comment:39 Changed 14 years ago by
comment:40 Changed 14 years ago by
comment:41 Changed 14 years ago by
comment:43 Changed 14 years ago by
comment:46 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
(In [2769]) Refs #1029
Added contrib files for CINT API