comp.lang.ada
 help / color / mirror / Atom feed
* What is the best way to get a process-list with Ada?
@ 2011-10-16 21:10 Shark8
  2011-10-16 23:21 ` anon
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Shark8 @ 2011-10-16 21:10 UTC (permalink / raw)


I got into a bit of a debate with a friend who said something to the
effect that to write drivers one needed to use C/C++... anyway, he was
irritated about not being able to use Java (which he's sort of been
forced to use in this instance) to 1) get a process list, and 2) get
window dimensions of a focused-window.

I was wondering how those of you who have had experience in all three
systems would approach it.

(BTW; Linux, Mac, and Windows for #1 & #2, which is the reason they
had for making the project Java, I certainly don't have enough
experience w/ Mac and Linux to say much about them.)



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: What is the best way to get a process-list with Ada?
  2011-10-16 21:10 What is the best way to get a process-list with Ada? Shark8
@ 2011-10-16 23:21 ` anon
  2011-10-17  9:33   ` Oliver Kleinke
  2011-10-19  0:47   ` Shark8
  2011-10-17  1:08 ` John B. Matthews
  2011-10-18 11:21 ` Stephen Leake
  2 siblings, 2 replies; 7+ messages in thread
From: anon @ 2011-10-16 23:21 UTC (permalink / raw)


Writing drivers are easy in any language except those which are 
interrupted like JAVA.

For "Java" you can bind like in Ada a small imported code that is 
wriiten in Assembly, C or any other compiled language. That would 
give you the way to include functions that he desires.

To use Ada for this type you must compile use the technique of 
no system. Ada specification will export the function. And a 
small java file will import the Ada function.

Its was back in the 1990's the last time I use native code with Java 
so this link might help:

  "Java Tip 23: Write native methods - JavaWorld"
  http://www.javaworld.com/javaworld/javatips/jw-javatip23.html

As for the actually routines just google for an example.


In <2cb6641e-dcd7-40de-95bd-71d405571631@p1g2000yqk.googlegroups.com>, Shark8 <onewingedshark@gmail.com> writes:
>I got into a bit of a debate with a friend who said something to the
>effect that to write drivers one needed to use C/C++... anyway, he was
>irritated about not being able to use Java (which he's sort of been
>forced to use in this instance) to 1) get a process list, and 2) get
>window dimensions of a focused-window.
>
>I was wondering how those of you who have had experience in all three
>systems would approach it.
>
>(BTW; Linux, Mac, and Windows for #1 & #2, which is the reason they
>had for making the project Java, I certainly don't have enough
>experience w/ Mac and Linux to say much about them.)




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: What is the best way to get a process-list with Ada?
  2011-10-16 21:10 What is the best way to get a process-list with Ada? Shark8
  2011-10-16 23:21 ` anon
@ 2011-10-17  1:08 ` John B. Matthews
  2011-10-18 11:21 ` Stephen Leake
  2 siblings, 0 replies; 7+ messages in thread
From: John B. Matthews @ 2011-10-17  1:08 UTC (permalink / raw)


In article 
<2cb6641e-dcd7-40de-95bd-71d405571631@p1g2000yqk.googlegroups.com>,
 Shark8 <onewingedshark@gmail.com> wrote:

> I got into a bit of a debate with a friend who said something to the 
> effect that to write drivers one needed to use C/C++... anyway, he 
> was irritated about not being able to use Java (which he's sort of 
> been forced to use in this instance) to 1) get a process list, and 2) 
> get window dimensions of a focused-window.
> 
> I was wondering how those of you who have had experience in all three 
> systems would approach it.
> 
> (BTW; Linux, Mac, and Windows for #1 & #2, which is the reason they 
> had for making the project Java, I certainly don't have enough 
> experience w/ Mac and Linux to say much about them.)

In Java, ProcessBuilder would let one examine the output of `ps`.
The options vary among BSD/Darwin/Mac and GNU/Linux flavors.
I'm not aware of a cross-platform solution.

<http://www.google.com/search?q=man+ps>

In Ada, I've always assumed I could use GNAT.Os_Lib to Spawn a
similar task, but I've never actually had to do so.

Sorry, no idea about windows I didn't create.

-- 
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: What is the best way to get a process-list with Ada?
  2011-10-16 23:21 ` anon
@ 2011-10-17  9:33   ` Oliver Kleinke
  2011-10-19  0:49     ` Shark8
  2011-10-19  0:47   ` Shark8
  1 sibling, 1 reply; 7+ messages in thread
From: Oliver Kleinke @ 2011-10-17  9:33 UTC (permalink / raw)


You can use Ada an Java together with either jGNAT (Ada and Java run on
the JVM)[1] and/or GNAT-AJIS (Java on JVM, Ada compiled natively)[2].
Be aware that jGNAT is not compatible with Java Versions > 1.5 (to my
knowledge). It is very possible to make OS-portable software
without Java.


--
[1] - http://ada.cx/PKV
[2] - http://ada.cx/kDK


> Shark8 <onewingedshark@gmail.com> writes:
> >I got into a bit of a debate with a friend who said something to the
> >effect that to write drivers one needed to use C/C++... anyway, he
> >was irritated about not being able to use Java (which he's sort of
> >been forced to use in this instance) to 1) get a process list, and
> >2) get window dimensions of a focused-window.
> >
> >I was wondering how those of you who have had experience in all three
> >systems would approach it.
> >
> >(BTW; Linux, Mac, and Windows for #1 & #2, which is the reason they
> >had for making the project Java, I certainly don't have enough
> >experience w/ Mac and Linux to say much about them.)





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: What is the best way to get a process-list with Ada?
  2011-10-16 21:10 What is the best way to get a process-list with Ada? Shark8
  2011-10-16 23:21 ` anon
  2011-10-17  1:08 ` John B. Matthews
@ 2011-10-18 11:21 ` Stephen Leake
  2 siblings, 0 replies; 7+ messages in thread
From: Stephen Leake @ 2011-10-18 11:21 UTC (permalink / raw)


Shark8 <onewingedshark@gmail.com> writes:

> I got into a bit of a debate with a friend who said something to the
> effect that to write drivers one needed to use C/C++... 

I use Ada for almost everything, but I write drivers for Lynx in C.

The reason is that the OS API is provided with C interface. I only need
a few functions from the OS API, and I keep the drivers as small as
possible (Lynx is efficient enough to let me do almost everything in
user code). Therefore writing and maintaining the Ada binding to the OS
API is not worth the effort. In addition, bug reports sent to support
will have to be rewritten in C

> anyway, he was irritated about not being able to use Java (which he's
> sort of been forced to use in this instance) to 1) get a process list,

This is not defined in any standard language that I'm aware of, so the
complaint is true of every language.

I guess you are saying "He could not find a Java binding to the OS
service that provides a process list". Finding a C binding is probably a
lot easier, since most OS APIs are provided in C.

> and 2) get window dimensions of a focused-window.

That's a typical operation in a GUI system; I'd be _very_ surprised if
the Java GUI packages on other OSs don't provide it. So again, it's a
matter of finding the binding to the necessary function.

-- 
-- Stephe



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: What is the best way to get a process-list with Ada?
  2011-10-16 23:21 ` anon
  2011-10-17  9:33   ` Oliver Kleinke
@ 2011-10-19  0:47   ` Shark8
  1 sibling, 0 replies; 7+ messages in thread
From: Shark8 @ 2011-10-19  0:47 UTC (permalink / raw)


On Oct 16, 6:21 pm, a...@att.net wrote:
> Writing drivers are easy in any language except those which are
> interrupted like JAVA.
>
> For "Java" you can bind like in Ada a small imported code that is
> wriiten in Assembly, C or any other compiled language. That would
> give you the way to include functions that he desires.
>
> To use Ada for this type you must compile use the technique of
> no system. Ada specification will export the function. And a
> small java file will import the Ada function.
>
> Its was back in the 1990's the last time I use native code with Java
> so this link might help:
>
>   "Java Tip 23: Write native methods - JavaWorld"
>  http://www.javaworld.com/javaworld/javatips/jw-javatip23.html
>
> As for the actually routines just google for an example.
>
> In <2cb6641e-dcd7-40de-95bd-71d405571...@p1g2000yqk.googlegroups.com>, Shark8 <onewingedsh...@gmail.com> writes:
>
>
>
>
>
>
>
> >I got into a bit of a debate with a friend who said something to the
> >effect that to write drivers one needed to use C/C++... anyway, he was
> >irritated about not being able to use Java (which he's sort of been
> >forced to use in this instance) to 1) get a process list, and 2) get
> >window dimensions of a focused-window.
>
> >I was wondering how those of you who have had experience in all three
> >systems would approach it.
>
> >(BTW; Linux, Mac, and Windows for #1 & #2, which is the reason they
> >had for making the project Java, I certainly don't have enough
> >experience w/ Mac and Linux to say much about them.)

Thank you for that pointer.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: What is the best way to get a process-list with Ada?
  2011-10-17  9:33   ` Oliver Kleinke
@ 2011-10-19  0:49     ` Shark8
  0 siblings, 0 replies; 7+ messages in thread
From: Shark8 @ 2011-10-19  0:49 UTC (permalink / raw)


On Oct 17, 4:33 am, Oliver Kleinke <oliver.klei...@c-01a.de> wrote:
> You can use Ada an Java together with either jGNAT (Ada and Java run on
> the JVM)[1] and/or GNAT-AJIS (Java on JVM, Ada compiled natively)[2].
> Be aware that jGNAT is not compatible with Java Versions > 1.5 (to my
> knowledge). It is very possible to make OS-portable software
> without Java.
>
> --
> [1] -http://ada.cx/PKV
> [2] -http://ada.cx/kDK
>
>
>
>
>
>
>
> > Shark8 <onewingedsh...@gmail.com> writes:
> > >I got into a bit of a debate with a friend who said something to the
> > >effect that to write drivers one needed to use C/C++... anyway, he
> > >was irritated about not being able to use Java (which he's sort of
> > >been forced to use in this instance) to 1) get a process list, and
> > >2) get window dimensions of a focused-window.
>
> > >I was wondering how those of you who have had experience in all three
> > >systems would approach it.
>
> > >(BTW; Linux, Mac, and Windows for #1 & #2, which is the reason they
> > >had for making the project Java, I certainly don't have enough
> > >experience w/ Mac and Linux to say much about them.)

Thank you for pointing me at the J-GNAT; I have played with it a
little, about a year and a half ago... but it seemed a bit quirky,
maybe because of how I was (ab)using it.



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-10-19  0:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-16 21:10 What is the best way to get a process-list with Ada? Shark8
2011-10-16 23:21 ` anon
2011-10-17  9:33   ` Oliver Kleinke
2011-10-19  0:49     ` Shark8
2011-10-19  0:47   ` Shark8
2011-10-17  1:08 ` John B. Matthews
2011-10-18 11:21 ` Stephen Leake

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox