+
     h"R  c                   s,   R t ^ RIHtHtHtHt ^ RIHt ^ RIH	t	H
t
HtHtHtHtHtHtHt  ^ RIHtHt ]]utt]R,          t]R8H  t]R8X  d   RMR	t]P5                  4       t^]^,          ,           t]'       d   R
M]! 4       tR]^,          ]3,          tR tR.R lt Rt!]]!3R lt"]! ]PF                  4       ]]PH                  n%        ]]P4                  n%        ]]! ]4      ]! ]4      ]! ]4      ]! ]4      ]! ]	4      ]! ]4      ]3]PL                  n'        ]]! ]4      ]! ]4      ]! ]4      ]! ]4      ]! ]	4      ]! ]4      ]! ]4      ]! ]4      ]! ]4      ]3]PP                  n'        ]]! ]4      ]! ]4      ]! ]4      ]! ]4      ]! ]	4      ]! ]4      ]3]PR                  n'        ]]! ]4      ]! ]4      ]! ]4      ]! ]4      ]! ]	4      ]! ]4      ]! ]4      ]! ]4      ]! ]4      ]3]PT                  n'        ]]! ]4      ]]! ]4      ]3]PV                  n'        ]3]PX                  n'        ]]3]PZ                  n'        ]]3]P\                  n'        ]]! ]4      ]! ]4      ]]3]P^                  n'        ]]! ]4      ]! ]4      ]]3]P`                  n'        ]! R]]4      t1R]Pd                  n%        R]Pf                  n%        ]3]Pf                  n'        R t4R t5R/R lt6R0R lt7R/R lt8R0R lt9R1R lt:R t;R t<R t=R t>R1R lt?R t@R tA^ tB^;tC;tDtE^;tF;tGtH^;tI;tJtK^tL^tM^ tN^@tO^tPRtQR tRR!tSR"tTR#tU^tV^tW^tX^ tY^@tZ^t[][t\Rt]^ t^R$t_R%t`R&taR'tbR(tcR)td]^]_]`]a]b]c]d3te]fR*8X  d"   ]g! ]4! 4       4       ]g! ]6! R+.R,^R-7      4       R# R#   ] d
    ]]
utt ELYi ; i)2a  Liblouis Python ctypes bindings
These bindings allow you to use the liblouis braille translator and back-translator library
from within Python.
This documentation is only related to the Python helper.
Please see the liblouis documentation for more information.

Most of these functions take a C{tableList}      argument which specifies
a list of translation tables to use. Please see the liblouis documentation
concerning the C{tableList} parameter to the C{lou_translateString}
function for information about how liblouis searches for these tables.

@author: Michael Curran <mick@kulgan.net>
@author: James Teh <jamie@jantrid.net>
@author: Eitan Isaacson <eitan@ascender.com>
@author: Michael Whapples <mwhapples@aim.com>
@author: Davy Kager <mail@davykager.nl>
@author: Leonard de Ruijter <alderuijter@gmail.com>
@author: Babbage B.V. <info@babbage.com>
@author: Andre-Abush Clause <dev@andreabc.net>
)	byteordergetfilesystemencodingplatformversion_info)register)	c_ushort	CFUNCTYPEcdllc_char_pc_charc_intPOINTERbyrefcreate_string_buffer)WINFUNCTYPEwindllzliblouis.so.20Zwin32ZbigZbeZleZmbcsz	utf_%d_%sc           	     s    RP                  V  Uu. uF9  p\        V\        4      '       d   VP                  \        4      M
\        V4      NK;  	  up4      # u upi )z*Creates a tables string for liblouis callss   ,)Zjoin
isinstancestrencodefileSystemEncodingbytes)Z
tablesListx   & 3/usr/lib/python3.14/site-packages/louis/__init__.py_createTablesStringr   V   sT    99  	
 -7q#,>,>AHH'(E!HL	
 	
s   ?ANc                sX    V'       d   \         V ,          ! V!  # \         V ,          ! 4       # )z,Creates a typeform buffer for liblouis calls)r   )lengthtypeforms   &&r   _createTypeformbufr   `   s!    -5Hv)PHv<M;PP    Zsurrogatepassc                 s6    \        V 4      P                  W4      # N)r   r   )r   Zencodingerrorss   &&&r   createEncodedByteStringr   h   s     q6==**r   c                 sH    \         P                  4       P                  R4      # )zObtain version information for liblouis.
@return: The version of liblouis, plus other information, such as
    the release date and perhaps notable changes.
@rtype: str
ASCII)liblouislou_versiondecode r   r   versionr%      s     !((11r   c                 s*    \         P                  4       # )zzObtain charSize information for liblouis.
@return: The size of the widechar with which liblouis was compiled.
@rtype: int
)r!   lou_charSizer$   r   r   charSizer'      s    
   ""r   c                s   \        V 4      p\        V4      p\        \        V4      \        ,          4      p\        VP
                  \        ,          4      p\        VP
                  \        ,          4      pRp	V'       d   \        VP
                  V4      p	\        VP
                  ,          ! 4       p
\        VP
                  ,          ! 4       p\        V4      p\        P                  VV\        V4      V\        V4      V	RVV
\        V4      V4      '       g    \        RV : RV: RV: RV: RV: 2
4      h\        V\        4      '       d   \        V	4      VR&   VP                  RVP
                  \        ,           P!                  \"        \$        R7      V
RVP
                   VRVP
                   VP
                  3# )	a  Translate a string of characters, providing position information.
@param tableList: A list of translation tables.
@type tableList: list of str
@param inbuf: The string to translate.
@type inbuf: str
@param typeform: A list of typeform constants indicating the typeform for each position in inbuf,
    C{None} for no typeform information.
@type typeform: list of int
@param cursorPos: The position of the cursor in inbuf.
@type cursorPos: int
@param mode: The translation mode; add multiple values for a combined mode.
@type mode: int
@return: A tuple of: the translated string,
    a list of input positions for each position in the output,
    a list of output positions for each position in the input, and
    the position of the cursor in the output.
@rtype: (str, list of int, list of int, int)
@raise RuntimeError: If a complete translation could not be done.
@see: lou_translate in the liblouis documentation
NCan't translate: tables , inbuf , typeform z, cursorPos , mode NNNr   )r   r   r
   lenwideCharBytesvalueoutlenMultiplierr   r   r!   lou_translater   RuntimeErrorr   listrawr#   conversionEncodingENCODING_ERROR_HANDLER	tableListinbufr   	cursorPosmodetablesStringinlenoutlenoutbuftypeformbufZinPosZoutPos   &&&&&       r   	translaterC      sp   * 'y1L#E*E#e*-.E5;;!112F!&,,">?FK(x@V\\!$Eekk!$Fi I!!efi  %9d<
 	
 (D!!;'

1V\\M1299'= 	: 	
 	n} r   c           
     s   \        V 4      p\        V4      p\        \        V4      \        ,          4      p\        VP
                  \        ,          4      p\        VP
                  \        ,          4      pRpV'       d   \        VP
                  V4      p\        P                  VV\        V4      V\        V4      VRV4      '       g   \        RV : RV: RV: RV: 24      h\        V\        4      '       d   \        V4      VR&   VP                  RVP
                  \        ,           P!                  \"        \$        R7      # )aP  Translate a string of characters.
@param tableList: A list of translation tables.
@type tableList: list of str
@param inbuf: The string to translate.
@type inbuf: str
@param typeform: A list of typeform constants indicating the typeform for each position in inbuf,
    C{None} for no typeform information.
@type typeform: list of int
@param mode: The translation mode; add multiple values for a combined mode.
@type mode: int
@return: The translated string.
@rtype: str
@raise RuntimeError: If a complete translation could not be done.
@see: lou_translateString in the liblouis documentation
Nr(   r)   r*   r+   r,   r-   )r   r   r
   r.   r/   r0   r1   r   r   r!   lou_translateStringr   r3   r   r4   r5   r#   r6   r7   	r9   r:   r   r<   r=   r>   r?   r@   rA   	   &&&&     r   translateStringrG     s
     'y1L#E*E#e*-.E5;;!112F!&,,">?FK(x@''ef	 	 %41
 	
 (D!!;'::4}45<<#9 =  r   c                s   \        V 4      p\        V4      p\        \        V4      \        ,          4      p\        VP
                  \        ,          4      p\        VP
                  \        ,          4      pRp	\        V\        4      '       d   \        VP
                  4      p	\        VP
                  ,          ! 4       p
\        VP
                  ,          ! 4       p\        V4      p\        P                  VV\        V4      V\        V4      V	RVV
\        V4      V4      '       g   \        RWW#V3,          4      h\        V\        4      '       d   \        V	4      VR&   VP                  RVP
                  \        ,           P!                  \"        \$        R7      V
RVP
                   VRVP
                   VP
                  3# )a  Back translates a string of characters, providing position information.
@param tableList: A list of translation tables.
@type tableList: list of str
@param inbuf: Braille to back translate.
@type inbuf: str
@param typeform: List where typeform constants will be placed.
@type typeform: list
@param cursorPos: Position of cursor.
@type cursorPos: int
@param mode: Translation mode.
@type mode: int
@return: A tuple: A string of the back translation,
    a list of input positions for each position in the output,
    a list of the output positions for each position in the input and
    the position of the cursor in the output.
@rtype: (str, list of int, list of int, int)
@raise RuntimeError: If a complete back translation could not be done.
@see: lou_backTranslate in the liblouis documentation.
NzMCan't back translate: tables %s, inbuf %s, typeform %s, cursorPos %d, mode %dr,   r-   )r   r   r
   r.   r/   r0   r1   r   r   r4   r   r!   lou_backTranslater   r3   r5   r#   r6   r7   r8   rB   r   backTranslaterI   G  sz   ( 'y1L#E*E#e*-.E5;;!112F!&,,">?FK(D!!(6V\\!$Eekk!$Fi I%%efi  [d;<
 	
 (D!!;'

1V\\M1299'= 	: 	
 	n} r   c           
     s   \        V 4      p\        V4      p\        \        V4      \        ,          4      p\        VP
                  \        ,          4      p\        VP
                  \        ,          4      pRp\        V\        4      '       d   \        VP
                  4      p\        P                  VV\        V4      V\        V4      VRV4      '       g   \        RWV3,          4      h\        V\        4      '       d   \        V4      VR&   VP                  RVP
                  \        ,           P!                  \"        \$        R7      # )a  Back translate from Braille.
@param tableList: A list of translation tables.
@type tableList: list of str
@param inbuf: The Braille to back translate.
@type inbuf: str
@param typeform: List for typeform constants to be put in.
    If you don't want typeform data then give None
@type typeform: list
@param mode: The translation mode
@type mode: int
@return: The back translation of inbuf.
@rtype: str
@raise RuntimeError: If a complete back translation could not be done.
@see: lou_backTranslateString in the liblouis documentation.
Nz2Can't back translate: tables %s, inbuf %s, mode %dr,   r-   )r   r   r
   r.   r/   r0   r1   r   r   r4   r   r!   lou_backTranslateStringr   r3   r5   r#   r6   r7   rE   rF   r   backTranslateStringrK     s     'y1L#E*E#e*-.E5;;!112F!&,,">?FK(D!!(6++ef	 	 @&'
 	
 (D!!;'::4}45<<#9 =  r   c                s<   \        V 4      p\        V4      p\        \        V4      \        ,          4      p\        VP                  ^,           4      p\        P                  W1WEV4      '       g   \        RWV3,          4      hVP                  P                  R4      # )a  Get information for hyphenation.
@param tableList: A list of translation tables and hyphenation
    dictionaries.
@type tableList: list of str
@param inbuf: The text to get hyphenation information about.
    This should be a single word and leading/trailing whitespace
    and punctuation is ignored.
@type inbuf: str
@param mode: Lets liblouis know if inbuf is plain text or Braille.
    Set to 0 for text and anyother value for Braille.
@type mode: int
@return: A string with '1' at the beginning of every syllable
    and '0' elsewhere.
@rtype: str
@raise RuntimeError: If hyphenation data could not be produced.
@see: lou_hyphenate in the liblouis documentation.
z-Can't hyphenate: tables %s, inbuf %s, mode %dr    )r   r   r
   r.   r/   r   r0   r!   lou_hyphenater3   r#   )r9   r:   r<   r=   r>   Zhyphen_string   &&&   r   	hyphenaterN     s    $ 'y1L#E*E#e*-.E(q9M!!,uTRR;yQU>VV
 	
 %%g..r   c                sv    \        V 4      p\        P                  V4      '       g   \        RV ,          4      hR# )a{  Check if the specified tables can be found and compiled.
    This can be used to check if a list of tables contains errors
    before sending it to other liblouis functions
    that accept a list of tables.
@param tableList: A list of translation tables.
@type tableList: list of str
@raise RuntimeError: If compilation failed.
@see: lou_checkTable in the liblouis documentation
zCan't compile: tables %sN)r   r!   lou_checkTabler3   )r9   r=   r   r   
checkTablerP     s5     'y1L""<005	ABB 1r   c                s    \        V 4      p\        V\        4      '       d   VP                  R4      M
\	        V4      p\
        P                  W#4      '       g   \        RV : RV: 24      hR# )a,  Compile a table entry on the fly at run-time.
@param tableList: A list of translation tables.
@type tableList: list of str
@param inString: The table entry to be added.
@type inString: str
@raise RuntimeError: If compilation of the entry failed.
@see: lou_compileString in the liblouis documentation
r    zCan't compile entry: tables z, inString N)r   r   r   r   r   r!   lou_compileStringr3   )r9   ZinStringr=   ZinBytess   &&  r   compileStringrR     sY     'y1L*4Xs*C*Choog&xG%%l<<=FQ
 	
 =r   c                sd    \        V 4      pVP                  R4      p\        P                  W!4      # )zGet the typeform bit for the named emphasis class.
@param tableList: A list of translation tables.
@type tableList: list of str
@param emphClass: An emphasis class name.
@type emphClass: str
@see: lou_getTypeformForEmphClass in the liblouis documentation
r    )r   r   r!   lou_getTypeformForEmphClass)r9   Z	emphClassr=   s   && r   getTypeformForEmphClassrT     s/     'y1L  )I//HHr   c                s   \        V 4      p\        V4      p\        \        V4      \        ,          4      p\        VP                  \        ,          4      p\        P                  W!WC^ 4      '       g   \        RV : RV: 24      hVP                  RVP                  \        ,           P                  \        \        R7      # )a  "Convert a string of dot patterns to a string of characters according to the specifications in tableList.
@param tableList: A list of translation tables.
@type tableList: list of str
@param inbuf: a string of dot patterns, either in liblouis format or Unicode braille.
@type inbuf: str
@raise RuntimeError: If a complete conversion could not be done.
@see: lou_dotsToChar in the liblouis documentation
z#Can't convert dots to char: tables r)   Nr-   )r   r   r
   r.   r/   r   r0   r!   lou_dotsToCharr3   r5   r#   r6   r7   )r9   r:   r=   r   r@   s   &&   r   
dotsToCharrV     s     'y1L#E*E3u:./F!&,,">?F""<JJAJER
 	
 ::4}45<<#9 =  r   c                s   \        V 4      p\        V4      p\        \        V4      \        ,          4      p\        VP                  \        ,          4      p\        P                  W1WTV4      '       g   \        RWV3,          4      hVP                  RVP                  \        ,           P                  \        \        R7      # )a  "Convert a string of characterss to a string of dot patterns according to the specifications in tableList.
@param tableList: A list of translation tables.
@type tableList: list of str
@param inbuf: a string of characters.
@type inbuf: str
@param mode: The translation mode; add multiple values for a combined mode.
@type mode: int
@raise RuntimeError: If a complete conversion could not be done.
@see: lou_charToDots in the liblouis documentation
z8Can't convert char to dots: tables %s, inbuf %s, mode %dNr-   )r   r   r
   r.   r/   r   r0   r!   lou_charToDotsr3   r5   r#   r6   r7   )r9   r:   r<   r=   r   r@   rM   r   
charToDotsrX     s     'y1L#E*E3u:./F!&,,">?F""<MMF&'
 	
 ::4}45<<#9 =  r   c                s    V e?   \        V \        4      '       g)   \        RP                  \        P                  4      4      h\
        P                  V 4      # )aD  Register logging callbacks.
Set to C{None} for default callback.
@param logCallback: The callback to use.
    The callback must take two arguments:
    @param level: The log level on which a message is logged.
    @type level: int
    @param message: The logged message.
        Note that the callback should provide its own ASCII decoding routine.
    @type message: bytes

    Example callback:

    @louis.LogCallback
    def incomingLouisLog(level, message):
        print("Message %s logged at level %d" % (message.decode("ASCII"), level))

@type logCallback: L{LogCallback}
z,logCallback should be of type {} or NoneType)r   LogCallbackZ	TypeErrorZformat__name__r!   lou_registerLogCallback)ZlogCallback   &r   registerLogCallbackr]   )  sJ    & z+{'K'K:AA+BVBVW
 	
 ++K88r   c                sf    V \         9  d   \        RV ,          4      h\        P                  V 4      # )zSet the level for logging callback to be called at.
@param level: one of the C{LOG_*} constants.
@type level: int
@raise ValueError: If an invalid log level is provided.
z Level %d is an invalid log level)	logLevelsZ
ValueErrorr!   lou_setLogLevel)Zlevelr\   r   setLogLevelr`   C  s.     I;eCDD##E**r   i   i   i   i   i   i'  i N  i0u  i@  iP  i`  Z__main__s   ../tables/en-us-g2.ctbzHello world!)r;   r   )N    ra   )Nra   )ra   )hZ__doc__Zsysr    r   r   r   Zatexitr   Zctypesr   r   r   r   r	   r
   r   r   r   r   r   Z_loaderZ	_functypeZImportErrorr!   Z_is_windowsZ_endiannessr&   r/   r1   r   r6   r   r   r7   r   Zlou_freer"   ZrestyperD   Zargtypesr2   rJ   rH   rL   rO   rQ   rS   rU   rW   rY   r[   r_   r%   r'   rC   rG   rI   rK   rN   rP   rR   rT   rV   rX   r]   r`   Z
plain_textZemph_1Zcomp_emph_1ZitalicZemph_2Zcomp_emph_2Z	underlineZemph_3Zcomp_emph_3ZboldZemph_4Zemph_5Zemph_6Zemph_7Zemph_8Zemph_9Zemph_10Zcomputer_brailleZno_translateZno_contractZnoContractionsZcompbrlAtCursorZdotsIOZcompbrlLeftCursorZucBrlZnoUndefinedZnoUndefinedDotsZpartialTransZLOG_ALLZ	LOG_DEBUGZLOG_INFOZLOG_WARNZ	LOG_ERRORZ	LOG_FATALZLOG_OFFr^   rZ   Zprintr$   r   r   <module>rb      s{  ** I H 
 
 
)*GY #$'!5(dd %%' }q((   +V0E0G  !MA$5{#CC Q
 )  #+A+ 			 '    %    FOENFOENHFO		)   % FOENFOENHFOENENEN	#    FOENFOENHFO		-     ) FOENFOENHFOENENEN	'   # FO	FO	#    %-;    '/&:   #1980D $ $ - FOFO		$     FOFO		$     eX.+/     (#'    %*H   !2#:z*Z9x*Z/:C
"
I,294+ 
 & & &v#) ) )y$ $ $t						
  	
 
 			
 i8Y	7S	z	')	)./1
MN w  )yGY)s   N NN