Of course, I can't just type 'dcl <declarator>' as the code as shown
doesn't allow for parsing an argument - none of the functions takes
any parameters and my C isn't yet up to modifying the code to allow
that.
Would any of the C gurus out there be able illustrate how this might
be done because I think this program is potentially a great learning
tool?
TIA
Is it the same dcl program as the one from this URL ?
http://www.java-samples.com/showtutorial.php?tutorialid=543
That program reads from standard input.
Just type ``dcl'' without arguments at the command line, and then,
while the program is running, type the declarations you want to have
explained, one per line.
> In article
>
<4d7228c7-549b-4d0e...@z23g2000prd.googlegroups.com>,
> <paolor...@gmail.com> wrote:
<snip>
>>
>>Of course, I can't just type 'dcl <declarator>' as the code as
>>shown doesn't allow for parsing an argument - none of the
>>functions takes any parameters and my C isn't yet up to modifying
>>the code to allow that.
>>
>>Would any of the C gurus out there be able illustrate how this
>>might be done because I think this program is potentially a great
>>learning tool?
>
> Is it the same dcl program as the one from this URL ?
>
> http://www.java-samples.com/showtutorial.php?tutorialid=543
>
> That program reads from standard input.
> Just type ``dcl'' without arguments at the command line, and then,
> while the program is running, type the declarations you want to
> have explained, one per line.
I think he's asking about how to modify it so that it /does/ take
arguments at the command line - argc, argv and all that. I took a
quick look - the high level stuff is simple enough, but I don't
have the time right now to write a string-chomping version of
gettoken().
--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Ike: that's the one. I didn't realise that you had to have the program
running to get explanations. In fact doing it this way is better than
what I had in mind. My way would have required executing the program
with each declaration. Thanks.
Richard: as Ike has explained I need to get the program running BEFORE
entering declarations and once running I can enter multiple
declarations which is a better model than the one I had in mind.
> On May 1, 5:09 pm, Richard Heathfield <r...@see.sig.invalid>
> wrote:
>> Ike Naar said:
>>
<snip>
>>
>> > That program reads from standard input.
>> > Just type ``dcl'' without arguments at the command line, and
>> > then, while the program is running, type the declarations you
>> > want to have explained, one per line.
>>
>> I think he's asking about how to modify it so that it /does/ take
>> arguments at the command line - argc, argv and all that. I took a
>> quick look - the high level stuff is simple enough, but I don't
>> have the time right now to write a string-chomping version of
>> gettoken().
>>
> Richard: as Ike has explained I need to get the program running
> BEFORE entering declarations and once running I can enter multiple
> declarations which is a better model than the one I had in mind.
See? I can be wrong too. Why, I remember a time back in 1974...
>As a new C learner, I'm coming up against the 'complicated
>declarations' problem i.e. identifying what certain declarations mean.
>So, reading K&R 2nd edition, I came across Section 5.12 Complicated
>Declarations, and thought that the dcl program and its associated
>functions were just what I needed i.e. type 'dcl <declarator>' and a
>word description would pop out. So I have typed in and compiled all
>the code shown (dcl, dirdcl, gettoken etc. as shown on pp. 122-126)
>and called the file dcl.c
>
>Of course, I can't just type 'dcl <declarator>' as the code as shown
>doesn't allow for parsing an argument - none of the functions takes
>any parameters and my C isn't yet up to modifying the code to allow
>that.
The reason the functions don't accept arguments or return values is
that they all use global variables defined at the bottom of page 124
for communication. There is no reason to change the program for that.
There are no prompts for input but if you invoke the program and then
type in a declaration you should get a response.
>
>Would any of the C gurus out there be able illustrate how this might
>be done because I think this program is potentially a great learning
>tool?
>
>TIA
--
Remove del for email