From 921c55968caacb72aca963dfb4c1ced8b3b5fe0d Mon Sep 17 00:00:00 2001 From: dtrg Date: Sat, 21 Apr 2007 23:19:32 +0000 Subject: [PATCH] Adapted to tell the user what language they were written in (because they're too similar!). Modified the Pascal implementation to work with our new syscall model. --- examples/hilo.b | 2 +- examples/hilo.c | 2 +- examples/hilo.mod | 2 +- examples/hilo.ocm | 2 +- examples/hilo.p | 12 +++++++----- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/examples/hilo.b b/examples/hilo.b index 7493b971b..bdde01eab 100644 --- a/examples/hilo.b +++ b/examples/hilo.b @@ -2,7 +2,7 @@ 2 ' $State$ 3 ' $Revision$ -10 print "Hi there! Before we start, what is your name?" +10 print "Hi there! I'm written in Basic. Before we start, what is your name?" 20 input "> ", PlayerName$ 30 print 40 print "Hello, "; PlayerName$; "!" diff --git a/examples/hilo.c b/examples/hilo.c index 21b407335..c5e599251 100644 --- a/examples/hilo.c +++ b/examples/hilo.c @@ -59,7 +59,7 @@ void game(void) int main(int argc, char* argv[]) { - printf("\nHi there! Before we start, what is your name?\n"); + printf("\nHi there! I'm written in C. Before we start, what is your name?\n"); reads(); strcpy(PlayerName, buffer); printf("\nHello, %s! ", PlayerName); diff --git a/examples/hilo.mod b/examples/hilo.mod index 7711f738b..11f494c7b 100644 --- a/examples/hilo.mod +++ b/examples/hilo.mod @@ -66,7 +66,7 @@ VAR finished : BOOLEAN; BEGIN WriteLn; - WriteString("Hi there! Before we start, what is your name?"); + WriteString("Hi there! I'm written in Modula-2. Before we start, what is your name?"); WriteLn; reads; WriteLn; diff --git a/examples/hilo.ocm b/examples/hilo.ocm index 85bafaa20..7af29a5ca 100644 --- a/examples/hilo.ocm +++ b/examples/hilo.ocm @@ -56,7 +56,7 @@ proc random(value range, var result) = proc getname = var seed, buffer[128]: seq - puts("*nHi there! Before we start, what is your name?*n") + puts("*nHi there! I'm written in Occam. Before we start, what is your name?*n") puts("> ") gets(buffer) diff --git a/examples/hilo.p b/examples/hilo.p index e316b46c5..b13bbd1a0 100644 --- a/examples/hilo.p +++ b/examples/hilo.p @@ -29,10 +29,12 @@ function random(range : integer) : integer; random := seed mod range; end; -{ Pascal doesn't provide string input, so we interface to the _read() syscall - and do it manually. } +{ Pascal doesn't provide string input, so we interface to the read() syscall + and do it manually. But... we can't interface to read() directly because + that conflicts with a Pascal keyword. Luckily there's a private function + uread() in the ACK Pascal library that we can use instead. } -function _read(fd : integer; var buffer : char; count : integer) : integer; +function uread(fd : integer; var buffer : char; count : integer) : integer; extern; function readchar : char; @@ -42,7 +44,7 @@ function readchar : char; begin c := chr(0); - dummy := _read(0, c, 1); + dummy := uread(0, c, 1); readchar := c; end; @@ -79,7 +81,7 @@ procedure getname; begin writeln; - writeln('Hi there! Before we start, what is your name?'); + writeln('Hi there! I''m written in Pascal. Before we start, what is your name?'); writeln; readstring(name, namelen); writeln; -- 2.34.1