Default
Google

LOGICALな文章を、VISUALに表示するためのプログラムを示します。

双方向アルゴリズムや、その元ネタのhttp://www.unicode.org/unicode/reports/tr9/を元に、perl scriptを起こしてみました(かなり簡略化しています)。

使用方法

このファイル名をhtrans.plとした場合、使用方法です(perl5以上で確かめました)。

perl htrans.pl stdin < xxxxx.txt

このxxxxx.txtは、LOGICALな文章を保管しているファイルです。

ないしは、packageとして使用できます。

require 'htrans.pl';                                                 
$out=&htrans'htrans($intext,$edir,$mode,$fcou);                      
INPUTs                                                               
  $intext : input text                                               
  $edir   : default direction, L is left-to-right,                   
            R or others is/are right-to-left                         
  $mode   : reserved (it'll be, VtoL is Visual to Losical,           
                      LtoV or others is/are Logical to Visual)       
  $fcou   : reserved (folding charactor count)                       
OUTPUT                                                               
  $out : output text                                                 

注意

  1. Unicodeの文字セットは使用していません。
  2. かなり簡略化しているので、忠実では有りません。
  3. デバッグはちゃんとしていません。
  4. サポートはしません(というより、できません)。

本体

これがhtrans.plのソースです。



Acquiring image from ProHosting Banner Exchange