Mercurial > hg > forks > multipaint-js
changeset 116:1180249d713d
Add some comments to the postprocess script.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 06 Jul 2018 19:43:56 +0300 |
parents | 653ce10184e5 |
children | 44a07b1c620d |
files | postprocess.pl |
diffstat | 1 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/postprocess.pl Fri Jul 06 18:58:28 2018 +0300 +++ b/postprocess.pl Fri Jul 06 19:43:56 2018 +0300 @@ -15,12 +15,20 @@ while (defined(my $line = <STDIN>)) { + # The $p.parseByte()s are useless, really $line =~ s@.p\.parseByte\(@(@g; + + # Transform $p.parseInt(new $p.Character('x')) to direct ASCII number of the character $line =~ s@.p\.parseInt\(\(new\s+.p\.Character\('(.)'\)\)\)@sprintf('%d',ord($1))@eg; + + # Same for (new $p.Character('x')) $line =~ s@\(new\s+.p\.Character\('(.)'\)\)@sprintf('%d',ord($1))@eg; + + # Using parseInt() is wasteful, Math.trunc() is more efficient $line =~ s@.p\.parseInt\(@Math.trunc(@g; - # Kludge + # Kludge. The switch() in help() in Interface.pde needs this to work after our + # previous transformations done in this script. $line =~ s@switch\s*\(.p\.parseChar\(mode\)\)@switch (mode)@g; print $line; }