# This file belongs to the CEP package | Ten plik nale/zy do pakietu CEP
# This package is public domain | Pakiet stanowi dobro powszechne
# For more info see `0CEP_LIC.ENG' | Wi/ecej informacji w ,,0CEP_LIC.POL''
# ===========================================================================
# E: "CEP filtered EPS" --> "EPS" converter
# input - input file name
# OUTF - output file name
# TMPSX - temporary PostScript file name
#
# P: Konwerter "CEP filtered EPS" --> "EPS"
# wej/scie - nazwa pliku konwertowanego
# OUTF - nazwa pliku wyj/sciowego
# TMPSX - nazwa tymczasowego pliku PostScriptowego
BEGIN {# preparing temporary files | przygotowywanie plik/ow tymczasowych
ver_no=1.03
gs_abort="2 2 .quit"
chop_EOD=1
if (TMPSX=="") TMPSX="tmp.psx"
flag="begin"
}
# check carefully whether the file to be processed was created by CEP
# sprawd/xmy staranne czy mamy do czynienia z plikiem stworzonym przez CEP-a
{l=$0 "\n"} # l is a candidate for a prolog line
flag~"begin" && /^%%Creator: CEP/ {flag="cep"; l=""} # ignore CEP comment
flag~"cep" && /^%UNCEPInfo:/ && NF==5 {
# store CEP data, ignore CEP comment
pre_lines=0+$2; buff_num=0+$3; buff_len=0+$4; pos_lines=0+$5
flag="uncep"; l=""
}
flag~"uncep" && /^\/_fltrd_file currentfile .+ \/_read_string .+ def$/ {
# store CEP decoding scheme, ignore CEP line
decodeline=$0; flag="good"; l=""
}
{prolog=prolog l} # lengthen prolog
flag!~"uncep|good" && /^[^%]/ {exit} # emergency exit (CEP comment not found
# in DSC comment block)
flag~"uncep|good" && NR==pre_lines {exit} # exit after prolog
END {
# error handling | obs/luga b/l/ed/ow
if (flag!~"good") errmessage("not a CEP file",1)
if (!is_A85() && !is_HEX())
errmessage("CEP file was modified (strange coding), can't uncompress",4)
printf "UNCEP ver. " ver_no ", decoding:"
if (is_A85()) printf " A85"
if (is_HEX()) printf " Hex"
if (is_LZW()) printf ", LZW"
if (is_RLE()) printf ", RLE"
if (is_ZIP()) printf ", Flate"
print ""
if (gsub(/_fltrd_file/,"currentfile",prolog)==0)
errmessage("CEP file was modified, can't uncompress",4)
if (gsub(/_read_string/,"readhexstring",prolog)==0)
errmessage("CEP file was modified, can't uncompress",4)
gsub(/%/,"%%",prolog) # neutralizing printf | podmiana dla printf