
    HAiF                        S r SrSrSrSrSSK7  SSKrSSK7  S	rSr	Sr
S
rS
rSrSrSrSrS
rSrSrSrSrSrSrSrSrSrSrSrSrSrSrSr Sr!Sr"Sr#Sr$Sr%Sr&Sr'Sr(Sr)Sr*Sr+Sr,Sr-Sr.S r/S!r0S"r1S"r2 " S# S$\35      r4\5r6\5r7 " S% S&\85      r9S' r:S( r;S) r<\=" \>\6\?" \@5      \>5      rAS* rBS+ rC\CrDS, rES- rFS. rGS/ rHS@S0 jrIS@S1 jrJS@S2 jrKS3 rLS@S4 jrMS@S5 jrNS6 rO\=" \>\5\55      rP\=" \>\5\55      rQ\=" \>\5\55      rR\=" \>\5\5\>\>\>\S5      rT\=" \>\5\5\>\>\>\S\?" \U5      5      rV\=" \>\5\55      rW\=" \>\5\5\>\>5      rX\=" \>\5\5\>\>\>\>5      rY\=" \5\5\5\Z5      r[\=" \>\5\5\55      r\\=" \>\5\5\>\]\^\^\^\^5	      r_ " S7 S8\35      r`S9 raS: rb\R                  S;:X  a)  \b" 5       rd\d(       d  \e" S<5      e\fR                  \d5      rdCbg \hR                  S=5      rdCbg! \i aC    SSKjr\R                  R                  S>5      rd\d(       d  \e" S?5      e\hR                  \d5      rd Cbgf = f)AzT
ghostscript._gsprint - A low-lewel interface to the Ghostscript C-API using ctypes
z-Hartmut Goebel <h.goebel@crazy-compilers.com>zDCopyright 2010-2023 by Hartmut Goebel <h.goebel@crazy-compilers.com>z-GNU General Public License version 3 (GPL v3)z0.8.1    )*N   i           i   i         @            i   i   i   i   i    i   i   i   i   i  0 i  @ i  P i  ` i  p c                   0    \ rS rSrS\4S\4S\4S\4/rSrg)Revisionr   product	copyrightrevisionrevisiondate N)__name__
__module____qualname____firstlineno__c_char_pc_long_fields___static_attributes__r       P/var/www/html/land-ocr/venv/lib/python3.13/site-packages/ghostscript/_gsprint.pyr   r      s)    	H	h	V	 	
Hr   r   c                       \ rS rSrS rSrg)GhostscriptError   c                 N    [         R                  U [        U5      5        Xl        g N)	Exception__init__
error2namecode)selfecodes     r   r%   GhostscriptError.__init__   s    4E!23	r   )r'   N)r   r   r   r   r%   r   r   r   r   r    r       s    r   r    c                      [        5       n [        R                  [        U 5      [	        U 5      5      nU(       a  [        SU-  5      eU $ )z
Get version numbers and strings.

This is safe to call at any time.
You should call this first to make sure that the correct version
of the Ghostscript is being used.

Returns a Revision instance
z7Revision structure size is incorrect, requires %s bytes)r   libgsgsapi_revisionpointersizeofArgumentError)r   rcs     r   r   r      sI     zH			gh/1A	BB	 0245 6 	6Or   c                  ~    Sn [        5       n[        R                  [        U5      U 5      nUS:w  a  [	        U5      eU$ )z\
Create a new instance of Ghostscript

This instance is passed to most other API functions.
Nr   )gs_main_instancer,   gsapi_new_instancer.   r    )display_callbackinstancer1   s      r   new_instancer7      sA     !H		!	!'("35E	FB	Qwr""Or   c                 ,    [         R                  U 5      $ )z
Destroy an instance of Ghostscript

Before you call this, Ghostscript must have finished.
If Ghostscript has been initialised, you must call exit()
before delete_instance()
)r,   gsapi_delete_instance)r6   s    r   delete_instancer:      s     &&x00r   c                 &   ^  U 4S jn[        U5      $ )z
Wrap a filehandle into a C function to be used as `stdin` callback
for ``set_stdio``. The filehandle has to support the readline() method.
c                    >  TR                  U5      nU(       d  SnU$ [        U5      n[        U[        U5      U5         U$ !   Sn U$ = f)Nr   )readlinelenmemmover   )r6   destcountdatainfps       r   _wrap_wrap_stdin.<locals>._wrap   sZ    		5=='D   D	htne4	E s   A A
c_stdstream_call_t)rD   rE   s   ` r   _wrap_stdinrI      s     e$$r   c                 &   ^  U 4S jn[        U5      $ )z
Wrap a filehandle into a C function to be used as `stdout` or
`stderr` callback for ``set_stdio``. The filehandle has to support the
write() and flush() methods.
c                 P   > TR                  US U 5        TR                  5         U$ r#   )writeflush)r6   strrB   outfps      r   rE   _wrap_stdout.<locals>._wrap   s#    CK r   rG   )rO   rE   s   ` r   _wrap_stdoutrQ      s    
 e$$r   c                 j    [         R                  XX#5      nUS[        [        4;  a  [	        U5      eU$ )aF  
Set the callback functions for stdio.

``stdin``, ``stdout`` and ``stderr`` have to be ``ctypes``
callback functions matching the ``_gsprint.c_stdstream_call_t``
prototype. You may want to use _wrap_* to wrap file handles.

Note 1: This function only changes stdio of the Postscript
interpreter, not that of the devices.

Note 2: Make sure you keep references to C function objects
as long as they are used from C code. Otherwise they may be
garbage collected, crashing your program when a callback is made.

The ``stdin`` callback function should return the number of
characters read, `0` for EOF, or `-1` for error. The `stdout` and
`stderr` callback functions should return the number of characters
written.

You may pass ``None`` for any of stdin, stdout or stderr , in which
case the system stdin, stdout resp. stderr will be used.
r   )r,   gsapi_set_stdioe_Quite_Infor    )r6   stdinstdoutstderrr1   s        r   	set_stdiorY      s5    . 
		x	?B	!VV$$r""Ir   c                     U[         [        [        4;   d   e[        R	                  U [        U5      5      nUS:  a  [        U5      eU$ Nr   )ARG_ENCODING_LOCALARG_ENCODING_UTF8ARG_ENCODING_UTF16LEr,   gsapi_set_arg_encodingc_intr    )r6   encodingr1   s      r   set_arg_encodingrb     sQ       
 
	%	%hh	@B	Avr""Ir   c                     [         [        U5      -  nU" U6 n[        R                  U [        U5      U5      nUS[        4;  a  [        U5      eU$ )uA  
Initialise the interpreter.

1. If quit or EOF occur during init_with_args(), the return value
   will be e_Quit. This is not an error. You must call exit() and
   must not call any other functions.

2. If usage info should be displayed, the return value will be
   e_Info which is not an error. Do not call exit().

3. Under normal conditions this returns 0. You would then call one
   or more run_*() functions and then finish with exit()

Please note that the first element of ``argv`` must be the
program-name, e.g.
``init_with_args(myinstance, ["text2pdf", "-q", …])``
r   )r   r?   r,   gsapi_init_with_argsrU   r    )r6   argvArgArrayc_argvr1   s        r   init_with_argsrh     sO    $ #d)#Ht_F		#	#Hc$i	@B	!Vr""Ir   c                 R    [         R                  U 5      nUS:w  a  [        U5      eU$ )z~
Exit the interpreter

This must be called on shutdown if init_with_args() has been
called, and just before delete_instance()
r   )r,   
gsapi_exitr    )r6   r1   s     r   exitrk   1  s+     
		(	#B	Qwr""Ir   c                     U(       a  SOSn[        5       n[        R                  U [        U5      [        U5      5      nUS:w  a  [	        U5      eUR
                  $ Nr=   r   )r`   r,   gsapi_run_string_beginr.   r    valuer6   user_errors	exit_coder1   s       r   run_string_beginrs   >  sO    #"KI		%	%hk0B&-i&8
:B	Qwr""??r   c           	         U(       a  SOSn[        5       n[        R                  U [        U5      [        [	        U5      5      [        U5      [        U5      5      nU[        :w  a  US:w  a  [        U5      eUR                  $ rm   )	r`   r,   gsapi_run_string_continuer   r?   r.   e_NeedInputr    ro   r6   rN   rq   rr   r1   s        r   run_string_continuerx   H  si    #"KI		(	((3-s3xkGI.
0B 
[R1Wr""??r   c                     U(       a  SOSn[        5       n[        R                  U [        U5      [        U5      5      nUS:w  a  [	        U5      eUR
                  $ rm   )r`   r,   gsapi_run_string_endr.   r    ro   rp   s       r   run_string_endr{   S  sO    #"KI		#	#HeK.@$+I$6
8B	Qwr""??r   c                      [        S5      e)NzUse run_string() instead)NotImpelmentedError)argskws     r   run_string_with_lengthr   ]  s    
8
99r   c           	          U(       a  SOSn[        5       n[        R                  U [        U5      [        [	        U5      5      [        U5      [        U5      5      nUS:w  a  [        U5      eUR                  $ rm   )r`   r,   gsapi_run_string_with_lengthr   r?   r.   r    ro   rw   s        r   
run_stringr   a  sb    #"KI		+	+(3-s3xkGI.
0B 
Qwr""??r   c                     U(       a  SOSn[        5       n[        R                  U [        U5      [        U5      [	        U5      5      nUS:w  a  [        U5      eUR                  $ rm   )r`   r,   gsapi_run_filer   r.   r    ro   )r6   filenamerq   rr   r1   s        r   run_filer   l  sW    #"KI			h(:#K0')2D
FB	Qwr""??r   c                     [         er#   )NotImplementedError)Is    r   set_visual_tracerr   v  s    
r   c                   l    \ rS rSrS\4S\4S\4S\4S\4S\4S\4S	\	4S
\
4S\4S\4S\4S\4S\4/rSrg)Display_callback_si  sizeversion_majorversion_minordisplay_opendisplay_preclosedisplay_closedisplay_presizedisplay_sizedisplay_syncdisplay_pagedisplay_updatedisplay_memallocdisplay_memfreedisplay_separationr   N)r   r   r   r   r`   c_display_openc_display_preclosec_display_closec_display_presizec_display_sizec_display_syncc_display_pagec_display_updatec_display_memallocc_display_memfreec_display_separationr   r   r   r   r   r   r     s    
 

 
%  
% 	(	/0	/*	-.	(	(	(	+,	/0	-.	347Hr   r   c                 R    [         R                  X5      nUS:w  a  [        U5      eU$ r[   )r,   gsapi_set_display_callbackr    )r6   callbackr1   s      r   set_display_callbackr     s)    		)	)(	=B	Qwr""Ir   c                    ^ SS K n SS KmSSKJnJnJnJnJnJn  U4S jn/ nS H  n	 U" USU	-  5      n
[        SU" U
5      S   5       Hc  nU" X5      n U" X5      nU" US5      S   nU" U5        U R                  R                  U5      (       a  UR                  U" U5      U45        Mc  Me     U" U
5        M     U(       a  UR                  5         US   S   $ g ! [         a     M  f = f! [         a     M  f = f)Nr   )OpenKeyCloseKeyEnumKeyQueryValueExQueryInfoKeyHKEY_LOCAL_MACHINEc                   > TR                  STR                  5      nUR                  U 5       Vs/ s H  o"(       d  M  US:w  d  M  UPM     nn[        U5       H  u  pE [	        U5      X4'   M     U$ s  snf ! [
         a     M+  f = f)Nz(\d+ | [a-z]+ | \.).)compileVERBOSEsplit	enumerateint
ValueError)vstringcomponent_rex
componentsiobjres         r   looseVersion%__win32_finddll.<locals>.looseVersion  s    zz"8"**E!-!3!3G!<O!<Aaa3ha!<
O
+FA #C
 ,
  P  s"   
A3A3A3 A88
BB)zAFPL GhostscriptzAladdin GhostscriptzGPL GhostscriptzGNU GhostscriptzSoftware\%sGS_DLLr=   )osr   winregr   r   r   r   r   r   rangepathexistsappendWindowsErrorsort)r   r   r   r   r   r   r   r   dllskey_namek1numversionk2dll_pathr   s                  @r   __win32_finddllr     s   ) )	 D;	+^h-FGBQR 0 34!"* -B+B9!<HRLww~~h//\'%:H$EF 0 5 RL;" 		Bx| $   		s6   ,C-AC*C-
C*&C-)C**C--
C;:C;win32z(Can not find Ghostscript DLL in registryzlibgs.sogsz(Can not find Ghostscript library (libgs))F)m__doc__
__author____copyright____licence____version__ctypessys_errorsMAX_STRING_LENGTHr\   r]   r^   DISPLAY_VERSION_MAJORDISPLAY_VERSION_MINORDISPLAY_VERSION_MAJOR_V1DISPLAY_VERSION_MINOR_V1DISPLAY_COLORS_NATIVEDISPLAY_COLORS_GRAYDISPLAY_COLORS_RGBDISPLAY_COLORS_CMYKDISPLAY_COLORS_SEPARATIONDISPLAY_COLORS_MASKDISPLAY_ALPHA_NONEDISPLAY_ALPHA_FIRSTDISPLAY_ALPHA_LASTDISPLAY_UNUSED_FIRSTDISPLAY_UNUSED_LASTDISPLAY_ALPHA_MASKDISPLAY_DEPTH_1DISPLAY_DEPTH_2DISPLAY_DEPTH_4DISPLAY_DEPTH_8DISPLAY_DEPTH_12DISPLAY_DEPTH_16DISPLAY_DEPTH_MASKDISPLAY_BIGENDIANDISPLAY_LITTLEENDIANDISPLAY_ENDIAN_MASKDISPLAY_TOPFIRSTDISPLAY_BOTTOMFIRSTDISPLAY_FIRSTROW_MASKDISPLAY_NATIVE_555DISPLAY_NATIVE_565DISPLAY_555_MASKDISPLAY_ROW_ALIGN_DEFAULTDISPLAY_ROW_ALIGN_4DISPLAY_ROW_ALIGN_8DISPLAY_ROW_ALIGN_16DISPLAY_ROW_ALIGN_32DISPLAY_ROW_ALIGN_64DISPLAY_ROW_ALIGN_MASK	Structurer   c_void_pr3   r5   r$   r    r   r7   r:   	CFUNCTYPEr`   POINTERc_charrH   rI   rQ   _wrap_stderrrY   rb   rh   rk   rs   rx   r{   r   r   r   r   r   r   r   c_uintr   c_ubyter   r   r   r   c_ulongr   r   r   c_ushortr   r   r   r   platformr,   RuntimeErrorwindllLoadLibrarycdllOSErrorctypes.utilutilfind_libraryr   r   r   <module>r     s}  . =
V=  
          $ # # # $  
            
         " 
     %        # 
y 
   y $1 u&6O %,% @	4
: 5(H5
 uh9 
 E8X6 eXx	5%!  5(H	5%!13
 5(H5
 5(H	5 UHh	5%   x8WE 
 eXxB & !(	8Xx8= ) @)X <<7EEFFu%E (  ,   (((.IJJ  '(s   ,F? ?AHH