ASCII85 エンコーダ & デコーダ
- 自前で base85 エンコーディングを書きたくないとき
- PostScript で Helloworldless Hello world を書く必要に迫られたとき
などにご利用ください。
エンコーダ
#!/bin/sh exec gs -q -dNODISPLAY -dBATCH -D#!="{2{currentfile 128 string readline pop pop}repeat}" -- $0 "$@" /in (%stdin)(r)file def /out (%stdout)(w)file /ASCII85Encode filter def { in read{ out exch write }{ exit }ifelse }loop out closefile in closefile
デコーダ
#!/bin/sh exec gs -q -dNODISPLAY -dBATCH -D#!="{2{currentfile 128 string readline pop pop}repeat}" -- $0 "$@" /in (%stdin)(r)file /ASCII85Decode filter def /out (%stdout)(w)file def { in read{ out exch write }{ exit }ifelse }loop out closefile in closefile