% This is a pdftex compatibility file. We could use \ifprimitive instead.

\begingroup

\catcode`\{ = 1 % left  brace is begin-group character
\catcode`\} = 2 % right brace is end-group   character

\ifdefined\pdfextension

    % promoted

    \global\let\pdfpagewidth      \pagewidth
    \global\let\pdfpageheight     \pageheight

    \global\let\pdfadjustspacing  \adjustspacing
    \global\let\pdfprotrudechars  \protrudechars
    \global\let\pdfnoligatures    \ignoreligaturesinfont
    \global\let\pdffontexpand     \expandglyphsinfont
    \global\let\pdfcopyfont       \copyfont

    \global\let\pdfxform          \saveboxresource
    \global\let\pdflastxform      \lastsavedboxresourceindex
    \global\let\pdfrefxform       \useboxresource

    \global\let\pdfximage         \saveimageresource
    \global\let\pdflastximage     \lastsavedimageresourceindex
    \global\let\pdflastximagepages\lastsavedimageresourcepages
    \global\let\pdfrefximage      \useimageresource

    \global\let\pdfsavepos        \savepos
    \global\let\pdflastxpos       \lastxpos
    \global\let\pdflastypos       \lastypos

    \global\let\pdftexversion     \luatexversion
    \global\let\pdftexrevision    \luatexrevision
    \global\let\pdftexbanner      \luatexbanner

    \global\let\pdfoutput         \outputmode
    \global\let\pdfdraftmode      \draftmode

    \global\let\pdfpxdimen        \pxdimen

    \global\let\pdfinsertht       \insertht

    % also promoted

  % \global\let\pdfnormaldeviate  \normaldeviate
  % \global\let\pdfuniformdeviate \uniformdeviate
  % \global\let\pdfsetrandomseed  \setrandomseed
  % \global\let\pdfrandomseed     \randomseed
  %
  % \let\pdfprimitive      \primitive
  %
  % \global\let\expandafter\csname    ifpdfabsnum\expandafter\endcsname\csname    ifabsnum\endcsname
  % \global\let\expandafter\csname    ifpdfabsdim\expandafter\endcsname\csname    ifabsdim\endcsname
  % \global\let\expandafter\csname ifpdfprimitive\expandafter\endcsname\csname ifprimitive\endcsname

    % removed (also some others but already long ago)

    \ifdefined\newdimen
        \newdimen\pdfeachlineheight
        \newdimen\pdfeachlinedepth
        \newdimen\pdflastlinedepth
        \newdimen\pdffirstlineheight
        \newdimen\pdfignoreddimen
    \fi

    % commands

    \protected\gdef\pdfliteral              {\pdfextension literal}
    \protected\gdef\pdfcolorstack           {\pdfextension colorstack}
    \protected\gdef\pdfsetmatrix            {\pdfextension setmatrix}
    \protected\gdef\pdfsave                 {\pdfextension save\relax}
    \protected\gdef\pdfrestore              {\pdfextension restore\relax}
    \protected\gdef\pdfobj                  {\pdfextension obj }
    \protected\gdef\pdfrefobj               {\pdfextension refobj }
    \protected\gdef\pdfannot                {\pdfextension annot }
    \protected\gdef\pdfstartlink            {\pdfextension startlink }
    \protected\gdef\pdfendlink              {\pdfextension endlink\relax}
    \protected\gdef\pdfoutline              {\pdfextension outline }
    \protected\gdef\pdfdest                 {\pdfextension dest }
    \protected\gdef\pdfthread               {\pdfextension thread }
    \protected\gdef\pdfstartthread          {\pdfextension startthread }
    \protected\gdef\pdfendthread            {\pdfextension endthread\relax}
    \protected\gdef\pdfinfo                 {\pdfextension info }
    \protected\gdef\pdfcatalog              {\pdfextension catalog }
    \protected\gdef\pdfnames                {\pdfextension names }
    \protected\gdef\pdfincludechars         {\pdfextension includechars }
    \protected\gdef\pdffontattr             {\pdfextension fontattr }
    \protected\gdef\pdfmapfile              {\pdfextension mapfile }
    \protected\gdef\pdfmapline              {\pdfextension mapline }
    \protected\gdef\pdftrailer              {\pdfextension trailer }
    \protected\gdef\pdfglyphtounicode       {\pdfextension glyphtounicode }

    \chardef\pdfnofullbanner   =   1
    \chardef\pdfnofilename     =   2
    \chardef\pdfnopagenumber   =   4
    \chardef\pdfnoinfodict     =   8
    \chardef\pdfnocreator      =  16
    \chardef\pdfnocreationdate =  32
    \chardef\pdfnomoddate      =  64
    \chardef\pdfnoproducer     = 128
    \chardef\pdfnotrapped      = 256
    \chardef\pdfnoid           = 512

    % converted

    \gdef\pdftexversion       {\numexpr\pdffeedback version\relax}
    \gdef\pdftexrevision              {\pdffeedback revision}
    \gdef\pdflastlink         {\numexpr\pdffeedback lastlink\relax}
    \gdef\pdfretval           {\numexpr\pdffeedback retval\relax}
    \gdef\pdflastobj          {\numexpr\pdffeedback lastobj\relax}
    \gdef\pdflastannot        {\numexpr\pdffeedback lastannot\relax}
    \gdef\pdfxformname        {\numexpr\pdffeedback xformname\relax}
    \gdef\pdfcreationdate             {\pdffeedback creationdate}
    \gdef\pdffontname         {\numexpr\pdffeedback fontname\relax}
    \gdef\pdffontobjnum       {\numexpr\pdffeedback fontobjnum\relax}
    \gdef\pdffontsize         {\dimexpr\pdffeedback fontsize\relax}
    \gdef\pdfpageref          {\numexpr\pdffeedback pageref\relax}
    \gdef\pdfcolorstackinit           {\pdffeedback colorstackinit}

    % registers

    \xdef\pdfcompresslevel            {\pdfvariable compresslevel}
    \xdef\pdfobjcompresslevel         {\pdfvariable objcompresslevel}
    %xdef\pdfrecompress               {\pdfvariable recompress}
    \xdef\pdfdecimaldigits            {\pdfvariable decimaldigits}
    \xdef\pdfgamma                    {\pdfvariable gamma}
    \xdef\pdfimageresolution          {\pdfvariable imageresolution}
    \xdef\pdfimageapplygamma          {\pdfvariable imageapplygamma}
    \xdef\pdfimagegamma               {\pdfvariable imagegamma}
    \xdef\pdfimagehicolor             {\pdfvariable imagehicolor}
    \xdef\pdfimageaddfilename         {\pdfvariable imageaddfilename}
    \xdef\pdfpkresolution             {\pdfvariable pkresolution}
    \xdef\pdfinclusioncopyfonts       {\pdfvariable inclusioncopyfonts}
    \xdef\pdfinclusionerrorlevel      {\pdfvariable inclusionerrorlevel}
    \xdef\pdfgentounicode             {\pdfvariable gentounicode}
    \xdef\pdfomitcidset               {\pdfvariable omitcidset}
    \xdef\pdfomitcharset              {\pdfvariable omitcharset}
    \xdef\pdfomitinfodict             {\pdfvariable omitinfodict}
    \xdef\pdfomitmediabox             {\pdfvariable omitmediabox}
    \xdef\pdfomitprocset              {\pdfvariable omitprocset}
    \xdef\pdfptexprefix               {\pdfvariable ptexprefix}
    \xdef\pdfpagebox                  {\pdfvariable pagebox}
    \xdef\pdfmajorversion             {\pdfvariable majorversion}
    \xdef\pdfminorversion             {\pdfvariable minorversion}
    \xdef\pdfuniqueresname            {\pdfvariable uniqueresname}

    \xdef\pdfpkfixeddpi               {\pdfvariable pkfixeddpi}
    \xdef\pdfignoreunknownimages      {\pdfvariable ignoreunknownimages}

    \xdef\pdfhorigin                  {\pdfvariable horigin}
    \xdef\pdfvorigin                  {\pdfvariable vorigin}
    \xdef\pdflinkmargin               {\pdfvariable linkmargin}
    \xdef\pdfdestmargin               {\pdfvariable destmargin}
    \xdef\pdfthreadmargin             {\pdfvariable threadmargin}
    \xdef\pdfxformmargin              {\pdfvariable xformmargin}

    \xdef\pdfpagesattr                {\pdfvariable pagesattr}
    \xdef\pdfpageattr                 {\pdfvariable pageattr}
    \xdef\pdfpageresources            {\pdfvariable pageresources}
    \xdef\pdfxformattr                {\pdfvariable xformattr}
    \xdef\pdfxformresources           {\pdfvariable xformresources}
    \xdef\pdfpkmode                   {\pdfvariable pkmode}

    \xdef\pdfsuppressoptionalinfo     {\pdfvariable suppressoptionalinfo }
    \global\let\pdfsuppressptexinfo             \pdfsuppressoptionalinfo
    \xdef\pdftrailerid                {\pdfvariable trailerid }
    \xdef\pdfinfoomitdate             {\pdfvariable suppressoptionalinfo \numexpr32+64\relax}

    % initializations

    \global\pdfcompresslevel         9
    \global\pdfobjcompresslevel      1
    %global\pdfrecompress            0
    \global\pdfdecimaldigits         4
    \global\pdfgamma              1000
    \global\pdfimageresolution      72
    \global\pdfimageapplygamma       0
    \global\pdfimagegamma         2200
    \global\pdfimagehicolor          1
    \global\pdfimageaddfilename      1
    \global\pdfpkresolution         72
    \global\pdfinclusioncopyfonts    0
    \global\pdfinclusionerrorlevel   0
    \global\pdfgentounicode          0
  % \global\pdfomitcidset            0
  % \global\pdfomitcharset           0
  % \global\pdfomitinfodict          0
  % \global\pdfomitmediabox          0
  % \global\pdfomitprocset           0
  % \global\pdfptexprefix            0
    \global\pdfpagebox               0
  % \global\pdfmajorversion          1
    \global\pdfminorversion          4 % 7 is needed for objectcompression
    \global\pdfuniqueresname         0

    \global\pdfhorigin             1in
    \global\pdfvorigin             1in
    \global\pdflinkmargin          0pt
    \global\pdfdestmargin          0pt
    \global\pdfthreadmargin        0pt

\fi

\endgroup

\endinput

% % engine=luatex texformat=plain
%
% % mtxrun --script plain thisfile
%
% \pdfminorversion     7 % otherwise no object compression
% \pdfobjcompresslevel 3
% \pdfcompresslevel    3
%
% \immediate\pdfextension obj                          {<</crap1/crap1>>}
% \immediate\pdfextension obj uncompressed             {<</crap2/crap2>>}
% \immediate\pdfextension obj                          {<</crap3/crap3>>}
% \immediate\pdfextension obj              stream attr   {/crap1/crap1}   {crap stream data 1}
% \immediate\pdfextension obj uncompressed stream attr   {/crap2/crap2}   {crap stream data 2}
% \immediate\pdfextension obj              stream attr   {/crap3/crap3}   {crap stream data 3}
%
% done \end
