I/O Port Access

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

I/O Port Access

highbeg
Hi everyone,

Is there a way to access a port (a parallel printer port) with Smalltalk?

In C I use ioperm (request permission), fcntl (open the port) and outb
(send a byte to the port), etc.

Thank you,

Gary
Reply | Threaded
Open this post in threaded view
|

Re: I/O Port Access

stes

I'm under the impression that when you write "Smalltalk" you mean "GNU Smalltalk".

As the wikipage https://en.wikipedia.org/wiki/GNU_Smalltalk explains:

"unlike other Smalltalk environments, uses text files for program input and interprets the contents as Smalltalk code. In this way, GNU Smalltalk acts more like an interpreter rather than an environment in the traditional Smalltalk manner."

There are some elements of a "language" in Smalltalk (the non GNU-Smalltalk products),
but also some elements of an "operating system" or "environment" in Smalltalk.

But as a simple start GNU Smalltalk you could "pipe" output of text-oriented Smalltalk programs,
to "lp" or "lpr" (UNIX commands).

I think that GNU Smalltalk also has some support for calling C functions from within Smalltalk.

If you really want to do low-level C programming from within GNU Smalltalk, that is ALSO possible.

And the reverse is also possible : calling Smalltalk from within C programs.

However I wonder whether to start, a simple "pipe" to "lp" would it be sufficient,
or can you explain in more detail what you are trying to do ?

David Stes

----- Op 17 jan 2021 om 0:40 schreef Gary Highberger [hidden email]:

> Hi everyone,
>
> Is there a way to access a port (a parallel printer port) with Smalltalk?
>
> In C I use ioperm (request permission), fcntl (open the port) and outb
> (send a byte to the port), etc.
>
> Thank you,
>
> Gary

Reply | Threaded
Open this post in threaded view
|

Re: I/O Port Access

highbeg
Hello David,

I'm not sure, in detail, what I'm going to do, but you've given me enough
to develop a broad outline. Many thanks!

My conclusions:

• GNU - Smalltalk isn't the place for low-level bit tinkering. It's
possible to do, but it sort of breaks the language.

• For now the plan is to handle the printer port in a C function, which
provides a text interface of some kind to GNU Smalltalk.

I'm developing a real-time control program written in GNU Smalltalk; and
yes, I'm totally worried about garbage collection.

The printer port isn't used to drive a printer at all. It's used (with
signal conditioning, etc.) to monitor and actuate real world devices. Email
me directly for more discussion on this.

Thanks for the help,

Gary



On Sun, Jan 17, 2021, 7:18 AM [hidden email] <[hidden email]> wrote:

>
> I'm under the impression that when you write "Smalltalk" you mean "GNU
> Smalltalk".
>
> As the wikipage https://en.wikipedia.org/wiki/GNU_Smalltalk explains:
>
> "unlike other Smalltalk environments, uses text files for program input
> and interprets the contents as Smalltalk code. In this way, GNU Smalltalk
> acts more like an interpreter rather than an environment in the traditional
> Smalltalk manner."
>
> There are some elements of a "language" in Smalltalk (the non
> GNU-Smalltalk products),
> but also some elements of an "operating system" or "environment" in
> Smalltalk.
>
> But as a simple start GNU Smalltalk you could "pipe" output of
> text-oriented Smalltalk programs,
> to "lp" or "lpr" (UNIX commands).
>
> I think that GNU Smalltalk also has some support for calling C functions
> from within Smalltalk.
>
> If you really want to do low-level C programming from within GNU
> Smalltalk, that is ALSO possible.
>
> And the reverse is also possible : calling Smalltalk from within C
> programs.
>
> However I wonder whether to start, a simple "pipe" to "lp" would it be
> sufficient,
> or can you explain in more detail what you are trying to do ?
>
> David Stes
>
> ----- Op 17 jan 2021 om 0:40 schreef Gary Highberger
> [hidden email]:
>
> > Hi everyone,
> >
> > Is there a way to access a port (a parallel printer port) with Smalltalk?
> >
> > In C I use ioperm (request permission), fcntl (open the port) and outb
> > (send a byte to the port), etc.
> >
> > Thank you,
> >
> > Gary
>
Reply | Threaded
Open this post in threaded view
|

Re: I/O Port Access

stes

----- Op 17 jan 2021 om 20:30 schreef Gary Highberger [hidden email]:
> The printer port isn't used to drive a printer at all. It's used (with
> signal conditioning, etc.) to monitor and actuate real world devices. Email
> me directly for more discussion on this.
>
> Thanks for the help,
>
> Gary

OK thanks for clarifying.

Because I read "parallel printer port", I thought you were going to use
ioperm (request permission), fcntl (open the port) and outb
(send a byte to the port) to print a file.

That's why I thought using "lp" or "lpr" would be easier.

But anyway as I also wrote it is possible to look at the GNU smalltalk
C interface possibilities which may be interesting to you ...