/* Authors: Arkeon */ /* Last update: 07.04.02 */ /* Version: 1.0 */ typeof class=S;; fun cbcomm(ui, cli, action, param, z) = let z->[o state] in if !strcmp action "state?" then UsendCli this nil ui "setState" itoa state else nil ;; /* fun activate(o, from, cli, action, param, rep, z) = let z->[_ state] in let 1-state -> newstate in ( mutate z<-[_ newstate]; UsendCli this nil ObUi o "setState" itoa newstate ); 0 ;; */ fun activate_on(o, from, cli, action, param, rep, z) = let z->[_ state] in let 1 -> newstate in ( mutate z<-[_ newstate]; UsendCli this nil ObUi o "setState" itoa newstate ); 0 ;; fun activate_off(o, from, cli, action, param, rep, z) = let z->[_ state] in let 0-> newstate in ( mutate z<-[_ newstate]; UsendCli this nil ObUi o "setState" itoa newstate ); 0 ;; fun newOb(o) = let [o if !strcmp hd UgetParam ObUi o "init" "on" then 1 else 0] -> z in ( ObRegisterAction o strcat ObName o ".startS" mkfun7 @activate_on z; ObRegisterAction o strcat ObName o ".stopS" mkfun7 @activate_off z; UcbComm this ObUi o mkfun5 @cbcomm z ); 0 ;; fun IniPlug(file)= set class=getInfo strextr _getpack _checkpack file "name"; PlugRegister class @newOb nil; 0 ;;