Re: Coming From QBasic
cc.ex:3
Graphics_Mode has not been declared
Graphics_Mode (260)
^
=============================================================
include ..\..\Include\graphics.e
Graphics_Mode (260)
print (1, 768 / 8)
=============================================================
-- Euphoria 2.5
-- Graphics & Sound Routines
-- GRAPHICS MODES -- argument to graphics_mode()
-- mode description
-- ---- -----------
-- -1 restore to original default mode
-- 0 40 x 25 text, 16 grey
-- 1 40 x 25 text, 16/8 color
-- 2 80 x 25 text, 16 grey
-- 3 80 x 25 text, 16/8 color
-- 4 320 x 200, 4 color
-- 5 320 x 200, 4 grey
-- 6 640 x 200, BW
-- 7 80 x 25 text, BW
-- 11 720 x 350, BW (many video cards are lacking this one)
-- 13 320 x 200, 16 color
-- 14 640 x 200, 16 color
-- 15 640 x 350, BW (may be 4-color with blinking)
-- 16 640 x 350, 4 or 16 color
-- 17 640 x 480, BW
-- 18 640 x 480, 16 color
-- 19 320 x 200, 256 color
-- 256 640 x 400, 256 color (some cards are missing this one)
-- 257 640 x 480, 256 color (some cards are missing this one)
-- 258 800 x 600, 16 color
-- 259 800 x 600, 256 color
-- 260 1024 x 768, 16 color
-- 261 1024 x 768, 256 color
-- COLOR values -- for characters and pixels
global constant
BLACK = 0, -- in graphics modes this is "transparent"
GREEN = 2,
MAGENTA = 5,
WHITE = 7,
GRAY = 8,
BRIGHT_GREEN = 10,
BRIGHT_MAGENTA = 13,
BRIGHT_WHITE = 15
global integer
BLUE, CYAN, RED, BROWN, BRIGHT_BLUE, BRIGHT_CYAN, BRIGHT_RED,
YELLOW
=============================================================
I'm trying to port a simple program. The program's simplicity {I thought}
would allow me to get a feel for the language. But it's not working out.
To me, this information is somewhat ambiguous. It's ambiguous becuase it
appears clear, yet something's not working. Could it be the file cc.ex
needs something more? Could it be the call to the subroutine isn't correct?
I don't know. I really don't.
Love & Friendship & Blessed Be!
Lynn Erika Kilroy
>From: Jason Gade <guest at RapidEuphoria.com>
>Reply-To: EUforum at topica.com
>To: EUforum at topica.com
>Subject: Re: Coming From QBasic
>Date: Tue, 17 Jan 2006 08:57:41 -0800
>
>
>posted by: Jason Gade <jaygade at yahoo.com>
>
>Lynn Kilroy wrote:
> >
> > How would I know something was declared at the right time in the
>include=
> >
> > file?
>
>If it is declared before it is used.
>
> > I've looked in those files, and the subroutines, AKA procedures, wer=
> > e
> > in apparently random order. What's more, the code doesn't look as neat
>as=
> >
> > it could to me. Mebbe I'm just a finiky coder. For example, in my
> > Graphics.E file, there appears to me some variable definitions {a def
>type=
> >
> > statement, I think} near the bottom of the file. Is this a normal
> > procedure? Or is it a sign that the file is corrupted?
>
>Looking at my copy of graphics.e I see the following:
>
>}}}
<eucode>
>type frequency(integer x)
> return x >= 0
>end type
>
>global procedure sound(frequency f)
>-- turn on speaker at frequency f
>-- turn off speaker if f is 0
> machine_proc(M_SOUND, f)
>end procedure
></eucode>
{{{
>
>What this is doing is defining a type called frequency. This is a function
>that returns a value. Because it is defined as a 'type', the interpreter
>also calls it to validate a value declared as a 'frequency'. What it does
>is to ensure that its input is greater than zero. If it is, it returns true
>or one (same thing in Euphoria). Else it returns false or zero.
>
>If you make a call
>z = frequency(x)
>then it checks if x is greater than zero and sets z to one or zero
>accordingly.
>
>However it you do this:
>frequency f -- declare variable f to be a frequency
>f = -100 -- program will fail with a typecheck error
>
>It is supposed to help you debug or catch errors in your program.
>
>'frequency' is declared where it is because it is only used by the 'sound'
>procedure immediately following it. Since frequency is not declared as
>'global' it cannot be used outside of graphics.e. But since sound *is*
>declared as global it will be visible to any file that has the statement
>include graphics.e
>in it.
>
>Make sense?
>
>--
>
>Have you tried running the examples? Can you tell us what kind of error you
>are getting?
>
>I understand you are comparing Euphoria to QBasic and trying to match up
>what you know in order to learn what Euphoria provides. But I don't
>understand your problems exactly.
>
>Not trying to be unfriendly!
>
>--
>"Actually, I'm sitting on my butt staring at a computer screen."
> - Tom Tomorrow
>
>j.
>
>
>
>
|
Not Categorized, Please Help
|
|