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 VAA20361; Fri, 18 Jan 2002 21:35:25 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id VAA20191 for caml-list@pauillac.inria.fr; Fri, 18 Jan 2002 21:35:24 +0100 (MET) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA21876 for ; Thu, 17 Jan 2002 20:15:14 +0100 (MET) Received: from ns.bagley.org (ns.bagley.org [216.30.46.2]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g0HJFCf00995 for ; Thu, 17 Jan 2002 20:15:13 +0100 (MET) Received: by ns.bagley.org (TRS/80 Mail Daemon, from userid 500) id DADA5FBA5C; Thu, 17 Jan 2002 13:15:12 -0600 (CST) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15431.8896.687093.692408@ns.bagley.org> Date: Thu, 17 Jan 2002 13:15:12 -0600 To: John Malecki Cc: caml-list@inria.fr Subject: Re: [Caml-list] error messages to stdout? From: Doug Bagley Organization: Ewige Blumenkraft AG X-Face: "|NaWfYJ-]P="T#?R.9}QgGuFXUd@3vi[.E2q-;"NV3+k_y@zreL2w^ts0XPXtt9^9{uQ@.cu2GgUgK9@HXC\a}Rtah}0'eT~>or7[~Hd?;!\Bpo#"3w>0a0ft-MvvZ In-Reply-To: <15431.6370.86918.38285@reggie.artisan.com> References: <15429.3000.625598.380078@ns.bagley.org> <87n0ze9ivj.dlv@wanadoo.fr> <15429.56844.510694.554970@ns.bagley.org> <15431.6370.86918.38285@reggie.artisan.com> Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk John Malecki wrote: > Doug Bagley wrote (2002-01-16T14:09:48-0600): > > > > Anyway, I have a workaround, I wrote a "trampoline" program that can > > be used in place of the toplevel interpreter and does the compilation > > transparently for lazy persons such as myself. > > > > It essentially turns any compiled language into a scripting language. > > If anyone is interested in it ... I could clean it up for public > > consumption. > > Hi Doug, > > I'd be interested in the trampoline program. Well, it's pre-release, and uses some pre-requesite libs of mine that are also pre-release :-) And I haven't had anyone else test out the build process yet, and so on and so forth, but if you are adventurous, you are welcome to take a look and give me feedback, as long as you realize it is a very raw work-in-progress :) It is currently here: http://www.bagley.org/~doug/ocaml/scriptomatic/ It basically hands off the build work to make, and I have a very simple makefile included whichs needs a lot of polishing, but the basic idea seems sound, and I can write "scripts" that compile to byte or optimized Ocaml, or even write "scripts" in C :) The built executables are cached, and only rebuilt if the original script changes. > At the moment we are operating in a homogeneous computing environment. > Sooner or later we will add some a different computer architecture to > our pool and I was thinking about how to take advantage of compiling > byte-code once and using it on all platforms. This has the advantage > that a developer can compile once, on any one platform, and make that > program immediately available on all other machine architectures. > > I'm not sure of the best way to do this. I was thinking of using the > bash MACHTYPE environment variable and then install the byte-code > program in /usr/local/bin but have the 1st line of that file say > > #! /usr/local/bin/ocamlrun.$MACHTYPE > > Unfortunately the loader does not perform environment variable > expansion. I tried other tricks but I couldn't find a simple "1 > liner". I'm still looking for something simple. If anyone has any > ideas I'd like to hear them. I think that simply doing what you want above is a little easier than what I have implemented, and you may wish to use the simplest solution. I've appended an idea for a replacement interpreter that is an "almost one-liner" in C below. It switches the toplevel interpreter based on the machine type environement variable. Maybe it will give you an idea. (Note that on Linux, the program execed by the trampoline may not see itself in argv[0], I sent a note to caml-bugs about an old fix (557), which I think is related to the problem). cheers, doug -- trampo.c: /* gcc trampo.c -o trampo */ #include main (int argc, char **argv) { char exe[256]; if (snprintf(exe, 256, "ocamlrun.%s", getenv("MACHTYPE")) > -1) execvp(exe, argv); else fprintf(stderr, "ouch\n"); } /* end */ int the shell: export MACHTYPE=MACLISA # or whatever tramptest: #! ./trampo let _ = print_endline "Hello World" ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr