/* ----------------------------------------------------------------------------- This source file is part of OpenSpace3D For the latest info, see http://www.openspace3d.com Copyright (c) 2012 I-maginer This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, or go to http://www.gnu.org/copyleft/lesser.txt ----------------------------------------------------------------------------- */ fun deleteOb(inst)= 0;; fun getParamData(param, nbskip)= let strextr param -> lp in let hd lp -> pp in let "" -> key in ( let 0 -> i in while (i < nbskip) do ( set key = strcatn key::(if (i == 0) then "" else " ")::(hd pp)::nil; set pp = tl pp; set i = i + 1; ); [key strbuildn pp::(tl lp)]; );; fun compareStringInList(l, string, firstword)= if (l == nil) then nil else let hd l -> value in let nil -> rep in let nil -> nextparam in let string -> tkey in ( if (!firstword) then nil else let sizelist (hd strextr value) -> lw in let getParamData string lw -> [key nextp] in ( set tkey = key; set nextparam = nextp; ); // search for *thing to compare using strfind if ((nth_char value 0) == 42) then set rep = if ((strfind (substr value 1 ((strlen value) - 1)) tkey 0) != nil) then value else nil else if ((nth_char tkey 0) == 42) then set rep = if ((strfind (substr tkey 1 ((strlen tkey) - 1)) value 0) != nil) then value else nil else set rep = if (!strcmp tkey value) then value else nil; if (rep != nil) then nil else let compareStringInList tl l string firstword -> [nr np] in ( set rep = nr; set nextparam = np; ); [rep nextparam]; );; fun cbInput(inst, from, action, param, rep, p) = let p -> [levent firstword] in let compareStringInList levent param firstword -> [key pp] in if (key != nil) then SendPluginEvent inst key pp nil else SendPluginEvent inst "Default" param nil; 0;; fun newOb(inst)= let atoi (getPluginInstanceParam inst "firstword") -> firstword in let if firstword == nil then 0 else firstword -> firstword in let getPluginInstanceUserEvents inst -> levent in PluginRegisterAction inst "Input" mkfun6 @cbInput [levent firstword]; setPluginInstanceCbDel inst @deleteOb; 0;; fun IniPlug(file)= PlugRegister @newOb nil; setPluginEditor @dynamicedit; 0;;