diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 1995-11-06 13:28:02 +0000 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 1995-11-06 13:28:02 +0000 |
commit | c935989e32fbc6609d2841884e89fb794a2d0bbf (patch) | |
tree | f00f5acacd2514baaab27e7116f16a74b9412ebc | |
parent | 3ad4f0faf39a3b0b5b7722862aea56734c53d0e5 (diff) |
Adaptation au compilo natif
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@411 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r-- | otherlibs/graph/Makefile | 13 | ||||
-rw-r--r-- | otherlibs/graph/draw.c | 25 | ||||
-rw-r--r-- | otherlibs/graph/fill.c | 25 | ||||
-rw-r--r-- | otherlibs/graph/graphics.ml | 4 | ||||
-rw-r--r-- | otherlibs/graph/graphics.mli | 4 |
5 files changed, 47 insertions, 24 deletions
diff --git a/otherlibs/graph/Makefile b/otherlibs/graph/Makefile index c52265b55..1fd2284ee 100644 --- a/otherlibs/graph/Makefile +++ b/otherlibs/graph/Makefile @@ -6,13 +6,14 @@ CC=$(BYTECC) CFLAGS=-I../../byterun -I$(X11_INCLUDES) -O $(BYTECCCOMPOPTS) CAMLC=../../boot/cslrun ../../boot/cslc -I ../../boot +CAMLOPT=../../boot/cslrun ../../cslopt -I ../../stdlib OBJS=open.o draw.o fill.o color.o text.o \ image.o make_img.o dump_img.o point_col.o sound.o events.o all: libgraph.a graphics.cmi graphics.cma -allopt: +allopt: libgraph.a graphics.cmi graphics.cmxa libgraph.a: $(OBJS) rm -f libgraph.a @@ -22,6 +23,9 @@ libgraph.a: $(OBJS) graphics.cma: graphics.cmo $(CAMLC) -a -o graphics.cma graphics.cmo +graphics.cmxa: graphics.cmx + $(CAMLOPT) -a -o graphics.cmxa graphics.cmx + clean: rm -f *.cm* @@ -34,13 +38,18 @@ install: cp graphics.cm[ia] $(LIBDIR) installopt: + cp graphics.a $(LIBDIR)/graphics.a + cd $(LIBDIR); $(RANLIB) graphics.a + cp graphics.cmxa $(LIBDIR) -.SUFFIXES: .ml .mli .cmo .cmi +.SUFFIXES: .ml .mli .cmo .cmi .cmx .mli.cmi: $(CAMLC) -c $< .ml.cmo: $(CAMLC) -c $< +.ml.cmx: + $(CAMLOPT) -c $(COMPFLAGS) $< depend: gcc -MM $(CFLAGS) *.c > .depend diff --git a/otherlibs/graph/draw.c b/otherlibs/graph/draw.c index d2c4f8e69..c0a6c4370 100644 --- a/otherlibs/graph/draw.c +++ b/otherlibs/graph/draw.c @@ -57,16 +57,16 @@ value gr_lineto(vx, vy) return Val_unit; } -value gr_draw_arc(argv, argc) - int argc; - value * argv; +value gr_draw_arc_nat(vx, vy, vrx, vry, va1, va2) + value vx, vy, vrx, vry, va1, va2; { - int x = Int_val(argv[0]); - int y = Int_val(argv[1]); - int rx = Int_val(argv[2]); - int ry = Int_val(argv[3]); - int a1 = Int_val(argv[4]); - int a2 = Int_val(argv[5]); + int x = Int_val(vx); + int y = Int_val(vy); + int rx = Int_val(vrx); + int ry = Int_val(vry); + int a1 = Int_val(va1); + int a2 = Int_val(va2); + XDrawArc(grdisplay, grwindow.win, grwindow.gc, x - rx, Wcvt(y) - ry, rx * 2, ry * 2, a1 * 64, (a2 - a1) * 64); XDrawArc(grdisplay, grbstore.win, grbstore.gc, @@ -75,6 +75,13 @@ value gr_draw_arc(argv, argc) return Val_unit; } +value gr_draw_arc(argv, argc) + int argc; + value * argv; +{ + return gr_draw_arc_nat(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]); +} + value gr_set_line_width(vwidth) value vwidth; { diff --git a/otherlibs/graph/fill.c b/otherlibs/graph/fill.c index 990d8f68a..46cb5721b 100644 --- a/otherlibs/graph/fill.c +++ b/otherlibs/graph/fill.c @@ -54,16 +54,16 @@ value gr_fill_poly(array) return Val_unit; } -value gr_fill_arc(argv, argc) - int argc; - value * argv; +value gr_fill_arc_nat(vx, vy, vrx, vry, va1, va2) + value vx, vy, vrx, vry, va1, va2; { - int x = Int_val(argv[0]); - int y = Int_val(argv[1]); - int rx = Int_val(argv[2]); - int ry = Int_val(argv[3]); - int a1 = Int_val(argv[4]); - int a2 = Int_val(argv[5]); + int x = Int_val(vx); + int y = Int_val(vy); + int rx = Int_val(vrx); + int ry = Int_val(vry); + int a1 = Int_val(va1); + int a2 = Int_val(va2); + XFillArc(grdisplay, grwindow.win, grwindow.gc, x - rx, Wcvt(y) - ry, rx * 2, ry * 2, a1 * 64, (a2 - a1) * 64); XFillArc(grdisplay, grbstore.win, grbstore.gc, @@ -72,3 +72,10 @@ value gr_fill_arc(argv, argc) return Val_unit; } +value gr_fill_arc(argv, argc) + int argc; + value * argv; +{ + return gr_fill_arc_nat(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]); +} + diff --git a/otherlibs/graph/graphics.ml b/otherlibs/graph/graphics.ml index 7c3045670..4ed1dd992 100644 --- a/otherlibs/graph/graphics.ml +++ b/otherlibs/graph/graphics.ml @@ -63,7 +63,7 @@ external moveto : int -> int -> unit = "gr_moveto" external current_point : unit -> int * int = "gr_current_point" external lineto : int -> int -> unit = "gr_lineto" external draw_arc : int -> int -> int -> int -> int -> int -> unit - = "gr_draw_arc" + = "gr_draw_arc" "gr_draw_arc_nat" let draw_ellipse x y rx ry = draw_arc x y rx ry 0 360 let draw_circle x y r = draw_arc x y r r 0 360 external set_line_width : int -> unit = "gr_set_line_width" @@ -71,7 +71,7 @@ external set_line_width : int -> unit = "gr_set_line_width" external fill_rect : int -> int -> int -> int -> unit = "gr_fill_rect" external fill_poly : (int * int) array -> unit = "gr_fill_poly" external fill_arc : int -> int -> int -> int -> int -> int -> unit - = "gr_fill_arc" + = "gr_fill_arc" "gr_fill_arc_nat" let fill_ellipse x y rx ry = fill_arc x y rx ry 0 360 let fill_circle x y r = fill_arc x y r r 0 360 diff --git a/otherlibs/graph/graphics.mli b/otherlibs/graph/graphics.mli index b6a91f6f7..d1077f655 100644 --- a/otherlibs/graph/graphics.mli +++ b/otherlibs/graph/graphics.mli @@ -86,7 +86,7 @@ external lineto : int -> int -> unit = "gr_lineto" (* Draw a line with endpoints the current point and the given point, and move the current point to the given point. *) external draw_arc : int -> int -> int -> int -> int -> int -> unit - = "gr_draw_arc" + = "gr_draw_arc" "gr_draw_arc_nat" (* [draw_arc x y rx ry a1 a2] draws an elliptical arc with center [x,y], horizontal radius [rx], vertical radius [ry], from angle [a1] to angle [a2] (in degrees). The current point is unchanged. *) @@ -128,7 +128,7 @@ external fill_poly : (int * int) array -> unit = "gr_fill_poly" (* Fill the given polygon with the current color. The array contains the coordinates of the vertices of the polygon. *) external fill_arc : int -> int -> int -> int -> int -> int -> unit - = "gr_fill_arc" + = "gr_fill_arc" "gr_fill_arc_nat" (* Fill an elliptical pie slice with the current color. The parameters are the same as for [draw_arc]. *) val fill_ellipse : int -> int -> int -> int -> unit |