cint integration in our CAD system

View: New views
2 Messages — Rating Filter:   Alert me  

cint integration in our CAD system

by Stefan Fink-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hallo,
at the moment we have our own interpreter (like pascal + little c)
intrgrated in our CAD system. the CAD system runs only on linux. we want to
port our CAD to windows. the want to support more languages (not only
german und english). we need string Unicode support. in our interpreter
we can create a gui through a extern program (this is only for easy
gui's). the CAD gui in written in motif. we want to port the whole CAD
system with QT4
(www.trolltech.com). We want use this toolkit in our interpreter. we
have ~3000 interpreted programs with maximal length  of ~70000 lines of
code.

features:
- Preprocessor with ifdef ifndef else usw.
- we can include functions from a other source file
- datatypes int,real,char,string, static array of int,real,char,string
- execute a script within a other script
- functional programming language
- interface to the cad functions (cad in programmed in C)
- debugger - i can stop the execution of the script to look for work i
have made with in
             script and later i go back to debug further
           - show the values of my variables
           - set breakpoints
           - trace over or in a function
           - change value of variable
           - terminate the script
           - evalute expressions with variable and/or functions from
my current context
- automaticly call function on the begin / end or exit of a script
without explicit call it
- one main per script
- function paramter with call by value and call by reference
- global variable
- begin - end - blocks (like pascal)
- function return values
- if else
- switch with int/string or expressions values
- for, while, repeat/until
- local variable
- evaluate expression within the current context

  a = berstr("b+c*(func(a)/3.4)");

file.txt
--------------------------------------------
[rectangle]
BERECH=a=100;b=200
BERECH=a=300;b=500
BERECH=a=100*sin(45)*45;b=500/2*7

script.mak
---------------------------------------------
program;
var
  int a,b;
  int ii,iCount,iRet;
  string sSccFile = "file.txt";
  string arLst[100];
begin
  iCount = GET_OPT_FILE(sSccFile,"rectangle",*arLst);
  for(ii=1;ii<=iCount;ii++)
  begin
     iRet = berstr(arLst[ii]);  // evaluate expression in the string in
current context
     RECHT_2PKT(@(0,0),@(a,b));
  end;
end.


- append strings with "+"
- uppercase of string with +str;
- lowercase of string with -str;
- global initialize of array with one value
- every variable is automatic initialized with zero or a empty string
- string compare with ==
- decrement/increment values with ii++ / ii--;
- const and mutable variable
- forever loops -- while (true)... or for(;;) ...
- break and continue like in C -
  breaks/continue in loops/ifs
- ifdef with expressions where executed during compilation
- execute "bytecode" (not really bytecode) it is a interpreter -
  only the syntax tree is written/read to/from file
- functions from include files which is not needed for
  execution the script will be deleted -- make "bytecode" smaller
- binary operators
- trigometric functions
- usw.
- shell execution
- first index in array is 1 not 0
- first index in string is 1 not 0
   str = "test";
   pos = str.indexOf("t");  // pos is 1 not 0
- we can declare at call time if the parameter of a function will the
past by reference or by value
- datatypes int, real, string, array of n dimensions (size is fix)
- we can debug our script - look at variable (string, int, real, array
of int , array of real, array of string)
  set breakpoints, go over function, go in function
  stop the interpreter and look in CAD system if all is ok and after
that debug the script farther.

  procedure swap(s1 : string, s2 : string);
  var
    string tmp;
  begin
    tmp = s1;
    s1 = s2;
    s2 = tmp;
  end;

  program;
  var
    string str1,str2;
  begin
    str1 = "Hallo";
    str2 = "Haus";
    swap(*str1,*str2);     // will swap the strings
  end;

what we have not :
- no integrated gui in script -- only over a extern program
- dynamic array
- no structs
- no classes
- no public,private,...
- no goto or labels
- no unicode strings only char strings (like in old c)

wish list
- embedded a new script language in our cad
- support more languages not only german and english
- interface to QT4 toolkit

please can anyone comment this list ??? can cint support this
features or ????


licensing ???


Thanks
   Stefan Fink


Re: cint integration in our CAD system

by Axel Naumann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Stefan,

 > please can anyone comment this list ??? can cint support this
 > features or ????

CINT is a C(++) interpreter, so of course it won't be able to interpret your
pascal code. None of the syntax extensions are going to work (-str to make it
lowercase etc). But when it comes to C++, I believe CINT does all you were
requiring - except for unicode string support. But we will definitely welcome a
contribution for that! :-) I have not let CINT loose on Qt4 yet, but you should
be able to get a working solution.

Concerning the licensing:
<http://root.cern.ch/viewcvs/trunk/cint/COPYING?revision=22729> shows the
current license terms. Pretty nice for commercial products, which is probably
why other products have made use of CINT before.

Let us know if you have any detailed questions.

Gruesse, Axel.

On 2008-03-17 12:39, Stefan Fink wrote:

> hallo,
> at the moment we have our own interpreter (like pascal + little c)
> intrgrated in our CAD system. the CAD system runs only on linux. we want to
> port our CAD to windows. the want to support more languages (not only
> german und english). we need string Unicode support. in our interpreter
> we can create a gui through a extern program (this is only for easy
> gui's). the CAD gui in written in motif. we want to port the whole CAD
> system with QT4
> (www.trolltech.com). We want use this toolkit in our interpreter. we
> have ~3000 interpreted programs with maximal length  of ~70000 lines of
> code.
>
> features:
> - Preprocessor with ifdef ifndef else usw.
> - we can include functions from a other source file
> - datatypes int,real,char,string, static array of int,real,char,string
> - execute a script within a other script
> - functional programming language
> - interface to the cad functions (cad in programmed in C)
> - debugger - i can stop the execution of the script to look for work i
> have made with in
>              script and later i go back to debug further
>            - show the values of my variables
>            - set breakpoints
>            - trace over or in a function
>            - change value of variable
>            - terminate the script
>            - evalute expressions with variable and/or functions from
> my current context
> - automaticly call function on the begin / end or exit of a script
> without explicit call it
> - one main per script
> - function paramter with call by value and call by reference
> - global variable
> - begin - end - blocks (like pascal)
> - function return values
> - if else
> - switch with int/string or expressions values
> - for, while, repeat/until
> - local variable
> - evaluate expression within the current context
>
>   a = berstr("b+c*(func(a)/3.4)");
>
> file.txt
> --------------------------------------------
> [rectangle]
> BERECH=a=100;b=200
> BERECH=a=300;b=500
> BERECH=a=100*sin(45)*45;b=500/2*7
>
> script.mak
> ---------------------------------------------
> program;
> var
>   int a,b;
>   int ii,iCount,iRet;
>   string sSccFile = "file.txt";
>   string arLst[100];
> begin
>   iCount = GET_OPT_FILE(sSccFile,"rectangle",*arLst);
>   for(ii=1;ii<=iCount;ii++)
>   begin
>      iRet = berstr(arLst[ii]);  // evaluate expression in the string in
> current context
>      RECHT_2PKT(@(0,0),@(a,b));
>   end;
> end.
>
>
> - append strings with "+"
> - uppercase of string with +str;
> - lowercase of string with -str;
> - global initialize of array with one value
> - every variable is automatic initialized with zero or a empty string
> - string compare with ==
> - decrement/increment values with ii++ / ii--;
> - const and mutable variable
> - forever loops -- while (true)... or for(;;) ...
> - break and continue like in C -
>   breaks/continue in loops/ifs
> - ifdef with expressions where executed during compilation
> - execute "bytecode" (not really bytecode) it is a interpreter -
>   only the syntax tree is written/read to/from file
> - functions from include files which is not needed for
>   execution the script will be deleted -- make "bytecode" smaller
> - binary operators
> - trigometric functions
> - usw.
> - shell execution
> - first index in array is 1 not 0
> - first index in string is 1 not 0
>    str = "test";
>    pos = str.indexOf("t");  // pos is 1 not 0
> - we can declare at call time if the parameter of a function will the
> past by reference or by value
> - datatypes int, real, string, array of n dimensions (size is fix)
> - we can debug our script - look at variable (string, int, real, array
> of int , array of real, array of string)
>   set breakpoints, go over function, go in function
>   stop the interpreter and look in CAD system if all is ok and after
> that debug the script farther.
>
>   procedure swap(s1 : string, s2 : string);
>   var
>     string tmp;
>   begin
>     tmp = s1;
>     s1 = s2;
>     s2 = tmp;
>   end;
>
>   program;
>   var
>     string str1,str2;
>   begin
>     str1 = "Hallo";
>     str2 = "Haus";
>     swap(*str1,*str2);     // will swap the strings
>   end;
>
> what we have not :
> - no integrated gui in script -- only over a extern program
> - dynamic array
> - no structs
> - no classes
> - no public,private,...
> - no goto or labels
> - no unicode strings only char strings (like in old c)
>
> wish list
> - embedded a new script language in our cad
> - support more languages not only german and english
> - interface to QT4 toolkit
>
> please can anyone comment this list ??? can cint support this
> features or ????
>
>
> licensing ???
>
>
> Thanks
>    Stefan Fink
>
>