From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id XAA01748; Mon, 28 Jun 2004 23:01:05 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id XAA01750 for ; Mon, 28 Jun 2004 23:01:04 +0200 (MET DST) Received: from mz1.forethought.net (mzpi3.forethought.net [216.241.36.12]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i5SL12SH010660 for ; Mon, 28 Jun 2004 23:01:03 +0200 Received: from [216.241.35.41] (helo=swordfish) by mz1.forethought.net with esmtp (Exim 4.30) id 1Bf3FN-0003Xn-4u for caml-list@pauillac.inria.fr; Mon, 28 Jun 2004 15:01:01 -0600 Received: from matt by swordfish with local (Exim 3.35 #1 (Debian)) id 1Bf3FO-000493-00 for ; Mon, 28 Jun 2004 15:01:02 -0600 Date: Mon, 28 Jun 2004 15:01:02 -0600 From: Matt Gushee To: caml-list@pauillac.inria.fr Subject: Re: [Caml-list] Why I cannot open a graph with a specific title Message-ID: <20040628210101.GA12584@swordfish> Reply-To: Matt Gushee Mail-Followup-To: caml-list@pauillac.inria.fr References: <20040628195734.426.qmail@web90102.mail.scd.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040628195734.426.qmail@web90102.mail.scd.yahoo.com> User-Agent: Mutt/1.3.27i X-Miltered: at concorde with ID 40E0870E.004 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; gushee:01 mgushee:01 havenrock:01 caml-list:01 2004:99 nonetheless:01 0.0:01 0.0:01 bash-:01 2.05:01 gushee:01 englewood:01 manure:01 mgushee:01 havenrock:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Mon, Jun 28, 2004 at 12:57:34PM -0700, Andy Yang wrote: > > I found that with the following code is OK: > > open Graphics;; > let _ = open_graph "";; > > However, if I set a title for a widnow > > open Graphics;; > let _ = open_graph "hello";; > > Ocaml will report "Fatal error: exception > Graphics.Graphic_failure("Cannot open display hello"). > > open_graph has a signature string -> unit. Yes, and did you read what the manual says about that string? The string is not supposed to be the window title. On X11, it's the the name of an X display and/or a geometry specification. I'm not sure what it's supposed to be on Win32 platforms. Nonetheless, the behavior of open_graph leaves something to be desired. For example, # open_graph " 400x600" (* Note the leading space. *);; - : unit = () # open_graph "400x600";; Exception: Graphics.Graphic_failure "Cannot open display 400x600". So the function distinguishes a display name from a geometry spec by whether there is a leading space? Yech. Maybe the signature should be open_graph : ?display:string -> ?geometry:string -> unit -> unit And at least one of the following should work: # open_graph "0";; Exception: Graphics.Graphic_failure "Cannot open display 0". # open_graph "0.0";; Exception: Graphics.Graphic_failure "Cannot open display 0.0". # open_graph "localhost:0.0";; Exception: Graphics.Graphic_failure "Cannot open display localhost:0.0". # open_graph "127.0.0.1:0.0";; Exception: Graphics.Graphic_failure "Cannot open display 127.0.0.1:0.0". # open_graph "localhost:0";; Signal 13 bash-2.05a$ Brilliant. P.S. When asking questions of this sort, it would be helpful if you gave some information about your system, e.g. the platform and version of OCaml--especially with libraries like Graphics that have platform-dependent features. -- Matt Gushee When a nation follows the Way, Englewood, Colorado, USA Horses bear manure through mgushee@havenrock.com its fields; http://www.havenrock.com/ When a nation ignores the Way, Horses bear soldiers through its streets. --Lao Tzu (Peter Merel, trans.) ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners