* Running programs using ADA @ 2012-11-30 7:56 Hans Vlems 2012-11-30 8:00 ` Nasser M. Abbasi ` (2 more replies) 0 siblings, 3 replies; 13+ messages in thread From: Hans Vlems @ 2012-11-30 7:56 UTC (permalink / raw) Our company will move its IT operation to another datacentre. The new provider doesn't allow access to the command prompt (cmd.exe, it's a Windows setup). We use aprox. 10 programs that are run from the command prompt. All software is written in C; the compiler is mingw (regularly updated). The first attempt was a program, in C, that shows the user a menu. The user types a single digit and a program is run. The C program relies on the system() function. The problem is that the new environment uses Windows on a 64 bit platform. mingw uses Microsoft's libraries and either I'm just too dumb to understand that new stuff or system() is broken. Now mingw also includes support for ADA. The last time I wrote something in ADA was in 1984. Anyway, ADA looks a lot more like Algol than C so I hope that ADA may help me here. More specifically: does ADA have support for a function similar to C's system()? Example: int main(void) { int retval; retval=system("copy h:\*.* g:\"); printf("return value %d\n",retval); return EXIT_SUCCESS; } Regards, Hans Vlems PS the example lacks #include statements so won't compile ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Running programs using ADA 2012-11-30 7:56 Running programs using ADA Hans Vlems @ 2012-11-30 8:00 ` Nasser M. Abbasi 2012-11-30 12:54 ` Hans Vlems 2012-11-30 21:22 ` Per Sandberg 2012-12-01 15:26 ` Anatoly Chernyshev 2 siblings, 1 reply; 13+ messages in thread From: Nasser M. Abbasi @ 2012-11-30 8:00 UTC (permalink / raw) On 11/30/2012 1:56 AM, Hans Vlems wrote: > than C so I hope that ADA may help me here. More specifically: does > ADA have support for a function similar to C's system()? > > Example: > > int main(void) > { > int retval; > retval=system("copy h:\*.* g:\"); > printf("return value %d\n",retval); > return EXIT_SUCCESS; > } yes. see http://rosettacode.org/wiki/Execute_a_system_command#Ada few examples are given --Nasser ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Running programs using ADA 2012-11-30 8:00 ` Nasser M. Abbasi @ 2012-11-30 12:54 ` Hans Vlems 0 siblings, 0 replies; 13+ messages in thread From: Hans Vlems @ 2012-11-30 12:54 UTC (permalink / raw) On 30 nov, 09:00, "Nasser M. Abbasi" <n...@12000.org> wrote: > On 11/30/2012 1:56 AM, Hans Vlems wrote: > > > than C so I hope that ADA may help me here. More specifically: does > > ADA have support for a function similar to C's system()? > > > Example: > > > int main(void) > > { > > int retval; > > retval=system("copy h:\*.* g:\"); > > printf("return value %d\n",retval); > > return EXIT_SUCCESS; > > } > > yes. see > > http://rosettacode.org/wiki/Execute_a_system_command#Ada > > few examples are given > > --Nasser Now that is a very useful website! Thank you very much indeed, Nasser. Hans ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Running programs using ADA 2012-11-30 7:56 Running programs using ADA Hans Vlems 2012-11-30 8:00 ` Nasser M. Abbasi @ 2012-11-30 21:22 ` Per Sandberg 2012-12-01 9:33 ` Hans Vlems 2012-12-01 15:26 ` Anatoly Chernyshev 2 siblings, 1 reply; 13+ messages in thread From: Per Sandberg @ 2012-11-30 21:22 UTC (permalink / raw) Well the language wont help since this is an operating system issue, however the interfaces that you are allowed to use may be accesible from your application using libraries such as (GNAT.Expect or GNAT.OS_Lib) using Ada in gcc, or (ProcessBuilder) using java-SE or using fork in C or using module subprocess in python. The selection of implementation depends on the requirements.. /P On Thu, 29 Nov 2012 23:56:13 -0800 (PST) Hans Vlems <hvlems@freenet.de> wrote: > Our company will move its IT operation to another datacentre. The new > provider doesn't allow access to the command prompt (cmd.exe, it's a > Windows setup). We use aprox. 10 programs that are run from the > command prompt. All software is written in C; the compiler is mingw > (regularly updated). The first attempt was a program, in C, that shows > the user a menu. The user types a single digit and a program is run. > The C program relies on the system() function. > The problem is that the new environment uses Windows on a 64 bit > platform. mingw uses Microsoft's libraries and either I'm just too > dumb to understand that new stuff or system() is broken. > Now mingw also includes support for ADA. The last time I wrote > something in ADA was in 1984. Anyway, ADA looks a lot more like Algol > than C so I hope that ADA may help me here. More specifically: does > ADA have support for a function similar to C's system()? > > Example: > > int main(void) > { > int retval; > retval=system("copy h:\*.* g:\"); > printf("return value %d\n",retval); > return EXIT_SUCCESS; > } > > Regards, > Hans Vlems > > PS > the example lacks #include statements so won't compile ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Running programs using ADA 2012-11-30 21:22 ` Per Sandberg @ 2012-12-01 9:33 ` Hans Vlems 2012-12-01 11:20 ` Dmitry A. Kazakov 0 siblings, 1 reply; 13+ messages in thread From: Hans Vlems @ 2012-12-01 9:33 UTC (permalink / raw) On 30 nov, 22:22, Per Sandberg <per.sandb...@sandat.dyndns.org> wrote: > Well the language wont help since this is an operating system issue, > however the interfaces that you are allowed to use may be accesible > from your application using libraries such as (GNAT.Expect or > GNAT.OS_Lib) using Ada in gcc, or (ProcessBuilder) using java-SE or > using fork in C or using module subprocess in python. > > The selection of implementation depends on the requirements.. > > /P > > On Thu, 29 Nov 2012 23:56:13 -0800 (PST) > > > > Hans Vlems <hvl...@freenet.de> wrote: > > Our company will move its IT operation to another datacentre. The new > > provider doesn't allow access to the command prompt (cmd.exe, it's a > > Windows setup). We use aprox. 10 programs that are run from the > > command prompt. All software is written in C; the compiler is mingw > > (regularly updated). The first attempt was a program, in C, that shows > > the user a menu. The user types a single digit and a program is run. > > The C program relies on the system() function. > > The problem is that the new environment uses Windows on a 64 bit > > platform. mingw uses Microsoft's libraries and either I'm just too > > dumb to understand that new stuff or system() is broken. > > Now mingw also includes support for ADA. The last time I wrote > > something in ADA was in 1984. Anyway, ADA looks a lot more like Algol > > than C so I hope that ADA may help me here. More specifically: does > > ADA have support for a function similar to C's system()? > > > Example: > > > int main(void) > > { > > int retval; > > retval=system("copy h:\*.* g:\"); > > printf("return value %d\n",retval); > > return EXIT_SUCCESS; > > } > > > Regards, > > Hans Vlems > > > PS > > the example lacks #include statements so won't compile- Tekst uit oorspronkelijk bericht niet weergeven - > > - Tekst uit oorspronkelijk bericht weergeven - Hi Per, the language does help in this case. Because the mingw C compiler bindings rely on the libraries supplied by Microsoft. The systems I've got to work with have no support for the system() function. ADA can do without them and this allows me to run various command line programs (with several options) without the need to have access to cmd.exe (which is prohibited too). Hans ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Running programs using ADA 2012-12-01 9:33 ` Hans Vlems @ 2012-12-01 11:20 ` Dmitry A. Kazakov 2012-12-01 21:49 ` Hans Vlems 0 siblings, 1 reply; 13+ messages in thread From: Dmitry A. Kazakov @ 2012-12-01 11:20 UTC (permalink / raw) On Sat, 1 Dec 2012 01:33:14 -0800 (PST), Hans Vlems wrote: > the language does help in this case. > Because the mingw C compiler bindings rely on the libraries supplied > by Microsoft. > The systems I've got to work with have no support for the system() > function. > ADA can do without them and this allows me to run various command line > programs (with several options) without the need to have access to > cmd.exe (which is prohibited too). Strictly speaking Ada cannot do this. The standard Ada run-time library does not define any means to start a process for [good] reasons which are irrelevant here. Various existing solutions always rely on libraries, which are either compiler vendor-specific, like in the case of GNAT.OS_Lib, or OS-specific, e.g. Win32 bindings, or [sub]standard libraries providing functionality in a more or less OS-independent way, like POSIX , Glib, Qt. Note also that running processes is much more than merely spawning them. Usually you want to get the execution status, wait for completion, attach input/output/error pipes and so on. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Running programs using ADA 2012-12-01 11:20 ` Dmitry A. Kazakov @ 2012-12-01 21:49 ` Hans Vlems 2012-12-02 11:22 ` Brian Drummond 0 siblings, 1 reply; 13+ messages in thread From: Hans Vlems @ 2012-12-01 21:49 UTC (permalink / raw) On 1 dec, 12:20, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de> wrote: > On Sat, 1 Dec 2012 01:33:14 -0800 (PST), Hans Vlems wrote: > > the language does help in this case. > > Because the mingw C compiler bindings rely on the libraries supplied > > by Microsoft. > > The systems I've got to work with have no support for the system() > > function. > > ADA can do without them and this allows me to run various command line > > programs (with several options) without the need to have access to > > cmd.exe (which is prohibited too). > > Strictly speaking Ada cannot do this. The standard Ada run-time library > does not define any means to start a process for [good] reasons which are > irrelevant here. > > Various existing solutions always rely on libraries, which are either > compiler vendor-specific, like in the case of GNAT.OS_Lib, or OS-specific, > e.g. Win32 bindings, or [sub]standard libraries providing functionality in > a more or less OS-independent way, like POSIX , Glib, Qt. > > Note also that running processes is much more than merely spawning them. > Usually you want to get the execution status, wait for completion, attach > input/output/error pipes and so on. > > -- > Regards, > Dmitry A. Kazakovhttp://www.dmitry-kazakov.de Oh yes, I know it's outside the formal ADA language specification. My reference manual is quite old (Ledgard's book from 1983) and on multiprocessing it only mentions tasks. That would only work for me if I'd written everything in ADA in the first place. So that wasn't it. My VAX/VMS manuals for ADA didn't help either so therefore I asked here. The only programming language I know that has built-in support to run external programs and keep control over them is Burroughs extended algol. As the name implies, that language is tied to a hardware architecture and thus no option. I've tried the GNAT.OS_lib and it works perfectly well. All it needs to do is run a program and have it control terminal input and output. Once it stops (or crashes :) control returns to the ADA program and the user can select another option. Trivial, but very important for the small company I work for. Thanks for tour help, Hans ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Running programs using ADA 2012-12-01 21:49 ` Hans Vlems @ 2012-12-02 11:22 ` Brian Drummond 2012-12-03 7:56 ` Hans Vlems 0 siblings, 1 reply; 13+ messages in thread From: Brian Drummond @ 2012-12-02 11:22 UTC (permalink / raw) On Sat, 01 Dec 2012 13:49:23 -0800, Hans Vlems wrote: >> -- >> Regards, >> Dmitry A. Kazakovhttp://www.dmitry-kazakov.de > > Oh yes, I know it's outside the formal ADA language specification. My > reference manual is quite old (Ledgard's book from 1983) and on > multiprocessing it only mentions tasks. Oooh. Then do yourself a favour and get a newer Ada textbook - Ada is a much nicer language than it was when that book was written... - Brian ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Running programs using ADA 2012-12-02 11:22 ` Brian Drummond @ 2012-12-03 7:56 ` Hans Vlems 2012-12-03 12:03 ` Brian Drummond 0 siblings, 1 reply; 13+ messages in thread From: Hans Vlems @ 2012-12-03 7:56 UTC (permalink / raw) On 2 dec, 12:22, Brian Drummond <br...@shapes.demon.co.uk> wrote: > On Sat, 01 Dec 2012 13:49:23 -0800, Hans Vlems wrote: > >> -- > >> Regards, > >> Dmitry A. Kazakovhttp://www.dmitry-kazakov.de > > > Oh yes, I know it's outside the formal ADA language specification. My > > reference manual is quite old (Ledgard's book from 1983) and on > > multiprocessing it only mentions tasks. > > Oooh. Then do yourself a favour and get a newer Ada textbook - Ada is a > much nicer language than it was when that book was written... > > - Brian Brian, do you have a good suggestion for a current textbook on ADA? ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Running programs using ADA 2012-12-03 7:56 ` Hans Vlems @ 2012-12-03 12:03 ` Brian Drummond 2012-12-04 4:49 ` Randy Brukardt 0 siblings, 1 reply; 13+ messages in thread From: Brian Drummond @ 2012-12-03 12:03 UTC (permalink / raw) On Sun, 02 Dec 2012 23:56:26 -0800, Hans Vlems wrote: > On 2 dec, 12:22, Brian Drummond <br...@shapes.demon.co.uk> wrote: >> On Sat, 01 Dec 2012 13:49:23 -0800, Hans Vlems wrote: >> >> -- >> >> Regards, >> >> Dmitry A. Kazakovhttp://www.dmitry-kazakov.de >> >> > Oh yes, I know it's outside the formal ADA language specification. My >> > reference manual is quite old (Ledgard's book from 1983) and on >> > multiprocessing it only mentions tasks. >> >> Oooh. Then do yourself a favour and get a newer Ada textbook - Ada is a >> much nicer language than it was when that book was written... >> >> - Brian > > Brian, do you have a good suggestion for a current textbook on ADA? Up until last week, it would have been John Barnes : Programming in Ada-2005 ... but now I suppose we have to wait for him to write an Ada-2012 edition! Just jesting - the Barnes book is still solidly worthwhile and usually the first thing I turn to (I know, I should use the ARM more..) Cohen's "Ada as a second language" is also worthwhile though it is still based on Ada-95. The Ada Wikibook will help introducing object-oriented programming in Ada. Since you mention tasking, also look at protected types (new in Ada-95 for lightweight inter-task communication) http://en.wikibooks.org/wiki/Ada_Programming Any good sources on Ada-2012 yet? (apart from the ARM of course) - Brian ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Running programs using ADA 2012-12-03 12:03 ` Brian Drummond @ 2012-12-04 4:49 ` Randy Brukardt 0 siblings, 0 replies; 13+ messages in thread From: Randy Brukardt @ 2012-12-04 4:49 UTC (permalink / raw) "Brian Drummond" <brian@shapes.demon.co.uk> wrote in message news:k9i4dq$ari$1@dont-email.me... ... > Any good sources on Ada-2012 yet? (apart from the ARM of course) The only suggestion that I have is the partially completed Rationale: http://www.ada-auth.org/standards/rationale12.html Sometime soon after HILT I'll be adding another chapter to it. (I have to wait a month or so after they're published in the Ada User Journal before adding them to the online version.) John burned a lot of my time last month being confused about his next chapter; I had to write a number of lengthy e-mails to set him straight. You'll probably get to see that chapter in February or so. Randy. ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Running programs using ADA 2012-11-30 7:56 Running programs using ADA Hans Vlems 2012-11-30 8:00 ` Nasser M. Abbasi 2012-11-30 21:22 ` Per Sandberg @ 2012-12-01 15:26 ` Anatoly Chernyshev 2012-12-01 21:50 ` Hans Vlems 2 siblings, 1 reply; 13+ messages in thread From: Anatoly Chernyshev @ 2012-12-01 15:26 UTC (permalink / raw) As long as it is not an Ada question indeed, Far manager (www.farmanager.com) will save your day. It's a text-mode advanced NC clone, with its own command prompt. There are versions for both 32 and 64 bit Win. ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Running programs using ADA 2012-12-01 15:26 ` Anatoly Chernyshev @ 2012-12-01 21:50 ` Hans Vlems 0 siblings, 0 replies; 13+ messages in thread From: Hans Vlems @ 2012-12-01 21:50 UTC (permalink / raw) On 1 dec, 16:26, Anatoly Chernyshev <achernys...@gmail.com> wrote: > As long as it is not an Ada question indeed, Far manager (www.farmanager.com) will save your day. It's a text-mode advanced NC clone, with its own command prompt. There are versions for both 32 and 64 bit Win. I tried it and it is an interesting tool indeed. Though I'm sure it will confuse my users no end.... ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2012-12-05 6:14 UTC | newest] Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2012-11-30 7:56 Running programs using ADA Hans Vlems 2012-11-30 8:00 ` Nasser M. Abbasi 2012-11-30 12:54 ` Hans Vlems 2012-11-30 21:22 ` Per Sandberg 2012-12-01 9:33 ` Hans Vlems 2012-12-01 11:20 ` Dmitry A. Kazakov 2012-12-01 21:49 ` Hans Vlems 2012-12-02 11:22 ` Brian Drummond 2012-12-03 7:56 ` Hans Vlems 2012-12-03 12:03 ` Brian Drummond 2012-12-04 4:49 ` Randy Brukardt 2012-12-01 15:26 ` Anatoly Chernyshev 2012-12-01 21:50 ` Hans Vlems
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox