unit InterpreteurBase;

interface

uses classes;

const MaxPara =19;

type parametresNum = array[1..maxPara] of extended;
     parametresStr = array[1..maxPara] of string;

type tvaripar = class(tobject)
       public
       value:extended;
       p1:integer;
       p2:double;
       p3:double;
       p4: string;
       p5: array of real;
       end;

var param:array[0..200] of tvaripar ;
    flagwaitchamp,flagwaittemp:boolean;
    flagwaitacquis,flagwaitmotor:boolean;
    flagwaitacquisPSD:boolean;
    flagWaitEnergizing:boolean; { flag qui indique que l'on est en train d'energiser la bobine supra }

    function rien(s:string):integer; far;
    function pause(par:parametresNum;pars:parametresStr):integer;
    function delay(par:parametresNum;pars:parametresStr):integer; {stop l'execution du timer1 pendant par[1] seconde}
    function addcomment(par:parametresNum;pars:parametresStr):integer;

implementation

uses sysutils,Forms,BoiteNoire,interpreteur;

    function rien(s:string):integer;
    begin
    result:=0;
    end;

    function pause(par:parametresNum;pars:parametresStr):integer;
    begin
    interpreteurform.timer1.enabled:=false;
    result:=0;
    end;

    function delay(par:parametresNum;pars:parametresStr):integer; {stop l'execution du timer1 pendant par[1] seconde}
    var t0,t,temps:real;
    begin
    interpreteurform.timer1.enabled:=false;
    t0:=(time-int(time))*86400;  {temps en s}
    temps:=par[1];
    repeat
      t:=(time-int(time))*86400;
      if t<t0 then t:=t+86400;  {correction bug passage par minuit}
      Application.processMessages;
    until ((t-t0)>temps);
    result:=0;
    interpreteurform.timer1.enabled:=true;
    end;

    {fonctions boite noire}
    function addcomment(par:parametresNum;pars:parametresStr):integer;
    var
    s:string;
    begin
    s:=pars[1]+pars[2]+pars[3]+pars[4]+pars[5]+pars[6]+pars[7]+pars[8]+pars[9]+pars[10];
    boitnoir.receivetext(s);
    result:=1;
    end;

end.
