관리-도구
편집 파일: conv_template.cpython-37.pyc
B ��Fd�% � @ s� d Z ddlmZmZmZ ddgZddlZddlZddlZddl m Z i ZdZdd � Z d d� Ze�d�Ze�d �Zdd� Ze�d�Ze�d�Ze�d�Ze�d�Zdd� Ze�d�Zdd� Zdd� Ze�dej�Zdd� Zdd� Zdd� Ze d k�r�yej!d! Z"W n" e#k �r" ej$Z%ej&Z'Y n*X e(e"d"�Z%ej)�*e"�\Z+Z,e+Z-e(e-d#�Z'e%�.� Z/yee/�Z0W n, e1k �r� e � Z2e1d$e"e2f ��Y nX e'�3e0� dS )%aX takes templated file .xxx.src and produces .xxx file where .xxx is .i or .c or .h, using the following template rules /**begin repeat -- on a line by itself marks the start of a repeated code segment /**end repeat**/ -- on a line by itself marks it's end After the /**begin repeat and before the */, all the named templates are placed these should all have the same number of replacements Repeat blocks can be nested, with each nested block labeled with its depth, i.e. /**begin repeat1 *.... */ /**end repeat1**/ When using nested loops, you can optionally exclude particular combinations of the variables using (inside the comment portion of the inner loop): :exclude: var1=value1, var2=value2, ... This will exclude the pattern where var1 is value1 and var2 is value2 when the result is being generated. In the main body each replace will use one entry from the list of named replacements Note that all #..# forms in a block must have the same number of comma-separated entries. Example: An input file containing /**begin repeat * #a = 1,2,3# * #b = 1,2,3# */ /**begin repeat1 * #c = ted, jim# */ @a@, @b@, @c@ /**end repeat1**/ /**end repeat**/ produces line 1 "template.c.src" /* ********************************************************************* ** This file was autogenerated from a template DO NOT EDIT!!** ** Changes should be made to the original source (.src) file ** ********************************************************************* */ #line 9 1, 1, ted #line 9 1, 1, jim #line 9 2, 2, ted #line 9 2, 2, jim #line 9 3, 3, ted #line 9 3, 3, jim � )�division�absolute_import�print_function�process_str�process_fileN)� get_exceptionaE /* ***************************************************************************** ** This file was autogenerated from a template DO NOT EDIT!!!! ** ** Changes should be made to the original source (.src) file ** ***************************************************************************** */ c C s� |dkrd}d}nd| }d| }d}d}g }x�| � ||�}|dkrFP | � d|�}| � d|�}| � ||�} | � d| �} || �d||d �7 }|�||d | | d |f� || �d|d | �7 }| }q0W |�� |S ) z� The returned line number is from the beginning of the string, starting at zero. Returns an empty list if no loops found. r z/**begin repeatz/**end repeat**/z/**begin repeat%dz/**end repeat%d**/���z*/� � )�find�count�append�sort)�astr�level�loopbeg�loopend�ind�line�spanlist�start�start2�fini1�fini2� r �P/opt/alt/python37/lib64/python3.7/site-packages/numpy/distutils/conv_template.py�parse_structurej s, r c C s( | � d�}| � d�}d�|gt|� �S )Nr � �,)�group�join�int)�obj�torep�numrepr r r � paren_repl� s r% z[(]([^)]*)[)]\*(\d+)z([^*]+)\*(\d+)c C s0 t �t| �} d�dd� | �d�D ��} | �d�S )Nr c S s g | ]}t �t|�� ��qS r )�plainrep�subr% �strip)�.0�xr r r � <listcomp>� s z parse_values.<locals>.<listcomp>)�parenrepr'