HEX
Server: LiteSpeed
System: Linux ws4.angoweb.net 5.14.0-611.13.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 11 04:57:59 EST 2025 x86_64
User: tswangoe (2287)
PHP: 8.1.33
Disabled: show_source, system, shell_exec, passthru, exec, phpinfo, popen, proc_open
Upload Files
File: //usr/local/lib/python3.9/site-packages/future/backports/test/__pycache__/pystone.cpython-39.pyc
a

q�dg�@s�dZddlmZddlmZdZdZedd�\ZZ	Z
ZZGdd	�d	e
�ZdZdZefd
d�Zefdd
�Zdaeadadadgdadd�tgdD�adadaefdd�Zdd�Zdd�Zdd�Zdd�Zdd�Z dd �Z!d!d"�Z"d#d$�Z#d%d&�Z$d'd(�Z%d)d*�Z&e'd+k�r�ddl(Z(d,d-�Z)e*e(j+�dZ,e,dk�rBe)d.e,�nJe,dk�r�ze-e(j+d�Z.Wn&e/�y�e)d/e(j+d�Yn0neZ.ee.�dS)0a�
"PYSTONE" Benchmark Program

Version:        Python/1.1 (corresponds to C/1.1 plus 2 Pystone fixes)

Author:         Reinhold P. Weicker,  CACM Vol 27, No 10, 10/84 pg. 1013.

                Translated from ADA to C by Rick Richardson.
                Every method to preserve ADA-likeness has been used,
                at the expense of C-ness.

                Translated from C to Python by Guido van Rossum.

Version History:

                Version 1.1 corrects two bugs in version 1.0:

                First, it leaked memory: in Proc1(), NextRecord ends
                up having a pointer to itself.  I have corrected this
                by zapping NextRecord.PtrComp at the end of Proc1().

                Second, Proc3() used the operator != to compare a
                record to None.  This is rather inefficient and not
                true to the intention of the original benchmark (where
                a pointer comparison to None is intended; the !=
                operator attempts to find a method __cmp__ to do value
                comparison of the record).  Version 1.1 runs 5-10
                percent faster than version 1.0, so benchmark figures
                of different versions can't be compared directly.

�)�print_function)�clockiP�z1.1��c@seZdZddd�Zdd�ZdS)�RecordNrcCs"||_||_||_||_||_dS�N)�PtrComp�Discr�EnumComp�IntComp�
StringComp)�selfrr	r
rr�r�G/usr/local/lib/python3.9/site-packages/future/backports/test/pystone.py�__init__/s
zRecord.__init__cCst|j|j|j|j|j�Sr)rrr	r
rr)r
rrr�copy7s�zRecord.copy)Nrrrr)�__name__�
__module__�__qualname__rrrrrrr-s�
rcCs.t|�\}}tdt||f�td|�dS)Nz#Pystone(%s) time for %d passes = %gz-This machine benchmarks at %g pystones/second)�pystones�print�__version__)�loops�	benchtimeZstonesrrr�main>s
�rcCst|�Sr)�Proc0)rrrrrEsr��3cCsg|]}|dd��qSrr)�.0�xrrr�
<listcomp>M�r Nc
Cs^t�}t|�D]}qt�|}t�at�att_tt_tt_	dt_
dt_d}dtdd<t�}t|�D]�}t
�t�d}d}d	}t}t||�a||kr�d
||}	t||�}	|d}q�ttt||	�tt�ad}
|
tk�r|t|
d
�kr�tt�}tt|
�d�}
q�||}	|	|}d|	||}t|�}qft�||}|dk�rNd}n||}||fS)N�(zDHRYSTONE PROGRAM, SOME STRINGzDHRYSTONE PROGRAM, 1'ST STRING�
����zDHRYSTONE PROGRAM, 2'ND STRING�r�A�Cg)r�ranger�
PtrGlbNext�PtrGlbr�Ident1r	�Ident3r
rr�
Array2Glob�Proc5�Proc4�Ident2�Func2�BoolGlob�Proc7�Proc8�
Array1Glob�Proc1�	Char2Glob�Func1�Proc6�chr�ord�Proc2)
rZ	starttime�iZnulltimeZ
String1LocZIntLoc1ZIntLoc2Z
String2Loc�EnumLocZIntLoc3Z	CharIndexrZloopsPerBenchtimerrrrQsT






rcCsvt��|_}d|_|j|_|j|_t|j�|_|jtkrdd|_t|j�|_tj|_t	|jd�|_n|��}d|_|S)Nr(rr#)
r-rrr�Proc3r	r.r<r
r6)ZPtrParInZ
NextRecordrrrr9�s
r9cCs4|d}tdkr$|d}|t}t}|tkrq0q|S)Nr#r)r)�	Char1Glob�IntGlobr.)ZIntParIO�IntLocrArrrr?�sr?cCs$tdurtj}ndatdt�t_|S)N�dr#)r-rrDr6r)Z	PtrParOutrrrrB�s
rBcCstdk}|pt}dadS)Nr)�B)rCr5r:)ZBoolLocrrrr2�sr2cCsdatadS)Nr))rC�FALSEr5rrrrr1�sr1cCsb|}t|�st}|tkrt}n@|tkr:tdkr4t}q^t}n$|tkrHt}n|tkrRn|tkr^t}|S)NrF)�Func3�Ident4r.r3rDr/�Ident5)�	EnumParInZ
EnumParOutrrrr<�s r<cCs|d}||}|S)Nr&r)�IntParI1�IntParI2rEZ	IntParOutrrrr6�sr6cCs�|d}|||<||||d<|||d<t||d�D]}||||<q:|||dd|||d<||||d|<dadS)Nr(r�r&�)r+rD)Z	Array1ParZ	Array2ParrMrNrEZIntIndexrrrr7�s r7cCs|}|}||krtStSdSr)r.r3)ZCharPar1ZCharPar2ZCharLoc1ZCharLoc2rrrr;�s
r;cCspd}|dkr4t||||d�tkrd}|d}q|dkrH|dkrHd}|dkrTtS||krh|d}tStSdS)Nrr)�W�Zr%�X)r;r.�TRUErH)ZStrParI1ZStrParI2rEZCharLocrrrr4�s
r4cCs|}|tkrtStSr)r/rTrH)rLrArrrrI�srI�__main__cCs6t|dtjd�tdtjdtjd�t�d�dS)N� )�end�filezusage: %s [number_of_loops]r)rXrF)r�sys�stderr�argv�exit)�msgrrr�errorsr^z%d arguments are too many;zInvalid argument %r;)0�__doc__�
__future__r�timerZLOOPSrr+r.r3r/rJrK�objectrrTrHrrrDr5rCr:r8r0r-r,rr9r?rBr2r1r<r6r7r;r4rIrrYr^�lenr[�nargs�intr�
ValueErrorrrrr�<module>sT 
: