From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6bcdc23b05684cbe X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-24 19:41:07 PST Message-ID: <3F99E2BF.3D233911@fakeaddress.nil> Date: Sat, 25 Oct 2003 04:41:03 +0200 From: Gautier Write-only X-Mailer: Mozilla 4.8 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Newbie GNAT question References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 217.162.143.128 X-Trace: news.swissonline.ch 1067049666 217.162.143.128 (25 Oct 2003 04:41:06 +0200) X-Complaints-To: abuse@swissonline.ch Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!irazu.switch.ch!news-zh.switch.ch!switch.ch!news.swissonline.ch!not-for-mail Xref: archiver1.google.com comp.lang.ada:1638 Date: 2003-10-25T04:41:03+02:00 List-Id: David Gressett: > I am trying to use the GNAT.OS_Lib package so that I can construct an > argument list and then spawn another program using that argument list. > The argument list will contain filenames which the spawned program > will open. An inspiration: procedure EXEC(name: String; param:String:="") is num_params : integer := 1; begin for i in param'range loop if param(i) = ' ' then num_params := num_params + 1; end if; end loop; DECLARE a_param_list : Argument_List(1..num_params); last_start : integer := param'first; counter : integer := 1; ok : Boolean; BEGIN for i in param'range loop if param(i) = ' ' then a_param_list(counter) := new String'(param(last_start..i-1)); last_start := i+1; counter := counter + 1; end if; end loop; a_param_list(num_params) := new String'(param(last_start..param'last)); Spawn(name, a_param_list, ok); if not ok then raise_exception(Exec_failed'identity, name & " " & param); end if; END; -- DECLARE end EXEC; > I'm being defeated by Ada's strong typing. Is there any example code > for this on the Web somewhere, or could somebody produce a quick > example of how to do it? (about Unrestricted_Access): do you need 'Access or 'Unrestricted_Access in your code around spawn ? ________________________________________________________ Gautier -- http://www.mysunrise.ch/users/gdm/gsoft.htm NB: For a direct answer, e-mail address on the Web site!