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MS_PRREQ        MS_MNG5         /* $BMW5a%a%C%;!<%8(B       */
    #define MS_PROUT        MS_MNG4         /* $B=PNO%a%C%;!<%8(B       */

$B%a%C%;!<%87A<0(B

    typedef struct {
            W       type;                   /* = MS_PRREQ/MS_PROUT  */
            W       size;                   /* = PrntMsgSz          */
            W       cmd;                    /* $B%3%^%s%I(B             */
            W       status;                 /* $B1~Ez>uBV(B             */
            W       dlen;                   /* $B%G!<%?%5%$%:(B         */
            VP      memptr;                 /* ($B6&M-(B)$B%a%b%j%]%$%s%?(B */
    } PrntMsg;

    #define PrntMsgSz       (sizeof(PrntMsg) - sizeof(W) * 2)
$BAw?.%a%C%;!<%8(B:
status $B$OL$;HMQ(B
$B1~Ez%a%C%;!<%8(B:
dlen, memptr $B$OL$;HMQ(B
cmd $B$OBP1~%3%^%s%I(B + PRNT_RESP
#define PPNT_RESP       0x100
$B1~Ez>uBV(B:
#define EP_OK           (0)             /* $B@5>o(B                 */
#define EP_CMND         (-1)            /* $B%3%^%s%I7A<0$,IT@5(B   */
#define EP_PAR          (-2)            /* $B%Q%i%a!<%?$,IT@5(B     */
#define EP_NOSPT        (-3)            /* $BL$%5%]!<%H(B           */
#define EP_PAPER        (-4)            /* $BMQ;f%5%$%:$,IT@5(B     */
#define EP_SPEC         (-5)            /* $B0u:~;EMM$,IT@5(B       */
#define EP_NOSPC        (-6)            /* $B;q8;$,ITB-$7$?(B       */
#define EP_OUTBUF       (-7)            /* $B=PNO%P%C%U%!$,L$@_Dj(B */
#define EP_ABORT        (-8)            /* $BCfCG$5$l$?(B           */
$B%3%^%s%I(B:
#define PRNT_FINISH     0x00            /* $B=hM}=*N;(B             */
#define PRNT_SETKIND    0x01            /* $B%W%j%s%?5!pJs@_Dj(B     */
#define PRNT_GETINFO    0x05            /* $B%W%j%s%?>pJs

13.5 $BMW5a%a%C%;!<%8(B

$B!{(B PRNT_FINISH $B=hM}=*N;(B

dlen:   0
memptr: NULL

$BF0:n(B:

$B%W%j%s%?%$%a!<%8%I%i%$%P$O@5>o1~Ez$rLa$7$?8e!"(B $B<+%W%m%;%9$r=*N;$9$k!#(B

status:  EP_OK ($B%(%i!<$rLa$7$F$O$$$1$J$$(B)

$B!{(B PRNT_SETKIND $B%W%j%s%?5!
dlen:   sizeof(TC) * L_PRNM
memptr:
        typedef struct {
                W       spec;           /* $B%W%j%s%?;EMM(B         */
                SIZE    papermin;       /* $B:G>.MQ;f%5%$%:(B(mm)   */
                SIZE    papermax;       /* $B:GBgMQ;f%5%$%:(B(mm)   */
        } PrntSpec;

        TC      hwname[L_PRNM];         /* $BMW5a(B: $B5!
    (B */ PrntSpec spec; /* $B1~Ez(B: $B%W%j%s%?;EMM(B */

$BF0:n(B:

$B;XDj$5$l$?%W%j%s%?5!

$B$?$@$7!"5!

    $,;XDj$5$l$J$+$C$?>l9g(B ( hwname[0] = TNULL ) $B$O5!

    $B%W%j%s%?;EMM$N(B spec $B$O0J2<$N%S%C%HBP1~$G<($9!#(B

    #define PR_DRAFT        0x0001  /* $B%I%i%U%H0u:~(B         */
    #define PR_FINE         0x0002  /* $B9bL)EY0u:~(B           */
    #define PR_COLOR        0x0010  /* $B%+%i!<0u:~(B           */
    
    #define PR_ROTATE       0x0100  /* $B=D2#5UE>%5%]!<%H(B     */
    #define PR_HWPAR        0x0200  /* $B8GM-%Q%i%a!<%?(B1$BM-(B   */
    #define PR_SETHWPAR     0x0400  /* $B8GM-%Q%i%a!<%?(B1$BMW@_Dj(B */
    #define PR_HWPAR2       0x0800  /* $B8GM-%Q%i%a!<%?(B2$BM-(B   */
    

    PR_DRAFT $B$O4pK\E*$K%5%]!<%H$7$J$/$F$O$$$1$J$$!#(B PR_HWPAR $B$O(B PRNT_SETPAR, PRNT_GETPAR $B$r%5%]!<%H$7$F$$$k$3$H$r<($7!"(B PR_SETHWPAR $B$O(B PRNT_GETPAR $B$rI,$: PR_HWPAR2 $B$O(B PRNT_GETPAR2 $B$r%5%]!<%H$7$F$$$k$3$H$r<($9!#(B

    $B$J$*!"8GM-%Q%i%a!<%?(B2$B$N@_Dj!&JQ99$K$h$j%W%j%s%?;EMM$,JQ2=$9$k>l9g$,$"$k!#(B

    status: > EP_OK         $B%W%j%s%?;EMM(B
              EP_NOSPT        $B%5%]!<%H$7$F$$$J$$5!
    
    

    $B!{(B PRNT_SETPAR $B8GM-%Q%i%a!<%?@_Dj(B

    dlen            L_HWPAR
    memptr  VB      hwpar[L_HWPAR];         /* $B8GM-%Q%i%a!<%?(B       */
    

    $BF0:n(B:

    $B%W%j%s%?8GM-%Q%i%a!<%?$r@_Dj$9$k!#(B

    status: EP_OK           $B@5>o(B
            EP_NOSPT        $B8GM-%Q%i%a!<%?$O%5%]!<%H$7$F$$$J$$!#(B
    

    $B!{(B PRNT_GETPAR $B8GM-%Q%i%a!<%?(B1$B

    $B!{(B PRNT_GETPAR2 $B8GM-%Q%i%a!<%?(B2$B
    dlen    L_HWPAR
    memptr  VB      hwpar[L_HWPAR];         /* $B8GM-%Q%i%a!<%?(B       */
    

    $BF0:n(B:

    $B;XDj$5$l$?%W%j%s%?8GM-%Q%i%a!<%?$r=i4|CM$H$7$F!"(B $B%W%j%s%?8GM-%Q%i%a!<%?@_Dj%Q%M%k$K$h$j!"(B $B%Q%i%a!<%?$N@_Dj(B/$BJQ99$r9T$$!"7k2L$rLa$9!#(B

    $B8GM-%Q%i%a!<%?(B hwpar $B$O!"(B PRNT_GETPAR, PRNT_GETPAR2 $B$G6&DL$G$"$k!#(B hwpar $BFb$N$I$NItJ,$r8GM-%Q%i%a!<%?(B1$B$*$h$S(B1$B$H$7$F07$&$+$O!"(B $B%W%j%s%?%$%a!<%8%I%i%$%P$,G$0U$K7h$a$k!#(B $BMW5a%W%m%;%9B&$O!"(Bhwpar $B$NFbMF$K4X$7$F$O4XCN$7$J$$!#(B

    PRNT_GETPAR $B$O0u:~D>A0$N@_Dj$N$?$a$K8F$S=P$9!#(B $B PRNT_GETPAR2 $B$O%W%j%s%?5!\:Y@_Dj$J$I$K;HMQ$9$k!#(B

    status: EP_OK           $B@5>o(B
            EP_NOSPT        $B8GM-%Q%i%a!<%?$O%5%]!<%H$7$F$$$J$$!#(B
    

    $B!{(B PRNT_SETINFO $B%W%j%s%?>pJs@_Dj(B

    dlen:   sizeof(PrntSet)
    memptr: typedef struct {
                    SIZE    paper;          /* $BMQ;f%5%$%:(B (mm)      */
                    W       spec;           /* $B0u:~;EMM(B             */
            } PrntSet;
    
            paper:  $B0u:~$9$kMQ;f$N%5%$%:(B (mm)
    
            spec:   $B0u:~$9$k;EMM(B
    
            $B0u:~;EMM$O2<5-$NAH$_9g$o$;!#$?$@$7!"(BPR_DRAFT $B$H(B PR_FINE $B$O(B
            $BF1;~$K;XDj$G$-$J$$!#(B
            PR_DRAFT, PR_FINE $B$H$b;XDj$,$J$1$l$PDL>o0u:~!#(B
    
            #define PR_DRAFT        0x0001  /* $B%I%i%U%H0u:~(B         */
            #define PR_FINE         0x0002  /* $B9bL)EY0u:~(B           */
            #define PR_COLOR        0x0010  /* $B%+%i!<0u:~(B           */
    

    $BF0:n(B:

    $BMQ;f%5%$%:!"0u:~;EMM$r@_Dj$9$k!#(B
    $B@_Dj$5$l$k$^$G$O!"%G%U%)!<%k%H@_Dj$H$J$C$F$$$k!#(B

    status: EP_OK           $B@5>o(B
            EP_PAPER        $BMQ;f%5%$%:$,IT@5(B/$BL$%5%]!<%H(B
            EP_SPEC         $B0u:~;EMM$,IT@5(B/$BL$%5%]!<%H(B
    

    $B!{(B PRNT_SETBUF $B=PNO%P%C%U%!@_Dj(B

    dlen:   $B=PNO%P%C%U%!$N%P%$%H%5%$%:(B
    memptr: $B=PNO%P%C%U%!$N@hF,%"%I%l%9(B
    

    $BF0:n(B:

    $B@8@.$7$?%W%j%s%?$X$N=PNO%G!<%?$r3JG<$9$k$?$a$N=PNO%P%C%U%!$r@_Dj$9$k!#(B $B@_Dj$7$?=PNO%P%C%U%!$O!"(BPRNT_SETBUF $B$G:F@_Dj$5$l$k$^$G$O!"(B $B$=$NB8:_$,J]>Z$5$l$k!#(B

    status: EP_OK           $B@5>o(B
            EP_PAR          $B%Q%i%a!<%?$,IT@5(B
    

    $B!{(B PRNT_GETINFO $B%W%j%s%?>pJs
    dlen:   sizeof(PrntInfo)
    memtr:  typedef struct {
                    SIZE    paper;          /* $BMQ;f%5%$%:(B (mm)      */
                    W       spec;           /* $B0u:~;EMM(B             */
                    SIZE    res;            /* $BM-8z2rA|EY(B           */
                    SIZE    unit;           /* $B0\F0C10L(B($B%I%C%H(B)     */
                    RECT    margin;         /* $BJ*M}%^!<%8%s(B(mm)     */
                    UH      headsz;         /* $B0u;z%X%C%I=D%I%C%H?t(B */
                    UH      pixbits;        /* $B%T%/%;%k%S%C%H?t(B     */
                    CSPEC   cspec;          /* $B%+%i!<;EMM(B           */
                    COLOR   colmap[MAX_CMAPENT]; /* $B%+%i!<%^%C%W(B    */
            } PrntInfo;
    
            #define MAX_CMAPENT     256
    
            paper, spec:    $BMQ;f%5%$%:!"0u:~;EMM(B
                    PRNT_SETINFO $B$G@_Dj$5$l$?!"$^$?$O%G%U%)!<%k%H@_Dj>pJs(B
    
            res:    $B%W%j%s%?$N2#(B/$B=D$NM-8z2rA|EY(B
                    < 0 $B$N;~(B: 1 $B%$%s%AEv$?$j$N%I%C%H?t$NIi?t(B
                    > 0 $B$N;~(B: 1 cm $BEv$?$j$N%I%C%H?t(B
                    $B;XDj$7$?(B quality $B$K0MB8$9$k!#(B
    
            headsz: $B0u;z%X%C%I$N=D$N%I%C%H?t(B (>= 1)
                    $B=DJ}8~$K$O!"$3$N%I%C%HC10L$G0u:~$9$k$3$H$,K>$^$7$$$3$H(B
                    $B$r<($9!#$3$NCM$O!"(Bunit.v $B$NG\?t$G$J$/$F$O$$$1$J$$!#(B
    
            unit:   $B2#(B/$B=DJ}8~$N0\F0C10L(B ($B%I%C%H(B)
                    $B$3$N%I%C%H?t$NG\?t$G$N$_2#(B / $B=DJ}8~$N0LCV$N0\F0$,2DG=(B
                    $B$H$J$k!#(B
    
            margin: $B;XDj$7$?MQ;f$K$*$1$k:8!">e!"1&!"2<$NJ*M}%^!<%8%s(B(mm)
    
            pixbits:$B%$%a!<%8:[email protected]%S%C%H%^%C%W$N%T%/%;%k%S%C%H?t(B
                     ($B%W%l!<%s?t$O(B 1 $B$K8GDj(B)
    
            cpsec:  $B%$%a!<%8:[email protected]%S%C%H%^%C%W$N%+%i!<;EMM(B
                    cspec.colmap $B$NCM$O0UL#$r;}$?$J$$!#(B
                    cspec.attr $B$O0J2<$N$$$:$l$+$G$J$/$F$O$$$1$J$$!#(B
                            DA_COLOR_RGB $B("(B DA_HAVECMAP
                            DA_COLOR_RGB
                            DA_COLOR_MONO
    
            colmap: $B%$%a!<%8%S%C%H%^%C%W$N%+%i!<%^%C%W(B
                    cspec.attr & DA_HAVECMAP $B$N$H$-$N$_M-8z$G!"(B
                    cspec.inf[0] $B$,
    

    $BF0:n(B:

    $B8=:_$N@_Dj$K$*$1$k>pJs$r

    status: EP_OK           $B@5>o(B
    

    $B!{(B PRNT_SETIMAGE $B0u:~%$%a!<%8@_Dj(B

    dlen:   sizeof(PrntImage)
    memptr: typedef struct {
                    PNT     offset;         /* $B0u:~%*%U%;%C%H(B       */
                    RECT    area;           /* $B0u:~NN0h(B             */
                    BMP     bmp;            /* $B0u:~%$%a!<%8(B         */
            } PrntImage;
    
            offset: $B0u:~$r3+;O$9$k%*%U%;%C%H%I%C%H?t(B
                    $B3+;O(B Y $B0LCV(B: $B8=:_$N(B Y $B0LCV(B + offset.y
                    $B3+;O(B X $B0LCV(B: offset.x
                    $Be$G]$N%S%C%H%^%C%W(B
                    PR_GETINFO $B$G
    

    $BF0:n(B:

    $B0u:~3+;O0LCV$r(B offset $B$G;XDj$5$l$?J,$@$1?J$a!"(B area $B$G;XDj$5$l$?NN0h$N%$%a!<%8$r0u:~$9$k$?$a$N%W%j%s%?$X$N=PNO%G!<%?$r@8@.$7$F!"(B $B=PNO%a%C%;!<%8$rAw?.$9$k!#(B

    $B=PNO%a%C%;!<%8$N1~Ez$H$7$F!"%(%i!<1~Ez$rl9g$O!"(B $BB(:B$K!"%(%i!<1~Ez$rLa$9!#(B

    PRNT_SETBUF $B$K$h$j=PNO%P%C%U%!$,@_Dj$5$l$F$$$J$$$H$-$O!"(B $B%(%i!<$H$J$k!#(B

    $B=hM}8e$O0J2<$N(B Y $B0LCV$H$J$k!#(B

       $B3+;O(B Y $B0LCV(B + $B
    

    status: EP_OK           $B@5>o(B
            EP_PAR          $B%Q%i%a!<%?$,IT@5(B
            EP_NOSPC        $B;q8;$,ITB-$7$?(B
            EP_OUTBUF       $B=PNO%P%C%U%!$,L$@_Dj(B
            EP_ABORT        $BCfCG$7$?(B
    

    $B!{(B PRNT_FEEDFORM $B2~%Z!<%8(B

    dlen:   0
    memptr: NULL
    

    $BF0:n(B:

    $B2~%Z!<%8$r9T$&$?$a$N%W%j%s%?$X$N=PNO%G!<%?$r@8@.$7$F!"(B $B=PNO%a%C%;!<%8$rAw?.$9$k!#(B

    $B=PNO%a%C%;!<%8$N1~Ez$H$7$F!"%(%i!<1~Ez$rl9g$O!"(B $BB(:B$K!"%(%i!<1~Ez$rLa$9!#(B

    PRNT_SETBUF $B$K$h$j=PNO%P%C%U%!$,@_Dj$5$l$F$$$J$$$H$-$O!"(B $B%(%i!<$H$J$k!#(B

    status: EP_OK           $B@5>o(B
            EP_NOSPC        $B;q8;$,ITB-$7$?(B
            EP_OUTBUF       $B=PNO%P%C%U%!$,L$@_Dj(B
            EP_ABORT        $BCfCG$7$?(B
    

    13.6 $B=PNO%a%C%;!<%8(B

    $B!{(B PRNT_OUTDATA $B%W%j%s%?=PNO%G!<%?(B

    dlen:   nbytes
    memptr: UB      dat[nbytes]             /* $BJQ49%P%$%HNs(B */
    

    memptr $B$O(B PR_SETBUF $B$K$h$j@_Dj$5$l$?=PNO%P%C%U%!$G$"$k(B($B@hF,$G$"$kI,MW$O$J$$(B)$B!#(B

    $BF0:n(B:

    $B@8@.$7$?%W%j%s%?$X$N=PNO%G!<%?$r=PNO$9$k!#(B dlen $B$K(B 0 $B$r;XDj$7$?>l9g$O!"%W%j%s%?$X$N=PNO$r%U%i%C%7%e$9$k!#(B

    $B1~Ez$H$7$F!"%(%i!<1~Ez(B (EP_ABORT) $B$rl9g$O!"(B $BB(:B$K!"=PNO=hM}$rCfCG$7$F!"(B $B85$K$J$C$?MW5a%3%^%s%I$KBP1~$9$k%(%i!<1~Ez$rLa$9!#(B

    status: EP_OK           $B@5>o(B
            EP_ABORT        $B2?$i$+$NM}M3$K$h$j=hM}$rCfCG$7$?!#(B
    

    13.7 $B0u:~(B

    $B0u:~(B
    $B?^(B 19 : $B0u:~(B

    13.8 $B%7%9%F%`9=@.(B

    $B!{(B $B%W%j%s%?%$%a!<%8%I%i%$%P(B ( /SYS/$$PRINTER.BOX/* )

    $B%W%j%s%?%$%a!<%8%I%i%$%P$O(B /SYS/$$PRINTER.BOX/* $B$KCV$/I,MW$,$"$k!#(B $B%W%j%s%?%$%a!<%8%I%i%$%P$N?t$OG$0U$G$"$j!"(B $BDL>o$O(B 1 $B$D$N%W%j%s%?%$%a!<%8%I%i%$%P$O!"(B $BF10l%a!<%+!<(B 1 $B8D0J>e$N5!$O0l0UE*$G$J$/$O$$$1$J$$!#(B

    $B%W%j%s%?%$%a!<%8%I%i%$%P$O!"(B $BBh(B 2 $B%l%3!<%I0J9_$K0J2<$N5!

      %l%3!<%I$r;}$C$F$$$J$/$F$O$$$1$J$$!#(B

          $B%l%3!<%I%?%$%W(B: 15
          $B%5%V%?%$%W(B:     0 ($BG$0U(B)
          $BFbMF(B:           $B%5%]!<%H$7$F$$$k5!
        $N(B TC $BJ8;zNs%j%9%H(B <$B%W%j%s%?5!
        $B"((B
        $B$J$*!"(B/SYS/$$PRINTER.BOX $B$K$O!"(B $B%W%j%s%?>pJs%l%3!<%I$b4^$^$l$k(B (BTRON3$B;EMM=q!V(B3.11 $B0u:~%^%M!<%8%c!W$r;2>H$N$3$H(B)$B!#(B

        13.9 $BA4BN9=@.(B

        $BA4BN9=@.(B
        $B?^(B 20 : $BA4BN9=@.(B

        $B$3$N>O$NL\
        $BA0JG(B:$BBh(B12$B>O(B $B%W%j%s%?$K$b$I$k(B
        $BO(B $B%M%C%H%o!<%/%G%P%$%9$K$9$9$`(B