5000 lines of code

Geoff Canyon Rev gcanyon+rev at gmail.com
Sat Jun 11 16:16:00 EDT 2011


Richmond, you could rewrite that to be much more efficient, both in code,
and I'm guessing in performance.

Instead of this:

case (numToChar(2339) & numToChar(2325))
set the unicodeText of fld "fPROC" to numToChar(61953)
put 2 into DDROP
break
case (numToChar(2339) & numToChar(2326))
set the unicodeText of fld "fPROC" to numToChar(61954)
put 2 into DDROP
break
case (numToChar(2339) & numToChar(2327))
set the unicodeText of fld "fPROC" to numToChar(61955)
break

etc.

Do this:

First, set up a custom property (or preference file, if you like). It should
contain this:

numToChar(2339) & numToChar(2325) & tab & numToChar(61953)
numToChar(2339) & numToChar(2326) & tab & numToChar(61954)
numToChar(2339) & numToChar(2327) & tab & numToChar(61955)

etc.

Then during startup, do this:

global fPROCTable
put the fPROCCustomProc of this stack into fPROCTable
split fPROCTable by cr and tab

Then, in place of that amazing switch statement, use this one line of code:

set the unicodeText of fld "fPROC" to subTable[the unicodeText of fld
"fBUILT"]

If you also want to set DDROP then you could tweak that first array or just
create a second array, which is probably better. The line of code for that
would be something like:

if DDROPTable[the unicodeText of fld "fBUILT"] is not empty then
put DDROPTable[the unicodeText of fld "fBUILT"] into DDROP

regards,

Geoff

On Sun, Jun 5, 2011 at 10:13 AM, Richmond Mathewson <
richmondmathewson at gmail.com> wrote:

> If anybody really cares here is a PDF of the code in
> ONE object in my Devawriter Pro: read it and weep . . .  :)
>
> http://andregarzia.on-rev.com/**richmond/PRO/KODE/5000.pdf<http://andregarzia.on-rev.com/richmond/PRO/KODE/5000.pdf>
>
> you never know; you might learn something, get a headache, or both!
>
> ______________________________**_________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/**mailman/listinfo/use-livecode<http://lists.runrev.com/mailman/listinfo/use-livecode>
>



More information about the Use-livecode mailing list