SRL Archive - Help

correct use of addonterminate


zluo

2012-06-02 00:28:13

{$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

2012-06-02 00:39:32


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

2012-06-02 00:57:20

Wouldn't you also want to free the DTMs too if, at the end of your script, it completes everything successfully?