|
From: Andre R. <and...@us...> - 2004-11-04 21:57:04
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22310 Modified Files: lang.c opverbs.c Log Message: Minor optimization in langrunscriptcode: If the UserTalk script to be called doesn't take any parameters, it's okay to pass in nil for the parameter list. opvisitallverb takes advantage of this optimization. Index: opverbs.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/opverbs.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** opverbs.c 31 Oct 2004 21:43:38 -0000 1.3 --- opverbs.c 4 Nov 2004 21:56:39 -0000 1.4 *************** *** 2775,2793 **** static boolean opvisitallvisit (hdlheadrecord hnode, ptrvoid bsscriptname) { ! //static boolean opvisitallvisit (hdlheadrecord hnode, tyvaluerecord val) { /* 7.0b17 PBS: visit every headline in an outline, calling a callback script for each. It's a wrapper for opvisiteverything. */ ! tyvaluerecord vreturned, vparams; ! hdllistrecord hlist; ! if (!opnewlist (&hlist, false)) /*create a list*/ return (false); if (!setheapvalue ((Handle) hlist, listvaluetype, &vparams)) return (false); oppushoutline (outlinedata); --- 2775,2801 ---- static boolean opvisitallvisit (hdlheadrecord hnode, ptrvoid bsscriptname) { ! /* 7.0b17 PBS: visit every headline in an outline, calling a callback script for each. It's a wrapper for opvisiteverything. + + 2004-11-03 aradke: Take advantage of langrunscript now accepting + a nil pointer if the script doesn't take any parameters. + We don't need to create an empty list anymore. */ ! tyvaluerecord vreturned; ! /* ! tyvaluerecord vparams; ! hdllistrecord hlist; ! ! if (!opnewlist (&hlist, false)) /%create a list%/ return (false); if (!setheapvalue ((Handle) hlist, listvaluetype, &vparams)) return (false); + */ oppushoutline (outlinedata); *************** *** 2797,2801 **** (**outlinedata).flwindowopen = true; ! langrunscript (bsscriptname, &vparams, nil, &vreturned); oppopoutline (); --- 2805,2809 ---- (**outlinedata).flwindowopen = true; ! langrunscript (bsscriptname, nil, nil, &vreturned); oppopoutline (); Index: lang.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/lang.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** lang.c 1 Nov 2004 11:50:17 -0000 1.3 --- lang.c 4 Nov 2004 21:56:39 -0000 1.4 *************** *** 1335,1339 **** boolean flpushedroot; register boolean fl = false; ! if ((*listval).valuetype == recordvaluetype) /*7.0b41 PBS: build named param list if a record*/ return (langbuildnamedparamlist (listval, hparams)); --- 1335,1339 ---- boolean flpushedroot; register boolean fl = false; ! if ((*listval).valuetype == recordvaluetype) /*7.0b41 PBS: build named param list if a record*/ return (langbuildnamedparamlist (listval, hparams)); *************** *** 1383,1386 **** --- 1383,1389 ---- /* 02/04/02 dmb: the guts of langrunscript + + 2004-11-03 aradke: Accept nil for vparams, meaning the function + doesn't take any parameters, so we simply bypass langbuildparamlist. */ *************** *** 1389,1393 **** tyvaluerecord val; hdltreenode hfunctioncall; ! hdltreenode hparamlist; boolean fltmpval; --- 1392,1396 ---- tyvaluerecord val; hdltreenode hfunctioncall; ! hdltreenode hparamlist = nil; boolean fltmpval; *************** *** 1401,1429 **** pushhashtable (hcontext); */ ! if (hcontext != nil) { ! ! flchained = (**hcontext).flchained; ! ! if (flchained) ! pushhashtable (hcontext); ! else ! chainhashtable (hcontext); /*establishes outer local context*/ ! } ! ! fl = langbuildparamlist (vparams, &hparamlist); ! ! if (hcontext != nil) { ! if (flchained) ! pophashtable (); ! else ! unchainhashtable (); ! } ! ! if (!fl) { ! langdisposetree (hfunctioncall); ! goto exit; } --- 1404,1435 ---- pushhashtable (hcontext); */ ! flchained = (hcontext != nil) && (**hcontext).flchained; ! ! if (vparams != nil) { ! ! if (hcontext != nil) { ! ! if (flchained) ! pushhashtable (hcontext); ! else ! chainhashtable (hcontext); /*establishes outer local context*/ ! } ! fl = langbuildparamlist (vparams, &hparamlist); ! if (hcontext != nil) { ! ! if (flchained) ! pophashtable (); ! else ! unchainhashtable (); ! } ! if (!fl) { ! ! langdisposetree (hfunctioncall); ! ! goto exit; ! } } |