comp.lang.ada
 help / color / mirror / Atom feed
* Is this a gnat problem?
@ 2019-02-19 18:22 lyttlec
  2019-02-19 18:33 ` Marek Kuziel
  2019-02-19 18:35 ` Egil H H
  0 siblings, 2 replies; 5+ messages in thread
From: lyttlec @ 2019-02-19 18:22 UTC (permalink / raw)


I'm working through the case study in "Analsable Real-Time Systems
Programming in Ada" by Burns & Wellings. So I'm not sure if this is my
not understanding something or gnat.
The following is extracted from the Cyclics package on page 471:

---
package Cyclics is

---

   task type Cyclic (S : Any_Cyclic_State) is
      with Priority => S.Pri;
   end Cyclic;
end Cyclics;

When compiled with gnat it fails with the following errors:

cyclics.ads:17:06: missing "end Cyclic;"
cyclics.ads:18:08: misspelling of "Cyclics"

The code compiles fine if changed to :

---
package Cyclics is

---

   task type Cyclic (S : Any_Cyclic_State) is
      pragma Priority (S.pri);
   end Cyclic;
end Cyclics;

The book code seems correct and I'm not sure if the modified code has
the effect intended in the text.
Can anyone help?


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Is this a gnat problem?
  2019-02-19 18:22 Is this a gnat problem? lyttlec
@ 2019-02-19 18:33 ` Marek Kuziel
  2019-02-19 18:35 ` Egil H H
  1 sibling, 0 replies; 5+ messages in thread
From: Marek Kuziel @ 2019-02-19 18:33 UTC (permalink / raw)


W dniu 19.02.2019 o 19:22, lyttlec pisze:
> I'm working through the case study in "Analsable Real-Time Systems
> Programming in Ada" by Burns & Wellings. So I'm not sure if this is my
> not understanding something or gnat.
> The following is extracted from the Cyclics package on page 471:
> 
> ---
> package Cyclics is
> 
> ---
> 
>     task type Cyclic (S : Any_Cyclic_State) is
>        with Priority => S.Pri;
>     end Cyclic;
> end Cyclics;
> 
> When compiled with gnat it fails with the following errors:
> 
> cyclics.ads:17:06: missing "end Cyclic;"
> cyclics.ads:18:08: misspelling of "Cyclics"
> 
> The code compiles fine if changed to :
> 
> ---
> package Cyclics is
> 
> ---
> 
>     task type Cyclic (S : Any_Cyclic_State) is
>        pragma Priority (S.pri);
>     end Cyclic;
> end Cyclics;
> 
> The book code seems correct and I'm not sure if the modified code has
> the effect intended in the text.
> Can anyone help?
> 
Maybe something like that:

package Cyclics is

---

    task type Cyclic (S : Any_Cyclic_State)
      with Priority => S.Pri
    is

    end Cyclic;
end Cyclics;

Marek

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Is this a gnat problem?
  2019-02-19 18:22 Is this a gnat problem? lyttlec
  2019-02-19 18:33 ` Marek Kuziel
@ 2019-02-19 18:35 ` Egil H H
  2019-02-19 20:31   ` Jeffrey R. Carter
  1 sibling, 1 reply; 5+ messages in thread
From: Egil H H @ 2019-02-19 18:35 UTC (permalink / raw)


On Tuesday, February 19, 2019 at 7:22:09 PM UTC+1, lyttlec wrote:
> 
> ---
> package Cyclics is
> 
> ---
> 
>    task type Cyclic (S : Any_Cyclic_State) is
>       with Priority => S.Pri;
>    end Cyclic;
> end Cyclics;
>
<snip>
> 
> The book code seems correct and I'm not sure if the modified code has
> the effect intended in the text.
> Can anyone help?

Aspect specifications for tasks/task types, should come before *is*, like so:

task type Cyclic (S : Any_Cyclic_State)
   with Priority => S.Pri
is
end Cyclic;



-- 
~egilhh

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Is this a gnat problem?
  2019-02-19 18:35 ` Egil H H
@ 2019-02-19 20:31   ` Jeffrey R. Carter
  2019-02-19 22:47     ` lyttlec
  0 siblings, 1 reply; 5+ messages in thread
From: Jeffrey R. Carter @ 2019-02-19 20:31 UTC (permalink / raw)


On 2/19/19 7:35 PM, Egil H H wrote:
> 
> Aspect specifications for tasks/task types, should come before *is*, like so:
> 
> task type Cyclic (S : Any_Cyclic_State)
>     with Priority => S.Pri
> is
> end Cyclic;

Yes, and a task type without entries doesn't need "is":

task type Cyclic (S : Any_Cyclic_State) with Priority => S.Pri;

-- 
Jeff Carter
"C++ is like jamming a helicopter inside a Miata
and expecting some sort of improvement."
Drew Olbrich
51

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Is this a gnat problem?
  2019-02-19 20:31   ` Jeffrey R. Carter
@ 2019-02-19 22:47     ` lyttlec
  0 siblings, 0 replies; 5+ messages in thread
From: lyttlec @ 2019-02-19 22:47 UTC (permalink / raw)


On 2/19/19 3:31 PM, Jeffrey R. Carter wrote:
> On 2/19/19 7:35 PM, Egil H H wrote:
>>
>> Aspect specifications for tasks/task types, should come before *is*,
>> like so:
>>
>> task type Cyclic (S : Any_Cyclic_State)
>>     with Priority => S.Pri
>> is
>> end Cyclic;
> 
> Yes, and a task type without entries doesn't need "is":
> 
> task type Cyclic (S : Any_Cyclic_State) with Priority => S.Pri;
> 
Well, Duh (Smacks forhead). My only excuse is that Burns & Wellings make
the same error several times.
Thanks, Guys.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-02-19 22:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-19 18:22 Is this a gnat problem? lyttlec
2019-02-19 18:33 ` Marek Kuziel
2019-02-19 18:35 ` Egil H H
2019-02-19 20:31   ` Jeffrey R. Carter
2019-02-19 22:47     ` lyttlec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox