Discussion:
newbie question
(too old to reply)
bart stes
2005-01-10 13:47:48 UTC
Permalink
Hey guys,

I'm pretty new to programming in Oberon. For a course i'm taking I have to
interact with the user through the keyboard. (i.e. the users communicates
with the application through the keyboard) It is a text based app, so no
forms or anything.
We can only use the (educational) In en Out modules. How can I read from the
keyboard?
Cuz when I use :

In.Open;
In.String(name);

or something like that...the system isn't waiting for text to be inputted,
heck I don't even know where it would be supposed to be inputted.
The Out.String functions just write to the log.

So how am I supposed to read in things from the keyboard?

Thanks a bunch,

A confused one
j***@yahoo.com
2005-01-10 15:54:42 UTC
Permalink
Post by bart stes
Hey guys,
I'm pretty new to programming in Oberon. For a course i'm taking I have to
interact with the user through the keyboard. (i.e. the users
communicates
Post by bart stes
with the application through the keyboard) It is a text based app, so no
forms or anything.
We can only use the (educational) In en Out modules. How can I read from the
keyboard?
In.Open;
In.String(name);
or something like that...the system isn't waiting for text to be inputted,
heck I don't even know where it would be supposed to be inputted.
The Out.String functions just write to the log.
So how am I supposed to read in things from the keyboard?
Thanks a bunch,
A confused one
From your post I'm guessing that you're using one of the "classic"
Oberon systems such as System 3 or V4. (It would help if you
specified).
If you were using POW it would give you a prompt and wait.

Anyway, the Oberon Operating system is completely "modeless" so it
doesn't "wait". Have you played around with executing commands?
Oberon uses a text based user interface (TUI) so it picks up
arguments directly from the document or "text" that you're working
in.

Here's an example.

MODULE Hello;

IMPORT In, Out;

PROCEDURE Do*;
VAR
name : ARRAY 20 OF CHAR;
BEGIN
In.Open;
In.String(name);
Out.String(name); Out.Ln();
END Do;
END Hello.

Hello.Do "Bart" ~

If you click on "HelloWorld.Do" it will read "Bart" in from the text
and print it in the log.

Here's another example.

MODULE Demo;
IMPORT In, Out;

PROCEDURE Sum*;
VAR
a, b : INTEGER;

BEGIN
In.Open;
In.Int(a);
In.Int(b);
Out.Int(a, 2); Out.String(" + "); Out.Int(b, 2); Out.String(" = ");
Out.Int(a+b, 2); Out.Ln();
END Sum;
END Demo.

Demo.Sum 5 7 ~

Hope that helps.

Regards,

John M. Drake
thiagoat
2005-03-17 20:32:29 UTC
Permalink
Please, in the Oberon language, which would be the object allocation,
binding, the variancia of types and its generic programming.

Thank you.
News.Individual.DE
2005-01-11 07:58:31 UTC
Permalink
Hi,
There is a quite unusual change in the behaviour of programmes if you
change from say PASCAL to OBERON.
In PASCAL a read or readln stops the program execution and you have to
input something via the keyboard.
When I started in OBERON it took me quite some time until I found out how
to input anything. Now it seems to be absolutely natural. The reason is a
shift in programme behaviour. An Oberon programme executes when started
and you are supposed to have provided all information in advance. It is
like filling in a bank transaction on screen, whatever you write is taken
and executed, if you do not provide any information the blank form will be
transmitted.
Similar in OBERON: When you want to input any information you have to
write it into the programme window (underneath the END <modulename>.) Then
you have to mark (highlight) this text and execute your command procedure.
The highlighted string will then be read by In.String(<argument>) into
<argument> and is available for the rest of the programme. This way of
input is similar for other types of course, In.Int or In.Char work
likewise.
Hope this will help
Harro von Lavergne
www.lahini.de
Post by bart stes
Hey guys,
I'm pretty new to programming in Oberon. For a course i'm taking I have to
interact with the user through the keyboard. (i.e. the users communicates
with the application through the keyboard) It is a text based app, so no
forms or anything.
We can only use the (educational) In en Out modules. How can I read from the
keyboard?
In.Open;
In.String(name);
or something like that...the system isn't waiting for text to be inputted,
heck I don't even know where it would be supposed to be inputted.
The Out.String functions just write to the log.
So how am I supposed to read in things from the keyboard?
Thanks a bunch,
A confused one
Ulrich
2005-01-15 10:24:32 UTC
Permalink
Post by News.Individual.DE
Hi,
There is a quite unusual change in the behaviour of programmes if you
change from say PASCAL to OBERON.
In PASCAL a read or readln stops the program execution and you have to
input something via the keyboard.
When I started in OBERON it took me quite some time until I found out
how to input anything. Now it seems to be absolutely natural. The
reason is a shift in programme behaviour. An Oberon programme executes
when started and you are supposed to have provided all information in
advance. It is like filling in a bank transaction on screen, whatever
you write is taken and executed, if you do not provide any information
the blank form will be transmitted.
Similar in OBERON: When you want to input any information you have to
write it into the programme window (underneath the END <modulename>.)
Then you have to mark (highlight) this text and execute your command
procedure. The highlighted string will then be read by
In.String(<argument>) into <argument> and is available for the rest of
the programme. This way of input is similar for other types of course,
In.Int or In.Char work likewise.
Hope this will help
Harro von Lavergne
www.lahini.de
Hallo Harro

Deine Erklärung wird sicher etwas nützen, aber - rein technisch
betrachtet - scheint sie mir nicht ganz schlüssig. Meiner Meinung nach
ist es wichtig, zwischen Oberon-System und der Sprache zu unterscheiden.
Abgesehen davon, dass es inzwischen auch andere Sprachen als Oberon
innerhalb von Oberon-Systemen gibt, hängt die Art, wie man die
Benutzerinteraktion programmieren kann, stark davon ab, in welcher
Umgebung sie angeboten wird.

Da es doch einige stark voneinander abweichende Implementationen der
Sprache Oberon und ebensolche Oberon-Systeme gibt, wäre es gut, wenn
jemand, der um Hilfe bittet, bekannt gibt, welche Umgebung er einsetzt.
Ich verwende meist das ObSys-V4, welches demjenigen im Buch "The Oberon
System" beschriebenen stark ähnelt und in dem es auch Routinen gibt, um
direkt von der Tastatur einzulesen wie in vielen
kommandozeilenorientierten Pascal-Implementationen.

Die von Dir angegebene Möglichkeit, alle Parameter in einer Textsicht
bereitzustellen und dann auf einen Schlag von einer Routine lesen zu
lassen, funktioniert in ObSys-V4, ist dort allerdings nicht auf eine
spezielle Platzierung der Parameter beschränkt, wie Du sie vorschlägst.

Generell kann man sagen, dass die Eingabemethode weder vom ObSys noch
von der Sprache festgelegt ist. Sowohl innerhalb des ObSys als auch
außerhalb (aber mit der Sprache Oberon) lassen sich sowohl zustandslose
als auch -gebundene Formen der Benutzerschnittstelle programmieren.

Besten Dank für Deinen Beitrag zur Oberon-Gemeinschaft!
Andy Ball
2005-04-08 16:12:18 UTC
Permalink
Hello Harro,

HvL> Similar in OBERON: When you want to input any
information you have to write it into the programme
window (underneath the END <modulename>.) Then you
have to mark (highlight) this text and execute your
command procedure. The highlighted string will then
be read by In.String(<argument>) into <argument> and
is available for the rest of the programme.
If I have defined argument to be an array of (say) 20
characters, and the marked text is longer than that, would
the array simply be filled with the first 20 characters of
the marked text?

- Andy Ball
Ulrich
2005-04-10 06:47:01 UTC
Permalink
Post by Andy Ball
If I have defined argument to be an array of (say) 20
characters, and the marked text is longer than that, would
the array simply be filled with the first 20 characters of
the marked text?
Das kann man nicht generell mit Ja oder Nein beantworten - es hängt vom Programm ab. Es ist problemlos möglich, nur einen Teil
der Parameter zu verarbeiten. Konkret wäre es aber unwahrscheinlich, dass 20 Zeichen benutzt würden, denn das letzte Zeichen
einer Zeichenkettenvariablen ist 0X.

Wenn man nicht die Quellen studieren will, kann man im Buch "The Oberon System" von Reiser Martin lesen, wie Kommandoparameter
analysiert werden.

Aubrey McIntosh
2005-01-13 14:55:20 UTC
Permalink
Hi Bart,

I thought on your request a bit, and I decided these things:

1. You are using BlackBox component builder, Educational edition, on
some windows machine.
2. "Text based app" means you have a viewer with some text in it.
3. "interact through the keyboard" does not mean "capture the keyboard."
4. You don't grok the idea of having all input in place first, then
committing an action second, that is common to all Oberon descended systems.

All of the Oberon related systems use innovative approach to the user
interface. Most of us who are active in this group really like the
interface, and were willing to explore and learn the system from the
documentation that is provided with it. Our advice will largely be
consistent with that.

5. I will publish one solution, as I understand the problem. Please
download the file:

http://aubrey.vima.austin.tx.us/BStes.Package1.txt

6. As a condition for this help, I want to learn where you are
studying, so that we can know who else is using BlackBox for instruction.
Post by bart stes
Hey guys,
I'm pretty new to programming in Oberon. For a course i'm taking I have to
interact with the user through the keyboard. (i.e. the users communicates
with the application through the keyboard) It is a text based app, so no
forms or anything.
We can only use the (educational) In en Out modules. How can I read from the
keyboard?
In.Open;
In.String(name);
or something like that...the system isn't waiting for text to be inputted,
heck I don't even know where it would be supposed to be inputted.
The Out.String functions just write to the log.
So how am I supposed to read in things from the keyboard?
Thanks a bunch,
A confused one
Continue reading on narkive:
Loading...