* RE: LONG POST - ObjectAda 7.1 Special Edition - how do I use my o wn packages?
@ 2001-11-05 22:01 Beard, Frank
2001-11-05 22:42 ` LONG POST - ObjectAda 7.1 Special Edition - how do I use my own packages? Axeplyr
0 siblings, 1 reply; 4+ messages in thread
From: Beard, Frank @ 2001-11-05 22:01 UTC (permalink / raw)
To: 'comp.lang.ada@ada.eu.org'
In this particular case, it is not a package visibility problem.
The procedure MoveCursor has two arguments in the spec:
PROCEDURE MoveCursor (Column : Width; Row : Depth);
But, in the body it has no arguments:
PROCEDURE MoveCursor IS
It should be:
PROCEDURE MoveCursor (Column : Width; Row : Depth) IS
Hence, the compile error:
> screen.adb: Error: line 32 col 1 LRM:3.11.1(6), Completion required for
> specification 'MoveCursor', Continuing
Frank
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: LONG POST - ObjectAda 7.1 Special Edition - how do I use my own packages? 2001-11-05 22:01 LONG POST - ObjectAda 7.1 Special Edition - how do I use my o wn packages? Beard, Frank @ 2001-11-05 22:42 ` Axeplyr 0 siblings, 0 replies; 4+ messages in thread From: Axeplyr @ 2001-11-05 22:42 UTC (permalink / raw) Thanks, Frank. I figured that out a little while ago when I double-checked my code with the book. DUH! I guess I learned a pretty good lesson that time - Thanks for all your help, John "Beard, Frank" <beardf@spawar.navy.mil> wrote in message news:mailman.1004997729.7738.comp.lang.ada@ada.eu.org... > In this particular case, it is not a package visibility problem. > The procedure MoveCursor has two arguments in the spec: > > PROCEDURE MoveCursor (Column : Width; Row : Depth); > > But, in the body it has no arguments: > > PROCEDURE MoveCursor IS > > It should be: > > PROCEDURE MoveCursor (Column : Width; Row : Depth) IS > > Hence, the compile error: > > > screen.adb: Error: line 32 col 1 LRM:3.11.1(6), Completion required for > > specification 'MoveCursor', Continuing > > Frank > > ^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: ObjectAda 7.1 Special Edition - how do I use my own packages? @ 2001-11-05 17:46 Beard, Frank 2001-11-05 21:15 ` LONG POST - " Axeplyr 0 siblings, 1 reply; 4+ messages in thread From: Beard, Frank @ 2001-11-05 17:46 UTC (permalink / raw) To: 'comp.lang.ada@ada.eu.org' If you're familiar with Windows tools, many, if not most, use a "project" concept. With OA, you first create a project (using "File/New Project" as SteveD said), then add files to it using the "Project/Files/Add..." option. If you are creating a brand new file, use the "File/New File" option to create the file. Once you're to the point where you want to compile it, you must first save it ("File/Save"), then add it to your project ("Project/Files/Add..."), and then you can compile it. I hope this makes more since. Frank PS. Steve, OA SE's are just like OA Professionals, but with limits on the number of packages, or units per library, etc., and minus some additional packages and bindings. The IDE and GUI Builder work exactly the same. -----Original Message----- From: Axeplyr [mailto:john.fluetter@aixtra.de] Sent: Saturday, November 03, 2001 12:52 PM To: comp.lang.ada@ada.eu.org Subject: Re: ObjectAda 7.1 Special Edition - how do I use my own packages? Ok, so if I type in a package spec and body that he has in the text, I need to create a project that uses them, then compile, build and execute the entire thing? I don't need to precompile them? The book indicates that you must compile the specification file, then the body file before you can use them. I'll give it a try and get back - thanks for the help! John ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: LONG POST - ObjectAda 7.1 Special Edition - how do I use my own packages? 2001-11-05 17:46 Beard, Frank @ 2001-11-05 21:15 ` Axeplyr 2001-11-05 22:12 ` Axeplyr 0 siblings, 1 reply; 4+ messages in thread From: Axeplyr @ 2001-11-05 21:15 UTC (permalink / raw) Well, I still haven't figured it out. I have no problems creating simple projects and adding files to the project. I've used MS Visual C++ for a couple of years now, and understand the Windows "project" concept of building apps. Let me provide an example. Let's say I wish to type in a package (from my textbook) called the "Screen" package. This screen package is a VERY basic 2-d graphics package that allows me to move the cursor around on the screen, etc. I need to create a specification file and a body file (code below). So I start by creating a screen project. So, I type in the specification file, and I type in the body file (code below). I save them both. I add them both to the project, and save the project. Now, I need to compile them both - first the screen specification file, then the body file. This is where I get lost. My problem is that I can't seem to get the body file to know where the specification file is. Maybe I don't know how to name these. Similar packages in the Aonix library would lead me to believe that I could call them screen.ads and screen.adb, but that doesn't work. I've tried screen.spc and screen.bdy also. I can compile the specification file no problem. I've called it Screen.ada, Screen.spc, and Screen.ads. In any case, it works fine. Then, try to compile the body file, and receive an error. Both files are in the project. But I receive the following errors: screen.adb: Error: line 26 col 41 LRM:4.1(3), Direct name, Row, is not visible, Ignoring future references screen.adb: Error: line 28 col 41 LRM:4.1(3), Direct name, Column, is not visible, Ignoring future references screen.adb: Error: line 32 col 1 LRM:3.11.1(6), Completion required for specification 'MoveCursor', Continuing Front end of ..\screen.adb failed with 3 errors. (0 Warnings) Tool execution failed. Perhaps if I provide the code, someone can try it and tell me if they have success: - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Here is the code for file screen.ads: - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PACKAGE Screen IS -- constants: the # of rows, cols on terminal Screen_Depth : CONSTANT Integer := 24; Screen_Width : CONSTANT Integer := 80; -- subtypes giving ranges of acceptable inputs -- to the cursor positioning operation SUBTYPE Depth IS Integer RANGE 1..Screen_Depth; SUBTYPE Width IS Integer RANGE 1..Screen_Width; PROCEDURE Beep; -- Pre: None -- Post: Terminal beeps once PROCEDURE ClearScreen; -- Pre: None -- Post: Terminal Screen is cleared PROCEDURE MoveCursor (Column : Width; Row : Depth); -- Pre: Column and row have been assigned in-range values -- Post: Cursor is moved to the given spot on the screen END Screen; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Here is the code for file screen.adb : - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ WITH Ada.Text_IO; WITH Ada.Integer_Text_IO; PACKAGE BODY Screen IS PROCEDURE Beep IS BEGIN Ada.Text_IO.Put (Item=> ASCII.BEL); END Beep; PROCEDURE ClearScreen IS BEGIN Ada.Text_IO.Put (Item=> ASCII.ESC); Ada.Text_IO.Put (Item=> "[2j"); END ClearScreen; PROCEDURE MoveCursor IS BEGIN Ada.Text_IO.Put (Item=> ASCII.ESC); Ada.Text_IO.Put ("["); Ada.Integer_Text_IO.Put (Item=> Row, Width => 1); Ada.Text_IO.Put (';'); Ada.Integer_Text_IO.Put (Item=> Column, Width => 1); Ada.Text_IO.Put (Item=> 'f'); END MoveCursor; END Screen; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Sorry for the long post, but I think everyone understands my problem now! 8^) John "Beard, Frank" <beardf@spawar.navy.mil> wrote in message news:mailman.1004982492.1947.comp.lang.ada@ada.eu.org... > If you're familiar with Windows tools, many, if not most, > use a "project" concept. With OA, you first create a > project (using "File/New Project" as SteveD said), then > add files to it using the "Project/Files/Add..." option. > If you are creating a brand new file, use the "File/New File" > option to create the file. Once you're to the point where > you want to compile it, you must first save it ("File/Save"), > then add it to your project ("Project/Files/Add..."), and > then you can compile it. > > I hope this makes more since. > > Frank > > PS. > Steve, OA SE's are just like OA Professionals, but with limits > on the number of packages, or units per library, etc., and minus > some additional packages and bindings. The IDE and GUI Builder > work exactly the same. > > -----Original Message----- > From: Axeplyr [mailto:john.fluetter@aixtra.de] > Sent: Saturday, November 03, 2001 12:52 PM > To: comp.lang.ada@ada.eu.org > Subject: Re: ObjectAda 7.1 Special Edition - how do I use my own > packages? > > > Ok, so if I type in a package spec and body that he has in the text, I need > to create a project that uses them, then compile, build and execute the > entire thing? I don't need to precompile them? > > The book indicates that you must compile the specification file, then the > body file before you can use them. > > I'll give it a try and get back - thanks for the help! > > John > ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: LONG POST - ObjectAda 7.1 Special Edition - how do I use my own packages? 2001-11-05 21:15 ` LONG POST - " Axeplyr @ 2001-11-05 22:12 ` Axeplyr 0 siblings, 0 replies; 4+ messages in thread From: Axeplyr @ 2001-11-05 22:12 UTC (permalink / raw) Never mind - I figured out the problem!!!! :-o I had a damn SYNTAX ERROR. The whole time, I thought it was some sort of procedural error - turns out it was a typo. I left out the decllarations of my function declaration for PROCEDURE MoveCursor. Well, thanks for all of the input you guys gave me, sorry I took up your time... Later, John "Axeplyr" <john.fluetter@aixtra.de> wrote in message news:3be70163@194.121.123.2... > Well, I still haven't figured it out. > > I have no problems creating simple projects and adding files to the project. > I've used MS Visual C++ for a couple of years now, and understand the > Windows "project" concept of building apps. > > Let me provide an example. Let's say I wish to type in a package (from my > textbook) called the "Screen" package. This screen package is a VERY basic > 2-d graphics package that allows me to move the cursor around on the screen, > etc. I need to create a specification file and a body file (code below). > So I start by creating a screen project. > > So, I type in the specification file, and I type in the body file (code > below). I save them both. > > I add them both to the project, and save the project. > > Now, I need to compile them both - first the screen specification file, then > the body file. > > This is where I get lost. > > My problem is that I can't seem to get the body file to know where the > specification file is. Maybe I don't know how to name these. Similar > packages in the Aonix library would lead me to believe that I could call > them screen.ads and screen.adb, but that doesn't work. I've tried > screen.spc and screen.bdy also. > > I can compile the specification file no problem. I've called it Screen.ada, > Screen.spc, and Screen.ads. In any case, it works fine. Then, try to > compile the body file, and receive an error. Both files are in the project. > But I receive the following errors: > > screen.adb: Error: line 26 col 41 LRM:4.1(3), Direct name, Row, is not > visible, Ignoring future references > screen.adb: Error: line 28 col 41 LRM:4.1(3), Direct name, Column, is not > visible, Ignoring future references > screen.adb: Error: line 32 col 1 LRM:3.11.1(6), Completion required for > specification 'MoveCursor', Continuing > Front end of ..\screen.adb failed with 3 errors. (0 Warnings) > Tool execution failed. > > Perhaps if I provide the code, someone can try it and tell me if they have > success: > > - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Here is the code for file screen.ads: > - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > PACKAGE Screen IS > > -- constants: the # of rows, cols on terminal > > Screen_Depth : CONSTANT Integer := 24; > Screen_Width : CONSTANT Integer := 80; > > -- subtypes giving ranges of acceptable inputs > -- to the cursor positioning operation > > SUBTYPE Depth IS Integer RANGE 1..Screen_Depth; > SUBTYPE Width IS Integer RANGE 1..Screen_Width; > > PROCEDURE Beep; > -- Pre: None > -- Post: Terminal beeps once > > PROCEDURE ClearScreen; > -- Pre: None > -- Post: Terminal Screen is cleared > > PROCEDURE MoveCursor (Column : Width; Row : Depth); > -- Pre: Column and row have been assigned in-range values > -- Post: Cursor is moved to the given spot on the screen > > END Screen; > > - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Here is the code for file screen.adb : > - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > WITH Ada.Text_IO; > WITH Ada.Integer_Text_IO; > PACKAGE BODY Screen IS > > PROCEDURE Beep IS > BEGIN > Ada.Text_IO.Put (Item=> ASCII.BEL); > END Beep; > > PROCEDURE ClearScreen IS > BEGIN > Ada.Text_IO.Put (Item=> ASCII.ESC); > Ada.Text_IO.Put (Item=> "[2j"); > END ClearScreen; > > PROCEDURE MoveCursor IS > BEGIN > Ada.Text_IO.Put (Item=> ASCII.ESC); > Ada.Text_IO.Put ("["); > Ada.Integer_Text_IO.Put (Item=> Row, Width => 1); > Ada.Text_IO.Put (';'); > Ada.Integer_Text_IO.Put (Item=> Column, Width => 1); > Ada.Text_IO.Put (Item=> 'f'); > END MoveCursor; > > END Screen; > - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Sorry for the long post, but I think everyone understands my problem now! > 8^) > > John > > "Beard, Frank" <beardf@spawar.navy.mil> wrote in message > news:mailman.1004982492.1947.comp.lang.ada@ada.eu.org... > > If you're familiar with Windows tools, many, if not most, > > use a "project" concept. With OA, you first create a > > project (using "File/New Project" as SteveD said), then > > add files to it using the "Project/Files/Add..." option. > > If you are creating a brand new file, use the "File/New File" > > option to create the file. Once you're to the point where > > you want to compile it, you must first save it ("File/Save"), > > then add it to your project ("Project/Files/Add..."), and > > then you can compile it. > > > > I hope this makes more since. > > > > Frank > > > > PS. > > Steve, OA SE's are just like OA Professionals, but with limits > > on the number of packages, or units per library, etc., and minus > > some additional packages and bindings. The IDE and GUI Builder > > work exactly the same. > > > > -----Original Message----- > > From: Axeplyr [mailto:john.fluetter@aixtra.de] > > Sent: Saturday, November 03, 2001 12:52 PM > > To: comp.lang.ada@ada.eu.org > > Subject: Re: ObjectAda 7.1 Special Edition - how do I use my own > > packages? > > > > > > Ok, so if I type in a package spec and body that he has in the text, I > need > > to create a project that uses them, then compile, build and execute the > > entire thing? I don't need to precompile them? > > > > The book indicates that you must compile the specification file, then the > > body file before you can use them. > > > > I'll give it a try and get back - thanks for the help! > > > > John > > > > ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2001-11-05 22:42 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2001-11-05 22:01 LONG POST - ObjectAda 7.1 Special Edition - how do I use my o wn packages? Beard, Frank 2001-11-05 22:42 ` LONG POST - ObjectAda 7.1 Special Edition - how do I use my own packages? Axeplyr -- strict thread matches above, loose matches on Subject: below -- 2001-11-05 17:46 Beard, Frank 2001-11-05 21:15 ` LONG POST - " Axeplyr 2001-11-05 22:12 ` Axeplyr
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox