/* Sequence Server - DMS - mar 98 - by Sylvain HUET */ /* Rev. 1.2 - Aug. '98 - by Marc BARILLEY */ /* Rev. 2.1 - May. '99 - by Patrice FAVRE */ typeof n=I;; typeof current=I;; typeof mode = I;; var ONE_BY_ONE = 1;; var ALL_AT_A_TIME = 2;; /* fun seq (i,n,cli,param,rep)= if i>n then 0 else { _DMSevent this cli strcat "out" itoa i param rep; seq i+1 n cli param rep };; fun activate (from, cli, action, param, rep)= if n==nil || n<=0 then nil else if mode==ONE_BY_ONE then { set current = (mod current n) + 1; _DMSevent this cli strcat "out" itoa current param rep; } else seq 1 n cli param rep;; */ fun seq (i, n, client, param, rep)= if i>n then 0 else { _DMSevent this client (strcat "out" itoa i) param rep ; seq i+1 n client param rep };; fun activate (from, client, action, param, rep)= if n==nil || n<=0 then nil else if mode==ONE_BY_ONE then { set current = (mod current n) + 1; _DMSevent this client (strcat "out" itoa current) param rep ; } else seq 1 n client param rep;; /* fun inputAct (from, client, action, param, rep)= if n==nil || n<=0 then nil else if mode==ONE_BY_ONE then { set current = (mod current n) + 1; _DMSeventTag this client (strcat "out" itoa current) param rep nil; } else seq 1 n client param rep;;*/ fun IniDMI (param)= _DMSregisterDMI this @activate nil nil nil; let strextr _getpack _checkpack param ->l in /* _DMSdefineActions this ["input" @inputAct]::nil; */ let _DMSgetDef this "dmi" ->l in { let getInfo l "mode" -> m in if !strcmp m "OneByOne" then set mode = ONE_BY_ONE else set mode = ALL_AT_A_TIME; set current = set n=atoi getInfo l "sequence" };;