[SciPy-dev] Re: [Scipy-cvs] world/scipy_core/scipy_distutils from_template.py, 1.6, 1.7

Pearu Peterson pearu at cens.ioc.ee
Fri Oct 1 06:12:19 CDT 2004


Travis,

What is the reason that process_str() lowers its input?
There may be other macros in addition to MIN, MAX that .pyf files may
contain and it would be nice to if process_str would not lower the input.

Pearu

On Fri, 1 Oct 2004 travo at scipy.org wrote:

> Update of /home/cvsroot/world/scipy_core/scipy_distutils
> In directory scipy.org:/tmp/cvs-serv19408/scipy_core/scipy_distutils
> 
> Modified Files:
> 	from_template.py 
> Log Message:
> Added wrappers to iterative methods
> 
> 
> Index: from_template.py
> ===================================================================
> RCS file: /home/cvsroot/world/scipy_core/scipy_distutils/from_template.py,v
> retrieving revision 1.6
> retrieving revision 1.7
> diff -C2 -d -r1.6 -r1.7
> *** from_template.py	31 Aug 2004 01:00:05 -0000	1.6
> --- from_template.py	1 Oct 2004 08:30:06 -0000	1.7
> ***************
> *** 173,176 ****
> --- 173,187 ----
>           char = str[ind]
>       return ''.join(extra)
> + 
> + maxre = re.compile(r"max[(](.+),(.+)[)]")
> + minre = re.compile(r"min[(](.+),(.+)[)]")
> + 
> + def fix_capitals(astr):
> +     # Need to convert max(x,x) to MAX(x,x)
> +     #  and min(x,x) to MIN(x,x)
> +     astr = maxre.sub(r"MAX(\g<1>,\g<2>)",astr)
> +     astr = minre.sub(r"MIN(\g<1>,\g<2>)",astr)
> +     return astr
> +     
>       
>   def process_str(allstr):
> ***************
> *** 184,193 ****
>       oldend = 0
>       for sub in struct:
> !         writestr += newstr[oldend:sub[0]]
>           expanded = expand_sub(newstr[sub[0]:sub[1]],get_line_header(newstr,sub[0]))
> !         writestr += expanded
>           oldend =  sub[1]
>   
> !     writestr += newstr[oldend:]
>       return writestr
>   
> --- 195,205 ----
>       oldend = 0
>       for sub in struct:
> !         writestr += fix_capitals(newstr[oldend:sub[0]])
>           expanded = expand_sub(newstr[sub[0]:sub[1]],get_line_header(newstr,sub[0]))
> !         writestr += fix_capitals(expanded)
>           oldend =  sub[1]
>   
> ! 
> !     writestr += fix_capitals(newstr[oldend:])
>       return writestr
>   
> 
> _______________________________________________
> Scipy-cvs mailing list
> Scipy-cvs at scipy.org
> http://scipy.net/mailman/listinfo/scipy-cvs
> 





More information about the Scipy-dev mailing list