Import print/ghostscript9-agpl-base version 9.16_2
[dports.git] / print / ghostscript9-agpl-base / files / patch-epag__gdevepag.c
1 --- epag/gdevepag.c.orig        Sat Jul  8 13:33:09 2000
2 +++ epag/gdevepag.c     Sat Nov 24 15:25:11 2007
3 @@ -102,30 +102,30 @@
4  } EpagBubble;
5  
6  /* The device descriptors */
7 -private dev_proc_open_device(epag_open);
8 -private dev_proc_close_device(epag_close);
9 -private dev_proc_print_page(epag_print_page);
10 -private void epag_printer_initialize(gx_device_printer *pdev, FILE *fp,int);
11 -private dev_proc_print_page(epag_print_page);
12 -private dev_proc_get_params(epag_get_params);
13 -private dev_proc_put_params(epag_put_params);
14 -private void epag_paper_set(gx_device_printer *pdev, FILE *fp);
15 -private void epag_bubble_flush_all(EpagPageCont *cont);
16 -private void epag_page_cont_init(gx_device_printer *pdev,FILE *fp,EpagPageCont *cont);
17 -private void epag_page_close(EpagPageCont *cont);
18 -private int epag_read_image(EpagPageCont *cont);
19 -private void epag_process_line(EpagPageCont *cont);
20 -private int epag_is_black(EpagPageCont *cont, int bx);
21 -private void epag_rect_add(EpagPageCont *cont,int start,int end);
22 -private void  epag_bubble_gen(EpagPageCont *cont,
23 +static dev_proc_open_device(epag_open);
24 +static dev_proc_close_device(epag_close);
25 +static dev_proc_print_page(epag_print_page);
26 +static void epag_printer_initialize(gx_device_printer *pdev, FILE *fp,int);
27 +static dev_proc_print_page(epag_print_page);
28 +static dev_proc_get_params(epag_get_params);
29 +static dev_proc_put_params(epag_put_params);
30 +static void epag_paper_set(gx_device_printer *pdev, FILE *fp);
31 +static void epag_bubble_flush_all(EpagPageCont *cont);
32 +static void epag_page_cont_init(gx_device_printer *pdev,FILE *fp,EpagPageCont *cont);
33 +static void epag_page_close(EpagPageCont *cont);
34 +static int epag_read_image(EpagPageCont *cont);
35 +static void epag_process_line(EpagPageCont *cont);
36 +static int epag_is_black(EpagPageCont *cont, int bx);
37 +static void epag_rect_add(EpagPageCont *cont,int start,int end);
38 +static void  epag_bubble_gen(EpagPageCont *cont,
39                               int x0, int x1, int y0, int y1);
40 -private void epag_bubble_flush(EpagPageCont *cont,EpagBubble *bbl);
41 -private void epag_bubble_image_out(EpagPageCont *cont,EpagBubble *bbl);
42 +static void epag_bubble_flush(EpagPageCont *cont,EpagBubble *bbl);
43 +static void epag_bubble_image_out(EpagPageCont *cont,EpagBubble *bbl);
44  
45  /*
46   *   ¥Ç¥Ð¥¤¥¹¤ÎÀë¸À
47   */
48 -private gx_device_procs prn_epag_procs =
49 +static gx_device_procs prn_epag_procs =
50  prn_params_procs(epag_open, gdev_prn_output_page, epag_close,
51                  epag_get_params, epag_put_params);
52  gx_device_printer far_data gs_epag_device =
53 @@ -140,13 +140,13 @@
54  static char *epson_remote_start = "\033\001@EJL \r\n";
55  
56  /* Open the printer, adjusting the margins if necessary. */
57 -private int
58 +static int
59  epag_open(gx_device *pdev)
60  {
61    return gdev_prn_open(pdev);
62  }
63  
64 -private int
65 +static int
66  epag_close(gx_device *pdev)
67  {
68    gdev_prn_open_printer(pdev, 1);
69 @@ -163,7 +163,7 @@
70    return gdev_prn_close(pdev);
71  }
72  
73 -private int 
74 +static int 
75  epag_print_page(gx_device_printer *pdev, FILE *fp)
76  {
77    EpagPageCont cont;
78 @@ -205,7 +205,7 @@
79    GS, '2', 'a', 'b', 'P',          /* ¥¤¥á¡¼¥¸ÉÁ²è¸å²¼¤Ø */
80  };
81  
82 -private void
83 +static void
84  epag_printer_initialize(gx_device_printer *pdev, FILE *fp, int copies)
85  {
86    double xDpi,yDpi;
87 @@ -260,7 +260,7 @@
88      fprintf(fp,"%c%dcoO",GS, copies < 256 ? copies : 255);
89  }
90  
91 -private int
92 +static int
93  epag_get_params(gx_device *pdev, gs_param_list *plist)
94  {
95    int code;
96 @@ -286,7 +286,7 @@
97  }
98  
99  /* Put properties. */
100 -private int
101 +static int
102  epag_put_params(gx_device *pdev, gs_param_list *plist)
103  {
104    param_read_int(plist, "cRowBuf", &epag_cont.cRowBuf);
105 @@ -380,7 +380,7 @@
106  /*
107   * epag_bubble_flush_all: »Ä¤Ã¤Æ¤¤¤ë bubble¤òÁ´¤Æ½ÐÎϤ¹¤ë¡£
108   */
109 -private void epag_bubble_flush_all(EpagPageCont *cont)
110 +static void epag_bubble_flush_all(EpagPageCont *cont)
111  {
112    int i;
113    
114 @@ -392,7 +392,7 @@
115  /*
116   * epag_page_cont_init: EpagPageCont¤Î½é´ü²½¡¢¥Ð¥Ã¥Õ¥¡³ÎÊÝÅù
117   */
118 -private void epag_page_cont_init(gx_device_printer *pdev,FILE *fp,
119 +static void epag_page_cont_init(gx_device_printer *pdev,FILE *fp,
120                                  EpagPageCont *cont)
121  {
122    int bpl;
123 @@ -417,15 +417,15 @@
124    cont->maxY = epag_cont.cRowBuf / cont->bh * cont->bh ;
125    if(cont->maxY < cont->bh) cont->maxY = cont->bh;
126    
127 -  cont->bp  = gs_malloc(bpl , cont->maxY, "epag_skip_blank_init(bp)");
128 -  cont->bp2 = gs_malloc(bpl*3/2+1 , cont->maxY, "epag_skip_blank_init(bp2)");
129 +  cont->bp  = (byte *)gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), bpl , cont->maxY, "epag_skip_blank_init(bp)");
130 +  cont->bp2 = (byte *)gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), bpl*3/2+1 , cont->maxY, "epag_skip_blank_init(bp2)");
131  
132    cont->h = cont->r = 0;
133  
134 -  cont->bubbleTbl=gs_malloc(sizeof(EpagBubble *),cont->maxBx,"bubbleTbl");
135 +  cont->bubbleTbl = (byte *)gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), sizeof(EpagBubble *),cont->maxBx,"bubbleTbl");
136    for(i=0;i<cont->maxBx;i++)
137      cont->bubbleTbl[i] = NULL;
138 -  cont->bubbleBuffer=gs_malloc(sizeof(EpagBubble),cont->maxBx,"bubbleBuffer");
139 +  cont->bubbleBuffer=gs_malloc(gs_lib_ctx_get_non_gc_memory_t(), sizeof(EpagBubble),cont->maxBx,"bubbleBuffer");
140    bbtbl = (EpagBubble *)cont->bubbleBuffer;
141    for(i=0;i<cont->maxBx-1;i++)
142      bbtbl[i].next = &bbtbl[i+1];
143 @@ -433,15 +433,15 @@
144    cont->freeBubbleList = &bbtbl[0];
145  }
146  
147 -private void
148 +static void
149  epag_page_close(EpagPageCont *cont)
150  {
151 -  gs_free(cont->bp, bpl, cont->maxY, "epag_skip_blank_init(bp)");
152 -  gs_free(cont->bp2, bpl*3/2+1, cont->maxY, "epag_skip_blank_init(bp2)");
153 -  gs_free(cont->bubbleBuffer, sizeof(EpagBubble), cont->maxBx,"bubbleBuffer");
154 +  gs_free(gs_lib_ctx_get_non_gc_memory_t(), cont->bp, bpl, cont->maxY, "epag_skip_blank_init(bp)");
155 +  gs_free(gs_lib_ctx_get_non_gc_memory_t(), cont->bp2, bpl*3/2+1, cont->maxY, "epag_skip_blank_init(bp2)");
156 +  gs_free(gs_lib_ctx_get_non_gc_memory_t(), cont->bubbleBuffer, sizeof(EpagBubble), cont->maxBx,"bubbleBuffer");
157  }
158  
159 -private int
160 +static int
161  epag_read_image(EpagPageCont *cont)
162  {
163    int bh = cont->bh;
164 @@ -473,7 +473,7 @@
165  /*
166   *    bh¹Ôʬ¤Î¥é¥¹¥¿¡¼¥Ç¡¼¥¿¤ò½èÍý¤¹¤ë
167   */
168 -private void
169 +static void
170  epag_process_line(EpagPageCont *cont)
171  {
172    int bh = cont->bh;
173 @@ -502,7 +502,7 @@
174    else epag_rect_add(cont, 0, cont->maxBx-1);
175  }
176  
177 -private int
178 +static int
179  epag_is_black(EpagPageCont *cont, int bx)
180  {
181    int bh  = cont->bh;
182 @@ -520,7 +520,7 @@
183    return 0;
184  }
185  
186 -private void
187 +static void
188  epag_rect_add(EpagPageCont *cont,int start,int end)
189  {
190    int x0 = start * cont->bw;
191 @@ -544,7 +544,7 @@
192    }
193  }
194  
195 -private void
196 +static void
197  epag_bubble_gen(EpagPageCont *cont, int x0, int x1, int y0, int y1)
198  {
199    EpagBubble *bbl;
200 @@ -569,7 +569,7 @@
201    }
202  }
203  
204 -private void epag_bubble_flush(EpagPageCont *cont,EpagBubble *bbl)
205 +static void epag_bubble_flush(EpagPageCont *cont,EpagBubble *bbl)
206  {
207    int bx,bx0,bx1;
208    
209 @@ -588,7 +588,7 @@
210  
211  /* ¥¤¥á¡¼¥¸¤ò½ÐÎÏ */
212  
213 -private void
214 +static void
215  epag_bubble_image_out(EpagPageCont *cont,EpagBubble *bbl)
216  {
217    FILE *fp = cont->fp;