%%
%% This is file `l3dvips.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% l3drivers.dtx  (with options: `package,dvips')
%% 
%% Copyright (C) 1990-2017 The LaTeX3 Project
%% 
%% It may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License (LPPL), either version 1.3c of
%% this license or (at your option) any later version.  The latest
%% version of this license is in the file:
%% 
%%    http://www.latex-project.org/lppl.txt
%% 
%% This file is part of the "l3kernel bundle" (The Work in LPPL)
%% and all files in that bundle must be distributed together.
%% 
%% File: l3drivers.dtx Copyright(C) 2011-2017 The LaTeX3 Project
\ProvidesExplFile
  {l3dvips.def}{2017/03/18}{}
  {L3 Experimental driver: dvips}
\AtBeginDocument
  {
    \@ifpackageloaded { color }
      {
        \cs_new_protected:Npn \__driver_color_pickup:
          { \tl_set:Nx \l__color_current_tl { \current@color } }
      }
      { \cs_new_protected:Npn \__driver_color_pickup: { } }
  }
\cs_new_protected:Npn \__driver_color_ensure_current:
  {
    \__driver_color_pickup:
    \tex_special:D { color~push~\l__color_current_tl }
  }
\cs_new_protected:Npn \__driver_color_reset:
  { \tex_special:D { color~pop } }
\cs_new_protected:Npn \__driver_literal:n #1
  {
    \tex_special:D
      {
        ps:
          currentpoint~
          currentpoint~translate~
          #1 ~
          neg~exch~neg~exch~translate
      }
  }
\cs_new_protected:Npn \__driver_scope_begin:
  { \tex_special:D { ps:gsave } }
\cs_new_protected:Npn \__driver_scope_end:
  { \tex_special:D { ps:grestore } }
\cs_new:Npn \__driver_absolute_lengths:n #1
  {
     matrix~currentmatrix~
     Resolution~72~div~VResolution~72~div~scale~
     DVImag~dup~scale~
     #1 ~
     setmatrix
  }
\cs_new_protected:Npn \__driver_box_use_clip:N #1
  {
    \__driver_scope_begin:
    \__driver_literal:n
      {
        \__driver_absolute_lengths:n
          {
            0 ~
            \dim_to_decimal_in_bp:n { \box_dp:N #1 } ~
            \dim_to_decimal_in_bp:n { \box_wd:N #1 } ~
            \dim_to_decimal_in_bp:n { -\box_ht:N #1 - \box_dp:N #1 } ~
            rectclip
          }
      }
    \hbox_overlap_right:n { \box_use:N #1 }
    \__driver_scope_end:
    \skip_horizontal:n { \box_wd:N #1 }
  }
\cs_new_protected:Npn \__driver_box_use_rotate:Nn #1#2
  {
    \__driver_scope_begin:
    \__driver_literal:n
      {
        \fp_compare:nNnTF {#2} = \c_zero_fp
          { 0 }
          { \fp_eval:n { round ( -#2 , 5 ) } } ~
        rotate
      }
   \box_use:N #1
   \__driver_scope_end:
  }
\cs_new_protected:Npn \__driver_box_use_scale:Nnn #1#2#3
  {
    \__driver_scope_begin:
    \__driver_literal:n
      {
        \fp_eval:n { round ( #2 , 5 ) } ~
        \fp_eval:n { round ( #3 , 5 ) } ~
        scale
      }
    \hbox_overlap_right:n { \box_use:N #1 }
    \__driver_scope_end:
  }
\cs_new_eq:NN \__driver_image_getbb_eps:n \__image_read_bb:n
\cs_new_protected:Npn \__driver_image_include_eps:n #1
  {
    \tex_special:D { PSfile = #1 }
  }
\cs_new_protected:Npn \__driver_draw_literal:n #1
  { \tex_special:D { ps:: ~ #1 } }
\cs_generate_variant:Nn \__driver_draw_literal:n { x }
\cs_new_protected:Npn \__driver_draw_begin:
  {
    \tex_special:D { ps::[begin] }
    \tex_special:D { ps::~save }
    \tex_special:D { ps::~/l3x~currentpoint~/l3y~exch~def~def }
    \tex_special:D { ps::~@beginspecial }
  }
\cs_new_protected:Npn \__driver_draw_end:
  {
    \tex_special:D { ps::~@endspecial }
    \tex_special:D { ps::~restore }
    \tex_special:D { ps::[end] }
  }
\cs_new_protected:Npn \__driver_draw_scope_begin:
  { \__driver_draw_literal:n { save } }
\cs_new_protected:Npn \__driver_draw_scope_end:
  { \__driver_draw_literal:n { restore } }
\cs_new_protected:Npn \__driver_draw_moveto:nn #1#2
  {
    \__driver_draw_literal:x
      { \dim_to_decimal_in_bp:n {#1} ~ \dim_to_decimal_in_bp:n {#2} ~ moveto }
  }
\cs_new_protected:Npn \__driver_draw_lineto:nn #1#2
  {
    \__driver_draw_literal:x
      { \dim_to_decimal_in_bp:n {#1} ~ \dim_to_decimal_in_bp:n {#2} ~ lineto }
  }
\cs_new_protected:Npn \__driver_draw_rectangle:nnnn #1#2#3#4
  {
     \__driver_draw_literal:x
       {
         \dim_to_decimal_in_bp:n {#4} ~ \dim_to_decimal_in_bp:n {#3} ~
         \dim_to_decimal_in_bp:n {#1} ~ \dim_to_decimal_in_bp:n {#2} ~
         moveto~dup~0~rlineto~exch~0~exch~rlineto~neg~0~rlineto~closepath
      }
  }
\cs_new_protected:Npn \__driver_draw_curveto:nnnnnn #1#2#3#4#5#6
  {
    \__driver_draw_literal:x
      {
        \dim_to_decimal_in_bp:n {#1} ~ \dim_to_decimal_in_bp:n {#2} ~
        \dim_to_decimal_in_bp:n {#3} ~ \dim_to_decimal_in_bp:n {#4} ~
        \dim_to_decimal_in_bp:n {#5} ~ \dim_to_decimal_in_bp:n {#6} ~
        curveto
      }
 }
\cs_new_protected:Npn \__driver_draw_evenodd_rule:
  { \bool_gset_true:N \g__driver_draw_eor_bool }
\cs_new_protected:Npn \__driver_draw_nonzero_rule:
  { \bool_gset_false:N \g__driver_draw_eor_bool }
\bool_new:N \g__driver_draw_eor_bool
\cs_new_protected:Npn \__driver_draw_closepath:
  { \__driver_draw_literal:n { closepath } }
\cs_new_protected:Npn \__driver_draw_stroke:
  {
    \__driver_draw_literal:n { currentdict~/l3sc~known~{gsave~l3sc}~if }
    \__driver_draw_literal:n { stroke }
    \__driver_draw_literal:n { currentdict~/l3sc~known~{grestore}~if }
    \bool_if:NT \g__driver_draw_clip_bool
      {
        \__driver_draw_literal:x
          {
            \bool_if:NT \g__driver_draw_eor_bool { eo }
            clip
          }
      }
    \__driver_draw_literal:n { newpath }
    \bool_gset_false:N \g__driver_draw_clip_bool
  }
\cs_new_protected:Npn \__driver_draw_closestroke:
  {
    \__driver_draw_closepath:
    \__driver_draw_stroke:
  }
\cs_new_protected:Npn \__driver_draw_fill:
  {
    \__driver_draw_literal:n { currentdict~/l3fc~known~{gsave~l3fc}~if }
    \__driver_draw_literal:x
      {
        \bool_if:NT \g__driver_draw_eor_bool { eo }
        fill
      }
    \__driver_draw_literal:n { currentdict~/l3fc~known~{grestore}~if }
    \bool_if:NT \g__driver_draw_clip_bool
      {
        \__driver_draw_literal:x
          {
            \bool_if:NT \g__driver_draw_eor_bool { eo }
            clip
          }
      }
    \__driver_draw_literal:n { newpath }
    \bool_gset_false:N \g__driver_draw_clip_bool
  }
\cs_new_protected:Npn \__driver_draw_fillstroke:
  {
    \__driver_draw_literal:n { currentdict~/l3fc~known~{gsave~l3fc}~if }
    \__driver_draw_literal:x
      {
        \bool_if:NT \g__driver_draw_eor_bool { eo }
        fill
      }
    \__driver_draw_literal:n { currentdict~/l3fc~known~{grestore}~if }
    \__driver_draw_literal:n { currentdict~/l3sc~known~{gsave~l3sc}~if }
    \__driver_draw_literal:n { stroke }
    \__driver_draw_literal:n { currentdict~/l3sc~known~{grestore}~if }
    \bool_if:NT \g__driver_draw_clip_bool
      {
        \__driver_draw_literal:x
          {
            \bool_if:NT \g__driver_draw_eor_bool { eo }
            clip
          }
      }
    \__driver_draw_literal:n { newpath }
    \bool_gset_false:N \g__driver_draw_clip_bool
  }
\cs_new_protected:Npn \__driver_draw_clip:
  { \bool_gset_true:N \g__driver_draw_clip_bool }
\bool_new:N \g__driver_draw_clip_bool
\cs_new_protected:Npn \__driver_draw_discardpath:
  {
    \bool_if:NT \g__driver_draw_clip_bool
      {
        \__driver_draw_literal:x
          {
            \bool_if:NT \g__driver_draw_eor_bool { eo }
            clip
          }
      }
    \__driver_draw_literal:n { newpath }
    \bool_gset_false:N \g__driver_draw_clip_bool
  }
\cs_new_protected:Npn \__driver_draw_dash:nn #1#2
  {
    \__driver_draw_literal:x
      {
        [ ~
          \clist_map_function:nN {#1} \__driver_draw_dash:n
        ] ~
        \dim_to_decimal_in_bp:n {#2} ~ setdash
      }
  }
\cs_new:Npn \__driver_draw_dash:n #1
  { \dim_to_decimal_in_bp:n {#1} ~ }
\cs_new_protected:Npn \__driver_draw_linewidth:n #1
  {
    \__driver_draw_literal:x
      { \dim_to_decimal_in_bp:n {#1} ~ setlinewidth }
  }
\cs_new_protected:Npn \__driver_draw_miterlimit:n #1
  { \__driver_draw_literal:x { \fp_eval:n {#1} ~ setmiterlimit } }
\cs_new_protected:Npn \__driver_draw_cap_butt:
  { \__driver_draw_literal:n { 0 ~ setlinecap } }
\cs_new_protected:Npn \__driver_draw_cap_round:
  { \__driver_draw_literal:n { 1 ~ setlinecap } }
\cs_new_protected:Npn \__driver_draw_cap_rectangle:
  { \__driver_draw_literal:n { 2 ~ setlinecap } }
\cs_new_protected:Npn \__driver_draw_join_miter:
  { \__driver_draw_literal:n { 0 ~ setlinejoin } }
\cs_new_protected:Npn \__driver_draw_join_round:
  { \__driver_draw_literal:n { 1 ~ setlinejoin } }
\cs_new_protected:Npn \__driver_draw_join_bevel:
  { \__driver_draw_literal:n { 2 ~ setlinejoin } }
\cs_new_protected:Npn \__driver_draw_color_reset:
  {
    \__driver_draw_literal:n { currentdic~/l3fc~known~{ /l3fc~ { } ~def }~if }
    \__driver_draw_literal:n { currentdic~/l3sc~known~{ /l3sc~ { } ~def }~if }
  }
\cs_new_protected:Npn \__driver_draw_color_cmyk:nnnn #1#2#3#4
  {
    \__driver_draw_literal:x
      {
        \fp_eval:n {#1} ~ \fp_eval:n {#2} ~
        \fp_eval:n {#3} ~ \fp_eval:n {#4} ~
        setcmykcolor ~
      }
    \__driver_draw_color_reset:
  }
\cs_new_protected:Npn \__driver_draw_color_cmyk_fill:nnnn #1#2#3#4
  {
    \__driver_draw_literal:x
      {
        /l3fc ~
          {
            \fp_eval:n {#1} ~ \fp_eval:n {#2} ~
            \fp_eval:n {#3} ~ \fp_eval:n {#4} ~
            setcmykcolor
          } ~
        def
      }
  }
\cs_new_protected:Npn \__driver_draw_color_cmyk_stroke:nnnn #1#2#3#4
  {
    \__driver_draw_literal:x
      {
        /l3sc ~
          {
            \fp_eval:n {#1} ~ \fp_eval:n {#2} ~
            \fp_eval:n {#3} ~ \fp_eval:n {#4} ~
            setcmykcolor
          } ~
        def
      }
  }
\cs_new_protected:Npn \__driver_draw_color_gray:n #1
  {
    \__driver_draw_literal:x { fp_eval:n {#1} ~ setgray  }
    \__driver_draw_color_reset:
  }
\cs_new_protected:Npn \__driver_draw_color_gray_fill:n #1
  { \__driver_draw_literal:x { /l3fc ~ { \fp_eval:n {#1} ~ setgray } ~ def } }
\cs_new_protected:Npn \__driver_draw_color_gray_stroke:n #1
  { \__driver_draw_literal:x { /l3sc ~ { \fp_eval:n {#1} ~ setgray } ~ def } }
\cs_new_protected:Npn \__driver_draw_color_rgb:nnn #1#2#3
  {
    \__driver_draw_literal:x
      {
        \fp_eval:n {#1} ~ \fp_eval:n {#2} ~ \fp_eval:n {#3} ~
        setrgbcolor
      }
    \__driver_draw_color_reset:
  }
\cs_new_protected:Npn \__driver_draw_color_rgb_fill:nnn #1#2#3
  {
    \__driver_draw_literal:x
      {
        /l3fc ~
          {
            \fp_eval:n {#1} ~ \fp_eval:n {#2} ~ \fp_eval:n {#3} ~
            setrgbcolor
          } ~
        def
      }
  }
\cs_new_protected:Npn \__driver_draw_color_rgb_stroke:nnn #1#2#3
  {
    \__driver_draw_literal:x
      {
        /l3sc ~
          {
            \fp_eval:n {#1} ~ \fp_eval:n {#2} ~ \fp_eval:n {#3} ~
            setrgbcolor
          } ~
        def
      }
  }
\cs_new_protected:Npn \__driver_draw_transformcm:nnnnnn #1#2#3#4#5#6
  {
    \__driver_draw_literal:x
      {
        [
          \fp_eval:n {#1} ~ \fp_eval:n {#2} ~
          \fp_eval:n {#3} ~ \fp_eval:n {#4} ~
          \dim_to_decimal_in_bp:n {#5} ~ \dim_to_decimal_in_bp:n {#6} ~
        ] ~
        concat
      }
  }
\cs_new_protected:Npn \__driver_draw_hbox:Nnnnnnn #1#2#3#4#5#6#7
  {
    \__driver_scope_begin:
    \tex_special:D { ps::[end] }
    \__driver_draw_transformcm:nnnnnn {#2} {#3} {#4} {#5} {#6} {#7}
    \tex_special:D { ps::~72~Resolution~div~72~VResolution~div~neg~scale }
    \tex_special:D { ps::~magscale~{1~DVImag~div~dup~scale}~if }
    \tex_special:D { ps::~l3x~neg~l3y~neg~translate }
    \box_set_wd:Nn #1 { 0pt }
    \box_set_ht:Nn #1 { 0pt }
    \box_set_dp:Nn #1 { 0pt }
    \box_use:N #1
    \tex_special:D { ps::[begin] }
    \__driver_scope_end:
  }
%% 
%%
%% End of file `l3dvips.def'.
