summaryrefslogtreecommitdiff
path: root/contrib/japanese
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2019-03-07 18:03:00 +0000
committerChris Liddell <chris.liddell@artifex.com>2019-05-29 09:39:36 +0100
commit9de16a6637b73e35f79d2d622de403b24e6502f2 (patch)
treebc6fba44e03e9caab75968fda94a0cea73caf5e3 /contrib/japanese
parent808021913baf763e07cc9eabc3716bfa507380ff (diff)
downloadghostpdl-9de16a6637b73e35f79d2d622de403b24e6502f2.tar.gz
Move FILE * operations behind new gp_file * API.
(squash of commits from filesec branch) Most of this commit is donkeywork conversions of calls from FILE * -> gp_file *, fwrite -> gp_fwrite etc. Pretty much every device is touched, along with the clist and parsing code. The more interesting changes are within gp.h (where the actual new API is defined), gpmisc.c (where the basic implementations live), and the platform specific levels (gp_mswin.c, gp_unifs.c etc where the platform specific implementations have been tweaked/renamed). File opening path validation All file opening routines now call a central routine for path validation. This then consults new entries in gs_lib_ctx to see if validation is enabled or not. If so, it validates the paths by seeing if they match. Simple C level functions for adding/removing/clearing paths, exposed through the gsapi level. Add 2 postscript operators for path control. <name> <string> .addcontrolpath - Add the given <string> (path) to the list of paths for controlset <name>, where <name> can be: /PermitFileReading /PermitFileWriting /PermitFileControl (Anything else -> rangecheck) - .activatepathcontrol - Enable path control. At this point PS cannot make any more changes, and all file access is checked.
Diffstat (limited to 'contrib/japanese')
-rw-r--r--contrib/japanese/dviprlib.c4
-rw-r--r--contrib/japanese/gdev10v.c14
-rw-r--r--contrib/japanese/gdevalps.c48
-rw-r--r--contrib/japanese/gdevdmpr.c12
-rw-r--r--contrib/japanese/gdevespg.c78
-rw-r--r--contrib/japanese/gdevfmlbp.c34
-rw-r--r--contrib/japanese/gdevfmpr.c12
-rw-r--r--contrib/japanese/gdevj100.c24
-rw-r--r--contrib/japanese/gdevlbp3.c60
-rw-r--r--contrib/japanese/gdevmjc.c97
-rw-r--r--contrib/japanese/gdevml6.c106
-rw-r--r--contrib/japanese/gdevnpdl.c70
-rw-r--r--contrib/japanese/gdevp201.c32
-rw-r--r--contrib/japanese/gdevrpdl.c134
14 files changed, 362 insertions, 363 deletions
diff --git a/contrib/japanese/dviprlib.c b/contrib/japanese/dviprlib.c
index 608bd15f5..12bee005c 100644
--- a/contrib/japanese/dviprlib.c
+++ b/contrib/japanese/dviprlib.c
@@ -80,7 +80,7 @@ dviprt_readcfg(char *ifname,dviprt_cfg_t *pcfg,uchar *pcodebuf,int codebuf_s,
static int
dviprt_read_S_cfg(dviprt_cfg_t *pcfg,dviprt_cfg_i *pinfo)
{
- FILE *ifp;
+ gp_file *ifp;
long intoff,stroff,codeoff;
int i,count;
uchar *pbuf,*rbuf;
@@ -461,7 +461,7 @@ dviprt_readsrc(char *fname,dviprt_cfg_t *pcfg,uchar *pcodebuf,int codebuf_s,
{
dviprt_cfg_i info;
int code;
- FILE *ifp;
+ gp_file *ifp;
dviprt_cfg_item_t *pitem;
int enc = CFG_ENCODE_NULL;
enum { T_INTEGER,T_STRINGS,T_CODE,T_SELECT,T_UPPERPOS};
diff --git a/contrib/japanese/gdev10v.c b/contrib/japanese/gdev10v.c
index 5c8b7fb3d..510a74e87 100644
--- a/contrib/japanese/gdev10v.c
+++ b/contrib/japanese/gdev10v.c
@@ -137,7 +137,7 @@ prn_putc(gx_device_printer *pdev, int c)
pc98_prn_out(c);
return 0;
}
- return fputc(c, pdev->file);
+ return gp_fputc(c, pdev->file);
}
static int
@@ -148,7 +148,7 @@ prn_puts(gx_device_printer *pdev, char *ptr)
pc98_prn_out(*ptr ++);
return 0;
}
- return fputs(ptr, pdev->file);
+ return gp_fputs(ptr, pdev->file);
}
static int
@@ -172,10 +172,10 @@ prn_flush(gx_device_printer *pdev)
#else /* PC9801 */
-#define prn_putc(pdev, c) putc(c, pdev->file)
-#define prn_puts(pdev, ptr) fputs(ptr, pdev->file)
-#define prn_write(pdev, ptr, size) fwrite(ptr, 1, size, pdev->file)
-#define prn_flush(pdev) fflush(pdev->file)
+#define prn_putc(pdev, c) gp_fputc(c, pdev->file)
+#define prn_puts(pdev, ptr) gp_fputs(ptr, pdev->file)
+#define prn_write(pdev, ptr, size) gp_fwrite(ptr, 1, size, pdev->file)
+#define prn_flush(pdev) gp_fflush(pdev->file)
#endif
@@ -194,7 +194,7 @@ bj10v_output_run(byte *data, int dnum, int bytes,
/* Send the page to the printer. */
static int
-bj10v_print_page(gx_device_printer *pdev, FILE *prn_stream)
+bj10v_print_page(gx_device_printer *pdev, gp_file *prn_stream)
{ int line_size = gdev_prn_raster((gx_device *)pdev);
int xres = pdev->x_pixels_per_inch;
int yres = pdev->y_pixels_per_inch;
diff --git a/contrib/japanese/gdevalps.c b/contrib/japanese/gdevalps.c
index f29aeb18f..e6af9cf16 100644
--- a/contrib/japanese/gdevalps.c
+++ b/contrib/japanese/gdevalps.c
@@ -51,7 +51,7 @@
#define Y_DPI 600
#define LINE_SIZE ((X_DPI * 84 / 10 + 7) / 8) /* bytes per line for letter */
-static int md50_print_page(gx_device_printer *, FILE *, const char *, int);
+static int md50_print_page(gx_device_printer *, gp_file *, const char *, int);
static dev_proc_open_device(md_open);
static dev_proc_print_page(md50m_print_page);
static dev_proc_print_page(md50e_print_page);
@@ -166,21 +166,21 @@ md_open(gx_device *pdev)
/* MD5000 monochrome mode entrance. */
static int
-md50m_print_page(gx_device_printer *pdev, FILE *prn_stream)
+md50m_print_page(gx_device_printer *pdev, gp_file *prn_stream)
{
return(md50_print_page(pdev, prn_stream, init_50mono, sizeof(init_50mono)));
}
/* MD5000 Eco mode monochrome mode entrance. */
static int
-md50e_print_page(gx_device_printer *pdev, FILE *prn_stream)
+md50e_print_page(gx_device_printer *pdev, gp_file *prn_stream)
{
return(md50_print_page(pdev, prn_stream, init_50eco, sizeof(init_50eco)));
}
/* MD5000 monochrome mode print. */
static int
-md50_print_page(gx_device_printer *pdev, FILE *prn_stream,
+md50_print_page(gx_device_printer *pdev, gp_file *prn_stream,
const char *init_str, int init_size)
{
int lnum;
@@ -192,8 +192,8 @@ md50_print_page(gx_device_printer *pdev, FILE *prn_stream,
int n;
/* Load Paper & Select Inc Cartridge */
- fwrite(init_str, sizeof(char), init_size, prn_stream);
- fflush(prn_stream);
+ gp_fwrite(init_str, sizeof(char), init_size, prn_stream);
+ gp_fflush(prn_stream);
for ( lnum = 0; lnum <= pdev->height; lnum++ ) {
byte *end_data = data + line_size;
@@ -222,27 +222,27 @@ md50_print_page(gx_device_printer *pdev, FILE *prn_stream,
{
if(skipping)
{
- fprintf(prn_stream, "%c%c%c%c%c%c", 0x1b, 0x2a, 0x62,
- skipping & 0xff, (skipping & 0xff00) / 0x100, 0x59);
+ gp_fprintf(prn_stream, "%c%c%c%c%c%c", 0x1b, 0x2a, 0x62,
+ skipping & 0xff, (skipping & 0xff00) / 0x100, 0x59);
skipping = 0;
}
- fprintf(prn_stream, "%c%c%c%c%c%c%c%c", 0x1b, 0x2a, 0x62,
- nbyte & 0xff, (nbyte & 0xff00) / 0x100, 0x54,
- nskip & 0xff, (nskip & 0xff00) / 0x100);
- fwrite(start_data, sizeof(char), nbyte, prn_stream);
+ gp_fprintf(prn_stream, "%c%c%c%c%c%c%c%c", 0x1b, 0x2a, 0x62,
+ nbyte & 0xff, (nbyte & 0xff00) / 0x100, 0x54,
+ nskip & 0xff, (nskip & 0xff00) / 0x100);
+ gp_fwrite(start_data, sizeof(char), nbyte, prn_stream);
}
}
/* Eject Page */
- fwrite(end_md, sizeof(char), sizeof(end_md), prn_stream);
- fflush(prn_stream);
+ gp_fwrite(end_md, sizeof(char), sizeof(end_md), prn_stream);
+ gp_fflush(prn_stream);
return 0;
}
/* all? MD series monochrome mode print with data compression. */
static int
-md1xm_print_page(gx_device_printer *pdev, FILE *prn_stream)
+md1xm_print_page(gx_device_printer *pdev, gp_file *prn_stream)
{
int lnum;
int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
@@ -252,8 +252,8 @@ md1xm_print_page(gx_device_printer *pdev, FILE *prn_stream)
int nbyte;
/* Load Paper & Select Inc Cartridge */
- fwrite(&init_md13[0], sizeof(char), sizeof(init_md13), prn_stream);
- fflush(prn_stream);
+ gp_fwrite(&init_md13[0], sizeof(char), sizeof(init_md13), prn_stream);
+ gp_fflush(prn_stream);
for ( lnum = 0; lnum <= pdev->height; lnum++ ) {
byte *end_data = data + line_size;
@@ -278,8 +278,8 @@ md1xm_print_page(gx_device_printer *pdev, FILE *prn_stream)
{
if(skipping)
{
- fprintf(prn_stream, "%c%c%c%c%c%c", 0x1b, 0x2a, 0x62,
- skipping & 0xff, (skipping & 0xff00) / 0x100, 0x59);
+ gp_fprintf(prn_stream, "%c%c%c%c%c%c", 0x1b, 0x2a, 0x62,
+ skipping & 0xff, (skipping & 0xff00) / 0x100, 0x59);
skipping = 0;
}
@@ -380,15 +380,15 @@ md1xm_print_page(gx_device_printer *pdev, FILE *prn_stream)
nbyte = out_data - out_start;
- fprintf(prn_stream, "%c%c%c%c%c%c", 0x1b, 0x2a, 0x62,
- nbyte & 0xff, (nbyte & 0xff00) / 0x100, 0x57);
- fwrite(out_start, sizeof(char), nbyte, prn_stream);
+ gp_fprintf(prn_stream, "%c%c%c%c%c%c", 0x1b, 0x2a, 0x62,
+ nbyte & 0xff, (nbyte & 0xff00) / 0x100, 0x57);
+ gp_fwrite(out_start, sizeof(char), nbyte, prn_stream);
}
}
/* Eject Page */
- fwrite(end_md, sizeof(char), sizeof(end_md), prn_stream);
- fflush(prn_stream);
+ gp_fwrite(end_md, sizeof(char), sizeof(end_md), prn_stream);
+ gp_fflush(prn_stream);
return 0;
}
diff --git a/contrib/japanese/gdevdmpr.c b/contrib/japanese/gdevdmpr.c
index 852bd8a8f..9444f79cc 100644
--- a/contrib/japanese/gdevdmpr.c
+++ b/contrib/japanese/gdevdmpr.c
@@ -41,7 +41,7 @@
/* include library header. */
#include "dviprlib.h"
-extern FILE *lib_fopen(const char *);
+extern gp_file *lib_fopen(const char *);
#define LOCAL_DEBUG 0
@@ -90,7 +90,7 @@ static dev_proc_close_device(gdev_dmprt_close);
static void gdev_dmprt_init_printer_props(gx_device_dmprt *);
static int gdev_dmprt_get_printer_props(gx_device_dmprt *,char *);
static int gdev_dmprt_check_code_props(byte * ,int );
-static FILE *gdev_dmprt_dviprt_lib_fopen(const char *,char *);
+static gp_file *gdev_dmprt_dviprt_lib_fopen(const char *,char *);
static int gdev_dmprt_error_no_dviprt_to_gs(int );
@@ -672,7 +672,7 @@ gdev_dmprt_close(gx_device *pdev)
/* Output the PAGE. */
static int
-gdev_dmprt_print_page(gx_device_printer *pdev, FILE *prn_stream)
+gdev_dmprt_print_page(gx_device_printer *pdev, gp_file *prn_stream)
{
int code = 0;
dviprt_print *pprint = &pddev->dmprt.prtinfo;
@@ -798,7 +798,7 @@ static int
gdev_dmprt_get_printer_props(gx_device_dmprt *pdev,char *fnamebase)
{
int code;
- FILE *fp;
+ gp_file *fp;
dviprt_cfg_t cfg;
char *fname;
@@ -839,10 +839,10 @@ gdev_dmprt_get_printer_props(gx_device_dmprt *pdev,char *fnamebase)
}
static const char * gp_file_name_concat_string(const char *, unsigned);
-static FILE *
+static gp_file *
gdev_dmprt_dviprt_lib_fopen(const char *fnamebase,char *fname)
{
- FILE *fp;
+ gp_file *fp;
char *env;
strcpy(fname,fnamebase);
diff --git a/contrib/japanese/gdevespg.c b/contrib/japanese/gdevespg.c
index 85a464633..18ce6ca46 100644
--- a/contrib/japanese/gdevespg.c
+++ b/contrib/japanese/gdevespg.c
@@ -39,8 +39,8 @@ static dev_proc_print_page_copies(escpage_print_page_copies);
static dev_proc_print_page_copies(lp2000_print_page_copies);
static dev_proc_image_out(escpage_image_out);
-static void escpage_printer_initialize(gx_device_printer * pdev, FILE * fp, int);
-static void escpage_paper_set(gx_device_printer * pdev, FILE * fp);
+static void escpage_printer_initialize(gx_device_printer * pdev, gp_file * fp, int);
+static void escpage_paper_set(gx_device_printer * pdev, gp_file * fp);
static gx_device_procs lp2000_prn_procs =
lprn_procs(lp2000_open, gdev_prn_output_page, gdev_prn_close);
@@ -99,16 +99,16 @@ escpage_close(gx_device * pdev)
int code = gdev_prn_open_printer(pdev, 1);
if (code >= 0) {
if (ppdev->Duplex && (pdev->PageCount & 1)) {
- fprintf(ppdev->file, "%c0dpsE", GS);
+ gp_fprintf(ppdev->file, "%c0dpsE", GS);
}
- fputs(epson_remote_start, ppdev->file);
- fputs(epson_remote_start, ppdev->file);
+ gp_fputs(epson_remote_start, ppdev->file);
+ gp_fputs(epson_remote_start, ppdev->file);
}
return gdev_prn_close(pdev);
}
static int
-escpage_print_page_copies(gx_device_printer * pdev, FILE * fp, int num_coipes)
+escpage_print_page_copies(gx_device_printer * pdev, gp_file * fp, int num_coipes)
{
gx_device_lprn *const lprn = (gx_device_lprn *) pdev;
@@ -116,24 +116,24 @@ escpage_print_page_copies(gx_device_printer * pdev, FILE * fp, int num_coipes)
double xDpi = pdev->x_pixels_per_inch;
/* Goto REMOTE MODE */
- fputs(epson_remote_start, fp);
- fprintf(fp, "@EJL SELECT LANGUAGE=ESC/PAGE\r\n");
+ gp_fputs(epson_remote_start, fp);
+ gp_fprintf(fp, "@EJL SELECT LANGUAGE=ESC/PAGE\r\n");
/* RIT (Resolution Improvement Technology) Setting */
if (lprn->RITOff)
- fprintf(fp, "@EJL SET RI=OFF\r\n");
+ gp_fprintf(fp, "@EJL SET RI=OFF\r\n");
else
- fprintf(fp, "@EJL SET RI=ON\r\n");
+ gp_fprintf(fp, "@EJL SET RI=ON\r\n");
/* Resolution Setting */
- fprintf(fp, "@EJL SET RS=%s\r\n", xDpi > 300 ? "FN" : "QK");
- fprintf(fp, "@EJL ENTER LANGUAGE=ESC/PAGE\r\n");
+ gp_fprintf(fp, "@EJL SET RS=%s\r\n", xDpi > 300 ? "FN" : "QK");
+ gp_fprintf(fp, "@EJL ENTER LANGUAGE=ESC/PAGE\r\n");
}
return lp2000_print_page_copies(pdev, fp, num_coipes);
}
static int
-lp2000_print_page_copies(gx_device_printer * pdev, FILE * fp, int num_coipes)
+lp2000_print_page_copies(gx_device_printer * pdev, gp_file * fp, int num_coipes)
{
gx_device_lprn *const lprn = (gx_device_lprn *) pdev;
int code = 0;
@@ -148,9 +148,9 @@ lp2000_print_page_copies(gx_device_printer * pdev, FILE * fp, int num_coipes)
return_error(gs_error_VMerror);
if (lprn->NegativePrint) {
- fprintf(fp, "%c1dmG", GS);
- fprintf(fp, "%c0;0;%d;%d;0rG", GS, pdev->width, pdev->height);
- fprintf(fp, "%c2owE", GS);
+ gp_fprintf(fp, "%c1dmG", GS);
+ gp_fprintf(fp, "%c0;0;%d;%d;0rG", GS, pdev->width, pdev->height);
+ gp_fprintf(fp, "%c2owE", GS);
}
code = lprn_print_image(pdev, fp);
if (code < 0)
@@ -159,30 +159,30 @@ lp2000_print_page_copies(gx_device_printer * pdev, FILE * fp, int num_coipes)
gs_free(pdev->memory->non_gc_memory, lprn->CompBuf, bpl * 3 / 2 + 1, maxY, "lp2000_print_page_copies(CompBuf)");
if (pdev->Duplex)
- fprintf(fp, "%c0dpsE", GS);
+ gp_fprintf(fp, "%c0dpsE", GS);
else
- fprintf(fp, "\014"); /* eject page */
+ gp_fprintf(fp, "\014"); /* eject page */
return code;
}
/* Output data */
static void
-escpage_image_out(gx_device_printer * pdev, FILE * fp, int x, int y, int width, int height)
+escpage_image_out(gx_device_printer * pdev, gp_file * fp, int x, int y, int width, int height)
{
gx_device_lprn *const lprn = (gx_device_lprn *) pdev;
int Len;
- fprintf(fp, "%c%dY%c%dX", GS, y, GS, x);
+ gp_fprintf(fp, "%c%dY%c%dX", GS, y, GS, x);
Len = lips_mode3format_encode(lprn->TmpBuf, lprn->CompBuf, width / 8 * height);
- fprintf(fp, "%c%d;%d;%d;0bi{I", GS, Len,
+ gp_fprintf(fp, "%c%d;%d;%d;0bi{I", GS, Len,
width, height);
- fwrite(lprn->CompBuf, 1, Len, fp);
+ gp_fwrite(lprn->CompBuf, 1, Len, fp);
if (lprn->ShowBubble) {
- fprintf(fp, "%c0dmG", GS);
- fprintf(fp, "%c%d;%d;%d;%d;0rG", GS,
+ gp_fprintf(fp, "%c0dmG", GS);
+ gp_fprintf(fp, "%c%d;%d;%d;%d;0rG", GS,
x, y, x + width, y + height);
}
}
@@ -202,7 +202,7 @@ static char can_inits[] =
};
static void
-escpage_printer_initialize(gx_device_printer * pdev, FILE * fp, int copies)
+escpage_printer_initialize(gx_device_printer * pdev, gp_file * fp, int copies)
{
gx_device_lprn *const lprn = (gx_device_lprn *) pdev;
double xDpi, yDpi;
@@ -211,28 +211,28 @@ escpage_printer_initialize(gx_device_printer * pdev, FILE * fp, int copies)
yDpi = pdev->y_pixels_per_inch;
/* Initialize */
- fwrite(can_inits, sizeof(can_inits), 1, fp);
+ gp_fwrite(can_inits, sizeof(can_inits), 1, fp);
/* Duplex Setting */
if (pdev->Duplex_set > 0) {
if (pdev->Duplex) {
- fprintf(fp, "%c1sdE", GS);
+ gp_fprintf(fp, "%c1sdE", GS);
if (lprn->Tumble == 0)
- fprintf(fp, "%c0bdE", GS);
+ gp_fprintf(fp, "%c0bdE", GS);
else
- fprintf(fp, "%c1bdE", GS);
+ gp_fprintf(fp, "%c1bdE", GS);
} else
- fprintf(fp, "%c0sdE", GS);
+ gp_fprintf(fp, "%c0sdE", GS);
}
/* Set the Size Unit */
- fprintf(fp, "%c0;%4.2fmuE", GS, 72.0 / xDpi);
+ gp_fprintf(fp, "%c0;%4.2fmuE", GS, 72.0 / xDpi);
/* Set the Resolution */
- fprintf(fp, "%c0;%d;%ddrE", GS, (int)(xDpi + 0.5), (int)(yDpi + 0.5));
+ gp_fprintf(fp, "%c0;%d;%ddrE", GS, (int)(xDpi + 0.5), (int)(yDpi + 0.5));
/* Set the Paper Size */
escpage_paper_set(pdev, fp);
/* Set the desired number of Copies */
- fprintf(fp, "%c%dcoO", GS, copies < 256 ? copies : 255);
+ gp_fprintf(fp, "%c%dcoO", GS, copies < 256 ? copies : 255);
/* Set the Position to (0, 0) */
- fprintf(fp, "%c0;0loE", GS);
+ gp_fprintf(fp, "%c0;0loE", GS);
}
typedef struct {
@@ -268,7 +268,7 @@ static EpagPaperTable epagPaperTable[] =
};
static void
-escpage_paper_set(gx_device_printer * pdev, FILE * fp)
+escpage_paper_set(gx_device_printer * pdev, gp_file * fp)
{
int width, height, w, h, wp, hp, bLandscape;
EpagPaperTable *pt;
@@ -294,10 +294,10 @@ escpage_paper_set(gx_device_printer * pdev, FILE * fp)
if (pt->width == w && pt->height == h)
break;
- fprintf(fp, "%c%d", GS, pt->escpage);
+ gp_fprintf(fp, "%c%d", GS, pt->escpage);
if (pt->escpage < 0)
- fprintf(fp, ";%d;%d", wp, hp);
- fprintf(fp, "psE");
+ gp_fprintf(fp, ";%d;%d", wp, hp);
+ gp_fprintf(fp, "psE");
- fprintf(fp, "%c%dpoE", GS, bLandscape);
+ gp_fprintf(fp, "%c%dpoE", GS, bLandscape);
}
diff --git a/contrib/japanese/gdevfmlbp.c b/contrib/japanese/gdevfmlbp.c
index 0b2ee79c6..0e0ab4254 100644
--- a/contrib/japanese/gdevfmlbp.c
+++ b/contrib/japanese/gdevfmlbp.c
@@ -129,19 +129,19 @@ gdev_fmlbp_paper_size(gx_device_printer *dev, char *paper)
#endif/*FMLBP_NOPAPERSIZE*/
/* move down and move across */
-static void goto_xy(FILE *prn_stream,int x,int y)
+static void goto_xy(gp_file *prn_stream,int x,int y)
{
unsigned char buff[20];
unsigned char *p=buff;
- fputc(CEX,prn_stream);
- fputc('"',prn_stream);
+ gp_fputc(CEX,prn_stream);
+ gp_fputc('"',prn_stream);
gs_sprintf((char *)buff,"%d",x);
while (*p)
{
- if (!*(p+1)) fputc((*p)+0x30,prn_stream);
+ if (!*(p+1)) gp_fputc((*p)+0x30,prn_stream);
else
- fputc((*p)-0x10,prn_stream);
+ gp_fputc((*p)-0x10,prn_stream);
p++;
}
@@ -149,16 +149,16 @@ static void goto_xy(FILE *prn_stream,int x,int y)
gs_sprintf((char *)buff,"%d",y);
while (*p)
{
- if (!*(p+1)) fputc((*p)+0x40,prn_stream);
+ if (!*(p+1)) gp_fputc((*p)+0x40,prn_stream);
else
- fputc((*p)-0x10,prn_stream);
+ gp_fputc((*p)-0x10,prn_stream);
p++;
}
}
/* Send the page to the printer. */
static int
-fmlbp_print_page(gx_device_printer *pdev, FILE *prn_stream)
+fmlbp_print_page(gx_device_printer *pdev, gp_file *prn_stream)
{
int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
#ifdef FMLBP_NOPAPERSIZE
@@ -170,14 +170,14 @@ fmlbp_print_page(gx_device_printer *pdev, FILE *prn_stream)
#endif/*FMLBP_NOPAPERSIZE*/
/* initialize */
- fwrite(can_inits, sizeof(can_inits), 1, prn_stream);
- fprintf(prn_stream, "%c%c%d!I", PU1, 0); /* 100% */
+ gp_fwrite(can_inits, sizeof(can_inits), 1, prn_stream);
+ gp_fprintf(prn_stream, "%c%c%d!I", PU1, 0); /* 100% */
#ifndef OLD_FMLBP_400DPI
- fprintf(prn_stream, "%c%c%d!A", PU1,
+ gp_fprintf(prn_stream, "%c%c%d!A", PU1,
(int)(pdev->x_pixels_per_inch)); /* 240dpi or 400dpi */
#endif/*!OLD_FMLBP_400DPI*/
#ifndef FMLBP_NOPAPERSIZE
- fprintf(prn_stream, "%c%c%s!F", PU1,
+ gp_fprintf(prn_stream, "%c%c%s!F", PU1,
gdev_fmlbp_paper_size(pdev, paper)); /* Paper size */
#endif/*!FMLBP_NOPAPERSIZE*/
@@ -210,17 +210,17 @@ fmlbp_print_page(gx_device_printer *pdev, FILE *prn_stream)
goto_xy(prn_stream, num_cols, lnum);
/* transfer raster graphics */
- fprintf(prn_stream, "%c%c%d;%d;0!a",
- PU1, out_count, out_count*8 );
+ gp_fprintf(prn_stream, "%c%c%d;%d;0!a",
+ PU1, out_count, out_count*8 );
/* send the row */
- fwrite(out_data, sizeof(byte), out_count, prn_stream);
+ gp_fwrite(out_data, sizeof(byte), out_count, prn_stream);
}
}
}
/* eject page */
- fputc(0x0c,prn_stream);
- fflush(prn_stream);
+ gp_fputc(0x0c,prn_stream);
+ gp_fflush(prn_stream);
#ifndef FMLBP_NOPAPERSIZE
gs_free(pdev->memory->non_gc_memory, (char *)data, line_size, sizeof(byte), "fmlbp_print_page(data)");
#endif/*!FMLBP_NOPAPERSIZE*/
diff --git a/contrib/japanese/gdevfmpr.c b/contrib/japanese/gdevfmpr.c
index 2243b2c3a..cd34d4fd0 100644
--- a/contrib/japanese/gdevfmpr.c
+++ b/contrib/japanese/gdevfmpr.c
@@ -46,25 +46,25 @@ gx_device_printer gs_fmpr_device =
static int
prn_putc(gx_device_printer *pdev, int c)
{
- return fputc(c, pdev->file);
+ return gp_fputc(c, pdev->file);
}
static int
prn_puts(gx_device_printer *pdev, const char *ptr)
{
- return fputs(ptr, pdev->file);
+ return gp_fputs(ptr, pdev->file);
}
static int
prn_write(gx_device_printer *pdev, const char *ptr, int size)
{
- return fwrite(ptr, 1, size, pdev->file);
+ return gp_fwrite(ptr, 1, size, pdev->file);
}
-static int
+static void
prn_flush(gx_device_printer *pdev)
{
- return fflush(pdev->file);
+ gp_fflush(pdev->file);
}
/* ------ internal routines ------ */
@@ -105,7 +105,7 @@ fmpr_transpose_8x8(byte *src, int src_step, byte *dst, int dst_step)
/* Send the page to the printer. */
static int
-fmpr_print_page(gx_device_printer *pdev, FILE *prn_stream)
+fmpr_print_page(gx_device_printer *pdev, gp_file *prn_stream)
{
int line_size = gdev_prn_raster(pdev);
int height = pdev->height;
diff --git a/contrib/japanese/gdevj100.c b/contrib/japanese/gdevj100.c
index cf708aed4..f8a701794 100644
--- a/contrib/japanese/gdevj100.c
+++ b/contrib/japanese/gdevj100.c
@@ -75,7 +75,7 @@ jj100_transpose_8x8(byte *src, int src_step, byte *dst, int dst_step)
/* Send the page to the printer. */
static int
-jj100_print_page(gx_device_printer *pdev, FILE *prn_stream)
+jj100_print_page(gx_device_printer *pdev, gp_file *prn_stream)
{ int line_size = gdev_prn_raster(pdev);
int height = pdev->height;
int bits_per_column = 48;
@@ -91,9 +91,9 @@ jj100_print_page(gx_device_printer *pdev, FILE *prn_stream)
return -1;
/* Initialize printer */
- fputs("\033P", pdev->file); /* Proportional Mode */
- fputs("\033G", pdev->file); /* 1/180 inch per line */
- fputs("\033T16", pdev->file); /* 16/180 inch per line */
+ gp_fputs("\033P", pdev->file); /* Proportional Mode */
+ gp_fputs("\033G", pdev->file); /* 1/180 inch per line */
+ gp_fputs("\033T16", pdev->file); /* 16/180 inch per line */
/* Send Data to printer */
lnum = 0;
@@ -129,12 +129,12 @@ jj100_print_page(gx_device_printer *pdev, FILE *prn_stream)
/* Vertical tab to the appropriate position. */
while(skip > 15) {
gs_sprintf(prn_buf, "\037%c", 16 + 15);
- fputs(prn_buf, pdev->file);
+ gp_fputs(prn_buf, pdev->file);
skip -= 15;
}
if(skip > 0) {
gs_sprintf(prn_buf, "\037%c", 16 + skip);
- fputs(prn_buf, pdev->file);
+ gp_fputs(prn_buf, pdev->file);
}
/* Transpose in blocks of 8 scan lines. */
@@ -172,22 +172,22 @@ jj100_print_page(gx_device_printer *pdev, FILE *prn_stream)
/* Dot addressing */
gs_sprintf(prn_buf, "\033F%04d",
(out_beg - out) / bytes_per_column / 2);
- fputs(prn_buf, pdev->file);
+ gp_fputs(prn_buf, pdev->file);
/* Dot graphics */
size = out_end - out_beg + 1;
gs_sprintf(prn_buf, "\034bP,48,%04d.", size / bytes_per_column);
- fputs(prn_buf, pdev->file);
- fwrite(out_beg, 1, size, pdev->file);
+ gp_fputs(prn_buf, pdev->file);
+ gp_fwrite(out_beg, 1, size, pdev->file);
/* Carriage Return */
- fputc('\r', pdev->file);
+ gp_fputc('\r', pdev->file);
skip = 1;
}
/* Form Feed */
- fputc('\f', pdev->file);
- fflush(pdev->file);
+ gp_fputc('\f', pdev->file);
+ gp_fflush(pdev->file);
gs_free(pdev->memory->non_gc_memory, (char *)out,
bits_per_column, line_size, "jj100_print_page(out)");
diff --git a/contrib/japanese/gdevlbp3.c b/contrib/japanese/gdevlbp3.c
index 9b59dfd0c..096aecf63 100644
--- a/contrib/japanese/gdevlbp3.c
+++ b/contrib/japanese/gdevlbp3.c
@@ -66,10 +66,10 @@ static const struct ppi PaperInfo[] =
};
static void BoundImage(gx_device_printer *, struct bounding *);
-static long CompressImage(gx_device_printer *, struct bounding *, FILE *, const char *);
+static long CompressImage(gx_device_printer *, struct bounding *, gp_file *, const char *);
static int
-lbp310PrintPage(gx_device_printer *pDev, FILE *fp)
+lbp310PrintPage(gx_device_printer *pDev, gp_file *fp)
{
int i;
char Buf[10];
@@ -84,14 +84,14 @@ lbp310PrintPage(gx_device_printer *pDev, FILE *fp)
gs_sprintf(Buf, "0%ld", DataSize);
i = (DataSize+strlen(Buf)+1)&1;
/* ----==== escape to LIPS ====---- */
- fprintf(fp, "\x80%s\x80\x80\x80\x80\x0c",Buf+i);
- fprintf(fp, "\x1bP0J\x1b\\");
+ gp_fprintf(fp, "\x80%s\x80\x80\x80\x80\x0c",Buf+i);
+ gp_fprintf(fp, "\x1bP0J\x1b\\");
return(0);
}
static int
-lbp320PrintPage(gx_device_printer *pDev, FILE *fp)
+lbp320PrintPage(gx_device_printer *pDev, gp_file *fp)
{
int i;
char Buf[16];
@@ -105,7 +105,7 @@ lbp320PrintPage(gx_device_printer *pDev, FILE *fp)
Box.Right |= 1;
/* ----==== JOB start ??? ====---- */
- fprintf(fp, "\x1b%%-12345X@PJL CJLMODE\n@PJL JOB\n");
+ gp_fprintf(fp, "\x1b%%-12345X@PJL CJLMODE\n@PJL JOB\n");
DataSize = CompressImage(pDev, &Box, fp, "\x1b[1;%d;%d;11;%d;.&r");
@@ -113,9 +113,9 @@ lbp320PrintPage(gx_device_printer *pDev, FILE *fp)
gs_sprintf(Buf, "000%ld", DataSize);
i = (DataSize+strlen(Buf)+1)&3;
/* ----==== escape to LIPS ====---- */
- fprintf(fp, "\x80%s\x80\x80\x80\x80\x0c",Buf+i);
- fprintf(fp, "\x1bP0J\x1b\\");
- fprintf(fp, "\x1b%%-12345X@PJL CJLMODE\n@PJL EOJ\n\x1b%%-12345X");
+ gp_fprintf(fp, "\x80%s\x80\x80\x80\x80\x0c",Buf+i);
+ gp_fprintf(fp, "\x1bP0J\x1b\\");
+ gp_fprintf(fp, "\x1b%%-12345X@PJL CJLMODE\n@PJL EOJ\n\x1b%%-12345X");
return(0);
}
@@ -176,7 +176,7 @@ BoundImage(gx_device_printer *pDev, struct bounding *pBox)
}
static long
-CompressImage(gx_device_printer *pDev, struct bounding *pBox, FILE *fp, const char *format)
+CompressImage(gx_device_printer *pDev, struct bounding *pBox, gp_file *fp, const char *format)
{
int x, y, i, count = 255;
int Xres = (int)pDev->x_pixels_per_inch;
@@ -186,28 +186,28 @@ CompressImage(gx_device_printer *pDev, struct bounding *pBox, FILE *fp, const ch
/* ----==== Printer initialize ====---- */
/* ----==== start TEXT mode ====---- */
- fprintf(fp, "\x1b%%@");
+ gp_fprintf(fp, "\x1b%%@");
/* ----==== job start ====---- */
- fprintf(fp, "\x1bP35;%d;1J;GhostScript\x1b\\", Xres);
+ gp_fprintf(fp, "\x1bP35;%d;1J;GhostScript\x1b\\", Xres);
/* ----==== soft reset ====---- */
- fprintf(fp, "\x1b<");
+ gp_fprintf(fp, "\x1b<");
/* ----==== select size as dot ====---- */
- fprintf(fp, "\x1b[7 I");
+ gp_fprintf(fp, "\x1b[7 I");
/* ----==== ??? ====---- */
- fprintf(fp, "\x1b[;1;'v");
+ gp_fprintf(fp, "\x1b[;1;'v");
/* ----==== set paper size ====---- */
- fprintf(fp, "\x1b[%d;;p", PaperInfo[pBox->paper].id);
+ gp_fprintf(fp, "\x1b[%d;;p", PaperInfo[pBox->paper].id);
/* ----==== select sheet feeder ====---- */
- fprintf(fp, "\x1b[1q");
+ gp_fprintf(fp, "\x1b[1q");
/* ----==== disable automatic FF ====---- */
- fprintf(fp, "\x1b[?2h");
+ gp_fprintf(fp, "\x1b[?2h");
/* ----==== set number of copies ====---- */
- fprintf(fp, "\x1b[%dv", 1);
+ gp_fprintf(fp, "\x1b[%dv", 1);
/* ----==== move CAP location ====---- */
- fprintf(fp, "\x1b[%d;%df", pBox->Top, pBox->Left*16);
+ gp_fprintf(fp, "\x1b[%d;%df", pBox->Top, pBox->Left*16);
/* ----==== draw raster image ====---- */
- fprintf(fp, format, pBox->Right-pBox->Left+1,
- Xres, pBox->Bottom-pBox->Top+1);
+ gp_fprintf(fp, format, pBox->Right-pBox->Left+1,
+ Xres, pBox->Bottom-pBox->Top+1);
/* ----==== Allocate momory ====---- */
Buf = (byte *)gs_malloc(pDev->memory->non_gc_memory, 1, LineSize, "LineBuffer");
@@ -230,7 +230,7 @@ CompressImage(gx_device_printer *pDev, struct bounding *pBox, FILE *fp, const ch
count--;
continue;
} else {
- fprintf(fp, "%c%c", count, c_prev);
+ gp_fprintf(fp, "%c%c", count, c_prev);
DataSize += 2;
}
} else if (count == 0) {
@@ -243,8 +243,8 @@ CompressImage(gx_device_printer *pDev, struct bounding *pBox, FILE *fp, const ch
continue;
} else if (count < 127) {
if (c_prev == c_cur) {
- fprintf(fp, "%c", count-1);
- fwrite(oBuf, 1, count, fp);
+ gp_fprintf(fp, "%c", count-1);
+ gp_fwrite(oBuf, 1, count, fp);
DataSize += (count+1);
count = -1;
} else {
@@ -253,8 +253,8 @@ CompressImage(gx_device_printer *pDev, struct bounding *pBox, FILE *fp, const ch
}
continue;
} else if (count == 127) {
- fprintf(fp, "%c", count);
- fwrite(oBuf, 1, count+1, fp);
+ gp_fprintf(fp, "%c", count);
+ gp_fwrite(oBuf, 1, count+1, fp);
DataSize += (count+2);
}
c_prev = *oBuf = c_cur;
@@ -264,11 +264,11 @@ CompressImage(gx_device_printer *pDev, struct bounding *pBox, FILE *fp, const ch
/* ----==== flush data ====---- */
if (count < 0) {
- fprintf(fp, "%c%c", count, c_prev);
+ gp_fprintf(fp, "%c%c", count, c_prev);
DataSize += 2;
} else {
- fprintf(fp, "%c", count);
- fwrite(oBuf, 1, count+1, fp);
+ gp_fprintf(fp, "%c", count);
+ gp_fwrite(oBuf, 1, count+1, fp);
DataSize += (count+2);
}
diff --git a/contrib/japanese/gdevmjc.c b/contrib/japanese/gdevmjc.c
index b02f9c438..85fa6a8a0 100644
--- a/contrib/japanese/gdevmjc.c
+++ b/contrib/japanese/gdevmjc.c
@@ -160,7 +160,7 @@ static dev_proc_put_params(mj500c_put_params);
static int mj_open(gx_device * pdev, int ptype);
static int mj_put_params(gx_device * pdev, gs_param_list * plist, int ptype);
-static int mj_print_page(gx_device_printer * pdev, FILE * prn_stream, int ptype);
+static int mj_print_page(gx_device_printer * pdev, gp_file * prn_stream, int ptype);
static void expand_line(word *, int, int, int);
static int put_param_int(gs_param_list *, gs_param_name, int *, int, int, int);
static void set_bpp(gx_device *, int);
@@ -615,7 +615,7 @@ mj_put_params(gx_device *pdev, gs_param_list *plist, int ptype)
/*
* Miscellaneous functions for Canon BJC-600J printers in raster command mode.
*/
-#define fputshort(n, f) fputc((n)%256,f);fputc((n)/256,f)
+#define fputshort(n, f) gp_fputc((n)%256,f);gp_fputc((n)/256,f)
#define row_bytes (img_rows / 8)
#define row_words (row_bytes / sizeof(word))
@@ -623,7 +623,7 @@ mj_put_params(gx_device *pdev, gs_param_list *plist, int ptype)
static int
mj_raster_cmd(int c_id, int in_size, byte* in, byte* buf2,
- gx_device_printer* pdev, FILE* prn_stream)
+ gx_device_printer* pdev, gp_file* prn_stream)
{
int band_size = 1; /* 1, 8, or 24 */
@@ -642,8 +642,8 @@ mj_raster_cmd(int c_id, int in_size, byte* in, byte* buf2,
/* specifying a colour */
- fputs("\033r",prn_stream); /* secape sequence to specify a color */
- fputc(colour_number[c_id], prn_stream);
+ gp_fputs("\033r",prn_stream); /* secape sequence to specify a color */
+ gp_fputc(colour_number[c_id], prn_stream);
/* end of specifying a colour */
@@ -745,53 +745,53 @@ mj_raster_cmd(int c_id, int in_size, byte* in, byte* buf2,
** Output data:
*/
- fwrite("\033.\001", 1, 3, prn_stream);
+ gp_fwrite("\033.\001", 1, 3, prn_stream);
if(pdev->y_pixels_per_inch == 720)
- fputc('\005', prn_stream);
+ gp_fputc('\005', prn_stream);
else if(pdev->y_pixels_per_inch == 180)
- fputc('\024', prn_stream);
+ gp_fputc('\024', prn_stream);
else /* pdev->y_pixels_per_inch == 360 */
- fputc('\012', prn_stream);
+ gp_fputc('\012', prn_stream);
if(pdev->x_pixels_per_inch == 720)
- fputc('\005', prn_stream);
+ gp_fputc('\005', prn_stream);
else if(pdev->x_pixels_per_inch == 180)
- fputc('\024', prn_stream);
+ gp_fputc('\024', prn_stream);
else /* pdev->x_pixels_per_inch == 360 */
- fputc('\012', prn_stream);
+ gp_fputc('\012', prn_stream);
- fputc(band_size, prn_stream);
+ gp_fputc(band_size, prn_stream);
- fputc((width << 3) & 0xff, prn_stream);
- fputc( width >> 5, prn_stream);
+ gp_fputc((width << 3) & 0xff, prn_stream);
+ gp_fputc( width >> 5, prn_stream);
- fwrite(out, 1, (outp - out), prn_stream);
+ gp_fwrite(out, 1, (outp - out), prn_stream);
- fputc('\r', prn_stream);
+ gp_fputc('\r', prn_stream);
return 0;
}
static int
-mj_v_skip(int n, gx_device_printer *pdev, FILE *stream)
+mj_v_skip(int n, gx_device_printer *pdev, gp_file *stream)
{
/* This is a kind of magic number. */
static const int max_y_step = (256 * 15 + 255);
int l = n - max_y_step;
for (; l > 0; l -= max_y_step) { /* move 256 * 15 + 255 dots at once*/
- fwrite("\033(v\2\0\xff\x0f", sizeof(byte), 7, stream);
+ gp_fwrite("\033(v\2\0\xff\x0f", sizeof(byte), 7, stream);
}
l += max_y_step;
/* move to the end. */
{
int n2 = l / 256;
int n1 = l - n2 * 256;
- fwrite("\033(v\2\0", sizeof(byte) ,5 ,stream);
- fputc(n1, stream);
- fputc(n2, stream);
- fputc('\r', stream);
+ gp_fwrite("\033(v\2\0", sizeof(byte) ,5 ,stream);
+ gp_fputc(n1, stream);
+ gp_fputc(n2, stream);
+ gp_fputc('\r', stream);
}
return 0;
}
@@ -933,32 +933,32 @@ xtal_plane( byte *dp , short *buf[] , byte *oP , short **bar , int plane_size ,
}
static int
-mj700v2c_print_page(gx_device_printer * pdev, FILE * prn_stream)
+mj700v2c_print_page(gx_device_printer * pdev, gp_file * prn_stream)
{
return mj_print_page(pdev, prn_stream, MJ700V2C);
}
static int
-mj500c_print_page(gx_device_printer * pdev, FILE * prn_stream)
+mj500c_print_page(gx_device_printer * pdev, gp_file * prn_stream)
{
return mj_print_page(pdev, prn_stream, MJ500C);
}
static int
-mj6000c_print_page(gx_device_printer * pdev, FILE * prn_stream)
+mj6000c_print_page(gx_device_printer * pdev, gp_file * prn_stream)
{
return mj_print_page(pdev, prn_stream, MJ6000C);
}
static int
-mj8000c_print_page(gx_device_printer * pdev, FILE * prn_stream)
+mj8000c_print_page(gx_device_printer * pdev, gp_file * prn_stream)
{
return mj_print_page(pdev, prn_stream, MJ8000C);
}
/* Send the page to the printer. Compress each scan line. */
static int
-mj_print_page(gx_device_printer * pdev, FILE * prn_stream, int ptype)
+mj_print_page(gx_device_printer * pdev, gp_file * prn_stream, int ptype)
{
/* int line_size = gdev_prn_rasterwidth(pdev, 0); */
int line_size = gdev_prn_raster(pdev);
@@ -1118,27 +1118,27 @@ mj_print_page(gx_device_printer * pdev, FILE * prn_stream, int ptype)
{
/** Reset printer, enter graphics mode: */
- fwrite("\033@\033(G\001\000\001", sizeof(byte), 8, prn_stream);
+ gp_fwrite("\033@\033(G\001\000\001", sizeof(byte), 8, prn_stream);
/** Micro-weave-Mode */
if (mj->microweave) {
- fwrite("\033(i\001\000\001", sizeof(byte), 6, prn_stream);
+ gp_fwrite("\033(i\001\000\001", sizeof(byte), 6, prn_stream);
}
/** Dot-Size define */
if (mj->dotsize) {
- fwrite("\033(e\002\000\000\001", sizeof(byte), 7, prn_stream);
+ gp_fwrite("\033(e\002\000\000\001", sizeof(byte), 7, prn_stream);
}
if (ptype == MJ6000C || ptype == MJ8000C) {
/* Select Monochrome/Color Printing Mode Command */
if (pdev->color_info.depth == 8)
- fwrite("\033(K\002\000\000\001", sizeof(byte), 7, prn_stream);
+ gp_fwrite("\033(K\002\000\000\001", sizeof(byte), 7, prn_stream);
}
if (mj->direction) /* set the direction of the head */
- fwrite("\033U\1", 1, 3, prn_stream); /* Unidirectional Printing */
+ gp_fwrite("\033U\1", 1, 3, prn_stream); /* Unidirectional Printing */
else
- fwrite("\033U\0", 1, 3, prn_stream);
+ gp_fwrite("\033U\0", 1, 3, prn_stream);
#if 0
#ifdef A4
@@ -1149,7 +1149,7 @@ mj_print_page(gx_device_printer * pdev, FILE * prn_stream, int ptype)
** margin measured from the *top* of the page:
*/
- fwrite("\033(U\001\0\n\033(C\002\0t\020\033(c\004\0\0\0t\020",
+ gp_fwrite("\033(U\001\0\n\033(C\002\0t\020\033(c\004\0\0\0t\020",
1, 22, prn_stream);
#endif
#endif
@@ -1158,18 +1158,17 @@ mj_print_page(gx_device_printer * pdev, FILE * prn_stream, int ptype)
** Set the line spacing to match the band height:
*/
- if( pdev->y_pixels_per_inch >= 720 ) {
- fwrite("\033(U\001\0\005\033+\001", sizeof(byte), 9, prn_stream);
- }
+ if( pdev->y_pixels_per_inch >= 720 )
+ gp_fwrite("\033(U\001\0\005\033+\001", sizeof(byte), 9, prn_stream);
else if( pdev->y_pixels_per_inch >= 360 )
- fwrite("\033(U\001\0\012\033+\001", sizeof(byte), 9, prn_stream);
+ gp_fwrite("\033(U\001\0\012\033+\001", sizeof(byte), 9, prn_stream);
else /* 180 dpi */
- fwrite("\033(U\001\0\024\033+\002", sizeof(byte), 9, prn_stream);
+ gp_fwrite("\033(U\001\0\024\033+\002", sizeof(byte), 9, prn_stream);
/* set the length of the page */
- fwrite("\033(C\2\0", sizeof(byte), 5, prn_stream);
- fputc(((pdev->height) % 256), prn_stream);
- fputc(((pdev->height) / 256), prn_stream);
+ gp_fwrite("\033(C\2\0", sizeof(byte), 5, prn_stream);
+ gp_fputc(((pdev->height) % 256), prn_stream);
+ gp_fputc(((pdev->height) / 256), prn_stream);
}
#define MOFFSET (pdev->t_margin - MJ700V2C_PRINT_LIMIT) /* Print position */
@@ -1178,8 +1177,8 @@ mj_print_page(gx_device_printer * pdev, FILE * prn_stream, int ptype)
int MJ_MARGIN_MM = 55;
uint top_skip = ( MJ_MARGIN_MM * pdev->y_pixels_per_inch ) / 254;
top_skip = (top_skip ^ (-1)) & 65536;
- fwrite("\033(V\2\0\0\0",sizeof(byte), 7, prn_stream);
- fwrite("\033(v\2\0\0\xff",sizeof(byte), 7, prn_stream);
+ gp_fwrite("\033(V\2\0\0\0",sizeof(byte), 7, prn_stream);
+ gp_fwrite("\033(v\2\0\0\xff",sizeof(byte), 7, prn_stream);
}
/* Send each scan line in turn */
@@ -1398,9 +1397,9 @@ mj_print_page(gx_device_printer * pdev, FILE * prn_stream, int ptype)
{
if ( pdev->y_pixels_per_inch > 360 ) {
- fwrite("\033(v\2\0\1\0",sizeof(byte),7, prn_stream);
+ gp_fwrite("\033(v\2\0\1\0",sizeof(byte),7, prn_stream);
} else {
- fputc('\n', prn_stream);
+ gp_fputc('\n', prn_stream);
}
}
scan = 1 - scan; /* toggle scan direction */
@@ -1412,8 +1411,8 @@ mj_print_page(gx_device_printer * pdev, FILE * prn_stream, int ptype)
/* eject page */
{
- fputs("\f\033@", prn_stream);
- fflush(prn_stream);
+ gp_fputs("\f\033@", prn_stream);
+ gp_fflush(prn_stream);
}
/* free temporary storage */
gs_free(pdev->memory->non_gc_memory, (char *) storage, storage_size_words, W, "mj_colour_print_page");
diff --git a/contrib/japanese/gdevml6.c b/contrib/japanese/gdevml6.c
index 79943be26..d8eaa1c30 100644
--- a/contrib/japanese/gdevml6.c
+++ b/contrib/japanese/gdevml6.c
@@ -46,19 +46,19 @@ gx_device_printer gs_ml600_device =
/* ------ prototype ------ */
static int
ml_finish(
- gx_device_printer *pdev,
- FILE *fp);
+ gx_device_printer *pdev,
+ gp_file *fp);
static int
ml_init(
- gx_device_printer *pdev,
- FILE *fp);
+ gx_device_printer *pdev,
+ gp_file *fp);
static int
move_pos(
- FILE *fp,
- int n,
- int m);
+ gp_file *fp,
+ int n,
+ int m);
static int
make_line_data(
@@ -69,14 +69,14 @@ make_line_data(
static int
send_line(
- byte *buf,
- int cnt,
- FILE *fp);
+ byte *buf,
+ int cnt,
+ gp_file *fp);
static int
page_header(
- gx_device_printer *pdev,
- FILE *fp);
+ gx_device_printer *pdev,
+ gp_file *fp);
/* ------ Internal routines ------ */
@@ -86,10 +86,10 @@ page_header(
static int
ml600_open(
- gx_device *pdev)
+ gx_device *pdev)
{
- int code = gdev_prn_open(pdev);
- FILE *prn_stream;
+ int code = gdev_prn_open(pdev);
+ gp_file *prn_stream;
/* dprintf("gdevml6: ml600_open called\n");*/
@@ -106,10 +106,10 @@ ml600_open(
static int
ml600_close(
- gx_device *pdev)
+ gx_device *pdev)
{
- int code = gdev_prn_open_printer(pdev, true);
- FILE *prn_stream;
+ int code = gdev_prn_open_printer(pdev, true);
+ gp_file *prn_stream;
/* dprintf("gdevml6: ml600_close called\n"); */
if (code < 0)
@@ -124,8 +124,8 @@ ml600_close(
/* Send the page to the printer. */
static int
ml600_print_page(
- gx_device_printer *pdev,
- FILE *prn_stream)
+ gx_device_printer *pdev,
+ gp_file *prn_stream)
{
int ystep;
byte data[2][LINE_SIZE*2];
@@ -192,29 +192,29 @@ ml600_print_page(
}
/* eject page */
- fprintf(prn_stream, "\014");
+ gp_fprintf(prn_stream, "\014");
return 0;
}
static int
move_pos(
- FILE *fp,
- int n,
- int m)
+ gp_file *fp,
+ int n,
+ int m)
{
- fprintf(fp, "%c%c%c%c%c%c", ESC, 0x7c, 0xa6, 1, 0, 2);
- fprintf(fp, "%c%c%c%c%c%c%c%c%c", ESC, 0x7c, 0xa4, 4, 0,
- (n >> 8) & 0xff, n & 0xff, 0, 0);
+ gp_fprintf(fp, "%c%c%c%c%c%c", ESC, 0x7c, 0xa6, 1, 0, 2);
+ gp_fprintf(fp, "%c%c%c%c%c%c%c%c%c", ESC, 0x7c, 0xa4, 4, 0,
+ (n >> 8) & 0xff, n & 0xff, 0, 0);
if (m > 0) {
int i;
- fprintf(fp, "%c%c%c%c%c%c", ESC, 0x7c, 0xa6, 1, 0, 0);
+ gp_fprintf(fp, "%c%c%c%c%c%c", ESC, 0x7c, 0xa6, 1, 0, 0);
for (i = 0; i < m; i++) {
- fprintf(fp, "%c%c%c%c%c%c", ESC, 0x7c, 0xa7, 0, 1, 0);
+ gp_fprintf(fp, "%c%c%c%c%c%c", ESC, 0x7c, 0xa7, 0, 1, 0);
}
}
- fprintf(fp, "%c%c%c%c%c%c", ESC, 0x7c, 0xa6, 1, 0, 3);
+ gp_fprintf(fp, "%c%c%c%c%c%c", ESC, 0x7c, 0xa6, 1, 0, 3);
return 0;
}
@@ -280,63 +280,63 @@ make_line_data(
static int
send_line(
- byte *buf,
- int cnt,
- FILE *fp)
+ byte *buf,
+ int cnt,
+ gp_file *fp)
{
- fprintf(fp, "%c%c%c", ESC, 0x7c, 0xa7);
- fprintf(fp, "%c%c", (cnt >> 8) & 0xff, cnt & 0xff);
- return fwrite(buf, sizeof(byte), cnt, fp);
+ gp_fprintf(fp, "%c%c%c", ESC, 0x7c, 0xa7);
+ gp_fprintf(fp, "%c%c", (cnt >> 8) & 0xff, cnt & 0xff);
+ return gp_fwrite(buf, sizeof(byte), cnt, fp);
}
static int
ml_init(
- gx_device_printer *pdev,
- FILE *fp)
+ gx_device_printer *pdev,
+ gp_file *fp)
{
/* dprintf("gdevml6: ml_init called\n"); */
- fprintf(fp, "%c%c%c", ESC, 0x2f, 0xf2);
+ gp_fprintf(fp, "%c%c%c", ESC, 0x2f, 0xf2);
return 0;
}
static int
page_header(
- gx_device_printer *pdev,
- FILE *fp)
+ gx_device_printer *pdev,
+ gp_file *fp)
{
int ydpi;
- fprintf(fp, "%c%c%c%c%c%c", ESC, 0x7c, 0xa0, 1, 0, 1);
- fprintf(fp, "%c%c%c%c%c%c", ESC, 0x7c, 0xa1, 1, 0, 1);
- fprintf(fp, "%c%c%c%c%c%c", ESC, 0x7c, 0xa2, 1, 0, 1);
+ gp_fprintf(fp, "%c%c%c%c%c%c", ESC, 0x7c, 0xa0, 1, 0, 1);
+ gp_fprintf(fp, "%c%c%c%c%c%c", ESC, 0x7c, 0xa1, 1, 0, 1);
+ gp_fprintf(fp, "%c%c%c%c%c%c", ESC, 0x7c, 0xa2, 1, 0, 1);
if (pdev->y_pixels_per_inch > 600) { /* 600 x 1200 dpi */
- fprintf(fp, "%c%c%c%c%c%c%c%c%c",
+ gp_fprintf(fp, "%c%c%c%c%c%c%c%c%c",
ESC, 0x7c, 0xa5, 4, 0, 2, 0x58, 4, 0xb0);
ydpi = 1200;
}
else if (pdev->y_pixels_per_inch > 300) { /* 600 dpi */
- fprintf(fp, "%c%c%c%c%c%c%c", ESC, 0x7c, 0xa5, 2, 0, 2, 0x58);
+ gp_fprintf(fp, "%c%c%c%c%c%c%c", ESC, 0x7c, 0xa5, 2, 0, 2, 0x58);
ydpi = 600;
}
else {
- fprintf(fp, "%c%c%c%c%c%c%c", ESC, 0x7c, 0xa5, 2, 0, 1, 0x2c);
+ gp_fprintf(fp, "%c%c%c%c%c%c%c", ESC, 0x7c, 0xa5, 2, 0, 1, 0x2c);
ydpi = 300;
}
- fprintf(fp, "%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",
- ESC, 0x7c, 0xf1, 0x0c, 0, 0, 1 , 0, 2, 0, 0, 0, 0, 0, 0, 0, 0);
- fprintf(fp, "%c%c%c%c%c%c", ESC, 0x7c, 0xa6, 1, 0, 3);
+ gp_fprintf(fp, "%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",
+ ESC, 0x7c, 0xf1, 0x0c, 0, 0, 1 , 0, 2, 0, 0, 0, 0, 0, 0, 0, 0);
+ gp_fprintf(fp, "%c%c%c%c%c%c", ESC, 0x7c, 0xa6, 1, 0, 3);
return ydpi;
}
static int
ml_finish(
- gx_device_printer *pdev,
- FILE *fp)
+ gx_device_printer *pdev,
+ gp_file *fp)
{
- fprintf(fp, "%c%c%c", ESC, 0x2f, 0xfe);
+ gp_fprintf(fp, "%c%c%c", ESC, 0x2f, 0xfe);
return 0;
}
diff --git a/contrib/japanese/gdevnpdl.c b/contrib/japanese/gdevnpdl.c
index 597ecc84a..4ecace501 100644
--- a/contrib/japanese/gdevnpdl.c
+++ b/contrib/japanese/gdevnpdl.c
@@ -548,7 +548,7 @@ npdl_close(gx_device *pdev)
gx_device_printer *const ppdev = (gx_device_printer *) pdev;
int code = gdev_prn_open_printer(pdev, 1);
if (code >= 0)
- fputs("\033c1", ppdev->file);
+ gp_fputs("\033c1", ppdev->file);
return gdev_prn_close(pdev);
}
@@ -571,7 +571,7 @@ npdl_put_params(gx_device * pdev, gs_param_list * plist)
/* Send the page to the printer. For speed, compress each scan line,
since computer-to-printer communication time is often a bottleneck. */
static int
-npdl_print_page_copies(gx_device_printer * pdev, FILE * prn_stream, int num_copies)
+npdl_print_page_copies(gx_device_printer * pdev, gp_file * prn_stream, int num_copies)
{
gx_device_lprn *const lprn = (gx_device_lprn *) pdev;
int line_size = gdev_prn_raster(pdev);
@@ -587,8 +587,8 @@ npdl_print_page_copies(gx_device_printer * pdev, FILE * prn_stream, int num_copi
if (pdev->PageCount == 0) {
/* Initialize printer */
- fputs("\033c1", prn_stream); /* Software Reset */
- fputs("\034d240.", prn_stream); /* Page Printer Mode */
+ gp_fputs("\033c1", prn_stream); /* Software Reset */
+ gp_fputs("\034d240.", prn_stream); /* Page Printer Mode */
/* Check paper size */
switch (npdl_get_paper_size((gx_device *) pdev)) {
@@ -622,58 +622,58 @@ npdl_print_page_copies(gx_device_printer * pdev, FILE * prn_stream, int num_copi
}
if (lprn->ManualFeed) {
- fprintf(prn_stream, "\034f%cM0.",
- (pdev->MediaSize[0] > pdev->MediaSize[1]) ? 'L' : 'P');
+ gp_fprintf(prn_stream, "\034f%cM0.",
+ (pdev->MediaSize[0] > pdev->MediaSize[1]) ? 'L' : 'P');
/* Page Orientation P: Portrait, L: Landscape */
} else {
- fprintf(prn_stream, "\034f%c%s.",
- (pdev->MediaSize[0] > pdev->MediaSize[1]) ? 'L' : 'P',
+ gp_fprintf(prn_stream, "\034f%c%s.",
+ (pdev->MediaSize[0] > pdev->MediaSize[1]) ? 'L' : 'P',
/* Page Orientation P: Portrait, L: Landscape */
- paper_command); /* Paper Size */
+ paper_command); /* Paper Size */
}
- fprintf(prn_stream, "\034<1/%d,i.", x_dpi); /* Image Resolution */
+ gp_fprintf(prn_stream, "\034<1/%d,i.", x_dpi); /* Image Resolution */
/* Duplex Setting */
if (pdev->Duplex_set > 0) {
if (pdev->Duplex) {
if (lprn->Tumble == 0)
- fprintf(prn_stream, "\034'B,,1,0.");
+ gp_fprintf(prn_stream, "\034'B,,1,0.");
else
- fprintf(prn_stream, "\034'B,,2,0.");
+ gp_fprintf(prn_stream, "\034'B,,2,0.");
} else
- fprintf(prn_stream, "\034'S,,,0.");
+ gp_fprintf(prn_stream, "\034'S,,,0.");
}
}
if (num_copies > 99)
num_copies = 99;
- fprintf(prn_stream, "\034x%d.", num_copies);
+ gp_fprintf(prn_stream, "\034x%d.", num_copies);
lprn->initialized = false;
if (lprn->NegativePrint) {
- fprintf(prn_stream, "\034e0,0."); /* move to (0, 0) */
- fprintf(prn_stream, "\034Y"); /* goto figure mode */
- fprintf(prn_stream, "SU1,%d,0;", (int)pdev->x_pixels_per_inch);
+ gp_fprintf(prn_stream, "\034e0,0."); /* move to (0, 0) */
+ gp_fprintf(prn_stream, "\034Y"); /* goto figure mode */
+ gp_fprintf(prn_stream, "SU1,%d,0;", (int)pdev->x_pixels_per_inch);
/* Setting Printer Unit */
- fprintf(prn_stream, "SG0,0;"); /* select black color */
- fprintf(prn_stream, "NP;"); /* begin path */
- fprintf(prn_stream, "PA%d,0,%d,%d,0,%d;",
- pdev->width, pdev->width, pdev->height, pdev->height);
+ gp_fprintf(prn_stream, "SG0,0;"); /* select black color */
+ gp_fprintf(prn_stream, "NP;"); /* begin path */
+ gp_fprintf(prn_stream, "PA%d,0,%d,%d,0,%d;",
+ pdev->width, pdev->width, pdev->height, pdev->height);
/* draw rectangle */
- fprintf(prn_stream, "CP"); /* close path */
- fprintf(prn_stream, "EP;"); /* end path */
- fprintf(prn_stream, "FL0;"); /* fill path */
- fprintf(prn_stream, "\034Z"); /* end of figure mode */
- fprintf(prn_stream, "\034\"R."); /* `R'eplace Mode */
+ gp_fprintf(prn_stream, "CP"); /* close path */
+ gp_fprintf(prn_stream, "EP;"); /* end path */
+ gp_fprintf(prn_stream, "FL0;"); /* fill path */
+ gp_fprintf(prn_stream, "\034Z"); /* end of figure mode */
+ gp_fprintf(prn_stream, "\034\"R."); /* `R'eplace Mode */
}
code = lprn_print_image(pdev, prn_stream);
if (code < 0)
return code;
/* Form Feed */
- fputs("\014", prn_stream);
+ gp_fputs("\014", prn_stream);
gs_free(pdev->memory->non_gc_memory, lprn->CompBuf, line_size * maxY, sizeof(byte), "npdl_print_page_copies(CompBuf)");
return 0;
@@ -681,13 +681,13 @@ npdl_print_page_copies(gx_device_printer * pdev, FILE * prn_stream, int num_copi
/* Output data */
static void
-npdl_image_out(gx_device_printer * pdev, FILE * prn_stream, int x, int y, int width, int height)
+npdl_image_out(gx_device_printer * pdev, gp_file * prn_stream, int x, int y, int width, int height)
{
gx_device_lprn *const lprn = (gx_device_lprn *) pdev;
int num_bytes;
int x_dpi = (int)(pdev->x_pixels_per_inch);
- fprintf(prn_stream, "\034e%d,%d.", x, y);
+ gp_fprintf(prn_stream, "\034e%d,%d.", x, y);
/* Data compression */
num_bytes = mh_compression(lprn->TmpBuf, lprn->CompBuf, width / 8, height);
@@ -695,16 +695,16 @@ npdl_image_out(gx_device_printer * pdev, FILE * prn_stream, int x, int y, int wi
* If the compression ratio >= 100%, send uncompressed data
*/
if (num_bytes == 0) {
- fprintf(prn_stream, "\034i%d,%d,0,1/1,1/1,%d,%d.", width,
- height, width * height / 8, x_dpi);
- fwrite(lprn->TmpBuf, 1, width * height / 8, prn_stream);
+ gp_fprintf(prn_stream, "\034i%d,%d,0,1/1,1/1,%d,%d.", width,
+ height, width * height / 8, x_dpi);
+ gp_fwrite(lprn->TmpBuf, 1, width * height / 8, prn_stream);
}
/*
* If the compression ratio < 100%, send compressed data
*/
else {
- fprintf(prn_stream, "\034i%d,%d,1,1/1,1/1,%d,%d.", width,
- height, num_bytes, x_dpi);
- fwrite(lprn->CompBuf, 1, num_bytes, prn_stream);
+ gp_fprintf(prn_stream, "\034i%d,%d,1,1/1,1/1,%d,%d.", width,
+ height, num_bytes, x_dpi);
+ gp_fwrite(lprn->CompBuf, 1, num_bytes, prn_stream);
}
}
diff --git a/contrib/japanese/gdevp201.c b/contrib/japanese/gdevp201.c
index c40f4e097..11f8f98e1 100644
--- a/contrib/japanese/gdevp201.c
+++ b/contrib/japanese/gdevp201.c
@@ -125,7 +125,7 @@ check_mode(const char* modename)
/* Send the page to the printer. */
static int
-pr201_print_page(gx_device_printer *pdev, FILE *prn_stream)
+pr201_print_page(gx_device_printer *pdev, gp_file *prn_stream)
{ int line_size;
int height;
int bits_per_column;
@@ -161,12 +161,12 @@ pr201_print_page(gx_device_printer *pdev, FILE *prn_stream)
return -1;
/* Initialize printer */
- fputs("\033cl", pdev->file); /* Software Reset */
- fputs("\033P", pdev->file); /* Proportional Mode */
+ gp_fputs("\033cl", pdev->file); /* Software Reset */
+ gp_fputs("\033P", pdev->file); /* Proportional Mode */
if (check_mode(pdev->dname)==PR150){
- fprintf(pdev->file, "\034d%d.", x_dpi); /* 320 dpi mode. */
+ gp_fprintf(pdev->file, "\034d%d.", x_dpi); /* 320 dpi mode. */
}
- fprintf(pdev->file, "\033T%d" , lr_pitch);
+ gp_fprintf(pdev->file, "\033T%d" , lr_pitch);
/* 18/120 inch per line */
/* Send Data to printer */
@@ -202,11 +202,11 @@ pr201_print_page(gx_device_printer *pdev, FILE *prn_stream)
/* Vertical tab to the appropriate position. */
while(skip > 72) {
- fprintf(pdev->file, "\037%c", 16 + 72);
+ gp_fprintf(pdev->file, "\037%c", 16 + 72);
skip -= 72;
}
if(skip > 0) {
- fprintf(pdev->file, "\037%c", 16 + skip);
+ gp_fprintf(pdev->file, "\037%c", 16 + skip);
}
/* Transpose in blocks of 8 scan lines. */
@@ -242,27 +242,27 @@ pr201_print_page(gx_device_printer *pdev, FILE *prn_stream)
out_beg -= (out_beg - out) % bytes_per_column;
/* Dot addressing */
- fprintf(pdev->file, "\033F%04d",
- (out_beg - out) / bytes_per_column);
+ gp_fprintf(pdev->file, "\033F%04d",
+ (out_beg - out) / bytes_per_column);
/* Dot graphics */
size = out_end - out_beg + 1;
if (check_mode(pdev->dname)==PR201){
- fprintf(pdev->file,"\033J%04d", size / bytes_per_column);
+ gp_fprintf(pdev->file,"\033J%04d", size / bytes_per_column);
}else{
- fprintf(pdev->file,"\034bP,48,%04d.",
- size / bytes_per_column);
+ gp_fprintf(pdev->file,"\034bP,48,%04d.",
+ size / bytes_per_column);
}
- fwrite(out_beg, size, 1, pdev->file);
+ gp_fwrite(out_beg, size, 1, pdev->file);
/* Carriage Return */
- fputc('\r', pdev->file);
+ gp_fputc('\r', pdev->file);
skip = 1;
}
/* Form Feed */
- fputc('\f',pdev->file);
- fflush(pdev->file);
+ gp_fputc('\f',pdev->file);
+ gp_fflush(pdev->file);
gs_free(pdev->memory->non_gc_memory, (char *)out,
bits_per_column, line_size, "pr201_print_page(out)");
diff --git a/contrib/japanese/gdevrpdl.c b/contrib/japanese/gdevrpdl.c
index 0e90e0005..dee81bb54 100644
--- a/contrib/japanese/gdevrpdl.c
+++ b/contrib/japanese/gdevrpdl.c
@@ -31,8 +31,8 @@ static dev_proc_open_device(rpdl_open);
static dev_proc_close_device(rpdl_close);
static dev_proc_print_page_copies(rpdl_print_page_copies);
static dev_proc_image_out(rpdl_image_out);
-static void rpdl_printer_initialize(gx_device_printer * pdev, FILE * prn_stream, int num_copies);
-static void rpdl_paper_set(gx_device_printer * pdev, FILE * prn_stream);
+static void rpdl_printer_initialize(gx_device_printer * pdev, gp_file * prn_stream, int num_copies);
+static void rpdl_paper_set(gx_device_printer * pdev, gp_file * prn_stream);
static gx_device_procs rpdl_prn_procs =
lprn_procs(rpdl_open, gdev_prn_output_page, rpdl_close);
@@ -67,13 +67,13 @@ rpdl_close(gx_device * pdev)
if (code < 0)
return code;
if (ppdev->Duplex && (pdev->PageCount & 1)) {
- fprintf(ppdev->file, "\014"); /* Form Feed */
+ gp_fprintf(ppdev->file, "\014"); /* Form Feed */
}
return gdev_prn_close(pdev);
}
static int
-rpdl_print_page_copies(gx_device_printer * pdev, FILE * prn_stream, int num_coipes)
+rpdl_print_page_copies(gx_device_printer * pdev, gp_file * prn_stream, int num_coipes)
{
gx_device_lprn *const lprn = (gx_device_lprn *) pdev;
int code = 0;
@@ -95,14 +95,14 @@ rpdl_print_page_copies(gx_device_printer * pdev, FILE * prn_stream, int num_coip
gs_free(pdev->memory->non_gc_memory, lprn->CompBuf, bpl * 3 / 2 + 1, maxY, "rpdl_print_page_copies(CompBuf)");
- fprintf(prn_stream, "\014"); /* Form Feed */
+ gp_fprintf(prn_stream, "\014"); /* Form Feed */
return code;
}
/* Output data */
static void
-rpdl_image_out(gx_device_printer * pdev, FILE * prn_stream, int x, int y, int width, int height)
+rpdl_image_out(gx_device_printer * pdev, gp_file * prn_stream, int x, int y, int width, int height)
{
gx_device_lprn *const lprn = (gx_device_lprn *) pdev;
int Len;
@@ -112,23 +112,23 @@ rpdl_image_out(gx_device_printer * pdev, FILE * prn_stream, int x, int y, int wi
if (Len < width / 8 * height) {
if (pdev->x_pixels_per_inch == 240) {
/* Unit Size is 1/720 inch */
- fprintf(prn_stream, "\033\022G3,%d,%d,,4,%d,%d,%d@",
+ gp_fprintf(prn_stream, "\033\022G3,%d,%d,,4,%d,%d,%d@",
width, height, x * 3, y * 3, Len);
} else {
- fprintf(prn_stream, "\033\022G3,%d,%d,,4,%d,%d,%d@",
+ gp_fprintf(prn_stream, "\033\022G3,%d,%d,,4,%d,%d,%d@",
width, height, x, y, Len);
}
- fwrite(lprn->CompBuf, 1, Len, prn_stream);
+ gp_fwrite(lprn->CompBuf, 1, Len, prn_stream);
} else { /* compression result is bad. So, raw data is used. */
if (pdev->x_pixels_per_inch == 240) {
/* Unit Size is 1/720 inch */
- fprintf(prn_stream, "\033\022G3,%d,%d,,,%d,%d@",
+ gp_fprintf(prn_stream, "\033\022G3,%d,%d,,,%d,%d@",
width, height, x * 3, y * 3);
- fwrite(lprn->TmpBuf, 1, width / 8 * height, prn_stream);
+ gp_fwrite(lprn->TmpBuf, 1, width / 8 * height, prn_stream);
} else {
- fprintf(prn_stream, "\033\022G3,%d,%d,,,%d,%d@",
+ gp_fprintf(prn_stream, "\033\022G3,%d,%d,,,%d,%d@",
width, height, x, y);
- fwrite(lprn->TmpBuf, 1, width / 8 * height, prn_stream);
+ gp_fwrite(lprn->TmpBuf, 1, width / 8 * height, prn_stream);
}
}
}
@@ -138,20 +138,20 @@ rpdl_image_out(gx_device_printer * pdev, FILE * prn_stream, int x, int y, int wi
/* ------ Internal routines ------ */
static void
-rpdl_printer_initialize(gx_device_printer * pdev, FILE * prn_stream, int num_copies)
+rpdl_printer_initialize(gx_device_printer * pdev, gp_file * prn_stream, int num_copies)
{
gx_device_lprn *const lprn = (gx_device_lprn *) pdev;
int xdpi = (int) pdev->x_pixels_per_inch;
/* Initialize */
- fprintf(prn_stream, "\033\022!@R00\033 "); /* Change to RPDL Mode */
- fprintf(prn_stream, "\0334"); /* Graphic Mode kaijyo */
- fprintf(prn_stream, "\033\022YP,2 "); /* Select RPDL Mode */
- fprintf(prn_stream, "\033\022YB,2 "); /* Printable Area - Maximum */
- fprintf(prn_stream, "\033\022YK,1 "); /* Left Margin - 0 mm */
- fprintf(prn_stream, "\033\022YL,1 "); /* Top Margin - 0 mm */
- fprintf(prn_stream, "\033\022YM,1 "); /* 100 % */
- fprintf(prn_stream, "\033\022YQ,2 "); /* Page Length - Maximum */
+ gp_fprintf(prn_stream, "\033\022!@R00\033 "); /* Change to RPDL Mode */
+ gp_fprintf(prn_stream, "\0334"); /* Graphic Mode kaijyo */
+ gp_fprintf(prn_stream, "\033\022YP,2 "); /* Select RPDL Mode */
+ gp_fprintf(prn_stream, "\033\022YB,2 "); /* Printable Area - Maximum */
+ gp_fprintf(prn_stream, "\033\022YK,1 "); /* Left Margin - 0 mm */
+ gp_fprintf(prn_stream, "\033\022YL,1 "); /* Top Margin - 0 mm */
+ gp_fprintf(prn_stream, "\033\022YM,1 "); /* 100 % */
+ gp_fprintf(prn_stream, "\033\022YQ,2 "); /* Page Length - Maximum */
/* Paper Size Selection */
rpdl_paper_set(pdev, prn_stream);
@@ -160,26 +160,26 @@ rpdl_printer_initialize(gx_device_printer * pdev, FILE * prn_stream, int num_cop
/* Duplex Setting */
if (pdev->Duplex_set > 0) {
if (pdev->Duplex) {
- fprintf(prn_stream, "\033\02261,");
+ gp_fprintf(prn_stream, "\033\02261,");
if (lprn->Tumble == 0)
- fprintf(prn_stream, "\033\022YA01,2 ");
+ gp_fprintf(prn_stream, "\033\022YA01,2 ");
else
- fprintf(prn_stream, "\033\022YA01,1 ");
+ gp_fprintf(prn_stream, "\033\022YA01,1 ");
} else
- fprintf(prn_stream, "\033\02260,");
+ gp_fprintf(prn_stream, "\033\02260,");
}
/* Resolution and Unit Setting */
/* Resolution Seting */
switch(xdpi) {
case 600:
- fprintf(prn_stream, "\033\022YA04,3 ");
+ gp_fprintf(prn_stream, "\033\022YA04,3 ");
break;
case 400:
- fprintf(prn_stream, "\033\022YA04,1 ");
+ gp_fprintf(prn_stream, "\033\022YA04,1 ");
break;
default: /* 240 dpi */
- fprintf(prn_stream, "\033\022YA04,2 ");
+ gp_fprintf(prn_stream, "\033\022YA04,2 ");
break;
}
@@ -187,51 +187,51 @@ rpdl_printer_initialize(gx_device_printer * pdev, FILE * prn_stream, int num_cop
/* Graphics Unit */
switch(xdpi) {
case 600:
- fprintf(prn_stream, "\033\022YW,3 ");
+ gp_fprintf(prn_stream, "\033\022YW,3 ");
break;
case 400:
- fprintf(prn_stream, "\033\022YW,1 ");
+ gp_fprintf(prn_stream, "\033\022YW,1 ");
break;
default: /* 240 dpi */
- fprintf(prn_stream, "\033\022YW,2 ");
+ gp_fprintf(prn_stream, "\033\022YW,2 ");
break;
}
/* Spacing Unit */
switch(xdpi) {
case 600:
- fprintf(prn_stream, "\033\022Q5 ");
+ gp_fprintf(prn_stream, "\033\022Q5 ");
break;
case 400:
- fprintf(prn_stream, "\033\022Q4 ");
+ gp_fprintf(prn_stream, "\033\022Q4 ");
break;
default: /* 240 dpi */
- fprintf(prn_stream, "\033\022Q0 ");
+ gp_fprintf(prn_stream, "\033\022Q0 ");
break;
}
/* Cartecian Unit */
switch(xdpi) {
case 600:
- fprintf(prn_stream, "\033\022#4 ");
+ gp_fprintf(prn_stream, "\033\022#4 ");
break;
case 400:
- fprintf(prn_stream, "\033\022#2 ");
+ gp_fprintf(prn_stream, "\033\022#2 ");
break;
}
/* Paper Setting */
if (pdev->MediaSize[0] > pdev->MediaSize[1])
- fprintf(prn_stream, "\033\022D2 "); /* landscape */
+ gp_fprintf(prn_stream, "\033\022D2 "); /* landscape */
else
- fprintf(prn_stream, "\033\022D1 "); /* portrait */
+ gp_fprintf(prn_stream, "\033\022D1 "); /* portrait */
/* Number of Copies */
- fprintf(prn_stream, "\033\022N%d ", num_copies);
+ gp_fprintf(prn_stream, "\033\022N%d ", num_copies);
}
static void
-rpdl_paper_set(gx_device_printer * pdev, FILE * prn_stream)
+rpdl_paper_set(gx_device_printer * pdev, gp_file * prn_stream)
{
int width, height, w, h;
@@ -250,45 +250,45 @@ rpdl_paper_set(gx_device_printer * pdev, FILE * prn_stream)
}
if (abs(w - 1684) <= TOL && abs(h - 2380) <= TOL) /* A1 */
- fprintf(prn_stream, "\033\02251@A1R\033 ");
+ gp_fprintf(prn_stream, "\033\02251@A1R\033 ");
else if (abs(w - 1190) <= TOL && abs(h - 1684) <= TOL) { /* A2 */
- fprintf(prn_stream, "\033\02251@A2R\033 ");
- fprintf(prn_stream, "\033\02251@A2\033 ");
+ gp_fprintf(prn_stream, "\033\02251@A2R\033 ");
+ gp_fprintf(prn_stream, "\033\02251@A2\033 ");
} else if (abs(w - 842) <= TOL && abs(h - 1190) <= TOL) { /* A3 */
- fprintf(prn_stream, "\033\02251@A3R\033 ");
- fprintf(prn_stream, "\033\02251@A3\033 ");
+ gp_fprintf(prn_stream, "\033\02251@A3R\033 ");
+ gp_fprintf(prn_stream, "\033\02251@A3\033 ");
} else if (abs(w - 595) <= TOL && abs(h - 842) <= TOL) { /* A4 */
- fprintf(prn_stream, "\033\02251@A4R\033 ");
- fprintf(prn_stream, "\033\02251@A4\033 ");
+ gp_fprintf(prn_stream, "\033\02251@A4R\033 ");
+ gp_fprintf(prn_stream, "\033\02251@A4\033 ");
} else if (abs(w - 421) <= TOL && abs(h - 595) <= TOL) { /* A5 */
- fprintf(prn_stream, "\033\02251@A5R\033 ");
- fprintf(prn_stream, "\033\02251@A5\033 ");
+ gp_fprintf(prn_stream, "\033\02251@A5R\033 ");
+ gp_fprintf(prn_stream, "\033\02251@A5\033 ");
} else if (abs(w - 297) <= TOL && abs(h - 421) <= TOL) { /* A6 */
- fprintf(prn_stream, "\033\02251@A6R\033 ");
- fprintf(prn_stream, "\033\02251@A6\033 ");
+ gp_fprintf(prn_stream, "\033\02251@A6R\033 ");
+ gp_fprintf(prn_stream, "\033\02251@A6\033 ");
} else if (abs(w - 729) <= TOL && abs(h - 1032) <= TOL) { /* B4 */
- fprintf(prn_stream, "\033\02251@B4R\033 ");
- fprintf(prn_stream, "\033\02251@B4\033 ");
+ gp_fprintf(prn_stream, "\033\02251@B4R\033 ");
+ gp_fprintf(prn_stream, "\033\02251@B4\033 ");
} else if (abs(w - 516) <= TOL && abs(h - 729) <= TOL) { /* B5 */
- fprintf(prn_stream, "\033\02251@B5R\033 ");
- fprintf(prn_stream, "\033\02251@B5\033 ");
+ gp_fprintf(prn_stream, "\033\02251@B5R\033 ");
+ gp_fprintf(prn_stream, "\033\02251@B5\033 ");
} else if (abs(w - 363) <= TOL && abs(h - 516) <= TOL) { /* B6 */
- fprintf(prn_stream, "\033\02251@A6R\033 ");
- fprintf(prn_stream, "\033\02251@A6\033 ");
+ gp_fprintf(prn_stream, "\033\02251@A6R\033 ");
+ gp_fprintf(prn_stream, "\033\02251@A6\033 ");
} else if (abs(w - 612) <= TOL && abs(h - 792) <= TOL) { /* Letter */
- fprintf(prn_stream, "\033\02251@LTR\033 ");
- fprintf(prn_stream, "\033\02251@LT\033 ");
+ gp_fprintf(prn_stream, "\033\02251@LTR\033 ");
+ gp_fprintf(prn_stream, "\033\02251@LT\033 ");
} else if (abs(w - 612) <= TOL && abs(h - 1008) <= TOL) { /* Legal */
- fprintf(prn_stream, "\033\02251@LGR\033 ");
- fprintf(prn_stream, "\033\02251@LG\033 ");
+ gp_fprintf(prn_stream, "\033\02251@LGR\033 ");
+ gp_fprintf(prn_stream, "\033\02251@LG\033 ");
} else if (abs(w - 396) <= TOL && abs(h - 612) <= TOL) { /* Half Letter */
- fprintf(prn_stream, "\033\02251@HLR\033 ");
- fprintf(prn_stream, "\033\02251@HLT\033 ");
+ gp_fprintf(prn_stream, "\033\02251@HLR\033 ");
+ gp_fprintf(prn_stream, "\033\02251@HLT\033 ");
} else if (abs(w - 792) <= TOL && abs(h - 1224) <= TOL) { /* Ledger */
- fprintf(prn_stream, "\033\02251@DLT\033 ");
- fprintf(prn_stream, "\033\02251@DLR\033 ");
+ gp_fprintf(prn_stream, "\033\02251@DLT\033 ");
+ gp_fprintf(prn_stream, "\033\02251@DLR\033 ");
} else { /* Free Size (mm) */
- fprintf(prn_stream, "\033\022?5%d,%d\033 ",
+ gp_fprintf(prn_stream, "\033\022?5%d,%d\033 ",
(int)((w * 25.4) / 72),
(int)((h * 25.4) / 72));
}