File:  [LON-CAPA] / doc / loncapafiles / lcmathcomplex.piml
Revision 1.1: download - view: text, annotated - select for diffs
Tue Oct 29 21:01:10 2013 UTC (10 years, 5 months ago) by raeburn
Branches: MAIN
CVS tags: version_2_12_X, version_2_11_X, version_2_11_4_uiuc, version_2_11_4_msu, version_2_11_4, version_2_11_3_uiuc, version_2_11_3_msu, version_2_11_3, version_2_11_2_uiuc, version_2_11_2_msu, version_2_11_2_educog, version_2_11_2, version_2_11_1, version_2_11_0_RC3, version_2_11_0_RC2, version_2_11_0, HEAD
- Bug 6629.
  - Re-enable access to functionality in Math::Complex in Safe Space by
    copying Math::Complex 1.55 to LONCAPA::LCMathComplex and eliminating use
    of Config.pm
    - Whenever ./UPDATE is run to install or update LON-CAPA, the code which
      sets $nvsize in the standard Math::Complex script will be run in
      lcmathcomplex.piml and the value of $nvsize will be set to the
      appropriate value: 4, 8, 10, 12 or 16 in LONCAPA/LCMathComplex.pm.

<!DOCTYPE piml PUBLIC "-//TUX/DTD piml 1.0 Final//EN"
        "http://lpml.sourceforge.net/DTD/piml.dtd">
<!-- lcmathcomplex.piml -->

<!-- $Id: lcmathcomplex.piml,v 1.1 2013/10/29 21:01:10 raeburn Exp $ -->

<!--

This file is part of the LearningOnline Network with CAPA (LON-CAPA).

LON-CAPA is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

LON-CAPA 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 General Public License for more details.

You should have received a copy of the GNU General Public License
along with LON-CAPA; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

/home/httpd/html/adm/gpl.txt

http://www.lon-capa.org/

-->

<piml>
<targetroot>/</targetroot>
<files>
<file>
<target dist="default">/home/httpd/lonUsers</target>
<perlscript mode="fg">

use strict;
use Config;

my $nvsize = $Config{nvsize} ||
             ($Config{uselongdouble} && $Config{longdblsize}) ||
             $Config{doublesize};

unless ($nvsize =~ /^\d+$/) {
    print "Unexpected value: $nvsize determined for nvsize from Config.pm for use in LCMathComplex.pm\n";
    exit;
}

my $fh;
my ($mathcomplex,$changed);
if (open($fh,"&lt;/home/httpd/lib/perl/LONCAPA/LCMathComplex.pm")) {
    while (&lt;$fh&gt;) {
        if (/^\s*\Qmy $nvsize = \E(\d+);/) {
            my $currsize = $1;
            if ($currsize != $nvsize) {
                $changed = 1;
                $mathcomplex .= '    my $nvsize = '.$nvsize.';'."\n";  
            } else {
                print "nvsize in LCMathComplex.pm already set to $nvsize -- no action required.\n";
                last;
            }
        } else {
            $mathcomplex .= $_;
        }
    }
    close($fh);
    if ($changed) {
        if (open($fh,"&gt;/home/httpd/lib/perl/LONCAPA/LCMathComplex.pm")) {
            print $fh $mathcomplex;
            close($fh);
            print "nvsize now set to $nvsize in LCMathComplex.pm\n";
        }
    }
}

</perlscript>
</file>
</files>
</piml>


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>