Log in

View Full Version : correct use of addonterminate



zluo
06-02-2012, 04:28 AM
{$i SRL/SRL.simba}

procedure loadthosedtms;
begin
dtm1 := dtmfromstring(........);
dtm2 := dtmfromstring(........);
end;

procedure freeing;
begin
freedtm(dtm1);
freedtm(dtm2);
end;

procedure This;
begin
something
end;

procedure Main;
begin
loadthosedtms;
repeat
This;
until(false);
end;

begin
SetUpSrl;
Addonterminate(freeing);
ClearDebug;
ActivateClient;
Repeat
Main;
Until(false);
end.

is this correct use of addonterminate? would this run "freeing" even if i terminated it manually and would it also run it if i terminate the script via terminatescript;?

CephaXz
06-02-2012, 04:39 AM
begin
ClearDebug;
SetUpSrl;
loadthosedtms; //Load dtms
Addonterminate('freeing'); // You missed out ''
ActivateClient;
Repeat
This; //Dont need the main since its the same?
Until(false);
end.

That's basically what I did. I believe as long as the script is terminated, it will run it.

Le Jingle
06-02-2012, 04:57 AM
Wouldn't you also want to free the DTMs too if, at the end of your script, it completes everything successfully?