| re: code in C
On Friday 17 March 2006 22:01, vicky opined (in
<11883$441b3193$3ec2b950$8272@news.chello.nl>):
[color=blue]
> Hello,
>
> As, I am new to the C-language, I was trying to find out this piece of
> code, without any comments. Would anyone around here can give me some
> idea what this code is doing.[/color]
It is impossible to tell that unless you provide details of all the
various macros, data types, and functions used.
Without that, the only thing that can be said is:
[color=blue]
> static const associative_array register_names = {
>
> ASSOCIATIVE_ARRAY_END
>
> };[/color]
This declares a variable `register_names`, which is of the type
`associative_array`, it is constant, and local to the compilation unit.
[color=blue]
> void SwitchOn(pvhVoid adr) {
>
> #ifndef HARDWARE
>
> SwitchSetReg(BASE, 0x0010, 0x0000, 0x0001) ;
>
> #else
>
> vhPrintfMessage("push the button ...\n");
>
> #endif
>
> }[/color]
This is a function that, depending on whether HARDWARE is defined or
not, calls a function `SwitchSetReg` or `vhPrintfMessage`. The latter
presumably outputs the string somewhere.
[color=blue]
> void SwitchSetIntRelease(pvhVoid adr) {
>
> #ifndef HARDWARE
>
> SwitchSetReg(BASE, 0x0010, 0x0000, 0x0000) ;
>
> #else
>
> vhPrintfMessage("Release button ...\n");
>
> #endif
>
> }[/color]
And same here...
[color=blue]
> Very thankful for any help.[/color]
I doubt this was much help. I'd suggest looking for documentation of the
system this came from.
--
BR, Vladimir
For large values of one, one equals two, for small values of two. |