caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Matt Gushee <mgushee@havenrock.com>
To: caml-list@pauillac.inria.fr
Subject: Re: [Caml-list] Why I cannot open a graph with a specific title
Date: Mon, 28 Jun 2004 15:01:02 -0600	[thread overview]
Message-ID: <20040628210101.GA12584@swordfish> (raw)
In-Reply-To: <20040628195734.426.qmail@web90102.mail.scd.yahoo.com>

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


      parent reply	other threads:[~2004-06-28 21:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-28 19:57 Andy Yang
2004-06-28 20:50 ` Christophe TROESTLER
2004-06-29  0:37   ` Matt Gushee
2004-06-29  8:46     ` Christophe TROESTLER
2004-06-28 21:01 ` Matt Gushee [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040628210101.GA12584@swordfish \
    --to=mgushee@havenrock.com \
    --cc=caml-list@pauillac.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).