
    :Qg                     D    d Z ddlmZ dZdZdZdZ G d de      Z	d	 Z
d
ay
)zH
ghostscript - A Python interface for the Ghostscript interpreter C-API
   )_gsprintz-Hartmut Goebel <h.goebel@crazy-compilers.com>zDCopyright 2010-2018 by Hartmut Goebel <h.goebel@crazy-compilers.com>z-GNU General Public License version 3 (GPL v3)z0.6c                   4    e Zd ZddZd Zd ZddZd Zd Zy)	__GhostscriptNc                     d| _         d | _        |s|s|r| j                  |||       t        j                  ||      }d| _         |t        j
                  k(  r| j                          y y )NFT)_initialized
_callbacks	set_stdiogsinit_with_argse_Quitexit)selfinstanceargsstdinstdoutstderrrcs          ]/var/www/html/answerous/venv/lib/python3.12/site-packages/camelot/ext/ghostscript/__init__.py__init__z__Ghostscript.__init__"   s[    !FfNN5&&1x. ?IIK     c                     | S N r   s    r   	__enter__z__Ghostscript.__enter__,   s    r   c                 $    | j                          y r   r   )r   r   s     r   __exit__z__Ghostscript.__exit__/       		r   c                    |xr t        j                  |      xs d|xr t        j                  |      xs d|xr t        j                  |      xs df| _        t        j
                  t        g| j                    y)a  Set stdin, stdout and stderr of the ghostscript interpreter.

        The ``stdin`` stream has to support the ``readline()``
        interface. The ``stdout`` and ``stderr`` streams have to
        support the ``write()`` and ``flush()`` interface.

        Please note that this does not affect the input- and output-
        streams of the devices. Esp. setting stdout does not allow
        catching the devise-output even when using ``-sOutputFile=-``.

        N)r
   _wrap_stdin_wrap_stdout_wrap_stderrr   r	   __instance__)r   r   r   r   s       r   r	   z__Ghostscript.set_stdio2   sf     +bnnU+3t.rv.6$.rv.6$

 	\4DOO4r   c                 $    | j                          y r   r   r   s    r   __del__z__Ghostscript.__del__F   r    r   c                     | j                   rBt        4t        j                  t               t        j                  t               d ad| _         y y )NF)r   r%   r
   r   delete_instancer   s    r   r   z__Ghostscript.exitI   s=    '%""<0# %D r   )NNN)	__name__
__module____qualname__r   r   r   r	   r'   r   r   r   r   r   r   !   s     5(&r   r   c            
          t         t        j                         a t        t         | |j	                  dd      |j	                  dd      |j	                  dd            S )z6Factory function for setting up a Ghostscript instanceNr   r   r   )r   r   r   )r%   r
   new_instancer   get)r   kwargss     r   Ghostscriptr1   S   sS     (jj$'zz(D)zz(D) r   N)__doc__ r   r
   
__author____copyright____license____version__objectr   r1   r%   r   r   r   <module>r9      s>   *  =
V=/&F /&d r   