/* 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, user, param, others, tag)= if i>n then 0 else { _DMSeventTag this user (strcat "out" itoa i) param others /*tag*/ nil; seq i+1 n user param others /*tag*/ nil };; fun inputAct (from, user, action, param, others, tag)= if n==nil || n<=0 then nil else if mode==ONE_BY_ONE then { set current = (mod current n) + 1; _DMSeventTag this user (strcat "out" itoa current) param others /*tag*/ nil; } else seq 1 n user param others /*tag*/ nil;; 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" };;