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, 6 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.

    1: <!DOCTYPE piml PUBLIC "-//TUX/DTD piml 1.0 Final//EN"
    2:         "http://lpml.sourceforge.net/DTD/piml.dtd">
    3: <!-- lcmathcomplex.piml -->
    4: 
    5: <!-- $Id: lcmathcomplex.piml,v 1.1 2013/10/29 21:01:10 raeburn Exp $ -->
    6: 
    7: <!--
    8: 
    9: This file is part of the LearningOnline Network with CAPA (LON-CAPA).
   10: 
   11: LON-CAPA is free software; you can redistribute it and/or modify
   12: it under the terms of the GNU General Public License as published by
   13: the Free Software Foundation; either version 2 of the License, or
   14: (at your option) any later version.
   15: 
   16: LON-CAPA is distributed in the hope that it will be useful,
   17: but WITHOUT ANY WARRANTY; without even the implied warranty of
   18: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   19: GNU General Public License for more details.
   20: 
   21: You should have received a copy of the GNU General Public License
   22: along with LON-CAPA; if not, write to the Free Software
   23: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   24: 
   25: /home/httpd/html/adm/gpl.txt
   26: 
   27: http://www.lon-capa.org/
   28: 
   29: -->
   30: 
   31: <piml>
   32: <targetroot>/</targetroot>
   33: <files>
   34: <file>
   35: <target dist="default">/home/httpd/lonUsers</target>
   36: <perlscript mode="fg">
   37: 
   38: use strict;
   39: use Config;
   40: 
   41: my $nvsize = $Config{nvsize} ||
   42:              ($Config{uselongdouble} && $Config{longdblsize}) ||
   43:              $Config{doublesize};
   44: 
   45: unless ($nvsize =~ /^\d+$/) {
   46:     print "Unexpected value: $nvsize determined for nvsize from Config.pm for use in LCMathComplex.pm\n";
   47:     exit;
   48: }
   49: 
   50: my $fh;
   51: my ($mathcomplex,$changed);
   52: if (open($fh,"&lt;/home/httpd/lib/perl/LONCAPA/LCMathComplex.pm")) {
   53:     while (&lt;$fh&gt;) {
   54:         if (/^\s*\Qmy $nvsize = \E(\d+);/) {
   55:             my $currsize = $1;
   56:             if ($currsize != $nvsize) {
   57:                 $changed = 1;
   58:                 $mathcomplex .= '    my $nvsize = '.$nvsize.';'."\n";  
   59:             } else {
   60:                 print "nvsize in LCMathComplex.pm already set to $nvsize -- no action required.\n";
   61:                 last;
   62:             }
   63:         } else {
   64:             $mathcomplex .= $_;
   65:         }
   66:     }
   67:     close($fh);
   68:     if ($changed) {
   69:         if (open($fh,"&gt;/home/httpd/lib/perl/LONCAPA/LCMathComplex.pm")) {
   70:             print $fh $mathcomplex;
   71:             close($fh);
   72:             print "nvsize now set to $nvsize in LCMathComplex.pm\n";
   73:         }
   74:     }
   75: }
   76: 
   77: </perlscript>
   78: </file>
   79: </files>
   80: </piml>
   81: 

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