[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[mgp-users-jp 00950] mgp2ps does not manage %area correctly (Debian Bug#149663)



以下のような mgp を mgp2ps に通すと

%include "/usr/share/doc/mgp/examples/default.mgp"
%page

Foo

    foo

%area 60 100 30 46
    bar

%page

% mgp2ps a.mgp > a.ps
% gs a.ps
Error: /undefined in nan
Operand stack:
   802
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--
   %--nostringval--   2   %stopped_push   --nostringval--
   %--nostringval--   --nostringval--   false   1   %stopped_push   1
   %3   %oparray_pop   1   3   %oparray_pop   .runexec2
   %--nostringval--   --nostringval--   --nostringval--   2
   %%stopped_push   --nostringval--   --nostringval--   --nostringval--
Dictionary stack:
   --dict:1035/1476(ro)(G)--   --dict:0/20(G)--   --dict:110/200(L)--
Current allocation mode is local
GNU Ghostscript 6.53: Unrecoverable error, exit code 1

このようなエラーがでます。
cp->ctar_height == 0 で (double)cp->ctar_xoff / cp->ctar_height とかが
nan になっているからなのですが、これは cp->ctar_height == 0 の時は
なにもしないようにすればいいんでしょうか?

--- ../cvs/kit/print.c	Wed Apr 17 10:32:50 2002
+++ print.c	Mon Jun 24 00:55:13 2002
@@ -823,15 +823,17 @@
 	case CTL_AREA:
 		window_width = (paper->width - paper_xmargin * 2) * cp->ctar_width / 100;
 		window_height = (paper->height - paper_ymargin * 2) * cp->ctar_height / 100;
-		fprintf(fp, "grestore\ngsave\n");
-		fprintf(fp, "%f dup scale\n", cp->ctar_height / 100.0);
-		fprintf(fp, "WIDTH XMARGIN 2 mul sub %f mul 0 translate\n", 
-		    (double)cp->ctar_xoff / cp->ctar_height);
-		fprintf(fp, "/XBODY WIDTH XMARGIN 2 mul sub %f mul def\n",
-		    (double)cp->ctar_width / cp->ctar_height);
-		fprintf(fp, "/ypos YMARGIN -1 mul 4 sub HEIGHT %f mul sub def\n",
-		    (double)cp->ctar_yoff / cp->ctar_height);
-		fprintf(fp, "/xpos 0 def\n");
+		if (cp->ctar_height != 0) {
+		    fprintf(fp, "grestore\ngsave\n");
+		    fprintf(fp, "%f dup scale\n", cp->ctar_height / 100.0);
+		    fprintf(fp, "WIDTH XMARGIN 2 mul sub %f mul 0 translate\n", 
+			    (double)cp->ctar_xoff / cp->ctar_height);
+		    fprintf(fp, "/XBODY WIDTH XMARGIN 2 mul sub %f mul def\n",
+			    (double)cp->ctar_width / cp->ctar_height);
+		    fprintf(fp, "/ypos YMARGIN -1 mul 4 sub HEIGHT %f mul sub def\n",
+			    (double)cp->ctar_yoff / cp->ctar_height);
+		    fprintf(fp, "/xpos 0 def\n");
+		}
 		break;
 
 	default:

-- 
鵜飼文敏