Adaptation au compilo natif

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@411 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Xavier Leroy 1995-11-06 13:28:02 +00:00
parent 3ad4f0faf3
commit c935989e32
5 changed files with 47 additions and 24 deletions

View File

@ -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

View File

@ -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;
{

View File

@ -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]);
}

View File

@ -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

View File

@ -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